mirror of
https://github.com/juce-framework/JUCE.git
synced 2026-01-17 00:44:19 +00:00
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.
This commit is contained in:
parent
15305e69af
commit
19821db2a3
1 changed files with 13 additions and 1 deletions
|
|
@ -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…
Add table
Add a link
Reference in a new issue