soul: show touch cursor

This commit is contained in:
Dniel97
2026-02-02 21:18:56 +01:00
parent 6e3272d4bd
commit 50067086bd
+23
View File
@@ -43,6 +43,8 @@ static BOOL WINAPI hook_GetTouchInputInfo(
static HCURSOR WINAPI hook_SetCursor(HCURSOR cursor);
static int WINAPI hook_ShowCursor(BOOL bShow);
static LONG_PTR WINAPI hook_SetWindowLongPtrA(HWND hWnd, int nIndex, LONG_PTR dwNewLong);
/* Link pointers */
@@ -69,6 +71,8 @@ static BOOL (WINAPI *next_GetTouchInputInfo)(
static HCURSOR(WINAPI *next_SetCursor)(HCURSOR cursor);
static int (WINAPI *next_ShowCursor)(BOOL bShow);
static LONG_PTR (WINAPI *next_SetWindowLongPtrA)(HWND hWnd, int nIndex, LONG_PTR dwNewLong);
static bool touch_hook_initted;
@@ -99,6 +103,11 @@ static const struct hook_symbol touch_hooks[] = {
.patch = hook_GetTouchInputInfo,
.link = (void **) &next_GetTouchInputInfo
},
{
.name = "ShowCursor",
.patch = hook_ShowCursor,
.link = (void **) &next_ShowCursor
},
{
.name = "SetCursor",
.patch = hook_SetCursor,
@@ -141,6 +150,15 @@ void touch_hook_insert_hooks(HMODULE target)
_countof(touch_hooks));
}
static int WINAPI hook_ShowCursor(BOOL bShow)
{
if (touch_config.cursor) {
return 1;
}
return next_ShowCursor(bShow);
}
static HCURSOR WINAPI hook_SetCursor(HCURSOR cursor) {
if (cursor == 0 && touch_config.cursor)
return next_SetCursor(defaultCursor);
@@ -155,6 +173,11 @@ static LRESULT hook_wndProc(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam) {
orig_wndProc(hWnd, WM_TOUCH, 1, 1);
}
if (Msg == WM_SETCURSOR && touch_config.cursor) {
SetCursor(defaultCursor);
return TRUE;
}
return orig_wndProc(hWnd, Msg, wParam, lParam);
}