From 6890cabfe93f5526491d146626f4874727ace8fc Mon Sep 17 00:00:00 2001 From: RamonUnch <74856804+RamonUnch@users.noreply.github.com> Date: Sun, 12 May 2024 10:37:33 +0200 Subject: [PATCH] Ignore Ctrl if simulated (vai AltGr for exmple) --- hooks.c | 8 ++++++-- unfuck.h | 10 +++++++++- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/hooks.c b/hooks.c index 825cc9f6..8709c591 100644 --- a/hooks.c +++ b/hooks.c @@ -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) { diff --git a/unfuck.h b/unfuck.h index 88a69891..65b3604d 100644 --- a/unfuck.h +++ b/unfuck.h @@ -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 @@ -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 { @@ -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);