aboutsummaryrefslogtreecommitdiff
path: root/libseat
diff options
context:
space:
mode:
authorKenny Levinsen <kl@kl.wtf>2021-07-08 23:41:09 +0200
committerKenny Levinsen <kl@kl.wtf>2021-07-08 23:48:30 +0200
commit7a6d12ff7a4e3e19d6c7c9e0f2d270491168e785 (patch)
treece06c2d4c80db8a3a2fe4bbb64cb48f9d736751d /libseat
parent2204db5531ed16bf32f969645e7177f6118f8a8e (diff)
libseat/seatd: Return executed events
Dispatch needs to report if something has happened, which includes events executed from the queue as these could have lead to additional dispatch and queuing.
Diffstat (limited to 'libseat')
-rw-r--r--libseat/backend/seatd.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/libseat/backend/seatd.c b/libseat/backend/seatd.c
index 07026ba..9bc5e6e 100644
--- a/libseat/backend/seatd.c
+++ b/libseat/backend/seatd.c
@@ -206,10 +206,11 @@ static int queue_event(struct backend_seatd *backend, int opcode) {
return 0;
}
-static void execute_events(struct backend_seatd *backend) {
+static int execute_events(struct backend_seatd *backend) {
struct linked_list list;
linked_list_init(&list);
linked_list_take(&list, &backend->pending_events);
+ int executed = 0;
while (!linked_list_empty(&list)) {
struct pending_event *ev = (struct pending_event *)list.next;
int opcode = ev->opcode;
@@ -231,7 +232,9 @@ static void execute_events(struct backend_seatd *backend) {
log_errorf("Invalid opcode: %d", opcode);
abort();
}
+ executed++;
}
+ return executed;
}
static int dispatch_pending(struct backend_seatd *backend, int *opcode) {
@@ -341,7 +344,7 @@ static int dispatch_background(struct libseat *base, int timeout) {
return -1;
}
- execute_events(backend);
+ dispatched += execute_events(backend);
return dispatched;
}