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 From: Samuel Thibault Date: Mon, 31 Oct 2016 17:00:07 +0100 Message-Id: <20161031160007.6047-5-samuel.thibault@ens-lyon.org> In-Reply-To: <20161031160007.6047-1-samuel.thibault@ens-lyon.org> References: <20161031160007.6047-1-samuel.thibault@ens-lyon.org> Subject: [Qemu-devel] [PATCH 4/4] gtk: set window ID List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org, kraxel@redhat.com Cc: Samuel Thibault 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) -- 2.10.1