add an error handler
authorDana Jansens <danakj@orodu.net>
Mon, 3 Mar 2008 05:29:04 +0000 (00:29 -0500)
committerDana Jansens <danakj@orodu.net>
Mon, 3 Mar 2008 05:29:04 +0000 (00:29 -0500)
dcompmgr.c
error.c [new file with mode: 0644]
error.h [new file with mode: 0644]
screen.c

index 9126010..c024349 100644 (file)
@@ -68,7 +68,7 @@ main(int argc, char **argv)
         printf("event %d\n", ev->response_type);
 
         if (!ev->response_type) {
         printf("event %d\n", ev->response_type);
 
         if (!ev->response_type) {
-            /* XXX handle error */
+            error(conn, (xcb_generic_error_t*)ev);
             free(ev);
             continue;
         }
             free(ev);
             continue;
         }
diff --git a/error.c b/error.c
new file mode 100644 (file)
index 0000000..918f95d
--- /dev/null
+++ b/error.c
@@ -0,0 +1,11 @@
+#include "error.h"
+#include <stdlib.h>
+#include <stdio.h>
+
+void
+error(xcb_connection_t *conn, xcb_generic_error_t *ev)
+{
+    (void)conn; (void)ev;
+    printf("error!\n");
+    abort();
+}
diff --git a/error.h b/error.h
new file mode 100644 (file)
index 0000000..3a8be4c
--- /dev/null
+++ b/error.h
@@ -0,0 +1,8 @@
+#ifndef dc__error_h
+#define dc__error_h
+
+#include <xcb/xcb.h>
+
+void error(xcb_connection_t *conn, xcb_generic_error_t *ev);
+
+#endif
index 5ffae1f..873e96f 100644 (file)
--- a/screen.c
+++ b/screen.c
@@ -1,4 +1,5 @@
 #include "screen.h"
 #include "screen.h"
+#include "error.h"
 #include "window.h"
 #include "gettext.h"
 #include <string.h>
 #include "window.h"
 #include "gettext.h"
 #include <string.h>
@@ -147,7 +148,7 @@ screen_timestamp(d_screen_t *sc)
 
         /* expect errors.. */
         if (!ev->response_type) {
 
         /* expect errors.. */
         if (!ev->response_type) {
-            /* XXX handle error */
+            error(sc->conn, (xcb_generic_error_t*)ev);
             free(ev);
             continue;
         }
             free(ev);
             continue;
         }