mirror of
https://github.com/Flow-Launcher/Flow.Launcher.git
synced 2026-03-11 08:54:32 +00:00
Use focus events to trigger
This commit is contained in:
parent
c39079badc
commit
4146f4d309
3 changed files with 18 additions and 10 deletions
|
|
@ -242,6 +242,8 @@
|
|||
InputMethod.PreferredImeState="{Binding StartWithEnglishMode, Converter={StaticResource BoolToIMEStateConverter}}"
|
||||
PreviewDragOver="QueryTextBox_OnPreviewDragOver"
|
||||
PreviewKeyUp="QueryTextBox_KeyUp"
|
||||
GotKeyboardFocus="QueryTextBox_OnGotKeyboardFocus"
|
||||
PreviewLostKeyboardFocus="QueryTextBox_OnPreviewLostKeyboardFocus"
|
||||
Style="{DynamicResource QueryBoxStyle}"
|
||||
Text="{Binding QueryText, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
|
||||
Visibility="Visible"
|
||||
|
|
|
|||
|
|
@ -989,6 +989,22 @@ namespace Flow.Launcher
|
|||
e.Handled = true;
|
||||
}
|
||||
|
||||
private void QueryTextBox_OnGotKeyboardFocus(object sender, KeyboardFocusChangedEventArgs e)
|
||||
{
|
||||
if (_viewModel.StartWithEnglishMode)
|
||||
{
|
||||
Win32Helper.SwitchToEnglishKeyboardLayout(true);
|
||||
}
|
||||
}
|
||||
|
||||
private void QueryTextBox_OnPreviewLostKeyboardFocus(object sender, KeyboardFocusChangedEventArgs e)
|
||||
{
|
||||
if (_viewModel.StartWithEnglishMode)
|
||||
{
|
||||
Win32Helper.RestorePreviousKeyboardLayout();
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1373,11 +1373,6 @@ namespace Flow.Launcher.ViewModel
|
|||
MainWindowOpacity = 1;
|
||||
MainWindowVisibilityStatus = true;
|
||||
VisibilityChanged?.Invoke(this, new VisibilityChangedEventArgs { IsVisible = true });
|
||||
|
||||
if (StartWithEnglishMode)
|
||||
{
|
||||
Win32Helper.SwitchToEnglishKeyboardLayout(true);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
|
@ -1447,11 +1442,6 @@ namespace Flow.Launcher.ViewModel
|
|||
Win32Helper.DWMSetCloakForWindow(mainWindow, true);
|
||||
}
|
||||
|
||||
if (StartWithEnglishMode)
|
||||
{
|
||||
Win32Helper.RestorePreviousKeyboardLayout();
|
||||
}
|
||||
|
||||
await Task.Delay(50);
|
||||
|
||||
// Update WPF properties
|
||||
|
|
|
|||
Loading…
Reference in a new issue