autotests: Use ShapeCursorSource to load reference cursor images in testPointerInput
This commit is contained in:
parent
a472c90327
commit
b1908949d0
1 changed files with 4 additions and 24 deletions
|
@ -38,17 +38,6 @@
|
||||||
namespace KWin
|
namespace KWin
|
||||||
{
|
{
|
||||||
|
|
||||||
static PlatformCursorImage loadReferenceThemeCursor_helper(const KXcursorTheme &theme,
|
|
||||||
const QByteArray &name)
|
|
||||||
{
|
|
||||||
const QList<KXcursorSprite> sprites = theme.shape(name);
|
|
||||||
if (sprites.isEmpty()) {
|
|
||||||
return PlatformCursorImage();
|
|
||||||
}
|
|
||||||
|
|
||||||
return PlatformCursorImage(sprites.constFirst().data(), sprites.constFirst().hotspot());
|
|
||||||
}
|
|
||||||
|
|
||||||
static PlatformCursorImage loadReferenceThemeCursor(const QByteArray &name)
|
static PlatformCursorImage loadReferenceThemeCursor(const QByteArray &name)
|
||||||
{
|
{
|
||||||
const Cursor *pointerCursor = Cursors::self()->mouse();
|
const Cursor *pointerCursor = Cursors::self()->mouse();
|
||||||
|
@ -58,20 +47,11 @@ static PlatformCursorImage loadReferenceThemeCursor(const QByteArray &name)
|
||||||
return PlatformCursorImage();
|
return PlatformCursorImage();
|
||||||
}
|
}
|
||||||
|
|
||||||
PlatformCursorImage platformCursorImage = loadReferenceThemeCursor_helper(theme, name);
|
ShapeCursorSource source;
|
||||||
if (!platformCursorImage.isNull()) {
|
source.setShape(name);
|
||||||
return platformCursorImage;
|
source.setTheme(theme);
|
||||||
}
|
|
||||||
|
|
||||||
const QList<QByteArray> alternativeNames = Cursor::cursorAlternativeNames(name);
|
return PlatformCursorImage(source.image(), source.hotspot());
|
||||||
for (const QByteArray &alternativeName : alternativeNames) {
|
|
||||||
platformCursorImage = loadReferenceThemeCursor_helper(theme, alternativeName);
|
|
||||||
if (!platformCursorImage.isNull()) {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return platformCursorImage;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static PlatformCursorImage loadReferenceThemeCursor(const CursorShape &shape)
|
static PlatformCursorImage loadReferenceThemeCursor(const CursorShape &shape)
|
||||||
|
|
Loading…
Reference in a new issue