mirror of https://github.com/hyprwm/Hyprland
use logical size for inputmgr
This commit is contained in:
parent
2d7ae9f4ed
commit
85081fc75a
|
@ -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;
|
||||
}
|
|
@ -176,6 +176,7 @@ struct SConstraint {
|
|||
|
||||
CRegion getLogicCoordsRegion();
|
||||
Vector2D getLogicConstraintPos();
|
||||
Vector2D getLogicConstraintSize();
|
||||
|
||||
bool operator==(const SConstraint& b) const {
|
||||
return constraint == b.constraint;
|
||||
|
|
|
@ -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.
|
||||
|
|
Loading…
Reference in New Issue