2020-03-01 22:14:37 +00:00
/*************************************************************************/
/* display_server.cpp */
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
/* https://godotengine.org */
/*************************************************************************/
2022-01-03 20:27:34 +00:00
/* Copyright (c) 2007-2022 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2014-2022 Godot Engine contributors (cf. AUTHORS.md). */
2020-03-01 22:14:37 +00:00
/* */
/* 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"
2020-04-01 13:35:00 +00:00
2020-04-28 13:19:37 +00:00
# include "core/input/input.h"
2020-03-07 16:02:54 +00:00
# include "scene/resources/texture.h"
2021-06-01 14:40:08 +00:00
# include "servers/display_server_headless.h"
2020-03-01 22:14:37 +00:00
DisplayServer * DisplayServer : : singleton = nullptr ;
2020-03-03 13:36:29 +00:00
2020-03-09 15:56:48 +00:00
bool DisplayServer : : hidpi_allowed = false ;
2021-06-01 14:40:08 +00:00
DisplayServer : : DisplayServerCreate DisplayServer : : server_create_functions [ DisplayServer : : MAX_SERVERS ] = {
{ " headless " , & DisplayServerHeadless : : create_func , & DisplayServerHeadless : : get_rendering_drivers_func }
} ;
int DisplayServer : : server_create_count = 1 ;
2020-03-01 22:14:37 +00:00
2022-08-31 08:11:52 +00:00
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 ) {
2020-03-01 22:14:37 +00:00
WARN_PRINT ( " Global menus not supported by this display server. " ) ;
2022-08-01 09:28:16 +00:00
return - 1 ;
2020-03-01 22:14:37 +00:00
}
2020-03-07 16:02:54 +00:00
2022-08-31 08:11:52 +00:00
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 ) {
2020-03-07 16:02:54 +00:00
WARN_PRINT ( " Global menus not supported by this display server. " ) ;
2022-08-01 09:28:16 +00:00
return - 1 ;
2020-03-07 16:02:54 +00:00
}
2022-08-31 08:11:52 +00:00
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 ) {
2020-03-07 16:02:54 +00:00
WARN_PRINT ( " Global menus not supported by this display server. " ) ;
2022-08-01 09:28:16 +00:00
return - 1 ;
2020-03-07 16:02:54 +00:00
}
2022-08-31 08:11:52 +00:00
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 ) {
2020-03-07 16:02:54 +00:00
WARN_PRINT ( " Global menus not supported by this display server. " ) ;
2022-08-01 09:28:16 +00:00
return - 1 ;
2020-03-07 16:02:54 +00:00
}
2022-08-31 08:11:52 +00:00
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 ) {
2022-03-22 09:26:36 +00:00
WARN_PRINT ( " Global menus not supported by this display server. " ) ;
2022-08-01 09:28:16 +00:00
return - 1 ;
2022-03-22 09:26:36 +00:00
}
2022-08-31 08:11:52 +00:00
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 ) {
2022-03-22 09:26:36 +00:00
WARN_PRINT ( " Global menus not supported by this display server. " ) ;
2022-08-01 09:28:16 +00:00
return - 1 ;
2022-03-22 09:26:36 +00:00
}
2022-08-31 08:11:52 +00:00
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 ) {
2022-03-22 09:26:36 +00:00
WARN_PRINT ( " Global menus not supported by this display server. " ) ;
2022-08-01 09:28:16 +00:00
return - 1 ;
2022-03-22 09:26:36 +00:00
}
2022-08-01 09:28:16 +00:00
int DisplayServer : : global_menu_add_submenu_item ( const String & p_menu_root , const String & p_label , const String & p_submenu , int p_index ) {
2022-03-22 09:26:36 +00:00
WARN_PRINT ( " Global menus not supported by this display server. " ) ;
2022-08-01 09:28:16 +00:00
return - 1 ;
2022-03-22 09:26:36 +00:00
}
2022-08-01 09:28:16 +00:00
int DisplayServer : : global_menu_add_separator ( const String & p_menu_root , int p_index ) {
2022-03-22 09:26:36 +00:00
WARN_PRINT ( " Global menus not supported by this display server. " ) ;
2022-08-01 09:28:16 +00:00
return - 1 ;
2022-03-22 09:26:36 +00:00
}
int DisplayServer : : global_menu_get_item_index_from_text ( const String & p_menu_root , const String & p_text ) const {
WARN_PRINT ( " Global menus not supported by this display server. " ) ;
return - 1 ;
}
int DisplayServer : : global_menu_get_item_index_from_tag ( const String & p_menu_root , const Variant & p_tag ) const {
WARN_PRINT ( " Global menus not supported by this display server. " ) ;
return - 1 ;
}
2020-03-07 16:02:54 +00:00
void DisplayServer : : global_menu_set_item_callback ( const String & p_menu_root , int p_idx , const Callable & p_callback ) {
WARN_PRINT ( " Global menus not supported by this display server. " ) ;
}
2022-08-31 08:11:52 +00:00
void DisplayServer : : global_menu_set_item_key_callback ( const String & p_menu_root , int p_idx , const Callable & p_key_callback ) {
WARN_PRINT ( " Global menus not supported by this display server. " ) ;
}
2020-03-07 16:02:54 +00:00
bool DisplayServer : : global_menu_is_item_checked ( const String & p_menu_root , int p_idx ) const {
WARN_PRINT ( " Global menus not supported by this display server. " ) ;
return false ;
}
bool DisplayServer : : global_menu_is_item_checkable ( const String & p_menu_root , int p_idx ) const {
WARN_PRINT ( " Global menus not supported by this display server. " ) ;
return false ;
}
2022-03-22 09:26:36 +00:00
bool DisplayServer : : global_menu_is_item_radio_checkable ( const String & p_menu_root , int p_idx ) const {
WARN_PRINT ( " Global menus not supported by this display server. " ) ;
return false ;
}
Callable DisplayServer : : global_menu_get_item_callback ( const String & p_menu_root , int p_idx ) const {
2020-03-07 16:02:54 +00:00
WARN_PRINT ( " Global menus not supported by this display server. " ) ;
return Callable ( ) ;
}
2022-08-31 08:11:52 +00:00
Callable DisplayServer : : global_menu_get_item_key_callback ( const String & p_menu_root , int p_idx ) const {
WARN_PRINT ( " Global menus not supported by this display server. " ) ;
return Callable ( ) ;
}
2022-03-22 09:26:36 +00:00
Variant DisplayServer : : global_menu_get_item_tag ( const String & p_menu_root , int p_idx ) const {
2020-03-07 16:02:54 +00:00
WARN_PRINT ( " Global menus not supported by this display server. " ) ;
return Variant ( ) ;
}
2022-03-22 09:26:36 +00:00
String DisplayServer : : global_menu_get_item_text ( const String & p_menu_root , int p_idx ) const {
2020-03-07 16:02:54 +00:00
WARN_PRINT ( " Global menus not supported by this display server. " ) ;
return String ( ) ;
}
2022-03-22 09:26:36 +00:00
String DisplayServer : : global_menu_get_item_submenu ( const String & p_menu_root , int p_idx ) const {
2020-03-07 16:02:54 +00:00
WARN_PRINT ( " Global menus not supported by this display server. " ) ;
return String ( ) ;
}
2022-03-22 09:26:36 +00:00
Key DisplayServer : : global_menu_get_item_accelerator ( const String & p_menu_root , int p_idx ) const {
WARN_PRINT ( " Global menus not supported by this display server. " ) ;
return Key : : NONE ;
}
bool DisplayServer : : global_menu_is_item_disabled ( const String & p_menu_root , int p_idx ) const {
WARN_PRINT ( " Global menus not supported by this display server. " ) ;
return false ;
}
String DisplayServer : : global_menu_get_item_tooltip ( const String & p_menu_root , int p_idx ) const {
WARN_PRINT ( " Global menus not supported by this display server. " ) ;
return String ( ) ;
}
int DisplayServer : : global_menu_get_item_state ( const String & p_menu_root , int p_idx ) const {
WARN_PRINT ( " Global menus not supported by this display server. " ) ;
return - 1 ;
}
int DisplayServer : : global_menu_get_item_max_states ( const String & p_menu_root , int p_idx ) const {
WARN_PRINT ( " Global menus not supported by this display server. " ) ;
return - 1 ;
}
Ref < Texture2D > DisplayServer : : global_menu_get_item_icon ( const String & p_menu_root , int p_idx ) const {
WARN_PRINT ( " Global menus not supported by this display server. " ) ;
return Ref < Texture2D > ( ) ;
}
2022-08-01 09:28:16 +00:00
int DisplayServer : : global_menu_get_item_indentation_level ( const String & p_menu_root , int p_idx ) const {
WARN_PRINT ( " Global menus not supported by this display server. " ) ;
return 0 ;
}
2020-03-07 16:02:54 +00:00
void DisplayServer : : global_menu_set_item_checked ( const String & p_menu_root , int p_idx , bool p_checked ) {
WARN_PRINT ( " Global menus not supported by this display server. " ) ;
}
void DisplayServer : : global_menu_set_item_checkable ( const String & p_menu_root , int p_idx , bool p_checkable ) {
WARN_PRINT ( " Global menus not supported by this display server. " ) ;
}
2022-03-22 09:26:36 +00:00
void DisplayServer : : global_menu_set_item_radio_checkable ( const String & p_menu_root , int p_idx , bool p_checkable ) {
WARN_PRINT ( " Global menus not supported by this display server. " ) ;
}
2020-03-07 16:02:54 +00:00
void DisplayServer : : global_menu_set_item_tag ( const String & p_menu_root , int p_idx , const Variant & p_tag ) {
WARN_PRINT ( " Global menus not supported by this display server. " ) ;
}
void DisplayServer : : global_menu_set_item_text ( const String & p_menu_root , int p_idx , const String & p_text ) {
2020-03-01 22:14:37 +00:00
WARN_PRINT ( " Global menus not supported by this display server. " ) ;
}
2020-03-07 16:02:54 +00:00
void DisplayServer : : global_menu_set_item_submenu ( const String & p_menu_root , int p_idx , const String & p_submenu ) {
WARN_PRINT ( " Global menus not supported by this display server. " ) ;
}
2022-03-22 09:26:36 +00:00
void DisplayServer : : global_menu_set_item_accelerator ( const String & p_menu_root , int p_idx , Key p_keycode ) {
WARN_PRINT ( " Global menus not supported by this display server. " ) ;
}
void DisplayServer : : global_menu_set_item_disabled ( const String & p_menu_root , int p_idx , bool p_disabled ) {
WARN_PRINT ( " Global menus not supported by this display server. " ) ;
}
void DisplayServer : : global_menu_set_item_tooltip ( const String & p_menu_root , int p_idx , const String & p_tooltip ) {
WARN_PRINT ( " Global menus not supported by this display server. " ) ;
}
void DisplayServer : : global_menu_set_item_state ( const String & p_menu_root , int p_idx , int p_state ) {
WARN_PRINT ( " Global menus not supported by this display server. " ) ;
}
void DisplayServer : : global_menu_set_item_max_states ( const String & p_menu_root , int p_idx , int p_max_states ) {
WARN_PRINT ( " Global menus not supported by this display server. " ) ;
}
void DisplayServer : : global_menu_set_item_icon ( const String & p_menu_root , int p_idx , const Ref < Texture2D > & p_icon ) {
WARN_PRINT ( " Global menus not supported by this display server. " ) ;
}
2022-08-01 09:28:16 +00:00
void DisplayServer : : global_menu_set_item_indentation_level ( const String & p_menu_root , int p_idx , int p_level ) {
WARN_PRINT ( " Global menus not supported by this display server. " ) ;
}
2020-03-07 16:02:54 +00:00
int DisplayServer : : global_menu_get_item_count ( const String & p_menu_root ) const {
WARN_PRINT ( " Global menus not supported by this display server. " ) ;
return 0 ;
}
void DisplayServer : : global_menu_remove_item ( const String & p_menu_root , int p_idx ) {
2020-03-01 22:14:37 +00:00
WARN_PRINT ( " Global menus not supported by this display server. " ) ;
}
2020-03-07 16:02:54 +00:00
void DisplayServer : : global_menu_clear ( const String & p_menu_root ) {
2020-03-01 22:14:37 +00:00
WARN_PRINT ( " Global menus not supported by this display server. " ) ;
}
2021-11-04 12:33:37 +00:00
bool DisplayServer : : tts_is_speaking ( ) const {
WARN_PRINT ( " TTS is not supported by this display server. " ) ;
return false ;
}
bool DisplayServer : : tts_is_paused ( ) const {
WARN_PRINT ( " TTS is not supported by this display server. " ) ;
return false ;
}
void DisplayServer : : tts_pause ( ) {
WARN_PRINT ( " TTS is not supported by this display server. " ) ;
}
void DisplayServer : : tts_resume ( ) {
WARN_PRINT ( " TTS is not supported by this display server. " ) ;
}
2022-08-05 01:41:48 +00:00
TypedArray < Dictionary > DisplayServer : : tts_get_voices ( ) const {
2021-11-04 12:33:37 +00:00
WARN_PRINT ( " TTS is not supported by this display server. " ) ;
2022-08-05 01:41:48 +00:00
return TypedArray < Dictionary > ( ) ;
2021-11-04 12:33:37 +00:00
}
PackedStringArray DisplayServer : : tts_get_voices_for_language ( const String & p_language ) const {
PackedStringArray ret ;
2022-08-05 01:41:48 +00:00
TypedArray < Dictionary > voices = tts_get_voices ( ) ;
2021-11-04 12:33:37 +00:00
for ( int i = 0 ; i < voices . size ( ) ; i + + ) {
const Dictionary & voice = voices [ i ] ;
if ( voice . has ( " id " ) & & voice . has ( " language " ) & & voice [ " language " ] . operator String ( ) . begins_with ( p_language ) ) {
ret . push_back ( voice [ " id " ] ) ;
}
}
return ret ;
}
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 ) {
WARN_PRINT ( " TTS is not supported by this display server. " ) ;
}
void DisplayServer : : tts_stop ( ) {
WARN_PRINT ( " TTS is not supported by this display server. " ) ;
}
void DisplayServer : : tts_set_utterance_callback ( TTSUtteranceEvent p_event , const Callable & p_callable ) {
ERR_FAIL_INDEX ( p_event , DisplayServer : : TTS_UTTERANCE_MAX ) ;
utterance_callback [ p_event ] = p_callable ;
}
void DisplayServer : : tts_post_utterance_event ( TTSUtteranceEvent p_event , int p_id , int p_pos ) {
ERR_FAIL_INDEX ( p_event , DisplayServer : : TTS_UTTERANCE_MAX ) ;
switch ( p_event ) {
case DisplayServer : : TTS_UTTERANCE_STARTED :
case DisplayServer : : TTS_UTTERANCE_ENDED :
case DisplayServer : : TTS_UTTERANCE_CANCELED : {
if ( utterance_callback [ p_event ] . is_valid ( ) ) {
Variant args [ 1 ] ;
args [ 0 ] = p_id ;
const Variant * argp [ ] = { & args [ 0 ] } ;
2022-07-28 20:56:41 +00:00
utterance_callback [ p_event ] . call_deferredp ( argp , 1 ) ; // Should be deferred, on some platforms utterance events can be called from different threads in a rapid succession.
2021-11-04 12:33:37 +00:00
}
} break ;
case DisplayServer : : TTS_UTTERANCE_BOUNDARY : {
if ( utterance_callback [ p_event ] . is_valid ( ) ) {
Variant args [ 2 ] ;
args [ 0 ] = p_pos ;
args [ 1 ] = p_id ;
const Variant * argp [ ] = { & args [ 0 ] , & args [ 1 ] } ;
2022-07-28 20:56:41 +00:00
utterance_callback [ p_event ] . call_deferredp ( argp , 2 ) ; // Should be deferred, on some platforms utterance events can be called from different threads in a rapid succession.
2021-11-04 12:33:37 +00:00
}
} break ;
default :
break ;
}
}
2020-03-01 22:14:37 +00:00
void DisplayServer : : mouse_set_mode ( MouseMode p_mode ) {
WARN_PRINT ( " Mouse is not supported by this display server. " ) ;
}
2020-05-14 12:29:06 +00:00
2020-03-01 22:14:37 +00:00
DisplayServer : : MouseMode DisplayServer : : mouse_get_mode ( ) const {
return MOUSE_MODE_VISIBLE ;
}
2022-03-27 09:17:36 +00:00
void DisplayServer : : warp_mouse ( const Point2i & p_position ) {
2020-03-01 22:14:37 +00:00
WARN_PRINT ( " Mouse warping is not supported by this display server. " ) ;
}
2020-05-14 12:29:06 +00:00
2020-03-01 22:14:37 +00:00
Point2i DisplayServer : : mouse_get_position ( ) const {
ERR_FAIL_V_MSG ( Point2i ( ) , " Mouse is not supported by this display server. " ) ;
}
2020-05-14 12:29:06 +00:00
2021-03-25 20:56:12 +00:00
MouseButton DisplayServer : : mouse_get_button_state ( ) const {
2021-08-13 21:31:57 +00:00
ERR_FAIL_V_MSG ( MouseButton : : NONE , " Mouse is not supported by this display server. " ) ;
2020-03-01 22:14:37 +00:00
}
void DisplayServer : : clipboard_set ( const String & p_text ) {
WARN_PRINT ( " Clipboard is not supported by this display server. " ) ;
}
2020-05-14 12:29:06 +00:00
2020-03-01 22:14:37 +00:00
String DisplayServer : : clipboard_get ( ) const {
ERR_FAIL_V_MSG ( String ( ) , " Clipboard is not supported by this display server. " ) ;
}
2022-01-19 13:04:52 +00:00
bool DisplayServer : : clipboard_has ( ) const {
return ! clipboard_get ( ) . is_empty ( ) ;
}
2021-10-12 07:43:50 +00:00
void DisplayServer : : clipboard_set_primary ( const String & p_text ) {
WARN_PRINT ( " Primary clipboard is not supported by this display server. " ) ;
}
String DisplayServer : : clipboard_get_primary ( ) const {
ERR_FAIL_V_MSG ( String ( ) , " Primary clipboard is not supported by this display server. " ) ;
}
2020-03-01 22:14:37 +00:00
void DisplayServer : : screen_set_orientation ( ScreenOrientation p_orientation , int p_screen ) {
WARN_PRINT ( " Orientation not supported by this display server. " ) ;
}
2020-05-14 12:29:06 +00:00
2020-03-01 22:14:37 +00:00
DisplayServer : : ScreenOrientation DisplayServer : : screen_get_orientation ( int p_screen ) const {
return SCREEN_LANDSCAPE ;
}
2020-03-07 16:02:54 +00:00
float DisplayServer : : screen_get_scale ( int p_screen ) const {
return 1.0f ;
} ;
2020-03-03 13:36:29 +00:00
bool DisplayServer : : screen_is_touchscreen ( int p_screen ) const {
//return false;
2020-04-28 13:19:37 +00:00
return Input : : get_singleton ( ) & & Input : : get_singleton ( ) - > is_emulating_touch_from_mouse ( ) ;
2020-03-03 13:36:29 +00:00
}
void DisplayServer : : screen_set_keep_on ( bool p_enable ) {
WARN_PRINT ( " Keeping screen on not supported by this display server. " ) ;
}
2020-05-14 12:29:06 +00:00
2020-03-03 13:36:29 +00:00
bool DisplayServer : : screen_is_kept_on ( ) const {
return false ;
}
2021-06-19 15:44:59 +00:00
DisplayServer : : WindowID DisplayServer : : create_sub_window ( WindowMode p_mode , VSyncMode p_vsync_mode , uint32_t p_flags , const Rect2i & p_rect ) {
2020-03-01 22:14:37 +00:00
ERR_FAIL_V_MSG ( INVALID_WINDOW_ID , " Sub-windows not supported by this display server. " ) ;
}
2020-05-14 12:29:06 +00:00
2020-08-21 07:39:30 +00:00
void DisplayServer : : show_window ( WindowID p_id ) {
ERR_FAIL_MSG ( " Sub-windows not supported by this display server. " ) ;
}
2020-03-01 22:14:37 +00:00
void DisplayServer : : delete_sub_window ( WindowID p_id ) {
ERR_FAIL_MSG ( " Sub-windows not supported by this display server. " ) ;
}
2022-01-19 12:04:05 +00:00
void DisplayServer : : window_set_exclusive ( WindowID p_window , bool p_exclusive ) {
// Do nothing, if not supported.
}
2020-06-29 09:31:36 +00:00
void DisplayServer : : window_set_mouse_passthrough ( const Vector < Vector2 > & p_region , WindowID p_window ) {
ERR_FAIL_MSG ( " Mouse passthrough not supported by this display server. " ) ;
}
2020-11-18 18:11:30 +00:00
void DisplayServer : : gl_window_make_current ( DisplayServer : : WindowID p_window_id ) {
// noop except in gles
}
2020-03-01 22:14:37 +00:00
void DisplayServer : : window_set_ime_active ( const bool p_active , WindowID p_window ) {
WARN_PRINT ( " IME not supported by this display server. " ) ;
}
2020-05-14 12:29:06 +00:00
2020-03-01 22:14:37 +00:00
void DisplayServer : : window_set_ime_position ( const Point2i & p_pos , WindowID p_window ) {
WARN_PRINT ( " IME not supported by this display server. " ) ;
}
Point2i DisplayServer : : ime_get_selection ( ) const {
ERR_FAIL_V_MSG ( Point2i ( ) , " IME or NOTIFICATION_WM_IME_UPDATE not supported by this display server. " ) ;
}
2020-05-14 12:29:06 +00:00
2020-03-01 22:14:37 +00:00
String DisplayServer : : ime_get_text ( ) const {
ERR_FAIL_V_MSG ( String ( ) , " IME or NOTIFICATION_WM_IME_UPDATEnot supported by this display server. " ) ;
}
2022-07-07 18:20:10 +00:00
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 ) {
2020-03-01 22:14:37 +00:00
WARN_PRINT ( " Virtual keyboard not supported by this display server. " ) ;
}
2020-05-14 12:29:06 +00:00
2020-03-01 22:14:37 +00:00
void DisplayServer : : virtual_keyboard_hide ( ) {
WARN_PRINT ( " Virtual keyboard not supported by this display server. " ) ;
}
// returns height of the currently shown keyboard (0 if keyboard is hidden)
int DisplayServer : : virtual_keyboard_get_height ( ) const {
2020-07-16 16:54:15 +00:00
ERR_FAIL_V_MSG ( 0 , " Virtual keyboard not supported by this display server. " ) ;
2020-03-01 22:14:37 +00:00
}
void DisplayServer : : cursor_set_shape ( CursorShape p_shape ) {
WARN_PRINT ( " Cursor shape not supported by this display server. " ) ;
}
2020-05-14 12:29:06 +00:00
2020-03-01 22:14:37 +00:00
DisplayServer : : CursorShape DisplayServer : : cursor_get_shape ( ) const {
return CURSOR_ARROW ;
}
2020-05-14 12:29:06 +00:00
2022-05-02 23:43:50 +00:00
void DisplayServer : : cursor_set_custom_image ( const Ref < Resource > & p_cursor , CursorShape p_shape , const Vector2 & p_hotspot ) {
2020-03-01 22:14:37 +00:00
WARN_PRINT ( " Custom cursor shape not supported by this display server. " ) ;
}
2020-07-08 23:02:38 +00:00
bool DisplayServer : : get_swap_cancel_ok ( ) {
2020-03-01 22:14:37 +00:00
return false ;
}
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 ) {
WARN_PRINT ( " Native dialogs not supported by this display server. " ) ;
return OK ;
}
2020-05-14 12:29:06 +00:00
2020-03-01 22:14:37 +00:00
Error DisplayServer : : dialog_input_text ( String p_title , String p_description , String p_partial , const Callable & p_callback ) {
WARN_PRINT ( " Native dialogs not supported by this display server. " ) ;
return OK ;
}
2020-06-11 09:27:07 +00:00
int DisplayServer : : keyboard_get_layout_count ( ) const {
return 0 ;
}
int DisplayServer : : keyboard_get_current_layout ( ) const {
return - 1 ;
}
void DisplayServer : : keyboard_set_current_layout ( int p_index ) {
}
String DisplayServer : : keyboard_get_layout_language ( int p_index ) const {
return " " ;
}
String DisplayServer : : keyboard_get_layout_name ( int p_index ) const {
return " Not supported " ;
2020-03-01 22:14:37 +00:00
}
2021-09-17 01:07:59 +00:00
Key DisplayServer : : keyboard_get_keycode_from_physical ( Key p_keycode ) const {
ERR_FAIL_V_MSG ( p_keycode , " Not supported by this display server. " ) ;
}
2020-03-01 22:14:37 +00:00
void DisplayServer : : force_process_and_drop_events ( ) {
}
void DisplayServer : : release_rendering_thread ( ) {
WARN_PRINT ( " Rendering thread not supported by this display server. " ) ;
}
2020-05-14 12:29:06 +00:00
2020-03-01 22:14:37 +00:00
void DisplayServer : : make_rendering_thread ( ) {
WARN_PRINT ( " Rendering thread not supported by this display server. " ) ;
}
2020-05-14 12:29:06 +00:00
2020-03-01 22:14:37 +00:00
void DisplayServer : : swap_buffers ( ) {
WARN_PRINT ( " Swap buffers not supported by this display server. " ) ;
}
void DisplayServer : : set_native_icon ( const String & p_filename ) {
WARN_PRINT ( " Native icon not supported by this display server. " ) ;
}
2020-05-14 12:29:06 +00:00
2020-03-01 22:14:37 +00:00
void DisplayServer : : set_icon ( const Ref < Image > & p_icon ) {
2020-03-03 13:36:29 +00:00
WARN_PRINT ( " Icon not supported by this display server. " ) ;
}
2022-01-14 10:41:04 +00:00
int64_t DisplayServer : : window_get_native_handle ( HandleType p_handle_type , WindowID p_window ) const {
WARN_PRINT ( " Native handle not supported by this display server. " ) ;
return 0 ;
}
2021-06-19 15:44:59 +00:00
void DisplayServer : : window_set_vsync_mode ( DisplayServer : : VSyncMode p_vsync_mode , WindowID p_window ) {
2022-03-05 21:54:48 +00:00
WARN_PRINT ( " Changing the V-Sync mode is not supported by this display server. " ) ;
2020-03-03 13:36:29 +00:00
}
2020-05-14 12:29:06 +00:00
2021-06-19 15:44:59 +00:00
DisplayServer : : VSyncMode DisplayServer : : window_get_vsync_mode ( WindowID p_window ) const {
2022-03-05 21:54:48 +00:00
WARN_PRINT ( " Changing the V-Sync mode is not supported by this display server. " ) ;
2021-06-19 15:44:59 +00:00
return VSyncMode : : VSYNC_ENABLED ;
2020-03-03 13:36:29 +00:00
}
void DisplayServer : : set_context ( Context p_context ) {
2020-03-01 22:14:37 +00:00
}
void DisplayServer : : _bind_methods ( ) {
ClassDB : : bind_method ( D_METHOD ( " has_feature " , " feature " ) , & DisplayServer : : has_feature ) ;
ClassDB : : bind_method ( D_METHOD ( " get_name " ) , & DisplayServer : : get_name ) ;
2022-03-22 09:26:36 +00:00
ClassDB : : bind_method ( D_METHOD ( " global_menu_add_submenu_item " , " menu_root " , " label " , " submenu " , " index " ) , & DisplayServer : : global_menu_add_submenu_item , DEFVAL ( - 1 ) ) ;
2022-08-31 08:11:52 +00:00
ClassDB : : bind_method ( D_METHOD ( " global_menu_add_item " , " menu_root " , " label " , " callback " , " key_callback " , " tag " , " accelerator " , " index " ) , & DisplayServer : : global_menu_add_item , DEFVAL ( Callable ( ) ) , DEFVAL ( Callable ( ) ) , DEFVAL ( Variant ( ) ) , DEFVAL ( Key : : NONE ) , DEFVAL ( - 1 ) ) ;
ClassDB : : bind_method ( D_METHOD ( " global_menu_add_check_item " , " menu_root " , " label " , " callback " , " key_callback " , " tag " , " accelerator " , " index " ) , & DisplayServer : : global_menu_add_check_item , DEFVAL ( Callable ( ) ) , DEFVAL ( Callable ( ) ) , DEFVAL ( Variant ( ) ) , DEFVAL ( Key : : NONE ) , DEFVAL ( - 1 ) ) ;
ClassDB : : bind_method ( D_METHOD ( " global_menu_add_icon_item " , " menu_root " , " icon " , " label " , " callback " , " key_callback " , " tag " , " accelerator " , " index " ) , & DisplayServer : : global_menu_add_icon_item , DEFVAL ( Callable ( ) ) , DEFVAL ( Callable ( ) ) , DEFVAL ( Variant ( ) ) , DEFVAL ( Key : : NONE ) , DEFVAL ( - 1 ) ) ;
ClassDB : : bind_method ( D_METHOD ( " global_menu_add_icon_check_item " , " menu_root " , " icon " , " label " , " callback " , " key_callback " , " tag " , " accelerator " , " index " ) , & DisplayServer : : global_menu_add_icon_check_item , DEFVAL ( Callable ( ) ) , DEFVAL ( Callable ( ) ) , DEFVAL ( Variant ( ) ) , DEFVAL ( Key : : NONE ) , DEFVAL ( - 1 ) ) ;
ClassDB : : bind_method ( D_METHOD ( " global_menu_add_radio_check_item " , " menu_root " , " label " , " callback " , " key_callback " , " tag " , " accelerator " , " index " ) , & DisplayServer : : global_menu_add_radio_check_item , DEFVAL ( Callable ( ) ) , DEFVAL ( Callable ( ) ) , DEFVAL ( Variant ( ) ) , DEFVAL ( Key : : NONE ) , DEFVAL ( - 1 ) ) ;
ClassDB : : bind_method ( D_METHOD ( " global_menu_add_icon_radio_check_item " , " menu_root " , " icon " , " label " , " callback " , " key_callback " , " tag " , " accelerator " , " index " ) , & DisplayServer : : global_menu_add_icon_radio_check_item , DEFVAL ( Callable ( ) ) , DEFVAL ( Callable ( ) ) , DEFVAL ( Variant ( ) ) , DEFVAL ( Key : : NONE ) , DEFVAL ( - 1 ) ) ;
ClassDB : : bind_method ( D_METHOD ( " global_menu_add_multistate_item " , " menu_root " , " labe " , " 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 ) ) ;
2022-03-22 09:26:36 +00:00
ClassDB : : bind_method ( D_METHOD ( " global_menu_add_separator " , " menu_root " , " index " ) , & DisplayServer : : global_menu_add_separator , DEFVAL ( - 1 ) ) ;
ClassDB : : bind_method ( D_METHOD ( " global_menu_get_item_index_from_text " , " menu_root " , " text " ) , & DisplayServer : : global_menu_get_item_index_from_text ) ;
ClassDB : : bind_method ( D_METHOD ( " global_menu_get_item_index_from_tag " , " menu_root " , " tag " ) , & DisplayServer : : global_menu_get_item_index_from_tag ) ;
2020-03-07 16:02:54 +00:00
ClassDB : : bind_method ( D_METHOD ( " global_menu_is_item_checked " , " menu_root " , " idx " ) , & DisplayServer : : global_menu_is_item_checked ) ;
ClassDB : : bind_method ( D_METHOD ( " global_menu_is_item_checkable " , " menu_root " , " idx " ) , & DisplayServer : : global_menu_is_item_checkable ) ;
2022-03-22 09:26:36 +00:00
ClassDB : : bind_method ( D_METHOD ( " global_menu_is_item_radio_checkable " , " menu_root " , " idx " ) , & DisplayServer : : global_menu_is_item_radio_checkable ) ;
2020-03-07 16:02:54 +00:00
ClassDB : : bind_method ( D_METHOD ( " global_menu_get_item_callback " , " menu_root " , " idx " ) , & DisplayServer : : global_menu_get_item_callback ) ;
2022-08-31 08:11:52 +00:00
ClassDB : : bind_method ( D_METHOD ( " global_menu_get_item_key_callback " , " menu_root " , " idx " ) , & DisplayServer : : global_menu_get_item_key_callback ) ;
2020-03-07 16:02:54 +00:00
ClassDB : : bind_method ( D_METHOD ( " global_menu_get_item_tag " , " menu_root " , " idx " ) , & DisplayServer : : global_menu_get_item_tag ) ;
ClassDB : : bind_method ( D_METHOD ( " global_menu_get_item_text " , " menu_root " , " idx " ) , & DisplayServer : : global_menu_get_item_text ) ;
ClassDB : : bind_method ( D_METHOD ( " global_menu_get_item_submenu " , " menu_root " , " idx " ) , & DisplayServer : : global_menu_get_item_submenu ) ;
2022-03-22 09:26:36 +00:00
ClassDB : : bind_method ( D_METHOD ( " global_menu_get_item_accelerator " , " menu_root " , " idx " ) , & DisplayServer : : global_menu_get_item_accelerator ) ;
ClassDB : : bind_method ( D_METHOD ( " global_menu_is_item_disabled " , " menu_root " , " idx " ) , & DisplayServer : : global_menu_is_item_disabled ) ;
ClassDB : : bind_method ( D_METHOD ( " global_menu_get_item_tooltip " , " menu_root " , " idx " ) , & DisplayServer : : global_menu_get_item_tooltip ) ;
ClassDB : : bind_method ( D_METHOD ( " global_menu_get_item_state " , " menu_root " , " idx " ) , & DisplayServer : : global_menu_get_item_state ) ;
ClassDB : : bind_method ( D_METHOD ( " global_menu_get_item_max_states " , " menu_root " , " idx " ) , & DisplayServer : : global_menu_get_item_max_states ) ;
ClassDB : : bind_method ( D_METHOD ( " global_menu_get_item_icon " , " menu_root " , " idx " ) , & DisplayServer : : global_menu_get_item_icon ) ;
2022-08-01 09:28:16 +00:00
ClassDB : : bind_method ( D_METHOD ( " global_menu_get_item_indentation_level " , " menu_root " , " idx " ) , & DisplayServer : : global_menu_get_item_indentation_level ) ;
2020-03-07 16:02:54 +00:00
ClassDB : : bind_method ( D_METHOD ( " global_menu_set_item_checked " , " menu_root " , " idx " , " checked " ) , & DisplayServer : : global_menu_set_item_checked ) ;
ClassDB : : bind_method ( D_METHOD ( " global_menu_set_item_checkable " , " menu_root " , " idx " , " checkable " ) , & DisplayServer : : global_menu_set_item_checkable ) ;
2022-03-22 09:26:36 +00:00
ClassDB : : bind_method ( D_METHOD ( " global_menu_set_item_radio_checkable " , " menu_root " , " idx " , " checkable " ) , & DisplayServer : : global_menu_set_item_radio_checkable ) ;
2020-03-07 16:02:54 +00:00
ClassDB : : bind_method ( D_METHOD ( " global_menu_set_item_callback " , " menu_root " , " idx " , " callback " ) , & DisplayServer : : global_menu_set_item_callback ) ;
2022-08-31 08:11:52 +00:00
ClassDB : : bind_method ( D_METHOD ( " global_menu_set_item_key_callback " , " menu_root " , " idx " , " key_callback " ) , & DisplayServer : : global_menu_set_item_key_callback ) ;
2020-03-07 16:02:54 +00:00
ClassDB : : bind_method ( D_METHOD ( " global_menu_set_item_tag " , " menu_root " , " idx " , " tag " ) , & DisplayServer : : global_menu_set_item_tag ) ;
ClassDB : : bind_method ( D_METHOD ( " global_menu_set_item_text " , " menu_root " , " idx " , " text " ) , & DisplayServer : : global_menu_set_item_text ) ;
ClassDB : : bind_method ( D_METHOD ( " global_menu_set_item_submenu " , " menu_root " , " idx " , " submenu " ) , & DisplayServer : : global_menu_set_item_submenu ) ;
2022-03-22 09:26:36 +00:00
ClassDB : : bind_method ( D_METHOD ( " global_menu_set_item_accelerator " , " menu_root " , " idx " , " keycode " ) , & DisplayServer : : global_menu_set_item_accelerator ) ;
ClassDB : : bind_method ( D_METHOD ( " global_menu_set_item_disabled " , " menu_root " , " idx " , " disabled " ) , & DisplayServer : : global_menu_set_item_disabled ) ;
ClassDB : : bind_method ( D_METHOD ( " global_menu_set_item_tooltip " , " menu_root " , " idx " , " tooltip " ) , & DisplayServer : : global_menu_set_item_tooltip ) ;
ClassDB : : bind_method ( D_METHOD ( " global_menu_set_item_state " , " menu_root " , " idx " , " state " ) , & DisplayServer : : global_menu_set_item_state ) ;
ClassDB : : bind_method ( D_METHOD ( " global_menu_set_item_max_states " , " menu_root " , " idx " , " max_states " ) , & DisplayServer : : global_menu_set_item_max_states ) ;
ClassDB : : bind_method ( D_METHOD ( " global_menu_set_item_icon " , " menu_root " , " idx " , " icon " ) , & DisplayServer : : global_menu_set_item_icon ) ;
2022-08-01 09:28:16 +00:00
ClassDB : : bind_method ( D_METHOD ( " global_menu_set_item_indentation_level " , " menu_root " , " idx " , " level " ) , & DisplayServer : : global_menu_set_item_indentation_level ) ;
2020-03-07 16:02:54 +00:00
ClassDB : : bind_method ( D_METHOD ( " global_menu_remove_item " , " menu_root " , " idx " ) , & DisplayServer : : global_menu_remove_item ) ;
ClassDB : : bind_method ( D_METHOD ( " global_menu_clear " , " menu_root " ) , & DisplayServer : : global_menu_clear ) ;
2020-03-01 22:14:37 +00:00
2021-11-04 12:33:37 +00:00
ClassDB : : bind_method ( D_METHOD ( " tts_is_speaking " ) , & DisplayServer : : tts_is_speaking ) ;
ClassDB : : bind_method ( D_METHOD ( " tts_is_paused " ) , & DisplayServer : : tts_is_paused ) ;
ClassDB : : bind_method ( D_METHOD ( " tts_get_voices " ) , & DisplayServer : : tts_get_voices ) ;
ClassDB : : bind_method ( D_METHOD ( " tts_get_voices_for_language " , " language " ) , & DisplayServer : : tts_get_voices_for_language ) ;
ClassDB : : bind_method ( D_METHOD ( " tts_speak " , " text " , " voice " , " volume " , " pitch " , " rate " , " utterance_id " , " interrupt " ) , & DisplayServer : : tts_speak , DEFVAL ( 50 ) , DEFVAL ( 1.f ) , DEFVAL ( 1.f ) , DEFVAL ( 0 ) , DEFVAL ( false ) ) ;
ClassDB : : bind_method ( D_METHOD ( " tts_pause " ) , & DisplayServer : : tts_pause ) ;
ClassDB : : bind_method ( D_METHOD ( " tts_resume " ) , & DisplayServer : : tts_resume ) ;
ClassDB : : bind_method ( D_METHOD ( " tts_stop " ) , & DisplayServer : : tts_stop ) ;
ClassDB : : bind_method ( D_METHOD ( " tts_set_utterance_callback " , " event " , " callable " ) , & DisplayServer : : tts_set_utterance_callback ) ;
ClassDB : : bind_method ( D_METHOD ( " _tts_post_utterance_event " , " event " , " id " , " char_pos " ) , & DisplayServer : : tts_post_utterance_event ) ;
2022-08-29 08:24:48 +00:00
ClassDB : : bind_method ( D_METHOD ( " is_dark_mode_supported " ) , & DisplayServer : : is_dark_mode_supported ) ;
ClassDB : : bind_method ( D_METHOD ( " is_dark_mode " ) , & DisplayServer : : is_dark_mode ) ;
ClassDB : : bind_method ( D_METHOD ( " get_accent_color " ) , & DisplayServer : : get_accent_color ) ;
2020-03-01 22:14:37 +00:00
ClassDB : : bind_method ( D_METHOD ( " mouse_set_mode " , " mouse_mode " ) , & DisplayServer : : mouse_set_mode ) ;
ClassDB : : bind_method ( D_METHOD ( " mouse_get_mode " ) , & DisplayServer : : mouse_get_mode ) ;
2022-03-27 09:17:36 +00:00
ClassDB : : bind_method ( D_METHOD ( " warp_mouse " , " position " ) , & DisplayServer : : warp_mouse ) ;
2020-03-01 22:14:37 +00:00
ClassDB : : bind_method ( D_METHOD ( " mouse_get_position " ) , & DisplayServer : : mouse_get_position ) ;
ClassDB : : bind_method ( D_METHOD ( " mouse_get_button_state " ) , & DisplayServer : : mouse_get_button_state ) ;
ClassDB : : bind_method ( D_METHOD ( " clipboard_set " , " clipboard " ) , & DisplayServer : : clipboard_set ) ;
ClassDB : : bind_method ( D_METHOD ( " clipboard_get " ) , & DisplayServer : : clipboard_get ) ;
2022-01-19 13:04:52 +00:00
ClassDB : : bind_method ( D_METHOD ( " clipboard_has " ) , & DisplayServer : : clipboard_has ) ;
2021-10-12 07:43:50 +00:00
ClassDB : : bind_method ( D_METHOD ( " clipboard_set_primary " , " clipboard_primary " ) , & DisplayServer : : clipboard_set_primary ) ;
ClassDB : : bind_method ( D_METHOD ( " clipboard_get_primary " ) , & DisplayServer : : clipboard_get_primary ) ;
2020-03-01 22:14:37 +00:00
2022-04-24 19:12:22 +00:00
ClassDB : : bind_method ( D_METHOD ( " get_display_cutouts " ) , & DisplayServer : : get_display_cutouts ) ;
2022-04-26 09:40:57 +00:00
ClassDB : : bind_method ( D_METHOD ( " get_display_safe_area " ) , & DisplayServer : : get_display_safe_area ) ;
2022-04-24 19:12:22 +00:00
2020-03-01 22:14:37 +00:00
ClassDB : : bind_method ( D_METHOD ( " get_screen_count " ) , & DisplayServer : : get_screen_count ) ;
ClassDB : : bind_method ( D_METHOD ( " screen_get_position " , " screen " ) , & DisplayServer : : screen_get_position , DEFVAL ( SCREEN_OF_MAIN_WINDOW ) ) ;
ClassDB : : bind_method ( D_METHOD ( " screen_get_size " , " screen " ) , & DisplayServer : : screen_get_size , DEFVAL ( SCREEN_OF_MAIN_WINDOW ) ) ;
2020-03-20 02:32:09 +00:00
ClassDB : : bind_method ( D_METHOD ( " screen_get_usable_rect " , " screen " ) , & DisplayServer : : screen_get_usable_rect , DEFVAL ( SCREEN_OF_MAIN_WINDOW ) ) ;
2020-03-01 22:14:37 +00:00
ClassDB : : bind_method ( D_METHOD ( " screen_get_dpi " , " screen " ) , & DisplayServer : : screen_get_dpi , DEFVAL ( SCREEN_OF_MAIN_WINDOW ) ) ;
2020-03-07 16:02:54 +00:00
ClassDB : : bind_method ( D_METHOD ( " screen_get_scale " , " screen " ) , & DisplayServer : : screen_get_scale , DEFVAL ( SCREEN_OF_MAIN_WINDOW ) ) ;
2020-03-01 22:14:37 +00:00
ClassDB : : bind_method ( D_METHOD ( " screen_is_touchscreen " , " screen " ) , & DisplayServer : : screen_is_touchscreen , DEFVAL ( SCREEN_OF_MAIN_WINDOW ) ) ;
2020-07-03 10:06:03 +00:00
ClassDB : : bind_method ( D_METHOD ( " screen_get_max_scale " ) , & DisplayServer : : screen_get_max_scale ) ;
2022-01-27 19:46:57 +00:00
ClassDB : : bind_method ( D_METHOD ( " screen_get_refresh_rate " , " screen " ) , & DisplayServer : : screen_get_refresh_rate , DEFVAL ( SCREEN_OF_MAIN_WINDOW ) ) ;
2020-03-01 22:14:37 +00:00
ClassDB : : bind_method ( D_METHOD ( " screen_set_orientation " , " orientation " , " screen " ) , & DisplayServer : : screen_set_orientation , DEFVAL ( SCREEN_OF_MAIN_WINDOW ) ) ;
ClassDB : : bind_method ( D_METHOD ( " screen_get_orientation " , " screen " ) , & DisplayServer : : screen_get_orientation , DEFVAL ( SCREEN_OF_MAIN_WINDOW ) ) ;
2020-03-03 13:36:29 +00:00
ClassDB : : bind_method ( D_METHOD ( " screen_set_keep_on " , " enable " ) , & DisplayServer : : screen_set_keep_on ) ;
ClassDB : : bind_method ( D_METHOD ( " screen_is_kept_on " ) , & DisplayServer : : screen_is_kept_on ) ;
2020-03-01 22:14:37 +00:00
ClassDB : : bind_method ( D_METHOD ( " get_window_list " ) , & DisplayServer : : get_window_list ) ;
2020-03-24 23:15:35 +00:00
ClassDB : : bind_method ( D_METHOD ( " get_window_at_screen_position " , " position " ) , & DisplayServer : : get_window_at_screen_position ) ;
2020-03-01 22:14:37 +00:00
2021-06-19 15:44:59 +00:00
ClassDB : : bind_method ( D_METHOD ( " create_sub_window " , " mode " , " vsync_mode " , " flags " , " rect " ) , & DisplayServer : : create_sub_window , DEFVAL ( Rect2i ( ) ) ) ;
2020-03-01 22:14:37 +00:00
ClassDB : : bind_method ( D_METHOD ( " delete_sub_window " , " window_id " ) , & DisplayServer : : delete_sub_window ) ;
2022-01-14 10:41:04 +00:00
ClassDB : : bind_method ( D_METHOD ( " window_get_native_handle " , " handle_type " , " window_id " ) , & DisplayServer : : window_get_native_handle , DEFVAL ( MAIN_WINDOW_ID ) ) ;
2022-02-24 09:21:23 +00:00
ClassDB : : bind_method ( D_METHOD ( " window_get_active_popup " ) , & DisplayServer : : window_get_active_popup ) ;
ClassDB : : bind_method ( D_METHOD ( " window_set_popup_safe_rect " , " window " , " rect " ) , & DisplayServer : : window_set_popup_safe_rect ) ;
ClassDB : : bind_method ( D_METHOD ( " window_get_popup_safe_rect " , " window " ) , & DisplayServer : : window_get_popup_safe_rect ) ;
2022-01-14 10:41:04 +00:00
2020-03-01 22:14:37 +00:00
ClassDB : : bind_method ( D_METHOD ( " window_set_title " , " title " , " window_id " ) , & DisplayServer : : window_set_title , DEFVAL ( MAIN_WINDOW_ID ) ) ;
2020-06-29 09:31:36 +00:00
ClassDB : : bind_method ( D_METHOD ( " window_set_mouse_passthrough " , " region " , " window_id " ) , & DisplayServer : : window_set_mouse_passthrough , DEFVAL ( MAIN_WINDOW_ID ) ) ;
2020-03-01 22:14:37 +00:00
ClassDB : : bind_method ( D_METHOD ( " window_get_current_screen " , " window_id " ) , & DisplayServer : : window_get_current_screen , DEFVAL ( MAIN_WINDOW_ID ) ) ;
ClassDB : : bind_method ( D_METHOD ( " window_set_current_screen " , " screen " , " window_id " ) , & DisplayServer : : window_set_current_screen , DEFVAL ( MAIN_WINDOW_ID ) ) ;
ClassDB : : bind_method ( D_METHOD ( " window_get_position " , " window_id " ) , & DisplayServer : : window_get_position , DEFVAL ( MAIN_WINDOW_ID ) ) ;
ClassDB : : bind_method ( D_METHOD ( " window_set_position " , " position " , " window_id " ) , & DisplayServer : : window_set_position , DEFVAL ( MAIN_WINDOW_ID ) ) ;
ClassDB : : bind_method ( D_METHOD ( " window_get_size " , " window_id " ) , & DisplayServer : : window_get_size , DEFVAL ( MAIN_WINDOW_ID ) ) ;
ClassDB : : bind_method ( D_METHOD ( " window_set_size " , " size " , " window_id " ) , & DisplayServer : : window_set_size , DEFVAL ( MAIN_WINDOW_ID ) ) ;
2020-03-14 16:06:39 +00:00
ClassDB : : bind_method ( D_METHOD ( " window_set_rect_changed_callback " , " callback " , " window_id " ) , & DisplayServer : : window_set_rect_changed_callback , DEFVAL ( MAIN_WINDOW_ID ) ) ;
2020-03-04 16:36:09 +00:00
ClassDB : : bind_method ( D_METHOD ( " window_set_window_event_callback " , " callback " , " window_id " ) , & DisplayServer : : window_set_window_event_callback , DEFVAL ( MAIN_WINDOW_ID ) ) ;
ClassDB : : bind_method ( D_METHOD ( " window_set_input_event_callback " , " callback " , " window_id " ) , & DisplayServer : : window_set_input_event_callback , DEFVAL ( MAIN_WINDOW_ID ) ) ;
ClassDB : : bind_method ( D_METHOD ( " window_set_input_text_callback " , " callback " , " window_id " ) , & DisplayServer : : window_set_input_text_callback , DEFVAL ( MAIN_WINDOW_ID ) ) ;
ClassDB : : bind_method ( D_METHOD ( " window_set_drop_files_callback " , " callback " , " window_id " ) , & DisplayServer : : window_set_drop_files_callback , DEFVAL ( MAIN_WINDOW_ID ) ) ;
2020-03-01 22:14:37 +00:00
2020-03-25 14:16:19 +00:00
ClassDB : : bind_method ( D_METHOD ( " window_attach_instance_id " , " instance_id " , " window_id " ) , & DisplayServer : : window_attach_instance_id , DEFVAL ( MAIN_WINDOW_ID ) ) ;
ClassDB : : bind_method ( D_METHOD ( " window_get_attached_instance_id " , " window_id " ) , & DisplayServer : : window_get_attached_instance_id , DEFVAL ( MAIN_WINDOW_ID ) ) ;
2020-03-24 23:15:35 +00:00
2020-03-01 22:14:37 +00:00
ClassDB : : bind_method ( D_METHOD ( " window_get_max_size " , " window_id " ) , & DisplayServer : : window_get_max_size , DEFVAL ( MAIN_WINDOW_ID ) ) ;
ClassDB : : bind_method ( D_METHOD ( " window_set_max_size " , " max_size " , " window_id " ) , & DisplayServer : : window_set_max_size , DEFVAL ( MAIN_WINDOW_ID ) ) ;
ClassDB : : bind_method ( D_METHOD ( " window_get_min_size " , " window_id " ) , & DisplayServer : : window_get_min_size , DEFVAL ( MAIN_WINDOW_ID ) ) ;
ClassDB : : bind_method ( D_METHOD ( " window_set_min_size " , " min_size " , " window_id " ) , & DisplayServer : : window_set_min_size , DEFVAL ( MAIN_WINDOW_ID ) ) ;
ClassDB : : bind_method ( D_METHOD ( " window_get_real_size " , " window_id " ) , & DisplayServer : : window_get_real_size , DEFVAL ( MAIN_WINDOW_ID ) ) ;
ClassDB : : bind_method ( D_METHOD ( " window_get_mode " , " window_id " ) , & DisplayServer : : window_get_mode , DEFVAL ( MAIN_WINDOW_ID ) ) ;
ClassDB : : bind_method ( D_METHOD ( " window_set_mode " , " mode " , " window_id " ) , & DisplayServer : : window_set_mode , DEFVAL ( MAIN_WINDOW_ID ) ) ;
ClassDB : : bind_method ( D_METHOD ( " window_set_flag " , " flag " , " enabled " , " window_id " ) , & DisplayServer : : window_set_flag , DEFVAL ( MAIN_WINDOW_ID ) ) ;
ClassDB : : bind_method ( D_METHOD ( " window_get_flag " , " flag " , " window_id " ) , & DisplayServer : : window_get_flag , DEFVAL ( MAIN_WINDOW_ID ) ) ;
2022-09-20 08:12:49 +00:00
ClassDB : : bind_method ( D_METHOD ( " window_set_window_buttons_offset " , " offset " , " window_id " ) , & DisplayServer : : window_set_window_buttons_offset , DEFVAL ( MAIN_WINDOW_ID ) ) ;
2022-08-23 10:40:48 +00:00
ClassDB : : bind_method ( D_METHOD ( " window_get_safe_title_margins " , " window_id " ) , & DisplayServer : : window_get_safe_title_margins , DEFVAL ( MAIN_WINDOW_ID ) ) ;
2020-03-01 22:14:37 +00:00
ClassDB : : bind_method ( D_METHOD ( " window_request_attention " , " window_id " ) , & DisplayServer : : window_request_attention , DEFVAL ( MAIN_WINDOW_ID ) ) ;
ClassDB : : bind_method ( D_METHOD ( " window_move_to_foreground " , " window_id " ) , & DisplayServer : : window_move_to_foreground , DEFVAL ( MAIN_WINDOW_ID ) ) ;
ClassDB : : bind_method ( D_METHOD ( " window_can_draw " , " window_id " ) , & DisplayServer : : window_can_draw , DEFVAL ( MAIN_WINDOW_ID ) ) ;
2020-03-04 19:03:30 +00:00
ClassDB : : bind_method ( D_METHOD ( " window_set_transient " , " window_id " , " parent_window_id " ) , & DisplayServer : : window_set_transient ) ;
2022-01-19 12:04:05 +00:00
ClassDB : : bind_method ( D_METHOD ( " window_set_exclusive " , " window_id " , " exclusive " ) , & DisplayServer : : window_set_exclusive ) ;
2020-03-04 19:03:30 +00:00
2020-03-01 22:14:37 +00:00
ClassDB : : bind_method ( D_METHOD ( " window_set_ime_active " , " active " , " window_id " ) , & DisplayServer : : window_set_ime_active , DEFVAL ( MAIN_WINDOW_ID ) ) ;
ClassDB : : bind_method ( D_METHOD ( " window_set_ime_position " , " position " , " window_id " ) , & DisplayServer : : window_set_ime_position , DEFVAL ( MAIN_WINDOW_ID ) ) ;
2021-06-19 15:44:59 +00:00
ClassDB : : bind_method ( D_METHOD ( " window_set_vsync_mode " , " vsync_mode " , " window_id " ) , & DisplayServer : : window_set_vsync_mode , DEFVAL ( MAIN_WINDOW_ID ) ) ;
ClassDB : : bind_method ( D_METHOD ( " window_get_vsync_mode " , " window_id " ) , & DisplayServer : : window_get_vsync_mode , DEFVAL ( MAIN_WINDOW_ID ) ) ;
2022-08-23 10:40:48 +00:00
ClassDB : : bind_method ( D_METHOD ( " window_maximize_on_title_dbl_click " ) , & DisplayServer : : window_maximize_on_title_dbl_click ) ;
ClassDB : : bind_method ( D_METHOD ( " window_minimize_on_title_dbl_click " ) , & DisplayServer : : window_minimize_on_title_dbl_click ) ;
2020-03-01 22:14:37 +00:00
ClassDB : : bind_method ( D_METHOD ( " ime_get_selection " ) , & DisplayServer : : ime_get_selection ) ;
ClassDB : : bind_method ( D_METHOD ( " ime_get_text " ) , & DisplayServer : : ime_get_text ) ;
2022-07-07 18:20:10 +00:00
ClassDB : : bind_method ( D_METHOD ( " virtual_keyboard_show " , " existing_text " , " position " , " type " , " max_length " , " cursor_start " , " cursor_end " ) , & DisplayServer : : virtual_keyboard_show , DEFVAL ( Rect2 ( ) ) , DEFVAL ( KEYBOARD_TYPE_DEFAULT ) , DEFVAL ( - 1 ) , DEFVAL ( - 1 ) , DEFVAL ( - 1 ) ) ;
2020-03-01 22:14:37 +00:00
ClassDB : : bind_method ( D_METHOD ( " virtual_keyboard_hide " ) , & DisplayServer : : virtual_keyboard_hide ) ;
ClassDB : : bind_method ( D_METHOD ( " virtual_keyboard_get_height " ) , & DisplayServer : : virtual_keyboard_get_height ) ;
ClassDB : : bind_method ( D_METHOD ( " cursor_set_shape " , " shape " ) , & DisplayServer : : cursor_set_shape ) ;
ClassDB : : bind_method ( D_METHOD ( " cursor_get_shape " ) , & DisplayServer : : cursor_get_shape ) ;
2020-03-03 13:36:29 +00:00
ClassDB : : bind_method ( D_METHOD ( " cursor_set_custom_image " , " cursor " , " shape " , " hotspot " ) , & DisplayServer : : cursor_set_custom_image , DEFVAL ( CURSOR_ARROW ) , DEFVAL ( Vector2 ( ) ) ) ;
2020-03-01 22:14:37 +00:00
2020-07-08 23:02:38 +00:00
ClassDB : : bind_method ( D_METHOD ( " get_swap_cancel_ok " ) , & DisplayServer : : get_swap_cancel_ok ) ;
2020-03-01 22:14:37 +00:00
ClassDB : : bind_method ( D_METHOD ( " enable_for_stealing_focus " , " process_id " ) , & DisplayServer : : enable_for_stealing_focus ) ;
ClassDB : : bind_method ( D_METHOD ( " dialog_show " , " title " , " description " , " buttons " , " callback " ) , & DisplayServer : : dialog_show ) ;
2020-04-01 01:49:23 +00:00
ClassDB : : bind_method ( D_METHOD ( " dialog_input_text " , " title " , " description " , " existing_text " , " callback " ) , & DisplayServer : : dialog_input_text ) ;
2020-03-01 22:14:37 +00:00
2020-06-11 09:27:07 +00:00
ClassDB : : bind_method ( D_METHOD ( " keyboard_get_layout_count " ) , & DisplayServer : : keyboard_get_layout_count ) ;
ClassDB : : bind_method ( D_METHOD ( " keyboard_get_current_layout " ) , & DisplayServer : : keyboard_get_current_layout ) ;
ClassDB : : bind_method ( D_METHOD ( " keyboard_set_current_layout " , " index " ) , & DisplayServer : : keyboard_set_current_layout ) ;
ClassDB : : bind_method ( D_METHOD ( " keyboard_get_layout_language " , " index " ) , & DisplayServer : : keyboard_get_layout_language ) ;
ClassDB : : bind_method ( D_METHOD ( " keyboard_get_layout_name " , " index " ) , & DisplayServer : : keyboard_get_layout_name ) ;
2021-09-17 01:07:59 +00:00
ClassDB : : bind_method ( D_METHOD ( " keyboard_get_keycode_from_physical " , " keycode " ) , & DisplayServer : : keyboard_get_keycode_from_physical ) ;
2020-03-01 22:14:37 +00:00
ClassDB : : bind_method ( D_METHOD ( " process_events " ) , & DisplayServer : : process_events ) ;
ClassDB : : bind_method ( D_METHOD ( " force_process_and_drop_events " ) , & DisplayServer : : force_process_and_drop_events ) ;
ClassDB : : bind_method ( D_METHOD ( " set_native_icon " , " filename " ) , & DisplayServer : : set_native_icon ) ;
ClassDB : : bind_method ( D_METHOD ( " set_icon " , " image " ) , & DisplayServer : : set_icon ) ;
2021-02-17 14:07:56 +00:00
ClassDB : : bind_method ( D_METHOD ( " tablet_get_driver_count " ) , & DisplayServer : : tablet_get_driver_count ) ;
ClassDB : : bind_method ( D_METHOD ( " tablet_get_driver_name " , " idx " ) , & DisplayServer : : tablet_get_driver_name ) ;
ClassDB : : bind_method ( D_METHOD ( " tablet_get_current_driver " ) , & DisplayServer : : tablet_get_current_driver ) ;
ClassDB : : bind_method ( D_METHOD ( " tablet_set_current_driver " , " name " ) , & DisplayServer : : tablet_set_current_driver ) ;
2020-03-01 22:14:37 +00:00
BIND_ENUM_CONSTANT ( FEATURE_GLOBAL_MENU ) ;
BIND_ENUM_CONSTANT ( FEATURE_SUBWINDOWS ) ;
BIND_ENUM_CONSTANT ( FEATURE_TOUCHSCREEN ) ;
BIND_ENUM_CONSTANT ( FEATURE_MOUSE ) ;
BIND_ENUM_CONSTANT ( FEATURE_MOUSE_WARP ) ;
BIND_ENUM_CONSTANT ( FEATURE_CLIPBOARD ) ;
BIND_ENUM_CONSTANT ( FEATURE_VIRTUAL_KEYBOARD ) ;
BIND_ENUM_CONSTANT ( FEATURE_CURSOR_SHAPE ) ;
BIND_ENUM_CONSTANT ( FEATURE_CUSTOM_CURSOR_SHAPE ) ;
BIND_ENUM_CONSTANT ( FEATURE_NATIVE_DIALOG ) ;
BIND_ENUM_CONSTANT ( FEATURE_IME ) ;
BIND_ENUM_CONSTANT ( FEATURE_WINDOW_TRANSPARENCY ) ;
BIND_ENUM_CONSTANT ( FEATURE_HIDPI ) ;
BIND_ENUM_CONSTANT ( FEATURE_ICON ) ;
BIND_ENUM_CONSTANT ( FEATURE_NATIVE_ICON ) ;
BIND_ENUM_CONSTANT ( FEATURE_ORIENTATION ) ;
BIND_ENUM_CONSTANT ( FEATURE_SWAP_BUFFERS ) ;
2021-10-20 19:25:09 +00:00
BIND_ENUM_CONSTANT ( FEATURE_CLIPBOARD_PRIMARY ) ;
2021-11-04 12:33:37 +00:00
BIND_ENUM_CONSTANT ( FEATURE_TEXT_TO_SPEECH ) ;
2022-08-23 10:40:48 +00:00
BIND_ENUM_CONSTANT ( FEATURE_EXTEND_TO_TITLE ) ;
2020-03-01 22:14:37 +00:00
BIND_ENUM_CONSTANT ( MOUSE_MODE_VISIBLE ) ;
BIND_ENUM_CONSTANT ( MOUSE_MODE_HIDDEN ) ;
BIND_ENUM_CONSTANT ( MOUSE_MODE_CAPTURED ) ;
BIND_ENUM_CONSTANT ( MOUSE_MODE_CONFINED ) ;
2021-03-30 22:35:08 +00:00
BIND_ENUM_CONSTANT ( MOUSE_MODE_CONFINED_HIDDEN ) ;
2020-03-01 22:14:37 +00:00
BIND_CONSTANT ( SCREEN_OF_MAIN_WINDOW ) ;
BIND_CONSTANT ( MAIN_WINDOW_ID ) ;
BIND_CONSTANT ( INVALID_WINDOW_ID ) ;
BIND_ENUM_CONSTANT ( SCREEN_LANDSCAPE ) ;
BIND_ENUM_CONSTANT ( SCREEN_PORTRAIT ) ;
BIND_ENUM_CONSTANT ( SCREEN_REVERSE_LANDSCAPE ) ;
BIND_ENUM_CONSTANT ( SCREEN_REVERSE_PORTRAIT ) ;
BIND_ENUM_CONSTANT ( SCREEN_SENSOR_LANDSCAPE ) ;
BIND_ENUM_CONSTANT ( SCREEN_SENSOR_PORTRAIT ) ;
BIND_ENUM_CONSTANT ( SCREEN_SENSOR ) ;
2022-07-07 18:20:10 +00:00
BIND_ENUM_CONSTANT ( KEYBOARD_TYPE_DEFAULT ) ;
BIND_ENUM_CONSTANT ( KEYBOARD_TYPE_MULTILINE ) ;
BIND_ENUM_CONSTANT ( KEYBOARD_TYPE_NUMBER ) ;
BIND_ENUM_CONSTANT ( KEYBOARD_TYPE_NUMBER_DECIMAL ) ;
BIND_ENUM_CONSTANT ( KEYBOARD_TYPE_PHONE ) ;
BIND_ENUM_CONSTANT ( KEYBOARD_TYPE_EMAIL_ADDRESS ) ;
BIND_ENUM_CONSTANT ( KEYBOARD_TYPE_PASSWORD ) ;
BIND_ENUM_CONSTANT ( KEYBOARD_TYPE_URL ) ;
2020-03-01 22:14:37 +00:00
BIND_ENUM_CONSTANT ( CURSOR_ARROW ) ;
BIND_ENUM_CONSTANT ( CURSOR_IBEAM ) ;
BIND_ENUM_CONSTANT ( CURSOR_POINTING_HAND ) ;
BIND_ENUM_CONSTANT ( CURSOR_CROSS ) ;
BIND_ENUM_CONSTANT ( CURSOR_WAIT ) ;
BIND_ENUM_CONSTANT ( CURSOR_BUSY ) ;
BIND_ENUM_CONSTANT ( CURSOR_DRAG ) ;
BIND_ENUM_CONSTANT ( CURSOR_CAN_DROP ) ;
BIND_ENUM_CONSTANT ( CURSOR_FORBIDDEN ) ;
BIND_ENUM_CONSTANT ( CURSOR_VSIZE ) ;
BIND_ENUM_CONSTANT ( CURSOR_HSIZE ) ;
BIND_ENUM_CONSTANT ( CURSOR_BDIAGSIZE ) ;
BIND_ENUM_CONSTANT ( CURSOR_FDIAGSIZE ) ;
BIND_ENUM_CONSTANT ( CURSOR_MOVE ) ;
BIND_ENUM_CONSTANT ( CURSOR_VSPLIT ) ;
BIND_ENUM_CONSTANT ( CURSOR_HSPLIT ) ;
BIND_ENUM_CONSTANT ( CURSOR_HELP ) ;
BIND_ENUM_CONSTANT ( CURSOR_MAX ) ;
BIND_ENUM_CONSTANT ( WINDOW_MODE_WINDOWED ) ;
BIND_ENUM_CONSTANT ( WINDOW_MODE_MINIMIZED ) ;
BIND_ENUM_CONSTANT ( WINDOW_MODE_MAXIMIZED ) ;
BIND_ENUM_CONSTANT ( WINDOW_MODE_FULLSCREEN ) ;
2022-01-28 09:19:53 +00:00
BIND_ENUM_CONSTANT ( WINDOW_MODE_EXCLUSIVE_FULLSCREEN ) ;
2020-03-01 22:14:37 +00:00
BIND_ENUM_CONSTANT ( WINDOW_FLAG_RESIZE_DISABLED ) ;
BIND_ENUM_CONSTANT ( WINDOW_FLAG_BORDERLESS ) ;
BIND_ENUM_CONSTANT ( WINDOW_FLAG_ALWAYS_ON_TOP ) ;
BIND_ENUM_CONSTANT ( WINDOW_FLAG_TRANSPARENT ) ;
2020-03-20 20:51:53 +00:00
BIND_ENUM_CONSTANT ( WINDOW_FLAG_NO_FOCUS ) ;
2022-02-24 09:21:23 +00:00
BIND_ENUM_CONSTANT ( WINDOW_FLAG_POPUP ) ;
2022-08-23 10:40:48 +00:00
BIND_ENUM_CONSTANT ( WINDOW_FLAG_EXTEND_TO_TITLE ) ;
2020-03-01 22:14:37 +00:00
BIND_ENUM_CONSTANT ( WINDOW_FLAG_MAX ) ;
2020-03-04 16:36:09 +00:00
BIND_ENUM_CONSTANT ( WINDOW_EVENT_MOUSE_ENTER ) ;
BIND_ENUM_CONSTANT ( WINDOW_EVENT_MOUSE_EXIT ) ;
BIND_ENUM_CONSTANT ( WINDOW_EVENT_FOCUS_IN ) ;
BIND_ENUM_CONSTANT ( WINDOW_EVENT_FOCUS_OUT ) ;
BIND_ENUM_CONSTANT ( WINDOW_EVENT_CLOSE_REQUEST ) ;
BIND_ENUM_CONSTANT ( WINDOW_EVENT_GO_BACK_REQUEST ) ;
2020-03-07 16:02:54 +00:00
BIND_ENUM_CONSTANT ( WINDOW_EVENT_DPI_CHANGE ) ;
2022-09-22 09:06:11 +00:00
BIND_ENUM_CONSTANT ( WINDOW_EVENT_TITLEBAR_CHANGE ) ;
2021-06-19 15:44:59 +00:00
BIND_ENUM_CONSTANT ( VSYNC_DISABLED ) ;
BIND_ENUM_CONSTANT ( VSYNC_ENABLED ) ;
BIND_ENUM_CONSTANT ( VSYNC_ADAPTIVE ) ;
BIND_ENUM_CONSTANT ( VSYNC_MAILBOX ) ;
2022-01-14 10:41:04 +00:00
BIND_ENUM_CONSTANT ( DISPLAY_HANDLE ) ;
BIND_ENUM_CONSTANT ( WINDOW_HANDLE ) ;
BIND_ENUM_CONSTANT ( WINDOW_VIEW ) ;
2021-11-04 12:33:37 +00:00
BIND_ENUM_CONSTANT ( TTS_UTTERANCE_STARTED ) ;
BIND_ENUM_CONSTANT ( TTS_UTTERANCE_ENDED ) ;
BIND_ENUM_CONSTANT ( TTS_UTTERANCE_CANCELED ) ;
BIND_ENUM_CONSTANT ( TTS_UTTERANCE_BOUNDARY ) ;
2020-03-01 22:14:37 +00:00
}
2020-03-03 13:36:29 +00:00
2020-03-27 09:48:30 +00:00
void DisplayServer : : register_create_function ( const char * p_name , CreateFunction p_function , GetRenderingDriversFunction p_get_drivers ) {
2020-03-03 13:36:29 +00:00
ERR_FAIL_COND ( server_create_count = = MAX_SERVERS ) ;
2021-06-01 14:40:08 +00:00
// Headless display server is always last
server_create_functions [ server_create_count ] = server_create_functions [ server_create_count - 1 ] ;
server_create_functions [ server_create_count - 1 ] . name = p_name ;
server_create_functions [ server_create_count - 1 ] . create_function = p_function ;
server_create_functions [ server_create_count - 1 ] . get_rendering_drivers_function = p_get_drivers ;
2020-03-03 13:36:29 +00:00
server_create_count + + ;
}
2020-03-27 09:48:30 +00:00
2020-03-03 13:36:29 +00:00
int DisplayServer : : get_create_function_count ( ) {
return server_create_count ;
}
2020-03-27 09:48:30 +00:00
2020-03-03 13:36:29 +00:00
const char * DisplayServer : : get_create_function_name ( int p_index ) {
ERR_FAIL_INDEX_V ( p_index , server_create_count , nullptr ) ;
return server_create_functions [ p_index ] . name ;
}
Vector < String > DisplayServer : : get_create_function_rendering_drivers ( int p_index ) {
ERR_FAIL_INDEX_V ( p_index , server_create_count , Vector < String > ( ) ) ;
return server_create_functions [ p_index ] . get_rendering_drivers_function ( ) ;
}
2021-06-19 15:44:59 +00:00
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_resolution , Error & r_error ) {
2020-03-03 13:36:29 +00:00
ERR_FAIL_INDEX_V ( p_index , server_create_count , nullptr ) ;
2021-06-19 15:44:59 +00:00
return server_create_functions [ p_index ] . create_function ( p_rendering_driver , p_mode , p_vsync_mode , p_flags , p_resolution , r_error ) ;
2020-03-03 13:36:29 +00:00
}
2020-04-28 13:19:37 +00:00
void DisplayServer : : _input_set_mouse_mode ( Input : : MouseMode p_mode ) {
2020-03-03 13:36:29 +00:00
singleton - > mouse_set_mode ( MouseMode ( p_mode ) ) ;
}
2020-05-14 12:29:06 +00:00
2020-04-28 13:19:37 +00:00
Input : : MouseMode DisplayServer : : _input_get_mouse_mode ( ) {
return Input : : MouseMode ( singleton - > mouse_get_mode ( ) ) ;
2020-03-03 13:36:29 +00:00
}
void DisplayServer : : _input_warp ( const Vector2 & p_to_pos ) {
2022-03-27 09:17:36 +00:00
singleton - > warp_mouse ( p_to_pos ) ;
2020-03-03 13:36:29 +00:00
}
2020-04-28 13:19:37 +00:00
Input : : CursorShape DisplayServer : : _input_get_current_cursor_shape ( ) {
return ( Input : : CursorShape ) singleton - > cursor_get_shape ( ) ;
2020-03-03 13:36:29 +00:00
}
2020-05-14 12:29:06 +00:00
2022-05-02 23:43:50 +00:00
void DisplayServer : : _input_set_custom_mouse_cursor_func ( const Ref < Resource > & p_image , Input : : CursorShape p_shape , const Vector2 & p_hostspot ) {
2020-03-03 13:36:29 +00:00
singleton - > cursor_set_custom_image ( p_image , ( CursorShape ) p_shape , p_hostspot ) ;
}
2020-03-01 22:14:37 +00:00
DisplayServer : : DisplayServer ( ) {
singleton = this ;
2020-04-28 13:19:37 +00:00
Input : : set_mouse_mode_func = _input_set_mouse_mode ;
Input : : get_mouse_mode_func = _input_get_mouse_mode ;
Input : : warp_mouse_func = _input_warp ;
Input : : get_current_cursor_shape_func = _input_get_current_cursor_shape ;
Input : : set_custom_mouse_cursor_func = _input_set_custom_mouse_cursor_func ;
2020-03-01 22:14:37 +00:00
}
2020-05-14 12:29:06 +00:00
2020-03-01 22:14:37 +00:00
DisplayServer : : ~ DisplayServer ( ) {
2021-07-11 13:26:18 +00:00
singleton = nullptr ;
2020-03-01 22:14:37 +00:00
}