File tree 1 file changed +25
-2
lines changed 1 file changed +25
-2
lines changed Original file line number Diff line number Diff line change @@ -22,6 +22,15 @@ use winit::{
22
22
event_loop:: { ControlFlow , EventLoop , EventLoopWindowTarget } ,
23
23
} ;
24
24
25
+ #[ cfg( any(
26
+ target_os = "linux" ,
27
+ target_os = "dragonfly" ,
28
+ target_os = "freebsd" ,
29
+ target_os = "netbsd" ,
30
+ target_os = "openbsd"
31
+ ) ) ]
32
+ use winit:: platform:: unix:: EventLoopExtUnix ;
33
+
25
34
#[ derive( Default ) ]
26
35
pub struct WinitPlugin ;
27
36
@@ -157,8 +166,22 @@ where
157
166
panic ! ( "Run return is not supported on this platform!" )
158
167
}
159
168
160
- pub fn winit_runner ( mut app : App ) {
161
- let mut event_loop = EventLoop :: new ( ) ;
169
+ pub fn winit_runner ( app : App ) {
170
+ winit_runner_with ( app, EventLoop :: new ( ) ) ;
171
+ }
172
+
173
+ #[ cfg( any(
174
+ target_os = "linux" ,
175
+ target_os = "dragonfly" ,
176
+ target_os = "freebsd" ,
177
+ target_os = "netbsd" ,
178
+ target_os = "openbsd"
179
+ ) ) ]
180
+ pub fn winit_runner_any_thread ( app : App ) {
181
+ winit_runner_with ( app, EventLoop :: new_any_thread ( ) ) ;
182
+ }
183
+
184
+ pub fn winit_runner_with ( mut app : App , mut event_loop : EventLoop < ( ) > ) {
162
185
let mut create_window_event_reader = EventReader :: < CreateWindow > :: default ( ) ;
163
186
let mut app_exit_event_reader = EventReader :: < AppExit > :: default ( ) ;
164
187
You can’t perform that action at this time.
0 commit comments