diff options
| author | vaxerski <43317083+vaxerski@users.noreply.github.com> | 2022-03-18 23:52:36 +0100 |
|---|---|---|
| committer | vaxerski <43317083+vaxerski@users.noreply.github.com> | 2022-03-18 23:52:36 +0100 |
| commit | 625e4ce264554e32975cb5f9e1d18b22640b56e6 (patch) | |
| tree | df698067896c5e6053f7c6c3005ae8762b761df9 /src/managers/InputManager.cpp | |
| parent | 5971576a50986646d7af301d8221e049f39ddb0b (diff) | |
fixed rendering
Diffstat (limited to 'src/managers/InputManager.cpp')
| -rw-r--r-- | src/managers/InputManager.cpp | 34 |
1 files changed, 27 insertions, 7 deletions
diff --git a/src/managers/InputManager.cpp b/src/managers/InputManager.cpp index c856f031..1b438ba9 100644 --- a/src/managers/InputManager.cpp +++ b/src/managers/InputManager.cpp @@ -15,20 +15,40 @@ void CInputManager::onMouseMoved(wlr_event_pointer_motion* e) { wlr_cursor_move(g_pCompositor->m_sWLRCursor, e->device, delta.floor().x, delta.floor().y); } - - if (e->time_msec) - wlr_idle_notify_activity(g_pCompositor->m_sWLRIdle, g_pCompositor->m_sWLRSeat); - - - g_pCompositor->focusWindow(g_pCompositor->vectorToWindow(getMouseCoordsInternal())); + mouseMoveUnified(e->time_msec); // todo: pointer } void CInputManager::onMouseWarp(wlr_event_pointer_motion_absolute* e) { wlr_cursor_warp_absolute(g_pCompositor->m_sWLRCursor, e->device, e->x, e->y); - if (e->time_msec) + m_vMouseCoords = Vector2D(e->x, e->y); + m_vWLRMouseCoords = m_vMouseCoords; + + mouseMoveUnified(e->time_msec); +} + +void CInputManager::mouseMoveUnified(uint32_t time) { + + const auto PWINDOW = g_pCompositor->vectorToWindow(m_vMouseCoords); + + if (!PWINDOW) { + wlr_xcursor_manager_set_cursor_image(g_pCompositor->m_sWLRXCursorMgr, "left_ptr", g_pCompositor->m_sWLRCursor); + + wlr_seat_pointer_clear_focus(g_pCompositor->m_sWLRSeat); + + return; + } + + if (time) wlr_idle_notify_activity(g_pCompositor->m_sWLRIdle, g_pCompositor->m_sWLRSeat); + + g_pCompositor->focusWindow(PWINDOW); + + Vector2D surfaceLocal = m_vMouseCoords - PWINDOW->m_vPosition; + + wlr_seat_pointer_notify_enter(g_pCompositor->m_sWLRSeat, g_pXWaylandManager->getWindowSurface(PWINDOW), surfaceLocal.x, surfaceLocal.y); + wlr_seat_pointer_notify_motion(g_pCompositor->m_sWLRSeat, time, surfaceLocal.x, surfaceLocal.y); } void CInputManager::onMouseButton(wlr_event_pointer_button* e) { |
