Close popup if user press a modifier flag an theme process events.

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@37158 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Germán Arias 2013-09-27 07:47:01 +00:00
parent 4877916592
commit 2decccabe0
2 changed files with 28 additions and 10 deletions

View file

@ -1,3 +1,9 @@
2013-09-27 German Arias <germanandre@gmx.es>
* Source/NSMenuView.m (- _trackWithEvent:startingMenuView:): If menu
is owned by a popup and theme process events, close it if user press
a modifier key.
2013-09-26 German Arias <germanandre@gmx.es>
* Source/GSThemeMenu.m (-displayPopUpMenu:withCellFrame:...): Revert

View file

@ -1451,6 +1451,7 @@ static NSMapTable *viewInfo = 0;
BOOL justAttachedNewSubmenu = NO;
BOOL subMenusNeedRemoving = YES;
BOOL shouldFinish = YES;
BOOL popUpProcessEvents = [[GSTheme theme] doesProcessEventsForPopUpMenu];
int delayCount = 0;
int indexOfActionToExecute = -1;
int firstIndex = -1;
@ -1496,9 +1497,10 @@ static NSMapTable *viewInfo = 0;
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 (style == NSWindows95InterfaceStyle)
/* We need know if the user press a modifier key to close the menu
when the menu is in a window or when is owned by a popup and theme
process events. */
if (style == NSWindows95InterfaceStyle || popUpProcessEvents)
{
eventMask |= NSFlagsChangedMask;
}
@ -1513,7 +1515,7 @@ static NSMapTable *viewInfo = 0;
the other hand, when the user clicks on the button and then moves the
mouse the menu is closed upon the next mouse click. */
([[self menu] _ownedByPopUp] && (style == NSMacintoshInterfaceStyle ||
[[GSTheme theme] doesProcessEventsForPopUpMenu])))
popUpProcessEvents)))
{
/*
* Ignore the first mouse up if nothing interesting has happened.
@ -1522,13 +1524,23 @@ static NSMapTable *viewInfo = 0;
}
do
{
/* Close the menu if the user press a modifier key and menu
is in a window */
if (mainWindowMenuView != nil && type == NSFlagsChanged)
if (type == NSFlagsChanged)
{
[self setHighlightedItemIndex: -1];
[[[mainWindowMenuView menu] attachedMenu] close];
return NO;
/* Close the menu if the user press a modifier key and menu
is in a window */
if (mainWindowMenuView != nil)
{
[self setHighlightedItemIndex: -1];
[[[mainWindowMenuView menu] attachedMenu] close];
return NO;
}
/* Close the menu if is owned by a popup and theme process events */
if ([[self menu] _ownedByPopUp] && popUpProcessEvents)
{
[[[self menu] _owningPopUp] dismissPopUp];
return NO;
}
}
if (type == NSLeftMouseUp ||