text: Rename text_model to text_input

Also rename text_model_factory to text_input_manager.

Signed-off-by: Jan Arne Petersen <jpetersen@openismus.com>
diff --git a/clients/editor.c b/clients/editor.c
index c921c43..027b562 100644
--- a/clients/editor.c
+++ b/clients/editor.c
@@ -57,7 +57,7 @@
 		int32_t cursor;
 		int32_t anchor;
 	} pending_commit;
-	struct text_model *model;
+	struct text_input *text_input;
 	PangoLayout *layout;
 	struct {
 		xkb_mod_mask_t shift_mask;
@@ -69,7 +69,7 @@
 };
 
 struct editor {
-	struct text_model_factory *text_model_factory;
+	struct text_input_manager *text_input_manager;
 	struct display *display;
 	struct window *window;
 	struct widget *widget;
@@ -129,8 +129,8 @@
 static void text_entry_commit_and_reset(struct text_entry *entry);
 
 static void
-text_model_commit_string(void *data,
-			 struct text_model *text_model,
+text_input_commit_string(void *data,
+			 struct text_input *text_input,
 			 uint32_t serial,
 			 const char *text)
 {
@@ -149,8 +149,8 @@
 }
 
 static void
-text_model_preedit_string(void *data,
-			  struct text_model *text_model,
+text_input_preedit_string(void *data,
+			  struct text_input *text_input,
 			  uint32_t serial,
 			  const char *text,
 			  const char *commit)
@@ -169,8 +169,8 @@
 }
 
 static void
-text_model_delete_surrounding_text(void *data,
-				   struct text_model *text_model,
+text_input_delete_surrounding_text(void *data,
+				   struct text_input *text_input,
 				   uint32_t serial,
 				   int32_t index,
 				   uint32_t length)
@@ -201,8 +201,8 @@
 }
 
 static void
-text_model_cursor_position(void *data,
-			   struct text_model *text_model,
+text_input_cursor_position(void *data,
+			   struct text_input *text_input,
 			   uint32_t serial,
 			   int32_t index,
 			   int32_t anchor)
@@ -214,8 +214,8 @@
 }
 
 static void
-text_model_preedit_styling(void *data,
-			   struct text_model *text_model,
+text_input_preedit_styling(void *data,
+			   struct text_input *text_input,
 			   uint32_t serial,
 			   uint32_t index,
 			   uint32_t length,
@@ -229,24 +229,24 @@
 		entry->preedit_info.attr_list = pango_attr_list_new();
 
 	switch (style) {
-		case TEXT_MODEL_PREEDIT_STYLE_DEFAULT:
-		case TEXT_MODEL_PREEDIT_STYLE_UNDERLINE:
+		case TEXT_INPUT_PREEDIT_STYLE_DEFAULT:
+		case TEXT_INPUT_PREEDIT_STYLE_UNDERLINE:
 			attr1 = pango_attr_underline_new(PANGO_UNDERLINE_SINGLE);
 			break;
-		case TEXT_MODEL_PREEDIT_STYLE_INCORRECT:
+		case TEXT_INPUT_PREEDIT_STYLE_INCORRECT:
 			attr1 = pango_attr_underline_new(PANGO_UNDERLINE_ERROR);
 			attr2 = pango_attr_underline_color_new(65535, 0, 0);
 			break;
-		case TEXT_MODEL_PREEDIT_STYLE_SELECTION:
+		case TEXT_INPUT_PREEDIT_STYLE_SELECTION:
 			attr1 = pango_attr_background_new(0.3 * 65535, 0.3 * 65535, 65535);
 			attr2 = pango_attr_foreground_new(65535, 65535, 65535);
 			break;
-		case TEXT_MODEL_PREEDIT_STYLE_HIGHLIGHT:
-		case TEXT_MODEL_PREEDIT_STYLE_ACTIVE:
+		case TEXT_INPUT_PREEDIT_STYLE_HIGHLIGHT:
+		case TEXT_INPUT_PREEDIT_STYLE_ACTIVE:
 			attr1 = pango_attr_underline_new(PANGO_UNDERLINE_SINGLE);
 			attr2 = pango_attr_weight_new(PANGO_WEIGHT_BOLD);
 			break;
-		case TEXT_MODEL_PREEDIT_STYLE_INACTIVE:
+		case TEXT_INPUT_PREEDIT_STYLE_INACTIVE:
 			attr1 = pango_attr_underline_new(PANGO_UNDERLINE_SINGLE);
 			attr2 = pango_attr_foreground_new(0.3 * 65535, 0.3 * 65535, 0.3 * 65535);
 			break;
@@ -266,8 +266,8 @@
 }
 
 static void
-text_model_preedit_cursor(void *data,
-			  struct text_model *text_model,
+text_input_preedit_cursor(void *data,
+			  struct text_input *text_input,
 			  uint32_t serial,
 			  int32_t index)
 {
@@ -277,8 +277,8 @@
 }
 
 static void
-text_model_modifiers_map(void *data,
-			 struct text_model *text_model,
+text_input_modifiers_map(void *data,
+			 struct text_input *text_input,
 			 struct wl_array *map)
 {
 	struct text_entry *entry = data;
@@ -287,8 +287,8 @@
 }
 
 static void
-text_model_keysym(void *data,
-		  struct text_model *text_model,
+text_input_keysym(void *data,
+		  struct text_input *text_input,
 		  uint32_t serial,
 		  uint32_t time,
 		  uint32_t key,
@@ -356,8 +356,8 @@
 }
 
 static void
-text_model_enter(void *data,
-		 struct text_model *text_model,
+text_input_enter(void *data,
+		 struct text_input *text_input,
 		 struct wl_surface *surface)
 {
 	struct text_entry *entry = data;
@@ -371,8 +371,8 @@
 }
 
 static void
-text_model_leave(void *data,
-		 struct text_model *text_model)
+text_input_leave(void *data,
+		 struct text_input *text_input)
 {
 	struct text_entry *entry = data;
 
@@ -380,21 +380,21 @@
 
 	entry->active = 0;
 
-	text_model_hide_input_panel(text_model);
+	text_input_hide_input_panel(text_input);
 
 	widget_schedule_redraw(entry->widget);
 }
 
 static void
-text_model_input_panel_state(void *data,
-			     struct text_model *text_model,
+text_input_input_panel_state(void *data,
+			     struct text_input *text_input,
 			     uint32_t state)
 {
 }
 
 static void
-text_model_language(void *data,
-		    struct text_model *text_model,
+text_input_language(void *data,
+		    struct text_input *text_input,
 		    uint32_t serial,
 		    const char *language)
 {
@@ -402,8 +402,8 @@
 }
 
 static void
-text_model_text_direction(void *data,
-			  struct text_model *text_model,
+text_input_text_direction(void *data,
+			  struct text_input *text_input,
 			  uint32_t serial,
 			  uint32_t direction)
 {
@@ -413,13 +413,13 @@
 
 
 	switch (direction) {
-		case TEXT_MODEL_TEXT_DIRECTION_LTR:
+		case TEXT_INPUT_TEXT_DIRECTION_LTR:
 			pango_direction = PANGO_DIRECTION_LTR;
 			break;
-		case TEXT_MODEL_TEXT_DIRECTION_RTL:
+		case TEXT_INPUT_TEXT_DIRECTION_RTL:
 			pango_direction = PANGO_DIRECTION_RTL;
 			break;
-		case TEXT_MODEL_TEXT_DIRECTION_AUTO:
+		case TEXT_INPUT_TEXT_DIRECTION_AUTO:
 		default:
 			pango_direction = PANGO_DIRECTION_NEUTRAL;
 	}
@@ -427,20 +427,20 @@
 	pango_context_set_base_dir(context, pango_direction);
 }
 
-static const struct text_model_listener text_model_listener = {
-	text_model_enter,
-	text_model_leave,
-	text_model_modifiers_map,
-	text_model_input_panel_state,
-	text_model_preedit_string,
-	text_model_preedit_styling,
-	text_model_preedit_cursor,
-	text_model_commit_string,
-	text_model_cursor_position,
-	text_model_delete_surrounding_text,
-	text_model_keysym,
-	text_model_language,
-	text_model_text_direction
+static const struct text_input_listener text_input_listener = {
+	text_input_enter,
+	text_input_leave,
+	text_input_modifiers_map,
+	text_input_input_panel_state,
+	text_input_preedit_string,
+	text_input_preedit_styling,
+	text_input_preedit_cursor,
+	text_input_commit_string,
+	text_input_cursor_position,
+	text_input_delete_surrounding_text,
+	text_input_keysym,
+	text_input_language,
+	text_input_text_direction
 };
 
 static struct text_entry*
@@ -456,8 +456,8 @@
 	entry->active = 0;
 	entry->cursor = strlen(text);
 	entry->anchor = entry->cursor;
-	entry->model = text_model_factory_create_text_model(editor->text_model_factory);
-	text_model_add_listener(entry->model, &text_model_listener, entry);
+	entry->text_input = text_input_manager_create_text_input(editor->text_input_manager);
+	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);
@@ -469,7 +469,7 @@
 text_entry_destroy(struct text_entry *entry)
 {
 	widget_destroy(entry->widget);
-	text_model_destroy(entry->model);
+	text_input_destroy(entry->text_input);
 	g_clear_object(&entry->layout);
 	free(entry->text);
 	free(entry);
@@ -537,17 +537,17 @@
 	struct wl_surface *surface = window_get_wl_surface(entry->window);
 
 	if (entry->click_to_show && entry->active) {
-		text_model_show_input_panel(entry->model);
+		text_input_show_input_panel(entry->text_input);
 
 		return;
 	}
 
 	if (!entry->click_to_show)
-		text_model_show_input_panel(entry->model);
+		text_input_show_input_panel(entry->text_input);
 
 	entry->serial++;
 
-	text_model_activate(entry->model,
+	text_input_activate(entry->text_input,
 			    entry->serial,
 			    seat,
 			    surface);
@@ -557,7 +557,7 @@
 text_entry_deactivate(struct text_entry *entry,
 		      struct wl_seat *seat)
 {
-	text_model_deactivate(entry->model,
+	text_input_deactivate(entry->text_input,
 			      seat);
 }
 
@@ -627,20 +627,20 @@
 static void
 text_entry_update(struct text_entry *entry)
 {
-	text_model_set_content_type(entry->model,
-				    TEXT_MODEL_CONTENT_HINT_NONE,
+	text_input_set_content_type(entry->text_input,
+				    TEXT_INPUT_CONTENT_HINT_NONE,
 				    entry->content_purpose);
 
-	text_model_set_surrounding_text(entry->model,
+	text_input_set_surrounding_text(entry->text_input,
 					entry->text,
 					entry->cursor,
 					entry->anchor);
 
 	if (entry->preferred_language)
-		text_model_set_preferred_language(entry->model,
+		text_input_set_preferred_language(entry->text_input,
 						  entry->preferred_language);
 
-	text_model_commit_state(entry->model);
+	text_input_commit_state(entry->text_input);
 }
 
 static void
@@ -702,7 +702,7 @@
 	}
 
 	entry->serial++;
-	text_model_reset(entry->model, entry->serial);
+	text_input_reset(entry->text_input, entry->serial);
 }
 
 static void
@@ -746,7 +746,7 @@
 	}
 
 	if (state == WL_POINTER_BUTTON_STATE_RELEASED)
-		text_model_invoke_action(entry->model,
+		text_input_invoke_action(entry->text_input,
 					 button,
 					 cursor - entry->cursor);
 
@@ -1073,10 +1073,10 @@
 {
 	struct editor *editor = data;
 
-	if (!strcmp(interface, "text_model_factory")) {
-		editor->text_model_factory =
+	if (!strcmp(interface, "text_input_manager")) {
+		editor->text_input_manager =
 			display_bind(display, name,
-				     &text_model_factory_interface, 1);
+				     &text_input_manager_interface, 1);
 	}
 }
 
@@ -1122,7 +1122,7 @@
 	if (preferred_language)
 		editor.entry->preferred_language = strdup(preferred_language);
 	editor.editor = text_entry_create(&editor, "Numeric");
-	editor.editor->content_purpose = TEXT_MODEL_CONTENT_PURPOSE_NUMBER;
+	editor.editor->content_purpose = TEXT_INPUT_CONTENT_PURPOSE_NUMBER;
 	editor.editor->click_to_show = click_to_show;
 
 	window_set_title(editor.window, "Text Editor");