9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
From: "Rubén Berenguel" <ruben@mostlymaths.net>
To: Fans of the OS Plan 9 from Bell Labs <9fans@9fans.net>
Subject: [9fans] The 2-1 chord in P9Ports Acme (Mac OS)
Date: Sat,  6 Apr 2013 20:22:46 +0200	[thread overview]
Message-ID: <CAHk2O6oyCy_mNK3TfXq16_EbPtP1u8uFCT=chH5PS8MzERQumg@mail.gmail.com> (raw)

[-- 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 --]

             reply	other threads:[~2013-04-06 18:22 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-04-06 18:22 Rubén Berenguel [this message]
2013-04-06 22:24 ` a
2013-04-06 22:40   ` Rubén Berenguel
2013-04-07  0:06     ` a

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAHk2O6oyCy_mNK3TfXq16_EbPtP1u8uFCT=chH5PS8MzERQumg@mail.gmail.com' \
    --to=ruben@mostlymaths.net \
    --cc=9fans@9fans.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).