diff options
| author | Danilo M. <danix@danix.xyz> | 2026-10-30 20:43:06 +0100 |
|---|---|---|
| committer | Danilo M. <danix@danix.xyz> | 2026-10-30 20:43:06 +0100 |
| commit | b3d57a7d89863104f68660ff72a763d3231d4db3 (patch) | |
| tree | df887f85da2f2bdd10b5bef592978a8c2e1ca426 /desktop/modules/monitors | |
| parent | a5d7986658a67803cbd204ac6e7ebc39b00e853c (diff) | |
| download | quickshell-b3d57a7d89863104f68660ff72a763d3231d4db3.tar.gz quickshell-b3d57a7d89863104f68660ff72a763d3231d4db3.zip | |
monitors: keep the drag, freeze the cards while pending
The page's ScrollView took a vertical drag and cancelled the MouseArea,
leaving the monitor drawn at its offset with nothing written; it now
prevents stealing and clears the offset on cancel. A click without
movement no longer snaps. The cards are disabled while an Apply waits
for Keep, which writes the draft and so must not write untried edits.
The mode list comes from orig, which set() leaves alone, so an edit to
another field does not hand the ComboBox a new model.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Diffstat (limited to 'desktop/modules/monitors')
| -rw-r--r-- | desktop/modules/monitors/MonitorsPage.qml | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/desktop/modules/monitors/MonitorsPage.qml b/desktop/modules/monitors/MonitorsPage.qml index df13d92..06fc182 100644 --- a/desktop/modules/monitors/MonitorsPage.qml +++ b/desktop/modules/monitors/MonitorsPage.qml @@ -127,6 +127,8 @@ Column { id: drag anchors.fill: parent enabled: !page.mod.pending + // The page's ScrollView would take a vertical drag. + preventStealing: true cursorShape: pressed ? Qt.ClosedHandCursor : Qt.OpenHandCursor property point start onPressed: m => start = mapToItem(canvas, m.x, m.y) @@ -135,7 +137,10 @@ Column { mon.dx = p.x - start.x; mon.dy = p.y - start.y; } + onCanceled: { mon.dx = 0; mon.dy = 0; } onReleased: { + // A click is not a move: it would snap, and make an auto position exact. + if (Math.hypot(mon.dx, mon.dy) < 4) { mon.dx = 0; mon.dy = 0; return; } const moved = { x: mon.r.x + mon.dx / canvas.k, y: mon.r.y + mon.dy / canvas.k, w: mon.r.w, h: mon.r.h }; const others = canvas.rects.filter((o, i) => i !== mon.index); const s = M.snap(moved, others, 64); @@ -169,6 +174,8 @@ Column { Column { id: rows anchors { fill: parent; margins: 14 } + // Keep writes the draft, so it may not change from what was tried. + enabled: !page.mod.pending spacing: 8 Text { @@ -182,7 +189,9 @@ Column { Label { text: "Mode" } Combo { width: 220 - model: card.d ? card.d.modes.map(m => m.replace("@", " @ ") + " Hz") : [] + // From orig, which set() leaves alone: a new model on every edit + // could reset the shown index. + model: page.mod.orig[card.index] ? page.mod.orig[card.index].modes.map(m => m.replace("@", " @ ") + " Hz") : [] currentIndex: card.d ? card.d.modes.indexOf(card.d.mode) : -1 onActivated: i => page.mod.set(card.index, "mode", card.d.modes[i]) } |
