From 0e5888a0cf993c89e4d52fd80b07990993e5abac Mon Sep 17 00:00:00 2001 From: aiju Date: Tue, 8 May 2018 08:28:48 +0000 Subject: add usb tablet support --- sys/src/9/port/devmouse.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'sys/src/9/port/devmouse.c') diff --git a/sys/src/9/port/devmouse.c b/sys/src/9/port/devmouse.c index 74db2587b..a0d004c66 100644 --- a/sys/src/9/port/devmouse.c +++ b/sys/src/9/port/devmouse.c @@ -351,6 +351,8 @@ setbuttonmap(char* map) } } +void scmousetrack(int, int, int, ulong); + static long mousewrite(Chan *c, void *va, long n, vlong) { @@ -468,6 +470,8 @@ mousewrite(Chan *c, void *va, long n, vlong) if(buf[0] == 'A') absmousetrack(pt.x, pt.y, b, msec); + else if(buf[0] == 'a') + scmousetrack(pt.x, pt.y, b, msec); else mousetrack(pt.x, pt.y, b, msec); return n; @@ -640,6 +644,22 @@ absmousetrack(int x, int y, int b, ulong msec) mouseredraw(); } +void +scmousetrack(int x, int y, int b, ulong msec) +{ + vlong vx, vy; + + if(gscreen==nil) + return; + + vx = (vlong)(uint)x * (gscreen->clipr.max.x - gscreen->clipr.min.x); + x = (vx + (1<<30) - (~vx>>31&1) >> 31) + gscreen->clipr.min.x; + vy = (vlong)(uint)y * (gscreen->clipr.max.y - gscreen->clipr.min.y); + y = (vy + (1<<30) - (~vy>>31&1) >> 31) + gscreen->clipr.min.y; + + absmousetrack(x, y, b, msec); +} + static ulong lastms(void) { -- cgit v1.2.3