window: Run deferred tasks before blocking for initial iteration
The first iteration of the while loop wouldn't run the deferred tasks before blocking in epoll_wait(). Move things around so we do.
This commit is contained in:
+13
-13
@@ -2998,19 +2998,7 @@ display_run(struct display *display)
|
|||||||
|
|
||||||
display->running = 1;
|
display->running = 1;
|
||||||
while (1) {
|
while (1) {
|
||||||
while (display->mask & WL_DISPLAY_WRITABLE)
|
wl_display_flush(display->display);
|
||||||
wl_display_iterate(display->display,
|
|
||||||
WL_DISPLAY_WRITABLE);
|
|
||||||
|
|
||||||
if (!display->running)
|
|
||||||
break;
|
|
||||||
|
|
||||||
count = epoll_wait(display->epoll_fd,
|
|
||||||
ep, ARRAY_LENGTH(ep), -1);
|
|
||||||
for (i = 0; i < count; i++) {
|
|
||||||
task = ep[i].data.ptr;
|
|
||||||
task->run(task, ep[i].events);
|
|
||||||
}
|
|
||||||
|
|
||||||
while (!wl_list_empty(&display->deferred_list)) {
|
while (!wl_list_empty(&display->deferred_list)) {
|
||||||
task = container_of(display->deferred_list.next,
|
task = container_of(display->deferred_list.next,
|
||||||
@@ -3018,6 +3006,18 @@ display_run(struct display *display)
|
|||||||
wl_list_remove(&task->link);
|
wl_list_remove(&task->link);
|
||||||
task->run(task, 0);
|
task->run(task, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!display->running)
|
||||||
|
break;
|
||||||
|
|
||||||
|
wl_display_flush(display->display);
|
||||||
|
|
||||||
|
count = epoll_wait(display->epoll_fd,
|
||||||
|
ep, ARRAY_LENGTH(ep), -1);
|
||||||
|
for (i = 0; i < count; i++) {
|
||||||
|
task = ep[i].data.ptr;
|
||||||
|
task->run(task, ep[i].events);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user