diff options
author | Samuel Thibault <samuel.thibault@ens-lyon.org> | 2016-12-21 01:38:05 +0100 |
---|---|---|
committer | Gerd Hoffmann <kraxel@redhat.com> | 2017-01-10 08:14:20 +0100 |
commit | f29b3431f6294168e5f8fc63edb91c15c6a08e41 (patch) | |
tree | 2d271f99511c902f501608b3eb1cc70be5fa08f5 /backends | |
parent | b3cb21b9b5ece1756a4796e2f2e3d275bf110002 (diff) |
console: move window ID code from baum to sdl
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 <samuel.thibault@ens-lyon.org>
Message-id: 20161221003806.22412-3-samuel.thibault@ens-lyon.org
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Diffstat (limited to 'backends')
-rw-r--r-- | backends/baum.c | 31 |
1 files changed, 8 insertions, 23 deletions
diff --git a/backends/baum.c b/backends/baum.c index b92369d840..b045ef49c5 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 <brlapi.h> #include <brlapi_constants.h> #include <brlapi_keycodes.h> -#ifdef CONFIG_SDL -#include <SDL_syswm.h> -#endif #if 0 #define DPRINTF(fmt, ...) \ @@ -227,12 +225,8 @@ 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; + int tty = BRLAPI_TTY_DEFAULT; + QemuConsole *con; if (baum->deferred_init) { return 1; @@ -243,21 +237,12 @@ 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 = BRLAPI_TTY_DEFAULT; -#if defined(CONFIG_SDL) -#if SDL_COMPILEDVERSION < SDL_VERSIONNUM(2, 0, 0) + con = qemu_console_lookup_by_index(0); + if (con && qemu_console_is_graphic(con)) { + tty = qemu_console_get_window_id(con); + if (tty == -1) + tty = BRLAPI_TTY_DEFAULT; } -#endif -#endif if (brlapi__enterTtyMode(baum->brlapi, tty, NULL) == -1) { brlapi_perror("baum: brlapi__enterTtyMode"); |