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