You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-17 14:11:06 +00:00
IME window follow the input cursor.
Abstruct set_ime_position to OS class. Update ime position for LineEdit and TextEdit.
This commit is contained in:
@@ -1191,12 +1191,19 @@ void TextEdit::_notification(int p_what) {
|
||||
}
|
||||
}
|
||||
|
||||
if (has_focus()) {
|
||||
OS::get_singleton()->set_ime_position(get_global_position() + cursor_pos + Point2(0, get_row_height()));
|
||||
}
|
||||
} break;
|
||||
case NOTIFICATION_FOCUS_ENTER: {
|
||||
|
||||
if (!caret_blink_enabled) {
|
||||
draw_caret = true;
|
||||
}
|
||||
|
||||
Point2 cursor_pos = Point2(cursor_get_column(), cursor_get_line()) * get_row_height();
|
||||
OS::get_singleton()->set_ime_position(get_global_position() + cursor_pos);
|
||||
|
||||
if (OS::get_singleton()->has_virtual_keyboard())
|
||||
OS::get_singleton()->show_virtual_keyboard(get_text(), get_global_rect());
|
||||
if (raised_from_completion) {
|
||||
@@ -1206,6 +1213,8 @@ void TextEdit::_notification(int p_what) {
|
||||
} break;
|
||||
case NOTIFICATION_FOCUS_EXIT: {
|
||||
|
||||
OS::get_singleton()->set_ime_position(Point2());
|
||||
|
||||
if (OS::get_singleton()->has_virtual_keyboard())
|
||||
OS::get_singleton()->hide_virtual_keyboard();
|
||||
if (raised_from_completion) {
|
||||
|
||||
Reference in New Issue
Block a user