From b8e78d2657d124d97509726ce9a4e4efd01fd752 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. --- src/w32term.c | 64 ++++++++++++++++++++++++++------------------------- 1 file changed, 33 insertions(+), 31 deletions(-) diff --git a/src/w32term.c b/src/w32term.c index 74d73af727a..61185279cf9 100644 --- a/src/w32term.c +++ b/src/w32term.c @@ -120,6 +120,38 @@ 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); +/* Define required types and constants on systems with older headers + lest they be absent. */ + +#if _WIN32_WINNT < 0x0601 +#define TOUCHEVENTF_DOWN 0x0001 +#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 + +typedef struct _TOUCHINPUT +{ + LONG x; + LONG y; + HANDLE hSource; + DWORD dwID; + DWORD dwFlags; + DWORD dwMask; + DWORD dwTime; + ULONG_PTR dwExtraInfo; + DWORD cxContact; + DWORD cyContact; +} 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); @@ -127,7 +159,6 @@ typedef BOOL (WINAPI * GetTouchInputInfo_proc) (HANDLE, UINT, PTOUCHINPUT, int); CloseTouchInputHandle_proc pfnCloseTouchInputHandle; GetTouchInputInfo_proc pfnGetTouchInputInfo; - #ifndef LWA_ALPHA #define LWA_ALPHA 0x02 #endif @@ -146,35 +177,6 @@ GetTouchInputInfo_proc pfnGetTouchInputInfo; #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 - -#define TOUCHEVENTMASKF_CONTACTAREA 0x0004 -#define TOUCHEVENTMASKF_EXTRAINFO 0x0002 -#define TOUCHEVENTMASKF_TIMEFROMSYSTEM 0x0001 - -#define WM_TOUCHMOVE 576 - -typedef struct _TOUCHINPUT -{ - LONG x; - LONG y; - HANDLE hSource; - DWORD dwID; - DWORD dwFlags; - DWORD dwMask; - DWORD dwTime; - ULONG_PTR dwExtraInfo; - DWORD cxContact; - DWORD cyContact; -} TOUCHINPUT, *PTOUCHINPUT; -#endif /* _WIN32_WINNT < 0x0601 */ - /* 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: