summaryrefslogtreecommitdiffstats
path: root/src/gui/kernel/qguiapplication.cpp
diff options
context:
space:
mode:
authorShawn Rutledge <shawn.rutledge@qt.io>2020-11-09 22:51:21 +0100
committerShawn Rutledge <shawn.rutledge@qt.io>2020-11-10 08:21:08 +0100
commit48219c8231f7f9daf79f6c60a752b78c03e44a1f (patch)
treed6e0997a558d3bb372f2a51e42a293bd0c8ffcda /src/gui/kernel/qguiapplication.cpp
parent5f2b53f13c40c31da21d8352312962bb97cb8c97 (diff)
Remove code for non-enhanced mouse events
Followup to a37785ec7638e7485112b87dd7e767881fecc114. The mouse button that caused the event and the current state of all mouse buttons must always be given separately in QPA mouse events. Task-number: QTBUG-59277 Task-number: QTBUG-62329 Task-number: QTBUG-63467 Change-Id: I27209b3730baef325ce0f1c4d3778930e72d5465 Reviewed-by: Gatis Paeglis <gatis.paeglis@qt.io>
Diffstat (limited to 'src/gui/kernel/qguiapplication.cpp')
-rw-r--r--src/gui/kernel/qguiapplication.cpp92
1 files changed, 25 insertions, 67 deletions
diff --git a/src/gui/kernel/qguiapplication.cpp b/src/gui/kernel/qguiapplication.cpp
index 3dcd0650e3..268f5cee1d 100644
--- a/src/gui/kernel/qguiapplication.cpp
+++ b/src/gui/kernel/qguiapplication.cpp
@@ -2159,73 +2159,31 @@ void QGuiApplicationPrivate::processMouseEvent(QWindowSystemInterfacePrivate::Mo
return;
}
- if (e->enhancedMouseEvent()) {
- type = e->buttonType;
- button = e->button;
-
- if (type == QEvent::NonClientAreaMouseMove || type == QEvent::MouseMove)
- mouseMove = true;
- else if (type == QEvent::NonClientAreaMouseButtonPress || type == QEvent::MouseButtonPress)
- mousePress = true;
-
- if (!mouseMove && positionChanged) {
- QWindowSystemInterfacePrivate::MouseEvent moveEvent(window, e->timestamp,
- e->localPos, e->globalPos, e->buttons ^ button, e->modifiers, Qt::NoButton,
- e->nonClientArea ? QEvent::NonClientAreaMouseMove : QEvent::MouseMove,
- e->source, e->nonClientArea);
- if (e->synthetic())
- moveEvent.flags |= QWindowSystemInterfacePrivate::WindowSystemEvent::Synthetic;
- processMouseEvent(&moveEvent); // mouse move excluding state change
- processMouseEvent(e); // the original mouse event
- return;
- }
- if (mouseMove && !positionChanged) {
- // On Windows, and possibly other platforms, a touchpad can send a mouse move
- // that does not change position, between a press and a release. This may
- // confuse applications, so we always filter out these mouse events for
- // consistent behavior among platforms.
- return;
- }
- } else {
- Qt::MouseButtons stateChange = e->buttons ^ mouse_buttons;
- if (positionChanged && (stateChange != Qt::NoButton)) {
- QWindowSystemInterfacePrivate::MouseEvent moveEvent(window, e->timestamp, e->localPos,
- e->globalPos, mouse_buttons, e->modifiers, Qt::NoButton, QEvent::None, e->source,
- e->nonClientArea);
- if (e->synthetic())
- moveEvent.flags |= QWindowSystemInterfacePrivate::WindowSystemEvent::Synthetic;
- processMouseEvent(&moveEvent); // mouse move excluding state change
- processMouseEvent(e); // the original mouse event
- return;
- }
-
- // In the compatibility path we deduce event type and button that caused the event
- if (positionChanged) {
- mouseMove = true;
- type = e->nonClientArea ? QEvent::NonClientAreaMouseMove : QEvent::MouseMove;
- } else {
- // Check to see if a new button has been pressed/released.
- for (uint mask = Qt::LeftButton; mask <= Qt::MaxMouseButton; mask <<= 1) {
- if (stateChange & mask) {
- button = Qt::MouseButton(mask);
- break;
- }
- }
- if (button == Qt::NoButton) {
- // Ignore mouse events that don't change the current state. This shouldn't
- // really happen, getting here can only mean that the stored button state
- // is out of sync with the actual physical button state.
- return;
- }
- if (button & e->buttons) {
- mousePress = true;
- type = e->nonClientArea ? QEvent::NonClientAreaMouseButtonPress
- : QEvent::MouseButtonPress;
- } else {
- type = e->nonClientArea ? QEvent::NonClientAreaMouseButtonRelease
- : QEvent::MouseButtonRelease;
- }
- }
+ type = e->buttonType;
+ button = e->button;
+
+ if (type == QEvent::NonClientAreaMouseMove || type == QEvent::MouseMove)
+ mouseMove = true;
+ else if (type == QEvent::NonClientAreaMouseButtonPress || type == QEvent::MouseButtonPress)
+ mousePress = true;
+
+ if (!mouseMove && positionChanged) {
+ QWindowSystemInterfacePrivate::MouseEvent moveEvent(window, e->timestamp,
+ e->localPos, e->globalPos, e->buttons ^ button, e->modifiers, Qt::NoButton,
+ e->nonClientArea ? QEvent::NonClientAreaMouseMove : QEvent::MouseMove,
+ e->source, e->nonClientArea);
+ if (e->synthetic())
+ moveEvent.flags |= QWindowSystemInterfacePrivate::WindowSystemEvent::Synthetic;
+ processMouseEvent(&moveEvent); // mouse move excluding state change
+ processMouseEvent(e); // the original mouse event
+ return;
+ }
+ if (mouseMove && !positionChanged) {
+ // On Windows, and possibly other platforms, a touchpad can send a mouse move
+ // that does not change position, between a press and a release. This may
+ // confuse applications, so we always filter out these mouse events for
+ // consistent behavior among platforms.
+ return;
}
modifier_buttons = e->modifiers;