Message ID | 20220103114515.24020-2-carwynellis@gmail.com |
---|---|
State | New |
Headers | show |
Series | Show/hide the menu bar in fullscreen on mouse | expand |
On 2022/01/03 20:45, Carwyn Ellis wrote: > 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. > > Signed-off-by: Carwyn Ellis <carwynellis@gmail.com> > --- > ui/cocoa.m | 8 ++++++-- > 1 file changed, 6 insertions(+), 2 deletions(-) > > diff --git a/ui/cocoa.m b/ui/cocoa.m > index 69745c483b..42dcf47da4 100644 > --- a/ui/cocoa.m > +++ b/ui/cocoa.m > @@ -1037,7 +1037,9 @@ QemuCocoaView *cocoaView; > { > 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 > @@ -1052,7 +1054,9 @@ QemuCocoaView *cocoaView; > { > 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 [QemuCocoaView -toggleFullscreen:] also has the calls to [NSMenu setMenuBarVisible:], which should be removed. Regards, Akihiko Odaki
Thanks, taking a look now and will push up another patch once I’ve tested the changes. Regards Carwyn > On 18 Feb 2022, at 18:42, Akihiko Odaki <akihiko.odaki@gmail.com> wrote: > > On 2022/01/03 20:45, Carwyn Ellis wrote: >> 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. >> Signed-off-by: Carwyn Ellis <carwynellis@gmail.com> >> --- >> ui/cocoa.m | 8 ++++++-- >> 1 file changed, 6 insertions(+), 2 deletions(-) >> diff --git a/ui/cocoa.m b/ui/cocoa.m >> index 69745c483b..42dcf47da4 100644 >> --- a/ui/cocoa.m >> +++ b/ui/cocoa.m >> @@ -1037,7 +1037,9 @@ QemuCocoaView *cocoaView; >> { >> 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 >> @@ -1052,7 +1054,9 @@ QemuCocoaView *cocoaView; >> { >> 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 > > [QemuCocoaView -toggleFullscreen:] also has the calls to [NSMenu setMenuBarVisible:], which should be removed. > > Regards, > Akihiko Odaki
diff --git a/ui/cocoa.m b/ui/cocoa.m index 69745c483b..42dcf47da4 100644 --- a/ui/cocoa.m +++ b/ui/cocoa.m @@ -1037,7 +1037,9 @@ QemuCocoaView *cocoaView; { 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 @@ -1052,7 +1054,9 @@ QemuCocoaView *cocoaView; { 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
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. Signed-off-by: Carwyn Ellis <carwynellis@gmail.com> --- ui/cocoa.m | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)