fix: trigger resize on border after refocus

This commit is contained in:
Ching Pei Yang 2023-01-12 15:20:29 +01:00
parent d499c55a3a
commit de6bdc9651

View file

@ -392,20 +392,6 @@ void CInputManager::processMouseDownNormal(wlr_pointer_button_event* e) {
if (!PASS && !*PPASSMOUSE)
return;
// TODO also check surfaces, maybe move into the switch statement below (focuses window first),
// so that I don't have to find surfaces myself, plus no need for vectorToWindowIdeal to find the window
const auto w = g_pCompositor->vectorToWindowIdeal(getMouseCoordsInternal());
if (*PBORDERRESIZE && w && !w->m_bIsFullscreen && !w->m_bFakeFullscreenState) {
const wlr_box box = w->getFullWindowBoundingBox();
const wlr_box real = {w->m_vRealPosition.vec().x, w->m_vRealPosition.vec().y, w->m_vRealSize.vec().x, w->m_vRealSize.vec().y};
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) || w->isInCurvedCorner(mouseCoords.x, mouseCoords.y))) {
g_pKeybindManager->resizeWithBorder(e);
return;
}
}
switch (e->state) {
case WLR_BUTTON_PRESSED:
if (*PFOLLOWMOUSE == 3) // don't refocus on full loose
@ -418,6 +404,19 @@ void CInputManager::processMouseDownNormal(wlr_pointer_button_event* e) {
if (g_pCompositor->m_pLastWindow && g_pCompositor->m_pLastWindow->m_bIsFloating)
g_pCompositor->moveWindowToTop(g_pCompositor->m_pLastWindow);
// clicking on border triggers resize
if (*PBORDERRESIZE && g_pCompositor->m_pLastWindow && !g_pCompositor->m_pLastWindow->m_bIsFullscreen && !g_pCompositor->m_pLastWindow->m_bFakeFullscreenState) {
const wlr_box box = g_pCompositor->m_pLastWindow->getFullWindowBoundingBox();
const wlr_box real = {g_pCompositor->m_pLastWindow->m_vRealPosition.vec().x, g_pCompositor->m_pLastWindow->m_vRealPosition.vec().y,
g_pCompositor->m_pLastWindow->m_vRealSize.vec().x, g_pCompositor->m_pLastWindow->m_vRealSize.vec().y};
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) || g_pCompositor->m_pLastWindow->isInCurvedCorner(mouseCoords.x, mouseCoords.y))) {
g_pKeybindManager->resizeWithBorder(e);
return;
}
}
break;
case WLR_BUTTON_RELEASED: break;
}