Skip to content

Commit f83e8ed

Browse files
committed
Revert "Use focus events to trigger"
This reverts commit 4146f4d.
1 parent 4146f4d commit f83e8ed

File tree

3 files changed

+10
-18
lines changed

3 files changed

+10
-18
lines changed

Flow.Launcher/MainWindow.xaml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -242,8 +242,6 @@
242242
InputMethod.PreferredImeState="{Binding StartWithEnglishMode, Converter={StaticResource BoolToIMEStateConverter}}"
243243
PreviewDragOver="QueryTextBox_OnPreviewDragOver"
244244
PreviewKeyUp="QueryTextBox_KeyUp"
245-
GotKeyboardFocus="QueryTextBox_OnGotKeyboardFocus"
246-
PreviewLostKeyboardFocus="QueryTextBox_OnPreviewLostKeyboardFocus"
247245
Style="{DynamicResource QueryBoxStyle}"
248246
Text="{Binding QueryText, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
249247
Visibility="Visible"

Flow.Launcher/MainWindow.xaml.cs

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -989,22 +989,6 @@ private void QueryTextBox_OnPreviewDragOver(object sender, DragEventArgs e)
989989
e.Handled = true;
990990
}
991991

992-
private void QueryTextBox_OnGotKeyboardFocus(object sender, KeyboardFocusChangedEventArgs e)
993-
{
994-
if (_viewModel.StartWithEnglishMode)
995-
{
996-
Win32Helper.SwitchToEnglishKeyboardLayout(true);
997-
}
998-
}
999-
1000-
private void QueryTextBox_OnPreviewLostKeyboardFocus(object sender, KeyboardFocusChangedEventArgs e)
1001-
{
1002-
if (_viewModel.StartWithEnglishMode)
1003-
{
1004-
Win32Helper.RestorePreviousKeyboardLayout();
1005-
}
1006-
}
1007-
1008992
#endregion
1009993
}
1010994
}

Flow.Launcher/ViewModel/MainViewModel.cs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1373,6 +1373,11 @@ public void Show()
13731373
MainWindowOpacity = 1;
13741374
MainWindowVisibilityStatus = true;
13751375
VisibilityChanged?.Invoke(this, new VisibilityChangedEventArgs { IsVisible = true });
1376+
1377+
if (StartWithEnglishMode)
1378+
{
1379+
Win32Helper.SwitchToEnglishKeyboardLayout(true);
1380+
}
13761381
});
13771382
}
13781383

@@ -1442,6 +1447,11 @@ public async void Hide()
14421447
Win32Helper.DWMSetCloakForWindow(mainWindow, true);
14431448
}
14441449

1450+
if (StartWithEnglishMode)
1451+
{
1452+
Win32Helper.RestorePreviousKeyboardLayout();
1453+
}
1454+
14451455
await Task.Delay(50);
14461456

14471457
// Update WPF properties

0 commit comments

Comments
 (0)