Add ability to change the min/max size of windows at runtime (#405)

* Add min/max size setting for win32 and wayland backends

* Implement dynamic min/max size on macos

* Add min/max size setting for x11

* Add empty functions for remaining platforms

* Improved min/max size setting for x11

* Added CHANGELOG entry for new min/max methods

* Added documentation for new min/max methods

* On win32, bound window size to min/max dimensions on window creation

* On win32, force re-check of window size when changing min/max dimensions

* Fix freeze when setting min and max size
This commit is contained in:
Osspial 2018-03-23 05:35:35 -04:00 committed by Pierre Krieger
parent d667a395b6
commit bbcd3019e8
12 changed files with 270 additions and 24 deletions

View file

@ -136,6 +136,16 @@ impl Window {
*(self.size.lock().unwrap()) = (x, y);
}
#[inline]
pub fn set_min_dimensions(&self, dimensions: Option<(u32, u32)>) {
self.frame.lock().unwrap().set_min_size(dimensions.map(|(w, h)| (w as i32, h as i32)));
}
#[inline]
pub fn set_max_dimensions(&self, dimensions: Option<(u32, u32)>) {
self.frame.lock().unwrap().set_max_size(dimensions.map(|(w, h)| (w as i32, h as i32)));
}
#[inline]
pub fn set_cursor(&self, _cursor: MouseCursor) {
// TODO
@ -190,11 +200,11 @@ impl Window {
// TODO: not yet possible on wayland
Err(())
}
pub fn get_display(&self) -> &wl_display::WlDisplay {
&*self.display
}
pub fn get_surface(&self) -> &wl_surface::WlSurface {
&self.surface
}