Window drag trigger
When dragging a window opens Teleport to Cua: move versus resize, the notch line and the dwell.
When dragging a window opens Teleport to Cua: move versus resize, the notch line and the dwell.
These APIs are part of the Cua Spaces app export for building Spaces UIs. They are source-available under FSL-1.1-MIT and ship for Swift only (import CuaSpacesFFI); the Rust tab shows the cua-spaces-ffi crate they come from. The open source SDK packages for Python, TypeScript and Kotlin do not include them.
app_drag_classify tells a move from a resize by the window's frame. app_drag_trigger_initial and app_drag_trigger_apply run the trigger: the cursor passes a line 5 pt above the notch's bottom edge, or rests 0.3 s in the Teleport to Cua box. app_drag_displays and app_drag_portal_displays give the notch geometry of each display.
AppStillAnchor record#| Field | Type | Default | Description |
|---|---|---|---|
x | f64 | X. | |
y | f64 | Y. | |
since_ms / sinceMs | u64 | When (ms, the shell's monotonic clock). |
AppTriggerPhase enum#.hidden
.prompt
.expanded| Variant | Description |
|---|---|
Hidden | Nothing (no drag, a resize, or not known yet). |
Prompt | The "Teleport to Cua" box. |
Expanded | The Space tiles as drop targets. |
AppDragDisplay record#Returned by app_drag_displays, app_drag_portal_displays.
| Field | Type | Default | Description |
|---|---|---|---|
frame | AppLogicalRect | The display. | |
notch | AppLogicalRect | The notch (or, without one, the menu-bar-high stand-in). | |
prompt | AppLogicalRect | The "Teleport to Cua" box: the dwell area. | |
expanded | AppLogicalRect | The expanded panel: the drag stays expanded inside it. |
AppDragTriggerState record#Returned by app_drag_trigger_initial.
| Field | Type | Default | Description |
|---|---|---|---|
active | bool | A drag is in flight. | |
kind | AppDragKind | Move or resize. | |
phase | AppTriggerPhase | What shows. | |
window_id / windowId | Option<u32> | The dragged window. | |
app_name / appName | Option<String> | Its app's name. | |
start_frame / startFrame | Option<AppLogicalRect> | The window's frame at mouse down. | |
display | Option<u32> | The display (index into the shell's list) the panel expanded on. | |
still | Option<AppStillAnchor> | Where the cursor rests, while it rests in the box. |
AppDragTriggerTransition record#Returned by app_drag_trigger_apply.
| Field | Type | Default | Description |
|---|---|---|---|
state | AppDragTriggerState | New state. | |
overlay | Vec<AppDragOverlayEvent> | Feed these to the drag overlay, in order. A drop carries no Space: the shell puts in the tile under the cursor, if any. | |
tick_at_ms / tickAtMs | Option<u64> | Send a tick at this time (replacing any earlier request); none cancels it. |
AppDragKind enum#.pending
.move
.resize| Variant | Description |
|---|---|
Pending | Not known yet (no frames, or they have not changed enough). |
Move | The window follows the cursor at its size. |
Resize | An edge or a corner: the size changes. |
AppDragTriggerEvent enum#.start(windowId: UInt32?, appName: String?, x: Double, y: Double, tMs: UInt64, startFrame: AppLogicalRect?, frame: AppLogicalRect?)
.cursor(x: Double, y: Double, tMs: UInt64)
.frame(frame: AppLogicalRect)
.tick(tMs: UInt64)
.end(x: Double, y: Double, tMs: UInt64)
.cancel| Variant | Description |
|---|---|
Start | A window drag started (the SDK's start). Fields: window_id: Option<u32>, app_name: Option<String>, x: f64, y: f64, t_ms: u64, start_frame: Option<AppLogicalRect>, frame: Option<AppLogicalRect> |
Cursor | The cursor moved. Fields: x: f64, y: f64, t_ms: u64 |
Frame | The dragged window's frame. Fields: frame: AppLogicalRect |
Tick | The timer DragTriggerTransition.tick_at_ms asked for fired. Fields: t_ms: u64 |
End | Released. Fields: x: f64, y: f64, t_ms: u64 |
Cancel | Abort (the notch was hidden, the monitor stopped). |
app_drag_classify#A window's frame at mouse down against a later one: move, resize, or not known yet.
func appDragClassify(start: AppLogicalRect, now: AppLogicalRect) -> AppDragKind| Parameter | Type | Default |
|---|---|---|
start | AppLogicalRect | required |
now | AppLogicalRect | required |
Returns AppDragKind
app_drag_displays#The trigger geometry for screens (the primary first), in global top-left points.
func appDragDisplays(screens: [AppScreenFacts]) -> [AppDragDisplay]| Parameter | Type | Default |
|---|---|---|
screens | Vec<AppScreenFacts> | required |
Returns Vec<AppDragDisplay>
app_drag_portal_displays#The same for a portal whose expanded panel is its top-centred switcher window (the Tauri app; the parity flows check it here too).
func appDragPortalDisplays(screens: [AppScreenFacts]) -> [AppDragDisplay]| Parameter | Type | Default |
|---|---|---|
screens | Vec<AppScreenFacts> | required |
Returns Vec<AppDragDisplay>
app_drag_trigger_apply#Advances the window-drag trigger over the notch displays: move or resize, the trigger line, the dwell, expand and collapse.
func appDragTriggerApply(state: AppDragTriggerState, event: AppDragTriggerEvent, displays: [AppDragDisplay]) -> AppDragTriggerTransition| Parameter | Type | Default |
|---|---|---|
state | AppDragTriggerState | required |
event | AppDragTriggerEvent | required |
displays | Vec<AppDragDisplay> | required |
Returns AppDragTriggerTransition
app_drag_trigger_initial#The window-drag trigger's idle state.
func appDragTriggerInitial() -> AppDragTriggerStateReturns AppDragTriggerState