Merge pull request #23923 from bruvzg/ime_gdscript
Changes IME to make it possible to use it from gdscript/gdnative
This commit is contained in:
commit
4c41e29c8e
14 changed files with 87 additions and 43 deletions
|
|
@ -1438,7 +1438,6 @@ void TextEdit::_notification(int p_what) {
|
|||
if (has_focus()) {
|
||||
OS::get_singleton()->set_ime_active(true);
|
||||
OS::get_singleton()->set_ime_position(get_global_position() + cursor_pos + Point2(0, get_row_height()));
|
||||
OS::get_singleton()->set_ime_intermediate_text_callback(_ime_text_callback, this);
|
||||
}
|
||||
|
||||
} break;
|
||||
|
|
@ -1451,7 +1450,6 @@ void TextEdit::_notification(int p_what) {
|
|||
OS::get_singleton()->set_ime_active(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);
|
||||
OS::get_singleton()->set_ime_intermediate_text_callback(_ime_text_callback, this);
|
||||
|
||||
if (OS::get_singleton()->has_virtual_keyboard())
|
||||
OS::get_singleton()->show_virtual_keyboard(get_text(), get_global_rect());
|
||||
|
|
@ -1459,7 +1457,6 @@ void TextEdit::_notification(int p_what) {
|
|||
case NOTIFICATION_FOCUS_EXIT: {
|
||||
|
||||
OS::get_singleton()->set_ime_position(Point2());
|
||||
OS::get_singleton()->set_ime_intermediate_text_callback(NULL, NULL);
|
||||
OS::get_singleton()->set_ime_active(false);
|
||||
ime_text = "";
|
||||
ime_selection = Point2();
|
||||
|
|
@ -1467,14 +1464,13 @@ void TextEdit::_notification(int p_what) {
|
|||
if (OS::get_singleton()->has_virtual_keyboard())
|
||||
OS::get_singleton()->hide_virtual_keyboard();
|
||||
} break;
|
||||
}
|
||||
}
|
||||
case MainLoop::NOTIFICATION_OS_IME_UPDATE: {
|
||||
|
||||
void TextEdit::_ime_text_callback(void *p_self, String p_text, Point2 p_selection) {
|
||||
TextEdit *self = (TextEdit *)p_self;
|
||||
self->ime_text = p_text;
|
||||
self->ime_selection = p_selection;
|
||||
self->update();
|
||||
ime_text = OS::get_singleton()->get_ime_text();
|
||||
ime_selection = OS::get_singleton()->get_ime_selection();
|
||||
update();
|
||||
} break;
|
||||
}
|
||||
}
|
||||
|
||||
void TextEdit::_consume_pair_symbol(CharType ch) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue