From patchwork Sun Oct 30 15:08:56 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Samuel Thibault X-Patchwork-Id: 9404507 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 97DF360588 for ; Sun, 30 Oct 2016 15:09:30 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7615628F56 for ; Sun, 30 Oct 2016 15:09:30 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 55C7328F45; Sun, 30 Oct 2016 15:09:30 +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 CC29328F45 for ; Sun, 30 Oct 2016 15:09:29 +0000 (UTC) Received: from localhost ([::1]:58829 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1c0rjk-0005m0-Ly for patchwork-qemu-devel@patchwork.kernel.org; Sun, 30 Oct 2016 11:09:28 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:47052) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1c0rjJ-0005le-LA for qemu-devel@nongnu.org; Sun, 30 Oct 2016 11:09:02 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1c0rjI-0002F3-Ii for qemu-devel@nongnu.org; Sun, 30 Oct 2016 11:09:01 -0400 Received: from hera.aquilenet.fr ([2a01:474::1]:41747) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1c0rjI-0002EH-CP for qemu-devel@nongnu.org; Sun, 30 Oct 2016 11:09:00 -0400 Received: from localhost (localhost [127.0.0.1]) by hera.aquilenet.fr (Postfix) with ESMTP id F07D08FB1; Sun, 30 Oct 2016 16:08:59 +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 491vPpnSMacS; Sun, 30 Oct 2016 16:08:59 +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 A65A09A59; Sun, 30 Oct 2016 16:08:58 +0100 (CET) Received: from samy by var.youpi.perso.aquilenet.fr with local (Exim 4.87) (envelope-from ) id 1c0rjG-0000g0-3e; Sun, 30 Oct 2016 16:08:58 +0100 From: Samuel Thibault To: qemu-devel@nongnu.org, kraxel@redhat.com Date: Sun, 30 Oct 2016 16:08:56 +0100 Message-Id: <20161030150857.2557-3-samuel.thibault@ens-lyon.org> X-Mailer: git-send-email 2.10.1 In-Reply-To: <20161030150857.2557-1-samuel.thibault@ens-lyon.org> References: <20161030150857.2557-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 2/3] console: move window ID code from baum to sdl 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 moves the SDL bits for window ID from the baum driver to SDL, as well as fixing the build for non-X11. Signed-off-by: Samuel Thibault --- backends/baum.c | 25 +++---------------------- ui/sdl.c | 25 +++++++++++++++++++++++++ 2 files changed, 28 insertions(+), 22 deletions(-) diff --git a/backends/baum.c b/backends/baum.c index b92369d..5d7d27c 100644 --- a/backends/baum.c +++ b/backends/baum.c @@ -27,12 +27,10 @@ #include "sysemu/char.h" #include "qemu/timer.h" #include "hw/usb.h" +#include "ui/console.h" #include #include #include -#ifdef CONFIG_SDL -#include -#endif #if 0 #define DPRINTF(fmt, ...) \ @@ -227,11 +225,6 @@ static const uint8_t nabcc_translation[2][256] = { /* The guest OS has started discussing with us, finish initializing BrlAPI */ static int baum_deferred_init(BaumDriverState *baum) { -#if defined(CONFIG_SDL) -#if SDL_COMPILEDVERSION < SDL_VERSIONNUM(2, 0, 0) - SDL_SysWMinfo info; -#endif -#endif int tty; if (baum->deferred_init) { @@ -243,21 +236,9 @@ static int baum_deferred_init(BaumDriverState *baum) return 0; } -#if defined(CONFIG_SDL) -#if SDL_COMPILEDVERSION < SDL_VERSIONNUM(2, 0, 0) - memset(&info, 0, sizeof(info)); - SDL_VERSION(&info.version); - if (SDL_GetWMInfo(&info)) { - tty = info.info.x11.wmwindow; - } else { -#endif -#endif + tty = qemu_graphic_console_get_window_id(); + if (tty == -1) tty = BRLAPI_TTY_DEFAULT; -#if defined(CONFIG_SDL) -#if SDL_COMPILEDVERSION < SDL_VERSIONNUM(2, 0, 0) - } -#endif -#endif if (brlapi__enterTtyMode(baum->brlapi, tty, NULL) == -1) { brlapi_perror("baum: brlapi__enterTtyMode"); diff --git a/ui/sdl.c b/ui/sdl.c index d8cf5bc..7fa3772 100644 --- a/ui/sdl.c +++ b/ui/sdl.c @@ -947,6 +947,7 @@ void sdl_display_init(DisplayState *ds, int full_screen, int no_frame) int flags; uint8_t data = 0; const SDL_VideoInfo *vi; + SDL_SysWMinfo info; char *filename; #if defined(__APPLE__) @@ -1023,5 +1024,29 @@ void sdl_display_init(DisplayState *ds, int full_screen, int no_frame) sdl_cursor_hidden = SDL_CreateCursor(&data, &data, 8, 1, 0, 0); sdl_cursor_normal = SDL_GetCursor(); + memset(&info, 0, sizeof(info)); + SDL_VERSION(&info.version); + if (SDL_GetWMInfo(&info)) { + int i; + for (i = 0; ; i++) { + /* All consoles share the same window */ + QemuConsole *con = qemu_console_lookup_by_index(i); + if (con) { +#if defined(SDL_VIDEO_DRIVER_X11) + qemu_console_set_window_id(i, info.info.x11.wmwindow); +#elif defined(SDL_VIDEO_DRIVER_NANOX) || \ + defined(SDL_VIDEO_DRIVER_WINDIB) || defined(SDL_VIDEO_DRIVER_DDRAW) || \ + defined(SDL_VIDEO_DRIVER_GAPI) || \ + defined(SDL_VIDEO_DRIVER_RISCOS) + qemu_console_set_window_id(i, (int) info.window); +#else + qemu_console_set_window_id(i, info.data); +#endif + } else { + break; + } + } + } + atexit(sdl_cleanup); }