mirror of
https://github.com/hyprwm/wlroots-hyprland.git
synced 2024-12-23 02:19:49 +01:00
backend/wayland: Add registering multiple seats
This commit is contained in:
parent
85b0872650
commit
70ffda3ea3
4 changed files with 25 additions and 25 deletions
|
@ -157,8 +157,8 @@ static bool backend_start(struct wlr_backend *backend) {
|
|||
|
||||
wl->started = true;
|
||||
|
||||
struct wlr_wl_seat *seat = wl->seat;
|
||||
if (seat != NULL) {
|
||||
struct wlr_wl_seat *seat;
|
||||
wl_list_for_each(seat, &wl->seats, link) {
|
||||
if (seat->keyboard) {
|
||||
create_wl_keyboard(seat);
|
||||
}
|
||||
|
@ -262,6 +262,7 @@ struct wlr_backend *wlr_wl_backend_create(struct wl_display *display,
|
|||
wl->local_display = display;
|
||||
wl_list_init(&wl->devices);
|
||||
wl_list_init(&wl->outputs);
|
||||
wl_list_init(&wl->seats);
|
||||
|
||||
wl->remote_display = wl_display_connect(remote);
|
||||
if (!wl->remote_display) {
|
||||
|
|
|
@ -586,8 +586,8 @@ struct wlr_output *wlr_wl_output_create(struct wlr_backend *wlr_backend) {
|
|||
|
||||
wlr_signal_emit_safe(&backend->backend.events.new_output, wlr_output);
|
||||
|
||||
struct wlr_wl_seat *seat = backend->seat;
|
||||
if (seat != NULL) {
|
||||
struct wlr_wl_seat *seat;
|
||||
wl_list_for_each(seat, &backend->seats, link) {
|
||||
if (seat->pointer) {
|
||||
create_wl_pointer(seat, output);
|
||||
}
|
||||
|
|
|
@ -373,7 +373,6 @@ static struct wlr_wl_input_device *get_wl_input_device_from_input_device(
|
|||
}
|
||||
|
||||
bool create_wl_seat(struct wl_seat *wl_seat, struct wlr_wl_backend *wl) {
|
||||
assert(!wl->seat); // only one seat supported at the moment
|
||||
struct wlr_wl_seat *seat = calloc(1, sizeof(struct wlr_wl_seat));
|
||||
if (!seat) {
|
||||
wlr_log_errno(WLR_ERROR, "Allocation failed");
|
||||
|
@ -381,17 +380,14 @@ bool create_wl_seat(struct wl_seat *wl_seat, struct wlr_wl_backend *wl) {
|
|||
}
|
||||
seat->wl_seat = wl_seat;
|
||||
seat->backend = wl;
|
||||
wl->seat = seat;
|
||||
wl_list_insert(&wl->seats, &seat->link);
|
||||
wl_seat_add_listener(wl_seat, &seat_listener, seat);
|
||||
return true;
|
||||
}
|
||||
|
||||
void destroy_wl_seats(struct wlr_wl_backend *wl) {
|
||||
struct wlr_wl_seat *seat = wl->seat;
|
||||
if (!seat) {
|
||||
return;
|
||||
}
|
||||
|
||||
struct wlr_wl_seat *seat, *tmp_seat;
|
||||
wl_list_for_each_safe(seat, tmp_seat, &wl->seats, link) {
|
||||
if (seat->touch) {
|
||||
wl_touch_destroy(seat->touch);
|
||||
}
|
||||
|
@ -403,10 +399,12 @@ void destroy_wl_seats(struct wlr_wl_backend *wl) {
|
|||
wl_keyboard_destroy(seat->keyboard);
|
||||
}
|
||||
free(seat->name);
|
||||
if (seat->wl_seat) {
|
||||
assert(seat->wl_seat);
|
||||
wl_seat_destroy(seat->wl_seat);
|
||||
}
|
||||
|
||||
wl_list_remove(&seat->link);
|
||||
free(seat);
|
||||
}
|
||||
}
|
||||
|
||||
static struct wlr_wl_seat *input_device_get_seat(struct wlr_input_device *wlr_dev) {
|
||||
|
|
|
@ -39,7 +39,7 @@ struct wlr_wl_backend {
|
|||
struct wp_presentation *presentation;
|
||||
struct zwp_linux_dmabuf_v1 *zwp_linux_dmabuf_v1;
|
||||
struct zwp_relative_pointer_manager_v1 *zwp_relative_pointer_manager_v1;
|
||||
struct wlr_wl_seat *seat;
|
||||
struct wl_list seats; // wlr_wl_seat.link
|
||||
struct wlr_wl_pointer *current_pointer;
|
||||
struct zwp_tablet_manager_v2 *tablet_manager;
|
||||
struct wlr_drm_format_set linux_dmabuf_v1_formats;
|
||||
|
@ -109,6 +109,7 @@ struct wlr_wl_pointer {
|
|||
struct wlr_wl_seat {
|
||||
struct wl_seat *wl_seat;
|
||||
|
||||
struct wl_list link; // wlr_wl_backend.seats
|
||||
char *name;
|
||||
struct wl_touch *touch;
|
||||
struct wl_pointer *pointer;
|
||||
|
|
Loading…
Reference in a new issue