feat: add macos simple fullscreen (#692)
* feat: add macos simple fullscreen * move impl to WindowExt * feedback: remove warning, unused file and rename param * feedback: combine fullscreen examples into one example * fix: ensure decorations and maximize do not toggle while in fullscreen * fix: prevent warning on non-macos platforms * feedback: make changelog more explicit * fix: prevent unconditional construction of NSRect * fix: don't try to set_simple_fullscreen if already using native fullscreen * fix: ensure set_simple_fullscreen plays nicely with set_fullscreen * fix: do not enter native fullscreen if simple fullscreen is active
This commit is contained in:
parent
4b4c73cee4
commit
bfbcab3a01
5 changed files with 183 additions and 34 deletions
|
|
@ -22,6 +22,15 @@ pub trait WindowExt {
|
|||
/// - `false`: the dock icon will only bounce once.
|
||||
/// - `true`: the dock icon will bounce until the application is focused.
|
||||
fn request_user_attention(&self, is_critical: bool);
|
||||
|
||||
/// Toggles a fullscreen mode that doesn't require a new macOS space.
|
||||
/// Returns a boolean indicating whether the transition was successful (this
|
||||
/// won't work if the window was already in the native fullscreen).
|
||||
///
|
||||
/// This is how fullscreen used to work on macOS in versions before Lion.
|
||||
/// 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;
|
||||
}
|
||||
|
||||
impl WindowExt for Window {
|
||||
|
|
@ -39,6 +48,11 @@ impl WindowExt for Window {
|
|||
fn request_user_attention(&self, is_critical: bool) {
|
||||
self.window.request_user_attention(is_critical)
|
||||
}
|
||||
|
||||
#[inline]
|
||||
fn set_simple_fullscreen(&self, fullscreen: bool) -> bool {
|
||||
self.window.set_simple_fullscreen(fullscreen)
|
||||
}
|
||||
}
|
||||
|
||||
/// Corresponds to `NSApplicationActivationPolicy`.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue