Skip to content

Commit cd28c09

Browse files
committed
Fix the issue with not being able to switch back to the original keyboard layout in OnDeactivated
1 parent 747f958 commit cd28c09

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

Flow.Launcher.Infrastructure/NativeMethods.txt

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,4 +51,9 @@ WM_EXITSIZEMOVE
5151
GetKeyboardLayout
5252
GetWindowThreadProcessId
5353
ActivateKeyboardLayout
54-
GetKeyboardLayoutList
54+
GetKeyboardLayoutList
55+
56+
PostMessage
57+
HWND_BROADCAST
58+
WM_INPUTLANGCHANGEREQUEST
59+
INPUTLANGCHANGE_FORWARD

Flow.Launcher.Infrastructure/Win32Helper.cs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -403,7 +403,11 @@ public static void RestorePreviousKeyboardLayout()
403403
{
404404
if (_previousLayout == HKL.Null) return;
405405

406-
PInvoke.ActivateKeyboardLayout(_previousLayout, 0);
406+
PInvoke.PostMessage(HWND.HWND_BROADCAST,
407+
PInvoke.WM_INPUTLANGCHANGEREQUEST,
408+
PInvoke.INPUTLANGCHANGE_FORWARD,
409+
_previousLayout.Value
410+
);
407411
_previousLayout = HKL.Null;
408412
}
409413

0 commit comments

Comments
 (0)