Removed the non-working keyboard hook, and with it, the NOHOOK make parameter.

This commit is contained in:
OBattler
2021-08-29 13:59:05 +02:00
parent 0ae0abcf9c
commit 64aee0481c
2 changed files with 31 additions and 112 deletions

View File

@@ -297,22 +297,39 @@ TOOL_PREFIX := x86_64-w64-mingw32-
else
TOOL_PREFIX := i686-w64-mingw32-
endif
CPP := ${TOOL_PREFIX}g++
CC := ${TOOL_PREFIX}gcc
WINDRES := windres
STRIP := strip
ifeq ($(ARM64), y)
CPP := aarch64-w64-mingw32-g++
CC := aarch64-w64-mingw32-gcc
WINDRES := aarch64-w64-mingw32-windres
STRIP := aarch64-w64-mingw32-strip
endif
ifeq ($(ARM), y)
CPP := armv7-w64-mingw32-g++
CC := armv7-w64-mingw32-gcc
WINDRES := armv7-w64-mingw32-windres
STRIP := armv7-w64-mingw32-strip
endif
ifeq ($(CLANG), y)
CPP := clang++
CC := clang
ifeq ($(ARM64), y)
CPP := aarch64-w64-mingw32-clang++
CC := aarch64-w64-mingw32-clang
endif
ifeq ($(ARM), y)
CPP := armv7-w64-mingw32-clang++
CC := armv7-w64-mingw32-clang
endif
else
CPP := ${TOOL_PREFIX}g++
CC := ${TOOL_PREFIX}gcc
ifeq ($(ARM64), y)
CPP := aarch64-w64-mingw32-g++
CC := aarch64-w64-mingw32-gcc
endif
ifeq ($(ARM), y)
CPP := armv7-w64-mingw32-g++
CC := armv7-w64-mingw32-gcc
endif
endif
DEPS = -MMD -MF $*.d -c $<
DEPFILE := win/.depends
@@ -326,15 +343,11 @@ endif
ifdef EXINC
OPTS += -I$(EXINC)
endif
ifeq ($(X64), y)
ifeq ($(OPTIM), y)
DFLAGS := -march=native
else
DFLAGS :=
endif
ifeq ($(OPTIM), y)
DFLAGS := -march=native
else
ifeq ($(OPTIM), y)
DFLAGS := -march=native
ifeq ($(X64), y)
DFLAGS :=
else
DFLAGS := -march=i686
endif
@@ -378,10 +391,6 @@ ifeq ($(VRAMDUMP), y)
OPTS += -DENABLE_VRAM_DUMP
RFLAGS += -DENABLE_VRAM_DUMP
endif
ifeq ($(NOHOOK), y)
OPTS += -DNO_KEYBOARD_HOOK
RFLAGS += -DNO_KEYBOARD_HOOK
endif
# Optional modules.
@@ -829,7 +838,7 @@ LIBS += -static
ifeq ($(AUTODEP), y)
%.o: %.c
@echo $<
@$(CC) $(CFLAGS) $(DEPS) -c $<
$(CC) $(CFLAGS) $(DEPS) -c $<
%.o: %.cc
@echo $<
@@ -866,7 +875,9 @@ endif
# Suppress false positive warnings in vid_voodoo_codegen_x86[-64].h
# that cause ~3000 lines to be output into the logs each time.
$(VOODOOOBJ): CFLAGS += -Wstringop-overflow=0
ifneq ($(CLANG), y)
$(VOODOOOBJ): CFLAGS += -Wstringop-overflow=0
endif
all: $(PROG).exe

View File

@@ -76,10 +76,6 @@ extern WCHAR wopenfilestring[512];
/* Local data. */
static wchar_t wTitle[512];
#ifndef NO_KEYBOARD_HOOK
static HHOOK hKeyboardHook;
static int hook_enabled = 0;
#endif
static int manager_wm = 0;
static int save_window_pos = 0, pause_state = 0;
static int dpi = 96;
@@ -399,42 +395,6 @@ ResetAllMenus(void)
}
#ifndef NO_KEYBOARD_HOOK
static LRESULT CALLBACK
LowLevelKeyboardProc(int nCode, WPARAM wParam, LPARAM lParam)
{
BOOL bControlKeyDown;
KBDLLHOOKSTRUCT *p;
if (nCode < 0 || nCode != HC_ACTION ||
(!mouse_capture && !video_fullscreen) || (kbd_req_capture && !mouse_capture && !video_fullscreen))
return(CallNextHookEx(hKeyboardHook, nCode, wParam, lParam));
p = (KBDLLHOOKSTRUCT*)lParam;
/* disable alt-tab */
if (p->vkCode == VK_TAB && p->flags & LLKHF_ALTDOWN) return(1);
/* disable alt-space */
if (p->vkCode == VK_SPACE && p->flags & LLKHF_ALTDOWN) return(1);
/* disable alt-escape */
if (p->vkCode == VK_ESCAPE && p->flags & LLKHF_ALTDOWN) return(1);
/* disable windows keys */
if((p->vkCode == VK_LWIN) || (p->vkCode == VK_RWIN)) return(1);
/* checks ctrl key pressed */
bControlKeyDown = GetAsyncKeyState(VK_CONTROL)>>((sizeof(SHORT)*8)-1);
/* disable ctrl-escape */
if (p->vkCode == VK_ESCAPE && bControlKeyDown) return(1);
return(CallNextHookEx(hKeyboardHook, nCode, wParam, lParam));
}
#endif
void
win_notify_dlg_open(void)
{
@@ -467,10 +427,6 @@ plat_power_off(void)
run before the main thread is terminated */
cycles -= 99999999;
#ifndef NO_KEYBOARD_HOOK
UnhookWindowsHookEx(hKeyboardHook);
#endif
KillTimer(hwndMain, TIMER_1SEC);
PostQuitMessage(0);
@@ -532,26 +488,11 @@ input_proc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
break;
case WM_SETFOCUS:
infocus = 1;
#ifndef NO_KEYBOARD_HOOK
if (! hook_enabled) {
hKeyboardHook = SetWindowsHookEx(WH_KEYBOARD_LL,
LowLevelKeyboardProc,
GetModuleHandle(NULL),
0);
hook_enabled = 1;
}
#endif
break;
case WM_KILLFOCUS:
infocus = 0;
plat_mouse_capture(0);
#ifndef NO_KEYBOARD_HOOK
if (hook_enabled) {
UnhookWindowsHookEx(hKeyboardHook);
hook_enabled = 0;
}
#endif
break;
case WM_LBUTTONDOWN:
@@ -597,12 +538,6 @@ MainWindowProcedure(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
switch (message) {
case WM_CREATE:
SetTimer(hwnd, TIMER_1SEC, 1000, NULL);
#ifndef NO_KEYBOARD_HOOK
hKeyboardHook = SetWindowsHookEx(WH_KEYBOARD_LL,
LowLevelKeyboardProc,
GetModuleHandle(NULL), 0);
hook_enabled = 1;
#endif
break;
case WM_COMMAND:
@@ -654,9 +589,6 @@ MainWindowProcedure(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
nvr_save();
config_save();
}
#ifndef NO_KEYBOARD_HOOK
UnhookWindowsHookEx(hKeyboardHook);
#endif
KillTimer(hwnd, TIMER_1SEC);
PostQuitMessage(0);
}
@@ -1125,9 +1057,6 @@ MainWindowProcedure(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
nvr_save();
config_save();
}
#ifndef NO_KEYBOARD_HOOK
UnhookWindowsHookEx(hKeyboardHook);
#endif
KillTimer(hwnd, TIMER_1SEC);
PostQuitMessage(0);
}
@@ -1135,9 +1064,6 @@ MainWindowProcedure(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
break;
case WM_DESTROY:
#ifndef NO_KEYBOARD_HOOK
UnhookWindowsHookEx(hKeyboardHook);
#endif
KillTimer(hwnd, TIMER_1SEC);
PostQuitMessage(0);
break;
@@ -1192,9 +1118,6 @@ MainWindowProcedure(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
nvr_save();
config_save();
}
#ifndef NO_KEYBOARD_HOOK
UnhookWindowsHookEx(hKeyboardHook);
#endif
KillTimer(hwnd, TIMER_1SEC);
PostQuitMessage(0);
}
@@ -1224,26 +1147,11 @@ MainWindowProcedure(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
case WM_SETFOCUS:
infocus = 1;
#ifndef NO_KEYBOARD_HOOK
if (! hook_enabled) {
hKeyboardHook = SetWindowsHookEx(WH_KEYBOARD_LL,
LowLevelKeyboardProc,
GetModuleHandle(NULL),
0);
hook_enabled = 1;
}
#endif
break;
case WM_KILLFOCUS:
infocus = 0;
plat_mouse_capture(0);
#ifndef NO_KEYBOARD_HOOK
if (hook_enabled) {
UnhookWindowsHookEx(hKeyboardHook);
hook_enabled = 0;
}
#endif
break;
case WM_ACTIVATE: