Files
aiongg c19abe8663 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.
2026-11-12 14:32:39 +00:00

53 lines
2.8 KiB
TOML

[package]
name = "craft-window"
description = "Decide who draws the window frame (the desktop or the app) so every Craft app gets the same titlebar and borders per desktop, make an app-drawn strip act as the title bar, and keep the window list, cascade placement and Window menu for apps with one window per document."
version.workspace = true
edition.workspace = true
license.workspace = true
rust-version.workspace = true
repository.workspace = true
[features]
# `policy::apply` and `desktop::fits`: the frame decision on an `egui::ViewportBuilder`, and whether a window fits its monitor.
ui = ["dep:egui"]
# `mac::set_movable`: AppKit's `movable` flag, without egui. `system::SystemWindows`: AppKit's pointer, button and Cmd.
# `native_menu`: the application menu bar
# on macOS (other platforms build the same API as no-ops).
appkit = ["dep:objc2", "dep:objc2-app-kit", "dep:objc2-foundation", "dep:muda"]
[dependencies]
egui = { workspace = true, optional = true }
craft-atomic = { workspace = true }
craft-behavior = { workspace = true }
craft-host = { workspace = true }
craft-settings = { workspace = true }
serde = { workspace = true }
serde_json = { workspace = true }
# Only Linux and the BSDs probe a Wayland compositor; everywhere else the frame is the OS's.
[target.'cfg(any(target_os = "linux", target_os = "freebsd", target_os = "openbsd", target_os = "netbsd"))'.dependencies]
wayland-client = "0.31"
# `mac::set_movable` (`NSWindow.movable`), `mac::measure` (button frames, OS version), `system::SystemWindows`
# (`NSEvent` pointer, buttons and modifiers, `NSScreen` for the primary screen),
# `native_menu` (muda menus, AppKit titles).
[target.'cfg(target_os = "macos")'.dependencies]
muda = { version = "0.21.2", default-features = false, optional = true }
objc2 = { version = "0.6.4", default-features = false, features = ["std"], optional = true }
objc2-app-kit = { version = "0.3.2", default-features = false, features = ["std", "NSApplication", "NSButton", "NSControl", "NSEvent", "NSMenu", "NSMenuItem", "NSResponder", "NSScreen", "NSView", "NSWindow"], optional = true }
objc2-foundation = { version = "0.3.2", default-features = false, features = ["std", "NSArray", "NSBundle", "NSEnumerator", "NSGeometry", "NSLocale", "NSProcessInfo", "NSString"], optional = true }
# `caps_lock`: the toggle bit of the Caps Lock key, through winsafe's safe wrapper (the workspace forbids `unsafe`).
# `win32`: the window procedure of an app-drawn frame and layered-window opacity; craft-win32 holds the `unsafe` calls,
# `raw-window-handle` is the root window's handle from eframe.
[target.'cfg(windows)'.dependencies]
winsafe = { version = "0.0.29", default-features = false, features = ["user"] }
craft-win32 = { workspace = true }
raw-window-handle = "0.6"
[dev-dependencies]
tempfile = "3"
[lints]
workspace = true