From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:56750) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YmfGh-0005Bk-83 for qemu-devel@nongnu.org; Mon, 27 Apr 2015 05:24:00 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YmfGd-0000O2-2d for qemu-devel@nongnu.org; Mon, 27 Apr 2015 05:23:59 -0400 Received: from mx1.redhat.com ([209.132.183.28]:59753) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YmfGc-0000Nl-TK for qemu-devel@nongnu.org; Mon, 27 Apr 2015 05:23:55 -0400 Message-ID: <1430126631.22166.9.camel@nilsson.home.kraxel.org> From: Gerd Hoffmann Date: Mon, 27 Apr 2015 11:23:51 +0200 In-Reply-To: References: Content-Type: multipart/mixed; boundary="=-TVkwV4axXlkdS/9QnbAl" Mime-Version: 1.0 Subject: Re: [Qemu-devel] [PATCH 1/2] gtk: Fix VTE focus grabbing List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Jan Kiszka Cc: John Snow , qemu-devel --=-TVkwV4axXlkdS/9QnbAl Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit On So, 2015-04-26 at 21:04 +0200, Jan Kiszka wrote: > From: Jan Kiszka > > At least on GTK2, the VTE terminal has to be specified as target of > gtk_widget_grab_focus. Otherwise, switching from one VTE terminal to > another causes the focus to get lost. Fails to build with CONFIG_VTE=n, update attached, please verify. thanks, Gerd --=-TVkwV4axXlkdS/9QnbAl Content-Disposition: attachment; filename="0001-gtk-Fix-VTE-focus-grabbing.patch" Content-Type: text/x-patch; name="0001-gtk-Fix-VTE-focus-grabbing.patch"; charset="UTF-8" Content-Transfer-Encoding: 7bit >>From 9d677e1c2fa479336fb7a2b90aea78c10d037e98 Mon Sep 17 00:00:00 2001 From: Jan Kiszka Date: Sun, 26 Apr 2015 21:04:20 +0200 Subject: [PATCH] gtk: Fix VTE focus grabbing At least on GTK2, the VTE terminal has to be specified as target of gtk_widget_grab_focus. Otherwise, switching from one VTE terminal to another causes the focus to get lost. CC: John Snow Signed-off-by: Jan Kiszka [ kraxel: fixed build with CONFIG_VTE=n ] Signed-off-by: Gerd Hoffmann --- ui/gtk.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/ui/gtk.c b/ui/gtk.c index 7180066..763d97a 100644 --- a/ui/gtk.c +++ b/ui/gtk.c @@ -170,6 +170,7 @@ typedef struct VirtualConsole { GtkWidget *window; GtkWidget *menu_item; GtkWidget *tab_item; + GtkWidget *focus; VirtualConsoleType type; union { VirtualGfxConsole gfx; @@ -1060,15 +1061,13 @@ 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(nb, vc->tab_item); gtk_notebook_set_current_page(nb, page); - child = gtk_notebook_get_nth_page(nb, page); - gtk_widget_grab_focus(child); + gtk_widget_grab_focus(vc->focus); } } @@ -1588,6 +1587,7 @@ static GSList *gd_vc_vte_init(GtkDisplayState *s, VirtualConsole *vc, vc->type = GD_VC_VTE; vc->tab_item = box; + vc->focus = vc->vte.terminal; gtk_notebook_append_page(GTK_NOTEBOOK(s->notebook), vc->tab_item, gtk_label_new(vc->label)); @@ -1749,6 +1749,7 @@ static GSList *gd_vc_gfx_init(GtkDisplayState *s, VirtualConsole *vc, vc->type = GD_VC_GFX; vc->tab_item = vc->gfx.drawing_area; + vc->focus = vc->gfx.drawing_area; gtk_notebook_append_page(GTK_NOTEBOOK(s->notebook), vc->tab_item, gtk_label_new(vc->label)); -- 1.8.3.1 --=-TVkwV4axXlkdS/9QnbAl--