diff options
| author | Vaxry <43317083+vaxerski@users.noreply.github.com> | 2025-07-24 00:36:29 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-07-24 00:36:29 +0200 |
| commit | 31cc7f3b87d1d9670b66e73e3720da2e2da49acd (patch) | |
| tree | d39c0e974bbaab8e2622fb32c1b0b037f22d6db9 /src/Compositor.hpp | |
| parent | ecc04e8ba7469fb01c5a066bf1c48d5cd58d1a18 (diff) | |
core: move workspace ptrs to weak (#11194)
Fixes some race conditions that come up in tests. We only clean up workspaces when we render a frame. With this, they are always cleared instantly.
Diffstat (limited to 'src/Compositor.hpp')
| -rw-r--r-- | src/Compositor.hpp | 43 |
1 files changed, 26 insertions, 17 deletions
diff --git a/src/Compositor.hpp b/src/Compositor.hpp index 23d1c365..c76a73b2 100644 --- a/src/Compositor.hpp +++ b/src/Compositor.hpp @@ -2,6 +2,8 @@ #include <sys/resource.h> +#include <ranges> + #include "managers/XWaylandManager.hpp" #include "managers/KeybindManager.hpp" #include "managers/SessionLockManager.hpp" @@ -42,7 +44,6 @@ class CCompositor { std::vector<PHLMONITOR> m_realMonitors; // for all monitors, even those turned off std::vector<PHLWINDOW> m_windows; std::vector<PHLLS> m_layers; - std::vector<PHLWORKSPACE> m_workspaces; std::vector<PHLWINDOWREF> m_windowsFadingOut; std::vector<PHLLSREF> m_surfacesFadingOut; @@ -75,6 +76,13 @@ class CCompositor { // ------------------------------------------------- // + auto getWorkspaces() { + return std::views::filter(m_workspaces, [](const auto& e) { return e; }); + } + void registerWorkspace(PHLWORKSPACE w); + + // + PHLMONITOR getMonitorFromID(const MONITORID&); PHLMONITOR getMonitorFromName(const std::string&); PHLMONITOR getMonitorFromDesc(const std::string&); @@ -96,7 +104,6 @@ class CCompositor { PHLWORKSPACE getWorkspaceByID(const WORKSPACEID&); PHLWORKSPACE getWorkspaceByName(const std::string&); PHLWORKSPACE getWorkspaceByString(const std::string&); - void sanityCheckWorkspaces(); PHLWINDOW getUrgentWindow(); bool isWindowActive(PHLWINDOW); void changeWindowZOrder(PHLWINDOW, bool); @@ -156,21 +163,23 @@ class CCompositor { std::string m_explicitConfigPath; private: - void initAllSignals(); - void removeAllSignals(); - void cleanEnvironment(); - void setRandomSplash(); - void initManagers(eManagersInitStage stage); - void prepareFallbackOutput(); - void createLockFile(); - void removeLockFile(); - void setMallocThreshold(); - - bool m_bDrmSyncobjTimelineSupported = false; - - uint64_t m_hyprlandPID = 0; - wl_event_source* m_critSigSource = nullptr; - rlimit m_originalNofile = {}; + void initAllSignals(); + void removeAllSignals(); + void cleanEnvironment(); + void setRandomSplash(); + void initManagers(eManagersInitStage stage); + void prepareFallbackOutput(); + void createLockFile(); + void removeLockFile(); + void setMallocThreshold(); + + bool m_bDrmSyncobjTimelineSupported = false; + + uint64_t m_hyprlandPID = 0; + wl_event_source* m_critSigSource = nullptr; + rlimit m_originalNofile = {}; + + std::vector<PHLWORKSPACEREF> m_workspaces; }; inline UP<CCompositor> g_pCompositor; |
