Skip to content

Commit 4fc7f70

Browse files
committed
Adjust formats
1 parent c63debe commit 4fc7f70

File tree

1 file changed

+5
-16
lines changed

1 file changed

+5
-16
lines changed

Flow.Launcher.Infrastructure/Win32Helper.cs

Lines changed: 5 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -351,10 +351,7 @@ private static unsafe HKL FindEnglishKeyboardLayout()
351351
fixed (HKL* h = handles)
352352
{
353353
var result = PInvoke.GetKeyboardLayoutList(count, h);
354-
if (result == 0)
355-
{
356-
throw new Win32Exception(Marshal.GetLastWin32Error());
357-
}
354+
if (result == 0) throw new Win32Exception(Marshal.GetLastWin32Error());
358355
}
359356

360357
// Look for any English keyboard layout
@@ -364,10 +361,7 @@ private static unsafe HKL FindEnglishKeyboardLayout()
364361
var langId = (uint)hkl.Value & KeyboardLayoutLoWord;
365362

366363
// Check if it's an English layout
367-
if (EnglishLanguageIds.Contains(langId))
368-
{
369-
return hkl;
370-
}
364+
if (EnglishLanguageIds.Contains(langId)) return hkl;
371365
}
372366

373367
return HKL.Null;
@@ -399,16 +393,10 @@ public static unsafe void SwitchToEnglishKeyboardLayout(bool backupPrevious)
399393
// the IME mode instead of switching to another layout.
400394
var currentLayout = PInvoke.GetKeyboardLayout(threadId);
401395
var currentLayoutCode = (uint)currentLayout.Value & KeyboardLayoutLoWord;
402-
if (ImeLanguageIds.Contains(currentLayoutCode))
403-
{
404-
return;
405-
}
396+
if (ImeLanguageIds.Contains(currentLayoutCode)) return;
406397

407398
// Backup current keyboard layout
408-
if (backupPrevious)
409-
{
410-
_previousLayout = currentLayout;
411-
}
399+
if (backupPrevious) _previousLayout = currentLayout;
412400

413401
// Switch to English layout
414402
PInvoke.ActivateKeyboardLayout(enHKL, 0);
@@ -431,6 +419,7 @@ public static void RestorePreviousKeyboardLayout()
431419
PInvoke.INPUTLANGCHANGE_FORWARD,
432420
_previousLayout.Value
433421
);
422+
434423
_previousLayout = HKL.Null;
435424
}
436425

0 commit comments

Comments
 (0)