From d164ca3dd62cb645767f332b7cddf07b400c8beb Mon Sep 17 00:00:00 2001 From: Miikka Heikkinen Date: Fri, 18 Mar 2011 14:35:08 +0200 Subject: Add /q switch to QMAKE_DEL_FILE command in symbian Builds will otherwise halt without giving reason if a wildcard is given in QMAKE_CLEAN in symbian-abld. Task-number: QTBUG-18207 Reviewed-by: axis --- mkspecs/common/symbian/symbian.conf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mkspecs/common/symbian/symbian.conf b/mkspecs/common/symbian/symbian.conf index c16e4f1..eab9644 100644 --- a/mkspecs/common/symbian/symbian.conf +++ b/mkspecs/common/symbian/symbian.conf @@ -93,7 +93,7 @@ contains(QMAKE_HOST.os,Windows) { QMAKE_COPY = copy /y QMAKE_COPY_DIR = xcopy /s /q /y /i QMAKE_MOVE = move - QMAKE_DEL_FILE = del 2> NUL + QMAKE_DEL_FILE = del /q 2> NUL QMAKE_MKDIR = mkdir QMAKE_DEL_DIR = rmdir QMAKE_DEL_TREE = rmdir /s /q -- cgit v0.12 From c2317645b94f9a3004d76dda558c4a2b853a1489 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Samuel=20R=C3=B8dal?= Date: Fri, 18 Mar 2011 14:24:03 +0100 Subject: Added setSwitchPolicy to MeeGo graphicssystem helper API. This lets the application control whether or not automatic switching should be used, and also to completely disable switching if desired. Reviewed-by: Armin Berres --- .../graphicssystems/meego/qmeegographicssystem.cpp | 19 ++++++++++++++----- .../graphicssystems/meego/qmeegographicssystem.h | 6 +++++- .../qmeegographicssystemhelper.cpp | 5 +++++ .../qmeegographicssystemhelper.h | 19 +++++++++++++++++++ tools/qmeegographicssystemhelper/qmeegoruntime.cpp | 13 ++++++++++++- tools/qmeegographicssystemhelper/qmeegoruntime.h | 3 +++ 6 files changed, 58 insertions(+), 7 deletions(-) diff --git a/src/plugins/graphicssystems/meego/qmeegographicssystem.cpp b/src/plugins/graphicssystems/meego/qmeegographicssystem.cpp index cb66695..c904c3c 100644 --- a/src/plugins/graphicssystems/meego/qmeegographicssystem.cpp +++ b/src/plugins/graphicssystems/meego/qmeegographicssystem.cpp @@ -67,6 +67,8 @@ QHash QMeeGoGraphicsSystem::liveTexturePixmaps; QList QMeeGoGraphicsSystem::switchCallbacks; +QMeeGoGraphicsSystem::SwitchPolicy QMeeGoGraphicsSystem::switchPolicy = QMeeGoGraphicsSystem::AutomaticSwitch; + QMeeGoGraphicsSystem::QMeeGoGraphicsSystem() { qDebug("Using the meego graphics system"); @@ -122,14 +124,14 @@ void QMeeGoGraphicsSystemSwitchHandler::addWidget(QWidget *widget) void QMeeGoGraphicsSystemSwitchHandler::handleMapNotify() { - if (m_widgets.isEmpty()) + if (m_widgets.isEmpty() && QMeeGoGraphicsSystem::switchPolicy == QMeeGoGraphicsSystem::AutomaticSwitch) QTimer::singleShot(0, this, SLOT(switchToMeeGo())); } void QMeeGoGraphicsSystemSwitchHandler::removeWidget(QObject *object) { m_widgets.removeOne(static_cast(object)); - if (m_widgets.isEmpty()) + if (m_widgets.isEmpty() && QMeeGoGraphicsSystem::switchPolicy == QMeeGoGraphicsSystem::AutomaticSwitch) QTimer::singleShot(0, this, SLOT(switchToRaster())); } @@ -153,7 +155,9 @@ int QMeeGoGraphicsSystemSwitchHandler::visibleWidgets() const bool QMeeGoGraphicsSystemSwitchHandler::eventFilter(QObject *object, QEvent *event) { - if (event->type() == QEvent::WindowStateChange) { + if (event->type() == QEvent::WindowStateChange + && QMeeGoGraphicsSystem::switchPolicy == QMeeGoGraphicsSystem::AutomaticSwitch) + { QWindowStateChangeEvent *change = static_cast(event); QWidget *widget = static_cast(object); @@ -380,7 +384,7 @@ QString QMeeGoGraphicsSystem::runningGraphicsSystemName() void QMeeGoGraphicsSystem::switchToMeeGo() { - if (meeGoRunning()) + if (switchPolicy == NoSwitch || meeGoRunning()) return; if (QApplicationPrivate::instance()->graphics_system_name != QLatin1String("runtime")) @@ -397,7 +401,7 @@ void QMeeGoGraphicsSystem::switchToMeeGo() void QMeeGoGraphicsSystem::switchToRaster() { - if (runningGraphicsSystemName() == QLatin1String("raster")) + if (switchPolicy == NoSwitch || runningGraphicsSystemName() == QLatin1String("raster")) return; if (QApplicationPrivate::instance()->graphics_system_name != QLatin1String("runtime")) @@ -522,4 +526,9 @@ void qt_meego_register_switch_callback(QMeeGoSwitchCallback callback) QMeeGoGraphicsSystem::registerSwitchCallback(callback); } +void qt_meego_set_switch_policy(int policy) +{ + QMeeGoGraphicsSystem::switchPolicy = QMeeGoGraphicsSystem::SwitchPolicy(policy); +} + #include "qmeegographicssystem.moc" diff --git a/src/plugins/graphicssystems/meego/qmeegographicssystem.h b/src/plugins/graphicssystems/meego/qmeegographicssystem.h index ecc85b2..3528425 100644 --- a/src/plugins/graphicssystems/meego/qmeegographicssystem.h +++ b/src/plugins/graphicssystems/meego/qmeegographicssystem.h @@ -52,6 +52,8 @@ extern "C" typedef void (*QMeeGoSwitchCallback)(int type, const char *name); class QMeeGoGraphicsSystem : public QGraphicsSystem { public: + enum SwitchPolicy { AutomaticSwitch, ManualSwitch, NoSwitch }; + QMeeGoGraphicsSystem(); ~QMeeGoGraphicsSystem(); @@ -84,6 +86,8 @@ public: static void registerSwitchCallback(QMeeGoSwitchCallback callback); + static SwitchPolicy switchPolicy; + private: static bool meeGoRunning(); static EGLSurface getSurfaceForLiveTexturePixmap(QPixmap *pixmap); @@ -93,7 +97,6 @@ private: static bool surfaceWasCreated; static QHash liveTexturePixmaps; static QList switchCallbacks; - }; /* C api */ @@ -118,6 +121,7 @@ extern "C" { Q_DECL_EXPORT void qt_meego_switch_to_raster(void); Q_DECL_EXPORT void qt_meego_switch_to_meego(void); Q_DECL_EXPORT void qt_meego_register_switch_callback(QMeeGoSwitchCallback callback); + Q_DECL_EXPORT void qt_meego_set_switch_policy(int policy); } #endif diff --git a/tools/qmeegographicssystemhelper/qmeegographicssystemhelper.cpp b/tools/qmeegographicssystemhelper/qmeegographicssystemhelper.cpp index 3f39bda..6778bd5 100644 --- a/tools/qmeegographicssystemhelper/qmeegographicssystemhelper.cpp +++ b/tools/qmeegographicssystemhelper/qmeegographicssystemhelper.cpp @@ -136,6 +136,11 @@ void QMeeGoGraphicsSystemHelper::setSwapBehavior(SwapMode mode) QGLWindowSurface::swapBehavior = QGLWindowSurface::KillSwap; } +void QMeeGoGraphicsSystemHelper::setSwitchPolicy(SwitchPolicy policy) +{ + QMeeGoRuntime::setSwitchPolicy(policy); +} + void QMeeGoGraphicsSystemHelper::enableSwitchEvents() { QMeeGoRuntime::enableSwitchEvents(); diff --git a/tools/qmeegographicssystemhelper/qmeegographicssystemhelper.h b/tools/qmeegographicssystemhelper/qmeegographicssystemhelper.h index 9e50652..4612190 100644 --- a/tools/qmeegographicssystemhelper/qmeegographicssystemhelper.h +++ b/tools/qmeegographicssystemhelper/qmeegographicssystemhelper.h @@ -112,6 +112,7 @@ public: If switch events are enabled, two events will be emitted for each switch -- one before the switch (QMeeGoSwitchEvent::WillSwitch) and one after the switch (QMeeGoSwitchEvent::DidSwitch). + If the switch policy is set to NoSwitch, this function has no effect. */ static void switchToMeeGo(); @@ -124,9 +125,27 @@ public: Calling this function will emit QMeeGoSwitchEvent to the top level widgets. If switch events are enabled, two events will be emitted for each switch -- one before the switch (QMeeGoSwitchEvent::WillSwitch) and one after the switch (QMeeGoSwitchEvent::DidSwitch). + If the switch policy is set to NoSwitch, this function has no effect. */ static void switchToRaster(); + //! Used to specify the policy for graphics system switching. + enum SwitchPolicy { + AutomaticSwitch, /**< Automatic switching */ + ManualSwitch, /**< Switching is controleld by the application */ + NoSwitch /**< Switching is disabled completely */ + }; + + //! Sets the policy of graphicssystem switching + /*! + By default, the switch to raster happens automatically when all windows are either + minimized or when the last window is destroyed. This function lets the application + change the graphicssystem switching policy to prevent the switching from happening + automatically (that is if the application doesn't want switching at all or wishes + to control the switching manually). + */ + static void setSwitchPolicy(SwitchPolicy policy); + //! Returns the name of the active graphics system /*! Returns the name of the currently active system. If running with 'runtime' graphics diff --git a/tools/qmeegographicssystemhelper/qmeegoruntime.cpp b/tools/qmeegographicssystemhelper/qmeegoruntime.cpp index 15f9cdf..928d01a 100644 --- a/tools/qmeegographicssystemhelper/qmeegoruntime.cpp +++ b/tools/qmeegographicssystemhelper/qmeegoruntime.cpp @@ -75,6 +75,7 @@ typedef void (*QMeeGoInvalidateLiveSurfacesFunc) (void); typedef void (*QMeeGoSwitchToRasterFunc) (void); typedef void (*QMeeGoSwitchToMeeGoFunc) (void); typedef void (*QMeeGoRegisterSwitchCallbackFunc) (void (*callback)(int type, const char *name)); +typedef void (*QMeeGoSetSwitchPolicyFunc) (int policy); static QMeeGoImageToEglSharedImageFunc qt_meego_image_to_egl_shared_image = NULL; static QMeeGoPixmapDataFromEglSharedImageFunc qt_meego_pixmapdata_from_egl_shared_image = NULL; @@ -95,6 +96,7 @@ static QMeeGoInvalidateLiveSurfacesFunc qt_meego_invalidate_live_surfaces = NULL static QMeeGoSwitchToRasterFunc qt_meego_switch_to_raster = NULL; static QMeeGoSwitchToMeeGoFunc qt_meego_switch_to_meego = NULL; static QMeeGoRegisterSwitchCallbackFunc qt_meego_register_switch_callback = NULL; +static QMeeGoSetSwitchPolicyFunc qt_meego_set_switch_policy = NULL; extern "C" void handleSwitch(int type, const char *name) { @@ -134,6 +136,7 @@ void QMeeGoRuntime::initialize() qt_meego_switch_to_raster = (QMeeGoSwitchToRasterFunc) library.resolve("qt_meego_switch_to_raster"); qt_meego_switch_to_meego = (QMeeGoSwitchToMeeGoFunc) library.resolve("qt_meego_switch_to_meego"); qt_meego_register_switch_callback = (QMeeGoRegisterSwitchCallbackFunc) library.resolve("qt_meego_register_switch_callback"); + qt_meego_set_switch_policy = (QMeeGoSetSwitchPolicyFunc) library.resolve("qt_meego_set_switch_policy"); if (qt_meego_image_to_egl_shared_image && qt_meego_pixmapdata_from_egl_shared_image && qt_meego_pixmapdata_with_gl_texture && qt_meego_destroy_egl_shared_image && qt_meego_update_egl_shared_image_pixmap && @@ -141,7 +144,8 @@ void QMeeGoRuntime::initialize() qt_meego_pixmapdata_with_new_live_texture && qt_meego_pixmapdata_from_live_texture_handle && qt_meego_live_texture_lock && qt_meego_live_texture_release && qt_meego_live_texture_get_handle && qt_meego_create_fence_sync && qt_meego_destroy_fence_sync && qt_meego_invalidate_live_surfaces && - qt_meego_switch_to_raster && qt_meego_switch_to_meego && qt_meego_register_switch_callback) + qt_meego_switch_to_raster && qt_meego_switch_to_meego && qt_meego_register_switch_callback && + qt_meego_set_switch_policy) { qDebug("Successfully resolved MeeGo graphics system: %s %s\n", qPrintable(libraryPrivate->fileName), qPrintable(libraryPrivate->fullVersion)); } else { @@ -289,3 +293,10 @@ void QMeeGoRuntime::enableSwitchEvents() switchEventsEnabled = true; } } + +void QMeeGoRuntime::setSwitchPolicy(QMeeGoGraphicsSystemHelper::SwitchPolicy policy) +{ + ENSURE_INITIALIZED; + Q_ASSERT(qt_meego_set_switch_policy); + qt_meego_set_switch_policy(int(policy)); +} diff --git a/tools/qmeegographicssystemhelper/qmeegoruntime.h b/tools/qmeegographicssystemhelper/qmeegoruntime.h index 6279b4c..b898699 100644 --- a/tools/qmeegographicssystemhelper/qmeegoruntime.h +++ b/tools/qmeegographicssystemhelper/qmeegoruntime.h @@ -42,6 +42,8 @@ #include #include +#include "qmeegographicssystemhelper.h" + class QMeeGoRuntime { public: @@ -66,6 +68,7 @@ public: static void switchToRaster(); static void switchToMeeGo(); static void enableSwitchEvents(); + static void setSwitchPolicy(QMeeGoGraphicsSystemHelper::SwitchPolicy policy); private: static bool initialized; -- cgit v0.12 From 59373dd338cb9428514b67c21d0e03b8dc189eef Mon Sep 17 00:00:00 2001 From: Gareth Stockwell Date: Fri, 18 Mar 2011 10:21:26 +0000 Subject: Fixed unmatched quotes in s60installs.pro Reviewed-by: Miikka Heikkinen --- src/s60installs/s60installs.pro | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/s60installs/s60installs.pro b/src/s60installs/s60installs.pro index 1e5ce0f..76f1dda 100644 --- a/src/s60installs/s60installs.pro +++ b/src/s60installs/s60installs.pro @@ -58,7 +58,7 @@ symbian: { " \"$$pluginLocations/qts60plugin_5_0$${QT_LIBINFIX}.dll\" - \"c:\\sys\\bin\\qts60plugin_5_0$${QT_LIBINFIX}.dll\"" \ " \"$$bearerPluginLocation/qsymbianbearer$${QT_LIBINFIX}.dll\" - \"c:\\sys\\bin\\qsymbianbearer$${QT_LIBINFIX}.dll\"" \ "ENDIF" \ - " \"$$bearerStubZ\" - \"c:$$replace(QT_PLUGINS_BASE_DIR,/,\\)\\bearer\\qsymbianbearer$${QT_LIBINFIX}.qtplugin\" + " \"$$bearerStubZ\" - \"c:$$replace(QT_PLUGINS_BASE_DIR,/,\\)\\bearer\\qsymbianbearer$${QT_LIBINFIX}.qtplugin\"" } else { # No need to deploy plugins for older platform versions when building on Symbian3 or later qts60plugindeployment = \ -- cgit v0.12 From 31514ab488c610056973318f5a950d925155d480 Mon Sep 17 00:00:00 2001 From: Gareth Stockwell Date: Wed, 16 Mar 2011 15:53:45 +0000 Subject: Add flag for forcibly propagating backing store alpha to framebuffer Previously, the following rules applies to the creation and blitting of the Symbian raster backing store: 1. Creation of backing store with an alpha channel: Backing store has an alpha channel only if !QWidget::isOpaque. 2. Pre-filling of backing store prior to paint loop: Backing store is filled with transparent pixels if !QWidget::isOpaque. 3. Blitting of backing store: CGraphicsContext::EDrawModeWriteAlpha is used (meaning that backing store alpha values are propagated into the frame buffer), if QWidget::isOpaque. In order for the direct camera viewfinder to be visible on DSA devices, alpha=0 must be written into the framebuffer in the region where the viewfinder will be displayed. This requires a backing store with an alpha channel (1), use of CGraphicsContext::EDrawModeWriteAlpha (3), but not pre-filling of the entire backing store (2). This patch adds a new enum value, QWExtra::BlitWriteAlpha, which can be used by camera backends to achieve the desired behaviour. Task-number: QTMOBILITY-1278 Reviewed-by: Jani Hautakangas --- src/gui/kernel/qapplication_s60.cpp | 3 ++- src/gui/kernel/qwidget_p.h | 5 +++++ src/gui/kernel/qwidget_s60.cpp | 10 +++++++--- src/gui/painting/qwindowsurface_s60.cpp | 28 +++++++++++++++++++--------- 4 files changed, 33 insertions(+), 13 deletions(-) diff --git a/src/gui/kernel/qapplication_s60.cpp b/src/gui/kernel/qapplication_s60.cpp index 43b9b01..2b10d63 100644 --- a/src/gui/kernel/qapplication_s60.cpp +++ b/src/gui/kernel/qapplication_s60.cpp @@ -1132,7 +1132,8 @@ void QSymbianControl::Draw(const TRect& controlRect) const // Do nothing break; case QWExtra::Blit: - if (qwidget->d_func()->isOpaque) + case QWExtra::BlitWriteAlpha: + if (qwidget->d_func()->isOpaque || nativePaintMode == QWExtra::BlitWriteAlpha) gc.SetDrawMode(CGraphicsContext::EDrawModeWriteAlpha); gc.BitBlt(controlRect.iTl, bitmap, backingStoreRect); break; diff --git a/src/gui/kernel/qwidget_p.h b/src/gui/kernel/qwidget_p.h index 5235dc4..13e2349 100644 --- a/src/gui/kernel/qwidget_p.h +++ b/src/gui/kernel/qwidget_p.h @@ -315,6 +315,11 @@ struct QWExtra { */ ZeroFill, + /** + * Blit backing store, propagating alpha channel into the framebuffer. + */ + BlitWriteAlpha, + Default = Blit }; diff --git a/src/gui/kernel/qwidget_s60.cpp b/src/gui/kernel/qwidget_s60.cpp index 62d09fe..b65ae4d 100644 --- a/src/gui/kernel/qwidget_s60.cpp +++ b/src/gui/kernel/qwidget_s60.cpp @@ -805,9 +805,14 @@ void QWidgetPrivate::s60UpdateIsOpaque() { Q_Q(QWidget); - if (!q->testAttribute(Qt::WA_WState_Created) || !q->testAttribute(Qt::WA_TranslucentBackground)) + if (!q->testAttribute(Qt::WA_WState_Created)) return; + const bool writeAlpha = extraData()->nativePaintMode == QWExtra::BlitWriteAlpha; + if (!q->testAttribute(Qt::WA_TranslucentBackground) && !writeAlpha) + return; + const bool requireAlphaChannel = !isOpaque || writeAlpha; + createTLExtra(); RWindow *const window = static_cast(q->effectiveWinId()->DrawableWindow()); @@ -819,12 +824,11 @@ void QWidgetPrivate::s60UpdateIsOpaque() return; } #endif - if (!isOpaque) { + if (requireAlphaChannel) { const TDisplayMode displayMode = static_cast(window->SetRequiredDisplayMode(EColor16MA)); if (window->SetTransparencyAlphaChannel() == KErrNone) { window->SetBackgroundColor(TRgb(255, 255, 255, 0)); extra->topextra->nativeWindowTransparencyEnabled = 1; - if (extra->topextra->backingStore.data() && ( QApplicationPrivate::graphics_system_name == QLatin1String("openvg") || QApplicationPrivate::graphics_system_name == QLatin1String("opengl"))) { diff --git a/src/gui/painting/qwindowsurface_s60.cpp b/src/gui/painting/qwindowsurface_s60.cpp index 9f371a8..cb53ea0 100644 --- a/src/gui/painting/qwindowsurface_s60.cpp +++ b/src/gui/painting/qwindowsurface_s60.cpp @@ -63,7 +63,6 @@ struct QS60WindowSurfacePrivate TDisplayMode displayMode(bool opaque) { - TDisplayMode mode = S60->screenDevice()->DisplayMode(); if (opaque) { mode = EColor16MU; @@ -76,10 +75,18 @@ TDisplayMode displayMode(bool opaque) return mode; } +bool blitWriteAlpha(QWidgetPrivate *widgetPrivate) +{ + QWExtra *extra = widgetPrivate->extraData(); + return extra ? extra->nativePaintMode == QWExtra::BlitWriteAlpha : false; +} + QS60WindowSurface::QS60WindowSurface(QWidget* widget) : QWindowSurface(widget), d_ptr(new QS60WindowSurfacePrivate) { - TDisplayMode mode = displayMode(qt_widget_private(widget)->isOpaque); + QWidgetPrivate *widgetPrivate = qt_widget_private(widget); + const bool opaque = widgetPrivate->isOpaque && !blitWriteAlpha(widgetPrivate); + TDisplayMode mode = displayMode(opaque); // We create empty CFbsBitmap here -> it will be resized in setGeometry CFbsBitmap *bitmap = q_check_ptr(new CFbsBitmap); // CBase derived object needs check on new qt_symbian_throwIfError( bitmap->Create( TSize(0, 0), mode ) ); @@ -123,7 +130,8 @@ void QS60WindowSurface::beginPaint(const QRegion &rgn) S60->wsSession().Finish(); #endif - if (!qt_widget_private(window())->isOpaque) { + QWidgetPrivate *windowPrivate = qt_widget_private(window()); + if (!windowPrivate->isOpaque || blitWriteAlpha(windowPrivate)) { QS60PixmapData *pixmapData = static_cast(d_ptr->device.data_ptr().data()); TDisplayMode mode = displayMode(false); @@ -132,12 +140,14 @@ void QS60WindowSurface::beginPaint(const QRegion &rgn) pixmapData->beginDataAccess(); - QPainter p(&pixmapData->image); - p.setCompositionMode(QPainter::CompositionMode_Source); - const QVector rects = rgn.rects(); - const QColor blank = Qt::transparent; - for (QVector::const_iterator it = rects.begin(); it != rects.end(); ++it) { - p.fillRect(*it, blank); + if (!windowPrivate->isOpaque) { + QPainter p(&pixmapData->image); + p.setCompositionMode(QPainter::CompositionMode_Source); + const QVector rects = rgn.rects(); + const QColor blank = Qt::transparent; + for (QVector::const_iterator it = rects.begin(); it != rects.end(); ++it) { + p.fillRect(*it, blank); + } } pixmapData->endDataAccess(); -- cgit v0.12