pub struct HitRegions {
pub minimize: Option<Rect>,
pub maximize: Option<Rect>,
pub close: Option<Rect>,
pub minimize_id: Option<WidgetId>,
pub maximize_id: Option<WidgetId>,
pub close_id: Option<WidgetId>,
pub drag: Vec<Rect>,
pub no_drag: Vec<Rect>,
pub resize_borders: ResizeBorders,
}Expand description
Set of rectangles inside the window client area that the title bar widget cares about. The widget tree publishes them in logical pixels (its native coordinate system); platform backends that need physical pixels (Windows) convert internally before storing. Coordinates are relative to the window client origin (top-left).
Fields§
§minimize: Option<Rect>§maximize: Option<Rect>§close: Option<Rect>§minimize_id: Option<WidgetId>Widget id of the minimize button, when one is present in the
tree. Companions to the rect above; the Windows backend uses
these to route WM_NCLBUTTONUP on HTMINBUTTON back into the
widget tree as a synthetic tap.
maximize_id: Option<WidgetId>§close_id: Option<WidgetId>§drag: Vec<Rect>One or more drag-region rectangles. Multiple rects allow non-rectangular drag surfaces (e.g. drag region split around a centred search bar).
no_drag: Vec<Rect>Holes punched in drag: sub-rectangles that must not
be treated as caption. Backends that hand the drag region to the OS
(Windows: WM_NCHITTEST -> HTCAPTION) must test these before
drag and answer HTCLIENT, or the OS owns those pixels and the widget
underneath never sees a click, a hover, or a cursor change.
Published by TitleBar::after_paint from two sources. First, the
gesture_dead_zone nodes
inside its drag region — the same declaration that already stops an
ancestor drag from arming in widget land. One concept, both layers:
wrap an interactive title-bar control in a DeadZone and it becomes
clickable on Windows and immune to jitter-drag everywhere else.
Teksilo’s counterpart of Electron’s -webkit-app-region: no-drag.
Second, every interactive overlay’s intersection with the title bar.
Overlay content floats above the chrome in widget land, so its pixels
must return to the client area no matter which published rect lies
beneath — which is why a backend must test these holes before the
control-button rects as well as before drag. The shipped bug: a
hamburger MenuBar’s revealed bar is an overlay anchored outside the
drag region, so no dead zone covered it, and on Windows every menu
title over the caption dragged the window instead of opening.
resize_borders: ResizeBordersImplementations§
Source§impl HitRegions
impl HitRegions
Trait Implementations§
Source§impl Clone for HitRegions
impl Clone for HitRegions
Source§fn clone(&self) -> HitRegions
fn clone(&self) -> HitRegions
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more