-
Notifications
You must be signed in to change notification settings - Fork 903
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
Fix x11 mouse scroll wheel #218
Conversation
Scroll direction seems correct to me--positive is down and right. What behavior are you observing? What do other platforms do? Bear in mind that some platforms (e.g. OSX) have a reversed direction convention.
That part looks good, thanks. |
Well this is weird. Found a file in /etc/X11/xorg.conf.d
I removed the file and rebooted. Then I readded the file and rebooted. The file has probably been there for years. (I dont actually know why I added it or what it was for) I guess its just an X11 bug that didnt occur in the previous way winit used the API. |
I have removed my incorrect change to direction. The scroll position update should be good to merge. |
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, just one quibble.
src/platform/linux/x11/mod.rs
Outdated
@@ -406,7 +406,7 @@ impl EventsLoop { | |||
for i in 0..xev.valuators.mask_len*8 { | |||
if ffi::XIMaskIsSet(mask, i) { | |||
if let Some(&mut (_, ref mut info)) = physical_device.scroll_axes.iter_mut().find(|&&mut (axis, _)| axis == i) { | |||
let delta = (unsafe { *value } - info.position) / info.increment; | |||
let delta = (unsafe { *value } - info.position) / info.increment; // TODO: Doesn't handle underflow/overflow |
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.
Is overflow a realistic concern here? The range of double is astronomical, and we're only computing differences between successive values delivered by X.
Didnt pay attention to the type, good point! |
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.
Changes look good to me, though @tomaka might want you to drop the version bump.
@@ -1,6 +1,6 @@ | |||
[package] | |||
name = "winit" | |||
version = "0.7.2" | |||
version = "0.7.3" |
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.
I think bumping this is usually left for the maintainer to do immediately prior to making a release.
I don't mind the version bump. |
fixes and a possible canvas addition
Fixes: #217
(unsafe { *value } - info.position)