diff options
author | MightyPlaza <[email protected]> | 2024-07-11 14:10:42 +0000 |
---|---|---|
committer | GitHub <[email protected]> | 2024-07-11 16:10:42 +0200 |
commit | a443902abca6549839910720b80bd01faf10f387 (patch) | |
tree | 2d7967fa812b9f4e06852445e9e7912261d8c6b8 /src/layout | |
parent | b03f41efec14273cf25c42d4cef326acc36cb319 (diff) | |
download | Hyprland-a443902abca6549839910720b80bd01faf10f387.tar.gz Hyprland-a443902abca6549839910720b80bd01faf10f387.zip |
core: Improve handling of window properties (#6776)
* add mWindowProperties
modified: src/debug/HyprCtl.cpp
modified: src/desktop/Window.cpp
modified: src/desktop/Window.hpp
modified: src/events/Windows.cpp
* support int values
modified: src/debug/HyprCtl.cpp
modified: src/desktop/Window.cpp
modified: src/desktop/Window.hpp
* create m_sWindowData
modified: src/Compositor.cpp
modified: src/debug/HyprCtl.cpp
modified: src/desktop/Window.cpp
modified: src/desktop/Window.hpp
modified: src/events/Windows.cpp
modified: src/layout/DwindleLayout.cpp
modified: src/layout/IHyprLayout.cpp
modified: src/layout/MasterLayout.cpp
modified: src/managers/AnimationManager.cpp
modified: src/managers/KeybindManager.cpp
modified: src/managers/XWaylandManager.cpp
modified: src/render/OpenGL.cpp
modified: src/render/Renderer.cpp
modified: src/render/decorations/CHyprBorderDecoration.cpp
modified: src/render/decorations/CHyprDropShadowDecoration.cpp
modified: src/render/decorations/CHyprGroupBarDecoration.cpp
* simplify some properties
modified: src/Compositor.cpp
modified: src/debug/HyprCtl.cpp
modified: src/desktop/Window.cpp
modified: src/desktop/Window.hpp
modified: src/managers/KeybindManager.cpp
* store multiple values in CWindowOverridableVar
modified: src/Compositor.cpp
modified: src/debug/HyprCtl.cpp
modified: src/desktop/Window.cpp
modified: src/desktop/Window.hpp
modified: src/events/Windows.cpp
modified: src/layout/IHyprLayout.cpp
modified: src/managers/AnimationManager.cpp
modified: src/managers/KeybindManager.cpp
modified: src/managers/XWaylandManager.cpp
modified: src/render/OpenGL.cpp
modified: src/render/Renderer.cpp
modified: src/render/decorations/CHyprBorderDecoration.cpp
modified: src/render/decorations/CHyprDropShadowDecoration.cpp
modified: src/render/decorations/CHyprGroupBarDecoration.cpp
* clean up
modified: src/Compositor.cpp
modified: src/Compositor.hpp
modified: src/config/ConfigManager.cpp
modified: src/config/ConfigManager.hpp
modified: src/debug/HyprCtl.cpp
modified: src/desktop/Window.cpp
modified: src/desktop/Window.hpp
modified: src/events/Windows.cpp
modified: src/layout/DwindleLayout.cpp
modified: src/layout/IHyprLayout.cpp
modified: src/layout/IHyprLayout.hpp
modified: src/layout/MasterLayout.cpp
modified: src/managers/KeybindManager.cpp
* use SET_PROP priority for exec rules
modified: src/config/ConfigManager.hpp
modified: src/desktop/Window.cpp
* add default value
modified: src/Compositor.cpp
modified: src/debug/HyprCtl.cpp
modified: src/desktop/Window.cpp
modified: src/desktop/Window.hpp
modified: src/events/Windows.cpp
modified: src/layout/IHyprLayout.cpp
modified: src/managers/KeybindManager.cpp
modified: src/managers/XWaylandManager.cpp
modified: src/render/OpenGL.cpp
modified: src/render/Renderer.cpp
modified: src/render/decorations/CHyprBorderDecoration.cpp
modified: src/render/decorations/CHyprDropShadowDecoration.cpp
modified: src/render/decorations/CHyprGroupBarDecoration.cpp
* add setprop toggle
modified: src/config/ConfigManager.hpp
modified: src/debug/HyprCtl.cpp
modified: src/desktop/Window.cpp
* add setprop toggle
modified: src/debug/HyprCtl.cpp
* make window rules functional
modified: src/config/ConfigManager.cpp
modified: src/desktop/Window.cpp
* minor fixes
modified: src/Compositor.cpp
modified: src/debug/HyprCtl.cpp
modified: src/desktop/Window.hpp
* properly clean layout data
modified: src/desktop/Window.cpp
modified: src/desktop/Window.hpp
modified: src/events/Windows.cpp
modified: src/layout/DwindleLayout.cpp
modified: src/layout/IHyprLayout.cpp
modified: src/layout/IHyprLayout.hpp
modified: src/layout/MasterLayout.cpp
* remove newline
modified: src/events/Windows.cpp
* fixes
modified: src/config/ConfigManager.hpp
modified: src/debug/HyprCtl.cpp
modified: src/desktop/Window.cpp
modified: src/desktop/Window.hpp
* use CamelCase
modified: src/Compositor.cpp
modified: src/debug/HyprCtl.cpp
modified: src/desktop/Window.cpp
modified: src/desktop/Window.hpp
modified: src/events/Windows.cpp
modified: src/layout/IHyprLayout.cpp
modified: src/managers/AnimationManager.cpp
modified: src/managers/KeybindManager.cpp
modified: src/managers/XWaylandManager.cpp
modified: src/render/OpenGL.cpp
modified: src/render/Renderer.cpp
modified: src/render/decorations/CHyprBorderDecoration.cpp
modified: src/render/decorations/CHyprDropShadowDecoration.cpp
modified: src/render/decorations/CHyprGroupBarDecoration.cpp
Diffstat (limited to 'src/layout')
-rw-r--r-- | src/layout/DwindleLayout.cpp | 14 | ||||
-rw-r--r-- | src/layout/IHyprLayout.cpp | 16 | ||||
-rw-r--r-- | src/layout/MasterLayout.cpp | 14 |
3 files changed, 24 insertions, 20 deletions
diff --git a/src/layout/DwindleLayout.cpp b/src/layout/DwindleLayout.cpp index cbeaa420..d1b4b7ca 100644 --- a/src/layout/DwindleLayout.cpp +++ b/src/layout/DwindleLayout.cpp @@ -139,7 +139,7 @@ void CHyprDwindleLayout::applyNodeDataToWindow(SDwindleNodeData* pNode, bool for if (PWINDOW->m_bIsFullscreen && !pNode->ignoreFullscreenChecks) return; - PWINDOW->updateSpecialRenderData(); + PWINDOW->unsetWindowData(PRIORITY_LAYOUT); static auto PNOGAPSWHENONLY = CConfigValue<Hyprlang::INT>("dwindle:no_gaps_when_only"); static auto PGAPSINDATA = CConfigValue<Hyprlang::CUSTOMTYPE>("general:gaps_in"); @@ -160,10 +160,10 @@ void CHyprDwindleLayout::applyNodeDataToWindow(SDwindleNodeData* pNode, bool for if (*PNOGAPSWHENONLY && !PWINDOW->onSpecialWorkspace() && (NODESONWORKSPACE == 1 || (PWINDOW->m_bIsFullscreen && PWINDOW->m_pWorkspace->m_efFullscreenMode == FULLSCREEN_MAXIMIZED))) { - PWINDOW->m_sSpecialRenderData.border = WORKSPACERULE.border.value_or(*PNOGAPSWHENONLY == 2); - PWINDOW->m_sSpecialRenderData.decorate = WORKSPACERULE.decorate.value_or(true); - PWINDOW->m_sSpecialRenderData.rounding = false; - PWINDOW->m_sSpecialRenderData.shadow = false; + PWINDOW->m_sWindowData.decorate = CWindowOverridableVar(true, PRIORITY_LAYOUT); + PWINDOW->m_sWindowData.noBorder = CWindowOverridableVar(*PNOGAPSWHENONLY != 2, PRIORITY_LAYOUT); + PWINDOW->m_sWindowData.noRounding = CWindowOverridableVar(true, PRIORITY_LAYOUT); + PWINDOW->m_sWindowData.noShadow = CWindowOverridableVar(true, PRIORITY_LAYOUT); PWINDOW->updateWindowDecos(); @@ -496,7 +496,7 @@ void CHyprDwindleLayout::onWindowRemovedTiling(PHLWINDOW pWindow) { return; } - pWindow->updateSpecialRenderData(); + pWindow->unsetWindowData(PRIORITY_LAYOUT); if (pWindow->m_bIsFullscreen) g_pCompositor->setWindowFullscreen(pWindow, false, FULLSCREEN_FULL); @@ -830,7 +830,7 @@ void CHyprDwindleLayout::fullscreenRequestForWindow(PHLWINDOW pWindow, eFullscre pWindow->m_vRealPosition = pWindow->m_vLastFloatingPosition; pWindow->m_vRealSize = pWindow->m_vLastFloatingSize; - pWindow->updateSpecialRenderData(); + pWindow->unsetWindowData(PRIORITY_LAYOUT); } } else { // if it now got fullscreen, make it fullscreen diff --git a/src/layout/IHyprLayout.cpp b/src/layout/IHyprLayout.cpp index c6a7a66c..56d22d4b 100644 --- a/src/layout/IHyprLayout.cpp +++ b/src/layout/IHyprLayout.cpp @@ -386,8 +386,12 @@ void IHyprLayout::onMouseMove(const Vector2D& mousePos) { } else if (g_pInputManager->dragMode == MBIND_RESIZE || g_pInputManager->dragMode == MBIND_RESIZE_FORCE_RATIO || g_pInputManager->dragMode == MBIND_RESIZE_BLOCK_RATIO) { if (DRAGGINGWINDOW->m_bIsFloating) { - Vector2D MINSIZE = g_pXWaylandManager->getMinSizeForWindow(DRAGGINGWINDOW).clamp(DRAGGINGWINDOW->m_sAdditionalConfigData.minSize.toUnderlying()); - Vector2D MAXSIZE = g_pXWaylandManager->getMaxSizeForWindow(DRAGGINGWINDOW).clamp({}, DRAGGINGWINDOW->m_sAdditionalConfigData.maxSize.toUnderlying()); + Vector2D MINSIZE = g_pXWaylandManager->getMinSizeForWindow(DRAGGINGWINDOW).clamp(DRAGGINGWINDOW->m_sWindowData.minSize.valueOr(Vector2D(20, 20))); + Vector2D MAXSIZE; + if (DRAGGINGWINDOW->m_sWindowData.maxSize.hasValue()) + MAXSIZE = g_pXWaylandManager->getMaxSizeForWindow(DRAGGINGWINDOW).clamp({}, DRAGGINGWINDOW->m_sWindowData.maxSize.value()); + else + MAXSIZE = g_pXWaylandManager->getMaxSizeForWindow(DRAGGINGWINDOW).clamp({}, Vector2D(std::numeric_limits<double>::max(), std::numeric_limits<double>::max())); Vector2D newSize = m_vBeginDragSizeXY; Vector2D newPos = m_vBeginDragPositionXY; @@ -403,7 +407,7 @@ void IHyprLayout::onMouseMove(const Vector2D& mousePos) { if ((m_vBeginDragSizeXY.x >= 1 && m_vBeginDragSizeXY.y >= 1) && (g_pInputManager->dragMode == MBIND_RESIZE_FORCE_RATIO || - (!(g_pInputManager->dragMode == MBIND_RESIZE_BLOCK_RATIO) && DRAGGINGWINDOW->m_sAdditionalConfigData.keepAspectRatio))) { + (!(g_pInputManager->dragMode == MBIND_RESIZE_BLOCK_RATIO) && DRAGGINGWINDOW->m_sWindowData.keepAspectRatio.valueOrDefault()))) { const float RATIO = m_vBeginDragSizeXY.y / m_vBeginDragSizeXY.x; @@ -538,7 +542,7 @@ void IHyprLayout::changeWindowFloatingMode(PHLWINDOW pWindow) { g_pHyprRenderer->damageMonitor(g_pCompositor->getMonitorFromID(pWindow->m_iMonitorID)); - pWindow->updateSpecialRenderData(); + pWindow->unsetWindowData(PRIORITY_LAYOUT); if (pWindow == m_pLastTiledWindow) m_pLastTiledWindow.reset(); @@ -587,7 +591,7 @@ PHLWINDOW IHyprLayout::getNextWindowCandidate(PHLWINDOW pWindow) { // find whether there is a floating window below this one for (auto& w : g_pCompositor->m_vWindows) { if (w->m_bIsMapped && !w->isHidden() && w->m_bIsFloating && w->m_iX11Type != 2 && w->m_pWorkspace == pWindow->m_pWorkspace && !w->m_bX11ShouldntFocus && - !w->m_sAdditionalConfigData.noFocus && w != pWindow) { + !w->m_sWindowData.noFocus.valueOrDefault() && w != pWindow) { if (VECINRECT((pWindow->m_vSize / 2.f + pWindow->m_vPosition), w->m_vPosition.x, w->m_vPosition.y, w->m_vPosition.x + w->m_vSize.x, w->m_vPosition.y + w->m_vSize.y)) { return w; @@ -607,7 +611,7 @@ PHLWINDOW IHyprLayout::getNextWindowCandidate(PHLWINDOW pWindow) { // if not, floating window for (auto& w : g_pCompositor->m_vWindows) { if (w->m_bIsMapped && !w->isHidden() && w->m_bIsFloating && w->m_iX11Type != 2 && w->m_pWorkspace == pWindow->m_pWorkspace && !w->m_bX11ShouldntFocus && - !w->m_sAdditionalConfigData.noFocus && w != pWindow) + !w->m_sWindowData.noFocus.valueOrDefault() && w != pWindow) return w; } diff --git a/src/layout/MasterLayout.cpp b/src/layout/MasterLayout.cpp index 965c0ed7..b5f2fa9f 100644 --- a/src/layout/MasterLayout.cpp +++ b/src/layout/MasterLayout.cpp @@ -264,7 +264,7 @@ void CHyprMasterLayout::onWindowRemovedTiling(PHLWINDOW pWindow) { const auto MASTERSLEFT = getMastersOnWorkspace(WORKSPACEID); static auto SMALLSPLIT = CConfigValue<Hyprlang::INT>("master:allow_small_split"); - pWindow->updateSpecialRenderData(); + pWindow->unsetWindowData(PRIORITY_LAYOUT); g_pCompositor->setWindowFullscreen(pWindow, false, FULLSCREEN_FULL); @@ -646,7 +646,7 @@ void CHyprMasterLayout::applyNodeDataToWindow(SMasterNodeData* pNode) { if (PWINDOW->m_bIsFullscreen && !pNode->ignoreFullscreenChecks) return; - PWINDOW->updateSpecialRenderData(); + PWINDOW->unsetWindowData(PRIORITY_LAYOUT); static auto PNOGAPSWHENONLY = CConfigValue<Hyprlang::INT>("master:no_gaps_when_only"); static auto PANIMATE = CConfigValue<Hyprlang::INT>("misc:animate_manual_resizes"); @@ -669,10 +669,10 @@ void CHyprMasterLayout::applyNodeDataToWindow(SMasterNodeData* pNode) { if (*PNOGAPSWHENONLY && !PWINDOW->onSpecialWorkspace() && (getNodesOnWorkspace(PWINDOW->workspaceID()) == 1 || (PWINDOW->m_bIsFullscreen && PWINDOW->m_pWorkspace->m_efFullscreenMode == FULLSCREEN_MAXIMIZED))) { - PWINDOW->m_sSpecialRenderData.border = WORKSPACERULE.border.value_or(*PNOGAPSWHENONLY == 2); - PWINDOW->m_sSpecialRenderData.decorate = WORKSPACERULE.decorate.value_or(true); - PWINDOW->m_sSpecialRenderData.rounding = false; - PWINDOW->m_sSpecialRenderData.shadow = false; + PWINDOW->m_sWindowData.decorate = CWindowOverridableVar(true, PRIORITY_LAYOUT); + PWINDOW->m_sWindowData.noBorder = CWindowOverridableVar(*PNOGAPSWHENONLY != 2, PRIORITY_LAYOUT); + PWINDOW->m_sWindowData.noRounding = CWindowOverridableVar(true, PRIORITY_LAYOUT); + PWINDOW->m_sWindowData.noShadow = CWindowOverridableVar(true, PRIORITY_LAYOUT); PWINDOW->updateWindowDecos(); @@ -922,7 +922,7 @@ void CHyprMasterLayout::fullscreenRequestForWindow(PHLWINDOW pWindow, eFullscree pWindow->m_vRealPosition = pWindow->m_vLastFloatingPosition; pWindow->m_vRealSize = pWindow->m_vLastFloatingSize; - pWindow->updateSpecialRenderData(); + pWindow->unsetWindowData(PRIORITY_LAYOUT); } } else { // if it now got fullscreen, make it fullscreen |