mirror of
https://github.com/storytold/craft-libs.git
synced 2026-11-18 02:32:33 +00:00
Dock a native window by dragging its title row
A floating dock group in its own OS window now moves through a window move gesture the app runs, which reports Begin, Update, Commit and Cancel like a layer's move, so the dock marks the target under the pointer and docks the whole window on release. - macOS (Caps::OS_MOVES_TRACKED): the OS moves the window (StartMove), and the app follows the system pointer, button and Cmd through SystemWindows, the running platform's WindowSystem in craft-window. The hand-off ends when the system reports the button up. - X11 and Windows: the app moves the window with SetOuterPosition so the pressed point stays under the pointer; Escape puts it back. - A drag started by a container shown in its own OS window follows that window's pointer, not its parent's. - The runtime's end hook sets NSWindow.movable for every window; a window whose move the app runs is never moved by AppKit from its band.
This commit is contained in:
@@ -188,6 +188,17 @@ pub fn with_pass_pointer<R>(ctx: &Context, f: impl FnOnce(&PassPointer) -> R) ->
|
||||
PerViewport::<Stamped<Arc<PassPointer>>>::with_pass(ctx, viewport, pass_nr, |_, _| {}, |record| f(record))
|
||||
}
|
||||
|
||||
/// The buttons held in the latest pass of `viewport`, which may be a child window whose pass ran inside this one.
|
||||
pub(crate) fn buttons_of(ctx: &Context, viewport: ViewportId) -> Buttons {
|
||||
PerViewport::<Stamped<Arc<PassPointer>>>::with_pass(
|
||||
ctx,
|
||||
viewport,
|
||||
pass::pass_nr(ctx, viewport),
|
||||
|_, _| {},
|
||||
|record| record.frame.as_ref().map_or(Buttons::empty(), |frame| frame.buttons),
|
||||
)
|
||||
}
|
||||
|
||||
/// Reads the running pass's pointer frame, `None` before the begin hook, and its hover position in place.
|
||||
pub(crate) fn with_frame<R>(ctx: &Context, f: impl FnOnce(Option<&PointerFrame>, Option<Pos2>) -> R) -> R {
|
||||
with_pass_pointer(ctx, |pointer| f(pointer.frame.as_ref(), pointer.hover))
|
||||
|
||||
Reference in New Issue
Block a user