* Source/NSMenuView.m: Allow any mouse up (left/right/other)

to choose a menu item.


git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@33435 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Eric Wasylishen 2011-07-03 06:47:41 +00:00
parent 04342f72c6
commit 1bc738ec3e
2 changed files with 35 additions and 35 deletions

View file

@ -1,3 +1,14 @@
2011-07-03 Eric Wasylishen <ewasylishen@gmail.com>
* Source/NSMenuView.m: Allow any mouse up (left/right/other)
to choose a menu item.
2011-07-02 Eric Wasylishen <ewasylishen@gmail.com>
* Source/NSTextView.m (-_updateState:): Invalidate cursor rects
so the cursor rects over links, for example, are updated when
text is edited.
2011-07-03 Fred Kiefer <FredKiefer@gmx.de>
* Source/NSLayoutManager.m (-drawGlyphsForGlyphRange:atPoint:,

View file

@ -1445,7 +1445,6 @@ static NSMapTable *viewInfo = 0;
int firstIndex = -1;
NSEvent *original;
NSEventType type;
NSEventType end;
/*
* The original event is unused except to determine whether the method
@ -1457,40 +1456,21 @@ static NSMapTable *viewInfo = 0;
type = [event type];
if (type == NSRightMouseDown || type == NSRightMouseDragged)
eventMask |= NSRightMouseUpMask | NSRightMouseDraggedMask;
eventMask |= NSRightMouseDownMask;
eventMask |= NSOtherMouseUpMask | NSOtherMouseDraggedMask;
eventMask |= NSOtherMouseDownMask;
eventMask |= NSLeftMouseUpMask | NSLeftMouseDraggedMask;
eventMask |= NSLeftMouseDownMask;
/*We need know if the user press a modifier key to close the menu
when the menu is in a window*/
if (NSInterfaceStyleForKey(@"NSMenuInterfaceStyle", self) ==
NSWindows95InterfaceStyle)
{
end = NSRightMouseUp;
eventMask |= NSRightMouseUpMask | NSRightMouseDraggedMask;
eventMask |= NSRightMouseDownMask;
eventMask |= NSFlagsChangedMask;
}
else if (type == NSOtherMouseDown || type == NSOtherMouseDragged)
{
end = NSOtherMouseUp;
eventMask |= NSOtherMouseUpMask | NSOtherMouseDraggedMask;
eventMask |= NSOtherMouseDownMask;
}
else if (type == NSLeftMouseDown || type == NSLeftMouseDragged)
{
end = NSLeftMouseUp;
eventMask |= NSLeftMouseUpMask | NSLeftMouseDraggedMask;
eventMask |= NSLeftMouseDownMask;
/*We need know if the user press a modifier key to close the menu
when the menu is in a window*/
if (NSInterfaceStyleForKey(@"NSMenuInterfaceStyle", self) ==
NSWindows95InterfaceStyle)
{
eventMask |= NSFlagsChangedMask;
}
}
else
{
NSLog (@"Unexpected event: %d during event tracking in NSMenuView", type);
end = NSLeftMouseUp;
eventMask |= NSLeftMouseUpMask | NSLeftMouseDraggedMask;
eventMask |= NSLeftMouseDownMask;
}
/* We attempt to mimic Mac OS X behavior for pop up menus. If the user
presses the mouse button over a pop up button and then drags the mouse
over the menu, the menu is closed when the user releases the mouse. On the
@ -1518,7 +1498,9 @@ static NSMapTable *viewInfo = 0;
return NO;
}
if (type == end)
if (type == NSLeftMouseUp ||
type == NSRightMouseUp ||
type == NSOtherMouseUp)
{
shouldFinish = YES;
}
@ -1713,7 +1695,9 @@ static NSMapTable *viewInfo = 0;
dequeue: YES];
type = [event type];
}
while (type != end || shouldFinish == NO);
while ((type != NSLeftMouseUp &&
type != NSRightMouseUp &&
type != NSOtherMouseUp) || shouldFinish == NO);
/*
* Ok, we released the mouse
@ -1873,6 +1857,11 @@ static NSMapTable *viewInfo = 0;
[self mouseDown: theEvent];
}
- (void) otherMouseDown: (NSEvent*) theEvent
{
[self mouseDown: theEvent];
}
- (BOOL) performKeyEquivalent: (NSEvent *)theEvent
{
return [_attachedMenu performKeyEquivalent: theEvent];