[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH] ui/gtk: Attach fullscreen toggling cb to all detached VCs
From: |
dongwon . kim |
Subject: |
[PATCH] ui/gtk: Attach fullscreen toggling cb to all detached VCs |
Date: |
Mon, 1 Jul 2024 17:07:15 -0700 |
From: Dongwon Kim <dongwon.kim@intel.com>
Enable hotkey for toggling window fullscreening for all individual
untabified VCs
Cc: Marc-André Lureau <marcandre.lureau@redhat.com>
Cc: Vivek Kasireddy <vivek.kasireddy@intel.com>
Signed-off-by: Dongwon Kim <dongwon.kim@intel.com>
---
ui/gtk.c | 39 +++++++++++++++++++++++++++++++++++----
1 file changed, 35 insertions(+), 4 deletions(-)
diff --git a/ui/gtk.c b/ui/gtk.c
index 93b13b7a30..768e66bec4 100644
--- a/ui/gtk.c
+++ b/ui/gtk.c
@@ -1396,6 +1396,34 @@ static gboolean gd_win_grab(void *opaque)
return TRUE;
}
+static void gd_vc_fullscreen_toggle(void *opaque)
+{
+ VirtualConsole *vc = opaque;
+ GdkWindow *window;
+ GdkWindowState state;
+
+ if (!vc->window)
+ return;
+
+ window = gtk_widget_get_window(vc->window);
+ state = gdk_window_get_state(window);
+
+ if (state & GDK_WINDOW_STATE_FULLSCREEN) {
+ gtk_window_unfullscreen(GTK_WINDOW(vc->window));
+
+ if (vc->type == GD_VC_GFX) {
+ vc->gfx.scale_x = 1.0;
+ vc->gfx.scale_y = 1.0;
+ gd_update_windowsize(vc);
+ }
+ } else {
+ if (vc->type == GD_VC_GFX) {
+ gtk_widget_set_size_request(vc->gfx.drawing_area, -1, -1);
+ }
+ gtk_window_fullscreen(GTK_WINDOW(vc->window));
+ }
+}
+
static void gd_menu_untabify(GtkMenuItem *item, void *opaque)
{
GtkDisplayState *s = opaque;
@@ -1428,10 +1456,13 @@ static void gd_menu_untabify(GtkMenuItem *item, void
*opaque)
if (qemu_console_is_graphic(vc->gfx.dcl.con)) {
GtkAccelGroup *ag = gtk_accel_group_new();
gtk_window_add_accel_group(GTK_WINDOW(vc->window), ag);
-
- GClosure *cb = g_cclosure_new_swap(G_CALLBACK(gd_win_grab),
- vc, NULL);
- gtk_accel_group_connect(ag, GDK_KEY_g, HOTKEY_MODIFIERS, 0, cb);
+ GClosure *cb_grab = g_cclosure_new_swap(G_CALLBACK(gd_win_grab),
+ vc, NULL);
+ gtk_accel_group_connect(ag, GDK_KEY_g, HOTKEY_MODIFIERS, 0,
cb_grab);
+ GClosure *cb_fs = g_cclosure_new_swap(
+
G_CALLBACK(gd_vc_fullscreen_toggle),
+ vc, NULL);
+ gtk_accel_group_connect(ag, GDK_KEY_f, HOTKEY_MODIFIERS, 0, cb_fs);
}
gd_update_geometry_hints(vc);
--
2.34.1
- [PATCH] ui/gtk: Attach fullscreen toggling cb to all detached VCs,
dongwon . kim <=