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,24 +2117,27 @@ 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 )
{ {
HWND hWnd = reinterpret_cast<HWND>(GetHandle()); // Check if the window is changing from hidden to shown.
if ( GetName() == "wxSTCCallTip" ) bool changingVisibility = wxWindowBase::Show(true);
::AnimateWindow(hWnd, 25, AW_BLEND);
else
::ShowWindow(hWnd, SW_SHOWNA );
::SetWindowPos(hWnd, HWND_NOTOPMOST, 0, 0, 0, 0, if ( changingVisibility )
SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE); {
HWND hWnd = reinterpret_cast<HWND>(GetHandle());
if ( GetName() == "wxSTCCallTip" )
::AnimateWindow(hWnd, 25, AW_BLEND);
else
::ShowWindow(hWnd, SW_SHOWNA );
::SetWindowPos(hWnd, HWND_NOTOPMOST, 0, 0, 0, 0,
SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE);
}
return changingVisibility;
} }
else else
wxPopupWindow::Show(false); return wxPopupWindow::Show(false);
return true;
} }
// Do not activate in response to mouse clicks on this window. // Do not activate in response to mouse clicks on this window.