From e4b11546067e8dfb716ccd57a88a68fbe521f3d3 Mon Sep 17 00:00:00 2001 From: Quantum Date: Mon, 8 Sep 2014 10:41:18 -0400 Subject: [PATCH] Fixed repetition on Caps Lock. --- include/MainWindow.hpp | 1 + src/MainWindow.cpp | 7 ++++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/include/MainWindow.hpp b/include/MainWindow.hpp index 5bf9506..398a379 100644 --- a/include/MainWindow.hpp +++ b/include/MainWindow.hpp @@ -56,6 +56,7 @@ protected: virtual HICON GetIcon(); int active[128]; + bool capsDown; bool useBeep; HANDLE hBeep; unsigned lastFrequency; diff --git a/src/MainWindow.cpp b/src/MainWindow.cpp index 578e0d3..29f5f1f 100644 --- a/src/MainWindow.cpp +++ b/src/MainWindow.cpp @@ -266,7 +266,7 @@ LRESULT MainWindow::OnCreate() F_RtlInitUnicodeString(&usBeepDevice, L"\\Device\\Beep"); hBeep = NULL; } - useBeep = false; + capsDown = useBeep = false; m_keychars = NULL; PostMessage(m_hwnd, WM_INPUTLANGCHANGE, 0, 0); return 0; @@ -496,10 +496,15 @@ LRESULT CALLBACK MainWindow::LowLevelKeyboardHook(HHOOK hHook, int nCode, WPARAM case WM_KEYDOWN: case WM_SYSKEYDOWN: down = true; + if (capsDown) + goto finish; + else + capsDown = true; break; case WM_KEYUP: case WM_SYSKEYUP: down = false; + capsDown = false; break; default: goto finish;