diff options
author | Vaxry <[email protected]> | 2024-07-29 18:13:17 +0200 |
---|---|---|
committer | Vaxry <[email protected]> | 2024-07-29 18:13:23 +0200 |
commit | 01560c9d7ccd0beec1a9c190862ee325e6f3c45e (patch) | |
tree | 91698ae326e51d651e8a974979f56fc878f2c425 | |
parent | 3a1afb53fdc75d6bfb434fb5ff29ab43ce6b040a (diff) | |
download | Hyprland-01560c9d7ccd0beec1a9c190862ee325e6f3c45e.tar.gz Hyprland-01560c9d7ccd0beec1a9c190862ee325e6f3c45e.zip |
virtualptr: map to entire screen if no output is provided
fixes #6749
-rw-r--r-- | src/devices/VirtualPointer.cpp | 2 | ||||
-rw-r--r-- | src/managers/PointerManager.cpp | 20 |
2 files changed, 19 insertions, 3 deletions
diff --git a/src/devices/VirtualPointer.cpp b/src/devices/VirtualPointer.cpp index 9223ebe1..7ad18775 100644 --- a/src/devices/VirtualPointer.cpp +++ b/src/devices/VirtualPointer.cpp @@ -38,7 +38,7 @@ CVirtualPointer::CVirtualPointer(SP<CVirtualPointerV1Resource> resource) : point listeners.holdBegin = pointer->events.holdBegin.registerListener([this](std::any d) { pointerEvents.holdBegin.emit(d); }); listeners.holdEnd = pointer->events.holdEnd.registerListener([this](std::any d) { pointerEvents.holdEnd.emit(d); }); - boundOutput = resource->boundOutput ? resource->boundOutput->szName : "auto"; + boundOutput = resource->boundOutput ? resource->boundOutput->szName : "entire"; deviceName = pointer->name; } diff --git a/src/managers/PointerManager.cpp b/src/managers/PointerManager.cpp index 59c54c78..a09992a2 100644 --- a/src/managers/PointerManager.cpp +++ b/src/managers/PointerManager.cpp @@ -676,8 +676,24 @@ void CPointerManager::warpAbsolute(Vector2D abs, SP<IHID> dev) { } case HID_TYPE_POINTER: { IPointer* POINTER = reinterpret_cast<IPointer*>(dev.get()); - if (!POINTER->boundOutput.empty() && POINTER->boundOutput != "auto") { - if (const auto PMONITOR = g_pCompositor->getMonitorFromString(POINTER->boundOutput); PMONITOR) { + if (!POINTER->boundOutput.empty()) { + if (POINTER->boundOutput == "entire") { + // find x and y size of the entire space + Vector2D bottomRight = {-9999999, -9999999}, topLeft = {9999999, 9999999}; + for (auto& m : g_pCompositor->m_vMonitors) { + const auto EXTENT = m->logicalBox().extent(); + const auto POS = m->logicalBox().pos(); + if (EXTENT.x > bottomRight.x) + bottomRight.x = EXTENT.x; + if (EXTENT.y > bottomRight.y) + bottomRight.y = EXTENT.y; + if (POS.x < topLeft.x) + topLeft.x = POS.x; + if (POS.y < topLeft.y) + topLeft.y = POS.y; + } + mappedArea = {topLeft, bottomRight - topLeft}; + } else if (const auto PMONITOR = g_pCompositor->getMonitorFromString(POINTER->boundOutput); PMONITOR) { currentMonitor = PMONITOR->self.lock(); mappedArea = currentMonitor->logicalBox(); } |