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
+12 -2
View File
@@ -14,11 +14,12 @@ use crate::widget::Element;
/// compositor sends `closed` and the runtime is about to destroy the
/// handle proxy. Both carry the same `id`, the Wayland protocol id of
/// the handle, unique within the session and stable for the handle's
/// lifetime.
/// lifetime. `identifier` is the compositor's opaque per-window token,
/// the one to name a single window by when talking to the compositor.
#[ derive( Debug, Clone ) ]
pub enum ToplevelEvent
{
Opened { id: u32, app_id: String },
Opened { id: u32, app_id: String, identifier: String, title: String },
Closed { id: u32 },
}
@@ -949,6 +950,15 @@ pub trait App: 'static
/// WPE WebView.
fn on_pointer_move( &mut self, _x: f32, _y: f32 ) {}
/// Mouse motion over `target`, in physical pixels of that surface, or
/// `None` when the pointer leaves it. Touch never reports here.
fn on_pointer_hover( &mut self, _target: SurfaceTarget, _position: Option<( f32, f32 )> ) {}
/// The `( rect, corner radius )` of every [`Container::blur_behind`](crate::widget::container::Container::blur_behind)
/// drawn on `target`, in its physical pixels, after a frame where they
/// changed: for a shell to tell its compositor what to blur.
fn on_blur_regions( &mut self, _target: SurfaceTarget, _regions: &[ ( crate::types::Rect, f32 ) ] ) {}
/// Called on a wheel / touchpad scroll event whose position does
/// not fall inside any LTK [`scroll`](crate::scroll) viewport. `x`,
/// `y` are in physical pixels (same coordinate space as