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);
}
uint64_t CHyprDropShadowDecoration::getDecorationFlags() {
return DECORATION_NON_SOLID;
}
void CHyprDropShadowDecoration::damageEntire() {
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 uint64_t getDecorationFlags();
private:
SWindowDecorationExtents m_seExtents;
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 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};

View file

@ -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,

View file

@ -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;