Skip to content

Commit

Permalink
Merge pull request #3842 from ShiinaRinne/hotkey
Browse files Browse the repository at this point in the history
修复部分键位无法录入热键
  • Loading branch information
2dust authored May 13, 2023
2 parents 6098132 + 4888032 commit 0bde282
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 11 deletions.
15 changes: 10 additions & 5 deletions v2rayN/v2rayN/Views/GlobalHotkeySettingWindow.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,8 @@
VerticalAlignment="Top"
AcceptsReturn="True"
IsReadOnly="True"
Style="{StaticResource MyOutlinedTextBox}" />
Style="{StaticResource MyOutlinedTextBox}"
PreviewKeyDown="TxtGlobalHotkey_PreviewKeyDown" />

<TextBlock
Grid.Row="2"
Expand All @@ -89,7 +90,8 @@
VerticalAlignment="Top"
AcceptsReturn="True"
IsReadOnly="True"
Style="{StaticResource MyOutlinedTextBox}" />
Style="{StaticResource MyOutlinedTextBox}"
PreviewKeyDown="TxtGlobalHotkey_PreviewKeyDown" />

<TextBlock
Grid.Row="3"
Expand All @@ -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"
Expand All @@ -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"
Expand All @@ -138,7 +142,8 @@
VerticalAlignment="Top"
AcceptsReturn="True"
IsReadOnly="True"
Style="{StaticResource MyOutlinedTextBox}" />
Style="{StaticResource MyOutlinedTextBox}"
PreviewKeyDown="TxtGlobalHotkey_PreviewKeyDown" />
</Grid>

<TextBlock
Expand Down
12 changes: 6 additions & 6 deletions v2rayN/v2rayN/Views/GlobalHotkeySettingWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,11 @@ public GlobalHotkeySettingWindow()
_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;
Expand All @@ -45,7 +45,7 @@ private void InitData()
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,
Expand Down

0 comments on commit 0bde282

Please sign in to comment.