Is it possible to make a window to go over the menu bar, without going in fullscreen?
Thanks in Advance!
Yes, trivially:
window.level = NSMainMenuWindowLevel + 1;
(Reference: Drawing to the Full Screen, OpenGL Programming Guide for Mac OS X.)
sebastianmarkow is correct in that this is terrible behaviour for a normal document window, but there are several window types for which this is normal: cursors, tool tips, and special utilities like Xscope.
I liked Jens Ayton's answer, but rather than pick an arbitrary number like that, I think it would be preferred that you use one of the defined constants.
Personally, I used NSPopUpMenuWindowLevel
as in:
self.window.level = NSPopUpMenuWindowLevel;
Other constants that you might prefer, as of my posting this answer, include:
NSNormalWindowLevel
NSFloatingWindowLevel
NSSubmenuWindowLevel
NSNormalWindowLevel
NSMainMenuWindowLevel
NSStatusWindowLevel
NSModalPaneWindowLevel
NSPopUpMenuWindowLevel
NSScreenSaverWindowLevel
Here's the reference (Apple has a tendency to change how they organize their docs and break these links over the years, but the APIs don't change much, which is why I included that list above. I doubt this link will work in 3 years or so, but these constants probably won't change much in the next 20 years.)
https://developer.apple.com/library/mac/documentation/cocoa/reference/applicationkit/classes/NSWindow_Class/Reference/Reference.html#//apple_ref/doc/constant_group/Window_Levels
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With