utils: Rename KXcursorTheme to CursorTheme
The KXcursorTheme type no longer with Xcursor only cursors, so rename it to maintain more reasonable naming conventions.
This commit is contained in:
parent
266c6ee855
commit
68a621f95a
16 changed files with 231 additions and 233 deletions
|
@ -14,7 +14,7 @@
|
||||||
#include "effect/effecthandler.h"
|
#include "effect/effecthandler.h"
|
||||||
#include "options.h"
|
#include "options.h"
|
||||||
#include "pointer_input.h"
|
#include "pointer_input.h"
|
||||||
#include "utils/xcursortheme.h"
|
#include "utils/cursortheme.h"
|
||||||
#include "virtualdesktops.h"
|
#include "virtualdesktops.h"
|
||||||
#include "wayland/seat.h"
|
#include "wayland/seat.h"
|
||||||
#include "wayland_server.h"
|
#include "wayland_server.h"
|
||||||
|
@ -42,7 +42,7 @@ static PlatformCursorImage loadReferenceThemeCursor(const QByteArray &name)
|
||||||
{
|
{
|
||||||
const Cursor *pointerCursor = Cursors::self()->mouse();
|
const Cursor *pointerCursor = Cursors::self()->mouse();
|
||||||
|
|
||||||
const KXcursorTheme theme(pointerCursor->themeName(), pointerCursor->themeSize(), kwinApp()->devicePixelRatio());
|
const CursorTheme theme(pointerCursor->themeName(), pointerCursor->themeSize(), kwinApp()->devicePixelRatio());
|
||||||
if (theme.isEmpty()) {
|
if (theme.isEmpty()) {
|
||||||
return PlatformCursorImage();
|
return PlatformCursorImage();
|
||||||
}
|
}
|
||||||
|
|
|
@ -586,6 +586,7 @@ install(FILES
|
||||||
install(FILES
|
install(FILES
|
||||||
utils/c_ptr.h
|
utils/c_ptr.h
|
||||||
utils/common.h
|
utils/common.h
|
||||||
|
utils/cursortheme.h
|
||||||
utils/damagejournal.h
|
utils/damagejournal.h
|
||||||
utils/drm_format_helper.h
|
utils/drm_format_helper.h
|
||||||
utils/edid.h
|
utils/edid.h
|
||||||
|
@ -604,7 +605,6 @@ install(FILES
|
||||||
utils/version.h
|
utils/version.h
|
||||||
utils/vsyncmonitor.h
|
utils/vsyncmonitor.h
|
||||||
utils/xcbutils.h
|
utils/xcbutils.h
|
||||||
utils/xcursortheme.h
|
|
||||||
DESTINATION ${KDE_INSTALL_INCLUDEDIR}/kwin/utils COMPONENT Devel)
|
DESTINATION ${KDE_INSTALL_INCLUDEDIR}/kwin/utils COMPONENT Devel)
|
||||||
|
|
||||||
install(FILES
|
install(FILES
|
||||||
|
|
|
@ -65,12 +65,12 @@ void ShapeCursorSource::setShape(Qt::CursorShape shape)
|
||||||
setShape(CursorShape(shape).name());
|
setShape(CursorShape(shape).name());
|
||||||
}
|
}
|
||||||
|
|
||||||
KXcursorTheme ShapeCursorSource::theme() const
|
CursorTheme ShapeCursorSource::theme() const
|
||||||
{
|
{
|
||||||
return m_theme;
|
return m_theme;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ShapeCursorSource::setTheme(const KXcursorTheme &theme)
|
void ShapeCursorSource::setTheme(const CursorTheme &theme)
|
||||||
{
|
{
|
||||||
if (m_theme != theme) {
|
if (m_theme != theme) {
|
||||||
m_theme = theme;
|
m_theme = theme;
|
||||||
|
@ -109,7 +109,7 @@ void ShapeCursorSource::selectSprite(int index)
|
||||||
if (m_currentSprite == index) {
|
if (m_currentSprite == index) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const KXcursorSprite &sprite = m_sprites[index];
|
const CursorSprite &sprite = m_sprites[index];
|
||||||
m_currentSprite = index;
|
m_currentSprite = index;
|
||||||
m_image = sprite.data();
|
m_image = sprite.data();
|
||||||
m_size = QSizeF(m_image.size()) / m_image.devicePixelRatio();
|
m_size = QSizeF(m_image.size()) / m_image.devicePixelRatio();
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "utils/xcursortheme.h"
|
#include "utils/cursortheme.h"
|
||||||
|
|
||||||
#include <QImage>
|
#include <QImage>
|
||||||
#include <QObject>
|
#include <QObject>
|
||||||
|
@ -58,17 +58,17 @@ public:
|
||||||
void setShape(const QByteArray &shape);
|
void setShape(const QByteArray &shape);
|
||||||
void setShape(Qt::CursorShape shape);
|
void setShape(Qt::CursorShape shape);
|
||||||
|
|
||||||
KXcursorTheme theme() const;
|
CursorTheme theme() const;
|
||||||
void setTheme(const KXcursorTheme &theme);
|
void setTheme(const CursorTheme &theme);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void refresh();
|
void refresh();
|
||||||
void selectNextSprite();
|
void selectNextSprite();
|
||||||
void selectSprite(int index);
|
void selectSprite(int index);
|
||||||
|
|
||||||
KXcursorTheme m_theme;
|
CursorTheme m_theme;
|
||||||
QByteArray m_shape;
|
QByteArray m_shape;
|
||||||
QList<KXcursorSprite> m_sprites;
|
QList<CursorSprite> m_sprites;
|
||||||
QTimer m_delayTimer;
|
QTimer m_delayTimer;
|
||||||
QImage m_image;
|
QImage m_image;
|
||||||
int m_currentSprite = -1;
|
int m_currentSprite = -1;
|
||||||
|
|
|
@ -18,7 +18,7 @@
|
||||||
namespace KWin
|
namespace KWin
|
||||||
{
|
{
|
||||||
|
|
||||||
ShakeCursorItem::ShakeCursorItem(const KXcursorTheme &theme, Item *parent)
|
ShakeCursorItem::ShakeCursorItem(const CursorTheme &theme, Item *parent)
|
||||||
: Item(parent)
|
: Item(parent)
|
||||||
{
|
{
|
||||||
m_source = std::make_unique<ShapeCursorSource>();
|
m_source = std::make_unique<ShapeCursorSource>();
|
||||||
|
@ -145,9 +145,9 @@ void ShakeCursorEffect::magnify(qreal magnification)
|
||||||
effects->hideCursor();
|
effects->hideCursor();
|
||||||
|
|
||||||
const qreal maxScale = ShakeCursorConfig::magnification() + 8 * ShakeCursorConfig::overMagnification();
|
const qreal maxScale = ShakeCursorConfig::magnification() + 8 * ShakeCursorConfig::overMagnification();
|
||||||
const KXcursorTheme originalTheme = input()->pointer()->cursorTheme();
|
const CursorTheme originalTheme = input()->pointer()->cursorTheme();
|
||||||
if (m_cursorTheme.name() != originalTheme.name() || m_cursorTheme.size() != originalTheme.size() || m_cursorTheme.devicePixelRatio() != maxScale) {
|
if (m_cursorTheme.name() != originalTheme.name() || m_cursorTheme.size() != originalTheme.size() || m_cursorTheme.devicePixelRatio() != maxScale) {
|
||||||
m_cursorTheme = KXcursorTheme(originalTheme.name(), originalTheme.size(), maxScale);
|
m_cursorTheme = CursorTheme(originalTheme.name(), originalTheme.size(), maxScale);
|
||||||
}
|
}
|
||||||
|
|
||||||
m_cursorItem = std::make_unique<ShakeCursorItem>(m_cursorTheme, effects->scene()->overlayItem());
|
m_cursorItem = std::make_unique<ShakeCursorItem>(m_cursorTheme, effects->scene()->overlayItem());
|
||||||
|
|
|
@ -10,7 +10,7 @@
|
||||||
#include "input_event_spy.h"
|
#include "input_event_spy.h"
|
||||||
#include "plugins/shakecursor/shakedetector.h"
|
#include "plugins/shakecursor/shakedetector.h"
|
||||||
#include "scene/cursoritem.h"
|
#include "scene/cursoritem.h"
|
||||||
#include "utils/xcursortheme.h"
|
#include "utils/cursortheme.h"
|
||||||
|
|
||||||
#include <QTimer>
|
#include <QTimer>
|
||||||
#include <QVariantAnimation>
|
#include <QVariantAnimation>
|
||||||
|
@ -27,7 +27,7 @@ class ShakeCursorItem : public Item
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
ShakeCursorItem(const KXcursorTheme &theme, Item *parent);
|
ShakeCursorItem(const CursorTheme &theme, Item *parent);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void refresh();
|
void refresh();
|
||||||
|
@ -63,7 +63,7 @@ private:
|
||||||
|
|
||||||
Cursor *m_cursor;
|
Cursor *m_cursor;
|
||||||
std::unique_ptr<ShakeCursorItem> m_cursorItem;
|
std::unique_ptr<ShakeCursorItem> m_cursorItem;
|
||||||
KXcursorTheme m_cursorTheme;
|
CursorTheme m_cursorTheme;
|
||||||
qreal m_targetMagnification = 1.0;
|
qreal m_targetMagnification = 1.0;
|
||||||
qreal m_currentMagnification = 1.0;
|
qreal m_currentMagnification = 1.0;
|
||||||
};
|
};
|
||||||
|
|
|
@ -79,7 +79,7 @@ PointerInputRedirection::PointerInputRedirection(InputRedirection *parent)
|
||||||
|
|
||||||
PointerInputRedirection::~PointerInputRedirection() = default;
|
PointerInputRedirection::~PointerInputRedirection() = default;
|
||||||
|
|
||||||
KXcursorTheme PointerInputRedirection::cursorTheme() const
|
CursorTheme PointerInputRedirection::cursorTheme() const
|
||||||
{
|
{
|
||||||
return m_cursor->theme();
|
return m_cursor->theme();
|
||||||
}
|
}
|
||||||
|
@ -1112,7 +1112,7 @@ WaylandCursorImage::WaylandCursorImage(QObject *parent)
|
||||||
connect(workspace(), &Workspace::outputsChanged, this, &WaylandCursorImage::updateCursorTheme);
|
connect(workspace(), &Workspace::outputsChanged, this, &WaylandCursorImage::updateCursorTheme);
|
||||||
}
|
}
|
||||||
|
|
||||||
KXcursorTheme WaylandCursorImage::theme() const
|
CursorTheme WaylandCursorImage::theme() const
|
||||||
{
|
{
|
||||||
return m_cursorTheme;
|
return m_cursorTheme;
|
||||||
}
|
}
|
||||||
|
@ -1129,14 +1129,14 @@ void WaylandCursorImage::updateCursorTheme()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
m_cursorTheme = KXcursorTheme(pointerCursor->themeName(), pointerCursor->themeSize(), targetDevicePixelRatio);
|
m_cursorTheme = CursorTheme(pointerCursor->themeName(), pointerCursor->themeSize(), targetDevicePixelRatio);
|
||||||
if (m_cursorTheme.isEmpty()) {
|
if (m_cursorTheme.isEmpty()) {
|
||||||
qCWarning(KWIN_CORE) << "Failed to load cursor theme" << pointerCursor->themeName();
|
qCWarning(KWIN_CORE) << "Failed to load cursor theme" << pointerCursor->themeName();
|
||||||
m_cursorTheme = KXcursorTheme(Cursor::defaultThemeName(), Cursor::defaultThemeSize(), targetDevicePixelRatio);
|
m_cursorTheme = CursorTheme(Cursor::defaultThemeName(), Cursor::defaultThemeSize(), targetDevicePixelRatio);
|
||||||
|
|
||||||
if (m_cursorTheme.isEmpty()) {
|
if (m_cursorTheme.isEmpty()) {
|
||||||
qCWarning(KWIN_CORE) << "Failed to load cursor theme" << Cursor::defaultThemeName();
|
qCWarning(KWIN_CORE) << "Failed to load cursor theme" << Cursor::defaultThemeName();
|
||||||
m_cursorTheme = KXcursorTheme(Cursor::fallbackThemeName(), Cursor::defaultThemeSize(), targetDevicePixelRatio);
|
m_cursorTheme = CursorTheme(Cursor::fallbackThemeName(), Cursor::defaultThemeSize(), targetDevicePixelRatio);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1191,7 +1191,7 @@ void CursorImage::setSource(CursorSource *source)
|
||||||
Q_EMIT changed();
|
Q_EMIT changed();
|
||||||
}
|
}
|
||||||
|
|
||||||
KXcursorTheme CursorImage::theme() const
|
CursorTheme CursorImage::theme() const
|
||||||
{
|
{
|
||||||
return m_waylandImage.theme();
|
return m_waylandImage.theme();
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,7 +12,7 @@
|
||||||
|
|
||||||
#include "cursor.h"
|
#include "cursor.h"
|
||||||
#include "input.h"
|
#include "input.h"
|
||||||
#include "utils/xcursortheme.h"
|
#include "utils/cursortheme.h"
|
||||||
|
|
||||||
#include <QElapsedTimer>
|
#include <QElapsedTimer>
|
||||||
#include <QObject>
|
#include <QObject>
|
||||||
|
@ -48,7 +48,7 @@ public:
|
||||||
|
|
||||||
void init() override;
|
void init() override;
|
||||||
|
|
||||||
KXcursorTheme cursorTheme() const; // TODO: Make it a Cursor property
|
CursorTheme cursorTheme() const; // TODO: Make it a Cursor property
|
||||||
|
|
||||||
void updateAfterScreenChange();
|
void updateAfterScreenChange();
|
||||||
bool supportsWarping() const;
|
bool supportsWarping() const;
|
||||||
|
@ -206,7 +206,7 @@ class WaylandCursorImage : public QObject
|
||||||
public:
|
public:
|
||||||
explicit WaylandCursorImage(QObject *parent = nullptr);
|
explicit WaylandCursorImage(QObject *parent = nullptr);
|
||||||
|
|
||||||
KXcursorTheme theme() const;
|
CursorTheme theme() const;
|
||||||
|
|
||||||
Q_SIGNALS:
|
Q_SIGNALS:
|
||||||
void themeChanged();
|
void themeChanged();
|
||||||
|
@ -214,7 +214,7 @@ Q_SIGNALS:
|
||||||
private:
|
private:
|
||||||
void updateCursorTheme();
|
void updateCursorTheme();
|
||||||
|
|
||||||
KXcursorTheme m_cursorTheme;
|
CursorTheme m_cursorTheme;
|
||||||
};
|
};
|
||||||
|
|
||||||
class CursorImage : public QObject
|
class CursorImage : public QObject
|
||||||
|
@ -229,7 +229,7 @@ public:
|
||||||
void setWindowSelectionCursor(const QByteArray &shape);
|
void setWindowSelectionCursor(const QByteArray &shape);
|
||||||
void removeWindowSelectionCursor();
|
void removeWindowSelectionCursor();
|
||||||
|
|
||||||
KXcursorTheme theme() const;
|
CursorTheme theme() const;
|
||||||
CursorSource *source() const;
|
CursorSource *source() const;
|
||||||
void setSource(CursorSource *source);
|
void setSource(CursorSource *source);
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
target_sources(kwin PRIVATE
|
target_sources(kwin PRIVATE
|
||||||
common.cpp
|
common.cpp
|
||||||
|
cursortheme.cpp
|
||||||
drm_format_helper.cpp
|
drm_format_helper.cpp
|
||||||
edid.cpp
|
edid.cpp
|
||||||
filedescriptor.cpp
|
filedescriptor.cpp
|
||||||
|
@ -10,7 +11,6 @@ target_sources(kwin PRIVATE
|
||||||
subsurfacemonitor.cpp
|
subsurfacemonitor.cpp
|
||||||
udev.cpp
|
udev.cpp
|
||||||
vsyncmonitor.cpp
|
vsyncmonitor.cpp
|
||||||
xcursortheme.cpp
|
|
||||||
)
|
)
|
||||||
if (KWIN_BUILD_X11)
|
if (KWIN_BUILD_X11)
|
||||||
target_sources(kwin PRIVATE xcbutils.cpp)
|
target_sources(kwin PRIVATE xcbutils.cpp)
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
SPDX-License-Identifier: GPL-2.0-or-later
|
SPDX-License-Identifier: GPL-2.0-or-later
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "utils/xcursortheme.h"
|
#include "utils/cursortheme.h"
|
||||||
#include "utils/svgcursorreader.h"
|
#include "utils/svgcursorreader.h"
|
||||||
#include "utils/xcursorreader.h"
|
#include "utils/xcursorreader.h"
|
||||||
|
|
||||||
|
@ -21,7 +21,7 @@
|
||||||
namespace KWin
|
namespace KWin
|
||||||
{
|
{
|
||||||
|
|
||||||
class KXcursorSpritePrivate : public QSharedData
|
class CursorSpritePrivate : public QSharedData
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
QImage data;
|
QImage data;
|
||||||
|
@ -29,35 +29,35 @@ public:
|
||||||
std::chrono::milliseconds delay;
|
std::chrono::milliseconds delay;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct KXcursorThemeXEntryInfo
|
struct CursorThemeXEntryInfo
|
||||||
{
|
{
|
||||||
QString path;
|
QString path;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct KXcursorThemeSvgEntryInfo
|
struct CursorThemeSvgEntryInfo
|
||||||
{
|
{
|
||||||
QString path;
|
QString path;
|
||||||
};
|
};
|
||||||
|
|
||||||
using KXcursorThemeEntryInfo = std::variant<KXcursorThemeXEntryInfo,
|
using CursorThemeEntryInfo = std::variant<CursorThemeXEntryInfo,
|
||||||
KXcursorThemeSvgEntryInfo>;
|
CursorThemeSvgEntryInfo>;
|
||||||
|
|
||||||
class KXcursorThemeEntry
|
class CursorThemeEntry
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
explicit KXcursorThemeEntry(const KXcursorThemeEntryInfo &info);
|
explicit CursorThemeEntry(const CursorThemeEntryInfo &info);
|
||||||
|
|
||||||
void load(int size, qreal devicePixelRatio);
|
void load(int size, qreal devicePixelRatio);
|
||||||
|
|
||||||
KXcursorThemeEntryInfo info;
|
CursorThemeEntryInfo info;
|
||||||
QList<KXcursorSprite> sprites;
|
QList<CursorSprite> sprites;
|
||||||
};
|
};
|
||||||
|
|
||||||
class KXcursorThemePrivate : public QSharedData
|
class CursorThemePrivate : public QSharedData
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
KXcursorThemePrivate();
|
CursorThemePrivate();
|
||||||
KXcursorThemePrivate(const QString &themeName, int size, qreal devicePixelRatio);
|
CursorThemePrivate(const QString &themeName, int size, qreal devicePixelRatio);
|
||||||
|
|
||||||
void discover(const QStringList &searchPaths);
|
void discover(const QStringList &searchPaths);
|
||||||
void discoverXCursors(const QString &packagePath);
|
void discoverXCursors(const QString &packagePath);
|
||||||
|
@ -67,83 +67,82 @@ public:
|
||||||
int size = 0;
|
int size = 0;
|
||||||
qreal devicePixelRatio = 0;
|
qreal devicePixelRatio = 0;
|
||||||
|
|
||||||
QHash<QByteArray, std::shared_ptr<KXcursorThemeEntry>> registry;
|
QHash<QByteArray, std::shared_ptr<CursorThemeEntry>> registry;
|
||||||
};
|
};
|
||||||
|
|
||||||
KXcursorSprite::KXcursorSprite()
|
CursorSprite::CursorSprite()
|
||||||
: d(new KXcursorSpritePrivate)
|
: d(new CursorSpritePrivate)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
KXcursorSprite::KXcursorSprite(const KXcursorSprite &other)
|
CursorSprite::CursorSprite(const CursorSprite &other)
|
||||||
: d(other.d)
|
: d(other.d)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
KXcursorSprite::~KXcursorSprite()
|
CursorSprite::~CursorSprite()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
KXcursorSprite &KXcursorSprite::operator=(const KXcursorSprite &other)
|
CursorSprite &CursorSprite::operator=(const CursorSprite &other)
|
||||||
{
|
{
|
||||||
d = other.d;
|
d = other.d;
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
KXcursorSprite::KXcursorSprite(const QImage &data, const QPoint &hotspot,
|
CursorSprite::CursorSprite(const QImage &data, const QPoint &hotspot, const std::chrono::milliseconds &delay)
|
||||||
const std::chrono::milliseconds &delay)
|
: d(new CursorSpritePrivate)
|
||||||
: d(new KXcursorSpritePrivate)
|
|
||||||
{
|
{
|
||||||
d->data = data;
|
d->data = data;
|
||||||
d->hotspot = hotspot;
|
d->hotspot = hotspot;
|
||||||
d->delay = delay;
|
d->delay = delay;
|
||||||
}
|
}
|
||||||
|
|
||||||
QImage KXcursorSprite::data() const
|
QImage CursorSprite::data() const
|
||||||
{
|
{
|
||||||
return d->data;
|
return d->data;
|
||||||
}
|
}
|
||||||
|
|
||||||
QPoint KXcursorSprite::hotspot() const
|
QPoint CursorSprite::hotspot() const
|
||||||
{
|
{
|
||||||
return d->hotspot;
|
return d->hotspot;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::chrono::milliseconds KXcursorSprite::delay() const
|
std::chrono::milliseconds CursorSprite::delay() const
|
||||||
{
|
{
|
||||||
return d->delay;
|
return d->delay;
|
||||||
}
|
}
|
||||||
|
|
||||||
KXcursorThemePrivate::KXcursorThemePrivate()
|
CursorThemePrivate::CursorThemePrivate()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
KXcursorThemePrivate::KXcursorThemePrivate(const QString &themeName, int size, qreal devicePixelRatio)
|
CursorThemePrivate::CursorThemePrivate(const QString &themeName, int size, qreal devicePixelRatio)
|
||||||
: name(themeName)
|
: name(themeName)
|
||||||
, size(size)
|
, size(size)
|
||||||
, devicePixelRatio(devicePixelRatio)
|
, devicePixelRatio(devicePixelRatio)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
KXcursorThemeEntry::KXcursorThemeEntry(const KXcursorThemeEntryInfo &info)
|
CursorThemeEntry::CursorThemeEntry(const CursorThemeEntryInfo &info)
|
||||||
: info(info)
|
: info(info)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
void KXcursorThemeEntry::load(int size, qreal devicePixelRatio)
|
void CursorThemeEntry::load(int size, qreal devicePixelRatio)
|
||||||
{
|
{
|
||||||
if (!sprites.isEmpty()) {
|
if (!sprites.isEmpty()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (const auto raster = std::get_if<KXcursorThemeXEntryInfo>(&info)) {
|
if (const auto raster = std::get_if<CursorThemeXEntryInfo>(&info)) {
|
||||||
sprites = XCursorReader::load(raster->path, size, devicePixelRatio);
|
sprites = XCursorReader::load(raster->path, size, devicePixelRatio);
|
||||||
} else if (const auto svg = std::get_if<KXcursorThemeSvgEntryInfo>(&info)) {
|
} else if (const auto svg = std::get_if<CursorThemeSvgEntryInfo>(&info)) {
|
||||||
sprites = SvgCursorReader::load(svg->path, size, devicePixelRatio);
|
sprites = SvgCursorReader::load(svg->path, size, devicePixelRatio);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void KXcursorThemePrivate::discoverXCursors(const QString &packagePath)
|
void CursorThemePrivate::discoverXCursors(const QString &packagePath)
|
||||||
{
|
{
|
||||||
const QDir dir(packagePath);
|
const QDir dir(packagePath);
|
||||||
QFileInfoList entries = dir.entryInfoList(QDir::Files | QDir::NoDotAndDotDot);
|
QFileInfoList entries = dir.entryInfoList(QDir::Files | QDir::NoDotAndDotDot);
|
||||||
|
@ -165,13 +164,13 @@ void KXcursorThemePrivate::discoverXCursors(const QString &packagePath)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
registry.insert(shape, std::make_shared<KXcursorThemeEntry>(KXcursorThemeXEntryInfo{
|
registry.insert(shape, std::make_shared<CursorThemeEntry>(CursorThemeXEntryInfo{
|
||||||
.path = entry.absoluteFilePath(),
|
.path = entry.absoluteFilePath(),
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void KXcursorThemePrivate::discoverSvgCursors(const QString &packagePath)
|
void CursorThemePrivate::discoverSvgCursors(const QString &packagePath)
|
||||||
{
|
{
|
||||||
const QDir dir(packagePath);
|
const QDir dir(packagePath);
|
||||||
QFileInfoList entries = dir.entryInfoList(QDir::Dirs | QDir::NoDotAndDotDot);
|
QFileInfoList entries = dir.entryInfoList(QDir::Dirs | QDir::NoDotAndDotDot);
|
||||||
|
@ -193,7 +192,7 @@ void KXcursorThemePrivate::discoverSvgCursors(const QString &packagePath)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
registry.insert(shape, std::make_shared<KXcursorThemeEntry>(KXcursorThemeSvgEntryInfo{
|
registry.insert(shape, std::make_shared<CursorThemeEntry>(CursorThemeSvgEntryInfo{
|
||||||
.path = entry.absoluteFilePath(),
|
.path = entry.absoluteFilePath(),
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
|
@ -222,7 +221,7 @@ static QStringList defaultSearchPaths()
|
||||||
return paths;
|
return paths;
|
||||||
}
|
}
|
||||||
|
|
||||||
void KXcursorThemePrivate::discover(const QStringList &searchPaths)
|
void CursorThemePrivate::discover(const QStringList &searchPaths)
|
||||||
{
|
{
|
||||||
const QStringList paths = !searchPaths.isEmpty() ? searchPaths : defaultSearchPaths();
|
const QStringList paths = !searchPaths.isEmpty() ? searchPaths : defaultSearchPaths();
|
||||||
|
|
||||||
|
@ -262,69 +261,69 @@ void KXcursorThemePrivate::discover(const QStringList &searchPaths)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
KXcursorTheme::KXcursorTheme()
|
CursorTheme::CursorTheme()
|
||||||
: d(new KXcursorThemePrivate)
|
: d(new CursorThemePrivate)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
KXcursorTheme::KXcursorTheme(const QString &themeName, int size, qreal devicePixelRatio, const QStringList &searchPaths)
|
CursorTheme::CursorTheme(const QString &themeName, int size, qreal devicePixelRatio, const QStringList &searchPaths)
|
||||||
: d(new KXcursorThemePrivate(themeName, size, devicePixelRatio))
|
: d(new CursorThemePrivate(themeName, size, devicePixelRatio))
|
||||||
{
|
{
|
||||||
d->discover(searchPaths);
|
d->discover(searchPaths);
|
||||||
}
|
}
|
||||||
|
|
||||||
KXcursorTheme::KXcursorTheme(const KXcursorTheme &other)
|
CursorTheme::CursorTheme(const CursorTheme &other)
|
||||||
: d(other.d)
|
: d(other.d)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
KXcursorTheme::~KXcursorTheme()
|
CursorTheme::~CursorTheme()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
KXcursorTheme &KXcursorTheme::operator=(const KXcursorTheme &other)
|
CursorTheme &CursorTheme::operator=(const CursorTheme &other)
|
||||||
{
|
{
|
||||||
d = other.d;
|
d = other.d;
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool KXcursorTheme::operator==(const KXcursorTheme &other)
|
bool CursorTheme::operator==(const CursorTheme &other)
|
||||||
{
|
{
|
||||||
return d == other.d;
|
return d == other.d;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool KXcursorTheme::operator!=(const KXcursorTheme &other)
|
bool CursorTheme::operator!=(const CursorTheme &other)
|
||||||
{
|
{
|
||||||
return !(*this == other);
|
return !(*this == other);
|
||||||
}
|
}
|
||||||
|
|
||||||
QString KXcursorTheme::name() const
|
QString CursorTheme::name() const
|
||||||
{
|
{
|
||||||
return d->name;
|
return d->name;
|
||||||
}
|
}
|
||||||
|
|
||||||
int KXcursorTheme::size() const
|
int CursorTheme::size() const
|
||||||
{
|
{
|
||||||
return d->size;
|
return d->size;
|
||||||
}
|
}
|
||||||
|
|
||||||
qreal KXcursorTheme::devicePixelRatio() const
|
qreal CursorTheme::devicePixelRatio() const
|
||||||
{
|
{
|
||||||
return d->devicePixelRatio;
|
return d->devicePixelRatio;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool KXcursorTheme::isEmpty() const
|
bool CursorTheme::isEmpty() const
|
||||||
{
|
{
|
||||||
return d->registry.isEmpty();
|
return d->registry.isEmpty();
|
||||||
}
|
}
|
||||||
|
|
||||||
QList<KXcursorSprite> KXcursorTheme::shape(const QByteArray &name) const
|
QList<CursorSprite> CursorTheme::shape(const QByteArray &name) const
|
||||||
{
|
{
|
||||||
if (auto entry = d->registry.value(name)) {
|
if (auto entry = d->registry.value(name)) {
|
||||||
entry->load(d->size, d->devicePixelRatio);
|
entry->load(d->size, d->devicePixelRatio);
|
||||||
return entry->sprites;
|
return entry->sprites;
|
||||||
}
|
}
|
||||||
return QList<KXcursorSprite>();
|
return QList<CursorSprite>();
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace KWin
|
} // namespace KWin
|
142
src/utils/cursortheme.h
Normal file
142
src/utils/cursortheme.h
Normal file
|
@ -0,0 +1,142 @@
|
||||||
|
/*
|
||||||
|
SPDX-FileCopyrightText: 2020 Vlad Zahorodnii <vlad.zahorodnii@kde.org>
|
||||||
|
|
||||||
|
SPDX-License-Identifier: GPL-2.0-or-later
|
||||||
|
*/
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <kwin_export.h>
|
||||||
|
|
||||||
|
#include <QImage>
|
||||||
|
#include <QList>
|
||||||
|
#include <QSharedDataPointer>
|
||||||
|
|
||||||
|
#include <chrono>
|
||||||
|
|
||||||
|
namespace KWin
|
||||||
|
{
|
||||||
|
|
||||||
|
class CursorSpritePrivate;
|
||||||
|
class CursorThemePrivate;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The CursorSprite class represents a single sprite in the cursor theme.
|
||||||
|
*/
|
||||||
|
class KWIN_EXPORT CursorSprite
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
/**
|
||||||
|
* Constructs an empty CursorSprite.
|
||||||
|
*/
|
||||||
|
CursorSprite();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructs a copy of the CursorSprite object @a other.
|
||||||
|
*/
|
||||||
|
CursorSprite(const CursorSprite &other);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructs an CursorSprite with the specified @a data, @a hotspot, and @a delay.
|
||||||
|
*/
|
||||||
|
CursorSprite(const QImage &data, const QPoint &hotspot, const std::chrono::milliseconds &delay);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Destructs the CursorSprite object.
|
||||||
|
*/
|
||||||
|
~CursorSprite();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Assigns the value of @a other to the cursor sprite object.
|
||||||
|
*/
|
||||||
|
CursorSprite &operator=(const CursorSprite &other);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the image for this sprite.
|
||||||
|
*/
|
||||||
|
QImage data() const;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the hotspot for this sprite. (0, 0) corresponds to the upper left corner.
|
||||||
|
*
|
||||||
|
* The coordinates of the hotspot are in device independent pixels.
|
||||||
|
*/
|
||||||
|
QPoint hotspot() const;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the time interval between this sprite and the next one, in milliseconds.
|
||||||
|
*/
|
||||||
|
std::chrono::milliseconds delay() const;
|
||||||
|
|
||||||
|
private:
|
||||||
|
QSharedDataPointer<CursorSpritePrivate> d;
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The CursorTheme class represents a cursor theme.
|
||||||
|
*/
|
||||||
|
class KWIN_EXPORT CursorTheme
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
/**
|
||||||
|
* Constructs an empty cursor theme.
|
||||||
|
*/
|
||||||
|
CursorTheme();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Loads the cursor theme with the given @ themeName and the desired @a size.
|
||||||
|
* The @a dpr specifies the desired scale factor. If no theme with the provided
|
||||||
|
* name exists, the cursor theme will be empty.
|
||||||
|
*
|
||||||
|
* @a searchPaths specifies where the cursor theme should be looked for.
|
||||||
|
*/
|
||||||
|
CursorTheme(const QString &theme, int size, qreal devicePixelRatio, const QStringList &searchPaths = QStringList());
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructs a copy of the CursorTheme object @a other.
|
||||||
|
*/
|
||||||
|
CursorTheme(const CursorTheme &other);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Destructs the CursorTheme object.
|
||||||
|
*/
|
||||||
|
~CursorTheme();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Assigns the value of @a other to the cursor theme object.
|
||||||
|
*/
|
||||||
|
CursorTheme &operator=(const CursorTheme &other);
|
||||||
|
|
||||||
|
bool operator==(const CursorTheme &other);
|
||||||
|
bool operator!=(const CursorTheme &other);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The name of the requested cursor theme.
|
||||||
|
*/
|
||||||
|
QString name() const;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The size of the requested cursor theme.
|
||||||
|
*/
|
||||||
|
int size() const;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The scale factor of the requested cursor theme.
|
||||||
|
*/
|
||||||
|
qreal devicePixelRatio() const;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns @c true if the cursor theme is empty; otherwise returns @c false.
|
||||||
|
*/
|
||||||
|
bool isEmpty() const;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the list of cursor sprites for the cursor with the given @a name.
|
||||||
|
*/
|
||||||
|
QList<CursorSprite> shape(const QByteArray &name) const;
|
||||||
|
|
||||||
|
private:
|
||||||
|
QSharedDataPointer<CursorThemePrivate> d;
|
||||||
|
};
|
||||||
|
|
||||||
|
} // namespace KWin
|
|
@ -102,7 +102,7 @@ std::optional<SvgCursorMetaData> SvgCursorMetaData::parse(const QString &filePat
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
QList<KXcursorSprite> SvgCursorReader::load(const QString &containerPath, int desiredSize, qreal devicePixelRatio)
|
QList<CursorSprite> SvgCursorReader::load(const QString &containerPath, int desiredSize, qreal devicePixelRatio)
|
||||||
{
|
{
|
||||||
const QDir containerDir(containerPath);
|
const QDir containerDir(containerPath);
|
||||||
|
|
||||||
|
@ -115,7 +115,7 @@ QList<KXcursorSprite> SvgCursorReader::load(const QString &containerPath, int de
|
||||||
|
|
||||||
const qreal scale = desiredSize / 24.0;
|
const qreal scale = desiredSize / 24.0;
|
||||||
|
|
||||||
QList<KXcursorSprite> sprites;
|
QList<CursorSprite> sprites;
|
||||||
for (const SvgCursorMetaDataEntry &entry : metadata->entries) {
|
for (const SvgCursorMetaDataEntry &entry : metadata->entries) {
|
||||||
const QString filePath = containerDir.filePath(entry.fileName);
|
const QString filePath = containerDir.filePath(entry.fileName);
|
||||||
|
|
||||||
|
@ -134,7 +134,7 @@ QList<KXcursorSprite> SvgCursorReader::load(const QString &containerPath, int de
|
||||||
renderer.render(&painter, bounds);
|
renderer.render(&painter, bounds);
|
||||||
painter.end();
|
painter.end();
|
||||||
|
|
||||||
sprites.append(KXcursorSprite(image, (entry.hotspot * scale).toPoint(), entry.delay));
|
sprites.append(CursorSprite(image, (entry.hotspot * scale).toPoint(), entry.delay));
|
||||||
}
|
}
|
||||||
|
|
||||||
return sprites;
|
return sprites;
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "utils/xcursortheme.h"
|
#include "utils/cursortheme.h"
|
||||||
|
|
||||||
namespace KWin
|
namespace KWin
|
||||||
{
|
{
|
||||||
|
@ -14,7 +14,7 @@ namespace KWin
|
||||||
class SvgCursorReader
|
class SvgCursorReader
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
static QList<KXcursorSprite> load(const QString &filePath, int desiredSize, qreal devicePixelRatio);
|
static QList<CursorSprite> load(const QString &filePath, int desiredSize, qreal devicePixelRatio);
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace KWin
|
} // namespace KWin
|
||||||
|
|
|
@ -12,7 +12,7 @@
|
||||||
namespace KWin
|
namespace KWin
|
||||||
{
|
{
|
||||||
|
|
||||||
QList<KXcursorSprite> XCursorReader::load(const QString &filePath, int desiredSize, qreal devicePixelRatio)
|
QList<CursorSprite> XCursorReader::load(const QString &filePath, int desiredSize, qreal devicePixelRatio)
|
||||||
{
|
{
|
||||||
QFile file(filePath);
|
QFile file(filePath);
|
||||||
if (!file.open(QFile::ReadOnly)) {
|
if (!file.open(QFile::ReadOnly)) {
|
||||||
|
@ -40,7 +40,7 @@ QList<KXcursorSprite> XCursorReader::load(const QString &filePath, int desiredSi
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
QList<KXcursorSprite> sprites;
|
QList<CursorSprite> sprites;
|
||||||
for (int i = 0; i < images->nimage; ++i) {
|
for (int i = 0; i < images->nimage; ++i) {
|
||||||
const XcursorImage *nativeCursorImage = images->images[i];
|
const XcursorImage *nativeCursorImage = images->images[i];
|
||||||
const qreal scale = std::max(qreal(1), qreal(nativeCursorImage->size) / desiredSize);
|
const qreal scale = std::max(qreal(1), qreal(nativeCursorImage->size) / desiredSize);
|
||||||
|
@ -51,7 +51,7 @@ QList<KXcursorSprite> XCursorReader::load(const QString &filePath, int desiredSi
|
||||||
data.setDevicePixelRatio(scale);
|
data.setDevicePixelRatio(scale);
|
||||||
memcpy(data.bits(), nativeCursorImage->pixels, data.sizeInBytes());
|
memcpy(data.bits(), nativeCursorImage->pixels, data.sizeInBytes());
|
||||||
|
|
||||||
sprites.append(KXcursorSprite(data, hotspot / scale, delay));
|
sprites.append(CursorSprite(data, hotspot / scale, delay));
|
||||||
}
|
}
|
||||||
|
|
||||||
XcursorImagesDestroy(images);
|
XcursorImagesDestroy(images);
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "utils/xcursortheme.h"
|
#include "utils/cursortheme.h"
|
||||||
|
|
||||||
namespace KWin
|
namespace KWin
|
||||||
{
|
{
|
||||||
|
@ -14,7 +14,7 @@ namespace KWin
|
||||||
class XCursorReader
|
class XCursorReader
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
static QList<KXcursorSprite> load(const QString &filePath, int desiredSize, qreal devicePixelRatio);
|
static QList<CursorSprite> load(const QString &filePath, int desiredSize, qreal devicePixelRatio);
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace KWin
|
} // namespace KWin
|
||||||
|
|
|
@ -1,143 +0,0 @@
|
||||||
/*
|
|
||||||
SPDX-FileCopyrightText: 2020 Vlad Zahorodnii <vlad.zahorodnii@kde.org>
|
|
||||||
|
|
||||||
SPDX-License-Identifier: GPL-2.0-or-later
|
|
||||||
*/
|
|
||||||
|
|
||||||
#pragma once
|
|
||||||
|
|
||||||
#include <kwin_export.h>
|
|
||||||
|
|
||||||
#include <QImage>
|
|
||||||
#include <QList>
|
|
||||||
#include <QSharedDataPointer>
|
|
||||||
|
|
||||||
#include <chrono>
|
|
||||||
|
|
||||||
namespace KWin
|
|
||||||
{
|
|
||||||
|
|
||||||
class KXcursorSpritePrivate;
|
|
||||||
class KXcursorThemePrivate;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The KXcursorSprite class represents a single sprite in the Xcursor theme.
|
|
||||||
*/
|
|
||||||
class KWIN_EXPORT KXcursorSprite
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
/**
|
|
||||||
* Constructs an empty XcursorSprite.
|
|
||||||
*/
|
|
||||||
KXcursorSprite();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Constructs a copy of the KXcursorSprite object @a other.
|
|
||||||
*/
|
|
||||||
KXcursorSprite(const KXcursorSprite &other);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Constructs an XcursorSprite with the specified @a data, @a hotspot, and @a delay.
|
|
||||||
*/
|
|
||||||
KXcursorSprite(const QImage &data, const QPoint &hotspot,
|
|
||||||
const std::chrono::milliseconds &delay);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Destructs the KXcursorSprite object.
|
|
||||||
*/
|
|
||||||
~KXcursorSprite();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Assigns the value of @a other to the Xcursor sprite object.
|
|
||||||
*/
|
|
||||||
KXcursorSprite &operator=(const KXcursorSprite &other);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns the image for this sprite.
|
|
||||||
*/
|
|
||||||
QImage data() const;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns the hotspot for this sprite. (0, 0) corresponds to the upper left corner.
|
|
||||||
*
|
|
||||||
* The coordinates of the hotspot are in device independent pixels.
|
|
||||||
*/
|
|
||||||
QPoint hotspot() const;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns the time interval between this sprite and the next one, in milliseconds.
|
|
||||||
*/
|
|
||||||
std::chrono::milliseconds delay() const;
|
|
||||||
|
|
||||||
private:
|
|
||||||
QSharedDataPointer<KXcursorSpritePrivate> d;
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The KXcursorTheme class represents an Xcursor theme.
|
|
||||||
*/
|
|
||||||
class KWIN_EXPORT KXcursorTheme
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
/**
|
|
||||||
* Constructs an empty Xcursor theme.
|
|
||||||
*/
|
|
||||||
KXcursorTheme();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Loads the Xcursor theme with the given @ themeName and the desired @a size.
|
|
||||||
* The @a dpr specifies the desired scale factor. If no theme with the provided
|
|
||||||
* name exists, the cursor theme will be empty.
|
|
||||||
*
|
|
||||||
* @a searchPaths specifies where the cursor theme should be looked for.
|
|
||||||
*/
|
|
||||||
KXcursorTheme(const QString &theme, int size, qreal devicePixelRatio, const QStringList &searchPaths = QStringList());
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Constructs a copy of the KXcursorTheme object @a other.
|
|
||||||
*/
|
|
||||||
KXcursorTheme(const KXcursorTheme &other);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Destructs the KXcursorTheme object.
|
|
||||||
*/
|
|
||||||
~KXcursorTheme();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Assigns the value of @a other to the Xcursor theme object.
|
|
||||||
*/
|
|
||||||
KXcursorTheme &operator=(const KXcursorTheme &other);
|
|
||||||
|
|
||||||
bool operator==(const KXcursorTheme &other);
|
|
||||||
bool operator!=(const KXcursorTheme &other);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The name of the requested Xcursor theme.
|
|
||||||
*/
|
|
||||||
QString name() const;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The size of the requested Xcursor theme.
|
|
||||||
*/
|
|
||||||
int size() const;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The scale factor of the requested Xcursor theme.
|
|
||||||
*/
|
|
||||||
qreal devicePixelRatio() const;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns @c true if the Xcursor theme is empty; otherwise returns @c false.
|
|
||||||
*/
|
|
||||||
bool isEmpty() const;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns the list of cursor sprites for the cursor with the given @a name.
|
|
||||||
*/
|
|
||||||
QList<KXcursorSprite> shape(const QByteArray &name) const;
|
|
||||||
|
|
||||||
private:
|
|
||||||
QSharedDataPointer<KXcursorThemePrivate> d;
|
|
||||||
};
|
|
||||||
|
|
||||||
} // namespace KWin
|
|
Loading…
Reference in a new issue