Toplevel events name the window, apps hear the pointer hover a surface and where their blurred cards were laid out, and rows can align to the bottom
CI / build + test (push) Canceled after 0s
CI / cargo audit (push) Canceled after 0s

A shell could not tell the windows of an app apart, follow the mouse over one of its overlays, or tell its compositor where the translucent cards of a surface ended up. crustace's floating dock needs all three, to activate and close single windows, to magnify the icons under the pointer and to have forge blur behind its pill and its Quick Settings cards.
`ToplevelEvent::Opened` carries the handle's `identifier`, the compositor's token for that one window, and its `title`, both from `ForeignToplevelInfo`; `toplevel_opened` builds the event for the new and the updated handle. Matches on `Opened { id, app_id }` have to add the fields or `..`.
`App::on_pointer_hover( SurfaceTarget, Option<( x, y )> )` is called on every mouse motion over a surface, in its physical pixels, and with `None` from the pointer's `leave`, which ltk did not handle before. `SurfaceFocus::target` gives the `SurfaceTarget` of a focus.
`Container::blur_behind()` marks a container whose rect and largest corner radius, capped at half its shorter side, the layout pass records in surface coordinates through the `DrawCtx::origin` offset of the sub-canvases, clipped by the viewports it sits in. `commit_draw_ctx` keeps them in `FrameState`, and after a frame where they changed `draw_frame` hands them to `App::on_blur_regions( SurfaceTarget, &[ ( Rect, f32 ) ] )`, for the main surface and each overlay.
`Row::align_bottom()` pins the children to the bottom edge, so taller siblings grow upward. `docs/architecture.md` lists `on_pointer_hover` among the input hooks.
Not done. `on_blur_regions`, `blur_behind` and `align_bottom` are not in the documentation, and there are no tests for them. The regions are reported after the frame is committed, so a compositor that receives them over IPC is one frame behind a surface whose cards move.
This commit is contained in:
2026-10-15 14:49:25 +02:00
parent 35ab8ac2b0
commit 3edd822918
13 changed files with 105 additions and 15 deletions
+16 -1
View File
@@ -11,7 +11,7 @@
//! function.
use crate::render::Canvas;
use crate::types::Rect;
use crate::types::{ Corners, Rect };
use crate::widget::{ Element, LaidOutWidget, WidgetHandlers };
use super::DrawCtx;
@@ -245,6 +245,13 @@ pub( crate ) fn layout_and_draw<Msg: Clone>(
{
canvas.stroke_rect( rect, color, width, c.corners );
}
if c.blur_behind
{
let Corners { tl, tr, br, bl } = c.corners;
let radius = tl.max( tr ).max( br ).max( bl ).min( rect.width * 0.5 ).min( rect.height * 0.5 );
let on_surface = Rect { x: rect.x + ctx.origin.0, y: rect.y + ctx.origin.1, ..rect };
ctx.blur_regions.push( ( on_surface, radius ) );
}
let pad_l = canvas.resolve_geom( c.pad_left );
let pad_r = canvas.resolve_geom( c.pad_right );
let pad_t = canvas.resolve_geom( c.pad_top );
@@ -463,11 +470,19 @@ pub( crate ) fn layout_and_draw<Msg: Clone>(
let child_rect = Rect { x: 0.0, y: 0.0, width: rect.width, height: effective_h };
let rects_before = ctx.widget_rects.len();
let scroll_rects_before = ctx.scroll_rects.len();
let blur_before = ctx.blur_regions.len();
let origin = ctx.origin;
ctx.origin = ( origin.0 + rect.x, origin.1 + rect.y );
let next_idx = layout_and_draw::<Msg>( v.child.as_ref(), &mut sub, child_rect, ctx, flat_idx );
ctx.origin = origin;
let view_on_surface = Rect { x: rect.x + origin.0, y: rect.y + origin.1, ..rect };
let clipped: Vec<( Rect, f32 )> = ctx.blur_regions.drain( blur_before.. )
.map( |( r, radius )| ( clamp_rect_to( r, view_on_surface ), radius ) )
.filter( |( r, _ )| r.width > 0.0 && r.height > 0.0 )
.collect();
ctx.blur_regions.extend( clipped );
let new_rects: Vec<LaidOutWidget<Msg>> = ctx.widget_rects.drain( rects_before.. ).collect();
for mut w in new_rects
{