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
diff --git a/ui/sdl2.c b/ui/sdl2.c
index 9a79b17b92..0f41d1fa90 100644
--- a/ui/sdl2.c
+++ b/ui/sdl2.c
@@ -762,6 +762,9 @@ void sdl_display_init(DisplayState *ds, int full_screen, 
int no_frame)
     char *filename;
     int i;
     SDL_SysWMinfo info;
+#if defined(SDL_VIDEO_DRIVER_WINDOWS) || defined(SDL_VIDEO_DRIVER_X11)
+    int window_id;
+#endif
 
     if (no_frame) {
         gui_noframe = 1;
@@ -817,9 +820,17 @@ 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)) {
-            qemu_console_set_window_id(con, info.info.x11.window);
+#ifdef SDL_VIDEO_DRIVER_WINDOWS
+            window_id = (int)(uintptr_t) info.info.win.hwnd;
+#endif
+#ifdef SDL_VIDEO_DRIVER_X11
+            window_id = info.info.x11.window;
+#endif
+            qemu_console_set_window_id(con, window_id);
         }
+#endif
     }
 
     /* Load a 32x32x4 image. White pixels are transparent. */

Reply via email to