diff options
author | bruvzg <7645683+bruvzg@users.noreply.github.com> | 2019-01-08 22:52:56 +0200 |
---|---|---|
committer | bruvzg <7645683+bruvzg@users.noreply.github.com> | 2019-01-08 22:52:56 +0200 |
commit | 55bc004a73598b5d483ac0e4d3a70358cddd1bd1 (patch) | |
tree | 9e6c8f3fc45893dfe20c4368ba3b18a595a2d6a7 /scene | |
parent | bcecf5626768c8399e9293fe12a25511eeb6c52d (diff) |
Update IME text only for focused input controls.
Diffstat (limited to 'scene')
-rw-r--r-- | scene/gui/line_edit.cpp | 12 | ||||
-rw-r--r-- | scene/gui/text_edit.cpp | 8 |
2 files changed, 13 insertions, 7 deletions
diff --git a/scene/gui/line_edit.cpp b/scene/gui/line_edit.cpp index c48a4e9114..4d638b50c6 100644 --- a/scene/gui/line_edit.cpp +++ b/scene/gui/line_edit.cpp @@ -248,7 +248,9 @@ void LineEdit::_gui_input(Ref<InputEvent> p_event) { set_cursor_position(text.length()); } break; #endif - default: { handled = false; } + default: { + handled = false; + } } if (handled) { @@ -860,9 +862,11 @@ void LineEdit::_notification(int p_what) { } break; case MainLoop::NOTIFICATION_OS_IME_UPDATE: { - ime_text = OS::get_singleton()->get_ime_text(); - ime_selection = OS::get_singleton()->get_ime_selection(); - update(); + if (has_focus()) { + ime_text = OS::get_singleton()->get_ime_text(); + ime_selection = OS::get_singleton()->get_ime_selection(); + update(); + } } break; } } diff --git a/scene/gui/text_edit.cpp b/scene/gui/text_edit.cpp index 6b75ca32b9..19c054fa43 100644 --- a/scene/gui/text_edit.cpp +++ b/scene/gui/text_edit.cpp @@ -1449,9 +1449,11 @@ void TextEdit::_notification(int p_what) { } break; case MainLoop::NOTIFICATION_OS_IME_UPDATE: { - ime_text = OS::get_singleton()->get_ime_text(); - ime_selection = OS::get_singleton()->get_ime_selection(); - update(); + if (has_focus()) { + ime_text = OS::get_singleton()->get_ime_text(); + ime_selection = OS::get_singleton()->get_ime_selection(); + update(); + } } break; } } |