This commit is contained in:
vaxerski 2022-03-19 13:35:04 +01:00
parent 8cc0f35fbb
commit d615033526
3 changed files with 26 additions and 7 deletions

View file

@ -121,8 +121,8 @@ void Events::listener_newLayerSurface(wl_listener* listener, void* data) {
const auto WLRLAYERSURFACE = (wlr_layer_surface_v1*)data;
const auto PMONITOR = (SMonitor*)WLRLAYERSURFACE->output->data;
PMONITOR->m_lLayerSurfaces.push_back(SLayerSurface());
SLayerSurface* layerSurface = &PMONITOR->m_lLayerSurfaces.back();
PMONITOR->m_aLayerSurfaceLists[WLRLAYERSURFACE->pending.layer].push_back(SLayerSurface());
SLayerSurface* layerSurface = &PMONITOR->m_aLayerSurfaceLists[WLRLAYERSURFACE->pending.layer].back();
if (!WLRLAYERSURFACE->output) {
WLRLAYERSURFACE->output = g_pCompositor->m_lMonitors.front().output; // TODO: current mon
@ -153,15 +153,14 @@ void Events::listener_destroyLayerSurface(wl_listener* listener, void* data) {
wl_list_remove(&layersurface->listen_unmapLayerSurface.link);
wl_list_remove(&layersurface->listen_commitLayerSurface.link);
free(layersurface);
const auto PMONITOR = g_pCompositor->getMonitorFromID(layersurface->monitorID);
if (!PMONITOR)
return;
// remove the layersurface as it's not used anymore
PMONITOR->m_lLayerSurfaces.remove(*layersurface);
PMONITOR->m_aLayerSurfaceLists[layersurface->layerSurface->pending.layer].remove(*layersurface);
free(layersurface);
Debug::log(LOG, "LayerSurface %x destroyed", layersurface);
}

View file

@ -22,7 +22,7 @@ struct SMonitor {
wlr_output* output = nullptr;
// Double-linked list because we need to have constant mem addresses for signals
std::list<SLayerSurface> m_lLayerSurfaces;
std::array<std::list<SLayerSurface>,4> m_aLayerSurfaceLists;
DYNLISTENER(monitorFrame);
DYNLISTENER(monitorDestroy);

View file

@ -38,6 +38,16 @@ void CHyprRenderer::renderAllClientsForMonitor(const int& ID, timespec* time) {
if (!PMONITOR)
return;
// Render layer surfaces below windows for monitor
for (auto& ls : PMONITOR->m_aLayerSurfaceLists[ZWLR_LAYER_SHELL_V1_LAYER_BACKGROUND]) {
SRenderData renderdata = {PMONITOR->output, time, ls.geometry.x, ls.geometry.y};
wlr_surface_for_each_surface(ls.layerSurface->surface, renderSurface, &renderdata);
}
for (auto& ls : PMONITOR->m_aLayerSurfaceLists[ZWLR_LAYER_SHELL_V1_LAYER_BOTTOM]) {
SRenderData renderdata = {PMONITOR->output, time, ls.geometry.x, ls.geometry.y};
wlr_surface_for_each_surface(ls.layerSurface->surface, renderSurface, &renderdata);
}
for (auto& w : g_pCompositor->m_lWindows) {
if (w.m_bIsX11)
@ -78,4 +88,14 @@ void CHyprRenderer::renderAllClientsForMonitor(const int& ID, timespec* time) {
if (w.m_uSurface.xwayland->surface)
wlr_surface_for_each_surface(g_pXWaylandManager->getWindowSurface(&w), renderSurface, &renderdata);
}
// Render surfaces above windows for monitor
for (auto& ls : PMONITOR->m_aLayerSurfaceLists[ZWLR_LAYER_SHELL_V1_LAYER_TOP]) {
SRenderData renderdata = {PMONITOR->output, time, ls.geometry.x, ls.geometry.y};
wlr_surface_for_each_surface(ls.layerSurface->surface, renderSurface, &renderdata);
}
for (auto& ls : PMONITOR->m_aLayerSurfaceLists[ZWLR_LAYER_SHELL_V1_LAYER_OVERLAY]) {
SRenderData renderdata = {PMONITOR->output, time, ls.geometry.x, ls.geometry.y};
wlr_surface_for_each_surface(ls.layerSurface->surface, renderSurface, &renderdata);
}
}