seat: Add occupancy count

websocket-tls
Andri Yngvason 2023-04-29 19:48:30 +00:00
parent 87c034db43
commit c01e5c6080
2 changed files with 14 additions and 0 deletions

View File

@ -26,6 +26,8 @@ struct seat {
uint32_t id;
uint32_t capabilities;
char name[256];
uint32_t occupancy;
};
struct seat* seat_new(struct wl_seat* wl_seat, uint32_t id);
@ -34,4 +36,5 @@ void seat_list_destroy(struct wl_list* list);
struct seat* seat_find_by_name(struct wl_list* list, const char* name);
struct seat* seat_find_by_id(struct wl_list* list, uint32_t id);
struct seat* seat_find_unoccupied(struct wl_list* list);
struct seat* seat_first(struct wl_list* list);

View File

@ -97,6 +97,17 @@ struct seat* seat_find_by_id(struct wl_list* list, uint32_t id)
return NULL;
}
struct seat* seat_find_unoccupied(struct wl_list* list)
{
struct seat* seat;
wl_list_for_each(seat, list, link)
if (seat->occupancy == 0)
return seat;
return NULL;
}
struct seat* seat_first(struct wl_list* list)
{
struct seat* seat;