diff options
author | Dmitry Petrov <dpetroff@gmail.com> | 2021-12-13 23:22:28 +0100 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2022-01-20 10:37:52 +0100 |
commit | 166221373755503134716317a51762a5fbedf3a7 (patch) | |
tree | c7e5c2396144611c22dad9d749016b4151d1b0c3 /Userland/Applications | |
parent | d61cc47055e27b007005ac2355728ce54cbbb50b (diff) | |
download | serenity-166221373755503134716317a51762a5fbedf3a7.zip |
Userland: Add horizontal mouse scroll support
Diffstat (limited to 'Userland/Applications')
-rw-r--r-- | Userland/Applications/3DFileViewer/main.cpp | 2 | ||||
-rw-r--r-- | Userland/Applications/PDFViewer/PDFViewer.cpp | 2 | ||||
-rw-r--r-- | Userland/Applications/Piano/RollWidget.cpp | 9 | ||||
-rw-r--r-- | Userland/Applications/PixelPaint/ImageEditor.cpp | 6 | ||||
-rw-r--r-- | Userland/Applications/SpaceAnalyzer/TreeMapWidget.cpp | 4 |
5 files changed, 15 insertions, 8 deletions
diff --git a/Userland/Applications/3DFileViewer/main.cpp b/Userland/Applications/3DFileViewer/main.cpp index 996018dff1..6a660cc9a3 100644 --- a/Userland/Applications/3DFileViewer/main.cpp +++ b/Userland/Applications/3DFileViewer/main.cpp @@ -156,7 +156,7 @@ void GLContextWidget::mousemove_event(GUI::MouseEvent& event) void GLContextWidget::mousewheel_event(GUI::MouseEvent& event) { - if (event.wheel_delta() > 0) + if (event.wheel_delta_y() > 0) m_zoom /= 1.1f; else m_zoom *= 1.1f; diff --git a/Userland/Applications/PDFViewer/PDFViewer.cpp b/Userland/Applications/PDFViewer/PDFViewer.cpp index ccc79e544e..b8007a3369 100644 --- a/Userland/Applications/PDFViewer/PDFViewer.cpp +++ b/Userland/Applications/PDFViewer/PDFViewer.cpp @@ -75,7 +75,7 @@ void PDFViewer::mousewheel_event(GUI::MouseEvent& event) if (!m_document) return; - bool scrolled_down = event.wheel_delta() > 0; + bool scrolled_down = event.wheel_delta_y() > 0; if (event.ctrl()) { if (scrolled_down) { diff --git a/Userland/Applications/Piano/RollWidget.cpp b/Userland/Applications/Piano/RollWidget.cpp index 190b6d81a0..23dad13867 100644 --- a/Userland/Applications/Piano/RollWidget.cpp +++ b/Userland/Applications/Piano/RollWidget.cpp @@ -239,7 +239,12 @@ void RollWidget::mouseup_event([[maybe_unused]] GUI::MouseEvent& event) void RollWidget::mousewheel_event(GUI::MouseEvent& event) { if (event.modifiers() & KeyModifier::Mod_Shift) { - horizontal_scrollbar().increase_slider_by(event.wheel_delta() * horizontal_scroll_sensitivity); + horizontal_scrollbar().increase_slider_by(event.wheel_delta_y() * horizontal_scroll_sensitivity); + return; + } + + if (event.wheel_delta_x() != 0) { + horizontal_scrollbar().increase_slider_by(event.wheel_delta_x() * horizontal_scroll_sensitivity); return; } @@ -248,7 +253,7 @@ void RollWidget::mousewheel_event(GUI::MouseEvent& event) return; } - double multiplier = event.wheel_delta() >= 0 ? 0.5 : 2; + double multiplier = event.wheel_delta_y() >= 0 ? 0.5 : 2; if (m_zoom_level * multiplier > max_zoom) return; diff --git a/Userland/Applications/PixelPaint/ImageEditor.cpp b/Userland/Applications/PixelPaint/ImageEditor.cpp index a9699e131c..d4b7964f86 100644 --- a/Userland/Applications/PixelPaint/ImageEditor.cpp +++ b/Userland/Applications/PixelPaint/ImageEditor.cpp @@ -257,7 +257,8 @@ GUI::MouseEvent ImageEditor::event_with_pan_and_scale_applied(GUI::MouseEvent co event.buttons(), event.button(), event.modifiers(), - event.wheel_delta() + event.wheel_delta_x(), + event.wheel_delta_y(), }; } @@ -271,7 +272,8 @@ GUI::MouseEvent ImageEditor::event_adjusted_for_layer(GUI::MouseEvent const& eve event.buttons(), event.button(), event.modifiers(), - event.wheel_delta() + event.wheel_delta_x(), + event.wheel_delta_y(), }; } diff --git a/Userland/Applications/SpaceAnalyzer/TreeMapWidget.cpp b/Userland/Applications/SpaceAnalyzer/TreeMapWidget.cpp index a90ae7841b..149baddc19 100644 --- a/Userland/Applications/SpaceAnalyzer/TreeMapWidget.cpp +++ b/Userland/Applications/SpaceAnalyzer/TreeMapWidget.cpp @@ -316,8 +316,8 @@ void TreeMapWidget::doubleclick_event(GUI::MouseEvent& event) void TreeMapWidget::mousewheel_event(GUI::MouseEvent& event) { - int delta = event.wheel_delta(); - // FIXME: The wheel_delta is premultiplied in the window server, we actually want a raw value here. + int delta = event.wheel_delta_y(); + // FIXME: The wheel_delta_y is premultiplied in the window server, we actually want a raw value here. int step_size = GUI::WindowServerConnection::the().get_scroll_step_size(); if (delta > 0) { size_t step_back = delta / step_size; |