display_server.cpp 103 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140
  1. /**************************************************************************/
  2. /* display_server.cpp */
  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. #include "display_server.h"
  31. #include "display_server.compat.inc"
  32. #include "core/input/input.h"
  33. #include "scene/resources/texture.h"
  34. #include "servers/display_server_headless.h"
  35. #if defined(VULKAN_ENABLED)
  36. #include "drivers/vulkan/rendering_context_driver_vulkan.h"
  37. #undef CursorShape
  38. #endif
  39. #if defined(D3D12_ENABLED)
  40. #include "drivers/d3d12/rendering_context_driver_d3d12.h"
  41. #endif
  42. #if defined(METAL_ENABLED)
  43. #include "drivers/metal/rendering_context_driver_metal.h"
  44. #endif
  45. DisplayServer *DisplayServer::singleton = nullptr;
  46. DisplayServer::AccessibilityMode DisplayServer::accessibility_mode = DisplayServer::AccessibilityMode::ACCESSIBILITY_AUTO;
  47. bool DisplayServer::hidpi_allowed = false;
  48. bool DisplayServer::window_early_clear_override_enabled = false;
  49. Color DisplayServer::window_early_clear_override_color = Color(0, 0, 0, 0);
  50. DisplayServer::DisplayServerCreate DisplayServer::server_create_functions[DisplayServer::MAX_SERVERS] = {
  51. { "headless", &DisplayServerHeadless::create_func, &DisplayServerHeadless::get_rendering_drivers_func }
  52. };
  53. int DisplayServer::server_create_count = 1;
  54. void DisplayServer::help_set_search_callbacks(const Callable &p_search_callback, const Callable &p_action_callback) {
  55. WARN_PRINT("Native help is not supported by this display server.");
  56. }
  57. #ifndef DISABLE_DEPRECATED
  58. RID DisplayServer::_get_rid_from_name(NativeMenu *p_nmenu, const String &p_menu_root) const {
  59. if (p_menu_root == "_main") {
  60. return p_nmenu->get_system_menu(NativeMenu::MAIN_MENU_ID);
  61. } else if (p_menu_root == "_apple") {
  62. return p_nmenu->get_system_menu(NativeMenu::APPLICATION_MENU_ID);
  63. } else if (p_menu_root == "_dock") {
  64. return p_nmenu->get_system_menu(NativeMenu::DOCK_MENU_ID);
  65. } else if (p_menu_root == "_help") {
  66. return p_nmenu->get_system_menu(NativeMenu::HELP_MENU_ID);
  67. } else if (p_menu_root == "_window") {
  68. return p_nmenu->get_system_menu(NativeMenu::WINDOW_MENU_ID);
  69. } else if (menu_names.has(p_menu_root)) {
  70. return menu_names[p_menu_root];
  71. }
  72. RID rid = p_nmenu->create_menu();
  73. menu_names[p_menu_root] = rid;
  74. return rid;
  75. }
  76. int DisplayServer::global_menu_add_item(const String &p_menu_root, const String &p_label, const Callable &p_callback, const Callable &p_key_callback, const Variant &p_tag, Key p_accel, int p_index) {
  77. NativeMenu *nmenu = NativeMenu::get_singleton();
  78. ERR_FAIL_NULL_V(nmenu, -1);
  79. return nmenu->add_item(_get_rid_from_name(nmenu, p_menu_root), p_label, p_callback, p_key_callback, p_tag, p_accel, p_index);
  80. }
  81. int DisplayServer::global_menu_add_check_item(const String &p_menu_root, const String &p_label, const Callable &p_callback, const Callable &p_key_callback, const Variant &p_tag, Key p_accel, int p_index) {
  82. NativeMenu *nmenu = NativeMenu::get_singleton();
  83. ERR_FAIL_NULL_V(nmenu, -1);
  84. return nmenu->add_check_item(_get_rid_from_name(nmenu, p_menu_root), p_label, p_callback, p_key_callback, p_tag, p_accel, p_index);
  85. }
  86. int DisplayServer::global_menu_add_icon_item(const String &p_menu_root, const Ref<Texture2D> &p_icon, const String &p_label, const Callable &p_callback, const Callable &p_key_callback, const Variant &p_tag, Key p_accel, int p_index) {
  87. NativeMenu *nmenu = NativeMenu::get_singleton();
  88. ERR_FAIL_NULL_V(nmenu, -1);
  89. return nmenu->add_icon_item(_get_rid_from_name(nmenu, p_menu_root), p_icon, p_label, p_callback, p_key_callback, p_tag, p_accel, p_index);
  90. }
  91. int DisplayServer::global_menu_add_icon_check_item(const String &p_menu_root, const Ref<Texture2D> &p_icon, const String &p_label, const Callable &p_callback, const Callable &p_key_callback, const Variant &p_tag, Key p_accel, int p_index) {
  92. NativeMenu *nmenu = NativeMenu::get_singleton();
  93. ERR_FAIL_NULL_V(nmenu, -1);
  94. return nmenu->add_icon_check_item(_get_rid_from_name(nmenu, p_menu_root), p_icon, p_label, p_callback, p_key_callback, p_tag, p_accel, p_index);
  95. }
  96. int DisplayServer::global_menu_add_radio_check_item(const String &p_menu_root, const String &p_label, const Callable &p_callback, const Callable &p_key_callback, const Variant &p_tag, Key p_accel, int p_index) {
  97. NativeMenu *nmenu = NativeMenu::get_singleton();
  98. ERR_FAIL_NULL_V(nmenu, -1);
  99. return nmenu->add_radio_check_item(_get_rid_from_name(nmenu, p_menu_root), p_label, p_callback, p_key_callback, p_tag, p_accel, p_index);
  100. }
  101. int DisplayServer::global_menu_add_icon_radio_check_item(const String &p_menu_root, const Ref<Texture2D> &p_icon, const String &p_label, const Callable &p_callback, const Callable &p_key_callback, const Variant &p_tag, Key p_accel, int p_index) {
  102. NativeMenu *nmenu = NativeMenu::get_singleton();
  103. ERR_FAIL_NULL_V(nmenu, -1);
  104. return nmenu->add_icon_radio_check_item(_get_rid_from_name(nmenu, p_menu_root), p_icon, p_label, p_callback, p_key_callback, p_tag, p_accel, p_index);
  105. }
  106. int DisplayServer::global_menu_add_multistate_item(const String &p_menu_root, const String &p_label, int p_max_states, int p_default_state, const Callable &p_callback, const Callable &p_key_callback, const Variant &p_tag, Key p_accel, int p_index) {
  107. NativeMenu *nmenu = NativeMenu::get_singleton();
  108. ERR_FAIL_NULL_V(nmenu, -1);
  109. return nmenu->add_multistate_item(_get_rid_from_name(nmenu, p_menu_root), p_label, p_max_states, p_default_state, p_callback, p_key_callback, p_tag, p_accel, p_index);
  110. }
  111. void DisplayServer::global_menu_set_popup_callbacks(const String &p_menu_root, const Callable &p_open_callback, const Callable &p_close_callback) {
  112. NativeMenu *nmenu = NativeMenu::get_singleton();
  113. ERR_FAIL_NULL(nmenu);
  114. nmenu->set_popup_open_callback(_get_rid_from_name(nmenu, p_menu_root), p_open_callback);
  115. nmenu->set_popup_open_callback(_get_rid_from_name(nmenu, p_menu_root), p_close_callback);
  116. }
  117. int DisplayServer::global_menu_add_submenu_item(const String &p_menu_root, const String &p_label, const String &p_submenu, int p_index) {
  118. NativeMenu *nmenu = NativeMenu::get_singleton();
  119. ERR_FAIL_NULL_V(nmenu, -1);
  120. return nmenu->add_submenu_item(_get_rid_from_name(nmenu, p_menu_root), p_label, _get_rid_from_name(nmenu, p_submenu), Variant(), p_index);
  121. }
  122. int DisplayServer::global_menu_add_separator(const String &p_menu_root, int p_index) {
  123. NativeMenu *nmenu = NativeMenu::get_singleton();
  124. ERR_FAIL_NULL_V(nmenu, -1);
  125. return nmenu->add_separator(_get_rid_from_name(nmenu, p_menu_root), p_index);
  126. }
  127. int DisplayServer::global_menu_get_item_index_from_text(const String &p_menu_root, const String &p_text) const {
  128. NativeMenu *nmenu = NativeMenu::get_singleton();
  129. ERR_FAIL_NULL_V(nmenu, -1);
  130. return nmenu->find_item_index_with_text(_get_rid_from_name(nmenu, p_menu_root), p_text);
  131. }
  132. int DisplayServer::global_menu_get_item_index_from_tag(const String &p_menu_root, const Variant &p_tag) const {
  133. NativeMenu *nmenu = NativeMenu::get_singleton();
  134. ERR_FAIL_NULL_V(nmenu, -1);
  135. return nmenu->find_item_index_with_tag(_get_rid_from_name(nmenu, p_menu_root), p_tag);
  136. }
  137. void DisplayServer::global_menu_set_item_callback(const String &p_menu_root, int p_idx, const Callable &p_callback) {
  138. NativeMenu *nmenu = NativeMenu::get_singleton();
  139. ERR_FAIL_NULL(nmenu);
  140. nmenu->set_item_callback(_get_rid_from_name(nmenu, p_menu_root), p_idx, p_callback);
  141. }
  142. void DisplayServer::global_menu_set_item_hover_callbacks(const String &p_menu_root, int p_idx, const Callable &p_callback) {
  143. NativeMenu *nmenu = NativeMenu::get_singleton();
  144. ERR_FAIL_NULL(nmenu);
  145. nmenu->set_item_hover_callbacks(_get_rid_from_name(nmenu, p_menu_root), p_idx, p_callback);
  146. }
  147. void DisplayServer::global_menu_set_item_key_callback(const String &p_menu_root, int p_idx, const Callable &p_key_callback) {
  148. NativeMenu *nmenu = NativeMenu::get_singleton();
  149. ERR_FAIL_NULL(nmenu);
  150. nmenu->set_item_key_callback(_get_rid_from_name(nmenu, p_menu_root), p_idx, p_key_callback);
  151. }
  152. bool DisplayServer::global_menu_is_item_checked(const String &p_menu_root, int p_idx) const {
  153. NativeMenu *nmenu = NativeMenu::get_singleton();
  154. ERR_FAIL_NULL_V(nmenu, false);
  155. return nmenu->is_item_checked(_get_rid_from_name(nmenu, p_menu_root), p_idx);
  156. }
  157. bool DisplayServer::global_menu_is_item_checkable(const String &p_menu_root, int p_idx) const {
  158. NativeMenu *nmenu = NativeMenu::get_singleton();
  159. ERR_FAIL_NULL_V(nmenu, false);
  160. return nmenu->is_item_checkable(_get_rid_from_name(nmenu, p_menu_root), p_idx);
  161. }
  162. bool DisplayServer::global_menu_is_item_radio_checkable(const String &p_menu_root, int p_idx) const {
  163. NativeMenu *nmenu = NativeMenu::get_singleton();
  164. ERR_FAIL_NULL_V(nmenu, false);
  165. return nmenu->is_item_radio_checkable(_get_rid_from_name(nmenu, p_menu_root), p_idx);
  166. }
  167. Callable DisplayServer::global_menu_get_item_callback(const String &p_menu_root, int p_idx) const {
  168. NativeMenu *nmenu = NativeMenu::get_singleton();
  169. ERR_FAIL_NULL_V(nmenu, Callable());
  170. return nmenu->get_item_callback(_get_rid_from_name(nmenu, p_menu_root), p_idx);
  171. }
  172. Callable DisplayServer::global_menu_get_item_key_callback(const String &p_menu_root, int p_idx) const {
  173. NativeMenu *nmenu = NativeMenu::get_singleton();
  174. ERR_FAIL_NULL_V(nmenu, Callable());
  175. return nmenu->get_item_key_callback(_get_rid_from_name(nmenu, p_menu_root), p_idx);
  176. }
  177. Variant DisplayServer::global_menu_get_item_tag(const String &p_menu_root, int p_idx) const {
  178. NativeMenu *nmenu = NativeMenu::get_singleton();
  179. ERR_FAIL_NULL_V(nmenu, Variant());
  180. return nmenu->get_item_tag(_get_rid_from_name(nmenu, p_menu_root), p_idx);
  181. }
  182. String DisplayServer::global_menu_get_item_text(const String &p_menu_root, int p_idx) const {
  183. NativeMenu *nmenu = NativeMenu::get_singleton();
  184. ERR_FAIL_NULL_V(nmenu, String());
  185. return nmenu->get_item_text(_get_rid_from_name(nmenu, p_menu_root), p_idx);
  186. }
  187. String DisplayServer::global_menu_get_item_submenu(const String &p_menu_root, int p_idx) const {
  188. NativeMenu *nmenu = NativeMenu::get_singleton();
  189. ERR_FAIL_NULL_V(nmenu, String());
  190. RID rid = nmenu->get_item_submenu(_get_rid_from_name(nmenu, p_menu_root), p_idx);
  191. if (!nmenu->is_system_menu(rid)) {
  192. for (HashMap<String, RID>::Iterator E = menu_names.begin(); E; ++E) {
  193. if (E->value == rid) {
  194. return E->key;
  195. }
  196. }
  197. }
  198. return String();
  199. }
  200. Key DisplayServer::global_menu_get_item_accelerator(const String &p_menu_root, int p_idx) const {
  201. NativeMenu *nmenu = NativeMenu::get_singleton();
  202. ERR_FAIL_NULL_V(nmenu, Key::NONE);
  203. return nmenu->get_item_accelerator(_get_rid_from_name(nmenu, p_menu_root), p_idx);
  204. }
  205. bool DisplayServer::global_menu_is_item_disabled(const String &p_menu_root, int p_idx) const {
  206. NativeMenu *nmenu = NativeMenu::get_singleton();
  207. ERR_FAIL_NULL_V(nmenu, false);
  208. return nmenu->is_item_disabled(_get_rid_from_name(nmenu, p_menu_root), p_idx);
  209. }
  210. bool DisplayServer::global_menu_is_item_hidden(const String &p_menu_root, int p_idx) const {
  211. NativeMenu *nmenu = NativeMenu::get_singleton();
  212. ERR_FAIL_NULL_V(nmenu, false);
  213. return nmenu->is_item_hidden(_get_rid_from_name(nmenu, p_menu_root), p_idx);
  214. }
  215. String DisplayServer::global_menu_get_item_tooltip(const String &p_menu_root, int p_idx) const {
  216. NativeMenu *nmenu = NativeMenu::get_singleton();
  217. ERR_FAIL_NULL_V(nmenu, String());
  218. return nmenu->get_item_tooltip(_get_rid_from_name(nmenu, p_menu_root), p_idx);
  219. }
  220. int DisplayServer::global_menu_get_item_state(const String &p_menu_root, int p_idx) const {
  221. NativeMenu *nmenu = NativeMenu::get_singleton();
  222. ERR_FAIL_NULL_V(nmenu, -1);
  223. return nmenu->get_item_state(_get_rid_from_name(nmenu, p_menu_root), p_idx);
  224. }
  225. int DisplayServer::global_menu_get_item_max_states(const String &p_menu_root, int p_idx) const {
  226. NativeMenu *nmenu = NativeMenu::get_singleton();
  227. ERR_FAIL_NULL_V(nmenu, -1);
  228. return nmenu->get_item_max_states(_get_rid_from_name(nmenu, p_menu_root), p_idx);
  229. }
  230. Ref<Texture2D> DisplayServer::global_menu_get_item_icon(const String &p_menu_root, int p_idx) const {
  231. NativeMenu *nmenu = NativeMenu::get_singleton();
  232. ERR_FAIL_NULL_V(nmenu, Ref<Texture2D>());
  233. return nmenu->get_item_icon(_get_rid_from_name(nmenu, p_menu_root), p_idx);
  234. }
  235. int DisplayServer::global_menu_get_item_indentation_level(const String &p_menu_root, int p_idx) const {
  236. NativeMenu *nmenu = NativeMenu::get_singleton();
  237. ERR_FAIL_NULL_V(nmenu, 0);
  238. return nmenu->get_item_indentation_level(_get_rid_from_name(nmenu, p_menu_root), p_idx);
  239. }
  240. void DisplayServer::global_menu_set_item_checked(const String &p_menu_root, int p_idx, bool p_checked) {
  241. NativeMenu *nmenu = NativeMenu::get_singleton();
  242. ERR_FAIL_NULL(nmenu);
  243. nmenu->set_item_checked(_get_rid_from_name(nmenu, p_menu_root), p_idx, p_checked);
  244. }
  245. void DisplayServer::global_menu_set_item_checkable(const String &p_menu_root, int p_idx, bool p_checkable) {
  246. NativeMenu *nmenu = NativeMenu::get_singleton();
  247. ERR_FAIL_NULL(nmenu);
  248. nmenu->set_item_checkable(_get_rid_from_name(nmenu, p_menu_root), p_idx, p_checkable);
  249. }
  250. void DisplayServer::global_menu_set_item_radio_checkable(const String &p_menu_root, int p_idx, bool p_checkable) {
  251. NativeMenu *nmenu = NativeMenu::get_singleton();
  252. ERR_FAIL_NULL(nmenu);
  253. nmenu->set_item_radio_checkable(_get_rid_from_name(nmenu, p_menu_root), p_idx, p_checkable);
  254. }
  255. void DisplayServer::global_menu_set_item_tag(const String &p_menu_root, int p_idx, const Variant &p_tag) {
  256. NativeMenu *nmenu = NativeMenu::get_singleton();
  257. ERR_FAIL_NULL(nmenu);
  258. nmenu->set_item_tag(_get_rid_from_name(nmenu, p_menu_root), p_idx, p_tag);
  259. }
  260. void DisplayServer::global_menu_set_item_text(const String &p_menu_root, int p_idx, const String &p_text) {
  261. NativeMenu *nmenu = NativeMenu::get_singleton();
  262. ERR_FAIL_NULL(nmenu);
  263. nmenu->set_item_text(_get_rid_from_name(nmenu, p_menu_root), p_idx, p_text);
  264. }
  265. void DisplayServer::global_menu_set_item_submenu(const String &p_menu_root, int p_idx, const String &p_submenu) {
  266. NativeMenu *nmenu = NativeMenu::get_singleton();
  267. ERR_FAIL_NULL(nmenu);
  268. nmenu->set_item_submenu(_get_rid_from_name(nmenu, p_menu_root), p_idx, _get_rid_from_name(nmenu, p_submenu));
  269. }
  270. void DisplayServer::global_menu_set_item_accelerator(const String &p_menu_root, int p_idx, Key p_keycode) {
  271. NativeMenu *nmenu = NativeMenu::get_singleton();
  272. ERR_FAIL_NULL(nmenu);
  273. nmenu->set_item_accelerator(_get_rid_from_name(nmenu, p_menu_root), p_idx, p_keycode);
  274. }
  275. void DisplayServer::global_menu_set_item_disabled(const String &p_menu_root, int p_idx, bool p_disabled) {
  276. NativeMenu *nmenu = NativeMenu::get_singleton();
  277. ERR_FAIL_NULL(nmenu);
  278. nmenu->set_item_disabled(_get_rid_from_name(nmenu, p_menu_root), p_idx, p_disabled);
  279. }
  280. void DisplayServer::global_menu_set_item_hidden(const String &p_menu_root, int p_idx, bool p_hidden) {
  281. NativeMenu *nmenu = NativeMenu::get_singleton();
  282. ERR_FAIL_NULL(nmenu);
  283. nmenu->set_item_hidden(_get_rid_from_name(nmenu, p_menu_root), p_idx, p_hidden);
  284. }
  285. void DisplayServer::global_menu_set_item_tooltip(const String &p_menu_root, int p_idx, const String &p_tooltip) {
  286. NativeMenu *nmenu = NativeMenu::get_singleton();
  287. ERR_FAIL_NULL(nmenu);
  288. nmenu->set_item_tooltip(_get_rid_from_name(nmenu, p_menu_root), p_idx, p_tooltip);
  289. }
  290. void DisplayServer::global_menu_set_item_state(const String &p_menu_root, int p_idx, int p_state) {
  291. NativeMenu *nmenu = NativeMenu::get_singleton();
  292. ERR_FAIL_NULL(nmenu);
  293. nmenu->set_item_state(_get_rid_from_name(nmenu, p_menu_root), p_idx, p_state);
  294. }
  295. void DisplayServer::global_menu_set_item_max_states(const String &p_menu_root, int p_idx, int p_max_states) {
  296. NativeMenu *nmenu = NativeMenu::get_singleton();
  297. ERR_FAIL_NULL(nmenu);
  298. nmenu->set_item_max_states(_get_rid_from_name(nmenu, p_menu_root), p_idx, p_max_states);
  299. }
  300. void DisplayServer::global_menu_set_item_icon(const String &p_menu_root, int p_idx, const Ref<Texture2D> &p_icon) {
  301. NativeMenu *nmenu = NativeMenu::get_singleton();
  302. ERR_FAIL_NULL(nmenu);
  303. nmenu->set_item_icon(_get_rid_from_name(nmenu, p_menu_root), p_idx, p_icon);
  304. }
  305. void DisplayServer::global_menu_set_item_indentation_level(const String &p_menu_root, int p_idx, int p_level) {
  306. NativeMenu *nmenu = NativeMenu::get_singleton();
  307. ERR_FAIL_NULL(nmenu);
  308. nmenu->set_item_indentation_level(_get_rid_from_name(nmenu, p_menu_root), p_idx, p_level);
  309. }
  310. int DisplayServer::global_menu_get_item_count(const String &p_menu_root) const {
  311. NativeMenu *nmenu = NativeMenu::get_singleton();
  312. ERR_FAIL_NULL_V(nmenu, 0);
  313. return nmenu->get_item_count(_get_rid_from_name(nmenu, p_menu_root));
  314. }
  315. void DisplayServer::global_menu_remove_item(const String &p_menu_root, int p_idx) {
  316. NativeMenu *nmenu = NativeMenu::get_singleton();
  317. ERR_FAIL_NULL(nmenu);
  318. nmenu->remove_item(_get_rid_from_name(nmenu, p_menu_root), p_idx);
  319. }
  320. void DisplayServer::global_menu_clear(const String &p_menu_root) {
  321. NativeMenu *nmenu = NativeMenu::get_singleton();
  322. ERR_FAIL_NULL(nmenu);
  323. RID rid = _get_rid_from_name(nmenu, p_menu_root);
  324. nmenu->clear(rid);
  325. if (!nmenu->is_system_menu(rid)) {
  326. nmenu->free_menu(rid);
  327. menu_names.erase(p_menu_root);
  328. }
  329. }
  330. Dictionary DisplayServer::global_menu_get_system_menu_roots() const {
  331. NativeMenu *nmenu = NativeMenu::get_singleton();
  332. ERR_FAIL_NULL_V(nmenu, Dictionary());
  333. Dictionary out;
  334. if (nmenu->has_system_menu(NativeMenu::DOCK_MENU_ID)) {
  335. out["_dock"] = "@Dock";
  336. }
  337. if (nmenu->has_system_menu(NativeMenu::APPLICATION_MENU_ID)) {
  338. out["_apple"] = "@Apple";
  339. }
  340. if (nmenu->has_system_menu(NativeMenu::WINDOW_MENU_ID)) {
  341. out["_window"] = "Window";
  342. }
  343. if (nmenu->has_system_menu(NativeMenu::HELP_MENU_ID)) {
  344. out["_help"] = "Help";
  345. }
  346. return out;
  347. }
  348. #endif
  349. bool DisplayServer::tts_is_speaking() const {
  350. WARN_PRINT("TTS is not supported by this display server.");
  351. return false;
  352. }
  353. bool DisplayServer::tts_is_paused() const {
  354. WARN_PRINT("TTS is not supported by this display server.");
  355. return false;
  356. }
  357. void DisplayServer::tts_pause() {
  358. WARN_PRINT("TTS is not supported by this display server.");
  359. }
  360. void DisplayServer::tts_resume() {
  361. WARN_PRINT("TTS is not supported by this display server.");
  362. }
  363. TypedArray<Dictionary> DisplayServer::tts_get_voices() const {
  364. WARN_PRINT("TTS is not supported by this display server.");
  365. return TypedArray<Dictionary>();
  366. }
  367. PackedStringArray DisplayServer::tts_get_voices_for_language(const String &p_language) const {
  368. PackedStringArray ret;
  369. TypedArray<Dictionary> voices = tts_get_voices();
  370. for (int i = 0; i < voices.size(); i++) {
  371. const Dictionary &voice = voices[i];
  372. if (voice.has("id") && voice.has("language") && voice["language"].operator String().begins_with(p_language)) {
  373. ret.push_back(voice["id"]);
  374. }
  375. }
  376. return ret;
  377. }
  378. void DisplayServer::tts_speak(const String &p_text, const String &p_voice, int p_volume, float p_pitch, float p_rate, int p_utterance_id, bool p_interrupt) {
  379. WARN_PRINT("TTS is not supported by this display server.");
  380. }
  381. void DisplayServer::tts_stop() {
  382. WARN_PRINT("TTS is not supported by this display server.");
  383. }
  384. void DisplayServer::tts_set_utterance_callback(TTSUtteranceEvent p_event, const Callable &p_callable) {
  385. ERR_FAIL_INDEX(p_event, DisplayServer::TTS_UTTERANCE_MAX);
  386. utterance_callback[p_event] = p_callable;
  387. }
  388. void DisplayServer::tts_post_utterance_event(TTSUtteranceEvent p_event, int p_id, int p_pos) {
  389. ERR_FAIL_INDEX(p_event, DisplayServer::TTS_UTTERANCE_MAX);
  390. switch (p_event) {
  391. case DisplayServer::TTS_UTTERANCE_STARTED:
  392. case DisplayServer::TTS_UTTERANCE_ENDED:
  393. case DisplayServer::TTS_UTTERANCE_CANCELED: {
  394. if (utterance_callback[p_event].is_valid()) {
  395. utterance_callback[p_event].call_deferred(p_id); // Should be deferred, on some platforms utterance events can be called from different threads in a rapid succession.
  396. }
  397. } break;
  398. case DisplayServer::TTS_UTTERANCE_BOUNDARY: {
  399. if (utterance_callback[p_event].is_valid()) {
  400. utterance_callback[p_event].call_deferred(p_pos, p_id); // Should be deferred, on some platforms utterance events can be called from different threads in a rapid succession.
  401. }
  402. } break;
  403. default:
  404. break;
  405. }
  406. }
  407. bool DisplayServer::_get_window_early_clear_override(Color &r_color) {
  408. if (window_early_clear_override_enabled) {
  409. r_color = window_early_clear_override_color;
  410. return true;
  411. } else if (RenderingServer::get_singleton()) {
  412. r_color = RenderingServer::get_singleton()->get_default_clear_color();
  413. return true;
  414. } else {
  415. return false;
  416. }
  417. }
  418. void DisplayServer::set_early_window_clear_color_override(bool p_enabled, Color p_color) {
  419. window_early_clear_override_enabled = p_enabled;
  420. window_early_clear_override_color = p_color;
  421. }
  422. void DisplayServer::mouse_set_mode(MouseMode p_mode) {
  423. WARN_PRINT("Mouse is not supported by this display server.");
  424. }
  425. DisplayServer::MouseMode DisplayServer::mouse_get_mode() const {
  426. return MOUSE_MODE_VISIBLE;
  427. }
  428. void DisplayServer::mouse_set_mode_override(MouseMode p_mode) {
  429. WARN_PRINT("Mouse is not supported by this display server.");
  430. }
  431. DisplayServer::MouseMode DisplayServer::mouse_get_mode_override() const {
  432. return MOUSE_MODE_VISIBLE;
  433. }
  434. void DisplayServer::mouse_set_mode_override_enabled(bool p_override_enabled) {
  435. WARN_PRINT("Mouse is not supported by this display server.");
  436. }
  437. bool DisplayServer::mouse_is_mode_override_enabled() const {
  438. return false;
  439. }
  440. void DisplayServer::warp_mouse(const Point2i &p_position) {
  441. }
  442. Point2i DisplayServer::mouse_get_position() const {
  443. ERR_FAIL_V_MSG(Point2i(), "Mouse is not supported by this display server.");
  444. }
  445. BitField<MouseButtonMask> DisplayServer::mouse_get_button_state() const {
  446. ERR_FAIL_V_MSG(MouseButtonMask::NONE, "Mouse is not supported by this display server.");
  447. }
  448. void DisplayServer::clipboard_set(const String &p_text) {
  449. WARN_PRINT("Clipboard is not supported by this display server.");
  450. }
  451. String DisplayServer::clipboard_get() const {
  452. ERR_FAIL_V_MSG(String(), "Clipboard is not supported by this display server.");
  453. }
  454. Ref<Image> DisplayServer::clipboard_get_image() const {
  455. ERR_FAIL_V_MSG(Ref<Image>(), "Clipboard is not supported by this display server.");
  456. }
  457. bool DisplayServer::clipboard_has() const {
  458. return !clipboard_get().is_empty();
  459. }
  460. bool DisplayServer::clipboard_has_image() const {
  461. return clipboard_get_image().is_valid();
  462. }
  463. void DisplayServer::clipboard_set_primary(const String &p_text) {
  464. WARN_PRINT("Primary clipboard is not supported by this display server.");
  465. }
  466. String DisplayServer::clipboard_get_primary() const {
  467. ERR_FAIL_V_MSG(String(), "Primary clipboard is not supported by this display server.");
  468. }
  469. void DisplayServer::screen_set_orientation(ScreenOrientation p_orientation, int p_screen) {
  470. WARN_PRINT("Orientation not supported by this display server.");
  471. }
  472. DisplayServer::ScreenOrientation DisplayServer::screen_get_orientation(int p_screen) const {
  473. return SCREEN_LANDSCAPE;
  474. }
  475. float DisplayServer::screen_get_scale(int p_screen) const {
  476. return 1.0f;
  477. }
  478. bool DisplayServer::is_touchscreen_available() const {
  479. return Input::get_singleton() && Input::get_singleton()->is_emulating_touch_from_mouse();
  480. }
  481. void DisplayServer::screen_set_keep_on(bool p_enable) {
  482. WARN_PRINT("Keeping screen on not supported by this display server.");
  483. }
  484. bool DisplayServer::screen_is_kept_on() const {
  485. return false;
  486. }
  487. int DisplayServer::get_screen_from_rect(const Rect2 &p_rect) const {
  488. int nearest_area = 0;
  489. int pos_screen = -1;
  490. for (int i = 0; i < get_screen_count(); i++) {
  491. Rect2i r;
  492. r.position = screen_get_position(i);
  493. r.size = screen_get_size(i);
  494. Rect2 inters = r.intersection(p_rect);
  495. int area = inters.size.width * inters.size.height;
  496. if (area > nearest_area) {
  497. pos_screen = i;
  498. nearest_area = area;
  499. }
  500. }
  501. return pos_screen;
  502. }
  503. DisplayServer::WindowID DisplayServer::create_sub_window(WindowMode p_mode, VSyncMode p_vsync_mode, uint32_t p_flags, const Rect2i &p_rect, bool p_exclusive, WindowID p_transient_parent) {
  504. ERR_FAIL_V_MSG(INVALID_WINDOW_ID, "Sub-windows not supported by this display server.");
  505. }
  506. void DisplayServer::show_window(WindowID p_id) {
  507. ERR_FAIL_MSG("Sub-windows not supported by this display server.");
  508. }
  509. void DisplayServer::delete_sub_window(WindowID p_id) {
  510. ERR_FAIL_MSG("Sub-windows not supported by this display server.");
  511. }
  512. void DisplayServer::window_set_exclusive(WindowID p_window, bool p_exclusive) {
  513. // Do nothing, if not supported.
  514. }
  515. void DisplayServer::window_set_mouse_passthrough(const Vector<Vector2> &p_region, WindowID p_window) {
  516. ERR_FAIL_MSG("Mouse passthrough not supported by this display server.");
  517. }
  518. void DisplayServer::gl_window_make_current(DisplayServer::WindowID p_window_id) {
  519. // noop except in gles
  520. }
  521. void DisplayServer::window_set_ime_active(const bool p_active, WindowID p_window) {
  522. WARN_PRINT("IME not supported by this display server.");
  523. }
  524. void DisplayServer::window_set_ime_position(const Point2i &p_pos, WindowID p_window) {
  525. WARN_PRINT("IME not supported by this display server.");
  526. }
  527. RID DisplayServer::accessibility_create_element(WindowID p_window, DisplayServer::AccessibilityRole p_role) {
  528. if (accessibility_driver) {
  529. return accessibility_driver->accessibility_create_element(p_window, p_role);
  530. } else {
  531. return RID();
  532. }
  533. }
  534. RID DisplayServer::accessibility_create_sub_element(const RID &p_parent_rid, DisplayServer::AccessibilityRole p_role, int p_insert_pos) {
  535. if (accessibility_driver) {
  536. return accessibility_driver->accessibility_create_sub_element(p_parent_rid, p_role, p_insert_pos);
  537. } else {
  538. return RID();
  539. }
  540. }
  541. RID DisplayServer::accessibility_create_sub_text_edit_elements(const RID &p_parent_rid, const RID &p_shaped_text, float p_min_height, int p_insert_pos) {
  542. if (accessibility_driver) {
  543. return accessibility_driver->accessibility_create_sub_text_edit_elements(p_parent_rid, p_shaped_text, p_min_height, p_insert_pos);
  544. } else {
  545. return RID();
  546. }
  547. }
  548. bool DisplayServer::accessibility_has_element(const RID &p_id) const {
  549. if (accessibility_driver) {
  550. return accessibility_driver->accessibility_has_element(p_id);
  551. } else {
  552. return false;
  553. }
  554. }
  555. void DisplayServer::accessibility_free_element(const RID &p_id) {
  556. if (accessibility_driver) {
  557. accessibility_driver->accessibility_free_element(p_id);
  558. }
  559. }
  560. void DisplayServer::accessibility_element_set_meta(const RID &p_id, const Variant &p_meta) {
  561. if (accessibility_driver) {
  562. accessibility_driver->accessibility_element_set_meta(p_id, p_meta);
  563. }
  564. }
  565. Variant DisplayServer::accessibility_element_get_meta(const RID &p_id) const {
  566. if (accessibility_driver) {
  567. return accessibility_driver->accessibility_element_get_meta(p_id);
  568. } else {
  569. return Variant();
  570. }
  571. }
  572. void DisplayServer::accessibility_update_if_active(const Callable &p_callable) {
  573. if (accessibility_driver) {
  574. accessibility_driver->accessibility_update_if_active(p_callable);
  575. }
  576. }
  577. void DisplayServer::accessibility_update_set_focus(const RID &p_id) {
  578. if (accessibility_driver) {
  579. accessibility_driver->accessibility_update_set_focus(p_id);
  580. }
  581. }
  582. RID DisplayServer::accessibility_get_window_root(DisplayServer::WindowID p_window_id) const {
  583. if (accessibility_driver) {
  584. return accessibility_driver->accessibility_get_window_root(p_window_id);
  585. } else {
  586. return RID();
  587. }
  588. }
  589. void DisplayServer::accessibility_set_window_rect(DisplayServer::WindowID p_window_id, const Rect2 &p_rect_out, const Rect2 &p_rect_in) {
  590. if (accessibility_driver) {
  591. accessibility_driver->accessibility_set_window_rect(p_window_id, p_rect_out, p_rect_in);
  592. }
  593. }
  594. void DisplayServer::accessibility_set_window_focused(DisplayServer::WindowID p_window_id, bool p_focused) {
  595. if (accessibility_driver) {
  596. accessibility_driver->accessibility_set_window_focused(p_window_id, p_focused);
  597. }
  598. }
  599. void DisplayServer::accessibility_update_set_role(const RID &p_id, DisplayServer::AccessibilityRole p_role) {
  600. if (accessibility_driver) {
  601. accessibility_driver->accessibility_update_set_role(p_id, p_role);
  602. }
  603. }
  604. void DisplayServer::accessibility_update_set_name(const RID &p_id, const String &p_name) {
  605. if (accessibility_driver) {
  606. accessibility_driver->accessibility_update_set_name(p_id, p_name);
  607. }
  608. }
  609. void DisplayServer::accessibility_update_set_description(const RID &p_id, const String &p_description) {
  610. if (accessibility_driver) {
  611. accessibility_driver->accessibility_update_set_description(p_id, p_description);
  612. }
  613. }
  614. void DisplayServer::accessibility_update_set_extra_info(const RID &p_id, const String &p_name_extra_info) {
  615. if (accessibility_driver) {
  616. accessibility_driver->accessibility_update_set_extra_info(p_id, p_name_extra_info);
  617. }
  618. }
  619. void DisplayServer::accessibility_update_set_value(const RID &p_id, const String &p_value) {
  620. if (accessibility_driver) {
  621. accessibility_driver->accessibility_update_set_value(p_id, p_value);
  622. }
  623. }
  624. void DisplayServer::accessibility_update_set_tooltip(const RID &p_id, const String &p_tooltip) {
  625. if (accessibility_driver) {
  626. accessibility_driver->accessibility_update_set_tooltip(p_id, p_tooltip);
  627. }
  628. }
  629. void DisplayServer::accessibility_update_set_bounds(const RID &p_id, const Rect2 &p_rect) {
  630. if (accessibility_driver) {
  631. accessibility_driver->accessibility_update_set_bounds(p_id, p_rect);
  632. }
  633. }
  634. void DisplayServer::accessibility_update_set_transform(const RID &p_id, const Transform2D &p_transform) {
  635. if (accessibility_driver) {
  636. accessibility_driver->accessibility_update_set_transform(p_id, p_transform);
  637. }
  638. }
  639. void DisplayServer::accessibility_update_add_child(const RID &p_id, const RID &p_child_id) {
  640. if (accessibility_driver) {
  641. accessibility_driver->accessibility_update_add_child(p_id, p_child_id);
  642. }
  643. }
  644. void DisplayServer::accessibility_update_add_related_controls(const RID &p_id, const RID &p_related_id) {
  645. if (accessibility_driver) {
  646. accessibility_driver->accessibility_update_add_related_controls(p_id, p_related_id);
  647. }
  648. }
  649. void DisplayServer::accessibility_update_add_related_details(const RID &p_id, const RID &p_related_id) {
  650. if (accessibility_driver) {
  651. accessibility_driver->accessibility_update_add_related_details(p_id, p_related_id);
  652. }
  653. }
  654. void DisplayServer::accessibility_update_add_related_described_by(const RID &p_id, const RID &p_related_id) {
  655. if (accessibility_driver) {
  656. accessibility_driver->accessibility_update_add_related_described_by(p_id, p_related_id);
  657. }
  658. }
  659. void DisplayServer::accessibility_update_add_related_flow_to(const RID &p_id, const RID &p_related_id) {
  660. if (accessibility_driver) {
  661. accessibility_driver->accessibility_update_add_related_flow_to(p_id, p_related_id);
  662. }
  663. }
  664. void DisplayServer::accessibility_update_add_related_labeled_by(const RID &p_id, const RID &p_related_id) {
  665. if (accessibility_driver) {
  666. accessibility_driver->accessibility_update_add_related_labeled_by(p_id, p_related_id);
  667. }
  668. }
  669. void DisplayServer::accessibility_update_add_related_radio_group(const RID &p_id, const RID &p_related_id) {
  670. if (accessibility_driver) {
  671. accessibility_driver->accessibility_update_add_related_radio_group(p_id, p_related_id);
  672. }
  673. }
  674. void DisplayServer::accessibility_update_set_active_descendant(const RID &p_id, const RID &p_other_id) {
  675. if (accessibility_driver) {
  676. accessibility_driver->accessibility_update_set_active_descendant(p_id, p_other_id);
  677. }
  678. }
  679. void DisplayServer::accessibility_update_set_next_on_line(const RID &p_id, const RID &p_other_id) {
  680. if (accessibility_driver) {
  681. accessibility_driver->accessibility_update_set_next_on_line(p_id, p_other_id);
  682. }
  683. }
  684. void DisplayServer::accessibility_update_set_previous_on_line(const RID &p_id, const RID &p_other_id) {
  685. if (accessibility_driver) {
  686. accessibility_driver->accessibility_update_set_previous_on_line(p_id, p_other_id);
  687. }
  688. }
  689. void DisplayServer::accessibility_update_set_member_of(const RID &p_id, const RID &p_group_id) {
  690. if (accessibility_driver) {
  691. accessibility_driver->accessibility_update_set_member_of(p_id, p_group_id);
  692. }
  693. }
  694. void DisplayServer::accessibility_update_set_in_page_link_target(const RID &p_id, const RID &p_other_id) {
  695. if (accessibility_driver) {
  696. accessibility_driver->accessibility_update_set_in_page_link_target(p_id, p_other_id);
  697. }
  698. }
  699. void DisplayServer::accessibility_update_set_error_message(const RID &p_id, const RID &p_other_id) {
  700. if (accessibility_driver) {
  701. accessibility_driver->accessibility_update_set_error_message(p_id, p_other_id);
  702. }
  703. }
  704. void DisplayServer::accessibility_update_set_live(const RID &p_id, DisplayServer::AccessibilityLiveMode p_live) {
  705. if (accessibility_driver) {
  706. accessibility_driver->accessibility_update_set_live(p_id, p_live);
  707. }
  708. }
  709. void DisplayServer::accessibility_update_add_action(const RID &p_id, DisplayServer::AccessibilityAction p_action, const Callable &p_callable) {
  710. if (accessibility_driver) {
  711. accessibility_driver->accessibility_update_add_action(p_id, p_action, p_callable);
  712. }
  713. }
  714. void DisplayServer::accessibility_update_add_custom_action(const RID &p_id, int p_action_id, const String &p_action_description) {
  715. if (accessibility_driver) {
  716. accessibility_driver->accessibility_update_add_custom_action(p_id, p_action_id, p_action_description);
  717. }
  718. }
  719. void DisplayServer::accessibility_update_set_table_row_count(const RID &p_id, int p_count) {
  720. if (accessibility_driver) {
  721. accessibility_driver->accessibility_update_set_table_row_count(p_id, p_count);
  722. }
  723. }
  724. void DisplayServer::accessibility_update_set_table_column_count(const RID &p_id, int p_count) {
  725. if (accessibility_driver) {
  726. accessibility_driver->accessibility_update_set_table_column_count(p_id, p_count);
  727. }
  728. }
  729. void DisplayServer::accessibility_update_set_table_row_index(const RID &p_id, int p_index) {
  730. if (accessibility_driver) {
  731. accessibility_driver->accessibility_update_set_table_row_index(p_id, p_index);
  732. }
  733. }
  734. void DisplayServer::accessibility_update_set_table_column_index(const RID &p_id, int p_index) {
  735. if (accessibility_driver) {
  736. accessibility_driver->accessibility_update_set_table_column_index(p_id, p_index);
  737. }
  738. }
  739. void DisplayServer::accessibility_update_set_table_cell_position(const RID &p_id, int p_row_index, int p_column_index) {
  740. if (accessibility_driver) {
  741. accessibility_driver->accessibility_update_set_table_cell_position(p_id, p_row_index, p_column_index);
  742. }
  743. }
  744. void DisplayServer::accessibility_update_set_table_cell_span(const RID &p_id, int p_row_span, int p_column_span) {
  745. if (accessibility_driver) {
  746. accessibility_driver->accessibility_update_set_table_cell_span(p_id, p_row_span, p_column_span);
  747. }
  748. }
  749. void DisplayServer::accessibility_update_set_list_item_count(const RID &p_id, int p_size) {
  750. if (accessibility_driver) {
  751. accessibility_driver->accessibility_update_set_list_item_count(p_id, p_size);
  752. }
  753. }
  754. void DisplayServer::accessibility_update_set_list_item_index(const RID &p_id, int p_index) {
  755. if (accessibility_driver) {
  756. accessibility_driver->accessibility_update_set_list_item_index(p_id, p_index);
  757. }
  758. }
  759. void DisplayServer::accessibility_update_set_list_item_level(const RID &p_id, int p_level) {
  760. if (accessibility_driver) {
  761. accessibility_driver->accessibility_update_set_list_item_level(p_id, p_level);
  762. }
  763. }
  764. void DisplayServer::accessibility_update_set_list_item_selected(const RID &p_id, bool p_selected) {
  765. if (accessibility_driver) {
  766. accessibility_driver->accessibility_update_set_list_item_selected(p_id, p_selected);
  767. }
  768. }
  769. void DisplayServer::accessibility_update_set_list_item_expanded(const RID &p_id, bool p_expanded) {
  770. if (accessibility_driver) {
  771. accessibility_driver->accessibility_update_set_list_item_expanded(p_id, p_expanded);
  772. }
  773. }
  774. void DisplayServer::accessibility_update_set_popup_type(const RID &p_id, DisplayServer::AccessibilityPopupType p_popup) {
  775. if (accessibility_driver) {
  776. accessibility_driver->accessibility_update_set_popup_type(p_id, p_popup);
  777. }
  778. }
  779. void DisplayServer::accessibility_update_set_checked(const RID &p_id, bool p_checekd) {
  780. if (accessibility_driver) {
  781. accessibility_driver->accessibility_update_set_checked(p_id, p_checekd);
  782. }
  783. }
  784. void DisplayServer::accessibility_update_set_num_value(const RID &p_id, double p_position) {
  785. if (accessibility_driver) {
  786. accessibility_driver->accessibility_update_set_num_value(p_id, p_position);
  787. }
  788. }
  789. void DisplayServer::accessibility_update_set_num_range(const RID &p_id, double p_min, double p_max) {
  790. if (accessibility_driver) {
  791. accessibility_driver->accessibility_update_set_num_range(p_id, p_min, p_max);
  792. }
  793. }
  794. void DisplayServer::accessibility_update_set_num_step(const RID &p_id, double p_step) {
  795. if (accessibility_driver) {
  796. accessibility_driver->accessibility_update_set_num_step(p_id, p_step);
  797. }
  798. }
  799. void DisplayServer::accessibility_update_set_num_jump(const RID &p_id, double p_jump) {
  800. if (accessibility_driver) {
  801. accessibility_driver->accessibility_update_set_num_jump(p_id, p_jump);
  802. }
  803. }
  804. void DisplayServer::accessibility_update_set_scroll_x(const RID &p_id, double p_position) {
  805. if (accessibility_driver) {
  806. accessibility_driver->accessibility_update_set_scroll_x(p_id, p_position);
  807. }
  808. }
  809. void DisplayServer::accessibility_update_set_scroll_x_range(const RID &p_id, double p_min, double p_max) {
  810. if (accessibility_driver) {
  811. accessibility_driver->accessibility_update_set_scroll_x_range(p_id, p_min, p_max);
  812. }
  813. }
  814. void DisplayServer::accessibility_update_set_scroll_y(const RID &p_id, double p_position) {
  815. if (accessibility_driver) {
  816. accessibility_driver->accessibility_update_set_scroll_y(p_id, p_position);
  817. }
  818. }
  819. void DisplayServer::accessibility_update_set_scroll_y_range(const RID &p_id, double p_min, double p_max) {
  820. if (accessibility_driver) {
  821. accessibility_driver->accessibility_update_set_scroll_y_range(p_id, p_min, p_max);
  822. }
  823. }
  824. void DisplayServer::accessibility_update_set_text_decorations(const RID &p_id, bool p_underline, bool p_strikethrough, bool p_overline) {
  825. if (accessibility_driver) {
  826. accessibility_driver->accessibility_update_set_text_decorations(p_id, p_underline, p_strikethrough, p_overline);
  827. }
  828. }
  829. void DisplayServer::accessibility_update_set_text_align(const RID &p_id, HorizontalAlignment p_align) {
  830. if (accessibility_driver) {
  831. accessibility_driver->accessibility_update_set_text_align(p_id, p_align);
  832. }
  833. }
  834. void DisplayServer::accessibility_update_set_text_selection(const RID &p_id, const RID &p_text_start_id, int p_start_char, const RID &p_text_end_id, int p_end_char) {
  835. if (accessibility_driver) {
  836. accessibility_driver->accessibility_update_set_text_selection(p_id, p_text_start_id, p_start_char, p_text_end_id, p_end_char);
  837. }
  838. }
  839. void DisplayServer::accessibility_update_set_flag(const RID &p_id, DisplayServer::AccessibilityFlags p_flag, bool p_value) {
  840. if (accessibility_driver) {
  841. accessibility_driver->accessibility_update_set_flag(p_id, p_flag, p_value);
  842. }
  843. }
  844. void DisplayServer::accessibility_update_set_classname(const RID &p_id, const String &p_classname) {
  845. if (accessibility_driver) {
  846. accessibility_driver->accessibility_update_set_classname(p_id, p_classname);
  847. }
  848. }
  849. void DisplayServer::accessibility_update_set_placeholder(const RID &p_id, const String &p_placeholder) {
  850. if (accessibility_driver) {
  851. accessibility_driver->accessibility_update_set_placeholder(p_id, p_placeholder);
  852. }
  853. }
  854. void DisplayServer::accessibility_update_set_language(const RID &p_id, const String &p_language) {
  855. if (accessibility_driver) {
  856. accessibility_driver->accessibility_update_set_language(p_id, p_language);
  857. }
  858. }
  859. void DisplayServer::accessibility_update_set_text_orientation(const RID &p_id, bool p_vertical) {
  860. if (accessibility_driver) {
  861. accessibility_driver->accessibility_update_set_text_orientation(p_id, p_vertical);
  862. }
  863. }
  864. void DisplayServer::accessibility_update_set_list_orientation(const RID &p_id, bool p_vertical) {
  865. if (accessibility_driver) {
  866. accessibility_driver->accessibility_update_set_list_orientation(p_id, p_vertical);
  867. }
  868. }
  869. void DisplayServer::accessibility_update_set_shortcut(const RID &p_id, const String &p_shortcut) {
  870. if (accessibility_driver) {
  871. accessibility_driver->accessibility_update_set_shortcut(p_id, p_shortcut);
  872. }
  873. }
  874. void DisplayServer::accessibility_update_set_url(const RID &p_id, const String &p_url) {
  875. if (accessibility_driver) {
  876. accessibility_driver->accessibility_update_set_url(p_id, p_url);
  877. }
  878. }
  879. void DisplayServer::accessibility_update_set_role_description(const RID &p_id, const String &p_description) {
  880. if (accessibility_driver) {
  881. accessibility_driver->accessibility_update_set_role_description(p_id, p_description);
  882. }
  883. }
  884. void DisplayServer::accessibility_update_set_state_description(const RID &p_id, const String &p_description) {
  885. if (accessibility_driver) {
  886. accessibility_driver->accessibility_update_set_state_description(p_id, p_description);
  887. }
  888. }
  889. void DisplayServer::accessibility_update_set_color_value(const RID &p_id, const Color &p_color) {
  890. if (accessibility_driver) {
  891. accessibility_driver->accessibility_update_set_color_value(p_id, p_color);
  892. }
  893. }
  894. void DisplayServer::accessibility_update_set_background_color(const RID &p_id, const Color &p_color) {
  895. if (accessibility_driver) {
  896. accessibility_driver->accessibility_update_set_background_color(p_id, p_color);
  897. }
  898. }
  899. void DisplayServer::accessibility_update_set_foreground_color(const RID &p_id, const Color &p_color) {
  900. if (accessibility_driver) {
  901. accessibility_driver->accessibility_update_set_foreground_color(p_id, p_color);
  902. }
  903. }
  904. Point2i DisplayServer::ime_get_selection() const {
  905. ERR_FAIL_V_MSG(Point2i(), "IME or NOTIFICATION_WM_IME_UPDATE not supported by this display server.");
  906. }
  907. String DisplayServer::ime_get_text() const {
  908. ERR_FAIL_V_MSG(String(), "IME or NOTIFICATION_WM_IME_UPDATE not supported by this display server.");
  909. }
  910. void DisplayServer::virtual_keyboard_show(const String &p_existing_text, const Rect2 &p_screen_rect, VirtualKeyboardType p_type, int p_max_length, int p_cursor_start, int p_cursor_end) {
  911. WARN_PRINT("Virtual keyboard not supported by this display server.");
  912. }
  913. void DisplayServer::virtual_keyboard_hide() {
  914. WARN_PRINT("Virtual keyboard not supported by this display server.");
  915. }
  916. // returns height of the currently shown keyboard (0 if keyboard is hidden)
  917. int DisplayServer::virtual_keyboard_get_height() const {
  918. WARN_PRINT("Virtual keyboard not supported by this display server.");
  919. return 0;
  920. }
  921. bool DisplayServer::has_hardware_keyboard() const {
  922. return true;
  923. }
  924. void DisplayServer::cursor_set_shape(CursorShape p_shape) {
  925. WARN_PRINT("Cursor shape not supported by this display server.");
  926. }
  927. DisplayServer::CursorShape DisplayServer::cursor_get_shape() const {
  928. return CURSOR_ARROW;
  929. }
  930. void DisplayServer::cursor_set_custom_image(const Ref<Resource> &p_cursor, CursorShape p_shape, const Vector2 &p_hotspot) {
  931. WARN_PRINT("Custom cursor shape not supported by this display server.");
  932. }
  933. bool DisplayServer::get_swap_cancel_ok() {
  934. return false;
  935. }
  936. void DisplayServer::enable_for_stealing_focus(OS::ProcessID pid) {
  937. }
  938. Error DisplayServer::embed_process(WindowID p_window, OS::ProcessID p_pid, const Rect2i &p_rect, bool p_visible, bool p_grab_focus) {
  939. WARN_PRINT("Embedded process not supported by this display server.");
  940. return ERR_UNAVAILABLE;
  941. }
  942. Error DisplayServer::request_close_embedded_process(OS::ProcessID p_pid) {
  943. WARN_PRINT("Embedded process not supported by this display server.");
  944. return ERR_UNAVAILABLE;
  945. }
  946. Error DisplayServer::remove_embedded_process(OS::ProcessID p_pid) {
  947. WARN_PRINT("Embedded process not supported by this display server.");
  948. return ERR_UNAVAILABLE;
  949. }
  950. OS::ProcessID DisplayServer::get_focused_process_id() {
  951. WARN_PRINT("Embedded process not supported by this display server.");
  952. return 0;
  953. }
  954. Error DisplayServer::dialog_show(String p_title, String p_description, Vector<String> p_buttons, const Callable &p_callback) {
  955. WARN_PRINT("Native dialogs not supported by this display server.");
  956. return ERR_UNAVAILABLE;
  957. }
  958. Error DisplayServer::dialog_input_text(String p_title, String p_description, String p_partial, const Callable &p_callback) {
  959. WARN_PRINT("Native dialogs not supported by this display server.");
  960. return ERR_UNAVAILABLE;
  961. }
  962. Error DisplayServer::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, WindowID p_window_id) {
  963. WARN_PRINT("Native dialogs not supported by this display server.");
  964. return ERR_UNAVAILABLE;
  965. }
  966. Error DisplayServer::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, WindowID p_window_id) {
  967. WARN_PRINT("Native dialogs not supported by this display server.");
  968. return ERR_UNAVAILABLE;
  969. }
  970. void DisplayServer::beep() const {
  971. }
  972. int DisplayServer::keyboard_get_layout_count() const {
  973. return 0;
  974. }
  975. int DisplayServer::keyboard_get_current_layout() const {
  976. return -1;
  977. }
  978. void DisplayServer::keyboard_set_current_layout(int p_index) {
  979. }
  980. String DisplayServer::keyboard_get_layout_language(int p_index) const {
  981. return "";
  982. }
  983. String DisplayServer::keyboard_get_layout_name(int p_index) const {
  984. return "Not supported";
  985. }
  986. Key DisplayServer::keyboard_get_keycode_from_physical(Key p_keycode) const {
  987. ERR_FAIL_V_MSG(p_keycode, "Not supported by this display server.");
  988. }
  989. Key DisplayServer::keyboard_get_label_from_physical(Key p_keycode) const {
  990. ERR_FAIL_V_MSG(p_keycode, "Not supported by this display server.");
  991. }
  992. void DisplayServer::show_emoji_and_symbol_picker() const {
  993. }
  994. bool DisplayServer::color_picker(const Callable &p_callback) {
  995. return false;
  996. }
  997. void DisplayServer::force_process_and_drop_events() {
  998. }
  999. void DisplayServer::release_rendering_thread() {
  1000. WARN_PRINT("Rendering thread not supported by this display server.");
  1001. }
  1002. void DisplayServer::swap_buffers() {
  1003. WARN_PRINT("Swap buffers not supported by this display server.");
  1004. }
  1005. void DisplayServer::set_native_icon(const String &p_filename) {
  1006. WARN_PRINT("Native icon not supported by this display server.");
  1007. }
  1008. void DisplayServer::set_icon(const Ref<Image> &p_icon) {
  1009. WARN_PRINT("Icon not supported by this display server.");
  1010. }
  1011. DisplayServer::IndicatorID DisplayServer::create_status_indicator(const Ref<Texture2D> &p_icon, const String &p_tooltip, const Callable &p_callback) {
  1012. WARN_PRINT("Status indicator not supported by this display server.");
  1013. return INVALID_INDICATOR_ID;
  1014. }
  1015. void DisplayServer::status_indicator_set_icon(IndicatorID p_id, const Ref<Texture2D> &p_icon) {
  1016. WARN_PRINT("Status indicator not supported by this display server.");
  1017. }
  1018. void DisplayServer::status_indicator_set_tooltip(IndicatorID p_id, const String &p_tooltip) {
  1019. WARN_PRINT("Status indicator not supported by this display server.");
  1020. }
  1021. void DisplayServer::status_indicator_set_menu(IndicatorID p_id, const RID &p_menu_rid) {
  1022. WARN_PRINT("Status indicator not supported by this display server.");
  1023. }
  1024. void DisplayServer::status_indicator_set_callback(IndicatorID p_id, const Callable &p_callback) {
  1025. WARN_PRINT("Status indicator not supported by this display server.");
  1026. }
  1027. Rect2 DisplayServer::status_indicator_get_rect(IndicatorID p_id) const {
  1028. WARN_PRINT("Status indicator not supported by this display server.");
  1029. return Rect2();
  1030. }
  1031. void DisplayServer::delete_status_indicator(IndicatorID p_id) {
  1032. WARN_PRINT("Status indicator not supported by this display server.");
  1033. }
  1034. int64_t DisplayServer::window_get_native_handle(HandleType p_handle_type, WindowID p_window) const {
  1035. WARN_PRINT("Native handle not supported by this display server.");
  1036. return 0;
  1037. }
  1038. void DisplayServer::window_set_vsync_mode(DisplayServer::VSyncMode p_vsync_mode, WindowID p_window) {
  1039. WARN_PRINT("Changing the V-Sync mode is not supported by this display server.");
  1040. }
  1041. DisplayServer::VSyncMode DisplayServer::window_get_vsync_mode(WindowID p_window) const {
  1042. WARN_PRINT("Changing the V-Sync mode is not supported by this display server.");
  1043. return VSyncMode::VSYNC_ENABLED;
  1044. }
  1045. DisplayServer::WindowID DisplayServer::get_focused_window() const {
  1046. return MAIN_WINDOW_ID; // Proper value for single windows.
  1047. }
  1048. void DisplayServer::set_context(Context p_context) {
  1049. }
  1050. void DisplayServer::register_additional_output(Object *p_object) {
  1051. ObjectID id = p_object->get_instance_id();
  1052. if (!additional_outputs.has(id)) {
  1053. additional_outputs.push_back(id);
  1054. }
  1055. }
  1056. void DisplayServer::unregister_additional_output(Object *p_object) {
  1057. additional_outputs.erase(p_object->get_instance_id());
  1058. }
  1059. void DisplayServer::_bind_methods() {
  1060. ClassDB::bind_method(D_METHOD("has_feature", "feature"), &DisplayServer::has_feature);
  1061. ClassDB::bind_method(D_METHOD("get_name"), &DisplayServer::get_name);
  1062. ClassDB::bind_method(D_METHOD("help_set_search_callbacks", "search_callback", "action_callback"), &DisplayServer::help_set_search_callbacks);
  1063. #ifndef DISABLE_DEPRECATED
  1064. ClassDB::bind_method(D_METHOD("global_menu_set_popup_callbacks", "menu_root", "open_callback", "close_callback"), &DisplayServer::global_menu_set_popup_callbacks);
  1065. ClassDB::bind_method(D_METHOD("global_menu_add_submenu_item", "menu_root", "label", "submenu", "index"), &DisplayServer::global_menu_add_submenu_item, DEFVAL(-1));
  1066. ClassDB::bind_method(D_METHOD("global_menu_add_item", "menu_root", "label", "callback", "key_callback", "tag", "accelerator", "index"), &DisplayServer::global_menu_add_item, DEFVAL(Callable()), DEFVAL(Callable()), DEFVAL(Variant()), DEFVAL(Key::NONE), DEFVAL(-1));
  1067. ClassDB::bind_method(D_METHOD("global_menu_add_check_item", "menu_root", "label", "callback", "key_callback", "tag", "accelerator", "index"), &DisplayServer::global_menu_add_check_item, DEFVAL(Callable()), DEFVAL(Callable()), DEFVAL(Variant()), DEFVAL(Key::NONE), DEFVAL(-1));
  1068. ClassDB::bind_method(D_METHOD("global_menu_add_icon_item", "menu_root", "icon", "label", "callback", "key_callback", "tag", "accelerator", "index"), &DisplayServer::global_menu_add_icon_item, DEFVAL(Callable()), DEFVAL(Callable()), DEFVAL(Variant()), DEFVAL(Key::NONE), DEFVAL(-1));
  1069. ClassDB::bind_method(D_METHOD("global_menu_add_icon_check_item", "menu_root", "icon", "label", "callback", "key_callback", "tag", "accelerator", "index"), &DisplayServer::global_menu_add_icon_check_item, DEFVAL(Callable()), DEFVAL(Callable()), DEFVAL(Variant()), DEFVAL(Key::NONE), DEFVAL(-1));
  1070. ClassDB::bind_method(D_METHOD("global_menu_add_radio_check_item", "menu_root", "label", "callback", "key_callback", "tag", "accelerator", "index"), &DisplayServer::global_menu_add_radio_check_item, DEFVAL(Callable()), DEFVAL(Callable()), DEFVAL(Variant()), DEFVAL(Key::NONE), DEFVAL(-1));
  1071. ClassDB::bind_method(D_METHOD("global_menu_add_icon_radio_check_item", "menu_root", "icon", "label", "callback", "key_callback", "tag", "accelerator", "index"), &DisplayServer::global_menu_add_icon_radio_check_item, DEFVAL(Callable()), DEFVAL(Callable()), DEFVAL(Variant()), DEFVAL(Key::NONE), DEFVAL(-1));
  1072. ClassDB::bind_method(D_METHOD("global_menu_add_multistate_item", "menu_root", "label", "max_states", "default_state", "callback", "key_callback", "tag", "accelerator", "index"), &DisplayServer::global_menu_add_multistate_item, DEFVAL(Callable()), DEFVAL(Callable()), DEFVAL(Variant()), DEFVAL(Key::NONE), DEFVAL(-1));
  1073. ClassDB::bind_method(D_METHOD("global_menu_add_separator", "menu_root", "index"), &DisplayServer::global_menu_add_separator, DEFVAL(-1));
  1074. ClassDB::bind_method(D_METHOD("global_menu_get_item_index_from_text", "menu_root", "text"), &DisplayServer::global_menu_get_item_index_from_text);
  1075. ClassDB::bind_method(D_METHOD("global_menu_get_item_index_from_tag", "menu_root", "tag"), &DisplayServer::global_menu_get_item_index_from_tag);
  1076. ClassDB::bind_method(D_METHOD("global_menu_is_item_checked", "menu_root", "idx"), &DisplayServer::global_menu_is_item_checked);
  1077. ClassDB::bind_method(D_METHOD("global_menu_is_item_checkable", "menu_root", "idx"), &DisplayServer::global_menu_is_item_checkable);
  1078. ClassDB::bind_method(D_METHOD("global_menu_is_item_radio_checkable", "menu_root", "idx"), &DisplayServer::global_menu_is_item_radio_checkable);
  1079. ClassDB::bind_method(D_METHOD("global_menu_get_item_callback", "menu_root", "idx"), &DisplayServer::global_menu_get_item_callback);
  1080. ClassDB::bind_method(D_METHOD("global_menu_get_item_key_callback", "menu_root", "idx"), &DisplayServer::global_menu_get_item_key_callback);
  1081. ClassDB::bind_method(D_METHOD("global_menu_get_item_tag", "menu_root", "idx"), &DisplayServer::global_menu_get_item_tag);
  1082. ClassDB::bind_method(D_METHOD("global_menu_get_item_text", "menu_root", "idx"), &DisplayServer::global_menu_get_item_text);
  1083. ClassDB::bind_method(D_METHOD("global_menu_get_item_submenu", "menu_root", "idx"), &DisplayServer::global_menu_get_item_submenu);
  1084. ClassDB::bind_method(D_METHOD("global_menu_get_item_accelerator", "menu_root", "idx"), &DisplayServer::global_menu_get_item_accelerator);
  1085. ClassDB::bind_method(D_METHOD("global_menu_is_item_disabled", "menu_root", "idx"), &DisplayServer::global_menu_is_item_disabled);
  1086. ClassDB::bind_method(D_METHOD("global_menu_is_item_hidden", "menu_root", "idx"), &DisplayServer::global_menu_is_item_hidden);
  1087. ClassDB::bind_method(D_METHOD("global_menu_get_item_tooltip", "menu_root", "idx"), &DisplayServer::global_menu_get_item_tooltip);
  1088. ClassDB::bind_method(D_METHOD("global_menu_get_item_state", "menu_root", "idx"), &DisplayServer::global_menu_get_item_state);
  1089. ClassDB::bind_method(D_METHOD("global_menu_get_item_max_states", "menu_root", "idx"), &DisplayServer::global_menu_get_item_max_states);
  1090. ClassDB::bind_method(D_METHOD("global_menu_get_item_icon", "menu_root", "idx"), &DisplayServer::global_menu_get_item_icon);
  1091. ClassDB::bind_method(D_METHOD("global_menu_get_item_indentation_level", "menu_root", "idx"), &DisplayServer::global_menu_get_item_indentation_level);
  1092. ClassDB::bind_method(D_METHOD("global_menu_set_item_checked", "menu_root", "idx", "checked"), &DisplayServer::global_menu_set_item_checked);
  1093. ClassDB::bind_method(D_METHOD("global_menu_set_item_checkable", "menu_root", "idx", "checkable"), &DisplayServer::global_menu_set_item_checkable);
  1094. ClassDB::bind_method(D_METHOD("global_menu_set_item_radio_checkable", "menu_root", "idx", "checkable"), &DisplayServer::global_menu_set_item_radio_checkable);
  1095. ClassDB::bind_method(D_METHOD("global_menu_set_item_callback", "menu_root", "idx", "callback"), &DisplayServer::global_menu_set_item_callback);
  1096. ClassDB::bind_method(D_METHOD("global_menu_set_item_hover_callbacks", "menu_root", "idx", "callback"), &DisplayServer::global_menu_set_item_hover_callbacks);
  1097. ClassDB::bind_method(D_METHOD("global_menu_set_item_key_callback", "menu_root", "idx", "key_callback"), &DisplayServer::global_menu_set_item_key_callback);
  1098. ClassDB::bind_method(D_METHOD("global_menu_set_item_tag", "menu_root", "idx", "tag"), &DisplayServer::global_menu_set_item_tag);
  1099. ClassDB::bind_method(D_METHOD("global_menu_set_item_text", "menu_root", "idx", "text"), &DisplayServer::global_menu_set_item_text);
  1100. ClassDB::bind_method(D_METHOD("global_menu_set_item_submenu", "menu_root", "idx", "submenu"), &DisplayServer::global_menu_set_item_submenu);
  1101. ClassDB::bind_method(D_METHOD("global_menu_set_item_accelerator", "menu_root", "idx", "keycode"), &DisplayServer::global_menu_set_item_accelerator);
  1102. ClassDB::bind_method(D_METHOD("global_menu_set_item_disabled", "menu_root", "idx", "disabled"), &DisplayServer::global_menu_set_item_disabled);
  1103. ClassDB::bind_method(D_METHOD("global_menu_set_item_hidden", "menu_root", "idx", "hidden"), &DisplayServer::global_menu_set_item_hidden);
  1104. ClassDB::bind_method(D_METHOD("global_menu_set_item_tooltip", "menu_root", "idx", "tooltip"), &DisplayServer::global_menu_set_item_tooltip);
  1105. ClassDB::bind_method(D_METHOD("global_menu_set_item_state", "menu_root", "idx", "state"), &DisplayServer::global_menu_set_item_state);
  1106. ClassDB::bind_method(D_METHOD("global_menu_set_item_max_states", "menu_root", "idx", "max_states"), &DisplayServer::global_menu_set_item_max_states);
  1107. ClassDB::bind_method(D_METHOD("global_menu_set_item_icon", "menu_root", "idx", "icon"), &DisplayServer::global_menu_set_item_icon);
  1108. ClassDB::bind_method(D_METHOD("global_menu_set_item_indentation_level", "menu_root", "idx", "level"), &DisplayServer::global_menu_set_item_indentation_level);
  1109. ClassDB::bind_method(D_METHOD("global_menu_get_item_count", "menu_root"), &DisplayServer::global_menu_get_item_count);
  1110. ClassDB::bind_method(D_METHOD("global_menu_remove_item", "menu_root", "idx"), &DisplayServer::global_menu_remove_item);
  1111. ClassDB::bind_method(D_METHOD("global_menu_clear", "menu_root"), &DisplayServer::global_menu_clear);
  1112. ClassDB::bind_method(D_METHOD("global_menu_get_system_menu_roots"), &DisplayServer::global_menu_get_system_menu_roots);
  1113. #endif
  1114. ClassDB::bind_method(D_METHOD("tts_is_speaking"), &DisplayServer::tts_is_speaking);
  1115. ClassDB::bind_method(D_METHOD("tts_is_paused"), &DisplayServer::tts_is_paused);
  1116. ClassDB::bind_method(D_METHOD("tts_get_voices"), &DisplayServer::tts_get_voices);
  1117. ClassDB::bind_method(D_METHOD("tts_get_voices_for_language", "language"), &DisplayServer::tts_get_voices_for_language);
  1118. ClassDB::bind_method(D_METHOD("tts_speak", "text", "voice", "volume", "pitch", "rate", "utterance_id", "interrupt"), &DisplayServer::tts_speak, DEFVAL(50), DEFVAL(1.f), DEFVAL(1.f), DEFVAL(0), DEFVAL(false));
  1119. ClassDB::bind_method(D_METHOD("tts_pause"), &DisplayServer::tts_pause);
  1120. ClassDB::bind_method(D_METHOD("tts_resume"), &DisplayServer::tts_resume);
  1121. ClassDB::bind_method(D_METHOD("tts_stop"), &DisplayServer::tts_stop);
  1122. ClassDB::bind_method(D_METHOD("tts_set_utterance_callback", "event", "callable"), &DisplayServer::tts_set_utterance_callback);
  1123. ClassDB::bind_method(D_METHOD("_tts_post_utterance_event", "event", "id", "char_pos"), &DisplayServer::tts_post_utterance_event);
  1124. ClassDB::bind_method(D_METHOD("is_dark_mode_supported"), &DisplayServer::is_dark_mode_supported);
  1125. ClassDB::bind_method(D_METHOD("is_dark_mode"), &DisplayServer::is_dark_mode);
  1126. ClassDB::bind_method(D_METHOD("get_accent_color"), &DisplayServer::get_accent_color);
  1127. ClassDB::bind_method(D_METHOD("get_base_color"), &DisplayServer::get_base_color);
  1128. ClassDB::bind_method(D_METHOD("set_system_theme_change_callback", "callable"), &DisplayServer::set_system_theme_change_callback);
  1129. ClassDB::bind_method(D_METHOD("mouse_set_mode", "mouse_mode"), &DisplayServer::mouse_set_mode);
  1130. ClassDB::bind_method(D_METHOD("mouse_get_mode"), &DisplayServer::mouse_get_mode);
  1131. ClassDB::bind_method(D_METHOD("warp_mouse", "position"), &DisplayServer::warp_mouse);
  1132. ClassDB::bind_method(D_METHOD("mouse_get_position"), &DisplayServer::mouse_get_position);
  1133. ClassDB::bind_method(D_METHOD("mouse_get_button_state"), &DisplayServer::mouse_get_button_state);
  1134. ClassDB::bind_method(D_METHOD("clipboard_set", "clipboard"), &DisplayServer::clipboard_set);
  1135. ClassDB::bind_method(D_METHOD("clipboard_get"), &DisplayServer::clipboard_get);
  1136. ClassDB::bind_method(D_METHOD("clipboard_get_image"), &DisplayServer::clipboard_get_image);
  1137. ClassDB::bind_method(D_METHOD("clipboard_has"), &DisplayServer::clipboard_has);
  1138. ClassDB::bind_method(D_METHOD("clipboard_has_image"), &DisplayServer::clipboard_has_image);
  1139. ClassDB::bind_method(D_METHOD("clipboard_set_primary", "clipboard_primary"), &DisplayServer::clipboard_set_primary);
  1140. ClassDB::bind_method(D_METHOD("clipboard_get_primary"), &DisplayServer::clipboard_get_primary);
  1141. ClassDB::bind_method(D_METHOD("get_display_cutouts"), &DisplayServer::get_display_cutouts);
  1142. ClassDB::bind_method(D_METHOD("get_display_safe_area"), &DisplayServer::get_display_safe_area);
  1143. ClassDB::bind_method(D_METHOD("get_screen_count"), &DisplayServer::get_screen_count);
  1144. ClassDB::bind_method(D_METHOD("get_primary_screen"), &DisplayServer::get_primary_screen);
  1145. ClassDB::bind_method(D_METHOD("get_keyboard_focus_screen"), &DisplayServer::get_keyboard_focus_screen);
  1146. ClassDB::bind_method(D_METHOD("get_screen_from_rect", "rect"), &DisplayServer::get_screen_from_rect);
  1147. ClassDB::bind_method(D_METHOD("screen_get_position", "screen"), &DisplayServer::screen_get_position, DEFVAL(SCREEN_OF_MAIN_WINDOW));
  1148. ClassDB::bind_method(D_METHOD("screen_get_size", "screen"), &DisplayServer::screen_get_size, DEFVAL(SCREEN_OF_MAIN_WINDOW));
  1149. ClassDB::bind_method(D_METHOD("screen_get_usable_rect", "screen"), &DisplayServer::screen_get_usable_rect, DEFVAL(SCREEN_OF_MAIN_WINDOW));
  1150. ClassDB::bind_method(D_METHOD("screen_get_dpi", "screen"), &DisplayServer::screen_get_dpi, DEFVAL(SCREEN_OF_MAIN_WINDOW));
  1151. ClassDB::bind_method(D_METHOD("screen_get_scale", "screen"), &DisplayServer::screen_get_scale, DEFVAL(SCREEN_OF_MAIN_WINDOW));
  1152. ClassDB::bind_method(D_METHOD("is_touchscreen_available"), &DisplayServer::is_touchscreen_available);
  1153. ClassDB::bind_method(D_METHOD("screen_get_max_scale"), &DisplayServer::screen_get_max_scale);
  1154. ClassDB::bind_method(D_METHOD("screen_get_refresh_rate", "screen"), &DisplayServer::screen_get_refresh_rate, DEFVAL(SCREEN_OF_MAIN_WINDOW));
  1155. ClassDB::bind_method(D_METHOD("screen_get_pixel", "position"), &DisplayServer::screen_get_pixel);
  1156. ClassDB::bind_method(D_METHOD("screen_get_image", "screen"), &DisplayServer::screen_get_image, DEFVAL(SCREEN_OF_MAIN_WINDOW));
  1157. ClassDB::bind_method(D_METHOD("screen_get_image_rect", "rect"), &DisplayServer::screen_get_image_rect);
  1158. ClassDB::bind_method(D_METHOD("screen_set_orientation", "orientation", "screen"), &DisplayServer::screen_set_orientation, DEFVAL(SCREEN_OF_MAIN_WINDOW));
  1159. ClassDB::bind_method(D_METHOD("screen_get_orientation", "screen"), &DisplayServer::screen_get_orientation, DEFVAL(SCREEN_OF_MAIN_WINDOW));
  1160. ClassDB::bind_method(D_METHOD("screen_set_keep_on", "enable"), &DisplayServer::screen_set_keep_on);
  1161. ClassDB::bind_method(D_METHOD("screen_is_kept_on"), &DisplayServer::screen_is_kept_on);
  1162. ClassDB::bind_method(D_METHOD("get_window_list"), &DisplayServer::get_window_list);
  1163. ClassDB::bind_method(D_METHOD("get_window_at_screen_position", "position"), &DisplayServer::get_window_at_screen_position);
  1164. ClassDB::bind_method(D_METHOD("window_get_native_handle", "handle_type", "window_id"), &DisplayServer::window_get_native_handle, DEFVAL(MAIN_WINDOW_ID));
  1165. ClassDB::bind_method(D_METHOD("window_get_active_popup"), &DisplayServer::window_get_active_popup);
  1166. ClassDB::bind_method(D_METHOD("window_set_popup_safe_rect", "window", "rect"), &DisplayServer::window_set_popup_safe_rect);
  1167. ClassDB::bind_method(D_METHOD("window_get_popup_safe_rect", "window"), &DisplayServer::window_get_popup_safe_rect);
  1168. ClassDB::bind_method(D_METHOD("window_set_title", "title", "window_id"), &DisplayServer::window_set_title, DEFVAL(MAIN_WINDOW_ID));
  1169. ClassDB::bind_method(D_METHOD("window_get_title_size", "title", "window_id"), &DisplayServer::window_get_title_size, DEFVAL(MAIN_WINDOW_ID));
  1170. ClassDB::bind_method(D_METHOD("window_set_mouse_passthrough", "region", "window_id"), &DisplayServer::window_set_mouse_passthrough, DEFVAL(MAIN_WINDOW_ID));
  1171. ClassDB::bind_method(D_METHOD("window_get_current_screen", "window_id"), &DisplayServer::window_get_current_screen, DEFVAL(MAIN_WINDOW_ID));
  1172. ClassDB::bind_method(D_METHOD("window_set_current_screen", "screen", "window_id"), &DisplayServer::window_set_current_screen, DEFVAL(MAIN_WINDOW_ID));
  1173. ClassDB::bind_method(D_METHOD("window_get_position", "window_id"), &DisplayServer::window_get_position, DEFVAL(MAIN_WINDOW_ID));
  1174. ClassDB::bind_method(D_METHOD("window_get_position_with_decorations", "window_id"), &DisplayServer::window_get_position_with_decorations, DEFVAL(MAIN_WINDOW_ID));
  1175. ClassDB::bind_method(D_METHOD("window_set_position", "position", "window_id"), &DisplayServer::window_set_position, DEFVAL(MAIN_WINDOW_ID));
  1176. ClassDB::bind_method(D_METHOD("window_get_size", "window_id"), &DisplayServer::window_get_size, DEFVAL(MAIN_WINDOW_ID));
  1177. ClassDB::bind_method(D_METHOD("window_set_size", "size", "window_id"), &DisplayServer::window_set_size, DEFVAL(MAIN_WINDOW_ID));
  1178. ClassDB::bind_method(D_METHOD("window_set_rect_changed_callback", "callback", "window_id"), &DisplayServer::window_set_rect_changed_callback, DEFVAL(MAIN_WINDOW_ID));
  1179. ClassDB::bind_method(D_METHOD("window_set_window_event_callback", "callback", "window_id"), &DisplayServer::window_set_window_event_callback, DEFVAL(MAIN_WINDOW_ID));
  1180. ClassDB::bind_method(D_METHOD("window_set_input_event_callback", "callback", "window_id"), &DisplayServer::window_set_input_event_callback, DEFVAL(MAIN_WINDOW_ID));
  1181. ClassDB::bind_method(D_METHOD("window_set_input_text_callback", "callback", "window_id"), &DisplayServer::window_set_input_text_callback, DEFVAL(MAIN_WINDOW_ID));
  1182. ClassDB::bind_method(D_METHOD("window_set_drop_files_callback", "callback", "window_id"), &DisplayServer::window_set_drop_files_callback, DEFVAL(MAIN_WINDOW_ID));
  1183. ClassDB::bind_method(D_METHOD("window_get_attached_instance_id", "window_id"), &DisplayServer::window_get_attached_instance_id, DEFVAL(MAIN_WINDOW_ID));
  1184. ClassDB::bind_method(D_METHOD("window_get_max_size", "window_id"), &DisplayServer::window_get_max_size, DEFVAL(MAIN_WINDOW_ID));
  1185. ClassDB::bind_method(D_METHOD("window_set_max_size", "max_size", "window_id"), &DisplayServer::window_set_max_size, DEFVAL(MAIN_WINDOW_ID));
  1186. ClassDB::bind_method(D_METHOD("window_get_min_size", "window_id"), &DisplayServer::window_get_min_size, DEFVAL(MAIN_WINDOW_ID));
  1187. ClassDB::bind_method(D_METHOD("window_set_min_size", "min_size", "window_id"), &DisplayServer::window_set_min_size, DEFVAL(MAIN_WINDOW_ID));
  1188. ClassDB::bind_method(D_METHOD("window_get_size_with_decorations", "window_id"), &DisplayServer::window_get_size_with_decorations, DEFVAL(MAIN_WINDOW_ID));
  1189. ClassDB::bind_method(D_METHOD("window_get_mode", "window_id"), &DisplayServer::window_get_mode, DEFVAL(MAIN_WINDOW_ID));
  1190. ClassDB::bind_method(D_METHOD("window_set_mode", "mode", "window_id"), &DisplayServer::window_set_mode, DEFVAL(MAIN_WINDOW_ID));
  1191. ClassDB::bind_method(D_METHOD("window_set_flag", "flag", "enabled", "window_id"), &DisplayServer::window_set_flag, DEFVAL(MAIN_WINDOW_ID));
  1192. ClassDB::bind_method(D_METHOD("window_get_flag", "flag", "window_id"), &DisplayServer::window_get_flag, DEFVAL(MAIN_WINDOW_ID));
  1193. ClassDB::bind_method(D_METHOD("window_set_window_buttons_offset", "offset", "window_id"), &DisplayServer::window_set_window_buttons_offset, DEFVAL(MAIN_WINDOW_ID));
  1194. ClassDB::bind_method(D_METHOD("window_get_safe_title_margins", "window_id"), &DisplayServer::window_get_safe_title_margins, DEFVAL(MAIN_WINDOW_ID));
  1195. ClassDB::bind_method(D_METHOD("window_request_attention", "window_id"), &DisplayServer::window_request_attention, DEFVAL(MAIN_WINDOW_ID));
  1196. ClassDB::bind_method(D_METHOD("window_move_to_foreground", "window_id"), &DisplayServer::window_move_to_foreground, DEFVAL(MAIN_WINDOW_ID));
  1197. ClassDB::bind_method(D_METHOD("window_is_focused", "window_id"), &DisplayServer::window_is_focused, DEFVAL(MAIN_WINDOW_ID));
  1198. ClassDB::bind_method(D_METHOD("window_can_draw", "window_id"), &DisplayServer::window_can_draw, DEFVAL(MAIN_WINDOW_ID));
  1199. ClassDB::bind_method(D_METHOD("window_set_transient", "window_id", "parent_window_id"), &DisplayServer::window_set_transient);
  1200. ClassDB::bind_method(D_METHOD("window_set_exclusive", "window_id", "exclusive"), &DisplayServer::window_set_exclusive);
  1201. ClassDB::bind_method(D_METHOD("window_set_ime_active", "active", "window_id"), &DisplayServer::window_set_ime_active, DEFVAL(MAIN_WINDOW_ID));
  1202. ClassDB::bind_method(D_METHOD("window_set_ime_position", "position", "window_id"), &DisplayServer::window_set_ime_position, DEFVAL(MAIN_WINDOW_ID));
  1203. ClassDB::bind_method(D_METHOD("window_set_vsync_mode", "vsync_mode", "window_id"), &DisplayServer::window_set_vsync_mode, DEFVAL(MAIN_WINDOW_ID));
  1204. ClassDB::bind_method(D_METHOD("window_get_vsync_mode", "window_id"), &DisplayServer::window_get_vsync_mode, DEFVAL(MAIN_WINDOW_ID));
  1205. ClassDB::bind_method(D_METHOD("window_is_maximize_allowed", "window_id"), &DisplayServer::window_is_maximize_allowed, DEFVAL(MAIN_WINDOW_ID));
  1206. ClassDB::bind_method(D_METHOD("window_maximize_on_title_dbl_click"), &DisplayServer::window_maximize_on_title_dbl_click);
  1207. ClassDB::bind_method(D_METHOD("window_minimize_on_title_dbl_click"), &DisplayServer::window_minimize_on_title_dbl_click);
  1208. ClassDB::bind_method(D_METHOD("window_start_drag", "window_id"), &DisplayServer::window_start_drag, DEFVAL(MAIN_WINDOW_ID));
  1209. ClassDB::bind_method(D_METHOD("window_start_resize", "edge", "window_id"), &DisplayServer::window_start_resize, DEFVAL(MAIN_WINDOW_ID));
  1210. ClassDB::bind_method(D_METHOD("accessibility_should_increase_contrast"), &DisplayServer::accessibility_should_increase_contrast);
  1211. ClassDB::bind_method(D_METHOD("accessibility_should_reduce_animation"), &DisplayServer::accessibility_should_reduce_animation);
  1212. ClassDB::bind_method(D_METHOD("accessibility_should_reduce_transparency"), &DisplayServer::accessibility_should_reduce_transparency);
  1213. ClassDB::bind_method(D_METHOD("accessibility_screen_reader_active"), &DisplayServer::accessibility_screen_reader_active);
  1214. ClassDB::bind_method(D_METHOD("accessibility_create_element", "window_id", "role"), &DisplayServer::accessibility_create_element);
  1215. ClassDB::bind_method(D_METHOD("accessibility_create_sub_element", "parent_rid", "role", "insert_pos"), &DisplayServer::accessibility_create_sub_element, DEFVAL(-1));
  1216. ClassDB::bind_method(D_METHOD("accessibility_create_sub_text_edit_elements", "parent_rid", "shaped_text", "min_height", "insert_pos"), &DisplayServer::accessibility_create_sub_text_edit_elements, DEFVAL(-1));
  1217. ClassDB::bind_method(D_METHOD("accessibility_has_element", "id"), &DisplayServer::accessibility_has_element);
  1218. ClassDB::bind_method(D_METHOD("accessibility_free_element", "id"), &DisplayServer::accessibility_free_element);
  1219. ClassDB::bind_method(D_METHOD("accessibility_element_set_meta", "id", "meta"), &DisplayServer::accessibility_element_set_meta);
  1220. ClassDB::bind_method(D_METHOD("accessibility_element_get_meta", "id"), &DisplayServer::accessibility_element_get_meta);
  1221. ClassDB::bind_method(D_METHOD("_accessibility_update_if_active", "callback"), &DisplayServer::accessibility_update_if_active);
  1222. ClassDB::bind_method(D_METHOD("accessibility_set_window_rect", "window_id", "rect_out", "rect_in"), &DisplayServer::accessibility_set_window_rect);
  1223. ClassDB::bind_method(D_METHOD("accessibility_set_window_focused", "window_id", "focused"), &DisplayServer::accessibility_set_window_focused);
  1224. ClassDB::bind_method(D_METHOD("accessibility_update_set_focus", "id"), &DisplayServer::accessibility_update_set_focus);
  1225. ClassDB::bind_method(D_METHOD("accessibility_get_window_root", "window_id"), &DisplayServer::accessibility_get_window_root);
  1226. ClassDB::bind_method(D_METHOD("accessibility_update_set_role", "id", "role"), &DisplayServer::accessibility_update_set_role);
  1227. ClassDB::bind_method(D_METHOD("accessibility_update_set_name", "id", "name"), &DisplayServer::accessibility_update_set_name);
  1228. ClassDB::bind_method(D_METHOD("accessibility_update_set_extra_info", "id", "name"), &DisplayServer::accessibility_update_set_extra_info);
  1229. ClassDB::bind_method(D_METHOD("accessibility_update_set_description", "id", "description"), &DisplayServer::accessibility_update_set_description);
  1230. ClassDB::bind_method(D_METHOD("accessibility_update_set_value", "id", "value"), &DisplayServer::accessibility_update_set_value);
  1231. ClassDB::bind_method(D_METHOD("accessibility_update_set_tooltip", "id", "tooltip"), &DisplayServer::accessibility_update_set_tooltip);
  1232. ClassDB::bind_method(D_METHOD("accessibility_update_set_bounds", "id", "p_rect"), &DisplayServer::accessibility_update_set_bounds);
  1233. ClassDB::bind_method(D_METHOD("accessibility_update_set_transform", "id", "transform"), &DisplayServer::accessibility_update_set_transform);
  1234. ClassDB::bind_method(D_METHOD("accessibility_update_add_child", "id", "child_id"), &DisplayServer::accessibility_update_add_child);
  1235. ClassDB::bind_method(D_METHOD("accessibility_update_add_related_controls", "id", "related_id"), &DisplayServer::accessibility_update_add_related_controls);
  1236. ClassDB::bind_method(D_METHOD("accessibility_update_add_related_details", "id", "related_id"), &DisplayServer::accessibility_update_add_related_details);
  1237. ClassDB::bind_method(D_METHOD("accessibility_update_add_related_described_by", "id", "related_id"), &DisplayServer::accessibility_update_add_related_described_by);
  1238. ClassDB::bind_method(D_METHOD("accessibility_update_add_related_flow_to", "id", "related_id"), &DisplayServer::accessibility_update_add_related_flow_to);
  1239. ClassDB::bind_method(D_METHOD("accessibility_update_add_related_labeled_by", "id", "related_id"), &DisplayServer::accessibility_update_add_related_labeled_by);
  1240. ClassDB::bind_method(D_METHOD("accessibility_update_add_related_radio_group", "id", "related_id"), &DisplayServer::accessibility_update_add_related_radio_group);
  1241. ClassDB::bind_method(D_METHOD("accessibility_update_set_active_descendant", "id", "other_id"), &DisplayServer::accessibility_update_set_active_descendant);
  1242. ClassDB::bind_method(D_METHOD("accessibility_update_set_next_on_line", "id", "other_id"), &DisplayServer::accessibility_update_set_next_on_line);
  1243. ClassDB::bind_method(D_METHOD("accessibility_update_set_previous_on_line", "id", "other_id"), &DisplayServer::accessibility_update_set_previous_on_line);
  1244. ClassDB::bind_method(D_METHOD("accessibility_update_set_member_of", "id", "group_id"), &DisplayServer::accessibility_update_set_member_of);
  1245. ClassDB::bind_method(D_METHOD("accessibility_update_set_in_page_link_target", "id", "other_id"), &DisplayServer::accessibility_update_set_in_page_link_target);
  1246. ClassDB::bind_method(D_METHOD("accessibility_update_set_error_message", "id", "other_id"), &DisplayServer::accessibility_update_set_error_message);
  1247. ClassDB::bind_method(D_METHOD("accessibility_update_set_live", "id", "live"), &DisplayServer::accessibility_update_set_live);
  1248. ClassDB::bind_method(D_METHOD("accessibility_update_add_action", "id", "action", "callable"), &DisplayServer::accessibility_update_add_action);
  1249. ClassDB::bind_method(D_METHOD("accessibility_update_add_custom_action", "id", "action_id", "action_description"), &DisplayServer::accessibility_update_add_custom_action);
  1250. ClassDB::bind_method(D_METHOD("accessibility_update_set_table_row_count", "id", "count"), &DisplayServer::accessibility_update_set_table_row_count);
  1251. ClassDB::bind_method(D_METHOD("accessibility_update_set_table_column_count", "id", "count"), &DisplayServer::accessibility_update_set_table_column_count);
  1252. ClassDB::bind_method(D_METHOD("accessibility_update_set_table_row_index", "id", "index"), &DisplayServer::accessibility_update_set_table_row_index);
  1253. ClassDB::bind_method(D_METHOD("accessibility_update_set_table_column_index", "id", "index"), &DisplayServer::accessibility_update_set_table_column_index);
  1254. ClassDB::bind_method(D_METHOD("accessibility_update_set_table_cell_position", "id", "row_index", "column_index"), &DisplayServer::accessibility_update_set_table_cell_position);
  1255. ClassDB::bind_method(D_METHOD("accessibility_update_set_table_cell_span", "id", "row_span", "column_span"), &DisplayServer::accessibility_update_set_table_cell_span);
  1256. ClassDB::bind_method(D_METHOD("accessibility_update_set_list_item_count", "id", "size"), &DisplayServer::accessibility_update_set_list_item_count);
  1257. ClassDB::bind_method(D_METHOD("accessibility_update_set_list_item_index", "id", "index"), &DisplayServer::accessibility_update_set_list_item_index);
  1258. ClassDB::bind_method(D_METHOD("accessibility_update_set_list_item_level", "id", "level"), &DisplayServer::accessibility_update_set_list_item_level);
  1259. ClassDB::bind_method(D_METHOD("accessibility_update_set_list_item_selected", "id", "selected"), &DisplayServer::accessibility_update_set_list_item_selected);
  1260. ClassDB::bind_method(D_METHOD("accessibility_update_set_list_item_expanded", "id", "expanded"), &DisplayServer::accessibility_update_set_list_item_expanded);
  1261. ClassDB::bind_method(D_METHOD("accessibility_update_set_popup_type", "id", "popup"), &DisplayServer::accessibility_update_set_popup_type);
  1262. ClassDB::bind_method(D_METHOD("accessibility_update_set_checked", "id", "checekd"), &DisplayServer::accessibility_update_set_checked);
  1263. ClassDB::bind_method(D_METHOD("accessibility_update_set_num_value", "id", "position"), &DisplayServer::accessibility_update_set_num_value);
  1264. ClassDB::bind_method(D_METHOD("accessibility_update_set_num_range", "id", "min", "max"), &DisplayServer::accessibility_update_set_num_range);
  1265. ClassDB::bind_method(D_METHOD("accessibility_update_set_num_step", "id", "step"), &DisplayServer::accessibility_update_set_num_step);
  1266. ClassDB::bind_method(D_METHOD("accessibility_update_set_num_jump", "id", "jump"), &DisplayServer::accessibility_update_set_num_jump);
  1267. ClassDB::bind_method(D_METHOD("accessibility_update_set_scroll_x", "id", "position"), &DisplayServer::accessibility_update_set_scroll_x);
  1268. ClassDB::bind_method(D_METHOD("accessibility_update_set_scroll_x_range", "id", "min", "max"), &DisplayServer::accessibility_update_set_scroll_x_range);
  1269. ClassDB::bind_method(D_METHOD("accessibility_update_set_scroll_y", "id", "position"), &DisplayServer::accessibility_update_set_scroll_y);
  1270. ClassDB::bind_method(D_METHOD("accessibility_update_set_scroll_y_range", "id", "min", "max"), &DisplayServer::accessibility_update_set_scroll_y_range);
  1271. ClassDB::bind_method(D_METHOD("accessibility_update_set_text_decorations", "id", "underline", "strikethrough", "overline"), &DisplayServer::accessibility_update_set_text_decorations);
  1272. ClassDB::bind_method(D_METHOD("accessibility_update_set_text_align", "id", "align"), &DisplayServer::accessibility_update_set_text_align);
  1273. ClassDB::bind_method(D_METHOD("accessibility_update_set_text_selection", "id", "text_start_id", "start_char", "text_end_id", "end_char"), &DisplayServer::accessibility_update_set_text_selection);
  1274. ClassDB::bind_method(D_METHOD("accessibility_update_set_flag", "id", "flag", "value"), &DisplayServer::accessibility_update_set_flag);
  1275. ClassDB::bind_method(D_METHOD("accessibility_update_set_classname", "id", "classname"), &DisplayServer::accessibility_update_set_classname);
  1276. ClassDB::bind_method(D_METHOD("accessibility_update_set_placeholder", "id", "placeholder"), &DisplayServer::accessibility_update_set_placeholder);
  1277. ClassDB::bind_method(D_METHOD("accessibility_update_set_language", "id", "language"), &DisplayServer::accessibility_update_set_language);
  1278. ClassDB::bind_method(D_METHOD("accessibility_update_set_text_orientation", "id", "vertical"), &DisplayServer::accessibility_update_set_text_orientation);
  1279. ClassDB::bind_method(D_METHOD("accessibility_update_set_list_orientation", "id", "vertical"), &DisplayServer::accessibility_update_set_list_orientation);
  1280. ClassDB::bind_method(D_METHOD("accessibility_update_set_shortcut", "id", "shortcut"), &DisplayServer::accessibility_update_set_shortcut);
  1281. ClassDB::bind_method(D_METHOD("accessibility_update_set_url", "id", "url"), &DisplayServer::accessibility_update_set_url);
  1282. ClassDB::bind_method(D_METHOD("accessibility_update_set_role_description", "id", "description"), &DisplayServer::accessibility_update_set_role_description);
  1283. ClassDB::bind_method(D_METHOD("accessibility_update_set_state_description", "id", "description"), &DisplayServer::accessibility_update_set_state_description);
  1284. ClassDB::bind_method(D_METHOD("accessibility_update_set_color_value", "id", "color"), &DisplayServer::accessibility_update_set_color_value);
  1285. ClassDB::bind_method(D_METHOD("accessibility_update_set_background_color", "id", "color"), &DisplayServer::accessibility_update_set_background_color);
  1286. ClassDB::bind_method(D_METHOD("accessibility_update_set_foreground_color", "id", "color"), &DisplayServer::accessibility_update_set_foreground_color);
  1287. ClassDB::bind_method(D_METHOD("ime_get_selection"), &DisplayServer::ime_get_selection);
  1288. ClassDB::bind_method(D_METHOD("ime_get_text"), &DisplayServer::ime_get_text);
  1289. ClassDB::bind_method(D_METHOD("virtual_keyboard_show", "existing_text", "position", "type", "max_length", "cursor_start", "cursor_end"), &DisplayServer::virtual_keyboard_show, DEFVAL(Rect2()), DEFVAL(KEYBOARD_TYPE_DEFAULT), DEFVAL(-1), DEFVAL(-1), DEFVAL(-1));
  1290. ClassDB::bind_method(D_METHOD("virtual_keyboard_hide"), &DisplayServer::virtual_keyboard_hide);
  1291. ClassDB::bind_method(D_METHOD("virtual_keyboard_get_height"), &DisplayServer::virtual_keyboard_get_height);
  1292. ClassDB::bind_method(D_METHOD("has_hardware_keyboard"), &DisplayServer::has_hardware_keyboard);
  1293. ClassDB::bind_method(D_METHOD("set_hardware_keyboard_connection_change_callback", "callable"), &DisplayServer::set_hardware_keyboard_connection_change_callback);
  1294. ClassDB::bind_method(D_METHOD("cursor_set_shape", "shape"), &DisplayServer::cursor_set_shape);
  1295. ClassDB::bind_method(D_METHOD("cursor_get_shape"), &DisplayServer::cursor_get_shape);
  1296. ClassDB::bind_method(D_METHOD("cursor_set_custom_image", "cursor", "shape", "hotspot"), &DisplayServer::cursor_set_custom_image, DEFVAL(CURSOR_ARROW), DEFVAL(Vector2()));
  1297. ClassDB::bind_method(D_METHOD("get_swap_cancel_ok"), &DisplayServer::get_swap_cancel_ok);
  1298. ClassDB::bind_method(D_METHOD("enable_for_stealing_focus", "process_id"), &DisplayServer::enable_for_stealing_focus);
  1299. ClassDB::bind_method(D_METHOD("dialog_show", "title", "description", "buttons", "callback"), &DisplayServer::dialog_show);
  1300. ClassDB::bind_method(D_METHOD("dialog_input_text", "title", "description", "existing_text", "callback"), &DisplayServer::dialog_input_text);
  1301. ClassDB::bind_method(D_METHOD("file_dialog_show", "title", "current_directory", "filename", "show_hidden", "mode", "filters", "callback", "parent_window_id"), &DisplayServer::file_dialog_show, DEFVAL(MAIN_WINDOW_ID));
  1302. ClassDB::bind_method(D_METHOD("file_dialog_with_options_show", "title", "current_directory", "root", "filename", "show_hidden", "mode", "filters", "options", "callback", "parent_window_id"), &DisplayServer::file_dialog_with_options_show, DEFVAL(MAIN_WINDOW_ID));
  1303. ClassDB::bind_method(D_METHOD("beep"), &DisplayServer::beep);
  1304. ClassDB::bind_method(D_METHOD("keyboard_get_layout_count"), &DisplayServer::keyboard_get_layout_count);
  1305. ClassDB::bind_method(D_METHOD("keyboard_get_current_layout"), &DisplayServer::keyboard_get_current_layout);
  1306. ClassDB::bind_method(D_METHOD("keyboard_set_current_layout", "index"), &DisplayServer::keyboard_set_current_layout);
  1307. ClassDB::bind_method(D_METHOD("keyboard_get_layout_language", "index"), &DisplayServer::keyboard_get_layout_language);
  1308. ClassDB::bind_method(D_METHOD("keyboard_get_layout_name", "index"), &DisplayServer::keyboard_get_layout_name);
  1309. ClassDB::bind_method(D_METHOD("keyboard_get_keycode_from_physical", "keycode"), &DisplayServer::keyboard_get_keycode_from_physical);
  1310. ClassDB::bind_method(D_METHOD("keyboard_get_label_from_physical", "keycode"), &DisplayServer::keyboard_get_label_from_physical);
  1311. ClassDB::bind_method(D_METHOD("show_emoji_and_symbol_picker"), &DisplayServer::show_emoji_and_symbol_picker);
  1312. ClassDB::bind_method(D_METHOD("color_picker", "callback"), &DisplayServer::color_picker);
  1313. ClassDB::bind_method(D_METHOD("process_events"), &DisplayServer::process_events);
  1314. ClassDB::bind_method(D_METHOD("force_process_and_drop_events"), &DisplayServer::force_process_and_drop_events);
  1315. ClassDB::bind_method(D_METHOD("set_native_icon", "filename"), &DisplayServer::set_native_icon);
  1316. ClassDB::bind_method(D_METHOD("set_icon", "image"), &DisplayServer::set_icon);
  1317. ClassDB::bind_method(D_METHOD("create_status_indicator", "icon", "tooltip", "callback"), &DisplayServer::create_status_indicator);
  1318. ClassDB::bind_method(D_METHOD("status_indicator_set_icon", "id", "icon"), &DisplayServer::status_indicator_set_icon);
  1319. ClassDB::bind_method(D_METHOD("status_indicator_set_tooltip", "id", "tooltip"), &DisplayServer::status_indicator_set_tooltip);
  1320. ClassDB::bind_method(D_METHOD("status_indicator_set_menu", "id", "menu_rid"), &DisplayServer::status_indicator_set_menu);
  1321. ClassDB::bind_method(D_METHOD("status_indicator_set_callback", "id", "callback"), &DisplayServer::status_indicator_set_callback);
  1322. ClassDB::bind_method(D_METHOD("status_indicator_get_rect", "id"), &DisplayServer::status_indicator_get_rect);
  1323. ClassDB::bind_method(D_METHOD("delete_status_indicator", "id"), &DisplayServer::delete_status_indicator);
  1324. ClassDB::bind_method(D_METHOD("tablet_get_driver_count"), &DisplayServer::tablet_get_driver_count);
  1325. ClassDB::bind_method(D_METHOD("tablet_get_driver_name", "idx"), &DisplayServer::tablet_get_driver_name);
  1326. ClassDB::bind_method(D_METHOD("tablet_get_current_driver"), &DisplayServer::tablet_get_current_driver);
  1327. ClassDB::bind_method(D_METHOD("tablet_set_current_driver", "name"), &DisplayServer::tablet_set_current_driver);
  1328. ClassDB::bind_method(D_METHOD("is_window_transparency_available"), &DisplayServer::is_window_transparency_available);
  1329. ClassDB::bind_method(D_METHOD("register_additional_output", "object"), &DisplayServer::register_additional_output);
  1330. ClassDB::bind_method(D_METHOD("unregister_additional_output", "object"), &DisplayServer::unregister_additional_output);
  1331. ClassDB::bind_method(D_METHOD("has_additional_outputs"), &DisplayServer::has_additional_outputs);
  1332. #ifndef DISABLE_DEPRECATED
  1333. BIND_ENUM_CONSTANT(FEATURE_GLOBAL_MENU);
  1334. #endif
  1335. BIND_ENUM_CONSTANT(FEATURE_SUBWINDOWS);
  1336. BIND_ENUM_CONSTANT(FEATURE_TOUCHSCREEN);
  1337. BIND_ENUM_CONSTANT(FEATURE_MOUSE);
  1338. BIND_ENUM_CONSTANT(FEATURE_MOUSE_WARP);
  1339. BIND_ENUM_CONSTANT(FEATURE_CLIPBOARD);
  1340. BIND_ENUM_CONSTANT(FEATURE_VIRTUAL_KEYBOARD);
  1341. BIND_ENUM_CONSTANT(FEATURE_CURSOR_SHAPE);
  1342. BIND_ENUM_CONSTANT(FEATURE_CUSTOM_CURSOR_SHAPE);
  1343. BIND_ENUM_CONSTANT(FEATURE_NATIVE_DIALOG);
  1344. BIND_ENUM_CONSTANT(FEATURE_IME);
  1345. BIND_ENUM_CONSTANT(FEATURE_WINDOW_TRANSPARENCY);
  1346. BIND_ENUM_CONSTANT(FEATURE_HIDPI);
  1347. BIND_ENUM_CONSTANT(FEATURE_ICON);
  1348. BIND_ENUM_CONSTANT(FEATURE_NATIVE_ICON);
  1349. BIND_ENUM_CONSTANT(FEATURE_ORIENTATION);
  1350. BIND_ENUM_CONSTANT(FEATURE_SWAP_BUFFERS);
  1351. BIND_ENUM_CONSTANT(FEATURE_CLIPBOARD_PRIMARY);
  1352. BIND_ENUM_CONSTANT(FEATURE_TEXT_TO_SPEECH);
  1353. BIND_ENUM_CONSTANT(FEATURE_EXTEND_TO_TITLE);
  1354. BIND_ENUM_CONSTANT(FEATURE_SCREEN_CAPTURE);
  1355. BIND_ENUM_CONSTANT(FEATURE_STATUS_INDICATOR);
  1356. BIND_ENUM_CONSTANT(FEATURE_NATIVE_HELP);
  1357. BIND_ENUM_CONSTANT(FEATURE_NATIVE_DIALOG_INPUT);
  1358. BIND_ENUM_CONSTANT(FEATURE_NATIVE_DIALOG_FILE);
  1359. BIND_ENUM_CONSTANT(FEATURE_NATIVE_DIALOG_FILE_EXTRA);
  1360. BIND_ENUM_CONSTANT(FEATURE_WINDOW_DRAG);
  1361. BIND_ENUM_CONSTANT(FEATURE_SCREEN_EXCLUDE_FROM_CAPTURE);
  1362. BIND_ENUM_CONSTANT(FEATURE_WINDOW_EMBEDDING);
  1363. BIND_ENUM_CONSTANT(FEATURE_NATIVE_DIALOG_FILE_MIME);
  1364. BIND_ENUM_CONSTANT(FEATURE_EMOJI_AND_SYMBOL_PICKER);
  1365. BIND_ENUM_CONSTANT(FEATURE_NATIVE_COLOR_PICKER);
  1366. BIND_ENUM_CONSTANT(FEATURE_SELF_FITTING_WINDOWS);
  1367. BIND_ENUM_CONSTANT(FEATURE_ACCESSIBILITY_SCREEN_READER);
  1368. BIND_ENUM_CONSTANT(ROLE_UNKNOWN);
  1369. BIND_ENUM_CONSTANT(ROLE_DEFAULT_BUTTON);
  1370. BIND_ENUM_CONSTANT(ROLE_AUDIO);
  1371. BIND_ENUM_CONSTANT(ROLE_VIDEO);
  1372. BIND_ENUM_CONSTANT(ROLE_STATIC_TEXT);
  1373. BIND_ENUM_CONSTANT(ROLE_CONTAINER);
  1374. BIND_ENUM_CONSTANT(ROLE_PANEL);
  1375. BIND_ENUM_CONSTANT(ROLE_BUTTON);
  1376. BIND_ENUM_CONSTANT(ROLE_LINK);
  1377. BIND_ENUM_CONSTANT(ROLE_CHECK_BOX);
  1378. BIND_ENUM_CONSTANT(ROLE_RADIO_BUTTON);
  1379. BIND_ENUM_CONSTANT(ROLE_CHECK_BUTTON);
  1380. BIND_ENUM_CONSTANT(ROLE_SCROLL_BAR);
  1381. BIND_ENUM_CONSTANT(ROLE_SCROLL_VIEW);
  1382. BIND_ENUM_CONSTANT(ROLE_SPLITTER);
  1383. BIND_ENUM_CONSTANT(ROLE_SLIDER);
  1384. BIND_ENUM_CONSTANT(ROLE_SPIN_BUTTON);
  1385. BIND_ENUM_CONSTANT(ROLE_PROGRESS_INDICATOR);
  1386. BIND_ENUM_CONSTANT(ROLE_TEXT_FIELD);
  1387. BIND_ENUM_CONSTANT(ROLE_MULTILINE_TEXT_FIELD);
  1388. BIND_ENUM_CONSTANT(ROLE_COLOR_PICKER);
  1389. BIND_ENUM_CONSTANT(ROLE_TABLE);
  1390. BIND_ENUM_CONSTANT(ROLE_CELL);
  1391. BIND_ENUM_CONSTANT(ROLE_ROW);
  1392. BIND_ENUM_CONSTANT(ROLE_ROW_GROUP);
  1393. BIND_ENUM_CONSTANT(ROLE_ROW_HEADER);
  1394. BIND_ENUM_CONSTANT(ROLE_COLUMN_HEADER);
  1395. BIND_ENUM_CONSTANT(ROLE_TREE);
  1396. BIND_ENUM_CONSTANT(ROLE_TREE_ITEM);
  1397. BIND_ENUM_CONSTANT(ROLE_LIST);
  1398. BIND_ENUM_CONSTANT(ROLE_LIST_ITEM);
  1399. BIND_ENUM_CONSTANT(ROLE_LIST_BOX);
  1400. BIND_ENUM_CONSTANT(ROLE_LIST_BOX_OPTION);
  1401. BIND_ENUM_CONSTANT(ROLE_TAB_BAR);
  1402. BIND_ENUM_CONSTANT(ROLE_TAB);
  1403. BIND_ENUM_CONSTANT(ROLE_TAB_PANEL);
  1404. BIND_ENUM_CONSTANT(ROLE_MENU_BAR);
  1405. BIND_ENUM_CONSTANT(ROLE_MENU);
  1406. BIND_ENUM_CONSTANT(ROLE_MENU_ITEM);
  1407. BIND_ENUM_CONSTANT(ROLE_MENU_ITEM_CHECK_BOX);
  1408. BIND_ENUM_CONSTANT(ROLE_MENU_ITEM_RADIO);
  1409. BIND_ENUM_CONSTANT(ROLE_IMAGE);
  1410. BIND_ENUM_CONSTANT(ROLE_WINDOW);
  1411. BIND_ENUM_CONSTANT(ROLE_TITLE_BAR);
  1412. BIND_ENUM_CONSTANT(ROLE_DIALOG);
  1413. BIND_ENUM_CONSTANT(ROLE_TOOLTIP);
  1414. BIND_ENUM_CONSTANT(POPUP_UNKNOWN);
  1415. BIND_ENUM_CONSTANT(POPUP_MENU);
  1416. BIND_ENUM_CONSTANT(POPUP_LIST);
  1417. BIND_ENUM_CONSTANT(POPUP_TREE);
  1418. BIND_ENUM_CONSTANT(POPUP_DIALOG);
  1419. BIND_ENUM_CONSTANT(FLAG_HIDDEN);
  1420. BIND_ENUM_CONSTANT(FLAG_LINKED);
  1421. BIND_ENUM_CONSTANT(FLAG_MULTISELECTABLE);
  1422. BIND_ENUM_CONSTANT(FLAG_REQUIRED);
  1423. BIND_ENUM_CONSTANT(FLAG_VISITED);
  1424. BIND_ENUM_CONSTANT(FLAG_BUSY);
  1425. BIND_ENUM_CONSTANT(FLAG_MODAL);
  1426. BIND_ENUM_CONSTANT(FLAG_TOUCH_PASSTHROUGH);
  1427. BIND_ENUM_CONSTANT(FLAG_READONLY);
  1428. BIND_ENUM_CONSTANT(FLAG_DISABLED);
  1429. BIND_ENUM_CONSTANT(FLAG_CLIPS_CHILDREN);
  1430. BIND_ENUM_CONSTANT(ACTION_CLICK);
  1431. BIND_ENUM_CONSTANT(ACTION_FOCUS);
  1432. BIND_ENUM_CONSTANT(ACTION_BLUR);
  1433. BIND_ENUM_CONSTANT(ACTION_COLLAPSE);
  1434. BIND_ENUM_CONSTANT(ACTION_EXPAND);
  1435. BIND_ENUM_CONSTANT(ACTION_DECREMENT);
  1436. BIND_ENUM_CONSTANT(ACTION_INCREMENT);
  1437. BIND_ENUM_CONSTANT(ACTION_HIDE_TOOLTIP);
  1438. BIND_ENUM_CONSTANT(ACTION_SHOW_TOOLTIP);
  1439. BIND_ENUM_CONSTANT(ACTION_SET_TEXT_SELECTION);
  1440. BIND_ENUM_CONSTANT(ACTION_REPLACE_SELECTED_TEXT);
  1441. BIND_ENUM_CONSTANT(ACTION_SCROLL_BACKWARD);
  1442. BIND_ENUM_CONSTANT(ACTION_SCROLL_DOWN);
  1443. BIND_ENUM_CONSTANT(ACTION_SCROLL_FORWARD);
  1444. BIND_ENUM_CONSTANT(ACTION_SCROLL_LEFT);
  1445. BIND_ENUM_CONSTANT(ACTION_SCROLL_RIGHT);
  1446. BIND_ENUM_CONSTANT(ACTION_SCROLL_UP);
  1447. BIND_ENUM_CONSTANT(ACTION_SCROLL_INTO_VIEW);
  1448. BIND_ENUM_CONSTANT(ACTION_SCROLL_TO_POINT);
  1449. BIND_ENUM_CONSTANT(ACTION_SET_SCROLL_OFFSET);
  1450. BIND_ENUM_CONSTANT(ACTION_SET_VALUE);
  1451. BIND_ENUM_CONSTANT(ACTION_SHOW_CONTEXT_MENU);
  1452. BIND_ENUM_CONSTANT(ACTION_CUSTOM);
  1453. BIND_ENUM_CONSTANT(LIVE_OFF);
  1454. BIND_ENUM_CONSTANT(LIVE_POLITE);
  1455. BIND_ENUM_CONSTANT(LIVE_ASSERTIVE);
  1456. BIND_ENUM_CONSTANT(MOUSE_MODE_VISIBLE);
  1457. BIND_ENUM_CONSTANT(MOUSE_MODE_HIDDEN);
  1458. BIND_ENUM_CONSTANT(MOUSE_MODE_CAPTURED);
  1459. BIND_ENUM_CONSTANT(MOUSE_MODE_CONFINED);
  1460. BIND_ENUM_CONSTANT(MOUSE_MODE_CONFINED_HIDDEN);
  1461. BIND_ENUM_CONSTANT(MOUSE_MODE_MAX);
  1462. BIND_CONSTANT(SCREEN_WITH_MOUSE_FOCUS);
  1463. BIND_CONSTANT(SCREEN_WITH_KEYBOARD_FOCUS);
  1464. BIND_CONSTANT(SCREEN_PRIMARY);
  1465. BIND_CONSTANT(SCREEN_OF_MAIN_WINDOW);
  1466. BIND_CONSTANT(MAIN_WINDOW_ID);
  1467. BIND_CONSTANT(INVALID_WINDOW_ID);
  1468. BIND_CONSTANT(INVALID_INDICATOR_ID);
  1469. BIND_ENUM_CONSTANT(SCREEN_LANDSCAPE);
  1470. BIND_ENUM_CONSTANT(SCREEN_PORTRAIT);
  1471. BIND_ENUM_CONSTANT(SCREEN_REVERSE_LANDSCAPE);
  1472. BIND_ENUM_CONSTANT(SCREEN_REVERSE_PORTRAIT);
  1473. BIND_ENUM_CONSTANT(SCREEN_SENSOR_LANDSCAPE);
  1474. BIND_ENUM_CONSTANT(SCREEN_SENSOR_PORTRAIT);
  1475. BIND_ENUM_CONSTANT(SCREEN_SENSOR);
  1476. BIND_ENUM_CONSTANT(KEYBOARD_TYPE_DEFAULT);
  1477. BIND_ENUM_CONSTANT(KEYBOARD_TYPE_MULTILINE);
  1478. BIND_ENUM_CONSTANT(KEYBOARD_TYPE_NUMBER);
  1479. BIND_ENUM_CONSTANT(KEYBOARD_TYPE_NUMBER_DECIMAL);
  1480. BIND_ENUM_CONSTANT(KEYBOARD_TYPE_PHONE);
  1481. BIND_ENUM_CONSTANT(KEYBOARD_TYPE_EMAIL_ADDRESS);
  1482. BIND_ENUM_CONSTANT(KEYBOARD_TYPE_PASSWORD);
  1483. BIND_ENUM_CONSTANT(KEYBOARD_TYPE_URL);
  1484. BIND_ENUM_CONSTANT(CURSOR_ARROW);
  1485. BIND_ENUM_CONSTANT(CURSOR_IBEAM);
  1486. BIND_ENUM_CONSTANT(CURSOR_POINTING_HAND);
  1487. BIND_ENUM_CONSTANT(CURSOR_CROSS);
  1488. BIND_ENUM_CONSTANT(CURSOR_WAIT);
  1489. BIND_ENUM_CONSTANT(CURSOR_BUSY);
  1490. BIND_ENUM_CONSTANT(CURSOR_DRAG);
  1491. BIND_ENUM_CONSTANT(CURSOR_CAN_DROP);
  1492. BIND_ENUM_CONSTANT(CURSOR_FORBIDDEN);
  1493. BIND_ENUM_CONSTANT(CURSOR_VSIZE);
  1494. BIND_ENUM_CONSTANT(CURSOR_HSIZE);
  1495. BIND_ENUM_CONSTANT(CURSOR_BDIAGSIZE);
  1496. BIND_ENUM_CONSTANT(CURSOR_FDIAGSIZE);
  1497. BIND_ENUM_CONSTANT(CURSOR_MOVE);
  1498. BIND_ENUM_CONSTANT(CURSOR_VSPLIT);
  1499. BIND_ENUM_CONSTANT(CURSOR_HSPLIT);
  1500. BIND_ENUM_CONSTANT(CURSOR_HELP);
  1501. BIND_ENUM_CONSTANT(CURSOR_MAX);
  1502. BIND_ENUM_CONSTANT(FILE_DIALOG_MODE_OPEN_FILE);
  1503. BIND_ENUM_CONSTANT(FILE_DIALOG_MODE_OPEN_FILES);
  1504. BIND_ENUM_CONSTANT(FILE_DIALOG_MODE_OPEN_DIR);
  1505. BIND_ENUM_CONSTANT(FILE_DIALOG_MODE_OPEN_ANY);
  1506. BIND_ENUM_CONSTANT(FILE_DIALOG_MODE_SAVE_FILE);
  1507. BIND_ENUM_CONSTANT(WINDOW_MODE_WINDOWED);
  1508. BIND_ENUM_CONSTANT(WINDOW_MODE_MINIMIZED);
  1509. BIND_ENUM_CONSTANT(WINDOW_MODE_MAXIMIZED);
  1510. BIND_ENUM_CONSTANT(WINDOW_MODE_FULLSCREEN);
  1511. BIND_ENUM_CONSTANT(WINDOW_MODE_EXCLUSIVE_FULLSCREEN);
  1512. BIND_ENUM_CONSTANT(WINDOW_FLAG_RESIZE_DISABLED);
  1513. BIND_ENUM_CONSTANT(WINDOW_FLAG_BORDERLESS);
  1514. BIND_ENUM_CONSTANT(WINDOW_FLAG_ALWAYS_ON_TOP);
  1515. BIND_ENUM_CONSTANT(WINDOW_FLAG_TRANSPARENT);
  1516. BIND_ENUM_CONSTANT(WINDOW_FLAG_NO_FOCUS);
  1517. BIND_ENUM_CONSTANT(WINDOW_FLAG_POPUP);
  1518. BIND_ENUM_CONSTANT(WINDOW_FLAG_EXTEND_TO_TITLE);
  1519. BIND_ENUM_CONSTANT(WINDOW_FLAG_MOUSE_PASSTHROUGH);
  1520. BIND_ENUM_CONSTANT(WINDOW_FLAG_SHARP_CORNERS);
  1521. BIND_ENUM_CONSTANT(WINDOW_FLAG_EXCLUDE_FROM_CAPTURE);
  1522. BIND_ENUM_CONSTANT(WINDOW_FLAG_POPUP_WM_HINT);
  1523. BIND_ENUM_CONSTANT(WINDOW_FLAG_MINIMIZE_DISABLED);
  1524. BIND_ENUM_CONSTANT(WINDOW_FLAG_MAXIMIZE_DISABLED);
  1525. BIND_ENUM_CONSTANT(WINDOW_FLAG_MAX);
  1526. BIND_ENUM_CONSTANT(WINDOW_EVENT_MOUSE_ENTER);
  1527. BIND_ENUM_CONSTANT(WINDOW_EVENT_MOUSE_EXIT);
  1528. BIND_ENUM_CONSTANT(WINDOW_EVENT_FOCUS_IN);
  1529. BIND_ENUM_CONSTANT(WINDOW_EVENT_FOCUS_OUT);
  1530. BIND_ENUM_CONSTANT(WINDOW_EVENT_CLOSE_REQUEST);
  1531. BIND_ENUM_CONSTANT(WINDOW_EVENT_GO_BACK_REQUEST);
  1532. BIND_ENUM_CONSTANT(WINDOW_EVENT_DPI_CHANGE);
  1533. BIND_ENUM_CONSTANT(WINDOW_EVENT_TITLEBAR_CHANGE);
  1534. BIND_ENUM_CONSTANT(WINDOW_EVENT_FORCE_CLOSE);
  1535. BIND_ENUM_CONSTANT(WINDOW_EDGE_TOP_LEFT);
  1536. BIND_ENUM_CONSTANT(WINDOW_EDGE_TOP);
  1537. BIND_ENUM_CONSTANT(WINDOW_EDGE_TOP_RIGHT);
  1538. BIND_ENUM_CONSTANT(WINDOW_EDGE_LEFT);
  1539. BIND_ENUM_CONSTANT(WINDOW_EDGE_RIGHT);
  1540. BIND_ENUM_CONSTANT(WINDOW_EDGE_BOTTOM_LEFT);
  1541. BIND_ENUM_CONSTANT(WINDOW_EDGE_BOTTOM);
  1542. BIND_ENUM_CONSTANT(WINDOW_EDGE_BOTTOM_RIGHT);
  1543. BIND_ENUM_CONSTANT(WINDOW_EDGE_MAX);
  1544. BIND_ENUM_CONSTANT(VSYNC_DISABLED);
  1545. BIND_ENUM_CONSTANT(VSYNC_ENABLED);
  1546. BIND_ENUM_CONSTANT(VSYNC_ADAPTIVE);
  1547. BIND_ENUM_CONSTANT(VSYNC_MAILBOX);
  1548. BIND_ENUM_CONSTANT(DISPLAY_HANDLE);
  1549. BIND_ENUM_CONSTANT(WINDOW_HANDLE);
  1550. BIND_ENUM_CONSTANT(WINDOW_VIEW);
  1551. BIND_ENUM_CONSTANT(OPENGL_CONTEXT);
  1552. BIND_ENUM_CONSTANT(EGL_DISPLAY);
  1553. BIND_ENUM_CONSTANT(EGL_CONFIG);
  1554. BIND_ENUM_CONSTANT(TTS_UTTERANCE_STARTED);
  1555. BIND_ENUM_CONSTANT(TTS_UTTERANCE_ENDED);
  1556. BIND_ENUM_CONSTANT(TTS_UTTERANCE_CANCELED);
  1557. BIND_ENUM_CONSTANT(TTS_UTTERANCE_BOUNDARY);
  1558. }
  1559. Ref<Image> DisplayServer::_get_cursor_image_from_resource(const Ref<Resource> &p_cursor, const Vector2 &p_hotspot) {
  1560. Ref<Image> image;
  1561. ERR_FAIL_COND_V_MSG(p_hotspot.x < 0 || p_hotspot.y < 0, image, "Hotspot outside cursor image.");
  1562. Ref<Texture2D> texture = p_cursor;
  1563. if (texture.is_valid()) {
  1564. image = texture->get_image();
  1565. } else {
  1566. image = p_cursor;
  1567. }
  1568. ERR_FAIL_COND_V(image.is_null(), image);
  1569. Size2 image_size = image->get_size();
  1570. ERR_FAIL_COND_V_MSG(p_hotspot.x > image_size.width || p_hotspot.y > image_size.height, image, "Hotspot outside cursor image.");
  1571. ERR_FAIL_COND_V_MSG(image_size.width > 256 || image_size.height > 256, image, "Cursor image too big. Max supported size is 256x256.");
  1572. if (image->is_compressed()) {
  1573. image = image->duplicate(true);
  1574. Error err = image->decompress();
  1575. ERR_FAIL_COND_V_MSG(err != OK, Ref<Image>(), "Couldn't decompress VRAM-compressed custom mouse cursor image. Switch to a lossless compression mode in the Import dock.");
  1576. }
  1577. return image;
  1578. }
  1579. void DisplayServer::register_create_function(const char *p_name, CreateFunction p_function, GetRenderingDriversFunction p_get_drivers) {
  1580. ERR_FAIL_COND(server_create_count == MAX_SERVERS);
  1581. // Headless display server is always last
  1582. server_create_functions[server_create_count] = server_create_functions[server_create_count - 1];
  1583. server_create_functions[server_create_count - 1].name = p_name;
  1584. server_create_functions[server_create_count - 1].create_function = p_function;
  1585. server_create_functions[server_create_count - 1].get_rendering_drivers_function = p_get_drivers;
  1586. server_create_count++;
  1587. }
  1588. int DisplayServer::get_create_function_count() {
  1589. return server_create_count;
  1590. }
  1591. const char *DisplayServer::get_create_function_name(int p_index) {
  1592. ERR_FAIL_INDEX_V(p_index, server_create_count, nullptr);
  1593. return server_create_functions[p_index].name;
  1594. }
  1595. Vector<String> DisplayServer::get_create_function_rendering_drivers(int p_index) {
  1596. ERR_FAIL_INDEX_V(p_index, server_create_count, Vector<String>());
  1597. return server_create_functions[p_index].get_rendering_drivers_function();
  1598. }
  1599. DisplayServer *DisplayServer::create(int p_index, 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, int64_t p_parent_window, Error &r_error) {
  1600. ERR_FAIL_INDEX_V(p_index, server_create_count, nullptr);
  1601. return server_create_functions[p_index].create_function(p_rendering_driver, p_mode, p_vsync_mode, p_flags, p_position, p_resolution, p_screen, p_context, p_parent_window, r_error);
  1602. }
  1603. void DisplayServer::_input_set_mouse_mode(Input::MouseMode p_mode) {
  1604. singleton->mouse_set_mode(MouseMode(p_mode));
  1605. }
  1606. Input::MouseMode DisplayServer::_input_get_mouse_mode() {
  1607. return Input::MouseMode(singleton->mouse_get_mode());
  1608. }
  1609. void DisplayServer::_input_set_mouse_mode_override(Input::MouseMode p_mode) {
  1610. singleton->mouse_set_mode_override(MouseMode(p_mode));
  1611. }
  1612. Input::MouseMode DisplayServer::_input_get_mouse_mode_override() {
  1613. return Input::MouseMode(singleton->mouse_get_mode_override());
  1614. }
  1615. void DisplayServer::_input_set_mouse_mode_override_enabled(bool p_enabled) {
  1616. singleton->mouse_set_mode_override_enabled(p_enabled);
  1617. }
  1618. bool DisplayServer::_input_is_mouse_mode_override_enabled() {
  1619. return singleton->mouse_is_mode_override_enabled();
  1620. }
  1621. void DisplayServer::_input_warp(const Vector2 &p_to_pos) {
  1622. singleton->warp_mouse(p_to_pos);
  1623. }
  1624. Input::CursorShape DisplayServer::_input_get_current_cursor_shape() {
  1625. return (Input::CursorShape)singleton->cursor_get_shape();
  1626. }
  1627. void DisplayServer::_input_set_custom_mouse_cursor_func(const Ref<Resource> &p_image, Input::CursorShape p_shape, const Vector2 &p_hotspot) {
  1628. singleton->cursor_set_custom_image(p_image, (CursorShape)p_shape, p_hotspot);
  1629. }
  1630. bool DisplayServer::is_rendering_device_supported() {
  1631. #if defined(RD_ENABLED)
  1632. RenderingDevice *device = RenderingDevice::get_singleton();
  1633. if (device) {
  1634. return true;
  1635. }
  1636. if (supported_rendering_device == RenderingDeviceCreationStatus::SUCCESS) {
  1637. return true;
  1638. } else if (supported_rendering_device == RenderingDeviceCreationStatus::FAILURE) {
  1639. return false;
  1640. }
  1641. Error err;
  1642. #if defined(WINDOWS_ENABLED) || defined(LINUXBSD_ENABLED)
  1643. // On some drivers combining OpenGL and RenderingDevice can result in crash, offload the check to the subprocess.
  1644. List<String> arguments;
  1645. arguments.push_back("--test-rd-support");
  1646. if (get_singleton()) {
  1647. arguments.push_back("--display-driver");
  1648. arguments.push_back(get_singleton()->get_name().to_lower());
  1649. }
  1650. String pipe;
  1651. int exitcode = 0;
  1652. err = OS::get_singleton()->execute(OS::get_singleton()->get_executable_path(), arguments, &pipe, &exitcode);
  1653. if (err == OK && exitcode == 0) {
  1654. supported_rendering_device = RenderingDeviceCreationStatus::SUCCESS;
  1655. return true;
  1656. } else {
  1657. supported_rendering_device = RenderingDeviceCreationStatus::FAILURE;
  1658. }
  1659. #else // WINDOWS_ENABLED
  1660. RenderingContextDriver *rcd = nullptr;
  1661. #if defined(VULKAN_ENABLED)
  1662. rcd = memnew(RenderingContextDriverVulkan);
  1663. #endif
  1664. #ifdef D3D12_ENABLED
  1665. if (rcd == nullptr) {
  1666. rcd = memnew(RenderingContextDriverD3D12);
  1667. }
  1668. #endif
  1669. #ifdef METAL_ENABLED
  1670. if (rcd == nullptr) {
  1671. GODOT_CLANG_WARNING_PUSH_AND_IGNORE("-Wunguarded-availability")
  1672. // Eliminate "RenderingContextDriverMetal is only available on iOS 14.0 or newer".
  1673. rcd = memnew(RenderingContextDriverMetal);
  1674. GODOT_CLANG_WARNING_POP
  1675. }
  1676. #endif
  1677. if (rcd != nullptr) {
  1678. err = rcd->initialize();
  1679. if (err == OK) {
  1680. RenderingDevice *rd = memnew(RenderingDevice);
  1681. err = rd->initialize(rcd);
  1682. memdelete(rd);
  1683. rd = nullptr;
  1684. if (err == OK) {
  1685. // Creating a RenderingDevice is quite slow.
  1686. // Cache the result for future usage, so that it's much faster on subsequent calls.
  1687. supported_rendering_device = RenderingDeviceCreationStatus::SUCCESS;
  1688. memdelete(rcd);
  1689. rcd = nullptr;
  1690. return true;
  1691. } else {
  1692. supported_rendering_device = RenderingDeviceCreationStatus::FAILURE;
  1693. }
  1694. }
  1695. memdelete(rcd);
  1696. rcd = nullptr;
  1697. }
  1698. #endif // WINDOWS_ENABLED
  1699. #endif // RD_ENABLED
  1700. return false;
  1701. }
  1702. bool DisplayServer::can_create_rendering_device() {
  1703. if (get_singleton() && get_singleton()->get_name() == "headless") {
  1704. return false;
  1705. }
  1706. #if defined(RD_ENABLED)
  1707. RenderingDevice *device = RenderingDevice::get_singleton();
  1708. if (device) {
  1709. return true;
  1710. }
  1711. if (created_rendering_device == RenderingDeviceCreationStatus::SUCCESS) {
  1712. return true;
  1713. } else if (created_rendering_device == RenderingDeviceCreationStatus::FAILURE) {
  1714. return false;
  1715. }
  1716. Error err;
  1717. #ifdef WINDOWS_ENABLED
  1718. // On some NVIDIA drivers combining OpenGL and RenderingDevice can result in crash, offload the check to the subprocess.
  1719. List<String> arguments;
  1720. arguments.push_back("--test-rd-creation");
  1721. String pipe;
  1722. int exitcode = 0;
  1723. err = OS::get_singleton()->execute(OS::get_singleton()->get_executable_path(), arguments, &pipe, &exitcode);
  1724. if (err == OK && exitcode == 0) {
  1725. created_rendering_device = RenderingDeviceCreationStatus::SUCCESS;
  1726. return true;
  1727. } else {
  1728. created_rendering_device = RenderingDeviceCreationStatus::FAILURE;
  1729. }
  1730. #else // WINDOWS_ENABLED
  1731. RenderingContextDriver *rcd = nullptr;
  1732. #if defined(VULKAN_ENABLED)
  1733. rcd = memnew(RenderingContextDriverVulkan);
  1734. #endif
  1735. #ifdef D3D12_ENABLED
  1736. if (rcd == nullptr) {
  1737. rcd = memnew(RenderingContextDriverD3D12);
  1738. }
  1739. #endif
  1740. #ifdef METAL_ENABLED
  1741. if (rcd == nullptr) {
  1742. GODOT_CLANG_WARNING_PUSH_AND_IGNORE("-Wunguarded-availability")
  1743. // Eliminate "RenderingContextDriverMetal is only available on iOS 14.0 or newer".
  1744. rcd = memnew(RenderingContextDriverMetal);
  1745. GODOT_CLANG_WARNING_POP
  1746. }
  1747. #endif
  1748. if (rcd != nullptr) {
  1749. err = rcd->initialize();
  1750. if (err == OK) {
  1751. RenderingDevice *rd = memnew(RenderingDevice);
  1752. err = rd->initialize(rcd);
  1753. memdelete(rd);
  1754. rd = nullptr;
  1755. if (err == OK) {
  1756. // Creating a RenderingDevice is quite slow.
  1757. // Cache the result for future usage, so that it's much faster on subsequent calls.
  1758. created_rendering_device = RenderingDeviceCreationStatus::SUCCESS;
  1759. memdelete(rcd);
  1760. rcd = nullptr;
  1761. return true;
  1762. } else {
  1763. created_rendering_device = RenderingDeviceCreationStatus::FAILURE;
  1764. }
  1765. }
  1766. memdelete(rcd);
  1767. rcd = nullptr;
  1768. }
  1769. #endif // WINDOWS_ENABLED
  1770. #endif // RD_ENABLED
  1771. return false;
  1772. }
  1773. DisplayServer::DisplayServer() {
  1774. singleton = this;
  1775. Input::set_mouse_mode_func = _input_set_mouse_mode;
  1776. Input::get_mouse_mode_func = _input_get_mouse_mode;
  1777. Input::set_mouse_mode_override_func = _input_set_mouse_mode_override;
  1778. Input::get_mouse_mode_override_func = _input_get_mouse_mode_override;
  1779. Input::set_mouse_mode_override_enabled_func = _input_set_mouse_mode_override_enabled;
  1780. Input::is_mouse_mode_override_enabled_func = _input_is_mouse_mode_override_enabled;
  1781. Input::warp_mouse_func = _input_warp;
  1782. Input::get_current_cursor_shape_func = _input_get_current_cursor_shape;
  1783. Input::set_custom_mouse_cursor_func = _input_set_custom_mouse_cursor_func;
  1784. }
  1785. DisplayServer::~DisplayServer() {
  1786. singleton = nullptr;
  1787. }