All of lore.kernel.org
 help / color / mirror / Atom feed
From: dongwon.kim@intel.com
To: qemu-devel@nongnu.org
Subject: [PATCH 1/2] ui/gtk: enable fullscreen hotkey for detached windows
Date: Tue,  4 Aug 2026 02:08:46 -0700	[thread overview]
Message-ID: <20260804090847.18871-1-dongwon.kim@intel.com> (raw)

From: Dongwon Kim <dongwon.kim@intel.com>

Currently, the fullscreen toggle hotkey (Ctrl+Alt+f by default) only
functions for the main QEMU window. When a Virtual Console (VC) is
detached into its own separate window (untabified), it loses this
capability.

Implement a toggle helper, gd_win_fullscreen, and connect it to
the 'f' accelerator when a detached window is created in
gd_menu_untabify. This allows individual detached windows to be
toggled fullscreen independently.

Cc: Marc-André Lureau <marcandre.lureau@redhat.com>
Signed-off-by: Dongwon Kim <dongwon.kim@intel.com>
---
 ui/gtk.c | 46 +++++++++++++++++++++++++++++++++++++++++++---
 1 file changed, 43 insertions(+), 3 deletions(-)

diff --git a/ui/gtk.c b/ui/gtk.c
index a723c8215d..3c9720a330 100644
--- a/ui/gtk.c
+++ b/ui/gtk.c
@@ -1556,6 +1556,42 @@ static gboolean gd_win_grab(void *opaque)
     return TRUE;
 }
 
+static void gd_win_fullscreen(void *opaque)
+{
+    VirtualConsole *vc = opaque;
+    GtkDisplayState *s = vc->s;
+    GdkWindow *window;
+    GdkWindowState state;
+
+    if (!vc->window || !gtk_widget_get_realized(vc->window)) {
+        return;
+    }
+
+    window = gtk_widget_get_window(vc->window);
+    if (!window) {
+        return;
+    }
+
+    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) {
+            if (!s->free_scale) {
+                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;
@@ -1590,9 +1626,13 @@ static void gd_menu_untabify(GtkMenuItem *item, void *opaque)
             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_fullscreen = g_cclosure_new_swap(
+                                             G_CALLBACK(gd_win_fullscreen),
+                                             vc, NULL);
+            gtk_accel_group_connect(ag, GDK_KEY_f, HOTKEY_MODIFIERS, 0, cb_fullscreen);
         }
 
         gd_rebuild_vc_menu(s);
-- 
2.43.0



             reply	other threads:[~2026-09-14 18:50 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-04  9:08 dongwon.kim [this message]
2026-08-04  9:08 ` [PATCH 2/2] ui/gtk: register "Grab Input" shortcut to accel_group dongwon.kim
2026-09-15 10:36   ` Marc-André Lureau
2026-09-15 18:53     ` Kim, Dongwon
2026-09-15  9:53 ` [PATCH 1/2] ui/gtk: enable fullscreen hotkey for detached windows Marc-André Lureau
2026-09-15 18:07   ` Kim, Dongwon

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260804090847.18871-1-dongwon.kim@intel.com \
    --to=dongwon.kim@intel.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.