focus to layers

This commit is contained in:
vaxerski 2022-03-20 14:36:55 +01:00
parent decb2f638d
commit f8a731b10b
7 changed files with 85 additions and 23 deletions

View file

@ -183,6 +183,8 @@ void Events::listener_destroyLayerSurface(wl_listener* listener, void* data) {
if (layersurface->layerSurface->mapped)
layersurface->layerSurface->mapped = 0;
if (layersurface->layerSurface->surface == g_pCompositor->m_pLastFocus)
g_pCompositor->m_pLastFocus = nullptr;
wl_list_remove(&layersurface->listen_destroyLayerSurface.link);
wl_list_remove(&layersurface->listen_mapLayerSurface.link);
@ -212,6 +214,9 @@ void Events::listener_unmapLayerSurface(wl_listener* listener, void* data) {
if (layersurface->layerSurface->mapped)
layersurface->layerSurface->mapped = 0;
if (layersurface->layerSurface->surface == g_pCompositor->m_pLastFocus)
g_pCompositor->m_pLastFocus = nullptr;
Debug::log(LOG, "LayerSurface %x unmapped", layersurface);
}
@ -477,6 +482,9 @@ void Events::listener_mapWindow(wl_listener* listener, void* data) {
void Events::listener_unmapWindow(wl_listener* listener, void* data) {
CWindow* PWINDOW = wl_container_of(listener, PWINDOW, listen_unmapWindow);
if (g_pXWaylandManager->getWindowSurface(PWINDOW) == g_pCompositor->m_pLastFocus)
g_pCompositor->m_pLastFocus = nullptr;
g_pLayoutManager->getCurrentLayout()->onWindowRemoved(PWINDOW);
g_pCompositor->removeWindowFromVectorSafe(PWINDOW);
@ -493,6 +501,9 @@ void Events::listener_commitWindow(wl_listener* listener, void* data) {
void Events::listener_destroyWindow(wl_listener* listener, void* data) {
CWindow* PWINDOW = wl_container_of(listener, PWINDOW, listen_destroyWindow);
if (g_pXWaylandManager->getWindowSurface(PWINDOW) == g_pCompositor->m_pLastFocus)
g_pCompositor->m_pLastFocus = nullptr;
g_pLayoutManager->getCurrentLayout()->onWindowRemoved(PWINDOW);
g_pCompositor->removeWindowFromVectorSafe(PWINDOW);