Commit 00fb259c authored by Vlad Zahorodnii's avatar Vlad Zahorodnii
Browse files

backends/drm: Fix cursor size check

Currently, the cursor size check ignores the cursor bitmap's size, so
the hardware cursor is used even though the bitmap size exceeds cursor
limits.
parent a601a08b
Pipeline #177175 passed with stage
in 12 minutes and 55 seconds
......@@ -125,10 +125,8 @@ void DrmOutput::updateCursor()
}
return;
}
const QImage cursorImage = cursor->image();
const QMatrix4x4 monitorMatrix = logicalToNativeMatrix(geometry(), scale(), transform());
const QSize surfaceSize = m_gpu->cursorSize() / scale();
const QRect cursorRect = monitorMatrix.mapRect(QRect(cursor->geometry().topLeft(), surfaceSize));
const QRect cursorRect = monitorMatrix.mapRect(cursor->geometry());
if (cursorRect.width() > m_gpu->cursorSize().width() || cursorRect.height() > m_gpu->cursorSize().height()) {
if (layer->isVisible()) {
layer->setVisible(false);
......@@ -142,10 +140,12 @@ void DrmOutput::updateCursor()
} else {
renderCursorQPainter();
}
layer->setPosition(cursorRect.topLeft());
const QSize surfaceSize = m_gpu->cursorSize() / scale();
const QRect layerRect = monitorMatrix.mapRect(QRect(cursor->geometry().topLeft(), surfaceSize));
layer->setPosition(layerRect.topLeft());
layer->setVisible(cursor->geometry().intersects(geometry()));
if (layer->isVisible()) {
m_setCursorSuccessful = m_pipeline->setCursor(logicalToNativeMatrix(QRect(QPoint(), cursorRect.size()), scale(), transform()).map(cursor->hotspot()));
m_setCursorSuccessful = m_pipeline->setCursor(logicalToNativeMatrix(QRect(QPoint(), layerRect.size()), scale(), transform()).map(cursor->hotspot()));
layer->setVisible(m_setCursorSuccessful);
}
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment