Hi

On Wed, May 20, 2026 at 4:33 AM <[email protected]> wrote:
>
> From: Dongwon Kim <[email protected]>
>
> 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 <[email protected]>
> Cc: Philippe Mathieu-Daudé <[email protected]>
> Cc: Daniel P. Berrangé <[email protected]>
> Signed-off-by: Dongwon Kim <[email protected]>
> ---
>  ui/gtk.c | 5 +++++
>  1 file changed, 5 insertions(+)
>
> diff --git a/ui/gtk.c b/ui/gtk.c
> index 2c61b601f7..8eb1a80377 100644
> --- a/ui/gtk.c
> +++ b/ui/gtk.c
> @@ -1475,6 +1475,11 @@ static gboolean gd_tab_window_close(GtkWidget *widget, 
> GdkEvent *event,
>          vc->gfx.ectx = NULL;
>      }
>  #endif
> +
> +    if (vc == gd_vc_find_by_menu(s)) {
> +        gtk_widget_grab_focus(vc->focus);
> +    }
> +

Looks ok to me. But could you share your test case? launching qemu
with just -nodefaults doesn't help reproduce your issue :)

(fwiw, I have a bunch of patches pending to fix/improve dynamic
console handling, I will try to send them later this week)

thanks

-- 
Marc-André Lureau

Reply via email to