Browse Source

HWNDComponentPeer: Dismiss modals when windows are moved

This change ensures that popup menus will be dismissed when hosted
plugin windows are moved, even when these plugin views are themselves
hosted inside JUCE views, like those used in the AudioPluginHost.
v6.1.6
reuk 4 years ago
parent
commit
19821db2a3
No known key found for this signature in database GPG Key ID: 9ADCD339CFC98A11
1 changed files with 13 additions and 1 deletions
  1. +13
    -1
      modules/juce_gui_basics/native/juce_win32_Windowing.cpp

+ 13
- 1
modules/juce_gui_basics/native/juce_win32_Windowing.cpp View File

@@ -4160,7 +4160,7 @@ private:
void windowShouldDismissModals (HWND originator)
{
if (isAncestor (originator, hwnd))
if (component.isShowing() && isAncestor (originator, hwnd))
sendInputAttemptWhenModalMessage();
}
@@ -4190,6 +4190,7 @@ private:
constexpr UINT events[] { WM_MOVE,
WM_SIZE,
WM_WINDOWPOSCHANGING,
WM_NCPOINTERDOWN,
WM_NCLBUTTONDOWN,
WM_NCRBUTTONDOWN,
@@ -4198,6 +4199,17 @@ private:
if (std::find (std::begin (events), std::end (events), info->message) == std::end (events))
return;
if (info->message == WM_WINDOWPOSCHANGING)
{
const auto* windowPos = reinterpret_cast<const WINDOWPOS*> (info->lParam);
const auto windowPosFlags = windowPos->flags;
constexpr auto maskToCheck = SWP_NOMOVE | SWP_NOSIZE;
if ((windowPosFlags & maskToCheck) == maskToCheck)
return;
}
// windowMayDismissModals could affect the number of active ComponentPeer instances
for (auto i = ComponentPeer::getNumPeers(); --i >= 0;)
if (i < ComponentPeer::getNumPeers())


Loading…
Cancel
Save