godot/servers/display_server.cpp

/**************************************************************************/
/*  display_server.cpp                                                    */
/**************************************************************************/
/*                         This file is part of:                          */
/*                             GODOT ENGINE                               */
/*                        https://godotengine.org                         */
/**************************************************************************/
/* Copyright (c) 2014-present Godot Engine contributors (see AUTHORS.md). */
/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur.                  */
/*                                                                        */
/* Permission is hereby granted, free of charge, to any person obtaining  */
/* a copy of this software and associated documentation files (the        */
/* "Software"), to deal in the Software without restriction, including    */
/* without limitation the rights to use, copy, modify, merge, publish,    */
/* distribute, sublicense, and/or sell copies of the Software, and to     */
/* permit persons to whom the Software is furnished to do so, subject to  */
/* the following conditions:                                              */
/*                                                                        */
/* The above copyright notice and this permission notice shall be         */
/* included in all copies or substantial portions of the Software.        */
/*                                                                        */
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,        */
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF     */
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. */
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY   */
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,   */
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE      */
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.                 */
/**************************************************************************/

#include "display_server.h"

#include "core/input/input.h"
#include "scene/resources/texture.h"
#include "servers/display_server_headless.h"

#if defined(VULKAN_ENABLED)
#include "drivers/vulkan/rendering_context_driver_vulkan.h"
#undef CursorShape
#endif
#if defined(D3D12_ENABLED)
#include "drivers/d3d12/rendering_context_driver_d3d12.h"
#endif
#if defined(METAL_ENABLED)
#include "drivers/metal/rendering_context_driver_metal.h"
#endif

DisplayServer *DisplayServer::singleton =;

bool DisplayServer::hidpi_allowed =;

bool DisplayServer::window_early_clear_override_enabled =;
Color DisplayServer::window_early_clear_override_color =;

DisplayServer::DisplayServerCreate DisplayServer::server_create_functions[DisplayServer::MAX_SERVERS] =;

int DisplayServer::server_create_count =;

void DisplayServer::help_set_search_callbacks(const Callable &p_search_callback, const Callable &p_action_callback) {}

#ifndef DISABLE_DEPRECATED

RID DisplayServer::_get_rid_from_name(NativeMenu *p_nmenu, const String &p_menu_root) const {}

int DisplayServer::global_menu_add_item(const String &p_menu_root, const String &p_label, const Callable &p_callback, const Callable &p_key_callback, const Variant &p_tag, Key p_accel, int p_index) {}

int DisplayServer::global_menu_add_check_item(const String &p_menu_root, const String &p_label, const Callable &p_callback, const Callable &p_key_callback, const Variant &p_tag, Key p_accel, int p_index) {}

int DisplayServer::global_menu_add_icon_item(const String &p_menu_root, const Ref<Texture2D> &p_icon, const String &p_label, const Callable &p_callback, const Callable &p_key_callback, const Variant &p_tag, Key p_accel, int p_index) {}

int DisplayServer::global_menu_add_icon_check_item(const String &p_menu_root, const Ref<Texture2D> &p_icon, const String &p_label, const Callable &p_callback, const Callable &p_key_callback, const Variant &p_tag, Key p_accel, int p_index) {}

int DisplayServer::global_menu_add_radio_check_item(const String &p_menu_root, const String &p_label, const Callable &p_callback, const Callable &p_key_callback, const Variant &p_tag, Key p_accel, int p_index) {}

int DisplayServer::global_menu_add_icon_radio_check_item(const String &p_menu_root, const Ref<Texture2D> &p_icon, const String &p_label, const Callable &p_callback, const Callable &p_key_callback, const Variant &p_tag, Key p_accel, int p_index) {}

int DisplayServer::global_menu_add_multistate_item(const String &p_menu_root, const String &p_label, int p_max_states, int p_default_state, const Callable &p_callback, const Callable &p_key_callback, const Variant &p_tag, Key p_accel, int p_index) {}

void DisplayServer::global_menu_set_popup_callbacks(const String &p_menu_root, const Callable &p_open_callback, const Callable &p_close_callback) {}

int DisplayServer::global_menu_add_submenu_item(const String &p_menu_root, const String &p_label, const String &p_submenu, int p_index) {}

int DisplayServer::global_menu_add_separator(const String &p_menu_root, int p_index) {}

int DisplayServer::global_menu_get_item_index_from_text(const String &p_menu_root, const String &p_text) const {}

int DisplayServer::global_menu_get_item_index_from_tag(const String &p_menu_root, const Variant &p_tag) const {}

void DisplayServer::global_menu_set_item_callback(const String &p_menu_root, int p_idx, const Callable &p_callback) {}

void DisplayServer::global_menu_set_item_hover_callbacks(const String &p_menu_root, int p_idx, const Callable &p_callback) {}

void DisplayServer::global_menu_set_item_key_callback(const String &p_menu_root, int p_idx, const Callable &p_key_callback) {}

bool DisplayServer::global_menu_is_item_checked(const String &p_menu_root, int p_idx) const {}

bool DisplayServer::global_menu_is_item_checkable(const String &p_menu_root, int p_idx) const {}

bool DisplayServer::global_menu_is_item_radio_checkable(const String &p_menu_root, int p_idx) const {}

Callable DisplayServer::global_menu_get_item_callback(const String &p_menu_root, int p_idx) const {}

Callable DisplayServer::global_menu_get_item_key_callback(const String &p_menu_root, int p_idx) const {}

Variant DisplayServer::global_menu_get_item_tag(const String &p_menu_root, int p_idx) const {}

String DisplayServer::global_menu_get_item_text(const String &p_menu_root, int p_idx) const {}

String DisplayServer::global_menu_get_item_submenu(const String &p_menu_root, int p_idx) const {}

Key DisplayServer::global_menu_get_item_accelerator(const String &p_menu_root, int p_idx) const {}

bool DisplayServer::global_menu_is_item_disabled(const String &p_menu_root, int p_idx) const {}

bool DisplayServer::global_menu_is_item_hidden(const String &p_menu_root, int p_idx) const {}

String DisplayServer::global_menu_get_item_tooltip(const String &p_menu_root, int p_idx) const {}

int DisplayServer::global_menu_get_item_state(const String &p_menu_root, int p_idx) const {}

int DisplayServer::global_menu_get_item_max_states(const String &p_menu_root, int p_idx) const {}

Ref<Texture2D> DisplayServer::global_menu_get_item_icon(const String &p_menu_root, int p_idx) const {}

int DisplayServer::global_menu_get_item_indentation_level(const String &p_menu_root, int p_idx) const {}

void DisplayServer::global_menu_set_item_checked(const String &p_menu_root, int p_idx, bool p_checked) {}

void DisplayServer::global_menu_set_item_checkable(const String &p_menu_root, int p_idx, bool p_checkable) {}

void DisplayServer::global_menu_set_item_radio_checkable(const String &p_menu_root, int p_idx, bool p_checkable) {}

void DisplayServer::global_menu_set_item_tag(const String &p_menu_root, int p_idx, const Variant &p_tag) {}

void DisplayServer::global_menu_set_item_text(const String &p_menu_root, int p_idx, const String &p_text) {}

void DisplayServer::global_menu_set_item_submenu(const String &p_menu_root, int p_idx, const String &p_submenu) {}

void DisplayServer::global_menu_set_item_accelerator(const String &p_menu_root, int p_idx, Key p_keycode) {}

void DisplayServer::global_menu_set_item_disabled(const String &p_menu_root, int p_idx, bool p_disabled) {}

void DisplayServer::global_menu_set_item_hidden(const String &p_menu_root, int p_idx, bool p_hidden) {}

void DisplayServer::global_menu_set_item_tooltip(const String &p_menu_root, int p_idx, const String &p_tooltip) {}

void DisplayServer::global_menu_set_item_state(const String &p_menu_root, int p_idx, int p_state) {}

void DisplayServer::global_menu_set_item_max_states(const String &p_menu_root, int p_idx, int p_max_states) {}

void DisplayServer::global_menu_set_item_icon(const String &p_menu_root, int p_idx, const Ref<Texture2D> &p_icon) {}

void DisplayServer::global_menu_set_item_indentation_level(const String &p_menu_root, int p_idx, int p_level) {}

int DisplayServer::global_menu_get_item_count(const String &p_menu_root) const {}

void DisplayServer::global_menu_remove_item(const String &p_menu_root, int p_idx) {}

void DisplayServer::global_menu_clear(const String &p_menu_root) {}

Dictionary DisplayServer::global_menu_get_system_menu_roots() const {}

#endif

bool DisplayServer::tts_is_speaking() const {}

bool DisplayServer::tts_is_paused() const {}

void DisplayServer::tts_pause() {}

void DisplayServer::tts_resume() {}

TypedArray<Dictionary> DisplayServer::tts_get_voices() const {}

PackedStringArray DisplayServer::tts_get_voices_for_language(const String &p_language) const {}

void DisplayServer::tts_speak(const String &p_text, const String &p_voice, int p_volume, float p_pitch, float p_rate, int p_utterance_id, bool p_interrupt) {}

void DisplayServer::tts_stop() {}

void DisplayServer::tts_set_utterance_callback(TTSUtteranceEvent p_event, const Callable &p_callable) {}

void DisplayServer::tts_post_utterance_event(TTSUtteranceEvent p_event, int p_id, int p_pos) {}

bool DisplayServer::_get_window_early_clear_override(Color &r_color) {}

void DisplayServer::set_early_window_clear_color_override(bool p_enabled, Color p_color) {}

void DisplayServer::mouse_set_mode(MouseMode p_mode) {}

DisplayServer::MouseMode DisplayServer::mouse_get_mode() const {}

void DisplayServer::warp_mouse(const Point2i &p_position) {}

Point2i DisplayServer::mouse_get_position() const {}

BitField<MouseButtonMask> DisplayServer::mouse_get_button_state() const {}

void DisplayServer::clipboard_set(const String &p_text) {}

String DisplayServer::clipboard_get() const {}

Ref<Image> DisplayServer::clipboard_get_image() const {}

bool DisplayServer::clipboard_has() const {}

bool DisplayServer::clipboard_has_image() const {}

void DisplayServer::clipboard_set_primary(const String &p_text) {}

String DisplayServer::clipboard_get_primary() const {}

void DisplayServer::screen_set_orientation(ScreenOrientation p_orientation, int p_screen) {}

DisplayServer::ScreenOrientation DisplayServer::screen_get_orientation(int p_screen) const {}

float DisplayServer::screen_get_scale(int p_screen) const {
	return 1.0f;
};

bool DisplayServer::is_touchscreen_available() const {}

void DisplayServer::screen_set_keep_on(bool p_enable) {}

bool DisplayServer::screen_is_kept_on() const {}

int DisplayServer::get_screen_from_rect(const Rect2 &p_rect) const {}

DisplayServer::WindowID DisplayServer::create_sub_window(WindowMode p_mode, VSyncMode p_vsync_mode, uint32_t p_flags, const Rect2i &p_rect, bool p_exclusive, WindowID p_transient_parent) {}

void DisplayServer::show_window(WindowID p_id) {}

void DisplayServer::delete_sub_window(WindowID p_id) {}

void DisplayServer::window_set_exclusive(WindowID p_window, bool p_exclusive) {}

void DisplayServer::window_set_mouse_passthrough(const Vector<Vector2> &p_region, WindowID p_window) {}

void DisplayServer::gl_window_make_current(DisplayServer::WindowID p_window_id) {}

void DisplayServer::window_set_ime_active(const bool p_active, WindowID p_window) {}

void DisplayServer::window_set_ime_position(const Point2i &p_pos, WindowID p_window) {}

Point2i DisplayServer::ime_get_selection() const {}

String DisplayServer::ime_get_text() const {}

void DisplayServer::virtual_keyboard_show(const String &p_existing_text, const Rect2 &p_screen_rect, VirtualKeyboardType p_type, int p_max_length, int p_cursor_start, int p_cursor_end) {}

void DisplayServer::virtual_keyboard_hide() {}

// returns height of the currently shown keyboard (0 if keyboard is hidden)
int DisplayServer::virtual_keyboard_get_height() const {}

bool DisplayServer::has_hardware_keyboard() const {}

void DisplayServer::cursor_set_shape(CursorShape p_shape) {}

DisplayServer::CursorShape DisplayServer::cursor_get_shape() const {}

void DisplayServer::cursor_set_custom_image(const Ref<Resource> &p_cursor, CursorShape p_shape, const Vector2 &p_hotspot) {}

bool DisplayServer::get_swap_cancel_ok() {}

void DisplayServer::enable_for_stealing_focus(OS::ProcessID pid) {}

Error DisplayServer::dialog_show(String p_title, String p_description, Vector<String> p_buttons, const Callable &p_callback) {}

Error DisplayServer::dialog_input_text(String p_title, String p_description, String p_partial, const Callable &p_callback) {}

Error DisplayServer::file_dialog_show(const String &p_title, const String &p_current_directory, const String &p_filename, bool p_show_hidden, FileDialogMode p_mode, const Vector<String> &p_filters, const Callable &p_callback) {}

Error DisplayServer::file_dialog_with_options_show(const String &p_title, const String &p_current_directory, const String &p_root, const String &p_filename, bool p_show_hidden, FileDialogMode p_mode, const Vector<String> &p_filters, const TypedArray<Dictionary> &p_options, const Callable &p_callback) {}

int DisplayServer::keyboard_get_layout_count() const {}

int DisplayServer::keyboard_get_current_layout() const {}

void DisplayServer::keyboard_set_current_layout(int p_index) {}

String DisplayServer::keyboard_get_layout_language(int p_index) const {}

String DisplayServer::keyboard_get_layout_name(int p_index) const {}

Key DisplayServer::keyboard_get_keycode_from_physical(Key p_keycode) const {}

Key DisplayServer::keyboard_get_label_from_physical(Key p_keycode) const {}

void DisplayServer::force_process_and_drop_events() {}

void DisplayServer::release_rendering_thread() {}

void DisplayServer::swap_buffers() {}

void DisplayServer::set_native_icon(const String &p_filename) {}

void DisplayServer::set_icon(const Ref<Image> &p_icon) {}

DisplayServer::IndicatorID DisplayServer::create_status_indicator(const Ref<Texture2D> &p_icon, const String &p_tooltip, const Callable &p_callback) {}

void DisplayServer::status_indicator_set_icon(IndicatorID p_id, const Ref<Texture2D> &p_icon) {}

void DisplayServer::status_indicator_set_tooltip(IndicatorID p_id, const String &p_tooltip) {}

void DisplayServer::status_indicator_set_menu(IndicatorID p_id, const RID &p_menu_rid) {}

void DisplayServer::status_indicator_set_callback(IndicatorID p_id, const Callable &p_callback) {}

Rect2 DisplayServer::status_indicator_get_rect(IndicatorID p_id) const {}

void DisplayServer::delete_status_indicator(IndicatorID p_id) {}

int64_t DisplayServer::window_get_native_handle(HandleType p_handle_type, WindowID p_window) const {}

void DisplayServer::window_set_vsync_mode(DisplayServer::VSyncMode p_vsync_mode, WindowID p_window) {}

DisplayServer::VSyncMode DisplayServer::window_get_vsync_mode(WindowID p_window) const {}

DisplayServer::WindowID DisplayServer::get_focused_window() const {}

void DisplayServer::set_context(Context p_context) {}

void DisplayServer::register_additional_output(Object *p_object) {}

void DisplayServer::unregister_additional_output(Object *p_object) {}

void DisplayServer::_bind_methods() {}

Ref<Image> DisplayServer::_get_cursor_image_from_resource(const Ref<Resource> &p_cursor, const Vector2 &p_hotspot) {}

void DisplayServer::register_create_function(const char *p_name, CreateFunction p_function, GetRenderingDriversFunction p_get_drivers) {}

int DisplayServer::get_create_function_count() {}

const char *DisplayServer::get_create_function_name(int p_index) {}

Vector<String> DisplayServer::get_create_function_rendering_drivers(int p_index) {}

DisplayServer *DisplayServer::create(int p_index, const String &p_rendering_driver, WindowMode p_mode, VSyncMode p_vsync_mode, uint32_t p_flags, const Vector2i *p_position, const Vector2i &p_resolution, int p_screen, Context p_context, Error &r_error) {}

void DisplayServer::_input_set_mouse_mode(Input::MouseMode p_mode) {}

Input::MouseMode DisplayServer::_input_get_mouse_mode() {}

void DisplayServer::_input_warp(const Vector2 &p_to_pos) {}

Input::CursorShape DisplayServer::_input_get_current_cursor_shape() {}

void DisplayServer::_input_set_custom_mouse_cursor_func(const Ref<Resource> &p_image, Input::CursorShape p_shape, const Vector2 &p_hostspot) {}

bool DisplayServer::can_create_rendering_device() {}

DisplayServer::DisplayServer() {}

DisplayServer::~DisplayServer() {}