text-input: Replace model with input

commit 78d00e45cc renamed text_model to text_input

This cleans up remaining uses of the word "model"

Reviewed-by: Jan Arne Petersen <janarne@gmail.com>
Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
Signed-off-by: Derek Foreman <derekf@osg.samsung.com>
dev
Derek Foreman 10 years ago committed by Bryce Harrington
parent 516d603515
commit 0f29923e30
  1. 18
      protocol/input-method.xml
  2. 70
      src/text-backend.c

@ -28,9 +28,9 @@
<interface name="wl_input_method_context" version="1"> <interface name="wl_input_method_context" version="1">
<description summary="input method context"> <description summary="input method context">
Corresponds to a text model on input method side. An input method context Corresponds to a text input on input method side. An input method context
is created on text model activation on the input method side. It allows to is created on text input activation on the input method side. It allows to
receive information about the text model from the application via events. receive information about the text input from the application via events.
Input method contexts do not keep state after deactivation and should be Input method contexts do not keep state after deactivation and should be
destroyed after deactivation is handled. destroyed after deactivation is handled.
@ -220,18 +220,18 @@
An input method object is responsible to compose text in response to An input method object is responsible to compose text in response to
input from hardware or virtual keyboards. There is one input method input from hardware or virtual keyboards. There is one input method
object per seat. On activate there is a new input method context object object per seat. On activate there is a new input method context object
created which allows the input method to communicate with the text model. created which allows the input method to communicate with the text input.
</description> </description>
<event name="activate"> <event name="activate">
<description summary="activate event"> <description summary="activate event">
A text model was activated. Creates an input method context object A text input was activated. Creates an input method context object
which allows communication with the text model. which allows communication with the text input.
</description> </description>
<arg name="id" type="new_id" interface="wl_input_method_context"/> <arg name="id" type="new_id" interface="wl_input_method_context"/>
</event> </event>
<event name="deactivate"> <event name="deactivate">
<description summary="deactivate event"> <description summary="deactivate event">
The text model corresponding to the context argument was deactivated. The text input corresponding to the context argument was deactivated.
The input method context should be destroyed after deactivation is The input method context should be destroyed after deactivation is
handled. handled.
</description> </description>
@ -257,7 +257,7 @@
<request name="set_toplevel"> <request name="set_toplevel">
<description summary="set the surface type as a keyboard"> <description summary="set the surface type as a keyboard">
A keyboard surface is only shown, when a text model is active A keyboard surface is only shown when a text input is active.
</description> </description>
<arg name="output" type="object" interface="wl_output"/> <arg name="output" type="object" interface="wl_output"/>
<arg name="position" type="uint"/> <arg name="position" type="uint"/>
@ -266,7 +266,7 @@
<request name="set_overlay_panel"> <request name="set_overlay_panel">
<description summary="set the surface type as an overlay panel"> <description summary="set the surface type as an overlay panel">
An overlay panel is shown near the input cursor above the application An overlay panel is shown near the input cursor above the application
window when a text model is active. window when a text input is active.
</description> </description>
</request> </request>
</interface> </interface>

@ -69,7 +69,7 @@ struct input_method {
struct wl_listener destroy_listener; struct wl_listener destroy_listener;
struct weston_seat *seat; struct weston_seat *seat;
struct text_input *model; struct text_input *input;
struct wl_list link; struct wl_list link;
@ -85,7 +85,7 @@ struct input_method {
struct input_method_context { struct input_method_context {
struct wl_resource *resource; struct wl_resource *resource;
struct text_input *model; struct text_input *input;
struct input_method *input_method; struct input_method *input_method;
struct wl_resource *keyboard; struct wl_resource *keyboard;
@ -109,7 +109,7 @@ struct text_backend {
}; };
static void static void
input_method_context_create(struct text_input *model, input_method_context_create(struct text_input *input,
struct input_method *input_method); struct input_method *input_method);
static void static void
input_method_context_end_keyboard_grab(struct input_method_context *context); input_method_context_end_keyboard_grab(struct input_method_context *context);
@ -120,7 +120,7 @@ input_method_init_seat(struct weston_seat *seat);
static void static void
deactivate_input_method(struct input_method *input_method) deactivate_input_method(struct input_method *input_method)
{ {
struct text_input *text_input = input_method->model; struct text_input *text_input = input_method->input;
struct weston_compositor *ec = text_input->ec; struct weston_compositor *ec = text_input->ec;
if (input_method->context && input_method->input_method_binding) { if (input_method->context && input_method->input_method_binding) {
@ -130,7 +130,7 @@ deactivate_input_method(struct input_method *input_method)
} }
wl_list_remove(&input_method->link); wl_list_remove(&input_method->link);
input_method->model = NULL; input_method->input = NULL;
input_method->context = NULL; input_method->context = NULL;
if (wl_list_empty(&text_input->input_methods) && if (wl_list_empty(&text_input->input_methods) &&
@ -186,13 +186,13 @@ text_input_activate(struct wl_client *client,
struct weston_compositor *ec = text_input->ec; struct weston_compositor *ec = text_input->ec;
struct text_input *current; struct text_input *current;
if (input_method->model == text_input) if (input_method->input == text_input)
return; return;
if (input_method->model) if (input_method->input)
deactivate_input_method(input_method); deactivate_input_method(input_method);
input_method->model = text_input; input_method->input = text_input;
wl_list_insert(&text_input->input_methods, &input_method->link); wl_list_insert(&text_input->input_methods, &input_method->link);
input_method_init_seat(weston_seat); input_method_init_seat(weston_seat);
@ -224,7 +224,7 @@ text_input_deactivate(struct wl_client *client,
{ {
struct weston_seat *weston_seat = wl_resource_get_user_data(seat); struct weston_seat *weston_seat = wl_resource_get_user_data(seat);
if (weston_seat->input_method->model) if (weston_seat->input_method->input)
deactivate_input_method(weston_seat->input_method); deactivate_input_method(weston_seat->input_method);
} }
@ -462,8 +462,8 @@ input_method_context_commit_string(struct wl_client *client,
struct input_method_context *context = struct input_method_context *context =
wl_resource_get_user_data(resource); wl_resource_get_user_data(resource);
if (context->model) if (context->input)
wl_text_input_send_commit_string(context->model->resource, wl_text_input_send_commit_string(context->input->resource,
serial, text); serial, text);
} }
@ -477,8 +477,8 @@ input_method_context_preedit_string(struct wl_client *client,
struct input_method_context *context = struct input_method_context *context =
wl_resource_get_user_data(resource); wl_resource_get_user_data(resource);
if (context->model) if (context->input)
wl_text_input_send_preedit_string(context->model->resource, wl_text_input_send_preedit_string(context->input->resource,
serial, text, commit); serial, text, commit);
} }
@ -492,8 +492,8 @@ input_method_context_preedit_styling(struct wl_client *client,
struct input_method_context *context = struct input_method_context *context =
wl_resource_get_user_data(resource); wl_resource_get_user_data(resource);
if (context->model) if (context->input)
wl_text_input_send_preedit_styling(context->model->resource, wl_text_input_send_preedit_styling(context->input->resource,
index, length, style); index, length, style);
} }
@ -505,8 +505,8 @@ input_method_context_preedit_cursor(struct wl_client *client,
struct input_method_context *context = struct input_method_context *context =
wl_resource_get_user_data(resource); wl_resource_get_user_data(resource);
if (context->model) if (context->input)
wl_text_input_send_preedit_cursor(context->model->resource, wl_text_input_send_preedit_cursor(context->input->resource,
cursor); cursor);
} }
@ -519,8 +519,8 @@ input_method_context_delete_surrounding_text(struct wl_client *client,
struct input_method_context *context = struct input_method_context *context =
wl_resource_get_user_data(resource); wl_resource_get_user_data(resource);
if (context->model) if (context->input)
wl_text_input_send_delete_surrounding_text(context->model->resource, wl_text_input_send_delete_surrounding_text(context->input->resource,
index, length); index, length);
} }
@ -533,8 +533,8 @@ input_method_context_cursor_position(struct wl_client *client,
struct input_method_context *context = struct input_method_context *context =
wl_resource_get_user_data(resource); wl_resource_get_user_data(resource);
if (context->model) if (context->input)
wl_text_input_send_cursor_position(context->model->resource, wl_text_input_send_cursor_position(context->input->resource,
index, anchor); index, anchor);
} }
@ -546,8 +546,8 @@ input_method_context_modifiers_map(struct wl_client *client,
struct input_method_context *context = struct input_method_context *context =
wl_resource_get_user_data(resource); wl_resource_get_user_data(resource);
if (context->model) if (context->input)
wl_text_input_send_modifiers_map(context->model->resource, map); wl_text_input_send_modifiers_map(context->input->resource, map);
} }
static void static void
@ -562,8 +562,8 @@ input_method_context_keysym(struct wl_client *client,
struct input_method_context *context = struct input_method_context *context =
wl_resource_get_user_data(resource); wl_resource_get_user_data(resource);
if (context->model) if (context->input)
wl_text_input_send_keysym(context->model->resource, wl_text_input_send_keysym(context->input->resource,
serial, time, sym, state, modifiers); serial, time, sym, state, modifiers);
} }
@ -692,8 +692,8 @@ input_method_context_language(struct wl_client *client,
{ {
struct input_method_context *context = wl_resource_get_user_data(resource); struct input_method_context *context = wl_resource_get_user_data(resource);
if (context->model) if (context->input)
wl_text_input_send_language(context->model->resource, wl_text_input_send_language(context->input->resource,
serial, language); serial, language);
} }
@ -705,8 +705,8 @@ input_method_context_text_direction(struct wl_client *client,
{ {
struct input_method_context *context = wl_resource_get_user_data(resource); struct input_method_context *context = wl_resource_get_user_data(resource);
if (context->model) if (context->input)
wl_text_input_send_text_direction(context->model->resource, wl_text_input_send_text_direction(context->input->resource,
serial, direction); serial, direction);
} }
@ -744,7 +744,7 @@ destroy_input_method_context(struct wl_resource *resource)
} }
static void static void
input_method_context_create(struct text_input *model, input_method_context_create(struct text_input *input,
struct input_method *input_method) struct input_method *input_method)
{ {
struct input_method_context *context; struct input_method_context *context;
@ -765,7 +765,7 @@ input_method_context_create(struct text_input *model,
&input_method_context_implementation, &input_method_context_implementation,
context, destroy_input_method_context); context, destroy_input_method_context);
context->model = model; context->input = input;
context->input_method = input_method; context->input_method = input_method;
input_method->context = context; input_method->context = context;
@ -843,7 +843,7 @@ input_method_notifier_destroy(struct wl_listener *listener, void *data)
struct input_method *input_method = struct input_method *input_method =
container_of(listener, struct input_method, destroy_listener); container_of(listener, struct input_method, destroy_listener);
if (input_method->model) if (input_method->input)
deactivate_input_method(input_method); deactivate_input_method(input_method);
wl_global_destroy(input_method->input_method_global); wl_global_destroy(input_method->input_method_global);
@ -860,10 +860,10 @@ handle_keyboard_focus(struct wl_listener *listener, void *data)
container_of(listener, struct input_method, keyboard_focus_listener); container_of(listener, struct input_method, keyboard_focus_listener);
struct weston_surface *surface = keyboard->focus; struct weston_surface *surface = keyboard->focus;
if (!input_method->model) if (!input_method->input)
return; return;
if (!surface || input_method->model->surface != surface) if (!surface || input_method->input->surface != surface)
deactivate_input_method(input_method); deactivate_input_method(input_method);
} }
@ -948,7 +948,7 @@ handle_seat_created(struct wl_listener *listener,
return; return;
input_method->seat = seat; input_method->seat = seat;
input_method->model = NULL; input_method->input = NULL;
input_method->focus_listener_initialized = 0; input_method->focus_listener_initialized = 0;
input_method->context = NULL; input_method->context = NULL;
input_method->text_backend = text_backend; input_method->text_backend = text_backend;

Loading…
Cancel
Save