mirror of
https://github.com/rust-windowing/winit.git
synced 2026-08-30 13:20:06 -04:00
* Windows: implement with_resizable (#540) * Fixed typo
This commit is contained in:
committed by
Francesca Frangipane
parent
bbfe57400d
commit
58a00bffbb
@@ -422,6 +422,11 @@ pub struct WindowAttributes {
|
||||
/// The default is `None`.
|
||||
pub max_dimensions: Option<(u32, u32)>,
|
||||
|
||||
/// [Windows only] Whether the window is resizable or not
|
||||
///
|
||||
/// The default is `true`.
|
||||
pub resizable: bool,
|
||||
|
||||
/// Whether the window should be set as fullscreen upon creation.
|
||||
///
|
||||
/// The default is `None`.
|
||||
@@ -475,6 +480,7 @@ impl Default for WindowAttributes {
|
||||
dimensions: None,
|
||||
min_dimensions: None,
|
||||
max_dimensions: None,
|
||||
resizable: true,
|
||||
title: "winit window".to_owned(),
|
||||
maximized: false,
|
||||
fullscreen: None,
|
||||
|
||||
@@ -843,6 +843,10 @@ unsafe fn init(
|
||||
style | winuser::WS_VISIBLE
|
||||
};
|
||||
|
||||
if !window.resizable {
|
||||
style &= !winuser::WS_SIZEBOX;
|
||||
}
|
||||
|
||||
if pl_attribs.parent.is_some() {
|
||||
style |= winuser::WS_CHILD;
|
||||
}
|
||||
|
||||
@@ -49,6 +49,17 @@ impl WindowBuilder {
|
||||
self
|
||||
}
|
||||
|
||||
/// Sets whether the window is resizable or not
|
||||
///
|
||||
/// ## Platform-specific
|
||||
///
|
||||
/// This only has an effect on Windows.
|
||||
#[inline]
|
||||
pub fn with_resizable(mut self, resizable: bool) -> WindowBuilder {
|
||||
self.window.resizable = resizable;
|
||||
self
|
||||
}
|
||||
|
||||
/// Requests a specific title for the window.
|
||||
#[inline]
|
||||
pub fn with_title<T: Into<String>>(mut self, title: T) -> WindowBuilder {
|
||||
|
||||
Reference in New Issue
Block a user