diff options
Diffstat (limited to 'src/plugins/platforms/xcb/qxcbcursor.h')
-rw-r--r-- | src/plugins/platforms/xcb/qxcbcursor.h | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/src/plugins/platforms/xcb/qxcbcursor.h b/src/plugins/platforms/xcb/qxcbcursor.h index e3f88518fe..5bc806381c 100644 --- a/src/plugins/platforms/xcb/qxcbcursor.h +++ b/src/plugins/platforms/xcb/qxcbcursor.h @@ -43,6 +43,8 @@ #include <qpa/qplatformcursor.h> #include "qxcbscreen.h" +#include <QtCore/QCache> + QT_BEGIN_NAMESPACE #ifndef QT_NO_CURSOR @@ -76,7 +78,7 @@ public: QXcbCursor(QXcbConnection *conn, QXcbScreen *screen); ~QXcbCursor(); #ifndef QT_NO_CURSOR - void changeCursor(QCursor *cursor, QWindow *widget) override; + void changeCursor(QCursor *cursor, QWindow *window) override; #endif QPoint pos() const override; void setPos(const QPoint &pos) override; @@ -89,9 +91,20 @@ public: #endif private: + #ifndef QT_NO_CURSOR typedef QHash<QXcbCursorCacheKey, xcb_cursor_t> CursorHash; + struct CachedCursor + { + explicit CachedCursor(xcb_connection_t *conn, xcb_cursor_t c) + : cursor(c), connection(conn) {} + ~CachedCursor() { xcb_free_cursor(connection, cursor); } + xcb_cursor_t cursor; + xcb_connection_t *connection; + }; + typedef QCache<QXcbCursorCacheKey, CachedCursor> BitmapCursorCache; + xcb_cursor_t createFontCursor(int cshape); xcb_cursor_t createBitmapCursor(QCursor *cursor); xcb_cursor_t createNonStandardCursor(int cshape); @@ -100,6 +113,7 @@ private: QXcbScreen *m_screen; #ifndef QT_NO_CURSOR CursorHash m_cursorHash; + BitmapCursorCache m_bitmapCache; #endif #if QT_CONFIG(xcb_xlib) && QT_CONFIG(library) static void cursorThemePropertyChanged(QXcbVirtualDesktop *screen, |