mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-05-30 13:30:37 +00:00
Menu handling fixes
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@5700 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
66353787d4
commit
fb77d815b2
4 changed files with 110 additions and 42 deletions
|
@ -535,9 +535,9 @@ static NSString *NSMenuLocationsKey = @"NSMenuLocations";
|
|||
|
||||
- (NSPoint) locationForSubmenu: (NSMenu*)aSubmenu
|
||||
{
|
||||
NSRect frame;
|
||||
NSRect submenuFrame;
|
||||
NSWindow *win_link;
|
||||
NSRect frame;
|
||||
NSRect submenuFrame;
|
||||
NSWindow *win_link;
|
||||
|
||||
if (![self isFollowTransient])
|
||||
{
|
||||
|
@ -1016,9 +1016,11 @@ static NSString *NSMenuLocationsKey = @"NSMenuLocations";
|
|||
[titleView _releaseCloseButton];
|
||||
}
|
||||
|
||||
- (void) _rightMouseDisplay
|
||||
- (void) _rightMouseDisplay: (NSEvent*)theEvent
|
||||
{
|
||||
// TODO: implement this method.
|
||||
[self displayTransient];
|
||||
[menu_view mouseDown: theEvent];
|
||||
[self closeTransient];
|
||||
}
|
||||
|
||||
- (void) display
|
||||
|
@ -1085,12 +1087,27 @@ static NSString *NSMenuLocationsKey = @"NSMenuLocations";
|
|||
|
||||
menu_follow_transient = YES;
|
||||
|
||||
// Cache the old submenu if any.
|
||||
_oldAttachedMenu = menu_supermenu->menu_attachedMenu;
|
||||
menu_supermenu->menu_attachedMenu = self;
|
||||
/*
|
||||
* Cache the old submenu if any and query the supermenu our position.
|
||||
* Otherwise, raise menu under the mouse.
|
||||
*/
|
||||
if (menu_supermenu != nil)
|
||||
{
|
||||
_oldAttachedMenu = menu_supermenu->menu_attachedMenu;
|
||||
menu_supermenu->menu_attachedMenu = self;
|
||||
location = [menu_supermenu locationForSubmenu: self];
|
||||
}
|
||||
else
|
||||
{
|
||||
NSRect frame = [aWindow frame];
|
||||
|
||||
// Query the supermenu our position.
|
||||
location = [menu_supermenu locationForSubmenu: self];
|
||||
location = [aWindow mouseLocationOutsideOfEventStream];
|
||||
location = [aWindow convertBaseToScreen: location];
|
||||
location.x -= frame.size.width/2;
|
||||
if (location.x < 0)
|
||||
location.x = 0;
|
||||
location.y -= frame.size.height - 10;
|
||||
}
|
||||
|
||||
[bWindow setFrameOrigin: location];
|
||||
|
||||
|
@ -1144,15 +1161,16 @@ static NSString *NSMenuLocationsKey = @"NSMenuLocations";
|
|||
|
||||
[[aWindow contentView] setNeedsDisplay: YES];
|
||||
|
||||
// Restore the old submenu.
|
||||
menu_supermenu->menu_attachedMenu = _oldAttachedMenu;
|
||||
// Restore the old submenu (if any).
|
||||
if (menu_supermenu != nil)
|
||||
menu_supermenu->menu_attachedMenu = _oldAttachedMenu;
|
||||
|
||||
menu_follow_transient = NO;
|
||||
|
||||
menu_isPartlyOffScreen = IS_OFFSCREEN(aWindow);
|
||||
}
|
||||
|
||||
- (NSWindow *) window
|
||||
- (NSWindow*) window
|
||||
{
|
||||
if (menu_follow_transient)
|
||||
return (NSWindow *)bWindow;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue