Merge branch 'Plasma/5.12' into Plasma/5.13
This commit is contained in:
commit
04dab3de1b
3 changed files with 22 additions and 14 deletions
|
@ -830,7 +830,8 @@ void PointerInputTest::testCursorImage()
|
|||
Cursor::setPos(800, 800);
|
||||
auto p = input()->pointer();
|
||||
// at the moment it should be the fallback cursor
|
||||
QVERIFY(!p->cursorImage().isNull());
|
||||
const QImage fallbackCursor = p->cursorImage();
|
||||
QVERIFY(!fallbackCursor.isNull());
|
||||
|
||||
// create a window
|
||||
QSignalSpy clientAddedSpy(waylandServer(), &WaylandServer::shellClientAdded);
|
||||
|
@ -844,10 +845,10 @@ void PointerInputTest::testCursorImage()
|
|||
AbstractClient *window = workspace()->activeClient();
|
||||
QVERIFY(window);
|
||||
|
||||
// move cursor to center of window, this should first set a null pointer
|
||||
// move cursor to center of window, this should first set a null pointer, so we still show old cursor
|
||||
Cursor::setPos(window->geometry().center());
|
||||
QCOMPARE(p->window().data(), window);
|
||||
QVERIFY(p->cursorImage().isNull());
|
||||
QCOMPARE(p->cursorImage(), fallbackCursor);
|
||||
QVERIFY(enteredSpy.wait());
|
||||
|
||||
// create a cursor on the pointer
|
||||
|
@ -890,6 +891,7 @@ void PointerInputTest::testCursorImage()
|
|||
Cursor::setPos(window->geometry().bottomLeft() + QPoint(20, 20));
|
||||
QVERIFY(p->window().isNull());
|
||||
QVERIFY(!p->cursorImage().isNull());
|
||||
QCOMPARE(p->cursorImage(), fallbackCursor);
|
||||
}
|
||||
|
||||
class HelperEffect : public Effect
|
||||
|
@ -935,8 +937,8 @@ void PointerInputTest::testEffectOverrideCursorImage()
|
|||
QVERIFY(!window->geometry().contains(QPoint(800, 800)));
|
||||
Cursor::setPos(window->geometry().center());
|
||||
QVERIFY(enteredSpy.wait());
|
||||
// cursor image should be null
|
||||
QVERIFY(p->cursorImage().isNull());
|
||||
// cursor image should still be fallback
|
||||
QCOMPARE(p->cursorImage(), fallback);
|
||||
|
||||
// now create an effect and set an override cursor
|
||||
QScopedPointer<HelperEffect> effect(new HelperEffect);
|
||||
|
|
|
@ -182,12 +182,11 @@ void SceneQPainterTest::testWindow()
|
|||
if (frameRenderedSpy.isEmpty()) {
|
||||
QVERIFY(frameRenderedSpy.wait());
|
||||
}
|
||||
// we didn't set a cursor image on the surface yet, so it should be just black + window
|
||||
// we didn't set a cursor image on the surface yet, so it should be just black + window and previous cursor
|
||||
QImage referenceImage(QSize(1280, 1024), QImage::Format_RGB32);
|
||||
referenceImage.fill(Qt::black);
|
||||
QPainter painter(&referenceImage);
|
||||
painter.fillRect(0, 0, 200, 300, Qt::blue);
|
||||
QCOMPARE(referenceImage, *scene->qpainterRenderBuffer());
|
||||
|
||||
// now let's set a cursor image
|
||||
QScopedPointer<Surface> cs(Test::createSurface());
|
||||
|
@ -215,6 +214,8 @@ void SceneQPainterTest::testWindowScaled()
|
|||
QScopedPointer<Surface> s(Test::createSurface());
|
||||
QScopedPointer<ShellSurface> ss(Test::createShellSurface(s.data()));
|
||||
QScopedPointer<Pointer> p(Test::waylandSeat()->createPointer());
|
||||
QSignalSpy pointerEnteredSpy(p.data(), &Pointer::entered);
|
||||
QVERIFY(pointerEnteredSpy.isValid());
|
||||
|
||||
auto scene = KWin::Compositor::self()->scene();
|
||||
QVERIFY(scene);
|
||||
|
@ -225,7 +226,6 @@ void SceneQPainterTest::testWindowScaled()
|
|||
QScopedPointer<Surface> cs(Test::createSurface());
|
||||
QVERIFY(!cs.isNull());
|
||||
Test::render(cs.data(), QSize(10, 10), Qt::red);
|
||||
p->setCursor(cs.data(), QPoint(5, 5));
|
||||
|
||||
// now let's map the window
|
||||
s->setScale(2);
|
||||
|
@ -239,12 +239,11 @@ void SceneQPainterTest::testWindowScaled()
|
|||
|
||||
//add buffer
|
||||
Test::render(s.data(), img);
|
||||
Test::waitForWaylandWindowShown();
|
||||
QVERIFY(pointerEnteredSpy.wait());
|
||||
p->setCursor(cs.data(), QPoint(5, 5));
|
||||
|
||||
// which should trigger a frame
|
||||
if (frameRenderedSpy.isEmpty()) {
|
||||
QVERIFY(frameRenderedSpy.wait());
|
||||
}
|
||||
QVERIFY(frameRenderedSpy.wait());
|
||||
QImage referenceImage(QSize(1280, 1024), QImage::Format_RGB32);
|
||||
referenceImage.fill(Qt::black);
|
||||
QPainter painter(&referenceImage);
|
||||
|
|
|
@ -455,6 +455,8 @@ bool PointerInputRedirection::areButtonsPressed() const
|
|||
return false;
|
||||
}
|
||||
|
||||
static bool s_cursorUpdateBlocking = false;
|
||||
|
||||
void PointerInputRedirection::update()
|
||||
{
|
||||
if (!m_inited) {
|
||||
|
@ -517,7 +519,9 @@ void PointerInputRedirection::update()
|
|||
m_window = QPointer<Toplevel>(t);
|
||||
// TODO: add convenient API to update global pos together with updating focused surface
|
||||
warpXcbOnSurfaceLeft(t->surface());
|
||||
s_cursorUpdateBlocking = true;
|
||||
seat->setFocusedPointerSurface(nullptr);
|
||||
s_cursorUpdateBlocking = false;
|
||||
seat->setPointerPos(m_pos.toPoint());
|
||||
seat->setFocusedPointerSurface(t->surface(), t->inputTransformation());
|
||||
m_windowGeometryConnection = connect(t, &Toplevel::geometryChanged, this,
|
||||
|
@ -965,6 +969,9 @@ void CursorImage::markAsRendered()
|
|||
|
||||
void CursorImage::update()
|
||||
{
|
||||
if (s_cursorUpdateBlocking) {
|
||||
return;
|
||||
}
|
||||
using namespace KWayland::Server;
|
||||
disconnect(m_serverCursor.connection);
|
||||
auto p = waylandServer()->seat()->focusedPointer();
|
||||
|
@ -972,8 +979,8 @@ void CursorImage::update()
|
|||
m_serverCursor.connection = connect(p, &PointerInterface::cursorChanged, this, &CursorImage::updateServerCursor);
|
||||
} else {
|
||||
m_serverCursor.connection = QMetaObject::Connection();
|
||||
reevaluteSource();
|
||||
}
|
||||
updateServerCursor();
|
||||
}
|
||||
|
||||
void CursorImage::updateDecoration()
|
||||
|
@ -1239,7 +1246,7 @@ void CursorImage::reevaluteSource()
|
|||
setSource(CursorSource::Decoration);
|
||||
return;
|
||||
}
|
||||
if (!m_pointer->window().isNull()) {
|
||||
if (!m_pointer->window().isNull() && waylandServer()->seat()->focusedPointer()) {
|
||||
setSource(CursorSource::PointerSurface);
|
||||
return;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue