diff options
| author | vaxerski <43317083+vaxerski@users.noreply.github.com> | 2022-05-29 15:44:30 +0200 |
|---|---|---|
| committer | vaxerski <43317083+vaxerski@users.noreply.github.com> | 2022-05-29 15:45:51 +0200 |
| commit | 227cbb0464bbf211f9d5ec7f6fa8e1bba0aecd12 (patch) | |
| tree | 99e04d68d0fa6521201a7645a9b8c5ee83f6d736 /src/layout | |
| parent | fdb3f610e564c644ab0fc7fd154562258350084a (diff) | |
Added fullscreen types, maximize and full
Diffstat (limited to 'src/layout')
| -rw-r--r-- | src/layout/DwindleLayout.cpp | 22 | ||||
| -rw-r--r-- | src/layout/DwindleLayout.hpp | 3 | ||||
| -rw-r--r-- | src/layout/IHyprLayout.hpp | 6 |
3 files changed, 25 insertions, 6 deletions
diff --git a/src/layout/DwindleLayout.cpp b/src/layout/DwindleLayout.cpp index 8117622c..79c08571 100644 --- a/src/layout/DwindleLayout.cpp +++ b/src/layout/DwindleLayout.cpp @@ -620,7 +620,7 @@ void CHyprDwindleLayout::onWindowCreatedFloating(CWindow* pWindow) { g_pCompositor->moveWindowToTop(pWindow); } -void CHyprDwindleLayout::fullscreenRequestForWindow(CWindow* pWindow) { +void CHyprDwindleLayout::fullscreenRequestForWindow(CWindow* pWindow, eFullscreenMode fullscreenMode) { if (!g_pCompositor->windowValidMapped(pWindow)) return; @@ -650,6 +650,8 @@ void CHyprDwindleLayout::fullscreenRequestForWindow(CWindow* pWindow) { } else { // if it now got fullscreen, make it fullscreen + PWORKSPACE->m_efFullscreenMode = fullscreenMode; + // save position and size if floating if (pWindow->m_bIsFloating) { pWindow->m_vPosition = pWindow->m_vRealPosition.vec(); @@ -657,8 +659,22 @@ void CHyprDwindleLayout::fullscreenRequestForWindow(CWindow* pWindow) { } // apply new pos and size being monitors' box - pWindow->m_vRealPosition = PMONITOR->vecPosition; - pWindow->m_vRealSize = PMONITOR->vecSize; + if (fullscreenMode == FULLSCREEN_FULL) { + pWindow->m_vRealPosition = PMONITOR->vecPosition; + pWindow->m_vRealSize = PMONITOR->vecSize; + } else { + // This is a massive hack. + // We make a fake "only" node and apply + // To keep consistent with the settings without C+P code + + SDwindleNodeData fakeNode; + fakeNode.pWindow = pWindow; + fakeNode.position = PMONITOR->vecPosition + PMONITOR->vecReservedTopLeft; + fakeNode.size = PMONITOR->vecSize - PMONITOR->vecReservedTopLeft - PMONITOR->vecReservedBottomRight; + fakeNode.workspaceID = pWindow->m_iWorkspaceID; + + applyNodeDataToWindow(&fakeNode); + } } g_pXWaylandManager->setWindowSize(pWindow, pWindow->m_vRealSize.goalv()); diff --git a/src/layout/DwindleLayout.hpp b/src/layout/DwindleLayout.hpp index 4abd04ef..492a52a3 100644 --- a/src/layout/DwindleLayout.hpp +++ b/src/layout/DwindleLayout.hpp @@ -6,6 +6,7 @@ #include "../render/decorations/CHyprGroupBarDecoration.hpp" class CHyprDwindleLayout; +enum eFullscreenMode : uint8_t; struct SDwindleNodeData { SDwindleNodeData* pParent = nullptr; @@ -50,7 +51,7 @@ public: virtual void onEndDragWindow(); virtual void onMouseMove(const Vector2D&); virtual void onWindowCreatedFloating(CWindow*); - virtual void fullscreenRequestForWindow(CWindow*); + virtual void fullscreenRequestForWindow(CWindow*, eFullscreenMode); virtual std::any layoutMessage(SLayoutMessageHeader, std::string); virtual SWindowRenderLayoutHints requestRenderHints(CWindow*); virtual void switchWindows(CWindow*, CWindow*); diff --git a/src/layout/IHyprLayout.hpp b/src/layout/IHyprLayout.hpp index 01e3e04a..e9cf2a15 100644 --- a/src/layout/IHyprLayout.hpp +++ b/src/layout/IHyprLayout.hpp @@ -12,6 +12,8 @@ struct SLayoutMessageHeader { CWindow* pWindow = nullptr; }; +enum eFullscreenMode : uint8_t; + interface IHyprLayout { public: @@ -66,11 +68,11 @@ public: virtual void onWindowCreatedFloating(CWindow*) = 0; /* - Called when a window requests to toggle its' fullscreen state. + Called when a window / the user requests to toggle the fullscreen state of a window The layout sets all the fullscreen flags. It can either accept or ignore. */ - virtual void fullscreenRequestForWindow(CWindow*) = 0; + virtual void fullscreenRequestForWindow(CWindow*, eFullscreenMode) = 0; /* Called when a dispatcher requests a custom message |
