pub enum Event {
Show 59 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: DeviceId,
key_code: KeyCode,
state: KeyState,
key_location: KeyLocation,
key: Key,
key_modified: Key,
text: Txt,
},
Ime {
window: WindowId,
ime: Ime,
},
MouseMoved {
window: WindowId,
device: DeviceId,
coalesced_pos: Vec<DipPoint>,
position: DipPoint,
},
MouseEntered {
window: WindowId,
device: DeviceId,
},
MouseLeft {
window: WindowId,
device: DeviceId,
},
MouseWheel {
window: WindowId,
device: DeviceId,
delta: MouseScrollDelta,
phase: TouchPhase,
},
MouseInput {
window: WindowId,
device: DeviceId,
state: ButtonState,
button: MouseButton,
},
TouchpadPressure {
window: WindowId,
device: DeviceId,
pressure: f32,
stage: i64,
},
AxisMotion {
window: WindowId,
device: DeviceId,
axis: AxisId,
value: f64,
},
Touch {
window: WindowId,
device: DeviceId,
touches: Vec<TouchUpdate>,
},
ScaleFactorChanged {
monitor: MonitorId,
windows: Vec<WindowId>,
scale_factor: f32,
},
MonitorsChanged(Vec<(MonitorId, MonitorInfo)>),
WindowCloseRequested(WindowId),
WindowClosed(WindowId),
ImageMetadataLoaded {
image: ImageId,
size: PxSize,
ppi: Option<ImagePpi>,
is_mask: bool,
},
ImageLoaded(ImageLoadedData),
ImagePartiallyLoaded {
image: ImageId,
partial_size: PxSize,
ppi: Option<ImagePpi>,
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),
DeviceAdded(DeviceId),
DeviceRemoved(DeviceId),
DeviceMouseMotion {
device: DeviceId,
delta: Vector2D<f64, ()>,
},
DeviceMouseWheel {
device: DeviceId,
delta: MouseScrollDelta,
},
DeviceMotion {
device: DeviceId,
axis: AxisId,
value: f64,
},
DeviceButton {
device: DeviceId,
button: ButtonId,
state: ButtonState,
},
DeviceKey {
device: DeviceId,
key_code: KeyCode,
state: KeyState,
},
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),
}
Expand description
System and User events sent from the View Process.
Variants§
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: DragDropEffect
Allowed effects.
drop_id: DragDropId
ID 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: DragDropId
Drag ID.
applied: DragDropEffect
Effect 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
key_location: KeyLocation
The location of the key on the keyboard.
key: Key
Semantic 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: Key
Semantic key modified by the current active modifiers.
Pressing Shift+A
key will produce Key::Char('A')
in QWERTY keyboards, the modifiers are applied.
text: Txt
Text 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
MouseEntered
The mouse cursor has entered the window.
Fields
MouseLeft
The mouse cursor has left the window.
Fields
MouseWheel
A mouse wheel movement or touchpad scroll occurred.
Fields
delta: MouseScrollDelta
Delta of change in the mouse scroll wheel state.
phase: TouchPhase
Touch state if the device that generated the event is a touchpad.
MouseInput
An mouse button press has been received.
TouchpadPressure
Touchpad pressure event.
Fields
AxisMotion
Motion on some analog axis. May report data redundant to other, more specific events.
Fields
Touch
Touch event has been received.
Fields
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.
WindowCloseRequested(WindowId)
The window has been requested to close.
WindowClosed(WindowId)
The window has closed.
ImageMetadataLoaded
An image resource already decoded size and PPI.
Fields
ImageLoaded(ImageLoadedData)
An image resource finished decoding.
ImagePartiallyLoaded
An image resource, progressively decoded has decoded more bytes.
Fields
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.
DeviceAdded(DeviceId)
Device added or installed.
DeviceRemoved(DeviceId)
Device removed.
DeviceMouseMotion
Mouse pointer motion.
The values if the delta of movement (x, y), not position.
Fields
DeviceMouseWheel
Mouse scroll wheel turn.
Fields
delta: MouseScrollDelta
Delta of change in the mouse scroll wheel state.
DeviceMotion
Motion on some analog axis.
This includes the mouse device and any other that fits.
Fields
DeviceButton
Device button press or release.
Fields
Device dependent button that was used.
state: ButtonState
If the button was pressed or released.
DeviceKey
Device key press or release.
Fields
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: AccessNodeId
Target 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.
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§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§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