Review everything shipped this weekend, and fix what the reviewers caught
Claude-Session: https://claude.ai/code/session_01Ms2FbjQy31TVf3CEvQhGM8
This commit is contained in:
@@ -248,13 +248,34 @@ Rectangle {
|
||||
// are their own surface: leaving the icon to reach them would otherwise
|
||||
// close the thing being reached for.
|
||||
property Item previewAnchor: null
|
||||
property var previewApp: null
|
||||
|
||||
// Looked up in the live model rather than snapshotted when the dwell fires.
|
||||
// `items` is rebuilt into fresh objects whenever any window opens or
|
||||
// closes, so a snapshot keeps the window list the app had when the pointer
|
||||
// stopped moving: a window closed while its preview is up stays in the
|
||||
// strip, and its ScreencopyView goes on holding a handle to a surface that
|
||||
// no longer exists. Reading it back out of `items` means the strip empties
|
||||
// itself, and an app whose last window closed drops the preview entirely.
|
||||
readonly property var previewApp: {
|
||||
const anchor = root.previewAnchor;
|
||||
if (!anchor || !anchor.app)
|
||||
return null;
|
||||
const id = anchor.app.appId;
|
||||
for (let i = 0; i < root.items.length; i++) {
|
||||
if (root.items[i].appId === id)
|
||||
return root.items[i];
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
// Written by the Dock from the preview popup's own hover.
|
||||
property bool previewHovered: false
|
||||
|
||||
onHoveredItemChanged: root.reconsiderPreview()
|
||||
onPreviewHoveredChanged: root.reconsiderPreview()
|
||||
// A window opening or closing changes what the strip should be showing --
|
||||
// including, when it was the last one, whether there should be a strip.
|
||||
onItemsChanged: root.reconsiderPreview()
|
||||
|
||||
function reconsiderPreview(): void {
|
||||
const item = root.hoveredItem;
|
||||
@@ -277,7 +298,6 @@ Rectangle {
|
||||
previewDwell.stop();
|
||||
previewGrace.stop();
|
||||
root.previewAnchor = null;
|
||||
root.previewApp = null;
|
||||
root.previewHovered = false;
|
||||
}
|
||||
|
||||
@@ -289,7 +309,6 @@ Rectangle {
|
||||
if (!item || !item.app || !item.app.windows || item.app.windows.length === 0)
|
||||
return;
|
||||
root.previewAnchor = item;
|
||||
root.previewApp = item.app;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -375,6 +394,13 @@ Rectangle {
|
||||
onDragMoved: travel => root.moveDrag(travel)
|
||||
onDragEnded: root.endDrag()
|
||||
onDragCancelled: root.cancelDrag()
|
||||
|
||||
// Keying the model keeps a delegate alive through a rebuild,
|
||||
// but not through the app's last window closing while it is
|
||||
// being dragged: that row is gone, and the release it owed is
|
||||
// gone with it. Without this the dock keeps dragIndex forever,
|
||||
// which reads as a dock that will not hide again.
|
||||
Component.onDestruction: if (root.dragIndex === dockItem.index) root.cancelDrag()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user