mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-04-23 15:11:37 +00:00
* Source/NSMenuView.m (-_trackWithEvent:): Fix for the bug where
the highlighted menu item can be offset from the mouse pointer location when menu windows are moved by the window manager. See detailed comment in the code for more info. git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@33508 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
74e522c0c2
commit
56bf8c17be
2 changed files with 40 additions and 5 deletions
|
@ -1,3 +1,10 @@
|
|||
2011-07-10 Eric Wasylishen <ewasylishen@gmail.com>
|
||||
|
||||
* Source/NSMenuView.m (-_trackWithEvent:): Fix for the bug where
|
||||
the highlighted menu item can be offset from the mouse pointer
|
||||
location when menu windows are moved by the window manager. See
|
||||
detailed comment in the code for more info.
|
||||
|
||||
2011-07-10 Eric Wasylishen <ewasylishen@gmail.com>
|
||||
|
||||
* Source/GSGhostscriptImageRep.m: Remove hardcoded path to gs
|
||||
|
|
|
@ -1456,6 +1456,26 @@ static NSMapTable *viewInfo = 0;
|
|||
|
||||
type = [event type];
|
||||
|
||||
/**
|
||||
* The following event tracking run loop can run for a long time, during
|
||||
* which new windows (for submenus) are created and put on screen. The
|
||||
* window manager might not place the menus where we ask them to be placed
|
||||
* (e.g. Metacity will move menus so they don't overlap the GNOME
|
||||
* top-of-screen panel).
|
||||
*
|
||||
* The mechanism which updates an NSWindow's frame when an external force
|
||||
* (such as the window manager) moves a window is an NSAppKitDefined event.
|
||||
* Since we need the frames of the menu windows to be accurate to know which
|
||||
* menu item the cursor is actually over, and since we are running our own
|
||||
* event loop and the NSAppKitDefined events aren't handled for us, we need
|
||||
* to request them ourselves and forward them to the relevant window.
|
||||
*
|
||||
* NOTE: While it seems messy to have to handle these events, Cocoa doesn't
|
||||
* handle them automatically either for code which goes in to an event
|
||||
* tracking loop.
|
||||
*/
|
||||
eventMask |= NSAppKitDefinedMask;
|
||||
|
||||
eventMask |= NSRightMouseUpMask | NSRightMouseDraggedMask;
|
||||
eventMask |= NSRightMouseDownMask;
|
||||
eventMask |= NSOtherMouseUpMask | NSOtherMouseDraggedMask;
|
||||
|
@ -1689,11 +1709,19 @@ static NSMapTable *viewInfo = 0;
|
|||
lastLocation = location;
|
||||
}
|
||||
|
||||
event = [NSApp nextEventMatchingMask: eventMask
|
||||
untilDate: theDistantFuture
|
||||
inMode: NSEventTrackingRunLoopMode
|
||||
dequeue: YES];
|
||||
type = [event type];
|
||||
do
|
||||
{
|
||||
event = [NSApp nextEventMatchingMask: eventMask
|
||||
untilDate: theDistantFuture
|
||||
inMode: NSEventTrackingRunLoopMode
|
||||
dequeue: YES];
|
||||
type = [event type];
|
||||
if (type == NSAppKitDefined)
|
||||
{
|
||||
[[event window] sendEvent: event];
|
||||
}
|
||||
}
|
||||
while (type == NSAppKitDefined);
|
||||
}
|
||||
while ((type != NSLeftMouseUp &&
|
||||
type != NSRightMouseUp &&
|
||||
|
|
Loading…
Reference in a new issue