diff options
author | Peter Hutterer <peter.hutterer@who-t.net> | 2011-11-02 15:36:09 +1000 |
---|---|---|
committer | Peter Hutterer <peter.hutterer@who-t.net> | 2011-11-02 15:36:09 +1000 |
commit | 8f762cd276d5afcf0a8f1e3f511f13e2b26fe155 (patch) | |
tree | 136ba8c44e44054c1bba0aecb447af39d46f9ef9 | |
parent | 700831d0d09cdb911de96e67b535291dd94add3f (diff) |
Store width/height in the mt struct
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
-rw-r--r-- | multitouch.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/multitouch.c b/multitouch.c index dccb2be..f15cbeb 100644 --- a/multitouch.c +++ b/multitouch.c @@ -19,6 +19,9 @@ struct multitouch { Window root; Window win; int xi_opcode; + + int width; + int height; }; static int error(const char *fmt, ...) @@ -57,7 +60,7 @@ static Window init_window(struct multitouch *mt) XIEventMask evmask; unsigned char mask[XIMaskLen(XI_LASTEVENT)]; - win = XCreateSimpleWindow(mt->dpy, mt->root, 0, 0, 800, 600, + win = XCreateSimpleWindow(mt->dpy, mt->root, 0, 0, mt->width, mt->height, 0, 0, WhitePixel(mt->dpy, mt->screen)); XSelectInput(mt->dpy, win, ExposureMask); XMapWindow(mt->dpy, win); @@ -79,7 +82,7 @@ static Window init_window(struct multitouch *mt) return win; } -static int init_x11(struct multitouch *mt) +static int init_x11(struct multitouch *mt, int width, int height) { Display *dpy; int major = 2, minor = 2; @@ -100,6 +103,8 @@ static int init_x11(struct multitouch *mt) mt->screen = DefaultScreen(dpy); mt->root = DefaultRootWindow(dpy); mt->xi_opcode = xi_opcode; + mt->width = width; + mt->height = height; mt->win = init_window(mt); if (!mt->win) @@ -167,7 +172,7 @@ int main(int argc, char **argv) int rc; struct multitouch mt = { 0 }; - rc = init_x11(&mt); + rc = init_x11(&mt, 800, 600); if (rc != EXIT_SUCCESS) return rc; |