From 86870912cfb1444f2ad0cd6b99c163af43f06bde Mon Sep 17 00:00:00 2001 From: Miikka Heikkinen Date: Tue, 26 Oct 2010 12:03:32 +0300 Subject: Fix empty mifconv TARGETFILE in some edge cases. Only add ICON for Qt gui application projects that do not explicitly want to suppress it in symbianpkgrules.pri. This logic should match the logic used for setting RSS_RULES.icon_file and thus avoid empty TARGETFILE in bld.inf mifconv extension. Task-number: QT-4193 Reviewed-by: Janne Koskinen --- demos/symbianpkgrules.pri | 4 +++- examples/symbianpkgrules.pri | 5 ++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/demos/symbianpkgrules.pri b/demos/symbianpkgrules.pri index d42f188..c9cc492 100644 --- a/demos/symbianpkgrules.pri +++ b/demos/symbianpkgrules.pri @@ -13,4 +13,6 @@ vendorinfo = \ demos_deployment.pkg_prerules += vendorinfo DEPLOYMENT += demos_deployment -contains(TEMPLATE,app):isEmpty(ICON):ICON = $$QT_SOURCE_TREE/src/s60installs/qt.svg +isEmpty(ICON):contains(TEMPLATE, ".*app"):contains(QT, gui):contains(CONFIG, qt):!contains(CONFIG, "no_icon") { + ICON = $$QT_SOURCE_TREE/src/s60installs/qt.svg +} diff --git a/examples/symbianpkgrules.pri b/examples/symbianpkgrules.pri index b22ca85..0f615c7 100644 --- a/examples/symbianpkgrules.pri +++ b/examples/symbianpkgrules.pri @@ -13,4 +13,7 @@ vendorinfo = \ examples_deployment.pkg_prerules += vendorinfo DEPLOYMENT += examples_deployment -contains(TEMPLATE,app):isEmpty(ICON):ICON = $$QT_SOURCE_TREE/src/s60installs/qt.svg +isEmpty(ICON):contains(TEMPLATE, ".*app"):contains(QT, gui):contains(CONFIG, qt):!contains(CONFIG, "no_icon") { + ICON = $$QT_SOURCE_TREE/src/s60installs/qt.svg +} + -- cgit v0.12 From f603ce9a960ee387ab10be1916da8ffd09305045 Mon Sep 17 00:00:00 2001 From: Miikka Heikkinen Date: Tue, 26 Oct 2010 13:50:28 +0300 Subject: Fix patch_capabilities.pl script for explicit set of capabilities Elftran command never got executed when explicit set of capabilities was defined. No warning or error was printed either, making it rather confusing for user. Task-number: QTBUG-14730 Reviewed-by: Janne Koskinen --- bin/patch_capabilities.pl | 3 +++ 1 file changed, 3 insertions(+) diff --git a/bin/patch_capabilities.pl b/bin/patch_capabilities.pl index 06ab116..5230480 100755 --- a/bin/patch_capabilities.pl +++ b/bin/patch_capabilities.pl @@ -269,6 +269,9 @@ if (@ARGV) if (@capabilitiesSpecified) { $commandToExecute = sprintf($baseCommandToExecute, join(" ", @capabilitiesSpecified)); + $executeNeeded = 1; + my $capString = join(" ", @capabilitiesSpecified); + print ("Patching: Patching the the Vendor ID to 0 and the capabilities used to: \"$capString\" in \"$binaryBaseName\".\n"); } else { # Test which capabilities are present and then restrict them to the allowed set. # This avoid raising the capabilities of apps that already have none. -- cgit v0.12 From 586fc2a9ead06a8478bdc380b775f18000741745 Mon Sep 17 00:00:00 2001 From: Gareth Stockwell Date: Tue, 19 Oct 2010 09:40:25 +0100 Subject: Suppress call to controlVisibilityChanged for null control pointer At this point, old_winid may be null. Passing a null pointer to controlVisibilityChanged is actually a no-op, due to the 'QWidgetPrivate::mapper->contains(control)' check, but suppressing the function call altogether clarifies the intent of the code slightly. Reviewed-by: Jason Barron --- src/gui/kernel/qwidget_s60.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/gui/kernel/qwidget_s60.cpp b/src/gui/kernel/qwidget_s60.cpp index 031892d..cf4bdf1 100644 --- a/src/gui/kernel/qwidget_s60.cpp +++ b/src/gui/kernel/qwidget_s60.cpp @@ -709,7 +709,8 @@ void QWidgetPrivate::setParent_sys(QWidget *parent, Qt::WindowFlags f) // old_winid may not have received a 'not visible' visibility // changed event before being destroyed; make sure that it is // removed from the backing store's list of visible windows. - S60->controlVisibilityChanged(old_winid, false); + if (old_winid) + S60->controlVisibilityChanged(old_winid, false); setWinId(0); -- cgit v0.12 From f417a6e7729a506e5a59e7fd38e03166515198b1 Mon Sep 17 00:00:00 2001 From: Gareth Stockwell Date: Tue, 19 Oct 2010 16:46:18 +0100 Subject: Remove widget subtree from backing store tracker when reparented When a native widget is reparented such that the value of maybeBackingStore() changes, it and all of its native descendents must be removed from the old QWidgetBackingStoreTracker. If this is not done, the backing store may not be deleted when the top-level widget is hidden, thereby consuming memory unnecessarily. Task-number: MOBILITY-1315 Reviewed-by: Jason Barron Reviewed-by: bnilsen --- src/gui/kernel/qwidget.cpp | 20 ++++++++++++++++++++ src/gui/kernel/qwidget_p.h | 1 + tests/auto/qwidget/tst_qwidget.cpp | 24 +++++++++++++++++++++--- 3 files changed, 42 insertions(+), 3 deletions(-) diff --git a/src/gui/kernel/qwidget.cpp b/src/gui/kernel/qwidget.cpp index 9b44f15..6c64ffc 100644 --- a/src/gui/kernel/qwidget.cpp +++ b/src/gui/kernel/qwidget.cpp @@ -236,6 +236,17 @@ void QWidgetBackingStoreTracker::unregisterWidget(QWidget *w) } } +/*! + \internal + Recursively remove widget and all of its descendents. + */ +void QWidgetBackingStoreTracker::unregisterWidgetSubtree(QWidget *widget) +{ + unregisterWidget(widget); + foreach (QObject *child, widget->children()) + if (QWidget *childWidget = qobject_cast(child)) + unregisterWidgetSubtree(childWidget); +} QWidgetPrivate::QWidgetPrivate(int version) : QObjectPrivate(version) @@ -10031,7 +10042,16 @@ void QWidget::setParent(QWidget *parent, Qt::WindowFlags f) if (newParent && isAncestorOf(focusWidget())) focusWidget()->clearFocus(); + QTLWExtra *oldTopExtra = window()->d_func()->maybeTopData(); + QWidgetBackingStoreTracker *oldBsTracker = oldTopExtra ? &oldTopExtra->backingStore : 0; + d->setParent_sys(parent, f); + + QTLWExtra *topExtra = window()->d_func()->maybeTopData(); + QWidgetBackingStoreTracker *bsTracker = topExtra ? &topExtra->backingStore : 0; + if (oldBsTracker && oldBsTracker != bsTracker) + oldBsTracker->unregisterWidgetSubtree(this); + if (desktopWidget) parent = 0; diff --git a/src/gui/kernel/qwidget_p.h b/src/gui/kernel/qwidget_p.h index 6c89659..ca1e3fc 100644 --- a/src/gui/kernel/qwidget_p.h +++ b/src/gui/kernel/qwidget_p.h @@ -122,6 +122,7 @@ public: void registerWidget(QWidget *w); void unregisterWidget(QWidget *w); + void unregisterWidgetSubtree(QWidget *w); inline QWidgetBackingStore* data() { diff --git a/tests/auto/qwidget/tst_qwidget.cpp b/tests/auto/qwidget/tst_qwidget.cpp index 2f221d2..09af941 100644 --- a/tests/auto/qwidget/tst_qwidget.cpp +++ b/tests/auto/qwidget/tst_qwidget.cpp @@ -9718,14 +9718,25 @@ void tst_QWidget::destroyBackingStoreWhenHidden() child.setAutoFillBackground(true); child.setPalette(Qt::blue); + QWidget grandChild(&child); + grandChild.setAutoFillBackground(true); + grandChild.setPalette(Qt::yellow); + QVBoxLayout layout(&parent); layout.setContentsMargins(10, 10, 10, 10); layout.addWidget(&child); parent.setLayout(&layout); - child.winId(); + QVBoxLayout childLayout(&child); + childLayout.setContentsMargins(10, 10, 10, 10); + childLayout.addWidget(&grandChild); + child.setLayout(&childLayout); + + // Ensure that this widget and all its ancestors are native + grandChild.winId(); parent.show(); + QTest::qWaitForWindowShown(&parent); // Check that child window does not obscure parent window @@ -9734,18 +9745,24 @@ void tst_QWidget::destroyBackingStoreWhenHidden() // Native child widget should share parent's backing store QVERIFY(0 != backingStore(parent)); QVERIFY(0 == backingStore(child)); + QVERIFY(0 == backingStore(grandChild)); // Make child widget full screen child.setWindowFlags((child.windowFlags() | Qt::Window) ^ Qt::SubWindow); child.setWindowState(child.windowState() | Qt::WindowFullScreen); child.show(); + + // Paint into the child to ensure that it gets a backing store + QPainter painter(&child); + painter.fillRect(QRect(0, 0, 90, 90), Qt::white); + QTest::qWaitForWindowShown(&child); // Ensure that 'window hidden' event is received by parent qApp->processEvents(); // Check that child window obscures parent window - QVERIFY(parent.visibleRegion().subtracted(child.visibleRegion()).isEmpty()); + QVERIFY(parent.visibleRegion().subtracted(child.visibleRegion() + grandChild.visibleRegion()).isEmpty()); // Now that extent of child widget goes beyond parent's extent, // a new backing store should be created for the child widget. @@ -9761,11 +9778,12 @@ void tst_QWidget::destroyBackingStoreWhenHidden() QTest::qWaitForWindowShown(&child); // Check that parent is now visible again - QVERIFY(!parent.visibleRegion().subtracted(child.visibleRegion()).isEmpty()); + QVERIFY(!parent.visibleRegion().subtracted(child.visibleRegion() + grandChild.visibleRegion()).isEmpty()); // Native child widget should once again share parent's backing store QVERIFY(0 != backingStore(parent)); QVERIFY(0 == backingStore(child)); + QVERIFY(0 == backingStore(grandChild)); } // 6. Partial reveal followed by full reveal -- cgit v0.12 From 5d411794d18f33ed8438744216b8ec5095682e20 Mon Sep 17 00:00:00 2001 From: Gareth Stockwell Date: Tue, 26 Oct 2010 09:18:39 +0100 Subject: Create dummy window surface if if _q_DummyWindowSurface property is set Task-number: MOBILITY-1315 Reviewed-by: Jason Barron Reviewed-by: bnilsen --- src/gui/kernel/qwidget.cpp | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/src/gui/kernel/qwidget.cpp b/src/gui/kernel/qwidget.cpp index 6c64ffc..e22ec55 100644 --- a/src/gui/kernel/qwidget.cpp +++ b/src/gui/kernel/qwidget.cpp @@ -337,15 +337,27 @@ QWidgetPrivate::~QWidgetPrivate() #endif //QT_NO_GRAPHICSEFFECT } +class QDummyWindowSurface : public QWindowSurface +{ +public: + QDummyWindowSurface(QWidget *window) : QWindowSurface(window) {} + QPaintDevice *paintDevice() { return window(); } + void flush(QWidget *, const QRegion &, const QPoint &) {} +}; + QWindowSurface *QWidgetPrivate::createDefaultWindowSurface() { Q_Q(QWidget); QWindowSurface *surface; - if (QApplicationPrivate::graphicsSystem()) - surface = QApplicationPrivate::graphicsSystem()->createWindowSurface(q); - else - surface = createDefaultWindowSurface_sys(); + if (q->property("_q_DummyWindowSurface").toBool()) { + surface = new QDummyWindowSurface(q); + } else { + if (QApplicationPrivate::graphicsSystem()) + surface = QApplicationPrivate::graphicsSystem()->createWindowSurface(q); + else + surface = createDefaultWindowSurface_sys(); + } return surface; } -- cgit v0.12 From 00ab5c0d690f5cbb1f588adf0d469e5e9c54051c Mon Sep 17 00:00:00 2001 From: Gareth Stockwell Date: Mon, 25 Oct 2010 15:40:19 +0100 Subject: Phonon MMF backend: set _q_DummyWindowSurface property on VideoWidget This prevents a window surface being created if Phonon::VideoWidget::setFullScreen(true) is called. Since Qt does not ever render any content to the native window in which video is displayed, creation of a surface for that window would consume memory unnecessarily. Task-number: MOBILITY-1315 Reviewed-by: Jason Barron --- src/3rdparty/phonon/mmf/videowidget.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/3rdparty/phonon/mmf/videowidget.cpp b/src/3rdparty/phonon/mmf/videowidget.cpp index 122094e..d59e82a 100644 --- a/src/3rdparty/phonon/mmf/videowidget.cpp +++ b/src/3rdparty/phonon/mmf/videowidget.cpp @@ -65,6 +65,8 @@ MMF::VideoWidget::VideoWidget(QWidget *parent) TRACE_CONTEXT(VideoWidget::VideoWidget, EVideoApi); TRACE_ENTRY_0(); + parent->setProperty("_q_DummyWindowSurface", true); + TRACE_EXIT_0(); } -- cgit v0.12