summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorQt Continuous Integration System <qt-info@nokia.com>2011-03-18 18:59:17 (GMT)
committerQt Continuous Integration System <qt-info@nokia.com>2011-03-18 18:59:17 (GMT)
commit9e937ab81ca069d18d04b3192bc48b22a8cc5308 (patch)
tree23abb182a8d02ea3451df464fda879b7f0d226df /src
parent8ec9e1c261a9992a8df0a0e2ec04ecf4c22575af (diff)
parentc2317645b94f9a3004d76dda558c4a2b853a1489 (diff)
downloadQt-9e937ab81ca069d18d04b3192bc48b22a8cc5308.zip
Qt-9e937ab81ca069d18d04b3192bc48b22a8cc5308.tar.gz
Qt-9e937ab81ca069d18d04b3192bc48b22a8cc5308.tar.bz2
Merge branch '4.7' of scm.dev.nokia.troll.no:qt/oslo-staging-2 into 4.7-integration
* '4.7' of scm.dev.nokia.troll.no:qt/oslo-staging-2: Added setSwitchPolicy to MeeGo graphicssystem helper API.
Diffstat (limited to 'src')
-rw-r--r--src/plugins/graphicssystems/meego/qmeegographicssystem.cpp19
-rw-r--r--src/plugins/graphicssystems/meego/qmeegographicssystem.h6
2 files changed, 19 insertions, 6 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 <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