@@ -432,11 +432,10 @@ impl ApplicationHandler<EventPayload> for Application<'_> {
432432 }
433433 }
434434 }
435- RioEventType :: Rio ( RioEvent :: Exit ) => {
435+ RioEventType :: Rio ( RioEvent :: Exit | RioEvent :: Quit ) => {
436436 if let Some ( route) = self . router . routes . get_mut ( & window_id) {
437437 if self . config . confirm_before_quit {
438438 route. confirm_quit ( ) ;
439- route. request_redraw ( ) ;
440439 } else {
441440 route. quit ( ) ;
442441 }
@@ -994,7 +993,6 @@ impl ApplicationHandler<EventPayload> for Application<'_> {
994993
995994 if self . config . confirm_before_quit {
996995 route. confirm_quit ( ) ;
997- route. request_redraw ( ) ;
998996 return ;
999997 } else {
1000998 self . router . routes . remove ( & window_id) ;
@@ -1010,7 +1008,9 @@ impl ApplicationHandler<EventPayload> for Application<'_> {
10101008 }
10111009
10121010 WindowEvent :: MouseInput { state, button, .. } => {
1013- if route. path != RoutePath :: Terminal {
1011+ if route. path != RoutePath :: Terminal
1012+ || route. window . screen . renderer . confirm_quit . is_active ( )
1013+ {
10141014 #[ cfg( target_os = "macos" ) ]
10151015 if state == ElementState :: Pressed
10161016 && button == MouseButton :: Left
@@ -1316,7 +1316,9 @@ impl ApplicationHandler<EventPayload> for Application<'_> {
13161316 route. window . screen . mouse . y = y;
13171317 route. window . screen . mouse . raw_y = position. y ;
13181318
1319- if route. path != RoutePath :: Terminal {
1319+ if route. path != RoutePath :: Terminal
1320+ || route. window . screen . renderer . confirm_quit . is_active ( )
1321+ {
13201322 route. window . winit_window . set_cursor ( CursorIcon :: Default ) ;
13211323 return ;
13221324 }
@@ -1624,7 +1626,9 @@ impl ApplicationHandler<EventPayload> for Application<'_> {
16241626 }
16251627
16261628 WindowEvent :: MouseWheel { delta, phase, .. } => {
1627- if route. path != RoutePath :: Terminal {
1629+ if route. path != RoutePath :: Terminal
1630+ || route. window . screen . renderer . confirm_quit . is_active ( )
1631+ {
16281632 return ;
16291633 }
16301634
@@ -1838,18 +1842,7 @@ impl ApplicationHandler<EventPayload> for Application<'_> {
18381842 RoutePath :: Welcome => {
18391843 route. window . screen . render_welcome ( ) ;
18401844 }
1841- RoutePath :: Terminal | RoutePath :: ConfirmQuit => {
1842- if route. path == RoutePath :: ConfirmQuit {
1843- let dim = route. window . screen . ctx ( ) . current ( ) . dimension ;
1844- crate :: router:: routes:: dialog:: screen (
1845- & mut route. window . screen . sugarloaf ,
1846- & dim,
1847- "want to quit?" ,
1848- "yes (y)" ,
1849- "no (n)" ,
1850- ) ;
1851- }
1852-
1845+ RoutePath :: Terminal => {
18531846 if let Some ( window_update) = route. window . screen . render ( ) {
18541847 use crate :: context:: renderable:: {
18551848 BackgroundState , WindowUpdate ,
@@ -1910,16 +1903,14 @@ impl ApplicationHandler<EventPayload> for Application<'_> {
19101903 route. request_redraw ( ) ;
19111904 event_loop. set_control_flow ( ControlFlow :: Poll ) ;
19121905 } else {
1913- if route. path == RoutePath :: Welcome
1914- || route. path == RoutePath :: ConfirmQuit
1915- || route
1916- . window
1917- . screen
1918- . ctx ( )
1919- . current ( )
1920- . renderable_content
1921- . pending_update
1922- . is_dirty ( )
1906+ if route
1907+ . window
1908+ . screen
1909+ . ctx ( )
1910+ . current ( )
1911+ . renderable_content
1912+ . pending_update
1913+ . is_dirty ( )
19231914 {
19241915 route. request_redraw ( ) ;
19251916 }
0 commit comments