diff options
Diffstat (limited to 'src/gui/kernel/qapplication_s60.cpp')
-rw-r--r-- | src/gui/kernel/qapplication_s60.cpp | 62 |
1 files changed, 51 insertions, 11 deletions
diff --git a/src/gui/kernel/qapplication_s60.cpp b/src/gui/kernel/qapplication_s60.cpp index 1a103ef..5d7af4c 100644 --- a/src/gui/kernel/qapplication_s60.cpp +++ b/src/gui/kernel/qapplication_s60.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** @@ -807,6 +807,15 @@ TCoeInputCapabilities QSymbianControl::InputCapabilities() const void QSymbianControl::Draw(const TRect& controlRect) const { + // Set flag to avoid calling DrawNow in window surface + QWExtra *extra = qwidget->d_func()->extraData(); + if (extra && !extra->inExpose) { + extra->inExpose = true; + QRect exposeRect = qt_TRect2QRect(controlRect); + qwidget->d_func()->syncBackingStore(exposeRect); + extra->inExpose = false; + } + QWindowSurface *surface = qwidget->windowSurface(); QPaintEngine *engine = surface ? surface->paintDevice()->paintEngine() : NULL; @@ -855,8 +864,6 @@ void QSymbianControl::Draw(const TRect& controlRect) const default: Q_ASSERT(false); } - } else { - surface->flush(qwidget, QRegion(qt_TRect2QRect(backingStoreRect)), QPoint()); } if (sendNativePaintEvents) { @@ -930,7 +937,7 @@ void QSymbianControl::PositionChanged() void QSymbianControl::FocusChanged(TDrawNow /* aDrawNow */) { - if (m_ignoreFocusChanged) + if (m_ignoreFocusChanged || (qwidget->windowType() & Qt::WindowType_Mask) == Qt::Desktop) return; // Popups never get focused, but still receive the FocusChanged when they are hidden. @@ -1523,6 +1530,12 @@ void QApplication::beep() qt_S60Beep->Play(); } +static inline bool callSymbianEventFilters(const QSymbianEvent *event) +{ + long unused; + return qApp->filterEvent(const_cast<QSymbianEvent *>(event), &unused); +} + /*! \warning This function is only available on Symbian. \since 4.6 @@ -1539,6 +1552,9 @@ int QApplication::symbianProcessEvent(const QSymbianEvent *event) QScopedLoopLevelCounter counter(d->threadData); + if (d->eventDispatcher->filterEvent(const_cast<QSymbianEvent *>(event))) + return 1; + QWidget *w = qApp ? qApp->focusWidget() : 0; if (w) { QInputContext *ic = w->inputContext(); @@ -1551,29 +1567,34 @@ int QApplication::symbianProcessEvent(const QSymbianEvent *event) switch (event->type()) { case QSymbianEvent::WindowServerEvent: - return d->symbianProcessWsEvent(event->windowServerEvent()); + return d->symbianProcessWsEvent(event); case QSymbianEvent::CommandEvent: - return d->symbianHandleCommand(event->command()); + return d->symbianHandleCommand(event); case QSymbianEvent::ResourceChangeEvent: - return d->symbianResourceChange(event->resourceChangeType()); + return d->symbianResourceChange(event); default: return -1; } } -int QApplicationPrivate::symbianProcessWsEvent(const TWsEvent *event) +int QApplicationPrivate::symbianProcessWsEvent(const QSymbianEvent *symbianEvent) { // Qt event handling. Handle some events regardless of if the handle is in our // widget map or not. + const TWsEvent *event = symbianEvent->windowServerEvent(); CCoeControl* control = reinterpret_cast<CCoeControl*>(event->Handle()); const bool controlInMap = QWidgetPrivate::mapper && QWidgetPrivate::mapper->contains(control); switch (event->Type()) { case EEventPointerEnter: - if (controlInMap) + if (controlInMap) { + callSymbianEventFilters(symbianEvent); return 1; // Qt::Enter will be generated in HandlePointerL + } break; case EEventPointerExit: if (controlInMap) { + if (callSymbianEventFilters(symbianEvent)) + return 1; if (S60) { // mouseEvent outside our window, send leave event to last focused widget QMouseEvent mEvent(QEvent::Leave, S60->lastPointerEventPos, S60->lastCursorPos, @@ -1586,6 +1607,8 @@ int QApplicationPrivate::symbianProcessWsEvent(const TWsEvent *event) } break; case EEventScreenDeviceChanged: + if (callSymbianEventFilters(symbianEvent)) + return 1; if (S60) S60->updateScreenSize(); if (qt_desktopWidget) { @@ -1598,6 +1621,8 @@ int QApplicationPrivate::symbianProcessWsEvent(const TWsEvent *event) return 0; // Propagate to CONE case EEventWindowVisibilityChanged: if (controlInMap) { + if (callSymbianEventFilters(symbianEvent)) + return 1; const TWsVisibilityChangedEvent *visChangedEvent = event->VisibilityChanged(); QWidget *w = QWidgetPrivate::mapper->value(control); if (!w->d_func()->maybeTopData()) @@ -1615,6 +1640,8 @@ int QApplicationPrivate::symbianProcessWsEvent(const TWsEvent *event) } break; case EEventFocusGained: + if (callSymbianEventFilters(symbianEvent)) + return 1; #ifndef QT_NO_CURSOR //re-enable mouse interaction if (S60->mouseInteractionEnabled) { @@ -1628,6 +1655,8 @@ int QApplicationPrivate::symbianProcessWsEvent(const TWsEvent *event) #endif break; case EEventFocusLost: + if (callSymbianEventFilters(symbianEvent)) + return 1; #ifndef QT_NO_CURSOR //disable mouse as may be moving to application that does not support it if (S60->mouseInteractionEnabled) { @@ -1679,11 +1708,16 @@ bool QApplication::symbianEventFilter(const QSymbianEvent *event) \sa s60EventFilter(), s60ProcessEvent() */ -int QApplicationPrivate::symbianHandleCommand(int command) +int QApplicationPrivate::symbianHandleCommand(const QSymbianEvent *symbianEvent) { Q_Q(QApplication); int ret = 0; + if (callSymbianEventFilters(symbianEvent)) + return 1; + + int command = symbianEvent->command(); + switch (command) { #ifdef Q_WS_S60 case EAknSoftkeyExit: { @@ -1723,14 +1757,18 @@ int QApplicationPrivate::symbianHandleCommand(int command) Currently, KEikDynamicLayoutVariantSwitch and KAknsMessageSkinChange are handled. */ -int QApplicationPrivate::symbianResourceChange(int type) +int QApplicationPrivate::symbianResourceChange(const QSymbianEvent *symbianEvent) { int ret = 0; + int type = symbianEvent->resourceChangeType(); + switch (type) { #ifdef Q_WS_S60 case KEikDynamicLayoutVariantSwitch: { + if (callSymbianEventFilters(symbianEvent)) + return 1; if (S60) S60->updateScreenSize(); @@ -1755,6 +1793,8 @@ int QApplicationPrivate::symbianResourceChange(int type) #ifndef QT_NO_STYLE_S60 case KAknsMessageSkinChange: + if (callSymbianEventFilters(symbianEvent)) + return 1; if (QS60Style *s60Style = qobject_cast<QS60Style*>(QApplication::style())) { s60Style->d_func()->handleSkinChange(); ret = 1; |