Fix for showing multiple popups in a row in wxMSW

There were at least 2 problems when showing a transient popup while
another one was already shown in wxMSW, as could be seen by showing
several wxRichToolTips in a row from a timer event handler, for example:

First problem was that wxCurrentPopupWindow was incorrectly reset in
this case by the old popup window when it was hidden, even though it
should have been remaining set to the new popup window. Fix this by
checking that we only reset wxCurrentPopupWindow when hiding the popup
if it still points to this popup, but not if it has been changed to
point to another one in the meanwhile.

Second problem was more mysterious and resulted in simply not receiving
the activation events for the new popup when showing it resulted in
hiding the previous one. The working hypothesis is that hiding a window,
which changes activation on its own, from WM_NCACTIVATE handler in our
code confused ShowWindow(), which handles switching activation, which
didn't expect this to happen, so the fix is to avoid doing anything
immediately from this handler and wait until the next idle event to do
it instead.

These fixes ensure that showing several popups in a row works correctly,
i.e. hides the previous popup when a new one is shown and also keeps the
parent window appearing active during all the time and deactivates it if
the focus switches to another top level window at the end.
This commit is contained in:
Vadim Zeitlin
2019-03-30 04:11:46 +01:00
parent 211b81f459
commit 58d4b0e209
2 changed files with 54 additions and 18 deletions

View File

@@ -152,6 +152,8 @@ public:
WXLPARAM lParam) wxOVERRIDE;
private:
void DismissOnDeactivate(WXHWND hwndActive);
wxDECLARE_DYNAMIC_CLASS(wxPopupTransientWindow);
wxDECLARE_NO_COPY_CLASS(wxPopupTransientWindow);
};