From 633d4e6fd121fe128aec78bb9c137c4f2f82f1ce Mon Sep 17 00:00:00 2001 From: Johan Klokkhammer Helsing Date: Tue, 15 May 2018 09:58:18 +0200 Subject: 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 --- src/client/qwaylandcursor.cpp | 22 +--------------------- 1 file changed, 1 insertion(+), 21 deletions(-) (limited to 'src/client/qwaylandcursor.cpp') 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; -- cgit v1.2.3