Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ignore pixel-based scrolling deltas on X11 #1716

Merged
merged 1 commit into from
Jun 8, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion core_lib/src/interface/scribblearea.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ GNU General Public License for more details.
#include "scribblearea.h"

#include <cmath>
#include <QGuiApplication>
#include <QMessageBox>
#include <QPixmapCache>

Expand Down Expand Up @@ -514,12 +515,14 @@ void ScribbleArea::wheelEvent(QWheelEvent* event)
return;
}

static const bool isX11 = QGuiApplication::platformName() == "xcb";
const QPoint pixels = event->pixelDelta();
const QPoint angle = event->angleDelta();
const QPointF offset = mEditor->view()->mapScreenToCanvas(event->posF());

const qreal currentScale = mEditor->view()->scaling();
if (!pixels.isNull())
// From the pixelDelta documentation: On X11 this value is driver-specific and unreliable, use angleDelta() instead
if (!isX11 && !pixels.isNull())
{
// XXX: This pixel-based zooming algorithm currently has some shortcomings compared to the angle-based one:
// Zooming in is faster than zooming out and scrolling twice with delta x yields different zoom than
Expand Down