-
Notifications
You must be signed in to change notification settings - Fork 946
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 #1826
base: master
Are you sure you want to change the base?
Conversation
To follow this new PR :) |
7e42f8d
to
278dc8e
Compare
I've now updated (*) There is still a known bug where |
0be43b0
to
48af569
Compare
Seems like the close button is not respected on macOS (minimize/maximize works), will have to do some digging to find out why that is. |
I've fixed the issued and updated my branch. Most of the work was done in cfe40cc, which has a very hacky solution to fix resizing on macOS. |
There appears to still be some issues: When I start vncviewer on Linux, the cursor is invisible until I enter and leave the window once. On Windows, the window buttons (minimize, maximize, close) don't work (we should return 0 instead of consuming the events). Also, the viewer doesn't detect WM_MOUSELEAVE / mouse-enter unless I lose focus and get window focus again. On macOS, the resizing is still a bit buggy and can leave the window in a broken state where the viewer can't be resized / loses input. |
4ce6d23
to
f82a074
Compare
There is also a bug on all platforms where pressing the forward button while moving the mouse will trigger a push/release/push instantly. Haven't looked into why this happens, but I've seen it on all platforms with three different mice. |
I've opened a PR to FLTK to fix forward/back mouse button support for macOS and Windows: With this fix in FLTK, the TigerVNC code can be immensely simplified. I've updated my branch to reflect the changes done in the PR. |
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.
Looks really nice! Great work!
There are some minor tweaks, but we are pretty much done.
Please also organise the commit history to something more final.
02b065c
to
d62899d
Compare
I've addressed most of the comments and rebased/cleaned up my commits. |
1747194
to
dc3dcbe
Compare
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.
For the commit message; full URLs are preferred to references that only work in GitHub. Or perhaps omit that reference to the old PR and just like it here in the new PR?
Same with using GitHub usernames. If it's a commit message, then a name (and possibly email) is best. Just like for git's author/committer.
unix/xserver/hw/vnc/vncInput.c
Outdated
@@ -207,6 +207,24 @@ static int vncPointerProc(DeviceIntPtr pDevice, int onoff) | |||
btn_labels[5] = XIGetKnownProperty(BTN_LABEL_PROP_BTN_HWHEEL_LEFT); | |||
btn_labels[6] = XIGetKnownProperty(BTN_LABEL_PROP_BTN_HWHEEL_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.
Indentation is off here.
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.
Whoops, looks like the file uses tabs and not spaces.
@@ -50,7 +50,7 @@ extern const unsigned int code_map_qnum_to_xorgevdev_len; | |||
extern const unsigned short code_map_qnum_to_xorgkbd[]; | |||
extern const unsigned int code_map_qnum_to_xorgkbd_len; | |||
|
|||
#define BUTTONS 7 | |||
#define BUTTONS 9 |
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.
Does this implicitly also make unknown bits ignored? Or are they just unlabeled and perhaps wrong?
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've explicitly labelled and initialized 9 buttons. We then loop through the mask, bits set in the higher range are ignored:
void vncPointerButtonAction(int buttonMask)
{
int i;
ValuatorMask mask;
for (i = 0; i < BUTTONS; i++) {
if ((buttonMask ^ oldButtonMask) & (1 << i)) {
int action = (buttonMask & (1<<i)) ?
ButtonPress : ButtonRelease;
valuator_mask_set_range(&mask, 0, 0, NULL);
QueuePointerEvents(vncPointerDev, action, i + 1,
POINTER_RELATIVE, &mask);
}
}
oldButtonMask = buttonMask;
}
2fbc92b
to
bfece3f
Compare
bfece3f
to
bda5a3d
Compare
3202331
to
7a34e39
Compare
Almost complete. x0vncserver doesn't work correctly for some reason. Only the back button works, not the forward button. |
7a34e39
to
1c2f07f
Compare
1c2f07f fixes this, but this would have to be updated if we want to add support for more buttons in the future. |
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.
Seems to work correctly now. Good work!
But I think a tweak is needed on which change is in which commit.
152e92b
to
d57a33b
Compare
This commit adds support for the pseudo-encoding ExtendedMouseButtons in Xvnc and x0vncserver, which makes it possible to use to use the back/forward mouse buttons. This commit contains work originally done by PixelSmith <[email protected]>.
It makes more sense to use bit shifts instead of decimals for each button.
This commit implements the pseudo-encoding ExtendedMouseButtons which makes it possible to use the back/forward mouse buttons. This commit contains work originally done by PixelSmith <[email protected]>.
d57a33b
to
c40d8a4
Compare
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.
Looks good!
When can we expect fltk/fltk#1083 to be merged? I don't want to risk the API changing.
And @bphinz, I assume you can easily add that PR to your FLTK build?
The FLTK fix has already been merged into master: fltk/fltk#1081 and should be part of the upcoming 1.4.0 API. Regarding the backport to 1.3 , it looks like it might be a while: fltk/fltk#1083 (comment) |
We are targeting FLTK 1.3, not 1.4, so we need to have some confirmation that we can start relying on this API. Otherwise we might end up in a mess where there are several version with subtle differences that we somehow need to handle. |
Sorry, our release process for 1.4.0 will take a while, depending on the number of RC's we need to publish. RC2 will certainly follow because we do already have one essential fix. Each RC is scheduled one week after the previous one and the final release will typically be two weeks after the last RC, i.e. the final release will be published if we don't have any issues for two weeks. I can't backport the changes to 1.3.10 (i.e. merge the existing PR) before 1.4.0 has been released which will not be before about 3 weeks from now (or later if more RC's are required, see above). |
We don't have to wait for a 1.3.10 release. We can apply a patch to our builds until then. But we need to know that you are happy with the API, and we won't have to change things once 1.3.10 is out. |
I am happy with it, as it stands now, but ...
As you certainly know the future is hard to predict. Therefore I can't give any guarantees that the API doesn't have to be changed later, but I'm pretty confident that this won't happen. Once 1.4.0 is finally released chances are even better that the API won't be changed in incompatible ways and I'll begin to verify and merge the open PR to 1.3.10. That's all I can say for sure. Sorry. |
This is a continuation of the work initially done by manny33 in #1711:
This PR intends to add support for forward and back mouse buttons by extending RFB with the pseudo-encoding
ExtendedMouseButtons
, which is IANA registered and has an open draft PR on rfbproto:In its current state, this PR has a working implementation that works on Windows, Mac and Linux (with some issues that are being worked on).
I'm quite content with the RFB implementation on the VNC side, but the client-side implementation in Viewport.cxx is currently being re-written quite extensively so that all mouse events are handled with native code instead of using a combination of FLTK and native code.
This is still a work in progress, and commits will be cleaned up / rebased.