Port away from deprecated QWheelEvent constructors

The additional arguments are based on what the deprecated ctors did
internally.
This commit is contained in:
Volker Krause 2022-03-13 11:36:23 +01:00 committed by Vlad Zahorodnii
parent f5c4040ac1
commit 2139e2abab
4 changed files with 13 additions and 18 deletions

View file

@ -62,13 +62,8 @@ bool EffectsMouseInterceptionX11Filter::event(xcb_generic_event_t *event)
// angleDelta = angleDelta.transposed();
}
if (angleDelta.y()) {
QWheelEvent ev(QPoint(me->event_x, me->event_y), angleDelta.y(), buttons, modifiers, Qt::Vertical);
return m_effects->checkInputWindowEvent(&ev);
} else if (angleDelta.x()) {
QWheelEvent ev(QPoint(me->event_x, me->event_y), angleDelta.x(), buttons, modifiers, Qt::Horizontal);
return m_effects->checkInputWindowEvent(&ev);
}
QWheelEvent ev(QPoint(me->event_x, me->event_y), QCursor::pos(), QPoint(), angleDelta, buttons, modifiers, Qt::NoScrollPhase, false);
return m_effects->checkInputWindowEvent(&ev);
}
const Qt::MouseButton button = x11ToQtMouseButton(me->detail);
Qt::MouseButtons buttons = x11ToQtMouseButtons(me->state);

View file

@ -939,10 +939,10 @@ bool X11Client::buttonPressEvent(xcb_window_t w, int button, int state, int x, i
QPointF(x_root, y_root),
QPoint(),
angle,
delta,
hor ? Qt::Horizontal : Qt::Vertical,
x11ToQtMouseButtons(state),
modifiers);
modifiers,
Qt::NoScrollPhase,
false);
event.setAccepted(false);
QCoreApplication::sendEvent(decoration(), &event);
if (!event.isAccepted() && !hor) {

View file

@ -1057,12 +1057,12 @@ class InternalWindowEventFilter : public InputEventFilter {
const QPointF localPos = event->globalPosition() - internal->position();
const Qt::Orientation orientation = (event->angleDelta().x() != 0) ? Qt::Horizontal : Qt::Vertical;
const int delta = event->angleDelta().x() != 0 ? event->angleDelta().x() : event->angleDelta().y();
QWheelEvent wheelEvent(localPos, event->globalPosF(), QPoint(),
QWheelEvent wheelEvent(localPos, event->globalPosition(), QPoint(),
event->angleDelta() * -1,
delta * -1,
orientation,
event->buttons(),
event->modifiers());
event->modifiers(),
Qt::NoScrollPhase,
false);
QCoreApplication::sendEvent(internal, &wheelEvent);
return wheelEvent.isAccepted();
}
@ -1255,10 +1255,10 @@ public:
const int delta = event->angleDelta().x() != 0 ? event->angleDelta().x() : event->angleDelta().y();
QWheelEvent e(localPos, event->globalPosition(), QPoint(),
event->angleDelta(),
delta,
orientation,
event->buttons(),
event->modifiers());
event->modifiers(),
Qt::NoScrollPhase,
false);
e.setAccepted(false);
QCoreApplication::sendEvent(decoration, &e);
if (e.isAccepted()) {

View file

@ -27,7 +27,7 @@ MouseEvent::MouseEvent(QEvent::Type type, const QPointF &pos, Qt::MouseButton bu
WheelEvent::WheelEvent(const QPointF &pos, qreal delta, qint32 discreteDelta, Qt::Orientation orientation,
Qt::MouseButtons buttons, Qt::KeyboardModifiers modifiers, InputRedirection::PointerAxisSource source,
quint32 timestamp, InputDevice *device)
: QWheelEvent(pos, pos, QPoint(), (orientation == Qt::Horizontal) ? QPoint(delta, 0) : QPoint(0, delta), delta, orientation, buttons, modifiers)
: QWheelEvent(pos, pos, QPoint(), (orientation == Qt::Horizontal) ? QPoint(delta, 0) : QPoint(0, delta), buttons, modifiers, Qt::NoScrollPhase, false)
, m_device(device)
, m_orientation(orientation)
, m_delta(delta)