diff options
author | Jeremy Katz <jeremy.katz@nokia.com> | 2009-11-23 15:14:38 +0100 |
---|---|---|
committer | Jeremy Katz <jeremy.katz@nokia.com> | 2009-11-23 15:14:38 +0100 |
commit | cd4c5e2af80e5161b301a9798686220eb4731be6 (patch) | |
tree | 7d80c380b56e1625b85a07e381f04dfbc54c8c0d /src/gui | |
parent | 4485749550e99b71ba14a2baaef492f1da3c0478 (diff) |
enable enter/leave event dispatching where the entered widget is null
With framebuffer backends (vnc, linuxfb), there can be screen coordinates
where no toplevel exists. dispatchEnterLeave() still needs to be called to
allow the cursor to be reset when leaving a widget that sets a cursor.
Diffstat (limited to 'src/gui')
-rw-r--r-- | src/gui/kernel/qapplication.cpp | 6 | ||||
-rw-r--r-- | src/gui/kernel/qapplication_lite.cpp | 2 | ||||
-rw-r--r-- | src/gui/kernel/qwidget_lite.cpp | 17 |
3 files changed, 21 insertions, 4 deletions
diff --git a/src/gui/kernel/qapplication.cpp b/src/gui/kernel/qapplication.cpp index bbf7b4095e..bb9028583f 100644 --- a/src/gui/kernel/qapplication.cpp +++ b/src/gui/kernel/qapplication.cpp @@ -2660,7 +2660,11 @@ void QApplicationPrivate::dispatchEnterLeave(QWidget* enter, QWidget* leave) { #if defined(Q_WS_X11) qt_x11_enforce_cursor(parentOfLeavingCursor,true); #elif defined(Q_WS_LITE) - qt_lite_set_cursor(parentOfLeavingCursor, true); + if (enter == QApplication::desktop()) { + qt_lite_set_cursor(enter, true); + } else { + qt_lite_set_cursor(parentOfLeavingCursor, true); + } #endif } } diff --git a/src/gui/kernel/qapplication_lite.cpp b/src/gui/kernel/qapplication_lite.cpp index f2be5c7c27..cdaa8559de 100644 --- a/src/gui/kernel/qapplication_lite.cpp +++ b/src/gui/kernel/qapplication_lite.cpp @@ -558,7 +558,7 @@ void QApplicationPrivate::handleMouseEvent(QWidget *tlw, const QMouseEvent &ev) } if (!mouseWindow && !implicit_mouse_grabber) - return; //nowhere to send it + mouseWindow = QApplication::desktop(); if (mouseWindow && mouseWindow != tlw) { //we did not get a sensible localPoint from the window system, so let's calculate it diff --git a/src/gui/kernel/qwidget_lite.cpp b/src/gui/kernel/qwidget_lite.cpp index cd4fa187f1..88df81fc54 100644 --- a/src/gui/kernel/qwidget_lite.cpp +++ b/src/gui/kernel/qwidget_lite.cpp @@ -669,8 +669,13 @@ void QWidgetPrivate::setModal_sys() void qt_lite_set_cursor(QWidget * w, bool force) { static QPointer<QWidget> lastUnderMouse = 0; - if (w == 0) { // override cursor stack emptied - QCursor * override = QApplication::overrideCursor(); + + QCursor * override = QApplication::overrideCursor(); + + if (override && w != 0) + return; + + if (w == 0) { if (override) { if (QGraphicsSystemCursor::instance) { QGraphicsSystemCursor::instance->changeCursor(override); @@ -678,6 +683,8 @@ void qt_lite_set_cursor(QWidget * w, bool force) return; } w = QApplication::widgetAt(QCursor::pos()); + if (w == 0) // clear the override cursor while over empty space + w = QApplication::desktop(); } else if (force) { lastUnderMouse = w; } else if (w->testAttribute(Qt::WA_WState_Created) && lastUnderMouse @@ -685,6 +692,12 @@ void qt_lite_set_cursor(QWidget * w, bool force) w = lastUnderMouse; } + if (w == QApplication::desktop()) { + if (QGraphicsSystemCursor::instance) { + QGraphicsSystemCursor::instance->changeCursor(w); + } + } + QWidget * curWin = QApplication::activeWindow(); if (!curWin && w && w->internalWinId()) return; |