Solution for touchpad missing right click

I was facing the problem that multitouch is not yet supported on Haiku and my laptop touchpad doesn’t have physical buttons. That meant that I have been living for a while without right click.

Inspired by the fact that on Tracker it was possible to open the right click menu also by performing CTRL+CLICK, I made GitHub - amol-/haiku_rclick_filter: Input Filter for Haiku that turns CTRL+CLICK to a right click. Helpful for touchpads missing right click.

The filter can be easily installed by running make install and it will immediately allow to use CTRL+click everywhere to simulate a right click. (When installing, sometimes the system becomes unstable due to the restart of input_server, but after rebooting once it goes back to being stable).

I share it here hoping it can be helpful to other people too.

4 Likes

Nice. I didn’t even thnk of CTRL click. I just installed Haiku on my laptop. Really just acts like a mouse, as two-finger click, scrolling, and tap to click do not work.

There’s no need for an input server filter for this, if you open Input preferences and change your mouse type to “1-button”, it will work out of the box. Always remember to read the manual!

3 Likes

Yes, sadly my new laptop doesn’t have that setting anymore. It was only available on the old Hawuei Matebook that I used for Haiku before. So I implemented this work-around

mouse_sshot

1 Like

Touchpads should support this automatically, I think. If they don’t, please file a ticket so we can fix that!

1 Like

There has been an open ticket for that issue for a few years → #5179 (Touchpad buttons not working correctly due to missing ClickPad support) – Haiku

My laptop is a Dell XPS 13 like the one mentioned in the recent ticket comment.

1 Like

I worked a bit on a patch: https://review.haiku-os.org/c/haiku/+/4425
But not having one such machine myself it’s not easy to test and make progress on this.

1 Like

Do you mean that ctrl-click consistently works only if 1-button is selected?
If that’s the case, the documentation does not read that explicitly.
On my MacBook Air the trackpad is initialized in HID mode only (i.e. no multitouch), if I keep the default settings (3-button mouse IIRC) only the Tracker supports ctrl-click. Could you confirm that?

Yes, Tracker has some older code that’s always enabled, and a few extra things work if you set your mouse to 1-button mode (it’s probably far from perfect however).

In some places, a “long click” (hold the mouse button without moving) is also used.

FWIW, for me it doesn’t matter if I’ve set my ‘mice’ in Input prefs to 1 or 3 buttons. CTRL+left-click to simulate a right-click only seems to work in Tracker and the Input preferences…

That probably deserves a bug ticket then. I guess we should decide whether to remove the special-case code in Tracker also and just fix this “globally”…

1 Like

@javanx’ input filter works great an my MacBook while all other canonical solutions fail. Good job!
Now I’m wondering if there is a way to create an input filter that simulates the two-finger scrolling.
I think of something like ctrl+option+mouse vertical movement.
B_MOUSE_MOVE message doesn’t seem to have a modifiers field. Is there a way to intercept this combination?

It’s a bit sad to see all this done in 3rd party input filters when really it could just as easily (or even, more easily) be added into Haiku touchpad driver?

It’s not either easy or sad. It’s a matter of balance between cost and benefit.
I’m specifically talking about the MacBook trackpad which is all but simple to program. For me, at least.
I’ve tried to figure out how to implement a driver for usb based trackpads (I.e not SPI-based before 2016) studying Linux and FreeBSD drivers but I put it on hold to focus on other projects.
Moreover, I seldom use that MacBook so it’s not worth too much effort for me.
If it was for another more widespread trackpad I’d definitely agree with you.
For a very specific not so common device like the MacBook’s trackpad and for my needs then I would go for a dirty workaround like this.

Oh and this dirty workaround doesn’t actually prevents me or others from implementing a full-fledged driver for Apple Fountain/Geyser and Wellspring generations (circa 2005-2015) in the future. But it would require time and willingness…

There is a part of the touchpad driver that lives completely in input_server just like filters, but it has a bit more low-level info (mostly, which device the input comes from). So, I was thinking more of moving the code there, rather than making a full native driver.

But a more complete driver will probably be needed for multi-finger scrolling anyway.

I totally get the frustration, but as a maintainer of opensource projects myself I’d like to bring the point of view that a user scratching his own itch is something the project should try to optimise for, incentive and celebrate.

You can’t exactly expect a new user like me, who just learnt what a BMessage is to write that input filter, to start with writing a kernel level contribution as its first thing.
I personally celebrate the fact that I was able to solve my own problem quickly and in userland as an achievement of Haiku. Haiku design and architecture allowed me to do so and that made me more interested in the project. If input_server wasn’t there, or it didn’t support filters or it didn’t allow to be restarted at runtime, I might have never invested the time required to develop a real driver that would require a reboot any time I want to test it.

Let’s not make perfect the enemy of good enough, a simple input_filter could become just the first of a long list of continuously improving contributions from a user if incentivised, or it can become a missed opportunity if the user is immediately scared away :wink:

2 Likes

Writing Kernel code is not harder than writing userspace code :smiley:

Anyway, yes, it’s great that you found a way to make this work and that other people find it helpful :slight_smile:

And it would not be the first time that such a solution eventually ends up being integrated in Haiku with few changes, it’s the case for the input server add-on that disables the touchpad while typing on the keyboard for example.

We’re talking about a global key-mouse-combo here, not something touchpad driver specific, right?
So, global key-mouse-combos to simulate a right-click (and a middle-click), but only if the Input settings have a single-button (or two-button) mouse configured?

Let’s say:

  • Right-click = CTRL+left-click
  • Middle-click = CTRL+OPT+left-click

If this is a global key-mouse-combo, will application still work that already use CTRL+left-click? ArtPaint for example shows a colour picker, WonderBrush and Icon-O-Matic remove a vertice from a shape.