diff options
author | John Snow <jsnow@redhat.com> | 2014-07-08 14:28:57 -0400 |
---|---|---|
committer | Gerd Hoffmann <kraxel@redhat.com> | 2014-07-11 10:44:00 +0200 |
commit | e72b59fa93b68635f42cdb1b1134f60dd4040d7b (patch) | |
tree | d905f0c374d62032c30045b4c8fe2f7b043b7b25 | |
parent | 9e99c5fd7060267a0331d900e73fdb36047bfe0c (diff) | |
download | hqemu-e72b59fa93b68635f42cdb1b1134f60dd4040d7b.zip hqemu-e72b59fa93b68635f42cdb1b1134f60dd4040d7b.tar.gz |
ui/gtk: Restore keyboard focus after Page change
(Resending for correct email addresses via MAINTAINERS ...)
In the GTK UI, after changing focus to the qemu monitor Notebook Page,
when restoring focus to the virtual machine page, the keyboard focus is lost
to a hidden GTK widget. Focus can only be restored to the virtual machine by
pressing "tab" or any of the four directional arrow keys.
Clicking in the window or grabbing/ungrabbing input does not restore keyboard
focus to the child widget.
This patch adjusts the Notebook page switching callback to automatically
steal keyboard focus on the Page switch event, so that keyboard input
does not appear to break or disappear after tabbing to the QEMU monitor.
Signed-off-by: John Snow <jsnow@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
-rw-r--r-- | ui/gtk.c | 9 |
1 files changed, 6 insertions, 3 deletions
@@ -992,13 +992,16 @@ static void gd_menu_switch_vc(GtkMenuItem *item, void *opaque) { GtkDisplayState *s = opaque; VirtualConsole *vc = gd_vc_find_by_menu(s); + GtkNotebook *nb = GTK_NOTEBOOK(s->notebook); + GtkWidget *child; gint page; gtk_release_modifiers(s); if (vc) { - page = gtk_notebook_page_num(GTK_NOTEBOOK(s->notebook), - vc->tab_item); - gtk_notebook_set_current_page(GTK_NOTEBOOK(s->notebook), page); + page = gtk_notebook_page_num(nb, vc->tab_item); + gtk_notebook_set_current_page(nb, page); + child = gtk_notebook_get_nth_page(nb, page); + gtk_widget_grab_focus(child); } } |