diff options
Diffstat (limited to 'src/common/surface.c')
| -rw-r--r-- | src/common/surface.c | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/src/common/surface.c b/src/common/surface.c index 5c29a10..6b805be 100644 --- a/src/common/surface.c +++ b/src/common/surface.c @@ -451,7 +451,8 @@ int yasl_surface_request_frame(yasl_surface *s) { if (!yasl_public_connected(s)) return -errno; - return STATUS(yasl_private_surface_request_shown_frame(s)); + yasl_private_surface_request_shown_frame(s); + return 0; } int yasl_surface_set_cursor(yasl_surface *s, enum yasl_cursor cursor) { @@ -901,14 +902,10 @@ static bool convert_event(const struct yasl_private_event *p, yasl_event *e) return false; } } +/* Queued events go first: input reaches the application before it draws, and + * a queued REFRESH also pays one owed to the same surface. */ static int take_event(yasl_event *out) { - for (yasl_surface *s = display->surfaces; s; s = s->event_next) - if (s->refresh_owed && refresh_ready(s)) { - s->refresh_owed = false; - *out = (yasl_event){.type = YASL_EVENT_REFRESH, .surface = s, .time_ns = yasl_time_ns()}; - return 1; - } struct yasl_private_event p; while (yasl_private_display_poll_event(display, &p)) { /* Input method events from an older text field are stale. */ @@ -926,6 +923,12 @@ static int take_event(yasl_event *out) if (errno) return yasl_public_error(errno); } + for (yasl_surface *s = display->surfaces; s; s = s->event_next) + if (s->refresh_owed && refresh_ready(s)) { + s->refresh_owed = false; + *out = (yasl_event){.type = YASL_EVENT_REFRESH, .surface = s, .time_ns = yasl_time_ns()}; + return 1; + } return 0; } /* Internal wakeups, such as a redraw request, keep waiting; only an event, the deadline or |
