X-Git-Url: http://pileus.org/git/?a=blobdiff_plain;f=sys-x11.c;h=77555a9cb05a309ec3531f2d36a0bd48f5837fad;hb=abf32f3ab4e5214d1a64579d4c7d8134ab46d797;hp=6c43780979ef3491dc96d380867453721ea959c7;hpb=79245152446fc0b9e3523135beabbd6783d2026a;p=wmpus diff --git a/sys-x11.c b/sys-x11.c index 6c43780..77555a9 100644 --- a/sys-x11.c +++ b/sys-x11.c @@ -25,12 +25,13 @@ #include #include "util.h" +#include "conf.h" #include "sys.h" #include "wm.h" -#ifndef BORDER -#define BORDER 2 -#endif +/* Configuration */ +static int BORDER = 2; +static int NO_CAPTURE = 0; /* Internal structures */ struct win_sys { @@ -540,6 +541,10 @@ win_t *sys_init(void) Display *dpy; Window xid; + /* Load configuration */ + BORDER = conf_get_int("main.border", BORDER); + NO_CAPTURE = conf_get_int("main.no-capture", NO_CAPTURE); + /* Open the display */ if (!(dpy = XOpenDisplay(NULL))) error("Unable to get display"); @@ -558,7 +563,6 @@ win_t *sys_init(void) /* Select window management events */ XSelectInput(dpy, xid, SubstructureRedirectMask|SubstructureNotifyMask); - XSetInputFocus(dpy, None, RevertToNone, CurrentTime); xerrorxlib = XSetErrorHandler(xerror); return win_find(dpy, xid, 1); @@ -567,18 +571,20 @@ win_t *sys_init(void) void sys_run(win_t *root) { /* Add each initial window */ - unsigned int nkids; - Window par, xid, *kids = NULL; - if (XQueryTree(root->sys->dpy, root->sys->xid, - &par, &xid, &kids, &nkids)) { - for(int i = 0; i < nkids; i++) { - win_t *win = win_find(root->sys->dpy, kids[i], 1); - if (win && win_viewable(win) && !strut_add(root,win)) - wm_insert(win); + if (!NO_CAPTURE) { + unsigned int nkids; + Window par, xid, *kids = NULL; + if (XQueryTree(root->sys->dpy, root->sys->xid, + &par, &xid, &kids, &nkids)) { + for(int i = 0; i < nkids; i++) { + win_t *win = win_find(root->sys->dpy, kids[i], 1); + if (win && win_viewable(win) && !strut_add(root,win)) + wm_insert(win); + } + XFree(kids); } - XFree(kids); + wm_update(); // For struts } - wm_update(); // For struts /* Main loop */ running = 1;