All of lore.kernel.org
 help / color / mirror / Atom feed
From: dongwon.kim@intel.com
To: qemu-devel@nongnu.org
Subject: [PATCH 3/3] ui/gtk: Defer initial fullscreen activation until window is mapped
Date: Tue, 11 Aug 2026 03:24:26 -0700	[thread overview]
Message-ID: <20260811102426.35538-4-dongwon.kim@intel.com> (raw)
In-Reply-To: <20260811102426.35538-1-dongwon.kim@intel.com>

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

When QEMU is started with '-display gtk,full-screen=on', the fullscreen
state is currently requested in gtk_display_init() before the window is
realized or mapped by the display server.

On certain compositors (such as GNOME/Mutter under Wayland or X11),
requesting fullscreen on an unmapped window can be overridden or dropped
when the window is subsequently mapped and assigned its initial windowed
geometry constraints.

Resolve this by deferring the initial fullscreen toggle until the
window's "map-event" signal fires. Once the native surface is fully mapped
and acknowledged by the compositor, activate the fullscreen action and
disconnect the one-shot handler.

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

diff --git a/ui/gtk.c b/ui/gtk.c
index f20edc5c5b..cace30114e 100644
--- a/ui/gtk.c
+++ b/ui/gtk.c
@@ -2861,6 +2861,22 @@ static void gd_vc_free(void *p)
 static GtkDisplayState *gtk_display_state;
 static gboolean gtkinit;
 
+static gboolean gd_window_map_event(GtkWidget *widget, GdkEvent *event, gpointer opaque)
+{
+    GtkDisplayState *s = opaque;
+
+    if (s->opts->has_full_screen &&
+        s->opts->full_screen) {
+        if (!s->full_screen) {
+            gtk_menu_item_activate(GTK_MENU_ITEM(s->full_screen_item));
+        }
+    }
+
+    /* Disconnect or ensure it runs only once at launch */
+    g_signal_handlers_disconnect_by_func(widget, gd_window_map_event, s);
+    return FALSE;
+}
+
 static void gtk_display_init(DisplayState *ds, DisplayOptions *opts)
 {
     VirtualConsole *vc;
@@ -2960,7 +2976,8 @@ static void gtk_display_init(DisplayState *ds, DisplayOptions *opts)
 
     if (opts->has_full_screen &&
         opts->full_screen) {
-        gtk_menu_item_activate(GTK_MENU_ITEM(s->full_screen_item));
+        g_signal_connect(s->window, "map-event",
+                         G_CALLBACK(gd_window_map_event), s);
     }
     if (opts->u.gtk.has_grab_on_hover &&
         opts->u.gtk.grab_on_hover) {
-- 
2.43.0



  parent reply	other threads:[~2026-09-21 20:06 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-11 10:24 [PATCH v2 0/3] ui/gtk: Hotkey and fullscreen handling fixes dongwon.kim
2026-08-11 10:24 ` [PATCH v2 1/3] ui/gtk: Enable fullscreen and zoom hotkeys for detached windows dongwon.kim
2026-08-11 10:24 ` [PATCH v2 2/3] ui/gtk: Register "Grab Input" shortcut to accel_group dongwon.kim
2026-08-11 10:24 ` dongwon.kim [this message]
2026-10-07 19:09 ` [PATCH v2 0/3] ui/gtk: Hotkey and fullscreen handling fixes Kim, Dongwon
2026-10-13 10:52   ` Marc-André Lureau

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=20260811102426.35538-4-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.