Windows: Report window HDC in SDL_SysWMinfo.
authorRyan C. Gordon <icculus@icculus.org>
Mon, 23 Mar 2015 19:47:08 -0400
changeset 9422 286c854c1d5b
parent 9421 fd5dd91ec0ce
child 9423 3df83030dab9
Windows: Report window HDC in SDL_SysWMinfo. Fixes Bugzilla #2668.
include/SDL_syswm.h
src/video/windows/SDL_windowswindow.c
--- a/include/SDL_syswm.h	Mon Mar 23 20:24:04 2015 +0100
+++ b/include/SDL_syswm.h	Mon Mar 23 19:47:08 2015 -0400
@@ -186,6 +186,7 @@
         struct
         {
             HWND window;                /**< The window handle */
+            HDC hdc;                    /**< The window device context */
         } win;
 #endif
 #if defined(SDL_VIDEO_DRIVER_WINRT)
--- a/src/video/windows/SDL_windowswindow.c	Mon Mar 23 20:24:04 2015 +0100
+++ b/src/video/windows/SDL_windowswindow.c	Mon Mar 23 19:47:08 2015 -0400
@@ -643,10 +643,11 @@
 SDL_bool
 WIN_GetWindowWMInfo(_THIS, SDL_Window * window, SDL_SysWMinfo * info)
 {
-    HWND hwnd = ((SDL_WindowData *) window->driverdata)->hwnd;
+    const SDL_WindowData *data = (const SDL_WindowData *) window->driverdata;
     if (info->version.major <= SDL_MAJOR_VERSION) {
         info->subsystem = SDL_SYSWM_WINDOWS;
-        info->info.win.window = hwnd;
+        info->info.win.window = data->hwnd;
+        info->info.win.hdc = data->hdc;
         return SDL_TRUE;
     } else {
         SDL_SetError("Application not compiled with SDL %d.%d\n",