-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathhotkey.c
More file actions
75 lines (66 loc) · 2.57 KB
/
hotkey.c
File metadata and controls
75 lines (66 loc) · 2.57 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
#include "mouse_stabilizer.h"
void Hotkey_ToggleStabilizer(void) {
g_stabilizer.enabled = !g_stabilizer.enabled;
Settings_WriteLog("Mouse stabilizer %s", g_stabilizer.enabled ? "enabled" : "disabled");
TrayUI_UpdateIcon();
}
LRESULT CALLBACK Hotkey_WindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) {
switch (uMsg) {
case WM_HOTKEY:
if (wParam == HOTKEY_ID) {
Hotkey_ToggleStabilizer();
}
return 0;
case WM_INPUT:
MouseInput_ProcessRawInput(lParam);
return 0;
case WM_TIMER:
if (wParam == TIMER_ID) {
StabilizerCore_UpdatePosition(&g_stabilizer);
} else if (wParam == DRAW_TIMER_ID) {
TargetPointer_UpdateWindow();
}
return 0;
case WM_TRAYICON:
switch (lParam) {
case WM_RBUTTONUP:
TrayUI_ShowContextMenu(hwnd);
break;
case WM_LBUTTONDBLCLK:
Hotkey_ToggleStabilizer();
break;
}
return 0;
case WM_COMMAND:
LOG_DEBUG("WM_COMMAND received, wParam: %lu", (unsigned long)wParam);
switch (LOWORD(wParam)) {
case 1001: // Toggle Stabilizer
LOG_DEBUG("Toggle Stabilizer command received");
Hotkey_ToggleStabilizer();
break;
case 1002: // Settings Window
LOG_DEBUG("Settings Window command received");
SettingsUI_ShowWindow();
LOG_DEBUG("SettingsUI_ShowWindow call completed");
break;
case 1003: // Debug Mode Toggle
{
LogLevel current = Settings_GetLogLevel();
LogLevel next = (LogLevel)((current + 1) % (LOG_TRACE + 1));
Settings_SetLogLevel(next);
Settings_Save();
}
break;
case 1004: // Exit
g_running = false;
PostQuitMessage(0);
break;
}
return 0;
case WM_DESTROY:
Shell_NotifyIcon(NIM_DELETE, &g_nid);
PostQuitMessage(0);
return 0;
}
return DefWindowProc(hwnd, uMsg, wParam, lParam);
}