mirror of
https://github.com/hyprwm/Hyprland
synced 2024-12-23 04:29:48 +01:00
cleaner code
This commit is contained in:
parent
20ad9d3e7d
commit
1810725a0c
1 changed files with 87 additions and 89 deletions
|
@ -88,7 +88,9 @@ void CInputManager::mouseMoveUnified(uint32_t time, bool refocus) {
|
||||||
// focus
|
// focus
|
||||||
wlr_surface* foundSurface = nullptr;
|
wlr_surface* foundSurface = nullptr;
|
||||||
|
|
||||||
if (!didConstraintOnCursor) {
|
if (didConstraintOnCursor)
|
||||||
|
return; // don't process when cursor constrained
|
||||||
|
|
||||||
if (PMONITOR && PMONITOR != g_pCompositor->m_pLastMonitor) {
|
if (PMONITOR && PMONITOR != g_pCompositor->m_pLastMonitor) {
|
||||||
g_pCompositor->m_pLastMonitor = PMONITOR;
|
g_pCompositor->m_pLastMonitor = PMONITOR;
|
||||||
|
|
||||||
|
@ -157,7 +159,6 @@ void CInputManager::mouseMoveUnified(uint32_t time, bool refocus) {
|
||||||
if (!foundSurface)
|
if (!foundSurface)
|
||||||
foundSurface = g_pCompositor->vectorToLayerSurface(mouseCoords, &PMONITOR->m_aLayerSurfaceLists[ZWLR_LAYER_SHELL_V1_LAYER_BACKGROUND], &surfaceCoords);
|
foundSurface = g_pCompositor->vectorToLayerSurface(mouseCoords, &PMONITOR->m_aLayerSurfaceLists[ZWLR_LAYER_SHELL_V1_LAYER_BACKGROUND], &surfaceCoords);
|
||||||
|
|
||||||
|
|
||||||
if (!foundSurface) {
|
if (!foundSurface) {
|
||||||
wlr_xcursor_manager_set_cursor_image(g_pCompositor->m_sWLRXCursorMgr, "left_ptr", g_pCompositor->m_sWLRCursor);
|
wlr_xcursor_manager_set_cursor_image(g_pCompositor->m_sWLRXCursorMgr, "left_ptr", g_pCompositor->m_sWLRCursor);
|
||||||
|
|
||||||
|
@ -172,14 +173,13 @@ void CInputManager::mouseMoveUnified(uint32_t time, bool refocus) {
|
||||||
Vector2D surfaceLocal = surfacePos == Vector2D(-1337, -1337) ? surfaceCoords : mouseCoords - surfacePos;
|
Vector2D surfaceLocal = surfacePos == Vector2D(-1337, -1337) ? surfaceCoords : mouseCoords - surfacePos;
|
||||||
|
|
||||||
if (pFoundWindow) {
|
if (pFoundWindow) {
|
||||||
static auto *const PFOLLOWMOUSE = &g_pConfigManager->getConfigValuePtr("input:follow_mouse")->intValue;
|
static auto* const PFOLLOWMOUSE = &g_pConfigManager->getConfigValuePtr("input:follow_mouse")->intValue;
|
||||||
if (*PFOLLOWMOUSE != 1 && !refocus) {
|
if (*PFOLLOWMOUSE != 1 && !refocus) {
|
||||||
if (pFoundWindow != g_pCompositor->m_pLastWindow && g_pCompositor->windowValidMapped(g_pCompositor->m_pLastWindow) && (g_pCompositor->m_pLastWindow->m_bIsFloating != pFoundWindow->m_bIsFloating)) {
|
if (pFoundWindow != g_pCompositor->m_pLastWindow && g_pCompositor->windowValidMapped(g_pCompositor->m_pLastWindow) && (g_pCompositor->m_pLastWindow->m_bIsFloating != pFoundWindow->m_bIsFloating)) {
|
||||||
// enter if change floating style
|
// enter if change floating style
|
||||||
g_pCompositor->focusWindow(pFoundWindow, foundSurface);
|
g_pCompositor->focusWindow(pFoundWindow, foundSurface);
|
||||||
wlr_seat_pointer_notify_enter(g_pCompositor->m_sSeat.seat, foundSurface, surfaceLocal.x, surfaceLocal.y);
|
wlr_seat_pointer_notify_enter(g_pCompositor->m_sSeat.seat, foundSurface, surfaceLocal.x, surfaceLocal.y);
|
||||||
}
|
} else if (*PFOLLOWMOUSE == 2) {
|
||||||
else if (*PFOLLOWMOUSE == 2) {
|
|
||||||
wlr_seat_pointer_notify_enter(g_pCompositor->m_sSeat.seat, foundSurface, surfaceLocal.x, surfaceLocal.y);
|
wlr_seat_pointer_notify_enter(g_pCompositor->m_sSeat.seat, foundSurface, surfaceLocal.x, surfaceLocal.y);
|
||||||
}
|
}
|
||||||
wlr_seat_pointer_notify_motion(g_pCompositor->m_sSeat.seat, time, surfaceLocal.x, surfaceLocal.y);
|
wlr_seat_pointer_notify_motion(g_pCompositor->m_sSeat.seat, time, surfaceLocal.x, surfaceLocal.y);
|
||||||
|
@ -187,13 +187,11 @@ void CInputManager::mouseMoveUnified(uint32_t time, bool refocus) {
|
||||||
} else {
|
} else {
|
||||||
g_pCompositor->focusWindow(pFoundWindow, foundSurface);
|
g_pCompositor->focusWindow(pFoundWindow, foundSurface);
|
||||||
}
|
}
|
||||||
}
|
} else
|
||||||
else
|
|
||||||
g_pCompositor->focusSurface(foundSurface);
|
g_pCompositor->focusSurface(foundSurface);
|
||||||
|
|
||||||
wlr_seat_pointer_notify_enter(g_pCompositor->m_sSeat.seat, foundSurface, surfaceLocal.x, surfaceLocal.y);
|
wlr_seat_pointer_notify_enter(g_pCompositor->m_sSeat.seat, foundSurface, surfaceLocal.x, surfaceLocal.y);
|
||||||
wlr_seat_pointer_notify_motion(g_pCompositor->m_sSeat.seat, time, surfaceLocal.x, surfaceLocal.y);
|
wlr_seat_pointer_notify_motion(g_pCompositor->m_sSeat.seat, time, surfaceLocal.x, surfaceLocal.y);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void CInputManager::onMouseButton(wlr_pointer_button_event* e) {
|
void CInputManager::onMouseButton(wlr_pointer_button_event* e) {
|
||||||
|
|
Loading…
Reference in a new issue