Skip to main content

HitRegions

Struct HitRegions 

Source
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: ResizeBorders

Implementations§

Source§

impl HitRegions

Source

pub fn new() -> Self

Trait Implementations§

Source§

impl Clone for HitRegions

Source§

fn clone(&self) -> HitRegions

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for HitRegions

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for HitRegions

Source§

fn default() -> HitRegions

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.