Path: blob/master/servers/display/display_server.cpp
20941 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"3233STATIC_ASSERT_INCOMPLETE_TYPE(class, Input);3435#include "core/input/input.h"36#include "scene/resources/texture.h"37#include "servers/display/display_server_headless.h"3839#if defined(VULKAN_ENABLED)40#include "drivers/vulkan/rendering_context_driver_vulkan.h"41#undef CursorShape42#endif43#if defined(D3D12_ENABLED)44#include "drivers/d3d12/rendering_context_driver_d3d12.h"45#endif46#if defined(METAL_ENABLED)47#include "drivers/metal/rendering_context_driver_metal.h"48#endif4950DisplayServer *DisplayServer::singleton = nullptr;5152DisplayServer::AccessibilityMode DisplayServer::accessibility_mode = DisplayServer::AccessibilityMode::ACCESSIBILITY_AUTO;5354bool DisplayServer::hidpi_allowed = false;5556bool DisplayServer::window_early_clear_override_enabled = false;57Color DisplayServer::window_early_clear_override_color = Color(0, 0, 0, 0);5859DisplayServer::DisplayServerCreate DisplayServer::server_create_functions[DisplayServer::MAX_SERVERS] = {60{ "headless", &DisplayServerHeadless::create_func, &DisplayServerHeadless::get_rendering_drivers_func }61};6263int DisplayServer::server_create_count = 1;6465void DisplayServer::help_set_search_callbacks(const Callable &p_search_callback, const Callable &p_action_callback) {66WARN_PRINT("Native help is not supported by this display server.");67}6869#ifndef DISABLE_DEPRECATED7071RID DisplayServer::_get_rid_from_name(NativeMenu *p_nmenu, const String &p_menu_root) const {72if (p_menu_root == "_main") {73return p_nmenu->get_system_menu(NativeMenu::MAIN_MENU_ID);74} else if (p_menu_root == "_apple") {75return p_nmenu->get_system_menu(NativeMenu::APPLICATION_MENU_ID);76} else if (p_menu_root == "_dock") {77return p_nmenu->get_system_menu(NativeMenu::DOCK_MENU_ID);78} else if (p_menu_root == "_help") {79return p_nmenu->get_system_menu(NativeMenu::HELP_MENU_ID);80} else if (p_menu_root == "_window") {81return p_nmenu->get_system_menu(NativeMenu::WINDOW_MENU_ID);82} else if (menu_names.has(p_menu_root)) {83return menu_names[p_menu_root];84}8586RID rid = p_nmenu->create_menu();87menu_names[p_menu_root] = rid;88return rid;89}9091int 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) {92NativeMenu *nmenu = NativeMenu::get_singleton();93ERR_FAIL_NULL_V(nmenu, -1);94return nmenu->add_item(_get_rid_from_name(nmenu, p_menu_root), p_label, p_callback, p_key_callback, p_tag, p_accel, p_index);95}9697int 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) {98NativeMenu *nmenu = NativeMenu::get_singleton();99ERR_FAIL_NULL_V(nmenu, -1);100return 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);101}102103int 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) {104NativeMenu *nmenu = NativeMenu::get_singleton();105ERR_FAIL_NULL_V(nmenu, -1);106return 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);107}108109int 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) {110NativeMenu *nmenu = NativeMenu::get_singleton();111ERR_FAIL_NULL_V(nmenu, -1);112return 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);113}114115int 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) {116NativeMenu *nmenu = NativeMenu::get_singleton();117ERR_FAIL_NULL_V(nmenu, -1);118return 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);119}120121int 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) {122NativeMenu *nmenu = NativeMenu::get_singleton();123ERR_FAIL_NULL_V(nmenu, -1);124return 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);125}126127int 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) {128NativeMenu *nmenu = NativeMenu::get_singleton();129ERR_FAIL_NULL_V(nmenu, -1);130return 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);131}132133void DisplayServer::global_menu_set_popup_callbacks(const String &p_menu_root, const Callable &p_open_callback, const Callable &p_close_callback) {134NativeMenu *nmenu = NativeMenu::get_singleton();135ERR_FAIL_NULL(nmenu);136nmenu->set_popup_open_callback(_get_rid_from_name(nmenu, p_menu_root), p_open_callback);137nmenu->set_popup_open_callback(_get_rid_from_name(nmenu, p_menu_root), p_close_callback);138}139140int DisplayServer::global_menu_add_submenu_item(const String &p_menu_root, const String &p_label, const String &p_submenu, int p_index) {141NativeMenu *nmenu = NativeMenu::get_singleton();142ERR_FAIL_NULL_V(nmenu, -1);143return nmenu->add_submenu_item(_get_rid_from_name(nmenu, p_menu_root), p_label, _get_rid_from_name(nmenu, p_submenu), Variant(), p_index);144}145146int DisplayServer::global_menu_add_separator(const String &p_menu_root, int p_index) {147NativeMenu *nmenu = NativeMenu::get_singleton();148ERR_FAIL_NULL_V(nmenu, -1);149return nmenu->add_separator(_get_rid_from_name(nmenu, p_menu_root), p_index);150}151152int DisplayServer::global_menu_get_item_index_from_text(const String &p_menu_root, const String &p_text) const {153NativeMenu *nmenu = NativeMenu::get_singleton();154ERR_FAIL_NULL_V(nmenu, -1);155return nmenu->find_item_index_with_text(_get_rid_from_name(nmenu, p_menu_root), p_text);156}157158int DisplayServer::global_menu_get_item_index_from_tag(const String &p_menu_root, const Variant &p_tag) const {159NativeMenu *nmenu = NativeMenu::get_singleton();160ERR_FAIL_NULL_V(nmenu, -1);161return nmenu->find_item_index_with_tag(_get_rid_from_name(nmenu, p_menu_root), p_tag);162}163164void DisplayServer::global_menu_set_item_callback(const String &p_menu_root, int p_idx, const Callable &p_callback) {165NativeMenu *nmenu = NativeMenu::get_singleton();166ERR_FAIL_NULL(nmenu);167nmenu->set_item_callback(_get_rid_from_name(nmenu, p_menu_root), p_idx, p_callback);168}169170void DisplayServer::global_menu_set_item_hover_callbacks(const String &p_menu_root, int p_idx, const Callable &p_callback) {171NativeMenu *nmenu = NativeMenu::get_singleton();172ERR_FAIL_NULL(nmenu);173nmenu->set_item_hover_callbacks(_get_rid_from_name(nmenu, p_menu_root), p_idx, p_callback);174}175176void DisplayServer::global_menu_set_item_key_callback(const String &p_menu_root, int p_idx, const Callable &p_key_callback) {177NativeMenu *nmenu = NativeMenu::get_singleton();178ERR_FAIL_NULL(nmenu);179nmenu->set_item_key_callback(_get_rid_from_name(nmenu, p_menu_root), p_idx, p_key_callback);180}181182bool DisplayServer::global_menu_is_item_checked(const String &p_menu_root, int p_idx) const {183NativeMenu *nmenu = NativeMenu::get_singleton();184ERR_FAIL_NULL_V(nmenu, false);185return nmenu->is_item_checked(_get_rid_from_name(nmenu, p_menu_root), p_idx);186}187188bool DisplayServer::global_menu_is_item_checkable(const String &p_menu_root, int p_idx) const {189NativeMenu *nmenu = NativeMenu::get_singleton();190ERR_FAIL_NULL_V(nmenu, false);191return nmenu->is_item_checkable(_get_rid_from_name(nmenu, p_menu_root), p_idx);192}193194bool DisplayServer::global_menu_is_item_radio_checkable(const String &p_menu_root, int p_idx) const {195NativeMenu *nmenu = NativeMenu::get_singleton();196ERR_FAIL_NULL_V(nmenu, false);197return nmenu->is_item_radio_checkable(_get_rid_from_name(nmenu, p_menu_root), p_idx);198}199200Callable DisplayServer::global_menu_get_item_callback(const String &p_menu_root, int p_idx) const {201NativeMenu *nmenu = NativeMenu::get_singleton();202ERR_FAIL_NULL_V(nmenu, Callable());203return nmenu->get_item_callback(_get_rid_from_name(nmenu, p_menu_root), p_idx);204}205206Callable DisplayServer::global_menu_get_item_key_callback(const String &p_menu_root, int p_idx) const {207NativeMenu *nmenu = NativeMenu::get_singleton();208ERR_FAIL_NULL_V(nmenu, Callable());209return nmenu->get_item_key_callback(_get_rid_from_name(nmenu, p_menu_root), p_idx);210}211212Variant DisplayServer::global_menu_get_item_tag(const String &p_menu_root, int p_idx) const {213NativeMenu *nmenu = NativeMenu::get_singleton();214ERR_FAIL_NULL_V(nmenu, Variant());215return nmenu->get_item_tag(_get_rid_from_name(nmenu, p_menu_root), p_idx);216}217218String DisplayServer::global_menu_get_item_text(const String &p_menu_root, int p_idx) const {219NativeMenu *nmenu = NativeMenu::get_singleton();220ERR_FAIL_NULL_V(nmenu, String());221return nmenu->get_item_text(_get_rid_from_name(nmenu, p_menu_root), p_idx);222}223224String DisplayServer::global_menu_get_item_submenu(const String &p_menu_root, int p_idx) const {225NativeMenu *nmenu = NativeMenu::get_singleton();226ERR_FAIL_NULL_V(nmenu, String());227RID rid = nmenu->get_item_submenu(_get_rid_from_name(nmenu, p_menu_root), p_idx);228if (!nmenu->is_system_menu(rid)) {229for (HashMap<String, RID>::Iterator E = menu_names.begin(); E; ++E) {230if (E->value == rid) {231return E->key;232}233}234}235return String();236}237238Key DisplayServer::global_menu_get_item_accelerator(const String &p_menu_root, int p_idx) const {239NativeMenu *nmenu = NativeMenu::get_singleton();240ERR_FAIL_NULL_V(nmenu, Key::NONE);241return nmenu->get_item_accelerator(_get_rid_from_name(nmenu, p_menu_root), p_idx);242}243244bool DisplayServer::global_menu_is_item_disabled(const String &p_menu_root, int p_idx) const {245NativeMenu *nmenu = NativeMenu::get_singleton();246ERR_FAIL_NULL_V(nmenu, false);247return nmenu->is_item_disabled(_get_rid_from_name(nmenu, p_menu_root), p_idx);248}249250bool DisplayServer::global_menu_is_item_hidden(const String &p_menu_root, int p_idx) const {251NativeMenu *nmenu = NativeMenu::get_singleton();252ERR_FAIL_NULL_V(nmenu, false);253return nmenu->is_item_hidden(_get_rid_from_name(nmenu, p_menu_root), p_idx);254}255256String DisplayServer::global_menu_get_item_tooltip(const String &p_menu_root, int p_idx) const {257NativeMenu *nmenu = NativeMenu::get_singleton();258ERR_FAIL_NULL_V(nmenu, String());259return nmenu->get_item_tooltip(_get_rid_from_name(nmenu, p_menu_root), p_idx);260}261262int DisplayServer::global_menu_get_item_state(const String &p_menu_root, int p_idx) const {263NativeMenu *nmenu = NativeMenu::get_singleton();264ERR_FAIL_NULL_V(nmenu, -1);265return nmenu->get_item_state(_get_rid_from_name(nmenu, p_menu_root), p_idx);266}267268int DisplayServer::global_menu_get_item_max_states(const String &p_menu_root, int p_idx) const {269NativeMenu *nmenu = NativeMenu::get_singleton();270ERR_FAIL_NULL_V(nmenu, -1);271return nmenu->get_item_max_states(_get_rid_from_name(nmenu, p_menu_root), p_idx);272}273274Ref<Texture2D> DisplayServer::global_menu_get_item_icon(const String &p_menu_root, int p_idx) const {275NativeMenu *nmenu = NativeMenu::get_singleton();276ERR_FAIL_NULL_V(nmenu, Ref<Texture2D>());277return nmenu->get_item_icon(_get_rid_from_name(nmenu, p_menu_root), p_idx);278}279280int DisplayServer::global_menu_get_item_indentation_level(const String &p_menu_root, int p_idx) const {281NativeMenu *nmenu = NativeMenu::get_singleton();282ERR_FAIL_NULL_V(nmenu, 0);283return nmenu->get_item_indentation_level(_get_rid_from_name(nmenu, p_menu_root), p_idx);284}285286void DisplayServer::global_menu_set_item_checked(const String &p_menu_root, int p_idx, bool p_checked) {287NativeMenu *nmenu = NativeMenu::get_singleton();288ERR_FAIL_NULL(nmenu);289nmenu->set_item_checked(_get_rid_from_name(nmenu, p_menu_root), p_idx, p_checked);290}291292void DisplayServer::global_menu_set_item_checkable(const String &p_menu_root, int p_idx, bool p_checkable) {293NativeMenu *nmenu = NativeMenu::get_singleton();294ERR_FAIL_NULL(nmenu);295nmenu->set_item_checkable(_get_rid_from_name(nmenu, p_menu_root), p_idx, p_checkable);296}297298void DisplayServer::global_menu_set_item_radio_checkable(const String &p_menu_root, int p_idx, bool p_checkable) {299NativeMenu *nmenu = NativeMenu::get_singleton();300ERR_FAIL_NULL(nmenu);301nmenu->set_item_radio_checkable(_get_rid_from_name(nmenu, p_menu_root), p_idx, p_checkable);302}303304void DisplayServer::global_menu_set_item_tag(const String &p_menu_root, int p_idx, const Variant &p_tag) {305NativeMenu *nmenu = NativeMenu::get_singleton();306ERR_FAIL_NULL(nmenu);307nmenu->set_item_tag(_get_rid_from_name(nmenu, p_menu_root), p_idx, p_tag);308}309310void DisplayServer::global_menu_set_item_text(const String &p_menu_root, int p_idx, const String &p_text) {311NativeMenu *nmenu = NativeMenu::get_singleton();312ERR_FAIL_NULL(nmenu);313nmenu->set_item_text(_get_rid_from_name(nmenu, p_menu_root), p_idx, p_text);314}315316void DisplayServer::global_menu_set_item_submenu(const String &p_menu_root, int p_idx, const String &p_submenu) {317NativeMenu *nmenu = NativeMenu::get_singleton();318ERR_FAIL_NULL(nmenu);319nmenu->set_item_submenu(_get_rid_from_name(nmenu, p_menu_root), p_idx, _get_rid_from_name(nmenu, p_submenu));320}321322void DisplayServer::global_menu_set_item_accelerator(const String &p_menu_root, int p_idx, Key p_keycode) {323NativeMenu *nmenu = NativeMenu::get_singleton();324ERR_FAIL_NULL(nmenu);325nmenu->set_item_accelerator(_get_rid_from_name(nmenu, p_menu_root), p_idx, p_keycode);326}327328void DisplayServer::global_menu_set_item_disabled(const String &p_menu_root, int p_idx, bool p_disabled) {329NativeMenu *nmenu = NativeMenu::get_singleton();330ERR_FAIL_NULL(nmenu);331nmenu->set_item_disabled(_get_rid_from_name(nmenu, p_menu_root), p_idx, p_disabled);332}333334void DisplayServer::global_menu_set_item_hidden(const String &p_menu_root, int p_idx, bool p_hidden) {335NativeMenu *nmenu = NativeMenu::get_singleton();336ERR_FAIL_NULL(nmenu);337nmenu->set_item_hidden(_get_rid_from_name(nmenu, p_menu_root), p_idx, p_hidden);338}339340void DisplayServer::global_menu_set_item_tooltip(const String &p_menu_root, int p_idx, const String &p_tooltip) {341NativeMenu *nmenu = NativeMenu::get_singleton();342ERR_FAIL_NULL(nmenu);343nmenu->set_item_tooltip(_get_rid_from_name(nmenu, p_menu_root), p_idx, p_tooltip);344}345346void DisplayServer::global_menu_set_item_state(const String &p_menu_root, int p_idx, int p_state) {347NativeMenu *nmenu = NativeMenu::get_singleton();348ERR_FAIL_NULL(nmenu);349nmenu->set_item_state(_get_rid_from_name(nmenu, p_menu_root), p_idx, p_state);350}351352void DisplayServer::global_menu_set_item_max_states(const String &p_menu_root, int p_idx, int p_max_states) {353NativeMenu *nmenu = NativeMenu::get_singleton();354ERR_FAIL_NULL(nmenu);355nmenu->set_item_max_states(_get_rid_from_name(nmenu, p_menu_root), p_idx, p_max_states);356}357358void DisplayServer::global_menu_set_item_icon(const String &p_menu_root, int p_idx, const Ref<Texture2D> &p_icon) {359NativeMenu *nmenu = NativeMenu::get_singleton();360ERR_FAIL_NULL(nmenu);361nmenu->set_item_icon(_get_rid_from_name(nmenu, p_menu_root), p_idx, p_icon);362}363364void DisplayServer::global_menu_set_item_indentation_level(const String &p_menu_root, int p_idx, int p_level) {365NativeMenu *nmenu = NativeMenu::get_singleton();366ERR_FAIL_NULL(nmenu);367nmenu->set_item_indentation_level(_get_rid_from_name(nmenu, p_menu_root), p_idx, p_level);368}369370int DisplayServer::global_menu_get_item_count(const String &p_menu_root) const {371NativeMenu *nmenu = NativeMenu::get_singleton();372ERR_FAIL_NULL_V(nmenu, 0);373return nmenu->get_item_count(_get_rid_from_name(nmenu, p_menu_root));374}375376void DisplayServer::global_menu_remove_item(const String &p_menu_root, int p_idx) {377NativeMenu *nmenu = NativeMenu::get_singleton();378ERR_FAIL_NULL(nmenu);379nmenu->remove_item(_get_rid_from_name(nmenu, p_menu_root), p_idx);380}381382void DisplayServer::global_menu_clear(const String &p_menu_root) {383NativeMenu *nmenu = NativeMenu::get_singleton();384ERR_FAIL_NULL(nmenu);385RID rid = _get_rid_from_name(nmenu, p_menu_root);386nmenu->clear(rid);387if (!nmenu->is_system_menu(rid)) {388nmenu->free_menu(rid);389menu_names.erase(p_menu_root);390}391}392393Dictionary DisplayServer::global_menu_get_system_menu_roots() const {394NativeMenu *nmenu = NativeMenu::get_singleton();395ERR_FAIL_NULL_V(nmenu, Dictionary());396397Dictionary out;398if (nmenu->has_system_menu(NativeMenu::DOCK_MENU_ID)) {399out["_dock"] = "@Dock";400}401if (nmenu->has_system_menu(NativeMenu::APPLICATION_MENU_ID)) {402out["_apple"] = "@Apple";403}404if (nmenu->has_system_menu(NativeMenu::WINDOW_MENU_ID)) {405out["_window"] = "Window";406}407if (nmenu->has_system_menu(NativeMenu::HELP_MENU_ID)) {408out["_help"] = "Help";409}410return out;411}412413#endif414415bool DisplayServer::tts_is_speaking() const {416WARN_PRINT("TTS is not supported by this display server.");417return false;418}419420bool DisplayServer::tts_is_paused() const {421WARN_PRINT("TTS is not supported by this display server.");422return false;423}424425void DisplayServer::tts_pause() {426WARN_PRINT("TTS is not supported by this display server.");427}428429void DisplayServer::tts_resume() {430WARN_PRINT("TTS is not supported by this display server.");431}432433TypedArray<Dictionary> DisplayServer::tts_get_voices() const {434WARN_PRINT("TTS is not supported by this display server.");435return TypedArray<Dictionary>();436}437438PackedStringArray DisplayServer::tts_get_voices_for_language(const String &p_language) const {439PackedStringArray ret;440TypedArray<Dictionary> voices = tts_get_voices();441for (int i = 0; i < voices.size(); i++) {442const Dictionary &voice = voices[i];443if (voice.has("id") && voice.has("language") && voice["language"].operator String().begins_with(p_language)) {444ret.push_back(voice["id"]);445}446}447return ret;448}449450void DisplayServer::tts_speak(const String &p_text, const String &p_voice, int p_volume, float p_pitch, float p_rate, int64_t p_utterance_id, bool p_interrupt) {451WARN_PRINT("TTS is not supported by this display server.");452}453454void DisplayServer::tts_stop() {455WARN_PRINT("TTS is not supported by this display server.");456}457458void DisplayServer::tts_set_utterance_callback(TTSUtteranceEvent p_event, const Callable &p_callable) {459ERR_FAIL_INDEX(p_event, DisplayServer::TTS_UTTERANCE_MAX);460utterance_callback[p_event] = p_callable;461}462463void DisplayServer::tts_post_utterance_event(TTSUtteranceEvent p_event, int64_t p_id, int p_pos) {464ERR_FAIL_INDEX(p_event, DisplayServer::TTS_UTTERANCE_MAX);465switch (p_event) {466case DisplayServer::TTS_UTTERANCE_STARTED:467case DisplayServer::TTS_UTTERANCE_ENDED:468case DisplayServer::TTS_UTTERANCE_CANCELED: {469if (utterance_callback[p_event].is_valid()) {470utterance_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.471}472} break;473case DisplayServer::TTS_UTTERANCE_BOUNDARY: {474if (utterance_callback[p_event].is_valid()) {475utterance_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.476}477} break;478default:479break;480}481}482483bool DisplayServer::_get_window_early_clear_override(Color &r_color) {484if (window_early_clear_override_enabled) {485r_color = window_early_clear_override_color;486return true;487} else if (RenderingServer::get_singleton()) {488r_color = RenderingServer::get_singleton()->get_default_clear_color();489return true;490} else {491return false;492}493}494495void DisplayServer::set_early_window_clear_color_override(bool p_enabled, Color p_color) {496window_early_clear_override_enabled = p_enabled;497window_early_clear_override_color = p_color;498}499500void DisplayServer::mouse_set_mode(MouseMode p_mode) {501WARN_PRINT("Mouse is not supported by this display server.");502}503504DisplayServer::MouseMode DisplayServer::mouse_get_mode() const {505return MOUSE_MODE_VISIBLE;506}507508void DisplayServer::mouse_set_mode_override(MouseMode p_mode) {509WARN_PRINT("Mouse is not supported by this display server.");510}511512DisplayServer::MouseMode DisplayServer::mouse_get_mode_override() const {513return MOUSE_MODE_VISIBLE;514}515516void DisplayServer::mouse_set_mode_override_enabled(bool p_override_enabled) {517WARN_PRINT("Mouse is not supported by this display server.");518}519520bool DisplayServer::mouse_is_mode_override_enabled() const {521return false;522}523524void DisplayServer::warp_mouse(const Point2i &p_position) {525}526527Point2i DisplayServer::mouse_get_position() const {528ERR_FAIL_V_MSG(Point2i(), "Mouse is not supported by this display server.");529}530531BitField<MouseButtonMask> DisplayServer::mouse_get_button_state() const {532ERR_FAIL_V_MSG(MouseButtonMask::NONE, "Mouse is not supported by this display server.");533}534535void DisplayServer::clipboard_set(const String &p_text) {536WARN_PRINT("Clipboard is not supported by this display server.");537}538539String DisplayServer::clipboard_get() const {540ERR_FAIL_V_MSG(String(), "Clipboard is not supported by this display server.");541}542543Ref<Image> DisplayServer::clipboard_get_image() const {544ERR_FAIL_V_MSG(Ref<Image>(), "Clipboard is not supported by this display server.");545}546547bool DisplayServer::clipboard_has() const {548return !clipboard_get().is_empty();549}550551bool DisplayServer::clipboard_has_image() const {552return clipboard_get_image().is_valid();553}554555void DisplayServer::clipboard_set_primary(const String &p_text) {556WARN_PRINT("Primary clipboard is not supported by this display server.");557}558559String DisplayServer::clipboard_get_primary() const {560ERR_FAIL_V_MSG(String(), "Primary clipboard is not supported by this display server.");561}562563void DisplayServer::screen_set_orientation(ScreenOrientation p_orientation, int p_screen) {564WARN_PRINT("Orientation not supported by this display server.");565}566567DisplayServer::ScreenOrientation DisplayServer::screen_get_orientation(int p_screen) const {568return SCREEN_LANDSCAPE;569}570571float DisplayServer::screen_get_scale(int p_screen) const {572return 1.0f;573}574575bool DisplayServer::is_touchscreen_available() const {576return Input::get_singleton() && Input::get_singleton()->is_emulating_touch_from_mouse();577}578579void DisplayServer::screen_set_keep_on(bool p_enable) {580WARN_PRINT("Keeping screen on not supported by this display server.");581}582583bool DisplayServer::screen_is_kept_on() const {584return false;585}586587int DisplayServer::get_screen_from_rect(const Rect2 &p_rect) const {588int nearest_area = 0;589int pos_screen = INVALID_SCREEN;590for (int i = 0; i < get_screen_count(); i++) {591Rect2i r;592r.position = screen_get_position(i);593r.size = screen_get_size(i);594Rect2 inters = r.intersection(p_rect);595int area = inters.size.width * inters.size.height;596if (area > nearest_area) {597pos_screen = i;598nearest_area = area;599}600}601return pos_screen;602}603604DisplayServer::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) {605ERR_FAIL_V_MSG(INVALID_WINDOW_ID, "Sub-windows not supported by this display server.");606}607608void DisplayServer::show_window(WindowID p_id) {609ERR_FAIL_MSG("Sub-windows not supported by this display server.");610}611612void DisplayServer::delete_sub_window(WindowID p_id) {613ERR_FAIL_MSG("Sub-windows not supported by this display server.");614}615616void DisplayServer::window_set_exclusive(WindowID p_window, bool p_exclusive) {617// Do nothing, if not supported.618}619620void DisplayServer::window_set_mouse_passthrough(const Vector<Vector2> &p_region, WindowID p_window) {621ERR_FAIL_MSG("Mouse passthrough not supported by this display server.");622}623624void DisplayServer::gl_window_make_current(DisplayServer::WindowID p_window_id) {625// noop except in gles626}627628void DisplayServer::window_set_ime_active(const bool p_active, WindowID p_window) {629WARN_PRINT("IME not supported by this display server.");630}631632void DisplayServer::window_set_ime_position(const Point2i &p_pos, WindowID p_window) {633WARN_PRINT("IME not supported by this display server.");634}635636RID DisplayServer::accessibility_create_element(WindowID p_window, DisplayServer::AccessibilityRole p_role) {637if (accessibility_driver) {638return accessibility_driver->accessibility_create_element(p_window, p_role);639} else {640return RID();641}642}643644RID DisplayServer::accessibility_create_sub_element(const RID &p_parent_rid, DisplayServer::AccessibilityRole p_role, int p_insert_pos) {645if (accessibility_driver) {646return accessibility_driver->accessibility_create_sub_element(p_parent_rid, p_role, p_insert_pos);647} else {648return RID();649}650}651652RID DisplayServer::accessibility_create_sub_text_edit_elements(const RID &p_parent_rid, const RID &p_shaped_text, float p_min_height, int p_insert_pos, bool p_is_last_line) {653if (accessibility_driver) {654return accessibility_driver->accessibility_create_sub_text_edit_elements(p_parent_rid, p_shaped_text, p_min_height, p_insert_pos, p_is_last_line);655} else {656return RID();657}658}659660bool DisplayServer::accessibility_has_element(const RID &p_id) const {661if (accessibility_driver) {662return accessibility_driver->accessibility_has_element(p_id);663} else {664return false;665}666}667668void DisplayServer::accessibility_free_element(const RID &p_id) {669if (accessibility_driver) {670accessibility_driver->accessibility_free_element(p_id);671}672}673674void DisplayServer::accessibility_element_set_meta(const RID &p_id, const Variant &p_meta) {675if (accessibility_driver) {676accessibility_driver->accessibility_element_set_meta(p_id, p_meta);677}678}679680Variant DisplayServer::accessibility_element_get_meta(const RID &p_id) const {681if (accessibility_driver) {682return accessibility_driver->accessibility_element_get_meta(p_id);683} else {684return Variant();685}686}687688void DisplayServer::accessibility_update_if_active(const Callable &p_callable) {689if (accessibility_driver) {690accessibility_driver->accessibility_update_if_active(p_callable);691}692}693694void DisplayServer::accessibility_update_set_focus(const RID &p_id) {695if (accessibility_driver) {696accessibility_driver->accessibility_update_set_focus(p_id);697}698}699700RID DisplayServer::accessibility_get_window_root(DisplayServer::WindowID p_window_id) const {701if (accessibility_driver) {702return accessibility_driver->accessibility_get_window_root(p_window_id);703} else {704return RID();705}706}707708void DisplayServer::accessibility_set_window_rect(DisplayServer::WindowID p_window_id, const Rect2 &p_rect_out, const Rect2 &p_rect_in) {709if (accessibility_driver) {710accessibility_driver->accessibility_set_window_rect(p_window_id, p_rect_out, p_rect_in);711}712}713714void DisplayServer::accessibility_set_window_focused(DisplayServer::WindowID p_window_id, bool p_focused) {715if (accessibility_driver) {716accessibility_driver->accessibility_set_window_focused(p_window_id, p_focused);717}718}719720void DisplayServer::accessibility_update_set_role(const RID &p_id, DisplayServer::AccessibilityRole p_role) {721if (accessibility_driver) {722accessibility_driver->accessibility_update_set_role(p_id, p_role);723}724}725726void DisplayServer::accessibility_update_set_name(const RID &p_id, const String &p_name) {727if (accessibility_driver) {728accessibility_driver->accessibility_update_set_name(p_id, p_name);729}730}731732void DisplayServer::accessibility_update_set_description(const RID &p_id, const String &p_description) {733if (accessibility_driver) {734accessibility_driver->accessibility_update_set_description(p_id, p_description);735}736}737738void DisplayServer::accessibility_update_set_extra_info(const RID &p_id, const String &p_name_extra_info) {739if (accessibility_driver) {740accessibility_driver->accessibility_update_set_extra_info(p_id, p_name_extra_info);741}742}743744void DisplayServer::accessibility_update_set_value(const RID &p_id, const String &p_value) {745if (accessibility_driver) {746accessibility_driver->accessibility_update_set_value(p_id, p_value);747}748}749750void DisplayServer::accessibility_update_set_tooltip(const RID &p_id, const String &p_tooltip) {751if (accessibility_driver) {752accessibility_driver->accessibility_update_set_tooltip(p_id, p_tooltip);753}754}755756void DisplayServer::accessibility_update_set_bounds(const RID &p_id, const Rect2 &p_rect) {757if (accessibility_driver) {758accessibility_driver->accessibility_update_set_bounds(p_id, p_rect);759}760}761762void DisplayServer::accessibility_update_set_transform(const RID &p_id, const Transform2D &p_transform) {763if (accessibility_driver) {764accessibility_driver->accessibility_update_set_transform(p_id, p_transform);765}766}767768void DisplayServer::accessibility_update_add_child(const RID &p_id, const RID &p_child_id) {769if (accessibility_driver) {770accessibility_driver->accessibility_update_add_child(p_id, p_child_id);771}772}773774void DisplayServer::accessibility_update_add_related_controls(const RID &p_id, const RID &p_related_id) {775if (accessibility_driver) {776accessibility_driver->accessibility_update_add_related_controls(p_id, p_related_id);777}778}779780void DisplayServer::accessibility_update_add_related_details(const RID &p_id, const RID &p_related_id) {781if (accessibility_driver) {782accessibility_driver->accessibility_update_add_related_details(p_id, p_related_id);783}784}785786void DisplayServer::accessibility_update_add_related_described_by(const RID &p_id, const RID &p_related_id) {787if (accessibility_driver) {788accessibility_driver->accessibility_update_add_related_described_by(p_id, p_related_id);789}790}791792void DisplayServer::accessibility_update_add_related_flow_to(const RID &p_id, const RID &p_related_id) {793if (accessibility_driver) {794accessibility_driver->accessibility_update_add_related_flow_to(p_id, p_related_id);795}796}797798void DisplayServer::accessibility_update_add_related_labeled_by(const RID &p_id, const RID &p_related_id) {799if (accessibility_driver) {800accessibility_driver->accessibility_update_add_related_labeled_by(p_id, p_related_id);801}802}803804void DisplayServer::accessibility_update_add_related_radio_group(const RID &p_id, const RID &p_related_id) {805if (accessibility_driver) {806accessibility_driver->accessibility_update_add_related_radio_group(p_id, p_related_id);807}808}809810void DisplayServer::accessibility_update_set_active_descendant(const RID &p_id, const RID &p_other_id) {811if (accessibility_driver) {812accessibility_driver->accessibility_update_set_active_descendant(p_id, p_other_id);813}814}815816void DisplayServer::accessibility_update_set_next_on_line(const RID &p_id, const RID &p_other_id) {817if (accessibility_driver) {818accessibility_driver->accessibility_update_set_next_on_line(p_id, p_other_id);819}820}821822void DisplayServer::accessibility_update_set_previous_on_line(const RID &p_id, const RID &p_other_id) {823if (accessibility_driver) {824accessibility_driver->accessibility_update_set_previous_on_line(p_id, p_other_id);825}826}827828void DisplayServer::accessibility_update_set_member_of(const RID &p_id, const RID &p_group_id) {829if (accessibility_driver) {830accessibility_driver->accessibility_update_set_member_of(p_id, p_group_id);831}832}833834void DisplayServer::accessibility_update_set_in_page_link_target(const RID &p_id, const RID &p_other_id) {835if (accessibility_driver) {836accessibility_driver->accessibility_update_set_in_page_link_target(p_id, p_other_id);837}838}839840void DisplayServer::accessibility_update_set_error_message(const RID &p_id, const RID &p_other_id) {841if (accessibility_driver) {842accessibility_driver->accessibility_update_set_error_message(p_id, p_other_id);843}844}845846void DisplayServer::accessibility_update_set_live(const RID &p_id, DisplayServer::AccessibilityLiveMode p_live) {847if (accessibility_driver) {848accessibility_driver->accessibility_update_set_live(p_id, p_live);849}850}851852void DisplayServer::accessibility_update_add_action(const RID &p_id, DisplayServer::AccessibilityAction p_action, const Callable &p_callable) {853if (accessibility_driver) {854accessibility_driver->accessibility_update_add_action(p_id, p_action, p_callable);855}856}857858void DisplayServer::accessibility_update_add_custom_action(const RID &p_id, int p_action_id, const String &p_action_description) {859if (accessibility_driver) {860accessibility_driver->accessibility_update_add_custom_action(p_id, p_action_id, p_action_description);861}862}863864void DisplayServer::accessibility_update_set_table_row_count(const RID &p_id, int p_count) {865if (accessibility_driver) {866accessibility_driver->accessibility_update_set_table_row_count(p_id, p_count);867}868}869870void DisplayServer::accessibility_update_set_table_column_count(const RID &p_id, int p_count) {871if (accessibility_driver) {872accessibility_driver->accessibility_update_set_table_column_count(p_id, p_count);873}874}875876void DisplayServer::accessibility_update_set_table_row_index(const RID &p_id, int p_index) {877if (accessibility_driver) {878accessibility_driver->accessibility_update_set_table_row_index(p_id, p_index);879}880}881882void DisplayServer::accessibility_update_set_table_column_index(const RID &p_id, int p_index) {883if (accessibility_driver) {884accessibility_driver->accessibility_update_set_table_column_index(p_id, p_index);885}886}887888void DisplayServer::accessibility_update_set_table_cell_position(const RID &p_id, int p_row_index, int p_column_index) {889if (accessibility_driver) {890accessibility_driver->accessibility_update_set_table_cell_position(p_id, p_row_index, p_column_index);891}892}893894void DisplayServer::accessibility_update_set_table_cell_span(const RID &p_id, int p_row_span, int p_column_span) {895if (accessibility_driver) {896accessibility_driver->accessibility_update_set_table_cell_span(p_id, p_row_span, p_column_span);897}898}899900void DisplayServer::accessibility_update_set_list_item_count(const RID &p_id, int p_size) {901if (accessibility_driver) {902accessibility_driver->accessibility_update_set_list_item_count(p_id, p_size);903}904}905906void DisplayServer::accessibility_update_set_list_item_index(const RID &p_id, int p_index) {907if (accessibility_driver) {908accessibility_driver->accessibility_update_set_list_item_index(p_id, p_index);909}910}911912void DisplayServer::accessibility_update_set_list_item_level(const RID &p_id, int p_level) {913if (accessibility_driver) {914accessibility_driver->accessibility_update_set_list_item_level(p_id, p_level);915}916}917918void DisplayServer::accessibility_update_set_list_item_selected(const RID &p_id, bool p_selected) {919if (accessibility_driver) {920accessibility_driver->accessibility_update_set_list_item_selected(p_id, p_selected);921}922}923924void DisplayServer::accessibility_update_set_list_item_expanded(const RID &p_id, bool p_expanded) {925if (accessibility_driver) {926accessibility_driver->accessibility_update_set_list_item_expanded(p_id, p_expanded);927}928}929930void DisplayServer::accessibility_update_set_popup_type(const RID &p_id, DisplayServer::AccessibilityPopupType p_popup) {931if (accessibility_driver) {932accessibility_driver->accessibility_update_set_popup_type(p_id, p_popup);933}934}935936void DisplayServer::accessibility_update_set_checked(const RID &p_id, bool p_checekd) {937if (accessibility_driver) {938accessibility_driver->accessibility_update_set_checked(p_id, p_checekd);939}940}941942void DisplayServer::accessibility_update_set_num_value(const RID &p_id, double p_position) {943if (accessibility_driver) {944accessibility_driver->accessibility_update_set_num_value(p_id, p_position);945}946}947948void DisplayServer::accessibility_update_set_num_range(const RID &p_id, double p_min, double p_max) {949if (accessibility_driver) {950accessibility_driver->accessibility_update_set_num_range(p_id, p_min, p_max);951}952}953954void DisplayServer::accessibility_update_set_num_step(const RID &p_id, double p_step) {955if (accessibility_driver) {956accessibility_driver->accessibility_update_set_num_step(p_id, p_step);957}958}959960void DisplayServer::accessibility_update_set_num_jump(const RID &p_id, double p_jump) {961if (accessibility_driver) {962accessibility_driver->accessibility_update_set_num_jump(p_id, p_jump);963}964}965966void DisplayServer::accessibility_update_set_scroll_x(const RID &p_id, double p_position) {967if (accessibility_driver) {968accessibility_driver->accessibility_update_set_scroll_x(p_id, p_position);969}970}971972void DisplayServer::accessibility_update_set_scroll_x_range(const RID &p_id, double p_min, double p_max) {973if (accessibility_driver) {974accessibility_driver->accessibility_update_set_scroll_x_range(p_id, p_min, p_max);975}976}977978void DisplayServer::accessibility_update_set_scroll_y(const RID &p_id, double p_position) {979if (accessibility_driver) {980accessibility_driver->accessibility_update_set_scroll_y(p_id, p_position);981}982}983984void DisplayServer::accessibility_update_set_scroll_y_range(const RID &p_id, double p_min, double p_max) {985if (accessibility_driver) {986accessibility_driver->accessibility_update_set_scroll_y_range(p_id, p_min, p_max);987}988}989990void DisplayServer::accessibility_update_set_text_decorations(const RID &p_id, bool p_underline, bool p_strikethrough, bool p_overline) {991if (accessibility_driver) {992accessibility_driver->accessibility_update_set_text_decorations(p_id, p_underline, p_strikethrough, p_overline);993}994}995996void DisplayServer::accessibility_update_set_text_align(const RID &p_id, HorizontalAlignment p_align) {997if (accessibility_driver) {998accessibility_driver->accessibility_update_set_text_align(p_id, p_align);999}1000}10011002void 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) {1003if (accessibility_driver) {1004accessibility_driver->accessibility_update_set_text_selection(p_id, p_text_start_id, p_start_char, p_text_end_id, p_end_char);1005}1006}10071008void DisplayServer::accessibility_update_set_flag(const RID &p_id, DisplayServer::AccessibilityFlags p_flag, bool p_value) {1009if (accessibility_driver) {1010accessibility_driver->accessibility_update_set_flag(p_id, p_flag, p_value);1011}1012}10131014void DisplayServer::accessibility_update_set_classname(const RID &p_id, const String &p_classname) {1015if (accessibility_driver) {1016accessibility_driver->accessibility_update_set_classname(p_id, p_classname);1017}1018}10191020void DisplayServer::accessibility_update_set_placeholder(const RID &p_id, const String &p_placeholder) {1021if (accessibility_driver) {1022accessibility_driver->accessibility_update_set_placeholder(p_id, p_placeholder);1023}1024}10251026void DisplayServer::accessibility_update_set_language(const RID &p_id, const String &p_language) {1027if (accessibility_driver) {1028accessibility_driver->accessibility_update_set_language(p_id, p_language);1029}1030}10311032void DisplayServer::accessibility_update_set_text_orientation(const RID &p_id, bool p_vertical) {1033if (accessibility_driver) {1034accessibility_driver->accessibility_update_set_text_orientation(p_id, p_vertical);1035}1036}10371038void DisplayServer::accessibility_update_set_list_orientation(const RID &p_id, bool p_vertical) {1039if (accessibility_driver) {1040accessibility_driver->accessibility_update_set_list_orientation(p_id, p_vertical);1041}1042}10431044void DisplayServer::accessibility_update_set_shortcut(const RID &p_id, const String &p_shortcut) {1045if (accessibility_driver) {1046accessibility_driver->accessibility_update_set_shortcut(p_id, p_shortcut);1047}1048}10491050void DisplayServer::accessibility_update_set_url(const RID &p_id, const String &p_url) {1051if (accessibility_driver) {1052accessibility_driver->accessibility_update_set_url(p_id, p_url);1053}1054}10551056void DisplayServer::accessibility_update_set_role_description(const RID &p_id, const String &p_description) {1057if (accessibility_driver) {1058accessibility_driver->accessibility_update_set_role_description(p_id, p_description);1059}1060}10611062void DisplayServer::accessibility_update_set_state_description(const RID &p_id, const String &p_description) {1063if (accessibility_driver) {1064accessibility_driver->accessibility_update_set_state_description(p_id, p_description);1065}1066}10671068void DisplayServer::accessibility_update_set_color_value(const RID &p_id, const Color &p_color) {1069if (accessibility_driver) {1070accessibility_driver->accessibility_update_set_color_value(p_id, p_color);1071}1072}10731074void DisplayServer::accessibility_update_set_background_color(const RID &p_id, const Color &p_color) {1075if (accessibility_driver) {1076accessibility_driver->accessibility_update_set_background_color(p_id, p_color);1077}1078}10791080void DisplayServer::accessibility_update_set_foreground_color(const RID &p_id, const Color &p_color) {1081if (accessibility_driver) {1082accessibility_driver->accessibility_update_set_foreground_color(p_id, p_color);1083}1084}10851086Point2i DisplayServer::ime_get_selection() const {1087ERR_FAIL_V_MSG(Point2i(), "IME or NOTIFICATION_WM_IME_UPDATE not supported by this display server.");1088}10891090String DisplayServer::ime_get_text() const {1091ERR_FAIL_V_MSG(String(), "IME or NOTIFICATION_WM_IME_UPDATE not supported by this display server.");1092}10931094void 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) {1095WARN_PRINT("Virtual keyboard not supported by this display server.");1096}10971098void DisplayServer::virtual_keyboard_hide() {1099WARN_PRINT("Virtual keyboard not supported by this display server.");1100}11011102// returns height of the currently shown keyboard (0 if keyboard is hidden)1103int DisplayServer::virtual_keyboard_get_height() const {1104WARN_PRINT("Virtual keyboard not supported by this display server.");1105return 0;1106}11071108bool DisplayServer::has_hardware_keyboard() const {1109return true;1110}11111112void DisplayServer::cursor_set_shape(CursorShape p_shape) {1113WARN_PRINT("Cursor shape not supported by this display server.");1114}11151116DisplayServer::CursorShape DisplayServer::cursor_get_shape() const {1117return CURSOR_ARROW;1118}11191120void DisplayServer::cursor_set_custom_image(const Ref<Resource> &p_cursor, CursorShape p_shape, const Vector2 &p_hotspot) {1121WARN_PRINT("Custom cursor shape not supported by this display server.");1122}11231124bool DisplayServer::get_swap_cancel_ok() {1125return false;1126}11271128void DisplayServer::enable_for_stealing_focus(OS::ProcessID pid) {1129}11301131Error DisplayServer::embed_process(WindowID p_window, OS::ProcessID p_pid, const Rect2i &p_rect, bool p_visible, bool p_grab_focus) {1132WARN_PRINT("Embedded process not supported by this display server.");1133return ERR_UNAVAILABLE;1134}11351136Error DisplayServer::request_close_embedded_process(OS::ProcessID p_pid) {1137WARN_PRINT("Embedded process not supported by this display server.");1138return ERR_UNAVAILABLE;1139}11401141Error DisplayServer::remove_embedded_process(OS::ProcessID p_pid) {1142WARN_PRINT("Embedded process not supported by this display server.");1143return ERR_UNAVAILABLE;1144}11451146OS::ProcessID DisplayServer::get_focused_process_id() {1147WARN_PRINT("Embedded process not supported by this display server.");1148return 0;1149}11501151Error DisplayServer::dialog_show(String p_title, String p_description, Vector<String> p_buttons, const Callable &p_callback) {1152WARN_PRINT("Native dialogs not supported by this display server.");1153return ERR_UNAVAILABLE;1154}11551156Error DisplayServer::dialog_input_text(String p_title, String p_description, String p_partial, const Callable &p_callback) {1157WARN_PRINT("Native dialogs not supported by this display server.");1158return ERR_UNAVAILABLE;1159}11601161Error 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) {1162WARN_PRINT("Native dialogs not supported by this display server.");1163return ERR_UNAVAILABLE;1164}11651166Error 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) {1167WARN_PRINT("Native dialogs not supported by this display server.");1168return ERR_UNAVAILABLE;1169}11701171void DisplayServer::beep() const {1172}11731174int DisplayServer::keyboard_get_layout_count() const {1175return 0;1176}11771178int DisplayServer::keyboard_get_current_layout() const {1179return -1;1180}11811182void DisplayServer::keyboard_set_current_layout(int p_index) {1183}11841185String DisplayServer::keyboard_get_layout_language(int p_index) const {1186return "";1187}11881189String DisplayServer::keyboard_get_layout_name(int p_index) const {1190return "Not supported";1191}11921193Key DisplayServer::keyboard_get_keycode_from_physical(Key p_keycode) const {1194ERR_FAIL_V_MSG(p_keycode, "Not supported by this display server.");1195}11961197Key DisplayServer::keyboard_get_label_from_physical(Key p_keycode) const {1198ERR_FAIL_V_MSG(p_keycode, "Not supported by this display server.");1199}12001201void DisplayServer::show_emoji_and_symbol_picker() const {1202}12031204bool DisplayServer::color_picker(const Callable &p_callback) {1205return false;1206}12071208void DisplayServer::force_process_and_drop_events() {1209}12101211void DisplayServer::release_rendering_thread() {1212WARN_PRINT("Rendering thread not supported by this display server.");1213}12141215void DisplayServer::swap_buffers() {1216WARN_PRINT("Swap buffers not supported by this display server.");1217}12181219void DisplayServer::set_native_icon(const String &p_filename) {1220WARN_PRINT("Native icon not supported by this display server.");1221}12221223void DisplayServer::set_icon(const Ref<Image> &p_icon) {1224WARN_PRINT("Icon not supported by this display server.");1225}12261227DisplayServer::IndicatorID DisplayServer::create_status_indicator(const Ref<Texture2D> &p_icon, const String &p_tooltip, const Callable &p_callback) {1228WARN_PRINT("Status indicator not supported by this display server.");1229return INVALID_INDICATOR_ID;1230}12311232void DisplayServer::status_indicator_set_icon(IndicatorID p_id, const Ref<Texture2D> &p_icon) {1233WARN_PRINT("Status indicator not supported by this display server.");1234}12351236void DisplayServer::status_indicator_set_tooltip(IndicatorID p_id, const String &p_tooltip) {1237WARN_PRINT("Status indicator not supported by this display server.");1238}12391240void DisplayServer::status_indicator_set_menu(IndicatorID p_id, const RID &p_menu_rid) {1241WARN_PRINT("Status indicator not supported by this display server.");1242}12431244void DisplayServer::status_indicator_set_callback(IndicatorID p_id, const Callable &p_callback) {1245WARN_PRINT("Status indicator not supported by this display server.");1246}12471248Rect2 DisplayServer::status_indicator_get_rect(IndicatorID p_id) const {1249WARN_PRINT("Status indicator not supported by this display server.");1250return Rect2();1251}12521253void DisplayServer::delete_status_indicator(IndicatorID p_id) {1254WARN_PRINT("Status indicator not supported by this display server.");1255}12561257int64_t DisplayServer::window_get_native_handle(HandleType p_handle_type, WindowID p_window) const {1258WARN_PRINT("Native handle not supported by this display server.");1259return 0;1260}12611262void DisplayServer::window_set_vsync_mode(DisplayServer::VSyncMode p_vsync_mode, WindowID p_window) {1263WARN_PRINT("Changing the V-Sync mode is not supported by this display server.");1264}12651266DisplayServer::VSyncMode DisplayServer::window_get_vsync_mode(WindowID p_window) const {1267WARN_PRINT("Changing the V-Sync mode is not supported by this display server.");1268return VSyncMode::VSYNC_ENABLED;1269}12701271DisplayServer::WindowID DisplayServer::get_focused_window() const {1272return MAIN_WINDOW_ID; // Proper value for single windows.1273}12741275void DisplayServer::set_context(Context p_context) {1276}12771278void DisplayServer::register_additional_output(Object *p_object) {1279ObjectID id = p_object->get_instance_id();1280if (!additional_outputs.has(id)) {1281additional_outputs.push_back(id);1282}1283}12841285void DisplayServer::unregister_additional_output(Object *p_object) {1286additional_outputs.erase(p_object->get_instance_id());1287}12881289void DisplayServer::_bind_methods() {1290ADD_SIGNAL(MethodInfo("orientation_changed", PropertyInfo(Variant::INT, "orientation")));12911292ClassDB::bind_method(D_METHOD("has_feature", "feature"), &DisplayServer::has_feature);1293ClassDB::bind_method(D_METHOD("get_name"), &DisplayServer::get_name);12941295ClassDB::bind_method(D_METHOD("help_set_search_callbacks", "search_callback", "action_callback"), &DisplayServer::help_set_search_callbacks);12961297#ifndef DISABLE_DEPRECATED1298ClassDB::bind_method(D_METHOD("global_menu_set_popup_callbacks", "menu_root", "open_callback", "close_callback"), &DisplayServer::global_menu_set_popup_callbacks);1299ClassDB::bind_method(D_METHOD("global_menu_add_submenu_item", "menu_root", "label", "submenu", "index"), &DisplayServer::global_menu_add_submenu_item, DEFVAL(-1));1300ClassDB::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));1301ClassDB::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));1302ClassDB::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));1303ClassDB::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));1304ClassDB::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));1305ClassDB::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));1306ClassDB::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));1307ClassDB::bind_method(D_METHOD("global_menu_add_separator", "menu_root", "index"), &DisplayServer::global_menu_add_separator, DEFVAL(-1));13081309ClassDB::bind_method(D_METHOD("global_menu_get_item_index_from_text", "menu_root", "text"), &DisplayServer::global_menu_get_item_index_from_text);1310ClassDB::bind_method(D_METHOD("global_menu_get_item_index_from_tag", "menu_root", "tag"), &DisplayServer::global_menu_get_item_index_from_tag);13111312ClassDB::bind_method(D_METHOD("global_menu_is_item_checked", "menu_root", "idx"), &DisplayServer::global_menu_is_item_checked);1313ClassDB::bind_method(D_METHOD("global_menu_is_item_checkable", "menu_root", "idx"), &DisplayServer::global_menu_is_item_checkable);1314ClassDB::bind_method(D_METHOD("global_menu_is_item_radio_checkable", "menu_root", "idx"), &DisplayServer::global_menu_is_item_radio_checkable);1315ClassDB::bind_method(D_METHOD("global_menu_get_item_callback", "menu_root", "idx"), &DisplayServer::global_menu_get_item_callback);1316ClassDB::bind_method(D_METHOD("global_menu_get_item_key_callback", "menu_root", "idx"), &DisplayServer::global_menu_get_item_key_callback);1317ClassDB::bind_method(D_METHOD("global_menu_get_item_tag", "menu_root", "idx"), &DisplayServer::global_menu_get_item_tag);1318ClassDB::bind_method(D_METHOD("global_menu_get_item_text", "menu_root", "idx"), &DisplayServer::global_menu_get_item_text);1319ClassDB::bind_method(D_METHOD("global_menu_get_item_submenu", "menu_root", "idx"), &DisplayServer::global_menu_get_item_submenu);1320ClassDB::bind_method(D_METHOD("global_menu_get_item_accelerator", "menu_root", "idx"), &DisplayServer::global_menu_get_item_accelerator);1321ClassDB::bind_method(D_METHOD("global_menu_is_item_disabled", "menu_root", "idx"), &DisplayServer::global_menu_is_item_disabled);1322ClassDB::bind_method(D_METHOD("global_menu_is_item_hidden", "menu_root", "idx"), &DisplayServer::global_menu_is_item_hidden);1323ClassDB::bind_method(D_METHOD("global_menu_get_item_tooltip", "menu_root", "idx"), &DisplayServer::global_menu_get_item_tooltip);1324ClassDB::bind_method(D_METHOD("global_menu_get_item_state", "menu_root", "idx"), &DisplayServer::global_menu_get_item_state);1325ClassDB::bind_method(D_METHOD("global_menu_get_item_max_states", "menu_root", "idx"), &DisplayServer::global_menu_get_item_max_states);1326ClassDB::bind_method(D_METHOD("global_menu_get_item_icon", "menu_root", "idx"), &DisplayServer::global_menu_get_item_icon);1327ClassDB::bind_method(D_METHOD("global_menu_get_item_indentation_level", "menu_root", "idx"), &DisplayServer::global_menu_get_item_indentation_level);13281329ClassDB::bind_method(D_METHOD("global_menu_set_item_checked", "menu_root", "idx", "checked"), &DisplayServer::global_menu_set_item_checked);1330ClassDB::bind_method(D_METHOD("global_menu_set_item_checkable", "menu_root", "idx", "checkable"), &DisplayServer::global_menu_set_item_checkable);1331ClassDB::bind_method(D_METHOD("global_menu_set_item_radio_checkable", "menu_root", "idx", "checkable"), &DisplayServer::global_menu_set_item_radio_checkable);1332ClassDB::bind_method(D_METHOD("global_menu_set_item_callback", "menu_root", "idx", "callback"), &DisplayServer::global_menu_set_item_callback);1333ClassDB::bind_method(D_METHOD("global_menu_set_item_hover_callbacks", "menu_root", "idx", "callback"), &DisplayServer::global_menu_set_item_hover_callbacks);1334ClassDB::bind_method(D_METHOD("global_menu_set_item_key_callback", "menu_root", "idx", "key_callback"), &DisplayServer::global_menu_set_item_key_callback);1335ClassDB::bind_method(D_METHOD("global_menu_set_item_tag", "menu_root", "idx", "tag"), &DisplayServer::global_menu_set_item_tag);1336ClassDB::bind_method(D_METHOD("global_menu_set_item_text", "menu_root", "idx", "text"), &DisplayServer::global_menu_set_item_text);1337ClassDB::bind_method(D_METHOD("global_menu_set_item_submenu", "menu_root", "idx", "submenu"), &DisplayServer::global_menu_set_item_submenu);1338ClassDB::bind_method(D_METHOD("global_menu_set_item_accelerator", "menu_root", "idx", "keycode"), &DisplayServer::global_menu_set_item_accelerator);1339ClassDB::bind_method(D_METHOD("global_menu_set_item_disabled", "menu_root", "idx", "disabled"), &DisplayServer::global_menu_set_item_disabled);1340ClassDB::bind_method(D_METHOD("global_menu_set_item_hidden", "menu_root", "idx", "hidden"), &DisplayServer::global_menu_set_item_hidden);1341ClassDB::bind_method(D_METHOD("global_menu_set_item_tooltip", "menu_root", "idx", "tooltip"), &DisplayServer::global_menu_set_item_tooltip);1342ClassDB::bind_method(D_METHOD("global_menu_set_item_state", "menu_root", "idx", "state"), &DisplayServer::global_menu_set_item_state);1343ClassDB::bind_method(D_METHOD("global_menu_set_item_max_states", "menu_root", "idx", "max_states"), &DisplayServer::global_menu_set_item_max_states);1344ClassDB::bind_method(D_METHOD("global_menu_set_item_icon", "menu_root", "idx", "icon"), &DisplayServer::global_menu_set_item_icon);1345ClassDB::bind_method(D_METHOD("global_menu_set_item_indentation_level", "menu_root", "idx", "level"), &DisplayServer::global_menu_set_item_indentation_level);13461347ClassDB::bind_method(D_METHOD("global_menu_get_item_count", "menu_root"), &DisplayServer::global_menu_get_item_count);13481349ClassDB::bind_method(D_METHOD("global_menu_remove_item", "menu_root", "idx"), &DisplayServer::global_menu_remove_item);1350ClassDB::bind_method(D_METHOD("global_menu_clear", "menu_root"), &DisplayServer::global_menu_clear);13511352ClassDB::bind_method(D_METHOD("global_menu_get_system_menu_roots"), &DisplayServer::global_menu_get_system_menu_roots);1353#endif13541355ClassDB::bind_method(D_METHOD("tts_is_speaking"), &DisplayServer::tts_is_speaking);1356ClassDB::bind_method(D_METHOD("tts_is_paused"), &DisplayServer::tts_is_paused);1357ClassDB::bind_method(D_METHOD("tts_get_voices"), &DisplayServer::tts_get_voices);1358ClassDB::bind_method(D_METHOD("tts_get_voices_for_language", "language"), &DisplayServer::tts_get_voices_for_language);13591360ClassDB::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));1361ClassDB::bind_method(D_METHOD("tts_pause"), &DisplayServer::tts_pause);1362ClassDB::bind_method(D_METHOD("tts_resume"), &DisplayServer::tts_resume);1363ClassDB::bind_method(D_METHOD("tts_stop"), &DisplayServer::tts_stop);13641365ClassDB::bind_method(D_METHOD("tts_set_utterance_callback", "event", "callable"), &DisplayServer::tts_set_utterance_callback);1366ClassDB::bind_method(D_METHOD("_tts_post_utterance_event", "event", "id", "char_pos"), &DisplayServer::tts_post_utterance_event);13671368ClassDB::bind_method(D_METHOD("is_dark_mode_supported"), &DisplayServer::is_dark_mode_supported);1369ClassDB::bind_method(D_METHOD("is_dark_mode"), &DisplayServer::is_dark_mode);1370ClassDB::bind_method(D_METHOD("get_accent_color"), &DisplayServer::get_accent_color);1371ClassDB::bind_method(D_METHOD("get_base_color"), &DisplayServer::get_base_color);1372ClassDB::bind_method(D_METHOD("set_system_theme_change_callback", "callable"), &DisplayServer::set_system_theme_change_callback);13731374ClassDB::bind_method(D_METHOD("mouse_set_mode", "mouse_mode"), &DisplayServer::mouse_set_mode);1375ClassDB::bind_method(D_METHOD("mouse_get_mode"), &DisplayServer::mouse_get_mode);13761377ClassDB::bind_method(D_METHOD("warp_mouse", "position"), &DisplayServer::warp_mouse);1378ClassDB::bind_method(D_METHOD("mouse_get_position"), &DisplayServer::mouse_get_position);1379ClassDB::bind_method(D_METHOD("mouse_get_button_state"), &DisplayServer::mouse_get_button_state);13801381ClassDB::bind_method(D_METHOD("clipboard_set", "clipboard"), &DisplayServer::clipboard_set);1382ClassDB::bind_method(D_METHOD("clipboard_get"), &DisplayServer::clipboard_get);1383ClassDB::bind_method(D_METHOD("clipboard_get_image"), &DisplayServer::clipboard_get_image);1384ClassDB::bind_method(D_METHOD("clipboard_has"), &DisplayServer::clipboard_has);1385ClassDB::bind_method(D_METHOD("clipboard_has_image"), &DisplayServer::clipboard_has_image);1386ClassDB::bind_method(D_METHOD("clipboard_set_primary", "clipboard_primary"), &DisplayServer::clipboard_set_primary);1387ClassDB::bind_method(D_METHOD("clipboard_get_primary"), &DisplayServer::clipboard_get_primary);13881389ClassDB::bind_method(D_METHOD("get_display_cutouts"), &DisplayServer::get_display_cutouts);1390ClassDB::bind_method(D_METHOD("get_display_safe_area"), &DisplayServer::get_display_safe_area);13911392ClassDB::bind_method(D_METHOD("get_screen_count"), &DisplayServer::get_screen_count);1393ClassDB::bind_method(D_METHOD("get_primary_screen"), &DisplayServer::get_primary_screen);1394ClassDB::bind_method(D_METHOD("get_keyboard_focus_screen"), &DisplayServer::get_keyboard_focus_screen);1395ClassDB::bind_method(D_METHOD("get_screen_from_rect", "rect"), &DisplayServer::get_screen_from_rect);1396ClassDB::bind_method(D_METHOD("screen_get_position", "screen"), &DisplayServer::screen_get_position, DEFVAL(SCREEN_OF_MAIN_WINDOW));1397ClassDB::bind_method(D_METHOD("screen_get_size", "screen"), &DisplayServer::screen_get_size, DEFVAL(SCREEN_OF_MAIN_WINDOW));1398ClassDB::bind_method(D_METHOD("screen_get_usable_rect", "screen"), &DisplayServer::screen_get_usable_rect, DEFVAL(SCREEN_OF_MAIN_WINDOW));1399ClassDB::bind_method(D_METHOD("screen_get_dpi", "screen"), &DisplayServer::screen_get_dpi, DEFVAL(SCREEN_OF_MAIN_WINDOW));1400ClassDB::bind_method(D_METHOD("screen_get_scale", "screen"), &DisplayServer::screen_get_scale, DEFVAL(SCREEN_OF_MAIN_WINDOW));1401ClassDB::bind_method(D_METHOD("is_touchscreen_available"), &DisplayServer::is_touchscreen_available);1402ClassDB::bind_method(D_METHOD("screen_get_max_scale"), &DisplayServer::screen_get_max_scale);1403ClassDB::bind_method(D_METHOD("screen_get_refresh_rate", "screen"), &DisplayServer::screen_get_refresh_rate, DEFVAL(SCREEN_OF_MAIN_WINDOW));1404ClassDB::bind_method(D_METHOD("screen_get_pixel", "position"), &DisplayServer::screen_get_pixel);1405ClassDB::bind_method(D_METHOD("screen_get_image", "screen"), &DisplayServer::screen_get_image, DEFVAL(SCREEN_OF_MAIN_WINDOW));1406ClassDB::bind_method(D_METHOD("screen_get_image_rect", "rect"), &DisplayServer::screen_get_image_rect);14071408ClassDB::bind_method(D_METHOD("screen_set_orientation", "orientation", "screen"), &DisplayServer::screen_set_orientation, DEFVAL(SCREEN_OF_MAIN_WINDOW));1409ClassDB::bind_method(D_METHOD("screen_get_orientation", "screen"), &DisplayServer::screen_get_orientation, DEFVAL(SCREEN_OF_MAIN_WINDOW));14101411ClassDB::bind_method(D_METHOD("screen_set_keep_on", "enable"), &DisplayServer::screen_set_keep_on);1412ClassDB::bind_method(D_METHOD("screen_is_kept_on"), &DisplayServer::screen_is_kept_on);14131414ClassDB::bind_method(D_METHOD("get_window_list"), &DisplayServer::get_window_list);1415ClassDB::bind_method(D_METHOD("get_window_at_screen_position", "position"), &DisplayServer::get_window_at_screen_position);14161417ClassDB::bind_method(D_METHOD("window_get_native_handle", "handle_type", "window_id"), &DisplayServer::window_get_native_handle, DEFVAL(MAIN_WINDOW_ID));1418ClassDB::bind_method(D_METHOD("window_get_active_popup"), &DisplayServer::window_get_active_popup);1419ClassDB::bind_method(D_METHOD("window_set_popup_safe_rect", "window", "rect"), &DisplayServer::window_set_popup_safe_rect);1420ClassDB::bind_method(D_METHOD("window_get_popup_safe_rect", "window"), &DisplayServer::window_get_popup_safe_rect);14211422ClassDB::bind_method(D_METHOD("window_set_title", "title", "window_id"), &DisplayServer::window_set_title, DEFVAL(MAIN_WINDOW_ID));1423ClassDB::bind_method(D_METHOD("window_get_title_size", "title", "window_id"), &DisplayServer::window_get_title_size, DEFVAL(MAIN_WINDOW_ID));1424ClassDB::bind_method(D_METHOD("window_set_mouse_passthrough", "region", "window_id"), &DisplayServer::window_set_mouse_passthrough, DEFVAL(MAIN_WINDOW_ID));14251426ClassDB::bind_method(D_METHOD("window_get_current_screen", "window_id"), &DisplayServer::window_get_current_screen, DEFVAL(MAIN_WINDOW_ID));1427ClassDB::bind_method(D_METHOD("window_set_current_screen", "screen", "window_id"), &DisplayServer::window_set_current_screen, DEFVAL(MAIN_WINDOW_ID));14281429ClassDB::bind_method(D_METHOD("window_get_position", "window_id"), &DisplayServer::window_get_position, DEFVAL(MAIN_WINDOW_ID));1430ClassDB::bind_method(D_METHOD("window_get_position_with_decorations", "window_id"), &DisplayServer::window_get_position_with_decorations, DEFVAL(MAIN_WINDOW_ID));1431ClassDB::bind_method(D_METHOD("window_set_position", "position", "window_id"), &DisplayServer::window_set_position, DEFVAL(MAIN_WINDOW_ID));14321433ClassDB::bind_method(D_METHOD("window_get_size", "window_id"), &DisplayServer::window_get_size, DEFVAL(MAIN_WINDOW_ID));1434ClassDB::bind_method(D_METHOD("window_set_size", "size", "window_id"), &DisplayServer::window_set_size, DEFVAL(MAIN_WINDOW_ID));1435ClassDB::bind_method(D_METHOD("window_set_rect_changed_callback", "callback", "window_id"), &DisplayServer::window_set_rect_changed_callback, DEFVAL(MAIN_WINDOW_ID));1436ClassDB::bind_method(D_METHOD("window_set_window_event_callback", "callback", "window_id"), &DisplayServer::window_set_window_event_callback, DEFVAL(MAIN_WINDOW_ID));1437ClassDB::bind_method(D_METHOD("window_set_input_event_callback", "callback", "window_id"), &DisplayServer::window_set_input_event_callback, DEFVAL(MAIN_WINDOW_ID));1438ClassDB::bind_method(D_METHOD("window_set_input_text_callback", "callback", "window_id"), &DisplayServer::window_set_input_text_callback, DEFVAL(MAIN_WINDOW_ID));1439ClassDB::bind_method(D_METHOD("window_set_drop_files_callback", "callback", "window_id"), &DisplayServer::window_set_drop_files_callback, DEFVAL(MAIN_WINDOW_ID));14401441ClassDB::bind_method(D_METHOD("window_get_attached_instance_id", "window_id"), &DisplayServer::window_get_attached_instance_id, DEFVAL(MAIN_WINDOW_ID));14421443ClassDB::bind_method(D_METHOD("window_get_max_size", "window_id"), &DisplayServer::window_get_max_size, DEFVAL(MAIN_WINDOW_ID));1444ClassDB::bind_method(D_METHOD("window_set_max_size", "max_size", "window_id"), &DisplayServer::window_set_max_size, DEFVAL(MAIN_WINDOW_ID));14451446ClassDB::bind_method(D_METHOD("window_get_min_size", "window_id"), &DisplayServer::window_get_min_size, DEFVAL(MAIN_WINDOW_ID));1447ClassDB::bind_method(D_METHOD("window_set_min_size", "min_size", "window_id"), &DisplayServer::window_set_min_size, DEFVAL(MAIN_WINDOW_ID));14481449ClassDB::bind_method(D_METHOD("window_get_size_with_decorations", "window_id"), &DisplayServer::window_get_size_with_decorations, DEFVAL(MAIN_WINDOW_ID));14501451ClassDB::bind_method(D_METHOD("window_get_mode", "window_id"), &DisplayServer::window_get_mode, DEFVAL(MAIN_WINDOW_ID));1452ClassDB::bind_method(D_METHOD("window_set_mode", "mode", "window_id"), &DisplayServer::window_set_mode, DEFVAL(MAIN_WINDOW_ID));14531454ClassDB::bind_method(D_METHOD("window_set_flag", "flag", "enabled", "window_id"), &DisplayServer::window_set_flag, DEFVAL(MAIN_WINDOW_ID));1455ClassDB::bind_method(D_METHOD("window_get_flag", "flag", "window_id"), &DisplayServer::window_get_flag, DEFVAL(MAIN_WINDOW_ID));14561457ClassDB::bind_method(D_METHOD("window_set_window_buttons_offset", "offset", "window_id"), &DisplayServer::window_set_window_buttons_offset, DEFVAL(MAIN_WINDOW_ID));1458ClassDB::bind_method(D_METHOD("window_get_safe_title_margins", "window_id"), &DisplayServer::window_get_safe_title_margins, DEFVAL(MAIN_WINDOW_ID));14591460ClassDB::bind_method(D_METHOD("window_request_attention", "window_id"), &DisplayServer::window_request_attention, DEFVAL(MAIN_WINDOW_ID));14611462ClassDB::bind_method(D_METHOD("window_move_to_foreground", "window_id"), &DisplayServer::window_move_to_foreground, DEFVAL(MAIN_WINDOW_ID));1463ClassDB::bind_method(D_METHOD("window_is_focused", "window_id"), &DisplayServer::window_is_focused, DEFVAL(MAIN_WINDOW_ID));1464ClassDB::bind_method(D_METHOD("window_can_draw", "window_id"), &DisplayServer::window_can_draw, DEFVAL(MAIN_WINDOW_ID));14651466ClassDB::bind_method(D_METHOD("window_set_transient", "window_id", "parent_window_id"), &DisplayServer::window_set_transient);1467ClassDB::bind_method(D_METHOD("window_set_exclusive", "window_id", "exclusive"), &DisplayServer::window_set_exclusive);14681469ClassDB::bind_method(D_METHOD("window_set_ime_active", "active", "window_id"), &DisplayServer::window_set_ime_active, DEFVAL(MAIN_WINDOW_ID));1470ClassDB::bind_method(D_METHOD("window_set_ime_position", "position", "window_id"), &DisplayServer::window_set_ime_position, DEFVAL(MAIN_WINDOW_ID));14711472ClassDB::bind_method(D_METHOD("window_set_vsync_mode", "vsync_mode", "window_id"), &DisplayServer::window_set_vsync_mode, DEFVAL(MAIN_WINDOW_ID));1473ClassDB::bind_method(D_METHOD("window_get_vsync_mode", "window_id"), &DisplayServer::window_get_vsync_mode, DEFVAL(MAIN_WINDOW_ID));14741475ClassDB::bind_method(D_METHOD("window_is_maximize_allowed", "window_id"), &DisplayServer::window_is_maximize_allowed, DEFVAL(MAIN_WINDOW_ID));1476ClassDB::bind_method(D_METHOD("window_maximize_on_title_dbl_click"), &DisplayServer::window_maximize_on_title_dbl_click);1477ClassDB::bind_method(D_METHOD("window_minimize_on_title_dbl_click"), &DisplayServer::window_minimize_on_title_dbl_click);14781479ClassDB::bind_method(D_METHOD("window_start_drag", "window_id"), &DisplayServer::window_start_drag, DEFVAL(MAIN_WINDOW_ID));1480ClassDB::bind_method(D_METHOD("window_start_resize", "edge", "window_id"), &DisplayServer::window_start_resize, DEFVAL(MAIN_WINDOW_ID));14811482ClassDB::bind_method(D_METHOD("window_set_color", "color"), &DisplayServer::window_set_color);14831484ClassDB::bind_method(D_METHOD("accessibility_should_increase_contrast"), &DisplayServer::accessibility_should_increase_contrast);1485ClassDB::bind_method(D_METHOD("accessibility_should_reduce_animation"), &DisplayServer::accessibility_should_reduce_animation);1486ClassDB::bind_method(D_METHOD("accessibility_should_reduce_transparency"), &DisplayServer::accessibility_should_reduce_transparency);1487ClassDB::bind_method(D_METHOD("accessibility_screen_reader_active"), &DisplayServer::accessibility_screen_reader_active);14881489ClassDB::bind_method(D_METHOD("accessibility_create_element", "window_id", "role"), &DisplayServer::accessibility_create_element);1490ClassDB::bind_method(D_METHOD("accessibility_create_sub_element", "parent_rid", "role", "insert_pos"), &DisplayServer::accessibility_create_sub_element, DEFVAL(-1));1491ClassDB::bind_method(D_METHOD("accessibility_create_sub_text_edit_elements", "parent_rid", "shaped_text", "min_height", "insert_pos", "is_last_line"), &DisplayServer::accessibility_create_sub_text_edit_elements, DEFVAL(-1), DEFVAL(false));1492ClassDB::bind_method(D_METHOD("accessibility_has_element", "id"), &DisplayServer::accessibility_has_element);1493ClassDB::bind_method(D_METHOD("accessibility_free_element", "id"), &DisplayServer::accessibility_free_element);1494ClassDB::bind_method(D_METHOD("accessibility_element_set_meta", "id", "meta"), &DisplayServer::accessibility_element_set_meta);1495ClassDB::bind_method(D_METHOD("accessibility_element_get_meta", "id"), &DisplayServer::accessibility_element_get_meta);14961497ClassDB::bind_method(D_METHOD("_accessibility_update_if_active", "callback"), &DisplayServer::accessibility_update_if_active);14981499ClassDB::bind_method(D_METHOD("accessibility_set_window_rect", "window_id", "rect_out", "rect_in"), &DisplayServer::accessibility_set_window_rect);1500ClassDB::bind_method(D_METHOD("accessibility_set_window_focused", "window_id", "focused"), &DisplayServer::accessibility_set_window_focused);15011502ClassDB::bind_method(D_METHOD("accessibility_update_set_focus", "id"), &DisplayServer::accessibility_update_set_focus);1503ClassDB::bind_method(D_METHOD("accessibility_get_window_root", "window_id"), &DisplayServer::accessibility_get_window_root);1504ClassDB::bind_method(D_METHOD("accessibility_update_set_role", "id", "role"), &DisplayServer::accessibility_update_set_role);1505ClassDB::bind_method(D_METHOD("accessibility_update_set_name", "id", "name"), &DisplayServer::accessibility_update_set_name);1506ClassDB::bind_method(D_METHOD("accessibility_update_set_extra_info", "id", "name"), &DisplayServer::accessibility_update_set_extra_info);1507ClassDB::bind_method(D_METHOD("accessibility_update_set_description", "id", "description"), &DisplayServer::accessibility_update_set_description);1508ClassDB::bind_method(D_METHOD("accessibility_update_set_value", "id", "value"), &DisplayServer::accessibility_update_set_value);1509ClassDB::bind_method(D_METHOD("accessibility_update_set_tooltip", "id", "tooltip"), &DisplayServer::accessibility_update_set_tooltip);1510ClassDB::bind_method(D_METHOD("accessibility_update_set_bounds", "id", "p_rect"), &DisplayServer::accessibility_update_set_bounds);1511ClassDB::bind_method(D_METHOD("accessibility_update_set_transform", "id", "transform"), &DisplayServer::accessibility_update_set_transform);1512ClassDB::bind_method(D_METHOD("accessibility_update_add_child", "id", "child_id"), &DisplayServer::accessibility_update_add_child);1513ClassDB::bind_method(D_METHOD("accessibility_update_add_related_controls", "id", "related_id"), &DisplayServer::accessibility_update_add_related_controls);1514ClassDB::bind_method(D_METHOD("accessibility_update_add_related_details", "id", "related_id"), &DisplayServer::accessibility_update_add_related_details);1515ClassDB::bind_method(D_METHOD("accessibility_update_add_related_described_by", "id", "related_id"), &DisplayServer::accessibility_update_add_related_described_by);1516ClassDB::bind_method(D_METHOD("accessibility_update_add_related_flow_to", "id", "related_id"), &DisplayServer::accessibility_update_add_related_flow_to);1517ClassDB::bind_method(D_METHOD("accessibility_update_add_related_labeled_by", "id", "related_id"), &DisplayServer::accessibility_update_add_related_labeled_by);1518ClassDB::bind_method(D_METHOD("accessibility_update_add_related_radio_group", "id", "related_id"), &DisplayServer::accessibility_update_add_related_radio_group);1519ClassDB::bind_method(D_METHOD("accessibility_update_set_active_descendant", "id", "other_id"), &DisplayServer::accessibility_update_set_active_descendant);1520ClassDB::bind_method(D_METHOD("accessibility_update_set_next_on_line", "id", "other_id"), &DisplayServer::accessibility_update_set_next_on_line);1521ClassDB::bind_method(D_METHOD("accessibility_update_set_previous_on_line", "id", "other_id"), &DisplayServer::accessibility_update_set_previous_on_line);1522ClassDB::bind_method(D_METHOD("accessibility_update_set_member_of", "id", "group_id"), &DisplayServer::accessibility_update_set_member_of);1523ClassDB::bind_method(D_METHOD("accessibility_update_set_in_page_link_target", "id", "other_id"), &DisplayServer::accessibility_update_set_in_page_link_target);1524ClassDB::bind_method(D_METHOD("accessibility_update_set_error_message", "id", "other_id"), &DisplayServer::accessibility_update_set_error_message);1525ClassDB::bind_method(D_METHOD("accessibility_update_set_live", "id", "live"), &DisplayServer::accessibility_update_set_live);1526ClassDB::bind_method(D_METHOD("accessibility_update_add_action", "id", "action", "callable"), &DisplayServer::accessibility_update_add_action);1527ClassDB::bind_method(D_METHOD("accessibility_update_add_custom_action", "id", "action_id", "action_description"), &DisplayServer::accessibility_update_add_custom_action);1528ClassDB::bind_method(D_METHOD("accessibility_update_set_table_row_count", "id", "count"), &DisplayServer::accessibility_update_set_table_row_count);1529ClassDB::bind_method(D_METHOD("accessibility_update_set_table_column_count", "id", "count"), &DisplayServer::accessibility_update_set_table_column_count);1530ClassDB::bind_method(D_METHOD("accessibility_update_set_table_row_index", "id", "index"), &DisplayServer::accessibility_update_set_table_row_index);1531ClassDB::bind_method(D_METHOD("accessibility_update_set_table_column_index", "id", "index"), &DisplayServer::accessibility_update_set_table_column_index);1532ClassDB::bind_method(D_METHOD("accessibility_update_set_table_cell_position", "id", "row_index", "column_index"), &DisplayServer::accessibility_update_set_table_cell_position);1533ClassDB::bind_method(D_METHOD("accessibility_update_set_table_cell_span", "id", "row_span", "column_span"), &DisplayServer::accessibility_update_set_table_cell_span);1534ClassDB::bind_method(D_METHOD("accessibility_update_set_list_item_count", "id", "size"), &DisplayServer::accessibility_update_set_list_item_count);1535ClassDB::bind_method(D_METHOD("accessibility_update_set_list_item_index", "id", "index"), &DisplayServer::accessibility_update_set_list_item_index);1536ClassDB::bind_method(D_METHOD("accessibility_update_set_list_item_level", "id", "level"), &DisplayServer::accessibility_update_set_list_item_level);1537ClassDB::bind_method(D_METHOD("accessibility_update_set_list_item_selected", "id", "selected"), &DisplayServer::accessibility_update_set_list_item_selected);1538ClassDB::bind_method(D_METHOD("accessibility_update_set_list_item_expanded", "id", "expanded"), &DisplayServer::accessibility_update_set_list_item_expanded);1539ClassDB::bind_method(D_METHOD("accessibility_update_set_popup_type", "id", "popup"), &DisplayServer::accessibility_update_set_popup_type);1540ClassDB::bind_method(D_METHOD("accessibility_update_set_checked", "id", "checekd"), &DisplayServer::accessibility_update_set_checked);1541ClassDB::bind_method(D_METHOD("accessibility_update_set_num_value", "id", "position"), &DisplayServer::accessibility_update_set_num_value);1542ClassDB::bind_method(D_METHOD("accessibility_update_set_num_range", "id", "min", "max"), &DisplayServer::accessibility_update_set_num_range);1543ClassDB::bind_method(D_METHOD("accessibility_update_set_num_step", "id", "step"), &DisplayServer::accessibility_update_set_num_step);1544ClassDB::bind_method(D_METHOD("accessibility_update_set_num_jump", "id", "jump"), &DisplayServer::accessibility_update_set_num_jump);1545ClassDB::bind_method(D_METHOD("accessibility_update_set_scroll_x", "id", "position"), &DisplayServer::accessibility_update_set_scroll_x);1546ClassDB::bind_method(D_METHOD("accessibility_update_set_scroll_x_range", "id", "min", "max"), &DisplayServer::accessibility_update_set_scroll_x_range);1547ClassDB::bind_method(D_METHOD("accessibility_update_set_scroll_y", "id", "position"), &DisplayServer::accessibility_update_set_scroll_y);1548ClassDB::bind_method(D_METHOD("accessibility_update_set_scroll_y_range", "id", "min", "max"), &DisplayServer::accessibility_update_set_scroll_y_range);1549ClassDB::bind_method(D_METHOD("accessibility_update_set_text_decorations", "id", "underline", "strikethrough", "overline"), &DisplayServer::accessibility_update_set_text_decorations);1550ClassDB::bind_method(D_METHOD("accessibility_update_set_text_align", "id", "align"), &DisplayServer::accessibility_update_set_text_align);1551ClassDB::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);1552ClassDB::bind_method(D_METHOD("accessibility_update_set_flag", "id", "flag", "value"), &DisplayServer::accessibility_update_set_flag);1553ClassDB::bind_method(D_METHOD("accessibility_update_set_classname", "id", "classname"), &DisplayServer::accessibility_update_set_classname);1554ClassDB::bind_method(D_METHOD("accessibility_update_set_placeholder", "id", "placeholder"), &DisplayServer::accessibility_update_set_placeholder);1555ClassDB::bind_method(D_METHOD("accessibility_update_set_language", "id", "language"), &DisplayServer::accessibility_update_set_language);1556ClassDB::bind_method(D_METHOD("accessibility_update_set_text_orientation", "id", "vertical"), &DisplayServer::accessibility_update_set_text_orientation);1557ClassDB::bind_method(D_METHOD("accessibility_update_set_list_orientation", "id", "vertical"), &DisplayServer::accessibility_update_set_list_orientation);1558ClassDB::bind_method(D_METHOD("accessibility_update_set_shortcut", "id", "shortcut"), &DisplayServer::accessibility_update_set_shortcut);1559ClassDB::bind_method(D_METHOD("accessibility_update_set_url", "id", "url"), &DisplayServer::accessibility_update_set_url);1560ClassDB::bind_method(D_METHOD("accessibility_update_set_role_description", "id", "description"), &DisplayServer::accessibility_update_set_role_description);1561ClassDB::bind_method(D_METHOD("accessibility_update_set_state_description", "id", "description"), &DisplayServer::accessibility_update_set_state_description);1562ClassDB::bind_method(D_METHOD("accessibility_update_set_color_value", "id", "color"), &DisplayServer::accessibility_update_set_color_value);1563ClassDB::bind_method(D_METHOD("accessibility_update_set_background_color", "id", "color"), &DisplayServer::accessibility_update_set_background_color);1564ClassDB::bind_method(D_METHOD("accessibility_update_set_foreground_color", "id", "color"), &DisplayServer::accessibility_update_set_foreground_color);15651566ClassDB::bind_method(D_METHOD("ime_get_selection"), &DisplayServer::ime_get_selection);1567ClassDB::bind_method(D_METHOD("ime_get_text"), &DisplayServer::ime_get_text);15681569ClassDB::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));1570ClassDB::bind_method(D_METHOD("virtual_keyboard_hide"), &DisplayServer::virtual_keyboard_hide);15711572ClassDB::bind_method(D_METHOD("virtual_keyboard_get_height"), &DisplayServer::virtual_keyboard_get_height);15731574ClassDB::bind_method(D_METHOD("has_hardware_keyboard"), &DisplayServer::has_hardware_keyboard);1575ClassDB::bind_method(D_METHOD("set_hardware_keyboard_connection_change_callback", "callable"), &DisplayServer::set_hardware_keyboard_connection_change_callback);15761577ClassDB::bind_method(D_METHOD("cursor_set_shape", "shape"), &DisplayServer::cursor_set_shape);1578ClassDB::bind_method(D_METHOD("cursor_get_shape"), &DisplayServer::cursor_get_shape);1579ClassDB::bind_method(D_METHOD("cursor_set_custom_image", "cursor", "shape", "hotspot"), &DisplayServer::cursor_set_custom_image, DEFVAL(CURSOR_ARROW), DEFVAL(Vector2()));15801581ClassDB::bind_method(D_METHOD("get_swap_cancel_ok"), &DisplayServer::get_swap_cancel_ok);15821583ClassDB::bind_method(D_METHOD("enable_for_stealing_focus", "process_id"), &DisplayServer::enable_for_stealing_focus);15841585ClassDB::bind_method(D_METHOD("dialog_show", "title", "description", "buttons", "callback"), &DisplayServer::dialog_show);1586ClassDB::bind_method(D_METHOD("dialog_input_text", "title", "description", "existing_text", "callback"), &DisplayServer::dialog_input_text);15871588ClassDB::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));1589ClassDB::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));15901591ClassDB::bind_method(D_METHOD("beep"), &DisplayServer::beep);15921593ClassDB::bind_method(D_METHOD("keyboard_get_layout_count"), &DisplayServer::keyboard_get_layout_count);1594ClassDB::bind_method(D_METHOD("keyboard_get_current_layout"), &DisplayServer::keyboard_get_current_layout);1595ClassDB::bind_method(D_METHOD("keyboard_set_current_layout", "index"), &DisplayServer::keyboard_set_current_layout);1596ClassDB::bind_method(D_METHOD("keyboard_get_layout_language", "index"), &DisplayServer::keyboard_get_layout_language);1597ClassDB::bind_method(D_METHOD("keyboard_get_layout_name", "index"), &DisplayServer::keyboard_get_layout_name);1598ClassDB::bind_method(D_METHOD("keyboard_get_keycode_from_physical", "keycode"), &DisplayServer::keyboard_get_keycode_from_physical);1599ClassDB::bind_method(D_METHOD("keyboard_get_label_from_physical", "keycode"), &DisplayServer::keyboard_get_label_from_physical);16001601ClassDB::bind_method(D_METHOD("show_emoji_and_symbol_picker"), &DisplayServer::show_emoji_and_symbol_picker);1602ClassDB::bind_method(D_METHOD("color_picker", "callback"), &DisplayServer::color_picker);16031604ClassDB::bind_method(D_METHOD("process_events"), &DisplayServer::process_events);1605ClassDB::bind_method(D_METHOD("force_process_and_drop_events"), &DisplayServer::force_process_and_drop_events);16061607ClassDB::bind_method(D_METHOD("set_native_icon", "filename"), &DisplayServer::set_native_icon);1608ClassDB::bind_method(D_METHOD("set_icon", "image"), &DisplayServer::set_icon);16091610ClassDB::bind_method(D_METHOD("create_status_indicator", "icon", "tooltip", "callback"), &DisplayServer::create_status_indicator);1611ClassDB::bind_method(D_METHOD("status_indicator_set_icon", "id", "icon"), &DisplayServer::status_indicator_set_icon);1612ClassDB::bind_method(D_METHOD("status_indicator_set_tooltip", "id", "tooltip"), &DisplayServer::status_indicator_set_tooltip);1613ClassDB::bind_method(D_METHOD("status_indicator_set_menu", "id", "menu_rid"), &DisplayServer::status_indicator_set_menu);1614ClassDB::bind_method(D_METHOD("status_indicator_set_callback", "id", "callback"), &DisplayServer::status_indicator_set_callback);1615ClassDB::bind_method(D_METHOD("status_indicator_get_rect", "id"), &DisplayServer::status_indicator_get_rect);1616ClassDB::bind_method(D_METHOD("delete_status_indicator", "id"), &DisplayServer::delete_status_indicator);16171618ClassDB::bind_method(D_METHOD("tablet_get_driver_count"), &DisplayServer::tablet_get_driver_count);1619ClassDB::bind_method(D_METHOD("tablet_get_driver_name", "idx"), &DisplayServer::tablet_get_driver_name);1620ClassDB::bind_method(D_METHOD("tablet_get_current_driver"), &DisplayServer::tablet_get_current_driver);1621ClassDB::bind_method(D_METHOD("tablet_set_current_driver", "name"), &DisplayServer::tablet_set_current_driver);16221623ClassDB::bind_method(D_METHOD("is_window_transparency_available"), &DisplayServer::is_window_transparency_available);16241625ClassDB::bind_method(D_METHOD("register_additional_output", "object"), &DisplayServer::register_additional_output);1626ClassDB::bind_method(D_METHOD("unregister_additional_output", "object"), &DisplayServer::unregister_additional_output);1627ClassDB::bind_method(D_METHOD("has_additional_outputs"), &DisplayServer::has_additional_outputs);16281629#ifndef DISABLE_DEPRECATED1630BIND_ENUM_CONSTANT(FEATURE_GLOBAL_MENU);1631#endif1632BIND_ENUM_CONSTANT(FEATURE_SUBWINDOWS);1633BIND_ENUM_CONSTANT(FEATURE_TOUCHSCREEN);1634BIND_ENUM_CONSTANT(FEATURE_MOUSE);1635BIND_ENUM_CONSTANT(FEATURE_MOUSE_WARP);1636BIND_ENUM_CONSTANT(FEATURE_CLIPBOARD);1637BIND_ENUM_CONSTANT(FEATURE_VIRTUAL_KEYBOARD);1638BIND_ENUM_CONSTANT(FEATURE_CURSOR_SHAPE);1639BIND_ENUM_CONSTANT(FEATURE_CUSTOM_CURSOR_SHAPE);1640BIND_ENUM_CONSTANT(FEATURE_NATIVE_DIALOG);1641BIND_ENUM_CONSTANT(FEATURE_IME);1642BIND_ENUM_CONSTANT(FEATURE_WINDOW_TRANSPARENCY);1643BIND_ENUM_CONSTANT(FEATURE_HIDPI);1644BIND_ENUM_CONSTANT(FEATURE_ICON);1645BIND_ENUM_CONSTANT(FEATURE_NATIVE_ICON);1646BIND_ENUM_CONSTANT(FEATURE_ORIENTATION);1647BIND_ENUM_CONSTANT(FEATURE_SWAP_BUFFERS);1648BIND_ENUM_CONSTANT(FEATURE_CLIPBOARD_PRIMARY);1649BIND_ENUM_CONSTANT(FEATURE_TEXT_TO_SPEECH);1650BIND_ENUM_CONSTANT(FEATURE_EXTEND_TO_TITLE);1651BIND_ENUM_CONSTANT(FEATURE_SCREEN_CAPTURE);1652BIND_ENUM_CONSTANT(FEATURE_STATUS_INDICATOR);1653BIND_ENUM_CONSTANT(FEATURE_NATIVE_HELP);1654BIND_ENUM_CONSTANT(FEATURE_NATIVE_DIALOG_INPUT);1655BIND_ENUM_CONSTANT(FEATURE_NATIVE_DIALOG_FILE);1656BIND_ENUM_CONSTANT(FEATURE_NATIVE_DIALOG_FILE_EXTRA);1657BIND_ENUM_CONSTANT(FEATURE_WINDOW_DRAG);1658BIND_ENUM_CONSTANT(FEATURE_SCREEN_EXCLUDE_FROM_CAPTURE);1659BIND_ENUM_CONSTANT(FEATURE_WINDOW_EMBEDDING);1660BIND_ENUM_CONSTANT(FEATURE_NATIVE_DIALOG_FILE_MIME);1661BIND_ENUM_CONSTANT(FEATURE_EMOJI_AND_SYMBOL_PICKER);1662BIND_ENUM_CONSTANT(FEATURE_NATIVE_COLOR_PICKER);1663BIND_ENUM_CONSTANT(FEATURE_SELF_FITTING_WINDOWS);1664BIND_ENUM_CONSTANT(FEATURE_ACCESSIBILITY_SCREEN_READER);16651666BIND_ENUM_CONSTANT(ROLE_UNKNOWN);1667BIND_ENUM_CONSTANT(ROLE_DEFAULT_BUTTON);1668BIND_ENUM_CONSTANT(ROLE_AUDIO);1669BIND_ENUM_CONSTANT(ROLE_VIDEO);1670BIND_ENUM_CONSTANT(ROLE_STATIC_TEXT);1671BIND_ENUM_CONSTANT(ROLE_CONTAINER);1672BIND_ENUM_CONSTANT(ROLE_PANEL);1673BIND_ENUM_CONSTANT(ROLE_BUTTON);1674BIND_ENUM_CONSTANT(ROLE_LINK);1675BIND_ENUM_CONSTANT(ROLE_CHECK_BOX);1676BIND_ENUM_CONSTANT(ROLE_RADIO_BUTTON);1677BIND_ENUM_CONSTANT(ROLE_CHECK_BUTTON);1678BIND_ENUM_CONSTANT(ROLE_SCROLL_BAR);1679BIND_ENUM_CONSTANT(ROLE_SCROLL_VIEW);1680BIND_ENUM_CONSTANT(ROLE_SPLITTER);1681BIND_ENUM_CONSTANT(ROLE_SLIDER);1682BIND_ENUM_CONSTANT(ROLE_SPIN_BUTTON);1683BIND_ENUM_CONSTANT(ROLE_PROGRESS_INDICATOR);1684BIND_ENUM_CONSTANT(ROLE_TEXT_FIELD);1685BIND_ENUM_CONSTANT(ROLE_MULTILINE_TEXT_FIELD);1686BIND_ENUM_CONSTANT(ROLE_COLOR_PICKER);1687BIND_ENUM_CONSTANT(ROLE_TABLE);1688BIND_ENUM_CONSTANT(ROLE_CELL);1689BIND_ENUM_CONSTANT(ROLE_ROW);1690BIND_ENUM_CONSTANT(ROLE_ROW_GROUP);1691BIND_ENUM_CONSTANT(ROLE_ROW_HEADER);1692BIND_ENUM_CONSTANT(ROLE_COLUMN_HEADER);1693BIND_ENUM_CONSTANT(ROLE_TREE);1694BIND_ENUM_CONSTANT(ROLE_TREE_ITEM);1695BIND_ENUM_CONSTANT(ROLE_LIST);1696BIND_ENUM_CONSTANT(ROLE_LIST_ITEM);1697BIND_ENUM_CONSTANT(ROLE_LIST_BOX);1698BIND_ENUM_CONSTANT(ROLE_LIST_BOX_OPTION);1699BIND_ENUM_CONSTANT(ROLE_TAB_BAR);1700BIND_ENUM_CONSTANT(ROLE_TAB);1701BIND_ENUM_CONSTANT(ROLE_TAB_PANEL);1702BIND_ENUM_CONSTANT(ROLE_MENU_BAR);1703BIND_ENUM_CONSTANT(ROLE_MENU);1704BIND_ENUM_CONSTANT(ROLE_MENU_ITEM);1705BIND_ENUM_CONSTANT(ROLE_MENU_ITEM_CHECK_BOX);1706BIND_ENUM_CONSTANT(ROLE_MENU_ITEM_RADIO);1707BIND_ENUM_CONSTANT(ROLE_IMAGE);1708BIND_ENUM_CONSTANT(ROLE_WINDOW);1709BIND_ENUM_CONSTANT(ROLE_TITLE_BAR);1710BIND_ENUM_CONSTANT(ROLE_DIALOG);1711BIND_ENUM_CONSTANT(ROLE_TOOLTIP);1712BIND_ENUM_CONSTANT(ROLE_REGION);17131714BIND_ENUM_CONSTANT(POPUP_MENU);1715BIND_ENUM_CONSTANT(POPUP_LIST);1716BIND_ENUM_CONSTANT(POPUP_TREE);1717BIND_ENUM_CONSTANT(POPUP_DIALOG);17181719BIND_ENUM_CONSTANT(FLAG_HIDDEN);1720BIND_ENUM_CONSTANT(FLAG_MULTISELECTABLE);1721BIND_ENUM_CONSTANT(FLAG_REQUIRED);1722BIND_ENUM_CONSTANT(FLAG_VISITED);1723BIND_ENUM_CONSTANT(FLAG_BUSY);1724BIND_ENUM_CONSTANT(FLAG_MODAL);1725BIND_ENUM_CONSTANT(FLAG_TOUCH_PASSTHROUGH);1726BIND_ENUM_CONSTANT(FLAG_READONLY);1727BIND_ENUM_CONSTANT(FLAG_DISABLED);1728BIND_ENUM_CONSTANT(FLAG_CLIPS_CHILDREN);17291730BIND_ENUM_CONSTANT(ACTION_CLICK);1731BIND_ENUM_CONSTANT(ACTION_FOCUS);1732BIND_ENUM_CONSTANT(ACTION_BLUR);1733BIND_ENUM_CONSTANT(ACTION_COLLAPSE);1734BIND_ENUM_CONSTANT(ACTION_EXPAND);1735BIND_ENUM_CONSTANT(ACTION_DECREMENT);1736BIND_ENUM_CONSTANT(ACTION_INCREMENT);1737BIND_ENUM_CONSTANT(ACTION_HIDE_TOOLTIP);1738BIND_ENUM_CONSTANT(ACTION_SHOW_TOOLTIP);1739BIND_ENUM_CONSTANT(ACTION_SET_TEXT_SELECTION);1740BIND_ENUM_CONSTANT(ACTION_REPLACE_SELECTED_TEXT);1741BIND_ENUM_CONSTANT(ACTION_SCROLL_BACKWARD);1742BIND_ENUM_CONSTANT(ACTION_SCROLL_DOWN);1743BIND_ENUM_CONSTANT(ACTION_SCROLL_FORWARD);1744BIND_ENUM_CONSTANT(ACTION_SCROLL_LEFT);1745BIND_ENUM_CONSTANT(ACTION_SCROLL_RIGHT);1746BIND_ENUM_CONSTANT(ACTION_SCROLL_UP);1747BIND_ENUM_CONSTANT(ACTION_SCROLL_INTO_VIEW);1748BIND_ENUM_CONSTANT(ACTION_SCROLL_TO_POINT);1749BIND_ENUM_CONSTANT(ACTION_SET_SCROLL_OFFSET);1750BIND_ENUM_CONSTANT(ACTION_SET_VALUE);1751BIND_ENUM_CONSTANT(ACTION_SHOW_CONTEXT_MENU);1752BIND_ENUM_CONSTANT(ACTION_CUSTOM);17531754BIND_ENUM_CONSTANT(LIVE_OFF);1755BIND_ENUM_CONSTANT(LIVE_POLITE);1756BIND_ENUM_CONSTANT(LIVE_ASSERTIVE);17571758BIND_ENUM_CONSTANT(SCROLL_UNIT_ITEM);1759BIND_ENUM_CONSTANT(SCROLL_UNIT_PAGE);17601761BIND_ENUM_CONSTANT(SCROLL_HINT_TOP_LEFT);1762BIND_ENUM_CONSTANT(SCROLL_HINT_BOTTOM_RIGHT);1763BIND_ENUM_CONSTANT(SCROLL_HINT_TOP_EDGE);1764BIND_ENUM_CONSTANT(SCROLL_HINT_BOTTOM_EDGE);1765BIND_ENUM_CONSTANT(SCROLL_HINT_LEFT_EDGE);1766BIND_ENUM_CONSTANT(SCROLL_HINT_RIGHT_EDGE);17671768BIND_ENUM_CONSTANT(MOUSE_MODE_VISIBLE);1769BIND_ENUM_CONSTANT(MOUSE_MODE_HIDDEN);1770BIND_ENUM_CONSTANT(MOUSE_MODE_CAPTURED);1771BIND_ENUM_CONSTANT(MOUSE_MODE_CONFINED);1772BIND_ENUM_CONSTANT(MOUSE_MODE_CONFINED_HIDDEN);1773BIND_ENUM_CONSTANT(MOUSE_MODE_MAX);17741775BIND_CONSTANT(INVALID_SCREEN);1776BIND_CONSTANT(SCREEN_WITH_MOUSE_FOCUS);1777BIND_CONSTANT(SCREEN_WITH_KEYBOARD_FOCUS);1778BIND_CONSTANT(SCREEN_PRIMARY);1779BIND_CONSTANT(SCREEN_OF_MAIN_WINDOW);17801781BIND_CONSTANT(MAIN_WINDOW_ID);1782BIND_CONSTANT(INVALID_WINDOW_ID);1783BIND_CONSTANT(INVALID_INDICATOR_ID);17841785BIND_ENUM_CONSTANT(SCREEN_LANDSCAPE);1786BIND_ENUM_CONSTANT(SCREEN_PORTRAIT);1787BIND_ENUM_CONSTANT(SCREEN_REVERSE_LANDSCAPE);1788BIND_ENUM_CONSTANT(SCREEN_REVERSE_PORTRAIT);1789BIND_ENUM_CONSTANT(SCREEN_SENSOR_LANDSCAPE);1790BIND_ENUM_CONSTANT(SCREEN_SENSOR_PORTRAIT);1791BIND_ENUM_CONSTANT(SCREEN_SENSOR);17921793BIND_ENUM_CONSTANT(KEYBOARD_TYPE_DEFAULT);1794BIND_ENUM_CONSTANT(KEYBOARD_TYPE_MULTILINE);1795BIND_ENUM_CONSTANT(KEYBOARD_TYPE_NUMBER);1796BIND_ENUM_CONSTANT(KEYBOARD_TYPE_NUMBER_DECIMAL);1797BIND_ENUM_CONSTANT(KEYBOARD_TYPE_PHONE);1798BIND_ENUM_CONSTANT(KEYBOARD_TYPE_EMAIL_ADDRESS);1799BIND_ENUM_CONSTANT(KEYBOARD_TYPE_PASSWORD);1800BIND_ENUM_CONSTANT(KEYBOARD_TYPE_URL);18011802BIND_ENUM_CONSTANT(CURSOR_ARROW);1803BIND_ENUM_CONSTANT(CURSOR_IBEAM);1804BIND_ENUM_CONSTANT(CURSOR_POINTING_HAND);1805BIND_ENUM_CONSTANT(CURSOR_CROSS);1806BIND_ENUM_CONSTANT(CURSOR_WAIT);1807BIND_ENUM_CONSTANT(CURSOR_BUSY);1808BIND_ENUM_CONSTANT(CURSOR_DRAG);1809BIND_ENUM_CONSTANT(CURSOR_CAN_DROP);1810BIND_ENUM_CONSTANT(CURSOR_FORBIDDEN);1811BIND_ENUM_CONSTANT(CURSOR_VSIZE);1812BIND_ENUM_CONSTANT(CURSOR_HSIZE);1813BIND_ENUM_CONSTANT(CURSOR_BDIAGSIZE);1814BIND_ENUM_CONSTANT(CURSOR_FDIAGSIZE);1815BIND_ENUM_CONSTANT(CURSOR_MOVE);1816BIND_ENUM_CONSTANT(CURSOR_VSPLIT);1817BIND_ENUM_CONSTANT(CURSOR_HSPLIT);1818BIND_ENUM_CONSTANT(CURSOR_HELP);1819BIND_ENUM_CONSTANT(CURSOR_MAX);18201821BIND_ENUM_CONSTANT(FILE_DIALOG_MODE_OPEN_FILE);1822BIND_ENUM_CONSTANT(FILE_DIALOG_MODE_OPEN_FILES);1823BIND_ENUM_CONSTANT(FILE_DIALOG_MODE_OPEN_DIR);1824BIND_ENUM_CONSTANT(FILE_DIALOG_MODE_OPEN_ANY);1825BIND_ENUM_CONSTANT(FILE_DIALOG_MODE_SAVE_FILE);18261827BIND_ENUM_CONSTANT(WINDOW_MODE_WINDOWED);1828BIND_ENUM_CONSTANT(WINDOW_MODE_MINIMIZED);1829BIND_ENUM_CONSTANT(WINDOW_MODE_MAXIMIZED);1830BIND_ENUM_CONSTANT(WINDOW_MODE_FULLSCREEN);1831BIND_ENUM_CONSTANT(WINDOW_MODE_EXCLUSIVE_FULLSCREEN);18321833BIND_ENUM_CONSTANT(WINDOW_FLAG_RESIZE_DISABLED);1834BIND_ENUM_CONSTANT(WINDOW_FLAG_BORDERLESS);1835BIND_ENUM_CONSTANT(WINDOW_FLAG_ALWAYS_ON_TOP);1836BIND_ENUM_CONSTANT(WINDOW_FLAG_TRANSPARENT);1837BIND_ENUM_CONSTANT(WINDOW_FLAG_NO_FOCUS);1838BIND_ENUM_CONSTANT(WINDOW_FLAG_POPUP);1839BIND_ENUM_CONSTANT(WINDOW_FLAG_EXTEND_TO_TITLE);1840BIND_ENUM_CONSTANT(WINDOW_FLAG_MOUSE_PASSTHROUGH);1841BIND_ENUM_CONSTANT(WINDOW_FLAG_SHARP_CORNERS);1842BIND_ENUM_CONSTANT(WINDOW_FLAG_EXCLUDE_FROM_CAPTURE);1843BIND_ENUM_CONSTANT(WINDOW_FLAG_POPUP_WM_HINT);1844BIND_ENUM_CONSTANT(WINDOW_FLAG_MINIMIZE_DISABLED);1845BIND_ENUM_CONSTANT(WINDOW_FLAG_MAXIMIZE_DISABLED);1846BIND_ENUM_CONSTANT(WINDOW_FLAG_MAX);18471848BIND_ENUM_CONSTANT(WINDOW_EVENT_MOUSE_ENTER);1849BIND_ENUM_CONSTANT(WINDOW_EVENT_MOUSE_EXIT);1850BIND_ENUM_CONSTANT(WINDOW_EVENT_FOCUS_IN);1851BIND_ENUM_CONSTANT(WINDOW_EVENT_FOCUS_OUT);1852BIND_ENUM_CONSTANT(WINDOW_EVENT_CLOSE_REQUEST);1853BIND_ENUM_CONSTANT(WINDOW_EVENT_GO_BACK_REQUEST);1854BIND_ENUM_CONSTANT(WINDOW_EVENT_DPI_CHANGE);1855BIND_ENUM_CONSTANT(WINDOW_EVENT_TITLEBAR_CHANGE);1856BIND_ENUM_CONSTANT(WINDOW_EVENT_FORCE_CLOSE);18571858BIND_ENUM_CONSTANT(WINDOW_EDGE_TOP_LEFT);1859BIND_ENUM_CONSTANT(WINDOW_EDGE_TOP);1860BIND_ENUM_CONSTANT(WINDOW_EDGE_TOP_RIGHT);1861BIND_ENUM_CONSTANT(WINDOW_EDGE_LEFT);1862BIND_ENUM_CONSTANT(WINDOW_EDGE_RIGHT);1863BIND_ENUM_CONSTANT(WINDOW_EDGE_BOTTOM_LEFT);1864BIND_ENUM_CONSTANT(WINDOW_EDGE_BOTTOM);1865BIND_ENUM_CONSTANT(WINDOW_EDGE_BOTTOM_RIGHT);1866BIND_ENUM_CONSTANT(WINDOW_EDGE_MAX);18671868BIND_ENUM_CONSTANT(VSYNC_DISABLED);1869BIND_ENUM_CONSTANT(VSYNC_ENABLED);1870BIND_ENUM_CONSTANT(VSYNC_ADAPTIVE);1871BIND_ENUM_CONSTANT(VSYNC_MAILBOX);18721873BIND_ENUM_CONSTANT(DISPLAY_HANDLE);1874BIND_ENUM_CONSTANT(WINDOW_HANDLE);1875BIND_ENUM_CONSTANT(WINDOW_VIEW);1876BIND_ENUM_CONSTANT(OPENGL_CONTEXT);1877BIND_ENUM_CONSTANT(EGL_DISPLAY);1878BIND_ENUM_CONSTANT(EGL_CONFIG);18791880BIND_ENUM_CONSTANT(TTS_UTTERANCE_STARTED);1881BIND_ENUM_CONSTANT(TTS_UTTERANCE_ENDED);1882BIND_ENUM_CONSTANT(TTS_UTTERANCE_CANCELED);1883BIND_ENUM_CONSTANT(TTS_UTTERANCE_BOUNDARY);1884}18851886Ref<Image> DisplayServer::_get_cursor_image_from_resource(const Ref<Resource> &p_cursor, const Vector2 &p_hotspot) {1887Ref<Image> image;1888ERR_FAIL_COND_V_MSG(p_hotspot.x < 0 || p_hotspot.y < 0, image, "Hotspot outside cursor image.");18891890Ref<Texture2D> texture = p_cursor;1891if (texture.is_valid()) {1892image = texture->get_image();1893} else {1894image = p_cursor;1895}1896ERR_FAIL_COND_V(image.is_null(), image);18971898Size2 image_size = image->get_size();1899ERR_FAIL_COND_V_MSG(p_hotspot.x > image_size.width || p_hotspot.y > image_size.height, image, "Hotspot outside cursor image.");1900ERR_FAIL_COND_V_MSG(image_size.width > 256 || image_size.height > 256, image, "Cursor image too big. Max supported size is 256x256.");19011902if (image->is_compressed()) {1903image = image->duplicate(true);1904Error err = image->decompress();1905ERR_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.");1906}1907return image;1908}19091910void DisplayServer::register_create_function(const char *p_name, CreateFunction p_function, GetRenderingDriversFunction p_get_drivers) {1911ERR_FAIL_COND(server_create_count == MAX_SERVERS);1912// Headless display server is always last1913server_create_functions[server_create_count] = server_create_functions[server_create_count - 1];1914server_create_functions[server_create_count - 1].name = p_name;1915server_create_functions[server_create_count - 1].create_function = p_function;1916server_create_functions[server_create_count - 1].get_rendering_drivers_function = p_get_drivers;1917server_create_count++;1918}19191920int DisplayServer::get_create_function_count() {1921return server_create_count;1922}19231924const char *DisplayServer::get_create_function_name(int p_index) {1925ERR_FAIL_INDEX_V(p_index, server_create_count, nullptr);1926return server_create_functions[p_index].name;1927}19281929Vector<String> DisplayServer::get_create_function_rendering_drivers(int p_index) {1930ERR_FAIL_INDEX_V(p_index, server_create_count, Vector<String>());1931return server_create_functions[p_index].get_rendering_drivers_function();1932}19331934DisplayServer *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) {1935ERR_FAIL_INDEX_V(p_index, server_create_count, nullptr);1936return 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);1937}19381939void DisplayServer::_input_set_mouse_mode(InputClassEnums::MouseMode p_mode) {1940singleton->mouse_set_mode(MouseMode(p_mode));1941}19421943InputClassEnums::MouseMode DisplayServer::_input_get_mouse_mode() {1944return InputClassEnums::MouseMode(singleton->mouse_get_mode());1945}19461947void DisplayServer::_input_set_mouse_mode_override(InputClassEnums::MouseMode p_mode) {1948singleton->mouse_set_mode_override(MouseMode(p_mode));1949}19501951InputClassEnums::MouseMode DisplayServer::_input_get_mouse_mode_override() {1952return InputClassEnums::MouseMode(singleton->mouse_get_mode_override());1953}19541955void DisplayServer::_input_set_mouse_mode_override_enabled(bool p_enabled) {1956singleton->mouse_set_mode_override_enabled(p_enabled);1957}19581959bool DisplayServer::_input_is_mouse_mode_override_enabled() {1960return singleton->mouse_is_mode_override_enabled();1961}19621963void DisplayServer::_input_warp(const Vector2 &p_to_pos) {1964singleton->warp_mouse(p_to_pos);1965}19661967InputClassEnums::CursorShape DisplayServer::_input_get_current_cursor_shape() {1968return (InputClassEnums::CursorShape)singleton->cursor_get_shape();1969}19701971void DisplayServer::_input_set_custom_mouse_cursor_func(const Ref<Resource> &p_image, InputClassEnums::CursorShape p_shape, const Vector2 &p_hotspot) {1972singleton->cursor_set_custom_image(p_image, (CursorShape)p_shape, p_hotspot);1973}19741975bool DisplayServer::is_rendering_device_supported() {1976#if defined(RD_ENABLED)1977RenderingDevice *device = RenderingDevice::get_singleton();1978if (device) {1979return true;1980}19811982if (supported_rendering_device == RenderingDeviceCreationStatus::SUCCESS) {1983return true;1984} else if (supported_rendering_device == RenderingDeviceCreationStatus::FAILURE) {1985return false;1986}19871988Error err;19891990#if defined(WINDOWS_ENABLED) || defined(LINUXBSD_ENABLED)1991// On some drivers combining OpenGL and RenderingDevice can result in crash, offload the check to the subprocess.1992List<String> arguments;1993arguments.push_back("--test-rd-support");1994if (get_singleton()) {1995arguments.push_back("--display-driver");1996arguments.push_back(get_singleton()->get_name().to_lower());1997}19981999String pipe;2000int exitcode = 0;2001err = OS::get_singleton()->execute(OS::get_singleton()->get_executable_path(), arguments, &pipe, &exitcode);2002if (err == OK && exitcode == 0) {2003supported_rendering_device = RenderingDeviceCreationStatus::SUCCESS;2004return true;2005} else {2006supported_rendering_device = RenderingDeviceCreationStatus::FAILURE;2007}2008#else // WINDOWS_ENABLED20092010RenderingContextDriver *rcd = nullptr;20112012#if defined(VULKAN_ENABLED)2013rcd = memnew(RenderingContextDriverVulkan);2014#endif2015#ifdef D3D12_ENABLED2016if (rcd == nullptr) {2017rcd = memnew(RenderingContextDriverD3D12);2018}2019#endif2020#ifdef METAL_ENABLED2021if (rcd == nullptr) {2022GODOT_CLANG_WARNING_PUSH_AND_IGNORE("-Wunguarded-availability")2023// Eliminate "RenderingContextDriverMetal is only available on iOS 14.0 or newer".2024rcd = memnew(RenderingContextDriverMetal);2025GODOT_CLANG_WARNING_POP2026}2027#endif20282029if (rcd != nullptr) {2030err = rcd->initialize();2031if (err == OK) {2032RenderingDevice *rd = memnew(RenderingDevice);2033err = rd->initialize(rcd);2034memdelete(rd);2035rd = nullptr;2036if (err == OK) {2037// Creating a RenderingDevice is quite slow.2038// Cache the result for future usage, so that it's much faster on subsequent calls.2039supported_rendering_device = RenderingDeviceCreationStatus::SUCCESS;2040memdelete(rcd);2041rcd = nullptr;2042return true;2043} else {2044supported_rendering_device = RenderingDeviceCreationStatus::FAILURE;2045}2046}20472048memdelete(rcd);2049rcd = nullptr;2050}20512052#endif // WINDOWS_ENABLED2053#endif // RD_ENABLED2054return false;2055}20562057bool DisplayServer::can_create_rendering_device() {2058if (get_singleton() && get_singleton()->get_name() == "headless") {2059return false;2060}20612062#if defined(RD_ENABLED)2063RenderingDevice *device = RenderingDevice::get_singleton();2064if (device) {2065return true;2066}20672068if (created_rendering_device == RenderingDeviceCreationStatus::SUCCESS) {2069return true;2070} else if (created_rendering_device == RenderingDeviceCreationStatus::FAILURE) {2071return false;2072}20732074Error err;20752076#ifdef WINDOWS_ENABLED2077// On some NVIDIA drivers combining OpenGL and RenderingDevice can result in crash, offload the check to the subprocess.2078List<String> arguments;2079arguments.push_back("--test-rd-creation");20802081String pipe;2082int exitcode = 0;2083err = OS::get_singleton()->execute(OS::get_singleton()->get_executable_path(), arguments, &pipe, &exitcode);2084if (err == OK && exitcode == 0) {2085created_rendering_device = RenderingDeviceCreationStatus::SUCCESS;2086return true;2087} else {2088created_rendering_device = RenderingDeviceCreationStatus::FAILURE;2089}2090#else // WINDOWS_ENABLED20912092RenderingContextDriver *rcd = nullptr;20932094#if defined(VULKAN_ENABLED)2095rcd = memnew(RenderingContextDriverVulkan);2096#endif2097#ifdef D3D12_ENABLED2098if (rcd == nullptr) {2099rcd = memnew(RenderingContextDriverD3D12);2100}2101#endif2102#ifdef METAL_ENABLED2103if (rcd == nullptr) {2104GODOT_CLANG_WARNING_PUSH_AND_IGNORE("-Wunguarded-availability")2105// Eliminate "RenderingContextDriverMetal is only available on iOS 14.0 or newer".2106rcd = memnew(RenderingContextDriverMetal);2107GODOT_CLANG_WARNING_POP2108}2109#endif21102111if (rcd != nullptr) {2112err = rcd->initialize();2113if (err == OK) {2114RenderingDevice *rd = memnew(RenderingDevice);2115err = rd->initialize(rcd);2116memdelete(rd);2117rd = nullptr;2118if (err == OK) {2119// Creating a RenderingDevice is quite slow.2120// Cache the result for future usage, so that it's much faster on subsequent calls.2121created_rendering_device = RenderingDeviceCreationStatus::SUCCESS;2122memdelete(rcd);2123rcd = nullptr;2124return true;2125} else {2126created_rendering_device = RenderingDeviceCreationStatus::FAILURE;2127}2128}21292130memdelete(rcd);2131rcd = nullptr;2132}21332134#endif // WINDOWS_ENABLED2135#endif // RD_ENABLED2136return false;2137}21382139DisplayServer::DisplayServer() {2140singleton = this;2141Input::set_mouse_mode_func = _input_set_mouse_mode;2142Input::get_mouse_mode_func = _input_get_mouse_mode;2143Input::set_mouse_mode_override_func = _input_set_mouse_mode_override;2144Input::get_mouse_mode_override_func = _input_get_mouse_mode_override;2145Input::set_mouse_mode_override_enabled_func = _input_set_mouse_mode_override_enabled;2146Input::is_mouse_mode_override_enabled_func = _input_is_mouse_mode_override_enabled;2147Input::warp_mouse_func = _input_warp;2148Input::get_current_cursor_shape_func = _input_get_current_cursor_shape;2149Input::set_custom_mouse_cursor_func = _input_set_custom_mouse_cursor_func;2150}21512152DisplayServer::~DisplayServer() {2153singleton = nullptr;2154}215521562157