diff options
| author | xDarksome <dev@darkso.me> | 2022-08-18 22:24:00 +0300 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-08-18 22:24:00 +0300 |
| commit | 4af95d42537e32805e4f679715dc3e763c15e328 (patch) | |
| tree | cb604942fb011c9a5755a8a3a2fb625bac08bdab /src/managers/input/Touch.cpp | |
| parent | 844c33c9801177adf65ea7ed163a8a6df36a9a37 (diff) | |
| parent | ece3ac97f932b1f39314cf63ec8e9abb5172104e (diff) | |
Merge branch 'hyprwm:main' into main
Diffstat (limited to 'src/managers/input/Touch.cpp')
| -rw-r--r-- | src/managers/input/Touch.cpp | 21 |
1 files changed, 14 insertions, 7 deletions
diff --git a/src/managers/input/Touch.cpp b/src/managers/input/Touch.cpp index 0b3c8961..daf34200 100644 --- a/src/managers/input/Touch.cpp +++ b/src/managers/input/Touch.cpp @@ -10,9 +10,16 @@ void CInputManager::onTouchDown(wlr_touch_down_event* e) { m_sTouchData.touchFocusWindow = nullptr; if (g_pCompositor->windowValidMapped(g_pCompositor->m_pLastWindow)) { - wlr_seat_touch_notify_down(g_pCompositor->m_sSeat.seat, g_pCompositor->m_pLastFocus, e->time_msec, e->touch_id, - e->x * g_pCompositor->m_pLastMonitor->vecSize.x + g_pCompositor->m_pLastMonitor->vecPosition.x - g_pCompositor->m_pLastWindow->m_vRealPosition.vec().x, - e->y * g_pCompositor->m_pLastMonitor->vecSize.y + g_pCompositor->m_pLastMonitor->vecPosition.y - g_pCompositor->m_pLastWindow->m_vRealPosition.vec().y); + Vector2D local; + if (g_pCompositor->m_pLastWindow->m_bIsX11) { + local = g_pInputManager->getMouseCoordsInternal() - g_pCompositor->m_pLastWindow->m_vRealPosition.goalv(); + } else { + g_pCompositor->vectorWindowToSurface(g_pInputManager->getMouseCoordsInternal(), g_pCompositor->m_pLastWindow, local); + } + + m_sTouchData.touchSurfaceOrigin = g_pInputManager->getMouseCoordsInternal() - local; + + wlr_seat_touch_notify_down(g_pCompositor->m_sSeat.seat, g_pCompositor->m_pLastFocus, e->time_msec, e->touch_id, local.x, local.y); m_sTouchData.touchFocusWindow = g_pCompositor->m_pLastWindow; } @@ -29,10 +36,10 @@ void CInputManager::onTouchMove(wlr_touch_motion_event* e){ if (g_pCompositor->windowValidMapped(m_sTouchData.touchFocusWindow)) { const auto PMONITOR = g_pCompositor->getMonitorFromID(m_sTouchData.touchFocusWindow->m_iMonitorID); - wlr_seat_touch_notify_motion(g_pCompositor->m_sSeat.seat, e->time_msec, e->touch_id, - e->x * PMONITOR->vecSize.x + PMONITOR->vecPosition.x - m_sTouchData.touchFocusWindow->m_vRealPosition.vec().x, - e->y * PMONITOR->vecSize.y + PMONITOR->vecPosition.y - m_sTouchData.touchFocusWindow->m_vRealPosition.vec().y); - wlr_cursor_warp(g_pCompositor->m_sWLRCursor, g_pCompositor->m_sSeat.mouse->mouse, PMONITOR->vecPosition.x + e->x * PMONITOR->vecSize.x, PMONITOR->vecPosition.y + e->y * PMONITOR->vecSize.y); + + const auto local = g_pInputManager->getMouseCoordsInternal() - m_sTouchData.touchSurfaceOrigin; + + wlr_seat_touch_notify_motion(g_pCompositor->m_sSeat.seat, e->time_msec, e->touch_id, local.x, local.y); } }
\ No newline at end of file |
