summaryrefslogtreecommitdiffstats
path: root/src/gui/kernel/qwindowsysteminterface_p.h
diff options
context:
space:
mode:
authorMiikka Heikkinen <miikka.heikkinen@digia.com>2012-10-18 14:15:38 +0300
committerThe Qt Project <gerrit-noreply@qt-project.org>2012-10-19 13:02:17 +0200
commitbdc0eaae6b47eebbf99bea1034857287fb75aa46 (patch)
tree7afe9f38f88dc22a09e21be0b3e4e58d166e806b /src/gui/kernel/qwindowsysteminterface_p.h
parentf948294f5ebbfd39ac802712aa9747d73738235b (diff)
Fix excess enter/leave event generation for native widgets
Native widgets have a native window each, so QPA plugin sends enter and leave events for associated QWindow whenever mouse cursor moves from one widget to another. QWidgetWindow had no context to interpret these events as moves from one widget to another, since they were sent separately. This resulted in leaves and enters for each widget in parent chain, when only the bottom child should have gotten them. Fixed by peeking into window system message queue when handling leave in QWidgetWindow and retrieving the entered window from queued enter event. Also provided a convenience function that QPA plugin can use to ensure both leave and enter events are in the event queue when moving from one QWindow to another. Task-number: QTBUG-27550 Change-Id: I74fec0ac90f6848495c2392c5f7e41624ad8aea2 Reviewed-by: Morten Johan Sørvig <morten.sorvig@digia.com> Reviewed-by: Samuel Rødal <samuel.rodal@digia.com>
Diffstat (limited to 'src/gui/kernel/qwindowsysteminterface_p.h')
-rw-r--r--src/gui/kernel/qwindowsysteminterface_p.h25
1 files changed, 23 insertions, 2 deletions
diff --git a/src/gui/kernel/qwindowsysteminterface_p.h b/src/gui/kernel/qwindowsysteminterface_p.h
index e9d2fadc84..4e907f3f51 100644
--- a/src/gui/kernel/qwindowsysteminterface_p.h
+++ b/src/gui/kernel/qwindowsysteminterface_p.h
@@ -52,7 +52,7 @@ QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
-class QWindowSystemInterfacePrivate {
+class Q_GUI_EXPORT QWindowSystemInterfacePrivate {
public:
enum EventType {
Close,
@@ -349,6 +349,25 @@ public:
{ const QMutexLocker locker(&mutex); impl.append(e); }
int count() const
{ const QMutexLocker locker(&mutex); return impl.count(); }
+ WindowSystemEvent *peekAtFirstOfType(EventType t) const
+ {
+ const QMutexLocker locker(&mutex);
+ for (int i = 0; i < impl.size(); ++i) {
+ if (impl.at(i)->type == t)
+ return impl.at(i);
+ }
+ return 0;
+ }
+ void remove(const WindowSystemEvent *e)
+ {
+ const QMutexLocker locker(&mutex);
+ for (int i = 0; i < impl.size(); ++i) {
+ if (impl.at(i) == e) {
+ impl.removeAt(i);
+ break;
+ }
+ }
+ }
private:
Q_DISABLE_COPY(WindowSystemEventList);
};
@@ -356,7 +375,9 @@ public:
static WindowSystemEventList windowSystemEventQueue;
static int windowSystemEventsQueued();
- static WindowSystemEvent * getWindowSystemEvent();
+ static WindowSystemEvent *getWindowSystemEvent();
+ static WindowSystemEvent *peekWindowSystemEvent(EventType t);
+ static void removeWindowSystemEvent(WindowSystemEvent *event);
static void handleWindowSystemEvent(WindowSystemEvent *ev);
static QElapsedTimer eventTime;