Forward and back mouse button support.

56 views
Skip to first unread message

Manuel Fernandez

unread,
Dec 29, 2023, 3:13:09 AM12/29/23
to TigerVNC Developer Discussion
Hello,

I've implemented support for the forward and back mouse buttons. I use those buttons often to navigate with my web browser and file manager. I was wondering if there's interest in merging it upstream.

The way it works is through the pseudo encodings. There's a new encoding called pseudoEncodingExtendedMouseButtons, which the server and client verify if there's support. if both have support they start communicating with a larger mouse button packet. Needed to support the 2 extra button bits.

Since there's a small handshake there the server and client are backward compatible.

The only worry i have is on the button assignments. In FLTK my mouse buttons are 4 and 5. In java they're 6 and 7. I'm not sure if it's true for all mice. It's just true for my mouse. If it's not the case it would need a config section.

The changes can seen here;

Pierre Ossman

unread,
Dec 29, 2023, 3:14:25 AM12/29/23
to Manuel Fernandez, TigerVNC Developer Discussion
On 28/12/2023 21:46, Manuel Fernandez wrote:
> Hello,
>
> I've implemented support for the forward and back mouse buttons. I use
> those buttons often to navigate with my web browser and file manager. I was
> wondering if there's interest in merging it upstream.
>

Sure. Please send a PR and we can examine the changes there.

Regards
--
Pierre Ossman Software Development
Cendio AB https://cendio.com
Teknikringen 8 https://twitter.com/ThinLinc
583 30 Linköping https://facebook.com/ThinLinc
Phone: +46-13-214600

A: Because it messes up the order in which people normally read text.
Q: Why is top-posting such a bad thing?

DRC

unread,
Jan 7, 2024, 4:40:40 PM1/7/24
to tigervn...@googlegroups.com
Here's how my Logitech mouse behaves, for reference:

On Linux, the forward and back buttons map to Buttons 6 and 7 in Java
and Buttons 8 and 9 in X11, and the left and right wheel clicks map to
Buttons 4 and 5 in Java and Buttons 6 and 7 in X11.  That makes sense,
because X11 uses Buttons 4 and 5 for scroll wheel up and down, but Java
uses a different type of event (MouseWheelEvent rather than MouseEvent)
for scroll wheel up and down, so it doesn't have to use Buttons 4 and 5
for that.

On macOS and Windows, the forward and back buttons map to Buttons 4 and
5 in Java, and the left and right wheel clicks produce a MouseWheelEvent
instead of a MouseEvent (i.e. they are indistinguishable, as far as Java
is concerned, from scroll wheel up and down.)

If you observe the same thing I observe with Java, then the button
mapping needs to be made contingent upon the client O/S:

X11 client
----------
Java Button 4 --> RFB Button 6
Java Button 5 --> RFB Button 7
Java Button 6 --> RFB Button 8
Java Button 7 --> RFB Button 9

macOS or Windows client
-----------------------
Java Button 4 --> RFB Button 8
Java Button 5 --> RFB Button 9

Double check which button numbers are used when you plug your mouse
directly into a Linux machine.  If the forward and back buttons
correspond to X11 Buttons 8 and 9, then that is consistent with what I
observe, and those are the button numbers you should use for the forward
and back button RFB events.  I would suggest testing the three major
client O/S's, as I did above, to see if your mouse behaves similarly
across those platforms.  Also figure out what maps to Buttons 4 and 5 in
Java.

My viewer uses only Java, so I didn't test FLTK.
Reply all
Reply to author
Forward
0 new messages