Make native dialogs application-modal in wxMSW
Being able to use other application windows while a modal dialog was shown was unexpected and could easily result in nasty reentrancies, and was also inconsistent with the behaviour of ShowModal() for the dialogs defined in wx, so disable all the windows, not just the parent one, while showing the native modal dialogs too. Closes #11887.
This commit is contained in:
@@ -177,6 +177,8 @@ int wxColourDialog::ShowModal()
|
||||
{
|
||||
WX_HOOK_MODAL_DIALOG();
|
||||
|
||||
wxWindowDisabler disableOthers(this);
|
||||
|
||||
wxWindow* const parent = GetParentForModalDialog(m_parent, GetWindowStyle());
|
||||
WXHWND hWndParent = parent ? GetHwndOf(parent) : NULL;
|
||||
|
||||
|
||||
@@ -152,6 +152,8 @@ int wxDirDialog::ShowModal()
|
||||
{
|
||||
WX_HOOK_MODAL_DIALOG();
|
||||
|
||||
wxWindowDisabler disableOthers(this);
|
||||
|
||||
wxWindow* const parent = GetParentForModalDialog();
|
||||
WXHWND hWndParent = parent ? GetHwndOf(parent) : NULL;
|
||||
|
||||
|
||||
@@ -430,6 +430,8 @@ int wxFileDialog::ShowModal()
|
||||
{
|
||||
WX_HOOK_MODAL_DIALOG();
|
||||
|
||||
wxWindowDisabler disableOthers(this);
|
||||
|
||||
wxWindow* const parent = GetParentForModalDialog(m_parent, GetWindowStyle());
|
||||
WXHWND hWndParent = parent ? GetHwndOf(parent) : NULL;
|
||||
|
||||
|
||||
@@ -92,6 +92,8 @@ int wxFontDialog::ShowModal()
|
||||
{
|
||||
WX_HOOK_MODAL_DIALOG();
|
||||
|
||||
wxWindowDisabler disableOthers(this);
|
||||
|
||||
wxWindow* const parent = GetParentForModalDialog(m_parent, GetWindowStyle());
|
||||
WXHWND hWndParent = parent ? GetHwndOf(parent) : NULL;
|
||||
// It should be OK to always use GDI simulations
|
||||
|
||||
@@ -539,6 +539,8 @@ int wxMessageDialog::ShowModal()
|
||||
{
|
||||
WX_HOOK_MODAL_DIALOG();
|
||||
|
||||
wxWindowDisabler disableOthers(this);
|
||||
|
||||
#ifdef wxHAS_MSW_TASKDIALOG
|
||||
if ( HasNativeTaskDialog() )
|
||||
{
|
||||
|
||||
@@ -29,6 +29,7 @@
|
||||
#include "wx/app.h"
|
||||
#include "wx/dcprint.h"
|
||||
#include "wx/cmndata.h"
|
||||
#include "wx/utils.h" // for wxWindowDisabler
|
||||
#endif
|
||||
|
||||
#include "wx/printdlg.h"
|
||||
@@ -805,6 +806,8 @@ int wxWindowsPrintDialog::ShowModal()
|
||||
{
|
||||
WX_HOOK_MODAL_DIALOG();
|
||||
|
||||
wxWindowDisabler disableOthers(this);
|
||||
|
||||
wxWindow* const parent = GetParentForModalDialog(m_parent, GetWindowStyle());
|
||||
WXHWND hWndParent = parent ? GetHwndOf(parent) : NULL;
|
||||
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
|
||||
#ifndef WX_PRECOMP
|
||||
#include "wx/msw/private.h"
|
||||
#include "wx/utils.h" // for wxWindowDisabler
|
||||
#endif
|
||||
|
||||
// This will define wxHAS_MSW_TASKDIALOG if we have support for it in the
|
||||
@@ -36,6 +37,8 @@ int wxRichMessageDialog::ShowModal()
|
||||
|
||||
if ( HasNativeTaskDialog() )
|
||||
{
|
||||
wxWindowDisabler disableOthers(this);
|
||||
|
||||
// create a task dialog
|
||||
WinStruct<TASKDIALOGCONFIG> tdc;
|
||||
wxMSWTaskDialogConfig wxTdc(*this);
|
||||
|
||||
Reference in New Issue
Block a user