mirror of
https://github.com/danbulant/cushy
synced 2026-06-24 17:12:11 +00:00
parent
4d6196f4e7
commit
60c7ef8859
3 changed files with 11 additions and 0 deletions
|
|
@ -23,6 +23,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
||||||
persist function.
|
persist function.
|
||||||
- Fixed a deadlock that could occur when multiple threads were attempting to
|
- Fixed a deadlock that could occur when multiple threads were attempting to
|
||||||
execute change callbacks for the same dynamic at the same time.
|
execute change callbacks for the same dynamic at the same time.
|
||||||
|
- The initial `inner_size` of a `Window` is now used if it is non-zero and
|
||||||
|
`WindowAttributes::inner_size` is `None`.
|
||||||
|
|
||||||
### Added
|
### Added
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -3,13 +3,16 @@ use cushy::{
|
||||||
widget::MakeWidget,
|
widget::MakeWidget,
|
||||||
Run,
|
Run,
|
||||||
};
|
};
|
||||||
|
use figures::{units::UPx, Size};
|
||||||
|
|
||||||
fn main() -> cushy::Result {
|
fn main() -> cushy::Result {
|
||||||
let has_unsaved_changes = Dynamic::new(true);
|
let has_unsaved_changes = Dynamic::new(true);
|
||||||
|
let inner_size = Dynamic::new(Size::new(UPx::new(1000), UPx::new(800)));
|
||||||
|
|
||||||
"Prevent Closing"
|
"Prevent Closing"
|
||||||
.into_checkbox(has_unsaved_changes.clone())
|
.into_checkbox(has_unsaved_changes.clone())
|
||||||
.into_window()
|
.into_window()
|
||||||
.on_close_requested(move |()| !has_unsaved_changes.get())
|
.on_close_requested(move |()| !has_unsaved_changes.get())
|
||||||
|
.inner_size(inner_size)
|
||||||
.run()
|
.run()
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1828,6 +1828,12 @@ where
|
||||||
attrs.preferred_theme = Some((*theme_mode).into());
|
attrs.preferred_theme = Some((*theme_mode).into());
|
||||||
}
|
}
|
||||||
attrs.title = settings.title.get();
|
attrs.title = settings.title.get();
|
||||||
|
if attrs.inner_size.is_none() {
|
||||||
|
let dynamic_inner = settings.inner_size.get();
|
||||||
|
if !dynamic_inner.is_zero() {
|
||||||
|
attrs.inner_size = Some(winit::dpi::Size::Physical(dynamic_inner.into()));
|
||||||
|
}
|
||||||
|
}
|
||||||
attrs
|
attrs
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue