quickshell: fix concave corners with direct path drawing

Replace broken destination-out compositing with direct Canvas
path fill — draws only the concave shape without alpha tricks.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
rope 2026-05-26 14:49:54 +01:00
parent 8c6ab7984d
commit 5e78dc42dc

View file

@ -856,66 +856,58 @@ in
} }
// Concave corner left // Concave corner left
Rectangle { Canvas {
id: cornerLeft id: cornerLeft
anchors.right: calContent.left anchors.right: calContent.left
anchors.top: parent.top anchors.top: parent.top
width: 8 width: 8
height: 8 height: 8
color: "#D1${c.base00}"
visible: calPopup.open visible: calPopup.open
opacity: calPopup.open ? 1.0 : 0.0 opacity: calPopup.open ? 1.0 : 0.0
Behavior on opacity { NumberAnimation { duration: 150 } } Behavior on opacity { NumberAnimation { duration: 150 } }
onPaint: {
Rectangle { var ctx = getContext("2d");
anchors.fill: parent var r = width;
color: "transparent" ctx.clearRect(0, 0, width, height);
radius: 8 ctx.fillStyle = "#D1${c.base00}";
Rectangle { // Draw filled area: full square minus quarter-circle cutout
anchors.fill: parent // The quarter circle is centered at top-left (0,0), radius = width
color: "transparent" ctx.beginPath();
} ctx.moveTo(r, 0); // top-right corner
} ctx.lineTo(r, r); // bottom-right corner
ctx.lineTo(0, r); // bottom-left corner
Canvas { // Arc from bottom-left back to top-right, curving inward
anchors.fill: parent ctx.arc(0, 0, r, Math.PI / 2, 0, true);
onPaint: { ctx.closePath();
var ctx = getContext("2d"); ctx.fill();
ctx.clearRect(0, 0, width, height);
ctx.fillStyle = "#D1${c.base00}";
ctx.fillRect(0, 0, width, height);
ctx.globalCompositeOperation = "destination-out";
ctx.beginPath();
ctx.arc(0, 0, width, 0, Math.PI / 2);
ctx.fill();
}
} }
} }
// Concave corner right // Concave corner right
Rectangle { Canvas {
id: cornerRight id: cornerRight
anchors.left: calContent.right anchors.left: calContent.right
anchors.top: parent.top anchors.top: parent.top
width: 8 width: 8
height: 8 height: 8
color: "#D1${c.base00}"
visible: calPopup.open visible: calPopup.open
opacity: calPopup.open ? 1.0 : 0.0 opacity: calPopup.open ? 1.0 : 0.0
Behavior on opacity { NumberAnimation { duration: 150 } } Behavior on opacity { NumberAnimation { duration: 150 } }
onPaint: {
Canvas { var ctx = getContext("2d");
anchors.fill: parent var r = width;
onPaint: { ctx.clearRect(0, 0, width, height);
var ctx = getContext("2d"); ctx.fillStyle = "#D1${c.base00}";
ctx.clearRect(0, 0, width, height); // Draw filled area: full square minus quarter-circle cutout
ctx.fillStyle = "#D1${c.base00}"; // The quarter circle is centered at top-right (width,0), radius = width
ctx.fillRect(0, 0, width, height); ctx.beginPath();
ctx.globalCompositeOperation = "destination-out"; ctx.moveTo(0, 0); // top-left corner
ctx.beginPath(); ctx.lineTo(0, r); // bottom-left corner
ctx.arc(width, 0, width, Math.PI / 2, Math.PI); ctx.lineTo(r, r); // bottom-right corner
ctx.fill(); // Arc from bottom-right back to top-left, curving inward
} ctx.arc(r, 0, r, Math.PI / 2, Math.PI, false);
ctx.closePath();
ctx.fill();
} }
} }