compositor_wayland: properly handle moving the cursor plane failing

On test failure, the plane has to be disabled or future atomic tests fail

BUG: 487037
wilder/Plasma/6.2
Xaver Hugl 2 years ago
parent f5ac8968d8
commit bbf4f46b28
  1. 34
      src/compositor_wayland.cpp

@ -450,18 +450,32 @@ void WaylandCompositor::addOutput(Output *output)
const QRectF outputLocalRect = output->mapFromGlobal(cursor->geometry());
const auto outputLayer = m_backend->cursorLayer(output);
bool hardwareCursor = false;
if (outputLayer) {
if (outputLayer->isEnabled()) {
const QRectF nativeCursorRect = output->transform()
.map(QRectF(outputLocalRect.topLeft() * output->scale(), outputLayer->targetRect().size()), output->pixelSize());
outputLayer->setTargetRect(QRect(nativeCursorRect.topLeft().toPoint(), outputLayer->targetRect().size()));
hardwareCursor = output->updateCursorLayer();
} else if (!cursorLayer->isVisible() && !forceSoftwareCursor) {
// this is for the case that the cursor wasn't visible because it was on a different output before
hardwareCursor = updateCursorLayer();
const bool shouldBeVisible = cursor->isOnOutput(output);
if (outputLayer && !forceSoftwareCursor) {
if (shouldBeVisible) {
const bool enabledBefore = outputLayer->isEnabled();
if (enabledBefore) {
// just move it
const QRectF nativeCursorRect = output->transform().map(QRectF(outputLocalRect.topLeft() * output->scale(), outputLayer->targetRect().size()), output->pixelSize());
outputLayer->setTargetRect(QRect(nativeCursorRect.topLeft().toPoint(), outputLayer->targetRect().size()));
outputLayer->setEnabled(true);
hardwareCursor = output->updateCursorLayer();
if (!hardwareCursor) {
outputLayer->setEnabled(false);
if (enabledBefore) {
output->updateCursorLayer();
}
}
} else {
// do the full update
hardwareCursor = updateCursorLayer();
}
} else if (outputLayer->isEnabled()) {
outputLayer->setEnabled(false);
output->updateCursorLayer();
}
}
cursorLayer->setVisible(cursor->isOnOutput(output) && !hardwareCursor);
cursorLayer->setVisible(shouldBeVisible && !hardwareCursor);
cursorLayer->setGeometry(outputLocalRect);
cursorLayer->addRepaintFull();
};

Loading…
Cancel
Save