platforms/drm: Remove redundant args in DrmBackend::moveCursor()

Similar to the cursor image, the cursor position can be retrieved by
checking Cursors::self()->currentCursor()->pos().
This commit is contained in:
Vlad Zahorodnii 2020-10-27 13:50:06 +02:00
parent 73f335adc2
commit 7372efffc6
4 changed files with 9 additions and 10 deletions

View file

@ -171,15 +171,13 @@ void DrmBackend::reactivate()
}
m_active = true;
if (!usesSoftwareCursor()) {
Cursor* cursor = Cursors::self()->mouse();
const QPoint cp = cursor->pos() - cursor->hotspot();
for (auto it = m_outputs.constBegin(); it != m_outputs.constEnd(); ++it) {
DrmOutput *o = *it;
// only relevant in atomic mode
o->m_modesetRequested = true;
o->m_crtc->blank();
o->showCursor();
o->moveCursor(cursor, cp);
o->moveCursor();
}
}
// restart compositor
@ -561,7 +559,7 @@ void DrmBackend::updateCursor()
setCursor();
moveCursor(cursor, cursor->pos());
moveCursor();
}
void DrmBackend::doShowCursor()
@ -579,13 +577,13 @@ void DrmBackend::doHideCursor()
}
}
void DrmBackend::moveCursor(Cursor *cursor, const QPoint &pos)
void DrmBackend::moveCursor()
{
if (isCursorHidden() || usesSoftwareCursor()) {
return;
}
for (auto it = m_outputs.constBegin(); it != m_outputs.constEnd(); ++it) {
(*it)->moveCursor(cursor, pos);
(*it)->moveCursor();
}
}

View file

@ -100,7 +100,7 @@ private:
bool updateOutputs();
void setCursor();
void updateCursor();
void moveCursor(Cursor *cursor, const QPoint &pos);
void moveCursor();
void initCursor();
void readOutputsConfiguration();
void writeOutputsConfiguration();

View file

@ -152,12 +152,13 @@ void DrmOutput::updateCursor()
p.end();
}
void DrmOutput::moveCursor(Cursor *cursor, const QPoint &globalPos)
void DrmOutput::moveCursor()
{
Cursor *cursor = Cursors::self()->currentCursor();
const QMatrix4x4 hotspotMatrix = logicalToNativeMatrix(cursor->rect(), scale(), transform());
const QMatrix4x4 monitorMatrix = logicalToNativeMatrix(geometry(), scale(), transform());
QPoint pos = monitorMatrix.map(globalPos);
QPoint pos = monitorMatrix.map(cursor->pos());
pos -= hotspotMatrix.map(cursor->hotspot());
drmModeMoveCursor(m_gpu->fd(), m_crtc->id(), pos.x(), pos.y());

View file

@ -46,7 +46,7 @@ public:
bool showCursor();
bool hideCursor();
void updateCursor();
void moveCursor(Cursor *cursor, const QPoint &globalPos);
void moveCursor();
bool init(drmModeConnector *connector);
bool present(DrmBuffer *buffer);
void pageFlipped();