From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:54744) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1X7ldM-0001IW-HN for qemu-devel@nongnu.org; Thu, 17 Jul 2014 09:22:13 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1X7ldD-0007WP-Fr for qemu-devel@nongnu.org; Thu, 17 Jul 2014 09:22:04 -0400 Received: from mail-we0-x22c.google.com ([2a00:1450:400c:c03::22c]:47619) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1X7ldD-0007WD-81 for qemu-devel@nongnu.org; Thu, 17 Jul 2014 09:21:55 -0400 Received: by mail-we0-f172.google.com with SMTP id x48so2890631wes.17 for ; Thu, 17 Jul 2014 06:21:51 -0700 (PDT) Date: Thu, 17 Jul 2014 14:21:48 +0100 From: Stefan Hajnoczi Message-ID: <20140717132148.GA25107@stefanha-thinkpad.redhat.com> References: <1404844137-25310-1-git-send-email-jsnow@redhat.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="envbJBWh7q8WU6mo" Content-Disposition: inline In-Reply-To: <1404844137-25310-1-git-send-email-jsnow@redhat.com> Subject: Re: [Qemu-devel] [PATCH RESEND] ui/gtk: Restore keyboard focus after Page change List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: John Snow Cc: stefanha@redhat.com, qemu-devel@nongnu.org, aliguori@amazon.com, kraxel@redhat.com --envbJBWh7q8WU6mo Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Tue, Jul 08, 2014 at 02:28:57PM -0400, John Snow wrote: > (Resending for correct email addresses via MAINTAINERS ...) >=20 > 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(-) >=20 > 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 Ping? --envbJBWh7q8WU6mo Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQEcBAEBAgAGBQJTx83sAAoJEJykq7OBq3PIwvMIAILQJfRy1EK/xLoNHz4e0hTL Yt3gOuQe3/0d2eA54WnQBFkWAdWpaTGQdK9ftC3GdM+zNuMMSrKOdTDR86y4csfY 5h2K1LKMjt2OboTIyAYIxL2FIO4iY8uBPQg9Irxc+LYM7twZEcdfzyTgDhSuPApB 5XDk+/cMNLTDQe/5PU4KMZJaq4QxaXdPF6JCbCzecNXb7zkwYK2iFdsoW+7gEUIy 3xPlBIA/C2LC7aSIVNLQS7rjhYhQEvOPDoRmYNJ7Y8Ko9qb8lSf87Mc0S/akOvqr HMirmLR8UOxDpjlyAMlejSyxIOlVd2GiCFTSb9EIPmB6V/6ObTyPHxCqL/gNMh8= =iIKe -----END PGP SIGNATURE----- --envbJBWh7q8WU6mo--