quickshell: fix bottom-right concave ear position

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
rope 2026-05-27 10:01:38 +01:00
parent d6bbf44566
commit b0f2b9bfd4

View file

@ -1185,8 +1185,8 @@ in
anchor.adjustment: alignRight ? PopupAdjustment.None : PopupAdjustment.Slide anchor.adjustment: alignRight ? PopupAdjustment.None : PopupAdjustment.Slide
visible: false visible: false
color: "transparent" color: "transparent"
implicitWidth: alignRight ? fullWidth + 8 + 20 : fullWidth + 16 implicitWidth: fullWidth + (alignRight ? 8 : 16)
implicitHeight: alignRight ? fullHeight + 4 + 8 : fullHeight + 4 implicitHeight: fullHeight + 4 + (alignRight ? 8 : 0)
onVisibleChanged: { onVisibleChanged: {
if (visible) { if (visible) {
@ -1267,17 +1267,16 @@ in
Rectangle { Rectangle {
id: _dropdownRect id: _dropdownRect
anchors.left: dropdown.alignRight ? undefined : undefined
anchors.right: dropdown.alignRight ? parent.right : undefined anchors.right: dropdown.alignRight ? parent.right : undefined
anchors.horizontalCenter: dropdown.alignRight ? undefined : parent.horizontalCenter anchors.horizontalCenter: dropdown.alignRight ? undefined : parent.horizontalCenter
anchors.top: parent.top anchors.top: parent.top
width: dropdown.alignRight ? dropdown.fullWidth + 20 : dropdown.fullWidth width: dropdown.fullWidth
height: dropdown.open ? dropdown.fullHeight : 0 height: dropdown.open ? dropdown.fullHeight : 0
color: Theme.barBg color: Theme.barBg
radius: 8 radius: 8
topLeftRadius: 0 topLeftRadius: 0
topRightRadius: 0 topRightRadius: 0
bottomRightRadius: 0 bottomRightRadius: dropdown.alignRight ? 0 : 8
clip: true clip: true
Behavior on height { Behavior on height {
@ -1286,20 +1285,17 @@ in
Item { Item {
id: dropdownContent id: dropdownContent
anchors.left: parent.left anchors.fill: parent
anchors.top: parent.top
anchors.bottom: parent.bottom
width: dropdown.fullWidth
} }
} }
// Bottom concave ear on right edge // Bottom-right concave ear connects dropdown bottom to right screen edge
Item { Item {
visible: dropdown.alignRight && _dropdownRect.height > 0 visible: dropdown.alignRight && _dropdownRect.height > 0
anchors.right: parent.right anchors.right: _dropdownRect.right
y: _dropdownRect.height anchors.top: _dropdownRect.bottom
width: 8 width: 8
height: 8 height: Math.min(8, _dropdownRect.height)
clip: true clip: true
Canvas { Canvas {
width: 8; height: 8 width: 8; height: 8
@ -1308,7 +1304,8 @@ in
ctx.clearRect(0, 0, 8, 8); ctx.clearRect(0, 0, 8, 8);
ctx.fillStyle = Theme.barBg; ctx.fillStyle = Theme.barBg;
ctx.beginPath(); ctx.beginPath();
ctx.moveTo(8, 0); ctx.lineTo(8, 8); ctx.lineTo(0, 8); // Fill top-right triangle with concave arc
ctx.moveTo(8, 0); ctx.lineTo(8, 8);
ctx.arc(0, 0, 8, Math.PI / 2, 0, true); ctx.arc(0, 0, 8, Math.PI / 2, 0, true);
ctx.closePath(); ctx.fill(); ctx.closePath(); ctx.fill();
} }