From c713fd98dd684b2594f1fd600ca938aa0bbe66f9 Mon Sep 17 00:00:00 2001 From: Emil Ernerfeldt Date: Sun, 16 Jan 2022 09:49:22 +0100 Subject: [PATCH] Fix horizontal scrolling direction on Linux Closes https://github.com/emilk/egui/issues/356 Work-around until https://github.com/rust-windowing/winit/pull/2105 is merged and released --- eframe/CHANGELOG.md | 1 + egui-winit/CHANGELOG.md | 1 + egui-winit/src/lib.rs | 8 ++------ 3 files changed, 4 insertions(+), 6 deletions(-) diff --git a/eframe/CHANGELOG.md b/eframe/CHANGELOG.md index f74e0dad..b704213e 100644 --- a/eframe/CHANGELOG.md +++ b/eframe/CHANGELOG.md @@ -8,6 +8,7 @@ NOTE: [`egui_web`](egui_web/CHANGELOG.md), [`egui-winit`](egui-winit/CHANGELOG.m * Removed `Frame::alloc_texture`. Use `egui::Context::load_texture` instead ([#1110](https://github.com/emilk/egui/pull/1110)). * The default native backend is now `egui_glow` (instead of `egui_glium`) ([#1020](https://github.com/emilk/egui/pull/1020)). * The default web painter is now `egui_glow` (instead of WebGL) ([#1020](https://github.com/emilk/egui/pull/1020)). +* Fix horizontal scrolling direction on Linux. ## 0.16.0 - 2021-12-29 diff --git a/egui-winit/CHANGELOG.md b/egui-winit/CHANGELOG.md index e2eb6621..d6d04c13 100644 --- a/egui-winit/CHANGELOG.md +++ b/egui-winit/CHANGELOG.md @@ -4,6 +4,7 @@ All notable changes to the `egui-winit` integration will be noted in this file. ## Unreleased +* Fix horizontal scrolling direction on Linux. * Replaced `std::time::Instant` with `instant::Instant` for WebAssembly compatability ([#1023](https://github.com/emilk/egui/pull/1023)) diff --git a/egui-winit/src/lib.rs b/egui-winit/src/lib.rs index b87bbdd2..0b91d1d5 100644 --- a/egui-winit/src/lib.rs +++ b/egui-winit/src/lib.rs @@ -453,12 +453,8 @@ impl State { egui::vec2(delta.x as f32, delta.y as f32) / self.pixels_per_point() } }; - if cfg!(target_os = "macos") { - delta.x *= -1.0; // until https://github.com/rust-windowing/winit/pull/2105 is merged and released - } - if cfg!(target_os = "windows") { - delta.x *= -1.0; // until https://github.com/rust-windowing/winit/pull/2101 is merged and released - } + + delta.x *= -1.0; // Winit has inverted hscroll. Remove this line when we update winit after https://github.com/rust-windowing/winit/pull/2105 is merged and released if self.egui_input.modifiers.ctrl || self.egui_input.modifiers.command { // Treat as zoom instead: