Skip to content

Support mouse scroll in X11.#961

Merged
xStrom merged 6 commits intolinebender:masterfrom
jneem:x11-scroll
May 20, 2020
Merged

Support mouse scroll in X11.#961
xStrom merged 6 commits intolinebender:masterfrom
jneem:x11-scroll

Conversation

@jneem
Copy link
Member

@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
Member 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.

@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