9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
* [9fans] The 2-1 chord in P9Ports Acme (Mac OS)
@ 2013-04-06 18:22 Rubén Berenguel
  2013-04-06 22:24 ` a
  0 siblings, 1 reply; 4+ messages in thread
From: Rubén Berenguel @ 2013-04-06 18:22 UTC (permalink / raw)
  To: Fans of the OS Plan 9 from Bell Labs

[-- Attachment #1: Type: text/plain, Size: 1720 bytes --]

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

[-- Attachment #2: Type: text/html, Size: 2756 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2013-04-07  0:06 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-04-06 18:22 [9fans] The 2-1 chord in P9Ports Acme (Mac OS) Rubén Berenguel
2013-04-06 22:24 ` a
2013-04-06 22:40   ` Rubén Berenguel
2013-04-07  0:06     ` a

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).