diff --git a/modules/juce_gui_basics/native/juce_win32_Windowing.cpp b/modules/juce_gui_basics/native/juce_win32_Windowing.cpp index 680df19181..87ec415962 100644 --- a/modules/juce_gui_basics/native/juce_win32_Windowing.cpp +++ b/modules/juce_gui_basics/native/juce_win32_Windowing.cpp @@ -1044,7 +1044,7 @@ private: const ScopedValueSetter setter (reentrant, true, false); - const bool isActive = isVisible(); + auto isActive = isKeyboardVisible(); if (isActive != shouldBeActive) { @@ -1061,6 +1061,14 @@ private: } bool isVisible() + { + if (auto hwnd = FindWindowEx (NULL, NULL, L"ApplicationFrameWindow", NULL)) + return FindWindowEx (hwnd, NULL, L"Windows.UI.Core.CoreWindow", L"Microsoft Text Input Application") != NULL; + + return false; + } + + bool isVisibleLegacy() { if (auto hwnd = FindWindow (L"IPTip_Main_Window", NULL)) { @@ -1071,6 +1079,15 @@ private: return false; } + bool isKeyboardVisible() + { + if (isVisible()) + return true; + + // isVisible() may fail on Win10 versions < 1709 so try the old method too + return isVisibleLegacy(); + } + bool shouldBeActive = false, reentrant = false; ComSmartPtr tipInvocation; };