[macOS] Move the window if there is no title bar (#382)
* macOS: Move the window if there is no title bar On macOS by default windows can only be moved by clicking and dragging on the titlebar, if we spawn a window without one we need to set the `movableByWindowBackground` property. Partial fix for #368 * macOS: Make moveByWindowBackground optional Implements setting the property via WindowBuilderExt: WindowBuilder::new() .with_decorations(false) .with_movable_by_window_background(true) * Update CHANGELOG
This commit is contained in:
parent
0e81251f3a
commit
7e1c70964d
3 changed files with 19 additions and 2 deletions
|
|
@ -254,6 +254,7 @@ impl Drop for WindowDelegate {
|
|||
#[derive(Clone, Default)]
|
||||
pub struct PlatformSpecificWindowBuilderAttributes {
|
||||
pub activation_policy: ActivationPolicy,
|
||||
pub movable_by_window_background: bool,
|
||||
}
|
||||
|
||||
pub struct Window2 {
|
||||
|
|
@ -312,7 +313,7 @@ impl Window2 {
|
|||
None => { return Err(OsError(format!("Couldn't create NSApplication"))); },
|
||||
};
|
||||
|
||||
let window = match Window2::create_window(win_attribs)
|
||||
let window = match Window2::create_window(win_attribs, pl_attribs)
|
||||
{
|
||||
Some(window) => window,
|
||||
None => { return Err(OsError(format!("Couldn't create NSWindow"))); },
|
||||
|
|
@ -381,7 +382,10 @@ impl Window2 {
|
|||
}
|
||||
}
|
||||
|
||||
fn create_window(attrs: &WindowAttributes) -> Option<IdRef> {
|
||||
fn create_window(
|
||||
attrs: &WindowAttributes,
|
||||
pl_attrs: &PlatformSpecificWindowBuilderAttributes)
|
||||
-> Option<IdRef> {
|
||||
unsafe {
|
||||
let screen = match attrs.fullscreen {
|
||||
Some(ref monitor_id) => {
|
||||
|
|
@ -449,6 +453,10 @@ impl Window2 {
|
|||
window.setTitlebarAppearsTransparent_(YES);
|
||||
}
|
||||
|
||||
if pl_attrs.movable_by_window_background {
|
||||
window.setMovableByWindowBackground_(YES);
|
||||
}
|
||||
|
||||
if screen.is_some() {
|
||||
window.setLevel_(appkit::NSMainMenuWindowLevel as i64 + 1);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue