summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorcinap_lenrek <cinap_lenrek@felloff.net>2017-12-03 16:34:35 +0100
committercinap_lenrek <cinap_lenrek@felloff.net>2017-12-03 16:34:35 +0100
commita08727d9da8334c3c96de41dafc5820aac9013da (patch)
tree2289e796e2716d41d1420d30bd9f9190a38ce3cb
parent308407dc6e46640c3e36049aad7ad6a84ddfdc2a (diff)
screenlock: put position check back in grabmouse (thanks deuteron)
the check was there because changing te position causes another mouse event to get posted resulting in grabmouse spinning.
-rw-r--r--sys/src/cmd/screenlock.c15
1 files changed, 11 insertions, 4 deletions
diff --git a/sys/src/cmd/screenlock.c b/sys/src/cmd/screenlock.c
index b010a0c17..8e3e48de8 100644
--- a/sys/src/cmd/screenlock.c
+++ b/sys/src/cmd/screenlock.c
@@ -91,8 +91,8 @@ blanker(void *)
void
grabmouse(void*)
{
+ int fd, x, y;
char ibuf[256], obuf[256];
- int fd;
if((fd = open("/dev/mouse", ORDWR)) < 0)
sysfatal("can't open /dev/mouse: %r");
@@ -102,9 +102,16 @@ grabmouse(void*)
screen->r.min.y + Dy(screen->r)/2);
while(read(fd, ibuf, sizeof ibuf) > 0){
- if(!debug)
- fprint(fd, "%s", obuf);
- blank = time(0);
+ ibuf[12] = 0;
+ ibuf[24] = 0;
+ x = atoi(ibuf+1);
+ y = atoi(ibuf+13);
+ if(x != screen->r.min.x + Dx(screen->r)/2 ||
+ y != screen->r.min.y + Dy(screen->r)/2){
+ if(!debug)
+ fprint(fd, "%s", obuf);
+ blank = time(0);
+ }
}
}