This commit is contained in:
Ching Pei Yang 2025-12-18 21:49:54 +01:00 committed by GitHub
commit 153fc869ff
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 10 additions and 10 deletions

View file

@ -196,7 +196,7 @@ void CInputManager::sendMotionEventsToFocused() {
g_pSeatManager->setPointerFocus(Desktop::focusState()->surface(), m_lastCursorPosFloored - BOX->pos()); g_pSeatManager->setPointerFocus(Desktop::focusState()->surface(), m_lastCursorPosFloored - BOX->pos());
} }
void CInputManager::mouseMoveUnified(uint32_t time, bool refocus, bool mouse, std::optional<Vector2D> overridePos) { void CInputManager::mouseMoveUnified(uint32_t time, bool refocus, bool mouse, std::optional<Vector2D> overridePos, std::optional<PHLMONITOR> monitor) {
m_lastInputMouse = mouse; m_lastInputMouse = mouse;
if (!g_pCompositor->m_readyToProcess || g_pCompositor->m_isShuttingDown || g_pCompositor->m_unsafeState) if (!g_pCompositor->m_readyToProcess || g_pCompositor->m_isShuttingDown || g_pCompositor->m_unsafeState)
@ -237,7 +237,7 @@ void CInputManager::mouseMoveUnified(uint32_t time, bool refocus, bool mouse, st
m_lastCursorPosFloored = MOUSECOORDSFLOORED; m_lastCursorPosFloored = MOUSECOORDSFLOORED;
const auto PMONITOR = isLocked() && Desktop::focusState()->monitor() ? Desktop::focusState()->monitor() : g_pCompositor->getMonitorFromCursor(); const auto PMONITOR = monitor ? monitor.value() : isLocked() && Desktop::focusState()->monitor() ? Desktop::focusState()->monitor() : g_pCompositor->getMonitorFromCursor();
// this can happen if there are no displays hooked up to Hyprland // this can happen if there are no displays hooked up to Hyprland
if (PMONITOR == nullptr) if (PMONITOR == nullptr)
@ -1566,8 +1566,8 @@ bool CInputManager::shouldIgnoreVirtualKeyboard(SP<IKeyboard> pKeyboard) {
return DISALLOWACTION; return DISALLOWACTION;
} }
void CInputManager::refocus(std::optional<Vector2D> overridePos) { void CInputManager::refocus(std::optional<Vector2D> overridePos, std::optional<PHLMONITOR> monitor) {
mouseMoveUnified(0, true, false, overridePos); mouseMoveUnified(0, true, false, overridePos, monitor);
} }
bool CInputManager::refocusLastWindow(PHLMONITOR pMonitor) { bool CInputManager::refocusLastWindow(PHLMONITOR pMonitor) {

View file

@ -117,7 +117,7 @@ class CInputManager {
bool isLocked(); bool isLocked();
Vector2D getMouseCoordsInternal(); Vector2D getMouseCoordsInternal();
void refocus(std::optional<Vector2D> overridePos = std::nullopt); void refocus(std::optional<Vector2D> overridePos = std::nullopt, std::optional<PHLMONITOR> monitor = std::nullopt);
bool refocusLastWindow(PHLMONITOR pMonitor); bool refocusLastWindow(PHLMONITOR pMonitor);
void simulateMouseMovement(); void simulateMouseMovement();
void sendMotionEventsToFocused(); void sendMotionEventsToFocused();
@ -244,12 +244,12 @@ class CInputManager {
uint32_t m_capabilities = 0; uint32_t m_capabilities = 0;
void mouseMoveUnified(uint32_t, bool refocus = false, bool mouse = false, std::optional<Vector2D> overridePos = std::nullopt); void mouseMoveUnified(uint32_t, bool refocus = false, bool mouse = false, std::optional<Vector2D> overridePos = std::nullopt, std::optional<PHLMONITOR> monitor = std::nullopt);
void recheckMouseWarpOnMouseInput(); void recheckMouseWarpOnMouseInput();
SP<CTabletTool> ensureTabletToolPresent(SP<Aquamarine::ITabletTool>); SP<CTabletTool> ensureTabletToolPresent(SP<Aquamarine::ITabletTool>);
void applyConfigToKeyboard(SP<IKeyboard>); void applyConfigToKeyboard(SP<IKeyboard>);
// this will be set after a refocus() // this will be set after a refocus()
WP<CWLSurfaceResource> m_foundSurfaceToFocus; WP<CWLSurfaceResource> m_foundSurfaceToFocus;

View file

@ -30,7 +30,7 @@ void CInputManager::onTouchDown(ITouch::SDownEvent e) {
const auto TOUCH_COORDS = PMONITOR->m_position + (e.pos * PMONITOR->m_size); const auto TOUCH_COORDS = PMONITOR->m_position + (e.pos * PMONITOR->m_size);
refocus(TOUCH_COORDS); refocus(TOUCH_COORDS, PMONITOR);
if (m_clickBehavior == CLICKMODE_KILL) { if (m_clickBehavior == CLICKMODE_KILL) {
IPointer::SButtonEvent e; IPointer::SButtonEvent e;