Files
RedBear-OS/local/recipes/kde/kwin/source/src/cursorsource.h
T
vasilito ff4ff35918 feat: track all source trees in git — full fork offline-first model
Red Bear OS is a full fork. All sources must be available from git clone
with zero network access. Removed gitignore rules that excluded fetched
source trees under recipes/*/source/, local/recipes/kde/*/source/,
local/recipes/qt/*/source/, and vendor source trees.

Build artifacts (target/, build/, source.tar, *.o, *.so) remain excluded.

127291 files added — kernel, relibc, base, bootloader, pkgar, all KDE/Qt
frameworks, mesa, wayland, DRM drivers, and every other recipe source.
2026-05-14 10:55:53 +01:00

102 lines
2.0 KiB
C++

/*
SPDX-FileCopyrightText: 2022 Vlad Zahorodnii <vlad.zahorodnii@kde.org>
SPDX-License-Identifier: GPL-2.0-or-later
*/
#pragma once
#include "utils/cursortheme.h"
#include <QImage>
#include <QObject>
#include <QPoint>
#include <QTimer>
namespace KWin
{
class SurfaceInterface;
/**
* The CursorSource class represents the contents of the Cursor.
*/
class KWIN_EXPORT CursorSource : public QObject
{
Q_OBJECT
public:
explicit CursorSource(QObject *parent = nullptr);
bool isBlank() const;
QSizeF size() const;
QPointF hotspot() const;
virtual void frame(std::chrono::milliseconds timestamp);
Q_SIGNALS:
void changed();
protected:
QSizeF m_size = QSizeF(0, 0);
QPointF m_hotspot;
};
/**
* The ShapeCursorSource class represents the contents of a shape in the cursor theme.
*/
class KWIN_EXPORT ShapeCursorSource : public CursorSource
{
Q_OBJECT
public:
explicit ShapeCursorSource(QObject *parent = nullptr);
QImage image() const;
QByteArray shape() const;
void setShape(const QByteArray &shape);
void setShape(Qt::CursorShape shape);
CursorTheme theme() const;
void setTheme(const CursorTheme &theme);
private:
void refresh();
void selectNextSprite();
void selectSprite(int index);
CursorTheme m_theme;
QByteArray m_shape;
QList<CursorSprite> m_sprites;
QTimer m_delayTimer;
QImage m_image;
int m_currentSprite = -1;
};
/**
* The SurfaceCursorSource class repsents the contents of a cursor backed by a wl_surface.
*/
class KWIN_EXPORT SurfaceCursorSource : public CursorSource
{
Q_OBJECT
public:
explicit SurfaceCursorSource(QObject *parent = nullptr);
SurfaceInterface *surface() const;
void frame(std::chrono::milliseconds timestamp) override;
public Q_SLOTS:
void update(SurfaceInterface *surface, const QPointF &hotspot);
private:
void refresh();
void reset();
SurfaceInterface *m_surface = nullptr;
};
} // namespace KWin