summaryrefslogtreecommitdiffstats
path: root/src/gui/kernel/qwindowsysteminterface.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/gui/kernel/qwindowsysteminterface.cpp')
-rw-r--r--src/gui/kernel/qwindowsysteminterface.cpp30
1 files changed, 30 insertions, 0 deletions
diff --git a/src/gui/kernel/qwindowsysteminterface.cpp b/src/gui/kernel/qwindowsysteminterface.cpp
index d05dc8cbdc..82e0e44ac7 100644
--- a/src/gui/kernel/qwindowsysteminterface.cpp
+++ b/src/gui/kernel/qwindowsysteminterface.cpp
@@ -89,6 +89,26 @@ void QWindowSystemInterface::handleLeaveEvent(QWindow *tlw)
QWindowSystemInterfacePrivate::handleWindowSystemEvent(e);
}
+/*!
+ This method can be used to ensure leave and enter events are both in queue when moving from
+ one QWindow to another. This allows QWindow subclasses to check for a queued enter event
+ when handling the leave event (\c QWindowSystemInterfacePrivate::peekWindowSystemEvent) to
+ determine where mouse went and act accordingly. E.g. QWidgetWindow needs to know if mouse
+ cursor moves between windows in same window hierarchy.
+*/
+void QWindowSystemInterface::handleEnterLeaveEvent(QWindow *enter, QWindow *leave)
+{
+ bool wasSynchronous = QWindowSystemInterfacePrivate::synchronousWindowsSystemEvents;
+ if (wasSynchronous)
+ setSynchronousWindowsSystemEvents(false);
+ handleLeaveEvent(leave);
+ handleEnterEvent(enter);
+ if (wasSynchronous) {
+ flushWindowSystemEvents();
+ setSynchronousWindowsSystemEvents(true);
+ }
+}
+
void QWindowSystemInterface::handleWindowActivated(QWindow *tlw)
{
QWindowSystemInterfacePrivate::ActivatedWindowEvent *e = new QWindowSystemInterfacePrivate::ActivatedWindowEvent(tlw);
@@ -324,6 +344,16 @@ QWindowSystemInterfacePrivate::WindowSystemEvent * QWindowSystemInterfacePrivate
return windowSystemEventQueue.takeFirstOrReturnNull();
}
+QWindowSystemInterfacePrivate::WindowSystemEvent *QWindowSystemInterfacePrivate::peekWindowSystemEvent(EventType t)
+{
+ return windowSystemEventQueue.peekAtFirstOfType(t);
+}
+
+void QWindowSystemInterfacePrivate::removeWindowSystemEvent(WindowSystemEvent *event)
+{
+ windowSystemEventQueue.remove(event);
+}
+
void QWindowSystemInterfacePrivate::handleWindowSystemEvent(QWindowSystemInterfacePrivate::WindowSystemEvent *ev)
{
if (synchronousWindowsSystemEvents) {