summaryrefslogtreecommitdiffstats
path: root/src/client/qwaylandcursor.cpp
diff options
context:
space:
mode:
authorJohan Klokkhammer Helsing <johan.helsing@qt.io>2018-05-15 09:58:18 +0200
committerJohan Helsing <johan.helsing@qt.io>2018-05-28 09:10:31 +0000
commit633d4e6fd121fe128aec78bb9c137c4f2f82f1ce (patch)
treef5ac15b1f4de5357c2463cc660e9812f9ad15ca9 /src/client/qwaylandcursor.cpp
parentd579651f7ef737d480791a2680eb57aa0e29c260 (diff)
Client: Only load cursor theme once
Now cursor themes load once per device pixel ratio, and not once per screen. Task-number: QTBUG-67796 Change-Id: I4c253e65a791d69e7d510c4228989390a4343110 Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>
Diffstat (limited to 'src/client/qwaylandcursor.cpp')
-rw-r--r--src/client/qwaylandcursor.cpp22
1 files changed, 1 insertions, 21 deletions
diff --git a/src/client/qwaylandcursor.cpp b/src/client/qwaylandcursor.cpp
index a356950c3..3d2cbd761 100644
--- a/src/client/qwaylandcursor.cpp
+++ b/src/client/qwaylandcursor.cpp
@@ -55,31 +55,11 @@ namespace QtWaylandClient {
QWaylandCursor::QWaylandCursor(QWaylandScreen *screen)
: mDisplay(screen->display())
+ , mCursorTheme(mDisplay->loadCursorTheme(screen->devicePixelRatio()))
{
- //TODO: Make wl_cursor_theme_load arguments configurable here
- QByteArray cursorTheme = qgetenv("XCURSOR_THEME");
- if (cursorTheme.isEmpty())
- cursorTheme = QByteArray("default");
- int cursorSize = qEnvironmentVariableIntValue("XCURSOR_SIZE");
- if (cursorSize <= 0)
- cursorSize = 32;
-
- // wl_surface.set_buffer_scale is not supported on earlier versions
- if (mDisplay->compositorVersion() >= 3)
- cursorSize *= screen->devicePixelRatio();
-
- mCursorTheme = wl_cursor_theme_load(cursorTheme, cursorSize, mDisplay->shm()->object());
- if (!mCursorTheme)
- qDebug() << "Could not load theme" << cursorTheme;
initCursorMap();
}
-QWaylandCursor::~QWaylandCursor()
-{
- if (mCursorTheme)
- wl_cursor_theme_destroy(mCursorTheme);
-}
-
struct wl_cursor_image *QWaylandCursor::cursorImage(Qt::CursorShape newShape)
{
struct wl_cursor *waylandCursor = nullptr;