]> Pileus Git - wmpus/blobdiff - sys-x11.c
Support graceful shutdown
[wmpus] / sys-x11.c
index 072216b76ca54c45550ae37be72c719e1d6a5aee..7222b462141d7f5eb5a38b22ca62ef6585bdeaff 100644 (file)
--- a/sys-x11.c
+++ b/sys-x11.c
@@ -55,6 +55,7 @@ typedef enum {
 } color_t;
 
 /* Global data */
+static int   running;
 static void *cache;
 static Atom atoms[natoms];
 static int (*xerrorxlib)(Display *, XErrorEvent *);
@@ -569,10 +570,16 @@ void sys_run(win_t *root)
        wm_update(); // For struts
 
        /* Main loop */
-       for(;;)
+       running = 1;
+       while (running)
        {
                XEvent ev;
                XNextEvent(root->sys->dpy, &ev);
                process_event(ev.type, &ev, root);
        }
 }
+
+void sys_exit(void)
+{
+       running = 0;
+}