mirror of
https://github.com/hyprwm/Hyprland
synced 2024-11-22 15:25:58 +01:00
handle layersurfaces better
This commit is contained in:
parent
5ea20cd041
commit
86b6d7f938
3 changed files with 20 additions and 14 deletions
|
@ -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 ? WLRLAYERSURFACE->output->data : g_pCompositor->getMonitorFromCursor());
|
||||
PMONITOR->m_aLayerSurfaceLists[WLRLAYERSURFACE->pending.layer].push_back(SLayerSurface());
|
||||
SLayerSurface* layerSurface = &PMONITOR->m_aLayerSurfaceLists[WLRLAYERSURFACE->pending.layer].back();
|
||||
PMONITOR->m_aLayerSurfaceLists[WLRLAYERSURFACE->pending.layer].push_back(new SLayerSurface());
|
||||
SLayerSurface* layerSurface = PMONITOR->m_aLayerSurfaceLists[WLRLAYERSURFACE->pending.layer].back();
|
||||
|
||||
if (!WLRLAYERSURFACE->output) {
|
||||
WLRLAYERSURFACE->output = g_pCompositor->m_lMonitors.front().output; // TODO: current mon
|
||||
|
@ -159,7 +159,8 @@ void Events::listener_destroyLayerSurface(wl_listener* listener, void* data) {
|
|||
return;
|
||||
|
||||
// remove the layersurface as it's not used anymore
|
||||
PMONITOR->m_aLayerSurfaceLists[layersurface->layerSurface->pending.layer].remove(*layersurface);
|
||||
PMONITOR->m_aLayerSurfaceLists[layersurface->layerSurface->pending.layer].remove(layersurface);
|
||||
delete layersurface;
|
||||
|
||||
Debug::log(LOG, "LayerSurface %x destroyed", layersurface);
|
||||
}
|
||||
|
@ -189,8 +190,11 @@ void Events::listener_commitLayerSurface(wl_listener* listener, void* data) {
|
|||
if (!layersurface->layerSurface->output)
|
||||
return;
|
||||
|
||||
// todo: handle this properly
|
||||
Debug::log(LOG, "LayerSurface %x committed", layersurface);
|
||||
if (layersurface->layer != layersurface->layerSurface->current.layer) {
|
||||
PMONITOR->m_aLayerSurfaceLists[layersurface->layer].remove(layersurface);
|
||||
PMONITOR->m_aLayerSurfaceLists[layersurface->layerSurface->current.layer].push_back(layersurface);
|
||||
layersurface->layer = layersurface->layerSurface->current.layer;
|
||||
}
|
||||
}
|
||||
|
||||
void Events::listener_mapWindow(wl_listener* listener, void* data) {
|
||||
|
|
|
@ -23,7 +23,9 @@ struct SMonitor {
|
|||
wlr_output* output = nullptr;
|
||||
|
||||
// Double-linked list because we need to have constant mem addresses for signals
|
||||
std::array<std::list<SLayerSurface>, 4> m_aLayerSurfaceLists;
|
||||
// We have to store pointers and use raw new/delete because they might be moved between them
|
||||
// and I am lazy
|
||||
std::array<std::list<SLayerSurface*>, 4> m_aLayerSurfaceLists;
|
||||
|
||||
DYNLISTENER(monitorFrame);
|
||||
DYNLISTENER(monitorDestroy);
|
||||
|
|
|
@ -40,12 +40,12 @@ void CHyprRenderer::renderAllClientsForMonitor(const int& ID, timespec* time) {
|
|||
|
||||
// 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);
|
||||
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);
|
||||
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) {
|
||||
|
@ -91,11 +91,11 @@ void CHyprRenderer::renderAllClientsForMonitor(const int& ID, timespec* time) {
|
|||
|
||||
// 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);
|
||||
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);
|
||||
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