aboutsummaryrefslogtreecommitdiff
path: root/Src/Plugins/General/gen_hotkeys/accelBlock.cpp
diff options
context:
space:
mode:
authorJean-Francois Mauguit <jfmauguit@mac.com>2024-09-24 09:03:25 -0400
committerGitHub <noreply@github.com>2024-09-24 09:03:25 -0400
commitbab614c421ed7ae329d26bf028c4a3b1d2450f5a (patch)
tree12f17f78986871dd2cfb0a56e5e93b545c1ae0d0 /Src/Plugins/General/gen_hotkeys/accelBlock.cpp
parent4bde6044fddf053f31795b9eaccdd2a5a527d21f (diff)
parent20d28e80a5c861a9d5f449ea911ab75b4f37ad0d (diff)
downloadwinamp-bab614c421ed7ae329d26bf028c4a3b1d2450f5a.tar.gz
Merge pull request #5 from WinampDesktop/community
Merge to main
Diffstat (limited to 'Src/Plugins/General/gen_hotkeys/accelBlock.cpp')
-rw-r--r--Src/Plugins/General/gen_hotkeys/accelBlock.cpp47
1 files changed, 47 insertions, 0 deletions
diff --git a/Src/Plugins/General/gen_hotkeys/accelBlock.cpp b/Src/Plugins/General/gen_hotkeys/accelBlock.cpp
new file mode 100644
index 00000000..e98245d7
--- /dev/null
+++ b/Src/Plugins/General/gen_hotkeys/accelBlock.cpp
@@ -0,0 +1,47 @@
+#include "gen_hotkeys.h"
+#include "api__gen_hotkeys.h"
+#include "./accelBlock.h"
+
+static BOOL RegisterMessageProcessor(ifc_messageprocessor *processor, BOOL bRegister)
+{
+ if (NULL == WASABI_API_APP)
+ return FALSE;
+
+ if (bRegister)
+ WASABI_API_APP->app_addMessageProcessor(processor);
+ else
+ WASABI_API_APP->app_removeMessageProcessor(processor);
+
+ return TRUE;
+}
+
+AcceleratorBlocker::AcceleratorBlocker(HWND hwndToBlock) : hwnd(hwndToBlock)
+{
+ RegisterMessageProcessor(this, TRUE);
+}
+AcceleratorBlocker::~AcceleratorBlocker()
+{
+ RegisterMessageProcessor(this, FALSE);
+}
+
+bool AcceleratorBlocker::ProcessMessage(MSG *pMsg)
+{
+ if (pMsg->hwnd != hwnd)
+ return false;
+
+ switch(pMsg->message)
+ {
+ case WM_KEYDOWN:
+ case WM_SYSKEYDOWN:
+ TranslateMessage(pMsg);
+ DispatchMessageW(pMsg);
+ return true;
+ }
+ return false;
+}
+
+
+#define CBCLASS AcceleratorBlocker
+START_DISPATCH;
+CB(IFC_MESSAGEPROCESSOR_PROCESS_MESSAGE, ProcessMessage)
+END_DISPATCH; \ No newline at end of file