1717use std:: any:: { Any , TypeId } ;
1818
1919use crate :: {
20- commands, core:: CommandQueue , Command , Data , Env , Event , Handled , MenuDesc , SingleUse , Target ,
21- WindowDesc , WindowId ,
20+ commands, core:: CommandQueue , ext_event :: ExtEventHost , Command , Data , Env , Event , ExtEventSink ,
21+ Handled , MenuDesc , SingleUse , Target , WindowDesc , WindowId ,
2222} ;
2323
2424/// A context passed in to [`AppDelegate`] functions.
2525///
2626/// [`AppDelegate`]: trait.AppDelegate.html
2727pub struct DelegateCtx < ' a > {
2828 pub ( crate ) command_queue : & ' a mut CommandQueue ,
29+ pub ( crate ) ext_event_host : & ' a ExtEventHost ,
2930 pub ( crate ) app_data_type : TypeId ,
3031}
3132
@@ -45,6 +46,14 @@ impl<'a> DelegateCtx<'a> {
4546 . push_back ( command. into ( ) . default_to ( Target :: Global ) )
4647 }
4748
49+ /// Returns an [`ExtEventSink`] that can be moved between threads,
50+ /// and can be used to submit commands back to the application.
51+ ///
52+ /// [`ExtEventSink`]: struct.ExtEventSink.html
53+ pub fn get_external_handle ( & self ) -> ExtEventSink {
54+ self . ext_event_host . make_sink ( )
55+ }
56+
4857 /// Create a new window.
4958 /// `T` must be the application's root `Data` type (the type provided to [`AppLauncher::launch`]).
5059 ///
0 commit comments