[Commits] SDL: windows: msgboxes should specify a parent HWND if possible ...

libsdl.org revision control commits-owner at libsdl.org
Fri May 26 21:30:19 PDT 2017


details:   https://hg.libsdl.org/SDL/rev/c5346d5c3c79
changeset: 11036:c5346d5c3c79
user:      Ryan C. Gordon <icculus at icculus.org>
date:      Sat May 27 00:30:06 2017 -0400
description:
windows: msgboxes should specify a parent HWND if possible (thanks, Ismael!).

This lets them be properly modal.

Fixes Bugzilla #3650.

diffstat:

 src/video/windows/SDL_windowsmessagebox.c |  10 ++++++++--
 1 files changed, 8 insertions(+), 2 deletions(-)

diffs (27 lines):

diff -r 10552ae634ca -r c5346d5c3c79 src/video/windows/SDL_windowsmessagebox.c
--- a/src/video/windows/SDL_windowsmessagebox.c	Fri May 26 22:45:52 2017 +0200
+++ b/src/video/windows/SDL_windowsmessagebox.c	Sat May 27 00:30:06 2017 -0400
@@ -354,6 +354,7 @@
     wchar_t* wmessage;
     TEXTMETRIC TM;
 
+    HWND ParentWindow = NULL;
 
     const int ButtonWidth = 88;
     const int ButtonHeight = 26;
@@ -469,8 +470,13 @@
         x += ButtonWidth + ButtonMargin;
     }
 
-    /* FIXME: If we have a parent window, get the Instance and HWND for them */
-    which = DialogBoxIndirect(NULL, (DLGTEMPLATE*)dialog->lpDialog, NULL, (DLGPROC)MessageBoxDialogProc);
+    /* If we have a parent window, get the Instance and HWND for them
+     * so that our little dialog gets exclusive focus at all times. */
+    if (messageboxdata->window)
+        ParentWindow = ((SDL_WindowData*)messageboxdata->window->driverdata)->hwnd;
+
+
+    which = DialogBoxIndirect(NULL, (DLGTEMPLATE*)dialog->lpDialog, ParentWindow, (DLGPROC)MessageBoxDialogProc);
     *buttonid = buttons[which].buttonid;
 
     FreeDialogData(dialog);


More information about the commits mailing list