Fix wxSTCPopupBase::Show for windows

The existing logic for the Show method results in wxWindowBase::Show
being called twice when the argument is false. Slightly rearrange the
code to fix this defect.
This commit is contained in:
New Pagodi
2019-08-07 21:33:17 -05:00
parent 075fa2b764
commit c3d9222a7c

View File

@@ -2117,10 +2117,12 @@ PRectangle Window::GetMonitorRect(Point pt) {
// Do not activate the window when it is shown. // Do not activate the window when it is shown.
bool wxSTCPopupBase::Show(bool show) bool wxSTCPopupBase::Show(bool show)
{ {
if ( !wxWindowBase::Show(show) )
return false;
if ( show ) if ( show )
{
// Check if the window is changing from hidden to shown.
bool changingVisibility = wxWindowBase::Show(true);
if ( changingVisibility )
{ {
HWND hWnd = reinterpret_cast<HWND>(GetHandle()); HWND hWnd = reinterpret_cast<HWND>(GetHandle());
if ( GetName() == "wxSTCCallTip" ) if ( GetName() == "wxSTCCallTip" )
@@ -2131,10 +2133,11 @@ PRectangle Window::GetMonitorRect(Point pt) {
::SetWindowPos(hWnd, HWND_NOTOPMOST, 0, 0, 0, 0, ::SetWindowPos(hWnd, HWND_NOTOPMOST, 0, 0, 0, 0,
SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE); SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE);
} }
else
wxPopupWindow::Show(false);
return true; return changingVisibility;
}
else
return wxPopupWindow::Show(false);
} }
// Do not activate in response to mouse clicks on this window. // Do not activate in response to mouse clicks on this window.