summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorvaxerski <43317083+vaxerski@users.noreply.github.com>2023-02-28 19:36:36 +0000
committervaxerski <43317083+vaxerski@users.noreply.github.com>2023-02-28 19:36:36 +0000
commit4b20d4f1add40130653b9a3f2351eb44e0e0df4b (patch)
treedbf7a2038f30fba5fac49dd26989c005afa9c9e2 /src
parent7beb9fd606106e82554c7050aebbc5ca23dafa79 (diff)
Added decoration reserved area
Diffstat (limited to 'src')
-rw-r--r--src/Window.cpp16
-rw-r--r--src/Window.hpp57
-rw-r--r--src/managers/XWaylandManager.cpp6
-rw-r--r--src/managers/XWaylandManager.hpp2
-rw-r--r--src/render/Renderer.cpp7
-rw-r--r--src/render/decorations/IHyprWindowDecoration.cpp4
-rw-r--r--src/render/decorations/IHyprWindowDecoration.hpp2
7 files changed, 61 insertions, 33 deletions
diff --git a/src/Window.cpp b/src/Window.cpp
index 549133d5..e06c3d3a 100644
--- a/src/Window.cpp
+++ b/src/Window.cpp
@@ -88,6 +88,22 @@ wlr_box CWindow::getWindowIdealBoundingBoxIgnoreReserved() {
return wlr_box{(int)POS.x, (int)POS.y, (int)SIZE.x, (int)SIZE.y};
}
+SWindowDecorationExtents CWindow::getFullWindowReservedArea() {
+ SWindowDecorationExtents extents;
+
+ for (auto& wd : m_dWindowDecorations) {
+ const auto RESERVED = wd->getWindowDecorationReservedArea();
+
+ if (RESERVED.bottomRight == Vector2D{} && RESERVED.topLeft == Vector2D{})
+ continue;
+
+ extents.topLeft = extents.topLeft + RESERVED.topLeft;
+ extents.bottomRight = extents.bottomRight + RESERVED.bottomRight;
+ }
+
+ return extents;
+}
+
void CWindow::updateWindowDecos() {
for (auto& wd : m_dWindowDecorations)
wd->updateWindow(this);
diff --git a/src/Window.hpp b/src/Window.hpp
index 577b7432..bc81e60a 100644
--- a/src/Window.hpp
+++ b/src/Window.hpp
@@ -287,34 +287,35 @@ class CWindow {
}
// methods
- wlr_box getFullWindowBoundingBox();
- wlr_box getWindowIdealBoundingBoxIgnoreReserved();
- void updateWindowDecos();
- pid_t getPID();
- IHyprWindowDecoration* getDecorationByType(eDecorationType);
- void removeDecorationByType(eDecorationType);
- void createToplevelHandle();
- void destroyToplevelHandle();
- void updateToplevel();
- void updateSurfaceOutputs();
- void moveToWorkspace(int);
- CWindow* X11TransientFor();
- void onUnmap();
- void onMap();
- void setHidden(bool hidden);
- bool isHidden();
- void applyDynamicRule(const SWindowRule& r);
- void updateDynamicRules();
-
- void onBorderAngleAnimEnd(void* ptr);
- bool isInCurvedCorner(double x, double y);
- bool hasPopupAt(const Vector2D& pos);
-
- CWindow* getGroupHead();
- CWindow* getGroupTail();
- CWindow* getGroupCurrent();
- void setGroupCurrent(CWindow* pWindow);
- void insertWindowToGroup(CWindow* pWindow);
+ wlr_box getFullWindowBoundingBox();
+ wlr_box getWindowIdealBoundingBoxIgnoreReserved();
+ void updateWindowDecos();
+ pid_t getPID();
+ IHyprWindowDecoration* getDecorationByType(eDecorationType);
+ void removeDecorationByType(eDecorationType);
+ void createToplevelHandle();
+ void destroyToplevelHandle();
+ void updateToplevel();
+ void updateSurfaceOutputs();
+ void moveToWorkspace(int);
+ CWindow* X11TransientFor();
+ void onUnmap();
+ void onMap();
+ void setHidden(bool hidden);
+ bool isHidden();
+ void applyDynamicRule(const SWindowRule& r);
+ void updateDynamicRules();
+ SWindowDecorationExtents getFullWindowReservedArea();
+
+ void onBorderAngleAnimEnd(void* ptr);
+ bool isInCurvedCorner(double x, double y);
+ bool hasPopupAt(const Vector2D& pos);
+
+ CWindow* getGroupHead();
+ CWindow* getGroupTail();
+ CWindow* getGroupCurrent();
+ void setGroupCurrent(CWindow* pWindow);
+ void insertWindowToGroup(CWindow* pWindow);
private:
// For hidden windows and stuff
diff --git a/src/managers/XWaylandManager.cpp b/src/managers/XWaylandManager.cpp
index d67441c7..3f8f51e8 100644
--- a/src/managers/XWaylandManager.cpp
+++ b/src/managers/XWaylandManager.cpp
@@ -136,7 +136,11 @@ void CHyprXWaylandManager::sendCloseWindow(CWindow* pWindow) {
}
}
-void CHyprXWaylandManager::setWindowSize(CWindow* pWindow, const Vector2D& size, bool force) {
+void CHyprXWaylandManager::setWindowSize(CWindow* pWindow, Vector2D size, bool force) {
+
+ const auto RESERVED = pWindow->getFullWindowReservedArea();
+
+ size = size - RESERVED.topLeft - RESERVED.bottomRight;
if (!force &&
((pWindow->m_vReportedSize == size && pWindow->m_vRealPosition.vec() == pWindow->m_vReportedPosition) || (pWindow->m_vReportedSize == size && !pWindow->m_bIsX11)))
diff --git a/src/managers/XWaylandManager.hpp b/src/managers/XWaylandManager.hpp
index cb3daaf5..bb4fd640 100644
--- a/src/managers/XWaylandManager.hpp
+++ b/src/managers/XWaylandManager.hpp
@@ -17,7 +17,7 @@ class CHyprXWaylandManager {
std::string getTitle(CWindow*);
std::string getAppIDClass(CWindow*);
void sendCloseWindow(CWindow*);
- void setWindowSize(CWindow*, const Vector2D&, bool force = false);
+ void setWindowSize(CWindow*, Vector2D, bool force = false);
void setWindowStyleTiled(CWindow*, uint32_t);
void setWindowFullscreen(CWindow*, bool);
wlr_surface* surfaceAt(CWindow*, const Vector2D&, Vector2D&);
diff --git a/src/render/Renderer.cpp b/src/render/Renderer.cpp
index 07f043de..0914eb49 100644
--- a/src/render/Renderer.cpp
+++ b/src/render/Renderer.cpp
@@ -237,7 +237,8 @@ void CHyprRenderer::renderWindow(CWindow* pWindow, CMonitor* pMonitor, timespec*
}
const auto PWORKSPACE = g_pCompositor->getWorkspaceByID(pWindow->m_iWorkspaceID);
- const auto REALPOS = pWindow->m_vRealPosition.vec() + (pWindow->m_bPinned ? Vector2D{} : PWORKSPACE->m_vRenderOffset.vec());
+ const auto RESERVED = pWindow->getFullWindowReservedArea();
+ const auto REALPOS = pWindow->m_vRealPosition.vec() + (pWindow->m_bPinned ? Vector2D{} : PWORKSPACE->m_vRenderOffset.vec()) + RESERVED.topLeft;
static auto* const PNOFLOATINGBORDERS = &g_pConfigManager->getConfigValuePtr("general:no_border_on_floating")->intValue;
static auto* const PDIMAROUND = &g_pConfigManager->getConfigValuePtr("decoration:dim_around")->floatValue;
@@ -251,8 +252,8 @@ void CHyprRenderer::renderWindow(CWindow* pWindow, CMonitor* pMonitor, timespec*
decorate = false;
renderdata.surface = g_pXWaylandManager->getWindowSurface(pWindow);
- renderdata.w = std::max(pWindow->m_vRealSize.vec().x, 5.0); // clamp the size to min 5,
- renderdata.h = std::max(pWindow->m_vRealSize.vec().y, 5.0); // otherwise we'll have issues later with invalid boxes
+ renderdata.w = std::max(pWindow->m_vRealSize.vec().x - RESERVED.topLeft.x - RESERVED.bottomRight.x, 5.0); // clamp the size to min 5,
+ renderdata.h = std::max(pWindow->m_vRealSize.vec().y - RESERVED.topLeft.y - RESERVED.bottomRight.y, 5.0); // otherwise we'll have issues later with invalid boxes
renderdata.dontRound = (pWindow->m_bIsFullscreen && PWORKSPACE->m_efFullscreenMode == FULLSCREEN_FULL) || (!pWindow->m_sSpecialRenderData.rounding);
renderdata.fadeAlpha = pWindow->m_fAlpha.fl() * (pWindow->m_bPinned ? 1.f : PWORKSPACE->m_fAlpha.fl());
renderdata.alpha = pWindow->m_fActiveInactiveAlpha.fl();
diff --git a/src/render/decorations/IHyprWindowDecoration.cpp b/src/render/decorations/IHyprWindowDecoration.cpp
index 1271a712..1c1fe734 100644
--- a/src/render/decorations/IHyprWindowDecoration.cpp
+++ b/src/render/decorations/IHyprWindowDecoration.cpp
@@ -3,3 +3,7 @@
#include "../../Window.hpp"
IHyprWindowDecoration::~IHyprWindowDecoration() {}
+
+SWindowDecorationExtents IHyprWindowDecoration::getWindowDecorationReservedArea() {
+ return SWindowDecorationExtents{};
+}
diff --git a/src/render/decorations/IHyprWindowDecoration.hpp b/src/render/decorations/IHyprWindowDecoration.hpp
index 4cd52cba..f07746ef 100644
--- a/src/render/decorations/IHyprWindowDecoration.hpp
+++ b/src/render/decorations/IHyprWindowDecoration.hpp
@@ -31,4 +31,6 @@ interface IHyprWindowDecoration {
virtual void updateWindow(CWindow*) = 0;
virtual void damageEntire() = 0;
+
+ virtual SWindowDecorationExtents getWindowDecorationReservedArea();
}; \ No newline at end of file