Support requesting user attention on macOS (#664)

* Support requesting user attention on macOS

* Documentation improvements
This commit is contained in:
Barret Rennie 2018-11-06 23:50:40 -05:00 committed by Francesca Plebani
parent 52e2748869
commit a46fcaee31
3 changed files with 29 additions and 0 deletions

View file

@ -14,6 +14,14 @@ pub trait WindowExt {
///
/// The pointer will become invalid when the `Window` is destroyed.
fn get_nsview(&self) -> *mut c_void;
/// Request user attention, causing the application's dock icon to bounce.
/// Note that this has no effect if the application is already focused.
///
/// The `is_critical` flag has the following effects:
/// - `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);
}
impl WindowExt for Window {
@ -26,6 +34,11 @@ impl WindowExt for Window {
fn get_nsview(&self) -> *mut c_void {
self.window.get_nsview()
}
#[inline]
fn request_user_attention(&self, is_critical: bool) {
self.window.request_user_attention(is_critical)
}
}
/// Corresponds to `NSApplicationActivationPolicy`.