Path: blob/master/servers/display/display_server.cpp
11322 views
/**************************************************************************/1/* display_server.cpp */2/**************************************************************************/3/* This file is part of: */4/* GODOT ENGINE */5/* https://godotengine.org */6/**************************************************************************/7/* Copyright (c) 2014-present Godot Engine contributors (see AUTHORS.md). */8/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */9/* */10/* Permission is hereby granted, free of charge, to any person obtaining */11/* a copy of this software and associated documentation files (the */12/* "Software"), to deal in the Software without restriction, including */13/* without limitation the rights to use, copy, modify, merge, publish, */14/* distribute, sublicense, and/or sell copies of the Software, and to */15/* permit persons to whom the Software is furnished to do so, subject to */16/* the following conditions: */17/* */18/* The above copyright notice and this permission notice shall be */19/* included in all copies or substantial portions of the Software. */20/* */21/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */22/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */23/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. */24/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */25/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */26/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */27/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */28/**************************************************************************/2930#include "display_server.h"31#include "display_server.compat.inc"3233#include "core/input/input.h"34#include "scene/resources/texture.h"35#include "servers/display/display_server_headless.h"3637#if defined(VULKAN_ENABLED)38#include "drivers/vulkan/rendering_context_driver_vulkan.h"39#undef CursorShape40#endif41#if defined(D3D12_ENABLED)42#include "drivers/d3d12/rendering_context_driver_d3d12.h"43#endif44#if defined(METAL_ENABLED)45#include "drivers/metal/rendering_context_driver_metal.h"46#endif4748DisplayServer *DisplayServer::singleton = nullptr;4950DisplayServer::AccessibilityMode DisplayServer::accessibility_mode = DisplayServer::AccessibilityMode::ACCESSIBILITY_AUTO;5152bool DisplayServer::hidpi_allowed = false;5354bool DisplayServer::window_early_clear_override_enabled = false;55Color DisplayServer::window_early_clear_override_color = Color(0, 0, 0, 0);5657DisplayServer::DisplayServerCreate DisplayServer::server_create_functions[DisplayServer::MAX_SERVERS] = {58{ "headless", &DisplayServerHeadless::create_func, &DisplayServerHeadless::get_rendering_drivers_func }59};6061int DisplayServer::server_create_count = 1;6263void DisplayServer::help_set_search_callbacks(const Callable &p_search_callback, const Callable &p_action_callback) {64WARN_PRINT("Native help is not supported by this display server.");65}6667#ifndef DISABLE_DEPRECATED6869RID DisplayServer::_get_rid_from_name(NativeMenu *p_nmenu, const String &p_menu_root) const {70if (p_menu_root == "_main") {71return p_nmenu->get_system_menu(NativeMenu::MAIN_MENU_ID);72} else if (p_menu_root == "_apple") {73return p_nmenu->get_system_menu(NativeMenu::APPLICATION_MENU_ID);74} else if (p_menu_root == "_dock") {75return p_nmenu->get_system_menu(NativeMenu::DOCK_MENU_ID);76} else if (p_menu_root == "_help") {77return p_nmenu->get_system_menu(NativeMenu::HELP_MENU_ID);78} else if (p_menu_root == "_window") {79return p_nmenu->get_system_menu(NativeMenu::WINDOW_MENU_ID);80} else if (menu_names.has(p_menu_root)) {81return menu_names[p_menu_root];82}8384RID rid = p_nmenu->create_menu();85menu_names[p_menu_root] = rid;86return rid;87}8889int 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) {90NativeMenu *nmenu = NativeMenu::get_singleton();91ERR_FAIL_NULL_V(nmenu, -1);92return nmenu->add_item(_get_rid_from_name(nmenu, p_menu_root), p_label, p_callback, p_key_callback, p_tag, p_accel, p_index);93}9495int 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) {96NativeMenu *nmenu = NativeMenu::get_singleton();97ERR_FAIL_NULL_V(nmenu, -1);98return 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);99}100101int 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) {102NativeMenu *nmenu = NativeMenu::get_singleton();103ERR_FAIL_NULL_V(nmenu, -1);104return 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);105}106107int 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) {108NativeMenu *nmenu = NativeMenu::get_singleton();109ERR_FAIL_NULL_V(nmenu, -1);110return 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);111}112113int 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) {114NativeMenu *nmenu = NativeMenu::get_singleton();115ERR_FAIL_NULL_V(nmenu, -1);116return 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);117}118119int 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) {120NativeMenu *nmenu = NativeMenu::get_singleton();121ERR_FAIL_NULL_V(nmenu, -1);122return 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);123}124125int 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) {126NativeMenu *nmenu = NativeMenu::get_singleton();127ERR_FAIL_NULL_V(nmenu, -1);128return 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);129}130131void DisplayServer::global_menu_set_popup_callbacks(const String &p_menu_root, const Callable &p_open_callback, const Callable &p_close_callback) {132NativeMenu *nmenu = NativeMenu::get_singleton();133ERR_FAIL_NULL(nmenu);134nmenu->set_popup_open_callback(_get_rid_from_name(nmenu, p_menu_root), p_open_callback);135nmenu->set_popup_open_callback(_get_rid_from_name(nmenu, p_menu_root), p_close_callback);136}137138int DisplayServer::global_menu_add_submenu_item(const String &p_menu_root, const String &p_label, const String &p_submenu, int p_index) {139NativeMenu *nmenu = NativeMenu::get_singleton();140ERR_FAIL_NULL_V(nmenu, -1);141return nmenu->add_submenu_item(_get_rid_from_name(nmenu, p_menu_root), p_label, _get_rid_from_name(nmenu, p_submenu), Variant(), p_index);142}143144int DisplayServer::global_menu_add_separator(const String &p_menu_root, int p_index) {145NativeMenu *nmenu = NativeMenu::get_singleton();146ERR_FAIL_NULL_V(nmenu, -1);147return nmenu->add_separator(_get_rid_from_name(nmenu, p_menu_root), p_index);148}149150int DisplayServer::global_menu_get_item_index_from_text(const String &p_menu_root, const String &p_text) const {151NativeMenu *nmenu = NativeMenu::get_singleton();152ERR_FAIL_NULL_V(nmenu, -1);153return nmenu->find_item_index_with_text(_get_rid_from_name(nmenu, p_menu_root), p_text);154}155156int DisplayServer::global_menu_get_item_index_from_tag(const String &p_menu_root, const Variant &p_tag) const {157NativeMenu *nmenu = NativeMenu::get_singleton();158ERR_FAIL_NULL_V(nmenu, -1);159return nmenu->find_item_index_with_tag(_get_rid_from_name(nmenu, p_menu_root), p_tag);160}161162void DisplayServer::global_menu_set_item_callback(const String &p_menu_root, int p_idx, const Callable &p_callback) {163NativeMenu *nmenu = NativeMenu::get_singleton();164ERR_FAIL_NULL(nmenu);165nmenu->set_item_callback(_get_rid_from_name(nmenu, p_menu_root), p_idx, p_callback);166}167168void DisplayServer::global_menu_set_item_hover_callbacks(const String &p_menu_root, int p_idx, const Callable &p_callback) {169NativeMenu *nmenu = NativeMenu::get_singleton();170ERR_FAIL_NULL(nmenu);171nmenu->set_item_hover_callbacks(_get_rid_from_name(nmenu, p_menu_root), p_idx, p_callback);172}173174void DisplayServer::global_menu_set_item_key_callback(const String &p_menu_root, int p_idx, const Callable &p_key_callback) {175NativeMenu *nmenu = NativeMenu::get_singleton();176ERR_FAIL_NULL(nmenu);177nmenu->set_item_key_callback(_get_rid_from_name(nmenu, p_menu_root), p_idx, p_key_callback);178}179180bool DisplayServer::global_menu_is_item_checked(const String &p_menu_root, int p_idx) const {181NativeMenu *nmenu = NativeMenu::get_singleton();182ERR_FAIL_NULL_V(nmenu, false);183return nmenu->is_item_checked(_get_rid_from_name(nmenu, p_menu_root), p_idx);184}185186bool DisplayServer::global_menu_is_item_checkable(const String &p_menu_root, int p_idx) const {187NativeMenu *nmenu = NativeMenu::get_singleton();188ERR_FAIL_NULL_V(nmenu, false);189return nmenu->is_item_checkable(_get_rid_from_name(nmenu, p_menu_root), p_idx);190}191192bool DisplayServer::global_menu_is_item_radio_checkable(const String &p_menu_root, int p_idx) const {193NativeMenu *nmenu = NativeMenu::get_singleton();194ERR_FAIL_NULL_V(nmenu, false);195return nmenu->is_item_radio_checkable(_get_rid_from_name(nmenu, p_menu_root), p_idx);196}197198Callable DisplayServer::global_menu_get_item_callback(const String &p_menu_root, int p_idx) const {199NativeMenu *nmenu = NativeMenu::get_singleton();200ERR_FAIL_NULL_V(nmenu, Callable());201return nmenu->get_item_callback(_get_rid_from_name(nmenu, p_menu_root), p_idx);202}203204Callable DisplayServer::global_menu_get_item_key_callback(const String &p_menu_root, int p_idx) const {205NativeMenu *nmenu = NativeMenu::get_singleton();206ERR_FAIL_NULL_V(nmenu, Callable());207return nmenu->get_item_key_callback(_get_rid_from_name(nmenu, p_menu_root), p_idx);208}209210Variant DisplayServer::global_menu_get_item_tag(const String &p_menu_root, int p_idx) const {211NativeMenu *nmenu = NativeMenu::get_singleton();212ERR_FAIL_NULL_V(nmenu, Variant());213return nmenu->get_item_tag(_get_rid_from_name(nmenu, p_menu_root), p_idx);214}215216String DisplayServer::global_menu_get_item_text(const String &p_menu_root, int p_idx) const {217NativeMenu *nmenu = NativeMenu::get_singleton();218ERR_FAIL_NULL_V(nmenu, String());219return nmenu->get_item_text(_get_rid_from_name(nmenu, p_menu_root), p_idx);220}221222String DisplayServer::global_menu_get_item_submenu(const String &p_menu_root, int p_idx) const {223NativeMenu *nmenu = NativeMenu::get_singleton();224ERR_FAIL_NULL_V(nmenu, String());225RID rid = nmenu->get_item_submenu(_get_rid_from_name(nmenu, p_menu_root), p_idx);226if (!nmenu->is_system_menu(rid)) {227for (HashMap<String, RID>::Iterator E = menu_names.begin(); E; ++E) {228if (E->value == rid) {229return E->key;230}231}232}233return String();234}235236Key DisplayServer::global_menu_get_item_accelerator(const String &p_menu_root, int p_idx) const {237NativeMenu *nmenu = NativeMenu::get_singleton();238ERR_FAIL_NULL_V(nmenu, Key::NONE);239return nmenu->get_item_accelerator(_get_rid_from_name(nmenu, p_menu_root), p_idx);240}241242bool DisplayServer::global_menu_is_item_disabled(const String &p_menu_root, int p_idx) const {243NativeMenu *nmenu = NativeMenu::get_singleton();244ERR_FAIL_NULL_V(nmenu, false);245return nmenu->is_item_disabled(_get_rid_from_name(nmenu, p_menu_root), p_idx);246}247248bool DisplayServer::global_menu_is_item_hidden(const String &p_menu_root, int p_idx) const {249NativeMenu *nmenu = NativeMenu::get_singleton();250ERR_FAIL_NULL_V(nmenu, false);251return nmenu->is_item_hidden(_get_rid_from_name(nmenu, p_menu_root), p_idx);252}253254String DisplayServer::global_menu_get_item_tooltip(const String &p_menu_root, int p_idx) const {255NativeMenu *nmenu = NativeMenu::get_singleton();256ERR_FAIL_NULL_V(nmenu, String());257return nmenu->get_item_tooltip(_get_rid_from_name(nmenu, p_menu_root), p_idx);258}259260int DisplayServer::global_menu_get_item_state(const String &p_menu_root, int p_idx) const {261NativeMenu *nmenu = NativeMenu::get_singleton();262ERR_FAIL_NULL_V(nmenu, -1);263return nmenu->get_item_state(_get_rid_from_name(nmenu, p_menu_root), p_idx);264}265266int DisplayServer::global_menu_get_item_max_states(const String &p_menu_root, int p_idx) const {267NativeMenu *nmenu = NativeMenu::get_singleton();268ERR_FAIL_NULL_V(nmenu, -1);269return nmenu->get_item_max_states(_get_rid_from_name(nmenu, p_menu_root), p_idx);270}271272Ref<Texture2D> DisplayServer::global_menu_get_item_icon(const String &p_menu_root, int p_idx) const {273NativeMenu *nmenu = NativeMenu::get_singleton();274ERR_FAIL_NULL_V(nmenu, Ref<Texture2D>());275return nmenu->get_item_icon(_get_rid_from_name(nmenu, p_menu_root), p_idx);276}277278int DisplayServer::global_menu_get_item_indentation_level(const String &p_menu_root, int p_idx) const {279NativeMenu *nmenu = NativeMenu::get_singleton();280ERR_FAIL_NULL_V(nmenu, 0);281return nmenu->get_item_indentation_level(_get_rid_from_name(nmenu, p_menu_root), p_idx);282}283284void DisplayServer::global_menu_set_item_checked(const String &p_menu_root, int p_idx, bool p_checked) {285NativeMenu *nmenu = NativeMenu::get_singleton();286ERR_FAIL_NULL(nmenu);287nmenu->set_item_checked(_get_rid_from_name(nmenu, p_menu_root), p_idx, p_checked);288}289290void DisplayServer::global_menu_set_item_checkable(const String &p_menu_root, int p_idx, bool p_checkable) {291NativeMenu *nmenu = NativeMenu::get_singleton();292ERR_FAIL_NULL(nmenu);293nmenu->set_item_checkable(_get_rid_from_name(nmenu, p_menu_root), p_idx, p_checkable);294}295296void DisplayServer::global_menu_set_item_radio_checkable(const String &p_menu_root, int p_idx, bool p_checkable) {297NativeMenu *nmenu = NativeMenu::get_singleton();298ERR_FAIL_NULL(nmenu);299nmenu->set_item_radio_checkable(_get_rid_from_name(nmenu, p_menu_root), p_idx, p_checkable);300}301302void DisplayServer::global_menu_set_item_tag(const String &p_menu_root, int p_idx, const Variant &p_tag) {303NativeMenu *nmenu = NativeMenu::get_singleton();304ERR_FAIL_NULL(nmenu);305nmenu->set_item_tag(_get_rid_from_name(nmenu, p_menu_root), p_idx, p_tag);306}307308void DisplayServer::global_menu_set_item_text(const String &p_menu_root, int p_idx, const String &p_text) {309NativeMenu *nmenu = NativeMenu::get_singleton();310ERR_FAIL_NULL(nmenu);311nmenu->set_item_text(_get_rid_from_name(nmenu, p_menu_root), p_idx, p_text);312}313314void DisplayServer::global_menu_set_item_submenu(const String &p_menu_root, int p_idx, const String &p_submenu) {315NativeMenu *nmenu = NativeMenu::get_singleton();316ERR_FAIL_NULL(nmenu);317nmenu->set_item_submenu(_get_rid_from_name(nmenu, p_menu_root), p_idx, _get_rid_from_name(nmenu, p_submenu));318}319320void DisplayServer::global_menu_set_item_accelerator(const String &p_menu_root, int p_idx, Key p_keycode) {321NativeMenu *nmenu = NativeMenu::get_singleton();322ERR_FAIL_NULL(nmenu);323nmenu->set_item_accelerator(_get_rid_from_name(nmenu, p_menu_root), p_idx, p_keycode);324}325326void DisplayServer::global_menu_set_item_disabled(const String &p_menu_root, int p_idx, bool p_disabled) {327NativeMenu *nmenu = NativeMenu::get_singleton();328ERR_FAIL_NULL(nmenu);329nmenu->set_item_disabled(_get_rid_from_name(nmenu, p_menu_root), p_idx, p_disabled);330}331332void DisplayServer::global_menu_set_item_hidden(const String &p_menu_root, int p_idx, bool p_hidden) {333NativeMenu *nmenu = NativeMenu::get_singleton();334ERR_FAIL_NULL(nmenu);335nmenu->set_item_hidden(_get_rid_from_name(nmenu, p_menu_root), p_idx, p_hidden);336}337338void DisplayServer::global_menu_set_item_tooltip(const String &p_menu_root, int p_idx, const String &p_tooltip) {339NativeMenu *nmenu = NativeMenu::get_singleton();340ERR_FAIL_NULL(nmenu);341nmenu->set_item_tooltip(_get_rid_from_name(nmenu, p_menu_root), p_idx, p_tooltip);342}343344void DisplayServer::global_menu_set_item_state(const String &p_menu_root, int p_idx, int p_state) {345NativeMenu *nmenu = NativeMenu::get_singleton();346ERR_FAIL_NULL(nmenu);347nmenu->set_item_state(_get_rid_from_name(nmenu, p_menu_root), p_idx, p_state);348}349350void DisplayServer::global_menu_set_item_max_states(const String &p_menu_root, int p_idx, int p_max_states) {351NativeMenu *nmenu = NativeMenu::get_singleton();352ERR_FAIL_NULL(nmenu);353nmenu->set_item_max_states(_get_rid_from_name(nmenu, p_menu_root), p_idx, p_max_states);354}355356void DisplayServer::global_menu_set_item_icon(const String &p_menu_root, int p_idx, const Ref<Texture2D> &p_icon) {357NativeMenu *nmenu = NativeMenu::get_singleton();358ERR_FAIL_NULL(nmenu);359nmenu->set_item_icon(_get_rid_from_name(nmenu, p_menu_root), p_idx, p_icon);360}361362void DisplayServer::global_menu_set_item_indentation_level(const String &p_menu_root, int p_idx, int p_level) {363NativeMenu *nmenu = NativeMenu::get_singleton();364ERR_FAIL_NULL(nmenu);365nmenu->set_item_indentation_level(_get_rid_from_name(nmenu, p_menu_root), p_idx, p_level);366}367368int DisplayServer::global_menu_get_item_count(const String &p_menu_root) const {369NativeMenu *nmenu = NativeMenu::get_singleton();370ERR_FAIL_NULL_V(nmenu, 0);371return nmenu->get_item_count(_get_rid_from_name(nmenu, p_menu_root));372}373374void DisplayServer::global_menu_remove_item(const String &p_menu_root, int p_idx) {375NativeMenu *nmenu = NativeMenu::get_singleton();376ERR_FAIL_NULL(nmenu);377nmenu->remove_item(_get_rid_from_name(nmenu, p_menu_root), p_idx);378}379380void DisplayServer::global_menu_clear(const String &p_menu_root) {381NativeMenu *nmenu = NativeMenu::get_singleton();382ERR_FAIL_NULL(nmenu);383RID rid = _get_rid_from_name(nmenu, p_menu_root);384nmenu->clear(rid);385if (!nmenu->is_system_menu(rid)) {386nmenu->free_menu(rid);387menu_names.erase(p_menu_root);388}389}390391Dictionary DisplayServer::global_menu_get_system_menu_roots() const {392NativeMenu *nmenu = NativeMenu::get_singleton();393ERR_FAIL_NULL_V(nmenu, Dictionary());394395Dictionary out;396if (nmenu->has_system_menu(NativeMenu::DOCK_MENU_ID)) {397out["_dock"] = "@Dock";398}399if (nmenu->has_system_menu(NativeMenu::APPLICATION_MENU_ID)) {400out["_apple"] = "@Apple";401}402if (nmenu->has_system_menu(NativeMenu::WINDOW_MENU_ID)) {403out["_window"] = "Window";404}405if (nmenu->has_system_menu(NativeMenu::HELP_MENU_ID)) {406out["_help"] = "Help";407}408return out;409}410411#endif412413bool DisplayServer::tts_is_speaking() const {414WARN_PRINT("TTS is not supported by this display server.");415return false;416}417418bool DisplayServer::tts_is_paused() const {419WARN_PRINT("TTS is not supported by this display server.");420return false;421}422423void DisplayServer::tts_pause() {424WARN_PRINT("TTS is not supported by this display server.");425}426427void DisplayServer::tts_resume() {428WARN_PRINT("TTS is not supported by this display server.");429}430431TypedArray<Dictionary> DisplayServer::tts_get_voices() const {432WARN_PRINT("TTS is not supported by this display server.");433return TypedArray<Dictionary>();434}435436PackedStringArray DisplayServer::tts_get_voices_for_language(const String &p_language) const {437PackedStringArray ret;438TypedArray<Dictionary> voices = tts_get_voices();439for (int i = 0; i < voices.size(); i++) {440const Dictionary &voice = voices[i];441if (voice.has("id") && voice.has("language") && voice["language"].operator String().begins_with(p_language)) {442ret.push_back(voice["id"]);443}444}445return ret;446}447448void DisplayServer::tts_speak(const String &p_text, const String &p_voice, int p_volume, float p_pitch, float p_rate, int p_utterance_id, bool p_interrupt) {449WARN_PRINT("TTS is not supported by this display server.");450}451452void DisplayServer::tts_stop() {453WARN_PRINT("TTS is not supported by this display server.");454}455456void DisplayServer::tts_set_utterance_callback(TTSUtteranceEvent p_event, const Callable &p_callable) {457ERR_FAIL_INDEX(p_event, DisplayServer::TTS_UTTERANCE_MAX);458utterance_callback[p_event] = p_callable;459}460461void DisplayServer::tts_post_utterance_event(TTSUtteranceEvent p_event, int p_id, int p_pos) {462ERR_FAIL_INDEX(p_event, DisplayServer::TTS_UTTERANCE_MAX);463switch (p_event) {464case DisplayServer::TTS_UTTERANCE_STARTED:465case DisplayServer::TTS_UTTERANCE_ENDED:466case DisplayServer::TTS_UTTERANCE_CANCELED: {467if (utterance_callback[p_event].is_valid()) {468utterance_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.469}470} break;471case DisplayServer::TTS_UTTERANCE_BOUNDARY: {472if (utterance_callback[p_event].is_valid()) {473utterance_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.474}475} break;476default:477break;478}479}480481bool DisplayServer::_get_window_early_clear_override(Color &r_color) {482if (window_early_clear_override_enabled) {483r_color = window_early_clear_override_color;484return true;485} else if (RenderingServer::get_singleton()) {486r_color = RenderingServer::get_singleton()->get_default_clear_color();487return true;488} else {489return false;490}491}492493void DisplayServer::set_early_window_clear_color_override(bool p_enabled, Color p_color) {494window_early_clear_override_enabled = p_enabled;495window_early_clear_override_color = p_color;496}497498void DisplayServer::mouse_set_mode(MouseMode p_mode) {499WARN_PRINT("Mouse is not supported by this display server.");500}501502DisplayServer::MouseMode DisplayServer::mouse_get_mode() const {503return MOUSE_MODE_VISIBLE;504}505506void DisplayServer::mouse_set_mode_override(MouseMode p_mode) {507WARN_PRINT("Mouse is not supported by this display server.");508}509510DisplayServer::MouseMode DisplayServer::mouse_get_mode_override() const {511return MOUSE_MODE_VISIBLE;512}513514void DisplayServer::mouse_set_mode_override_enabled(bool p_override_enabled) {515WARN_PRINT("Mouse is not supported by this display server.");516}517518bool DisplayServer::mouse_is_mode_override_enabled() const {519return false;520}521522void DisplayServer::warp_mouse(const Point2i &p_position) {523}524525Point2i DisplayServer::mouse_get_position() const {526ERR_FAIL_V_MSG(Point2i(), "Mouse is not supported by this display server.");527}528529BitField<MouseButtonMask> DisplayServer::mouse_get_button_state() const {530ERR_FAIL_V_MSG(MouseButtonMask::NONE, "Mouse is not supported by this display server.");531}532533void DisplayServer::clipboard_set(const String &p_text) {534WARN_PRINT("Clipboard is not supported by this display server.");535}536537String DisplayServer::clipboard_get() const {538ERR_FAIL_V_MSG(String(), "Clipboard is not supported by this display server.");539}540541Ref<Image> DisplayServer::clipboard_get_image() const {542ERR_FAIL_V_MSG(Ref<Image>(), "Clipboard is not supported by this display server.");543}544545bool DisplayServer::clipboard_has() const {546return !clipboard_get().is_empty();547}548549bool DisplayServer::clipboard_has_image() const {550return clipboard_get_image().is_valid();551}552553void DisplayServer::clipboard_set_primary(const String &p_text) {554WARN_PRINT("Primary clipboard is not supported by this display server.");555}556557String DisplayServer::clipboard_get_primary() const {558ERR_FAIL_V_MSG(String(), "Primary clipboard is not supported by this display server.");559}560561void DisplayServer::screen_set_orientation(ScreenOrientation p_orientation, int p_screen) {562WARN_PRINT("Orientation not supported by this display server.");563}564565DisplayServer::ScreenOrientation DisplayServer::screen_get_orientation(int p_screen) const {566return SCREEN_LANDSCAPE;567}568569float DisplayServer::screen_get_scale(int p_screen) const {570return 1.0f;571}572573bool DisplayServer::is_touchscreen_available() const {574return Input::get_singleton() && Input::get_singleton()->is_emulating_touch_from_mouse();575}576577void DisplayServer::screen_set_keep_on(bool p_enable) {578WARN_PRINT("Keeping screen on not supported by this display server.");579}580581bool DisplayServer::screen_is_kept_on() const {582return false;583}584585int DisplayServer::get_screen_from_rect(const Rect2 &p_rect) const {586int nearest_area = 0;587int pos_screen = INVALID_SCREEN;588for (int i = 0; i < get_screen_count(); i++) {589Rect2i r;590r.position = screen_get_position(i);591r.size = screen_get_size(i);592Rect2 inters = r.intersection(p_rect);593int area = inters.size.width * inters.size.height;594if (area > nearest_area) {595pos_screen = i;596nearest_area = area;597}598}599return pos_screen;600}601602DisplayServer::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) {603ERR_FAIL_V_MSG(INVALID_WINDOW_ID, "Sub-windows not supported by this display server.");604}605606void DisplayServer::show_window(WindowID p_id) {607ERR_FAIL_MSG("Sub-windows not supported by this display server.");608}609610void DisplayServer::delete_sub_window(WindowID p_id) {611ERR_FAIL_MSG("Sub-windows not supported by this display server.");612}613614void DisplayServer::window_set_exclusive(WindowID p_window, bool p_exclusive) {615// Do nothing, if not supported.616}617618void DisplayServer::window_set_mouse_passthrough(const Vector<Vector2> &p_region, WindowID p_window) {619ERR_FAIL_MSG("Mouse passthrough not supported by this display server.");620}621622void DisplayServer::gl_window_make_current(DisplayServer::WindowID p_window_id) {623// noop except in gles624}625626void DisplayServer::window_set_ime_active(const bool p_active, WindowID p_window) {627WARN_PRINT("IME not supported by this display server.");628}629630void DisplayServer::window_set_ime_position(const Point2i &p_pos, WindowID p_window) {631WARN_PRINT("IME not supported by this display server.");632}633634RID DisplayServer::accessibility_create_element(WindowID p_window, DisplayServer::AccessibilityRole p_role) {635if (accessibility_driver) {636return accessibility_driver->accessibility_create_element(p_window, p_role);637} else {638return RID();639}640}641642RID DisplayServer::accessibility_create_sub_element(const RID &p_parent_rid, DisplayServer::AccessibilityRole p_role, int p_insert_pos) {643if (accessibility_driver) {644return accessibility_driver->accessibility_create_sub_element(p_parent_rid, p_role, p_insert_pos);645} else {646return RID();647}648}649650RID 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) {651if (accessibility_driver) {652return accessibility_driver->accessibility_create_sub_text_edit_elements(p_parent_rid, p_shaped_text, p_min_height, p_insert_pos);653} else {654return RID();655}656}657658bool DisplayServer::accessibility_has_element(const RID &p_id) const {659if (accessibility_driver) {660return accessibility_driver->accessibility_has_element(p_id);661} else {662return false;663}664}665666void DisplayServer::accessibility_free_element(const RID &p_id) {667if (accessibility_driver) {668accessibility_driver->accessibility_free_element(p_id);669}670}671672void DisplayServer::accessibility_element_set_meta(const RID &p_id, const Variant &p_meta) {673if (accessibility_driver) {674accessibility_driver->accessibility_element_set_meta(p_id, p_meta);675}676}677678Variant DisplayServer::accessibility_element_get_meta(const RID &p_id) const {679if (accessibility_driver) {680return accessibility_driver->accessibility_element_get_meta(p_id);681} else {682return Variant();683}684}685686void DisplayServer::accessibility_update_if_active(const Callable &p_callable) {687if (accessibility_driver) {688accessibility_driver->accessibility_update_if_active(p_callable);689}690}691692void DisplayServer::accessibility_update_set_focus(const RID &p_id) {693if (accessibility_driver) {694accessibility_driver->accessibility_update_set_focus(p_id);695}696}697698RID DisplayServer::accessibility_get_window_root(DisplayServer::WindowID p_window_id) const {699if (accessibility_driver) {700return accessibility_driver->accessibility_get_window_root(p_window_id);701} else {702return RID();703}704}705706void DisplayServer::accessibility_set_window_rect(DisplayServer::WindowID p_window_id, const Rect2 &p_rect_out, const Rect2 &p_rect_in) {707if (accessibility_driver) {708accessibility_driver->accessibility_set_window_rect(p_window_id, p_rect_out, p_rect_in);709}710}711712void DisplayServer::accessibility_set_window_focused(DisplayServer::WindowID p_window_id, bool p_focused) {713if (accessibility_driver) {714accessibility_driver->accessibility_set_window_focused(p_window_id, p_focused);715}716}717718void DisplayServer::accessibility_update_set_role(const RID &p_id, DisplayServer::AccessibilityRole p_role) {719if (accessibility_driver) {720accessibility_driver->accessibility_update_set_role(p_id, p_role);721}722}723724void DisplayServer::accessibility_update_set_name(const RID &p_id, const String &p_name) {725if (accessibility_driver) {726accessibility_driver->accessibility_update_set_name(p_id, p_name);727}728}729730void DisplayServer::accessibility_update_set_description(const RID &p_id, const String &p_description) {731if (accessibility_driver) {732accessibility_driver->accessibility_update_set_description(p_id, p_description);733}734}735736void DisplayServer::accessibility_update_set_extra_info(const RID &p_id, const String &p_name_extra_info) {737if (accessibility_driver) {738accessibility_driver->accessibility_update_set_extra_info(p_id, p_name_extra_info);739}740}741742void DisplayServer::accessibility_update_set_value(const RID &p_id, const String &p_value) {743if (accessibility_driver) {744accessibility_driver->accessibility_update_set_value(p_id, p_value);745}746}747748void DisplayServer::accessibility_update_set_tooltip(const RID &p_id, const String &p_tooltip) {749if (accessibility_driver) {750accessibility_driver->accessibility_update_set_tooltip(p_id, p_tooltip);751}752}753754void DisplayServer::accessibility_update_set_bounds(const RID &p_id, const Rect2 &p_rect) {755if (accessibility_driver) {756accessibility_driver->accessibility_update_set_bounds(p_id, p_rect);757}758}759760void DisplayServer::accessibility_update_set_transform(const RID &p_id, const Transform2D &p_transform) {761if (accessibility_driver) {762accessibility_driver->accessibility_update_set_transform(p_id, p_transform);763}764}765766void DisplayServer::accessibility_update_add_child(const RID &p_id, const RID &p_child_id) {767if (accessibility_driver) {768accessibility_driver->accessibility_update_add_child(p_id, p_child_id);769}770}771772void DisplayServer::accessibility_update_add_related_controls(const RID &p_id, const RID &p_related_id) {773if (accessibility_driver) {774accessibility_driver->accessibility_update_add_related_controls(p_id, p_related_id);775}776}777778void DisplayServer::accessibility_update_add_related_details(const RID &p_id, const RID &p_related_id) {779if (accessibility_driver) {780accessibility_driver->accessibility_update_add_related_details(p_id, p_related_id);781}782}783784void DisplayServer::accessibility_update_add_related_described_by(const RID &p_id, const RID &p_related_id) {785if (accessibility_driver) {786accessibility_driver->accessibility_update_add_related_described_by(p_id, p_related_id);787}788}789790void DisplayServer::accessibility_update_add_related_flow_to(const RID &p_id, const RID &p_related_id) {791if (accessibility_driver) {792accessibility_driver->accessibility_update_add_related_flow_to(p_id, p_related_id);793}794}795796void DisplayServer::accessibility_update_add_related_labeled_by(const RID &p_id, const RID &p_related_id) {797if (accessibility_driver) {798accessibility_driver->accessibility_update_add_related_labeled_by(p_id, p_related_id);799}800}801802void DisplayServer::accessibility_update_add_related_radio_group(const RID &p_id, const RID &p_related_id) {803if (accessibility_driver) {804accessibility_driver->accessibility_update_add_related_radio_group(p_id, p_related_id);805}806}807808void DisplayServer::accessibility_update_set_active_descendant(const RID &p_id, const RID &p_other_id) {809if (accessibility_driver) {810accessibility_driver->accessibility_update_set_active_descendant(p_id, p_other_id);811}812}813814void DisplayServer::accessibility_update_set_next_on_line(const RID &p_id, const RID &p_other_id) {815if (accessibility_driver) {816accessibility_driver->accessibility_update_set_next_on_line(p_id, p_other_id);817}818}819820void DisplayServer::accessibility_update_set_previous_on_line(const RID &p_id, const RID &p_other_id) {821if (accessibility_driver) {822accessibility_driver->accessibility_update_set_previous_on_line(p_id, p_other_id);823}824}825826void DisplayServer::accessibility_update_set_member_of(const RID &p_id, const RID &p_group_id) {827if (accessibility_driver) {828accessibility_driver->accessibility_update_set_member_of(p_id, p_group_id);829}830}831832void DisplayServer::accessibility_update_set_in_page_link_target(const RID &p_id, const RID &p_other_id) {833if (accessibility_driver) {834accessibility_driver->accessibility_update_set_in_page_link_target(p_id, p_other_id);835}836}837838void DisplayServer::accessibility_update_set_error_message(const RID &p_id, const RID &p_other_id) {839if (accessibility_driver) {840accessibility_driver->accessibility_update_set_error_message(p_id, p_other_id);841}842}843844void DisplayServer::accessibility_update_set_live(const RID &p_id, DisplayServer::AccessibilityLiveMode p_live) {845if (accessibility_driver) {846accessibility_driver->accessibility_update_set_live(p_id, p_live);847}848}849850void DisplayServer::accessibility_update_add_action(const RID &p_id, DisplayServer::AccessibilityAction p_action, const Callable &p_callable) {851if (accessibility_driver) {852accessibility_driver->accessibility_update_add_action(p_id, p_action, p_callable);853}854}855856void DisplayServer::accessibility_update_add_custom_action(const RID &p_id, int p_action_id, const String &p_action_description) {857if (accessibility_driver) {858accessibility_driver->accessibility_update_add_custom_action(p_id, p_action_id, p_action_description);859}860}861862void DisplayServer::accessibility_update_set_table_row_count(const RID &p_id, int p_count) {863if (accessibility_driver) {864accessibility_driver->accessibility_update_set_table_row_count(p_id, p_count);865}866}867868void DisplayServer::accessibility_update_set_table_column_count(const RID &p_id, int p_count) {869if (accessibility_driver) {870accessibility_driver->accessibility_update_set_table_column_count(p_id, p_count);871}872}873874void DisplayServer::accessibility_update_set_table_row_index(const RID &p_id, int p_index) {875if (accessibility_driver) {876accessibility_driver->accessibility_update_set_table_row_index(p_id, p_index);877}878}879880void DisplayServer::accessibility_update_set_table_column_index(const RID &p_id, int p_index) {881if (accessibility_driver) {882accessibility_driver->accessibility_update_set_table_column_index(p_id, p_index);883}884}885886void DisplayServer::accessibility_update_set_table_cell_position(const RID &p_id, int p_row_index, int p_column_index) {887if (accessibility_driver) {888accessibility_driver->accessibility_update_set_table_cell_position(p_id, p_row_index, p_column_index);889}890}891892void DisplayServer::accessibility_update_set_table_cell_span(const RID &p_id, int p_row_span, int p_column_span) {893if (accessibility_driver) {894accessibility_driver->accessibility_update_set_table_cell_span(p_id, p_row_span, p_column_span);895}896}897898void DisplayServer::accessibility_update_set_list_item_count(const RID &p_id, int p_size) {899if (accessibility_driver) {900accessibility_driver->accessibility_update_set_list_item_count(p_id, p_size);901}902}903904void DisplayServer::accessibility_update_set_list_item_index(const RID &p_id, int p_index) {905if (accessibility_driver) {906accessibility_driver->accessibility_update_set_list_item_index(p_id, p_index);907}908}909910void DisplayServer::accessibility_update_set_list_item_level(const RID &p_id, int p_level) {911if (accessibility_driver) {912accessibility_driver->accessibility_update_set_list_item_level(p_id, p_level);913}914}915916void DisplayServer::accessibility_update_set_list_item_selected(const RID &p_id, bool p_selected) {917if (accessibility_driver) {918accessibility_driver->accessibility_update_set_list_item_selected(p_id, p_selected);919}920}921922void DisplayServer::accessibility_update_set_list_item_expanded(const RID &p_id, bool p_expanded) {923if (accessibility_driver) {924accessibility_driver->accessibility_update_set_list_item_expanded(p_id, p_expanded);925}926}927928void DisplayServer::accessibility_update_set_popup_type(const RID &p_id, DisplayServer::AccessibilityPopupType p_popup) {929if (accessibility_driver) {930accessibility_driver->accessibility_update_set_popup_type(p_id, p_popup);931}932}933934void DisplayServer::accessibility_update_set_checked(const RID &p_id, bool p_checekd) {935if (accessibility_driver) {936accessibility_driver->accessibility_update_set_checked(p_id, p_checekd);937}938}939940void DisplayServer::accessibility_update_set_num_value(const RID &p_id, double p_position) {941if (accessibility_driver) {942accessibility_driver->accessibility_update_set_num_value(p_id, p_position);943}944}945946void DisplayServer::accessibility_update_set_num_range(const RID &p_id, double p_min, double p_max) {947if (accessibility_driver) {948accessibility_driver->accessibility_update_set_num_range(p_id, p_min, p_max);949}950}951952void DisplayServer::accessibility_update_set_num_step(const RID &p_id, double p_step) {953if (accessibility_driver) {954accessibility_driver->accessibility_update_set_num_step(p_id, p_step);955}956}957958void DisplayServer::accessibility_update_set_num_jump(const RID &p_id, double p_jump) {959if (accessibility_driver) {960accessibility_driver->accessibility_update_set_num_jump(p_id, p_jump);961}962}963964void DisplayServer::accessibility_update_set_scroll_x(const RID &p_id, double p_position) {965if (accessibility_driver) {966accessibility_driver->accessibility_update_set_scroll_x(p_id, p_position);967}968}969970void DisplayServer::accessibility_update_set_scroll_x_range(const RID &p_id, double p_min, double p_max) {971if (accessibility_driver) {972accessibility_driver->accessibility_update_set_scroll_x_range(p_id, p_min, p_max);973}974}975976void DisplayServer::accessibility_update_set_scroll_y(const RID &p_id, double p_position) {977if (accessibility_driver) {978accessibility_driver->accessibility_update_set_scroll_y(p_id, p_position);979}980}981982void DisplayServer::accessibility_update_set_scroll_y_range(const RID &p_id, double p_min, double p_max) {983if (accessibility_driver) {984accessibility_driver->accessibility_update_set_scroll_y_range(p_id, p_min, p_max);985}986}987988void DisplayServer::accessibility_update_set_text_decorations(const RID &p_id, bool p_underline, bool p_strikethrough, bool p_overline) {989if (accessibility_driver) {990accessibility_driver->accessibility_update_set_text_decorations(p_id, p_underline, p_strikethrough, p_overline);991}992}993994void DisplayServer::accessibility_update_set_text_align(const RID &p_id, HorizontalAlignment p_align) {995if (accessibility_driver) {996accessibility_driver->accessibility_update_set_text_align(p_id, p_align);997}998}9991000void 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) {1001if (accessibility_driver) {1002accessibility_driver->accessibility_update_set_text_selection(p_id, p_text_start_id, p_start_char, p_text_end_id, p_end_char);1003}1004}10051006void DisplayServer::accessibility_update_set_flag(const RID &p_id, DisplayServer::AccessibilityFlags p_flag, bool p_value) {1007if (accessibility_driver) {1008accessibility_driver->accessibility_update_set_flag(p_id, p_flag, p_value);1009}1010}10111012void DisplayServer::accessibility_update_set_classname(const RID &p_id, const String &p_classname) {1013if (accessibility_driver) {1014accessibility_driver->accessibility_update_set_classname(p_id, p_classname);1015}1016}10171018void DisplayServer::accessibility_update_set_placeholder(const RID &p_id, const String &p_placeholder) {1019if (accessibility_driver) {1020accessibility_driver->accessibility_update_set_placeholder(p_id, p_placeholder);1021}1022}10231024void DisplayServer::accessibility_update_set_language(const RID &p_id, const String &p_language) {1025if (accessibility_driver) {1026accessibility_driver->accessibility_update_set_language(p_id, p_language);1027}1028}10291030void DisplayServer::accessibility_update_set_text_orientation(const RID &p_id, bool p_vertical) {1031if (accessibility_driver) {1032accessibility_driver->accessibility_update_set_text_orientation(p_id, p_vertical);1033}1034}10351036void DisplayServer::accessibility_update_set_list_orientation(const RID &p_id, bool p_vertical) {1037if (accessibility_driver) {1038accessibility_driver->accessibility_update_set_list_orientation(p_id, p_vertical);1039}1040}10411042void DisplayServer::accessibility_update_set_shortcut(const RID &p_id, const String &p_shortcut) {1043if (accessibility_driver) {1044accessibility_driver->accessibility_update_set_shortcut(p_id, p_shortcut);1045}1046}10471048void DisplayServer::accessibility_update_set_url(const RID &p_id, const String &p_url) {1049if (accessibility_driver) {1050accessibility_driver->accessibility_update_set_url(p_id, p_url);1051}1052}10531054void DisplayServer::accessibility_update_set_role_description(const RID &p_id, const String &p_description) {1055if (accessibility_driver) {1056accessibility_driver->accessibility_update_set_role_description(p_id, p_description);1057}1058}10591060void DisplayServer::accessibility_update_set_state_description(const RID &p_id, const String &p_description) {1061if (accessibility_driver) {1062accessibility_driver->accessibility_update_set_state_description(p_id, p_description);1063}1064}10651066void DisplayServer::accessibility_update_set_color_value(const RID &p_id, const Color &p_color) {1067if (accessibility_driver) {1068accessibility_driver->accessibility_update_set_color_value(p_id, p_color);1069}1070}10711072void DisplayServer::accessibility_update_set_background_color(const RID &p_id, const Color &p_color) {1073if (accessibility_driver) {1074accessibility_driver->accessibility_update_set_background_color(p_id, p_color);1075}1076}10771078void DisplayServer::accessibility_update_set_foreground_color(const RID &p_id, const Color &p_color) {1079if (accessibility_driver) {1080accessibility_driver->accessibility_update_set_foreground_color(p_id, p_color);1081}1082}10831084Point2i DisplayServer::ime_get_selection() const {1085ERR_FAIL_V_MSG(Point2i(), "IME or NOTIFICATION_WM_IME_UPDATE not supported by this display server.");1086}10871088String DisplayServer::ime_get_text() const {1089ERR_FAIL_V_MSG(String(), "IME or NOTIFICATION_WM_IME_UPDATE not supported by this display server.");1090}10911092void 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) {1093WARN_PRINT("Virtual keyboard not supported by this display server.");1094}10951096void DisplayServer::virtual_keyboard_hide() {1097WARN_PRINT("Virtual keyboard not supported by this display server.");1098}10991100// returns height of the currently shown keyboard (0 if keyboard is hidden)1101int DisplayServer::virtual_keyboard_get_height() const {1102WARN_PRINT("Virtual keyboard not supported by this display server.");1103return 0;1104}11051106bool DisplayServer::has_hardware_keyboard() const {1107return true;1108}11091110void DisplayServer::cursor_set_shape(CursorShape p_shape) {1111WARN_PRINT("Cursor shape not supported by this display server.");1112}11131114DisplayServer::CursorShape DisplayServer::cursor_get_shape() const {1115return CURSOR_ARROW;1116}11171118void DisplayServer::cursor_set_custom_image(const Ref<Resource> &p_cursor, CursorShape p_shape, const Vector2 &p_hotspot) {1119WARN_PRINT("Custom cursor shape not supported by this display server.");1120}11211122bool DisplayServer::get_swap_cancel_ok() {1123return false;1124}11251126void DisplayServer::enable_for_stealing_focus(OS::ProcessID pid) {1127}11281129Error DisplayServer::embed_process(WindowID p_window, OS::ProcessID p_pid, const Rect2i &p_rect, bool p_visible, bool p_grab_focus) {1130WARN_PRINT("Embedded process not supported by this display server.");1131return ERR_UNAVAILABLE;1132}11331134Error DisplayServer::request_close_embedded_process(OS::ProcessID p_pid) {1135WARN_PRINT("Embedded process not supported by this display server.");1136return ERR_UNAVAILABLE;1137}11381139Error DisplayServer::remove_embedded_process(OS::ProcessID p_pid) {1140WARN_PRINT("Embedded process not supported by this display server.");1141return ERR_UNAVAILABLE;1142}11431144OS::ProcessID DisplayServer::get_focused_process_id() {1145WARN_PRINT("Embedded process not supported by this display server.");1146return 0;1147}11481149Error DisplayServer::dialog_show(String p_title, String p_description, Vector<String> p_buttons, const Callable &p_callback) {1150WARN_PRINT("Native dialogs not supported by this display server.");1151return ERR_UNAVAILABLE;1152}11531154Error DisplayServer::dialog_input_text(String p_title, String p_description, String p_partial, const Callable &p_callback) {1155WARN_PRINT("Native dialogs not supported by this display server.");1156return ERR_UNAVAILABLE;1157}11581159Error 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) {1160WARN_PRINT("Native dialogs not supported by this display server.");1161return ERR_UNAVAILABLE;1162}11631164Error 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) {1165WARN_PRINT("Native dialogs not supported by this display server.");1166return ERR_UNAVAILABLE;1167}11681169void DisplayServer::beep() const {1170}11711172int DisplayServer::keyboard_get_layout_count() const {1173return 0;1174}11751176int DisplayServer::keyboard_get_current_layout() const {1177return -1;1178}11791180void DisplayServer::keyboard_set_current_layout(int p_index) {1181}11821183String DisplayServer::keyboard_get_layout_language(int p_index) const {1184return "";1185}11861187String DisplayServer::keyboard_get_layout_name(int p_index) const {1188return "Not supported";1189}11901191Key DisplayServer::keyboard_get_keycode_from_physical(Key p_keycode) const {1192ERR_FAIL_V_MSG(p_keycode, "Not supported by this display server.");1193}11941195Key DisplayServer::keyboard_get_label_from_physical(Key p_keycode) const {1196ERR_FAIL_V_MSG(p_keycode, "Not supported by this display server.");1197}11981199void DisplayServer::show_emoji_and_symbol_picker() const {1200}12011202bool DisplayServer::color_picker(const Callable &p_callback) {1203return false;1204}12051206void DisplayServer::force_process_and_drop_events() {1207}12081209void DisplayServer::release_rendering_thread() {1210WARN_PRINT("Rendering thread not supported by this display server.");1211}12121213void DisplayServer::swap_buffers() {1214WARN_PRINT("Swap buffers not supported by this display server.");1215}12161217void DisplayServer::set_native_icon(const String &p_filename) {1218WARN_PRINT("Native icon not supported by this display server.");1219}12201221void DisplayServer::set_icon(const Ref<Image> &p_icon) {1222WARN_PRINT("Icon not supported by this display server.");1223}12241225DisplayServer::IndicatorID DisplayServer::create_status_indicator(const Ref<Texture2D> &p_icon, const String &p_tooltip, const Callable &p_callback) {1226WARN_PRINT("Status indicator not supported by this display server.");1227return INVALID_INDICATOR_ID;1228}12291230void DisplayServer::status_indicator_set_icon(IndicatorID p_id, const Ref<Texture2D> &p_icon) {1231WARN_PRINT("Status indicator not supported by this display server.");1232}12331234void DisplayServer::status_indicator_set_tooltip(IndicatorID p_id, const String &p_tooltip) {1235WARN_PRINT("Status indicator not supported by this display server.");1236}12371238void DisplayServer::status_indicator_set_menu(IndicatorID p_id, const RID &p_menu_rid) {1239WARN_PRINT("Status indicator not supported by this display server.");1240}12411242void DisplayServer::status_indicator_set_callback(IndicatorID p_id, const Callable &p_callback) {1243WARN_PRINT("Status indicator not supported by this display server.");1244}12451246Rect2 DisplayServer::status_indicator_get_rect(IndicatorID p_id) const {1247WARN_PRINT("Status indicator not supported by this display server.");1248return Rect2();1249}12501251void DisplayServer::delete_status_indicator(IndicatorID p_id) {1252WARN_PRINT("Status indicator not supported by this display server.");1253}12541255int64_t DisplayServer::window_get_native_handle(HandleType p_handle_type, WindowID p_window) const {1256WARN_PRINT("Native handle not supported by this display server.");1257return 0;1258}12591260void DisplayServer::window_set_vsync_mode(DisplayServer::VSyncMode p_vsync_mode, WindowID p_window) {1261WARN_PRINT("Changing the V-Sync mode is not supported by this display server.");1262}12631264DisplayServer::VSyncMode DisplayServer::window_get_vsync_mode(WindowID p_window) const {1265WARN_PRINT("Changing the V-Sync mode is not supported by this display server.");1266return VSyncMode::VSYNC_ENABLED;1267}12681269DisplayServer::WindowID DisplayServer::get_focused_window() const {1270return MAIN_WINDOW_ID; // Proper value for single windows.1271}12721273void DisplayServer::set_context(Context p_context) {1274}12751276void DisplayServer::register_additional_output(Object *p_object) {1277ObjectID id = p_object->get_instance_id();1278if (!additional_outputs.has(id)) {1279additional_outputs.push_back(id);1280}1281}12821283void DisplayServer::unregister_additional_output(Object *p_object) {1284additional_outputs.erase(p_object->get_instance_id());1285}12861287void DisplayServer::_bind_methods() {1288ClassDB::bind_method(D_METHOD("has_feature", "feature"), &DisplayServer::has_feature);1289ClassDB::bind_method(D_METHOD("get_name"), &DisplayServer::get_name);12901291ClassDB::bind_method(D_METHOD("help_set_search_callbacks", "search_callback", "action_callback"), &DisplayServer::help_set_search_callbacks);12921293#ifndef DISABLE_DEPRECATED1294ClassDB::bind_method(D_METHOD("global_menu_set_popup_callbacks", "menu_root", "open_callback", "close_callback"), &DisplayServer::global_menu_set_popup_callbacks);1295ClassDB::bind_method(D_METHOD("global_menu_add_submenu_item", "menu_root", "label", "submenu", "index"), &DisplayServer::global_menu_add_submenu_item, DEFVAL(-1));1296ClassDB::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));1297ClassDB::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));1298ClassDB::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));1299ClassDB::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));1300ClassDB::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));1301ClassDB::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));1302ClassDB::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));1303ClassDB::bind_method(D_METHOD("global_menu_add_separator", "menu_root", "index"), &DisplayServer::global_menu_add_separator, DEFVAL(-1));13041305ClassDB::bind_method(D_METHOD("global_menu_get_item_index_from_text", "menu_root", "text"), &DisplayServer::global_menu_get_item_index_from_text);1306ClassDB::bind_method(D_METHOD("global_menu_get_item_index_from_tag", "menu_root", "tag"), &DisplayServer::global_menu_get_item_index_from_tag);13071308ClassDB::bind_method(D_METHOD("global_menu_is_item_checked", "menu_root", "idx"), &DisplayServer::global_menu_is_item_checked);1309ClassDB::bind_method(D_METHOD("global_menu_is_item_checkable", "menu_root", "idx"), &DisplayServer::global_menu_is_item_checkable);1310ClassDB::bind_method(D_METHOD("global_menu_is_item_radio_checkable", "menu_root", "idx"), &DisplayServer::global_menu_is_item_radio_checkable);1311ClassDB::bind_method(D_METHOD("global_menu_get_item_callback", "menu_root", "idx"), &DisplayServer::global_menu_get_item_callback);1312ClassDB::bind_method(D_METHOD("global_menu_get_item_key_callback", "menu_root", "idx"), &DisplayServer::global_menu_get_item_key_callback);1313ClassDB::bind_method(D_METHOD("global_menu_get_item_tag", "menu_root", "idx"), &DisplayServer::global_menu_get_item_tag);1314ClassDB::bind_method(D_METHOD("global_menu_get_item_text", "menu_root", "idx"), &DisplayServer::global_menu_get_item_text);1315ClassDB::bind_method(D_METHOD("global_menu_get_item_submenu", "menu_root", "idx"), &DisplayServer::global_menu_get_item_submenu);1316ClassDB::bind_method(D_METHOD("global_menu_get_item_accelerator", "menu_root", "idx"), &DisplayServer::global_menu_get_item_accelerator);1317ClassDB::bind_method(D_METHOD("global_menu_is_item_disabled", "menu_root", "idx"), &DisplayServer::global_menu_is_item_disabled);1318ClassDB::bind_method(D_METHOD("global_menu_is_item_hidden", "menu_root", "idx"), &DisplayServer::global_menu_is_item_hidden);1319ClassDB::bind_method(D_METHOD("global_menu_get_item_tooltip", "menu_root", "idx"), &DisplayServer::global_menu_get_item_tooltip);1320ClassDB::bind_method(D_METHOD("global_menu_get_item_state", "menu_root", "idx"), &DisplayServer::global_menu_get_item_state);1321ClassDB::bind_method(D_METHOD("global_menu_get_item_max_states", "menu_root", "idx"), &DisplayServer::global_menu_get_item_max_states);1322ClassDB::bind_method(D_METHOD("global_menu_get_item_icon", "menu_root", "idx"), &DisplayServer::global_menu_get_item_icon);1323ClassDB::bind_method(D_METHOD("global_menu_get_item_indentation_level", "menu_root", "idx"), &DisplayServer::global_menu_get_item_indentation_level);13241325ClassDB::bind_method(D_METHOD("global_menu_set_item_checked", "menu_root", "idx", "checked"), &DisplayServer::global_menu_set_item_checked);1326ClassDB::bind_method(D_METHOD("global_menu_set_item_checkable", "menu_root", "idx", "checkable"), &DisplayServer::global_menu_set_item_checkable);1327ClassDB::bind_method(D_METHOD("global_menu_set_item_radio_checkable", "menu_root", "idx", "checkable"), &DisplayServer::global_menu_set_item_radio_checkable);1328ClassDB::bind_method(D_METHOD("global_menu_set_item_callback", "menu_root", "idx", "callback"), &DisplayServer::global_menu_set_item_callback);1329ClassDB::bind_method(D_METHOD("global_menu_set_item_hover_callbacks", "menu_root", "idx", "callback"), &DisplayServer::global_menu_set_item_hover_callbacks);1330ClassDB::bind_method(D_METHOD("global_menu_set_item_key_callback", "menu_root", "idx", "key_callback"), &DisplayServer::global_menu_set_item_key_callback);1331ClassDB::bind_method(D_METHOD("global_menu_set_item_tag", "menu_root", "idx", "tag"), &DisplayServer::global_menu_set_item_tag);1332ClassDB::bind_method(D_METHOD("global_menu_set_item_text", "menu_root", "idx", "text"), &DisplayServer::global_menu_set_item_text);1333ClassDB::bind_method(D_METHOD("global_menu_set_item_submenu", "menu_root", "idx", "submenu"), &DisplayServer::global_menu_set_item_submenu);1334ClassDB::bind_method(D_METHOD("global_menu_set_item_accelerator", "menu_root", "idx", "keycode"), &DisplayServer::global_menu_set_item_accelerator);1335ClassDB::bind_method(D_METHOD("global_menu_set_item_disabled", "menu_root", "idx", "disabled"), &DisplayServer::global_menu_set_item_disabled);1336ClassDB::bind_method(D_METHOD("global_menu_set_item_hidden", "menu_root", "idx", "hidden"), &DisplayServer::global_menu_set_item_hidden);1337ClassDB::bind_method(D_METHOD("global_menu_set_item_tooltip", "menu_root", "idx", "tooltip"), &DisplayServer::global_menu_set_item_tooltip);1338ClassDB::bind_method(D_METHOD("global_menu_set_item_state", "menu_root", "idx", "state"), &DisplayServer::global_menu_set_item_state);1339ClassDB::bind_method(D_METHOD("global_menu_set_item_max_states", "menu_root", "idx", "max_states"), &DisplayServer::global_menu_set_item_max_states);1340ClassDB::bind_method(D_METHOD("global_menu_set_item_icon", "menu_root", "idx", "icon"), &DisplayServer::global_menu_set_item_icon);1341ClassDB::bind_method(D_METHOD("global_menu_set_item_indentation_level", "menu_root", "idx", "level"), &DisplayServer::global_menu_set_item_indentation_level);13421343ClassDB::bind_method(D_METHOD("global_menu_get_item_count", "menu_root"), &DisplayServer::global_menu_get_item_count);13441345ClassDB::bind_method(D_METHOD("global_menu_remove_item", "menu_root", "idx"), &DisplayServer::global_menu_remove_item);1346ClassDB::bind_method(D_METHOD("global_menu_clear", "menu_root"), &DisplayServer::global_menu_clear);13471348ClassDB::bind_method(D_METHOD("global_menu_get_system_menu_roots"), &DisplayServer::global_menu_get_system_menu_roots);1349#endif13501351ClassDB::bind_method(D_METHOD("tts_is_speaking"), &DisplayServer::tts_is_speaking);1352ClassDB::bind_method(D_METHOD("tts_is_paused"), &DisplayServer::tts_is_paused);1353ClassDB::bind_method(D_METHOD("tts_get_voices"), &DisplayServer::tts_get_voices);1354ClassDB::bind_method(D_METHOD("tts_get_voices_for_language", "language"), &DisplayServer::tts_get_voices_for_language);13551356ClassDB::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));1357ClassDB::bind_method(D_METHOD("tts_pause"), &DisplayServer::tts_pause);1358ClassDB::bind_method(D_METHOD("tts_resume"), &DisplayServer::tts_resume);1359ClassDB::bind_method(D_METHOD("tts_stop"), &DisplayServer::tts_stop);13601361ClassDB::bind_method(D_METHOD("tts_set_utterance_callback", "event", "callable"), &DisplayServer::tts_set_utterance_callback);1362ClassDB::bind_method(D_METHOD("_tts_post_utterance_event", "event", "id", "char_pos"), &DisplayServer::tts_post_utterance_event);13631364ClassDB::bind_method(D_METHOD("is_dark_mode_supported"), &DisplayServer::is_dark_mode_supported);1365ClassDB::bind_method(D_METHOD("is_dark_mode"), &DisplayServer::is_dark_mode);1366ClassDB::bind_method(D_METHOD("get_accent_color"), &DisplayServer::get_accent_color);1367ClassDB::bind_method(D_METHOD("get_base_color"), &DisplayServer::get_base_color);1368ClassDB::bind_method(D_METHOD("set_system_theme_change_callback", "callable"), &DisplayServer::set_system_theme_change_callback);13691370ClassDB::bind_method(D_METHOD("mouse_set_mode", "mouse_mode"), &DisplayServer::mouse_set_mode);1371ClassDB::bind_method(D_METHOD("mouse_get_mode"), &DisplayServer::mouse_get_mode);13721373ClassDB::bind_method(D_METHOD("warp_mouse", "position"), &DisplayServer::warp_mouse);1374ClassDB::bind_method(D_METHOD("mouse_get_position"), &DisplayServer::mouse_get_position);1375ClassDB::bind_method(D_METHOD("mouse_get_button_state"), &DisplayServer::mouse_get_button_state);13761377ClassDB::bind_method(D_METHOD("clipboard_set", "clipboard"), &DisplayServer::clipboard_set);1378ClassDB::bind_method(D_METHOD("clipboard_get"), &DisplayServer::clipboard_get);1379ClassDB::bind_method(D_METHOD("clipboard_get_image"), &DisplayServer::clipboard_get_image);1380ClassDB::bind_method(D_METHOD("clipboard_has"), &DisplayServer::clipboard_has);1381ClassDB::bind_method(D_METHOD("clipboard_has_image"), &DisplayServer::clipboard_has_image);1382ClassDB::bind_method(D_METHOD("clipboard_set_primary", "clipboard_primary"), &DisplayServer::clipboard_set_primary);1383ClassDB::bind_method(D_METHOD("clipboard_get_primary"), &DisplayServer::clipboard_get_primary);13841385ClassDB::bind_method(D_METHOD("get_display_cutouts"), &DisplayServer::get_display_cutouts);1386ClassDB::bind_method(D_METHOD("get_display_safe_area"), &DisplayServer::get_display_safe_area);13871388ClassDB::bind_method(D_METHOD("get_screen_count"), &DisplayServer::get_screen_count);1389ClassDB::bind_method(D_METHOD("get_primary_screen"), &DisplayServer::get_primary_screen);1390ClassDB::bind_method(D_METHOD("get_keyboard_focus_screen"), &DisplayServer::get_keyboard_focus_screen);1391ClassDB::bind_method(D_METHOD("get_screen_from_rect", "rect"), &DisplayServer::get_screen_from_rect);1392ClassDB::bind_method(D_METHOD("screen_get_position", "screen"), &DisplayServer::screen_get_position, DEFVAL(SCREEN_OF_MAIN_WINDOW));1393ClassDB::bind_method(D_METHOD("screen_get_size", "screen"), &DisplayServer::screen_get_size, DEFVAL(SCREEN_OF_MAIN_WINDOW));1394ClassDB::bind_method(D_METHOD("screen_get_usable_rect", "screen"), &DisplayServer::screen_get_usable_rect, DEFVAL(SCREEN_OF_MAIN_WINDOW));1395ClassDB::bind_method(D_METHOD("screen_get_dpi", "screen"), &DisplayServer::screen_get_dpi, DEFVAL(SCREEN_OF_MAIN_WINDOW));1396ClassDB::bind_method(D_METHOD("screen_get_scale", "screen"), &DisplayServer::screen_get_scale, DEFVAL(SCREEN_OF_MAIN_WINDOW));1397ClassDB::bind_method(D_METHOD("is_touchscreen_available"), &DisplayServer::is_touchscreen_available);1398ClassDB::bind_method(D_METHOD("screen_get_max_scale"), &DisplayServer::screen_get_max_scale);1399ClassDB::bind_method(D_METHOD("screen_get_refresh_rate", "screen"), &DisplayServer::screen_get_refresh_rate, DEFVAL(SCREEN_OF_MAIN_WINDOW));1400ClassDB::bind_method(D_METHOD("screen_get_pixel", "position"), &DisplayServer::screen_get_pixel);1401ClassDB::bind_method(D_METHOD("screen_get_image", "screen"), &DisplayServer::screen_get_image, DEFVAL(SCREEN_OF_MAIN_WINDOW));1402ClassDB::bind_method(D_METHOD("screen_get_image_rect", "rect"), &DisplayServer::screen_get_image_rect);14031404ClassDB::bind_method(D_METHOD("screen_set_orientation", "orientation", "screen"), &DisplayServer::screen_set_orientation, DEFVAL(SCREEN_OF_MAIN_WINDOW));1405ClassDB::bind_method(D_METHOD("screen_get_orientation", "screen"), &DisplayServer::screen_get_orientation, DEFVAL(SCREEN_OF_MAIN_WINDOW));14061407ClassDB::bind_method(D_METHOD("screen_set_keep_on", "enable"), &DisplayServer::screen_set_keep_on);1408ClassDB::bind_method(D_METHOD("screen_is_kept_on"), &DisplayServer::screen_is_kept_on);14091410ClassDB::bind_method(D_METHOD("get_window_list"), &DisplayServer::get_window_list);1411ClassDB::bind_method(D_METHOD("get_window_at_screen_position", "position"), &DisplayServer::get_window_at_screen_position);14121413ClassDB::bind_method(D_METHOD("window_get_native_handle", "handle_type", "window_id"), &DisplayServer::window_get_native_handle, DEFVAL(MAIN_WINDOW_ID));1414ClassDB::bind_method(D_METHOD("window_get_active_popup"), &DisplayServer::window_get_active_popup);1415ClassDB::bind_method(D_METHOD("window_set_popup_safe_rect", "window", "rect"), &DisplayServer::window_set_popup_safe_rect);1416ClassDB::bind_method(D_METHOD("window_get_popup_safe_rect", "window"), &DisplayServer::window_get_popup_safe_rect);14171418ClassDB::bind_method(D_METHOD("window_set_title", "title", "window_id"), &DisplayServer::window_set_title, DEFVAL(MAIN_WINDOW_ID));1419ClassDB::bind_method(D_METHOD("window_get_title_size", "title", "window_id"), &DisplayServer::window_get_title_size, DEFVAL(MAIN_WINDOW_ID));1420ClassDB::bind_method(D_METHOD("window_set_mouse_passthrough", "region", "window_id"), &DisplayServer::window_set_mouse_passthrough, DEFVAL(MAIN_WINDOW_ID));14211422ClassDB::bind_method(D_METHOD("window_get_current_screen", "window_id"), &DisplayServer::window_get_current_screen, DEFVAL(MAIN_WINDOW_ID));1423ClassDB::bind_method(D_METHOD("window_set_current_screen", "screen", "window_id"), &DisplayServer::window_set_current_screen, DEFVAL(MAIN_WINDOW_ID));14241425ClassDB::bind_method(D_METHOD("window_get_position", "window_id"), &DisplayServer::window_get_position, DEFVAL(MAIN_WINDOW_ID));1426ClassDB::bind_method(D_METHOD("window_get_position_with_decorations", "window_id"), &DisplayServer::window_get_position_with_decorations, DEFVAL(MAIN_WINDOW_ID));1427ClassDB::bind_method(D_METHOD("window_set_position", "position", "window_id"), &DisplayServer::window_set_position, DEFVAL(MAIN_WINDOW_ID));14281429ClassDB::bind_method(D_METHOD("window_get_size", "window_id"), &DisplayServer::window_get_size, DEFVAL(MAIN_WINDOW_ID));1430ClassDB::bind_method(D_METHOD("window_set_size", "size", "window_id"), &DisplayServer::window_set_size, DEFVAL(MAIN_WINDOW_ID));1431ClassDB::bind_method(D_METHOD("window_set_rect_changed_callback", "callback", "window_id"), &DisplayServer::window_set_rect_changed_callback, DEFVAL(MAIN_WINDOW_ID));1432ClassDB::bind_method(D_METHOD("window_set_window_event_callback", "callback", "window_id"), &DisplayServer::window_set_window_event_callback, DEFVAL(MAIN_WINDOW_ID));1433ClassDB::bind_method(D_METHOD("window_set_input_event_callback", "callback", "window_id"), &DisplayServer::window_set_input_event_callback, DEFVAL(MAIN_WINDOW_ID));1434ClassDB::bind_method(D_METHOD("window_set_input_text_callback", "callback", "window_id"), &DisplayServer::window_set_input_text_callback, DEFVAL(MAIN_WINDOW_ID));1435ClassDB::bind_method(D_METHOD("window_set_drop_files_callback", "callback", "window_id"), &DisplayServer::window_set_drop_files_callback, DEFVAL(MAIN_WINDOW_ID));14361437ClassDB::bind_method(D_METHOD("window_get_attached_instance_id", "window_id"), &DisplayServer::window_get_attached_instance_id, DEFVAL(MAIN_WINDOW_ID));14381439ClassDB::bind_method(D_METHOD("window_get_max_size", "window_id"), &DisplayServer::window_get_max_size, DEFVAL(MAIN_WINDOW_ID));1440ClassDB::bind_method(D_METHOD("window_set_max_size", "max_size", "window_id"), &DisplayServer::window_set_max_size, DEFVAL(MAIN_WINDOW_ID));14411442ClassDB::bind_method(D_METHOD("window_get_min_size", "window_id"), &DisplayServer::window_get_min_size, DEFVAL(MAIN_WINDOW_ID));1443ClassDB::bind_method(D_METHOD("window_set_min_size", "min_size", "window_id"), &DisplayServer::window_set_min_size, DEFVAL(MAIN_WINDOW_ID));14441445ClassDB::bind_method(D_METHOD("window_get_size_with_decorations", "window_id"), &DisplayServer::window_get_size_with_decorations, DEFVAL(MAIN_WINDOW_ID));14461447ClassDB::bind_method(D_METHOD("window_get_mode", "window_id"), &DisplayServer::window_get_mode, DEFVAL(MAIN_WINDOW_ID));1448ClassDB::bind_method(D_METHOD("window_set_mode", "mode", "window_id"), &DisplayServer::window_set_mode, DEFVAL(MAIN_WINDOW_ID));14491450ClassDB::bind_method(D_METHOD("window_set_flag", "flag", "enabled", "window_id"), &DisplayServer::window_set_flag, DEFVAL(MAIN_WINDOW_ID));1451ClassDB::bind_method(D_METHOD("window_get_flag", "flag", "window_id"), &DisplayServer::window_get_flag, DEFVAL(MAIN_WINDOW_ID));14521453ClassDB::bind_method(D_METHOD("window_set_window_buttons_offset", "offset", "window_id"), &DisplayServer::window_set_window_buttons_offset, DEFVAL(MAIN_WINDOW_ID));1454ClassDB::bind_method(D_METHOD("window_get_safe_title_margins", "window_id"), &DisplayServer::window_get_safe_title_margins, DEFVAL(MAIN_WINDOW_ID));14551456ClassDB::bind_method(D_METHOD("window_request_attention", "window_id"), &DisplayServer::window_request_attention, DEFVAL(MAIN_WINDOW_ID));14571458ClassDB::bind_method(D_METHOD("window_move_to_foreground", "window_id"), &DisplayServer::window_move_to_foreground, DEFVAL(MAIN_WINDOW_ID));1459ClassDB::bind_method(D_METHOD("window_is_focused", "window_id"), &DisplayServer::window_is_focused, DEFVAL(MAIN_WINDOW_ID));1460ClassDB::bind_method(D_METHOD("window_can_draw", "window_id"), &DisplayServer::window_can_draw, DEFVAL(MAIN_WINDOW_ID));14611462ClassDB::bind_method(D_METHOD("window_set_transient", "window_id", "parent_window_id"), &DisplayServer::window_set_transient);1463ClassDB::bind_method(D_METHOD("window_set_exclusive", "window_id", "exclusive"), &DisplayServer::window_set_exclusive);14641465ClassDB::bind_method(D_METHOD("window_set_ime_active", "active", "window_id"), &DisplayServer::window_set_ime_active, DEFVAL(MAIN_WINDOW_ID));1466ClassDB::bind_method(D_METHOD("window_set_ime_position", "position", "window_id"), &DisplayServer::window_set_ime_position, DEFVAL(MAIN_WINDOW_ID));14671468ClassDB::bind_method(D_METHOD("window_set_vsync_mode", "vsync_mode", "window_id"), &DisplayServer::window_set_vsync_mode, DEFVAL(MAIN_WINDOW_ID));1469ClassDB::bind_method(D_METHOD("window_get_vsync_mode", "window_id"), &DisplayServer::window_get_vsync_mode, DEFVAL(MAIN_WINDOW_ID));14701471ClassDB::bind_method(D_METHOD("window_is_maximize_allowed", "window_id"), &DisplayServer::window_is_maximize_allowed, DEFVAL(MAIN_WINDOW_ID));1472ClassDB::bind_method(D_METHOD("window_maximize_on_title_dbl_click"), &DisplayServer::window_maximize_on_title_dbl_click);1473ClassDB::bind_method(D_METHOD("window_minimize_on_title_dbl_click"), &DisplayServer::window_minimize_on_title_dbl_click);14741475ClassDB::bind_method(D_METHOD("window_start_drag", "window_id"), &DisplayServer::window_start_drag, DEFVAL(MAIN_WINDOW_ID));1476ClassDB::bind_method(D_METHOD("window_start_resize", "edge", "window_id"), &DisplayServer::window_start_resize, DEFVAL(MAIN_WINDOW_ID));14771478ClassDB::bind_method(D_METHOD("window_set_color", "color"), &DisplayServer::window_set_color);14791480ClassDB::bind_method(D_METHOD("accessibility_should_increase_contrast"), &DisplayServer::accessibility_should_increase_contrast);1481ClassDB::bind_method(D_METHOD("accessibility_should_reduce_animation"), &DisplayServer::accessibility_should_reduce_animation);1482ClassDB::bind_method(D_METHOD("accessibility_should_reduce_transparency"), &DisplayServer::accessibility_should_reduce_transparency);1483ClassDB::bind_method(D_METHOD("accessibility_screen_reader_active"), &DisplayServer::accessibility_screen_reader_active);14841485ClassDB::bind_method(D_METHOD("accessibility_create_element", "window_id", "role"), &DisplayServer::accessibility_create_element);1486ClassDB::bind_method(D_METHOD("accessibility_create_sub_element", "parent_rid", "role", "insert_pos"), &DisplayServer::accessibility_create_sub_element, DEFVAL(-1));1487ClassDB::bind_method(D_METHOD("accessibility_create_sub_text_edit_elements", "parent_rid", "shaped_text", "min_height", "insert_pos"), &DisplayServer::accessibility_create_sub_text_edit_elements, DEFVAL(-1));1488ClassDB::bind_method(D_METHOD("accessibility_has_element", "id"), &DisplayServer::accessibility_has_element);1489ClassDB::bind_method(D_METHOD("accessibility_free_element", "id"), &DisplayServer::accessibility_free_element);1490ClassDB::bind_method(D_METHOD("accessibility_element_set_meta", "id", "meta"), &DisplayServer::accessibility_element_set_meta);1491ClassDB::bind_method(D_METHOD("accessibility_element_get_meta", "id"), &DisplayServer::accessibility_element_get_meta);14921493ClassDB::bind_method(D_METHOD("_accessibility_update_if_active", "callback"), &DisplayServer::accessibility_update_if_active);14941495ClassDB::bind_method(D_METHOD("accessibility_set_window_rect", "window_id", "rect_out", "rect_in"), &DisplayServer::accessibility_set_window_rect);1496ClassDB::bind_method(D_METHOD("accessibility_set_window_focused", "window_id", "focused"), &DisplayServer::accessibility_set_window_focused);14971498ClassDB::bind_method(D_METHOD("accessibility_update_set_focus", "id"), &DisplayServer::accessibility_update_set_focus);1499ClassDB::bind_method(D_METHOD("accessibility_get_window_root", "window_id"), &DisplayServer::accessibility_get_window_root);1500ClassDB::bind_method(D_METHOD("accessibility_update_set_role", "id", "role"), &DisplayServer::accessibility_update_set_role);1501ClassDB::bind_method(D_METHOD("accessibility_update_set_name", "id", "name"), &DisplayServer::accessibility_update_set_name);1502ClassDB::bind_method(D_METHOD("accessibility_update_set_extra_info", "id", "name"), &DisplayServer::accessibility_update_set_extra_info);1503ClassDB::bind_method(D_METHOD("accessibility_update_set_description", "id", "description"), &DisplayServer::accessibility_update_set_description);1504ClassDB::bind_method(D_METHOD("accessibility_update_set_value", "id", "value"), &DisplayServer::accessibility_update_set_value);1505ClassDB::bind_method(D_METHOD("accessibility_update_set_tooltip", "id", "tooltip"), &DisplayServer::accessibility_update_set_tooltip);1506ClassDB::bind_method(D_METHOD("accessibility_update_set_bounds", "id", "p_rect"), &DisplayServer::accessibility_update_set_bounds);1507ClassDB::bind_method(D_METHOD("accessibility_update_set_transform", "id", "transform"), &DisplayServer::accessibility_update_set_transform);1508ClassDB::bind_method(D_METHOD("accessibility_update_add_child", "id", "child_id"), &DisplayServer::accessibility_update_add_child);1509ClassDB::bind_method(D_METHOD("accessibility_update_add_related_controls", "id", "related_id"), &DisplayServer::accessibility_update_add_related_controls);1510ClassDB::bind_method(D_METHOD("accessibility_update_add_related_details", "id", "related_id"), &DisplayServer::accessibility_update_add_related_details);1511ClassDB::bind_method(D_METHOD("accessibility_update_add_related_described_by", "id", "related_id"), &DisplayServer::accessibility_update_add_related_described_by);1512ClassDB::bind_method(D_METHOD("accessibility_update_add_related_flow_to", "id", "related_id"), &DisplayServer::accessibility_update_add_related_flow_to);1513ClassDB::bind_method(D_METHOD("accessibility_update_add_related_labeled_by", "id", "related_id"), &DisplayServer::accessibility_update_add_related_labeled_by);1514ClassDB::bind_method(D_METHOD("accessibility_update_add_related_radio_group", "id", "related_id"), &DisplayServer::accessibility_update_add_related_radio_group);1515ClassDB::bind_method(D_METHOD("accessibility_update_set_active_descendant", "id", "other_id"), &DisplayServer::accessibility_update_set_active_descendant);1516ClassDB::bind_method(D_METHOD("accessibility_update_set_next_on_line", "id", "other_id"), &DisplayServer::accessibility_update_set_next_on_line);1517ClassDB::bind_method(D_METHOD("accessibility_update_set_previous_on_line", "id", "other_id"), &DisplayServer::accessibility_update_set_previous_on_line);1518ClassDB::bind_method(D_METHOD("accessibility_update_set_member_of", "id", "group_id"), &DisplayServer::accessibility_update_set_member_of);1519ClassDB::bind_method(D_METHOD("accessibility_update_set_in_page_link_target", "id", "other_id"), &DisplayServer::accessibility_update_set_in_page_link_target);1520ClassDB::bind_method(D_METHOD("accessibility_update_set_error_message", "id", "other_id"), &DisplayServer::accessibility_update_set_error_message);1521ClassDB::bind_method(D_METHOD("accessibility_update_set_live", "id", "live"), &DisplayServer::accessibility_update_set_live);1522ClassDB::bind_method(D_METHOD("accessibility_update_add_action", "id", "action", "callable"), &DisplayServer::accessibility_update_add_action);1523ClassDB::bind_method(D_METHOD("accessibility_update_add_custom_action", "id", "action_id", "action_description"), &DisplayServer::accessibility_update_add_custom_action);1524ClassDB::bind_method(D_METHOD("accessibility_update_set_table_row_count", "id", "count"), &DisplayServer::accessibility_update_set_table_row_count);1525ClassDB::bind_method(D_METHOD("accessibility_update_set_table_column_count", "id", "count"), &DisplayServer::accessibility_update_set_table_column_count);1526ClassDB::bind_method(D_METHOD("accessibility_update_set_table_row_index", "id", "index"), &DisplayServer::accessibility_update_set_table_row_index);1527ClassDB::bind_method(D_METHOD("accessibility_update_set_table_column_index", "id", "index"), &DisplayServer::accessibility_update_set_table_column_index);1528ClassDB::bind_method(D_METHOD("accessibility_update_set_table_cell_position", "id", "row_index", "column_index"), &DisplayServer::accessibility_update_set_table_cell_position);1529ClassDB::bind_method(D_METHOD("accessibility_update_set_table_cell_span", "id", "row_span", "column_span"), &DisplayServer::accessibility_update_set_table_cell_span);1530ClassDB::bind_method(D_METHOD("accessibility_update_set_list_item_count", "id", "size"), &DisplayServer::accessibility_update_set_list_item_count);1531ClassDB::bind_method(D_METHOD("accessibility_update_set_list_item_index", "id", "index"), &DisplayServer::accessibility_update_set_list_item_index);1532ClassDB::bind_method(D_METHOD("accessibility_update_set_list_item_level", "id", "level"), &DisplayServer::accessibility_update_set_list_item_level);1533ClassDB::bind_method(D_METHOD("accessibility_update_set_list_item_selected", "id", "selected"), &DisplayServer::accessibility_update_set_list_item_selected);1534ClassDB::bind_method(D_METHOD("accessibility_update_set_list_item_expanded", "id", "expanded"), &DisplayServer::accessibility_update_set_list_item_expanded);1535ClassDB::bind_method(D_METHOD("accessibility_update_set_popup_type", "id", "popup"), &DisplayServer::accessibility_update_set_popup_type);1536ClassDB::bind_method(D_METHOD("accessibility_update_set_checked", "id", "checekd"), &DisplayServer::accessibility_update_set_checked);1537ClassDB::bind_method(D_METHOD("accessibility_update_set_num_value", "id", "position"), &DisplayServer::accessibility_update_set_num_value);1538ClassDB::bind_method(D_METHOD("accessibility_update_set_num_range", "id", "min", "max"), &DisplayServer::accessibility_update_set_num_range);1539ClassDB::bind_method(D_METHOD("accessibility_update_set_num_step", "id", "step"), &DisplayServer::accessibility_update_set_num_step);1540ClassDB::bind_method(D_METHOD("accessibility_update_set_num_jump", "id", "jump"), &DisplayServer::accessibility_update_set_num_jump);1541ClassDB::bind_method(D_METHOD("accessibility_update_set_scroll_x", "id", "position"), &DisplayServer::accessibility_update_set_scroll_x);1542ClassDB::bind_method(D_METHOD("accessibility_update_set_scroll_x_range", "id", "min", "max"), &DisplayServer::accessibility_update_set_scroll_x_range);1543ClassDB::bind_method(D_METHOD("accessibility_update_set_scroll_y", "id", "position"), &DisplayServer::accessibility_update_set_scroll_y);1544ClassDB::bind_method(D_METHOD("accessibility_update_set_scroll_y_range", "id", "min", "max"), &DisplayServer::accessibility_update_set_scroll_y_range);1545ClassDB::bind_method(D_METHOD("accessibility_update_set_text_decorations", "id", "underline", "strikethrough", "overline"), &DisplayServer::accessibility_update_set_text_decorations);1546ClassDB::bind_method(D_METHOD("accessibility_update_set_text_align", "id", "align"), &DisplayServer::accessibility_update_set_text_align);1547ClassDB::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);1548ClassDB::bind_method(D_METHOD("accessibility_update_set_flag", "id", "flag", "value"), &DisplayServer::accessibility_update_set_flag);1549ClassDB::bind_method(D_METHOD("accessibility_update_set_classname", "id", "classname"), &DisplayServer::accessibility_update_set_classname);1550ClassDB::bind_method(D_METHOD("accessibility_update_set_placeholder", "id", "placeholder"), &DisplayServer::accessibility_update_set_placeholder);1551ClassDB::bind_method(D_METHOD("accessibility_update_set_language", "id", "language"), &DisplayServer::accessibility_update_set_language);1552ClassDB::bind_method(D_METHOD("accessibility_update_set_text_orientation", "id", "vertical"), &DisplayServer::accessibility_update_set_text_orientation);1553ClassDB::bind_method(D_METHOD("accessibility_update_set_list_orientation", "id", "vertical"), &DisplayServer::accessibility_update_set_list_orientation);1554ClassDB::bind_method(D_METHOD("accessibility_update_set_shortcut", "id", "shortcut"), &DisplayServer::accessibility_update_set_shortcut);1555ClassDB::bind_method(D_METHOD("accessibility_update_set_url", "id", "url"), &DisplayServer::accessibility_update_set_url);1556ClassDB::bind_method(D_METHOD("accessibility_update_set_role_description", "id", "description"), &DisplayServer::accessibility_update_set_role_description);1557ClassDB::bind_method(D_METHOD("accessibility_update_set_state_description", "id", "description"), &DisplayServer::accessibility_update_set_state_description);1558ClassDB::bind_method(D_METHOD("accessibility_update_set_color_value", "id", "color"), &DisplayServer::accessibility_update_set_color_value);1559ClassDB::bind_method(D_METHOD("accessibility_update_set_background_color", "id", "color"), &DisplayServer::accessibility_update_set_background_color);1560ClassDB::bind_method(D_METHOD("accessibility_update_set_foreground_color", "id", "color"), &DisplayServer::accessibility_update_set_foreground_color);15611562ClassDB::bind_method(D_METHOD("ime_get_selection"), &DisplayServer::ime_get_selection);1563ClassDB::bind_method(D_METHOD("ime_get_text"), &DisplayServer::ime_get_text);15641565ClassDB::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));1566ClassDB::bind_method(D_METHOD("virtual_keyboard_hide"), &DisplayServer::virtual_keyboard_hide);15671568ClassDB::bind_method(D_METHOD("virtual_keyboard_get_height"), &DisplayServer::virtual_keyboard_get_height);15691570ClassDB::bind_method(D_METHOD("has_hardware_keyboard"), &DisplayServer::has_hardware_keyboard);1571ClassDB::bind_method(D_METHOD("set_hardware_keyboard_connection_change_callback", "callable"), &DisplayServer::set_hardware_keyboard_connection_change_callback);15721573ClassDB::bind_method(D_METHOD("cursor_set_shape", "shape"), &DisplayServer::cursor_set_shape);1574ClassDB::bind_method(D_METHOD("cursor_get_shape"), &DisplayServer::cursor_get_shape);1575ClassDB::bind_method(D_METHOD("cursor_set_custom_image", "cursor", "shape", "hotspot"), &DisplayServer::cursor_set_custom_image, DEFVAL(CURSOR_ARROW), DEFVAL(Vector2()));15761577ClassDB::bind_method(D_METHOD("get_swap_cancel_ok"), &DisplayServer::get_swap_cancel_ok);15781579ClassDB::bind_method(D_METHOD("enable_for_stealing_focus", "process_id"), &DisplayServer::enable_for_stealing_focus);15801581ClassDB::bind_method(D_METHOD("dialog_show", "title", "description", "buttons", "callback"), &DisplayServer::dialog_show);1582ClassDB::bind_method(D_METHOD("dialog_input_text", "title", "description", "existing_text", "callback"), &DisplayServer::dialog_input_text);15831584ClassDB::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));1585ClassDB::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));15861587ClassDB::bind_method(D_METHOD("beep"), &DisplayServer::beep);15881589ClassDB::bind_method(D_METHOD("keyboard_get_layout_count"), &DisplayServer::keyboard_get_layout_count);1590ClassDB::bind_method(D_METHOD("keyboard_get_current_layout"), &DisplayServer::keyboard_get_current_layout);1591ClassDB::bind_method(D_METHOD("keyboard_set_current_layout", "index"), &DisplayServer::keyboard_set_current_layout);1592ClassDB::bind_method(D_METHOD("keyboard_get_layout_language", "index"), &DisplayServer::keyboard_get_layout_language);1593ClassDB::bind_method(D_METHOD("keyboard_get_layout_name", "index"), &DisplayServer::keyboard_get_layout_name);1594ClassDB::bind_method(D_METHOD("keyboard_get_keycode_from_physical", "keycode"), &DisplayServer::keyboard_get_keycode_from_physical);1595ClassDB::bind_method(D_METHOD("keyboard_get_label_from_physical", "keycode"), &DisplayServer::keyboard_get_label_from_physical);15961597ClassDB::bind_method(D_METHOD("show_emoji_and_symbol_picker"), &DisplayServer::show_emoji_and_symbol_picker);1598ClassDB::bind_method(D_METHOD("color_picker", "callback"), &DisplayServer::color_picker);15991600ClassDB::bind_method(D_METHOD("process_events"), &DisplayServer::process_events);1601ClassDB::bind_method(D_METHOD("force_process_and_drop_events"), &DisplayServer::force_process_and_drop_events);16021603ClassDB::bind_method(D_METHOD("set_native_icon", "filename"), &DisplayServer::set_native_icon);1604ClassDB::bind_method(D_METHOD("set_icon", "image"), &DisplayServer::set_icon);16051606ClassDB::bind_method(D_METHOD("create_status_indicator", "icon", "tooltip", "callback"), &DisplayServer::create_status_indicator);1607ClassDB::bind_method(D_METHOD("status_indicator_set_icon", "id", "icon"), &DisplayServer::status_indicator_set_icon);1608ClassDB::bind_method(D_METHOD("status_indicator_set_tooltip", "id", "tooltip"), &DisplayServer::status_indicator_set_tooltip);1609ClassDB::bind_method(D_METHOD("status_indicator_set_menu", "id", "menu_rid"), &DisplayServer::status_indicator_set_menu);1610ClassDB::bind_method(D_METHOD("status_indicator_set_callback", "id", "callback"), &DisplayServer::status_indicator_set_callback);1611ClassDB::bind_method(D_METHOD("status_indicator_get_rect", "id"), &DisplayServer::status_indicator_get_rect);1612ClassDB::bind_method(D_METHOD("delete_status_indicator", "id"), &DisplayServer::delete_status_indicator);16131614ClassDB::bind_method(D_METHOD("tablet_get_driver_count"), &DisplayServer::tablet_get_driver_count);1615ClassDB::bind_method(D_METHOD("tablet_get_driver_name", "idx"), &DisplayServer::tablet_get_driver_name);1616ClassDB::bind_method(D_METHOD("tablet_get_current_driver"), &DisplayServer::tablet_get_current_driver);1617ClassDB::bind_method(D_METHOD("tablet_set_current_driver", "name"), &DisplayServer::tablet_set_current_driver);16181619ClassDB::bind_method(D_METHOD("is_window_transparency_available"), &DisplayServer::is_window_transparency_available);16201621ClassDB::bind_method(D_METHOD("register_additional_output", "object"), &DisplayServer::register_additional_output);1622ClassDB::bind_method(D_METHOD("unregister_additional_output", "object"), &DisplayServer::unregister_additional_output);1623ClassDB::bind_method(D_METHOD("has_additional_outputs"), &DisplayServer::has_additional_outputs);16241625#ifndef DISABLE_DEPRECATED1626BIND_ENUM_CONSTANT(FEATURE_GLOBAL_MENU);1627#endif1628BIND_ENUM_CONSTANT(FEATURE_SUBWINDOWS);1629BIND_ENUM_CONSTANT(FEATURE_TOUCHSCREEN);1630BIND_ENUM_CONSTANT(FEATURE_MOUSE);1631BIND_ENUM_CONSTANT(FEATURE_MOUSE_WARP);1632BIND_ENUM_CONSTANT(FEATURE_CLIPBOARD);1633BIND_ENUM_CONSTANT(FEATURE_VIRTUAL_KEYBOARD);1634BIND_ENUM_CONSTANT(FEATURE_CURSOR_SHAPE);1635BIND_ENUM_CONSTANT(FEATURE_CUSTOM_CURSOR_SHAPE);1636BIND_ENUM_CONSTANT(FEATURE_NATIVE_DIALOG);1637BIND_ENUM_CONSTANT(FEATURE_IME);1638BIND_ENUM_CONSTANT(FEATURE_WINDOW_TRANSPARENCY);1639BIND_ENUM_CONSTANT(FEATURE_HIDPI);1640BIND_ENUM_CONSTANT(FEATURE_ICON);1641BIND_ENUM_CONSTANT(FEATURE_NATIVE_ICON);1642BIND_ENUM_CONSTANT(FEATURE_ORIENTATION);1643BIND_ENUM_CONSTANT(FEATURE_SWAP_BUFFERS);1644BIND_ENUM_CONSTANT(FEATURE_CLIPBOARD_PRIMARY);1645BIND_ENUM_CONSTANT(FEATURE_TEXT_TO_SPEECH);1646BIND_ENUM_CONSTANT(FEATURE_EXTEND_TO_TITLE);1647BIND_ENUM_CONSTANT(FEATURE_SCREEN_CAPTURE);1648BIND_ENUM_CONSTANT(FEATURE_STATUS_INDICATOR);1649BIND_ENUM_CONSTANT(FEATURE_NATIVE_HELP);1650BIND_ENUM_CONSTANT(FEATURE_NATIVE_DIALOG_INPUT);1651BIND_ENUM_CONSTANT(FEATURE_NATIVE_DIALOG_FILE);1652BIND_ENUM_CONSTANT(FEATURE_NATIVE_DIALOG_FILE_EXTRA);1653BIND_ENUM_CONSTANT(FEATURE_WINDOW_DRAG);1654BIND_ENUM_CONSTANT(FEATURE_SCREEN_EXCLUDE_FROM_CAPTURE);1655BIND_ENUM_CONSTANT(FEATURE_WINDOW_EMBEDDING);1656BIND_ENUM_CONSTANT(FEATURE_NATIVE_DIALOG_FILE_MIME);1657BIND_ENUM_CONSTANT(FEATURE_EMOJI_AND_SYMBOL_PICKER);1658BIND_ENUM_CONSTANT(FEATURE_NATIVE_COLOR_PICKER);1659BIND_ENUM_CONSTANT(FEATURE_SELF_FITTING_WINDOWS);1660BIND_ENUM_CONSTANT(FEATURE_ACCESSIBILITY_SCREEN_READER);16611662BIND_ENUM_CONSTANT(ROLE_UNKNOWN);1663BIND_ENUM_CONSTANT(ROLE_DEFAULT_BUTTON);1664BIND_ENUM_CONSTANT(ROLE_AUDIO);1665BIND_ENUM_CONSTANT(ROLE_VIDEO);1666BIND_ENUM_CONSTANT(ROLE_STATIC_TEXT);1667BIND_ENUM_CONSTANT(ROLE_CONTAINER);1668BIND_ENUM_CONSTANT(ROLE_PANEL);1669BIND_ENUM_CONSTANT(ROLE_BUTTON);1670BIND_ENUM_CONSTANT(ROLE_LINK);1671BIND_ENUM_CONSTANT(ROLE_CHECK_BOX);1672BIND_ENUM_CONSTANT(ROLE_RADIO_BUTTON);1673BIND_ENUM_CONSTANT(ROLE_CHECK_BUTTON);1674BIND_ENUM_CONSTANT(ROLE_SCROLL_BAR);1675BIND_ENUM_CONSTANT(ROLE_SCROLL_VIEW);1676BIND_ENUM_CONSTANT(ROLE_SPLITTER);1677BIND_ENUM_CONSTANT(ROLE_SLIDER);1678BIND_ENUM_CONSTANT(ROLE_SPIN_BUTTON);1679BIND_ENUM_CONSTANT(ROLE_PROGRESS_INDICATOR);1680BIND_ENUM_CONSTANT(ROLE_TEXT_FIELD);1681BIND_ENUM_CONSTANT(ROLE_MULTILINE_TEXT_FIELD);1682BIND_ENUM_CONSTANT(ROLE_COLOR_PICKER);1683BIND_ENUM_CONSTANT(ROLE_TABLE);1684BIND_ENUM_CONSTANT(ROLE_CELL);1685BIND_ENUM_CONSTANT(ROLE_ROW);1686BIND_ENUM_CONSTANT(ROLE_ROW_GROUP);1687BIND_ENUM_CONSTANT(ROLE_ROW_HEADER);1688BIND_ENUM_CONSTANT(ROLE_COLUMN_HEADER);1689BIND_ENUM_CONSTANT(ROLE_TREE);1690BIND_ENUM_CONSTANT(ROLE_TREE_ITEM);1691BIND_ENUM_CONSTANT(ROLE_LIST);1692BIND_ENUM_CONSTANT(ROLE_LIST_ITEM);1693BIND_ENUM_CONSTANT(ROLE_LIST_BOX);1694BIND_ENUM_CONSTANT(ROLE_LIST_BOX_OPTION);1695BIND_ENUM_CONSTANT(ROLE_TAB_BAR);1696BIND_ENUM_CONSTANT(ROLE_TAB);1697BIND_ENUM_CONSTANT(ROLE_TAB_PANEL);1698BIND_ENUM_CONSTANT(ROLE_MENU_BAR);1699BIND_ENUM_CONSTANT(ROLE_MENU);1700BIND_ENUM_CONSTANT(ROLE_MENU_ITEM);1701BIND_ENUM_CONSTANT(ROLE_MENU_ITEM_CHECK_BOX);1702BIND_ENUM_CONSTANT(ROLE_MENU_ITEM_RADIO);1703BIND_ENUM_CONSTANT(ROLE_IMAGE);1704BIND_ENUM_CONSTANT(ROLE_WINDOW);1705BIND_ENUM_CONSTANT(ROLE_TITLE_BAR);1706BIND_ENUM_CONSTANT(ROLE_DIALOG);1707BIND_ENUM_CONSTANT(ROLE_TOOLTIP);17081709BIND_ENUM_CONSTANT(POPUP_MENU);1710BIND_ENUM_CONSTANT(POPUP_LIST);1711BIND_ENUM_CONSTANT(POPUP_TREE);1712BIND_ENUM_CONSTANT(POPUP_DIALOG);17131714BIND_ENUM_CONSTANT(FLAG_HIDDEN);1715BIND_ENUM_CONSTANT(FLAG_MULTISELECTABLE);1716BIND_ENUM_CONSTANT(FLAG_REQUIRED);1717BIND_ENUM_CONSTANT(FLAG_VISITED);1718BIND_ENUM_CONSTANT(FLAG_BUSY);1719BIND_ENUM_CONSTANT(FLAG_MODAL);1720BIND_ENUM_CONSTANT(FLAG_TOUCH_PASSTHROUGH);1721BIND_ENUM_CONSTANT(FLAG_READONLY);1722BIND_ENUM_CONSTANT(FLAG_DISABLED);1723BIND_ENUM_CONSTANT(FLAG_CLIPS_CHILDREN);17241725BIND_ENUM_CONSTANT(ACTION_CLICK);1726BIND_ENUM_CONSTANT(ACTION_FOCUS);1727BIND_ENUM_CONSTANT(ACTION_BLUR);1728BIND_ENUM_CONSTANT(ACTION_COLLAPSE);1729BIND_ENUM_CONSTANT(ACTION_EXPAND);1730BIND_ENUM_CONSTANT(ACTION_DECREMENT);1731BIND_ENUM_CONSTANT(ACTION_INCREMENT);1732BIND_ENUM_CONSTANT(ACTION_HIDE_TOOLTIP);1733BIND_ENUM_CONSTANT(ACTION_SHOW_TOOLTIP);1734BIND_ENUM_CONSTANT(ACTION_SET_TEXT_SELECTION);1735BIND_ENUM_CONSTANT(ACTION_REPLACE_SELECTED_TEXT);1736BIND_ENUM_CONSTANT(ACTION_SCROLL_BACKWARD);1737BIND_ENUM_CONSTANT(ACTION_SCROLL_DOWN);1738BIND_ENUM_CONSTANT(ACTION_SCROLL_FORWARD);1739BIND_ENUM_CONSTANT(ACTION_SCROLL_LEFT);1740BIND_ENUM_CONSTANT(ACTION_SCROLL_RIGHT);1741BIND_ENUM_CONSTANT(ACTION_SCROLL_UP);1742BIND_ENUM_CONSTANT(ACTION_SCROLL_INTO_VIEW);1743BIND_ENUM_CONSTANT(ACTION_SCROLL_TO_POINT);1744BIND_ENUM_CONSTANT(ACTION_SET_SCROLL_OFFSET);1745BIND_ENUM_CONSTANT(ACTION_SET_VALUE);1746BIND_ENUM_CONSTANT(ACTION_SHOW_CONTEXT_MENU);1747BIND_ENUM_CONSTANT(ACTION_CUSTOM);17481749BIND_ENUM_CONSTANT(LIVE_OFF);1750BIND_ENUM_CONSTANT(LIVE_POLITE);1751BIND_ENUM_CONSTANT(LIVE_ASSERTIVE);17521753BIND_ENUM_CONSTANT(SCROLL_UNIT_ITEM);1754BIND_ENUM_CONSTANT(SCROLL_UNIT_PAGE);17551756BIND_ENUM_CONSTANT(SCROLL_HINT_TOP_LEFT);1757BIND_ENUM_CONSTANT(SCROLL_HINT_BOTTOM_RIGHT);1758BIND_ENUM_CONSTANT(SCROLL_HINT_TOP_EDGE);1759BIND_ENUM_CONSTANT(SCROLL_HINT_BOTTOM_EDGE);1760BIND_ENUM_CONSTANT(SCROLL_HINT_LEFT_EDGE);1761BIND_ENUM_CONSTANT(SCROLL_HINT_RIGHT_EDGE);17621763BIND_ENUM_CONSTANT(MOUSE_MODE_VISIBLE);1764BIND_ENUM_CONSTANT(MOUSE_MODE_HIDDEN);1765BIND_ENUM_CONSTANT(MOUSE_MODE_CAPTURED);1766BIND_ENUM_CONSTANT(MOUSE_MODE_CONFINED);1767BIND_ENUM_CONSTANT(MOUSE_MODE_CONFINED_HIDDEN);1768BIND_ENUM_CONSTANT(MOUSE_MODE_MAX);17691770BIND_CONSTANT(INVALID_SCREEN);1771BIND_CONSTANT(SCREEN_WITH_MOUSE_FOCUS);1772BIND_CONSTANT(SCREEN_WITH_KEYBOARD_FOCUS);1773BIND_CONSTANT(SCREEN_PRIMARY);1774BIND_CONSTANT(SCREEN_OF_MAIN_WINDOW);17751776BIND_CONSTANT(MAIN_WINDOW_ID);1777BIND_CONSTANT(INVALID_WINDOW_ID);1778BIND_CONSTANT(INVALID_INDICATOR_ID);17791780BIND_ENUM_CONSTANT(SCREEN_LANDSCAPE);1781BIND_ENUM_CONSTANT(SCREEN_PORTRAIT);1782BIND_ENUM_CONSTANT(SCREEN_REVERSE_LANDSCAPE);1783BIND_ENUM_CONSTANT(SCREEN_REVERSE_PORTRAIT);1784BIND_ENUM_CONSTANT(SCREEN_SENSOR_LANDSCAPE);1785BIND_ENUM_CONSTANT(SCREEN_SENSOR_PORTRAIT);1786BIND_ENUM_CONSTANT(SCREEN_SENSOR);17871788BIND_ENUM_CONSTANT(KEYBOARD_TYPE_DEFAULT);1789BIND_ENUM_CONSTANT(KEYBOARD_TYPE_MULTILINE);1790BIND_ENUM_CONSTANT(KEYBOARD_TYPE_NUMBER);1791BIND_ENUM_CONSTANT(KEYBOARD_TYPE_NUMBER_DECIMAL);1792BIND_ENUM_CONSTANT(KEYBOARD_TYPE_PHONE);1793BIND_ENUM_CONSTANT(KEYBOARD_TYPE_EMAIL_ADDRESS);1794BIND_ENUM_CONSTANT(KEYBOARD_TYPE_PASSWORD);1795BIND_ENUM_CONSTANT(KEYBOARD_TYPE_URL);17961797BIND_ENUM_CONSTANT(CURSOR_ARROW);1798BIND_ENUM_CONSTANT(CURSOR_IBEAM);1799BIND_ENUM_CONSTANT(CURSOR_POINTING_HAND);1800BIND_ENUM_CONSTANT(CURSOR_CROSS);1801BIND_ENUM_CONSTANT(CURSOR_WAIT);1802BIND_ENUM_CONSTANT(CURSOR_BUSY);1803BIND_ENUM_CONSTANT(CURSOR_DRAG);1804BIND_ENUM_CONSTANT(CURSOR_CAN_DROP);1805BIND_ENUM_CONSTANT(CURSOR_FORBIDDEN);1806BIND_ENUM_CONSTANT(CURSOR_VSIZE);1807BIND_ENUM_CONSTANT(CURSOR_HSIZE);1808BIND_ENUM_CONSTANT(CURSOR_BDIAGSIZE);1809BIND_ENUM_CONSTANT(CURSOR_FDIAGSIZE);1810BIND_ENUM_CONSTANT(CURSOR_MOVE);1811BIND_ENUM_CONSTANT(CURSOR_VSPLIT);1812BIND_ENUM_CONSTANT(CURSOR_HSPLIT);1813BIND_ENUM_CONSTANT(CURSOR_HELP);1814BIND_ENUM_CONSTANT(CURSOR_MAX);18151816BIND_ENUM_CONSTANT(FILE_DIALOG_MODE_OPEN_FILE);1817BIND_ENUM_CONSTANT(FILE_DIALOG_MODE_OPEN_FILES);1818BIND_ENUM_CONSTANT(FILE_DIALOG_MODE_OPEN_DIR);1819BIND_ENUM_CONSTANT(FILE_DIALOG_MODE_OPEN_ANY);1820BIND_ENUM_CONSTANT(FILE_DIALOG_MODE_SAVE_FILE);18211822BIND_ENUM_CONSTANT(WINDOW_MODE_WINDOWED);1823BIND_ENUM_CONSTANT(WINDOW_MODE_MINIMIZED);1824BIND_ENUM_CONSTANT(WINDOW_MODE_MAXIMIZED);1825BIND_ENUM_CONSTANT(WINDOW_MODE_FULLSCREEN);1826BIND_ENUM_CONSTANT(WINDOW_MODE_EXCLUSIVE_FULLSCREEN);18271828BIND_ENUM_CONSTANT(WINDOW_FLAG_RESIZE_DISABLED);1829BIND_ENUM_CONSTANT(WINDOW_FLAG_BORDERLESS);1830BIND_ENUM_CONSTANT(WINDOW_FLAG_ALWAYS_ON_TOP);1831BIND_ENUM_CONSTANT(WINDOW_FLAG_TRANSPARENT);1832BIND_ENUM_CONSTANT(WINDOW_FLAG_NO_FOCUS);1833BIND_ENUM_CONSTANT(WINDOW_FLAG_POPUP);1834BIND_ENUM_CONSTANT(WINDOW_FLAG_EXTEND_TO_TITLE);1835BIND_ENUM_CONSTANT(WINDOW_FLAG_MOUSE_PASSTHROUGH);1836BIND_ENUM_CONSTANT(WINDOW_FLAG_SHARP_CORNERS);1837BIND_ENUM_CONSTANT(WINDOW_FLAG_EXCLUDE_FROM_CAPTURE);1838BIND_ENUM_CONSTANT(WINDOW_FLAG_POPUP_WM_HINT);1839BIND_ENUM_CONSTANT(WINDOW_FLAG_MINIMIZE_DISABLED);1840BIND_ENUM_CONSTANT(WINDOW_FLAG_MAXIMIZE_DISABLED);1841BIND_ENUM_CONSTANT(WINDOW_FLAG_MAX);18421843BIND_ENUM_CONSTANT(WINDOW_EVENT_MOUSE_ENTER);1844BIND_ENUM_CONSTANT(WINDOW_EVENT_MOUSE_EXIT);1845BIND_ENUM_CONSTANT(WINDOW_EVENT_FOCUS_IN);1846BIND_ENUM_CONSTANT(WINDOW_EVENT_FOCUS_OUT);1847BIND_ENUM_CONSTANT(WINDOW_EVENT_CLOSE_REQUEST);1848BIND_ENUM_CONSTANT(WINDOW_EVENT_GO_BACK_REQUEST);1849BIND_ENUM_CONSTANT(WINDOW_EVENT_DPI_CHANGE);1850BIND_ENUM_CONSTANT(WINDOW_EVENT_TITLEBAR_CHANGE);1851BIND_ENUM_CONSTANT(WINDOW_EVENT_FORCE_CLOSE);18521853BIND_ENUM_CONSTANT(WINDOW_EDGE_TOP_LEFT);1854BIND_ENUM_CONSTANT(WINDOW_EDGE_TOP);1855BIND_ENUM_CONSTANT(WINDOW_EDGE_TOP_RIGHT);1856BIND_ENUM_CONSTANT(WINDOW_EDGE_LEFT);1857BIND_ENUM_CONSTANT(WINDOW_EDGE_RIGHT);1858BIND_ENUM_CONSTANT(WINDOW_EDGE_BOTTOM_LEFT);1859BIND_ENUM_CONSTANT(WINDOW_EDGE_BOTTOM);1860BIND_ENUM_CONSTANT(WINDOW_EDGE_BOTTOM_RIGHT);1861BIND_ENUM_CONSTANT(WINDOW_EDGE_MAX);18621863BIND_ENUM_CONSTANT(VSYNC_DISABLED);1864BIND_ENUM_CONSTANT(VSYNC_ENABLED);1865BIND_ENUM_CONSTANT(VSYNC_ADAPTIVE);1866BIND_ENUM_CONSTANT(VSYNC_MAILBOX);18671868BIND_ENUM_CONSTANT(DISPLAY_HANDLE);1869BIND_ENUM_CONSTANT(WINDOW_HANDLE);1870BIND_ENUM_CONSTANT(WINDOW_VIEW);1871BIND_ENUM_CONSTANT(OPENGL_CONTEXT);1872BIND_ENUM_CONSTANT(EGL_DISPLAY);1873BIND_ENUM_CONSTANT(EGL_CONFIG);18741875BIND_ENUM_CONSTANT(TTS_UTTERANCE_STARTED);1876BIND_ENUM_CONSTANT(TTS_UTTERANCE_ENDED);1877BIND_ENUM_CONSTANT(TTS_UTTERANCE_CANCELED);1878BIND_ENUM_CONSTANT(TTS_UTTERANCE_BOUNDARY);1879}18801881Ref<Image> DisplayServer::_get_cursor_image_from_resource(const Ref<Resource> &p_cursor, const Vector2 &p_hotspot) {1882Ref<Image> image;1883ERR_FAIL_COND_V_MSG(p_hotspot.x < 0 || p_hotspot.y < 0, image, "Hotspot outside cursor image.");18841885Ref<Texture2D> texture = p_cursor;1886if (texture.is_valid()) {1887image = texture->get_image();1888} else {1889image = p_cursor;1890}1891ERR_FAIL_COND_V(image.is_null(), image);18921893Size2 image_size = image->get_size();1894ERR_FAIL_COND_V_MSG(p_hotspot.x > image_size.width || p_hotspot.y > image_size.height, image, "Hotspot outside cursor image.");1895ERR_FAIL_COND_V_MSG(image_size.width > 256 || image_size.height > 256, image, "Cursor image too big. Max supported size is 256x256.");18961897if (image->is_compressed()) {1898image = image->duplicate(true);1899Error err = image->decompress();1900ERR_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.");1901}1902return image;1903}19041905void DisplayServer::register_create_function(const char *p_name, CreateFunction p_function, GetRenderingDriversFunction p_get_drivers) {1906ERR_FAIL_COND(server_create_count == MAX_SERVERS);1907// Headless display server is always last1908server_create_functions[server_create_count] = server_create_functions[server_create_count - 1];1909server_create_functions[server_create_count - 1].name = p_name;1910server_create_functions[server_create_count - 1].create_function = p_function;1911server_create_functions[server_create_count - 1].get_rendering_drivers_function = p_get_drivers;1912server_create_count++;1913}19141915int DisplayServer::get_create_function_count() {1916return server_create_count;1917}19181919const char *DisplayServer::get_create_function_name(int p_index) {1920ERR_FAIL_INDEX_V(p_index, server_create_count, nullptr);1921return server_create_functions[p_index].name;1922}19231924Vector<String> DisplayServer::get_create_function_rendering_drivers(int p_index) {1925ERR_FAIL_INDEX_V(p_index, server_create_count, Vector<String>());1926return server_create_functions[p_index].get_rendering_drivers_function();1927}19281929DisplayServer *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) {1930ERR_FAIL_INDEX_V(p_index, server_create_count, nullptr);1931return 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);1932}19331934void DisplayServer::_input_set_mouse_mode(Input::MouseMode p_mode) {1935singleton->mouse_set_mode(MouseMode(p_mode));1936}19371938Input::MouseMode DisplayServer::_input_get_mouse_mode() {1939return Input::MouseMode(singleton->mouse_get_mode());1940}19411942void DisplayServer::_input_set_mouse_mode_override(Input::MouseMode p_mode) {1943singleton->mouse_set_mode_override(MouseMode(p_mode));1944}19451946Input::MouseMode DisplayServer::_input_get_mouse_mode_override() {1947return Input::MouseMode(singleton->mouse_get_mode_override());1948}19491950void DisplayServer::_input_set_mouse_mode_override_enabled(bool p_enabled) {1951singleton->mouse_set_mode_override_enabled(p_enabled);1952}19531954bool DisplayServer::_input_is_mouse_mode_override_enabled() {1955return singleton->mouse_is_mode_override_enabled();1956}19571958void DisplayServer::_input_warp(const Vector2 &p_to_pos) {1959singleton->warp_mouse(p_to_pos);1960}19611962Input::CursorShape DisplayServer::_input_get_current_cursor_shape() {1963return (Input::CursorShape)singleton->cursor_get_shape();1964}19651966void DisplayServer::_input_set_custom_mouse_cursor_func(const Ref<Resource> &p_image, Input::CursorShape p_shape, const Vector2 &p_hotspot) {1967singleton->cursor_set_custom_image(p_image, (CursorShape)p_shape, p_hotspot);1968}19691970bool DisplayServer::is_rendering_device_supported() {1971#if defined(RD_ENABLED)1972RenderingDevice *device = RenderingDevice::get_singleton();1973if (device) {1974return true;1975}19761977if (supported_rendering_device == RenderingDeviceCreationStatus::SUCCESS) {1978return true;1979} else if (supported_rendering_device == RenderingDeviceCreationStatus::FAILURE) {1980return false;1981}19821983Error err;19841985#if defined(WINDOWS_ENABLED) || defined(LINUXBSD_ENABLED)1986// On some drivers combining OpenGL and RenderingDevice can result in crash, offload the check to the subprocess.1987List<String> arguments;1988arguments.push_back("--test-rd-support");1989if (get_singleton()) {1990arguments.push_back("--display-driver");1991arguments.push_back(get_singleton()->get_name().to_lower());1992}19931994String pipe;1995int exitcode = 0;1996err = OS::get_singleton()->execute(OS::get_singleton()->get_executable_path(), arguments, &pipe, &exitcode);1997if (err == OK && exitcode == 0) {1998supported_rendering_device = RenderingDeviceCreationStatus::SUCCESS;1999return true;2000} else {2001supported_rendering_device = RenderingDeviceCreationStatus::FAILURE;2002}2003#else // WINDOWS_ENABLED20042005RenderingContextDriver *rcd = nullptr;20062007#if defined(VULKAN_ENABLED)2008rcd = memnew(RenderingContextDriverVulkan);2009#endif2010#ifdef D3D12_ENABLED2011if (rcd == nullptr) {2012rcd = memnew(RenderingContextDriverD3D12);2013}2014#endif2015#ifdef METAL_ENABLED2016if (rcd == nullptr) {2017GODOT_CLANG_WARNING_PUSH_AND_IGNORE("-Wunguarded-availability")2018// Eliminate "RenderingContextDriverMetal is only available on iOS 14.0 or newer".2019rcd = memnew(RenderingContextDriverMetal);2020GODOT_CLANG_WARNING_POP2021}2022#endif20232024if (rcd != nullptr) {2025err = rcd->initialize();2026if (err == OK) {2027RenderingDevice *rd = memnew(RenderingDevice);2028err = rd->initialize(rcd);2029memdelete(rd);2030rd = nullptr;2031if (err == OK) {2032// Creating a RenderingDevice is quite slow.2033// Cache the result for future usage, so that it's much faster on subsequent calls.2034supported_rendering_device = RenderingDeviceCreationStatus::SUCCESS;2035memdelete(rcd);2036rcd = nullptr;2037return true;2038} else {2039supported_rendering_device = RenderingDeviceCreationStatus::FAILURE;2040}2041}20422043memdelete(rcd);2044rcd = nullptr;2045}20462047#endif // WINDOWS_ENABLED2048#endif // RD_ENABLED2049return false;2050}20512052bool DisplayServer::can_create_rendering_device() {2053if (get_singleton() && get_singleton()->get_name() == "headless") {2054return false;2055}20562057#if defined(RD_ENABLED)2058RenderingDevice *device = RenderingDevice::get_singleton();2059if (device) {2060return true;2061}20622063if (created_rendering_device == RenderingDeviceCreationStatus::SUCCESS) {2064return true;2065} else if (created_rendering_device == RenderingDeviceCreationStatus::FAILURE) {2066return false;2067}20682069Error err;20702071#ifdef WINDOWS_ENABLED2072// On some NVIDIA drivers combining OpenGL and RenderingDevice can result in crash, offload the check to the subprocess.2073List<String> arguments;2074arguments.push_back("--test-rd-creation");20752076String pipe;2077int exitcode = 0;2078err = OS::get_singleton()->execute(OS::get_singleton()->get_executable_path(), arguments, &pipe, &exitcode);2079if (err == OK && exitcode == 0) {2080created_rendering_device = RenderingDeviceCreationStatus::SUCCESS;2081return true;2082} else {2083created_rendering_device = RenderingDeviceCreationStatus::FAILURE;2084}2085#else // WINDOWS_ENABLED20862087RenderingContextDriver *rcd = nullptr;20882089#if defined(VULKAN_ENABLED)2090rcd = memnew(RenderingContextDriverVulkan);2091#endif2092#ifdef D3D12_ENABLED2093if (rcd == nullptr) {2094rcd = memnew(RenderingContextDriverD3D12);2095}2096#endif2097#ifdef METAL_ENABLED2098if (rcd == nullptr) {2099GODOT_CLANG_WARNING_PUSH_AND_IGNORE("-Wunguarded-availability")2100// Eliminate "RenderingContextDriverMetal is only available on iOS 14.0 or newer".2101rcd = memnew(RenderingContextDriverMetal);2102GODOT_CLANG_WARNING_POP2103}2104#endif21052106if (rcd != nullptr) {2107err = rcd->initialize();2108if (err == OK) {2109RenderingDevice *rd = memnew(RenderingDevice);2110err = rd->initialize(rcd);2111memdelete(rd);2112rd = nullptr;2113if (err == OK) {2114// Creating a RenderingDevice is quite slow.2115// Cache the result for future usage, so that it's much faster on subsequent calls.2116created_rendering_device = RenderingDeviceCreationStatus::SUCCESS;2117memdelete(rcd);2118rcd = nullptr;2119return true;2120} else {2121created_rendering_device = RenderingDeviceCreationStatus::FAILURE;2122}2123}21242125memdelete(rcd);2126rcd = nullptr;2127}21282129#endif // WINDOWS_ENABLED2130#endif // RD_ENABLED2131return false;2132}21332134DisplayServer::DisplayServer() {2135singleton = this;2136Input::set_mouse_mode_func = _input_set_mouse_mode;2137Input::get_mouse_mode_func = _input_get_mouse_mode;2138Input::set_mouse_mode_override_func = _input_set_mouse_mode_override;2139Input::get_mouse_mode_override_func = _input_get_mouse_mode_override;2140Input::set_mouse_mode_override_enabled_func = _input_set_mouse_mode_override_enabled;2141Input::is_mouse_mode_override_enabled_func = _input_is_mouse_mode_override_enabled;2142Input::warp_mouse_func = _input_warp;2143Input::get_current_cursor_shape_func = _input_get_current_cursor_shape;2144Input::set_custom_mouse_cursor_func = _input_set_custom_mouse_cursor_func;2145}21462147DisplayServer::~DisplayServer() {2148singleton = nullptr;2149}215021512152