Remove special wxFindReplaceDialog hack from wxGUIEventLoop

Don't call IsDialogMessage() for any unknown windows, this is not needed
any longer now that we recognize wxFindReplaceDialog HWND as ours (see
the previous commit) and that its MSWProcessMessage() works correctly
(done in this one).

Removing this IsDialogMessage() call still allows TAB navigation to work
in the "Find" dialog but prevents us from processing unknown messages
for unknown windows, which might have unwatned consequences.
This commit is contained in:
Vadim Zeitlin 2023-08-26 18:20:32 +02:00
parent 79e057fe06
commit a378b7b4be
3 changed files with 16 additions and 9 deletions

View file

@ -41,6 +41,8 @@ public:
virtual void SetTitle( const wxString& title) override;
virtual wxString GetTitle() const override;
virtual bool MSWProcessMessage(WXMSG* pMsg) override;
protected:
virtual void DoGetSize(int *width, int *height) const override;
virtual void DoGetClientSize(int *width, int *height) const override;

View file

@ -79,15 +79,7 @@ bool wxGUIEventLoop::PreProcessMessage(WXMSG *msg)
}
if ( !wndThis )
{
// this may happen if the event occurred in a standard modeless dialog (the
// only example of which I know of is the find/replace dialog) - then call
// IsDialogMessage() to make TAB navigation in it work
// NOTE: IsDialogMessage() just eats all the messages (i.e. returns true for
// them) if we call it for the control itself
return hwnd && ::IsDialogMessage(hwnd, msg) != 0;
}
return false;
}
if ( !AllowProcessing(wndThis) )

View file

@ -446,6 +446,19 @@ wxString wxFindReplaceDialog::GetTitle() const
return m_title;
}
// ----------------------------------------------------------------------------
// wxFindReplaceDialog message handling
// ----------------------------------------------------------------------------
bool wxFindReplaceDialog::MSWProcessMessage(WXMSG* pMsg)
{
// The base class MSWProcessMessage() doesn't work for us because we don't
// have wxTAB_TRAVERSAL style, but then we don't need it anyhow: as this
// dialog only ever contains standard controls, just using the standard
// function is enough to make TAB navigation work in it.
return m_hWnd && ::IsDialogMessage(m_hWnd, pMsg);
}
// ----------------------------------------------------------------------------
// wxFindReplaceDialog position/size
// ----------------------------------------------------------------------------