From mboxrd@z Thu Jan 1 00:00:00 1970 MIME-Version: 1.0 From: =?ISO-8859-1?Q?Rub=E9n_Berenguel?= Date: Sat, 6 Apr 2013 20:22:46 +0200 Message-ID: To: Fans of the OS Plan 9 from Bell Labs <9fans@9fans.net> Content-Type: multipart/alternative; boundary=20cf3074b55288afa504d9b54bb3 Subject: [9fans] The 2-1 chord in P9Ports Acme (Mac OS) Topicbox-Message-UUID: 3eda16b8-ead8-11e9-9d60-3106f5b1d025 --20cf3074b55288afa504d9b54bb3 Content-Type: text/plain; charset=ISO-8859-1 As you may know, Apple has an odd stance against multi-button mice and trackpads. Acme works surprisingly well with just one button, with the emulation of buttons 2 and 3 with alt+click and cmd+click. Problem is, with these settings there's no way to do a 2-1 chord, since "1" is already pressed while doing 2. After a little Googling I just took a look at the source and did the simplest thing possible: diff -r 1bd8b25173d5 src/cmd/devdraw/cocoa-screen.m --- a/src/cmd/devdraw/cocoa-screen.m Tue Mar 19 14:36:50 2013 -0400 +++ b/src/cmd/devdraw/cocoa-screen.m Sat Apr 06 20:02:44 2013 +0200 @@ -847,7 +847,9 @@ case NSFlagsChanged: if(in.mbuttons || in.kbuttons){ in.kbuttons = 0; - if(m & NSAlternateKeyMask) + if(m & NSControlKeyMask) + in.kbuttons |= 1; + if(m & NSAlternateKeyMask) in.kbuttons |= 2; if(m & NSCommandKeyMask) in.kbuttons |= 4; This allows 2-1 chords by pressing Ctrl. How? Select something as usual (the extra command for the 2-1 chord). Select the command with Alt pressed, to execute it. While holding Alt (and the trackpad button) press control. Release everything (does not really matter the order as far as I can tell.) Done. Or at least, it does what is expected in my machine in all the tries I have done so far. Hard to tell with such a small change :) Oh, to get the changes rolling you should cd $PLAN9/src/cmd/devdraw && mk install I'm not sure if this change should be accepted in p9ports, neither do I know how to propose it or submit it. So if you think it could be useful, please let me know how it can be done. Feels good to dig into the depths of some software you care and change it :) Ruben --20cf3074b55288afa504d9b54bb3 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable
As you may know, Apple has an odd stance against multi-but= ton mice and trackpads. Acme works surprisingly well with just one button, = with the emulation of buttons 2 and 3 with alt+click and cmd+click. Problem= is, with these settings there's no way to do a 2-1 chord, since "= 1" is already pressed while doing 2.=A0

After a little Googling I just took a look at the sour= ce and did the simplest thing possible:

diff -r 1bd8b25173d5 src/cmd/devdraw/cocoa-screen.m
--- a/= src/cmd/devdraw/cocoa-screen.m <= /span>Tue Mar 19 14:36:50 2013 -0400
+++ b/src/cmd/devdraw/cocoa-screen.m Sat Apr 06 20:02:44 2013 +0200
@@ -847,7 +847,9 = @@
=A0 case NSF= lagsChanged:
=A0 if(in.mbuttons = || in.kbuttons){
=A0 = in.kbuttons =3D 0;
- if(m & NSAlternateKeyMask)
+ if(m & NSCon= trolKeyMask)
+ in.kbuttons |=3D 1;
+ =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 = =A0 =A0if(m & NSAlternateKeyMask)
=A0 in.kbuttons |= =3D 2;
=A0 if= (m & NSCommandKeyMask)
=A0 in.kbuttons |=3D 4;

This allows 2-1 chords by pressing Ctrl. How?

Select something as usual (the extra comm= and for the 2-1 chord). Select the command with Alt pressed, to execute it.= While holding Alt (and the trackpad button) press control. Release everyth= ing (does not really matter the order as far as I can tell.) Done. Or at le= ast, it does what is expected in my machine in all the tries I have done so= far. Hard to tell with such a small change :)

Oh, to get the changes rolling you should= =A0

cd $PLAN9/src/cmd/devdraw &&am= p; mk install

I'm not sure if = this change should be accepted in p9ports, neither do I know how to propose= it or submit it. So if you think it could be useful, please let me know ho= w it can be done.=A0

Feels good to dig into the depths of some s= oftware you care and change it :)

Rube= n
--20cf3074b55288afa504d9b54bb3--