Support requesting user attention on macOS (#664)
* Support requesting user attention on macOS * Documentation improvements
This commit is contained in:
parent
52e2748869
commit
a46fcaee31
3 changed files with 29 additions and 0 deletions
|
|
@ -9,8 +9,10 @@ use std::sync::atomic::{Ordering, AtomicBool};
|
|||
use cocoa::appkit::{
|
||||
self,
|
||||
CGFloat,
|
||||
NSApp,
|
||||
NSApplication,
|
||||
NSColor,
|
||||
NSRequestUserAttentionType,
|
||||
NSScreen,
|
||||
NSView,
|
||||
NSWindow,
|
||||
|
|
@ -585,6 +587,19 @@ impl WindowExt for Window2 {
|
|||
fn get_nsview(&self) -> *mut c_void {
|
||||
*self.view as *mut c_void
|
||||
}
|
||||
|
||||
#[inline]
|
||||
fn request_user_attention(&self, is_critical: bool) {
|
||||
let request_type = if is_critical {
|
||||
NSRequestUserAttentionType::NSCriticalRequest
|
||||
} else {
|
||||
NSRequestUserAttentionType::NSInformationalRequest
|
||||
};
|
||||
|
||||
unsafe {
|
||||
NSApp().requestUserAttention_(request_type);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl Window2 {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue