tdevdraw: fix support for multitouch trackpads - plan9port - [fork] Plan 9 from user space (HTM) git clone git://src.adamsgaard.dk/plan9port (DIR) Log (DIR) Files (DIR) Refs (DIR) README (DIR) LICENSE --- (DIR) commit 28afa898ee3281afde739c9a09e59264680756ae (DIR) parent d9e047e5d5560912da6d2860fa25e427322f08bb (HTM) Author: Russ Cox <rsc@swtch.com> Date: Sat, 6 Feb 2010 22:16:46 -0800 devdraw: fix support for multitouch trackpads R=rsc http://codereview.appspot.com/203059 Diffstat: M src/cmd/devdraw/osx-screen-carbon.m | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) --- (DIR) diff --git a/src/cmd/devdraw/osx-screen-carbon.m b/src/cmd/devdraw/osx-screen-carbon.m t@@ -182,7 +182,7 @@ classifyTouch(Touch *t) if((t->timestamp - tracks[i].firstThreshTime) < kTimeSensitivity) { return 0; } - if(p.y > kButtonLimit && t->size > kSizeSensitivity ) { + if(p.y > kButtonLimit && t->size > kSizeSensitivity) { if(p.x < 0.35) return 1; if(p.x > 0.65) t@@ -604,18 +604,18 @@ mouseevent(EventRef event) GetEventParameter(event, kEventParamKeyModifiers, typeUInt32, 0, sizeof mod, 0, &mod); + // OS X swaps button 2 and 3 + but = (but & ~6) | ((but & 4)>>1) | ((but&2)<<1); + but = (but & ~((1<<10)-1)) | mouseswap(but & ((1<<10)-1)); if(osx.touched) { // in multitouch we use the clicks down to enable our // virtual buttons. - if(but & 0x3) - but = but >> 29; - else + if(but & 0x7) { + if(but>>29) + but = but >> 29; + } else but = 0; osx.touched = 0; - } else { - // OS X swaps button 2 and 3 - but = (but & ~6) | ((but & 4)>>1) | ((but&2)<<1); - but = mouseswap(but); } // Apply keyboard modifiers and pretend it was a real mouse button.