struct weston_desktop_seat * weston_desktop_seat_from_seat(struct weston_seat *wseat) { struct wl_listener *listener; struct weston_desktop_seat *seat; listener = wl_signal_get(&wseat->destroy_signal, weston_desktop_seat_destroy); if (listener != NULL) return wl_container_of(listener, seat, seat_destroy_listener); seat = zalloc(sizeof(struct weston_desktop_seat)); if (seat == NULL) return NULL; seat->seat = wseat; seat->seat_destroy_listener.notify = weston_desktop_seat_destroy; wl_signal_add(&wseat->destroy_signal, &seat->seat_destroy_listener); seat->popup_grab.keyboard.interface = &weston_desktop_seat_keyboard_popup_grab_interface; seat->popup_grab.pointer.interface = &weston_desktop_seat_pointer_popup_grab_interface; seat->popup_grab.touch.interface = &weston_desktop_seat_touch_popup_grab_interface; wl_list_init(&seat->popup_grab.surfaces); return seat; }
ShellSeat *ShellSeat::shellSeat(struct weston_seat *seat) { struct wl_listener *listener = wl_signal_get(&seat->destroy_signal, ShellSeat::seatDestroyed); if (!listener) { return new ShellSeat(seat); } return static_cast<Wrapper *>(container_of(listener, Wrapper, seatDestroy))->seat; }
WL_EXPORT struct wl_listener * wl_event_loop_get_destroy_listener(struct wl_event_loop *loop, wl_notify_func_t notify) { return wl_signal_get(&loop->destroy_signal, notify); }