summaryrefslogtreecommitdiffstats
path: root/src/plugins/graphicssystems
diff options
context:
space:
mode:
authorJeremy Katz <jeremy.katz@nokia.com>2009-12-30 14:21:30 (GMT)
committerJeremy Katz <jeremy.katz@nokia.com>2010-01-05 12:07:39 (GMT)
commite6c02f892651e69fc7f3a1991e115a7c315cc1de (patch)
tree6f3ff24e8943d59723e86ee4be6f302f5aa4e663 /src/plugins/graphicssystems
parent5e4b2e2591bb1b5897b29c43fa35b0a60fd43d56 (diff)
downloadQt-e6c02f892651e69fc7f3a1991e115a7c315cc1de.zip
Qt-e6c02f892651e69fc7f3a1991e115a7c315cc1de.tar.gz
Qt-e6c02f892651e69fc7f3a1991e115a7c315cc1de.tar.bz2
working on cursor changes - not at all functional currently
Diffstat (limited to 'src/plugins/graphicssystems')
-rw-r--r--src/plugins/graphicssystems/minimaldfb/minimaldfb.pro6
-rw-r--r--src/plugins/graphicssystems/minimaldfb/qdirectfbcursor.cpp73
-rw-r--r--src/plugins/graphicssystems/minimaldfb/qdirectfbcursor.h22
-rw-r--r--src/plugins/graphicssystems/minimaldfb/qgraphicssystem_minimaldfb.cpp4
-rw-r--r--src/plugins/graphicssystems/minimaldfb/qgraphicssystem_minimaldfb.h5
5 files changed, 108 insertions, 2 deletions
diff --git a/src/plugins/graphicssystems/minimaldfb/minimaldfb.pro b/src/plugins/graphicssystems/minimaldfb/minimaldfb.pro
index 6f50b4a..f5d2406 100644
--- a/src/plugins/graphicssystems/minimaldfb/minimaldfb.pro
+++ b/src/plugins/graphicssystems/minimaldfb/minimaldfb.pro
@@ -21,11 +21,13 @@ SOURCES = main.cpp \
qwindowsurface_minimaldfb.cpp \
qblitter_directfb.cpp \
qdirectfbconvenience.cpp \
- qdirectfbinput.cpp
+ qdirectfbinput.cpp \
+ qdirectfbcursor.cpp
HEADERS = qgraphicssystem_minimaldfb.h \
qwindowsurface_minimaldfb.h \
qblitter_directfb.h \
qdirectfbconvenience.h \
- qdirectfbinput.h
+ qdirectfbinput.h \
+ qdirectfbcursor.h
target.path += $$[QT_INSTALL_PLUGINS]/graphicssystems
INSTALLS += target
diff --git a/src/plugins/graphicssystems/minimaldfb/qdirectfbcursor.cpp b/src/plugins/graphicssystems/minimaldfb/qdirectfbcursor.cpp
new file mode 100644
index 0000000..9c6cc59
--- /dev/null
+++ b/src/plugins/graphicssystems/minimaldfb/qdirectfbcursor.cpp
@@ -0,0 +1,73 @@
+#include "qdirectfbcursor.h"
+#include "qblitter_directfb.h"
+#include "qgraphicssystem_minimaldfb.h"
+#include "qdirectfbconvenience.h"
+
+QDirectFBCursor::QDirectFBCursor(QGraphicsSystemScreen * screen) :
+ QGraphicsSystemCursor(screen), surface(0)
+{
+ QDirectFbGraphicsSystemScreen * s;
+ s = static_cast<QDirectFbGraphicsSystemScreen *>(screen);
+ m_layer = s->m_layer;
+ image = new QGraphicsSystemCursorImage(0, 0, 0, 0, 0, 0);
+}
+
+void QDirectFBCursor::changeCursor(QCursor * cursor, QWidget * widget)
+{
+ qDebug() << "cursor change request:" << cursor << widget;
+
+ if (cursor->shape() != Qt::BitmapCursor) {
+ image->set(cursor->shape());
+ } else {
+ qDebug() << "non-shape cursor: not implemented yet";
+ return; // not attempting to deal with application supplied cursors yet
+ }
+
+ // create a window to show the cursor for debugging purposes
+ static IDirectFBWindow * window = 0;
+ static IDirectFBSurface * windowSurface;
+ qDebug() << "window is" << window;
+ if (!window) {
+ qDebug() << "creating cursor preview window";
+ DFBWindowDescription description;
+ description.width = 32;
+ description.height = 32;
+ description.flags = DFBWindowDescriptionFlags(DSDESC_WIDTH | DSDESC_HEIGHT);
+ qDebug() << m_layer->CreateWindow(m_layer, &description,&window);
+ qDebug() << window->RaiseToTop(window);
+ qDebug() << window->MoveTo(window, 500, 500);
+ qDebug() << window->GetSurface(window, &windowSurface);
+ }
+
+ QImage *i = image->image();
+ QRect imageRect = i->rect();
+ QPixmap map = QPixmap::fromImage(*i);
+
+ if (surface)
+ surface->Release(surface);
+ DFBSurfaceDescription surfaceDesc;
+ surfaceDesc.width = map.width();
+ surfaceDesc.height = map.height();
+ surfaceDesc.flags = DFBSurfaceDescriptionFlags(DSDESC_WIDTH | DSDESC_HEIGHT);
+
+ IDirectFB *dfb = QDirectFbConvenience::dfbInterface();
+ QDirectFbConvenience::dfbInterface()->CreateSurface(QDirectFbConvenience::dfbInterface(), &surfaceDesc, &surface);
+
+ blitter = new QDirectFbBlitter(imageRect, windowSurface); // jeremy - should be surface
+ blitter->drawPixmap(imageRect, map, imageRect);
+
+
+ //
+ // blit to the window
+ //
+ //windowSurface->Blit(windowSurface, surface, NULL, 0, 0);
+
+ DFBResult res = m_layer->SetCursorShape( m_layer, surface, cursor->hotSpot().x(), cursor->hotSpot().y());
+ qDebug() << "setCursorShape result:";
+ switch(res) {
+ case DFB_OK: qDebug() << "OK"; break;
+ case DFB_INVARG: qDebug() << "DFB_INVARG"; break;
+ case DFB_ACCESSDENIED: qDebug() << "DFB_ACCESSDENIED"; break;
+ default: qDebug() << "unknown error" << res;
+ }
+}
diff --git a/src/plugins/graphicssystems/minimaldfb/qdirectfbcursor.h b/src/plugins/graphicssystems/minimaldfb/qdirectfbcursor.h
new file mode 100644
index 0000000..064a336
--- /dev/null
+++ b/src/plugins/graphicssystems/minimaldfb/qdirectfbcursor.h
@@ -0,0 +1,22 @@
+#ifndef QDIRECTFBCURSOR_H
+#define QDIRECTFBCURSOR_H
+
+#include <QGraphicsSystemCursor>
+#include <directfb.h>
+class QDirectFbGraphicsSystemScreen;
+class QDirectFbBlitter;
+
+class QDirectFBCursor : public QGraphicsSystemCursor
+{
+public:
+ QDirectFBCursor(QGraphicsSystemScreen *screem);
+ void changeCursor(QCursor * cursor, QWidget * widget);
+
+private:
+ IDirectFBDisplayLayer * m_layer;
+ IDirectFBSurface * surface;
+ QGraphicsSystemCursorImage * image;
+ QDirectFbBlitter *blitter;
+};
+
+#endif // QDIRECTFBCURSOR_H
diff --git a/src/plugins/graphicssystems/minimaldfb/qgraphicssystem_minimaldfb.cpp b/src/plugins/graphicssystems/minimaldfb/qgraphicssystem_minimaldfb.cpp
index 9e5e8bb..c767c7c 100644
--- a/src/plugins/graphicssystems/minimaldfb/qgraphicssystem_minimaldfb.cpp
+++ b/src/plugins/graphicssystems/minimaldfb/qgraphicssystem_minimaldfb.cpp
@@ -43,6 +43,7 @@
#include "qwindowsurface_minimaldfb.h"
#include "qblitter_directfb.h"
#include "qdirectfbconvenience.h"
+#include "qdirectfbcursor.h"
#include <private/qwindowsurface_raster_p.h>
#include <private/qpixmap_raster_p.h>
@@ -107,6 +108,9 @@ IDirectFBWindow *QDirectFbGraphicsSystemScreen::createWindow(const QRect &rect,
DFBWindowID id;
window->GetID(window, &id);
m_input.addWindow(id,tlw);
+
+ cursor = new QDirectFBCursor(this);
+
return window;
}
diff --git a/src/plugins/graphicssystems/minimaldfb/qgraphicssystem_minimaldfb.h b/src/plugins/graphicssystems/minimaldfb/qgraphicssystem_minimaldfb.h
index 2f29ab4..f6ce011 100644
--- a/src/plugins/graphicssystems/minimaldfb/qgraphicssystem_minimaldfb.h
+++ b/src/plugins/graphicssystems/minimaldfb/qgraphicssystem_minimaldfb.h
@@ -50,6 +50,8 @@
QT_BEGIN_NAMESPACE
+class QDirectFBCursor;
+
class QDirectFbGraphicsSystemScreen : public QGraphicsSystemScreen
{
public:
@@ -73,6 +75,9 @@ public:
IDirectFBDisplayLayer *m_layer;
+private:
+ QDirectFBCursor * cursor;
+
};
class QDirectFbGraphicsSystem : public QGraphicsSystem