compositor-wayland: Delay seat creation
We'll get a rash of seats added when we run our first wl_display_iterate across the parent display, but won't actually be ready to create them. Create a new global listener on our parent display for wl_seats only, and run that from wayland_input_create. Signed-off-by: Daniel Stone <daniel@fooishbar.org>
This commit is contained in:
committed by
Kristian Høgsberg
parent
670b5d343d
commit
a497d57619
+37
-19
@@ -245,23 +245,6 @@ create_border(struct wayland_compositor *c)
|
|||||||
pixman_image_unref(image);
|
pixman_image_unref(image);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
|
||||||
wayland_input_create(struct wayland_compositor *c)
|
|
||||||
{
|
|
||||||
struct weston_seat *seat;
|
|
||||||
|
|
||||||
seat = malloc(sizeof *seat);
|
|
||||||
if (seat == NULL)
|
|
||||||
return -1;
|
|
||||||
|
|
||||||
memset(seat, 0, sizeof *seat);
|
|
||||||
weston_seat_init(seat, &c->base);
|
|
||||||
|
|
||||||
c->base.seat = seat;
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
static int
|
static int
|
||||||
wayland_compositor_init_egl(struct wayland_compositor *c)
|
wayland_compositor_init_egl(struct wayland_compositor *c)
|
||||||
{
|
{
|
||||||
@@ -722,6 +705,22 @@ display_add_seat(struct wayland_compositor *c, uint32_t id)
|
|||||||
wl_seat_set_user_data(input->seat, input);
|
wl_seat_set_user_data(input->seat, input);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* We can't start adding input devices until weston_compositor_init, but
|
||||||
|
* also can't call weston_compositor_init until we've handled some of the
|
||||||
|
* base display code first. So, we have a separate global handler for
|
||||||
|
* seats. */
|
||||||
|
static void
|
||||||
|
display_handle_global_input(struct wl_display *display, uint32_t id,
|
||||||
|
const char *interface, uint32_t version,
|
||||||
|
void *data)
|
||||||
|
{
|
||||||
|
struct wayland_compositor *c = data;
|
||||||
|
|
||||||
|
if (strcmp(interface, "wl_seat") == 0)
|
||||||
|
display_add_seat(c, id);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
display_handle_global(struct wl_display *display, uint32_t id,
|
display_handle_global(struct wl_display *display, uint32_t id,
|
||||||
const char *interface, uint32_t version, void *data)
|
const char *interface, uint32_t version, void *data)
|
||||||
@@ -735,8 +734,6 @@ display_handle_global(struct wl_display *display, uint32_t id,
|
|||||||
c->parent.output =
|
c->parent.output =
|
||||||
wl_display_bind(display, id, &wl_output_interface);
|
wl_display_bind(display, id, &wl_output_interface);
|
||||||
wl_output_add_listener(c->parent.output, &output_listener, c);
|
wl_output_add_listener(c->parent.output, &output_listener, c);
|
||||||
} else if (strcmp(interface, "wl_seat") == 0) {
|
|
||||||
display_add_seat(c, id);
|
|
||||||
} else if (strcmp(interface, "wl_shell") == 0) {
|
} else if (strcmp(interface, "wl_shell") == 0) {
|
||||||
c->parent.shell =
|
c->parent.shell =
|
||||||
wl_display_bind(display, id, &wl_shell_interface);
|
wl_display_bind(display, id, &wl_shell_interface);
|
||||||
@@ -768,6 +765,27 @@ wayland_compositor_handle_event(int fd, uint32_t mask, void *data)
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int
|
||||||
|
wayland_input_create(struct wayland_compositor *c)
|
||||||
|
{
|
||||||
|
struct weston_seat *seat;
|
||||||
|
|
||||||
|
seat = malloc(sizeof *seat);
|
||||||
|
if (seat == NULL)
|
||||||
|
return -1;
|
||||||
|
|
||||||
|
memset(seat, 0, sizeof *seat);
|
||||||
|
weston_seat_init(seat, &c->base);
|
||||||
|
|
||||||
|
c->base.seat = seat;
|
||||||
|
|
||||||
|
wl_display_add_global_listener(c->parent.display,
|
||||||
|
display_handle_global_input,
|
||||||
|
c);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
wayland_destroy(struct weston_compositor *ec)
|
wayland_destroy(struct weston_compositor *ec)
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user