Ladybird/Qt: Explicitly ignore wheel events with the ctrl key pressed

This allows ctrl+wheel events to zoom in and out of the page. This was
ported incorrectly in commit c1476c3405.
This commit is contained in:
Timothy Flynn 2024-03-06 07:21:00 -05:00 committed by Tim Flynn
parent 6dfb2f9dc8
commit 8a602876d7
Notes: sideshowbarker 2024-07-17 06:51:40 +09:00

View file

@ -364,6 +364,11 @@ void WebContentView::mouseReleaseEvent(QMouseEvent* event)
void WebContentView::wheelEvent(QWheelEvent* event)
{
if (event->modifiers().testFlag(Qt::ControlModifier)) {
event->ignore();
return;
}
enqueue_native_event(Web::MouseEvent::Type::MouseWheel, *event);
}
@ -699,7 +704,7 @@ void WebContentView::enqueue_native_event(Web::MouseEvent::Type type, QSinglePoi
int wheel_delta_x = 0;
int wheel_delta_y = 0;
if (type == Web::MouseEvent::Type::MouseWheel && !event.modifiers().testFlag(Qt::ControlModifier)) {
if (type == Web::MouseEvent::Type::MouseWheel) {
auto const& wheel_event = static_cast<QWheelEvent const&>(event);
if (auto pixel_delta = -wheel_event.pixelDelta(); !pixel_delta.isNull()) {