diff --git a/modules/juce_gui_basics/native/juce_win32_Windowing.cpp b/modules/juce_gui_basics/native/juce_win32_Windowing.cpp index 0103297b3c..a624953b3d 100644 --- a/modules/juce_gui_basics/native/juce_win32_Windowing.cpp +++ b/modules/juce_gui_basics/native/juce_win32_Windowing.cpp @@ -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; }