diff options
author | bruvzg <7645683+bruvzg@users.noreply.github.com> | 2020-06-11 12:27:07 +0300 |
---|---|---|
committer | bruvzg <7645683+bruvzg@users.noreply.github.com> | 2020-06-13 11:02:00 +0300 |
commit | 92352b1c2374d6dda80eda7536b925ac111f94af (patch) | |
tree | bf59049f90ef1b640a58d1c999e096a79784c0ff /servers | |
parent | 84abf5a979648081a9076ec6b342f5f9d33093d4 (diff) |
Add keyboard layout enumeration / set / get functions (macOS, Windows, Linux/X11), remove latin variant function.
Diffstat (limited to 'servers')
-rw-r--r-- | servers/display_server.cpp | 33 | ||||
-rw-r--r-- | servers/display_server.h | 17 |
2 files changed, 27 insertions, 23 deletions
diff --git a/servers/display_server.cpp b/servers/display_server.cpp index cc818cbe04..0ea11a2670 100644 --- a/servers/display_server.cpp +++ b/servers/display_server.cpp @@ -276,8 +276,23 @@ Error DisplayServer::dialog_input_text(String p_title, String p_description, Str return OK; } -DisplayServer::LatinKeyboardVariant DisplayServer::get_latin_keyboard_variant() const { - return LATIN_KEYBOARD_QWERTY; +int DisplayServer::keyboard_get_layout_count() const { + return 0; +} + +int DisplayServer::keyboard_get_current_layout() const { + return -1; +} + +void DisplayServer::keyboard_set_current_layout(int p_index) { +} + +String DisplayServer::keyboard_get_layout_language(int p_index) const { + return ""; +} + +String DisplayServer::keyboard_get_layout_name(int p_index) const { + return "Not supported"; } void DisplayServer::force_process_and_drop_events() { @@ -461,7 +476,11 @@ void DisplayServer::_bind_methods() { ClassDB::bind_method(D_METHOD("dialog_show", "title", "description", "buttons", "callback"), &DisplayServer::dialog_show); ClassDB::bind_method(D_METHOD("dialog_input_text", "title", "description", "existing_text", "callback"), &DisplayServer::dialog_input_text); - ClassDB::bind_method(D_METHOD("get_latin_keyboard_variant"), &DisplayServer::get_latin_keyboard_variant); + ClassDB::bind_method(D_METHOD("keyboard_get_layout_count"), &DisplayServer::keyboard_get_layout_count); + ClassDB::bind_method(D_METHOD("keyboard_get_current_layout"), &DisplayServer::keyboard_get_current_layout); + ClassDB::bind_method(D_METHOD("keyboard_set_current_layout", "index"), &DisplayServer::keyboard_set_current_layout); + ClassDB::bind_method(D_METHOD("keyboard_get_layout_language", "index"), &DisplayServer::keyboard_get_layout_language); + ClassDB::bind_method(D_METHOD("keyboard_get_layout_name", "index"), &DisplayServer::keyboard_get_layout_name); ClassDB::bind_method(D_METHOD("process_events"), &DisplayServer::process_events); ClassDB::bind_method(D_METHOD("force_process_and_drop_events"), &DisplayServer::force_process_and_drop_events); @@ -543,14 +562,6 @@ void DisplayServer::_bind_methods() { BIND_ENUM_CONSTANT(WINDOW_FLAG_NO_FOCUS); BIND_ENUM_CONSTANT(WINDOW_FLAG_MAX); - BIND_ENUM_CONSTANT(LATIN_KEYBOARD_QWERTY); - BIND_ENUM_CONSTANT(LATIN_KEYBOARD_QWERTZ); - BIND_ENUM_CONSTANT(LATIN_KEYBOARD_AZERTY); - BIND_ENUM_CONSTANT(LATIN_KEYBOARD_QZERTY); - BIND_ENUM_CONSTANT(LATIN_KEYBOARD_DVORAK); - BIND_ENUM_CONSTANT(LATIN_KEYBOARD_NEO); - BIND_ENUM_CONSTANT(LATIN_KEYBOARD_COLEMAK); - BIND_ENUM_CONSTANT(WINDOW_EVENT_MOUSE_ENTER); BIND_ENUM_CONSTANT(WINDOW_EVENT_MOUSE_EXIT); BIND_ENUM_CONSTANT(WINDOW_EVENT_FOCUS_IN); diff --git a/servers/display_server.h b/servers/display_server.h index b25b1931c8..166274f8ed 100644 --- a/servers/display_server.h +++ b/servers/display_server.h @@ -324,17 +324,11 @@ public: virtual Error dialog_show(String p_title, String p_description, Vector<String> p_buttons, const Callable &p_callback); virtual Error dialog_input_text(String p_title, String p_description, String p_partial, const Callable &p_callback); - enum LatinKeyboardVariant { - LATIN_KEYBOARD_QWERTY, - LATIN_KEYBOARD_QWERTZ, - LATIN_KEYBOARD_AZERTY, - LATIN_KEYBOARD_QZERTY, - LATIN_KEYBOARD_DVORAK, - LATIN_KEYBOARD_NEO, - LATIN_KEYBOARD_COLEMAK, - }; - - virtual LatinKeyboardVariant get_latin_keyboard_variant() const; + virtual int keyboard_get_layout_count() const; + virtual int keyboard_get_current_layout() const; + virtual void keyboard_set_current_layout(int p_index); + virtual String keyboard_get_layout_language(int p_index) const; + virtual String keyboard_get_layout_name(int p_index) const; virtual void process_events() = 0; @@ -384,6 +378,5 @@ VARIANT_ENUM_CAST(DisplayServer::ScreenOrientation) VARIANT_ENUM_CAST(DisplayServer::WindowMode) VARIANT_ENUM_CAST(DisplayServer::WindowFlags) VARIANT_ENUM_CAST(DisplayServer::CursorShape) -VARIANT_ENUM_CAST(DisplayServer::LatinKeyboardVariant) #endif // DISPLAY_SERVER_H |