From patchwork Wed Dec 21 00:38:06 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Samuel Thibault X-Patchwork-Id: 9482417 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 C22F660821 for ; Wed, 21 Dec 2016 00:41:32 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B3D07284E0 for ; Wed, 21 Dec 2016 00:41:32 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A8342284F2; Wed, 21 Dec 2016 00:41:32 +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 7D8FE284E0 for ; Wed, 21 Dec 2016 00:41:31 +0000 (UTC) Received: from localhost ([::1]:54252 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cJUyI-00042M-Ld for patchwork-qemu-devel@patchwork.kernel.org; Tue, 20 Dec 2016 19:41:30 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:51701) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cJUvA-0001h1-7n for qemu-devel@nongnu.org; Tue, 20 Dec 2016 19:38:17 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cJUv7-00087h-EH for qemu-devel@nongnu.org; Tue, 20 Dec 2016 19:38:16 -0500 Received: from hera.aquilenet.fr ([141.255.128.1]:59703) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cJUv7-00087R-7W for qemu-devel@nongnu.org; Tue, 20 Dec 2016 19:38:13 -0500 Received: from localhost (localhost [127.0.0.1]) by hera.aquilenet.fr (Postfix) with ESMTP id AD33AB3A8; Wed, 21 Dec 2016 01:38: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 Y68c_q6UoEuy; Wed, 21 Dec 2016 01:38: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 89CC4B3AB; Wed, 21 Dec 2016 01:38:09 +0100 (CET) Received: from samy by var.youpi.perso.aquilenet.fr with local (Exim 4.88) (envelope-from ) id 1cJUv2-0005qH-Pu; Wed, 21 Dec 2016 01:38:08 +0100 From: Samuel Thibault To: qemu-devel@nongnu.org, Gerd Hoffmann Date: Wed, 21 Dec 2016 01:38:06 +0100 Message-Id: <20161221003806.22412-4-samuel.thibault@ens-lyon.org> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20161221003806.22412-1-samuel.thibault@ens-lyon.org> References: <20161221003806.22412-1-samuel.thibault@ens-lyon.org> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 141.255.128.1 Subject: [Qemu-devel] [PATCH 3/3] sdl2: 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 SDL2 windows. Signed-off-by: Samuel Thibault --- ui/sdl2.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/ui/sdl2.c b/ui/sdl2.c index 30d2a3c35d..9a79b17b92 100644 --- a/ui/sdl2.c +++ b/ui/sdl2.c @@ -761,6 +761,7 @@ void sdl_display_init(DisplayState *ds, int full_screen, int no_frame) uint8_t data = 0; char *filename; int i; + SDL_SysWMinfo info; if (no_frame) { gui_noframe = 1; @@ -786,6 +787,8 @@ void sdl_display_init(DisplayState *ds, int full_screen, int no_frame) exit(1); } SDL_SetHint(SDL_HINT_GRAB_KEYBOARD, "1"); + memset(&info, 0, sizeof(info)); + SDL_VERSION(&info.version); for (i = 0;; i++) { QemuConsole *con = qemu_console_lookup_by_index(i); @@ -813,6 +816,10 @@ void sdl_display_init(DisplayState *ds, int full_screen, int no_frame) #endif sdl2_console[i].dcl.con = con; register_displaychangelistener(&sdl2_console[i].dcl); + + if (SDL_GetWindowWMInfo(sdl2_console[i].real_window, &info)) { + qemu_console_set_window_id(con, info.info.x11.window); + } } /* Load a 32x32x4 image. White pixels are transparent. */