Skip to content

Commit

Permalink
feat: always on bottom
Browse files Browse the repository at this point in the history
  • Loading branch information
henry40408 committed Aug 7, 2022
1 parent c04e427 commit d93ed90
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 7 deletions.
12 changes: 6 additions & 6 deletions src/platform_impl/macos/window.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1125,19 +1125,19 @@ impl UnownedWindow {
}

#[inline]
pub fn set_always_on_top(&self, always_on_top: bool) {
let level = if always_on_top {
ffi::NSWindowLevel::NSFloatingWindowLevel
pub fn set_always_on_bottom(&self, always_on_bottom: bool) {
let level = if always_on_bottom {
ffi::NSWindowLevel::BelowNormalWindowLevel
} else {
ffi::NSWindowLevel::NSNormalWindowLevel
};
unsafe { util::set_level_async(*self.ns_window, level) };
}

#[inline]
pub fn set_always_on_bottom(&self, always_on_bottom: bool) {
let level = if always_on_bottom {
ffi::NSWindowLevel::BelowNormalWindowLevel
pub fn set_always_on_top(&self, always_on_top: bool) {
let level = if always_on_top {
ffi::NSWindowLevel::NSFloatingWindowLevel
} else {
ffi::NSWindowLevel::NSNormalWindowLevel
};
Expand Down
5 changes: 5 additions & 0 deletions src/platform_impl/windows/window.rs
Original file line number Diff line number Diff line change
Expand Up @@ -649,6 +649,11 @@ impl Window {
});
}

#[inline]
pub fn set_always_on_bottom(&self, _always_on_bottom: bool) {
warn!("`Window::set_always_on_bottom` is ignored on Windows");
}

#[inline]
pub fn set_always_on_top(&self, always_on_top: bool) {
let window = self.window.clone();
Expand Down
2 changes: 1 addition & 1 deletion src/window.rs
Original file line number Diff line number Diff line change
Expand Up @@ -795,7 +795,7 @@ impl Window {
///
/// ## Platform-specific
///
/// - **iOS / Android:** Unsupported.
/// - **Windows / iOS / Android:** Unsupported.
#[inline]
pub fn set_always_on_bottom(&self, always_on_bottom: bool) {
self.window.set_always_on_bottom(always_on_bottom)
Expand Down

0 comments on commit d93ed90

Please sign in to comment.