[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:
Robert Günzler 2018-01-22 18:07:51 +00:00 committed by Pierre Krieger
parent 0e81251f3a
commit 7e1c70964d
3 changed files with 19 additions and 2 deletions

View file

@ -63,6 +63,7 @@ impl From<ActivationPolicy> for NSApplicationActivationPolicy {
/// Additional methods on `WindowBuilder` that are specific to MacOS.
pub trait WindowBuilderExt {
fn with_activation_policy(self, activation_policy: ActivationPolicy) -> WindowBuilder;
fn with_movable_by_window_background(self, movable_by_window_background: bool) -> WindowBuilder;
}
impl WindowBuilderExt for WindowBuilder {
@ -72,6 +73,13 @@ impl WindowBuilderExt for WindowBuilder {
self.platform_specific.activation_policy = activation_policy;
self
}
/// Enables click-and-drag behavior for the entire window, not just the titlebar
#[inline]
fn with_movable_by_window_background(mut self, movable_by_window_background: bool) -> WindowBuilder {
self.platform_specific.movable_by_window_background = movable_by_window_background;
self
}
}
/// Additional methods on `MonitorId` that are specific to MacOS.