decoration: add NON_SOLID flag for shadow

fixes #3841
This commit is contained in:
Vaxry 2023-11-12 13:01:23 +00:00
parent 9afdd61ade
commit 91cbe93cf8
5 changed files with 32 additions and 15 deletions

View file

@ -26,6 +26,10 @@ void CHyprDropShadowDecoration::onPositioningReply(const SDecorationPositioningR
updateWindow(m_pWindow); updateWindow(m_pWindow);
} }
uint64_t CHyprDropShadowDecoration::getDecorationFlags() {
return DECORATION_NON_SOLID;
}
void CHyprDropShadowDecoration::damageEntire() { void CHyprDropShadowDecoration::damageEntire() {
static auto* const PSHADOWS = &g_pConfigManager->getConfigValuePtr("decoration:drop_shadow")->intValue; static auto* const PSHADOWS = &g_pConfigManager->getConfigValuePtr("decoration:drop_shadow")->intValue;

View file

@ -21,6 +21,8 @@ class CHyprDropShadowDecoration : public IHyprWindowDecoration {
virtual eDecorationLayer getDecorationLayer(); virtual eDecorationLayer getDecorationLayer();
virtual uint64_t getDecorationFlags();
private: private:
SWindowDecorationExtents m_seExtents; SWindowDecorationExtents m_seExtents;
SWindowDecorationExtents m_seReportedExtents; SWindowDecorationExtents m_seReportedExtents;

View file

@ -168,16 +168,20 @@ void CDecorationPositioner::onWindowUpdate(CWindow* pWindow) {
const bool LEFT = wd->positioningInfo.edges & DECORATION_EDGE_LEFT; const bool LEFT = wd->positioningInfo.edges & DECORATION_EDGE_LEFT;
const bool RIGHT = wd->positioningInfo.edges & DECORATION_EDGE_RIGHT; const bool RIGHT = wd->positioningInfo.edges & DECORATION_EDGE_RIGHT;
const int EDGESNO = TOP + BOTTOM + LEFT + 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 (wd->positioningInfo.policy == DECORATION_POSITION_ABSOLUTE) {
if (LEFT)
stickyOffsetXL += wd->positioningInfo.desiredExtents.topLeft.x; if (SOLID) {
if (RIGHT) if (LEFT)
stickyOffsetXR += wd->positioningInfo.desiredExtents.bottomRight.x; stickyOffsetXL += wd->positioningInfo.desiredExtents.topLeft.x;
if (TOP) if (RIGHT)
stickyOffsetYT += wd->positioningInfo.desiredExtents.topLeft.y; stickyOffsetXR += wd->positioningInfo.desiredExtents.bottomRight.x;
if (BOTTOM) if (TOP)
stickyOffsetYB += wd->positioningInfo.desiredExtents.bottomRight.y; stickyOffsetYT += wd->positioningInfo.desiredExtents.topLeft.y;
if (BOTTOM)
stickyOffsetYB += wd->positioningInfo.desiredExtents.bottomRight.y;
}
wd->lastReply = {}; wd->lastReply = {};
wd->pDecoration->onPositioningReply({}); wd->pDecoration->onPositioningReply({});
@ -210,23 +214,27 @@ void CDecorationPositioner::onWindowUpdate(CWindow* pWindow) {
pos.x -= desiredSize; pos.x -= desiredSize;
size = {desiredSize, wb.size().y}; size = {desiredSize, wb.size().y};
stickyOffsetXL += desiredSize; if (SOLID)
stickyOffsetXL += desiredSize;
} else if (RIGHT) { } else if (RIGHT) {
pos = wb.pos() + Vector2D{wb.size().x, 0} - EDGEPOINT + Vector2D{stickyOffsetXR, 0}; pos = wb.pos() + Vector2D{wb.size().x, 0} - EDGEPOINT + Vector2D{stickyOffsetXR, 0};
size = {desiredSize, wb.size().y}; size = {desiredSize, wb.size().y};
stickyOffsetXR += desiredSize; if (SOLID)
stickyOffsetXR += desiredSize;
} else if (TOP) { } else if (TOP) {
pos = wb.pos() - EDGEPOINT - Vector2D{0, stickyOffsetYT}; pos = wb.pos() - EDGEPOINT - Vector2D{0, stickyOffsetYT};
pos.y -= desiredSize; pos.y -= desiredSize;
size = {wb.size().x, desiredSize}; size = {wb.size().x, desiredSize};
stickyOffsetYT += desiredSize; if (SOLID)
stickyOffsetYT += desiredSize;
} else { } else {
pos = wb.pos() + Vector2D{0, wb.size().y} - EDGEPOINT - Vector2D{0, stickyOffsetYB}; pos = wb.pos() + Vector2D{0, wb.size().y} - EDGEPOINT - Vector2D{0, stickyOffsetYB};
size = {wb.size().x, desiredSize}; size = {wb.size().x, desiredSize};
stickyOffsetYB += desiredSize; if (SOLID)
stickyOffsetYB += desiredSize;
} }
wd->lastReply = {{pos, size}, EPHEMERAL}; wd->lastReply = {{pos, size}, EPHEMERAL};

View file

@ -9,12 +9,14 @@
class CWindow; class CWindow;
class IHyprWindowDecoration; class IHyprWindowDecoration;
enum eDecorationPositioningPolicy { enum eDecorationPositioningPolicy
DECORATION_POSITION_ABSOLUTE = 0, /* Decoration does not interfere with anything else */ {
DECORATION_POSITION_ABSOLUTE = 0, /* Decoration wants absolute positioning */
DECORATION_POSITION_STICKY, /* Decoration is stuck to some edge of a window */ DECORATION_POSITION_STICKY, /* Decoration is stuck to some edge of a window */
}; };
enum eDecorationEdges { enum eDecorationEdges
{
DECORATION_EDGE_TOP = 1 << 0, DECORATION_EDGE_TOP = 1 << 0,
DECORATION_EDGE_BOTTOM = 1 << 1, DECORATION_EDGE_BOTTOM = 1 << 1,
DECORATION_EDGE_LEFT = 1 << 2, DECORATION_EDGE_LEFT = 1 << 2,

View file

@ -24,6 +24,7 @@ enum eDecorationFlags
{ {
DECORATION_ALLOWS_MOUSE_INPUT = 1 << 0, /* this decoration accepts mouse input */ 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_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; class CWindow;