mirror of
https://github.com/hyprwm/Hyprland.git
synced 2025-08-05 14:42:01 -07:00
input: add warp_back_after_non_mouse_input
adds cursor:warp_back_after_non_mouse_input fixes #8675
This commit is contained in:
@@ -94,13 +94,19 @@ void CInputManager::onMouseMoved(IPointer::SMotionEvent e) {
|
||||
|
||||
PROTO::relativePointer->sendRelativeMotion((uint64_t)e.timeMs * 1000, DELTA, e.unaccel);
|
||||
|
||||
if (e.mouse)
|
||||
recheckMouseWarpOnMouseInput();
|
||||
|
||||
g_pPointerManager->move(DELTA);
|
||||
|
||||
mouseMoveUnified(e.timeMs);
|
||||
mouseMoveUnified(e.timeMs, false, e.mouse);
|
||||
|
||||
m_tmrLastCursorMovement.reset();
|
||||
|
||||
m_bLastInputTouch = false;
|
||||
|
||||
if (e.mouse)
|
||||
m_vLastMousePos = getMouseCoordsInternal();
|
||||
}
|
||||
|
||||
void CInputManager::onMouseWarp(IPointer::SMotionAbsoluteEvent e) {
|
||||
@@ -138,7 +144,9 @@ void CInputManager::sendMotionEventsToFocused() {
|
||||
g_pSeatManager->setPointerFocus(g_pCompositor->m_pLastFocus.lock(), LOCAL);
|
||||
}
|
||||
|
||||
void CInputManager::mouseMoveUnified(uint32_t time, bool refocus) {
|
||||
void CInputManager::mouseMoveUnified(uint32_t time, bool refocus, bool mouse) {
|
||||
m_bLastInputMouse = mouse;
|
||||
|
||||
if (!g_pCompositor->m_bReadyToProcess || g_pCompositor->m_bIsShuttingDown || g_pCompositor->m_bUnsafeState)
|
||||
return;
|
||||
|
||||
@@ -534,6 +542,9 @@ void CInputManager::mouseMoveUnified(uint32_t time, bool refocus) {
|
||||
void CInputManager::onMouseButton(IPointer::SButtonEvent e) {
|
||||
EMIT_HOOK_EVENT_CANCELLABLE("mouseButton", e);
|
||||
|
||||
if (e.mouse)
|
||||
recheckMouseWarpOnMouseInput();
|
||||
|
||||
m_tmrLastCursorMovement.reset();
|
||||
|
||||
if (e.state == WL_POINTER_BUTTON_STATE_PRESSED) {
|
||||
@@ -768,6 +779,9 @@ void CInputManager::onMouseWheel(IPointer::SAxisEvent e) {
|
||||
const auto EMAP = std::unordered_map<std::string, std::any>{{"event", e}};
|
||||
EMIT_HOOK_EVENT_CANCELLABLE("mouseAxis", EMAP);
|
||||
|
||||
if (e.mouse)
|
||||
recheckMouseWarpOnMouseInput();
|
||||
|
||||
bool passEvent = g_pKeybindManager->onAxisEvent(e);
|
||||
|
||||
if (!passEvent)
|
||||
@@ -1790,3 +1804,10 @@ void CInputManager::setCursorIconOnBorder(PHLWINDOW w) {
|
||||
case BORDERICON_DOWN_RIGHT: setCursorImageUntilUnset("bottom_right_corner"); break;
|
||||
}
|
||||
}
|
||||
|
||||
void CInputManager::recheckMouseWarpOnMouseInput() {
|
||||
static auto PWARPFORNONMOUSE = CConfigValue<Hyprlang::INT>("cursor:warp_back_after_non_mouse_input");
|
||||
|
||||
if (!m_bLastInputMouse && *PWARPFORNONMOUSE)
|
||||
g_pPointerManager->warpTo(m_vLastMousePos);
|
||||
}
|
||||
|
Reference in New Issue
Block a user