SDL_windowsvideo.h 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558
  1. /*
  2. Simple DirectMedia Layer
  3. Copyright (C) 1997-2025 Sam Lantinga <slouken@libsdl.org>
  4. This software is provided 'as-is', without any express or implied
  5. warranty. In no event will the authors be held liable for any damages
  6. arising from the use of this software.
  7. Permission is granted to anyone to use this software for any purpose,
  8. including commercial applications, and to alter it and redistribute it
  9. freely, subject to the following restrictions:
  10. 1. The origin of this software must not be misrepresented; you must not
  11. claim that you wrote the original software. If you use this software
  12. in a product, an acknowledgment in the product documentation would be
  13. appreciated but is not required.
  14. 2. Altered source versions must be plainly marked as such, and must not be
  15. misrepresented as being the original software.
  16. 3. This notice may not be removed or altered from any source distribution.
  17. */
  18. #include "SDL_internal.h"
  19. #ifndef SDL_windowsvideo_h_
  20. #define SDL_windowsvideo_h_
  21. #include "../../core/windows/SDL_windows.h"
  22. #include "../SDL_sysvideo.h"
  23. #ifdef HAVE_DXGI_H
  24. #define CINTERFACE
  25. #define COBJMACROS
  26. #include <dxgi.h>
  27. #endif
  28. #if defined(_MSC_VER) && (_MSC_VER >= 1500) && !defined(SDL_PLATFORM_XBOXONE) && !defined(SDL_PLATFORM_XBOXSERIES)
  29. #include <msctf.h>
  30. #else
  31. #include "SDL_msctf.h"
  32. #endif
  33. #include <imm.h>
  34. #define MAX_CANDLIST 10
  35. #define MAX_CANDLENGTH 256
  36. #define MAX_CANDSIZE (sizeof(WCHAR) * MAX_CANDLIST * MAX_CANDLENGTH)
  37. #include "SDL_windowsclipboard.h"
  38. #include "SDL_windowsevents.h"
  39. #include "SDL_windowsgameinput.h"
  40. #include "SDL_windowsopengl.h"
  41. #if !defined(SDL_PLATFORM_XBOXONE) && !defined(SDL_PLATFORM_XBOXSERIES)
  42. #include "SDL_windowsshape.h"
  43. #include "SDL_windowskeyboard.h"
  44. #include "SDL_windowsmodes.h"
  45. #include "SDL_windowsmouse.h"
  46. #include "SDL_windowsopengles.h"
  47. #endif
  48. #include "SDL_windowswindow.h"
  49. #ifndef USER_DEFAULT_SCREEN_DPI
  50. #define USER_DEFAULT_SCREEN_DPI 96
  51. #endif
  52. #if WINVER < 0x0601
  53. // Touch input definitions
  54. #define TWF_FINETOUCH 1
  55. #define TWF_WANTPALM 2
  56. #define TOUCHEVENTF_MOVE 0x0001
  57. #define TOUCHEVENTF_DOWN 0x0002
  58. #define TOUCHEVENTF_UP 0x0004
  59. DECLARE_HANDLE(HTOUCHINPUT);
  60. typedef struct _TOUCHINPUT
  61. {
  62. LONG x;
  63. LONG y;
  64. HANDLE hSource;
  65. DWORD dwID;
  66. DWORD dwFlags;
  67. DWORD dwMask;
  68. DWORD dwTime;
  69. ULONG_PTR dwExtraInfo;
  70. DWORD cxContact;
  71. DWORD cyContact;
  72. } TOUCHINPUT, *PTOUCHINPUT;
  73. // More-robust display information in Vista...
  74. // This is a huge amount of data to be stuffing into three API calls. :(
  75. typedef struct DISPLAYCONFIG_PATH_SOURCE_INFO
  76. {
  77. LUID adapterId;
  78. UINT32 id;
  79. union
  80. {
  81. UINT32 modeInfoIdx;
  82. struct
  83. {
  84. UINT32 cloneGroupId : 16;
  85. UINT32 sourceModeInfoIdx : 16;
  86. } DUMMYSTRUCTNAME;
  87. } DUMMYUNIONNAME;
  88. UINT32 statusFlags;
  89. } DISPLAYCONFIG_PATH_SOURCE_INFO;
  90. typedef struct DISPLAYCONFIG_RATIONAL
  91. {
  92. UINT32 Numerator;
  93. UINT32 Denominator;
  94. } DISPLAYCONFIG_RATIONAL;
  95. typedef struct DISPLAYCONFIG_PATH_TARGET_INFO
  96. {
  97. LUID adapterId;
  98. UINT32 id;
  99. union
  100. {
  101. UINT32 modeInfoIdx;
  102. struct
  103. {
  104. UINT32 desktopModeInfoIdx : 16;
  105. UINT32 targetModeInfoIdx : 16;
  106. } DUMMYSTRUCTNAME;
  107. } DUMMYUNIONNAME;
  108. UINT32 /*DISPLAYCONFIG_VIDEO_OUTPUT_TECHNOLOGY*/ outputTechnology;
  109. UINT32 /*DISPLAYCONFIG_ROTATION*/ rotation;
  110. UINT32 /*DISPLAYCONFIG_SCALING*/ scaling;
  111. DISPLAYCONFIG_RATIONAL refreshRate;
  112. UINT32 /*DISPLAYCONFIG_SCANLINE_ORDERING*/ scanLineOrdering;
  113. BOOL targetAvailable;
  114. UINT32 statusFlags;
  115. } DISPLAYCONFIG_PATH_TARGET_INFO;
  116. typedef struct DISPLAYCONFIG_PATH_INFO
  117. {
  118. DISPLAYCONFIG_PATH_SOURCE_INFO sourceInfo;
  119. DISPLAYCONFIG_PATH_TARGET_INFO targetInfo;
  120. UINT32 flags;
  121. } DISPLAYCONFIG_PATH_INFO;
  122. typedef enum
  123. {
  124. DISPLAYCONFIG_MODE_INFO_TYPE_SOURCE = 1,
  125. DISPLAYCONFIG_MODE_INFO_TYPE_TARGET = 2,
  126. DISPLAYCONFIG_MODE_INFO_TYPE_DESKTOP_IMAGE = 3,
  127. DISPLAYCONFIG_MODE_INFO_TYPE_FORCE_UINT32 = 0xFFFFFFFF
  128. } DISPLAYCONFIG_MODE_INFO_TYPE;
  129. typedef struct DISPLAYCONFIG_2DREGION
  130. {
  131. UINT32 cx;
  132. UINT32 cy;
  133. } DISPLAYCONFIG_2DREGION;
  134. typedef struct DISPLAYCONFIG_VIDEO_SIGNAL_INFO
  135. {
  136. UINT64 pixelRate;
  137. DISPLAYCONFIG_RATIONAL hSyncFreq;
  138. DISPLAYCONFIG_RATIONAL vSyncFreq;
  139. DISPLAYCONFIG_2DREGION activeSize;
  140. DISPLAYCONFIG_2DREGION totalSize;
  141. union
  142. {
  143. struct
  144. {
  145. UINT32 videoStandard : 16;
  146. // Vertical refresh frequency divider
  147. UINT32 vSyncFreqDivider : 6;
  148. UINT32 reserved : 10;
  149. } AdditionalSignalInfo;
  150. UINT32 videoStandard;
  151. } DUMMYUNIONNAME;
  152. // Scan line ordering (e.g. progressive, interlaced).
  153. UINT32 /*DISPLAYCONFIG_SCANLINE_ORDERING*/ scanLineOrdering;
  154. } DISPLAYCONFIG_VIDEO_SIGNAL_INFO;
  155. typedef struct DISPLAYCONFIG_SOURCE_MODE
  156. {
  157. UINT32 width;
  158. UINT32 height;
  159. UINT32 /*DISPLAYCONFIG_PIXELFORMAT*/ pixelFormat;
  160. POINTL position;
  161. } DISPLAYCONFIG_SOURCE_MODE;
  162. typedef struct DISPLAYCONFIG_TARGET_MODE
  163. {
  164. DISPLAYCONFIG_VIDEO_SIGNAL_INFO targetVideoSignalInfo;
  165. } DISPLAYCONFIG_TARGET_MODE;
  166. typedef struct DISPLAYCONFIG_DESKTOP_IMAGE_INFO
  167. {
  168. POINTL PathSourceSize;
  169. RECTL DesktopImageRegion;
  170. RECTL DesktopImageClip;
  171. } DISPLAYCONFIG_DESKTOP_IMAGE_INFO;
  172. typedef struct DISPLAYCONFIG_MODE_INFO
  173. {
  174. DISPLAYCONFIG_MODE_INFO_TYPE infoType;
  175. UINT32 id;
  176. LUID adapterId;
  177. union
  178. {
  179. DISPLAYCONFIG_TARGET_MODE targetMode;
  180. DISPLAYCONFIG_SOURCE_MODE sourceMode;
  181. DISPLAYCONFIG_DESKTOP_IMAGE_INFO desktopImageInfo;
  182. } DUMMYUNIONNAME;
  183. } DISPLAYCONFIG_MODE_INFO;
  184. typedef enum DISPLAYCONFIG_TOPOLOGY_ID
  185. {
  186. DISPLAYCONFIG_TOPOLOGY_INTERNAL = 0x00000001,
  187. DISPLAYCONFIG_TOPOLOGY_CLONE = 0x00000002,
  188. DISPLAYCONFIG_TOPOLOGY_EXTEND = 0x00000004,
  189. DISPLAYCONFIG_TOPOLOGY_EXTERNAL = 0x00000008,
  190. DISPLAYCONFIG_TOPOLOGY_FORCE_UINT32 = 0xFFFFFFFF
  191. } DISPLAYCONFIG_TOPOLOGY_ID;
  192. typedef enum
  193. {
  194. DISPLAYCONFIG_DEVICE_INFO_GET_SOURCE_NAME = 1,
  195. DISPLAYCONFIG_DEVICE_INFO_GET_TARGET_NAME = 2,
  196. DISPLAYCONFIG_DEVICE_INFO_GET_TARGET_PREFERRED_MODE = 3,
  197. DISPLAYCONFIG_DEVICE_INFO_GET_ADAPTER_NAME = 4,
  198. DISPLAYCONFIG_DEVICE_INFO_SET_TARGET_PERSISTENCE = 5,
  199. DISPLAYCONFIG_DEVICE_INFO_GET_TARGET_BASE_TYPE = 6,
  200. DISPLAYCONFIG_DEVICE_INFO_GET_SUPPORT_VIRTUAL_RESOLUTION = 7,
  201. DISPLAYCONFIG_DEVICE_INFO_SET_SUPPORT_VIRTUAL_RESOLUTION = 8,
  202. DISPLAYCONFIG_DEVICE_INFO_GET_ADVANCED_COLOR_INFO = 9,
  203. DISPLAYCONFIG_DEVICE_INFO_SET_ADVANCED_COLOR_STATE = 10,
  204. DISPLAYCONFIG_DEVICE_INFO_GET_SDR_WHITE_LEVEL = 11,
  205. DISPLAYCONFIG_DEVICE_INFO_FORCE_UINT32 = 0xFFFFFFFF
  206. } DISPLAYCONFIG_DEVICE_INFO_TYPE;
  207. typedef struct DISPLAYCONFIG_DEVICE_INFO_HEADER
  208. {
  209. DISPLAYCONFIG_DEVICE_INFO_TYPE type;
  210. UINT32 size;
  211. LUID adapterId;
  212. UINT32 id;
  213. } DISPLAYCONFIG_DEVICE_INFO_HEADER;
  214. typedef struct DISPLAYCONFIG_SOURCE_DEVICE_NAME
  215. {
  216. DISPLAYCONFIG_DEVICE_INFO_HEADER header;
  217. WCHAR viewGdiDeviceName[CCHDEVICENAME];
  218. } DISPLAYCONFIG_SOURCE_DEVICE_NAME;
  219. typedef struct DISPLAYCONFIG_TARGET_DEVICE_NAME_FLAGS
  220. {
  221. union
  222. {
  223. struct
  224. {
  225. UINT32 friendlyNameFromEdid : 1;
  226. UINT32 friendlyNameForced : 1;
  227. UINT32 edidIdsValid : 1;
  228. UINT32 reserved : 29;
  229. } DUMMYSTRUCTNAME;
  230. UINT32 value;
  231. } DUMMYUNIONNAME;
  232. } DISPLAYCONFIG_TARGET_DEVICE_NAME_FLAGS;
  233. typedef struct DISPLAYCONFIG_TARGET_DEVICE_NAME
  234. {
  235. DISPLAYCONFIG_DEVICE_INFO_HEADER header;
  236. DISPLAYCONFIG_TARGET_DEVICE_NAME_FLAGS flags;
  237. UINT32 /*DISPLAYCONFIG_VIDEO_OUTPUT_TECHNOLOGY*/ outputTechnology;
  238. UINT16 edidManufactureId;
  239. UINT16 edidProductCodeId;
  240. UINT32 connectorInstance;
  241. WCHAR monitorFriendlyDeviceName[64];
  242. WCHAR monitorDevicePath[128];
  243. } DISPLAYCONFIG_TARGET_DEVICE_NAME;
  244. #define QDC_ONLY_ACTIVE_PATHS 0x00000002
  245. #endif // WINVER < 0x0601
  246. #ifndef HAVE_SHELLSCALINGAPI_H
  247. typedef enum MONITOR_DPI_TYPE
  248. {
  249. MDT_EFFECTIVE_DPI = 0,
  250. MDT_ANGULAR_DPI = 1,
  251. MDT_RAW_DPI = 2,
  252. MDT_DEFAULT = MDT_EFFECTIVE_DPI
  253. } MONITOR_DPI_TYPE;
  254. typedef enum PROCESS_DPI_AWARENESS
  255. {
  256. PROCESS_DPI_UNAWARE = 0,
  257. PROCESS_SYSTEM_DPI_AWARE = 1,
  258. PROCESS_PER_MONITOR_DPI_AWARE = 2
  259. } PROCESS_DPI_AWARENESS;
  260. #else
  261. #include <shellscalingapi.h>
  262. #endif
  263. typedef struct ITaskbarList3 ITaskbarList3;
  264. #ifndef _DPI_AWARENESS_CONTEXTS_
  265. typedef enum DPI_AWARENESS
  266. {
  267. DPI_AWARENESS_INVALID = -1,
  268. DPI_AWARENESS_UNAWARE = 0,
  269. DPI_AWARENESS_SYSTEM_AWARE = 1,
  270. DPI_AWARENESS_PER_MONITOR_AWARE = 2
  271. } DPI_AWARENESS;
  272. DECLARE_HANDLE(DPI_AWARENESS_CONTEXT);
  273. #define DPI_AWARENESS_CONTEXT_UNAWARE ((DPI_AWARENESS_CONTEXT)-1)
  274. #define DPI_AWARENESS_CONTEXT_SYSTEM_AWARE ((DPI_AWARENESS_CONTEXT)-2)
  275. #define DPI_AWARENESS_CONTEXT_PER_MONITOR_AWARE ((DPI_AWARENESS_CONTEXT)-3)
  276. #endif // _DPI_AWARENESS_CONTEXTS_
  277. // Windows 10 Creators Update
  278. #if NTDDI_VERSION < 0x0A000003
  279. #define DPI_AWARENESS_CONTEXT_PER_MONITOR_AWARE_V2 ((DPI_AWARENESS_CONTEXT)-4)
  280. #endif // NTDDI_VERSION < 0x0A000003
  281. // Windows 10 version 1809
  282. #if NTDDI_VERSION < 0x0A000006
  283. #define DPI_AWARENESS_CONTEXT_UNAWARE_GDISCALED ((DPI_AWARENESS_CONTEXT)-5)
  284. #endif // NTDDI_VERSION < 0x0A000006
  285. typedef BOOL (*PFNSHFullScreen)(HWND, DWORD);
  286. typedef void (*PFCoordTransform)(SDL_Window *, POINT *);
  287. typedef struct
  288. {
  289. void **lpVtbl;
  290. int refcount;
  291. void *data;
  292. } TSFSink;
  293. #ifndef SDL_DISABLE_WINDOWS_IME
  294. // Definition from Win98DDK version of IMM.H
  295. typedef struct tagINPUTCONTEXT2
  296. {
  297. HWND hWnd;
  298. BOOL fOpen;
  299. POINT ptStatusWndPos;
  300. POINT ptSoftKbdPos;
  301. DWORD fdwConversion;
  302. DWORD fdwSentence;
  303. union
  304. {
  305. LOGFONTA A;
  306. LOGFONTW W;
  307. } lfFont;
  308. COMPOSITIONFORM cfCompForm;
  309. CANDIDATEFORM cfCandForm[4];
  310. HIMCC hCompStr;
  311. HIMCC hCandInfo;
  312. HIMCC hGuideLine;
  313. HIMCC hPrivate;
  314. DWORD dwNumMsgBuf;
  315. HIMCC hMsgBuf;
  316. DWORD fdwInit;
  317. DWORD dwReserve[3];
  318. } INPUTCONTEXT2, *PINPUTCONTEXT2, NEAR *NPINPUTCONTEXT2, FAR *LPINPUTCONTEXT2;
  319. #endif
  320. // Corner rounding support (Win 11+)
  321. #ifndef DWMWA_WINDOW_CORNER_PREFERENCE
  322. #define DWMWA_WINDOW_CORNER_PREFERENCE 33
  323. #endif
  324. typedef enum {
  325. DWMWCP_DEFAULT = 0,
  326. DWMWCP_DONOTROUND = 1,
  327. DWMWCP_ROUND = 2,
  328. DWMWCP_ROUNDSMALL = 3
  329. } DWM_WINDOW_CORNER_PREFERENCE;
  330. // Border Color support (Win 11+)
  331. #ifndef DWMWA_BORDER_COLOR
  332. #define DWMWA_BORDER_COLOR 34
  333. #endif
  334. #ifndef DWMWA_COLOR_DEFAULT
  335. #define DWMWA_COLOR_DEFAULT 0xFFFFFFFF
  336. #endif
  337. #ifndef DWMWA_COLOR_NONE
  338. #define DWMWA_COLOR_NONE 0xFFFFFFFE
  339. #endif
  340. // Transparent window support
  341. #ifndef DWM_BB_ENABLE
  342. #define DWM_BB_ENABLE 0x00000001
  343. #endif
  344. #ifndef DWM_BB_BLURREGION
  345. #define DWM_BB_BLURREGION 0x00000002
  346. #endif
  347. typedef struct
  348. {
  349. DWORD flags;
  350. BOOL enable;
  351. HRGN blur_region;
  352. BOOL transition_on_maxed;
  353. } DWM_BLURBEHIND;
  354. // Private display data
  355. struct SDL_VideoData
  356. {
  357. int render;
  358. bool coinitialized;
  359. #if !(defined(SDL_PLATFORM_XBOXONE) || defined(SDL_PLATFORM_XBOXSERIES))
  360. bool oleinitialized;
  361. #endif // !(defined(SDL_PLATFORM_XBOXONE) || defined(SDL_PLATFORM_XBOXSERIES))
  362. DWORD clipboard_count;
  363. #if !defined(SDL_PLATFORM_XBOXONE) && !defined(SDL_PLATFORM_XBOXSERIES) // Xbox doesn't support user32/shcore
  364. // Touch input functions
  365. SDL_SharedObject *userDLL;
  366. /* *INDENT-OFF* */ // clang-format off
  367. BOOL (WINAPI *CloseTouchInputHandle)( HTOUCHINPUT );
  368. BOOL (WINAPI *GetTouchInputInfo)( HTOUCHINPUT, UINT, PTOUCHINPUT, int );
  369. BOOL (WINAPI *RegisterTouchWindow)( HWND, ULONG );
  370. BOOL (WINAPI *SetProcessDPIAware)( void );
  371. BOOL (WINAPI *SetProcessDpiAwarenessContext)( DPI_AWARENESS_CONTEXT );
  372. DPI_AWARENESS_CONTEXT (WINAPI *SetThreadDpiAwarenessContext)( DPI_AWARENESS_CONTEXT );
  373. DPI_AWARENESS_CONTEXT (WINAPI *GetThreadDpiAwarenessContext)( void );
  374. DPI_AWARENESS (WINAPI *GetAwarenessFromDpiAwarenessContext)( DPI_AWARENESS_CONTEXT );
  375. BOOL (WINAPI *EnableNonClientDpiScaling)( HWND );
  376. BOOL (WINAPI *AdjustWindowRectExForDpi)( LPRECT, DWORD, BOOL, DWORD, UINT );
  377. UINT (WINAPI *GetDpiForWindow)( HWND );
  378. BOOL (WINAPI *AreDpiAwarenessContextsEqual)(DPI_AWARENESS_CONTEXT, DPI_AWARENESS_CONTEXT);
  379. BOOL (WINAPI *IsValidDpiAwarenessContext)(DPI_AWARENESS_CONTEXT);
  380. // DisplayConfig functions
  381. LONG (WINAPI *GetDisplayConfigBufferSizes)( UINT32, UINT32*, UINT32* );
  382. LONG (WINAPI *QueryDisplayConfig)( UINT32, UINT32*, DISPLAYCONFIG_PATH_INFO*, UINT32*, DISPLAYCONFIG_MODE_INFO*, DISPLAYCONFIG_TOPOLOGY_ID*);
  383. LONG (WINAPI *DisplayConfigGetDeviceInfo)( DISPLAYCONFIG_DEVICE_INFO_HEADER*);
  384. /* *INDENT-ON* */ // clang-format on
  385. SDL_SharedObject *shcoreDLL;
  386. /* *INDENT-OFF* */ // clang-format off
  387. HRESULT (WINAPI *GetDpiForMonitor)( HMONITOR hmonitor,
  388. MONITOR_DPI_TYPE dpiType,
  389. UINT *dpiX,
  390. UINT *dpiY );
  391. HRESULT (WINAPI *SetProcessDpiAwareness)(PROCESS_DPI_AWARENESS dpiAwareness);
  392. BOOL (WINAPI *GetPointerType)(UINT32 pointerId, POINTER_INPUT_TYPE *pointerType);
  393. BOOL (WINAPI *GetPointerPenInfo)(UINT32 pointerId, POINTER_PEN_INFO *penInfo);
  394. SDL_SharedObject *dwmapiDLL;
  395. /* *INDENT-OFF* */ // clang-format off
  396. HRESULT (WINAPI *DwmFlush)(void);
  397. HRESULT (WINAPI *DwmEnableBlurBehindWindow)(HWND hwnd, const DWM_BLURBEHIND *pBlurBehind);
  398. HRESULT (WINAPI *DwmSetWindowAttribute)(HWND hwnd, DWORD dwAttribute, LPCVOID pvAttribute, DWORD cbAttribute);
  399. /* *INDENT-ON* */ // clang-format on
  400. #endif // !defined(SDL_PLATFORM_XBOXONE) && !defined(SDL_PLATFORM_XBOXSERIES)
  401. #ifdef HAVE_DXGI_H
  402. SDL_SharedObject *dxgiDLL;
  403. IDXGIFactory *pDXGIFactory;
  404. #endif
  405. bool cleared;
  406. BYTE *rawinput;
  407. UINT rawinput_offset;
  408. UINT rawinput_size;
  409. UINT rawinput_count;
  410. Uint64 last_rawinput_poll;
  411. SDL_Point last_raw_mouse_position;
  412. bool raw_mouse_enabled;
  413. bool raw_keyboard_enabled;
  414. bool pending_E1_key_sequence;
  415. Uint32 raw_input_enabled;
  416. WIN_GameInputData *gameinput_context;
  417. #ifndef SDL_DISABLE_WINDOWS_IME
  418. bool ime_initialized;
  419. bool ime_enabled;
  420. bool ime_available;
  421. bool ime_internal_composition;
  422. bool ime_internal_candidates;
  423. HWND ime_hwnd_main;
  424. HWND ime_hwnd_current;
  425. bool ime_needs_clear_composition;
  426. HIMC ime_himc;
  427. WCHAR *ime_composition;
  428. int ime_composition_length;
  429. WCHAR ime_readingstring[16];
  430. int ime_cursor;
  431. int ime_selected_start;
  432. int ime_selected_length;
  433. bool ime_candidates_open;
  434. bool ime_update_candidates;
  435. char *ime_candidates[MAX_CANDLIST];
  436. int ime_candcount;
  437. DWORD ime_candref;
  438. DWORD ime_candsel;
  439. int ime_candlistindexbase;
  440. bool ime_horizontal_candidates;
  441. #endif
  442. #if !defined(SDL_PLATFORM_XBOXONE) && !defined(SDL_PLATFORM_XBOXSERIES)
  443. COMPOSITIONFORM ime_composition_area;
  444. CANDIDATEFORM ime_candidate_area;
  445. #endif // !defined(SDL_PLATFORM_XBOXONE) && !defined(SDL_PLATFORM_XBOXSERIES)
  446. #ifndef SDL_DISABLE_WINDOWS_IME
  447. HKL ime_hkl;
  448. SDL_SharedObject *ime_himm32;
  449. /* *INDENT-OFF* */ // clang-format off
  450. UINT (WINAPI *GetReadingString)(HIMC himc, UINT uReadingBufLen, LPWSTR lpwReadingBuf, PINT pnErrorIndex, BOOL *pfIsVertical, PUINT puMaxReadingLen);
  451. BOOL (WINAPI *ShowReadingWindow)(HIMC himc, BOOL bShow);
  452. LPINPUTCONTEXT2 (WINAPI *ImmLockIMC)(HIMC himc);
  453. BOOL (WINAPI *ImmUnlockIMC)(HIMC himc);
  454. LPVOID (WINAPI *ImmLockIMCC)(HIMCC himcc);
  455. BOOL (WINAPI *ImmUnlockIMCC)(HIMCC himcc);
  456. /* *INDENT-ON* */ // clang-format on
  457. #endif // !SDL_DISABLE_WINDOWS_IME
  458. BYTE pre_hook_key_state[256];
  459. UINT _SDL_WAKEUP;
  460. #ifdef HAVE_SHOBJIDL_CORE_H
  461. UINT WM_TASKBAR_BUTTON_CREATED;
  462. ITaskbarList3 *taskbar_list;
  463. #endif
  464. };
  465. extern bool g_WindowsEnableMessageLoop;
  466. extern bool g_WindowsEnableMenuMnemonics;
  467. extern bool g_WindowFrameUsableWhileCursorHidden;
  468. typedef struct IDirect3D9 IDirect3D9;
  469. extern bool D3D_LoadDLL(void **pD3DDLL, IDirect3D9 **pDirect3D9Interface);
  470. extern SDL_SystemTheme WIN_GetSystemTheme(void);
  471. extern bool WIN_IsPerMonitorV2DPIAware(SDL_VideoDevice *_this);
  472. #endif // SDL_windowsvideo_h_