ui/gtk: Allow user to select monitor number to display qemu in full screen through new gtk display option
PATCH 1/1 ui/gtk: Allow user to select monitor number to display qemu in full screen through new gtk display option
-display gtk,monitor-num=<value>
--- qapi/ui.json | 3 ++- qemu-options.hx | 2 +- ui/gtk.c | 15 +++++++++++++++ 3 files changed, 18 insertions(+), 2 deletions(-)
qapi/ui.json +2 -1
@@ -1041,7 +1041,8 @@ ## { 'struct' : 'DisplayGTK', 'data' : { '*grab-on-hover' : 'bool', - '*zoom-to-fit' : 'bool' } } + '*zoom-to-fit' : 'bool', + '*monitor-num' : 'int' } } ## # @DisplayEGLHeadless:
qemu-options.hx +1 -1
@@ -1787,7 +1787,7 @@ DEF("display", HAS_ARG, QEMU_OPTION_display, " [,window_close=on|off][,gl=on|core|es|off]\n" #endif #if defined(CONFIG_GTK) - "-display gtk[,grab_on_hover=on|off][,gl=on|off]|\n" + "-display gtk[,grab_on_hover=on|off][,gl=on|off][,monitor-num=<value>]\n" #endif #if defined(CONFIG_VNC) "-display vnc=<display>[,<optargs>]\n"
ui/gtk.c +15 -0
@@ -2268,6 +2268,21 @@ static void gtk_display_init(DisplayState *ds, DisplayOptions *opts)gtk_menu_item_activate (GTK_MENU_ITEM (s->grab_on_hover_item)); }gd_clipboard_init (s); + +if (opts->u.gtk.has_monitor_num) { +int n_monitor; + n_monitor =gdk_display_get_n_monitors (window_display); + +if ((opts->u.gtk.monitor_num <= n_monitor) && + (opts->u.gtk.monitor_num >0 )) { +GdkScreen *gdk_screen; + gdk_screen =gdk_display_get_default_screen (window_display); +gtk_window_fullscreen_on_monitor (GTK_WINDOW (s->window), gdk_screen, + (opts->u.gtk.monitor_num -1 )); + }else { +fprintf (stderr,"Invalid GTK monitor-num argument\n" ); + } + } }static void early_gtk_display_init (DisplayOptions *opts)
Signature · 1 line
2.24.3
Quoted 14 lines · sweeaun
-display gtk,monitor-num=<value>
Signed-off-by sweeaun <[email protected]>--- qapi/ui.json | 3 ++- qemu-options.hx | 2 +- ui/gtk.c | 15 +++++++++++++++ 3 files changed, 18 insertions(+), 2 deletions(-)qapi/ui.json +0
-0
qapi/ui.json line 1045
Quoted 6 lines
qapi/ui.json +2
-1@@ -1041,7 +1041,8 @@ ## { 'struct' : 'DisplayGTK', 'data' : { '*grab-on-hover' : 'bool', - '*zoom-to-fit' : 'bool' } } + '*zoom-to-fit' : 'bool', + '*monitor-num' : 'int' } }
Missing documentation of the new member. Also, get rid of the tab damage.
Signature · 3 lines
Eric Blake, Principal Software Engineer Red Hat, Inc. +1-919-301-3266 Virtualization: qemu.org | libvirt.org
Quoted 10 lines · Eric Blake
Quoted 9 lines · sweeaun
-display gtk,monitor-num=<value>
Signed-off-by sweeaun <[email protected]>--- qapi/ui.json | 3 ++- qemu-options.hx | 2 +- ui/gtk.c | 15 +++++++++++++++ 3 files changed, 18 insertions(+), 2 deletions(-)
Quoted 13 lines
qapi/ui.json line 1045
Quoted 11 lines
qapi/ui.json +2
-1@@ -1041,7 +1041,8 @@ ## { 'struct' : 'DisplayGTK', 'data' : { '*grab-on-hover' : 'bool', - '*zoom-to-fit' : 'bool' } } + '*zoom-to-fit' : 'bool', + '*monitor-num' : 'int' } }Missing documentation of the new member. Also, get rid of the tab damage.
Suggest to name it either @monitor-number or @monitor (because what else than the number could 'int' be?)
Thanks for review and feedback. I shall rework those in v2.
Regards,
SweeAun
-----Original Message-----
From: Markus Armbruster <[email protected]>
Sent: Monday, June 14, 2021 11:01 PM
To: Eric Blake <[email protected]>
Cc: Khor, Swee Aun <[email protected]>; Romli, Khairul Anuar <[email protected]>; [email protected]; Kasireddy, Vivek <[email protected]>
Subject: Re: [PATCH] ui/gtk: Allow user to select monitor number to display qemu in full screen through new gtk display option
Quoted 10 lines · Eric Blake
Quoted 9 lines · sweeaun
-display gtk,monitor-num=<value>
Signed-off-by sweeaun <[email protected]>--- qapi/ui.json | 3 ++- qemu-options.hx | 2 +- ui/gtk.c | 15 +++++++++++++++ 3 files changed, 18 insertions(+), 2 deletions(-)
Quoted 13 lines
qapi/ui.json line 1045
Quoted 11 lines
qapi/ui.json index 1052ca9c38..c3363c7ad5 renamed from qapi/ui.json +0
-0100644
qapi/ui.json +2
-1@@ -1041,7 +1041,8 @@ ## { 'struct' : 'DisplayGTK', 'data' : { '*grab-on-hover' : 'bool', - '*zoom-to-fit' : 'bool' } } + '*zoom-to-fit' : 'bool', + '*monitor-num' : 'int' } }Missing documentation of the new member. Also, get rid of the tab damage.
Suggest to name it either @monitor-number or @monitor (because what else than the number could 'int' be?)