From: Stefan Hajnoczi <stefanha@gmail.com>
To: John Snow <jsnow@redhat.com>
Cc: aliguori@us.ibm.com, qemu-devel@nongnu.org, stefanha@redhat.com,
Gerd Hoffmann <kraxel@redhat.com>
Subject: Re: [Qemu-devel] [PATCH] ui/gtk: Restore keyboard focus after Page change
Date: Wed, 9 Jul 2014 10:00:02 +0200 [thread overview]
Message-ID: <20140709080002.GA23643@stefanha-thinkpad.redhat.com> (raw)
In-Reply-To: <1404842483-23612-1-git-send-email-jsnow@redhat.com>
[-- Attachment #1: Type: text/plain, Size: 1858 bytes --]
On Tue, Jul 08, 2014 at 02:01:23PM -0400, John Snow wrote:
> 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>
> ---
> ui/gtk.c | 9 ++++++---
> 1 file changed, 6 insertions(+), 3 deletions(-)
CCed Gerd who may also be able to review this patch.
If this patch is non-contentious it could be merged for 2.1.
> diff --git a/ui/gtk.c b/ui/gtk.c
> index b02fcd6..2345d7e 100644
> --- a/ui/gtk.c
> +++ b/ui/gtk.c
> @@ -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);
> }
> }
>
> --
> 1.9.3
>
>
[-- Attachment #2: Type: application/pgp-signature, Size: 473 bytes --]
prev parent reply other threads:[~2014-07-09 8:00 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-07-08 18:01 [Qemu-devel] [PATCH] ui/gtk: Restore keyboard focus after Page change John Snow
2014-07-09 8:00 ` Stefan Hajnoczi [this message]
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=20140709080002.GA23643@stefanha-thinkpad.redhat.com \
--to=stefanha@gmail.com \
--cc=aliguori@us.ibm.com \
--cc=jsnow@redhat.com \
--cc=kraxel@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=stefanha@redhat.com \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).