Merge 3f396a2311
into 0e575b2809
This commit is contained in:
commit
27e0286b61
9 changed files with 77 additions and 8 deletions
|
@ -62,6 +62,7 @@ impl AgentNotification {
|
||||||
app_id: Some(app_id.to_owned()),
|
app_id: Some(app_id.to_owned()),
|
||||||
window_min_size: None,
|
window_min_size: None,
|
||||||
window_decorations: Some(WindowDecorations::Client),
|
window_decorations: Some(WindowDecorations::Client),
|
||||||
|
..Default::default()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -66,5 +66,6 @@ fn notification_window_options(
|
||||||
app_id: Some(app_id.to_owned()),
|
app_id: Some(app_id.to_owned()),
|
||||||
window_min_size: None,
|
window_min_size: None,
|
||||||
window_decorations: Some(WindowDecorations::Client),
|
window_decorations: Some(WindowDecorations::Client),
|
||||||
|
..Default::default()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -152,6 +152,36 @@ impl Render for WindowDemo {
|
||||||
)
|
)
|
||||||
.unwrap();
|
.unwrap();
|
||||||
}))
|
}))
|
||||||
|
.child(button("Unresizable", move |_, cx| {
|
||||||
|
cx.open_window(
|
||||||
|
WindowOptions {
|
||||||
|
is_resizable: false,
|
||||||
|
window_bounds: Some(window_bounds),
|
||||||
|
..Default::default()
|
||||||
|
},
|
||||||
|
|_, cx| {
|
||||||
|
cx.new(|_| SubWindow {
|
||||||
|
custom_titlebar: false,
|
||||||
|
})
|
||||||
|
},
|
||||||
|
)
|
||||||
|
.unwrap();
|
||||||
|
}))
|
||||||
|
.child(button("Unminimizable", move |_, cx| {
|
||||||
|
cx.open_window(
|
||||||
|
WindowOptions {
|
||||||
|
is_minimizable: false,
|
||||||
|
window_bounds: Some(window_bounds),
|
||||||
|
..Default::default()
|
||||||
|
},
|
||||||
|
|_, cx| {
|
||||||
|
cx.new(|_| SubWindow {
|
||||||
|
custom_titlebar: false,
|
||||||
|
})
|
||||||
|
},
|
||||||
|
)
|
||||||
|
.unwrap();
|
||||||
|
}))
|
||||||
.child(button("Hide Application", |window, cx| {
|
.child(button("Hide Application", |window, cx| {
|
||||||
cx.hide();
|
cx.hide();
|
||||||
|
|
||||||
|
|
|
@ -62,6 +62,7 @@ fn build_window_options(display_id: DisplayId, bounds: Bounds<Pixels>) -> Window
|
||||||
app_id: None,
|
app_id: None,
|
||||||
window_min_size: None,
|
window_min_size: None,
|
||||||
window_decorations: None,
|
window_decorations: None,
|
||||||
|
..Default::default()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1089,6 +1089,12 @@ pub struct WindowOptions {
|
||||||
/// Whether the window should be movable by the user
|
/// Whether the window should be movable by the user
|
||||||
pub is_movable: bool,
|
pub is_movable: bool,
|
||||||
|
|
||||||
|
/// Whether the window should be resizable by the user
|
||||||
|
pub is_resizable: bool,
|
||||||
|
|
||||||
|
/// Whether the window should be minimized by the user
|
||||||
|
pub is_minimizable: bool,
|
||||||
|
|
||||||
/// The display to create the window on, if this is None,
|
/// The display to create the window on, if this is None,
|
||||||
/// the window will be created on the main display
|
/// the window will be created on the main display
|
||||||
pub display_id: Option<DisplayId>,
|
pub display_id: Option<DisplayId>,
|
||||||
|
@ -1131,6 +1137,14 @@ pub(crate) struct WindowParams {
|
||||||
#[cfg_attr(any(target_os = "linux", target_os = "freebsd"), allow(dead_code))]
|
#[cfg_attr(any(target_os = "linux", target_os = "freebsd"), allow(dead_code))]
|
||||||
pub is_movable: bool,
|
pub is_movable: bool,
|
||||||
|
|
||||||
|
/// Whether the window should be resizable by the user
|
||||||
|
#[cfg_attr(any(target_os = "linux", target_os = "freebsd"), allow(dead_code))]
|
||||||
|
pub is_resizable: bool,
|
||||||
|
|
||||||
|
/// Whether the window should be minimized by the user
|
||||||
|
#[cfg_attr(any(target_os = "linux", target_os = "freebsd"), allow(dead_code))]
|
||||||
|
pub is_minimizable: bool,
|
||||||
|
|
||||||
#[cfg_attr(
|
#[cfg_attr(
|
||||||
any(target_os = "linux", target_os = "freebsd", target_os = "windows"),
|
any(target_os = "linux", target_os = "freebsd", target_os = "windows"),
|
||||||
allow(dead_code)
|
allow(dead_code)
|
||||||
|
@ -1189,6 +1203,8 @@ impl Default for WindowOptions {
|
||||||
show: true,
|
show: true,
|
||||||
kind: WindowKind::Normal,
|
kind: WindowKind::Normal,
|
||||||
is_movable: true,
|
is_movable: true,
|
||||||
|
is_resizable: true,
|
||||||
|
is_minimizable: true,
|
||||||
display_id: None,
|
display_id: None,
|
||||||
window_background: WindowBackgroundAppearance::default(),
|
window_background: WindowBackgroundAppearance::default(),
|
||||||
app_id: None,
|
app_id: None,
|
||||||
|
|
|
@ -530,6 +530,8 @@ impl MacWindow {
|
||||||
titlebar,
|
titlebar,
|
||||||
kind,
|
kind,
|
||||||
is_movable,
|
is_movable,
|
||||||
|
is_resizable,
|
||||||
|
is_minimizable,
|
||||||
focus,
|
focus,
|
||||||
show,
|
show,
|
||||||
display_id,
|
display_id,
|
||||||
|
@ -545,10 +547,16 @@ impl MacWindow {
|
||||||
|
|
||||||
let mut style_mask;
|
let mut style_mask;
|
||||||
if let Some(titlebar) = titlebar.as_ref() {
|
if let Some(titlebar) = titlebar.as_ref() {
|
||||||
style_mask = NSWindowStyleMask::NSClosableWindowMask
|
style_mask =
|
||||||
| NSWindowStyleMask::NSMiniaturizableWindowMask
|
NSWindowStyleMask::NSClosableWindowMask | NSWindowStyleMask::NSTitledWindowMask;
|
||||||
| NSWindowStyleMask::NSResizableWindowMask
|
|
||||||
| NSWindowStyleMask::NSTitledWindowMask;
|
if is_resizable {
|
||||||
|
style_mask |= NSWindowStyleMask::NSResizableWindowMask;
|
||||||
|
}
|
||||||
|
|
||||||
|
if is_minimizable {
|
||||||
|
style_mask |= NSWindowStyleMask::NSMiniaturizableWindowMask;
|
||||||
|
}
|
||||||
|
|
||||||
if titlebar.appears_transparent {
|
if titlebar.appears_transparent {
|
||||||
style_mask |= NSWindowStyleMask::NSFullSizeContentViewWindowMask;
|
style_mask |= NSWindowStyleMask::NSFullSizeContentViewWindowMask;
|
||||||
|
|
|
@ -382,10 +382,17 @@ impl WindowsWindow {
|
||||||
let (mut dwexstyle, dwstyle) = if params.kind == WindowKind::PopUp {
|
let (mut dwexstyle, dwstyle) = if params.kind == WindowKind::PopUp {
|
||||||
(WS_EX_TOOLWINDOW, WINDOW_STYLE(0x0))
|
(WS_EX_TOOLWINDOW, WINDOW_STYLE(0x0))
|
||||||
} else {
|
} else {
|
||||||
(
|
let mut dwstyle = WS_SYSMENU;
|
||||||
WS_EX_APPWINDOW,
|
|
||||||
WS_THICKFRAME | WS_SYSMENU | WS_MAXIMIZEBOX | WS_MINIMIZEBOX,
|
if params.is_resizable {
|
||||||
)
|
dwstyle |= WS_THICKFRAME | WS_MAXIMIZEBOX;
|
||||||
|
}
|
||||||
|
|
||||||
|
if params.is_minimizable {
|
||||||
|
dwstyle |= WS_MINIMIZEBOX;
|
||||||
|
}
|
||||||
|
|
||||||
|
(WS_EX_APPWINDOW, dwstyle)
|
||||||
};
|
};
|
||||||
if !disable_direct_composition {
|
if !disable_direct_composition {
|
||||||
dwexstyle |= WS_EX_NOREDIRECTIONBITMAP;
|
dwexstyle |= WS_EX_NOREDIRECTIONBITMAP;
|
||||||
|
|
|
@ -939,6 +939,8 @@ impl Window {
|
||||||
show,
|
show,
|
||||||
kind,
|
kind,
|
||||||
is_movable,
|
is_movable,
|
||||||
|
is_resizable,
|
||||||
|
is_minimizable,
|
||||||
display_id,
|
display_id,
|
||||||
window_background,
|
window_background,
|
||||||
app_id,
|
app_id,
|
||||||
|
@ -956,6 +958,8 @@ impl Window {
|
||||||
titlebar,
|
titlebar,
|
||||||
kind,
|
kind,
|
||||||
is_movable,
|
is_movable,
|
||||||
|
is_resizable,
|
||||||
|
is_minimizable,
|
||||||
focus,
|
focus,
|
||||||
show,
|
show,
|
||||||
display_id,
|
display_id,
|
||||||
|
|
|
@ -301,6 +301,7 @@ pub fn build_window_options(display_uuid: Option<Uuid>, cx: &mut App) -> WindowO
|
||||||
width: px(360.0),
|
width: px(360.0),
|
||||||
height: px(240.0),
|
height: px(240.0),
|
||||||
}),
|
}),
|
||||||
|
..Default::default()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue