From patchwork Mon Oct 31 16:00:07 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Samuel Thibault X-Patchwork-Id: 9405915 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id DD8F7601C0 for ; Mon, 31 Oct 2016 16:39:49 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C9B9229342 for ; Mon, 31 Oct 2016 16:39:49 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id BCD9C2934B; Mon, 31 Oct 2016 16:39:49 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 583AB29342 for ; Mon, 31 Oct 2016 16:39:49 +0000 (UTC) Received: from localhost ([::1]:36940 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1c1Fci-0002N7-MB for patchwork-qemu-devel@patchwork.kernel.org; Mon, 31 Oct 2016 12:39:48 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:33422) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1c1F0Q-00005v-4a for qemu-devel@nongnu.org; Mon, 31 Oct 2016 12:00:14 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1c1F0P-0003MU-Fm for qemu-devel@nongnu.org; Mon, 31 Oct 2016 12:00:14 -0400 Received: from hera.aquilenet.fr ([2a01:474::1]:44728) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1c1F0P-0003MG-9U for qemu-devel@nongnu.org; Mon, 31 Oct 2016 12:00:13 -0400 Received: from localhost (localhost [127.0.0.1]) by hera.aquilenet.fr (Postfix) with ESMTP id B5DA2A166; Mon, 31 Oct 2016 17:00:12 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at aquilenet.fr Received: from hera.aquilenet.fr ([127.0.0.1]) by localhost (hera.aquilenet.fr [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id smWisj9hvkby; Mon, 31 Oct 2016 17:00:12 +0100 (CET) Received: from var.youpi.perso.aquilenet.fr (unknown [IPv6:2a01:cb19:181:c200:3602:86ff:fe2c:6a19]) by hera.aquilenet.fr (Postfix) with ESMTPSA id 5F2BFA168; Mon, 31 Oct 2016 17:00:10 +0100 (CET) Received: from samy by var.youpi.perso.aquilenet.fr with local (Exim 4.87) (envelope-from ) id 1c1F0L-0001aR-PB; Mon, 31 Oct 2016 17:00:09 +0100 From: Samuel Thibault To: qemu-devel@nongnu.org, kraxel@redhat.com Date: Mon, 31 Oct 2016 17:00:07 +0100 Message-Id: <20161031160007.6047-5-samuel.thibault@ens-lyon.org> X-Mailer: git-send-email 2.10.1 In-Reply-To: <20161031160007.6047-1-samuel.thibault@ens-lyon.org> References: <20161031160007.6047-1-samuel.thibault@ens-lyon.org> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2a01:474::1 Subject: [Qemu-devel] [PATCH 4/4] gtk: set window ID X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Samuel Thibault Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP This uses the console API to record the window ID of the GTK windows. Signed-off-by: Samuel Thibault --- ui/gtk.c | 25 +++++++++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) diff --git a/ui/gtk.c b/ui/gtk.c index ca737c4..d75f255 100644 --- a/ui/gtk.c +++ b/ui/gtk.c @@ -2170,6 +2170,13 @@ void gtk_display_init(DisplayState *ds, bool full_screen, bool grab_on_hover) GtkDisplayState *s = g_malloc0(sizeof(*s)); char *filename; GdkDisplay *window_display; + GdkWindow *gdk_window; +#ifdef GDK_WINDOWING_X11 + Window window_id; +#elif defined(GDK_WINDOWING_WIN32) + HWND window_id; +#endif + int i; if (!gtkinit) { fprintf(stderr, "gtk initialization failed\n"); @@ -2232,8 +2239,6 @@ void gtk_display_init(DisplayState *ds, bool full_screen, bool grab_on_hover) { VirtualConsole *cur = gd_vc_find_current(s); if (cur) { - int i; - for (i = 0; i < s->nb_vcs; i++) { VirtualConsole *vc = &s->vc[i]; if (vc && vc->type == GD_VC_VTE && vc != cur) { @@ -2253,6 +2258,22 @@ void gtk_display_init(DisplayState *ds, bool full_screen, bool grab_on_hover) } gd_set_keycode_type(s); + + gdk_window = gtk_widget_get_window(s->window); +#ifdef GDK_WINDOWING_X11 + window_id = GDK_WINDOW_XID(gdk_window); +#elif defined(GDK_WINDOWING_WIN32) + window_id = gdk_win32_window_get_impl_hwnd(gdk_window); +#endif + for (i = 0; ; i++) { + /* All consoles share the same window */ + QemuConsole *con = qemu_console_lookup_by_index(i); + if (con) { + qemu_console_set_window_id(i, (int) window_id); + } else { + break; + } + } } void early_gtk_display_init(int opengl)