mirror of
https://github.com/juce-framework/JUCE.git
synced 2026-01-10 23:44:24 +00:00
Fixed a bug in Windows plugins where the display bounds were not being updated when the scale factor was changed
This commit is contained in:
parent
6fe0358dee
commit
f11c43d038
2 changed files with 24 additions and 5 deletions
|
|
@ -28,6 +28,9 @@ extern HWND juce_messageWindowHandle;
|
||||||
typedef bool (*CheckEventBlockedByModalComps) (const MSG&);
|
typedef bool (*CheckEventBlockedByModalComps) (const MSG&);
|
||||||
CheckEventBlockedByModalComps isEventBlockedByModalComps = nullptr;
|
CheckEventBlockedByModalComps isEventBlockedByModalComps = nullptr;
|
||||||
|
|
||||||
|
typedef void (*SettingChangeCallbackFunc) (void);
|
||||||
|
SettingChangeCallbackFunc settingChangeCallback = nullptr;
|
||||||
|
|
||||||
//==============================================================================
|
//==============================================================================
|
||||||
namespace WindowsMessageHelpers
|
namespace WindowsMessageHelpers
|
||||||
{
|
{
|
||||||
|
|
@ -101,6 +104,11 @@ namespace WindowsMessageHelpers
|
||||||
handleBroadcastMessage (reinterpret_cast<const COPYDATASTRUCT*> (lParam));
|
handleBroadcastMessage (reinterpret_cast<const COPYDATASTRUCT*> (lParam));
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
else if (message == WM_SETTINGCHANGE)
|
||||||
|
{
|
||||||
|
if (settingChangeCallback != nullptr)
|
||||||
|
settingChangeCallback();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return DefWindowProc (h, message, wParam, lParam);
|
return DefWindowProc (h, message, wParam, lParam);
|
||||||
|
|
|
||||||
|
|
@ -303,6 +303,9 @@ static void checkForPointerAPI()
|
||||||
&& getPointerPenInfo != nullptr);
|
&& getPointerPenInfo != nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
typedef void (*SettingChangeCallbackFunc) (void);
|
||||||
|
extern SettingChangeCallbackFunc settingChangeCallback;
|
||||||
|
|
||||||
static Rectangle<int> rectangleFromRECT (const RECT& r) noexcept
|
static Rectangle<int> rectangleFromRECT (const RECT& r) noexcept
|
||||||
{
|
{
|
||||||
return Rectangle<int>::leftTopRightBottom ((int) r.left, (int) r.top, (int) r.right, (int) r.bottom);
|
return Rectangle<int>::leftTopRightBottom ((int) r.left, (int) r.top, (int) r.right, (int) r.bottom);
|
||||||
|
|
@ -1772,6 +1775,11 @@ private:
|
||||||
updateBorderSize();
|
updateBorderSize();
|
||||||
checkForPointerAPI();
|
checkForPointerAPI();
|
||||||
|
|
||||||
|
// This is needed so that our plugin window gets notified of WM_SETTINGCHANGE messages
|
||||||
|
// and can respond to display scale changes
|
||||||
|
if (! JUCEApplication::isStandaloneApp())
|
||||||
|
settingChangeCallback = forceDisplayUpdate;
|
||||||
|
|
||||||
// Calling this function here is (for some reason) necessary to make Windows
|
// Calling this function here is (for some reason) necessary to make Windows
|
||||||
// correctly enable the menu items that we specify in the wm_initmenu message.
|
// correctly enable the menu items that we specify in the wm_initmenu message.
|
||||||
GetSystemMenu (hwnd, false);
|
GetSystemMenu (hwnd, false);
|
||||||
|
|
@ -2918,19 +2926,23 @@ private:
|
||||||
|
|
||||||
void doSettingChange()
|
void doSettingChange()
|
||||||
{
|
{
|
||||||
auto& desktop = Desktop::getInstance();
|
forceDisplayUpdate();
|
||||||
|
|
||||||
const_cast<Desktop::Displays&> (desktop.getDisplays()).refresh();
|
|
||||||
|
|
||||||
if (fullScreen && ! isMinimised())
|
if (fullScreen && ! isMinimised())
|
||||||
{
|
{
|
||||||
auto& display = desktop.getDisplays().getDisplayContaining (component.getScreenBounds().getCentre());
|
auto& display = Desktop::getInstance().getDisplays()
|
||||||
|
.getDisplayContaining (component.getScreenBounds().getCentre());
|
||||||
|
|
||||||
setWindowPos (hwnd, display.userArea * display.scale,
|
setWindowPos (hwnd, display.userArea * display.scale,
|
||||||
SWP_NOACTIVATE | SWP_NOOWNERZORDER | SWP_NOZORDER | SWP_NOSENDCHANGING);
|
SWP_NOACTIVATE | SWP_NOOWNERZORDER | SWP_NOZORDER | SWP_NOSENDCHANGING);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void forceDisplayUpdate()
|
||||||
|
{
|
||||||
|
const_cast<Desktop::Displays&> (Desktop::getInstance().getDisplays()).refresh();
|
||||||
|
}
|
||||||
|
|
||||||
void handleDPIChange() // happens when a window moves to a screen with a different DPI.
|
void handleDPIChange() // happens when a window moves to a screen with a different DPI.
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
@ -3596,7 +3608,6 @@ JUCE_API ComponentPeer* createNonRepaintingEmbeddedWindowsPeer (Component& compo
|
||||||
|
|
||||||
JUCE_IMPLEMENT_SINGLETON (HWNDComponentPeer::WindowClassHolder)
|
JUCE_IMPLEMENT_SINGLETON (HWNDComponentPeer::WindowClassHolder)
|
||||||
|
|
||||||
|
|
||||||
//==============================================================================
|
//==============================================================================
|
||||||
void ModifierKeys::updateCurrentModifiers() noexcept
|
void ModifierKeys::updateCurrentModifiers() noexcept
|
||||||
{
|
{
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue