From 360416f5406b3125effb0b598cdc25ceecc82674 Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Sun, 9 Jun 2024 16:26:14 +0300 Subject: [PATCH] Fix MS-Windows build broken by recent touch-screen changes * src/w32term.c (TOUCHEVENTF_DOWN, TOUCHEVENTF_UP): (struct _TOUCHINPUT): Move before first use. (TOUCHEVENTF_MOVE, TOUCHEVENTMASKF_CONTACTAREA) (TOUCHEVENTMASKF_EXTRAINFO, TOUCHEVENTMASKF_TIMEFROMSYSTEM): Ifdef away unused macros. (w32_read_socket): Fix typo. (cherry picked from commit b8e78d2657d124d97509726ce9a4e4efd01fd752) --- src/w32term.c | 58 ++++++++++++++++++++++++++------------------------- 1 file changed, 30 insertions(+), 28 deletions(-) diff --git a/src/w32term.c b/src/w32term.c index 74d73af727a..61185279cf9 100644 --- a/src/w32term.c +++ b/src/w32term.c @@ -120,43 +120,20 @@ BOOL (WINAPI *pfnSetLayeredWindowAttributes) (HWND, COLORREF, BYTE, DWORD); /* PlgBlt is available since Windows 2000. */ BOOL (WINAPI *pfnPlgBlt) (HDC, const POINT *, HDC, int, int, int, int, HBITMAP, int, int); -/* Functions that extract data from touch-screen events. */ -typedef BOOL (WINAPI * CloseTouchInputHandle_proc) (HANDLE); -typedef BOOL (WINAPI * GetTouchInputInfo_proc) (HANDLE, UINT, PTOUCHINPUT, int); - -CloseTouchInputHandle_proc pfnCloseTouchInputHandle; -GetTouchInputInfo_proc pfnGetTouchInputInfo; - - -#ifndef LWA_ALPHA -#define LWA_ALPHA 0x02 -#endif -/* WS_EX_LAYERED is defined unconditionally by MingW, but only for W2K and - later targets by MSVC headers. */ -#ifndef WS_EX_LAYERED -#define WS_EX_LAYERED 0x80000 -#endif - -/* SM_CXVIRTUALSCREEN and SM_CYVIRTUALSCREEN are not defined on 95 and - NT4. */ -#ifndef SM_CXVIRTUALSCREEN -#define SM_CXVIRTUALSCREEN 78 -#endif -#ifndef SM_CYVIRTUALSCREEN -#define SM_CYVIRTUALSCREEN 79 -#endif - /* Define required types and constants on systems with older headers lest they be absent. */ #if _WIN32_WINNT < 0x0601 #define TOUCHEVENTF_DOWN 0x0001 -#define TOUCHEVENTF_MOVE 0x0002 #define TOUCHEVENTF_UP 0x0004 +/* These are currently unused; prevent compiler warnings. */ +#if 0 +#define TOUCHEVENTF_MOVE 0x0002 #define TOUCHEVENTMASKF_CONTACTAREA 0x0004 #define TOUCHEVENTMASKF_EXTRAINFO 0x0002 #define TOUCHEVENTMASKF_TIMEFROMSYSTEM 0x0001 +#endif /* 0 */ #define WM_TOUCHMOVE 576 @@ -175,6 +152,31 @@ typedef struct _TOUCHINPUT } TOUCHINPUT, *PTOUCHINPUT; #endif /* _WIN32_WINNT < 0x0601 */ +/* Functions that extract data from touch-screen events. */ +typedef BOOL (WINAPI * CloseTouchInputHandle_proc) (HANDLE); +typedef BOOL (WINAPI * GetTouchInputInfo_proc) (HANDLE, UINT, PTOUCHINPUT, int); + +CloseTouchInputHandle_proc pfnCloseTouchInputHandle; +GetTouchInputInfo_proc pfnGetTouchInputInfo; + +#ifndef LWA_ALPHA +#define LWA_ALPHA 0x02 +#endif +/* WS_EX_LAYERED is defined unconditionally by MingW, but only for W2K and + later targets by MSVC headers. */ +#ifndef WS_EX_LAYERED +#define WS_EX_LAYERED 0x80000 +#endif + +/* SM_CXVIRTUALSCREEN and SM_CYVIRTUALSCREEN are not defined on 95 and + NT4. */ +#ifndef SM_CXVIRTUALSCREEN +#define SM_CXVIRTUALSCREEN 78 +#endif +#ifndef SM_CYVIRTUALSCREEN +#define SM_CYVIRTUALSCREEN 79 +#endif + /* The handle of the frame that currently owns the system caret. */ HWND w32_system_caret_hwnd; int w32_system_caret_height; @@ -6264,7 +6266,7 @@ w32_read_socket (struct terminal *terminal, } } - (*CloseTouchInputHandle) ((HANDLE) msg.msg.lParam); + (*pfnCloseTouchInputHandle) ((HANDLE) msg.msg.lParam); break; default: -- 2.39.2