From 4429c038377a2c59dfcab6fe2424fb2c3a99d2cd Mon Sep 17 00:00:00 2001 From: outfoxxed Date: Sun, 8 Feb 2026 20:10:11 -0800 Subject: [PATCH 1/2] widgets/cliprect: fix ShaderEffect warnings on reload layer.effect causes warnings on reload for an unknown reason which seems to be ownership or destruction time related. This commit uses an alternate strategy to create the shader which does not show this warning. --- src/widgets/ClippingRectangle.qml | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/src/widgets/ClippingRectangle.qml b/src/widgets/ClippingRectangle.qml index 3fc64d8..749b331 100644 --- a/src/widgets/ClippingRectangle.qml +++ b/src/widgets/ClippingRectangle.qml @@ -66,20 +66,22 @@ Item { Item { id: contentItemContainer anchors.fill: root + layer.enabled: true + visible: false Item { id: contentItem anchors.fill: parent anchors.margins: root.contentInsideBorder ? root.border.width : 0 } + } - layer.enabled: true - layer.samplerName: "content" - layer.effect: ShaderEffect { - fragmentShader: `qrc:/Quickshell/Widgets/shaders/cliprect${root.contentUnderBorder ? "-ub" : ""}.frag.qsb` - property Rectangle rect: rectangle - property color backgroundColor: root.color - property color borderColor: root.border.color - } + ShaderEffect { + anchors.fill: contentItemContainer + fragmentShader: `qrc:/Quickshell/Widgets/shaders/cliprect${root.contentUnderBorder ? "-ub" : ""}.frag.qsb` + property Item content: contentItemContainer + property Rectangle rect: rectangle + property color backgroundColor: root.color + property color borderColor: root.border.color } } From dacfa9de829ac7cb173825f593236bf2c21f637e Mon Sep 17 00:00:00 2001 From: outfoxxed Date: Mon, 9 Feb 2026 19:14:36 -0800 Subject: [PATCH 2/2] widgets/cliprect: use ShaderEffectSource to propagate mouse events --- src/widgets/ClippingRectangle.qml | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/src/widgets/ClippingRectangle.qml b/src/widgets/ClippingRectangle.qml index 749b331..604f346 100644 --- a/src/widgets/ClippingRectangle.qml +++ b/src/widgets/ClippingRectangle.qml @@ -26,7 +26,7 @@ Item { /// Defaults to true if any corner has a non-zero radius, otherwise false. property /*bool*/alias antialiasing: rectangle.antialiasing /// The background color of the rectangle, which goes under its content. - property color color: "white" + property /*color*/alias color: shader.backgroundColor /// See @@QtQuick.Rectangle.border. property clippingRectangleBorder border /// Radius of all corners. Defaults to 0. @@ -66,8 +66,6 @@ Item { Item { id: contentItemContainer anchors.fill: root - layer.enabled: true - visible: false Item { id: contentItem @@ -76,12 +74,19 @@ Item { } } + ShaderEffectSource { + id: shaderSource + hideSource: true + sourceItem: contentItemContainer + } + ShaderEffect { - anchors.fill: contentItemContainer + id: shader + anchors.fill: root fragmentShader: `qrc:/Quickshell/Widgets/shaders/cliprect${root.contentUnderBorder ? "-ub" : ""}.frag.qsb` - property Item content: contentItemContainer property Rectangle rect: rectangle - property color backgroundColor: root.color + property color backgroundColor: "white" property color borderColor: root.border.color + property ShaderEffectSource content: shaderSource } }