diff options
Diffstat (limited to 'Userland/Libraries')
23 files changed, 66 insertions, 49 deletions
diff --git a/Userland/Libraries/LibGUI/AbstractScrollableWidget.cpp b/Userland/Libraries/LibGUI/AbstractScrollableWidget.cpp index 963f230c7d..77ec27eda2 100644 --- a/Userland/Libraries/LibGUI/AbstractScrollableWidget.cpp +++ b/Userland/Libraries/LibGUI/AbstractScrollableWidget.cpp @@ -47,11 +47,26 @@ void AbstractScrollableWidget::handle_wheel_event(MouseEvent& event, Widget& eve event.ignore(); return; } - // FIXME: The wheel delta multiplier should probably come from... somewhere? + + int wheel_delta_x { 0 }; + bool vertical_scroll_hijacked { false }; + if (event.shift() || &event_source == m_horizontal_scrollbar.ptr()) { - horizontal_scrollbar().increase_slider_by(event.wheel_delta() * 60); - } else { - vertical_scrollbar().increase_slider_by(event.wheel_delta() * 20); + wheel_delta_x = event.wheel_delta_y(); + vertical_scroll_hijacked = true; + } + + if (event.wheel_delta_x() != 0) { + wheel_delta_x = event.wheel_delta_x(); + } + + if (wheel_delta_x != 0) { + // FIXME: The wheel delta multiplier should probably come from... somewhere? + horizontal_scrollbar().increase_slider_by(wheel_delta_x * 60); + } + + if (!vertical_scroll_hijacked && event.wheel_delta_y() != 0) { + vertical_scrollbar().increase_slider_by(event.wheel_delta_y() * 20); } } @@ -283,5 +298,4 @@ Gfx::IntPoint AbstractScrollableWidget::to_widget_position(const Gfx::IntPoint& widget_position.translate_by(frame_thickness(), frame_thickness()); return widget_position; } - } diff --git a/Userland/Libraries/LibGUI/AbstractZoomPanWidget.cpp b/Userland/Libraries/LibGUI/AbstractZoomPanWidget.cpp index 91e0b488a0..43c0add6bc 100644 --- a/Userland/Libraries/LibGUI/AbstractZoomPanWidget.cpp +++ b/Userland/Libraries/LibGUI/AbstractZoomPanWidget.cpp @@ -111,7 +111,7 @@ Gfx::FloatRect AbstractZoomPanWidget::content_to_frame_rect(Gfx::IntRect const& void AbstractZoomPanWidget::mousewheel_event(GUI::MouseEvent& event) { - float new_scale = scale() / AK::exp2(event.wheel_delta() / wheel_zoom_factor); + float new_scale = scale() / AK::exp2(event.wheel_delta_y() / wheel_zoom_factor); scale_centered(new_scale, event.position()); } diff --git a/Userland/Libraries/LibGUI/ComboBox.cpp b/Userland/Libraries/LibGUI/ComboBox.cpp index ec86eeec6c..8060764999 100644 --- a/Userland/Libraries/LibGUI/ComboBox.cpp +++ b/Userland/Libraries/LibGUI/ComboBox.cpp @@ -36,7 +36,7 @@ private: if (!is_focused()) set_focus(true); if (on_mousewheel) - on_mousewheel(event.wheel_delta()); + on_mousewheel(event.wheel_delta_y()); } virtual void keydown_event(KeyEvent& event) override diff --git a/Userland/Libraries/LibGUI/Event.h b/Userland/Libraries/LibGUI/Event.h index bc1a859914..517650493e 100644 --- a/Userland/Libraries/LibGUI/Event.h +++ b/Userland/Libraries/LibGUI/Event.h @@ -370,13 +370,14 @@ private: class MouseEvent final : public Event { public: - MouseEvent(Type type, const Gfx::IntPoint& position, unsigned buttons, MouseButton button, unsigned modifiers, int wheel_delta) + MouseEvent(Type type, const Gfx::IntPoint& position, unsigned buttons, MouseButton button, unsigned modifiers, int wheel_delta_x, int wheel_delta_y) : Event(type) , m_position(position) , m_buttons(buttons) , m_button(button) , m_modifiers(modifiers) - , m_wheel_delta(wheel_delta) + , m_wheel_delta_x(wheel_delta_x) + , m_wheel_delta_y(wheel_delta_y) { } @@ -390,14 +391,16 @@ public: bool shift() const { return m_modifiers & Mod_Shift; } bool super() const { return m_modifiers & Mod_Super; } unsigned modifiers() const { return m_modifiers; } - int wheel_delta() const { return m_wheel_delta; } + int wheel_delta_x() const { return m_wheel_delta_x; } + int wheel_delta_y() const { return m_wheel_delta_y; } private: Gfx::IntPoint m_position; unsigned m_buttons { 0 }; MouseButton m_button { MouseButton::None }; unsigned m_modifiers { 0 }; - int m_wheel_delta { 0 }; + int m_wheel_delta_x { 0 }; + int m_wheel_delta_y { 0 }; }; class DragEvent final : public Event { diff --git a/Userland/Libraries/LibGUI/OpacitySlider.cpp b/Userland/Libraries/LibGUI/OpacitySlider.cpp index d8cc98e457..be578c0f0e 100644 --- a/Userland/Libraries/LibGUI/OpacitySlider.cpp +++ b/Userland/Libraries/LibGUI/OpacitySlider.cpp @@ -139,7 +139,7 @@ void OpacitySlider::mouseup_event(MouseEvent& event) void OpacitySlider::mousewheel_event(MouseEvent& event) { - decrease_slider_by(event.wheel_delta()); + decrease_slider_by(event.wheel_delta_y()); } } diff --git a/Userland/Libraries/LibGUI/Scrollbar.cpp b/Userland/Libraries/LibGUI/Scrollbar.cpp index 7268a48b98..6d05917962 100644 --- a/Userland/Libraries/LibGUI/Scrollbar.cpp +++ b/Userland/Libraries/LibGUI/Scrollbar.cpp @@ -299,7 +299,7 @@ void Scrollbar::mousewheel_event(MouseEvent& event) { if (!is_scrollable()) return; - increase_slider_by_steps(event.wheel_delta()); + increase_slider_by_steps(event.wheel_delta_y()); Widget::mousewheel_event(event); } diff --git a/Userland/Libraries/LibGUI/Slider.cpp b/Userland/Libraries/LibGUI/Slider.cpp index 15998aa433..333a194144 100644 --- a/Userland/Libraries/LibGUI/Slider.cpp +++ b/Userland/Libraries/LibGUI/Slider.cpp @@ -139,7 +139,7 @@ void Slider::mouseup_event(MouseEvent& event) void Slider::mousewheel_event(MouseEvent& event) { auto acceleration_modifier = step(); - auto wheel_delta = event.wheel_delta(); + auto wheel_delta = event.wheel_delta_y(); if (event.modifiers() == KeyModifier::Mod_Ctrl) acceleration_modifier *= 6; diff --git a/Userland/Libraries/LibGUI/SpinBox.cpp b/Userland/Libraries/LibGUI/SpinBox.cpp index 8036ee6e98..ad988d4681 100644 --- a/Userland/Libraries/LibGUI/SpinBox.cpp +++ b/Userland/Libraries/LibGUI/SpinBox.cpp @@ -87,7 +87,7 @@ void SpinBox::set_range(int min, int max, AllowCallback allow_callback) void SpinBox::mousewheel_event(MouseEvent& event) { - auto wheel_delta = event.wheel_delta() / abs(event.wheel_delta()); + auto wheel_delta = event.wheel_delta_y() / abs(event.wheel_delta_y()); if (event.modifiers() == KeyModifier::Mod_Ctrl) wheel_delta *= 6; set_value(m_value - wheel_delta); diff --git a/Userland/Libraries/LibGUI/ValueSlider.cpp b/Userland/Libraries/LibGUI/ValueSlider.cpp index c1fd24b257..42e09f0be7 100644 --- a/Userland/Libraries/LibGUI/ValueSlider.cpp +++ b/Userland/Libraries/LibGUI/ValueSlider.cpp @@ -162,7 +162,7 @@ void ValueSlider::leave_event(Core::Event&) void ValueSlider::mousewheel_event(MouseEvent& event) { - if (event.wheel_delta() < 0) + if (event.wheel_delta_y() < 0) increase_slider_by(1); else decrease_slider_by(1); diff --git a/Userland/Libraries/LibGUI/Window.cpp b/Userland/Libraries/LibGUI/Window.cpp index d9b74a57e2..539fc680c2 100644 --- a/Userland/Libraries/LibGUI/Window.cpp +++ b/Userland/Libraries/LibGUI/Window.cpp @@ -366,7 +366,7 @@ void Window::handle_mouse_event(MouseEvent& event) if (m_automatic_cursor_tracking_widget) { auto window_relative_rect = m_automatic_cursor_tracking_widget->window_relative_rect(); Gfx::IntPoint local_point { event.x() - window_relative_rect.x(), event.y() - window_relative_rect.y() }; - auto local_event = MouseEvent((Event::Type)event.type(), local_point, event.buttons(), event.button(), event.modifiers(), event.wheel_delta()); + auto local_event = MouseEvent((Event::Type)event.type(), local_point, event.buttons(), event.button(), event.modifiers(), event.wheel_delta_x(), event.wheel_delta_y()); m_automatic_cursor_tracking_widget->dispatch_event(local_event, this); if (event.buttons() == 0) m_automatic_cursor_tracking_widget = nullptr; @@ -375,7 +375,7 @@ void Window::handle_mouse_event(MouseEvent& event) if (!m_main_widget) return; auto result = m_main_widget->hit_test(event.position()); - auto local_event = MouseEvent((Event::Type)event.type(), result.local_position, event.buttons(), event.button(), event.modifiers(), event.wheel_delta()); + auto local_event = MouseEvent((Event::Type)event.type(), result.local_position, event.buttons(), event.button(), event.modifiers(), event.wheel_delta_x(), event.wheel_delta_y()); VERIFY(result.widget); set_hovered_widget(result.widget); if (event.buttons() != 0 && !m_automatic_cursor_tracking_widget) diff --git a/Userland/Libraries/LibGUI/WindowServerConnection.cpp b/Userland/Libraries/LibGUI/WindowServerConnection.cpp index 60490a4129..75812ed9e5 100644 --- a/Userland/Libraries/LibGUI/WindowServerConnection.cpp +++ b/Userland/Libraries/LibGUI/WindowServerConnection.cpp @@ -228,38 +228,38 @@ static MouseButton to_mouse_button(u32 button) } } -void WindowServerConnection::mouse_down(i32 window_id, Gfx::IntPoint const& mouse_position, u32 button, u32 buttons, u32 modifiers, i32 wheel_delta) +void WindowServerConnection::mouse_down(i32 window_id, Gfx::IntPoint const& mouse_position, u32 button, u32 buttons, u32 modifiers, i32 wheel_delta_x, i32 wheel_delta_y) { if (auto* window = Window::from_window_id(window_id)) - Core::EventLoop::current().post_event(*window, make<MouseEvent>(Event::MouseDown, mouse_position, buttons, to_mouse_button(button), modifiers, wheel_delta)); + Core::EventLoop::current().post_event(*window, make<MouseEvent>(Event::MouseDown, mouse_position, buttons, to_mouse_button(button), modifiers, wheel_delta_x, wheel_delta_y)); } -void WindowServerConnection::mouse_up(i32 window_id, Gfx::IntPoint const& mouse_position, u32 button, u32 buttons, u32 modifiers, i32 wheel_delta) +void WindowServerConnection::mouse_up(i32 window_id, Gfx::IntPoint const& mouse_position, u32 button, u32 buttons, u32 modifiers, i32 wheel_delta_x, i32 wheel_delta_y) { if (auto* window = Window::from_window_id(window_id)) - Core::EventLoop::current().post_event(*window, make<MouseEvent>(Event::MouseUp, mouse_position, buttons, to_mouse_button(button), modifiers, wheel_delta)); + Core::EventLoop::current().post_event(*window, make<MouseEvent>(Event::MouseUp, mouse_position, buttons, to_mouse_button(button), modifiers, wheel_delta_x, wheel_delta_y)); } -void WindowServerConnection::mouse_move(i32 window_id, Gfx::IntPoint const& mouse_position, u32 button, u32 buttons, u32 modifiers, i32 wheel_delta, bool is_drag, Vector<String> const& mime_types) +void WindowServerConnection::mouse_move(i32 window_id, Gfx::IntPoint const& mouse_position, u32 button, u32 buttons, u32 modifiers, i32 wheel_delta_x, i32 wheel_delta_y, bool is_drag, Vector<String> const& mime_types) { if (auto* window = Window::from_window_id(window_id)) { if (is_drag) Core::EventLoop::current().post_event(*window, make<DragEvent>(Event::DragMove, mouse_position, mime_types)); else - Core::EventLoop::current().post_event(*window, make<MouseEvent>(Event::MouseMove, mouse_position, buttons, to_mouse_button(button), modifiers, wheel_delta)); + Core::EventLoop::current().post_event(*window, make<MouseEvent>(Event::MouseMove, mouse_position, buttons, to_mouse_button(button), modifiers, wheel_delta_x, wheel_delta_y)); } } -void WindowServerConnection::mouse_double_click(i32 window_id, Gfx::IntPoint const& mouse_position, u32 button, u32 buttons, u32 modifiers, i32 wheel_delta) +void WindowServerConnection::mouse_double_click(i32 window_id, Gfx::IntPoint const& mouse_position, u32 button, u32 buttons, u32 modifiers, i32 wheel_delta_x, i32 wheel_delta_y) { if (auto* window = Window::from_window_id(window_id)) - Core::EventLoop::current().post_event(*window, make<MouseEvent>(Event::MouseDoubleClick, mouse_position, buttons, to_mouse_button(button), modifiers, wheel_delta)); + Core::EventLoop::current().post_event(*window, make<MouseEvent>(Event::MouseDoubleClick, mouse_position, buttons, to_mouse_button(button), modifiers, wheel_delta_x, wheel_delta_y)); } -void WindowServerConnection::mouse_wheel(i32 window_id, Gfx::IntPoint const& mouse_position, u32 button, u32 buttons, u32 modifiers, i32 wheel_delta) +void WindowServerConnection::mouse_wheel(i32 window_id, Gfx::IntPoint const& mouse_position, u32 button, u32 buttons, u32 modifiers, i32 wheel_delta_x, i32 wheel_delta_y) { if (auto* window = Window::from_window_id(window_id)) - Core::EventLoop::current().post_event(*window, make<MouseEvent>(Event::MouseWheel, mouse_position, buttons, to_mouse_button(button), modifiers, wheel_delta)); + Core::EventLoop::current().post_event(*window, make<MouseEvent>(Event::MouseWheel, mouse_position, buttons, to_mouse_button(button), modifiers, wheel_delta_x, wheel_delta_y)); } void WindowServerConnection::menu_visibility_did_change(i32 menu_id, bool visible) diff --git a/Userland/Libraries/LibGUI/WindowServerConnection.h b/Userland/Libraries/LibGUI/WindowServerConnection.h index 24adb18407..e5a9b79901 100644 --- a/Userland/Libraries/LibGUI/WindowServerConnection.h +++ b/Userland/Libraries/LibGUI/WindowServerConnection.h @@ -26,11 +26,11 @@ private: virtual void fast_greet(Vector<Gfx::IntRect> const&, u32, u32, u32, Core::AnonymousBuffer const&, String const&, String const&, i32) override; virtual void paint(i32, Gfx::IntSize const&, Vector<Gfx::IntRect> const&) override; - virtual void mouse_move(i32, Gfx::IntPoint const&, u32, u32, u32, i32, bool, Vector<String> const&) override; - virtual void mouse_down(i32, Gfx::IntPoint const&, u32, u32, u32, i32) override; - virtual void mouse_double_click(i32, Gfx::IntPoint const&, u32, u32, u32, i32) override; - virtual void mouse_up(i32, Gfx::IntPoint const&, u32, u32, u32, i32) override; - virtual void mouse_wheel(i32, Gfx::IntPoint const&, u32, u32, u32, i32) override; + virtual void mouse_move(i32, Gfx::IntPoint const&, u32, u32, u32, i32, i32, bool, Vector<String> const&) override; + virtual void mouse_down(i32, Gfx::IntPoint const&, u32, u32, u32, i32, i32) override; + virtual void mouse_double_click(i32, Gfx::IntPoint const&, u32, u32, u32, i32, i32) override; + virtual void mouse_up(i32, Gfx::IntPoint const&, u32, u32, u32, i32, i32) override; + virtual void mouse_wheel(i32, Gfx::IntPoint const&, u32, u32, u32, i32, i32) override; virtual void window_entered(i32) override; virtual void window_left(i32) override; virtual void key_down(i32, u32, u32, u32, u32) override; diff --git a/Userland/Libraries/LibVT/TerminalWidget.cpp b/Userland/Libraries/LibVT/TerminalWidget.cpp index c3108d3d3f..8bfe60fed4 100644 --- a/Userland/Libraries/LibVT/TerminalWidget.cpp +++ b/Userland/Libraries/LibVT/TerminalWidget.cpp @@ -918,7 +918,7 @@ void TerminalWidget::mousewheel_event(GUI::MouseEvent& event) if (!is_scrollable()) return; set_auto_scroll_direction(AutoScrollDirection::None); - m_scrollbar->increase_slider_by(event.wheel_delta() * scroll_length()); + m_scrollbar->increase_slider_by(event.wheel_delta_y() * scroll_length()); GUI::Frame::mousewheel_event(event); } diff --git a/Userland/Libraries/LibWeb/InProcessWebView.cpp b/Userland/Libraries/LibWeb/InProcessWebView.cpp index 88cf8e9a9a..040f220be1 100644 --- a/Userland/Libraries/LibWeb/InProcessWebView.cpp +++ b/Userland/Libraries/LibWeb/InProcessWebView.cpp @@ -237,7 +237,7 @@ void InProcessWebView::mouseup_event(GUI::MouseEvent& event) void InProcessWebView::mousewheel_event(GUI::MouseEvent& event) { - page().handle_mousewheel(to_content_position(event.position()), event.button(), event.modifiers(), event.wheel_delta()); + page().handle_mousewheel(to_content_position(event.position()), event.button(), event.modifiers(), event.wheel_delta_x(), event.wheel_delta_y()); GUI::AbstractScrollableWidget::mousewheel_event(event); } diff --git a/Userland/Libraries/LibWeb/Layout/BlockContainer.cpp b/Userland/Libraries/LibWeb/Layout/BlockContainer.cpp index a22981a9fe..5bbc155f22 100644 --- a/Userland/Libraries/LibWeb/Layout/BlockContainer.cpp +++ b/Userland/Libraries/LibWeb/Layout/BlockContainer.cpp @@ -136,12 +136,12 @@ void BlockContainer::set_scroll_offset(const Gfx::FloatPoint& offset) set_needs_display(); } -bool BlockContainer::handle_mousewheel(Badge<EventHandler>, const Gfx::IntPoint&, unsigned int, unsigned int, int wheel_delta) +bool BlockContainer::handle_mousewheel(Badge<EventHandler>, const Gfx::IntPoint&, unsigned int, unsigned int, int wheel_delta_x, int wheel_delta_y) { if (!is_scrollable()) return false; auto new_offset = m_scroll_offset; - new_offset.translate_by(0, wheel_delta); + new_offset.translate_by(wheel_delta_x, wheel_delta_y); set_scroll_offset(new_offset); return true; diff --git a/Userland/Libraries/LibWeb/Layout/BlockContainer.h b/Userland/Libraries/LibWeb/Layout/BlockContainer.h index 0fa3e2aacd..397a262917 100644 --- a/Userland/Libraries/LibWeb/Layout/BlockContainer.h +++ b/Userland/Libraries/LibWeb/Layout/BlockContainer.h @@ -50,7 +50,7 @@ protected: private: virtual bool is_block_container() const final { return true; } virtual bool wants_mouse_events() const override { return false; } - virtual bool handle_mousewheel(Badge<EventHandler>, const Gfx::IntPoint&, unsigned buttons, unsigned modifiers, int wheel_delta) override; + virtual bool handle_mousewheel(Badge<EventHandler>, const Gfx::IntPoint&, unsigned buttons, unsigned modifiers, int wheel_delta_x, int wheel_delta_y) override; bool should_clip_overflow() const; diff --git a/Userland/Libraries/LibWeb/Layout/Node.cpp b/Userland/Libraries/LibWeb/Layout/Node.cpp index be8bd5e9cc..d2a0f8b460 100644 --- a/Userland/Libraries/LibWeb/Layout/Node.cpp +++ b/Userland/Libraries/LibWeb/Layout/Node.cpp @@ -494,13 +494,13 @@ void Node::handle_mousemove(Badge<EventHandler>, const Gfx::IntPoint&, unsigned, { } -bool Node::handle_mousewheel(Badge<EventHandler>, const Gfx::IntPoint&, unsigned, unsigned, int wheel_delta) +bool Node::handle_mousewheel(Badge<EventHandler>, const Gfx::IntPoint&, unsigned, unsigned, int wheel_delta_x, int wheel_delta_y) { if (auto* containing_block = this->containing_block()) { if (!containing_block->is_scrollable()) return false; auto new_offset = containing_block->scroll_offset(); - new_offset.translate_by(0, wheel_delta); + new_offset.translate_by(wheel_delta_x, wheel_delta_y); containing_block->set_scroll_offset(new_offset); return true; } diff --git a/Userland/Libraries/LibWeb/Layout/Node.h b/Userland/Libraries/LibWeb/Layout/Node.h index 3a6a90a009..bcf67189b9 100644 --- a/Userland/Libraries/LibWeb/Layout/Node.h +++ b/Userland/Libraries/LibWeb/Layout/Node.h @@ -89,7 +89,7 @@ public: virtual void handle_mousedown(Badge<EventHandler>, const Gfx::IntPoint&, unsigned button, unsigned modifiers); virtual void handle_mouseup(Badge<EventHandler>, const Gfx::IntPoint&, unsigned button, unsigned modifiers); virtual void handle_mousemove(Badge<EventHandler>, const Gfx::IntPoint&, unsigned buttons, unsigned modifiers); - virtual bool handle_mousewheel(Badge<EventHandler>, const Gfx::IntPoint&, unsigned buttons, unsigned modifiers, int wheel_delta); + virtual bool handle_mousewheel(Badge<EventHandler>, const Gfx::IntPoint&, unsigned buttons, unsigned modifiers, int wheel_delta_x, int wheel_delta_y); virtual void before_children_paint(PaintContext&, PaintPhase) {}; virtual void paint(PaintContext&, PaintPhase) = 0; diff --git a/Userland/Libraries/LibWeb/OutOfProcessWebView.cpp b/Userland/Libraries/LibWeb/OutOfProcessWebView.cpp index b9390ca618..c1f4470cd8 100644 --- a/Userland/Libraries/LibWeb/OutOfProcessWebView.cpp +++ b/Userland/Libraries/LibWeb/OutOfProcessWebView.cpp @@ -183,7 +183,7 @@ void OutOfProcessWebView::mousemove_event(GUI::MouseEvent& event) void OutOfProcessWebView::mousewheel_event(GUI::MouseEvent& event) { - client().async_mouse_wheel(to_content_position(event.position()), event.button(), event.buttons(), event.modifiers(), event.wheel_delta()); + client().async_mouse_wheel(to_content_position(event.position()), event.button(), event.buttons(), event.modifiers(), event.wheel_delta_x(), event.wheel_delta_y()); } void OutOfProcessWebView::theme_change_event(GUI::ThemeChangeEvent& event) diff --git a/Userland/Libraries/LibWeb/Page/EventHandler.cpp b/Userland/Libraries/LibWeb/Page/EventHandler.cpp index 146639c7ac..a254df2bd4 100644 --- a/Userland/Libraries/LibWeb/Page/EventHandler.cpp +++ b/Userland/Libraries/LibWeb/Page/EventHandler.cpp @@ -112,7 +112,7 @@ Layout::InitialContainingBlock* EventHandler::layout_root() return m_frame.active_document()->layout_node(); } -bool EventHandler::handle_mousewheel(const Gfx::IntPoint& position, unsigned int buttons, unsigned int modifiers, int wheel_delta) +bool EventHandler::handle_mousewheel(const Gfx::IntPoint& position, unsigned int buttons, unsigned int modifiers, int wheel_delta_x, int wheel_delta_y) { if (!layout_root()) return false; @@ -121,12 +121,12 @@ bool EventHandler::handle_mousewheel(const Gfx::IntPoint& position, unsigned int auto result = layout_root()->hit_test(position, Layout::HitTestType::Exact); if (result.layout_node) { - if (result.layout_node->handle_mousewheel({}, position, buttons, modifiers, wheel_delta)) + if (result.layout_node->handle_mousewheel({}, position, buttons, modifiers, wheel_delta_x, wheel_delta_y)) return true; } if (auto* page = m_frame.page()) { - page->client().page_did_request_scroll(0, wheel_delta * 20); + page->client().page_did_request_scroll(wheel_delta_x * 20, wheel_delta_y * 20); return true; } diff --git a/Userland/Libraries/LibWeb/Page/EventHandler.h b/Userland/Libraries/LibWeb/Page/EventHandler.h index 402696036a..b4730b03e1 100644 --- a/Userland/Libraries/LibWeb/Page/EventHandler.h +++ b/Userland/Libraries/LibWeb/Page/EventHandler.h @@ -25,7 +25,7 @@ public: bool handle_mouseup(const Gfx::IntPoint&, unsigned button, unsigned modifiers); bool handle_mousedown(const Gfx::IntPoint&, unsigned button, unsigned modifiers); bool handle_mousemove(const Gfx::IntPoint&, unsigned buttons, unsigned modifiers); - bool handle_mousewheel(const Gfx::IntPoint&, unsigned buttons, unsigned modifiers, int wheel_delta); + bool handle_mousewheel(const Gfx::IntPoint&, unsigned buttons, unsigned modifiers, int wheel_delta_x, int wheel_delta_y); bool handle_keydown(KeyCode, unsigned modifiers, u32 code_point); bool handle_keyup(KeyCode, unsigned modifiers, u32 code_point); diff --git a/Userland/Libraries/LibWeb/Page/Page.cpp b/Userland/Libraries/LibWeb/Page/Page.cpp index d033a9a799..64fd74229b 100644 --- a/Userland/Libraries/LibWeb/Page/Page.cpp +++ b/Userland/Libraries/LibWeb/Page/Page.cpp @@ -61,9 +61,9 @@ CSS::PreferredColorScheme Page::preferred_color_scheme() const return m_client.preferred_color_scheme(); } -bool Page::handle_mousewheel(const Gfx::IntPoint& position, unsigned button, unsigned modifiers, int wheel_delta) +bool Page::handle_mousewheel(const Gfx::IntPoint& position, unsigned button, unsigned modifiers, int wheel_delta_x, int wheel_delta_y) { - return top_level_browsing_context().event_handler().handle_mousewheel(position, button, modifiers, wheel_delta); + return top_level_browsing_context().event_handler().handle_mousewheel(position, button, modifiers, wheel_delta_x, wheel_delta_y); } bool Page::handle_mouseup(const Gfx::IntPoint& position, unsigned button, unsigned modifiers) diff --git a/Userland/Libraries/LibWeb/Page/Page.h b/Userland/Libraries/LibWeb/Page/Page.h index 9939e6644f..f0c3bcb259 100644 --- a/Userland/Libraries/LibWeb/Page/Page.h +++ b/Userland/Libraries/LibWeb/Page/Page.h @@ -50,7 +50,7 @@ public: bool handle_mouseup(const Gfx::IntPoint&, unsigned button, unsigned modifiers); bool handle_mousedown(const Gfx::IntPoint&, unsigned button, unsigned modifiers); bool handle_mousemove(const Gfx::IntPoint&, unsigned buttons, unsigned modifiers); - bool handle_mousewheel(const Gfx::IntPoint&, unsigned button, unsigned modifiers, int wheel_delta); + bool handle_mousewheel(const Gfx::IntPoint&, unsigned button, unsigned modifiers, int wheel_delta_x, int wheel_delta_y); bool handle_keydown(KeyCode, unsigned modifiers, u32 code_point); bool handle_keyup(KeyCode, unsigned modifiers, u32 code_point); |