From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:55271) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1X4mnZ-0006bM-BG for qemu-devel@nongnu.org; Wed, 09 Jul 2014 04:00:26 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1X4mnP-0007o5-V3 for qemu-devel@nongnu.org; Wed, 09 Jul 2014 04:00:17 -0400 Received: from mail-wg0-x233.google.com ([2a00:1450:400c:c00::233]:61378) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1X4mnP-0007lT-Hn for qemu-devel@nongnu.org; Wed, 09 Jul 2014 04:00:07 -0400 Received: by mail-wg0-f51.google.com with SMTP id y10so2273634wgg.22 for ; Wed, 09 Jul 2014 01:00:06 -0700 (PDT) Date: Wed, 9 Jul 2014 10:00:02 +0200 From: Stefan Hajnoczi Message-ID: <20140709080002.GA23643@stefanha-thinkpad.redhat.com> References: <1404842483-23612-1-git-send-email-jsnow@redhat.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="RnlQjJ0d97Da+TV1" Content-Disposition: inline In-Reply-To: <1404842483-23612-1-git-send-email-jsnow@redhat.com> Subject: Re: [Qemu-devel] [PATCH] ui/gtk: Restore keyboard focus after Page change List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: John Snow Cc: aliguori@us.ibm.com, qemu-devel@nongnu.org, stefanha@redhat.com, Gerd Hoffmann --RnlQjJ0d97Da+TV1 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable 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 l= ost > 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. >=20 > Clicking in the window or grabbing/ungrabbing input does not restore keyb= oard > focus to the child widget. >=20 > 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. >=20 > Signed-off-by: John Snow > --- > 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, vo= id *opaque) > { > GtkDisplayState *s =3D opaque; > VirtualConsole *vc =3D gd_vc_find_by_menu(s); > + GtkNotebook *nb =3D GTK_NOTEBOOK(s->notebook); > + GtkWidget *child; > gint page; > =20 > gtk_release_modifiers(s); > if (vc) { > - page =3D gtk_notebook_page_num(GTK_NOTEBOOK(s->notebook), > - vc->tab_item); > - gtk_notebook_set_current_page(GTK_NOTEBOOK(s->notebook), page); > + page =3D gtk_notebook_page_num(nb, vc->tab_item); > + gtk_notebook_set_current_page(nb, page); > + child =3D gtk_notebook_get_nth_page(nb, page); > + gtk_widget_grab_focus(child); > } > } > =20 > --=20 > 1.9.3 >=20 >=20 --RnlQjJ0d97Da+TV1 Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQEcBAEBAgAGBQJTvPaCAAoJEJykq7OBq3PIcZMH/iBh6WZ4mQrrWHPZzz4U7Wjd OixBFcTjggoexIziRTb1OzVTuSQqeEbn6YfoWPayevShT5S8XsA0HRk8weywKtGN eROt/h+GTMxeNeU44wyXZoz/9gVCwuGMiA9NfS1sdcpJcRiAxDofaUAxtmHyfA4S uJT8lYGzwJTf/SlQSeinH7PXPWuXPBbHraM7ilYqVPgghSlBxHRiKqlWIILJlQwx DrW8oGLVmOTroZ6/q6CfmnmmYyJGj0AG+/eNr8OFiU4OvVU6wJXA3c4rxJePGeRO k3/YXxZdLG1ORH0zQ7+3m9dihoeglK1uZ/Ryyl3eFJr5P0yOlJu68flQiAkquUo= =UIxu -----END PGP SIGNATURE----- --RnlQjJ0d97Da+TV1--