Desktop: Switch to the latest unreleased version of Winit (#3177)

* Use unstable winit

* Improve

* Remove unnecessary heap indirection
This commit is contained in:
Timon
2025-09-17 16:40:43 +02:00
committed by Dennis Kobert
parent 4662cbbbc1
commit 3fe7c477e9
14 changed files with 567 additions and 527 deletions
+34
View File
@@ -0,0 +1,34 @@
use graphite_desktop_wrapper::NodeGraphExecutionResult;
use graphite_desktop_wrapper::messages::DesktopWrapperMessage;
pub(crate) enum AppEvent {
UiUpdate(wgpu::Texture),
ScheduleBrowserWork(std::time::Instant),
WebCommunicationInitialized,
DesktopWrapperMessage(DesktopWrapperMessage),
NodeGraphExecutionResult(NodeGraphExecutionResult),
CloseWindow,
}
#[derive(Clone)]
pub(crate) struct AppEventScheduler {
pub(crate) proxy: winit::event_loop::EventLoopProxy,
pub(crate) sender: std::sync::mpsc::Sender<AppEvent>,
}
impl AppEventScheduler {
pub(crate) fn schedule(&self, event: AppEvent) {
let _ = self.sender.send(event);
self.proxy.wake_up();
}
}
pub(crate) trait CreateAppEventSchedulerEventLoopExt {
fn create_app_event_scheduler(&self, sender: std::sync::mpsc::Sender<AppEvent>) -> AppEventScheduler;
}
impl CreateAppEventSchedulerEventLoopExt for winit::event_loop::EventLoop {
fn create_app_event_scheduler(&self, sender: std::sync::mpsc::Sender<AppEvent>) -> AppEventScheduler {
AppEventScheduler { proxy: self.create_proxy(), sender }
}
}