summaryrefslogtreecommitdiffstats
path: root/src/plugins/gfxdrivers
diff options
context:
space:
mode:
authorAnders Bakken <anders.bakken@nokia.com>2009-10-15 15:15:34 (GMT)
committerAnders Bakken <anders.bakken@nokia.com>2009-10-15 15:23:17 (GMT)
commit739a36b3e86d6c112bc1720ec92a61433c48ee80 (patch)
tree4878757493a17904390a8519a2c5c0b4f7af8121 /src/plugins/gfxdrivers
parent8d1d511a51aa26b4d86f4cc83e1eed194441469f (diff)
downloadQt-739a36b3e86d6c112bc1720ec92a61433c48ee80.zip
Qt-739a36b3e86d6c112bc1720ec92a61433c48ee80.tar.gz
Qt-739a36b3e86d6c112bc1720ec92a61433c48ee80.tar.bz2
Fix a problem with QDirectFBScreen::instance
If using a proxy screen QScreen::instance() will not return a QDirectFBScreen but rather a QProxyScreen. This patch lets QDirectFBScreen::instance hold its own pointer. Reviewed-by: Jervey Kong <jervey.kong@nokia.com>
Diffstat (limited to 'src/plugins/gfxdrivers')
-rw-r--r--src/plugins/gfxdrivers/directfb/qdirectfbscreen.cpp11
-rw-r--r--src/plugins/gfxdrivers/directfb/qdirectfbscreen.h7
2 files changed, 12 insertions, 6 deletions
diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbscreen.cpp b/src/plugins/gfxdrivers/directfb/qdirectfbscreen.cpp
index 0f7a6de..00eeebd 100644
--- a/src/plugins/gfxdrivers/directfb/qdirectfbscreen.cpp
+++ b/src/plugins/gfxdrivers/directfb/qdirectfbscreen.cpp
@@ -99,8 +99,11 @@ public:
qint64 cursorImageKey;
QDirectFBScreen *q;
+ static QDirectFBScreen *instance;
};
+QDirectFBScreen *QDirectFBScreenPrivate::instance = 0;
+
QDirectFBScreenPrivate::QDirectFBScreenPrivate(QDirectFBScreen *qptr)
: QWSGraphicsSystem(qptr), dfb(0), flipFlags(DSFLIP_NONE),
directFBFlags(QDirectFBScreen::NoFlags), alphaPixmapFormat(QImage::Format_Invalid),
@@ -802,13 +805,21 @@ void QDirectFBScreenCursor::set(const QImage &image, int hotx, int hoty)
QDirectFBScreen::QDirectFBScreen(int display_id)
: QScreen(display_id, DirectFBClass), d_ptr(new QDirectFBScreenPrivate(this))
{
+ QDirectFBScreenPrivate::instance = this;
}
QDirectFBScreen::~QDirectFBScreen()
{
+ if (QDirectFBScreenPrivate::instance == this)
+ QDirectFBScreenPrivate::instance = 0;
delete d_ptr;
}
+QDirectFBScreen *QDirectFBScreen::instance()
+{
+ return QDirectFBScreenPrivate::instance;
+}
+
int QDirectFBScreen::depth(DFBSurfacePixelFormat format)
{
switch (format) {
diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbscreen.h b/src/plugins/gfxdrivers/directfb/qdirectfbscreen.h
index 5e8c5c6..437f1ae 100644
--- a/src/plugins/gfxdrivers/directfb/qdirectfbscreen.h
+++ b/src/plugins/gfxdrivers/directfb/qdirectfbscreen.h
@@ -163,12 +163,7 @@ public:
QWSWindowSurface *createSurface(QWidget *widget) const;
QWSWindowSurface *createSurface(const QString &key) const;
- static inline QDirectFBScreen *instance() {
- QScreen *inst = QScreen::instance();
- Q_ASSERT(!inst || inst->classId() == QScreen::DirectFBClass);
- return static_cast<QDirectFBScreen*>(inst);
- }
-
+ static QDirectFBScreen *instance();
void waitIdle();
IDirectFBSurface *surfaceForWidget(const QWidget *widget, QRect *rect) const;
#ifdef QT_DIRECTFB_SUBSURFACE