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
This commit is contained in:
parent
fb243a134d
commit
7d419a1421
1 changed files with 5 additions and 2 deletions
|
|
@ -204,14 +204,16 @@ touchCallback(int device, Touch *data, int nFingers, double timestamp, int frame
|
||||||
CGPoint p;
|
CGPoint p;
|
||||||
CGEventRef e;
|
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;
|
osx.touched = 1;
|
||||||
buttons = 0;
|
buttons = 0;
|
||||||
for(i = 0; i < nFingers; ++i)
|
for(i = 0; i < nFingers; ++i)
|
||||||
buttons |= classifyTouch(data+i);
|
buttons |= classifyTouch(data+i);
|
||||||
delta = buttons ^ obuttons;
|
delta = buttons ^ obuttons;
|
||||||
obuttons = buttons;
|
obuttons = buttons;
|
||||||
p.x = osx.xy.x+osx.screenr.min.x;
|
|
||||||
p.y = osx.xy.y+osx.screenr.min.y;
|
|
||||||
if(delta & 1) {
|
if(delta & 1) {
|
||||||
e = CGEventCreateMouseEvent(NULL,
|
e = CGEventCreateMouseEvent(NULL,
|
||||||
(buttons & 1) ? kCGEventOtherMouseDown : kCGEventOtherMouseUp,
|
(buttons & 1) ? kCGEventOtherMouseDown : kCGEventOtherMouseUp,
|
||||||
|
|
@ -886,6 +888,7 @@ activated(int active)
|
||||||
MTDeviceStart([osx.devicelist objectAtIndex:i], 0); //start sending events
|
MTDeviceStart([osx.devicelist objectAtIndex:i], 0); //start sending events
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
osx.xy.x = -10000;
|
||||||
for(i = 0; i<[osx.devicelist count]; i++) { //iterate available devices
|
for(i = 0; i<[osx.devicelist count]; i++) { //iterate available devices
|
||||||
MTDeviceStop([osx.devicelist objectAtIndex:i]); //stop sending events
|
MTDeviceStop([osx.devicelist objectAtIndex:i]); //stop sending events
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue