mirror of
https://github.com/danbulant/appit
synced 2026-07-03 10:00:37 +00:00
Fixing multiwindow close behavior
This commit is contained in:
parent
d0af8bb4e0
commit
ea1c0975dc
4 changed files with 17 additions and 3 deletions
|
|
@ -5,6 +5,13 @@ All notable changes to this project will be documented in this file.
|
||||||
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
||||||
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
||||||
|
|
||||||
|
## Unreleased
|
||||||
|
|
||||||
|
### Fixed
|
||||||
|
|
||||||
|
- When multiple windows are open, windows now properly close fully without
|
||||||
|
requiring that all windows are closed.
|
||||||
|
|
||||||
## v0.3.0 (2024-07-15)
|
## v0.3.0 (2024-07-15)
|
||||||
|
|
||||||
### Added
|
### Added
|
||||||
|
|
|
||||||
|
|
@ -474,7 +474,9 @@ impl<Message> Windows<Message> {
|
||||||
|
|
||||||
fn close(&self, window: WindowId) -> bool {
|
fn close(&self, window: WindowId) -> bool {
|
||||||
let mut data = self.data.lock().unwrap_or_else(PoisonError::into_inner);
|
let mut data = self.data.lock().unwrap_or_else(PoisonError::into_inner);
|
||||||
data.remove(&window);
|
if let Some(closed) = data.remove(&window) {
|
||||||
|
closed.winit.close();
|
||||||
|
}
|
||||||
data.is_empty()
|
data.is_empty()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -38,6 +38,10 @@ impl OpenedWindow {
|
||||||
.unwrap_or_else(PoisonError::into_inner)
|
.unwrap_or_else(PoisonError::into_inner)
|
||||||
.clone()
|
.clone()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub(crate) fn close(&self) {
|
||||||
|
*self.0.lock().unwrap_or_else(PoisonError::into_inner) = None;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub enum EventLoopMessage<AppMessage>
|
pub enum EventLoopMessage<AppMessage>
|
||||||
|
|
|
||||||
|
|
@ -221,7 +221,8 @@ where
|
||||||
let (sender, receiver) = mpsc::sync_channel(65536);
|
let (sender, receiver) = mpsc::sync_channel(65536);
|
||||||
let sender = Arc::new(sender);
|
let sender = Arc::new(sender);
|
||||||
let app = self.owner.as_application().app();
|
let app = self.owner.as_application().app();
|
||||||
let show_after_init = self.attributes.delay_visible && std::mem::replace(&mut self.attributes.visible, false);
|
let show_after_init =
|
||||||
|
self.attributes.delay_visible && std::mem::replace(&mut self.attributes.visible, false);
|
||||||
let Some(winit) = self.owner.as_application_mut().open(
|
let Some(winit) = self.owner.as_application_mut().open(
|
||||||
self.attributes,
|
self.attributes,
|
||||||
sender.clone(),
|
sender.clone(),
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue