mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-05-30 22:50:37 +00:00
Improvements for menu in window
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@31857 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
b7d5dadadd
commit
285febd6c4
2 changed files with 38 additions and 3 deletions
|
@ -1,3 +1,10 @@
|
|||
2011-01-08 German Arias <german@xelalug.org>
|
||||
|
||||
* Source/NSMenuView.m (-trackWithEvent:):
|
||||
Close the menu in window if user press a modifier key.
|
||||
And improvements for don't lose the mouse tracking
|
||||
in a menu in window.
|
||||
|
||||
2011-01-06 German Arias <german@xelalug.org>
|
||||
|
||||
* Source/NSMenuView.m (-locationForSubmenu:, -trackWithEvent:):
|
||||
|
|
|
@ -1427,6 +1427,7 @@ static NSMapTable *viewInfo = 0;
|
|||
int delayCount = 0;
|
||||
int indexOfActionToExecute = -1;
|
||||
int firstIndex = -1;
|
||||
int space = 0;
|
||||
NSEvent *original;
|
||||
NSEventType type;
|
||||
NSEventType end;
|
||||
|
@ -1458,6 +1459,14 @@ static NSMapTable *viewInfo = 0;
|
|||
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
|
||||
{
|
||||
|
@ -1484,6 +1493,17 @@ static NSMapTable *viewInfo = 0;
|
|||
}
|
||||
do
|
||||
{
|
||||
/*Close the menu if the user press a modifier key and menu
|
||||
is in a window*/
|
||||
if (NSInterfaceStyleForKey(@"NSMenuInterfaceStyle", self) ==
|
||||
NSWindows95InterfaceStyle && type == NSFlagsChanged)
|
||||
{
|
||||
[self setHighlightedItemIndex: -1];
|
||||
[[[[NSApp mainWindow] menu] attachedMenu] close];
|
||||
shouldFinish = YES;
|
||||
return NO;
|
||||
}
|
||||
|
||||
if (type == end)
|
||||
{
|
||||
shouldFinish = YES;
|
||||
|
@ -1628,9 +1648,17 @@ static NSMapTable *viewInfo = 0;
|
|||
{
|
||||
if ([self hitTest: location] == nil)
|
||||
{
|
||||
[[[[NSApp mainWindow] menu] attachedMenu] close];
|
||||
shouldFinish = YES;
|
||||
return NO;
|
||||
/*This gives us time to move the cursor between a menu and
|
||||
its submenu (or vice versa) without lose the mouse
|
||||
tracking*/
|
||||
space += 1;
|
||||
|
||||
if (space == 2)
|
||||
{
|
||||
[[[[NSApp mainWindow] menu] attachedMenu] close];
|
||||
shouldFinish = YES;
|
||||
return NO;
|
||||
}
|
||||
}
|
||||
|
||||
if (self != [[[NSApp mainWindow] menu] menuRepresentation])
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue