summaryrefslogtreecommitdiffstats
path: root/src/plugins/gfxdrivers/directfb/qdirectfbwindowsurface.cpp
diff options
context:
space:
mode:
authorKent Hansen <khansen@trolltech.com>2009-08-19 07:24:09 (GMT)
committerKent Hansen <khansen@trolltech.com>2009-08-19 07:24:09 (GMT)
commit52e14a2d02d1d664bd8b981d261db0a62592efb8 (patch)
treed315c6f53081a41bee4ccba540204eaeef66bb99 /src/plugins/gfxdrivers/directfb/qdirectfbwindowsurface.cpp
parent12bdeb146a479b008d9f65c022bb22a15989e558 (diff)
parent5fb5c01bd0ac234eaca890d97053c7b0772861a3 (diff)
downloadQt-52e14a2d02d1d664bd8b981d261db0a62592efb8.zip
Qt-52e14a2d02d1d664bd8b981d261db0a62592efb8.tar.gz
Qt-52e14a2d02d1d664bd8b981d261db0a62592efb8.tar.bz2
Merge branch 'master' of git@scm.dev.nokia.troll.no:qt/qt into qtscript-jsc-backend
Diffstat (limited to 'src/plugins/gfxdrivers/directfb/qdirectfbwindowsurface.cpp')
-rw-r--r--src/plugins/gfxdrivers/directfb/qdirectfbwindowsurface.cpp51
1 files changed, 28 insertions, 23 deletions
diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbwindowsurface.cpp b/src/plugins/gfxdrivers/directfb/qdirectfbwindowsurface.cpp
index 584f334..441bac9 100644
--- a/src/plugins/gfxdrivers/directfb/qdirectfbwindowsurface.cpp
+++ b/src/plugins/gfxdrivers/directfb/qdirectfbwindowsurface.cpp
@@ -54,6 +54,7 @@ QDirectFBWindowSurface::QDirectFBWindowSurface(DFBSurfaceFlipFlags flip, QDirect
: QDirectFBPaintDevice(scr)
#ifndef QT_NO_DIRECTFB_WM
, dfbWindow(0)
+ , sibling(0)
#endif
, flipFlags(flip)
, boundingRectFlip(scr->directFBFlags() & QDirectFBScreen::BoundingRectFlip)
@@ -72,6 +73,7 @@ QDirectFBWindowSurface::QDirectFBWindowSurface(DFBSurfaceFlipFlags flip, QDirect
: QWSWindowSurface(widget), QDirectFBPaintDevice(scr)
#ifndef QT_NO_DIRECTFB_WM
, dfbWindow(0)
+ , sibling(0)
#endif
, flipFlags(flip)
, boundingRectFlip(scr->directFBFlags() & QDirectFBScreen::BoundingRectFlip)
@@ -98,6 +100,17 @@ QDirectFBWindowSurface::~QDirectFBWindowSurface()
{
}
+#ifdef QT_DIRECTFB_WM
+void QDirectFBWindowSurface::raise()
+{
+ if (dfbWindow) {
+ dfbWindow->RaiseToTop(dfbWindow);
+ } else if (sibling && (!sibling->sibling || sibling->dfbWindow)) {
+ sibling->raise();
+ }
+}
+#endif
+
bool QDirectFBWindowSurface::isValid() const
{
return true;
@@ -126,6 +139,7 @@ void QDirectFBWindowSurface::createWindow()
description.surface_caps = DSCAPS_PREMULTIPLIED;
DFBResult result = layer->CreateWindow(layer, &description, &dfbWindow);
+
if (result != DFB_OK)
DirectFBErrorFatal("QDirectFBWindowSurface::createWindow", result);
@@ -231,34 +245,25 @@ void QDirectFBWindowSurface::setGeometry(const QRect &rect)
QByteArray QDirectFBWindowSurface::permanentState() const
{
- QByteArray array;
-#ifdef QT_NO_DIRECTFB_WM
- array.resize(sizeof(SurfaceFlags) + sizeof(IDirectFBSurface*));
-#else
- array.resize(sizeof(SurfaceFlags));
-#endif
- char *ptr = array.data();
-
- *reinterpret_cast<SurfaceFlags*>(ptr) = surfaceFlags();
- ptr += sizeof(SurfaceFlags);
-
-#ifdef QT_NO_DIRECTFB_WM
- *reinterpret_cast<IDirectFBSurface**>(ptr) = dfbSurface;
+ QByteArray state;
+#ifdef QT_DIRECTFB_WM
+ QDataStream ds(&state, QIODevice::WriteOnly);
+ ds << reinterpret_cast<quintptr>(this);
#endif
- return array;
+ return state;
}
void QDirectFBWindowSurface::setPermanentState(const QByteArray &state)
{
- SurfaceFlags flags;
- const char *ptr = state.constData();
-
- flags = *reinterpret_cast<const SurfaceFlags*>(ptr);
- setSurfaceFlags(flags);
-
-#ifdef QT_NO_DIRECTFB_WM
- ptr += sizeof(SurfaceFlags);
- dfbSurface = *reinterpret_cast<IDirectFBSurface* const*>(ptr);
+#ifdef QT_DIRECTFB_WM
+ if (state.size() == sizeof(quintptr)) {
+ QDataStream ds(state);
+ quintptr ptr;
+ ds >> ptr;
+ sibling = reinterpret_cast<QDirectFBWindowSurface*>(ptr);
+ }
+#else
+ Q_UNUSED(state);
#endif
}