Implement dismissal for unfocused wxPopupTransientWindow
Popups not using wxPU_CONTAINS_CONTROLS were not automatically dismissed at all any longer, as the only auto-dismissal mechanism related on getting WM_ACTIVATE, which they never did, so implement a different logic for dismissing them: do it on any change of focus and also any mouse press (but not move and not key press neither). This will allow not using wxPU_CONTAINS_CONTROLS for popups that don't need focus, but still must disappear on their own.
This commit is contained in:
@@ -3844,6 +3844,42 @@ wxWindowMSW::MSWHandleMessage(WXLRESULT *result,
|
||||
}
|
||||
}
|
||||
|
||||
// Special hook for dismissing the current popup if it's active. It's a bit
|
||||
// ugly to have to do this here, but the only alternatives seem to be
|
||||
// installing a WH_CBT hook in wxPopupTransientWindow code, which is not
|
||||
// really much better.
|
||||
#if wxUSE_POPUPWIN
|
||||
if ( wxCurrentPopupWindow )
|
||||
{
|
||||
switch ( message )
|
||||
{
|
||||
case WM_NCLBUTTONDOWN:
|
||||
case WM_NCLBUTTONUP:
|
||||
case WM_NCLBUTTONDBLCLK:
|
||||
case WM_NCRBUTTONDOWN:
|
||||
case WM_NCRBUTTONUP:
|
||||
case WM_NCRBUTTONDBLCLK:
|
||||
case WM_NCMBUTTONDOWN:
|
||||
case WM_NCMBUTTONUP:
|
||||
case WM_NCMBUTTONDBLCLK:
|
||||
|
||||
case WM_LBUTTONDOWN:
|
||||
case WM_LBUTTONUP:
|
||||
case WM_LBUTTONDBLCLK:
|
||||
case WM_RBUTTONDOWN:
|
||||
case WM_RBUTTONUP:
|
||||
case WM_RBUTTONDBLCLK:
|
||||
case WM_MBUTTONDOWN:
|
||||
case WM_MBUTTONUP:
|
||||
case WM_MBUTTONDBLCLK:
|
||||
|
||||
case WM_SETFOCUS:
|
||||
case WM_KILLFOCUS:
|
||||
wxCurrentPopupWindow->MSWDismissUnfocusedPopup();
|
||||
}
|
||||
}
|
||||
#endif // wxUSE_POPUPWIN
|
||||
|
||||
if ( !processed )
|
||||
return false;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user