summaryrefslogtreecommitdiffstats
path: root/src/plugins/platforms/eglfs/qeglfscursor.h
diff options
context:
space:
mode:
authorGirish Ramakrishnan <girish.1.ramakrishnan@nokia.com>2012-05-26 11:52:06 -0700
committerQt by Nokia <qt-info@nokia.com>2012-06-01 15:22:49 +0200
commit5933205cfcd73481cb0645fa6183103063fe3e0d (patch)
tree708107118253121ed325557abc93c893f0f144ca /src/plugins/platforms/eglfs/qeglfscursor.h
parentbae1613c4c3d8c38b90ed2ba5c1b149e1bc87987 (diff)
eglfs: implement hardware cursor for the raspberry-pi
The cursor is rendered on a dispmanx layer and moved around. This approach saves us from having to update the underlying window each time the cursor moves. Dispmanx layers cannot be moved to negative coords. As a result, currently it is not possible to move to a location less than the hostpot. A future commit will fix this problem. Change-Id: Ida5ee961d03a6929860c515e503482756a4913ed Reviewed-by: Johannes Zellner <johannes.zellner@nokia.com> Reviewed-by: Andy Nichols <andy.nichols@nokia.com> Reviewed-by: Samuel Rødal <samuel.rodal@nokia.com>
Diffstat (limited to 'src/plugins/platforms/eglfs/qeglfscursor.h')
-rw-r--r--src/plugins/platforms/eglfs/qeglfscursor.h40
1 files changed, 23 insertions, 17 deletions
diff --git a/src/plugins/platforms/eglfs/qeglfscursor.h b/src/plugins/platforms/eglfs/qeglfscursor.h
index c8c4a8307c..464b52e195 100644
--- a/src/plugins/platforms/eglfs/qeglfscursor.h
+++ b/src/plugins/platforms/eglfs/qeglfscursor.h
@@ -49,6 +49,7 @@
QT_BEGIN_NAMESPACE
class QOpenGLShaderProgram;
+class QEglFSScreen;
class QEglFSCursor : public QPlatformCursor
{
@@ -64,15 +65,34 @@ public:
QRect cursorRect() const;
- void render();
+ virtual void paintOnScreen();
+
+protected:
+ bool setCurrentCursor(QCursor *cursor);
+ void draw(const QRectF &rect);
+ void update(const QRegion &region);
+
+ QEglFSScreen *m_screen;
+
+ // current cursor information
+ struct Cursor {
+ Cursor() : texture(0), shape(Qt::BlankCursor), customCursorTexture(0) { }
+ uint texture; // a texture from 'image' or the atlas
+ Qt::CursorShape shape;
+ QRectF textureRect; // normalized rect inside texture
+ QSize size; // size of the cursor
+ QPoint hotSpot;
+ QImage customCursorImage;
+ uint customCursorTexture;
+ } m_cursor;
+
+ QPoint m_pos; // current cursor position
private:
void createShaderPrograms();
static void createCursorTexture(uint *texture, const QImage &image);
void initCursorAtlas();
- QPlatformScreen *m_screen;
-
// cursor atlas information
struct CursorAtlas {
CursorAtlas() : cursorsPerRow(0), texture(0), cursorWidth(0), cursorHeight(0) { }
@@ -84,20 +104,6 @@ private:
QImage image; // valid until it's uploaded
} m_cursorAtlas;
- // current cursor information
- struct Cursor {
- Cursor() : texture(0), shape(Qt::BlankCursor), customCursorTexture(0) { }
- uint texture; // a texture from 'image' or the atlas
- Qt::CursorShape shape;
- QRectF textureRect; // normalized rect inside texture
- QSize size; // size of the cursor
- QPoint hotSpot;
- QImage customCursorImage;
- uint customCursorTexture;
- } m_cursor;
-
- QPoint m_pos;
-
GLuint m_program;
int m_vertexCoordEntry;
int m_textureCoordEntry;