diff options
author | Chase Douglas <chase.douglas@canonical.com> | 2011-01-13 11:52:40 -0500 |
---|---|---|
committer | Chase Douglas <chase.douglas@canonical.com> | 2011-01-13 11:52:40 -0500 |
commit | ecd4106f77dd755cb39ffca1440804641e4c80a9 (patch) | |
tree | a2741b996db2effadae3acabb3db996d9d379ebd | |
parent | acad3f1a8c076979a7b34c919bed47ba5eaecd03 (diff) |
Update for utouch-frame coord translation
Some minor fixes too
-rw-r--r-- | tools/mtview.c | 22 |
1 files changed, 15 insertions, 7 deletions
diff --git a/tools/mtview.c b/tools/mtview.c index 79b8466..e739d78 100644 --- a/tools/mtview.c +++ b/tools/mtview.c @@ -65,10 +65,10 @@ static void output_touch(utouch_frame_handle fh, struct windata *w, minor = t->touch_minor; angle = t->orientation; } - if (major == 0) + if (major == 0 && minor == 0) { major = DEF_WIDTH * dy; - if (minor == 0) minor = DEF_WIDTH * dx; + } float ac = fabs(cos(angle)); float as = fabs(sin(angle)); @@ -81,7 +81,7 @@ static void output_touch(utouch_frame_handle fh, struct windata *w, } XSetForeground(w->dsp, w->gc, w->color[t->slot]); - XFillArc(w->dsp, w->win, w->gc, t->window_x - mx / 2, t->window_y - my / 2, mx, my, 0, + XFillArc(w->dsp, w->win, w->gc, t->x - mx / 2, t->y - my / 2, mx, my, 0, 360 * 64); XFlush(w->dsp); } @@ -142,6 +142,7 @@ static void run_window_mtdev(utouch_frame_handle fh, struct mtdev *dev, int fd) const struct utouch_frame *frame; struct input_event iev; struct windata w; + XWindowAttributes attrs; XEvent xev; if (init_window(&w)) @@ -154,12 +155,13 @@ static void run_window_mtdev(utouch_frame_handle fh, struct mtdev *dev, int fd) } while (xev.type != MapNotify); - XSelectInput(w.dsp, w.win, - ButtonPressMask | ButtonReleaseMask | - ExposureMask | StructureNotifyMask); + XSelectInput(w.dsp, w.win, StructureNotifyMask); clear_screen(&w); + XGetWindowAttributes(w.dsp, w.win, &attrs); + utouch_frame_mtdev_set_dimensions(fh, attrs.width, attrs.height); + while (1) { while (!mtdev_idle(dev, fd, 100)) { while (mtdev_get(dev, fd, &iev, 1) > 0) { @@ -170,6 +172,12 @@ static void run_window_mtdev(utouch_frame_handle fh, struct mtdev *dev, int fd) } while (XPending(w.dsp)) { XNextEvent(w.dsp, &xev); + if (xev.type == ConfigureNotify) { + XConfigureEvent *xce = (XConfigureEvent *)&xev; + utouch_frame_mtdev_set_dimensions(fh, + xce->width, + xce->height); + } } } @@ -188,7 +196,7 @@ static void run_window_xi2(struct windata *w, XSelectInput(w->dsp, w->win, StructureNotifyMask); XSelectInput(w->dsp, XDefaultRootWindow(w->dsp), StructureNotifyMask); - mask.deviceid = XIAllDevices; + mask.deviceid = dev->deviceid; mask.mask_len = XIMaskLen(XI_TouchMotion); mask.mask = calloc(mask.mask_len, sizeof(char)); |