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