Poll revents reset

This commit is contained in:
dec05eba
2026-03-11 11:39:36 +01:00
parent 02e4e25b75
commit 83aa20a9e4
4 changed files with 13 additions and 2 deletions

View File

@@ -43,6 +43,7 @@ namespace gsr {
XEvent xev; XEvent xev;
while(running) { while(running) {
poll_fds[0].revents = 0;
poll(poll_fds, 1, 100); poll(poll_fds, 1, 100);
while(XPending(dpy)) { while(XPending(dpy)) {
XNextEvent(dpy, &xev); XNextEvent(dpy, &xev);

View File

@@ -213,8 +213,10 @@ namespace gsr {
continue; continue;
} }
if(!(poll_fd[i].revents & POLLIN)) if(!(poll_fd[i].revents & POLLIN)) {
poll_fd[i].revents = 0;
continue; continue;
}
if(i == event_index) { if(i == event_index) {
goto done; goto done;
@@ -235,6 +237,8 @@ namespace gsr {
} else { } else {
process_input_event(poll_fd[i].fd, event); process_input_event(poll_fd[i].fd, event);
} }
poll_fd[i].revents = 0;
} }
} }

View File

@@ -184,6 +184,8 @@ namespace gsr {
--num_polls; --num_polls;
--i; --i;
} }
polls[i].revents = 0;
} }
} }
} }

View File

@@ -968,8 +968,10 @@ void keyboard_event_poll_events(keyboard_event *self, int timeout_milliseconds)
continue; continue;
} }
if(!(self->event_polls[i].revents & POLLIN)) if(!(self->event_polls[i].revents & POLLIN)) {
self->event_polls[i].revents = 0;
continue; continue;
}
if(i == self->hotplug_event_index) { if(i == self->hotplug_event_index) {
/* Device is added to end of |event_polls| so it's ok to add while iterating it via index */ /* Device is added to end of |event_polls| so it's ok to add while iterating it via index */
@@ -988,6 +990,8 @@ void keyboard_event_poll_events(keyboard_event *self, int timeout_milliseconds)
} else { } else {
keyboard_event_process_input_event_data(self, &self->event_extra_data[i], self->event_polls[i].fd); keyboard_event_process_input_event_data(self, &self->event_extra_data[i], self->event_polls[i].fd);
} }
self->event_polls[i].revents = 0;
} }
} }