display_server_x11.h 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551
  1. /**************************************************************************/
  2. /* display_server_x11.h */
  3. /**************************************************************************/
  4. /* This file is part of: */
  5. /* GODOT ENGINE */
  6. /* https://godotengine.org */
  7. /**************************************************************************/
  8. /* Copyright (c) 2014-present Godot Engine contributors (see AUTHORS.md). */
  9. /* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
  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_X11_H
  31. #define DISPLAY_SERVER_X11_H
  32. #ifdef X11_ENABLED
  33. #include "joypad_linux.h"
  34. #include "core/input/input.h"
  35. #include "core/os/mutex.h"
  36. #include "core/os/thread.h"
  37. #include "core/templates/local_vector.h"
  38. #include "drivers/alsa/audio_driver_alsa.h"
  39. #include "drivers/alsamidi/midi_driver_alsamidi.h"
  40. #include "drivers/pulseaudio/audio_driver_pulseaudio.h"
  41. #include "drivers/unix/os_unix.h"
  42. #include "servers/audio_server.h"
  43. #include "servers/display_server.h"
  44. #include "servers/rendering/renderer_compositor.h"
  45. #include "servers/rendering_server.h"
  46. #if defined(SPEECHD_ENABLED)
  47. #include "tts_linux.h"
  48. #endif
  49. #if defined(GLES3_ENABLED)
  50. #include "x11/gl_manager_x11.h"
  51. #include "x11/gl_manager_x11_egl.h"
  52. #endif
  53. #if defined(RD_ENABLED)
  54. #include "servers/rendering/rendering_device.h"
  55. #if defined(VULKAN_ENABLED)
  56. #include "x11/rendering_context_driver_vulkan_x11.h"
  57. #endif
  58. #endif
  59. #if defined(DBUS_ENABLED)
  60. #include "freedesktop_portal_desktop.h"
  61. #include "freedesktop_screensaver.h"
  62. #endif
  63. #include <X11/Xatom.h>
  64. #include <X11/Xlib.h>
  65. #include <X11/Xutil.h>
  66. #include <X11/keysym.h>
  67. #ifdef SOWRAP_ENABLED
  68. #include "x11/dynwrappers/xlib-so_wrap.h"
  69. #include "x11/dynwrappers/xcursor-so_wrap.h"
  70. #include "x11/dynwrappers/xext-so_wrap.h"
  71. #include "x11/dynwrappers/xinerama-so_wrap.h"
  72. #include "x11/dynwrappers/xinput2-so_wrap.h"
  73. #include "x11/dynwrappers/xrandr-so_wrap.h"
  74. #include "x11/dynwrappers/xrender-so_wrap.h"
  75. #include "xkbcommon-so_wrap.h"
  76. #else
  77. #include <X11/XKBlib.h>
  78. #include <X11/Xlib.h>
  79. #include <X11/Xutil.h>
  80. #include <X11/Xcursor/Xcursor.h>
  81. #include <X11/extensions/XInput2.h>
  82. #include <X11/extensions/Xext.h>
  83. #include <X11/extensions/Xinerama.h>
  84. #include <X11/extensions/Xrandr.h>
  85. #include <X11/extensions/Xrender.h>
  86. #include <X11/extensions/shape.h>
  87. #ifdef XKB_ENABLED
  88. #include <xkbcommon/xkbcommon-compose.h>
  89. #include <xkbcommon/xkbcommon-keysyms.h>
  90. #include <xkbcommon/xkbcommon.h>
  91. #endif
  92. #endif
  93. typedef struct _xrr_monitor_info {
  94. Atom name;
  95. Bool primary = false;
  96. Bool automatic = false;
  97. int noutput = 0;
  98. int x = 0;
  99. int y = 0;
  100. int width = 0;
  101. int height = 0;
  102. int mwidth = 0;
  103. int mheight = 0;
  104. RROutput *outputs = nullptr;
  105. } xrr_monitor_info;
  106. #undef CursorShape
  107. class DisplayServerX11 : public DisplayServer {
  108. // No need to register with GDCLASS, it's platform-specific and nothing is added.
  109. _THREAD_SAFE_CLASS_
  110. Atom wm_delete;
  111. Atom xdnd_enter;
  112. Atom xdnd_position;
  113. Atom xdnd_status;
  114. Atom xdnd_action_copy;
  115. Atom xdnd_drop;
  116. Atom xdnd_finished;
  117. Atom xdnd_selection;
  118. Atom xdnd_aware;
  119. Atom requested = None;
  120. int xdnd_version = 5;
  121. #if defined(GLES3_ENABLED)
  122. GLManager_X11 *gl_manager = nullptr;
  123. GLManagerEGL_X11 *gl_manager_egl = nullptr;
  124. #endif
  125. #if defined(RD_ENABLED)
  126. RenderingContextDriver *rendering_context = nullptr;
  127. RenderingDevice *rendering_device = nullptr;
  128. #endif
  129. #if defined(DBUS_ENABLED)
  130. FreeDesktopScreenSaver *screensaver = nullptr;
  131. bool keep_screen_on = false;
  132. #endif
  133. #ifdef SPEECHD_ENABLED
  134. TTS_Linux *tts = nullptr;
  135. #endif
  136. NativeMenu *native_menu = nullptr;
  137. #if defined(DBUS_ENABLED)
  138. FreeDesktopPortalDesktop *portal_desktop = nullptr;
  139. #endif
  140. struct WindowData {
  141. Window x11_window;
  142. Window x11_xim_window;
  143. Window parent;
  144. ::XIC xic;
  145. bool ime_active = false;
  146. bool ime_in_progress = false;
  147. bool ime_suppress_next_keyup = false;
  148. #ifdef XKB_ENABLED
  149. xkb_compose_state *xkb_state = nullptr;
  150. #endif
  151. Size2i min_size;
  152. Size2i max_size;
  153. Point2i position;
  154. Size2i size;
  155. Callable rect_changed_callback;
  156. Callable event_callback;
  157. Callable input_event_callback;
  158. Callable input_text_callback;
  159. Callable drop_files_callback;
  160. Vector<Vector2> mpath;
  161. WindowID transient_parent = INVALID_WINDOW_ID;
  162. HashSet<WindowID> transient_children;
  163. ObjectID instance_id;
  164. bool no_focus = false;
  165. //better to guess on the fly, given WM can change it
  166. //WindowMode mode;
  167. bool fullscreen = false; //OS can't exit from this mode
  168. bool exclusive_fullscreen = false;
  169. bool on_top = false;
  170. bool borderless = false;
  171. bool resize_disabled = false;
  172. Vector2i last_position_before_fs;
  173. bool focused = true;
  174. bool minimized = false;
  175. bool maximized = false;
  176. bool is_popup = false;
  177. bool layered_window = false;
  178. bool mpass = false;
  179. Rect2i parent_safe_rect;
  180. unsigned int focus_order = 0;
  181. };
  182. Point2i im_selection;
  183. String im_text;
  184. #ifdef XKB_ENABLED
  185. bool xkb_loaded_v05p = false;
  186. bool xkb_loaded_v08p = false;
  187. xkb_context *xkb_ctx = nullptr;
  188. xkb_compose_table *dead_tbl = nullptr;
  189. #endif
  190. HashMap<WindowID, WindowData> windows;
  191. unsigned int last_mouse_monitor_mask = 0;
  192. uint64_t time_since_popup = 0;
  193. List<WindowID> popup_list;
  194. WindowID window_mouseover_id = INVALID_WINDOW_ID;
  195. WindowID last_focused_window = INVALID_WINDOW_ID;
  196. WindowID window_id_counter = MAIN_WINDOW_ID;
  197. WindowID _create_window(WindowMode p_mode, VSyncMode p_vsync_mode, uint32_t p_flags, const Rect2i &p_rect);
  198. String internal_clipboard;
  199. String internal_clipboard_primary;
  200. Window xdnd_source_window = 0;
  201. ::Display *x11_display;
  202. char *xmbstring = nullptr;
  203. int xmblen = 0;
  204. unsigned long last_timestamp = 0;
  205. ::Time last_keyrelease_time = 0;
  206. ::XIM xim;
  207. ::XIMStyle xim_style;
  208. static int _xim_preedit_start_callback(::XIM xim, ::XPointer client_data,
  209. ::XPointer call_data);
  210. static void _xim_preedit_done_callback(::XIM xim, ::XPointer client_data,
  211. ::XPointer call_data);
  212. static void _xim_preedit_draw_callback(::XIM xim, ::XPointer client_data,
  213. ::XIMPreeditDrawCallbackStruct *call_data);
  214. static void _xim_preedit_caret_callback(::XIM xim, ::XPointer client_data,
  215. ::XIMPreeditCaretCallbackStruct *call_data);
  216. static void _xim_destroy_callback(::XIM im, ::XPointer client_data,
  217. ::XPointer call_data);
  218. Point2i last_mouse_pos;
  219. bool last_mouse_pos_valid = false;
  220. Point2i last_click_pos = Point2i(-100, -100);
  221. uint64_t last_click_ms = 0;
  222. MouseButton last_click_button_index = MouseButton::NONE;
  223. bool app_focused = false;
  224. uint64_t time_since_no_focus = 0;
  225. struct {
  226. int opcode;
  227. Vector<int> touch_devices;
  228. HashMap<int, Vector2> absolute_devices;
  229. HashMap<int, Vector2> pen_pressure_range;
  230. HashMap<int, Vector2> pen_tilt_x_range;
  231. HashMap<int, Vector2> pen_tilt_y_range;
  232. HashMap<int, bool> pen_inverted_devices;
  233. XIEventMask all_event_mask;
  234. HashMap<int, Vector2> state;
  235. double pressure;
  236. bool pressure_supported;
  237. bool pen_inverted;
  238. Vector2 tilt;
  239. Vector2 mouse_pos_to_filter;
  240. Vector2 relative_motion;
  241. Vector2 raw_pos;
  242. Vector2 old_raw_pos;
  243. ::Time last_relative_time;
  244. } xi;
  245. bool _refresh_device_info();
  246. Rect2i _screen_get_rect(int p_screen) const;
  247. void _get_key_modifier_state(unsigned int p_x11_state, Ref<InputEventWithModifiers> state);
  248. void _flush_mouse_motion();
  249. MouseMode mouse_mode = MOUSE_MODE_VISIBLE;
  250. Point2i center;
  251. void _handle_key_event(WindowID p_window, XKeyEvent *p_event, LocalVector<XEvent> &p_events, uint32_t &p_event_index, bool p_echo = false);
  252. Atom _process_selection_request_target(Atom p_target, Window p_requestor, Atom p_property, Atom p_selection) const;
  253. void _handle_selection_request_event(XSelectionRequestEvent *p_event) const;
  254. void _update_window_mouse_passthrough(WindowID p_window);
  255. String _clipboard_get_impl(Atom p_source, Window x11_window, Atom target) const;
  256. String _clipboard_get(Atom p_source, Window x11_window) const;
  257. Atom _clipboard_get_image_target(Atom p_source, Window x11_window) const;
  258. void _clipboard_transfer_ownership(Atom p_source, Window x11_window) const;
  259. bool do_mouse_warp = false;
  260. const char *cursor_theme = nullptr;
  261. int cursor_size = 0;
  262. XcursorImage *cursor_img[CURSOR_MAX];
  263. Cursor cursors[CURSOR_MAX];
  264. Cursor null_cursor;
  265. CursorShape current_cursor = CURSOR_ARROW;
  266. HashMap<CursorShape, Vector<Variant>> cursors_cache;
  267. String rendering_driver;
  268. void set_wm_fullscreen(bool p_enabled);
  269. void set_wm_above(bool p_enabled);
  270. typedef xrr_monitor_info *(*xrr_get_monitors_t)(Display *dpy, Window window, Bool get_active, int *nmonitors);
  271. typedef void (*xrr_free_monitors_t)(xrr_monitor_info *monitors);
  272. xrr_get_monitors_t xrr_get_monitors = nullptr;
  273. xrr_free_monitors_t xrr_free_monitors = nullptr;
  274. void *xrandr_handle = nullptr;
  275. bool xrandr_ext_ok = true;
  276. bool xinerama_ext_ok = true;
  277. bool xshaped_ext_ok = true;
  278. bool xwayland = false;
  279. struct Property {
  280. unsigned char *data;
  281. int format, nitems;
  282. Atom type;
  283. };
  284. static Property _read_property(Display *p_display, Window p_window, Atom p_property);
  285. void _update_real_mouse_position(const WindowData &wd);
  286. bool _window_maximize_check(WindowID p_window, const char *p_atom_name) const;
  287. bool _window_fullscreen_check(WindowID p_window) const;
  288. bool _window_minimize_check(WindowID p_window) const;
  289. void _validate_mode_on_map(WindowID p_window);
  290. void _update_size_hints(WindowID p_window);
  291. void _set_wm_fullscreen(WindowID p_window, bool p_enabled, bool p_exclusive);
  292. void _set_wm_maximized(WindowID p_window, bool p_enabled);
  293. void _set_wm_minimized(WindowID p_window, bool p_enabled);
  294. void _update_context(WindowData &wd);
  295. Context context = CONTEXT_ENGINE;
  296. WindowID _get_focused_window_or_popup() const;
  297. bool _window_focus_check();
  298. void _send_window_event(const WindowData &wd, WindowEvent p_event);
  299. static void _dispatch_input_events(const Ref<InputEvent> &p_event);
  300. void _dispatch_input_event(const Ref<InputEvent> &p_event);
  301. void _set_input_focus(Window p_window, int p_revert_to);
  302. mutable Mutex events_mutex;
  303. Thread events_thread;
  304. SafeFlag events_thread_done;
  305. LocalVector<XEvent> polled_events;
  306. static void _poll_events_thread(void *ud);
  307. bool _wait_for_events() const;
  308. void _poll_events();
  309. void _check_pending_events(LocalVector<XEvent> &r_events);
  310. static Bool _predicate_all_events(Display *display, XEvent *event, XPointer arg);
  311. static Bool _predicate_clipboard_selection(Display *display, XEvent *event, XPointer arg);
  312. static Bool _predicate_clipboard_incr(Display *display, XEvent *event, XPointer arg);
  313. static Bool _predicate_clipboard_save_targets(Display *display, XEvent *event, XPointer arg);
  314. protected:
  315. void _window_changed(XEvent *event);
  316. public:
  317. bool mouse_process_popups();
  318. void popup_open(WindowID p_window);
  319. void popup_close(WindowID p_window);
  320. virtual bool has_feature(Feature p_feature) const override;
  321. virtual String get_name() const override;
  322. #ifdef SPEECHD_ENABLED
  323. virtual bool tts_is_speaking() const override;
  324. virtual bool tts_is_paused() const override;
  325. virtual TypedArray<Dictionary> tts_get_voices() const override;
  326. virtual void tts_speak(const String &p_text, const String &p_voice, int p_volume = 50, float p_pitch = 1.f, float p_rate = 1.f, int p_utterance_id = 0, bool p_interrupt = false) override;
  327. virtual void tts_pause() override;
  328. virtual void tts_resume() override;
  329. virtual void tts_stop() override;
  330. #endif
  331. #if defined(DBUS_ENABLED)
  332. virtual bool is_dark_mode_supported() const override;
  333. virtual bool is_dark_mode() const override;
  334. virtual void set_system_theme_change_callback(const Callable &p_callable) override;
  335. virtual Error file_dialog_show(const String &p_title, const String &p_current_directory, const String &p_filename, bool p_show_hidden, FileDialogMode p_mode, const Vector<String> &p_filters, const Callable &p_callback) override;
  336. virtual Error file_dialog_with_options_show(const String &p_title, const String &p_current_directory, const String &p_root, const String &p_filename, bool p_show_hidden, FileDialogMode p_mode, const Vector<String> &p_filters, const TypedArray<Dictionary> &p_options, const Callable &p_callback) override;
  337. #endif
  338. virtual void beep() const override;
  339. virtual void mouse_set_mode(MouseMode p_mode) override;
  340. virtual MouseMode mouse_get_mode() const override;
  341. virtual void warp_mouse(const Point2i &p_position) override;
  342. virtual Point2i mouse_get_position() const override;
  343. virtual BitField<MouseButtonMask> mouse_get_button_state() const override;
  344. virtual void clipboard_set(const String &p_text) override;
  345. virtual String clipboard_get() const override;
  346. virtual Ref<Image> clipboard_get_image() const override;
  347. virtual bool clipboard_has_image() const override;
  348. virtual void clipboard_set_primary(const String &p_text) override;
  349. virtual String clipboard_get_primary() const override;
  350. virtual int get_screen_count() const override;
  351. virtual int get_primary_screen() const override;
  352. virtual int get_keyboard_focus_screen() const override;
  353. virtual Point2i screen_get_position(int p_screen = SCREEN_OF_MAIN_WINDOW) const override;
  354. virtual Size2i screen_get_size(int p_screen = SCREEN_OF_MAIN_WINDOW) const override;
  355. virtual Rect2i screen_get_usable_rect(int p_screen = SCREEN_OF_MAIN_WINDOW) const override;
  356. virtual int screen_get_dpi(int p_screen = SCREEN_OF_MAIN_WINDOW) const override;
  357. virtual float screen_get_refresh_rate(int p_screen = SCREEN_OF_MAIN_WINDOW) const override;
  358. virtual Color screen_get_pixel(const Point2i &p_position) const override;
  359. virtual Ref<Image> screen_get_image(int p_screen = SCREEN_OF_MAIN_WINDOW) const override;
  360. #if defined(DBUS_ENABLED)
  361. virtual void screen_set_keep_on(bool p_enable) override;
  362. virtual bool screen_is_kept_on() const override;
  363. #endif
  364. virtual Vector<DisplayServer::WindowID> get_window_list() const override;
  365. virtual WindowID create_sub_window(WindowMode p_mode, VSyncMode p_vsync_mode, uint32_t p_flags, const Rect2i &p_rect = Rect2i(), bool p_exclusive = false, WindowID p_transient_parent = INVALID_WINDOW_ID) override;
  366. virtual void show_window(WindowID p_id) override;
  367. virtual void delete_sub_window(WindowID p_id) override;
  368. virtual WindowID window_get_active_popup() const override;
  369. virtual void window_set_popup_safe_rect(WindowID p_window, const Rect2i &p_rect) override;
  370. virtual Rect2i window_get_popup_safe_rect(WindowID p_window) const override;
  371. virtual WindowID get_window_at_screen_position(const Point2i &p_position) const override;
  372. virtual int64_t window_get_native_handle(HandleType p_handle_type, WindowID p_window = MAIN_WINDOW_ID) const override;
  373. virtual void window_attach_instance_id(ObjectID p_instance, WindowID p_window = MAIN_WINDOW_ID) override;
  374. virtual ObjectID window_get_attached_instance_id(WindowID p_window = MAIN_WINDOW_ID) const override;
  375. virtual void window_set_title(const String &p_title, WindowID p_window = MAIN_WINDOW_ID) override;
  376. virtual void window_set_mouse_passthrough(const Vector<Vector2> &p_region, WindowID p_window = MAIN_WINDOW_ID) override;
  377. virtual void window_set_rect_changed_callback(const Callable &p_callable, WindowID p_window = MAIN_WINDOW_ID) override;
  378. virtual void window_set_window_event_callback(const Callable &p_callable, WindowID p_window = MAIN_WINDOW_ID) override;
  379. virtual void window_set_input_event_callback(const Callable &p_callable, WindowID p_window = MAIN_WINDOW_ID) override;
  380. virtual void window_set_input_text_callback(const Callable &p_callable, WindowID p_window = MAIN_WINDOW_ID) override;
  381. virtual void window_set_drop_files_callback(const Callable &p_callable, WindowID p_window = MAIN_WINDOW_ID) override;
  382. virtual int window_get_current_screen(WindowID p_window = MAIN_WINDOW_ID) const override;
  383. virtual void window_set_current_screen(int p_screen, WindowID p_window = MAIN_WINDOW_ID) override;
  384. virtual Point2i window_get_position(WindowID p_window = MAIN_WINDOW_ID) const override;
  385. virtual Point2i window_get_position_with_decorations(WindowID p_window = MAIN_WINDOW_ID) const override;
  386. virtual void window_set_position(const Point2i &p_position, WindowID p_window = MAIN_WINDOW_ID) override;
  387. virtual void window_set_max_size(const Size2i p_size, WindowID p_window = MAIN_WINDOW_ID) override;
  388. virtual Size2i window_get_max_size(WindowID p_window = MAIN_WINDOW_ID) const override;
  389. virtual void gl_window_make_current(DisplayServer::WindowID p_window_id) override;
  390. virtual void window_set_transient(WindowID p_window, WindowID p_parent) override;
  391. virtual void window_set_min_size(const Size2i p_size, WindowID p_window = MAIN_WINDOW_ID) override;
  392. virtual Size2i window_get_min_size(WindowID p_window = MAIN_WINDOW_ID) const override;
  393. virtual void window_set_size(const Size2i p_size, WindowID p_window = MAIN_WINDOW_ID) override;
  394. virtual Size2i window_get_size(WindowID p_window = MAIN_WINDOW_ID) const override;
  395. virtual Size2i window_get_size_with_decorations(WindowID p_window = MAIN_WINDOW_ID) const override;
  396. virtual void window_set_mode(WindowMode p_mode, WindowID p_window = MAIN_WINDOW_ID) override;
  397. virtual WindowMode window_get_mode(WindowID p_window = MAIN_WINDOW_ID) const override;
  398. virtual bool window_is_maximize_allowed(WindowID p_window = MAIN_WINDOW_ID) const override;
  399. virtual void window_set_flag(WindowFlags p_flag, bool p_enabled, WindowID p_window = MAIN_WINDOW_ID) override;
  400. virtual bool window_get_flag(WindowFlags p_flag, WindowID p_window = MAIN_WINDOW_ID) const override;
  401. virtual void window_request_attention(WindowID p_window = MAIN_WINDOW_ID) override;
  402. virtual void window_move_to_foreground(WindowID p_window = MAIN_WINDOW_ID) override;
  403. virtual bool window_is_focused(WindowID p_window = MAIN_WINDOW_ID) const override;
  404. virtual WindowID get_focused_window() const override;
  405. virtual bool window_can_draw(WindowID p_window = MAIN_WINDOW_ID) const override;
  406. virtual bool can_any_window_draw() const override;
  407. virtual void window_set_ime_active(const bool p_active, WindowID p_window = MAIN_WINDOW_ID) override;
  408. virtual void window_set_ime_position(const Point2i &p_pos, WindowID p_window = MAIN_WINDOW_ID) override;
  409. virtual Point2i ime_get_selection() const override;
  410. virtual String ime_get_text() const override;
  411. virtual void window_set_vsync_mode(DisplayServer::VSyncMode p_vsync_mode, WindowID p_window = MAIN_WINDOW_ID) override;
  412. virtual DisplayServer::VSyncMode window_get_vsync_mode(WindowID p_vsync_mode) const override;
  413. virtual void cursor_set_shape(CursorShape p_shape) override;
  414. virtual CursorShape cursor_get_shape() const override;
  415. virtual void cursor_set_custom_image(const Ref<Resource> &p_cursor, CursorShape p_shape, const Vector2 &p_hotspot) override;
  416. virtual int keyboard_get_layout_count() const override;
  417. virtual int keyboard_get_current_layout() const override;
  418. virtual void keyboard_set_current_layout(int p_index) override;
  419. virtual String keyboard_get_layout_language(int p_index) const override;
  420. virtual String keyboard_get_layout_name(int p_index) const override;
  421. virtual Key keyboard_get_keycode_from_physical(Key p_keycode) const override;
  422. virtual Key keyboard_get_label_from_physical(Key p_keycode) const override;
  423. virtual void process_events() override;
  424. virtual void release_rendering_thread() override;
  425. virtual void swap_buffers() override;
  426. virtual void set_context(Context p_context) override;
  427. virtual bool is_window_transparency_available() const override;
  428. virtual void set_native_icon(const String &p_filename) override;
  429. virtual void set_icon(const Ref<Image> &p_icon) override;
  430. static DisplayServer *create_func(const String &p_rendering_driver, WindowMode p_mode, VSyncMode p_vsync_mode, uint32_t p_flags, const Vector2i *p_position, const Vector2i &p_resolution, int p_screen, Context p_context, Error &r_error);
  431. static Vector<String> get_rendering_drivers_func();
  432. static void register_x11_driver();
  433. DisplayServerX11(const String &p_rendering_driver, WindowMode p_mode, VSyncMode p_vsync_mode, uint32_t p_flags, const Vector2i *p_position, const Vector2i &p_resolution, int p_screen, Context p_context, Error &r_error);
  434. ~DisplayServerX11();
  435. };
  436. #endif // X11_ENABLED
  437. #endif // DISPLAY_SERVER_X11_H