fix: don't switch focus during window resizing via gaps

This commit is contained in:
Ching Pei Yang 2023-01-08 17:21:47 +01:00
parent 2055a40092
commit d03c7eebc4

View file

@ -391,16 +391,7 @@ void CInputManager::processMouseDownNormal(wlr_pointer_button_event* e) {
if (!PASS && !*PPASSMOUSE) if (!PASS && !*PPASSMOUSE)
return; return;
switch (e->state) { // TODO is there a more direct way to check if a window is tiled?
case WLR_BUTTON_PRESSED:
if (*PFOLLOWMOUSE == 3) // don't refocus on full loose
break;
if (!g_pCompositor->m_sSeat.mouse->currentConstraint)
refocus();
// TODO maybe move out of switch statement
// HELP if a window is not fullscreen and not floating, it is tiled, right??
if (TEMP_CONFIG_RESIZE_ON_BORDER && g_pCompositor->m_pLastWindow && !g_pCompositor->m_pLastWindow->m_bIsFullscreen && !g_pCompositor->m_pLastWindow->m_bIsFloating) { if (TEMP_CONFIG_RESIZE_ON_BORDER && g_pCompositor->m_pLastWindow && !g_pCompositor->m_pLastWindow->m_bIsFullscreen && !g_pCompositor->m_pLastWindow->m_bIsFloating) {
const auto w = g_pCompositor->vectorToWindowIdeal(getMouseCoordsInternal()); const auto w = g_pCompositor->vectorToWindowIdeal(getMouseCoordsInternal());
const wlr_box box = w->getFullWindowBoundingBox(); const wlr_box box = w->getFullWindowBoundingBox();
@ -410,9 +401,18 @@ void CInputManager::processMouseDownNormal(wlr_pointer_button_event* e) {
const auto mouseCoords = g_pInputManager->getMouseCoordsInternal(); const auto mouseCoords = g_pInputManager->getMouseCoordsInternal();
if (wlr_box_contains_point(&box, mouseCoords.x, mouseCoords.y) && !wlr_box_contains_point(&real, mouseCoords.x, mouseCoords.y)) { if (wlr_box_contains_point(&box, mouseCoords.x, mouseCoords.y) && !wlr_box_contains_point(&real, mouseCoords.x, mouseCoords.y)) {
g_pKeybindManager->onGapDragEvent(e); g_pKeybindManager->onGapDragEvent(e);
return;
} }
} }
switch (e->state) {
case WLR_BUTTON_PRESSED:
if (*PFOLLOWMOUSE == 3) // don't refocus on full loose
break;
if (!g_pCompositor->m_sSeat.mouse->currentConstraint)
refocus();
// if clicked on a floating window make it top // if clicked on a floating window make it top
if (g_pCompositor->m_pLastWindow && g_pCompositor->m_pLastWindow->m_bIsFloating) if (g_pCompositor->m_pLastWindow && g_pCompositor->m_pLastWindow->m_bIsFloating)
g_pCompositor->moveWindowToTop(g_pCompositor->m_pLastWindow); g_pCompositor->moveWindowToTop(g_pCompositor->m_pLastWindow);