mirror of
https://github.com/hyprwm/Hyprland
synced 2024-11-22 15:05:59 +01:00
layers
This commit is contained in:
parent
8cc0f35fbb
commit
d615033526
3 changed files with 26 additions and 7 deletions
|
@ -121,8 +121,8 @@ void Events::listener_newLayerSurface(wl_listener* listener, void* data) {
|
||||||
const auto WLRLAYERSURFACE = (wlr_layer_surface_v1*)data;
|
const auto WLRLAYERSURFACE = (wlr_layer_surface_v1*)data;
|
||||||
|
|
||||||
const auto PMONITOR = (SMonitor*)WLRLAYERSURFACE->output->data;
|
const auto PMONITOR = (SMonitor*)WLRLAYERSURFACE->output->data;
|
||||||
PMONITOR->m_lLayerSurfaces.push_back(SLayerSurface());
|
PMONITOR->m_aLayerSurfaceLists[WLRLAYERSURFACE->pending.layer].push_back(SLayerSurface());
|
||||||
SLayerSurface* layerSurface = &PMONITOR->m_lLayerSurfaces.back();
|
SLayerSurface* layerSurface = &PMONITOR->m_aLayerSurfaceLists[WLRLAYERSURFACE->pending.layer].back();
|
||||||
|
|
||||||
if (!WLRLAYERSURFACE->output) {
|
if (!WLRLAYERSURFACE->output) {
|
||||||
WLRLAYERSURFACE->output = g_pCompositor->m_lMonitors.front().output; // TODO: current mon
|
WLRLAYERSURFACE->output = g_pCompositor->m_lMonitors.front().output; // TODO: current mon
|
||||||
|
@ -153,16 +153,15 @@ void Events::listener_destroyLayerSurface(wl_listener* listener, void* data) {
|
||||||
wl_list_remove(&layersurface->listen_unmapLayerSurface.link);
|
wl_list_remove(&layersurface->listen_unmapLayerSurface.link);
|
||||||
wl_list_remove(&layersurface->listen_commitLayerSurface.link);
|
wl_list_remove(&layersurface->listen_commitLayerSurface.link);
|
||||||
|
|
||||||
free(layersurface);
|
|
||||||
|
|
||||||
const auto PMONITOR = g_pCompositor->getMonitorFromID(layersurface->monitorID);
|
const auto PMONITOR = g_pCompositor->getMonitorFromID(layersurface->monitorID);
|
||||||
|
|
||||||
if (!PMONITOR)
|
if (!PMONITOR)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// remove the layersurface as it's not used anymore
|
// 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);
|
Debug::log(LOG, "LayerSurface %x destroyed", layersurface);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -22,7 +22,7 @@ struct SMonitor {
|
||||||
wlr_output* output = nullptr;
|
wlr_output* output = nullptr;
|
||||||
|
|
||||||
// Double-linked list because we need to have constant mem addresses for signals
|
// 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(monitorFrame);
|
||||||
DYNLISTENER(monitorDestroy);
|
DYNLISTENER(monitorDestroy);
|
||||||
|
|
|
@ -38,6 +38,16 @@ void CHyprRenderer::renderAllClientsForMonitor(const int& ID, timespec* time) {
|
||||||
if (!PMONITOR)
|
if (!PMONITOR)
|
||||||
return;
|
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) {
|
for (auto& w : g_pCompositor->m_lWindows) {
|
||||||
|
|
||||||
if (w.m_bIsX11)
|
if (w.m_bIsX11)
|
||||||
|
@ -78,4 +88,14 @@ void CHyprRenderer::renderAllClientsForMonitor(const int& ID, timespec* time) {
|
||||||
if (w.m_uSurface.xwayland->surface)
|
if (w.m_uSurface.xwayland->surface)
|
||||||
wlr_surface_for_each_surface(g_pXWaylandManager->getWindowSurface(&w), renderSurface, &renderdata);
|
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);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue