summaryrefslogtreecommitdiffstats
path: root/src/plugins
diff options
context:
space:
mode:
authorAnders Bakken <anders.bakken@nokia.com>2009-08-31 19:21:03 (GMT)
committerAnders Bakken <anders.bakken@nokia.com>2009-08-31 19:27:55 (GMT)
commit9e652a18780aece1c5a8f12209747274a37bf91c (patch)
treee9732fa7bf6b09ec67c4d5e41209830acee81a15 /src/plugins
parenta2b2fbbbffa4fa04f47cd8b9e6265e2e61c5e5f3 (diff)
downloadQt-9e652a18780aece1c5a8f12209747274a37bf91c.zip
Qt-9e652a18780aece1c5a8f12209747274a37bf91c.tar.gz
Qt-9e652a18780aece1c5a8f12209747274a37bf91c.tar.bz2
Make cursor work in non-windowed mode
Reviewed-by: Donald Carr <donald.carr@nokia.com>
Diffstat (limited to 'src/plugins')
-rw-r--r--src/plugins/gfxdrivers/directfb/qdirectfbpaintdevice.h2
-rw-r--r--src/plugins/gfxdrivers/directfb/qdirectfbscreen.cpp34
-rw-r--r--src/plugins/gfxdrivers/directfb/qdirectfbscreen.h10
-rw-r--r--src/plugins/gfxdrivers/directfb/qdirectfbwindowsurface.cpp21
-rw-r--r--src/plugins/gfxdrivers/directfb/qdirectfbwindowsurface.h4
5 files changed, 41 insertions, 30 deletions
diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbpaintdevice.h b/src/plugins/gfxdrivers/directfb/qdirectfbpaintdevice.h
index aed1cb5..f5de44b 100644
--- a/src/plugins/gfxdrivers/directfb/qdirectfbpaintdevice.h
+++ b/src/plugins/gfxdrivers/directfb/qdirectfbpaintdevice.h
@@ -60,7 +60,7 @@ class QDirectFBPaintDevice : public QCustomRasterPaintDevice
public:
~QDirectFBPaintDevice();
- IDirectFBSurface *directFBSurface() const;
+ virtual IDirectFBSurface *directFBSurface() const;
void lockDirectFB(DFBSurfaceLockFlags lock);
void unlockDirectFB();
diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbscreen.cpp b/src/plugins/gfxdrivers/directfb/qdirectfbscreen.cpp
index 664c8a8..59fa191 100644
--- a/src/plugins/gfxdrivers/directfb/qdirectfbscreen.cpp
+++ b/src/plugins/gfxdrivers/directfb/qdirectfbscreen.cpp
@@ -496,14 +496,6 @@ void QDirectFBScreen::setSurfaceColorTable(IDirectFBSurface *surface,
#endif // QT_NO_DIRECTFB_PALETTE
-#ifndef QT_NO_QWS_CURSOR
-#if defined QT_DIRECTFB_WM && defined QT_DIRECTFB_WINDOW_AS_CURSOR
-#define QT_DIRECTFB_CURSOR
-#elif defined QT_DIRECTFB_LAYER
-#define QT_DIRECTFB_CURSOR
-#endif
-#endif
-
#if defined QT_DIRECTFB_CURSOR
class Q_GUI_EXPORT QDirectFBScreenCursor : public QScreenCursor
{
@@ -1279,12 +1271,10 @@ bool QDirectFBScreen::initDevice()
}
#endif
-#ifndef QT_NO_QWS_CURSOR
-#if defined QT_NO_DIRECTFB_WM || defined QT_NO_DIRECTFB_LAYER
- QScreenCursor::initSoftwareCursor();
-#else
+#ifdef QT_DIRECTFB_CURSOR
qt_screencursor = new QDirectFBScreenCursor;
-#endif
+#elif !defined QT_NO_QWS_CURSOR
+ QScreenCursor::initSoftwareCursor();
#endif
return true;
}
@@ -1344,17 +1334,18 @@ QWSWindowSurface *QDirectFBScreen::createSurface(const QString &key) const
// window surfaces. Normal, directFB surfaces are handled by DirectFB.
void QDirectFBScreen::exposeRegion(QRegion r, int changing)
{
-#ifdef QT_NO_DIRECTFB_WM
+#if defined QT_NO_DIRECTFB_WM
const QList<QWSWindow*> windows = QWSServer::instance()->clientWindows();
- if (changing < 0 || changing >= windows.size())
+ if (changing < 0 || changing >= windows.size()) {
return;
-
+ }
QWSWindow *win = windows.at(changing);
QWSWindowSurface *s = win->windowSurface();
r &= region();
- if (r.isEmpty())
+ if (r.isEmpty()) {
return;
+ }
const QRect brect = r.boundingRect();
@@ -1372,15 +1363,18 @@ void QDirectFBScreen::exposeRegion(QRegion r, int changing)
? static_cast<QDirectFBWindowSurface*>(s) : 0;
if (dfbWindowSurface) {
IDirectFBSurface *surface = dfbWindowSurface->directFBSurface();
+ Q_ASSERT(surface);
const int n = insideWindow.numRects();
if (n == 1 || d_ptr->directFBFlags & BoundingRectFlip) {
const QRect source = (insideWindow.boundingRect().intersected(windowGeometry)).translated(-windowGeometry.topLeft());
const DFBRectangle rect = {
source.x(), source.y(), source.width(), source.height()
};
+
d_ptr->primarySurface->Blit(d_ptr->primarySurface, surface, &rect,
windowGeometry.x() + source.x(),
windowGeometry.y() + source.y());
+
} else {
const QVector<QRect> rects = insideWindow.rects();
QVarLengthArray<DFBRectangle, 16> dfbRectangles(n);
@@ -1403,6 +1397,7 @@ void QDirectFBScreen::exposeRegion(QRegion r, int changing)
}
}
+#ifdef QT_NO_DIRECTFB_CURSOR
if (QScreenCursor *cursor = QScreenCursor::instance()) {
const QRect cursorRectangle = cursor->boundingRect();
if (cursor->isVisible() && !cursor->isAccelerated() && cursorRectangle.intersects(brect)) {
@@ -1416,6 +1411,7 @@ void QDirectFBScreen::exposeRegion(QRegion r, int changing)
#endif
}
}
+#endif
flipSurface(d_ptr->primarySurface, d_ptr->flipFlags, r, QPoint());
#else
Q_UNUSED(r);
@@ -1433,8 +1429,8 @@ void QDirectFBScreen::solidFill(const QColor &color, const QRegion &region)
return;
d_ptr->primarySurface->SetColor(d_ptr->primarySurface,
- color.red(), color.green(), color.blue(),
- color.alpha());
+ color.red(), color.green(), color.blue(),
+ color.alpha());
const int n = region.numRects();
if (n > 1) {
const QRect r = region.boundingRect();
diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbscreen.h b/src/plugins/gfxdrivers/directfb/qdirectfbscreen.h
index 14fde86..e74adb1 100644
--- a/src/plugins/gfxdrivers/directfb/qdirectfbscreen.h
+++ b/src/plugins/gfxdrivers/directfb/qdirectfbscreen.h
@@ -87,6 +87,16 @@ QT_MODULE(Gui)
#if !defined QT_NO_DIRECTFB_OPAQUE_DETECTION && !defined QT_DIRECTFB_OPAQUE_DETECTION
#define QT_DIRECTFB_OPAQUE_DETECTION
#endif
+#ifndef QT_NO_QWS_CURSOR
+#if defined QT_DIRECTFB_WM && defined QT_DIRECTFB_WINDOW_AS_CURSOR
+#define QT_DIRECTFB_CURSOR
+#elif defined QT_DIRECTFB_LAYER
+#define QT_DIRECTFB_CURSOR
+#endif
+#endif
+#ifndef QT_DIRECTFB_CURSOR
+#define QT_NO_DIRECTFB_CURSOR
+#endif
#if defined QT_NO_DIRECTFB_LAYER && defined QT_DIRECTFB_WM
#error QT_NO_DIRECTFB_LAYER requires QT_NO_DIRECTFB_WM
#endif
diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbwindowsurface.cpp b/src/plugins/gfxdrivers/directfb/qdirectfbwindowsurface.cpp
index 82c8a41..73a6dd7 100644
--- a/src/plugins/gfxdrivers/directfb/qdirectfbwindowsurface.cpp
+++ b/src/plugins/gfxdrivers/directfb/qdirectfbwindowsurface.cpp
@@ -54,9 +54,9 @@ QT_BEGIN_NAMESPACE
QDirectFBWindowSurface::QDirectFBWindowSurface(DFBSurfaceFlipFlags flip, QDirectFBScreen *scr)
: QDirectFBPaintDevice(scr)
+ , sibling(0)
#ifndef QT_NO_DIRECTFB_WM
, dfbWindow(0)
- , sibling(0)
#endif
, flipFlags(flip)
, boundingRectFlip(scr->directFBFlags() & QDirectFBScreen::BoundingRectFlip)
@@ -73,9 +73,9 @@ QDirectFBWindowSurface::QDirectFBWindowSurface(DFBSurfaceFlipFlags flip, QDirect
QDirectFBWindowSurface::QDirectFBWindowSurface(DFBSurfaceFlipFlags flip, QDirectFBScreen *scr, QWidget *widget)
: QWSWindowSurface(widget), QDirectFBPaintDevice(scr)
+ , sibling(0)
#ifndef QT_NO_DIRECTFB_WM
, dfbWindow(0)
- , sibling(0)
#endif
, flipFlags(flip)
, boundingRectFlip(scr->directFBFlags() & QDirectFBScreen::BoundingRectFlip)
@@ -247,23 +247,16 @@ void QDirectFBWindowSurface::setGeometry(const QRect &rect)
QByteArray QDirectFBWindowSurface::permanentState() const
{
-#ifdef QT_DIRECTFB_WM
QByteArray state(sizeof(this), 0);
*reinterpret_cast<const QDirectFBWindowSurface**>(state.data()) = this;
return state;
-#endif
- return QByteArray();
}
void QDirectFBWindowSurface::setPermanentState(const QByteArray &state)
{
-#ifdef QT_DIRECTFB_WM
if (state.size() == sizeof(this)) {
sibling = *reinterpret_cast<QDirectFBWindowSurface *const*>(state.constData());
}
-#else
- Q_UNUSED(state);
-#endif
}
static inline void scrollSurface(IDirectFBSurface *surface, const QRect &r, int dx, int dy)
@@ -385,6 +378,7 @@ void QDirectFBWindowSurface::flush(QWidget *, const QRegion &region,
}
}
+#ifdef QT_NO_DIRECTFB_CURSOR
if (QScreenCursor *cursor = QScreenCursor::instance()) {
const QRect cursorRectangle = cursor->boundingRect();
if (cursor->isVisible() && !cursor->isAccelerated()
@@ -400,6 +394,7 @@ void QDirectFBWindowSurface::flush(QWidget *, const QRegion &region,
#endif
}
}
+#endif
if (mode == Offscreen) {
screen->flipSurface(primarySurface, flipFlags, region, offset + windowGeometry.topLeft());
} else
@@ -428,6 +423,14 @@ void QDirectFBWindowSurface::endPaint(const QRegion &)
unlockDirectFB();
}
+IDirectFBSurface *QDirectFBWindowSurface::directFBSurface() const
+{
+ if (!dfbSurface && sibling && sibling->dfbSurface)
+ return sibling->dfbSurface;
+ return dfbSurface;
+}
+
+
IDirectFBSurface *QDirectFBWindowSurface::surfaceForWidget(const QWidget *widget, QRect *rect) const
{
Q_ASSERT(widget);
diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbwindowsurface.h b/src/plugins/gfxdrivers/directfb/qdirectfbwindowsurface.h
index bb81e1a..ca76613 100644
--- a/src/plugins/gfxdrivers/directfb/qdirectfbwindowsurface.h
+++ b/src/plugins/gfxdrivers/directfb/qdirectfbwindowsurface.h
@@ -92,12 +92,14 @@ public:
void endPaint(const QRegion &);
IDirectFBSurface *surfaceForWidget(const QWidget *widget, QRect *rect) const;
+ IDirectFBSurface *directFBSurface() const;
private:
void updateFormat();
+ QDirectFBWindowSurface *sibling;
+
#ifdef QT_DIRECTFB_WM
void createWindow();
IDirectFBWindow *dfbWindow;
- QDirectFBWindowSurface *sibling;
#else
enum Mode {
Primary,