[X11] Prevent IME activation from entering infinite loop.

This commit is contained in:
bruvzg 2023-01-25 10:21:27 +02:00
parent a3a42159e3
commit b713cfdccd
No known key found for this signature in database
GPG key ID: 7960FCF39844EC38

View file

@ -2496,6 +2496,9 @@ void DisplayServerX11::window_set_ime_active(const bool p_active, WindowID p_win
return;
}
if (!wd.focused) {
wd.ime_active = false;
im_text = String();
im_selection = Vector2i();
return;
}
@ -2524,7 +2527,6 @@ void DisplayServerX11::window_set_ime_active(const bool p_active, WindowID p_win
im_text = String();
im_selection = Vector2i();
}
OS_Unix::get_singleton()->get_main_loop()->notification(MainLoop::NOTIFICATION_OS_IME_UPDATE);
}
void DisplayServerX11::window_set_ime_position(const Point2i &p_pos, WindowID p_window) {
@ -3316,6 +3318,7 @@ void DisplayServerX11::_xim_preedit_draw_callback(::XIM xim, ::XPointer client_d
WindowData &wd = ds->windows[window_id];
XIMText *xim_text = call_data->text;
if (wd.ime_active) {
if (xim_text != nullptr) {
String changed_text;
if (xim_text->encoding_is_wchar) {
@ -3351,7 +3354,7 @@ void DisplayServerX11::_xim_preedit_draw_callback(::XIM xim, ::XPointer client_d
ds->im_text = String();
ds->im_selection = Point2i();
}
if (wd.ime_active) {
OS_Unix::get_singleton()->get_main_loop()->notification(MainLoop::NOTIFICATION_OS_IME_UPDATE);
}
}