Revert "Use focus events to trigger"

This reverts commit 4146f4d309.
This commit is contained in:
Yusyuriv 2025-03-22 16:23:34 +06:00
parent 4146f4d309
commit f83e8eddb6
No known key found for this signature in database
GPG key ID: A91C52E6F73148E0
3 changed files with 10 additions and 18 deletions

View file

@ -242,8 +242,6 @@
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"

View file

@ -989,22 +989,6 @@ 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
}
}

View file

@ -1373,6 +1373,11 @@ namespace Flow.Launcher.ViewModel
MainWindowOpacity = 1;
MainWindowVisibilityStatus = true;
VisibilityChanged?.Invoke(this, new VisibilityChangedEventArgs { IsVisible = true });
if (StartWithEnglishMode)
{
Win32Helper.SwitchToEnglishKeyboardLayout(true);
}
});
}
@ -1442,6 +1447,11 @@ namespace Flow.Launcher.ViewModel
Win32Helper.DWMSetCloakForWindow(mainWindow, true);
}
if (StartWithEnglishMode)
{
Win32Helper.RestorePreviousKeyboardLayout();
}
await Task.Delay(50);
// Update WPF properties