Skip to main content

Module drag_bus

Module drag_bus 

Expand description

What is being dragged, across widgets in one window.

A DragRun reorders its own items by itself. A drag that leaves the run — a dock item dragged onto a bar’s strip, a search result dragged onto a dock — needs every other run in the window to know it is there: which one it came from, its label, where the pointer is, and where it was let go.

This is that one place, per thread (a window’s widgets all run on its own thread). A run publishes when an item lifts past the drag threshold and clears when it is let go; every run reads it while it is up; the release records the drop, and the run whose extent holds the pointer takes it in its next update, as one action of the owner’s.

It holds no model: the payload is opaque bytes the owner put there, and the drop names the run it landed in so the owner can route it.

Structs§

InFlight
What a drag in flight is.
Landed
A drag that was let go outside its own run, waiting for the run it landed in to take it.

Functions§

current
What is in flight now, if anything.
end
The drag ended: None for a cancel, or where it was let go for a drop another run takes.
moved
The pointer moved while something is in flight: what every run needs to show where it would land.
publish
run lifted an item: everything else in the window may take it now.
take
Take the drop run takes, if the last drag ended inside its extent and came from somewhere else. One run takes it; the rest see nothing.