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:
espectador 2013-09-27 07:47:01 +00:00
parent 7baaaf9425
commit 054851fa01
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> 2013-09-26 German Arias <germanandre@gmx.es>
* Source/GSThemeMenu.m (-displayPopUpMenu:withCellFrame:...): Revert * Source/GSThemeMenu.m (-displayPopUpMenu:withCellFrame:...): Revert

View file

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