Skip to content

Commit

Permalink
remove syskeys causing trouble
Browse files Browse the repository at this point in the history
  • Loading branch information
Damien LEROY committed Sep 2, 2022
1 parent 0071dc9 commit bb01fae
Showing 1 changed file with 2 additions and 13 deletions.
15 changes: 2 additions & 13 deletions PowerAccent.Core/Tools/KeyboardListener.cs
Original file line number Diff line number Diff line change
Expand Up @@ -75,14 +75,11 @@ private IntPtr LowLevelKeyboardProc(int nCode, UIntPtr wParam, IntPtr lParam)
{
if (nCode >= 0)
if (wParam.ToUInt32() == (int)InterceptKeys.KeyEvent.WM_KEYDOWN ||
wParam.ToUInt32() == (int)InterceptKeys.KeyEvent.WM_KEYUP ||
wParam.ToUInt32() == (int)InterceptKeys.KeyEvent.WM_SYSKEYDOWN ||
wParam.ToUInt32() == (int)InterceptKeys.KeyEvent.WM_SYSKEYUP)
wParam.ToUInt32() == (int)InterceptKeys.KeyEvent.WM_KEYUP)
{
//Captures the character(s) pressed only on WM_KEYDOWN
var chars = InterceptKeys.VKCodeToString((uint)Marshal.ReadInt32(lParam),
wParam.ToUInt32() == (int)InterceptKeys.KeyEvent.WM_KEYDOWN ||
wParam.ToUInt32() == (int)InterceptKeys.KeyEvent.WM_SYSKEYDOWN);
wParam.ToUInt32() == (int)InterceptKeys.KeyEvent.WM_KEYDOWN);

if (!hookedKeyboardCallbackAsync.Invoke((InterceptKeys.KeyEvent)wParam.ToUInt32(), Marshal.ReadInt32(lParam), chars))
{
Expand All @@ -108,20 +105,12 @@ bool KeyboardListener_KeyboardCallbackAsync(InterceptKeys.KeyEvent keyEvent, int
if (KeyDown != null)
return KeyDown.Invoke(this, new RawKeyEventArgs(vkCode, false, character));
break;
case InterceptKeys.KeyEvent.WM_SYSKEYDOWN:
if (KeyDown != null)
return KeyDown.Invoke(this, new RawKeyEventArgs(vkCode, true, character));
break;

// KeyUp events
case InterceptKeys.KeyEvent.WM_KEYUP:
if (KeyUp != null)
return KeyUp.Invoke(this, new RawKeyEventArgs(vkCode, false, character));
break;
case InterceptKeys.KeyEvent.WM_SYSKEYUP:
if (KeyUp != null)
return KeyUp.Invoke(this, new RawKeyEventArgs(vkCode, true, character));
break;

default:
break;
Expand Down

0 comments on commit bb01fae

Please sign in to comment.