summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarlos Garnacho <carlosg@gnome.org>2016-09-27 19:03:26 +0200
committerAdam Jackson <ajax@redhat.com>2016-10-05 13:27:35 -0400
commitbbd4854f81ebba1119202c5f6ff4679c62afec1f (patch)
tree81dffa836bbf7d3f3d7fb4bdcd9b8b036009fd28
parentee526285882995289846648f3122c4295e3e8284 (diff)
xwayland: Apply touch abs axes transformation before posting events
The way we map the touch absolute device to screen coordinates can't work across wl_output mode and geometry events. Instead, set up a fixed coordinate space, and transform touch events according to the screen coordinate space as they happen. Reviewed-by: Adam Jackson <ajax@redhat.com> Signed-off-by: Carlos Garnacho <carlosg@gnome.org>
-rw-r--r--hw/xwayland/xwayland-input.c17
1 files changed, 8 insertions, 9 deletions
diff --git a/hw/xwayland/xwayland-input.c b/hw/xwayland/xwayland-input.c
index 1872bdcc6..d3a8e504e 100644
--- a/hw/xwayland/xwayland-input.c
+++ b/hw/xwayland/xwayland-input.c
@@ -167,7 +167,6 @@ xwl_touch_proc(DeviceIntPtr device, int what)
#define NTOUCHPOINTS 20
#define NBUTTONS 1
#define NAXES 2
- struct xwl_seat *xwl_seat = device->public.devicePrivate;
Atom btn_labels[NBUTTONS] = { 0 };
Atom axes_labels[NAXES] = { 0 };
BYTE map[NBUTTONS + 1] = { 0 };
@@ -191,13 +190,10 @@ xwl_touch_proc(DeviceIntPtr device, int what)
return BadValue;
/* Valuators */
- /* FIXME: devices might be mapped to a single wl_output */
InitValuatorAxisStruct(device, 0, axes_labels[0],
- 0, xwl_seat->xwl_screen->width,
- 10000, 0, 10000, Absolute);
+ 0, 0xFFFF, 10000, 0, 10000, Absolute);
InitValuatorAxisStruct(device, 1, axes_labels[1],
- 0, xwl_seat->xwl_screen->height,
- 10000, 0, 10000, Absolute);
+ 0, 0xFFFF, 10000, 0, 10000, Absolute);
return Success;
case DEVICE_ON:
@@ -640,15 +636,18 @@ static void
xwl_touch_send_event(struct xwl_touch *xwl_touch,
struct xwl_seat *xwl_seat, int type)
{
- int32_t dx, dy;
+ double dx, dy, x, y;
ValuatorMask mask;
dx = xwl_touch->window->window->drawable.x;
dy = xwl_touch->window->window->drawable.y;
+ x = (dx + xwl_touch->x) * 0xFFFF / xwl_seat->xwl_screen->width;
+ y = (dy + xwl_touch->y) * 0xFFFF / xwl_seat->xwl_screen->height;
+
valuator_mask_zero(&mask);
- valuator_mask_set(&mask, 0, dx + xwl_touch->x);
- valuator_mask_set(&mask, 1, dy + xwl_touch->y);
+ valuator_mask_set_double(&mask, 0, x);
+ valuator_mask_set_double(&mask, 1, y);
QueueTouchEvents(xwl_seat->touch, type, xwl_touch->id, 0, &mask);
}