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

Use a faster scroll speed under X11

Platforms may report scroll deltas either in
chunks/lines/rows or pixels, depending on the
platform API and device capabilities.

If the platform reports a line/chunk-based delta
then the application needs to convert the delta
into a suitable number of pixels.

This commit just hardcodes it to 57 as
a starting point which matches the value that
Firefox calculates as the max char height
for the root frame on my system.

Fixes #5660
  • Loading branch information
Robert Knight
Robert Knight committed Jun 22, 2015
commit 658df6047703aa24c88dacc0d17fe5076b778186

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.