From ea2211729eccdcddcc0e4773d7d7552be06b2cf3 Mon Sep 17 00:00:00 2001 From: aiongg Date: Wed, 25 Nov 2026 15:42:39 +0000 Subject: [PATCH] The waiting window's repaint is a docking::native function --- crates/ui-panels/src/docking/native.rs | 10 ++++++++++ crates/ui-patterns/src/patterns/dock/area.rs | 8 +------- 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/crates/ui-panels/src/docking/native.rs b/crates/ui-panels/src/docking/native.rs index 2b2922e89..5cf998916 100644 --- a/crates/ui-panels/src/docking/native.rs +++ b/crates/ui-panels/src/docking/native.rs @@ -113,6 +113,16 @@ pub fn opening

(ctx: &Context, config: &DockConfig, window: &Floating

, spec Opening { rect: recorded.unwrap_or_else(|| restore(ctx, window)), spec: Some(spec_for(specs)), waits: false } } +/// Asks for the pass in which a group that waits to open its OS window ([`Opening::waits`]) opens it: the next one once +/// the press that moved it has ended, or the one after a target in another window had its chance to take the drop. +#[doc(hidden)] +pub fn waited(ctx: &Context, opening: &Opening, output: &FloatingGroupOutput) { + let ended = output.placed.is_some_and(|change| matches!(change.phase, GesturePhase::Commit | GesturePhase::Cancel)); + if opening.waits && (ended || pointer::pressed_part(ctx, output.response.id).is_none()) { + crate::runtime::frame::request_repaint(ctx); + } +} + /// The action that records where the OS put the native window `window`, shown in `viewport`: its placement, as an /// app window's is recorded, with the rect `kept` gives for the rect the OS shows the window at (outer top-left corner /// and inner size, in desktop points), so a collapsed window keeps its expanded rect diff --git a/crates/ui-patterns/src/patterns/dock/area.rs b/crates/ui-patterns/src/patterns/dock/area.rs index 9809d8a1d..7a5e6d2f3 100644 --- a/crates/ui-patterns/src/patterns/dock/area.rs +++ b/crates/ui-patterns/src/patterns/dock/area.rs @@ -26,7 +26,6 @@ use crate::runtime::derived::derived; use crate::runtime::drag; use crate::runtime::env::{Env, Label, RevealEdge, ShellCx, ShellEntry, in_room}; use crate::runtime::memory::Remember as _; -use crate::runtime::pointer; use crate::runtime::windows::{ResizeEdge, WindowHost}; use crate::sections::{HeaderAction, Panel}; use craft_behavior::dock::{ @@ -1830,6 +1829,7 @@ impl Pass<'_, P> { }); self.dock = area_dock; let output = shown.output; + native::waited(&ctx, &opening, &output); // The window's grips, then everything it drew, in the OS window it shows in, if it has one. let grips = output.grip.map(|(rect, node)| DockSource::new(SourceKind::WindowGrip(anchor.clone()), rect, node)); let resize = @@ -1848,12 +1848,6 @@ impl Pass<'_, P> { let panel = under.or(groups.first()).map_or_else(|| active.clone(), |(panel, _)| panel.clone()); self.report.files.push(WindowFiles { panel, files: output.files }); } - let ended = output.placed.is_some_and(|change| matches!(change.phase, GesturePhase::Commit | GesturePhase::Cancel)); - // The window opens its OS window in a pass after the press that moved it: the next, or the one after a - // target in another window had its chance to take the drop. - if opening.waits && (ended || pointer::pressed_part(&ctx, group_id).is_none()) { - crate::runtime::frame::request_repaint(&ctx); - } if let Some(dropped) = dropped.into_inner() { cross_window::accept_cross_window(&ctx); self.report.actions.push(dropped.action);