1
0
Fork 0
mirror of https://github.com/juce-framework/JUCE.git synced 2026-01-22 01:34:21 +00:00

Windows: Use ScopedThreadDPIAwarenessSetter in keyboard hooks to set correct thread DPI awareness

This commit is contained in:
ed 2021-06-10 16:29:26 +01:00
parent a70488e38e
commit d5175b6e23

View file

@ -1963,10 +1963,18 @@ public:
static bool offerKeyMessageToJUCEWindow (MSG& m)
{
if (m.message == WM_KEYDOWN || m.message == WM_KEYUP)
{
if (Component::getCurrentlyFocusedComponent() != nullptr)
if (auto* h = getOwnerOfWindow (m.hwnd))
return m.message == WM_KEYDOWN ? h->doKeyDown (m.wParam)
: h->doKeyUp (m.wParam);
{
if (auto* peer = getOwnerOfWindow (m.hwnd))
{
ScopedThreadDPIAwarenessSetter threadDpiAwarenessSetter { m.hwnd };
return m.message == WM_KEYDOWN ? peer->doKeyDown (m.wParam)
: peer->doKeyUp (m.wParam);
}
}
}
return false;
}