Skip to content

Commit

Permalink
Auto merge of #15333 - mbrubeck:update_mouse_position_when_receiving_…
Browse files Browse the repository at this point in the history
…wheel_events, r=mbrubeck

update mouse position when receiving mouse wheel events

Rebase of #14808.

---
- [x] `./mach build -d` does not report any errors
- [x] `./mach test-tidy` does not report any errors
- [x] These changes fix #14290 (github issue number if applicable).
- [ ] There are tests for these changes OR
- [ ] These changes do not require tests because _____

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/15333)
<!-- Reviewable:end -->
  • Loading branch information
bors-servo committed Feb 1, 2017
2 parents d161f6e + 7717e83 commit 8b9dc93
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 9 deletions.
14 changes: 7 additions & 7 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion ports/glutin/Cargo.toml
Expand Up @@ -17,7 +17,7 @@ log = "0.3.5"
msg = {path = "../../components/msg"}
net_traits = {path = "../../components/net_traits"}
script_traits = {path = "../../components/script_traits"}
servo-glutin = "0.6"
servo-glutin = "0.7"
servo_geometry = {path = "../../components/geometry"}
servo_config = {path = "../../components/config"}
servo_url = {path = "../../components/url"}
Expand Down
7 changes: 6 additions & 1 deletion ports/glutin/window.rs
Expand Up @@ -421,12 +421,17 @@ impl Window {
self.event_queue.borrow_mut().push(
WindowEvent::MouseWindowMoveEventClass(TypedPoint2D::new(x as f32, y as f32)));
}
Event::MouseWheel(delta, phase) => {
Event::MouseWheel(delta, phase, pos) => {
let (dx, dy) = match delta {
MouseScrollDelta::LineDelta(dx, dy) => (dx, dy * LINE_HEIGHT),
MouseScrollDelta::PixelDelta(dx, dy) => (dx, dy),
};
let scroll_location = ScrollLocation::Delta(TypedPoint2D::new(dx, dy));
if let Some((x, y)) = pos {
self.mouse_pos.set(Point2D::new(x, y));
self.event_queue.borrow_mut().push(
WindowEvent::MouseWindowMoveEventClass(TypedPoint2D::new(x as f32, y as f32)));
};
let phase = glutin_phase_to_touch_event_type(phase);
self.scroll_window(scroll_location, phase);
},
Expand Down

0 comments on commit 8b9dc93

Please sign in to comment.