Skip to content

Commit

Permalink
Revert hscroll on mac
Browse files Browse the repository at this point in the history
The previous hscroll was based on a wrong precedence set by windows.

The PR to fix this on windows is at rust-windowing#2101

With this PR we now match what GLFW does: https://github.com/glfw/glfw/blob/53d86c64d709ff52886580d338d9b3b2b1f27266/src/cocoa_window.m#L614:L627

This will remove the need for a workaround in my egui crate at https://github.com/emilk/egui/blob/master/egui-winit/src/lib.rs#L456-L460
  • Loading branch information
emilk committed Jan 3, 2022
1 parent 25ff30e commit b533fc0
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
- On X11, add mappings for numpad comma, numpad enter, numlock and pause.
- On macOS, fix Pinyin IME input by reverting a change that intended to improve IME.
- On Windows, fix a crash with transparent windows on Windows 11.
- On Mac, reversed horizontal scrolling in `WindowEvent::MouseWheel` to match the direction of vertical scrolling.

# 0.26.0 (2021-12-01)

Expand Down
3 changes: 1 addition & 2 deletions src/platform_impl/macos/view.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1002,8 +1002,7 @@ extern "C" fn scroll_wheel(this: &Object, _sel: Sel, event: id) {
let state = &mut *(state_ptr as *mut ViewState);

let delta = {
// macOS horizontal sign convention is the inverse of winit.
let (x, y) = (event.scrollingDeltaX() * -1.0, event.scrollingDeltaY());
let (x, y) = (event.scrollingDeltaX(), event.scrollingDeltaY());
if event.hasPreciseScrollingDeltas() == YES {
let delta = LogicalPosition::new(x, y).to_physical(state.get_scale_factor());
MouseScrollDelta::PixelDelta(delta)
Expand Down

0 comments on commit b533fc0

Please sign in to comment.