summaryrefslogtreecommitdiffstats
path: root/src/platformsupport/eglconvenience/qeglplatformscreen.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/platformsupport/eglconvenience/qeglplatformscreen.cpp')
-rw-r--r--src/platformsupport/eglconvenience/qeglplatformscreen.cpp42
1 files changed, 41 insertions, 1 deletions
diff --git a/src/platformsupport/eglconvenience/qeglplatformscreen.cpp b/src/platformsupport/eglconvenience/qeglplatformscreen.cpp
index dd4a97cdf5..6e2fc81c42 100644
--- a/src/platformsupport/eglconvenience/qeglplatformscreen.cpp
+++ b/src/platformsupport/eglconvenience/qeglplatformscreen.cpp
@@ -32,6 +32,8 @@
****************************************************************************/
#include "qeglplatformscreen_p.h"
+#include <QtGui/qwindow.h>
+#include <qpa/qwindowsysteminterface.h>
#include <QtPlatformSupport/private/qopenglcompositor_p.h>
QT_BEGIN_NAMESPACE
@@ -45,7 +47,8 @@ QT_BEGIN_NAMESPACE
*/
QEGLPlatformScreen::QEGLPlatformScreen(EGLDisplay dpy)
- : m_dpy(dpy)
+ : m_dpy(dpy),
+ m_pointerWindow(0)
{
}
@@ -54,4 +57,41 @@ QEGLPlatformScreen::~QEGLPlatformScreen()
QOpenGLCompositor::destroy();
}
+void QEGLPlatformScreen::handleCursorMove(const QPoint &pos)
+{
+ const QOpenGLCompositor *compositor = QOpenGLCompositor::instance();
+ const QList<QOpenGLCompositorWindow *> windows = compositor->windows();
+
+ // Generate enter and leave events like a real windowing system would do.
+ if (windows.isEmpty())
+ return;
+
+ // First window is always fullscreen.
+ if (windows.count() == 1) {
+ QWindow *window = windows[0]->sourceWindow();
+ if (m_pointerWindow != window) {
+ m_pointerWindow = window;
+ QWindowSystemInterface::handleEnterEvent(window, window->mapFromGlobal(pos), pos);
+ }
+ return;
+ }
+
+ QWindow *enter = 0, *leave = 0;
+ for (int i = windows.count() - 1; i >= 0; --i) {
+ QWindow *window = windows[i]->sourceWindow();
+ const QRect geom = window->geometry();
+ if (geom.contains(pos)) {
+ if (m_pointerWindow != window) {
+ leave = m_pointerWindow;
+ m_pointerWindow = window;
+ enter = window;
+ }
+ break;
+ }
+ }
+
+ if (enter && leave)
+ QWindowSystemInterface::handleEnterLeaveEvent(enter, leave, enter->mapFromGlobal(pos), pos);
+}
+
QT_END_NAMESPACE