diff mbox

[PULL,v2,05/11] sdl2: set window ID

Message ID ac52618f-a5c1-3b4b-3d07-2bdbb6fb1372@weilnetz.de
State New
Headers show

Commit Message

Stefan Weil Jan. 12, 2017, 7:07 p.m. UTC
On 01/12/17 18:05, Samuel Thibault wrote:
> Hello,
>
> Gerd Hoffmann, on Thu 12 Jan 2017 16:56:49 +0100, wrote:
>> On Do, 2017-01-12 at 16:10 +0100, Stefan Weil wrote:
>>> This commit breaks builds for Windows. See below for details.
>>
>>> Windows does not use X11. gcc fails:
>>>
>>>   CC      ui/sdl2.o
>>> /qemu/ui/sdl2.c: In function ‘sdl_display_init’:
>>> /qemu/ui/sdl2.c:821:54: error: ‘union <anonymous>’ has no member named ‘x11’
>>>              qemu_console_set_window_id(con, info.info.x11.window);
>>
>> Oops.
>
> Oops, sorry, it seems to have been overlooked indeed.  Can you easily
> test the attached patch?
>
> Samuel
>

It does not compile. I fixed it and simplified the code a little bit
(see below, please fix line wrap which my mailer enforced). That code
compiles. I did not run tests.

Stefan



      /* Load a 32x32x4 image. White pixels are transparent. */
diff mbox

Patch

diff --git a/ui/sdl2.c b/ui/sdl2.c
index 9a79b17b92..91fb111aa5 100644
--- a/ui/sdl2.c
+++ b/ui/sdl2.c
@@ -817,9 +817,15 @@  void sdl_display_init(DisplayState *ds, int 
full_screen, int no_frame)
          sdl2_console[i].dcl.con = con;
          register_displaychangelistener(&sdl2_console[i].dcl);

+#if defined(SDL_VIDEO_DRIVER_WINDOWS) || defined(SDL_VIDEO_DRIVER_X11)
          if (SDL_GetWindowWMInfo(sdl2_console[i].real_window, &info)) {
+#if defined(SDL_VIDEO_DRIVER_WINDOWS)
+            qemu_console_set_window_id(con, 
(uintptr_t)info.info.win.window);
+#elif defined(SDL_VIDEO_DRIVER_X11)
              qemu_console_set_window_id(con, info.info.x11.window);
+#endif
          }
+#endif
      }