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