From 96740193e1e0f0608f67660811a44b696924ad4c Mon Sep 17 00:00:00 2001 From: Gabriel de Dietrich Date: Tue, 8 Mar 2016 14:37:55 -0800 Subject: QWheelEvent: Make NoScrollPhase public This reverts d5fde514106f5479f9c929c8a165aced4a1b2c84 and makes that enum value the default for QWheelEvent::phase() with non phase-aware mice. [ChangeLog][QtGui] QWheelEvent::phase() returns NoScrollPhase with non phase-aware mice. This is most mice and input devices except, for now, Apple's trackpads and Magic Mouse. Change-Id: I929fb39889cf116e89dcd134c1b1ec6587b8f05e Reviewed-by: Shawn Rutledge --- src/gui/kernel/qevent.cpp | 9 +-------- src/gui/kernel/qguiapplication.cpp | 5 ----- src/gui/kernel/qguiapplication_p.h | 3 --- src/gui/kernel/qwindowsysteminterface.cpp | 7 +------ 4 files changed, 2 insertions(+), 22 deletions(-) (limited to 'src/gui/kernel') diff --git a/src/gui/kernel/qevent.cpp b/src/gui/kernel/qevent.cpp index d8b1367833..78a4dc4f35 100644 --- a/src/gui/kernel/qevent.cpp +++ b/src/gui/kernel/qevent.cpp @@ -761,8 +761,6 @@ QWheelEvent::QWheelEvent(const QPointF &pos, int delta, : QInputEvent(Wheel, modifiers), p(pos), qt4D(delta), qt4O(orient), mouseState(buttons), ph(Qt::NoScrollPhase), src(Qt::MouseEventNotSynthesized), invertedScrolling(false) { - if (!QGuiApplicationPrivate::scrollNoPhaseAllowed) - ph = Qt::ScrollUpdate; g = QCursor::pos(); if (orient == Qt::Vertical) angleD = QPoint(0, delta); @@ -798,8 +796,6 @@ QWheelEvent::QWheelEvent(const QPointF &pos, const QPointF& globalPos, int delta : QInputEvent(Wheel, modifiers), p(pos), g(globalPos), qt4D(delta), qt4O(orient), mouseState(buttons), ph(Qt::NoScrollPhase), src(Qt::MouseEventNotSynthesized), invertedScrolling(false) { - if (!QGuiApplicationPrivate::scrollNoPhaseAllowed) - ph = Qt::ScrollUpdate; if (orient == Qt::Vertical) angleD = QPoint(0, delta); else @@ -836,10 +832,7 @@ QWheelEvent::QWheelEvent(const QPointF &pos, const QPointF& globalPos, : QInputEvent(Wheel, modifiers), p(pos), g(globalPos), pixelD(pixelDelta), angleD(angleDelta), qt4D(qt4Delta), qt4O(qt4Orientation), mouseState(buttons), ph(Qt::NoScrollPhase), src(Qt::MouseEventNotSynthesized), invertedScrolling(false) -{ - if (!QGuiApplicationPrivate::scrollNoPhaseAllowed) - ph = Qt::ScrollUpdate; -} +{} /*! Constructs a wheel event object. diff --git a/src/gui/kernel/qguiapplication.cpp b/src/gui/kernel/qguiapplication.cpp index a79a602088..31b30c6e5a 100644 --- a/src/gui/kernel/qguiapplication.cpp +++ b/src/gui/kernel/qguiapplication.cpp @@ -199,9 +199,6 @@ bool QGuiApplicationPrivate::obey_desktop_settings = true; QInputDeviceManager *QGuiApplicationPrivate::m_inputDeviceManager = 0; -// enable the fix for QTBUG-50199; TODO remove this check in 5.7 -bool QGuiApplicationPrivate::scrollNoPhaseAllowed = false; - static qreal fontSmoothingGamma = 1.7; extern void qRegisterGuiVariant(); @@ -1458,8 +1455,6 @@ void QGuiApplicationPrivate::init() if (layout_direction == Qt::LayoutDirectionAuto || force_reverse) QGuiApplication::setLayoutDirection(qt_detectRTLLanguage() ? Qt::RightToLeft : Qt::LeftToRight); - - scrollNoPhaseAllowed = qEnvironmentVariableIsSet("QT_ENABLE_MOUSE_WHEEL_TRACKING"); } extern void qt_cleanupFontDatabase(); diff --git a/src/gui/kernel/qguiapplication_p.h b/src/gui/kernel/qguiapplication_p.h index 830d716ed8..a028441a2f 100644 --- a/src/gui/kernel/qguiapplication_p.h +++ b/src/gui/kernel/qguiapplication_p.h @@ -302,9 +302,6 @@ public: static void setApplicationState(Qt::ApplicationState state, bool forcePropagate = false); - // enable the fix for QTBUG-50199; TODO remove this check in 5.7 - static bool scrollNoPhaseAllowed; - protected: virtual void notifyThemeChanged(); bool tryCloseRemainingWindows(QWindowList processedWindows); diff --git a/src/gui/kernel/qwindowsysteminterface.cpp b/src/gui/kernel/qwindowsysteminterface.cpp index 01e27d72d4..5b91f1bc7e 100644 --- a/src/gui/kernel/qwindowsysteminterface.cpp +++ b/src/gui/kernel/qwindowsysteminterface.cpp @@ -318,9 +318,6 @@ void QWindowSystemInterface::handleWheelEvent(QWindow *w, const QPointF & local, void QWindowSystemInterface::handleWheelEvent(QWindow *tlw, ulong timestamp, const QPointF & local, const QPointF & global, QPoint pixelDelta, QPoint angleDelta, Qt::KeyboardModifiers mods, Qt::ScrollPhase phase, Qt::MouseEventSource source, bool invertedScrolling) { - if (!QGuiApplicationPrivate::scrollNoPhaseAllowed && phase == Qt::NoScrollPhase) - phase = Qt::ScrollUpdate; - // Qt 4 sends two separate wheel events for horizontal and vertical // deltas. For Qt 5 we want to send the deltas in one event, but at the // same time preserve source and behavior compatibility with Qt 4. @@ -944,9 +941,7 @@ bool QWindowSystemEventHandler::sendEvent(QWindowSystemInterfacePrivate::WindowS QWindowSystemInterfacePrivate::WheelEvent::WheelEvent(QWindow *w, ulong time, const QPointF &local, const QPointF &global, QPoint pixelD, QPoint angleD, int qt4D, Qt::Orientation qt4O, Qt::KeyboardModifiers mods, Qt::ScrollPhase phase, Qt::MouseEventSource src, bool inverted) : InputEvent(w, time, Wheel, mods), pixelDelta(pixelD), angleDelta(angleD), qt4Delta(qt4D), - qt4Orientation(qt4O), localPos(local), globalPos(global), - phase(!QGuiApplicationPrivate::scrollNoPhaseAllowed && phase == Qt::NoScrollPhase ? Qt::ScrollUpdate : phase), - source(src), inverted(inverted) + qt4Orientation(qt4O), localPos(local), globalPos(global), phase(phase), source(src), inverted(inverted) { } -- cgit v1.2.3