1
0
Fork 0
mirror of https://github.com/juce-framework/JUCE.git synced 2026-01-10 23:44:24 +00:00

Windows: Fix bug where plugins with additional top-level windows could fail to repaint after changing the display config

This commit is contained in:
reuk 2024-08-12 20:43:38 +01:00
parent 025a05d210
commit 19aade443a
No known key found for this signature in database
GPG key ID: FCB43929F012EE5C

View file

@ -3477,6 +3477,19 @@ private:
yes
};
static void updateVBlankDispatcherForAllPeers (ForceRefreshDispatcher force = ForceRefreshDispatcher::no)
{
// There's an edge case where only top-level windows seem to get WM_SETTINGCHANGE
// messages, which means that if we have a plugin that opens its own top-level/desktop
// window, then the extra window might get a SETTINGCHANGE but the plugin window may not.
// If we only update the vblank dispatcher for windows that get a SETTINGCHANGE, we might
// miss child windows, and those windows won't be able to repaint.
for (auto i = getNumPeers(); --i >= 0;)
if (auto* peer = static_cast<HWNDComponentPeer*> (getPeer (i)))
peer->updateCurrentMonitorAndRefreshVBlankDispatcher (force);
}
void updateCurrentMonitorAndRefreshVBlankDispatcher (ForceRefreshDispatcher force = ForceRefreshDispatcher::no)
{
auto monitor = MonitorFromWindow (hwnd, MONITOR_DEFAULTTONULL);
@ -3655,7 +3668,7 @@ private:
auto* dispatcher = VBlankDispatcher::getInstance();
dispatcher->reconfigureDisplays();
updateCurrentMonitorAndRefreshVBlankDispatcher (ForceRefreshDispatcher::yes);
updateVBlankDispatcherForAllPeers (ForceRefreshDispatcher::yes);
}
//==============================================================================