diff options
author | Jani Hautakangas <ext-jani.hautakangas@nokia.com> | 2010-05-28 14:30:26 (GMT) |
---|---|---|
committer | Jani Hautakangas <ext-jani.hautakangas@nokia.com> | 2010-05-28 14:33:20 (GMT) |
commit | b42315c1d7811a0997181e188fc39a368ac9175f (patch) | |
tree | c71f5ce19e50a2259075131584ca2961c82ee7c3 | |
parent | 22b583438b8ef83535b0b94b695aba22a09cea2b (diff) | |
download | Qt-b42315c1d7811a0997181e188fc39a368ac9175f.zip Qt-b42315c1d7811a0997181e188fc39a368ac9175f.tar.gz Qt-b42315c1d7811a0997181e188fc39a368ac9175f.tar.bz2 |
Add runtime_graphics_system flag to QApplicationPrivate.
This flag can be internally used to detect if
QRuntimeGraphicsSystem is used. In some cases Qt needs
to know if runtime graphics system is used and it's
better to have a flag than relsolving graphics system
name every time.
Reviewed-by: Jason Barron
-rw-r--r-- | src/gui/kernel/qapplication.cpp | 1 | ||||
-rw-r--r-- | src/gui/kernel/qapplication_p.h | 1 | ||||
-rw-r--r-- | src/gui/kernel/qapplication_s60.cpp | 7 | ||||
-rw-r--r-- | src/gui/painting/qgraphicssystem_runtime.cpp | 1 | ||||
-rw-r--r-- | src/gui/painting/qwindowsurface.cpp | 5 | ||||
-rw-r--r-- | src/gui/painting/qwindowsurface_s60.cpp | 2 |
6 files changed, 12 insertions, 5 deletions
diff --git a/src/gui/kernel/qapplication.cpp b/src/gui/kernel/qapplication.cpp index 3d4bf5d..a2c058a 100644 --- a/src/gui/kernel/qapplication.cpp +++ b/src/gui/kernel/qapplication.cpp @@ -446,6 +446,7 @@ QPalette *QApplicationPrivate::set_pal = 0; // default palette set by pro QGraphicsSystem *QApplicationPrivate::graphics_system = 0; // default graphics system QString QApplicationPrivate::graphics_system_name; // graphics system id - for delayed initialization +bool QApplicationPrivate::runtime_graphics_system = false; Q_GLOBAL_STATIC(QMutex, applicationFontMutex) QFont *QApplicationPrivate::app_font = 0; // default application font diff --git a/src/gui/kernel/qapplication_p.h b/src/gui/kernel/qapplication_p.h index e30b6be..e83cd71 100644 --- a/src/gui/kernel/qapplication_p.h +++ b/src/gui/kernel/qapplication_p.h @@ -412,6 +412,7 @@ public: static QPalette *set_pal; static QGraphicsSystem *graphics_system; static QString graphics_system_name; + static bool runtime_graphics_system; private: static QFont *app_font; // private for a reason! Always use QApplication::font() instead! diff --git a/src/gui/kernel/qapplication_s60.cpp b/src/gui/kernel/qapplication_s60.cpp index 7e270aa..8ab82c9 100644 --- a/src/gui/kernel/qapplication_s60.cpp +++ b/src/gui/kernel/qapplication_s60.cpp @@ -66,7 +66,6 @@ #include "private/qgraphicssystem_runtime_p.h" #endif - #include "apgwgnam.h" // For CApaWindowGroupName #include <mdaaudiotoneplayer.h> // For CMdaAudioToneUtility @@ -958,7 +957,7 @@ void QSymbianControl::Draw(const TRect& controlRect) const if (engine->type() == QPaintEngine::Raster) { QS60WindowSurface *s60Surface; #ifdef QT_GRAPHICSSYSTEM_RUNTIME - if (QApplicationPrivate::graphics_system_name == QLatin1String("runtime")) { + if (QApplicationPrivate::runtime_graphics_system) { QRuntimeWindowSurface *rtSurface = static_cast<QRuntimeWindowSurface*>(qwidget->windowSurface()); s60Surface = static_cast<QS60WindowSurface *>(rtSurface->m_windowSurface); @@ -1855,7 +1854,7 @@ int QApplicationPrivate::symbianProcessWsEvent(const QSymbianEvent *symbianEvent if (callSymbianEventFilters(symbianEvent)) return 1; #ifdef QT_GRAPHICSSYSTEM_RUNTIME - if(QApplicationPrivate::graphics_system_name == QLatin1String("runtime")) { + if(QApplicationPrivate::runtime_graphics_system) { bool switchToSwRendering(false); foreach (QWidget *w, QApplication::topLevelWidgets()) { @@ -1887,7 +1886,7 @@ int QApplicationPrivate::symbianProcessWsEvent(const QSymbianEvent *symbianEvent if (callSymbianEventFilters(symbianEvent)) return 1; #ifdef QT_GRAPHICSSYSTEM_RUNTIME - if(QApplicationPrivate::graphics_system_name == QLatin1String("runtime")) { + if(QApplicationPrivate::runtime_graphics_system) { QRuntimeGraphicsSystem *gs = static_cast<QRuntimeGraphicsSystem*>(QApplicationPrivate::graphics_system); gs->setGraphicsSystem(QLatin1String("openvg"), S60->memoryLimitForHwRendering); diff --git a/src/gui/painting/qgraphicssystem_runtime.cpp b/src/gui/painting/qgraphicssystem_runtime.cpp index 1c5d944..32a8578 100644 --- a/src/gui/painting/qgraphicssystem_runtime.cpp +++ b/src/gui/painting/qgraphicssystem_runtime.cpp @@ -344,6 +344,7 @@ QRuntimeGraphicsSystem::QRuntimeGraphicsSystem() m_graphicsSystem(0), m_graphicsSystemChangeMemoryLimit(0) { QApplicationPrivate::graphics_system_name = QLatin1String("runtime"); + QApplicationPrivate::runtime_graphics_system = true; #ifdef Q_OS_SYMBIAN m_graphicsSystemName = QLatin1String("openvg"); diff --git a/src/gui/painting/qwindowsurface.cpp b/src/gui/painting/qwindowsurface.cpp index 2fe9036..02a8b80 100644 --- a/src/gui/painting/qwindowsurface.cpp +++ b/src/gui/painting/qwindowsurface.cpp @@ -43,6 +43,7 @@ #include <qwidget.h> #include <private/qwidget_p.h> #include <private/qbackingstore_p.h> +#include <private/qapplication_p.h> QT_BEGIN_NAMESPACE @@ -116,6 +117,10 @@ public: QWindowSurface::QWindowSurface(QWidget *window) : d_ptr(new QWindowSurfacePrivate(window)) { + if (!QApplicationPrivate::runtime_graphics_system) { + if(window) + window->setWindowSurface(this); + } } /*! diff --git a/src/gui/painting/qwindowsurface_s60.cpp b/src/gui/painting/qwindowsurface_s60.cpp index 93d4d18..477bd93 100644 --- a/src/gui/painting/qwindowsurface_s60.cpp +++ b/src/gui/painting/qwindowsurface_s60.cpp @@ -88,7 +88,7 @@ QS60WindowSurface::QS60WindowSurface(QWidget* widget) QS60WindowSurface::~QS60WindowSurface() { #if defined(QT_GRAPHICSSYSTEM_RUNTIME) && defined(Q_SYMBIAN_SUPPORTS_SURFACES) - if(QApplicationPrivate::graphics_system_name == QLatin1String("runtime")) { + if(QApplicationPrivate::runtime_graphics_system) { QRuntimeGraphicsSystem *runtimeGraphicsSystem = static_cast<QRuntimeGraphicsSystem*>(QApplicationPrivate::graphics_system); if(runtimeGraphicsSystem->graphicsSystemName() == QLatin1String("openvg")) { |