#[non_exhaustive]pub enum Event {
Show 56 variants
Inited(Inited),
Suspended,
Disconnected(ViewProcessGen),
WindowOpened(WindowId, WindowOpenData),
HeadlessOpened(WindowId, HeadlessOpenData),
WindowOrHeadlessOpenError {
id: WindowId,
error: Txt,
},
FrameRendered(EventFrameRendered),
WindowChanged(WindowChanged),
DragHovered {
window: WindowId,
data: Vec<DragDropData>,
allowed: DragDropEffect,
},
DragMoved {
window: WindowId,
coalesced_pos: Vec<DipPoint>,
position: DipPoint,
},
DragDropped {
window: WindowId,
data: Vec<DragDropData>,
allowed: DragDropEffect,
drop_id: DragDropId,
},
DragCancelled {
window: WindowId,
},
AppDragEnded {
window: WindowId,
drag: DragDropId,
applied: DragDropEffect,
},
FocusChanged {
prev: Option<WindowId>,
new: Option<WindowId>,
},
KeyboardInput {
window: WindowId,
device: InputDeviceId,
key_code: KeyCode,
state: KeyState,
key_location: KeyLocation,
key: Key,
key_modified: Key,
text: Txt,
},
Ime {
window: WindowId,
ime: Ime,
},
MouseMoved {
window: WindowId,
device: InputDeviceId,
coalesced_pos: Vec<DipPoint>,
position: DipPoint,
},
MouseEntered {
window: WindowId,
device: InputDeviceId,
},
MouseLeft {
window: WindowId,
device: InputDeviceId,
},
MouseWheel {
window: WindowId,
device: InputDeviceId,
delta: MouseScrollDelta,
phase: TouchPhase,
},
MouseInput {
window: WindowId,
device: InputDeviceId,
state: ButtonState,
button: MouseButton,
},
TouchpadPressure {
window: WindowId,
device: InputDeviceId,
pressure: f32,
stage: i64,
},
AxisMotion {
window: WindowId,
device: InputDeviceId,
axis: AxisId,
value: f64,
},
Touch {
window: WindowId,
device: InputDeviceId,
touches: Vec<TouchUpdate>,
},
ScaleFactorChanged {
monitor: MonitorId,
windows: Vec<WindowId>,
scale_factor: f32,
},
MonitorsChanged(Vec<(MonitorId, MonitorInfo)>),
AudioDevicesChanged(Vec<(AudioDeviceId, AudioDeviceInfo)>),
InputDevicesChanged(Vec<(InputDeviceId, InputDeviceInfo)>),
WindowCloseRequested(WindowId),
WindowClosed(WindowId),
ImageMetadataLoaded {
image: ImageId,
size: PxSize,
density: Option<PxDensity2d>,
is_mask: bool,
},
ImageLoaded(ImageLoadedData),
ImagePartiallyLoaded {
image: ImageId,
partial_size: PxSize,
density: Option<PxDensity2d>,
is_opaque: bool,
is_mask: bool,
partial_pixels: IpcBytes,
},
ImageLoadError {
image: ImageId,
error: Txt,
},
ImageEncoded {
image: ImageId,
format: Txt,
data: IpcBytes,
},
ImageEncodeError {
image: ImageId,
format: Txt,
error: Txt,
},
FrameImageReady {
window: WindowId,
frame: FrameId,
image: ImageId,
selection: PxRect,
},
FontsChanged,
FontAaChanged(FontAntiAliasing),
MultiClickConfigChanged(MultiClickConfig),
AnimationsConfigChanged(AnimationsConfig),
KeyRepeatConfigChanged(KeyRepeatConfig),
TouchConfigChanged(TouchConfig),
LocaleChanged(LocaleConfig),
ColorsConfigChanged(ColorsConfig),
ChromeConfigChanged(ChromeConfig),
InputDeviceEvent {
device: InputDeviceId,
event: InputDeviceEvent,
},
MsgDialogResponse(DialogId, MsgDialogResponse),
FileDialogResponse(DialogId, FileDialogResponse),
AccessInit {
window: WindowId,
},
AccessCommand {
window: WindowId,
target: AccessNodeId,
command: AccessCmd,
},
AccessDeinit {
window: WindowId,
},
LowMemory,
RecoveredFromComponentPanic {
component: Txt,
recover: Txt,
panic: Txt,
},
ExtensionEvent(ApiExtensionId, ApiExtensionPayload),
Pong(u16),
}Expand description
System and User events sent from the View Process.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Inited(Inited)
View-process inited.
Suspended
View-process suspended.
Disconnected(ViewProcessGen)
The event channel disconnected, probably because the view-process crashed.
The ViewProcessGen is the generation of the view-process that was lost, it must be passed to
Controller::handle_disconnect.
WindowOpened(WindowId, WindowOpenData)
Window, context and renderer have finished initializing and is ready to receive commands.
HeadlessOpened(WindowId, HeadlessOpenData)
Headless context and renderer have finished initializing and is ready to receive commands.
WindowOrHeadlessOpenError
Window open or headless context open request failed.
FrameRendered(EventFrameRendered)
A frame finished rendering.
EventsCleared is not send after this event.
WindowChanged(WindowChanged)
Window moved, resized, or minimized/maximized etc.
This event aggregates events moves, resizes and other state changes into a single event to simplify tracking composite changes, for example, the window changes size and position when maximized, this can be trivially observed with this event.
The EventCause can be used to identify a state change initiated by the app.
DragHovered
A drag&drop gesture started dragging over the window.
DragMoved
A drag&drop gesture moved over the window.
Fields
DragDropped
A drag&drop gesture finished over the window.
Fields
data: Vec<DragDropData>Data payload.
allowed: DragDropEffectAllowed effects.
drop_id: DragDropIdID of this drop operation.
Handlers must call drag_dropped with this ID and what effect was applied to the data.
DragCancelled
A drag&drop gesture stopped hovering the window without dropping.
AppDragEnded
A drag started by the app was dropped or canceled.
Fields
drag: DragDropIdDrag ID.
applied: DragDropEffectEffect applied to the data by the drop target.
Is a single flag if the data was dropped in a valid drop target, or is empty if was canceled.
FocusChanged
App window(s) focus changed.
KeyboardInput
An event from the keyboard has been received.
This event is only send if the window is focused, all pressed keys should be considered released
after FocusChanged to None. Modifier keys receive special treatment, after they are pressed,
the modifier key state is monitored directly so that the Released event is always send, unless the
focus changed to none.
Fields
device: InputDeviceIdDevice that generated the key event.
key_location: KeyLocationThe location of the key on the keyboard.
key: KeySemantic key unmodified.
Pressing Shift+A key will produce Key::Char('a') in QWERTY keyboards, the modifiers are not applied. Note that
the numpad keys do not represents the numbers unmodified
key_modified: KeySemantic key modified by the current active modifiers.
Pressing Shift+A key will produce Key::Char('A') in QWERTY keyboards, the modifiers are applied.
text: TxtText typed.
This is only set during KeyState::Pressed of a key that generates text.
This is usually the key_modified char, but is also '\r' for Key::Enter. On Windows when a dead key was
pressed earlier but cannot be combined with the character from this key press, the produced text
will consist of two characters: the dead-key-character followed by the character resulting from this key press.
Ime
IME composition event.
MouseMoved
The mouse cursor has moved on the window.
This event can be coalesced, i.e. multiple cursor moves packed into the same event.
Fields
device: InputDeviceIdDevice that generated the cursor move.
MouseEntered
The mouse cursor has entered the window.
Fields
device: InputDeviceIdDevice that generated the cursor move event.
MouseLeft
The mouse cursor has left the window.
Fields
device: InputDeviceIdDevice that generated the cursor move event.
MouseWheel
A mouse wheel movement or touchpad scroll occurred.
Fields
device: InputDeviceIdDevice that generated the mouse wheel event.
delta: MouseScrollDeltaDelta of change in the mouse scroll wheel state.
phase: TouchPhaseTouch state if the device that generated the event is a touchpad.
MouseInput
An mouse button press has been received.
Fields
device: InputDeviceIdMouse device that generated the event.
state: ButtonStateIf the button was pressed or released.
The mouse button.
TouchpadPressure
Touchpad pressure event.
Fields
device: InputDeviceIdTouchpad device.
AxisMotion
Motion on some analog axis. May report data redundant to other, more specific events.
Fields
device: InputDeviceIdAnalog device.
Touch
Touch event has been received.
Fields
device: InputDeviceIdTouch device.
touches: Vec<TouchUpdate>Coalesced touch updates, never empty.
ScaleFactorChanged
The monitor’s scale factor has changed.
Fields
windows: Vec<WindowId>Windows affected by this change.
Note that a window’s scale factor can also change if it is moved to another monitor,
the Event::WindowChanged event notifies this using the WindowChanged::monitor.
MonitorsChanged(Vec<(MonitorId, MonitorInfo)>)
The available monitors have changed.
AudioDevicesChanged(Vec<(AudioDeviceId, AudioDeviceInfo)>)
The available audio input and output devices have changed.
InputDevicesChanged(Vec<(InputDeviceId, InputDeviceInfo)>)
The available raw input devices have changed.
WindowCloseRequested(WindowId)
The window has been requested to close.
WindowClosed(WindowId)
The window has closed.
ImageMetadataLoaded
An image resource already decoded size and density metadata.
Fields
density: Option<PxDensity2d>The image density metadata.
ImageLoaded(ImageLoadedData)
An image resource finished decoding.
ImagePartiallyLoaded
An image resource, progressively decoded has decoded more bytes.
Fields
partial_size: PxSizeThe size of the decoded pixels, can be different then the image size if the image is not interlaced.
density: Option<PxDensity2d>The image density metadata.
ImageLoadError
An image resource failed to decode, the image ID is not valid.
ImageEncoded
An image finished encoding.
Fields
ImageEncodeError
An image failed to encode.
Fields
FrameImageReady
An image generated from a rendered frame is ready.
Fields
FontsChanged
System fonts have changed.
FontAaChanged(FontAntiAliasing)
System text anti-aliasing configuration has changed.
MultiClickConfigChanged(MultiClickConfig)
System double-click definition changed.
AnimationsConfigChanged(AnimationsConfig)
System animations config changed.
KeyRepeatConfigChanged(KeyRepeatConfig)
System definition of pressed key repeat event changed.
TouchConfigChanged(TouchConfig)
System touch config changed.
LocaleChanged(LocaleConfig)
System locale changed.
ColorsConfigChanged(ColorsConfig)
System color scheme or colors changed.
ChromeConfigChanged(ChromeConfig)
System window chrome (decorations) preference changed.
InputDeviceEvent
Raw input device event.
MsgDialogResponse(DialogId, MsgDialogResponse)
User responded to a native message dialog.
FileDialogResponse(DialogId, FileDialogResponse)
User responded to a native file dialog.
AccessInit
Accessibility info tree is now required for the window.
AccessCommand
Accessibility command.
Fields
target: AccessNodeIdTarget widget.
AccessDeinit
Accessibility info tree is no longer needed for the window.
Note that accessibility may be enabled again after this. It is not an error to send access updates after this, but they will be ignored.
LowMemory
System low memory warning, some platforms may kill the app if it does not release memory.
RecoveredFromComponentPanic
An internal component panicked, but the view-process managed to recover from it without needing to respawn.
Fields
ExtensionEvent(ApiExtensionId, ApiExtensionPayload)
Represents a custom event send by the extension.
Pong(u16)
Signal the view-process is alive.
The associated value must be the count requested by Api::ping.
Implementations§
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Event
impl<'de> Deserialize<'de> for Event
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Auto Trait Implementations§
impl Freeze for Event
impl RefUnwindSafe for Event
impl Send for Event
impl Sync for Event
impl Unpin for Event
impl UnwindSafe for Event
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more