Selection: fix untappable chip and the chip that never cleared
Two bugs from the first on-device run. The card sized itself from a layout it also centered, which resolved to zero, so mask claimed a zero-size input region: the chip painted but no tap landed. Card now sizes from the layout's implicit size and the background is a plain Item child, not layout-managed. wl-paste --watch replays the existing selection on start, so every watcher restart (every unlock) resurrected a stale selection that could never be cleared because the primary buffer never changed again. The first emission after a start now only sets the baseline, and a dismissed selection is remembered so a re-read cannot revive it.
This commit is contained in:
parent
808f06358e
commit
5a643d7059
2 changed files with 64 additions and 23 deletions
|
|
@ -92,12 +92,22 @@ Scope {
|
|||
return Math.min(win.hintY + 16, win.height - card.height - win.pad);
|
||||
}
|
||||
|
||||
// `card` takes its size from the layout's implicit size, and the
|
||||
// layout takes its size from its own — no path where a child's size
|
||||
// depends on the parent's. The earlier version centered the layout
|
||||
// in the card while the card sized from the layout, which resolved
|
||||
// to zero and silently made `mask` a zero-size input region: the
|
||||
// chip painted but nothing could be tapped. The background stays a
|
||||
// plain Item child, because anchors on a layout-managed item are
|
||||
// undefined behavior.
|
||||
Item {
|
||||
id: card
|
||||
x: win.targetX
|
||||
y: win.targetY
|
||||
width: content.implicitWidth
|
||||
height: content.implicitHeight
|
||||
implicitWidth: content.implicitWidth
|
||||
implicitHeight: content.implicitHeight
|
||||
width: implicitWidth
|
||||
height: implicitHeight
|
||||
|
||||
// Position eases so a re-selection slides rather than teleports,
|
||||
// but only once mapped — animating from 0,0 on first show reads
|
||||
|
|
@ -113,6 +123,7 @@ Scope {
|
|||
|
||||
Rectangle {
|
||||
anchors.fill: parent
|
||||
z: -1
|
||||
radius: Appearance.rounding.normal
|
||||
color: Appearance.colors.colLayer1
|
||||
border.width: 1
|
||||
|
|
@ -121,33 +132,36 @@ Scope {
|
|||
|
||||
ColumnLayout {
|
||||
id: content
|
||||
anchors.centerIn: parent
|
||||
anchors.left: parent.left
|
||||
anchors.top: parent.top
|
||||
width: implicitWidth
|
||||
height: implicitHeight
|
||||
spacing: 0
|
||||
|
||||
// ── collapsed: the chip ──────────────────────────────
|
||||
SelectionChip {
|
||||
visible: !scope.expanded
|
||||
charCount: Selection.text.length
|
||||
onTapped: {
|
||||
DeviceEvidence.touched("selection-menu");
|
||||
Haptics.trigger("button-pressed");
|
||||
scope.expanded = true;
|
||||
}
|
||||
onDismissed: {
|
||||
DeviceEvidence.touched("selection-menu");
|
||||
Selection.dismiss();
|
||||
}
|
||||
// ── collapsed: the chip ──────────────────────────────────
|
||||
SelectionChip {
|
||||
visible: !scope.expanded
|
||||
charCount: Selection.text.length
|
||||
onTapped: {
|
||||
DeviceEvidence.touched("selection-menu");
|
||||
Haptics.trigger("button-pressed");
|
||||
scope.expanded = true;
|
||||
}
|
||||
onDismissed: {
|
||||
DeviceEvidence.touched("selection-menu");
|
||||
Selection.dismiss();
|
||||
}
|
||||
}
|
||||
|
||||
// ── expanded: the actions ────────────────────────────
|
||||
SelectionActions {
|
||||
visible: scope.expanded
|
||||
onActed: {
|
||||
DeviceEvidence.touched("selection-menu");
|
||||
Selection.dismiss();
|
||||
}
|
||||
// ── expanded: the actions ────────────────────────────────
|
||||
SelectionActions {
|
||||
visible: scope.expanded
|
||||
onActed: {
|
||||
DeviceEvidence.touched("selection-menu");
|
||||
Selection.dismiss();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue