Windows: Fixed crash if using current SDL_GetWindowWMInfo() from older programs.

This commit is contained in:
Philipp Wiesemann 2016-11-18 00:06:09 +01:00
parent d05a39d0a6
commit a49ac09c02
1 changed files with 7 additions and 1 deletions

View File

@ -697,9 +697,15 @@ WIN_GetWindowWMInfo(_THIS, SDL_Window * window, SDL_SysWMinfo * info)
{ {
const SDL_WindowData *data = (const SDL_WindowData *) window->driverdata; const SDL_WindowData *data = (const SDL_WindowData *) window->driverdata;
if (info->version.major <= SDL_MAJOR_VERSION) { if (info->version.major <= SDL_MAJOR_VERSION) {
int versionnum = SDL_VERSIONNUM(info->version.major, info->version.minor, info->version.patch);
info->subsystem = SDL_SYSWM_WINDOWS; info->subsystem = SDL_SYSWM_WINDOWS;
info->info.win.window = data->hwnd; info->info.win.window = data->hwnd;
if (versionnum >= SDL_VERSIONNUM(2, 0, 4)) {
info->info.win.hdc = data->hdc; info->info.win.hdc = data->hdc;
}
return SDL_TRUE; return SDL_TRUE;
} else { } else {
SDL_SetError("Application not compiled with SDL %d.%d\n", SDL_SetError("Application not compiled with SDL %d.%d\n",