@samitouri / QOSamiQemu / commits / 7385a32751

ui/gtk: Fix focus loss on re-attachment with single VC

When QEMU is launched with a single virtual console (e.g., using --nodefaults), detaching and then closing the detached window leaves the main window's notebook without an active focus target which makes keyboard unfunctional on re-attached VC. Fix this by explicitly calling gtk_widget_grab_focus on the active VC's focus widget during the window close handler. Cc: Marc-André Lureau <marcandre.lureau@redhat.com> Cc: Philippe Mathieu-Daudé <philmd@linaro.org> Cc: Daniel P. Berrangé <berrange@redhat.com> Signed-off-by: Dongwon Kim <dongwon.kim@intel.com> Message-ID: <20260520002645.1910740-1-dongwon.kim@intel.com> Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>

Dongwon Kim committed May 19, 2026 at 17:26 UTC 7385a3275128fae7ee3de341e9af24a0dd8f7533
1 file changed +5
ui/gtk.c
+5
@@ -1483,6 +1483,11 @@ static gboolean gd_tab_window_close(GtkWidget *widget, GdkEvent *event,
1483 vc->gfx.ectx = NULL;
1484 }
1485 #endif
1486 +
1487 + if (vc == gd_vc_find_by_menu(s)) {
1488 + gtk_widget_grab_focus(vc->focus);
1489 + }
1490 +
1491 return TRUE;
1492 }
1493