Fix locks and clean up CPointerManager::damageIfSoftware

This commit is contained in:
Szwagi 2025-12-19 10:26:33 +00:00
parent ee471d11cd
commit 1198f83d8f

View file

@ -744,16 +744,20 @@ void CPointerManager::damageIfSoftware() {
auto b = getCursorBoxGlobal().expand(4); auto b = getCursorBoxGlobal().expand(4);
for (auto const& mw : m_monitorStates) { for (auto const& mw : m_monitorStates) {
auto monitor = mw->monitor; auto monitor = mw->monitor.lock();
if (monitor.expired() || !monitor->m_output || monitor->isMirror()) if (!monitor || !monitor->m_output || monitor->isMirror())
continue; continue;
if ((mw->softwareLocks > 0 || mw->hardwareFailed || g_pConfigManager->shouldUseSoftwareCursors(mw->monitor.lock())) && auto usesSoftwareCursor = (mw->softwareLocks > 0 || mw->hardwareFailed || g_pConfigManager->shouldUseSoftwareCursors(monitor));
b.overlaps({mw->monitor->m_position, mw->monitor->m_size}) && !mw->monitor->shouldSkipScheduleFrameOnMouseEvent()) { if (!usesSoftwareCursor)
continue;
CBox damageBox = b.copy().translate(-monitor->m_position).scale(monitor->m_scale).round(); auto shouldAddDamage = !monitor->shouldSkipScheduleFrameOnMouseEvent() && b.overlaps({monitor->m_position, monitor->m_size});
mw->monitor->addDamage(damageBox); if (!shouldAddDamage)
} continue;
CBox damageBox = b.copy().translate(-monitor->m_position).scale(monitor->m_scale).round();
monitor->addDamage(damageBox);
} }
} }