aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/Compositor.hpp
diff options
context:
space:
mode:
authorVaxry <[email protected]>2024-04-30 02:41:27 +0100
committerVaxry <[email protected]>2024-04-30 02:41:27 +0100
commit5edc32930d85f5f481160b938965c8bc329487e7 (patch)
tree3609cb2bebd1f72e17605022e2b9a2dd526377f6 /src/Compositor.hpp
parent5e6f7b1cdb72b394ad8556bb232ac8a406d851b4 (diff)
downloadHyprland-5edc32930d85f5f481160b938965c8bc329487e7.tar.gz
Hyprland-5edc32930d85f5f481160b938965c8bc329487e7.zip
layerSurface: refactor/move to a memory-safe impl
Makes all the pointers smart to avoid memory issues Refactors layerSurface code to live inside desktop/layersurface
Diffstat (limited to 'src/Compositor.hpp')
-rw-r--r--src/Compositor.hpp166
1 files changed, 83 insertions, 83 deletions
diff --git a/src/Compositor.hpp b/src/Compositor.hpp
index d0acad4d..5e9d0e9f 100644
--- a/src/Compositor.hpp
+++ b/src/Compositor.hpp
@@ -82,7 +82,7 @@ class CCompositor {
std::vector<PHLWINDOW> m_vWindows;
std::vector<PHLWORKSPACE> m_vWorkspaces;
std::vector<PHLWINDOWREF> m_vWindowsFadingOut;
- std::vector<SLayerSurface*> m_vSurfacesFadingOut;
+ std::vector<PHLLSREF> m_vSurfacesFadingOut;
std::unordered_map<std::string, uint64_t> m_mMonitorIDMap;
@@ -111,88 +111,88 @@ class CCompositor {
// ------------------------------------------------- //
- CMonitor* getMonitorFromID(const int&);
- CMonitor* getMonitorFromName(const std::string&);
- CMonitor* getMonitorFromDesc(const std::string&);
- CMonitor* getMonitorFromCursor();
- CMonitor* getMonitorFromVector(const Vector2D&);
- void removeWindowFromVectorSafe(PHLWINDOW);
- void focusWindow(PHLWINDOW, wlr_surface* pSurface = nullptr);
- void focusSurface(wlr_surface*, PHLWINDOW pWindowOwner = nullptr);
- bool monitorExists(CMonitor*);
- PHLWINDOW vectorToWindowUnified(const Vector2D&, uint8_t properties, PHLWINDOW pIgnoreWindow = nullptr);
- wlr_surface* vectorToLayerSurface(const Vector2D&, std::vector<std::unique_ptr<SLayerSurface>>*, Vector2D*, SLayerSurface**);
- wlr_surface* vectorToLayerPopupSurface(const Vector2D&, CMonitor* monitor, Vector2D*, SLayerSurface**);
- wlr_surface* vectorWindowToSurface(const Vector2D&, PHLWINDOW, Vector2D& sl);
- Vector2D vectorToSurfaceLocal(const Vector2D&, PHLWINDOW, wlr_surface*);
- CMonitor* getMonitorFromOutput(wlr_output*);
- CMonitor* getRealMonitorFromOutput(wlr_output*);
- PHLWINDOW getWindowFromSurface(wlr_surface*);
- PHLWINDOW getWindowFromHandle(uint32_t);
- bool isWorkspaceVisible(PHLWORKSPACE);
- PHLWORKSPACE getWorkspaceByID(const int&);
- PHLWORKSPACE getWorkspaceByName(const std::string&);
- PHLWORKSPACE getWorkspaceByString(const std::string&);
- void sanityCheckWorkspaces();
- void updateWorkspaceWindowDecos(const int&);
- void updateWorkspaceSpecialRenderData(const int&);
- int getWindowsOnWorkspace(const int& id, std::optional<bool> onlyTiled = {}, std::optional<bool> onlyVisible = {});
- int getGroupsOnWorkspace(const int& id, std::optional<bool> onlyTiled = {}, std::optional<bool> onlyVisible = {});
- PHLWINDOW getUrgentWindow();
- bool hasUrgentWindowOnWorkspace(const int&);
- PHLWINDOW getFirstWindowOnWorkspace(const int&);
- PHLWINDOW getTopLeftWindowOnWorkspace(const int&);
- PHLWINDOW getFullscreenWindowOnWorkspace(const int&);
- bool doesSeatAcceptInput(wlr_surface*);
- bool isWindowActive(PHLWINDOW);
- void changeWindowZOrder(PHLWINDOW, bool);
- void cleanupFadingOut(const int& monid);
- PHLWINDOW getWindowInDirection(PHLWINDOW, char);
- PHLWINDOW getNextWindowOnWorkspace(PHLWINDOW, bool focusableOnly = false, std::optional<bool> floating = {});
- PHLWINDOW getPrevWindowOnWorkspace(PHLWINDOW, bool focusableOnly = false, std::optional<bool> floating = {});
- int getNextAvailableNamedWorkspace();
- bool isPointOnAnyMonitor(const Vector2D&);
- bool isPointOnReservedArea(const Vector2D& point, const CMonitor* monitor = nullptr);
- CMonitor* getMonitorInDirection(const char&);
- CMonitor* getMonitorInDirection(CMonitor*, const char&);
- void updateAllWindowsAnimatedDecorationValues();
- void updateWorkspaceWindows(const int64_t& id);
- void updateWindowAnimatedDecorationValues(PHLWINDOW);
- int getNextAvailableMonitorID(std::string const& name);
- void moveWorkspaceToMonitor(PHLWORKSPACE, CMonitor*, bool noWarpCursor = false);
- void swapActiveWorkspaces(CMonitor*, CMonitor*);
- CMonitor* getMonitorFromString(const std::string&);
- bool workspaceIDOutOfBounds(const int64_t&);
- void setWindowFullscreen(PHLWINDOW, bool, eFullscreenMode mode = FULLSCREEN_INVALID);
- void updateFullscreenFadeOnWorkspace(PHLWORKSPACE);
- PHLWINDOW getX11Parent(PHLWINDOW);
- void scheduleFrameForMonitor(CMonitor*);
- void addToFadingOutSafe(SLayerSurface*);
- void addToFadingOutSafe(PHLWINDOW);
- PHLWINDOW getWindowByRegex(const std::string&);
- void warpCursorTo(const Vector2D&, bool force = false);
- SLayerSurface* getLayerSurfaceFromWlr(wlr_layer_surface_v1*);
- SLayerSurface* getLayerSurfaceFromSurface(wlr_surface*);
- void closeWindow(PHLWINDOW);
- Vector2D parseWindowVectorArgsRelative(const std::string&, const Vector2D&);
- void forceReportSizesToWindowsOnWorkspace(const int&);
- PHLWORKSPACE createNewWorkspace(const int&, const int&, const std::string& name = ""); // will be deleted next frame if left empty and unfocused!
- void renameWorkspace(const int&, const std::string& name = "");
- void setActiveMonitor(CMonitor*);
- bool isWorkspaceSpecial(const int&);
- int getNewSpecialID();
- void performUserChecks();
- void moveWindowToWorkspaceSafe(PHLWINDOW pWindow, PHLWORKSPACE pWorkspace);
- PHLWINDOW getForceFocus();
- void arrangeMonitors();
- void enterUnsafeState();
- void leaveUnsafeState();
- void setPreferredScaleForSurface(wlr_surface* pSurface, double scale);
- void setPreferredTransformForSurface(wlr_surface* pSurface, wl_output_transform transform);
- void updateSuspendedStates();
- PHLWINDOW windowForCPointer(CWindow*);
-
- std::string explicitConfigPath;
+ CMonitor* getMonitorFromID(const int&);
+ CMonitor* getMonitorFromName(const std::string&);
+ CMonitor* getMonitorFromDesc(const std::string&);
+ CMonitor* getMonitorFromCursor();
+ CMonitor* getMonitorFromVector(const Vector2D&);
+ void removeWindowFromVectorSafe(PHLWINDOW);
+ void focusWindow(PHLWINDOW, wlr_surface* pSurface = nullptr);
+ void focusSurface(wlr_surface*, PHLWINDOW pWindowOwner = nullptr);
+ bool monitorExists(CMonitor*);
+ PHLWINDOW vectorToWindowUnified(const Vector2D&, uint8_t properties, PHLWINDOW pIgnoreWindow = nullptr);
+ wlr_surface* vectorToLayerSurface(const Vector2D&, std::vector<PHLLS>*, Vector2D*, PHLLS*);
+ wlr_surface* vectorToLayerPopupSurface(const Vector2D&, CMonitor* monitor, Vector2D*, PHLLS*);
+ wlr_surface* vectorWindowToSurface(const Vector2D&, PHLWINDOW, Vector2D& sl);
+ Vector2D vectorToSurfaceLocal(const Vector2D&, PHLWINDOW, wlr_surface*);
+ CMonitor* getMonitorFromOutput(wlr_output*);
+ CMonitor* getRealMonitorFromOutput(wlr_output*);
+ PHLWINDOW getWindowFromSurface(wlr_surface*);
+ PHLWINDOW getWindowFromHandle(uint32_t);
+ bool isWorkspaceVisible(PHLWORKSPACE);
+ PHLWORKSPACE getWorkspaceByID(const int&);
+ PHLWORKSPACE getWorkspaceByName(const std::string&);
+ PHLWORKSPACE getWorkspaceByString(const std::string&);
+ void sanityCheckWorkspaces();
+ void updateWorkspaceWindowDecos(const int&);
+ void updateWorkspaceSpecialRenderData(const int&);
+ int getWindowsOnWorkspace(const int& id, std::optional<bool> onlyTiled = {}, std::optional<bool> onlyVisible = {});
+ int getGroupsOnWorkspace(const int& id, std::optional<bool> onlyTiled = {}, std::optional<bool> onlyVisible = {});
+ PHLWINDOW getUrgentWindow();
+ bool hasUrgentWindowOnWorkspace(const int&);
+ PHLWINDOW getFirstWindowOnWorkspace(const int&);
+ PHLWINDOW getTopLeftWindowOnWorkspace(const int&);
+ PHLWINDOW getFullscreenWindowOnWorkspace(const int&);
+ bool doesSeatAcceptInput(wlr_surface*);
+ bool isWindowActive(PHLWINDOW);
+ void changeWindowZOrder(PHLWINDOW, bool);
+ void cleanupFadingOut(const int& monid);
+ PHLWINDOW getWindowInDirection(PHLWINDOW, char);
+ PHLWINDOW getNextWindowOnWorkspace(PHLWINDOW, bool focusableOnly = false, std::optional<bool> floating = {});
+ PHLWINDOW getPrevWindowOnWorkspace(PHLWINDOW, bool focusableOnly = false, std::optional<bool> floating = {});
+ int getNextAvailableNamedWorkspace();
+ bool isPointOnAnyMonitor(const Vector2D&);
+ bool isPointOnReservedArea(const Vector2D& point, const CMonitor* monitor = nullptr);
+ CMonitor* getMonitorInDirection(const char&);
+ CMonitor* getMonitorInDirection(CMonitor*, const char&);
+ void updateAllWindowsAnimatedDecorationValues();
+ void updateWorkspaceWindows(const int64_t& id);
+ void updateWindowAnimatedDecorationValues(PHLWINDOW);
+ int getNextAvailableMonitorID(std::string const& name);
+ void moveWorkspaceToMonitor(PHLWORKSPACE, CMonitor*, bool noWarpCursor = false);
+ void swapActiveWorkspaces(CMonitor*, CMonitor*);
+ CMonitor* getMonitorFromString(const std::string&);
+ bool workspaceIDOutOfBounds(const int64_t&);
+ void setWindowFullscreen(PHLWINDOW, bool, eFullscreenMode mode = FULLSCREEN_INVALID);
+ void updateFullscreenFadeOnWorkspace(PHLWORKSPACE);
+ PHLWINDOW getX11Parent(PHLWINDOW);
+ void scheduleFrameForMonitor(CMonitor*);
+ void addToFadingOutSafe(PHLLS);
+ void addToFadingOutSafe(PHLWINDOW);
+ PHLWINDOW getWindowByRegex(const std::string&);
+ void warpCursorTo(const Vector2D&, bool force = false);
+ PHLLS getLayerSurfaceFromWlr(wlr_layer_surface_v1*);
+ PHLLS getLayerSurfaceFromSurface(wlr_surface*);
+ void closeWindow(PHLWINDOW);
+ Vector2D parseWindowVectorArgsRelative(const std::string&, const Vector2D&);
+ void forceReportSizesToWindowsOnWorkspace(const int&);
+ PHLWORKSPACE createNewWorkspace(const int&, const int&, const std::string& name = ""); // will be deleted next frame if left empty and unfocused!
+ void renameWorkspace(const int&, const std::string& name = "");
+ void setActiveMonitor(CMonitor*);
+ bool isWorkspaceSpecial(const int&);
+ int getNewSpecialID();
+ void performUserChecks();
+ void moveWindowToWorkspaceSafe(PHLWINDOW pWindow, PHLWORKSPACE pWorkspace);
+ PHLWINDOW getForceFocus();
+ void arrangeMonitors();
+ void enterUnsafeState();
+ void leaveUnsafeState();
+ void setPreferredScaleForSurface(wlr_surface* pSurface, double scale);
+ void setPreferredTransformForSurface(wlr_surface* pSurface, wl_output_transform transform);
+ void updateSuspendedStates();
+ PHLWINDOW windowForCPointer(CWindow*);
+
+ std::string explicitConfigPath;
private:
void initAllSignals();