@@ -41,8 +41,8 @@ use crate::{
41
41
use cocoa:: {
42
42
appkit:: {
43
43
self , CGFloat , NSApp , NSApplication , NSApplicationPresentationOptions , NSColor , NSEvent ,
44
- NSRequestUserAttentionType , NSScreen , NSView , NSWindow , NSWindowButton , NSWindowOrderingMode ,
45
- NSWindowStyleMask ,
44
+ NSRequestUserAttentionType , NSScreen , NSView , NSWindow , NSWindowButton ,
45
+ NSWindowCollectionBehavior , NSWindowOrderingMode , NSWindowStyleMask ,
46
46
} ,
47
47
base:: { id, nil} ,
48
48
foundation:: {
@@ -519,6 +519,7 @@ impl UnownedWindow {
519
519
let visible = win_attribs. visible ;
520
520
let focused = win_attribs. focused ;
521
521
let decorations = win_attribs. decorations ;
522
+ let visible_on_all_workspaces = win_attribs. visible_on_all_workspaces ;
522
523
let inner_rect = win_attribs
523
524
. inner_size
524
525
. map ( |size| size. to_physical ( scale_factor) ) ;
@@ -551,6 +552,7 @@ impl UnownedWindow {
551
552
552
553
// Set fullscreen mode after we setup everything
553
554
window. set_fullscreen ( fullscreen) ;
555
+ window. set_visible_on_all_workspaces ( visible_on_all_workspaces) ;
554
556
555
557
// Setting the window as key has to happen *after* we set the fullscreen
556
558
// state, since otherwise we'll briefly see the window at normal size
@@ -1360,6 +1362,20 @@ impl UnownedWindow {
1360
1362
let _: ( ) = msg_send ! [ * self . ns_window, setSharingType: !enabled as i32 ] ;
1361
1363
}
1362
1364
}
1365
+
1366
+ pub fn set_visible_on_all_workspaces ( & self , visible : bool ) {
1367
+ unsafe {
1368
+ let mut collection_behavior = self . ns_window . collectionBehavior ( ) ;
1369
+ if visible {
1370
+ collection_behavior |=
1371
+ NSWindowCollectionBehavior :: NSWindowCollectionBehaviorCanJoinAllSpaces ;
1372
+ } else {
1373
+ collection_behavior &=
1374
+ !NSWindowCollectionBehavior :: NSWindowCollectionBehaviorCanJoinAllSpaces ;
1375
+ } ;
1376
+ self . ns_window . setCollectionBehavior_ ( collection_behavior)
1377
+ }
1378
+ }
1363
1379
}
1364
1380
1365
1381
impl WindowExtMacOS for UnownedWindow {
0 commit comments