aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorShawn Rutledge <shawn.rutledge@qt.io>2016-11-21 13:39:38 +0100
committerShawn Rutledge <shawn.rutledge@qt.io>2016-12-28 18:28:30 +0000
commitb2501b0bda6a0bf4f4d5ce19e7efeda236bcbe9a (patch)
tree406692442fc791cb5162fe4632afa6d9bf9c6282 /src
parentd2eaf438ac44a39aab6ac6ecc23e9ebb39aa58ac (diff)
QQuickWindow flushFrameSynchronousEvents: don't hover if nothing dirty
An optimization revising 6f84a09dfbd15aac023580cf06e7b8c24f3b524c Calling hoverMoveEvent every frame is too inefficient when an item subclass is actually doing something there. For example, any QtQuick-based Wayland compositor needs to notify its client windows when hover state changes, so calling this method too often would impose extra work to double-check whether it really changed or not. Change-Id: I98b40a2083700e7a50820bd13154247444249e59 Reviewed-by: Robin Burchell <robin.burchell@viroteck.net>
Diffstat (limited to 'src')
-rw-r--r--src/quick/items/qquickwindow.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/quick/items/qquickwindow.cpp b/src/quick/items/qquickwindow.cpp
index 155a52bd9b..a58912e38f 100644
--- a/src/quick/items/qquickwindow.cpp
+++ b/src/quick/items/qquickwindow.cpp
@@ -2081,11 +2081,12 @@ void QQuickWindowPrivate::flushFrameSynchronousEvents()
ut->startAnimations();
}
- // Once per frame, send a synthetic hover, in case items have changed position.
+ // Once per frame, if any items are dirty, send a synthetic hover,
+ // in case items have changed position, visibility, etc.
// For instance, during animation (including the case of a ListView
// whose delegates contain MouseAreas), a MouseArea needs to know
// whether it has moved into a position where it is now under the cursor.
- if (!q->mouseGrabberItem() && !lastMousePosition.isNull()) {
+ if (!q->mouseGrabberItem() && !lastMousePosition.isNull() && dirtyItemList) {
bool accepted = false;
bool delivered = deliverHoverEvent(contentItem, lastMousePosition, lastMousePosition, QGuiApplication::keyboardModifiers(), 0, accepted);
if (!delivered)