From bca7804bb6e1bf5ce5a99b9ae4806be25e36993c Mon Sep 17 00:00:00 2001 From: Vaxry <43317083+vaxerski@users.noreply.github.com> Date: Sat, 27 Apr 2024 12:43:12 +0100 Subject: internal: Window storage rework - part 1 (#5762) * Window storage rework - part 1 * format * remove useless include * fix pch * format * fix crash in dwindle * fix vram leak * prefer .expired() for bool checks --- src/layout/IHyprLayout.hpp | 68 +++++++++++++++++++++++----------------------- 1 file changed, 34 insertions(+), 34 deletions(-) (limited to 'src/layout/IHyprLayout.hpp') diff --git a/src/layout/IHyprLayout.hpp b/src/layout/IHyprLayout.hpp index e05580c4..74a00d19 100644 --- a/src/layout/IHyprLayout.hpp +++ b/src/layout/IHyprLayout.hpp @@ -12,7 +12,7 @@ struct SWindowRenderLayoutHints { }; struct SLayoutMessageHeader { - CWindow* pWindow = nullptr; + PHLWINDOW pWindow; }; enum eFullscreenMode : int8_t; @@ -44,21 +44,21 @@ class IHyprLayout { The layout HAS TO set the goal pos and size (anim mgr will use it) If !animationinprogress, then the anim mgr will not apply an anim. */ - virtual void onWindowCreated(CWindow*, eDirection direction = DIRECTION_DEFAULT); - virtual void onWindowCreatedTiling(CWindow*, eDirection direction = DIRECTION_DEFAULT) = 0; - virtual void onWindowCreatedFloating(CWindow*); + virtual void onWindowCreated(PHLWINDOW, eDirection direction = DIRECTION_DEFAULT); + virtual void onWindowCreatedTiling(PHLWINDOW, eDirection direction = DIRECTION_DEFAULT) = 0; + virtual void onWindowCreatedFloating(PHLWINDOW); /* Return tiled status */ - virtual bool isWindowTiled(CWindow*) = 0; + virtual bool isWindowTiled(PHLWINDOW) = 0; /* Called when a window is removed (unmapped) */ - virtual void onWindowRemoved(CWindow*); - virtual void onWindowRemovedTiling(CWindow*) = 0; - virtual void onWindowRemovedFloating(CWindow*); + virtual void onWindowRemoved(PHLWINDOW); + virtual void onWindowRemovedTiling(PHLWINDOW) = 0; + virtual void onWindowRemovedFloating(PHLWINDOW); /* Called when the monitor requires a layout recalculation this usually means reserved area changes @@ -69,12 +69,12 @@ class IHyprLayout { Called when the compositor requests a window to be recalculated, e.g. when pseudo is toggled. */ - virtual void recalculateWindow(CWindow*) = 0; + virtual void recalculateWindow(PHLWINDOW) = 0; /* Called when a window is requested to be floated */ - virtual void changeWindowFloatingMode(CWindow*); + virtual void changeWindowFloatingMode(PHLWINDOW); /* Called when a window is clicked on, beginning a drag this might be a resize, move, whatever the layout defines it @@ -86,13 +86,13 @@ class IHyprLayout { Vector2D holds pixel values Optional pWindow for a specific window */ - virtual void resizeActiveWindow(const Vector2D&, eRectCorner corner = CORNER_NONE, CWindow* pWindow = nullptr) = 0; + virtual void resizeActiveWindow(const Vector2D&, eRectCorner corner = CORNER_NONE, PHLWINDOW pWindow = nullptr) = 0; /* Called when a user requests a move of the current window by a vec Vector2D holds pixel values Optional pWindow for a specific window */ - virtual void moveActiveWindow(const Vector2D&, CWindow* pWindow = nullptr); + virtual void moveActiveWindow(const Vector2D&, PHLWINDOW pWindow = nullptr); /* Called when a window is ended being dragged (mouse up) @@ -110,7 +110,7 @@ class IHyprLayout { The layout sets all the fullscreen flags. It can either accept or ignore. */ - virtual void fullscreenRequestForWindow(CWindow*, eFullscreenMode, bool) = 0; + virtual void fullscreenRequestForWindow(PHLWINDOW, eFullscreenMode, bool) = 0; /* Called when a dispatcher requests a custom message @@ -124,25 +124,25 @@ class IHyprLayout { Called when the renderer requests any special draw flags for a specific window, e.g. border color for groups. */ - virtual SWindowRenderLayoutHints requestRenderHints(CWindow*) = 0; + virtual SWindowRenderLayoutHints requestRenderHints(PHLWINDOW) = 0; /* Called when the user requests two windows to be swapped places. The layout is free to ignore. */ - virtual void switchWindows(CWindow*, CWindow*) = 0; + virtual void switchWindows(PHLWINDOW, PHLWINDOW) = 0; /* Called when the user requests a window move in a direction. The layout is free to ignore. */ - virtual void moveWindowTo(CWindow*, const std::string& direction, bool silent = false) = 0; + virtual void moveWindowTo(PHLWINDOW, const std::string& direction, bool silent = false) = 0; /* Called when the user requests to change the splitratio by or to X on a window */ - virtual void alterSplitRatio(CWindow*, float, bool exact = false) = 0; + virtual void alterSplitRatio(PHLWINDOW, float, bool exact = false) = 0; /* Called when something wants the current layout's name @@ -152,36 +152,36 @@ class IHyprLayout { /* Called for getting the next candidate for a focus */ - virtual CWindow* getNextWindowCandidate(CWindow*); + virtual PHLWINDOW getNextWindowCandidate(PHLWINDOW); /* Internal: called when window focus changes */ - virtual void onWindowFocusChange(CWindow*); + virtual void onWindowFocusChange(PHLWINDOW); /* Called for replacing any data a layout has for a new window */ - virtual void replaceWindowDataWith(CWindow* from, CWindow* to) = 0; + virtual void replaceWindowDataWith(PHLWINDOW from, PHLWINDOW to) = 0; /* Determines if a window can be focused. If hidden this usually means the window is part of a group. */ - virtual bool isWindowReachable(CWindow*); + virtual bool isWindowReachable(PHLWINDOW); /* Called before an attempt is made to focus a window. Brings the window to the top of any groups and ensures it is not hidden. If the window is unmapped following this call, the focus attempt will fail. */ - virtual void bringWindowToTop(CWindow*); + virtual void bringWindowToTop(PHLWINDOW); /* Called via the foreign toplevel activation protocol. Focuses a window, bringing it to the top of its group if applicable. May be ignored. */ - virtual void requestFocusForWindow(CWindow*); + virtual void requestFocusForWindow(PHLWINDOW); /* Called to predict the size of a newly opened window to send it a configure. @@ -192,17 +192,17 @@ class IHyprLayout { /* Prefer not overriding, use predictSizeForNewWindowTiled. */ - virtual Vector2D predictSizeForNewWindow(CWindow* pWindow); - virtual Vector2D predictSizeForNewWindowFloating(CWindow* pWindow); + virtual Vector2D predictSizeForNewWindow(PHLWINDOW pWindow); + virtual Vector2D predictSizeForNewWindowFloating(PHLWINDOW pWindow); private: - int m_iMouseMoveEventCount; - Vector2D m_vBeginDragXY; - Vector2D m_vLastDragXY; - Vector2D m_vBeginDragPositionXY; - Vector2D m_vBeginDragSizeXY; - Vector2D m_vDraggingWindowOriginalFloatSize; - eRectCorner m_eGrabbedCorner = CORNER_TOPLEFT; - - CWindow* m_pLastTiledWindow = nullptr; + int m_iMouseMoveEventCount; + Vector2D m_vBeginDragXY; + Vector2D m_vLastDragXY; + Vector2D m_vBeginDragPositionXY; + Vector2D m_vBeginDragSizeXY; + Vector2D m_vDraggingWindowOriginalFloatSize; + eRectCorner m_eGrabbedCorner = CORNER_TOPLEFT; + + PHLWINDOWREF m_pLastTiledWindow; }; -- cgit v1.2.3