Skip to content

Commit

Permalink
Ignore Ctrl if simulated (vai AltGr for exmple)
Browse files Browse the repository at this point in the history
  • Loading branch information
RamonUnch authored May 12, 2024
1 parent 340a81f commit 6890cab
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 3 deletions.
8 changes: 6 additions & 2 deletions hooks.c
Original file line number Diff line number Diff line change
Expand Up @@ -2674,11 +2674,15 @@ __declspec(dllexport) LRESULT CALLBACK LowLevelKeyboardProc(int nCode, WPARAM wP
// Block ESC if an action was ongoing
if (action) return 1;
}
} else if (!state.ctrl && state.alt!=vkey && !IsModKey(vkey)/*vkey != conf.ModKey*/
&& (vkey == VK_LCONTROL || vkey == VK_RCONTROL)) {
} else if (!state.ctrl
&& state.alt!=vkey
&& (vkey == VK_LCONTROL || vkey == VK_RCONTROL)
&& !(kbh->scanCode&SCANCODE_SIMULATED) /* Ignore ALT GR Scan Code (&0x0200) */
&& !IsModKey(vkey)/*vkey != conf.ModKey*/ ) {
RestrictToCurentMonitor();
// If menu is present inform it that we pressed Ctrl.
//if (state.unikeymenu) PostMessage(g_mchwnd, WM_CLOSEMODE, 1, 0);
//LOGA("sC=%lu", kbh->scanCode);
state.ctrl = 1;
state.ctrlpt = state.prevpt; // Save point where ctrl was pressed.
if (state.action) {
Expand Down
10 changes: 9 additions & 1 deletion unfuck.h
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,10 @@ enum MONITOR_DPI_TYPE {
#define INVALID_FILE_ATTRIBUTES 0xFFFFFFFF
#endif

#ifndef STACK_SIZE_PARAM_IS_A_RESERVATION
#define STACK_SIZE_PARAM_IS_A_RESERVATION 0x10000L
#endif

#ifndef WPF_ASYNCWINDOWPLACEMENT
#define WPF_ASYNCWINDOWPLACEMENT 0x0004
#endif
Expand All @@ -126,6 +130,10 @@ enum MONITOR_DPI_TYPE {
#define InterlockedDecrement(x) InterlockedDecrement((LONG*)(x))
#endif

#ifndef SCANCODE_SIMULATED
#define SCANCODE_SIMULATED 0x0200
#endif

#ifndef MSAA_MENU_SIG
#define MSAA_MENU_SIG 0xAA0DF00D
typedef struct tagMSAAMENUINFO {
Expand Down Expand Up @@ -203,7 +211,7 @@ static void LOGfunk( const char *fmt, ... )
char lerrorstr[16];
DWORD dummy;
lstrcat_sA(str, ARR_SZ(str), " (");
lstrcat_sA(str, ARR_SZ(str), itostrA(lerr, lerrorstr, 16));
lstrcat_sA(str, ARR_SZ(str), itostrA(lerr, lerrorstr, 10));
lstrcat_sA(str, ARR_SZ(str), ")\n");
WriteFile( h, str, lstrlenA(str), &dummy, NULL );
CloseHandle(h);
Expand Down

0 comments on commit 6890cab

Please sign in to comment.