mirror of
https://github.com/tauri-apps/tauri.git
synced 2026-04-03 10:11:15 +02:00
This commit is contained in:
committed by
GitHub
parent
28c6b7adfe
commit
6be3f43391
5
.changes/main-events-cleared-and-resumed.md
Normal file
5
.changes/main-events-cleared-and-resumed.md
Normal file
@@ -0,0 +1,5 @@
|
||||
---
|
||||
"tauri": patch
|
||||
---
|
||||
|
||||
Adds `Resumed` and `MainEventsCleared` variants to the `Event` enum.
|
||||
6
.changes/runtime-main-events-cleared-and-resumed.md
Normal file
6
.changes/runtime-main-events-cleared-and-resumed.md
Normal file
@@ -0,0 +1,6 @@
|
||||
---
|
||||
"tauri-runtime": minor
|
||||
"tauri-runtime-wry": minor
|
||||
---
|
||||
|
||||
Adds `Resumed` and `MainEventsCleared` variants to the `RunEvent` enum.
|
||||
@@ -1785,6 +1785,14 @@ fn handle_event_loop(
|
||||
callback(RunEvent::Ready);
|
||||
}
|
||||
|
||||
Event::NewEvents(StartCause::Poll) => {
|
||||
callback(RunEvent::Resumed);
|
||||
}
|
||||
|
||||
Event::MainEventsCleared => {
|
||||
callback(RunEvent::MainEventsCleared);
|
||||
}
|
||||
|
||||
Event::GlobalShortcutEvent(accelerator_id) => {
|
||||
for (id, handler) in &*global_shortcut_manager_handle.listeners.lock().unwrap() {
|
||||
if accelerator_id == *id {
|
||||
|
||||
@@ -186,6 +186,12 @@ pub enum RunEvent {
|
||||
WindowClose(String),
|
||||
/// Application ready.
|
||||
Ready,
|
||||
/// Sent if the event loop is being resumed.
|
||||
Resumed,
|
||||
/// Emitted when all of the event loop’s input events have been processed and redraw processing is about to begin.
|
||||
///
|
||||
/// This event is useful as a place to put your code that should be run after all state-changing events have been handled and you want to do stuff (updating state, performing calculations, etc) that happens as the “main body” of your event loop.
|
||||
MainEventsCleared,
|
||||
}
|
||||
|
||||
/// Action to take when the event loop is about to exit
|
||||
|
||||
@@ -97,6 +97,12 @@ pub enum Event {
|
||||
WindowClosed(String),
|
||||
/// Application ready.
|
||||
Ready,
|
||||
/// Sent if the event loop is being resumed.
|
||||
Resumed,
|
||||
/// Emitted when all of the event loop’s input events have been processed and redraw processing is about to begin.
|
||||
///
|
||||
/// This event is useful as a place to put your code that should be run after all state-changing events have been handled and you want to do stuff (updating state, performing calculations, etc) that happens as the “main body” of your event loop.
|
||||
MainEventsCleared,
|
||||
}
|
||||
|
||||
/// A menu event that was triggered on a window.
|
||||
@@ -441,6 +447,8 @@ impl<R: Runtime> App<R> {
|
||||
},
|
||||
RunEvent::WindowClose(label) => Event::WindowClosed(label),
|
||||
RunEvent::Ready => Event::Ready,
|
||||
RunEvent::Resumed => Event::Resumed,
|
||||
RunEvent::MainEventsCleared => Event::MainEventsCleared,
|
||||
_ => unimplemented!(),
|
||||
},
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user