mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-04-06 03:07:04 +02:00
Fix a global hotkey issues in CMD, which will hang Wox on init.
This commit is contained in:
@@ -13,7 +13,6 @@ namespace Wox.Plugin.CMD
|
||||
{
|
||||
public class CMD : IPlugin, ISettingProvider,IPluginI18n
|
||||
{
|
||||
private readonly GlobalHotkey globalHotkey = new GlobalHotkey();
|
||||
private PluginInitContext context;
|
||||
private bool WinRStroked;
|
||||
private readonly KeyboardSimulator keyboardSimulator = new KeyboardSimulator(new InputSimulator());
|
||||
@@ -174,20 +173,20 @@ namespace Wox.Plugin.CMD
|
||||
public void Init(PluginInitContext context)
|
||||
{
|
||||
this.context = context;
|
||||
globalHotkey.hookedKeyboardCallback += KListener_hookedKeyboardCallback;
|
||||
context.API.GlobalKeyboardEvent += API_GlobalKeyboardEvent;
|
||||
}
|
||||
|
||||
private bool KListener_hookedKeyboardCallback(KeyEvent keyevent, int vkcode, SpecialKeyState state)
|
||||
bool API_GlobalKeyboardEvent(int keyevent, int vkcode, SpecialKeyState state)
|
||||
{
|
||||
if (CMDStorage.Instance.ReplaceWinR)
|
||||
{
|
||||
if (keyevent == KeyEvent.WM_KEYDOWN && vkcode == (int)Keys.R && state.WinPressed)
|
||||
if (keyevent == (int)KeyEvent.WM_KEYDOWN && vkcode == (int)Keys.R && state.WinPressed)
|
||||
{
|
||||
WinRStroked = true;
|
||||
OnWinRPressed();
|
||||
return false;
|
||||
}
|
||||
if (keyevent == KeyEvent.WM_KEYUP && WinRStroked && vkcode == (int)Keys.LWin)
|
||||
if (keyevent == (int)KeyEvent.WM_KEYUP && WinRStroked && vkcode == (int)Keys.LWin)
|
||||
{
|
||||
WinRStroked = false;
|
||||
keyboardSimulator.ModifiedKeyStroke(VirtualKeyCode.LWIN, VirtualKeyCode.CONTROL);
|
||||
|
||||
@@ -82,7 +82,7 @@ namespace Wox.Plugin.Folder
|
||||
}
|
||||
}).ToList();
|
||||
|
||||
if (!driverNames.Any(input.StartsWith))
|
||||
if (driverNames != null && !driverNames.Any(input.StartsWith))
|
||||
return results;
|
||||
|
||||
if (!input.EndsWith("\\"))
|
||||
|
||||
BIN
Plugins/Wox.Plugin.Program/Images/cmd.png
Normal file
BIN
Plugins/Wox.Plugin.Program/Images/cmd.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.6 KiB |
@@ -4,6 +4,7 @@ using System.Diagnostics;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using System.Threading;
|
||||
using System.Windows;
|
||||
using Wox.Infrastructure;
|
||||
using Wox.Plugin.Program.ProgramSources;
|
||||
|
||||
@@ -81,6 +81,9 @@
|
||||
<None Include="Images\program.png">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Include="Images\cmd.png">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</None>
|
||||
<Content Include="Languages\en.xaml">
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
<SubType>Designer</SubType>
|
||||
|
||||
Reference in New Issue
Block a user