From 331a434fa1a64add928dfd312ce876b539008eaf Mon Sep 17 00:00:00 2001 From: "Ryan C. Gordon" Date: Mon, 23 Mar 2015 19:47:08 -0400 Subject: [PATCH] Windows: Report window HDC in SDL_SysWMinfo. Fixes Bugzilla #2668. --- include/SDL_syswm.h | 1 + src/video/windows/SDL_windowswindow.c | 5 +++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/include/SDL_syswm.h b/include/SDL_syswm.h index 03c3b025d..c26533384 100644 --- a/include/SDL_syswm.h +++ b/include/SDL_syswm.h @@ -186,6 +186,7 @@ struct SDL_SysWMinfo struct { HWND window; /**< The window handle */ + HDC hdc; /**< The window device context */ } win; #endif #if defined(SDL_VIDEO_DRIVER_WINRT) diff --git a/src/video/windows/SDL_windowswindow.c b/src/video/windows/SDL_windowswindow.c index 94328339f..463db1e06 100644 --- a/src/video/windows/SDL_windowswindow.c +++ b/src/video/windows/SDL_windowswindow.c @@ -643,10 +643,11 @@ WIN_DestroyWindow(_THIS, SDL_Window * window) 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",