Skip to contentSkip to conversation

gtk: Add show_tabs=on|off command line option.

PATCH Superseded Felix xq Queißner 6 participants 9 messages Jun 27, 2022 – Jul 12, 2022

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 gtk: Add show_tabs=on|off command line option.

The patch adds "show_tabs" command line option for GTK ui similar to "grab_on_hover". This option allows tabbed view mode to not have to be enabled by hand at each start of the VM.

---
 qapi/ui.json    | 5 ++++-
 qemu-options.hx | 2 +-
 ui/gtk.c        | 4 ++++
 3 files changed, 9 insertions(+), 2 deletions(-)
qapi/ui.json +4 -1
index 413371d5e8..049e7957a9 100644
@@ -1195,12 +1195,15 @@
 #               assuming the guest will resize the display to match
 #               the window size then.  Otherwise it defaults to "off".
 #               Since 3.1
+# @show-tabs:   Displays the tab items by default.
+#               Since 7.1
 #
 # Since: 2.12
 ##
 { 'struct'  : 'DisplayGTK',
   'data'    : { '*grab-on-hover' : 'bool',
-                '*zoom-to-fit'   : 'bool'  } }
+                '*zoom-to-fit'   : 'bool',
+                '*show-tabs'     : 'bool'  } }
 
 ##
 # @DisplayEGLHeadless:
qemu-options.hx +1 -1
index 377d22fbd8..2b279afff7 100644
@@ -1937,7 +1937,7 @@ DEF("display", HAS_ARG, QEMU_OPTION_display,
     "            [,window-close=on|off]\n"
 #endif
 #if defined(CONFIG_GTK)
-    "-display gtk[,full-screen=on|off][,gl=on|off][,grab-on-hover=on|off]\n"
+    "-display gtk[,full-screen=on|off][,gl=on|off][,grab-on-hover=on|off][,show-tabs=on|off]\n"
     "            [,show-cursor=on|off][,window-close=on|off]\n"
 #endif
 #if defined(CONFIG_VNC)
ui/gtk.c +4 -0
index 2a791dd2aa..1467b8c7d7 100644
@@ -2390,6 +2390,10 @@ static void gtk_display_init(DisplayState *ds, DisplayOptions *opts)
         opts->u.gtk.grab_on_hover) {
         gtk_menu_item_activate(GTK_MENU_ITEM(s->grab_on_hover_item));
     }
+    if (opts->u.gtk.has_show_tabs &&
+        opts->u.gtk.show_tabs) {
+        gtk_menu_item_activate(GTK_MENU_ITEM(s->show_tabs_item));
+    }
     gd_clipboard_init(s);
 }
 
Signature · 1 line
2.36.1
#1 lore raw

Hi,

(Thanks for the patch!)

Quoted 1 line · Felix xq Queißner

The patch adds "show_tabs" command line option for GTK ui similar to "grab_on_hover". This option allows tabbed view mode to not have to be enabled by hand at each start of the VM.

I’m not sure we have a hard rule on it, but I think generally commit messages should be wrapped at 72 characters.

Quoted 12 lines
---
  qapi/ui.json    | 5 ++++-
  qemu-options.hx | 2 +-
  ui/gtk.c        | 4 ++++
  3 files changed, 9 insertions(+), 2 deletions(-)
qapi/ui.json +0 -0
index 413371d5e8..049e7957a9 100644

qapi/ui.json line 1199

Quoted 5 lines
qapi/ui.json +2 -0
@@ -1195,12 +1195,15 @@
  #               assuming the guest will resize the display to match
  #               the window size then.  Otherwise it defaults to "off".
  #               Since 3.1
+# @show-tabs:   Displays the tab items by default.
+#               Since 7.1

I don’t really understand what “tab items” is supposed to mean. Perhaps “tabs item”?

But a bit more verbosity might be nice, too.  What about “Display the tab bar for switching between the various graphical interfaces (e.g. VGA and virtual console character devices) by default”?  (Note the imperative on “Display”, I think we generally use the imperative to document options.)

Quoted 16 lines
qapi/ui.json +2 -1
  #
  # Since: 2.12
  ##
  { 'struct'  : 'DisplayGTK',
    'data'    : { '*grab-on-hover' : 'bool',
-                '*zoom-to-fit'   : 'bool'  } }
+                '*zoom-to-fit'   : 'bool',
+                '*show-tabs'     : 'bool'  } }
 
  ##
  # @DisplayEGLHeadless:
qemu-options.hx +0 -0
index 377d22fbd8..2b279afff7 100644

qemu-options.hx DEF("display", HAS_ARG, QEMU_OPTION_display, · line 1941

Quoted 6 lines
qemu-options.hx +1 -1
@@ -1937,7 +1937,7 @@ DEF("display", HAS_ARG, QEMU_OPTION_display,
      "            [,window-close=on|off]\n"
  #endif
  #if defined(CONFIG_GTK)
-    "-display gtk[,full-screen=on|off][,gl=on|off][,grab-on-hover=on|off]\n"
+    "-display gtk[,full-screen=on|off][,gl=on|off][,grab-on-hover=on|off][,show-tabs=on|off]\n"
      "            [,show-cursor=on|off][,window-close=on|off]\n"

There is some documentation further below that explains the other options.  I think this new option should be explained there as well.  (Probably reusing the documentation from qapi/ui.json.)

Quoted 7 lines
qemu-options.hx +0 -0
  #endif
  #if defined(CONFIG_VNC)
ui/gtk.c +0 -0
index 2a791dd2aa..1467b8c7d7 100644

ui/gtk.c static void gtk_display_init(DisplayState *ds, DisplayOptions *opts) · line 2398

Quoted 9 lines
ui/gtk.c +4 -0
@@ -2390,6 +2390,10 @@ static void gtk_display_init(DisplayState *ds, DisplayOptions *opts)
          opts->u.gtk.grab_on_hover) {
          gtk_menu_item_activate(GTK_MENU_ITEM(s->grab_on_hover_item));
      }
+    if (opts->u.gtk.has_show_tabs &&
+        opts->u.gtk.show_tabs) {
+        gtk_menu_item_activate(GTK_MENU_ITEM(s->show_tabs_item));
+    }
      gd_clipboard_init(s);
  }

Not that I’d know any of this code, but FWIW, makes sense and looks good to me.

Thanks!

Hanna

#2 lore raw
Quoted 15 lines · Hanna Reitz

Hi,

(Thanks for the patch!)

Quoted 1 line · Felix xq Queißner

The patch adds "show_tabs" command line option for GTK ui similar to "grab_on_hover". This option allows tabbed view mode to not have to be enabled by hand at each start of the VM.

I’m not sure we have a hard rule on it, but I think generally commit messages should be wrapped at 72 characters.

Quoted 6 lines

---
  qapi/ui.json    | 5 ++++-
  qemu-options.hx | 2 +-
  ui/gtk.c        | 4 ++++

  3 files changed, 9 insertions(+), 2 deletions(-)

[...]

Quoted 5 lines
Quoted 5 lines
qemu-options.hx +0 -0
index 377d22fbd8..2b279afff7 100644
@@ -1937,7 +1937,7 @@ DEF("display", HAS_ARG, QEMU_OPTION_display,
Quoted 8 lines
Quoted 8 lines

      "            [,window-close=on|off]\n"
  #endif
  #if defined(CONFIG_GTK)
-    "-display gtk[,full-screen=on|off][,gl=on|off][,grab-on-hover=on|off]\n"
+    "-display gtk[,full-screen=on|off][,gl=on|off][,grab-on-hover=on|off][,show-tabs=on|off]\n" " [,show-cursor=on|off][,window-close=on|off]\n"

Oops, noticed another thing (a bit late): Considering the options are already spit over two lines, it looks to me like this line’s length is supposed to be limited.  (My guess is we’re trying to not exceed 80 characters here in this source file.)  Therefore, this new option should probably go on a separate new line.

Hanna

#3 lore raw
In reply to Hanna Reitz
Quoted 8 lines · Hanna Reitz

Hi,

(Thanks for the patch!)

Quoted 1 line · Felix xq Queißner

The patch adds "show_tabs" command line option for GTK ui similar to "grab_on_hover". This option allows tabbed view mode to not have to be enabled by hand at each start of the VM.

I’m not sure we have a hard rule on it, but I think generally commit messages should be wrapped at 72 characters.

Yes, please.

[...]

#4 lore raw
In reply to Hanna Reitz

Hi,

Quoted 4 lines

But a bit more verbosity might be nice, too.  What about “Display the tab bar for switching between the various graphical interfaces (e.g. VGA and virtual console character devices) by default”?  (Note the imperative on “Display”, I think we generally use the imperative to document options.)

And 'tab bar' is more clear too I think.

take care,
Gerd

#5 lore raw
In reply to Felix xq Queißner
Quoted 12 lines

-----Original Message-----
From: Qemu-devel <qemu-devel- [email protected]> On Behalf Of Felix xq Queißner
Sent: Tuesday, June 28, 2022 12:44 AM
To: [email protected]
Cc: [email protected]; [email protected]; Felix "xq" Queißner <[email protected]>
Subject: [PATCH] gtk: Add show_tabs=on|off command line option.

Quoted 5 lines

The patch adds "show_tabs" command line option for GTK ui similar to "grab_on_hover". This option allows tabbed view mode to not have to be enabled by hand at each start of the VM.

Thanks your patch, but please use your real name to sign a patch. For the details:
docs/devel/submitting-a-patch.rst

Thanks
Chen

Quoted 59 lines
---
 qapi/ui.json    | 5 ++++-
 qemu-options.hx | 2 +-
 ui/gtk.c        | 4 ++++
 3 files changed, 9 insertions(+), 2 deletions(-)
qapi/ui.json +4 -1
@@ -1195,12 +1195,15 @@
 #               assuming the guest will resize the display to match
 #               the window size then.  Otherwise it defaults to "off".
 #               Since 3.1
+# @show-tabs:   Displays the tab items by default.
+#               Since 7.1
 #
 # Since: 2.12
 ##
 { 'struct'  : 'DisplayGTK',
   'data'    : { '*grab-on-hover' : 'bool',
-                '*zoom-to-fit'   : 'bool'  } }
+                '*zoom-to-fit'   : 'bool',
+                '*show-tabs'     : 'bool'  } }
 
 ##
 # @DisplayEGLHeadless:
qemu-options.hx index renamed from qemu-options.hx +0 -0

377d22fbd8..2b279afff7 100644

qemu-options.hx +1 -1
@@ -1937,7 +1937,7 @@ DEF("display", HAS_ARG, QEMU_OPTION_display,
     "            [,window-close=on|off]\n"
 #endif
 #if defined(CONFIG_GTK)
-    "-display gtk[,full-screen=on|off][,gl=on|off][,grab-on-hover=on|off]\n"
+    "-display gtk[,full-screen=on|off][,gl=on|off][,grab-on-

hover=on|off][,show-tabs=on|off]\n"

     "            [,show-cursor=on|off][,window-close=on|off]\n"

#endif
#if defined(CONFIG_VNC)

ui/gtk.c +4 -1
index 2a791dd2aa..1467b8c7d7 100644
@@ -2390,6 +2390,10 @@ static void gtk_display_init(DisplayState *ds,
 DisplayOptions *opts)
         opts->u.gtk.grab_on_hover) {
         gtk_menu_item_activate(GTK_MENU_ITEM(s->grab_on_hover_item));
     }
+    if (opts->u.gtk.has_show_tabs &&
+        opts->u.gtk.show_tabs) {
+        gtk_menu_item_activate(GTK_MENU_ITEM(s->show_tabs_item));
+    }
     gd_clipboard_init(s);
 }
 
--

2.36.1

#7 lore raw
In reply to Felix xq Queißner

Heya!

Quoted 1 line · Felix xq Queißner

The patch adds "show_tabs" command line option for GTK ui similar to "grab_on_hover". This option allows tabbed view mode to not have to be enabled by hand at each start of the VM.

Quoted 1 line · Hanna Reitz

[snip]

Quoted 1 line · Markus Armbruster

[snip]

Quoted 1 line · Gerd Hoffmann

[snip]

I have addressed the things mentioned:
- limiting line length to 80 in ui.json, qemu-options.hx
- limiting line length in commit to 72
- improved description of the option as Hanna suggested

Quoted 3 lines · Chen
Quoted 1 line

Thanks your patch, but please use your real name to sign a patch.

Not sure what to do about this one. Felix Queißer *is* my real name, so the only thing i could do is to remove the "xq"?

Should i submit my changes as a response to this or create a new mail thread with a new patch?

Regards
- Felix

#8 lore raw
Quoted 19 lines · Felix Queißner

Heya!

Quoted 1 line · Felix xq Queißner

The patch adds "show_tabs" command line option for GTK ui similar to "grab_on_hover". This option allows tabbed view mode to not have to be enabled by hand at each start of the VM.

Quoted 1 line · Hanna Reitz

[snip]

Quoted 1 line · Markus Armbruster

[snip]

Quoted 1 line · Gerd Hoffmann

[snip]

I have addressed the things mentioned:
- limiting line length to 80 in ui.json, qemu-options.hx
- limiting line length in commit to 72
- improved description of the option as Hanna suggested

Quoted 6 lines
Quoted 3 lines · Chen
Quoted 1 line

Thanks your patch, but please use your real name to sign a patch.

Not sure what to do about this one. Felix Queißer *is* my real name, so the only thing i could do is to remove the "xq"?

I feel like you can leave it that way because given the quotation marks it seems obvious what you real name is.

(FWIW I can see precedent in commit f5507e0448bd34473af72509297617a783049024.)

Quoted 1 line

Should i submit my changes as a response to this or create a new mail thread with a new patch?

Please submit them as a new thread with a “[PATCH v2]” tag (git format-patch -v2 will create that tag).

Hanna