From 7f36bb0705a2a47ac5f1450f97164c78df91fb4c Mon Sep 17 00:00:00 2001 From: axis Date: Wed, 8 Jul 2009 14:32:44 +0200 Subject: Removed a warning. --- src/corelib/kernel/qsharedmemory_symbian.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/corelib/kernel/qsharedmemory_symbian.cpp b/src/corelib/kernel/qsharedmemory_symbian.cpp index f564391..ffa363f 100644 --- a/src/corelib/kernel/qsharedmemory_symbian.cpp +++ b/src/corelib/kernel/qsharedmemory_symbian.cpp @@ -131,7 +131,7 @@ bool QSharedMemoryPrivate::create(int size) return true; } -bool QSharedMemoryPrivate::attach(QSharedMemory::AccessMode mode) +bool QSharedMemoryPrivate::attach(QSharedMemory::AccessMode /* mode */) { // Grab a pointer to the memory block if (!chunk.Handle()) { -- cgit v0.12 From f9dcdb8ca49a67b6bd0a191bf622efb2efe9111b Mon Sep 17 00:00:00 2001 From: axis Date: Thu, 9 Jul 2009 11:31:53 +0200 Subject: Added some extra cleanup for QWidget autotest. These leftovers made some tests fail on Symbian due to focus issues. RevBy: Trust me AutoTest: Passed --- tests/auto/qwidget/tst_qwidget.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tests/auto/qwidget/tst_qwidget.cpp b/tests/auto/qwidget/tst_qwidget.cpp index 1bf12bb..eccb21b 100644 --- a/tests/auto/qwidget/tst_qwidget.cpp +++ b/tests/auto/qwidget/tst_qwidget.cpp @@ -2455,6 +2455,9 @@ void tst_QWidget::hideWhenFocusWidgetIsChild() actualFocusWidget.sprintf("%p %s %s", qApp->focusWidget(), qApp->focusWidget()->objectName().toLatin1().constData(), qApp->focusWidget()->metaObject()->className()); expectedFocusWidget.sprintf("%p %s %s", edit2, edit2->objectName().toLatin1().constData(), edit2->metaObject()->className()); QCOMPARE(actualFocusWidget, expectedFocusWidget); + + delete edit2; + delete parentWidget; } void tst_QWidget::normalGeometry() -- cgit v0.12 From b6377f43410b14125a66ffd02acde69cfb6e455e Mon Sep 17 00:00:00 2001 From: axis Date: Thu, 9 Jul 2009 11:36:37 +0200 Subject: Switched to asynchronous focus handling on Symbian. This was done in order to be more in line with what other platforms (at least X11) do. In addition, it prevents show() from entering event handlers in Qt. That should only happen in processEvents(). This required the introduction of a new event, SymbianDeferredFocusChanged, which we post whenever there is a focus change. RevBy: Jason Barron AutoTest: Passed --- src/corelib/kernel/qcoreevent.cpp | 1 + src/corelib/kernel/qcoreevent.h | 2 ++ src/gui/kernel/qapplication_s60.cpp | 16 ++-------------- src/gui/kernel/qwidget.cpp | 6 ++++++ src/gui/kernel/qwidget_p.h | 3 +++ src/gui/kernel/qwidget_s60.cpp | 26 ++++++++++++++++++++++++++ tests/auto/qwidget/tst_qwidget.cpp | 9 +++++++++ 7 files changed, 49 insertions(+), 14 deletions(-) diff --git a/src/corelib/kernel/qcoreevent.cpp b/src/corelib/kernel/qcoreevent.cpp index 01b310b..b1c01ca 100644 --- a/src/corelib/kernel/qcoreevent.cpp +++ b/src/corelib/kernel/qcoreevent.cpp @@ -266,6 +266,7 @@ QT_BEGIN_NAMESPACE \omitvalue NetworkReplyUpdated \omitvalue FutureCallOut \omitvalue CocoaRequestModal + \omitvalue SymbianDeferredFocusChanged */ /*! diff --git a/src/corelib/kernel/qcoreevent.h b/src/corelib/kernel/qcoreevent.h index d896ad5..e88525a 100644 --- a/src/corelib/kernel/qcoreevent.h +++ b/src/corelib/kernel/qcoreevent.h @@ -269,6 +269,8 @@ public: RequestSoftwareInputPanel = 192, CloseSoftwareInputPanel = 193, + SymbianDeferredFocusChanged = 194, // Internal for generating asynchronous focus events on Symbian + // 512 reserved for Qt Jambi's MetaCall event // 513 reserved for Qt Jambi's DeleteOnMainThread event diff --git a/src/gui/kernel/qapplication_s60.cpp b/src/gui/kernel/qapplication_s60.cpp index b954ddb..dd05806 100644 --- a/src/gui/kernel/qapplication_s60.cpp +++ b/src/gui/kernel/qapplication_s60.cpp @@ -659,20 +659,8 @@ void QSymbianControl::FocusChanged(TDrawNow /* aDrawNow */) || (qwidget->windowType() & Qt::Popup) == Qt::Popup) return; - if (IsFocused()) { - QApplication::setActiveWindow(qwidget); - // If widget is fullscreen, hide status pane and button container - // otherwise show them. - CEikStatusPane* statusPane = S60->statusPane(); - CEikButtonGroupContainer* buttonGroup = S60->buttonGroupContainer(); - bool isFullscreen = qwidget->windowState() & Qt::WindowFullScreen; - if (statusPane && (statusPane->IsVisible() == isFullscreen)) - statusPane->MakeVisible(!isFullscreen); - if (buttonGroup && (buttonGroup->IsVisible() == isFullscreen)) - buttonGroup->MakeVisible(!isFullscreen); - } else { - QApplication::setActiveWindow(0); - } + QEvent *deferredFocusEvent = new QEvent(QEvent::SymbianDeferredFocusChanged); + QApplication::postEvent(qwidget, deferredFocusEvent); } void QSymbianControl::HandleResourceChange(int resourceType) diff --git a/src/gui/kernel/qwidget.cpp b/src/gui/kernel/qwidget.cpp index baacdf5..f1094c5 100644 --- a/src/gui/kernel/qwidget.cpp +++ b/src/gui/kernel/qwidget.cpp @@ -8018,6 +8018,12 @@ bool QWidget::event(QEvent *event) d->needWindowChange = false; break; #endif + case QEvent::SymbianDeferredFocusChanged: { +#ifdef Q_OS_SYMBIAN + d->handleSymbianDeferredFocusChanged(); +#endif + break; + } #ifndef QT_NO_PROPERTIES case QEvent::DynamicPropertyChange: { const QByteArray &propName = static_cast(event)->propertyName(); diff --git a/src/gui/kernel/qwidget_p.h b/src/gui/kernel/qwidget_p.h index 0ad0255..24e7503 100644 --- a/src/gui/kernel/qwidget_p.h +++ b/src/gui/kernel/qwidget_p.h @@ -279,6 +279,9 @@ public: #ifdef Q_WS_S60 void s60UpdateIsOpaque(); #endif +#ifdef Q_OS_SYMBIAN + void handleSymbianDeferredFocusChanged(); +#endif void raise_sys(); void lower_sys(); diff --git a/src/gui/kernel/qwidget_s60.cpp b/src/gui/kernel/qwidget_s60.cpp index c8bca6e..3c7e424 100644 --- a/src/gui/kernel/qwidget_s60.cpp +++ b/src/gui/kernel/qwidget_s60.cpp @@ -421,6 +421,32 @@ void QWidgetPrivate::setFocus_sys() q->effectiveWinId()->SetFocus(true); } +void QWidgetPrivate::handleSymbianDeferredFocusChanged() +{ + Q_Q(QWidget); + WId control = q->internalWinId(); + if (!control) { + // This could happen if the widget was reparented, while the focuschange + // was in the event queue. + return; + } + + if (control->IsFocused()) { + QApplication::setActiveWindow(q); + // If widget is fullscreen, hide status pane and button container + // otherwise show them. + CEikStatusPane* statusPane = S60->statusPane(); + CEikButtonGroupContainer* buttonGroup = S60->buttonGroupContainer(); + bool isFullscreen = q->windowState() & Qt::WindowFullScreen; + if (statusPane && (statusPane->IsVisible() == isFullscreen)) + statusPane->MakeVisible(!isFullscreen); + if (buttonGroup && (buttonGroup->IsVisible() == isFullscreen)) + buttonGroup->MakeVisible(!isFullscreen); + } else { + QApplication::setActiveWindow(0); + } +} + void QWidgetPrivate::raise_sys() { Q_Q(QWidget); diff --git a/tests/auto/qwidget/tst_qwidget.cpp b/tests/auto/qwidget/tst_qwidget.cpp index eccb21b..abff886 100644 --- a/tests/auto/qwidget/tst_qwidget.cpp +++ b/tests/auto/qwidget/tst_qwidget.cpp @@ -6128,6 +6128,9 @@ void tst_QWidget::compatibilityChildInsertedEvents() EventRecorder::EventList() << qMakePair(&widget, QEvent::PolishRequest) << qMakePair(&widget, QEvent::Type(QEvent::User + 1)) +#ifdef Q_OS_SYMBIAN + << qMakePair(&widget, QEvent::SymbianDeferredFocusChanged) +#endif #if defined(Q_WS_X11) || defined(Q_WS_WIN) || defined(Q_WS_QWS) || defined(Q_WS_S60) << qMakePair(&widget, QEvent::UpdateRequest) #endif @@ -6223,6 +6226,9 @@ void tst_QWidget::compatibilityChildInsertedEvents() << qMakePair(&widget, QEvent::PolishRequest) << qMakePair(&widget, QEvent::Type(QEvent::User + 1)) << qMakePair(&widget, QEvent::Type(QEvent::User + 2)) +#ifdef Q_OS_SYMBIAN + << qMakePair(&widget, QEvent::SymbianDeferredFocusChanged) +#endif #if defined(Q_WS_X11) || defined(Q_WS_WIN) || defined(Q_WS_QWS) || defined(Q_WS_S60) << qMakePair(&widget, QEvent::UpdateRequest) #endif @@ -6318,6 +6324,9 @@ void tst_QWidget::compatibilityChildInsertedEvents() << qMakePair(&widget, QEvent::PolishRequest) << qMakePair(&widget, QEvent::Type(QEvent::User + 1)) << qMakePair(&widget, QEvent::Type(QEvent::User + 2)) +#ifdef Q_OS_SYMBIAN + << qMakePair(&widget, QEvent::SymbianDeferredFocusChanged) +#endif #if defined(Q_WS_X11) || defined(Q_WS_WIN) || defined(Q_WS_QWS) || defined(Q_WS_S60) << qMakePair(&widget, QEvent::UpdateRequest) #endif -- cgit v0.12