Rename methods to make their purpose more obvious; slight code style changes

This commit is contained in:
Yusyuriv 2025-03-22 14:58:42 +06:00
parent 465108a9d4
commit 67be335600
No known key found for this signature in database
GPG key ID: A91C52E6F73148E0
2 changed files with 12 additions and 14 deletions

View file

@ -66,7 +66,7 @@ namespace Flow.Launcher.Infrastructure
}
/// <summary>
///
///
/// </summary>
/// <param name="window"></param>
/// <param name="cornerType">DoNotRound, Round, RoundSmall, Default</param>
@ -362,7 +362,7 @@ namespace Flow.Launcher.Infrastructure
return HKL.Null;
}
public static unsafe void SetEnglishKeyboardLayout(bool backupPrevious)
public static unsafe void SwitchToEnglishKeyboardLayout(bool backupPrevious)
{
// Find an installed English layout
var enHKL = FindEnglishKeyboardLayout();
@ -384,14 +384,12 @@ namespace Flow.Launcher.Infrastructure
PInvoke.ActivateKeyboardLayout(enHKL, 0);
}
public static void SetPreviousKeyboardLayout()
public static void RestorePreviousKeyboardLayout()
{
if (_previousLayout != HKL.Null)
{
PInvoke.ActivateKeyboardLayout(_previousLayout, 0);
if (_previousLayout == HKL.Null) return;
_previousLayout = HKL.Null;
}
PInvoke.ActivateKeyboardLayout(_previousLayout, 0);
_previousLayout = HKL.Null;
}
#endregion

View file

@ -1376,7 +1376,7 @@ namespace Flow.Launcher.ViewModel
if (StartWithEnglishMode)
{
Win32Helper.SetEnglishKeyboardLayout(true);
Win32Helper.SwitchToEnglishKeyboardLayout(true);
}
});
}
@ -1385,6 +1385,11 @@ namespace Flow.Launcher.ViewModel
public async void Hide()
{
if (StartWithEnglishMode)
{
Win32Helper.RestorePreviousKeyboardLayout();
}
lastHistoryIndex = 1;
if (ExternalPreviewVisible)
@ -1447,11 +1452,6 @@ namespace Flow.Launcher.ViewModel
Win32Helper.DWMSetCloakForWindow(mainWindow, true);
}
if (StartWithEnglishMode)
{
Win32Helper.SetPreviousKeyboardLayout();
}
await Task.Delay(50);
// Update WPF properties