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/tests/text-test.c b/tests/text-test.c
index 8983ac4..1feae66 100644
--- a/tests/text-test.c
+++ b/tests/text-test.c
@@ -26,22 +26,22 @@
#include "weston-test-client-helper.h"
#include "../clients/text-client-protocol.h"
-struct text_model_state {
+struct text_input_state {
int activated;
int deactivated;
};
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)
{
}
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)
@@ -49,8 +49,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)
@@ -58,8 +58,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)
@@ -67,8 +67,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,
@@ -77,23 +77,23 @@
}
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)
{
}
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)
{
}
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 sym,
@@ -103,12 +103,12 @@
}
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_model_state *state = data;
+ struct text_input_state *state = data;
fprintf(stderr, "%s\n", __FUNCTION__);
@@ -116,77 +116,77 @@
}
static void
-text_model_leave(void *data,
- struct text_model *text_model)
+text_input_leave(void *data,
+ struct text_input *text_input)
{
- struct text_model_state *state = data;
+ struct text_input_state *state = data;
state->deactivated += 1;
}
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)
{
}
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)
{
}
-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
};
TEST(text_test)
{
struct client *client;
struct global *global;
- struct text_model_factory *factory;
- struct text_model *text_model;
- struct text_model_state state;
+ struct text_input_manager *factory;
+ struct text_input *text_input;
+ struct text_input_state state;
client = client_create(100, 100, 100, 100);
assert(client);
factory = NULL;
wl_list_for_each(global, &client->global_list, link) {
- if (strcmp(global->interface, "text_model_factory") == 0)
+ if (strcmp(global->interface, "text_input_manager") == 0)
factory = wl_registry_bind(client->wl_registry,
global->name,
- &text_model_factory_interface, 1);
+ &text_input_manager_interface, 1);
}
assert(factory);
memset(&state, 0, sizeof state);
- text_model = text_model_factory_create_text_model(factory);
- text_model_add_listener(text_model, &text_model_listener, &state);
+ text_input = text_input_manager_create_text_input(factory);
+ text_input_add_listener(text_input, &text_input_listener, &state);
/* Make sure our test surface has keyboard focus. */
wl_test_activate_surface(client->test->wl_test,
@@ -195,18 +195,18 @@
assert(client->input->keyboard->focus == client->surface);
/* Activate test model and make sure we get enter event. */
- text_model_activate(text_model, 0, client->input->wl_seat,
+ text_input_activate(text_input, 0, client->input->wl_seat,
client->surface->wl_surface);
client_roundtrip(client);
assert(state.activated == 1 && state.deactivated == 0);
/* Deactivate test model and make sure we get leave event. */
- text_model_deactivate(text_model, client->input->wl_seat);
+ text_input_deactivate(text_input, client->input->wl_seat);
client_roundtrip(client);
assert(state.activated == 1 && state.deactivated == 1);
/* Activate test model again. */
- text_model_activate(text_model, 0, client->input->wl_seat,
+ text_input_activate(text_input, 0, client->input->wl_seat,
client->surface->wl_surface);
client_roundtrip(client);
assert(state.activated == 2 && state.deactivated == 1);