mirror of
https://github.com/hyprwm/Hyprland
synced 2024-11-23 02:45:58 +01:00
pointer: use software rendering when monitor is mirrored (#6587)
* pointer_manager: add lock/unlock software wrappers that receive the raw pointer * monitor: lock/unlock software pointer rendering when adding/removing mirrored screens * use relative path in includes
This commit is contained in:
parent
fb15b7aa2a
commit
20a465f69d
3 changed files with 30 additions and 0 deletions
|
@ -6,6 +6,7 @@
|
||||||
#include "../devices/ITouch.hpp"
|
#include "../devices/ITouch.hpp"
|
||||||
#include "../protocols/LayerShell.hpp"
|
#include "../protocols/LayerShell.hpp"
|
||||||
#include "../protocols/PresentationTime.hpp"
|
#include "../protocols/PresentationTime.hpp"
|
||||||
|
#include "../managers/PointerManager.hpp"
|
||||||
#include <hyprutils/string/String.hpp>
|
#include <hyprutils/string/String.hpp>
|
||||||
using namespace Hyprutils::String;
|
using namespace Hyprutils::String;
|
||||||
|
|
||||||
|
@ -248,6 +249,9 @@ void CMonitor::onDisconnect(bool destroy) {
|
||||||
// remove mirror
|
// remove mirror
|
||||||
if (pMirrorOf) {
|
if (pMirrorOf) {
|
||||||
pMirrorOf->mirrors.erase(std::find_if(pMirrorOf->mirrors.begin(), pMirrorOf->mirrors.end(), [&](const auto& other) { return other == this; }));
|
pMirrorOf->mirrors.erase(std::find_if(pMirrorOf->mirrors.begin(), pMirrorOf->mirrors.end(), [&](const auto& other) { return other == this; }));
|
||||||
|
|
||||||
|
// unlock software for mirrored monitor
|
||||||
|
g_pPointerManager->unlockSoftwareForMonitor(pMirrorOf);
|
||||||
pMirrorOf = nullptr;
|
pMirrorOf = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -471,6 +475,9 @@ void CMonitor::setMirror(const std::string& mirrorOf) {
|
||||||
|
|
||||||
if (pMirrorOf) {
|
if (pMirrorOf) {
|
||||||
pMirrorOf->mirrors.erase(std::find_if(pMirrorOf->mirrors.begin(), pMirrorOf->mirrors.end(), [&](const auto& other) { return other == this; }));
|
pMirrorOf->mirrors.erase(std::find_if(pMirrorOf->mirrors.begin(), pMirrorOf->mirrors.end(), [&](const auto& other) { return other == this; }));
|
||||||
|
|
||||||
|
// unlock software for mirrored monitor
|
||||||
|
g_pPointerManager->unlockSoftwareForMonitor(pMirrorOf);
|
||||||
}
|
}
|
||||||
|
|
||||||
pMirrorOf = nullptr;
|
pMirrorOf = nullptr;
|
||||||
|
@ -540,6 +547,9 @@ void CMonitor::setMirror(const std::string& mirrorOf) {
|
||||||
g_pCompositor->setActiveMonitor(g_pCompositor->m_vMonitors.front().get());
|
g_pCompositor->setActiveMonitor(g_pCompositor->m_vMonitors.front().get());
|
||||||
|
|
||||||
g_pCompositor->sanityCheckWorkspaces();
|
g_pCompositor->sanityCheckWorkspaces();
|
||||||
|
|
||||||
|
// Software lock mirrored monitor
|
||||||
|
g_pPointerManager->lockSoftwareForMonitor(PMIRRORMON);
|
||||||
}
|
}
|
||||||
|
|
||||||
events.modeChanged.emit();
|
events.modeChanged.emit();
|
||||||
|
|
|
@ -164,6 +164,15 @@ void CPointerManager::unlockSoftwareAll() {
|
||||||
updateCursorBackend();
|
updateCursorBackend();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CPointerManager::lockSoftwareForMonitor(CMonitor* Monitor) {
|
||||||
|
for (auto& m : g_pCompositor->m_vMonitors) {
|
||||||
|
if (m->ID == Monitor->ID) {
|
||||||
|
lockSoftwareForMonitor(m);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void CPointerManager::lockSoftwareForMonitor(SP<CMonitor> mon) {
|
void CPointerManager::lockSoftwareForMonitor(SP<CMonitor> mon) {
|
||||||
auto state = stateFor(mon);
|
auto state = stateFor(mon);
|
||||||
state->softwareLocks++;
|
state->softwareLocks++;
|
||||||
|
@ -172,6 +181,15 @@ void CPointerManager::lockSoftwareForMonitor(SP<CMonitor> mon) {
|
||||||
updateCursorBackend();
|
updateCursorBackend();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CPointerManager::unlockSoftwareForMonitor(CMonitor* Monitor) {
|
||||||
|
for (auto& m : g_pCompositor->m_vMonitors) {
|
||||||
|
if (m->ID == Monitor->ID) {
|
||||||
|
unlockSoftwareForMonitor(m);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void CPointerManager::unlockSoftwareForMonitor(SP<CMonitor> mon) {
|
void CPointerManager::unlockSoftwareForMonitor(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 lockSoftwareForMonitor(CMonitor* pMonitor);
|
||||||
|
void unlockSoftwareForMonitor(CMonitor* pMonitor);
|
||||||
void lockSoftwareAll();
|
void lockSoftwareAll();
|
||||||
void unlockSoftwareAll();
|
void unlockSoftwareAll();
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue