Fix the effective parent of wxGenericFindReplaceDialog

This dialog is non-modal and so using GetParentForModalDialog() for it
is not quite right, because this function checks that the candidate
parent window is visible, which may not be the case for a modeless
dialog parent, as the dialog isn't necessarily going to be shown
immediately, but may well be shown later, after showing its parent.

And not allowing to use the not yet shown parent was also inconsistent
with the native MSW version which didn't have any problem with this.

So fix this by adding new GetParentForModelessDialog() function and
using it for this modeless dialog instead. This required slightly
refactoring wxDialog code to allow reusing most of it between the old
GetParentForModalDialog() and the new function.
This commit is contained in:
Vadim Zeitlin
2021-08-23 17:53:03 +01:00
parent 8bbcf0af09
commit ce92055f3a
3 changed files with 47 additions and 13 deletions

View File

@@ -83,7 +83,7 @@ bool wxGenericFindReplaceDialog::Create(wxWindow *parent,
const wxString& title,
int style)
{
parent = GetParentForModalDialog(parent, style);
parent = GetParentForModelessDialog(parent, style);
if ( !wxDialog::Create(parent, wxID_ANY, title,
wxDefaultPosition, wxDefaultSize,