Skip to content

Commit 65e0e48

Browse files
authored
Merge pull request #537 from RamonUnch/RamonUnch-Ignore-Ctrl-if-simulated
Ignore Ctrl if simulated (vai AltGr for exmple)
2 parents 340a81f + 6890cab commit 65e0e48

File tree

2 files changed

+15
-3
lines changed

2 files changed

+15
-3
lines changed

hooks.c

+6-2
Original file line numberDiff line numberDiff line change
@@ -2674,11 +2674,15 @@ __declspec(dllexport) LRESULT CALLBACK LowLevelKeyboardProc(int nCode, WPARAM wP
26742674
// Block ESC if an action was ongoing
26752675
if (action) return 1;
26762676
}
2677-
} else if (!state.ctrl && state.alt!=vkey && !IsModKey(vkey)/*vkey != conf.ModKey*/
2678-
&& (vkey == VK_LCONTROL || vkey == VK_RCONTROL)) {
2677+
} else if (!state.ctrl
2678+
&& state.alt!=vkey
2679+
&& (vkey == VK_LCONTROL || vkey == VK_RCONTROL)
2680+
&& !(kbh->scanCode&SCANCODE_SIMULATED) /* Ignore ALT GR Scan Code (&0x0200) */
2681+
&& !IsModKey(vkey)/*vkey != conf.ModKey*/ ) {
26792682
RestrictToCurentMonitor();
26802683
// If menu is present inform it that we pressed Ctrl.
26812684
//if (state.unikeymenu) PostMessage(g_mchwnd, WM_CLOSEMODE, 1, 0);
2685+
//LOGA("sC=%lu", kbh->scanCode);
26822686
state.ctrl = 1;
26832687
state.ctrlpt = state.prevpt; // Save point where ctrl was pressed.
26842688
if (state.action) {

unfuck.h

+9-1
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,10 @@ enum MONITOR_DPI_TYPE {
114114
#define INVALID_FILE_ATTRIBUTES 0xFFFFFFFF
115115
#endif
116116

117+
#ifndef STACK_SIZE_PARAM_IS_A_RESERVATION
118+
#define STACK_SIZE_PARAM_IS_A_RESERVATION 0x10000L
119+
#endif
120+
117121
#ifndef WPF_ASYNCWINDOWPLACEMENT
118122
#define WPF_ASYNCWINDOWPLACEMENT 0x0004
119123
#endif
@@ -126,6 +130,10 @@ enum MONITOR_DPI_TYPE {
126130
#define InterlockedDecrement(x) InterlockedDecrement((LONG*)(x))
127131
#endif
128132

133+
#ifndef SCANCODE_SIMULATED
134+
#define SCANCODE_SIMULATED 0x0200
135+
#endif
136+
129137
#ifndef MSAA_MENU_SIG
130138
#define MSAA_MENU_SIG 0xAA0DF00D
131139
typedef struct tagMSAAMENUINFO {
@@ -203,7 +211,7 @@ static void LOGfunk( const char *fmt, ... )
203211
char lerrorstr[16];
204212
DWORD dummy;
205213
lstrcat_sA(str, ARR_SZ(str), " (");
206-
lstrcat_sA(str, ARR_SZ(str), itostrA(lerr, lerrorstr, 16));
214+
lstrcat_sA(str, ARR_SZ(str), itostrA(lerr, lerrorstr, 10));
207215
lstrcat_sA(str, ARR_SZ(str), ")\n");
208216
WriteFile( h, str, lstrlenA(str), &dummy, NULL );
209217
CloseHandle(h);

0 commit comments

Comments
 (0)