summaryrefslogtreecommitdiffstats
path: root/src/gui/kernel/qplatformintegration_qpa.cpp
diff options
context:
space:
mode:
authorSamuel Rødal <samuel.rodal@nokia.com>2011-07-21 13:50:28 +0200
committerJørgen Lind <jorgen.lind@nokia.com>2011-07-25 13:52:09 +0200
commitc3da77798b876716ce038a30e9aa8517ec158c47 (patch)
tree99ac6cf5ce37fcb626a12857bb18cf9b444b27f2 /src/gui/kernel/qplatformintegration_qpa.cpp
parente80b6619524a3720efb5fbe4c2307bec25a12ab8 (diff)
Added workable QScreen API on top of QPlatformScreen.
QPlatformIntegration::screens() no longer has to be implemented, implementations should call QPlatformIntegration::screenAdded() for each screen instead. This is for being able to support adding screens at run-time later on, by connecting it to a signal in QGuiApplication. The QGuiGLContext API has changed a bit, by not sending in all the parameters in the constructor but instead having a create() function. The createPlatformGLContext() factory in QPlatformIntegration takes a QGuiGLContext * instead of a QSurfaceFormat and a share context, similar to how the window and backing store factory functions work. The XCB plugin has experimental support for connecting to multiple X displays simultaneously, creating one or more QScreen for each. Change-Id: I248a22a4fd3481280710110272c04a30a8021e8f Reviewed-on: http://codereview.qt.nokia.com/2103 Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com> Reviewed-by: Jørgen Lind <jorgen.lind@nokia.com>
Diffstat (limited to 'src/gui/kernel/qplatformintegration_qpa.cpp')
-rw-r--r--src/gui/kernel/qplatformintegration_qpa.cpp59
1 files changed, 33 insertions, 26 deletions
diff --git a/src/gui/kernel/qplatformintegration_qpa.cpp b/src/gui/kernel/qplatformintegration_qpa.cpp
index ab0d5100c3..c190c4f481 100644
--- a/src/gui/kernel/qplatformintegration_qpa.cpp
+++ b/src/gui/kernel/qplatformintegration_qpa.cpp
@@ -44,21 +44,12 @@
#include <QtGui/QPlatformFontDatabase>
#include <QtGui/QPlatformClipboard>
#include <QtGui/QPlatformPrinterSupport>
+#include <QtGui/private/qguiapplication_p.h>
+#include <QtGui/private/qpixmap_raster_p.h>
#include <private/qdnd_p.h>
QT_BEGIN_NAMESPACE
-QPixmap QPlatformIntegration::grabWindow(WId window, int x, int y, int width, int height) const
-{
- Q_UNUSED(window);
- Q_UNUSED(x);
- Q_UNUSED(y);
- Q_UNUSED(width);
- Q_UNUSED(height);
- return QPixmap();
-}
-
-
/*!
Accessor for the platform integrations fontdatabase.
@@ -177,12 +168,6 @@ QPlatformNativeInterface * QPlatformIntegration::nativeInterface() const
*/
-QPlatformGLContext *QPlatformIntegration::createPlatformGLContext(const QSurfaceFormat &, QPlatformGLContext *) const
-{
- qWarning("This plugin does not support createPlatformGLContext!");
- return 0;
-}
-
/*!
\fn void QPlatformIntegration::moveToScreen(QWindow *window, int screen)
@@ -212,15 +197,6 @@ QPlatformGLContext *QPlatformIntegration::createPlatformGLContext(const QSurface
*/
/*!
- \fn QPixmap QPlatformIntegration::grabWindow(WId window, int x, int y, int width, int height) const
-
- This function is called when Qt needs to be able to grab the content of a window.
-
- Returnes the content of the window specified with the WId handle within the boundaries of
- QRect(x,y,width,height).
-*/
-
-/*!
\fn QAbstractEventDispatcher *createEventDispatcher() const
Factory function for the event dispatcher. The platform plugin
@@ -234,6 +210,17 @@ bool QPlatformIntegration::hasCapability(Capability cap) const
return false;
}
+QPlatformPixmap *QPlatformIntegration::createPlatformPixmap(QPlatformPixmap::PixelType type) const
+{
+ return new QRasterPlatformPixmap(type);
+}
+
+QPlatformGLContext *QPlatformIntegration::createPlatformGLContext(QGuiGLContext *context) const
+{
+ qWarning("This plugin does not support createPlatformGLContext!");
+ return 0;
+}
+
/*!
Returns the platform's printing support.
@@ -261,4 +248,24 @@ QPlatformInputContext *QPlatformIntegration::inputContext() const
return 0;
}
+/*!
+ Should be called by the implementation whenever a new screen is added.
+
+ The first screen added will be the primary screen, used for default-created
+ windows, GL contexts, and other resources unless otherwise specified.
+
+ This adds the screen to QGuiApplication::screens(), and emits the
+ QGuiApplication::screenAdded() signal.
+
+ The screen is automatically removed when the QPlatformScreen is destroyed.
+*/
+void QPlatformIntegration::screenAdded(QPlatformScreen *ps)
+{
+ QScreen *screen = ps ? ps->screen() : 0;
+ if (screen && !QGuiApplicationPrivate::screen_list.contains(screen)) {
+ QGuiApplicationPrivate::screen_list << screen;
+ emit qGuiApp->screenAdded(screen);
+ }
+}
+
QT_END_NAMESPACE