diff options
author | Paul Olav Tvete <paul.tvete@nokia.com> | 2009-09-14 12:23:06 (GMT) |
---|---|---|
committer | Paul Olav Tvete <paul.tvete@nokia.com> | 2009-09-14 12:37:51 (GMT) |
commit | f1b134bc57584c64e9703683d2c3bc6c46264d19 (patch) | |
tree | c9c5161bbb65926d421630102202aadbd0b4fc69 /src | |
parent | 2f331bb76f00e251513c197fd43bee9faa511395 (diff) | |
download | Qt-f1b134bc57584c64e9703683d2c3bc6c46264d19.zip Qt-f1b134bc57584c64e9703683d2c3bc6c46264d19.tar.gz Qt-f1b134bc57584c64e9703683d2c3bc6c46264d19.tar.bz2 |
Implement synthetic enter/leave events for QWS.
QWS uses alien widgets too, so we need the same logic as the other
platforms.
Reviewed-by: bnilsen
Diffstat (limited to 'src')
-rw-r--r-- | src/gui/kernel/qapplication.cpp | 18 | ||||
-rw-r--r-- | src/gui/kernel/qapplication_p.h | 5 | ||||
-rw-r--r-- | src/gui/kernel/qapplication_qws.cpp | 3 | ||||
-rw-r--r-- | src/gui/kernel/qwidget.cpp | 12 |
4 files changed, 29 insertions, 9 deletions
diff --git a/src/gui/kernel/qapplication.cpp b/src/gui/kernel/qapplication.cpp index 300e519..a19e022 100644 --- a/src/gui/kernel/qapplication.cpp +++ b/src/gui/kernel/qapplication.cpp @@ -469,12 +469,18 @@ QWidget *QApplicationPrivate::oldEditFocus = 0; bool qt_tabletChokeMouse = false; static bool force_reverse = false; -static inline bool isAlien(QWidget *widget) +inline bool QApplicationPrivate::isAlien(QWidget *widget) { if (!widget) return false; -#ifdef Q_WS_MAC // Fake alien behavior on the Mac :) +#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) + return !widget->isWindow() +# ifdef Q_BACKINGSTORE_SUBSURFACES + && !(widget->d_func()->maybeTopData() && widget->d_func()->maybeTopData()->windowSurface) +# endif + ; #else return !widget->internalWinId(); #endif @@ -2974,7 +2980,7 @@ bool QApplicationPrivate::sendMouseEvent(QWidget *receiver, QMouseEvent *event, return result; } -#if defined(Q_WS_WIN) || defined(Q_WS_X11) +#if defined(Q_WS_WIN) || defined(Q_WS_X11) || defined(Q_WS_QWS) /* 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 @@ -2986,9 +2992,13 @@ extern QWidget *qt_button_down; void QApplicationPrivate::sendSyntheticEnterLeave(QWidget *widget) { #ifndef QT_NO_CURSOR +#ifdef Q_WS_QWS + if (!widget || widget->isWindow()) + return; +#else if (!widget || widget->internalWinId() || widget->isWindow()) return; - +#endif const bool widgetInShow = widget->isVisible() && !widget->data->in_destructor; if (!widgetInShow && widget != qt_last_mouse_receiver) return; // Widget was not under the cursor when it was hidden/deleted. diff --git a/src/gui/kernel/qapplication_p.h b/src/gui/kernel/qapplication_p.h index c027763..c33eb1a 100644 --- a/src/gui/kernel/qapplication_p.h +++ b/src/gui/kernel/qapplication_p.h @@ -513,7 +513,7 @@ public: #ifdef Q_OS_SYMBIAN static TUint resolveS60ScanCode(TInt scanCode, TUint keysym); #endif -#if defined(Q_WS_WIN) || defined(Q_WS_X11) +#if defined(Q_WS_WIN) || defined(Q_WS_X11) || defined (Q_WS_QWS) void sendSyntheticEnterLeave(QWidget *widget); #endif @@ -586,6 +586,9 @@ private: Qt::FocusPolicy focusPolicy, Qt::FocusReason focusReason); static bool shouldSetFocus(QWidget *w, Qt::FocusPolicy policy); + + + static bool isAlien(QWidget *); }; Q_GUI_EXPORT void qt_translateRawTouchEvent(QWidget *window, diff --git a/src/gui/kernel/qapplication_qws.cpp b/src/gui/kernel/qapplication_qws.cpp index e6bfd28..e9284f7 100644 --- a/src/gui/kernel/qapplication_qws.cpp +++ b/src/gui/kernel/qapplication_qws.cpp @@ -430,6 +430,7 @@ static QWidget *popupOfPopupButtonFocus = 0; static bool popupCloseDownMode = false; static bool popupGrabOk; static QPointer<QWidget> *mouseInWidget = 0; +QPointer<QWidget> qt_last_mouse_receiver = 0; static bool sm_blockUserInput = false; // session management @@ -3523,10 +3524,12 @@ bool QETWidget::translateMouseEvent(const QWSMouseEvent *event, int prevstate) if (widget != (*mouseInWidget)) { QApplicationPrivate::dispatchEnterLeave(widget, *mouseInWidget); (*mouseInWidget) = widget; + qt_last_mouse_receiver = widget; } QApplication::sendSpontaneousEvent(widget, &e); if (leaveAfterRelease && !QWidget::mouseGrabber()) { *mouseInWidget = QApplication::widgetAt(globalPos); + qt_last_mouse_receiver = *mouseInWidget; QApplicationPrivate::dispatchEnterLeave(*mouseInWidget, leaveAfterRelease); leaveAfterRelease = 0; } diff --git a/src/gui/kernel/qwidget.cpp b/src/gui/kernel/qwidget.cpp index fd44d78..fd89cb9 100644 --- a/src/gui/kernel/qwidget.cpp +++ b/src/gui/kernel/qwidget.cpp @@ -1442,9 +1442,13 @@ QWidget::~QWidget() } } -#if defined(Q_WS_WIN) || defined(Q_WS_X11) +#if defined(Q_WS_WIN) || defined(Q_WS_X11) || defined (Q_WS_QWS) else if (!internalWinId() && isVisible()) { qApp->d_func()->sendSyntheticEnterLeave(this); +#ifdef Q_WS_QWS + } else if (isVisible()) { + qApp->d_func()->sendSyntheticEnterLeave(this); +#endif } #endif @@ -7181,7 +7185,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) +#if defined(Q_WS_WIN) || defined(Q_WS_X11) || defined (Q_WS_QWS) qApp->d_func()->sendSyntheticEnterLeave(q); #endif @@ -7313,7 +7317,7 @@ void QWidget::setVisible(bool visible) d->show_helper(); -#if defined(Q_WS_WIN) || defined(Q_WS_X11) +#if defined(Q_WS_WIN) || defined(Q_WS_X11) || defined (Q_WS_QWS) qApp->d_func()->sendSyntheticEnterLeave(this); #endif } @@ -7428,7 +7432,7 @@ void QWidgetPrivate::hideChildren(bool spontaneous) widget->d_func()->hide_sys(); } } -#if defined(Q_WS_WIN) || defined(Q_WS_X11) +#if defined(Q_WS_WIN) || defined(Q_WS_X11) || defined (Q_WS_QWS) qApp->d_func()->sendSyntheticEnterLeave(widget); #endif #ifndef QT_NO_ACCESSIBILITY |