static struct text_entry* text_entry_create(struct editor *editor, const char *text) { struct text_entry *entry; entry = calloc(1, sizeof *entry); entry->widget = widget_add_widget(editor->widget, entry); entry->window = editor->window; entry->text = strdup(text); entry->active = 0; entry->cursor = strlen(text); entry->anchor = entry->cursor; entry->preedit_text = NULL; entry->preedit_cursor = 0; entry->model = text_model_factory_create_text_model(editor->text_model_factory); text_model_add_listener(entry->model, &text_model_listener, entry); entry->layout = text_layout_create(); text_layout_set_text(entry->layout, entry->text); widget_set_redraw_handler(entry->widget, text_entry_redraw_handler); widget_set_button_handler(entry->widget, text_entry_button_handler); return entry; }
static struct text_entry* text_entry_create(struct editor *editor, const char *text) { struct text_entry *entry; entry = calloc(1, sizeof *entry); entry->widget = widget_add_widget(editor->widget, entry); entry->window = editor->window; entry->text = strdup(text); entry->active = 0; entry->cursor = strlen(text); entry->anchor = entry->cursor; entry->text_input = wl_text_input_manager_create_text_input(editor->text_input_manager); wl_text_input_add_listener(entry->text_input, &text_input_listener, entry); widget_set_redraw_handler(entry->widget, text_entry_redraw_handler); widget_set_button_handler(entry->widget, text_entry_button_handler); return entry; }