diff options
author | RĂ©mi Verschelde <rverschelde@gmail.com> | 2017-07-11 17:07:14 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-07-11 17:07:14 +0200 |
commit | a5bb77d5232668045fc2fb82637b00b5295b8741 (patch) | |
tree | 4d90c5017f1557b381d43eb7d4b805e9c3b0d9f0 /scene/gui/line_edit.cpp | |
parent | faae28c9551a8e57577762e8e7ed84d0d66c0744 (diff) | |
parent | 7358766ff69e064d8a31b18c54e3c1e22e303cb6 (diff) |
Merge pull request #9366 from GodotExplorer/pr-ime-position-flow-cursor
IME window follow the input cursor.
Diffstat (limited to 'scene/gui/line_edit.cpp')
-rw-r--r-- | scene/gui/line_edit.cpp | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/scene/gui/line_edit.cpp b/scene/gui/line_edit.cpp index bc579020bd..8d3271ca8c 100644 --- a/scene/gui/line_edit.cpp +++ b/scene/gui/line_edit.cpp @@ -660,6 +660,11 @@ void LineEdit::_notification(int p_what) { Point2(x_ofs, y_ofs), Size2(1, caret_height)), cursor_color); } + + if (has_focus()) { + + OS::get_singleton()->set_ime_position(get_global_position() + Point2(x_ofs, y_ofs + caret_height)); + } } break; case NOTIFICATION_FOCUS_ENTER: { @@ -667,12 +672,17 @@ void LineEdit::_notification(int p_what) { draw_caret = true; } + Point2 cursor_pos = Point2(get_cursor_pos(), 1) * get_minimum_size().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(text, get_global_rect()); } 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(); |