diff options
author | Russ Cox <rsc@swtch.com> | 2010-01-15 00:01:12 -0800 |
---|---|---|
committer | Russ Cox <rsc@swtch.com> | 2010-01-15 00:01:12 -0800 |
commit | 7d419a14214394e2f9523b78d4b9db59d7c9a025 (patch) | |
tree | 5699e35e3231b9f5bfeef024463990bf565d37b8 | |
parent | fb243a134de240cfafd3eb9db4545d0db5f01638 (diff) | |
download | plan9port-7d419a14214394e2f9523b78d4b9db59d7c9a025.tar.gz plan9port-7d419a14214394e2f9523b78d4b9db59d7c9a025.tar.bz2 plan9port-7d419a14214394e2f9523b78d4b9db59d7c9a025.zip |
devdraw: fewer spurious mouse clicks in OS X multitouch
Was turning all button touches into clicks of high
buttons, causing spurious clicks even outside the
app window.
R=rsc
http://codereview.appspot.com/189084
-rw-r--r-- | src/cmd/devdraw/osx-screen-carbon.m | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/src/cmd/devdraw/osx-screen-carbon.m b/src/cmd/devdraw/osx-screen-carbon.m index 4babbf95..ee20d631 100644 --- a/src/cmd/devdraw/osx-screen-carbon.m +++ b/src/cmd/devdraw/osx-screen-carbon.m @@ -204,14 +204,16 @@ touchCallback(int device, Touch *data, int nFingers, double timestamp, int frame CGPoint p; CGEventRef e; + p.x = osx.xy.x+osx.screenr.min.x; + p.y = osx.xy.y+osx.screenr.min.y; + if(!ptinrect(Pt(p.x, p.y), osx.screenr)) + return 0; osx.touched = 1; buttons = 0; for(i = 0; i < nFingers; ++i) buttons |= classifyTouch(data+i); delta = buttons ^ obuttons; obuttons = buttons; - p.x = osx.xy.x+osx.screenr.min.x; - p.y = osx.xy.y+osx.screenr.min.y; if(delta & 1) { e = CGEventCreateMouseEvent(NULL, (buttons & 1) ? kCGEventOtherMouseDown : kCGEventOtherMouseUp, @@ -886,6 +888,7 @@ activated(int active) MTDeviceStart([osx.devicelist objectAtIndex:i], 0); //start sending events } } else { + osx.xy.x = -10000; for(i = 0; i<[osx.devicelist count]; i++) { //iterate available devices MTDeviceStop([osx.devicelist objectAtIndex:i]); //stop sending events } |