aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorvaxerski <[email protected]>2023-09-20 11:44:37 +0100
committervaxerski <[email protected]>2023-09-20 11:44:37 +0100
commit85081fc75a73c55424c68cf8d564e81f27b14d44 (patch)
treedc3389eed36410cc7a4c6f87288b9e3515f42a46
parent2d7ae9f4edebc35bed15d21b26a621a3f43de296 (diff)
downloadHyprland-85081fc75a73c55424c68cf8d564e81f27b14d44.tar.gz
Hyprland-85081fc75a73c55424c68cf8d564e81f27b14d44.zip
use logical size for inputmgr
-rw-r--r--src/helpers/WLClasses.cpp25
-rw-r--r--src/helpers/WLClasses.hpp1
-rw-r--r--src/managers/input/InputManager.cpp3
3 files changed, 27 insertions, 2 deletions
diff --git a/src/helpers/WLClasses.cpp b/src/helpers/WLClasses.cpp
index 455dd890..1fa807fa 100644
--- a/src/helpers/WLClasses.cpp
+++ b/src/helpers/WLClasses.cpp
@@ -90,3 +90,28 @@ Vector2D SConstraint::getLogicConstraintPos() {
return COORDS;
}
+
+Vector2D SConstraint::getLogicConstraintSize() {
+ if (!constraint)
+ return {};
+
+ const auto PWINDOWOWNER = g_pCompositor->getWindowFromSurface(constraint->surface);
+
+ if (!PWINDOWOWNER)
+ return {};
+
+ if (!PWINDOWOWNER->m_bIsX11)
+ return PWINDOWOWNER->m_vRealSize.goalv();
+
+ const auto PMONITOR = PWINDOWOWNER->m_bIsMapped ?
+ g_pCompositor->getMonitorFromID(PWINDOWOWNER->m_iMonitorID) :
+ g_pCompositor->getMonitorFromVector(g_pXWaylandManager->xwaylandToWaylandCoords({PWINDOWOWNER->m_uSurface.xwayland->x, PWINDOWOWNER->m_uSurface.xwayland->y}));
+
+ if (!PMONITOR)
+ return {};
+
+ const auto SIZE = PWINDOWOWNER->m_bIsMapped ? PWINDOWOWNER->m_vRealSize.goalv() :
+ Vector2D{PWINDOWOWNER->m_uSurface.xwayland->width, PWINDOWOWNER->m_uSurface.xwayland->height} * PMONITOR->xwaylandScale;
+
+ return SIZE;
+} \ No newline at end of file
diff --git a/src/helpers/WLClasses.hpp b/src/helpers/WLClasses.hpp
index 2c6a6781..d66ebdfd 100644
--- a/src/helpers/WLClasses.hpp
+++ b/src/helpers/WLClasses.hpp
@@ -176,6 +176,7 @@ struct SConstraint {
CRegion getLogicCoordsRegion();
Vector2D getLogicConstraintPos();
+ Vector2D getLogicConstraintSize();
bool operator==(const SConstraint& b) const {
return constraint == b.constraint;
diff --git a/src/managers/input/InputManager.cpp b/src/managers/input/InputManager.cpp
index 485fe6f6..ec1534d5 100644
--- a/src/managers/input/InputManager.cpp
+++ b/src/managers/input/InputManager.cpp
@@ -145,8 +145,7 @@ void CInputManager::mouseMoveUnified(uint32_t time, bool refocus) {
// Native Wayland apps know how 2 constrain themselves.
// XWayland, we just have to accept them. Might cause issues, but thats XWayland for ya.
const auto CONSTRAINTPOS = PCONSTRAINT->getLogicConstraintPos();
- const auto CONSTRAINTSIZE = CONSTRAINTWINDOW->m_bIsX11 ? Vector2D(CONSTRAINTWINDOW->m_uSurface.xwayland->width, CONSTRAINTWINDOW->m_uSurface.xwayland->height) :
- CONSTRAINTWINDOW->m_vRealSize.vec();
+ const auto CONSTRAINTSIZE = PCONSTRAINT->getLogicConstraintSize();
if (g_pCompositor->m_sSeat.mouse->currentConstraint->type == WLR_POINTER_CONSTRAINT_V1_LOCKED) {
// we just snap the cursor to where it should be.