Fix IME deactivation events not send on focus loss. Do not unset AltGr modifiers in non-IME input.

This commit is contained in:
bruvzg 2024-11-06 09:47:08 +02:00
parent 87318a2fb7
commit fdde7713a8
3 changed files with 6 additions and 2 deletions

View File

@ -5438,7 +5438,7 @@ void DisplayServerWindows::_process_key_events() {
k->set_physical_keycode(physical_keycode);
k->set_key_label(key_label);
k->set_unicode(fix_unicode(unicode));
if (k->get_unicode() && ke.altgr) {
if (k->get_unicode() && ke.altgr && windows[ke.window_id].ime_active) {
k->set_alt_pressed(false);
k->set_ctrl_pressed(false);
}
@ -5514,7 +5514,7 @@ void DisplayServerWindows::_process_key_events() {
}
k->set_unicode(fix_unicode(unicode));
}
if (k->get_unicode() && ke.altgr) {
if (k->get_unicode() && ke.altgr && windows[ke.window_id].ime_active) {
k->set_alt_pressed(false);
k->set_ctrl_pressed(false);
}

View File

@ -128,6 +128,7 @@ bool LineEdit::has_ime_text() const {
void LineEdit::cancel_ime() {
if (!has_ime_text()) {
_close_ime_window();
return;
}
ime_text = String();
@ -140,6 +141,7 @@ void LineEdit::cancel_ime() {
void LineEdit::apply_ime() {
if (!has_ime_text()) {
_close_ime_window();
return;
}

View File

@ -3169,6 +3169,7 @@ bool TextEdit::has_ime_text() const {
void TextEdit::cancel_ime() {
if (!has_ime_text()) {
_close_ime_window();
return;
}
ime_text = String();
@ -3181,6 +3182,7 @@ void TextEdit::cancel_ime() {
void TextEdit::apply_ime() {
if (!has_ime_text()) {
_close_ime_window();
return;
}