Add IME support checks in LineEdit/TextEdit.
Avoid spamming "IME is unsupported" when the DisplayServer report it as such.
This commit is contained in:
parent
5024b7236e
commit
eda5ae9d75
2 changed files with 6 additions and 6 deletions
|
@ -848,7 +848,7 @@ void LineEdit::_notification(int p_what) {
|
|||
}
|
||||
|
||||
if (has_focus()) {
|
||||
if (get_viewport()->get_window_id() != DisplayServer::INVALID_WINDOW_ID) {
|
||||
if (get_viewport()->get_window_id() != DisplayServer::INVALID_WINDOW_ID && DisplayServer::get_singleton()->has_feature(DisplayServer::FEATURE_IME)) {
|
||||
DisplayServer::get_singleton()->window_set_ime_active(true, get_viewport()->get_window_id());
|
||||
DisplayServer::get_singleton()->window_set_ime_position(get_global_position() + Point2(using_placeholder ? 0 : x_ofs, y_ofs + TS->shaped_text_get_size(text_rid).y), get_viewport()->get_window_id());
|
||||
}
|
||||
|
@ -865,7 +865,7 @@ void LineEdit::_notification(int p_what) {
|
|||
}
|
||||
}
|
||||
|
||||
if (get_viewport()->get_window_id() != DisplayServer::INVALID_WINDOW_ID) {
|
||||
if (get_viewport()->get_window_id() != DisplayServer::INVALID_WINDOW_ID && DisplayServer::get_singleton()->has_feature(DisplayServer::FEATURE_IME)) {
|
||||
DisplayServer::get_singleton()->window_set_ime_active(true, get_viewport()->get_window_id());
|
||||
Point2 cursor_pos = Point2(get_cursor_position(), 1) * get_minimum_size().height;
|
||||
DisplayServer::get_singleton()->window_set_ime_position(get_global_position() + cursor_pos, get_viewport()->get_window_id());
|
||||
|
@ -878,7 +878,7 @@ void LineEdit::_notification(int p_what) {
|
|||
caret_blink_timer->stop();
|
||||
}
|
||||
|
||||
if (get_viewport()->get_window_id() != DisplayServer::INVALID_WINDOW_ID) {
|
||||
if (get_viewport()->get_window_id() != DisplayServer::INVALID_WINDOW_ID && DisplayServer::get_singleton()->has_feature(DisplayServer::FEATURE_IME)) {
|
||||
DisplayServer::get_singleton()->window_set_ime_position(Point2(), get_viewport()->get_window_id());
|
||||
DisplayServer::get_singleton()->window_set_ime_active(false, get_viewport()->get_window_id());
|
||||
}
|
||||
|
|
|
@ -1702,7 +1702,7 @@ void TextEdit::_notification(int p_what) {
|
|||
}
|
||||
|
||||
if (has_focus()) {
|
||||
if (get_viewport()->get_window_id() != DisplayServer::INVALID_WINDOW_ID) {
|
||||
if (get_viewport()->get_window_id() != DisplayServer::INVALID_WINDOW_ID && DisplayServer::get_singleton()->has_feature(DisplayServer::FEATURE_IME)) {
|
||||
DisplayServer::get_singleton()->window_set_ime_active(true, get_viewport()->get_window_id());
|
||||
DisplayServer::get_singleton()->window_set_ime_position(get_global_position() + cursor_pos, get_viewport()->get_window_id());
|
||||
}
|
||||
|
@ -1715,7 +1715,7 @@ void TextEdit::_notification(int p_what) {
|
|||
draw_caret = true;
|
||||
}
|
||||
|
||||
if (get_viewport()->get_window_id() != DisplayServer::INVALID_WINDOW_ID) {
|
||||
if (get_viewport()->get_window_id() != DisplayServer::INVALID_WINDOW_ID && DisplayServer::get_singleton()->has_feature(DisplayServer::FEATURE_IME)) {
|
||||
DisplayServer::get_singleton()->window_set_ime_active(true, get_viewport()->get_window_id());
|
||||
DisplayServer::get_singleton()->window_set_ime_position(get_global_position() + _get_cursor_pixel_pos(false), get_viewport()->get_window_id());
|
||||
}
|
||||
|
@ -1744,7 +1744,7 @@ void TextEdit::_notification(int p_what) {
|
|||
caret_blink_timer->stop();
|
||||
}
|
||||
|
||||
if (get_viewport()->get_window_id() != DisplayServer::INVALID_WINDOW_ID) {
|
||||
if (get_viewport()->get_window_id() != DisplayServer::INVALID_WINDOW_ID && DisplayServer::get_singleton()->has_feature(DisplayServer::FEATURE_IME)) {
|
||||
DisplayServer::get_singleton()->window_set_ime_position(Point2(), get_viewport()->get_window_id());
|
||||
DisplayServer::get_singleton()->window_set_ime_active(false, get_viewport()->get_window_id());
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue