[macos] add NSWindow.hasShadow support (#1637)

* [macos] add NSWindow.hasShadow

* change log

* cargo fmt

* Update CHANGELOG.md

* Update src/platform_impl/macos/window.rs

* Update src/platform/macos.rs

* set_has_shadow() with cuter format

* adjust code

* cargo fmt

* changelog
This commit is contained in:
TakWolf 2020-08-14 02:10:34 +08:00 committed by GitHub
parent 68100102be
commit 514ab043f2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 61 additions and 1 deletions

View file

@ -56,6 +56,12 @@ pub trait WindowExtMacOS {
/// And allows the user to have a fullscreen window without using another
/// space or taking control over the entire monitor.
fn set_simple_fullscreen(&self, fullscreen: bool) -> bool;
/// Returns whether or not the window has shadow.
fn has_shadow(&self) -> bool;
/// Sets whether or not the window has shadow.
fn set_has_shadow(&self, has_shadow: bool);
}
impl WindowExtMacOS for Window {
@ -83,6 +89,16 @@ impl WindowExtMacOS for Window {
fn set_simple_fullscreen(&self, fullscreen: bool) -> bool {
self.window.set_simple_fullscreen(fullscreen)
}
#[inline]
fn has_shadow(&self) -> bool {
self.window.has_shadow()
}
#[inline]
fn set_has_shadow(&self, has_shadow: bool) {
self.window.set_has_shadow(has_shadow)
}
}
/// Corresponds to `NSApplicationActivationPolicy`.
@ -131,6 +147,7 @@ pub trait WindowBuilderExtMacOS {
/// Build window with `resizeIncrements` property. Values must not be 0.
fn with_resize_increments(self, increments: LogicalSize<f64>) -> WindowBuilder;
fn with_disallow_hidpi(self, disallow_hidpi: bool) -> WindowBuilder;
fn with_has_shadow(self, has_shadow: bool) -> WindowBuilder;
}
impl WindowBuilderExtMacOS for WindowBuilder {
@ -190,6 +207,12 @@ impl WindowBuilderExtMacOS for WindowBuilder {
self.platform_specific.disallow_hidpi = disallow_hidpi;
self
}
#[inline]
fn with_has_shadow(mut self, has_shadow: bool) -> WindowBuilder {
self.platform_specific.has_shadow = has_shadow;
self
}
}
/// Additional methods on `MonitorHandle` that are specific to MacOS.