From f29b3431f6294168e5f8fc63edb91c15c6a08e41 Mon Sep 17 00:00:00 2001 From: Samuel Thibault Date: Wed, 21 Dec 2016 01:38:05 +0100 Subject: 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 Message-id: 20161221003806.22412-3-samuel.thibault@ens-lyon.org Signed-off-by: Gerd Hoffmann --- ui/sdl.c | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) (limited to 'ui/sdl.c') diff --git a/ui/sdl.c b/ui/sdl.c index d8cf5bcf74..19e8a848a7 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(con, 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(con, (int) (uintptr_t) info.window); +#else + qemu_console_set_window_id(con, info.data); +#endif + } else { + break; + } + } + } + atexit(sdl_cleanup); } -- cgit v1.2.3-55-g7522