summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorVaxry <vaxry@vaxry.net>2023-11-12 13:01:23 +0000
committerVaxry <vaxry@vaxry.net>2023-11-12 13:01:23 +0000
commit91cbe93cf875c064847c76c6501d2a22c3f0abec (patch)
treed1f6418f9ad87d7079abe02d95a57f322e7ed63a /src
parent9afdd61adeaf413afbe853dbc5fdf6853c8bde21 (diff)
decoration: add NON_SOLID flag for shadow
fixes #3841
Diffstat (limited to 'src')
-rw-r--r--src/render/decorations/CHyprDropShadowDecoration.cpp4
-rw-r--r--src/render/decorations/CHyprDropShadowDecoration.hpp2
-rw-r--r--src/render/decorations/DecorationPositioner.cpp32
-rw-r--r--src/render/decorations/DecorationPositioner.hpp8
-rw-r--r--src/render/decorations/IHyprWindowDecoration.hpp1
5 files changed, 32 insertions, 15 deletions
diff --git a/src/render/decorations/CHyprDropShadowDecoration.cpp b/src/render/decorations/CHyprDropShadowDecoration.cpp
index 08234339..c992a4d8 100644
--- a/src/render/decorations/CHyprDropShadowDecoration.cpp
+++ b/src/render/decorations/CHyprDropShadowDecoration.cpp
@@ -26,6 +26,10 @@ void CHyprDropShadowDecoration::onPositioningReply(const SDecorationPositioningR
updateWindow(m_pWindow);
}
+uint64_t CHyprDropShadowDecoration::getDecorationFlags() {
+ return DECORATION_NON_SOLID;
+}
+
void CHyprDropShadowDecoration::damageEntire() {
static auto* const PSHADOWS = &g_pConfigManager->getConfigValuePtr("decoration:drop_shadow")->intValue;
diff --git a/src/render/decorations/CHyprDropShadowDecoration.hpp b/src/render/decorations/CHyprDropShadowDecoration.hpp
index c3e362c7..7820a76c 100644
--- a/src/render/decorations/CHyprDropShadowDecoration.hpp
+++ b/src/render/decorations/CHyprDropShadowDecoration.hpp
@@ -21,6 +21,8 @@ class CHyprDropShadowDecoration : public IHyprWindowDecoration {
virtual eDecorationLayer getDecorationLayer();
+ virtual uint64_t getDecorationFlags();
+
private:
SWindowDecorationExtents m_seExtents;
SWindowDecorationExtents m_seReportedExtents;
diff --git a/src/render/decorations/DecorationPositioner.cpp b/src/render/decorations/DecorationPositioner.cpp
index 62279ca5..840fd907 100644
--- a/src/render/decorations/DecorationPositioner.cpp
+++ b/src/render/decorations/DecorationPositioner.cpp
@@ -168,16 +168,20 @@ void CDecorationPositioner::onWindowUpdate(CWindow* pWindow) {
const bool LEFT = wd->positioningInfo.edges & DECORATION_EDGE_LEFT;
const bool RIGHT = wd->positioningInfo.edges & DECORATION_EDGE_RIGHT;
const int EDGESNO = TOP + BOTTOM + LEFT + RIGHT;
+ const bool SOLID = !(wd->pDecoration->getDecorationFlags() & DECORATION_NON_SOLID);
if (wd->positioningInfo.policy == DECORATION_POSITION_ABSOLUTE) {
- if (LEFT)
- stickyOffsetXL += wd->positioningInfo.desiredExtents.topLeft.x;
- if (RIGHT)
- stickyOffsetXR += wd->positioningInfo.desiredExtents.bottomRight.x;
- if (TOP)
- stickyOffsetYT += wd->positioningInfo.desiredExtents.topLeft.y;
- if (BOTTOM)
- stickyOffsetYB += wd->positioningInfo.desiredExtents.bottomRight.y;
+
+ if (SOLID) {
+ if (LEFT)
+ stickyOffsetXL += wd->positioningInfo.desiredExtents.topLeft.x;
+ if (RIGHT)
+ stickyOffsetXR += wd->positioningInfo.desiredExtents.bottomRight.x;
+ if (TOP)
+ stickyOffsetYT += wd->positioningInfo.desiredExtents.topLeft.y;
+ if (BOTTOM)
+ stickyOffsetYB += wd->positioningInfo.desiredExtents.bottomRight.y;
+ }
wd->lastReply = {};
wd->pDecoration->onPositioningReply({});
@@ -210,23 +214,27 @@ void CDecorationPositioner::onWindowUpdate(CWindow* pWindow) {
pos.x -= desiredSize;
size = {desiredSize, wb.size().y};
- stickyOffsetXL += desiredSize;
+ if (SOLID)
+ stickyOffsetXL += desiredSize;
} else if (RIGHT) {
pos = wb.pos() + Vector2D{wb.size().x, 0} - EDGEPOINT + Vector2D{stickyOffsetXR, 0};
size = {desiredSize, wb.size().y};
- stickyOffsetXR += desiredSize;
+ if (SOLID)
+ stickyOffsetXR += desiredSize;
} else if (TOP) {
pos = wb.pos() - EDGEPOINT - Vector2D{0, stickyOffsetYT};
pos.y -= desiredSize;
size = {wb.size().x, desiredSize};
- stickyOffsetYT += desiredSize;
+ if (SOLID)
+ stickyOffsetYT += desiredSize;
} else {
pos = wb.pos() + Vector2D{0, wb.size().y} - EDGEPOINT - Vector2D{0, stickyOffsetYB};
size = {wb.size().x, desiredSize};
- stickyOffsetYB += desiredSize;
+ if (SOLID)
+ stickyOffsetYB += desiredSize;
}
wd->lastReply = {{pos, size}, EPHEMERAL};
diff --git a/src/render/decorations/DecorationPositioner.hpp b/src/render/decorations/DecorationPositioner.hpp
index fca8eec2..ae4a814a 100644
--- a/src/render/decorations/DecorationPositioner.hpp
+++ b/src/render/decorations/DecorationPositioner.hpp
@@ -9,12 +9,14 @@
class CWindow;
class IHyprWindowDecoration;
-enum eDecorationPositioningPolicy {
- DECORATION_POSITION_ABSOLUTE = 0, /* Decoration does not interfere with anything else */
+enum eDecorationPositioningPolicy
+{
+ DECORATION_POSITION_ABSOLUTE = 0, /* Decoration wants absolute positioning */
DECORATION_POSITION_STICKY, /* Decoration is stuck to some edge of a window */
};
-enum eDecorationEdges {
+enum eDecorationEdges
+{
DECORATION_EDGE_TOP = 1 << 0,
DECORATION_EDGE_BOTTOM = 1 << 1,
DECORATION_EDGE_LEFT = 1 << 2,
diff --git a/src/render/decorations/IHyprWindowDecoration.hpp b/src/render/decorations/IHyprWindowDecoration.hpp
index 15890f44..c411a4d9 100644
--- a/src/render/decorations/IHyprWindowDecoration.hpp
+++ b/src/render/decorations/IHyprWindowDecoration.hpp
@@ -24,6 +24,7 @@ enum eDecorationFlags
{
DECORATION_ALLOWS_MOUSE_INPUT = 1 << 0, /* this decoration accepts mouse input */
DECORATION_PART_OF_MAIN_WINDOW = 1 << 1, /* this decoration is a *seamless* part of the main window, so stuff like shadows will include it */
+ DECORATION_NON_SOLID = 1 << 2, /* this decoration is not solid. Other decorations should draw on top of it. Example: shadow */
};
class CWindow;