sdl2: update window_handle to support Windows and intro display_handle
authorAlexis Laferrière <alexis.laf@xymus.net>
Thu, 23 Feb 2017 20:39:53 +0000 (15:39 -0500)
committerAlexis Laferrière <alexis.laf@xymus.net>
Sun, 26 Feb 2017 13:37:46 +0000 (08:37 -0500)
Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>

lib/sdl2/syswm.nit

index 068c634..19bd81b 100644 (file)
@@ -99,10 +99,21 @@ extern class SDLSysWMInfo `{ SDL_SysWMinfo * `}
                #endif
        `}
 
-       # Returns the handle of this window on a X11 window system
-       #
-       # Require: `is_x11`
-       fun x11_window_handle: Pointer `{
-               return (void*)self->info.x11.window;
+       # Handle to the window
+       fun window_handle: Pointer `{
+               #ifdef _WIN32
+                       return (void*)self->info.win.window;
+               #else
+                       return (void*)self->info.x11.window;
+               #endif
+       `}
+
+       # Handle to the display or device context
+       fun display_handle: Pointer `{
+               #ifdef _WIN32
+                       return (void*)self->info.win.hdc;
+               #else
+                       return (void*)self->info.x11.display;
+               #endif
        `}
 end