summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--mkspecs/common/symbian/symbian.conf2
-rw-r--r--src/gui/kernel/qapplication_s60.cpp3
-rw-r--r--src/gui/kernel/qwidget_p.h5
-rw-r--r--src/gui/kernel/qwidget_s60.cpp10
-rw-r--r--src/gui/painting/qwindowsurface_s60.cpp28
-rw-r--r--src/plugins/graphicssystems/meego/qmeegographicssystem.cpp19
-rw-r--r--src/plugins/graphicssystems/meego/qmeegographicssystem.h6
-rw-r--r--src/s60installs/s60installs.pro2
-rw-r--r--tools/qmeegographicssystemhelper/qmeegographicssystemhelper.cpp5
-rw-r--r--tools/qmeegographicssystemhelper/qmeegographicssystemhelper.h19
-rw-r--r--tools/qmeegographicssystemhelper/qmeegoruntime.cpp13
-rw-r--r--tools/qmeegographicssystemhelper/qmeegoruntime.h3
12 files changed, 93 insertions, 22 deletions
diff --git a/mkspecs/common/symbian/symbian.conf b/mkspecs/common/symbian/symbian.conf
index d9f6279..74acc64 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
diff --git a/src/gui/kernel/qapplication_s60.cpp b/src/gui/kernel/qapplication_s60.cpp
index 3ce597b..3d642d0 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 dd9bb49..b4c4163 100644
--- a/src/gui/kernel/qwidget_p.h
+++ b/src/gui/kernel/qwidget_p.h
@@ -322,6 +322,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 16f28c7..b031936 100644
--- a/src/gui/kernel/qwidget_s60.cpp
+++ b/src/gui/kernel/qwidget_s60.cpp
@@ -809,9 +809,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<RWindow *>(q->effectiveWinId()->DrawableWindow());
@@ -823,12 +828,11 @@ void QWidgetPrivate::s60UpdateIsOpaque()
return;
}
#endif
- if (!isOpaque) {
+ if (requireAlphaChannel) {
const TDisplayMode displayMode = static_cast<TDisplayMode>(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 71556d7..bb4c870 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 = new CFbsBitmap; // CBase derived object needs check on new
Q_CHECK_PTR(bitmap);
@@ -124,7 +131,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<QS60PixmapData *>(d_ptr->device.data_ptr().data());
TDisplayMode mode = displayMode(false);
@@ -133,12 +141,14 @@ void QS60WindowSurface::beginPaint(const QRegion &rgn)
pixmapData->beginDataAccess();
- QPainter p(&pixmapData->image);
- p.setCompositionMode(QPainter::CompositionMode_Source);
- const QVector<QRect> rects = rgn.rects();
- const QColor blank = Qt::transparent;
- for (QVector<QRect>::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<QRect> rects = rgn.rects();
+ const QColor blank = Qt::transparent;
+ for (QVector<QRect>::const_iterator it = rects.begin(); it != rects.end(); ++it) {
+ p.fillRect(*it, blank);
+ }
}
pixmapData->endDataAccess();
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 <Qt::HANDLE, QPixmap*> QMeeGoGraphicsSystem::liveTexturePixmaps;
QList<QMeeGoSwitchCallback> 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<QWidget *>(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<QWindowStateChangeEvent *>(event);
QWidget *widget = static_cast<QWidget *>(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<Qt::HANDLE, QPixmap*> liveTexturePixmaps;
static QList<QMeeGoSwitchCallback> 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/src/s60installs/s60installs.pro b/src/s60installs/s60installs.pro
index 1c91422..1b5a5ce 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 = \
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 <QPixmap>
#include <QImage>
+#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;