Merge pull request #117648 from bruvzg/te_ro
[TextEdit] Ignore IME updates and Alt sequences when control is read-only.
This commit is contained in:
@@ -1979,7 +1979,7 @@ void TextEdit::_notification(int p_what) {
|
||||
} break;
|
||||
|
||||
case MainLoop::NOTIFICATION_OS_IME_UPDATE: {
|
||||
if (has_focus()) {
|
||||
if (has_focus() && editable) {
|
||||
const String &new_ime_text = DisplayServer::get_singleton()->ime_get_text();
|
||||
const Vector2i &new_ime_selection = DisplayServer::get_singleton()->ime_get_selection();
|
||||
if (ime_text == new_ime_text && ime_selection == new_ime_selection) {
|
||||
@@ -2064,6 +2064,9 @@ void TextEdit::unhandled_key_input(const Ref<InputEvent> &p_event) {
|
||||
}
|
||||
|
||||
bool TextEdit::alt_input(const Ref<InputEvent> &p_gui_input) {
|
||||
if (!editable) {
|
||||
return false;
|
||||
}
|
||||
Ref<InputEventKey> k = p_gui_input;
|
||||
if (k.is_valid()) {
|
||||
// Start Unicode Alt input (hold).
|
||||
@@ -3441,6 +3444,10 @@ void TextEdit::_update_ime_window_position() {
|
||||
if (wid == DisplayServerEnums::INVALID_WINDOW_ID || !DisplayServer::get_singleton()->has_feature(DisplayServerEnums::FEATURE_IME)) {
|
||||
return;
|
||||
}
|
||||
if (!editable) {
|
||||
DisplayServer::get_singleton()->window_set_ime_active(false, wid);
|
||||
return;
|
||||
}
|
||||
DisplayServer::get_singleton()->window_set_ime_active(true, wid);
|
||||
Point2 pos = get_global_position() + get_caret_draw_pos();
|
||||
if (get_window()->get_embedder()) {
|
||||
|
||||
Reference in New Issue
Block a user