{
entry->cursor = text_layout_xy_to_index(entry->layout, x, y);
+ text_model_reset(entry->model);
+
if (entry->cursor >= entry->preedit_cursor) {
entry->cursor -= entry->preedit_cursor;
}
fprintf(stderr, "Surrounding text updated: %s\n", text);
}
+static void
+input_method_context_reset(void *data,
+ struct input_method_context *context)
+{
+ struct virtual_keyboard *keyboard = data;
+
+ fprintf(stderr, "Reset pre-edit buffer\n");
+
+ if (strlen(keyboard->preedit_string)) {
+ input_method_context_preedit_string(context,
+ "",
+ 0);
+ free(keyboard->preedit_string);
+ keyboard->preedit_string = strdup("");
+ }
+}
+
static const struct input_method_context_listener input_method_context_listener = {
input_method_context_surrounding_text,
+ input_method_context_reset
};
static void
<arg name="cursor" type="uint"/>
<arg name="anchor" type="uint"/>
</event>
+ <event name="reset">
+ </event>
</interface>
<interface name="input_method" version="1">
</description>
<arg name="seat" type="object" interface="wl_seat"/>
</request>
+ <request name="reset">
+ </request>
<request name="set_micro_focus">
<arg name="x" type="int"/>
<arg name="y" type="int"/>
}
static void
+text_model_reset(struct wl_client *client,
+ struct wl_resource *resource)
+{
+ struct text_model *text_model = resource->data;
+ struct input_method *input_method, *next;
+
+ wl_list_for_each_safe(input_method, next, &text_model->input_methods, link) {
+ if (!input_method->context)
+ continue;
+ input_method_context_send_reset(&input_method->context->resource);
+ }
+}
+
+static void
text_model_set_micro_focus(struct wl_client *client,
struct wl_resource *resource,
int32_t x,
text_model_set_surrounding_text,
text_model_activate,
text_model_deactivate,
+ text_model_reset,
text_model_set_micro_focus,
text_model_set_preedit,
text_model_set_content_type