Skip to content

Commit

Permalink
windows: msgboxes should specify a parent HWND if possible (thanks, I…
Browse files Browse the repository at this point in the history
…smael!).

This lets them be properly modal.

Fixes Bugzilla #3650.
  • Loading branch information
icculus committed May 27, 2017
1 parent 90ed3da commit 3fbd21c
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/video/windows/SDL_windowsmessagebox.c
Expand Up @@ -354,6 +354,7 @@ WIN_ShowMessageBox(const SDL_MessageBoxData *messageboxdata, int *buttonid)
wchar_t* wmessage;
TEXTMETRIC TM;

HWND ParentWindow = NULL;

const int ButtonWidth = 88;
const int ButtonHeight = 26;
Expand Down Expand Up @@ -469,8 +470,13 @@ WIN_ShowMessageBox(const SDL_MessageBoxData *messageboxdata, int *buttonid)
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);
Expand Down

0 comments on commit 3fbd21c

Please sign in to comment.