Skip to content

Commit

Permalink
Adjust scale factor
Browse files Browse the repository at this point in the history
  • Loading branch information
PatrickTaibel committed Nov 24, 2023
1 parent 05d1819 commit 34bfb19
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/managers/input/InputManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1259,7 +1259,7 @@ void CInputManager::constrainMouse(SMouse* pMouse, wlr_pointer_constraint_v1* co
g_pXWaylandManager->xwaylandToWaylandCoords({PWINDOW->m_uSurface.xwayland->x, PWINDOW->m_uSurface.xwayland->y})) :
PWINDOW->m_vRealPosition.goalv();

PCONSTRAINT->cursorPosOnActivate = (MOUSECOORDS - RELATIVETO) * PWINDOW->m_fX11SurfaceScaledBy;
PCONSTRAINT->cursorPosOnActivate = (MOUSECOORDS - RELATIVETO) * PWINDOW->getX11ScaleFactor();
}

if (constraint->current.committed & WLR_POINTER_CONSTRAINT_V1_STATE_CURSOR_HINT) {
Expand Down
2 changes: 1 addition & 1 deletion src/managers/input/Tablets.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,7 @@ void CInputManager::focusTablet(STablet* pTab, wlr_tablet_tool* pTool, bool moti
auto local = CURSORPOS - PWINDOW->m_vRealPosition.goalv();

if (PWINDOW->m_bIsX11)
local = local * PWINDOW->m_fX11SurfaceScaledBy;
local = local * PWINDOW->getX11ScaleFactor();

wlr_tablet_v2_tablet_tool_notify_motion(PTOOL->wlrTabletToolV2, local.x, local.y);
}
Expand Down
4 changes: 2 additions & 2 deletions src/managers/input/Touch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ void CInputManager::onTouchDown(wlr_touch_down_event* e) {

if (m_sTouchData.touchFocusWindow) {
if (m_sTouchData.touchFocusWindow->m_bIsX11) {
local = (g_pInputManager->getMouseCoordsInternal() - m_sTouchData.touchFocusWindow->m_vRealPosition.goalv()) * m_sTouchData.touchFocusWindow->m_fX11SurfaceScaledBy;
local = (g_pInputManager->getMouseCoordsInternal() - m_sTouchData.touchFocusWindow->m_vRealPosition.goalv()) * m_sTouchData.touchFocusWindow->getX11ScaleFactor();
m_sTouchData.touchSurfaceOrigin = m_sTouchData.touchFocusWindow->m_vRealPosition.goalv();
} else {
g_pCompositor->vectorWindowToSurface(g_pInputManager->getMouseCoordsInternal(), m_sTouchData.touchFocusWindow, local);
Expand Down Expand Up @@ -69,7 +69,7 @@ void CInputManager::onTouchMove(wlr_touch_motion_event* e) {

auto local = g_pInputManager->getMouseCoordsInternal() - m_sTouchData.touchSurfaceOrigin;
if (m_sTouchData.touchFocusWindow->m_bIsX11)
local = local * m_sTouchData.touchFocusWindow->m_fX11SurfaceScaledBy;
local = local * m_sTouchData.touchFocusWindow->getX11ScaleFactor();

wlr_seat_touch_notify_motion(g_pCompositor->m_sSeat.seat, e->time_msec, e->touch_id, local.x, local.y);
wlr_seat_pointer_notify_motion(g_pCompositor->m_sSeat.seat, e->time_msec, local.x, local.y);
Expand Down

0 comments on commit 34bfb19

Please sign in to comment.