Move resize_callback field from WindowBuilder into WindowAttributes struct

This commit is contained in:
mitchmindtree 2016-11-12 02:55:21 +11:00
parent eb18b3d8b6
commit 53065bda40
2 changed files with 7 additions and 7 deletions

View file

@ -107,10 +107,6 @@ pub struct WindowBuilder {
/// Platform-specific configuration.
platform_specific: platform::PlatformSpecificWindowBuilderAttributes,
/// A function called upon resizing, necessary to receive resize events on Mac and possibly
/// other systems.
window_resize_callback: Option<fn(u32, u32)>,
}
/// Error that can happen while creating a window or a headless renderer.
@ -263,6 +259,10 @@ pub struct WindowAttributes {
/// [iOS only] Enable multitouch, see [UIView#multipleTouchEnabled]
/// (https://developer.apple.com/library/ios/documentation/UIKit/Reference/UIView_Class/#//apple_ref/occ/instp/UIView/multipleTouchEnabled)
pub multitouch: bool,
/// A function called upon resizing, necessary to receive resize events on Mac and possibly
/// other systems.
pub resize_callback: Option<fn(u32, u32)>,
}
impl Default for WindowAttributes {
@ -278,6 +278,7 @@ impl Default for WindowAttributes {
transparent: false,
decorations: true,
multitouch: false,
resize_callback: None,
}
}
}

View file

@ -18,7 +18,6 @@ impl WindowBuilder {
WindowBuilder {
window: Default::default(),
platform_specific: Default::default(),
window_resize_callback: None,
}
}
@ -99,7 +98,7 @@ impl WindowBuilder {
/// during window resizing.
#[inline]
pub fn with_window_resize_callback(mut self, cb: fn(u32, u32)) -> WindowBuilder {
self.window_resize_callback = Some(cb);
self.window.resize_callback = Some(cb);
self
}
@ -122,7 +121,7 @@ impl WindowBuilder {
let mut w = try!(platform::Window::new(&self.window, &self.platform_specific));
// a window resize callback was given
if let Some(callback) = self.window_resize_callback {
if let Some(callback) = self.window.resize_callback {
w.set_window_resize_callback(Some(callback));
}