I'm trying to display overlay on screen by following code:
NSRect windowRect = [[NSScreen mainScreen] frame];
self.overlayWindow = [[NSWindow alloc] initWithContentRect:windowRect
styleMask:NSWindowStyleMaskBorderless
backing:NSBackingStoreBuffered
defer:NO
screen:[NSScreen mainScreen]];
[self.overlayWindow setReleasedWhenClosed:YES];
[self.overlayWindow setBackgroundColor:[NSColor colorWithCalibratedRed:0.0
green:1.0
blue:0.0
alpha:0.1]];
[self.overlayWindow setAlphaValue:1.0];
[self.overlayWindow setOpaque:NO];
[self.overlayWindow setIgnoresMouseEvents:NO];
[self.overlayWindow makeKeyAndOrderFront:nil];
self.overlayWindow.ignoresMouseEvents = YES;
self.overlayWindow.level = NSScreenSaverWindowLevel;
self.overlayWindow.collectionBehavior = NSWindowCollectionBehaviorCanJoinAllSpaces | NSWindowCollectionBehaviorCanJoinAllApplications;
But when other APP enter full screen, the overlay disappears even I set the collectionBehavior
with option NSWindowCollectionBehaviorCanJoinAllApplications
. Is it possible to display a overlay on top of all other APPs?