fix crash when click on no window

This commit is contained in:
Ching Pei Yang 2023-01-11 07:58:29 +01:00
parent 4c2c0031e2
commit f41b69f69d

View file

@ -394,8 +394,11 @@ void CInputManager::processMouseDownNormal(wlr_pointer_button_event* e) {
if (!PASS && !*PPASSMOUSE) if (!PASS && !*PPASSMOUSE)
return; return;
if (*PBORDERRESIZE && g_pCompositor->m_pLastWindow) { // TODO also check surfaces, maybe move into the switch statement below (focuses window first),
const auto w = g_pCompositor->vectorToWindowIdeal(getMouseCoordsInternal()); // 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());
// TODO exclude if fullscreen
if (*PBORDERRESIZE && w) {
const wlr_box box = w->getFullWindowBoundingBox(); 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 wlr_box real = {w->m_vRealPosition.vec().x, w->m_vRealPosition.vec().y, w->m_vRealSize.vec().x, w->m_vRealSize.vec().y};
// check if clicked on gaps/border (borders are hard to click on, doesn't matter how thick it is) // check if clicked on gaps/border (borders are hard to click on, doesn't matter how thick it is)