diff --git a/src/Compositor.cpp b/src/Compositor.cpp index baf8b030..aac5aef4 100644 --- a/src/Compositor.cpp +++ b/src/Compositor.cpp @@ -1197,7 +1197,7 @@ void CCompositor::cleanupFadingOut(const int& monid) { // sometimes somehow fucking happens wtf bool exists = false; for (auto& m : m_vMonitors) { - for (auto& lsl : m->m_aLayerSurfaceLists) { + for (auto& lsl : m->m_aLayerSurfaceLayers) { for (auto& lsp : lsl) { if (lsp.get() == ls) { exists = true; @@ -1233,7 +1233,7 @@ void CCompositor::cleanupFadingOut(const int& monid) { g_pHyprOpenGL->m_mLayerFramebuffers.erase(ls); for (auto& m : m_vMonitors) { - for (auto& lsl : m->m_aLayerSurfaceLists) { + for (auto& lsl : m->m_aLayerSurfaceLayers) { if (!lsl.empty() && std::find_if(lsl.begin(), lsl.end(), [&](std::unique_ptr& other) { return other.get() == ls; }) != lsl.end()) { std::erase_if(lsl, [&](std::unique_ptr& other) { return other.get() == ls; }); } @@ -1890,7 +1890,7 @@ void CCompositor::setWindowFullscreen(CWindow* pWindow, bool on, eFullscreenMode } } - for (auto& ls : PMONITOR->m_aLayerSurfaceLists[ZWLR_LAYER_SHELL_V1_LAYER_TOP]) { + for (auto& ls : PMONITOR->m_aLayerSurfaceLayers[ZWLR_LAYER_SHELL_V1_LAYER_TOP]) { if (!ls->fadingOut) ls->alpha = pWindow->m_bIsFullscreen && mode == FULLSCREEN_FULL ? 0.f : 1.f; } @@ -2022,7 +2022,7 @@ void CCompositor::warpCursorTo(const Vector2D& pos) { SLayerSurface* CCompositor::getLayerSurfaceFromWlr(wlr_layer_surface_v1* pLS) { for (auto& m : m_vMonitors) { - for (auto& lsl : m->m_aLayerSurfaceLists) { + for (auto& lsl : m->m_aLayerSurfaceLayers) { for (auto& ls : lsl) { if (ls->layerSurface == pLS) return ls.get(); @@ -2041,7 +2041,7 @@ void CCompositor::closeWindow(CWindow* pWindow) { SLayerSurface* CCompositor::getLayerSurfaceFromSurface(wlr_surface* pSurface) { for (auto& m : m_vMonitors) { - for (auto& lsl : m->m_aLayerSurfaceLists) { + for (auto& lsl : m->m_aLayerSurfaceLayers) { for (auto& ls : lsl) { if (ls->layerSurface && ls->layerSurface->surface == pSurface) return ls.get(); diff --git a/src/debug/HyprCtl.cpp b/src/debug/HyprCtl.cpp index 63dbf411..48be1c5c 100644 --- a/src/debug/HyprCtl.cpp +++ b/src/debug/HyprCtl.cpp @@ -239,7 +239,7 @@ std::string layersRequest(HyprCtl::eHyprCtlOutputFormat format) { escapeJSONStrings(mon->szName).c_str()); int layerLevel = 0; - for (auto& level : mon->m_aLayerSurfaceLists) { + for (auto& level : mon->m_aLayerSurfaceLayers) { result += getFormat( R"#( "%i": [ @@ -285,7 +285,7 @@ std::string layersRequest(HyprCtl::eHyprCtlOutputFormat format) { result += getFormat("Monitor %s:\n", mon->szName.c_str()); int layerLevel = 0; static const std::array levelNames = {"background", "bottom", "top", "overlay"}; - for (auto& level : mon->m_aLayerSurfaceLists) { + for (auto& level : mon->m_aLayerSurfaceLayers) { result += getFormat("\tLayer level %i (%s):\n", layerLevel, levelNames[layerLevel].c_str()); for (auto& layer : level) { diff --git a/src/events/Layers.cpp b/src/events/Layers.cpp index 0ef1731e..4ecb8ed8 100644 --- a/src/events/Layers.cpp +++ b/src/events/Layers.cpp @@ -38,7 +38,7 @@ void Events::listener_newLayerSurface(wl_listener* listener, void* data) { WLRLAYERSURFACE->output = PMONITOR->output; // TODO: current mon } - SLayerSurface* layerSurface = PMONITOR->m_aLayerSurfaceLists[WLRLAYERSURFACE->pending.layer].emplace_back(std::make_unique()).get(); + SLayerSurface* layerSurface = PMONITOR->m_aLayerSurfaceLayers[WLRLAYERSURFACE->pending.layer].emplace_back(std::make_unique()).get(); layerSurface->szNamespace = WLRLAYERSURFACE->_namespace; @@ -123,10 +123,10 @@ void Events::listener_mapLayerSurface(void* owner, void* data) { if ((uint64_t)layersurface->monitorID != PMONITOR->ID) { const auto POLDMON = g_pCompositor->getMonitorFromID(layersurface->monitorID); - for (auto it = POLDMON->m_aLayerSurfaceLists[layersurface->layer].begin(); it != POLDMON->m_aLayerSurfaceLists[layersurface->layer].end(); it++) { + for (auto it = POLDMON->m_aLayerSurfaceLayers[layersurface->layer].begin(); it != POLDMON->m_aLayerSurfaceLayers[layersurface->layer].end(); it++) { if (it->get() == layersurface) { - PMONITOR->m_aLayerSurfaceLists[layersurface->layer].emplace_back(std::move(*it)); - POLDMON->m_aLayerSurfaceLists[layersurface->layer].erase(it); + PMONITOR->m_aLayerSurfaceLayers[layersurface->layer].emplace_back(std::move(*it)); + POLDMON->m_aLayerSurfaceLayers[layersurface->layer].erase(it); break; } } @@ -214,11 +214,11 @@ void Events::listener_unmapLayerSurface(void* owner, void* data) { g_pCompositor->m_pLastFocus = nullptr; // find LS-es to focus - foundSurface = g_pCompositor->vectorToLayerSurface(g_pInputManager->getMouseCoordsInternal(), &PMONITOR->m_aLayerSurfaceLists[ZWLR_LAYER_SHELL_V1_LAYER_OVERLAY], + foundSurface = g_pCompositor->vectorToLayerSurface(g_pInputManager->getMouseCoordsInternal(), &PMONITOR->m_aLayerSurfaceLayers[ZWLR_LAYER_SHELL_V1_LAYER_OVERLAY], &surfaceCoords, &pFoundLayerSurface); if (!foundSurface) - foundSurface = g_pCompositor->vectorToLayerSurface(g_pInputManager->getMouseCoordsInternal(), &PMONITOR->m_aLayerSurfaceLists[ZWLR_LAYER_SHELL_V1_LAYER_TOP], + foundSurface = g_pCompositor->vectorToLayerSurface(g_pInputManager->getMouseCoordsInternal(), &PMONITOR->m_aLayerSurfaceLayers[ZWLR_LAYER_SHELL_V1_LAYER_TOP], &surfaceCoords, &pFoundLayerSurface); if (!foundSurface) { @@ -266,10 +266,10 @@ void Events::listener_commitLayerSurface(void* owner, void* data) { if ((uint64_t)layersurface->monitorID != PMONITOR->ID) { const auto POLDMON = g_pCompositor->getMonitorFromID(layersurface->monitorID); - for (auto it = POLDMON->m_aLayerSurfaceLists[layersurface->layer].begin(); it != POLDMON->m_aLayerSurfaceLists[layersurface->layer].end(); it++) { + for (auto it = POLDMON->m_aLayerSurfaceLayers[layersurface->layer].begin(); it != POLDMON->m_aLayerSurfaceLayers[layersurface->layer].end(); it++) { if (it->get() == layersurface) { - PMONITOR->m_aLayerSurfaceLists[layersurface->layer].emplace_back(std::move(*it)); - POLDMON->m_aLayerSurfaceLists[layersurface->layer].erase(it); + PMONITOR->m_aLayerSurfaceLayers[layersurface->layer].emplace_back(std::move(*it)); + POLDMON->m_aLayerSurfaceLayers[layersurface->layer].erase(it); break; } } @@ -282,10 +282,10 @@ void Events::listener_commitLayerSurface(void* owner, void* data) { if (layersurface->layerSurface->current.committed != 0) { if (layersurface->layer != layersurface->layerSurface->current.layer) { - for (auto it = PMONITOR->m_aLayerSurfaceLists[layersurface->layer].begin(); it != PMONITOR->m_aLayerSurfaceLists[layersurface->layer].end(); it++) { + for (auto it = PMONITOR->m_aLayerSurfaceLayers[layersurface->layer].begin(); it != PMONITOR->m_aLayerSurfaceLayers[layersurface->layer].end(); it++) { if (it->get() == layersurface) { - PMONITOR->m_aLayerSurfaceLists[layersurface->layerSurface->current.layer].emplace_back(std::move(*it)); - PMONITOR->m_aLayerSurfaceLists[layersurface->layer].erase(it); + PMONITOR->m_aLayerSurfaceLayers[layersurface->layerSurface->current.layer].emplace_back(std::move(*it)); + PMONITOR->m_aLayerSurfaceLayers[layersurface->layer].erase(it); break; } } diff --git a/src/helpers/Monitor.cpp b/src/helpers/Monitor.cpp index db3799fb..7d44b0c0 100644 --- a/src/helpers/Monitor.cpp +++ b/src/helpers/Monitor.cpp @@ -193,10 +193,10 @@ void CMonitor::onDisconnect() { hyprListener_monitorFrame.removeCallback(); for (size_t i = 0; i < 4; ++i) { - for (auto& ls : m_aLayerSurfaceLists[i]) { + for (auto& ls : m_aLayerSurfaceLayers[i]) { wlr_layer_surface_v1_destroy(ls->layerSurface); } - m_aLayerSurfaceLists[i].clear(); + m_aLayerSurfaceLayers[i].clear(); } Debug::log(LOG, "Removed monitor %s!", szName.c_str()); diff --git a/src/helpers/Monitor.hpp b/src/helpers/Monitor.hpp index ca2913b7..6582cbfc 100644 --- a/src/helpers/Monitor.hpp +++ b/src/helpers/Monitor.hpp @@ -47,12 +47,9 @@ class CMonitor { std::vector mirrors; // for the special workspace. 0 means not open. - int specialWorkspaceID = 0; + int specialWorkspaceID = 0; - // Double-linked list because we need to have constant mem addresses for signals - // We have to store pointers and use raw new/delete because they might be moved between them - // and I am lazy - std::array>, 4> m_aLayerSurfaceLists; + std::array>, 4> m_aLayerSurfaceLayers; DYNLISTENER(monitorFrame); DYNLISTENER(monitorDestroy); diff --git a/src/helpers/Workspace.cpp b/src/helpers/Workspace.cpp index 2e243403..06b3c766 100644 --- a/src/helpers/Workspace.cpp +++ b/src/helpers/Workspace.cpp @@ -100,7 +100,7 @@ void CWorkspace::startAnim(bool in, bool left, bool instant) { // check LS-es if (in && !m_bIsSpecialWorkspace) { const auto PMONITOR = g_pCompositor->getMonitorFromID(m_iMonitorID); - for (auto& ls : PMONITOR->m_aLayerSurfaceLists[ZWLR_LAYER_SHELL_V1_LAYER_TOP]) { + for (auto& ls : PMONITOR->m_aLayerSurfaceLayers[ZWLR_LAYER_SHELL_V1_LAYER_TOP]) { if (!ls->fadingOut) ls->alpha = m_bHasFullscreenWindow && m_efFullscreenMode == FULLSCREEN_FULL ? 0.f : 1.f; } diff --git a/src/managers/input/InputManager.cpp b/src/managers/input/InputManager.cpp index 4f201677..685cf26a 100644 --- a/src/managers/input/InputManager.cpp +++ b/src/managers/input/InputManager.cpp @@ -142,10 +142,10 @@ void CInputManager::mouseMoveUnified(uint32_t time, bool refocus) { // overlay is above fullscreen if (!foundSurface) - foundSurface = g_pCompositor->vectorToLayerSurface(mouseCoords, &PMONITOR->m_aLayerSurfaceLists[ZWLR_LAYER_SHELL_V1_LAYER_OVERLAY], &surfaceCoords, &pFoundLayerSurface); + foundSurface = g_pCompositor->vectorToLayerSurface(mouseCoords, &PMONITOR->m_aLayerSurfaceLayers[ZWLR_LAYER_SHELL_V1_LAYER_OVERLAY], &surfaceCoords, &pFoundLayerSurface); if (!foundSurface) - foundSurface = g_pCompositor->vectorToLayerSurface(mouseCoords, &PMONITOR->m_aLayerSurfaceLists[ZWLR_LAYER_SHELL_V1_LAYER_TOP], &surfaceCoords, &pFoundLayerSurface); + foundSurface = g_pCompositor->vectorToLayerSurface(mouseCoords, &PMONITOR->m_aLayerSurfaceLayers[ZWLR_LAYER_SHELL_V1_LAYER_TOP], &surfaceCoords, &pFoundLayerSurface); // then, we check if the workspace doesnt have a fullscreen window const auto PWORKSPACE = g_pCompositor->getWorkspaceByID(PMONITOR->activeWorkspace); @@ -215,10 +215,11 @@ void CInputManager::mouseMoveUnified(uint32_t time, bool refocus) { // then surfaces below if (!foundSurface) - foundSurface = g_pCompositor->vectorToLayerSurface(mouseCoords, &PMONITOR->m_aLayerSurfaceLists[ZWLR_LAYER_SHELL_V1_LAYER_BOTTOM], &surfaceCoords, &pFoundLayerSurface); + foundSurface = g_pCompositor->vectorToLayerSurface(mouseCoords, &PMONITOR->m_aLayerSurfaceLayers[ZWLR_LAYER_SHELL_V1_LAYER_BOTTOM], &surfaceCoords, &pFoundLayerSurface); if (!foundSurface) - foundSurface = g_pCompositor->vectorToLayerSurface(mouseCoords, &PMONITOR->m_aLayerSurfaceLists[ZWLR_LAYER_SHELL_V1_LAYER_BACKGROUND], &surfaceCoords, &pFoundLayerSurface); + foundSurface = + g_pCompositor->vectorToLayerSurface(mouseCoords, &PMONITOR->m_aLayerSurfaceLayers[ZWLR_LAYER_SHELL_V1_LAYER_BACKGROUND], &surfaceCoords, &pFoundLayerSurface); g_pCompositor->scheduleFrameForMonitor(g_pCompositor->m_pLastMonitor); diff --git a/src/managers/input/Swipe.cpp b/src/managers/input/Swipe.cpp index c4e89605..596ec8f0 100644 --- a/src/managers/input/Swipe.cpp +++ b/src/managers/input/Swipe.cpp @@ -34,7 +34,7 @@ void CInputManager::beginWorkspaceSwipe() { m_sActiveSwipe.speedPoints = 0; if (PWORKSPACE->m_bHasFullscreenWindow) { - for (auto& ls : g_pCompositor->m_pLastMonitor->m_aLayerSurfaceLists[ZWLR_LAYER_SHELL_V1_LAYER_TOP]) { + for (auto& ls : g_pCompositor->m_pLastMonitor->m_aLayerSurfaceLayers[ZWLR_LAYER_SHELL_V1_LAYER_TOP]) { ls->alpha = 1.f; } } @@ -165,7 +165,7 @@ void CInputManager::onSwipeEnd(wlr_pointer_swipe_end_event* e) { g_pInputManager->refocus(); // apply alpha - for (auto& ls : g_pCompositor->m_pLastMonitor->m_aLayerSurfaceLists[ZWLR_LAYER_SHELL_V1_LAYER_TOP]) { + for (auto& ls : g_pCompositor->m_pLastMonitor->m_aLayerSurfaceLayers[ZWLR_LAYER_SHELL_V1_LAYER_TOP]) { ls->alpha = pSwitchedTo->m_bHasFullscreenWindow && pSwitchedTo->m_efFullscreenMode == FULLSCREEN_FULL ? 0.f : 1.f; } } diff --git a/src/render/Renderer.cpp b/src/render/Renderer.cpp index 4875fb77..765864c1 100644 --- a/src/render/Renderer.cpp +++ b/src/render/Renderer.cpp @@ -199,12 +199,12 @@ void CHyprRenderer::renderWorkspaceWithFullscreenWindow(CMonitor* pMonitor, CWor } // and the overlay layers - for (auto& ls : pMonitor->m_aLayerSurfaceLists[ZWLR_LAYER_SHELL_V1_LAYER_TOP]) { + for (auto& ls : pMonitor->m_aLayerSurfaceLayers[ZWLR_LAYER_SHELL_V1_LAYER_TOP]) { if (ls->alpha.fl() != 0.f) renderLayer(ls.get(), pMonitor, time); } - for (auto& ls : pMonitor->m_aLayerSurfaceLists[ZWLR_LAYER_SHELL_V1_LAYER_OVERLAY]) { + for (auto& ls : pMonitor->m_aLayerSurfaceLayers[ZWLR_LAYER_SHELL_V1_LAYER_OVERLAY]) { renderLayer(ls.get(), pMonitor, time); } @@ -387,10 +387,10 @@ void CHyprRenderer::renderAllClientsForMonitor(const int& ID, timespec* time) { return; // Render layer surfaces below windows for monitor - for (auto& ls : PMONITOR->m_aLayerSurfaceLists[ZWLR_LAYER_SHELL_V1_LAYER_BACKGROUND]) { + for (auto& ls : PMONITOR->m_aLayerSurfaceLayers[ZWLR_LAYER_SHELL_V1_LAYER_BACKGROUND]) { renderLayer(ls.get(), PMONITOR, time); } - for (auto& ls : PMONITOR->m_aLayerSurfaceLists[ZWLR_LAYER_SHELL_V1_LAYER_BOTTOM]) { + for (auto& ls : PMONITOR->m_aLayerSurfaceLayers[ZWLR_LAYER_SHELL_V1_LAYER_BOTTOM]) { renderLayer(ls.get(), PMONITOR, time); } @@ -522,7 +522,7 @@ 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]) { + for (auto& ls : PMONITOR->m_aLayerSurfaceLayers[ZWLR_LAYER_SHELL_V1_LAYER_TOP]) { renderLayer(ls.get(), PMONITOR, time); } @@ -531,7 +531,7 @@ void CHyprRenderer::renderAllClientsForMonitor(const int& ID, timespec* time) { renderIMEPopup(&imep, PMONITOR, time); } - for (auto ls = PMONITOR->m_aLayerSurfaceLists[ZWLR_LAYER_SHELL_V1_LAYER_OVERLAY].rbegin(); ls != PMONITOR->m_aLayerSurfaceLists[ZWLR_LAYER_SHELL_V1_LAYER_OVERLAY].rend(); + for (auto ls = PMONITOR->m_aLayerSurfaceLayers[ZWLR_LAYER_SHELL_V1_LAYER_OVERLAY].rbegin(); ls != PMONITOR->m_aLayerSurfaceLayers[ZWLR_LAYER_SHELL_V1_LAYER_OVERLAY].rend(); ls++) { renderLayer(ls->get(), PMONITOR, time); } @@ -632,10 +632,10 @@ bool CHyprRenderer::attemptDirectScanout(CMonitor* pMonitor) { PCANDIDATE->m_vRealSize.isBeingAnimated()) return false; - if (!pMonitor->m_aLayerSurfaceLists[ZWLR_LAYER_SHELL_V1_LAYER_OVERLAY].empty()) + if (!pMonitor->m_aLayerSurfaceLayers[ZWLR_LAYER_SHELL_V1_LAYER_OVERLAY].empty()) return false; - for (auto& topls : pMonitor->m_aLayerSurfaceLists[ZWLR_LAYER_SHELL_V1_LAYER_TOP]) { + for (auto& topls : pMonitor->m_aLayerSurfaceLayers[ZWLR_LAYER_SHELL_V1_LAYER_TOP]) { if (topls->alpha.fl() != 0.f) return false; } @@ -958,10 +958,10 @@ void CHyprRenderer::arrangeLayersForMonitor(const int& monitor) { wlr_box usableArea = {PMONITOR->vecPosition.x, PMONITOR->vecPosition.y, PMONITOR->vecSize.x, PMONITOR->vecSize.y}; - for (auto& la : PMONITOR->m_aLayerSurfaceLists) + for (auto& la : PMONITOR->m_aLayerSurfaceLayers) arrangeLayerArray(PMONITOR, la, true, &usableArea); - for (auto& la : PMONITOR->m_aLayerSurfaceLists) + for (auto& la : PMONITOR->m_aLayerSurfaceLayers) arrangeLayerArray(PMONITOR, la, false, &usableArea); PMONITOR->vecReservedTopLeft = Vector2D(usableArea.x, usableArea.y) - PMONITOR->vecPosition;