Skip to content
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

Support mouse scroll in X11. #961

Merged
merged 6 commits into from
May 20, 2020
Merged

Support mouse scroll in X11. #961

merged 6 commits into from
May 20, 2020

Conversation

jneem
Copy link
Collaborator

@jneem jneem commented May 18, 2020

Fixes #921.

Copy link
Member

@xStrom xStrom left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks promising. I have a few requests.

6 => (-120.0, 0.0),
7 => (120.0, 0.0),
_ => {
log::error!("unexpected mouse wheel button: {}", button);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a good spot to return an error instead. Perhaps something like:

_ => return Err(Error::Generic(format!("unexpected mouse wheel button: {}", button))),

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure if this affects your preferred error handling technique, but hitting this case represents a bug in druid-shell. It's impossible for now because we check that the button is between 4 and 7 before calling handle_wheel.

Copy link
Member

@xStrom xStrom May 19, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah I think returning an error in case of invalid input parameters is just fine. Certainly better than generating a zero delta wheel event.

druid-shell/src/platform/x11/window.rs Show resolved Hide resolved
druid-shell/src/platform/x11/window.rs Outdated Show resolved Hide resolved
@xStrom xStrom added S-waiting-on-author waits for changes from the submitter shell/x11 concerns the X11 backend labels May 18, 2020
@xStrom xStrom added S-needs-review waits for review and removed S-waiting-on-author waits for changes from the submitter labels May 20, 2020
Copy link
Member

@xStrom xStrom left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@xStrom xStrom removed the S-needs-review waits for review label May 20, 2020
@xStrom xStrom merged commit 70d5900 into linebender:master May 20, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
shell/x11 concerns the X11 backend
Projects
None yet
Development

Successfully merging this pull request may close these issues.

X11: Add support for the mouse wheel.
2 participants