From d452fd7891cc7f14dcde36ff14dad1238aebd767 Mon Sep 17 00:00:00 2001 From: hendricks266 Date: Sun, 12 Jan 2014 14:06:15 +0000 Subject: [PATCH] Fix the startup window freeze under SDL2+Windows when a Yes/No box was supposed to be displayed. git-svn-id: https://svn.eduke32.com/eduke32@4254 1a8010ca-5511-0410-912e-c29ae57300e0 --- polymer/eduke32/build/src/sdlayer.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/polymer/eduke32/build/src/sdlayer.c b/polymer/eduke32/build/src/sdlayer.c index d1143a4cd..9c0400af5 100644 --- a/polymer/eduke32/build/src/sdlayer.c +++ b/polymer/eduke32/build/src/sdlayer.c @@ -123,7 +123,7 @@ HWND win_gethwnd(void) if (SDL_GetWindowWMInfo(sdl_window, &wmInfo) != SDL_TRUE) #endif { - initprintf("win_gethwnd: SDL_GetWindowWMInfo() failed: %s\n", SDL_GetError()); + // initprintf("win_gethwnd: SDL_GetWindowWMInfo() failed: %s\n", SDL_GetError()); return 0; } @@ -162,6 +162,9 @@ int32_t wm_msgbox(char *name, char *fmt, ...) return osx_msgbox(name, buf); #elif defined HAVE_GTK2 if (gtkbuild_msgbox(name, buf) >= 0) return 1; +#elif defined _WIN32 + MessageBox(win_gethwnd(),buf,name,MB_OK|MB_TASKMODAL); + return 0; #elif SDL_MAJOR_VERSION==2 # if !defined _WIN32 // Replace all tab chars with spaces because the hand-rolled SDL message @@ -187,7 +190,7 @@ int32_t wm_ynbox(char *name, char *fmt, ...) char buf[2048]; char c; va_list va; -#if (!defined(__APPLE__) && defined(HAVE_GTK2)) +#if (!defined(__APPLE__) && defined(HAVE_GTK2)) || defined _WIN32 int32_t r; #endif @@ -201,6 +204,10 @@ int32_t wm_ynbox(char *name, char *fmt, ...) return osx_ynbox(name, buf); #elif defined HAVE_GTK2 if ((r = gtkbuild_ynbox(name, buf)) >= 0) return r; +#elif defined _WIN32 + r = MessageBox(win_gethwnd(),buf,name,MB_YESNO|MB_ICONQUESTION|MB_TASKMODAL); + if (r==IDYES) return 1; + return 0; #endif puts(buf); puts(" (type 'Y' or 'N', and press Return or Enter to continue)");