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.
dev
Kristian Høgsberg 13 years ago
parent bb901fac90
commit 9ca2d08fb0
  1. 20
      clients/window.c

@ -2998,26 +2998,26 @@ display_run(struct display *display)
display->running = 1;
while (1) {
while (display->mask & WL_DISPLAY_WRITABLE)
wl_display_iterate(display->display,
WL_DISPLAY_WRITABLE);
wl_display_flush(display->display);
while (!wl_list_empty(&display->deferred_list)) {
task = container_of(display->deferred_list.next,
struct task, link);
wl_list_remove(&task->link);
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);
}
while (!wl_list_empty(&display->deferred_list)) {
task = container_of(display->deferred_list.next,
struct task, link);
wl_list_remove(&task->link);
task->run(task, 0);
}
}
}

Loading…
Cancel
Save