summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGunnar Sletta <gunnar.sletta@nokia.com>2011-02-21 12:57:34 +0100
committerJørgen Lind <jorgen.lind@nokia.com>2011-03-01 12:06:05 +0100
commit327f4c8e3894ccf34e7629a8a840f92bd3ff8dd0 (patch)
treeddf41680fe506b07338797486e5412fe70e614c4 /src
parentb67d537070e88feb708d13b46cd1468e2c0dc0e8 (diff)
downloadqt4-tools-327f4c8e3894ccf34e7629a8a840f92bd3ff8dd0.tar.gz
added capabilites to QPlatformIntegration
Reviewed-by: Jørgen Lind
Diffstat (limited to 'src')
-rw-r--r--src/gui/image/qpixmap.cpp9
-rw-r--r--src/gui/kernel/qplatformintegration_qpa.cpp10
-rw-r--r--src/gui/kernel/qplatformintegration_qpa.h6
-rw-r--r--src/plugins/platforms/cocoa/qcocoaintegration.h1
-rw-r--r--src/plugins/platforms/cocoa/qcocoaintegration.mm12
-rw-r--r--src/plugins/platforms/eglfs/qeglfsintegration.cpp8
-rw-r--r--src/plugins/platforms/eglfs/qeglfsintegration.h1
-rw-r--r--src/plugins/platforms/linuxfb/qlinuxfbintegration.cpp9
-rw-r--r--src/plugins/platforms/linuxfb/qlinuxfbintegration.h2
-rw-r--r--src/plugins/platforms/minimal/qminimalintegration.cpp8
-rw-r--r--src/plugins/platforms/minimal/qminimalintegration.h2
-rw-r--r--src/plugins/platforms/openkode/qopenkodeintegration.cpp9
-rw-r--r--src/plugins/platforms/openkode/qopenkodeintegration.h2
-rw-r--r--src/plugins/platforms/vnc/qvncintegration.cpp9
-rw-r--r--src/plugins/platforms/vnc/qvncintegration.h1
-rw-r--r--src/plugins/platforms/wayland/qwaylandintegration.cpp10
-rw-r--r--src/plugins/platforms/wayland/qwaylandintegration.h1
17 files changed, 97 insertions, 3 deletions
diff --git a/src/gui/image/qpixmap.cpp b/src/gui/image/qpixmap.cpp
index b276180a57..90d9a90b1b 100644
--- a/src/gui/image/qpixmap.cpp
+++ b/src/gui/image/qpixmap.cpp
@@ -71,6 +71,10 @@
# include "private/qpixmap_mac_p.h"
#endif
+#ifdef Q_WS_QPA
+# include "qplatformintegration_qpa.h"
+#endif
+
#if defined(Q_WS_X11)
# include "qx11info_x11.h"
# include <private/qt_x11_p.h>
@@ -104,6 +108,11 @@ static bool qt_pixmap_thread_test()
#if defined (Q_WS_X11)
if (!QApplication::testAttribute(Qt::AA_X11InitThreads))
fail = true;
+#elif defined (Q_WS_QPA)
+ if (!QApplicationPrivate::platformIntegration()->hasCapability(QPlatformIntegration::ThreadedPixmaps)) {
+ printf("Lighthouse plugin does not support threaded pixmaps!\n");
+ fail = true;
+ }
#else
if (QApplicationPrivate::graphics_system_name != QLatin1String("raster"))
fail = true;
diff --git a/src/gui/kernel/qplatformintegration_qpa.cpp b/src/gui/kernel/qplatformintegration_qpa.cpp
index 9f62538c7c..f43e141a16 100644
--- a/src/gui/kernel/qplatformintegration_qpa.cpp
+++ b/src/gui/kernel/qplatformintegration_qpa.cpp
@@ -216,4 +216,14 @@ QPlatformNativeInterface * QPlatformIntegration::nativeInterface() const
QRect(x,y,width,height).
*/
+
+bool QPlatformIntegration::hasCapability(Capability cap) const
+{
+ return false;
+}
+
+
+
+
+
QT_END_NAMESPACE
diff --git a/src/gui/kernel/qplatformintegration_qpa.h b/src/gui/kernel/qplatformintegration_qpa.h
index f01d462566..1d69af4922 100644
--- a/src/gui/kernel/qplatformintegration_qpa.h
+++ b/src/gui/kernel/qplatformintegration_qpa.h
@@ -65,8 +65,14 @@ class QPlatformNativeInterface;
class Q_GUI_EXPORT QPlatformIntegration
{
public:
+ enum Capability {
+ ThreadedPixmaps = 1,
+ };
+
virtual ~QPlatformIntegration() { }
+ virtual bool hasCapability(Capability cap) const;
+
// GraphicsSystem functions
virtual QPixmapData *createPixmapData(QPixmapData::PixelType type) const = 0;
virtual QPlatformWindow *createPlatformWindow(QWidget *widget, WId winId = 0) const = 0;
diff --git a/src/plugins/platforms/cocoa/qcocoaintegration.h b/src/plugins/platforms/cocoa/qcocoaintegration.h
index e7ecf2a65b..b94bcb972b 100644
--- a/src/plugins/platforms/cocoa/qcocoaintegration.h
+++ b/src/plugins/platforms/cocoa/qcocoaintegration.h
@@ -75,6 +75,7 @@ public:
QCocoaIntegration();
~QCocoaIntegration();
+ bool hasCapability(QPlatformIntegration::Capability cap) const;
QPixmapData *createPixmapData(QPixmapData::PixelType type) const;
QPlatformWindow *createPlatformWindow(QWidget *widget, WId winId = 0) const;
QWindowSurface *createWindowSurface(QWidget *widget, WId winId) const;
diff --git a/src/plugins/platforms/cocoa/qcocoaintegration.mm b/src/plugins/platforms/cocoa/qcocoaintegration.mm
index 28e894c56b..a75b88c844 100644
--- a/src/plugins/platforms/cocoa/qcocoaintegration.mm
+++ b/src/plugins/platforms/cocoa/qcocoaintegration.mm
@@ -94,9 +94,19 @@ QCocoaIntegration::~QCocoaIntegration()
delete mPool;
}
+bool QCocoaIntegration::hasCapability(QPlatformIntegration::Capability cap) const
+{
+ switch (cap) {
+ case ThreadedPixmaps: return true;
+ default: return QPlatformIntegration::hasCapability(cap);
+ }
+}
+
+
+
QPixmapData *QCocoaIntegration::createPixmapData(QPixmapData::PixelType type) const
{
- return new QRasterPixmapData(type);
+ return new QRasterPixmapData(type);
}
QPlatformWindow *QCocoaIntegration::createPlatformWindow(QWidget *widget, WId winId) const
diff --git a/src/plugins/platforms/eglfs/qeglfsintegration.cpp b/src/plugins/platforms/eglfs/qeglfsintegration.cpp
index a48fde8681..257490d13e 100644
--- a/src/plugins/platforms/eglfs/qeglfsintegration.cpp
+++ b/src/plugins/platforms/eglfs/qeglfsintegration.cpp
@@ -65,6 +65,14 @@ QEglFSIntegration::QEglFSIntegration()
#endif
}
+bool QEglFSIntegration::hasCapability(QPlatformIntegration::Capability cap) const
+{
+ switch (cap) {
+ case ThreadedPixmaps: return true;
+ default: return QPlatformIntegration::hasCapability(cap);
+ }
+}
+
QPixmapData *QEglFSIntegration::createPixmapData(QPixmapData::PixelType type) const
{
#ifdef QEGL_EXTRA_DEBUG
diff --git a/src/plugins/platforms/eglfs/qeglfsintegration.h b/src/plugins/platforms/eglfs/qeglfsintegration.h
index 0342539bb5..ce231f2e55 100644
--- a/src/plugins/platforms/eglfs/qeglfsintegration.h
+++ b/src/plugins/platforms/eglfs/qeglfsintegration.h
@@ -56,6 +56,7 @@ class QEglFSIntegration : public QPlatformIntegration
public:
QEglFSIntegration();
+ bool hasCapability(QPlatformIntegration::Capability cap) const;
QPixmapData *createPixmapData(QPixmapData::PixelType type) const;
QPlatformWindow *createPlatformWindow(QWidget *widget, WId winId) const;
QWindowSurface *createWindowSurface(QWidget *widget, WId winId) const;
diff --git a/src/plugins/platforms/linuxfb/qlinuxfbintegration.cpp b/src/plugins/platforms/linuxfb/qlinuxfbintegration.cpp
index aa1d4019a5..af5a3371fb 100644
--- a/src/plugins/platforms/linuxfb/qlinuxfbintegration.cpp
+++ b/src/plugins/platforms/linuxfb/qlinuxfbintegration.cpp
@@ -782,6 +782,15 @@ void QLinuxFbIntegration::blank(bool on)
d_ptr->blank = on;
}
+bool QLinuxFbIntegration::hasCapability(QPlatformIntegration::Capability cap) const
+{
+ switch (cap) {
+ case ThreadedPixmaps: return true;
+ default: return QPlatformIntegration::hasCapability(cap);
+ }
+}
+
+
QPixmapData *QLinuxFbIntegration::createPixmapData(QPixmapData::PixelType type) const
{
return new QRasterPixmapData(type);
diff --git a/src/plugins/platforms/linuxfb/qlinuxfbintegration.h b/src/plugins/platforms/linuxfb/qlinuxfbintegration.h
index e93495c09b..ddf8873ba6 100644
--- a/src/plugins/platforms/linuxfb/qlinuxfbintegration.h
+++ b/src/plugins/platforms/linuxfb/qlinuxfbintegration.h
@@ -77,6 +77,8 @@ public:
QLinuxFbIntegration();
~QLinuxFbIntegration();
+ bool hasCapability(QPlatformIntegration::Capability cap) const;
+
QPixmapData *createPixmapData(QPixmapData::PixelType type) const;
QPlatformWindow *createPlatformWindow(QWidget *widget, WId WinId) const;
QWindowSurface *createWindowSurface(QWidget *widget, WId WinId) const;
diff --git a/src/plugins/platforms/minimal/qminimalintegration.cpp b/src/plugins/platforms/minimal/qminimalintegration.cpp
index c90e92ed87..0f11edd5e0 100644
--- a/src/plugins/platforms/minimal/qminimalintegration.cpp
+++ b/src/plugins/platforms/minimal/qminimalintegration.cpp
@@ -56,6 +56,14 @@ QMinimalIntegration::QMinimalIntegration()
mScreens.append(mPrimaryScreen);
}
+bool QMinimalIntegration::hasCapability(QPlatformIntegration::Capability cap) const
+{
+ switch (cap) {
+ case ThreadedPixmaps: return true;
+ default: return QPlatformIntegration::hasCapability(cap);
+ }
+}
+
QPixmapData *QMinimalIntegration::createPixmapData(QPixmapData::PixelType type) const
{
return new QRasterPixmapData(type);
diff --git a/src/plugins/platforms/minimal/qminimalintegration.h b/src/plugins/platforms/minimal/qminimalintegration.h
index 95b952ea9f..aab6fe399a 100644
--- a/src/plugins/platforms/minimal/qminimalintegration.h
+++ b/src/plugins/platforms/minimal/qminimalintegration.h
@@ -69,6 +69,8 @@ class QMinimalIntegration : public QPlatformIntegration
public:
QMinimalIntegration();
+ bool hasCapability(QPlatformIntegration::Capability cap) const;
+
QPixmapData *createPixmapData(QPixmapData::PixelType type) const;
QPlatformWindow *createPlatformWindow(QWidget *widget, WId winId) const;
QWindowSurface *createWindowSurface(QWidget *widget, WId winId) const;
diff --git a/src/plugins/platforms/openkode/qopenkodeintegration.cpp b/src/plugins/platforms/openkode/qopenkodeintegration.cpp
index 763e69ef42..2d17f335da 100644
--- a/src/plugins/platforms/openkode/qopenkodeintegration.cpp
+++ b/src/plugins/platforms/openkode/qopenkodeintegration.cpp
@@ -185,6 +185,15 @@ QOpenKODEIntegration::~QOpenKODEIntegration()
delete mFontDb;
}
+
+bool QOpenKODEIntegration::hasCapability(QPlatformIntegration::Capability cap) const
+{
+ switch (cap) {
+ case ThreadedPixmaps: return true;
+ default: return QPlatformIntegration::hasCapability(cap);
+ }
+}
+
QPixmapData *QOpenKODEIntegration::createPixmapData(QPixmapData::PixelType type) const
{
return new QGLPixmapData(type);
diff --git a/src/plugins/platforms/openkode/qopenkodeintegration.h b/src/plugins/platforms/openkode/qopenkodeintegration.h
index a067491c0b..2304f275a7 100644
--- a/src/plugins/platforms/openkode/qopenkodeintegration.h
+++ b/src/plugins/platforms/openkode/qopenkodeintegration.h
@@ -90,6 +90,8 @@ public:
QOpenKODEIntegration();
~QOpenKODEIntegration();
+ bool hasCapability(QPlatformIntegration::Capability cap) const;
+
QPixmapData *createPixmapData(QPixmapData::PixelType type) const;
QPlatformWindow *createPlatformWindow(QWidget *widget, WId winId = 0) const;
QWindowSurface *createWindowSurface(QWidget *widget, WId winId) const;
diff --git a/src/plugins/platforms/vnc/qvncintegration.cpp b/src/plugins/platforms/vnc/qvncintegration.cpp
index b36ff333c5..56cbe4b7d1 100644
--- a/src/plugins/platforms/vnc/qvncintegration.cpp
+++ b/src/plugins/platforms/vnc/qvncintegration.cpp
@@ -152,6 +152,15 @@ QVNCIntegration::QVNCIntegration(const QStringList& paramList)
screen->setDirty(screenRect);
}
+bool QVNCIntegration::hasCapability(QPlatformIntegration::Capability cap) const
+{
+ switch (cap) {
+ case ThreadedPixmaps: return true;
+ default: return QPlatformIntegration::hasCapability(cap);
+ }
+}
+
+
QPixmapData *QVNCIntegration::createPixmapData(QPixmapData::PixelType type) const
{
return new QRasterPixmapData(type);
diff --git a/src/plugins/platforms/vnc/qvncintegration.h b/src/plugins/platforms/vnc/qvncintegration.h
index dfc0e6bde9..80338a1b79 100644
--- a/src/plugins/platforms/vnc/qvncintegration.h
+++ b/src/plugins/platforms/vnc/qvncintegration.h
@@ -81,6 +81,7 @@ class QVNCIntegration : public QPlatformIntegration
public:
QVNCIntegration(const QStringList& paramList);
+ bool hasCapability(QPlatformIntegration::Capability cap) const;
QPixmapData *createPixmapData(QPixmapData::PixelType type) const;
QPlatformWindow *createPlatformWindow(QWidget *widget, WId winId) const;
QWindowSurface *createWindowSurface(QWidget *widget, WId winId) const;
diff --git a/src/plugins/platforms/wayland/qwaylandintegration.cpp b/src/plugins/platforms/wayland/qwaylandintegration.cpp
index 7c0f69eb0f..33834101d8 100644
--- a/src/plugins/platforms/wayland/qwaylandintegration.cpp
+++ b/src/plugins/platforms/wayland/qwaylandintegration.cpp
@@ -71,6 +71,14 @@ QWaylandIntegration::screens() const
return mDisplay->screens();
}
+bool QWaylandIntegration::hasCapability(QPlatformIntegration::Capability cap) const
+{
+ switch (cap) {
+ case ThreadedPixmaps: return true;
+ default: return QPlatformIntegration::hasCapability(cap);
+ }
+}
+
QPixmapData *QWaylandIntegration::createPixmapData(QPixmapData::PixelType type) const
{
#ifdef QT_WAYLAND_GL_SUPPORT
@@ -80,8 +88,6 @@ QPixmapData *QWaylandIntegration::createPixmapData(QPixmapData::PixelType type)
return new QRasterPixmapData(type);
}
-
-
QPlatformWindow *QWaylandIntegration::createPlatformWindow(QWidget *widget, WId winId) const
{
Q_UNUSED(winId);
diff --git a/src/plugins/platforms/wayland/qwaylandintegration.h b/src/plugins/platforms/wayland/qwaylandintegration.h
index d70761229d..c3919ab2ec 100644
--- a/src/plugins/platforms/wayland/qwaylandintegration.h
+++ b/src/plugins/platforms/wayland/qwaylandintegration.h
@@ -54,6 +54,7 @@ class QWaylandIntegration : public QPlatformIntegration
public:
QWaylandIntegration(bool useOpenGL = false);
+ bool hasCapability(QPlatformIntegration::Capability cap) const;
QPixmapData *createPixmapData(QPixmapData::PixelType type) const;
QPlatformWindow *createPlatformWindow(QWidget *widget, WId winId) const;
QWindowSurface *createWindowSurface(QWidget *widget, WId winId) const;