struct sigaction sigint;
struct display display = { 0 };
struct window window = { 0 };
- int i;
+ int i, ret = 0;
window.display = &display;
display.window = &window;
sigint.sa_flags = SA_RESETHAND;
sigaction(SIGINT, &sigint, NULL);
- while (running)
- wl_display_dispatch(display.display);
+ while (running && ret != -1)
+ ret = wl_display_dispatch(display.display);
fprintf(stderr, "simple-egl exiting\n");
struct sigaction sigint;
struct display *display;
struct window *window;
+ int ret;
display = create_display();
window = create_window(display, 250, 250);
redraw(window, NULL, 0);
- while (running)
- wl_display_dispatch(display->display);
+ while (running && ret != -1)
+ ret = wl_display_dispatch(display->display);
fprintf(stderr, "simple-shm exiting\n");
destroy_window(window);
main(int argc, char **argv)
{
struct touch *touch;
+ int ret = 0;
touch = touch_create(600, 500);
- while (true)
- wl_display_dispatch(touch->display);
+ while (ret != -1)
+ ret = wl_display_dispatch(touch->display);
return 0;
}
return;
}
- if (events & EPOLLIN)
- wl_display_dispatch(display->display);
+ if (events & EPOLLIN) {
+ ret = wl_display_dispatch(display->display);
+ if (ret == -1) {
+ display_exit(display);
+ return;
+ }
+ }
if (events & EPOLLOUT) {
ret = wl_display_flush(display->display);