diff options
author | Paul Olav Tvete <paul.tvete@nokia.com> | 2009-10-16 14:33:43 (GMT) |
---|---|---|
committer | Paul Olav Tvete <paul.tvete@nokia.com> | 2009-10-16 14:33:43 (GMT) |
commit | 59cab5edd7db8a8e8d16ebbb89329eafb5147b46 (patch) | |
tree | 74f3d0fe065f2d81a26f8d2c74e4db9b084aee03 /src/gui | |
parent | d4cbb6936131867073fc026d3c4697af36a0e2d4 (diff) | |
download | Qt-59cab5edd7db8a8e8d16ebbb89329eafb5147b46.zip Qt-59cab5edd7db8a8e8d16ebbb89329eafb5147b46.tar.gz Qt-59cab5edd7db8a8e8d16ebbb89329eafb5147b46.tar.bz2 |
Implement enter/leave events for Lighthouse
Diffstat (limited to 'src/gui')
-rw-r--r-- | src/gui/kernel/qapplication.cpp | 6 | ||||
-rw-r--r-- | src/gui/kernel/qapplication_lite.cpp | 12 | ||||
-rw-r--r-- | src/gui/kernel/qapplication_p.h | 2 | ||||
-rw-r--r-- | src/gui/kernel/qwidget.cpp | 14 |
4 files changed, 22 insertions, 12 deletions
diff --git a/src/gui/kernel/qapplication.cpp b/src/gui/kernel/qapplication.cpp index 191cdf4..74f2971 100644 --- a/src/gui/kernel/qapplication.cpp +++ b/src/gui/kernel/qapplication.cpp @@ -498,7 +498,7 @@ inline bool QApplicationPrivate::isAlien(QWidget *widget) return false; #if defined(Q_WS_MAC) // Fake alien behavior on the Mac :) return !widget->isWindow() && widget->window()->testAttribute(Qt::WA_DontShowOnScreen); -#elif defined(Q_WS_QWS) +#elif defined(Q_WS_QWS) || defined(Q_WS_LITE) return !widget->isWindow() # ifdef Q_BACKINGSTORE_SUBSURFACES && !(widget->d_func()->maybeTopData() && widget->d_func()->maybeTopData()->windowSurface) @@ -3004,7 +3004,7 @@ bool QApplicationPrivate::sendMouseEvent(QWidget *receiver, QMouseEvent *event, return result; } -#if defined(Q_WS_WIN) || defined(Q_WS_X11) || defined(Q_WS_QWS) +#if defined(Q_WS_WIN) || defined(Q_WS_X11) || defined(Q_WS_QWS) || defined(Q_WS_LITE) /* This function should only be called when the widget changes visibility, i.e. when the \a widget is shown, hidden or deleted. This function does nothing @@ -3016,7 +3016,7 @@ extern QWidget *qt_button_down; void QApplicationPrivate::sendSyntheticEnterLeave(QWidget *widget) { #ifndef QT_NO_CURSOR -#ifdef Q_WS_QWS +#if defined(Q_WS_QWS) || defined(Q_WS_LITE) if (!widget || widget->isWindow()) return; #else diff --git a/src/gui/kernel/qapplication_lite.cpp b/src/gui/kernel/qapplication_lite.cpp index b3ad06f..0ddcfab 100644 --- a/src/gui/kernel/qapplication_lite.cpp +++ b/src/gui/kernel/qapplication_lite.cpp @@ -72,6 +72,7 @@ extern QWidgetList *qt_modal_stack; // stack of modal widgets int qt_last_x = 0; int qt_last_y = 0; +QPointer<QWidget> qt_last_mouse_receiver = 0; QString QApplicationPrivate::appName() const { @@ -508,11 +509,15 @@ void QApplication::setMainWidget(QWidget *mainWidget) void QApplicationPrivate::handleEnterEvent(QWidget *tlw) { dispatchEnterLeave(tlw, 0); + qt_last_mouse_receiver = tlw; } void QApplicationPrivate::handleLeaveEvent(QWidget *tlw) { - dispatchEnterLeave(0, tlw); + dispatchEnterLeave(0, qt_last_mouse_receiver); + if (!tlw->isAncestorOf(qt_last_mouse_receiver)) //(???) this should not happen + dispatchEnterLeave(0, tlw); + qt_last_mouse_receiver = 0; } void QApplicationPrivate::handleMouseEvent(QWidget *tlw, const QMouseEvent &ev) @@ -589,6 +594,11 @@ void QApplicationPrivate::handleMouseEvent(QWidget *tlw, const QMouseEvent &ev) implicit_mouse_grabber = 0; } + if (mouseWidget != qt_last_mouse_receiver) { + dispatchEnterLeave(mouseWidget, qt_last_mouse_receiver); + qt_last_mouse_receiver = mouseWidget; + } + // Remember, we might enter a modal event loop when sending the event, // so think carefully before adding code below this point. diff --git a/src/gui/kernel/qapplication_p.h b/src/gui/kernel/qapplication_p.h index a5496d6..2622f1c 100644 --- a/src/gui/kernel/qapplication_p.h +++ b/src/gui/kernel/qapplication_p.h @@ -504,7 +504,7 @@ public: static TUint resolveS60ScanCode(TInt scanCode, TUint keysym); QSet<WId> nativeWindows; #endif -#if defined(Q_WS_WIN) || defined(Q_WS_X11) || defined (Q_WS_QWS) +#if defined(Q_WS_WIN) || defined(Q_WS_X11) || defined (Q_WS_QWS) || defined(Q_WS_LITE) void sendSyntheticEnterLeave(QWidget *widget); #endif diff --git a/src/gui/kernel/qwidget.cpp b/src/gui/kernel/qwidget.cpp index 88d90ee..4d8386b 100644 --- a/src/gui/kernel/qwidget.cpp +++ b/src/gui/kernel/qwidget.cpp @@ -1440,13 +1440,13 @@ QWidget::~QWidget() } } -#if defined(Q_WS_WIN) || defined(Q_WS_X11) || defined (Q_WS_QWS) //### LITE +#if defined(Q_WS_WIN) || defined(Q_WS_X11) else if (!internalWinId() && isVisible()) { qApp->d_func()->sendSyntheticEnterLeave(this); -#ifdef Q_WS_QWS - } else if (isVisible()) { + } +#elif defined(Q_WS_QWS) || defined(Q_WS_LITE) + else if (isVisible()) { qApp->d_func()->sendSyntheticEnterLeave(this); -#endif } #endif @@ -7200,7 +7200,7 @@ void QWidgetPrivate::hide_helper() // next bit tries to move the focus if the focus widget is now // hidden. if (wasVisible) { -#if defined(Q_WS_WIN) || defined(Q_WS_X11) || defined (Q_WS_QWS) +#if defined(Q_WS_WIN) || defined(Q_WS_X11) || defined (Q_WS_QWS) || defined(Q_WS_LITE) qApp->d_func()->sendSyntheticEnterLeave(q); #endif @@ -7332,7 +7332,7 @@ void QWidget::setVisible(bool visible) d->show_helper(); -#if defined(Q_WS_WIN) || defined(Q_WS_X11) || defined (Q_WS_QWS) +#if defined(Q_WS_WIN) || defined(Q_WS_X11) || defined (Q_WS_QWS) || defined(Q_WS_LITE) qApp->d_func()->sendSyntheticEnterLeave(this); #endif } @@ -7447,7 +7447,7 @@ void QWidgetPrivate::hideChildren(bool spontaneous) widget->d_func()->hide_sys(); } } -#if defined(Q_WS_WIN) || defined(Q_WS_X11) || defined (Q_WS_QWS) +#if defined(Q_WS_WIN) || defined(Q_WS_X11) || defined (Q_WS_QWS) || defined(Q_WS_LITE) qApp->d_func()->sendSyntheticEnterLeave(widget); #endif #ifndef QT_NO_ACCESSIBILITY |