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

* Re: [9fans] The 2-1 chord in P9Ports Acme (Mac OS)
  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
  0 siblings, 1 reply; 4+ messages in thread
From: a @ 2013-04-06 22:24 UTC (permalink / raw)
  To: 9fans

Apple has no such "odd stance" against multi-button mice.
Buy one and plug it in. It's worked just fine at least since OS X
came out. The chording will be vastly more comfortable that
way. The keyboard mapping (even with your patch, which
does seem to be an improvement) is intended as a fallback.

It would be interesting to see more experiments using these
devices multitouch capabilities in the context of the plan 9
graphics model.

Anthony




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

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

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

Oh I wasn't meaning Apple forbids 3-button mice, but just a side remark at
the fact that they only create one-buttoned things. I do have a 3-button
mouse I plug occasionally to my Mac, but most often than not I forget it at
home (or I'm too lazy to pick it up) and having this keyboard fallback is
neat: so far I have used 2-1 VERY sparingly because of it.

There's also a patch lying in the internet (or the group archives) using
trackpad gestures to get this. I think having gestures is a good way to go
in this particular case, but since my Mac is old I don't have multitouch by
default (I have a Magic Trackpad for that.) I think I will add that patch
and check how good gestures feel for the chording in Acme.

I'm not sure how/what could be used as gestures in a "Plan9 world" but this
is probably because I don't use Plan9 enough... I do use Acme daily for my
unorganized writing and occasional go tinkering (still not far from being a
"hello world" go programmer,) emacs for the rest of the writing. What do
you think would fit the model (inside Acme, I mean)?

Thanks,

Ruben


On Sun, Apr 7, 2013 at 12:24 AM, <a@9srv.net> wrote:

> Apple has no such "odd stance" against multi-button mice.
> Buy one and plug it in. It's worked just fine at least since OS X
> came out. The chording will be vastly more comfortable that
> way. The keyboard mapping (even with your patch, which
> does seem to be an improvement) is intended as a fallback.
>
> It would be interesting to see more experiments using these
> devices multitouch capabilities in the context of the plan 9
> graphics model.
>
> Anthony
>
>
>

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

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

* Re: [9fans] The 2-1 chord in P9Ports Acme (Mac OS)
  2013-04-06 22:40   ` Rubén Berenguel
@ 2013-04-07  0:06     ` a
  0 siblings, 0 replies; 4+ messages in thread
From: a @ 2013-04-07  0:06 UTC (permalink / raw)
  To: 9fans

// What do you think would fit the model (inside Acme, I mean)?

I don't really know - that's why I said I wanted to see experiments. ;-)

You already mentioned one patch, and I think it's a good start. It was
pretty comfortable when I was using it regularly (I don't use the p9p
graphics bits much any more). I'm not sure it was quite right, but I
think that was mostly just tuning.

Beyond replicating the existing chords or the functions they invoke,
it's harder to know what various ideas would actually feel like to use.
For example, I could see repurposing the gestures OS X usually uses
for exposé (do they still call it that?) for the effects currently achieved
by clicking different buttons in the box just to the left of the tag. I'd like
to be able to, say, flick down and have the window the pointer's in go
to the bottom of the column, as if I'd just middle-clicked the box in the
next window above it. I could see having something assigned to Del
a window being nice.

Ideas are easy. Without implementing some of them, it's nearly
impossible to know what it'd actually feel like to use, and that's what
matters.

I've suggested this as a GSoC project before, and I still think it'd be a
fun thing to do for someone reasonably familiar with the OS X (or
some other platform) multitouch interface. With drawterm, it'd be
even more exciting to define what a, say, /dev/multitouch would
look like and how native software could use it, without having to do
the hardware drivers for Plan 9 (yet) (unless you're into that sort of
thing, of course).

Anthony




^ 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).