KWin
Loading...
Searching...
No Matches
src
cursorsource.h
Go to the documentation of this file.
1
/*
2
SPDX-FileCopyrightText: 2022 Vlad Zahorodnii <vlad.zahorodnii@kde.org>
3
4
SPDX-License-Identifier: GPL-2.0-or-later
5
*/
6
7
#pragma once
8
9
#include "
utils/xcursortheme.h
"
10
11
#include <QImage>
12
#include <QObject>
13
#include <QPoint>
14
#include <QTimer>
15
16
namespace
KWin
17
{
18
19
class
SurfaceInterface;
20
24
class
KWIN_EXPORT
CursorSource
:
public
QObject
25
{
26
Q_OBJECT
27
28
public
:
29
explicit
CursorSource
(QObject *parent =
nullptr
);
30
31
QSizeF size()
const
;
32
QPointF hotspot()
const
;
33
34
Q_SIGNALS:
35
void
changed
();
36
37
protected
:
38
QSizeF m_size = QSizeF(0, 0);
39
QPointF
m_hotspot
;
40
};
41
45
class
KWIN_EXPORT
ShapeCursorSource
:
public
CursorSource
46
{
47
Q_OBJECT
48
49
public
:
50
explicit
ShapeCursorSource
(QObject *parent =
nullptr
);
51
52
QImage image()
const
;
53
54
QByteArray shape()
const
;
55
void
setShape(
const
QByteArray &shape);
56
void
setShape(Qt::CursorShape shape);
57
58
KXcursorTheme
theme()
const
;
59
void
setTheme(
const
KXcursorTheme
&theme);
60
61
private
:
62
void
refresh();
63
void
selectNextSprite();
64
void
selectSprite(
int
index);
65
66
KXcursorTheme
m_theme;
67
QByteArray m_shape;
68
QList<KXcursorSprite> m_sprites;
69
QTimer m_delayTimer;
70
QImage m_image;
71
int
m_currentSprite = -1;
72
};
73
77
class
KWIN_EXPORT
SurfaceCursorSource
:
public
CursorSource
78
{
79
Q_OBJECT
80
81
public
:
82
explicit
SurfaceCursorSource
(QObject *parent =
nullptr
);
83
84
SurfaceInterface
*surface()
const
;
85
86
public
Q_SLOTS:
87
void
update(
SurfaceInterface
*surface,
const
QPointF &hotspot);
88
89
private
:
90
void
refresh();
91
void
reset();
92
93
SurfaceInterface
*m_surface =
nullptr
;
94
};
95
96
}
// namespace KWin
KWin::CursorSource
Definition
cursorsource.h:25
KWin::CursorSource::m_hotspot
QPointF m_hotspot
Definition
cursorsource.h:39
KWin::CursorSource::changed
void changed()
KWin::KXcursorTheme
Definition
xcursortheme.h:80
KWin::ShapeCursorSource
Definition
cursorsource.h:46
KWin::SurfaceCursorSource
Definition
cursorsource.h:78
KWin::SurfaceInterface
Resource representing a wl_surface.
Definition
surface.h:80
KWin
Definition
activation_test.cpp:20
xcursortheme.h
Generated on Sat Feb 17 2024 01:42:09 for KWin by
1.10.0