summaryrefslogtreecommitdiffstats
path: root/tools
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 /tools
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 'tools')
-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
4 files changed, 39 insertions, 1 deletions
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;