diff options
author | Laszlo Agocs <laszlo.agocs@qt.io> | 2016-08-08 11:37:43 +0200 |
---|---|---|
committer | Laszlo Agocs <laszlo.agocs@qt.io> | 2016-08-10 09:04:47 +0000 |
commit | b305702d1e38d72765325dd7b1f2a7fde14e5529 (patch) | |
tree | 701309886d8d34a74b025a2b8de2633fc36e0f7b /src/plugins/platforms/eglfs/api/qeglfscursor_p.h | |
parent | e93042522817003f35402adea83b8a537dba7c87 (diff) |
eglfs: Support virtual desktops in the OpenGL cursor
The GBM-based hardware cursor already has this. Let's implement it
in the commonly used OpenGL cursor too. The main user will be the
EGLDevice backend which does not currently have a hardware cursor
but supports multiple screens.
This also means QEglFSCursor must be capable of operating on different
contexts (and what's more, non-sharing contexts).
Task-number: QTBUG-55161
Change-Id: Ie23bba1e6aab34b04d689f26a84c19a2bde518da
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
Diffstat (limited to 'src/plugins/platforms/eglfs/api/qeglfscursor_p.h')
-rw-r--r-- | src/plugins/platforms/eglfs/api/qeglfscursor_p.h | 27 |
1 files changed, 18 insertions, 9 deletions
diff --git a/src/plugins/platforms/eglfs/api/qeglfscursor_p.h b/src/plugins/platforms/eglfs/api/qeglfscursor_p.h index f72e4c0374..8ccbe4493c 100644 --- a/src/plugins/platforms/eglfs/api/qeglfscursor_p.h +++ b/src/plugins/platforms/eglfs/api/qeglfscursor_p.h @@ -105,30 +105,29 @@ private: bool setCurrentCursor(QCursor *cursor); #endif void draw(const QRectF &rect); - void update(const QRegion ®ion); + void update(const QRect &rect, bool allScreens); void createShaderPrograms(); void createCursorTexture(uint *texture, const QImage &image); void initCursorAtlas(); // current cursor information struct Cursor { - Cursor() : texture(0), shape(Qt::BlankCursor), customCursorTexture(0), customCursorPending(false) { } - uint texture; // a texture from 'image' or the atlas + Cursor() : shape(Qt::BlankCursor), customCursorPending(false), customCursorKey(0), useCustomCursor(false) { } Qt::CursorShape shape; QRectF textureRect; // normalized rect inside texture QSize size; // size of the cursor QPoint hotSpot; QImage customCursorImage; QPoint pos; // current cursor position - uint customCursorTexture; bool customCursorPending; + qint64 customCursorKey; + bool useCustomCursor; } m_cursor; // cursor atlas information struct CursorAtlas { - CursorAtlas() : cursorsPerRow(0), texture(0), cursorWidth(0), cursorHeight(0) { } + CursorAtlas() : cursorsPerRow(0), cursorWidth(0), cursorHeight(0) { } int cursorsPerRow; - uint texture; int width, height; // width and height of the atlas int cursorWidth, cursorHeight; // width and height of cursors inside the atlas QList<QPoint> hotSpots; @@ -137,12 +136,22 @@ private: bool m_visible; QEglFSScreen *m_screen; - QOpenGLShaderProgram *m_program; - int m_textureEntry; - int m_matEntry; + QPlatformScreen *m_activeScreen; QEglFSCursorDeviceListener *m_deviceListener; bool m_updateRequested; QMatrix4x4 m_rotationMatrix; + + struct GraphicsContextData { + GraphicsContextData() : program(nullptr), textureEntry(0), matEntry(0), + customCursorTexture(0), atlasTexture(0), customCursorKey(0) { } + QOpenGLShaderProgram *program; + int textureEntry; + int matEntry; + uint customCursorTexture; + uint atlasTexture; + qint64 customCursorKey; + }; + QHash<QOpenGLContext *, GraphicsContextData> m_gfx; }; QT_END_NAMESPACE |