On macOS, set that we prefer tabbing
Winit now supports tabbing identifiers, thus set that we prefer tabbing, in particular it'll make windows tab when using the same tabbing identifiers, which is desirable for the end users.
This commit is contained in:
parent
4d6dbea74c
commit
06fb089633
3 changed files with 20 additions and 2 deletions
|
|
@ -56,7 +56,8 @@ pub(crate) use self::version::NSAppKitVersion;
|
|||
pub(crate) use self::view::{NSTrackingRectTag, NSView};
|
||||
pub(crate) use self::window::{
|
||||
NSBackingStoreType, NSWindow, NSWindowButton, NSWindowLevel, NSWindowOcclusionState,
|
||||
NSWindowOrderingMode, NSWindowSharingType, NSWindowStyleMask, NSWindowTitleVisibility,
|
||||
NSWindowOrderingMode, NSWindowSharingType, NSWindowStyleMask, NSWindowTabbingMode,
|
||||
NSWindowTitleVisibility,
|
||||
};
|
||||
|
||||
#[link(name = "AppKit", kind = "framework")]
|
||||
|
|
|
|||
|
|
@ -89,6 +89,9 @@ extern_methods!(
|
|||
#[sel(setSharingType:)]
|
||||
pub fn setSharingType(&self, sharingType: NSWindowSharingType);
|
||||
|
||||
#[sel(setTabbingMode:)]
|
||||
pub fn setTabbingMode(&self, tabbingMode: NSWindowTabbingMode);
|
||||
|
||||
#[sel(setOpaque:)]
|
||||
pub fn setOpaque(&self, opaque: bool);
|
||||
|
||||
|
|
@ -425,3 +428,16 @@ pub enum NSWindowOrderingMode {
|
|||
unsafe impl Encode for NSWindowOrderingMode {
|
||||
const ENCODING: Encoding = NSInteger::ENCODING;
|
||||
}
|
||||
|
||||
#[allow(dead_code)]
|
||||
#[repr(isize)] // NSInteger
|
||||
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)]
|
||||
pub enum NSWindowTabbingMode {
|
||||
NSWindowTabbingModeAutomatic = 0,
|
||||
NSWindowTabbingModeDisallowed = 2,
|
||||
NSWindowTabbingModePreferred = 1,
|
||||
}
|
||||
|
||||
unsafe impl Encode for NSWindowTabbingMode {
|
||||
const ENCODING: Encoding = NSInteger::ENCODING;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -48,7 +48,7 @@ use super::appkit::{
|
|||
NSApp, NSAppKitVersion, NSAppearance, NSApplicationPresentationOptions, NSBackingStoreType,
|
||||
NSColor, NSCursor, NSFilenamesPboardType, NSRequestUserAttentionType, NSResponder, NSScreen,
|
||||
NSView, NSWindow, NSWindowButton, NSWindowLevel, NSWindowSharingType, NSWindowStyleMask,
|
||||
NSWindowTitleVisibility,
|
||||
NSWindowTabbingMode, NSWindowTitleVisibility,
|
||||
};
|
||||
|
||||
#[derive(Debug, Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
|
||||
|
|
@ -362,6 +362,7 @@ impl WinitWindow {
|
|||
|
||||
if let Some(identifier) = pl_attrs.tabbing_identifier {
|
||||
this.setTabbingIdentifier(&NSString::from_str(&identifier));
|
||||
this.setTabbingMode(NSWindowTabbingMode::NSWindowTabbingModePreferred);
|
||||
}
|
||||
|
||||
if attrs.content_protected {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue