From patchwork Sun Apr 26 19:04:20 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jan Kiszka X-Patchwork-Id: 464728 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id E02FA1400A0 for ; Mon, 27 Apr 2015 05:05:11 +1000 (AEST) Received: from localhost ([::1]:51790 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YmRrY-0006hK-4E for incoming@patchwork.ozlabs.org; Sun, 26 Apr 2015 15:05:08 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:55120) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YmRr3-0005tn-4I for qemu-devel@nongnu.org; Sun, 26 Apr 2015 15:04:37 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YmRqz-0004X7-HS for qemu-devel@nongnu.org; Sun, 26 Apr 2015 15:04:36 -0400 Received: from mout.web.de ([212.227.17.11]:55137) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YmRqz-0004Wq-7N for qemu-devel@nongnu.org; Sun, 26 Apr 2015 15:04:33 -0400 Received: from md1f2u6c.ww002.siemens.net ([95.157.58.223]) by smtp.web.de (mrweb102) with ESMTPSA (Nemesis) id 0MVu1U-1YofqQ11EO-00X17x; Sun, 26 Apr 2015 21:04:30 +0200 From: Jan Kiszka To: qemu-devel , Gerd Hoffmann Date: Sun, 26 Apr 2015 21:04:20 +0200 Message-Id: X-Mailer: git-send-email 2.1.4 In-Reply-To: References: In-Reply-To: References: X-Provags-ID: V03:K0:37boUZCh+6ViDG8l9rcZLmIxYVYc725R8lXLNuX4fVslUKVE2Fc P+68RhVnbwjuuAwE3pfoiEiJphM3KYiCS41megEtZXb9kor9NRBZHb2KRX53DdQ1C8MvezQ E0IjtcPjDJpqbZz7ihDbVW/WLo1jAqhjKacHKVoEtiFnFjKnu+GJtGP4lTfpKefMwJTpRCr eGrWPFwtFAeM64ZamUPvw== X-UI-Out-Filterresults: notjunk:1; X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [generic] X-Received-From: 212.227.17.11 Cc: John Snow Subject: [Qemu-devel] [PATCH 1/2] gtk: Fix VTE focus grabbing X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org 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. CC: John Snow Signed-off-by: Jan Kiszka --- ui/gtk.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/ui/gtk.c b/ui/gtk.c index 51abac9..76d9b73 100644 --- a/ui/gtk.c +++ b/ui/gtk.c @@ -1021,15 +1021,17 @@ 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); + if (vc->type == GD_VC_VTE) { + gtk_widget_grab_focus(vc->vte.terminal); + } else { + gtk_widget_grab_focus(vc->tab_item); + } } }