diff options
author | 2021-09-02 13:46:01 +0700 | |
---|---|---|
committer | 2021-09-02 13:46:01 +0700 | |
commit | c9711ff48fa1ad16365bc7eb37fa7153143bcee6 (patch) | |
tree | 7e3964bd3ccc08e2ad566788728e48a3a916302b /glutin | |
parent | 76698ff2b5753e637b14533650c0d28e681be3c5 (diff) | |
download | iced-c9711ff48fa1ad16365bc7eb37fa7153143bcee6.tar.gz iced-c9711ff48fa1ad16365bc7eb37fa7153143bcee6.tar.bz2 iced-c9711ff48fa1ad16365bc7eb37fa7153143bcee6.zip |
Handle `clipboard::Action` in `iced_winit` shell
Diffstat (limited to 'glutin')
-rw-r--r-- | glutin/src/application.rs | 23 |
1 files changed, 18 insertions, 5 deletions
diff --git a/glutin/src/application.rs b/glutin/src/application.rs index 1368f7f8..cef49ea0 100644 --- a/glutin/src/application.rs +++ b/glutin/src/application.rs @@ -33,6 +33,8 @@ where debug.startup_started(); let event_loop = EventLoop::with_user_event(); + let mut proxy = event_loop.create_proxy(); + let mut runtime = { let executor = E::new().map_err(Error::ExecutorCreationFailed)?; let proxy = Proxy::new(event_loop.create_proxy()); @@ -48,9 +50,6 @@ where let subscription = application.subscription(); - application::run_command(init_command, &mut runtime); - runtime.track(subscription); - let context = { let builder = settings .window @@ -90,6 +89,16 @@ where })? }; + let mut clipboard = Clipboard::connect(context.window()); + + application::run_command( + init_command, + &mut runtime, + &mut clipboard, + &mut proxy, + ); + runtime.track(subscription); + let (mut sender, receiver) = mpsc::unbounded(); let mut instance = Box::pin(run_instance::<A, E, C>( @@ -97,6 +106,8 @@ where compositor, renderer, runtime, + clipboard, + proxy, debug, receiver, context, @@ -145,6 +156,8 @@ async fn run_instance<A, E, C>( mut compositor: C, mut renderer: A::Renderer, mut runtime: Runtime<E, Proxy<A::Message>, A::Message>, + mut clipboard: Clipboard, + mut proxy: glutin::event_loop::EventLoopProxy<A::Message>, mut debug: Debug, mut receiver: mpsc::UnboundedReceiver<glutin::event::Event<'_, A::Message>>, mut context: glutin::ContextWrapper<glutin::PossiblyCurrent, Window>, @@ -157,8 +170,6 @@ async fn run_instance<A, E, C>( use glutin::event; use iced_winit::futures::stream::StreamExt; - let mut clipboard = Clipboard::connect(context.window()); - let mut state = application::State::new(&application, context.window()); let mut viewport_version = state.viewport_version(); let mut user_interface = @@ -210,6 +221,8 @@ async fn run_instance<A, E, C>( application::update( &mut application, &mut runtime, + &mut clipboard, + &mut proxy, &mut debug, &mut messages, ); |