diff --git a/scene/gui/line_edit.cpp b/scene/gui/line_edit.cpp index c48a4e91147..4d638b50c6c 100644 --- a/scene/gui/line_edit.cpp +++ b/scene/gui/line_edit.cpp @@ -248,7 +248,9 @@ void LineEdit::_gui_input(Ref 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 6b75ca32b97..19c054fa433 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; } }