[X11] Prevent IME activation from entering infinite loop.
This commit is contained in:
parent
a3a42159e3
commit
b713cfdccd
1 changed files with 34 additions and 31 deletions
|
@ -2496,6 +2496,9 @@ void DisplayServerX11::window_set_ime_active(const bool p_active, WindowID p_win
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (!wd.focused) {
|
if (!wd.focused) {
|
||||||
|
wd.ime_active = false;
|
||||||
|
im_text = String();
|
||||||
|
im_selection = Vector2i();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2524,7 +2527,6 @@ void DisplayServerX11::window_set_ime_active(const bool p_active, WindowID p_win
|
||||||
im_text = String();
|
im_text = String();
|
||||||
im_selection = Vector2i();
|
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) {
|
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];
|
WindowData &wd = ds->windows[window_id];
|
||||||
|
|
||||||
XIMText *xim_text = call_data->text;
|
XIMText *xim_text = call_data->text;
|
||||||
|
if (wd.ime_active) {
|
||||||
if (xim_text != nullptr) {
|
if (xim_text != nullptr) {
|
||||||
String changed_text;
|
String changed_text;
|
||||||
if (xim_text->encoding_is_wchar) {
|
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_text = String();
|
||||||
ds->im_selection = Point2i();
|
ds->im_selection = Point2i();
|
||||||
}
|
}
|
||||||
if (wd.ime_active) {
|
|
||||||
OS_Unix::get_singleton()->get_main_loop()->notification(MainLoop::NOTIFICATION_OS_IME_UPDATE);
|
OS_Unix::get_singleton()->get_main_loop()->notification(MainLoop::NOTIFICATION_OS_IME_UPDATE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue