mirror of
https://github.com/hyprwm/Hyprland.git
synced 2024-12-27 17:55:24 +03:00
renderer: properly software lock cursors with zoom_factor (#6434)
This commit is contained in:
parent
a99f314106
commit
38132ffaf5
@ -150,6 +150,20 @@ CPointerManager::CPointerManager() {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CPointerManager::lockSoftwareAll() {
|
||||||
|
for (auto& state : monitorStates)
|
||||||
|
state->softwareLocks++;
|
||||||
|
|
||||||
|
updateCursorBackend();
|
||||||
|
}
|
||||||
|
|
||||||
|
void CPointerManager::unlockSoftwareAll() {
|
||||||
|
for (auto& state : monitorStates)
|
||||||
|
state->softwareLocks--;
|
||||||
|
|
||||||
|
updateCursorBackend();
|
||||||
|
}
|
||||||
|
|
||||||
void CPointerManager::lockSoftwareForMonitor(SP<CMonitor> mon) {
|
void CPointerManager::lockSoftwareForMonitor(SP<CMonitor> mon) {
|
||||||
auto state = stateFor(mon);
|
auto state = stateFor(mon);
|
||||||
state->softwareLocks++;
|
state->softwareLocks++;
|
||||||
|
@ -43,6 +43,8 @@ class CPointerManager {
|
|||||||
|
|
||||||
void lockSoftwareForMonitor(SP<CMonitor> pMonitor);
|
void lockSoftwareForMonitor(SP<CMonitor> pMonitor);
|
||||||
void unlockSoftwareForMonitor(SP<CMonitor> pMonitor);
|
void unlockSoftwareForMonitor(SP<CMonitor> pMonitor);
|
||||||
|
void lockSoftwareAll();
|
||||||
|
void unlockSoftwareAll();
|
||||||
|
|
||||||
void renderSoftwareCursorsFor(SP<CMonitor> pMonitor, timespec* now, CRegion& damage /* logical */, std::optional<Vector2D> overridePos = {} /* monitor-local */);
|
void renderSoftwareCursorsFor(SP<CMonitor> pMonitor, timespec* now, CRegion& damage /* logical */, std::optional<Vector2D> overridePos = {} /* monitor-local */);
|
||||||
|
|
||||||
|
@ -1253,6 +1253,15 @@ void CHyprRenderer::renderMonitor(CMonitor* pMonitor) {
|
|||||||
|
|
||||||
TRACY_GPU_ZONE("Render");
|
TRACY_GPU_ZONE("Render");
|
||||||
|
|
||||||
|
static bool zoomLock = false;
|
||||||
|
if (zoomLock && *PZOOMFACTOR == 1.f) {
|
||||||
|
g_pPointerManager->unlockSoftwareAll();
|
||||||
|
zoomLock = false;
|
||||||
|
} else if (!zoomLock && *PZOOMFACTOR != 1.f) {
|
||||||
|
g_pPointerManager->lockSoftwareAll();
|
||||||
|
zoomLock = true;
|
||||||
|
}
|
||||||
|
|
||||||
if (pMonitor == g_pCompositor->getMonitorFromCursor())
|
if (pMonitor == g_pCompositor->getMonitorFromCursor())
|
||||||
g_pHyprOpenGL->m_RenderData.mouseZoomFactor = std::clamp(*PZOOMFACTOR, 1.f, INFINITY);
|
g_pHyprOpenGL->m_RenderData.mouseZoomFactor = std::clamp(*PZOOMFACTOR, 1.f, INFINITY);
|
||||||
else
|
else
|
||||||
@ -1265,10 +1274,6 @@ void CHyprRenderer::renderMonitor(CMonitor* pMonitor) {
|
|||||||
pMonitor->forceFullFrames = 10;
|
pMonitor->forceFullFrames = 10;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool lockSoftware = pMonitor == g_pCompositor->getMonitorFromCursor() && *PZOOMFACTOR != 1.f;
|
|
||||||
if (lockSoftware)
|
|
||||||
g_pPointerManager->lockSoftwareForMonitor(pMonitor->self.lock());
|
|
||||||
|
|
||||||
CRegion damage, finalDamage;
|
CRegion damage, finalDamage;
|
||||||
if (!beginRender(pMonitor, damage, RENDER_MODE_NORMAL)) {
|
if (!beginRender(pMonitor, damage, RENDER_MODE_NORMAL)) {
|
||||||
Debug::log(ERR, "renderer: couldn't beginRender()!");
|
Debug::log(ERR, "renderer: couldn't beginRender()!");
|
||||||
@ -1370,9 +1375,6 @@ void CHyprRenderer::renderMonitor(CMonitor* pMonitor) {
|
|||||||
|
|
||||||
endRender();
|
endRender();
|
||||||
|
|
||||||
if (lockSoftware)
|
|
||||||
g_pPointerManager->unlockSoftwareForMonitor(pMonitor->self.lock());
|
|
||||||
|
|
||||||
TRACY_GPU_COLLECT;
|
TRACY_GPU_COLLECT;
|
||||||
|
|
||||||
if (!pMonitor->mirrors.empty()) {
|
if (!pMonitor->mirrors.empty()) {
|
||||||
|
Loading…
Reference in New Issue
Block a user