summaryrefslogtreecommitdiffstats
path: root/src/gui/kernel/qguiapplication.cpp
diff options
context:
space:
mode:
authorLaszlo Agocs <laszlo.agocs@theqtcompany.com>2015-03-06 10:36:43 +0100
committerLaszlo Agocs <laszlo.agocs@theqtcompany.com>2015-03-14 02:14:00 +0000
commit048918d4bd73886e1a8999a06b7af2cd2ddbe5f2 (patch)
treeb41dc86f2f6fa3ff3fcc83361de272271835f5d4 /src/gui/kernel/qguiapplication.cpp
parentf5edf2b6fb20722bb63c8855793bc2552721748c (diff)
eglfs: Generate enter and leave events
In addition the logic in QGuiApplication that picks the target window for input events with a null window has to be enhanced to be compatible with how real windowing systems work: mouse events following a press are delivered to the same window until the release, even if the cursor has left the original target window. Task-number: QTBUG-44814 Change-Id: I3fea84ac77a5ccebeae5def64f92d8d2e03d13ff Reviewed-by: Jørgen Lind <jorgen.lind@theqtcompany.com>
Diffstat (limited to 'src/gui/kernel/qguiapplication.cpp')
-rw-r--r--src/gui/kernel/qguiapplication.cpp14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/gui/kernel/qguiapplication.cpp b/src/gui/kernel/qguiapplication.cpp
index 60b289bacb..3d21b4affc 100644
--- a/src/gui/kernel/qguiapplication.cpp
+++ b/src/gui/kernel/qguiapplication.cpp
@@ -147,12 +147,15 @@ QString *QGuiApplicationPrivate::displayName = 0;
QPalette *QGuiApplicationPrivate::app_pal = 0; // default application palette
Qt::MouseButtons QGuiApplicationPrivate::buttons = Qt::NoButton;
+
ulong QGuiApplicationPrivate::mousePressTime = 0;
Qt::MouseButton QGuiApplicationPrivate::mousePressButton = Qt::NoButton;
int QGuiApplicationPrivate::mousePressX = 0;
int QGuiApplicationPrivate::mousePressY = 0;
int QGuiApplicationPrivate::mouse_double_click_distance = -1;
+QWindow *QGuiApplicationPrivate::currentMousePressWindow = 0;
+
static Qt::LayoutDirection layout_direction = Qt::LeftToRight;
static bool force_reverse = false;
@@ -1703,6 +1706,17 @@ void QGuiApplicationPrivate::processMouseEvent(QWindowSystemInterfacePrivate::Mo
if (e->nullWindow()) {
window = QGuiApplication::topLevelAt(globalPoint.toPoint());
if (window) {
+ // Moves and the release following a press must go to the same
+ // window, even if the cursor has moved on over another window.
+ if (e->buttons != Qt::NoButton) {
+ if (!currentMousePressWindow)
+ currentMousePressWindow = window;
+ else
+ window = currentMousePressWindow;
+ } else if (currentMousePressWindow) {
+ window = currentMousePressWindow;
+ currentMousePressWindow = 0;
+ }
QPointF delta = globalPoint - globalPoint.toPoint();
localPoint = window->mapFromGlobal(globalPoint.toPoint()) + delta;
}