diff --git a/src/protocols/PointerConstraints.cpp b/src/protocols/PointerConstraints.cpp index 30ab0a55..6f1ee837 100644 --- a/src/protocols/PointerConstraints.cpp +++ b/src/protocols/PointerConstraints.cpp @@ -7,6 +7,7 @@ #include "../managers/input/InputManager.hpp" #include "../render/Renderer.hpp" #include "../helpers/Monitor.hpp" +#include "../xwayland/XWayland.hpp" CPointerConstraint::CPointerConstraint(SP resource_, SP surf, wl_resource* region_, zwpPointerConstraintsV1Lifetime lifetime_) : resourceL(resource_), locked(true), lifetime(lifetime_) { @@ -37,7 +38,7 @@ CPointerConstraint::CPointerConstraint(SP resource_, SPgetWindow(); if (PWINDOW) { const auto ISXWL = PWINDOW->m_bIsX11; - scale = ISXWL && *PXWLFORCESCALEZERO ? PWINDOW->m_fX11SurfaceScaledBy : 1.f; + scale = ISXWL ? (*PXWLFORCESCALEZERO ? PWINDOW->m_fX11SurfaceScaledBy : g_pXWayland->pWM->getScale()) : scale; } positionHint = {wl_fixed_to_double(x) / scale, wl_fixed_to_double(y) / scale}; diff --git a/src/xwayland/XWM.cpp b/src/xwayland/XWM.cpp index beb20286..2d45c847 100644 --- a/src/xwayland/XWM.cpp +++ b/src/xwayland/XWM.cpp @@ -1333,6 +1333,10 @@ double CXWM::applyScale(double val) { return std::floor(val * scale); } +double CXWM::getScale() { + return scale; +} + double CXWM::applyUnScale(double val) { return std::ceil(val / scale); } diff --git a/src/xwayland/XWM.hpp b/src/xwayland/XWM.hpp index 85f57690..c3504fbb 100644 --- a/src/xwayland/XWM.hpp +++ b/src/xwayland/XWM.hpp @@ -112,6 +112,7 @@ class CXWM { int onEvent(int fd, uint32_t mask); SP getDataDevice(); SP createX11DataOffer(SP surf, SP source); + double getScale(); private: void setCursor(unsigned char* pixData, uint32_t stride, const Vector2D& size, const Vector2D& hotspot); @@ -175,8 +176,8 @@ class CXWM { SXSelection* getSelection(xcb_atom_t atom); - double applyScale(double val); - double applyUnScale(double val); + double applyScale(double val); + double applyUnScale(double val); // CXCBConnection connection;