[wayland] Simplify WaylandCursorImage
Cached cursor lookup tables aren't used anywhere so drop relevant methods that populate those tables in order to make the code simpler.
This commit is contained in:
parent
c10fe06d06
commit
317bc74c86
2 changed files with 2 additions and 21 deletions
|
@ -973,8 +973,6 @@ CursorImage::CursorImage(PointerInputRedirection *parent)
|
||||||
m_surfaceRenderedTimer.start();
|
m_surfaceRenderedTimer.start();
|
||||||
|
|
||||||
connect(&m_waylandImage, &WaylandCursorImage::themeChanged, this, [this] {
|
connect(&m_waylandImage, &WaylandCursorImage::themeChanged, this, [this] {
|
||||||
m_cursors.clear();
|
|
||||||
m_cursorsByName.clear();
|
|
||||||
loadThemeCursor(Qt::ArrowCursor, &m_fallbackCursor);
|
loadThemeCursor(Qt::ArrowCursor, &m_fallbackCursor);
|
||||||
updateDecorationCursor();
|
updateDecorationCursor();
|
||||||
updateMoveResize();
|
updateMoveResize();
|
||||||
|
@ -1262,12 +1260,12 @@ void CursorImage::updateDragCursor()
|
||||||
|
|
||||||
void CursorImage::loadThemeCursor(CursorShape shape, WaylandCursorImage::Image *image)
|
void CursorImage::loadThemeCursor(CursorShape shape, WaylandCursorImage::Image *image)
|
||||||
{
|
{
|
||||||
m_waylandImage.loadThemeCursor(shape, m_cursors, image);
|
m_waylandImage.loadThemeCursor(shape, image);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CursorImage::loadThemeCursor(const QByteArray &shape, WaylandCursorImage::Image *image)
|
void CursorImage::loadThemeCursor(const QByteArray &shape, WaylandCursorImage::Image *image)
|
||||||
{
|
{
|
||||||
m_waylandImage.loadThemeCursor(shape, m_cursorsByName, image);
|
m_waylandImage.loadThemeCursor(shape, image);
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
|
@ -1302,18 +1300,6 @@ void WaylandCursorImage::loadThemeCursor(const T &shape, Image *image)
|
||||||
*image = {img, QPoint(hotSpotX, hotSpotY)};
|
*image = {img, QPoint(hotSpotX, hotSpotY)};
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename T>
|
|
||||||
void WaylandCursorImage::loadThemeCursor(const T &shape, QHash<T, Image> &cursors, Image *image)
|
|
||||||
{
|
|
||||||
auto it = cursors.constFind(shape);
|
|
||||||
if (it == cursors.constEnd()) {
|
|
||||||
loadThemeCursor(shape, image);
|
|
||||||
cursors.insert(shape, *image);
|
|
||||||
} else {
|
|
||||||
*image = it.value();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void CursorImage::reevaluteSource()
|
void CursorImage::reevaluteSource()
|
||||||
{
|
{
|
||||||
if (waylandServer()->seat()->isDragPointer()) {
|
if (waylandServer()->seat()->isDragPointer()) {
|
||||||
|
|
|
@ -189,9 +189,6 @@ public:
|
||||||
template <typename T>
|
template <typename T>
|
||||||
void loadThemeCursor(const T &shape, Image *image);
|
void loadThemeCursor(const T &shape, Image *image);
|
||||||
|
|
||||||
template <typename T>
|
|
||||||
void loadThemeCursor(const T &shape, QHash<T, Image> &cursors, Image *image);
|
|
||||||
|
|
||||||
Q_SIGNALS:
|
Q_SIGNALS:
|
||||||
void themeChanged();
|
void themeChanged();
|
||||||
|
|
||||||
|
@ -253,8 +250,6 @@ private:
|
||||||
WaylandCursorImage::Image m_fallbackCursor;
|
WaylandCursorImage::Image m_fallbackCursor;
|
||||||
WaylandCursorImage::Image m_moveResizeCursor;
|
WaylandCursorImage::Image m_moveResizeCursor;
|
||||||
WaylandCursorImage::Image m_windowSelectionCursor;
|
WaylandCursorImage::Image m_windowSelectionCursor;
|
||||||
QHash<CursorShape, WaylandCursorImage::Image> m_cursors;
|
|
||||||
QHash<QByteArray, WaylandCursorImage::Image> m_cursorsByName;
|
|
||||||
QElapsedTimer m_surfaceRenderedTimer;
|
QElapsedTimer m_surfaceRenderedTimer;
|
||||||
struct {
|
struct {
|
||||||
WaylandCursorImage::Image cursor;
|
WaylandCursorImage::Image cursor;
|
||||||
|
|
Loading…
Reference in a new issue