Skip to main content

DragSession

Struct DragSession 

Source
pub struct DragSession {
Show 28 fields pub session_id: DragSessionId, pub pointer_id: PointerId, pub source_window: AppWindowId, pub current_window: AppWindowId, pub cross_window_hover: bool, pub kind: DragKindId, pub start_position: Point, pub position: Point, pub cursor_grab_offset: Option<Point>, pub follow_window: Option<AppWindowId>, pub moving_window: Option<AppWindowId>, pub window_under_moving_window: Option<AppWindowId>, pub window_under_moving_window_source: WindowUnderCursorSource, pub transparent_payload_applied: bool, pub transparent_payload_hit_test_passthrough_applied: bool, pub window_under_cursor_source: WindowUnderCursorSource, pub diag_cursor_screen_pos_raw_physical_px: Option<Point>, pub diag_cursor_screen_pos_used_physical_px: Option<Point>, pub diag_cursor_screen_pos_was_clamped: bool, pub diag_cursor_override_active: bool, pub diag_current_window_outer_pos_physical_px: Option<Point>, pub diag_current_window_decoration_offset_physical_px: Option<Point>, pub diag_current_window_client_origin_screen_physical_px: Option<Point>, pub diag_current_window_client_origin_source_platform: bool, pub diag_current_window_scale_factor_x1000: Option<u32>, pub diag_current_window_local_pos_from_screen_logical_px: Option<Point>, pub dragging: bool, pub phase: DragPhase, /* private fields */
}

Fields§

§session_id: DragSessionId§pointer_id: PointerId§source_window: AppWindowId§current_window: AppWindowId§cross_window_hover: bool§kind: DragKindId§start_position: Point§position: Point§cursor_grab_offset: Option<Point>

Cursor grab offset in window-local logical coordinates.

Runners may use this to keep an OS window under the cursor during docking interactions (ImGui-style multi-viewport behavior), without needing to downcast the typed payload.

§follow_window: Option<AppWindowId>

If set, requests the runner to treat this drag as a “move the OS window” interaction for the given window id, while still allowing cross-window docking hover/drop routing.

§moving_window: Option<AppWindowId>

Best-effort diagnostics hint: OS window currently being moved by the runner for this drag session (ImGui-style “follow window” multi-viewport behavior).

This is intentionally diagnostics-only: it does not request follow behavior; it records what the runner is currently doing.

§window_under_moving_window: Option<AppWindowId>

Best-effort diagnostics hint: when Self::moving_window is set, the window considered “under” the moving window at the current cursor position.

This exists to support ImGui-style terminology where HoveredWindow and HoveredWindowUnderMovingWindow can differ during a viewport drag. Fret currently keeps current_window as the runner-selected hover/drop target; this field makes it possible to gate and evolve “peek-behind” behavior without reinterpreting current_window.

§window_under_moving_window_source: WindowUnderCursorSource

Best-effort diagnostics hint: which mechanism was used to select Self::window_under_moving_window.

§transparent_payload_applied: bool

Best-effort diagnostics hint: true when the runner has applied an ImGui-style “transparent payload” treatment to the moving dock window (e.g. reduced opacity and/or click-through hit-test passthrough while following the cursor).

§transparent_payload_hit_test_passthrough_applied: bool

Best-effort diagnostics hint: true when the runner successfully applied click-through hit-test passthrough to the moving dock window while transparent payload is enabled.

This is a result signal (applied by the OS/window backend), not a request. When false, the runner either did not attempt passthrough or the platform/backend rejected it.

§window_under_cursor_source: WindowUnderCursorSource

Best-effort diagnostics hint: which mechanism was used to select the hovered window during cross-window drag routing (OS-backed vs heuristic).

§diag_cursor_screen_pos_raw_physical_px: Option<Point>

Best-effort diagnostics hint: raw cursor position in screen-space physical pixels, as observed by the runner.

§diag_cursor_screen_pos_used_physical_px: Option<Point>

Best-effort diagnostics hint: cursor position in screen-space physical pixels used for local position conversion (may be clamped during scripted injection).

§diag_cursor_screen_pos_was_clamped: bool§diag_cursor_override_active: bool

True when diagnostics cursor override/input isolation is active while recording the cursor conversion hints.

§diag_current_window_outer_pos_physical_px: Option<Point>

Best-effort diagnostics hint: outer window position (top-left) in screen-space physical pixels for Self::current_window at the time routing was computed.

§diag_current_window_decoration_offset_physical_px: Option<Point>

Best-effort diagnostics hint: window decoration offset (client origin relative to outer origin) in physical pixels for Self::current_window.

§diag_current_window_client_origin_screen_physical_px: Option<Point>

Best-effort diagnostics hint: computed client origin in screen-space physical pixels for Self::current_window at the time routing was computed.

§diag_current_window_client_origin_source_platform: bool

True when the runner obtained the client origin from a platform API (e.g. Win32 HWND), rather than falling back to outer_position + surface_position.

§diag_current_window_scale_factor_x1000: Option<u32>

Best-effort diagnostics hint: scale factor (DPI) of Self::current_window used by the runner to convert screen physical pixels into window-local logical pixels.

§diag_current_window_local_pos_from_screen_logical_px: Option<Point>

Best-effort diagnostics hint: local cursor position derived from the screen-space cursor position + client origin + scale factor.

§dragging: bool§phase: DragPhase

Implementations§

Source§

impl DragSession

Source

pub fn new<T: Any>( session_id: DragSessionId, pointer_id: PointerId, source_window: AppWindowId, kind: DragKindId, start_position: Point, payload: T, ) -> Self

Source

pub fn new_cross_window<T: Any>( session_id: DragSessionId, pointer_id: PointerId, source_window: AppWindowId, kind: DragKindId, start_position: Point, payload: T, ) -> Self

Source

pub fn payload<T: Any>(&self) -> Option<&T>

Source

pub fn payload_mut<T: Any>(&mut self) -> Option<&mut T>

Source

pub fn into_payload(self) -> Box<dyn Any>

Trait Implementations§

Source§

impl Debug for DragSession

Source§

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

Formats the value using the given formatter. 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> 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, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

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.