text: Fix set_surrounding_text request

Add cursor and anchor positions as arguments to the set_surrounding_text
request. The cursor and anchor positions are relative to the surrounded
text, so it does not make sense to have that separate. Remove the
separate set_cursor_index and set_selected_text requests. Also update
the corresponding event in input-method-context and add support for it
in the weston example keyboard.

Signed-off-by: Jan Arne Petersen <jpetersen@openismus.com>
diff --git a/src/text-backend.c b/src/text-backend.c
index 7ae023a..ed2e24c 100644
--- a/src/text-backend.c
+++ b/src/text-backend.c
@@ -109,7 +109,9 @@
 static void
 text_model_set_surrounding_text(struct wl_client *client,
 				struct wl_resource *resource,
-				const char *text)
+				const char *text,
+				uint32_t cursor,
+				uint32_t anchor)
 {
 	struct text_model *text_model = resource->data;
 	struct input_method *input_method, *next;
@@ -117,18 +119,14 @@
 	wl_list_for_each_safe(input_method, next, &text_model->input_methods, link) {
 		if (!input_method->context)
 			continue;
-		input_method_context_send_set_surrounding_text(&input_method->context->resource, text);
+		input_method_context_send_surrounding_text(&input_method->context->resource,
+							   text,
+							   cursor,
+							   anchor);
 	}
 }
 
 static void
-text_model_set_cursor_index(struct wl_client *client,
-			    struct wl_resource *resource,
-			    uint32_t index)
-{
-}
-
-static void
 text_model_activate(struct wl_client *client,
 	            struct wl_resource *resource,
 		    struct wl_resource *seat,
@@ -174,14 +172,6 @@
 }
 
 static void
-text_model_set_selected_text(struct wl_client *client,
-			     struct wl_resource *resource,
-			     const char *text,
-			     int32_t index)
-{
-}
-
-static void
 text_model_set_micro_focus(struct wl_client *client,
 			   struct wl_resource *resource,
 			   int32_t x,
@@ -205,10 +195,8 @@
 
 static const struct text_model_interface text_model_implementation = {
 	text_model_set_surrounding_text,
-	text_model_set_cursor_index,
 	text_model_activate,
 	text_model_deactivate,
-	text_model_set_selected_text,
 	text_model_set_micro_focus,
 	text_model_set_preedit,
 	text_model_set_content_type