Merge branch 'red/rr-ribbon-w2' into area/ribbon-fw

This commit is contained in:
Martin Ball committed 2026-11-18 22:06:53 +00:00
commit c8ac66db1f
3 files changed
+26 -5

No files matched your search

@@ -202,16 +202,18 @@ pub(crate) fn host(ctx: &Context, layer: &Layer<'_>, body: &mut dyn FnMut(&mut U
if real && (layer.exiting || matches!(overlay.rank, Rank::Popup | Rank::Modal { .. })) {
access::report_layer(ctx, layer.id, ui.unique_id(), ui.max_rect(), overlay.rank.is_modal(), layer.exiting);
}
if let (Some(policy), true) = (scope, real) {
// Every layer is a focus scope, one without a policy (`FocusPolicy::NONE`) included: its stops are the layer's,
// not those of the scope it was opened in, so a trap around it leaves them out (a menu's companion bar).
if real {
let entering = !std::mem::replace(&mut memory.scope_entered, true);
focus::push_scope_from(ctx, layer.id, policy, None, opener, layer.exiting, Some(entering));
focus::push_scope_from(ctx, layer.id, overlay.focus, None, opener, layer.exiting, Some(entering));
}
areas::bound(ui, placed.room, min_width.min(placed.room.x));
if overlay.fit == OverlayFit::Resizable {
ui.set_min_size(overlay.size_limits.min.min(placed.room));
}
access::scope::outside(ctx, || body(ui));
if scope.is_some() && real {
if real {
focus::pop_scope(ctx);
}
Env::restore(ctx, installed);
@@ -278,7 +278,7 @@ impl Overlay {
}
/// The chrome of a modal over a part of the window the modal covers, placed at `rect`: above the modal, with no
/// focus scope and no dismissal of its own. Its move band moves the window the layer is shown in.
/// focus policy and no dismissal of its own. Its move band moves the window the layer is shown in.
pub fn modal_chrome(rect: Rect) -> Overlay {
let mut overlay =
Overlay::base(Rank::ModalChrome, Place::Float(FloatPlace::centred()), OverlayFit::Content, OwnerClass::Widget, FocusPolicy::NONE);
+20 -1
View File
@@ -254,7 +254,26 @@ impl State {
}
fn entries(&self, scope_root: Option<Id>, all_controls: bool) -> Vec<Entry> {
self.last().entries(|rec| self.in_scope(rec.scope, scope_root), all_controls)
self.last().entries(|rec| self.reaches(rec.scope, scope_root), all_controls)
}
/// Whether Tab and F6 inside the scope `root` reach a stop of `scope`: it lies inside `root`, and not inside a
/// layer opened within `root` that takes no focus, traps nothing and restores nothing (a menu's companion bar).
fn reaches(&self, scope: Option<Id>, root: Option<Id>) -> bool {
let Some(root) = root else { return true };
let mut at = scope;
while let Some(id) = at {
if id == root {
return true;
}
let Some(rec) = self.last_scopes.get(&id) else { return false };
let unreached = rec.entering.is_some() && !rec.policy.trap && !rec.policy.restore && rec.policy.initial == Initial::Keep;
if unreached {
return false;
}
at = rec.parent;
}
false
}
/// The stops of the running pass that keyboard focus reaches, among those `keep` takes, in Tab order: every member