@@ -17,9 +17,9 @@ use std::time::{Duration, Instant};
1717use url:: Url ;
1818use winit:: dpi:: { LogicalSize , PhysicalPosition , PhysicalSize , Size } ;
1919use winit:: event:: { ElementState , KeyEvent , Modifiers , WindowEvent } ;
20- use winit:: event_loop:: { ControlFlow , EventLoop , EventLoopBuilder } ;
20+ use winit:: event_loop:: { ControlFlow , EventLoop } ;
2121use winit:: keyboard:: { Key , NamedKey } ;
22- use winit:: window:: { Fullscreen , Icon , Window , WindowBuilder } ;
22+ use winit:: window:: { Fullscreen , Icon , Window , WindowAttributes } ;
2323
2424pub struct App {
2525 preferences : GlobalPreferences ,
@@ -43,22 +43,26 @@ impl App {
4343 let icon =
4444 Icon :: from_rgba ( icon_bytes. to_vec ( ) , 32 , 32 ) . context ( "Couldn't load app icon" ) ?;
4545
46- let event_loop = EventLoopBuilder :: with_user_event ( ) . build ( ) ?;
46+ let event_loop = EventLoop :: with_user_event ( ) . build ( ) ?;
4747
4848 let no_gui = preferences. cli . no_gui ;
4949 let min_window_size = ( 16 , if no_gui { 16 } else { MENU_HEIGHT + 16 } ) . into ( ) ;
50- let max_window_size = get_screen_size ( & event_loop) ;
5150 let preferred_width = preferences. cli . width ;
5251 let preferred_height = preferences. cli . height ;
5352 let start_fullscreen = preferences. cli . fullscreen ;
5453
55- let window = WindowBuilder :: new ( )
54+ let window_attributes = WindowAttributes :: default ( )
5655 . with_visible ( false )
5756 . with_title ( "Ruffle" )
5857 . with_window_icon ( Some ( icon) )
59- . with_min_inner_size ( min_window_size)
60- . with_max_inner_size ( max_window_size)
61- . build ( & event_loop) ?;
58+ . with_min_inner_size ( min_window_size) ;
59+
60+ // TODO: Migrate to ActiveEventLoop::create_window, see:
61+ // https://github.com/rust-windowing/winit/releases/tag/v0.30.0
62+ #[ allow( deprecated) ]
63+ let window = event_loop. create_window ( window_attributes) ?;
64+ let max_window_size = get_screen_size ( & window) ;
65+ window. set_max_inner_size ( Some ( max_window_size) ) ;
6266 let window = Arc :: new ( window) ;
6367
6468 let mut font_database = fontdb:: Database :: default ( ) ;
@@ -136,6 +140,9 @@ impl App {
136140 // Poll UI events.
137141 let event_loop = self . event_loop . take ( ) . expect ( "App already running" ) ;
138142 let event_loop_proxy = event_loop. create_proxy ( ) ;
143+ // TODO: Migrate to `EventLoop::run_app` and `impl ApplicationHandler<RuffleEvent> for App`,
144+ // see: https://github.com/rust-windowing/winit/releases/tag/v0.30.0
145+ #[ allow( deprecated) ]
139146 event_loop. run ( move |event, elwt| {
140147 let mut check_redraw = false ;
141148 match event {
0 commit comments