[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:
Vlad Zahorodnii 2020-05-18 22:45:48 +03:00 committed by Vlad Zahorodnii
parent c10fe06d06
commit 317bc74c86
2 changed files with 2 additions and 21 deletions

View file

@ -973,8 +973,6 @@ CursorImage::CursorImage(PointerInputRedirection *parent)
m_surfaceRenderedTimer.start();
connect(&m_waylandImage, &WaylandCursorImage::themeChanged, this, [this] {
m_cursors.clear();
m_cursorsByName.clear();
loadThemeCursor(Qt::ArrowCursor, &m_fallbackCursor);
updateDecorationCursor();
updateMoveResize();
@ -1262,12 +1260,12 @@ void CursorImage::updateDragCursor()
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)
{
m_waylandImage.loadThemeCursor(shape, m_cursorsByName, image);
m_waylandImage.loadThemeCursor(shape, image);
}
template <typename T>
@ -1302,18 +1300,6 @@ void WaylandCursorImage::loadThemeCursor(const T &shape, Image *image)
*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()
{
if (waylandServer()->seat()->isDragPointer()) {

View file

@ -189,9 +189,6 @@ public:
template <typename T>
void loadThemeCursor(const T &shape, Image *image);
template <typename T>
void loadThemeCursor(const T &shape, QHash<T, Image> &cursors, Image *image);
Q_SIGNALS:
void themeChanged();
@ -253,8 +250,6 @@ private:
WaylandCursorImage::Image m_fallbackCursor;
WaylandCursorImage::Image m_moveResizeCursor;
WaylandCursorImage::Image m_windowSelectionCursor;
QHash<CursorShape, WaylandCursorImage::Image> m_cursors;
QHash<QByteArray, WaylandCursorImage::Image> m_cursorsByName;
QElapsedTimer m_surfaceRenderedTimer;
struct {
WaylandCursorImage::Image cursor;