-
Notifications
You must be signed in to change notification settings - Fork 2.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add support for forward and back mouse buttons #1919
base: master
Are you sure you want to change the base?
Conversation
This MR should partly fix #1920, but only on chromium. |
This commit implements the extendedMouseButtons pseudo-encoding, which makes it possible to use the forward and back mouse buttons.
897d269
to
e3195f7
Compare
* NOTE: This only works on chromium-based browsers. There is | ||
* no support for firefox/safari. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Strictly speaking, Safari has buggy support rather than no support. Right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Correct.
I just realized that safari send the incorrect ev.button
value, but the button mask ev.buttons
seems to work correctly. With back pressed, ev.buttons
is 8, and with forward pressed, it is 16.
We could look at those instead of keeping mouse button state ourselves?
it('should send correct data for extended pointer events', function () { | ||
RFB.messages.extendedPointerEvent(sock, 12345, 54321, 0xab); | ||
let expected = | ||
[ 5, 0xab, 0x30, 0x39, 0xd4, 0x31, 0x01]; | ||
expect(sock).to.have.sent(new Uint8Array(expected)); | ||
}); | ||
}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We'd also like tests for the interaction with the pseudo-encoding and pseudo-rect.
[ 5, 0xab, 0x30, 0x39, 0xd4, 0x31]; | ||
[ 5, 0x2b, 0x30, 0x39, 0xd4, 0x31]; | ||
expect(sock).to.have.sent(new Uint8Array(expected)); | ||
}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The masking should probably be tested as an explicitly different test.
This commit implements the extendedMouseButtons pseudo-encoding, which makes it possible to use the forward and back mouse buttons.
It looks like chromium is the only browser that has support for this currently. See #1918 for more info.
Confirmed that it works with chromium on Mac, Linux and Windows against TigerVNC server.