X-Git-Url: http://pileus.org/git/?p=wmpus;a=blobdiff_plain;f=sys-x11.c;h=7222b462141d7f5eb5a38b22ca62ef6585bdeaff;hp=a5ae667f6e3e794676df052921ad6c54a03a8988;hb=43cb9b7de22dac5864d73321ec974bb937a217ff;hpb=a6f2be4a52a3dd478c0640714c5be9c5cf87c64e diff --git a/sys-x11.c b/sys-x11.c index a5ae667..7222b46 100644 --- 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 *); @@ -275,7 +276,7 @@ static void process_event(int type, XEvent *ev, win_t *root) //printf("event: %d\n", type); /* Common data for all these events ... */ - ptr_t ptr; mod_t mod; + ptr_t ptr = {}; mod_t mod = {}; if (type == KeyPress || type == KeyRelease || type == ButtonPress || type == ButtonRelease || type == MotionNotify) { @@ -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; +}