Hi Marc-André,
> Subject: Re: [PATCH 1/2] ui/gtk: enable fullscreen hotkey for detached
> windows
>
> Hi
>
> On Mon, Sep 14, 2026 at 10:50 PM <[email protected]> wrote:
> >
> > From: Dongwon Kim <[email protected]>
> >
> > 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 <[email protected]>
> > Signed-off-by: Dongwon Kim <[email protected]>
> > ---
> > 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_menu_full_screen restores it to gfx.preferred_scale
I will change this. This was based on what was done in menu_full_screen a while
ago.
I didn't notice it was changed there. In addition to that, I will take out
check on free_scale
as well.
>
> > + }
> > + 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));
> > + }
> > +}
>
> For consistency with gd_menu_full_screen() it should call gd_update_cursor
Yes
>
> > +
> > 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);
>
> You also hook grab, this should be mentionned in the commit message.
>
> btw, it would be nice to remove the stderr printf there..
Yes, I will remove it.
>
> Why not add the zoom keys while at it?
Yes, we can enable other hotkeys. I am going to add zoom in/out/reset keys.
I think it's better to create a new commit with all these major changes included
rather than going with v2.
Thanks,
DW
>
> thanks
>
> > + 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
> >
> >
>
>
> --
> Marc-André Lureau