display_server_windows.h 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576
  1. /*************************************************************************/
  2. /* display_server_windows.h */
  3. /*************************************************************************/
  4. /* This file is part of: */
  5. /* GODOT ENGINE */
  6. /* https://godotengine.org */
  7. /*************************************************************************/
  8. /* Copyright (c) 2007-2021 Juan Linietsky, Ariel Manzur. */
  9. /* Copyright (c) 2014-2021 Godot Engine contributors (cf. AUTHORS.md). */
  10. /* */
  11. /* Permission is hereby granted, free of charge, to any person obtaining */
  12. /* a copy of this software and associated documentation files (the */
  13. /* "Software"), to deal in the Software without restriction, including */
  14. /* without limitation the rights to use, copy, modify, merge, publish, */
  15. /* distribute, sublicense, and/or sell copies of the Software, and to */
  16. /* permit persons to whom the Software is furnished to do so, subject to */
  17. /* the following conditions: */
  18. /* */
  19. /* The above copyright notice and this permission notice shall be */
  20. /* included in all copies or substantial portions of the Software. */
  21. /* */
  22. /* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
  23. /* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
  24. /* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
  25. /* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
  26. /* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
  27. /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
  28. /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
  29. /*************************************************************************/
  30. #ifndef DISPLAY_SERVER_WINDOWS_H
  31. #define DISPLAY_SERVER_WINDOWS_H
  32. #include "servers/display_server.h"
  33. #include "core/config/project_settings.h"
  34. #include "core/input/input.h"
  35. #include "core/os/os.h"
  36. #include "crash_handler_windows.h"
  37. #include "drivers/unix/ip_unix.h"
  38. #include "drivers/wasapi/audio_driver_wasapi.h"
  39. #include "drivers/winmidi/midi_driver_winmidi.h"
  40. #include "joypad_windows.h"
  41. #include "key_mapping_windows.h"
  42. #include "servers/audio_server.h"
  43. #include "servers/rendering/renderer_compositor.h"
  44. #include "servers/rendering/renderer_rd/renderer_compositor_rd.h"
  45. #include "servers/rendering_server.h"
  46. #ifdef XAUDIO2_ENABLED
  47. #include "drivers/xaudio2/audio_driver_xaudio2.h"
  48. #endif
  49. #if defined(VULKAN_ENABLED)
  50. #include "drivers/vulkan/rendering_device_vulkan.h"
  51. #include "platform/windows/vulkan_context_win.h"
  52. #endif
  53. #if defined(GLES3_ENABLED)
  54. #include "gl_manager_windows.h"
  55. #endif
  56. #include <fcntl.h>
  57. #include <io.h>
  58. #include <stdio.h>
  59. #define WIN32_LEAN_AND_MEAN
  60. #include <windows.h>
  61. #include <windowsx.h>
  62. // WinTab API
  63. #define WT_PACKET 0x7FF0
  64. #define WT_PROXIMITY 0x7FF5
  65. #define WT_INFOCHANGE 0x7FF6
  66. #define WT_CSRCHANGE 0x7FF7
  67. #define WTI_DEFSYSCTX 4
  68. #define WTI_DEVICES 100
  69. #define DVC_NPRESSURE 15
  70. #define DVC_TPRESSURE 16
  71. #define DVC_ORIENTATION 17
  72. #define DVC_ROTATION 18
  73. #define CXO_MESSAGES 0x0004
  74. #define PK_NORMAL_PRESSURE 0x0400
  75. #define PK_TANGENT_PRESSURE 0x0800
  76. #define PK_ORIENTATION 0x1000
  77. typedef struct tagLOGCONTEXTW {
  78. WCHAR lcName[40];
  79. UINT lcOptions;
  80. UINT lcStatus;
  81. UINT lcLocks;
  82. UINT lcMsgBase;
  83. UINT lcDevice;
  84. UINT lcPktRate;
  85. DWORD lcPktData;
  86. DWORD lcPktMode;
  87. DWORD lcMoveMask;
  88. DWORD lcBtnDnMask;
  89. DWORD lcBtnUpMask;
  90. LONG lcInOrgX;
  91. LONG lcInOrgY;
  92. LONG lcInOrgZ;
  93. LONG lcInExtX;
  94. LONG lcInExtY;
  95. LONG lcInExtZ;
  96. LONG lcOutOrgX;
  97. LONG lcOutOrgY;
  98. LONG lcOutOrgZ;
  99. LONG lcOutExtX;
  100. LONG lcOutExtY;
  101. LONG lcOutExtZ;
  102. DWORD lcSensX;
  103. DWORD lcSensY;
  104. DWORD lcSensZ;
  105. BOOL lcSysMode;
  106. int lcSysOrgX;
  107. int lcSysOrgY;
  108. int lcSysExtX;
  109. int lcSysExtY;
  110. DWORD lcSysSensX;
  111. DWORD lcSysSensY;
  112. } LOGCONTEXTW;
  113. typedef struct tagAXIS {
  114. LONG axMin;
  115. LONG axMax;
  116. UINT axUnits;
  117. DWORD axResolution;
  118. } AXIS;
  119. typedef struct tagORIENTATION {
  120. int orAzimuth;
  121. int orAltitude;
  122. int orTwist;
  123. } ORIENTATION;
  124. typedef struct tagPACKET {
  125. int pkNormalPressure;
  126. int pkTangentPressure;
  127. ORIENTATION pkOrientation;
  128. } PACKET;
  129. typedef HANDLE(WINAPI *WTOpenPtr)(HWND p_window, LOGCONTEXTW *p_ctx, BOOL p_enable);
  130. typedef BOOL(WINAPI *WTClosePtr)(HANDLE p_ctx);
  131. typedef UINT(WINAPI *WTInfoPtr)(UINT p_category, UINT p_index, LPVOID p_output);
  132. typedef BOOL(WINAPI *WTPacketPtr)(HANDLE p_ctx, UINT p_param, LPVOID p_packets);
  133. typedef BOOL(WINAPI *WTEnablePtr)(HANDLE p_ctx, BOOL p_enable);
  134. // Windows Ink API
  135. #ifndef POINTER_STRUCTURES
  136. #define POINTER_STRUCTURES
  137. typedef DWORD POINTER_INPUT_TYPE;
  138. typedef UINT32 POINTER_FLAGS;
  139. typedef UINT32 PEN_FLAGS;
  140. typedef UINT32 PEN_MASK;
  141. #ifndef PEN_MASK_PRESSURE
  142. #define PEN_MASK_PRESSURE 0x00000001
  143. #endif
  144. #ifndef PEN_MASK_TILT_X
  145. #define PEN_MASK_TILT_X 0x00000004
  146. #endif
  147. #ifndef PEN_MASK_TILT_Y
  148. #define PEN_MASK_TILT_Y 0x00000008
  149. #endif
  150. #ifndef POINTER_MESSAGE_FLAG_FIRSTBUTTON
  151. #define POINTER_MESSAGE_FLAG_FIRSTBUTTON 0x00000010
  152. #endif
  153. enum tagPOINTER_INPUT_TYPE {
  154. PT_POINTER = 0x00000001,
  155. PT_TOUCH = 0x00000002,
  156. PT_PEN = 0x00000003,
  157. PT_MOUSE = 0x00000004,
  158. PT_TOUCHPAD = 0x00000005
  159. };
  160. typedef enum tagPOINTER_BUTTON_CHANGE_TYPE {
  161. POINTER_CHANGE_NONE,
  162. POINTER_CHANGE_FIRSTBUTTON_DOWN,
  163. POINTER_CHANGE_FIRSTBUTTON_UP,
  164. POINTER_CHANGE_SECONDBUTTON_DOWN,
  165. POINTER_CHANGE_SECONDBUTTON_UP,
  166. POINTER_CHANGE_THIRDBUTTON_DOWN,
  167. POINTER_CHANGE_THIRDBUTTON_UP,
  168. POINTER_CHANGE_FOURTHBUTTON_DOWN,
  169. POINTER_CHANGE_FOURTHBUTTON_UP,
  170. POINTER_CHANGE_FIFTHBUTTON_DOWN,
  171. POINTER_CHANGE_FIFTHBUTTON_UP,
  172. } POINTER_BUTTON_CHANGE_TYPE;
  173. typedef struct tagPOINTER_INFO {
  174. POINTER_INPUT_TYPE pointerType;
  175. UINT32 pointerId;
  176. UINT32 frameId;
  177. POINTER_FLAGS pointerFlags;
  178. HANDLE sourceDevice;
  179. HWND hwndTarget;
  180. POINT ptPixelLocation;
  181. POINT ptHimetricLocation;
  182. POINT ptPixelLocationRaw;
  183. POINT ptHimetricLocationRaw;
  184. DWORD dwTime;
  185. UINT32 historyCount;
  186. INT32 InputData;
  187. DWORD dwKeyStates;
  188. UINT64 PerformanceCount;
  189. POINTER_BUTTON_CHANGE_TYPE ButtonChangeType;
  190. } POINTER_INFO;
  191. typedef struct tagPOINTER_PEN_INFO {
  192. POINTER_INFO pointerInfo;
  193. PEN_FLAGS penFlags;
  194. PEN_MASK penMask;
  195. UINT32 pressure;
  196. UINT32 rotation;
  197. INT32 tiltX;
  198. INT32 tiltY;
  199. } POINTER_PEN_INFO;
  200. #endif //POINTER_STRUCTURES
  201. #ifndef WM_POINTERUPDATE
  202. #define WM_POINTERUPDATE 0x0245
  203. #endif
  204. #ifndef WM_POINTERENTER
  205. #define WM_POINTERENTER 0x0249
  206. #endif
  207. #ifndef WM_POINTERLEAVE
  208. #define WM_POINTERLEAVE 0x024A
  209. #endif
  210. typedef BOOL(WINAPI *GetPointerTypePtr)(uint32_t p_id, POINTER_INPUT_TYPE *p_type);
  211. typedef BOOL(WINAPI *GetPointerPenInfoPtr)(uint32_t p_id, POINTER_PEN_INFO *p_pen_info);
  212. typedef struct {
  213. BYTE bWidth; // Width, in pixels, of the image
  214. BYTE bHeight; // Height, in pixels, of the image
  215. BYTE bColorCount; // Number of colors in image (0 if >=8bpp)
  216. BYTE bReserved; // Reserved ( must be 0)
  217. WORD wPlanes; // Color Planes
  218. WORD wBitCount; // Bits per pixel
  219. DWORD dwBytesInRes; // How many bytes in this resource?
  220. DWORD dwImageOffset; // Where in the file is this image?
  221. } ICONDIRENTRY, *LPICONDIRENTRY;
  222. typedef struct {
  223. WORD idReserved; // Reserved (must be 0)
  224. WORD idType; // Resource Type (1 for icons)
  225. WORD idCount; // How many images?
  226. ICONDIRENTRY idEntries[1]; // An entry for each image (idCount of 'em)
  227. } ICONDIR, *LPICONDIR;
  228. class DisplayServerWindows : public DisplayServer {
  229. //No need to register, it's platform-specific and nothing is added
  230. //GDCLASS(DisplayServerWindows, DisplayServer)
  231. _THREAD_SAFE_CLASS_
  232. // WinTab API
  233. static bool wintab_available;
  234. static WTOpenPtr wintab_WTOpen;
  235. static WTClosePtr wintab_WTClose;
  236. static WTInfoPtr wintab_WTInfo;
  237. static WTPacketPtr wintab_WTPacket;
  238. static WTEnablePtr wintab_WTEnable;
  239. // Windows Ink API
  240. static bool winink_available;
  241. static GetPointerTypePtr win8p_GetPointerType;
  242. static GetPointerPenInfoPtr win8p_GetPointerPenInfo;
  243. void _update_tablet_ctx(const String &p_old_driver, const String &p_new_driver);
  244. String tablet_driver;
  245. Vector<String> tablet_drivers;
  246. void GetMaskBitmaps(HBITMAP hSourceBitmap, COLORREF clrTransparent, OUT HBITMAP &hAndMaskBitmap, OUT HBITMAP &hXorMaskBitmap);
  247. enum {
  248. KEY_EVENT_BUFFER_SIZE = 512
  249. };
  250. struct KeyEvent {
  251. WindowID window_id;
  252. bool alt, shift, control, meta;
  253. UINT uMsg;
  254. WPARAM wParam;
  255. LPARAM lParam;
  256. };
  257. KeyEvent key_event_buffer[KEY_EVENT_BUFFER_SIZE];
  258. int key_event_pos;
  259. bool old_invalid;
  260. bool outside;
  261. int old_x, old_y;
  262. Point2i center;
  263. #if defined(GLES3_ENABLED)
  264. GLManager_Windows *gl_manager;
  265. #endif
  266. #if defined(VULKAN_ENABLED)
  267. VulkanContextWindows *context_vulkan;
  268. RenderingDeviceVulkan *rendering_device_vulkan;
  269. #endif
  270. Map<int, Vector2> touch_state;
  271. int pressrc;
  272. HINSTANCE hInstance; // Holds The Instance Of The Application
  273. String rendering_driver;
  274. bool app_focused = false;
  275. struct WindowData {
  276. HWND hWnd;
  277. //layered window
  278. Vector<Vector2> mpath;
  279. bool preserve_window_size = false;
  280. bool pre_fs_valid = false;
  281. RECT pre_fs_rect;
  282. bool maximized = false;
  283. bool minimized = false;
  284. bool fullscreen = false;
  285. bool borderless = false;
  286. bool resizable = true;
  287. bool window_focused = false;
  288. bool was_maximized = false;
  289. bool always_on_top = false;
  290. bool no_focus = false;
  291. bool window_has_focus = false;
  292. // Used to transfer data between events using timer.
  293. WPARAM saved_wparam;
  294. LPARAM saved_lparam;
  295. // Timers.
  296. uint32_t move_timer_id = 0U;
  297. uint32_t focus_timer_id = 0U;
  298. HANDLE wtctx;
  299. LOGCONTEXTW wtlc;
  300. int min_pressure;
  301. int max_pressure;
  302. bool tilt_supported;
  303. bool block_mm = false;
  304. int last_pressure_update;
  305. float last_pressure;
  306. Vector2 last_tilt;
  307. HBITMAP hBitmap; //DIB section for layered window
  308. uint8_t *dib_data = nullptr;
  309. Size2 dib_size;
  310. HDC hDC_dib;
  311. Size2 min_size;
  312. Size2 max_size;
  313. int width = 0, height = 0;
  314. Size2 window_rect;
  315. Point2 last_pos;
  316. ObjectID instance_id;
  317. // IME
  318. HIMC im_himc;
  319. Vector2 im_position;
  320. bool layered_window = false;
  321. Callable rect_changed_callback;
  322. Callable event_callback;
  323. Callable input_event_callback;
  324. Callable input_text_callback;
  325. Callable drop_files_callback;
  326. WindowID transient_parent = INVALID_WINDOW_ID;
  327. Set<WindowID> transient_children;
  328. };
  329. JoypadWindows *joypad;
  330. WindowID _create_window(WindowMode p_mode, VSyncMode p_vsync_mode, uint32_t p_flags, const Rect2i &p_rect);
  331. WindowID window_id_counter = MAIN_WINDOW_ID;
  332. Map<WindowID, WindowData> windows;
  333. WindowID last_focused_window = INVALID_WINDOW_ID;
  334. HCURSOR hCursor;
  335. WNDPROC user_proc = nullptr;
  336. void _send_window_event(const WindowData &wd, WindowEvent p_event);
  337. void _get_window_style(bool p_main_window, bool p_fullscreen, bool p_borderless, bool p_resizable, bool p_maximized, bool p_no_activate_focus, DWORD &r_style, DWORD &r_style_ex);
  338. MouseMode mouse_mode;
  339. int restore_mouse_trails = 0;
  340. bool alt_mem = false;
  341. bool gr_mem = false;
  342. bool shift_mem = false;
  343. bool control_mem = false;
  344. bool meta_mem = false;
  345. MouseButton last_button_state = MOUSE_BUTTON_NONE;
  346. bool use_raw_input = false;
  347. bool drop_events = false;
  348. bool in_dispatch_input_event = false;
  349. bool console_visible = false;
  350. WNDCLASSEXW wc;
  351. HCURSOR cursors[CURSOR_MAX] = { nullptr };
  352. CursorShape cursor_shape = CursorShape::CURSOR_ARROW;
  353. Map<CursorShape, Vector<Variant>> cursors_cache;
  354. void _drag_event(WindowID p_window, float p_x, float p_y, int idx);
  355. void _touch_event(WindowID p_window, bool p_pressed, float p_x, float p_y, int idx);
  356. void _update_window_style(WindowID p_window, bool p_repaint = true);
  357. void _update_window_mouse_passthrough(WindowID p_window);
  358. void _update_real_mouse_position(WindowID p_window);
  359. void _set_mouse_mode_impl(MouseMode p_mode);
  360. void _process_activate_event(WindowID p_window_id, WPARAM wParam, LPARAM lParam);
  361. void _process_key_events();
  362. static void _dispatch_input_events(const Ref<InputEvent> &p_event);
  363. void _dispatch_input_event(const Ref<InputEvent> &p_event);
  364. public:
  365. LRESULT WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
  366. virtual bool has_feature(Feature p_feature) const override;
  367. virtual String get_name() const override;
  368. virtual void mouse_set_mode(MouseMode p_mode) override;
  369. virtual MouseMode mouse_get_mode() const override;
  370. virtual void mouse_warp_to_position(const Point2i &p_to) override;
  371. virtual Point2i mouse_get_position() const override;
  372. virtual MouseButton mouse_get_button_state() const override;
  373. virtual void clipboard_set(const String &p_text) override;
  374. virtual String clipboard_get() const override;
  375. virtual int get_screen_count() const override;
  376. virtual Point2i screen_get_position(int p_screen = SCREEN_OF_MAIN_WINDOW) const override;
  377. virtual Size2i screen_get_size(int p_screen = SCREEN_OF_MAIN_WINDOW) const override;
  378. virtual Rect2i screen_get_usable_rect(int p_screen = SCREEN_OF_MAIN_WINDOW) const override;
  379. virtual int screen_get_dpi(int p_screen = SCREEN_OF_MAIN_WINDOW) const override;
  380. virtual bool screen_is_touchscreen(int p_screen = SCREEN_OF_MAIN_WINDOW) const override;
  381. virtual void screen_set_orientation(ScreenOrientation p_orientation, int p_screen = SCREEN_OF_MAIN_WINDOW) override;
  382. virtual ScreenOrientation screen_get_orientation(int p_screen = SCREEN_OF_MAIN_WINDOW) const override;
  383. virtual void screen_set_keep_on(bool p_enable) override; //disable screensaver
  384. virtual bool screen_is_kept_on() const override;
  385. virtual Vector<DisplayServer::WindowID> get_window_list() const override;
  386. virtual WindowID create_sub_window(WindowMode p_mode, VSyncMode p_vsync_mode, uint32_t p_flags, const Rect2i &p_rect = Rect2i()) override;
  387. virtual void show_window(WindowID p_window) override;
  388. virtual void delete_sub_window(WindowID p_window) override;
  389. virtual WindowID get_window_at_screen_position(const Point2i &p_position) const override;
  390. virtual void window_attach_instance_id(ObjectID p_instance, WindowID p_window = MAIN_WINDOW_ID) override;
  391. virtual ObjectID window_get_attached_instance_id(WindowID p_window = MAIN_WINDOW_ID) const override;
  392. virtual void gl_window_make_current(DisplayServer::WindowID p_window_id);
  393. virtual void window_set_rect_changed_callback(const Callable &p_callable, WindowID p_window = MAIN_WINDOW_ID) override;
  394. virtual void window_set_window_event_callback(const Callable &p_callable, WindowID p_window = MAIN_WINDOW_ID) override;
  395. virtual void window_set_input_event_callback(const Callable &p_callable, WindowID p_window = MAIN_WINDOW_ID) override;
  396. virtual void window_set_input_text_callback(const Callable &p_callable, WindowID p_window = MAIN_WINDOW_ID) override;
  397. virtual void window_set_drop_files_callback(const Callable &p_callable, WindowID p_window = MAIN_WINDOW_ID) override;
  398. virtual void window_set_title(const String &p_title, WindowID p_window = MAIN_WINDOW_ID) override;
  399. virtual void window_set_mouse_passthrough(const Vector<Vector2> &p_region, WindowID p_window = MAIN_WINDOW_ID) override;
  400. virtual int window_get_current_screen(WindowID p_window = MAIN_WINDOW_ID) const override;
  401. virtual void window_set_current_screen(int p_screen, WindowID p_window = MAIN_WINDOW_ID) override;
  402. virtual Point2i window_get_position(WindowID p_window = MAIN_WINDOW_ID) const override;
  403. virtual void window_set_position(const Point2i &p_position, WindowID p_window = MAIN_WINDOW_ID) override;
  404. virtual void window_set_transient(WindowID p_window, WindowID p_parent) override;
  405. virtual void window_set_max_size(const Size2i p_size, WindowID p_window = MAIN_WINDOW_ID) override;
  406. virtual Size2i window_get_max_size(WindowID p_window = MAIN_WINDOW_ID) const override;
  407. virtual void window_set_min_size(const Size2i p_size, WindowID p_window = MAIN_WINDOW_ID) override;
  408. virtual Size2i window_get_min_size(WindowID p_window = MAIN_WINDOW_ID) const override;
  409. virtual void window_set_size(const Size2i p_size, WindowID p_window = MAIN_WINDOW_ID) override;
  410. virtual Size2i window_get_size(WindowID p_window = MAIN_WINDOW_ID) const override;
  411. virtual Size2i window_get_real_size(WindowID p_window = MAIN_WINDOW_ID) const override; //wtf is this? should probable use proper name
  412. virtual void window_set_mode(WindowMode p_mode, WindowID p_window = MAIN_WINDOW_ID) override;
  413. virtual WindowMode window_get_mode(WindowID p_window = MAIN_WINDOW_ID) const override;
  414. virtual bool window_is_maximize_allowed(WindowID p_window = MAIN_WINDOW_ID) const override;
  415. virtual void window_set_flag(WindowFlags p_flag, bool p_enabled, WindowID p_window = MAIN_WINDOW_ID) override;
  416. virtual bool window_get_flag(WindowFlags p_flag, WindowID p_window = MAIN_WINDOW_ID) const override;
  417. virtual void window_request_attention(WindowID p_window = MAIN_WINDOW_ID) override;
  418. virtual void window_move_to_foreground(WindowID p_window = MAIN_WINDOW_ID) override;
  419. virtual bool window_can_draw(WindowID p_window = MAIN_WINDOW_ID) const override;
  420. virtual bool can_any_window_draw() const override;
  421. virtual void window_set_ime_active(const bool p_active, WindowID p_window = MAIN_WINDOW_ID) override;
  422. virtual void window_set_ime_position(const Point2i &p_pos, WindowID p_window = MAIN_WINDOW_ID) override;
  423. virtual void window_set_vsync_mode(DisplayServer::VSyncMode p_vsync_mode, WindowID p_window = MAIN_WINDOW_ID) override;
  424. virtual DisplayServer::VSyncMode window_get_vsync_mode(WindowID p_vsync_mode) const override;
  425. virtual void console_set_visible(bool p_enabled) override;
  426. virtual bool is_console_visible() const override;
  427. virtual void cursor_set_shape(CursorShape p_shape) override;
  428. virtual CursorShape cursor_get_shape() const override;
  429. virtual void cursor_set_custom_image(const RES &p_cursor, CursorShape p_shape = CURSOR_ARROW, const Vector2 &p_hotspot = Vector2()) override;
  430. virtual bool get_swap_cancel_ok() override;
  431. virtual void enable_for_stealing_focus(OS::ProcessID pid) override;
  432. virtual int keyboard_get_layout_count() const override;
  433. virtual int keyboard_get_current_layout() const override;
  434. virtual void keyboard_set_current_layout(int p_index) override;
  435. virtual String keyboard_get_layout_language(int p_index) const override;
  436. virtual String keyboard_get_layout_name(int p_index) const override;
  437. virtual Key keyboard_get_keycode_from_physical(Key p_keycode) const override;
  438. virtual int tablet_get_driver_count() const override;
  439. virtual String tablet_get_driver_name(int p_driver) const override;
  440. virtual String tablet_get_current_driver() const override;
  441. virtual void tablet_set_current_driver(const String &p_driver) override;
  442. virtual void process_events() override;
  443. virtual void force_process_and_drop_events() override;
  444. virtual void release_rendering_thread() override;
  445. virtual void make_rendering_thread() override;
  446. virtual void swap_buffers() override;
  447. virtual void set_native_icon(const String &p_filename) override;
  448. virtual void set_icon(const Ref<Image> &p_icon) override;
  449. virtual void set_context(Context p_context) override;
  450. static DisplayServer *create_func(const String &p_rendering_driver, WindowMode p_mode, VSyncMode p_vsync_mode, uint32_t p_flags, const Vector2i &p_resolution, Error &r_error);
  451. static Vector<String> get_rendering_drivers_func();
  452. static void register_windows_driver();
  453. DisplayServerWindows(const String &p_rendering_driver, WindowMode p_mode, VSyncMode p_vsync_mode, uint32_t p_flags, const Vector2i &p_resolution, Error &r_error);
  454. ~DisplayServerWindows();
  455. };
  456. #endif // DISPLAY_SERVER_WINDOWS_H