* [PATCH] ui/gtk: Allow user to select monitor number to display qemu in full screen through new gtk display option
@ 2021-06-14 8:05 sweeaun
2021-06-14 14:11 ` Eric Blake
0 siblings, 1 reply; 4+ messages in thread
From: sweeaun @ 2021-06-14 8:05 UTC (permalink / raw)
To: qemu-devel; +Cc: swee.aun.khor, khairul.anuar.romli, vivek.kasireddy
-display gtk,monitor-num=<value>
Signed-off-by: sweeaun <swee.aun.khor@intel.com>
---
qapi/ui.json | 3 ++-
qemu-options.hx | 2 +-
ui/gtk.c | 15 +++++++++++++++
3 files changed, 18 insertions(+), 2 deletions(-)
diff --git a/qapi/ui.json b/qapi/ui.json
index 1052ca9c38..c3363c7ad5 100644
--- a/qapi/ui.json
+++ b/qapi/ui.json
@@ -1041,7 +1041,8 @@
##
{ 'struct' : 'DisplayGTK',
'data' : { '*grab-on-hover' : 'bool',
- '*zoom-to-fit' : 'bool' } }
+ '*zoom-to-fit' : 'bool',
+ '*monitor-num' : 'int' } }
##
# @DisplayEGLHeadless:
diff --git a/qemu-options.hx b/qemu-options.hx
index 14258784b3..6bd524c8c2 100644
--- a/qemu-options.hx
+++ b/qemu-options.hx
@@ -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"
diff --git a/ui/gtk.c b/ui/gtk.c
index 98046f577b..0716b3abbc 100644
--- a/ui/gtk.c
+++ b/ui/gtk.c
@@ -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)
--
2.24.3
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] ui/gtk: Allow user to select monitor number to display qemu in full screen through new gtk display option
2021-06-14 8:05 [PATCH] ui/gtk: Allow user to select monitor number to display qemu in full screen through new gtk display option sweeaun
@ 2021-06-14 14:11 ` Eric Blake
2021-06-14 15:00 ` Markus Armbruster
0 siblings, 1 reply; 4+ messages in thread
From: Eric Blake @ 2021-06-14 14:11 UTC (permalink / raw)
To: sweeaun; +Cc: khairul.anuar.romli, qemu-devel, vivek.kasireddy
On Mon, Jun 14, 2021 at 04:05:42PM +0800, sweeaun wrote:
> -display gtk,monitor-num=<value>
>
> Signed-off-by: sweeaun <swee.aun.khor@intel.com>
> ---
> qapi/ui.json | 3 ++-
> qemu-options.hx | 2 +-
> ui/gtk.c | 15 +++++++++++++++
> 3 files changed, 18 insertions(+), 2 deletions(-)
>
> diff --git a/qapi/ui.json b/qapi/ui.json
> index 1052ca9c38..c3363c7ad5 100644
> --- a/qapi/ui.json
> +++ b/qapi/ui.json
> @@ -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.
--
Eric Blake, Principal Software Engineer
Red Hat, Inc. +1-919-301-3266
Virtualization: qemu.org | libvirt.org
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] ui/gtk: Allow user to select monitor number to display qemu in full screen through new gtk display option
2021-06-14 14:11 ` Eric Blake
@ 2021-06-14 15:00 ` Markus Armbruster
2021-06-16 1:28 ` Khor, Swee Aun
0 siblings, 1 reply; 4+ messages in thread
From: Markus Armbruster @ 2021-06-14 15:00 UTC (permalink / raw)
To: Eric Blake; +Cc: sweeaun, khairul.anuar.romli, qemu-devel, vivek.kasireddy
Eric Blake <eblake@redhat.com> writes:
> On Mon, Jun 14, 2021 at 04:05:42PM +0800, sweeaun wrote:
>> -display gtk,monitor-num=<value>
>>
>> Signed-off-by: sweeaun <swee.aun.khor@intel.com>
>> ---
>> qapi/ui.json | 3 ++-
>> qemu-options.hx | 2 +-
>> ui/gtk.c | 15 +++++++++++++++
>> 3 files changed, 18 insertions(+), 2 deletions(-)
>>
>> diff --git a/qapi/ui.json b/qapi/ui.json
>> index 1052ca9c38..c3363c7ad5 100644
>> --- a/qapi/ui.json
>> +++ b/qapi/ui.json
>> @@ -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?)
^ permalink raw reply [flat|nested] 4+ messages in thread
* RE: [PATCH] ui/gtk: Allow user to select monitor number to display qemu in full screen through new gtk display option
2021-06-14 15:00 ` Markus Armbruster
@ 2021-06-16 1:28 ` Khor, Swee Aun
0 siblings, 0 replies; 4+ messages in thread
From: Khor, Swee Aun @ 2021-06-16 1:28 UTC (permalink / raw)
To: Markus Armbruster, Eric Blake
Cc: Romli, Khairul Anuar, qemu-devel@nongnu.org, Kasireddy, Vivek
Thanks for review and feedback. I shall rework those in v2.
Regards,
SweeAun
-----Original Message-----
From: Markus Armbruster <armbru@redhat.com>
Sent: Monday, June 14, 2021 11:01 PM
To: Eric Blake <eblake@redhat.com>
Cc: Khor, Swee Aun <swee.aun.khor@intel.com>; Romli, Khairul Anuar <khairul.anuar.romli@intel.com>; qemu-devel@nongnu.org; Kasireddy, Vivek <vivek.kasireddy@intel.com>
Subject: Re: [PATCH] ui/gtk: Allow user to select monitor number to display qemu in full screen through new gtk display option
Eric Blake <eblake@redhat.com> writes:
> On Mon, Jun 14, 2021 at 04:05:42PM +0800, sweeaun wrote:
>> -display gtk,monitor-num=<value>
>>
>> Signed-off-by: sweeaun <swee.aun.khor@intel.com>
>> ---
>> qapi/ui.json | 3 ++-
>> qemu-options.hx | 2 +-
>> ui/gtk.c | 15 +++++++++++++++
>> 3 files changed, 18 insertions(+), 2 deletions(-)
>>
>> diff --git a/qapi/ui.json b/qapi/ui.json index 1052ca9c38..c3363c7ad5
>> 100644
>> --- a/qapi/ui.json
>> +++ b/qapi/ui.json
>> @@ -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?)
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2021-06-16 1:44 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-14 8:05 [PATCH] ui/gtk: Allow user to select monitor number to display qemu in full screen through new gtk display option sweeaun
2021-06-14 14:11 ` Eric Blake
2021-06-14 15:00 ` Markus Armbruster
2021-06-16 1:28 ` Khor, Swee Aun
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.