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
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:
@@ -48,6 +48,7 @@ pub struct Row<Msg: Clone>
|
||||
pub( crate ) padding: Length,
|
||||
pub( crate ) align_right: bool,
|
||||
pub( crate ) align_top: bool,
|
||||
pub( crate ) align_bottom: bool,
|
||||
pub( crate ) fill_height: bool,
|
||||
/// When false the row keeps every child at its preferred width even if
|
||||
/// the cluster overflows. Default true.
|
||||
@@ -65,6 +66,7 @@ impl<Msg: Clone> Row<Msg>
|
||||
padding: Length::px( 0.0 ),
|
||||
align_right: false,
|
||||
align_top: false,
|
||||
align_bottom: false,
|
||||
fill_height: false,
|
||||
shrink: true,
|
||||
}
|
||||
@@ -134,6 +136,13 @@ impl<Msg: Clone> Row<Msg>
|
||||
self
|
||||
}
|
||||
|
||||
/// Pin children to the bottom edge, so taller siblings grow upward.
|
||||
pub fn align_bottom( mut self ) -> Self
|
||||
{
|
||||
self.align_bottom = true;
|
||||
self
|
||||
}
|
||||
|
||||
/// Stretch every child to the row's inner height, so siblings share
|
||||
/// both the top and the bottom line regardless of their natural
|
||||
/// heights. The row's own height still comes from the tallest
|
||||
@@ -306,6 +315,8 @@ impl<Msg: Clone> Row<Msg>
|
||||
( rect.y + pad, inner_h )
|
||||
} else if self.align_top {
|
||||
( rect.y + pad, h )
|
||||
} else if self.align_bottom {
|
||||
( rect.y + pad + inner_h - h, h )
|
||||
} else {
|
||||
( rect.y + pad + ( inner_h - h ) / 2.0, h )
|
||||
};
|
||||
@@ -327,6 +338,7 @@ impl<Msg: Clone> Row<Msg>
|
||||
padding: self.padding,
|
||||
align_right: self.align_right,
|
||||
align_top: self.align_top,
|
||||
align_bottom: self.align_bottom,
|
||||
fill_height: self.fill_height,
|
||||
shrink: self.shrink,
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user