mirror of
https://github.com/italicsjenga/winit-sonoma-fix.git
synced 2024-12-25 06:41:31 +11:00
Move resize_callback field from WindowBuilder into WindowAttributes struct
This commit is contained in:
parent
eb18b3d8b6
commit
53065bda40
|
@ -107,10 +107,6 @@ pub struct WindowBuilder {
|
||||||
|
|
||||||
/// Platform-specific configuration.
|
/// Platform-specific configuration.
|
||||||
platform_specific: platform::PlatformSpecificWindowBuilderAttributes,
|
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.
|
/// 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]
|
/// [iOS only] Enable multitouch, see [UIView#multipleTouchEnabled]
|
||||||
/// (https://developer.apple.com/library/ios/documentation/UIKit/Reference/UIView_Class/#//apple_ref/occ/instp/UIView/multipleTouchEnabled)
|
/// (https://developer.apple.com/library/ios/documentation/UIKit/Reference/UIView_Class/#//apple_ref/occ/instp/UIView/multipleTouchEnabled)
|
||||||
pub multitouch: bool,
|
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 {
|
impl Default for WindowAttributes {
|
||||||
|
@ -278,6 +278,7 @@ impl Default for WindowAttributes {
|
||||||
transparent: false,
|
transparent: false,
|
||||||
decorations: true,
|
decorations: true,
|
||||||
multitouch: false,
|
multitouch: false,
|
||||||
|
resize_callback: None,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,7 +18,6 @@ impl WindowBuilder {
|
||||||
WindowBuilder {
|
WindowBuilder {
|
||||||
window: Default::default(),
|
window: Default::default(),
|
||||||
platform_specific: Default::default(),
|
platform_specific: Default::default(),
|
||||||
window_resize_callback: None,
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -99,7 +98,7 @@ impl WindowBuilder {
|
||||||
/// during window resizing.
|
/// during window resizing.
|
||||||
#[inline]
|
#[inline]
|
||||||
pub fn with_window_resize_callback(mut self, cb: fn(u32, u32)) -> WindowBuilder {
|
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
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -122,7 +121,7 @@ impl WindowBuilder {
|
||||||
let mut w = try!(platform::Window::new(&self.window, &self.platform_specific));
|
let mut w = try!(platform::Window::new(&self.window, &self.platform_specific));
|
||||||
|
|
||||||
// a window resize callback was given
|
// 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));
|
w.set_window_resize_callback(Some(callback));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue