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

Use a faster scroll speed under X11 #6373

Merged
merged 1 commit into from Jun 22, 2015
Merged
Changes from all commits
Commits
File filter...
Filter file types
Jump to…
Jump to file
Failed to load files.

Always

Just for now

Some generated files are not rendered by default. Learn more.

Some generated files are not rendered by default. Learn more.

@@ -28,7 +28,7 @@ use compositing::windowing::{MouseWindowEvent, WindowNavigateMsg};
#[cfg(feature = "window")]
use euclid::point::Point2D;
#[cfg(feature = "window")]
use glutin::{Api, ElementState, Event, GlRequest, MouseButton, VirtualKeyCode};
use glutin::{Api, ElementState, Event, GlRequest, MouseButton, VirtualKeyCode, MouseScrollDelta};
#[cfg(feature = "window")]
use msg::constellation_msg::{KeyState, CONTROL, SHIFT, ALT};
#[cfg(feature = "window")]
@@ -187,15 +187,25 @@ impl Window {
Event::MouseWheel(delta) => {
if self.ctrl_pressed() {
// Ctrl-Scrollwheel simulates a "pinch zoom" gesture.
if delta < 0 {
let dy = match delta {
MouseScrollDelta::LineDelta(_, dy) => dy,
MouseScrollDelta::PixelDelta(_, dy) => dy
};
if dy < 0.0 {
self.event_queue.borrow_mut().push(WindowEvent::PinchZoom(1.0/1.1));
} else if delta > 0 {
} else if dy > 0.0 {
self.event_queue.borrow_mut().push(WindowEvent::PinchZoom(1.1));
}
} else {
let dx = 0.0;
let dy = delta as f32;
self.scroll_window(dx, dy);
match delta {
MouseScrollDelta::LineDelta(dx, dy) => {
// this should use the actual line height
// of the frame under the mouse
let line_height = 57.0;
self.scroll_window(dx, dy * line_height);
}
MouseScrollDelta::PixelDelta(dx, dy) => self.scroll_window(dx, dy)
}
}
},
Event::Refresh => {
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.