From 27e57ccd327fbc1edbb23d9959c5388023974dfc Mon Sep 17 00:00:00 2001 From: Jason Barron Date: Tue, 28 Apr 2009 16:08:22 +0200 Subject: Enable dynamic [de|con]struction of window surfaces based on visibility When a window becomes completely obscured either because it has been hidden or another window is completely covering it, the backing store should be deallocated to save memory and then re-allocated when the window is later made visible again. Reviewed-by: Iain --- src/gui/kernel/qapplication_s60.cpp | 35 +++++++++++++++++++++++++---------- src/gui/kernel/qwidget_s60.cpp | 7 ++++--- 2 files changed, 29 insertions(+), 13 deletions(-) diff --git a/src/gui/kernel/qapplication_s60.cpp b/src/gui/kernel/qapplication_s60.cpp index b021b1c..c7bbcdb 100644 --- a/src/gui/kernel/qapplication_s60.cpp +++ b/src/gui/kernel/qapplication_s60.cpp @@ -531,6 +531,9 @@ TCoeInputCapabilities QSymbianControl::InputCapabilities() const void QSymbianControl::Draw(const TRect& r) const { QWindowSurface *surface = qwidget->windowSurface(); + if (!surface) + return; + QPaintEngine *engine = surface->paintDevice()->paintEngine(); if (!engine) return; @@ -948,6 +951,7 @@ int QApplication::s60ProcessEvent(TWsEvent *event) // Qt event handling. Handle some events regardless of if the handle is in our // widget map or not. CCoeControl* control = reinterpret_cast(event->Handle()); + const bool controlInMap = QWidgetPrivate::mapper && QWidgetPrivate::mapper->contains(control); switch (event->Type()) { #ifndef QT_NO_IM case EEventKey: @@ -970,17 +974,12 @@ int QApplication::s60ProcessEvent(TWsEvent *event) } #endif case EEventPointerEnter: - if (QWidgetPrivate::mapper && QWidgetPrivate::mapper->contains(control)) - { - // Qt::Enter will be generated in HandlePointerL - return 1; - } + if (controlInMap) + return 1; // Qt::Enter will be generated in HandlePointerL break; case EEventPointerExit: - if (QWidgetPrivate::mapper && QWidgetPrivate::mapper->contains(control)) - { - if (S60) - { + if (controlInMap) { + if (S60) { // mouseEvent outside our window, send leave event to last focused widget QMouseEvent mEvent(QEvent::Leave, S60->lastPointerEventPos, S60->lastCursorPos, Qt::NoButton, QApplicationPrivate::mouse_buttons, Qt::NoModifier); @@ -995,11 +994,27 @@ int QApplication::s60ProcessEvent(TWsEvent *event) if (S60) S60->updateScreenSize(); return 0; // Propagate to CONE + case EEventWindowVisibilityChanged: + if (controlInMap) { + const TWsVisibilityChangedEvent *visChangedEvent = event->VisibilityChanged(); + QWidget *w = QWidgetPrivate::mapper->value(control); + if (!w->d_func()->maybeTopData()) + break; + if (visChangedEvent->iFlags & TWsVisibilityChangedEvent::ENotVisible) { + delete w->d_func()->topData()->backingStore; + w->d_func()->topData()->backingStore = 0; + } else if ((visChangedEvent->iFlags & TWsVisibilityChangedEvent::EPartiallyVisible) + && !w->d_func()->maybeBackingStore()) { + w->d_func()->topData()->backingStore = new QWidgetBackingStore(w); + } + return 1; + } + break; default: break; } - if (!QWidgetPrivate::mapper || !QWidgetPrivate::mapper->contains(control)) + if (!controlInMap) return -1; return 0; diff --git a/src/gui/kernel/qwidget_s60.cpp b/src/gui/kernel/qwidget_s60.cpp index 116dc35..ec80a18 100644 --- a/src/gui/kernel/qwidget_s60.cpp +++ b/src/gui/kernel/qwidget_s60.cpp @@ -195,12 +195,13 @@ void QWidgetPrivate::create_sys(WId window, bool initializeWindow, bool destroyO data.crect.moveTopLeft(QPoint(clientRect.iTl.iX, clientRect.iTl.iY)); QSymbianControl *control= new QSymbianControl(q); control->ConstructL(true,desktop); - if (!desktop) - { + if (!desktop) { QTLWExtra *topExtra = topData(); topExtra->rwindow = control->DrawableWindow(); // Request mouse move events. - topExtra->rwindow->PointerFilter(EPointerFilterEnterExit | EPointerFilterMove | EPointerFilterDrag, 0); + topExtra->rwindow->PointerFilter(EPointerFilterEnterExit + | EPointerFilterMove | EPointerFilterDrag, 0); + topExtra->rwindow->EnableVisibilityChangeEvents(); } id = (WId)control; -- cgit v0.12 From 5c0f4317665984746f9c2b2f93dbe6a6090318cf Mon Sep 17 00:00:00 2001 From: Janne Anttila Date: Wed, 29 Apr 2009 08:28:13 +0300 Subject: Fixed tst_QTcpSocket RVCT build when TEST_QNETWORK_PROXY is not defined. RVCT compiles also unused inline methods etc, for this reason QNetworkProxy needs to be included even it is not really used for anything. --- tests/auto/qtcpsocket/tst_qtcpsocket.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/auto/qtcpsocket/tst_qtcpsocket.cpp b/tests/auto/qtcpsocket/tst_qtcpsocket.cpp index 9d75fba..2e039bf 100644 --- a/tests/auto/qtcpsocket/tst_qtcpsocket.cpp +++ b/tests/auto/qtcpsocket/tst_qtcpsocket.cpp @@ -81,7 +81,8 @@ #ifndef TEST_QNETWORK_PROXY //#define TEST_QNETWORK_PROXY #endif -#ifdef TEST_QNETWORK_PROXY +#if defined(TEST_QNETWORK_PROXY) || defined (Q_CC_RVCT) +// RVCT compiles also unused inline methods # include #endif -- cgit v0.12 From 06b103c81a28237a568b3392e5e7954bb1ec7b1d Mon Sep 17 00:00:00 2001 From: Janne Anttila Date: Wed, 29 Apr 2009 10:40:36 +0300 Subject: Increased stack size for threads created in QLocalSocket autotests. The default stack size (8KB), caused KERN-EXEC 3 panics when executing tests in 5800 HW. --- tests/auto/qlocalsocket/tst_qlocalsocket.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/tests/auto/qlocalsocket/tst_qlocalsocket.cpp b/tests/auto/qlocalsocket/tst_qlocalsocket.cpp index c289c24..50ac953 100644 --- a/tests/auto/qlocalsocket/tst_qlocalsocket.cpp +++ b/tests/auto/qlocalsocket/tst_qlocalsocket.cpp @@ -716,12 +716,18 @@ void tst_QLocalSocket::threadedConnection() QFETCH(int, threads); Server server; +#if defined(Q_OS_SYMBIAN) + server.setStackSize(0x14000); +#endif server.clients = threads; server.start(); QList clients; for (int i = 0; i < threads; ++i) { clients.append(new Client()); +#if defined(Q_OS_SYMBIAN) + clients.last()->setStackSize(0x14000); +#endif clients.last()->start(); } -- cgit v0.12