ui/cocoa: show/hide menu in fullscreen on mouse
v2 cover ui/cocoa: show/hide menu in fullscreen on mouse
Minor change to make fullscreen mode in the Cocoa UI a little more convenient.
The menu bar is now made visible when the mouse is released (ungrabbed) making it accessible without having to leave fullscreen mode. Grabbing the mouse hides the menu.
Incorporates changes in response to feedback from Akihiko Odaki.
Carwyn Ellis (1):
ui/cocoa: show/hide menu in fullscreen on mouse ungrab/grab
ui/cocoa.m | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-)
Signature · 1 line
2.35.1
PATCH v2 1/1 ui/cocoa: show/hide menu in fullscreen on mouse ungrab/grab
The menu bar is only accessible when the Cocoa UI is windowed. In order to allow the menu bar to be accessible in fullscreen mode, this change makes the menu visible when the mouse is ungrabbed.
When the mouse is grabbed the menu is hidden again.
Incorporates changes in response to review feedback from Akihiko Odaki.
--- ui/cocoa.m | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-)
ui/cocoa.m +6 -4
@@ -656,13 +656,11 @@ - (void) toggleFullScreen:(id)sender [fullScreenWindow close]; [normalWindow setContentView: self]; [normalWindow makeKeyAndOrderFront: self]; - [NSMenu setMenuBarVisible:YES]; } else { // switch from desktop to fullscreen isFullscreen = TRUE; [normalWindow orderOut: nil]; /* Hide the window */ [self grabMouse]; [self setContentDimensions]; - [NSMenu setMenuBarVisible:NO]; fullScreenWindow = [[NSWindow alloc] initWithContentRect:[[NSScreen mainScreen] frame] styleMask:NSWindowStyleMaskBorderless backing:NSBackingStoreBuffered
@@ -1141,7 +1139,9 @@ - (void) grabMouse { COCOA_DEBUG("QemuCocoaView: grabMouse\n"); - if (!isFullscreen) { + if (isFullscreen) { + [NSMenu setMenuBarVisible: FALSE]; + } else { if (qemu_name) [normalWindow setTitle:[NSString stringWithFormat:@"QEMU %s - (Press ctrl + alt + g to release Mouse)", qemu_name]]; else
@@ -1156,7 +1156,9 @@ - (void) ungrabMouse { COCOA_DEBUG("QemuCocoaView: ungrabMouse\n"); - if (!isFullscreen) { + if (isFullscreen) { + [NSMenu setMenuBarVisible: TRUE]; + } else { if (qemu_name) [normalWindow setTitle:[NSString stringWithFormat:@"QEMU %s", qemu_name]]; else
Signature · 1 line
2.35.1