Defer launch input method with wl_event_loop_add_idle.

Input method process may also be a XIM server which requires the correct
DISPLAY to be set after xwayland start up. This helps input method to
work for both wayland and Xwayland.

Signed-off-by: Weng Xuetian <wengxt@gmail.com>
dev
Weng Xuetian 3 years ago
parent 8fb529bc31
commit e99ed2ad36
No known key found for this signature in database
GPG Key ID: 8E8B898CBF2412F9
  1. 10
      compositor/text-backend.c

@ -949,7 +949,7 @@ input_method_init_seat(struct weston_seat *seat)
seat->input_method->focus_listener_initialized = true; seat->input_method->focus_listener_initialized = true;
} }
static void launch_input_method(struct text_backend *text_backend); static void launch_input_method(void *data);
static void static void
respawn_input_method_process(struct text_backend *text_backend) respawn_input_method_process(struct text_backend *text_backend)
@ -989,8 +989,10 @@ input_method_client_notifier(struct wl_listener *listener, void *data)
} }
static void static void
launch_input_method(struct text_backend *text_backend) launch_input_method(void *data)
{ {
struct text_backend *text_backend = data;
if (!text_backend->input_method.path) if (!text_backend->input_method.path)
return; return;
@ -1093,6 +1095,7 @@ text_backend_init(struct weston_compositor *ec)
{ {
struct text_backend *text_backend; struct text_backend *text_backend;
struct weston_seat *seat; struct weston_seat *seat;
struct wl_event_loop *loop;
text_backend = zalloc(sizeof(*text_backend)); text_backend = zalloc(sizeof(*text_backend));
if (text_backend == NULL) if (text_backend == NULL)
@ -1110,7 +1113,8 @@ text_backend_init(struct weston_compositor *ec)
text_input_manager_create(ec); text_input_manager_create(ec);
launch_input_method(text_backend); loop = wl_display_get_event_loop(ec->wl_display);
wl_event_loop_add_idle(loop, launch_input_method, text_backend);
return text_backend; return text_backend;
} }

Loading…
Cancel
Save