compositor-wayland: Handle HUP or ERR from event loop

Otherwise we end up in a busy loop instead of exiting nicely.
diff --git a/src/compositor-wayland.c b/src/compositor-wayland.c
index 21ce5cb..3ab8785 100644
--- a/src/compositor-wayland.c
+++ b/src/compositor-wayland.c
@@ -684,6 +684,11 @@
 	struct wayland_compositor *c = data;
 	int count = 0;
 
+	if ((mask & WL_EVENT_HANGUP) || (mask & WL_EVENT_ERROR)) {
+		wl_display_terminate(c->base.wl_display);
+		return 0;
+	}
+
 	if (mask & WL_EVENT_READABLE)
 		count = wl_display_dispatch(c->parent.wl_display);
 	if (mask & WL_EVENT_WRITABLE)