mirror of
https://github.com/godotengine/godot.git
synced 2026-01-06 10:11:57 +03:00
Fix Return key events in LineEdit & TextEdit on Android
Depending on the device implementation, editor actions could be received with different action ids or not at all for multi-line. Added a parameter to virtual keyboards to properly handle single-line and multi-line cases in all situations. Single-line: Input type set to text without multiline to make sure actions are sent. IME options are set to DONE action to force action id consistency. Multi-line: Input type set to text and multiline to make sure enter triggers new lines. Actions are disabled by the multiline flag, so '\n' characters are handled in text changed callbacks.
This commit is contained in:
@@ -1068,8 +1068,8 @@ bool _OS::has_virtual_keyboard() const {
|
||||
return OS::get_singleton()->has_virtual_keyboard();
|
||||
}
|
||||
|
||||
void _OS::show_virtual_keyboard(const String &p_existing_text) {
|
||||
OS::get_singleton()->show_virtual_keyboard(p_existing_text, Rect2());
|
||||
void _OS::show_virtual_keyboard(const String &p_existing_text, bool p_multiline) {
|
||||
OS::get_singleton()->show_virtual_keyboard(p_existing_text, Rect2(), p_multiline);
|
||||
}
|
||||
|
||||
void _OS::hide_virtual_keyboard() {
|
||||
@@ -1372,7 +1372,7 @@ void _OS::_bind_methods() {
|
||||
ClassDB::bind_method(D_METHOD("dump_memory_to_file", "file"), &_OS::dump_memory_to_file);
|
||||
ClassDB::bind_method(D_METHOD("dump_resources_to_file", "file"), &_OS::dump_resources_to_file);
|
||||
ClassDB::bind_method(D_METHOD("has_virtual_keyboard"), &_OS::has_virtual_keyboard);
|
||||
ClassDB::bind_method(D_METHOD("show_virtual_keyboard", "existing_text"), &_OS::show_virtual_keyboard, DEFVAL(""));
|
||||
ClassDB::bind_method(D_METHOD("show_virtual_keyboard", "existing_text", "multiline"), &_OS::show_virtual_keyboard, DEFVAL(""), DEFVAL(false));
|
||||
ClassDB::bind_method(D_METHOD("hide_virtual_keyboard"), &_OS::hide_virtual_keyboard);
|
||||
ClassDB::bind_method(D_METHOD("get_virtual_keyboard_height"), &_OS::get_virtual_keyboard_height);
|
||||
ClassDB::bind_method(D_METHOD("print_resources_in_use", "short"), &_OS::print_resources_in_use, DEFVAL(false));
|
||||
|
||||
@@ -256,7 +256,7 @@ public:
|
||||
void dump_resources_to_file(const String &p_file);
|
||||
|
||||
bool has_virtual_keyboard() const;
|
||||
void show_virtual_keyboard(const String &p_existing_text = "");
|
||||
void show_virtual_keyboard(const String &p_existing_text = "", bool p_multiline = false);
|
||||
void hide_virtual_keyboard();
|
||||
int get_virtual_keyboard_height();
|
||||
|
||||
|
||||
@@ -226,7 +226,7 @@ bool OS::has_virtual_keyboard() const {
|
||||
return false;
|
||||
}
|
||||
|
||||
void OS::show_virtual_keyboard(const String &p_existing_text, const Rect2 &p_screen_rect, int p_max_input_length, int p_cursor_start, int p_cursor_end) {
|
||||
void OS::show_virtual_keyboard(const String &p_existing_text, const Rect2 &p_screen_rect, bool p_multiline, int p_max_input_length, int p_cursor_start, int p_cursor_end) {
|
||||
}
|
||||
|
||||
void OS::hide_virtual_keyboard() {
|
||||
|
||||
@@ -388,7 +388,7 @@ public:
|
||||
};
|
||||
|
||||
virtual bool has_virtual_keyboard() const;
|
||||
virtual void show_virtual_keyboard(const String &p_existing_text, const Rect2 &p_screen_rect = Rect2(), int p_max_input_length = -1, int p_cursor_start = -1, int p_cursor_end = -1);
|
||||
virtual void show_virtual_keyboard(const String &p_existing_text, const Rect2 &p_screen_rect = Rect2(), bool p_multiline = false, int p_max_input_length = -1, int p_cursor_start = -1, int p_cursor_end = -1);
|
||||
virtual void hide_virtual_keyboard();
|
||||
|
||||
// returns height of the currently shown virtual keyboard (0 if keyboard is hidden)
|
||||
|
||||
Reference in New Issue
Block a user