Ladybird: Don't scroll web view if wheel event is a Ctrl+Wheel zoom

This commit is contained in:
Andreas Kling 2023-07-01 08:12:42 +02:00
parent bf16618fba
commit c0a5787395
Notes: sideshowbarker 2024-07-16 22:11:09 +09:00
2 changed files with 11 additions and 0 deletions

View file

@ -262,6 +262,16 @@ KeyCode get_keycode_from_qt_keyboard_event(QKeyEvent const& event)
return Key_Invalid;
}
void WebContentView::wheelEvent(QWheelEvent* event)
{
if (!event->modifiers().testFlag(Qt::ControlModifier)) {
QAbstractScrollArea::wheelEvent(event);
event->accept();
return;
}
event->ignore();
}
void WebContentView::mouseMoveEvent(QMouseEvent* event)
{
Gfx::IntPoint position(event->position().x() / m_inverse_pixel_scaling_ratio, event->position().y() / m_inverse_pixel_scaling_ratio);

View file

@ -46,6 +46,7 @@ public:
virtual void paintEvent(QPaintEvent*) override;
virtual void resizeEvent(QResizeEvent*) override;
virtual void wheelEvent(QWheelEvent*) override;
virtual void mouseMoveEvent(QMouseEvent*) override;
virtual void mousePressEvent(QMouseEvent*) override;
virtual void mouseReleaseEvent(QMouseEvent*) override;