diff options
author | aiju <devnull@localhost> | 2018-05-08 08:28:48 +0000 |
---|---|---|
committer | aiju <devnull@localhost> | 2018-05-08 08:28:48 +0000 |
commit | 0e5888a0cf993c89e4d52fd80b07990993e5abac (patch) | |
tree | 4ad57117b3b7053ae8b7fc1d4844ca6c29d6037f /sys/src/9/port/devmouse.c | |
parent | ec60da4961b4acff96631e7b99c90a0f4500dbed (diff) |
add usb tablet support
Diffstat (limited to 'sys/src/9/port/devmouse.c')
-rw-r--r-- | sys/src/9/port/devmouse.c | 20 |
1 files changed, 20 insertions, 0 deletions
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) { |