summaryrefslogtreecommitdiff
path: root/Userland/Applications
diff options
context:
space:
mode:
authorcircl <circl.lastname@gmail.com>2022-03-26 23:04:47 +0100
committerAndreas Kling <kling@serenityos.org>2022-03-27 01:11:27 +0100
commiteeeaf410fbe4735a3495f1cec05b22cc25b2a904 (patch)
tree4cbc7911d22e21af838c62121cae29f4e0158777 /Userland/Applications
parent148f8169a4f2181e5f9a62e61dd6eedfadf99e3f (diff)
downloadserenity-eeeaf410fbe4735a3495f1cec05b22cc25b2a904.zip
WindowServer+LibGUI: Expose raw scroll wheel values to applications
This is useful, for instance, in games in which you can switch held items using the scroll wheel. In order to implement this, they previously would have to either add a hard-coded division by 4, or look up your mouse settings to adjust correctly. This commit adds an MouseEvent.wheel_raw_delta_x() and MouseEvent.wheel_raw_delta_y().
Diffstat (limited to 'Userland/Applications')
-rw-r--r--Userland/Applications/PixelPaint/ImageEditor.cpp4
-rw-r--r--Userland/Applications/Spreadsheet/SpreadsheetView.cpp4
2 files changed, 6 insertions, 2 deletions
diff --git a/Userland/Applications/PixelPaint/ImageEditor.cpp b/Userland/Applications/PixelPaint/ImageEditor.cpp
index 72f0574e9f..9718bfd3c6 100644
--- a/Userland/Applications/PixelPaint/ImageEditor.cpp
+++ b/Userland/Applications/PixelPaint/ImageEditor.cpp
@@ -267,6 +267,8 @@ GUI::MouseEvent ImageEditor::event_with_pan_and_scale_applied(GUI::MouseEvent co
event.modifiers(),
event.wheel_delta_x(),
event.wheel_delta_y(),
+ event.wheel_raw_delta_x(),
+ event.wheel_raw_delta_y(),
};
}
@@ -282,6 +284,8 @@ GUI::MouseEvent ImageEditor::event_adjusted_for_layer(GUI::MouseEvent const& eve
event.modifiers(),
event.wheel_delta_x(),
event.wheel_delta_y(),
+ event.wheel_raw_delta_x(),
+ event.wheel_raw_delta_y(),
};
}
diff --git a/Userland/Applications/Spreadsheet/SpreadsheetView.cpp b/Userland/Applications/Spreadsheet/SpreadsheetView.cpp
index f37ebd9ef6..ce8b46665f 100644
--- a/Userland/Applications/Spreadsheet/SpreadsheetView.cpp
+++ b/Userland/Applications/Spreadsheet/SpreadsheetView.cpp
@@ -202,7 +202,7 @@ void InfinitelyScrollableTableView::mousedown_event(GUI::MouseEvent& event)
else if (m_is_hovering_extend_zone)
m_is_dragging_for_extend = true;
auto rect = content_rect_minus_scrollbars(m_target_cell);
- GUI::MouseEvent adjusted_event = { (GUI::Event::Type)event.type(), rect.center(), event.buttons(), event.button(), event.modifiers(), event.wheel_delta_x(), event.wheel_delta_y() };
+ GUI::MouseEvent adjusted_event = { (GUI::Event::Type)event.type(), rect.center(), event.buttons(), event.button(), event.modifiers(), event.wheel_delta_x(), event.wheel_delta_y(), event.wheel_raw_delta_x(), event.wheel_raw_delta_y() };
AbstractTableView::mousedown_event(adjusted_event);
} else {
AbstractTableView::mousedown_event(event);
@@ -239,7 +239,7 @@ void InfinitelyScrollableTableView::mouseup_event(GUI::MouseEvent& event)
m_has_committed_to_extending = false;
if (m_is_hovering_cut_zone || m_is_hovering_extend_zone) {
auto rect = content_rect_minus_scrollbars(m_target_cell);
- GUI::MouseEvent adjusted_event = { (GUI::Event::Type)event.type(), rect.center(), event.buttons(), event.button(), event.modifiers(), event.wheel_delta_x(), event.wheel_delta_y() };
+ GUI::MouseEvent adjusted_event = { (GUI::Event::Type)event.type(), rect.center(), event.buttons(), event.button(), event.modifiers(), event.wheel_delta_x(), event.wheel_delta_y(), event.wheel_raw_delta_x(), event.wheel_raw_delta_y() };
TableView::mouseup_event(adjusted_event);
} else {
TableView::mouseup_event(event);