diff --git a/Flow.Launcher.Infrastructure/NativeMethods.txt b/Flow.Launcher.Infrastructure/NativeMethods.txt index 54ae099f8..833c6682b 100644 --- a/Flow.Launcher.Infrastructure/NativeMethods.txt +++ b/Flow.Launcher.Infrastructure/NativeMethods.txt @@ -54,6 +54,5 @@ ActivateKeyboardLayout GetKeyboardLayoutList PostMessage -HWND_BROADCAST WM_INPUTLANGCHANGEREQUEST INPUTLANGCHANGE_FORWARD diff --git a/Flow.Launcher.Infrastructure/Win32Helper.cs b/Flow.Launcher.Infrastructure/Win32Helper.cs index 197a5a556..7bb9df2e7 100644 --- a/Flow.Launcher.Infrastructure/Win32Helper.cs +++ b/Flow.Launcher.Infrastructure/Win32Helper.cs @@ -403,7 +403,9 @@ namespace Flow.Launcher.Infrastructure { if (_previousLayout == HKL.Null) return; - PInvoke.PostMessage(HWND.HWND_BROADCAST, + var hwnd = PInvoke.GetForegroundWindow(); + PInvoke.PostMessage( + hwnd, PInvoke.WM_INPUTLANGCHANGEREQUEST, PInvoke.INPUTLANGCHANGE_FORWARD, _previousLayout.Value