Fix to enable "Save changes" popup
This commit is contained in:
1 parent
1c99e9fabc
commit
913d2127d8
5 files changed
+51
-2
No files matched your search
+12
-2
@@ -29,6 +29,7 @@ pub struct AppState {
|
||||
pub fonts: Fonts,
|
||||
pub texture_manager: WrappedTextureManager,
|
||||
pub script_dir: PathBuf,
|
||||
pub should_exit: bool,
|
||||
}
|
||||
|
||||
impl AppState {
|
||||
@@ -59,6 +60,7 @@ impl App {
|
||||
fonts: Fonts::new(pob_font_definitions()),
|
||||
texture_manager: WrappedTextureManager::new(),
|
||||
script_dir,
|
||||
should_exit: false,
|
||||
};
|
||||
|
||||
let current_mode = if uses_custom_script_dir {
|
||||
@@ -188,8 +190,10 @@ impl ApplicationHandler<GraphicsContext> for App {
|
||||
) {
|
||||
match event {
|
||||
WindowEvent::CloseRequested => {
|
||||
self.handle_event(AppEvent::Exit);
|
||||
event_loop.exit();
|
||||
self.state.should_exit = self.current_mode.can_exit(&mut self.state);
|
||||
if !self.state.should_exit {
|
||||
self.state.window.request_redraw();
|
||||
}
|
||||
}
|
||||
WindowEvent::RedrawRequested => {
|
||||
profiling::scope!("RedrawRequested");
|
||||
@@ -200,6 +204,12 @@ impl ApplicationHandler<GraphicsContext> for App {
|
||||
return;
|
||||
}
|
||||
|
||||
if self.state.should_exit {
|
||||
self.handle_event(AppEvent::Exit);
|
||||
event_loop.exit();
|
||||
return;
|
||||
}
|
||||
|
||||
if self.needs_reconfigure {
|
||||
if let Some(ref mut gfx) = self.gfx_context {
|
||||
let size = gfx.window.inner_size();
|
||||
|
||||
Reference in new issue
Block a user