diff options
author | Chris Wilson <chris@chris-wilson.co.uk> | 2013-08-22 15:07:48 +0100 |
---|---|---|
committer | Chris Wilson <chris@chris-wilson.co.uk> | 2013-08-22 15:28:02 +0100 |
commit | 7c52a3cf5243b42b632fd73789d1b484e81b9b0c (patch) | |
tree | 7d303d347fd1d3201801486d676bbae246fab35f /overlay/x11/x11-window.c | |
parent | 184786988e5d78ae230139d76691b9ce7f97dca6 (diff) |
overlay: Rudiments of config files and option parsing
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Diffstat (limited to 'overlay/x11/x11-window.c')
-rw-r--r-- | overlay/x11/x11-window.c | 41 |
1 files changed, 3 insertions, 38 deletions
diff --git a/overlay/x11/x11-window.c b/overlay/x11/x11-window.c index b77f5375..7f7d6d72 100644 --- a/overlay/x11/x11-window.c +++ b/overlay/x11/x11-window.c @@ -32,6 +32,7 @@ #include <unistd.h> #include "../overlay.h" +#include "position.h" struct x11_window { struct overlay base; @@ -109,7 +110,7 @@ static void x11_window_destroy(void *data) } cairo_surface_t * -x11_window_create(enum position position, int *width, int *height) +x11_window_create(struct config *config, int *width, int *height) { Display *dpy; Screen *scr; @@ -129,43 +130,7 @@ x11_window_create(enum position position, int *width, int *height) XSetErrorHandler(noop); - if (*width == -1) { - w = scr->width; - switch (position & 7) { - default: - case 0: - case 2: w >>= 1; break; - } - } else if (*width > scr->width) { - w = scr->width; - } else - w = *width; - - if (*height == -1) { - h = scr->height; - switch ((position >> 4) & 7) { - default: - case 0: - case 2: h >>= 1; break; - } - } else if (*height > scr->height) - h = scr->height; - else - h = *height; - - switch (position & 7) { - default: - case 0: x = 0; break; - case 1: x = (scr->width - w)/2; break; - case 2: x = scr->width - w; break; - } - - switch ((position >> 4) & 7) { - default: - case 0: y = 0; break; - case 1: y = (scr->height - h)/2; break; - case 2: y = scr->height - h; break; - } + x11_position(scr, *width, *height, config, &x, &y, &w, &h); attr.override_redirect = True; win = XCreateWindow(dpy, DefaultRootWindow(dpy), |