Skip to contentSkip to conversation

Show/hide the menu bar in fullscreen on mouse

PATCH Superseded Carwyn Ellis 2 participants 4 messages Jan 3, 2022 – Apr 10, 2022

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

cover Show/hide the menu bar 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.

Carwyn Ellis (1):
ui/cocoa: show/hide menu in fullscreen on mouse ungrab/grab

 ui/cocoa.m | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)
Signature · 1 line
2.34.1
#1 lore raw

PATCH 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.

---
 ui/cocoa.m | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)
ui/cocoa.m +6 -2
index 69745c483b..42dcf47da4 100644
@@ -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
Signature · 1 line
2.34.1
#2 lore raw

Re: [PATCH 1/1] ui/cocoa: show/hide menu in fullscreen on mouse ungrab/grab

Quoted 27 lines · Carwyn Ellis

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.

---
  ui/cocoa.m | 8 ++++++--
  1 file changed, 6 insertions(+), 2 deletions(-)
ui/cocoa.m +3 -1
index 69745c483b..42dcf47da4 100644
@@ -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

ui/cocoa.m QemuCocoaView *cocoaView; · line 1062

Quoted 10 lines
ui/cocoa.m +3 -1
@@ -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

#3 lore raw

Re: [PATCH 1/1] ui/cocoa: show/hide menu in fullscreen on mouse ungrab/grab

Thanks, taking a look now and will push up another patch once I’ve tested the changes.

Regards
Carwyn

Quoted 40 lines · Akihiko Odaki
Quoted 23 lines · Carwyn Ellis

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.

---
 ui/cocoa.m | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)
ui/cocoa.m +3 -0
index 69745c483b..42dcf47da4 100644
@@ -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

ui/cocoa.m QemuCocoaView *cocoaView; · line 1062

Quoted 9 lines
ui/cocoa.m +3 -0
@@ -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