mirror of
https://github.com/storytold/craft-libs.git
synced 2026-11-26 12:32:10 +01:00
The waiting window's repaint is a docking::native function
This commit is contained in:
1 parent
fd7f86446f
commit
ea2211729e
2 files changed
+11
-7
No files matched your search
@@ -113,6 +113,16 @@ pub fn opening<P>(ctx: &Context, config: &DockConfig, window: &Floating<P>, 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
|
||||
|
||||
@@ -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<P: Clone + Eq + Hash + Debug + Send + Sync + 'static> 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<P: Clone + Eq + Hash + Debug + Send + Sync + 'static> 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);
|
||||
|
||||
Reference in new issue
Block a user