Merge pull request #3842 from ShiinaRinne/hotkey

修复部分键位无法录入热键
pull/3852/head
2dust 2023-05-13 19:33:07 +08:00 committed by GitHub
commit 0bde282448
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 16 additions and 11 deletions

View File

@ -72,7 +72,8 @@
VerticalAlignment="Top"
AcceptsReturn="True"
IsReadOnly="True"
Style="{StaticResource MyOutlinedTextBox}" />
Style="{StaticResource MyOutlinedTextBox}"
PreviewKeyDown="TxtGlobalHotkey_PreviewKeyDown" />
<TextBlock
Grid.Row="2"
@ -89,7 +90,8 @@
VerticalAlignment="Top"
AcceptsReturn="True"
IsReadOnly="True"
Style="{StaticResource MyOutlinedTextBox}" />
Style="{StaticResource MyOutlinedTextBox}"
PreviewKeyDown="TxtGlobalHotkey_PreviewKeyDown" />
<TextBlock
Grid.Row="3"
@ -106,7 +108,8 @@
VerticalAlignment="Top"
AcceptsReturn="True"
IsReadOnly="True"
Style="{StaticResource MyOutlinedTextBox}" />
Style="{StaticResource MyOutlinedTextBox}"
PreviewKeyDown="TxtGlobalHotkey_PreviewKeyDown" />
<TextBlock
Grid.Row="4"
Grid.Column="0"
@ -122,7 +125,8 @@
VerticalAlignment="Top"
AcceptsReturn="True"
IsReadOnly="True"
Style="{StaticResource MyOutlinedTextBox}" />
Style="{StaticResource MyOutlinedTextBox}"
PreviewKeyDown="TxtGlobalHotkey_PreviewKeyDown" />
<TextBlock
Grid.Row="5"
Grid.Column="0"
@ -138,7 +142,8 @@
VerticalAlignment="Top"
AcceptsReturn="True"
IsReadOnly="True"
Style="{StaticResource MyOutlinedTextBox}" />
Style="{StaticResource MyOutlinedTextBox}"
PreviewKeyDown="TxtGlobalHotkey_PreviewKeyDown" />
</Grid>
<TextBlock

View File

@ -20,11 +20,11 @@ namespace v2rayN.Views
_config = LazyConfig.Instance.GetConfig();
_config.globalHotkeys ??= new List<KeyEventItem>();
txtGlobalHotkey0.KeyDown += TxtGlobalHotkey_KeyDown;
txtGlobalHotkey1.KeyDown += TxtGlobalHotkey_KeyDown;
txtGlobalHotkey2.KeyDown += TxtGlobalHotkey_KeyDown;
txtGlobalHotkey3.KeyDown += TxtGlobalHotkey_KeyDown;
txtGlobalHotkey4.KeyDown += TxtGlobalHotkey_KeyDown;
txtGlobalHotkey0.KeyDown += TxtGlobalHotkey_PreviewKeyDown;
txtGlobalHotkey1.KeyDown += TxtGlobalHotkey_PreviewKeyDown;
txtGlobalHotkey2.KeyDown += TxtGlobalHotkey_PreviewKeyDown;
txtGlobalHotkey3.KeyDown += TxtGlobalHotkey_PreviewKeyDown;
txtGlobalHotkey4.KeyDown += TxtGlobalHotkey_PreviewKeyDown;
HotkeyHandler.Instance.IsPause = true;
this.Closing += (s, e) => HotkeyHandler.Instance.IsPause = false;
@ -45,7 +45,7 @@ namespace v2rayN.Views
BindingData();
}
private void TxtGlobalHotkey_KeyDown(object sender, KeyEventArgs e)
private void TxtGlobalHotkey_PreviewKeyDown(object sender, KeyEventArgs e)
{
e.Handled = true;
var _ModifierKeys = new Key[] { Key.LeftCtrl, Key.RightCtrl, Key.LeftShift,