mirror of
https://github.com/hyprwm/Hyprland
synced 2024-11-22 09:25:59 +01:00
fix crashes
This commit is contained in:
parent
dbf566c78a
commit
7f8648fc8b
4 changed files with 23 additions and 3 deletions
|
@ -151,7 +151,8 @@ SMonitor* CCompositor::getMonitorFromCursor() {
|
|||
}
|
||||
|
||||
void CCompositor::removeWindowFromVectorSafe(CWindow* pWindow) {
|
||||
m_lWindows.remove(*pWindow);
|
||||
if (windowExists(pWindow))
|
||||
m_lWindows.remove(*pWindow);
|
||||
}
|
||||
|
||||
bool CCompositor::windowExists(CWindow* pWindow) {
|
||||
|
@ -189,10 +190,23 @@ void CCompositor::focusWindow(CWindow* pWindow) {
|
|||
wlr_seat_keyboard_notify_enter(m_sWLRSeat, PWINDOWSURFACE, KEYBOARD->keycodes, KEYBOARD->num_keycodes, &KEYBOARD->modifiers);
|
||||
|
||||
g_pXWaylandManager->activateSurface(PWINDOWSURFACE, true);
|
||||
if (m_pLastFocus && windowExists(m_pLastFocus))
|
||||
if (m_pLastFocus && windowValidMapped(m_pLastFocus))
|
||||
g_pXWaylandManager->activateSurface(g_pXWaylandManager->getWindowSurface(m_pLastFocus), false);
|
||||
|
||||
m_pLastFocus = pWindow;
|
||||
|
||||
Debug::log(LOG, "Set focus to %x", pWindow);
|
||||
}
|
||||
|
||||
bool CCompositor::windowValidMapped(CWindow* pWindow) {
|
||||
if (!windowExists(pWindow))
|
||||
return false;
|
||||
|
||||
if (pWindow->m_bIsX11 && !pWindow->m_bMappedX11)
|
||||
return false;
|
||||
|
||||
if (!g_pXWaylandManager->getWindowSurface(pWindow))
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
|
@ -60,6 +60,7 @@ public:
|
|||
void removeWindowFromVectorSafe(CWindow*);
|
||||
void focusWindow(CWindow*);
|
||||
bool windowExists(CWindow*);
|
||||
bool windowValidMapped(CWindow*);
|
||||
CWindow* vectorToWindow(const Vector2D&);
|
||||
};
|
||||
|
||||
|
|
|
@ -41,6 +41,7 @@ public:
|
|||
|
||||
// XWayland stuff
|
||||
bool m_bIsX11 = false;
|
||||
bool m_bMappedX11 = false;
|
||||
uint64_t m_iX11Type = 0;
|
||||
DYNLISTENER(activateX11);
|
||||
DYNLISTENER(configureX11);
|
||||
|
|
|
@ -200,6 +200,7 @@ void Events::listener_mapWindow(wl_listener* listener, void* data) {
|
|||
|
||||
const auto PMONITOR = g_pCompositor->getMonitorFromCursor();
|
||||
PWINDOW->m_iMonitorID = PMONITOR->ID;
|
||||
PWINDOW->m_bMappedX11 = true;
|
||||
|
||||
// test
|
||||
g_pXWaylandManager->setWindowSize(PWINDOW, PMONITOR->vecSize);
|
||||
|
@ -395,7 +396,10 @@ void Events::listener_outputMgrTest(wl_listener* listener, void* data) {
|
|||
}
|
||||
|
||||
void Events::listener_requestMouse(wl_listener* listener, void* data) {
|
||||
|
||||
const auto EVENT = (wlr_seat_pointer_request_set_cursor_event*)data;
|
||||
|
||||
if (EVENT->seat_client == g_pCompositor->m_sWLRSeat->pointer_state.focused_client)
|
||||
wlr_cursor_set_surface(g_pCompositor->m_sWLRCursor, EVENT->surface, EVENT->hotspot_x, EVENT->hotspot_y);
|
||||
}
|
||||
|
||||
void Events::listener_requestSetPrimarySel(wl_listener* listener, void* data) {
|
||||
|
|
Loading…
Reference in a new issue