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

Windows: Fixed a bug on later versions of Windows 10 causing the on-screen keyboard to keep showing and hiding

This commit is contained in:
ed 2019-02-19 11:00:05 +00:00
parent f0c1c4c6f5
commit 8635315e61

View file

@ -1044,7 +1044,7 @@ private:
const ScopedValueSetter<bool> 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<ITipInvocation> tipInvocation;
};