text: handle existing seats on init

a following patch will be moving text init call into shell
modules, which will be called much later than in current code

Signed-off-by: Murray Calavera <murray.calavera@gmail.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
dev
Murray Calavera 10 years ago committed by Pekka Paalanen
parent 883ac02d22
commit 2588124cc3
  1. 27
      src/text-backend.c

@ -933,13 +933,9 @@ launch_input_method(struct text_backend *text_backend)
} }
static void static void
handle_seat_created(struct wl_listener *listener, text_backend_seat_created(struct text_backend *text_backend,
void *data) struct weston_seat *seat)
{ {
struct weston_seat *seat = data;
struct text_backend *text_backend =
container_of(listener, struct text_backend,
seat_created_listener);
struct input_method *input_method; struct input_method *input_method;
struct weston_compositor *ec = seat->compositor; struct weston_compositor *ec = seat->compositor;
@ -965,6 +961,17 @@ handle_seat_created(struct wl_listener *listener,
launch_input_method(text_backend); launch_input_method(text_backend);
} }
static void
handle_seat_created(struct wl_listener *listener, void *data)
{
struct weston_seat *seat = data;
struct text_backend *text_backend =
container_of(listener, struct text_backend,
seat_created_listener);
text_backend_seat_created(text_backend, seat);
}
static void static void
text_backend_configuration(struct text_backend *text_backend) text_backend_configuration(struct text_backend *text_backend)
{ {
@ -998,11 +1005,11 @@ text_backend_notifier_destroy(struct wl_listener *listener, void *data)
free(text_backend); free(text_backend);
} }
WL_EXPORT int WL_EXPORT int
text_backend_init(struct weston_compositor *ec) text_backend_init(struct weston_compositor *ec)
{ {
struct text_backend *text_backend; struct text_backend *text_backend;
struct weston_seat *seat;
text_backend = zalloc(sizeof(*text_backend)); text_backend = zalloc(sizeof(*text_backend));
if (text_backend == NULL) if (text_backend == NULL)
@ -1010,6 +1017,10 @@ text_backend_init(struct weston_compositor *ec)
text_backend->compositor = ec; text_backend->compositor = ec;
text_backend_configuration(text_backend);
wl_list_for_each(seat, &ec->seat_list, link)
text_backend_seat_created(text_backend, seat);
text_backend->seat_created_listener.notify = handle_seat_created; text_backend->seat_created_listener.notify = handle_seat_created;
wl_signal_add(&ec->seat_created_signal, wl_signal_add(&ec->seat_created_signal,
&text_backend->seat_created_listener); &text_backend->seat_created_listener);
@ -1017,8 +1028,6 @@ text_backend_init(struct weston_compositor *ec)
text_backend->destroy_listener.notify = text_backend_notifier_destroy; text_backend->destroy_listener.notify = text_backend_notifier_destroy;
wl_signal_add(&ec->destroy_signal, &text_backend->destroy_listener); wl_signal_add(&ec->destroy_signal, &text_backend->destroy_listener);
text_backend_configuration(text_backend);
text_input_manager_create(ec); text_input_manager_create(ec);
return 0; return 0;

Loading…
Cancel
Save