2020-08-05 14:06:55 -07:00
|
|
|
|
// Copyright (c) Microsoft Corporation
|
|
|
|
|
|
// The Microsoft Corporation licenses this file to you under the MIT license.
|
|
|
|
|
|
// See the LICENSE file in the project root for more information.
|
|
|
|
|
|
|
2020-06-11 12:59:36 -07:00
|
|
|
|
using System.Windows.Input;
|
|
|
|
|
|
using Wox.Plugin;
|
|
|
|
|
|
|
2020-07-20 11:22:03 -07:00
|
|
|
|
namespace PowerLauncher.Helper
|
2020-06-11 12:59:36 -07:00
|
|
|
|
{
|
2020-08-14 09:22:24 -07:00
|
|
|
|
internal class KeyboardHelper
|
2020-06-11 12:59:36 -07:00
|
|
|
|
{
|
|
|
|
|
|
public static SpecialKeyState CheckModifiers()
|
|
|
|
|
|
{
|
|
|
|
|
|
SpecialKeyState state = new SpecialKeyState();
|
|
|
|
|
|
if ((Keyboard.GetKeyStates(Key.LeftShift) & KeyStates.Down) > 0 ||
|
|
|
|
|
|
(Keyboard.GetKeyStates(Key.RightShift) & KeyStates.Down) > 0)
|
|
|
|
|
|
{
|
|
|
|
|
|
state.ShiftPressed = true;
|
|
|
|
|
|
}
|
2020-08-06 20:38:49 -07:00
|
|
|
|
|
2020-06-11 12:59:36 -07:00
|
|
|
|
if ((Keyboard.GetKeyStates(Key.LWin) & KeyStates.Down) > 0 ||
|
|
|
|
|
|
(Keyboard.GetKeyStates(Key.RWin) & KeyStates.Down) > 0)
|
|
|
|
|
|
{
|
|
|
|
|
|
state.WinPressed = true;
|
|
|
|
|
|
}
|
2020-08-06 20:38:49 -07:00
|
|
|
|
|
2020-06-11 12:59:36 -07:00
|
|
|
|
if ((Keyboard.GetKeyStates(Key.LeftCtrl) & KeyStates.Down) > 0 ||
|
|
|
|
|
|
(Keyboard.GetKeyStates(Key.RightCtrl) & KeyStates.Down) > 0)
|
|
|
|
|
|
{
|
|
|
|
|
|
state.CtrlPressed = true;
|
|
|
|
|
|
}
|
2020-08-06 20:38:49 -07:00
|
|
|
|
|
2020-06-11 12:59:36 -07:00
|
|
|
|
if ((Keyboard.GetKeyStates(Key.LeftAlt) & KeyStates.Down) > 0 ||
|
|
|
|
|
|
(Keyboard.GetKeyStates(Key.RightAlt) & KeyStates.Down) > 0)
|
|
|
|
|
|
{
|
|
|
|
|
|
state.AltPressed = true;
|
|
|
|
|
|
}
|
2020-08-06 20:38:49 -07:00
|
|
|
|
|
2020-06-11 12:59:36 -07:00
|
|
|
|
return state;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|