Is it possible to add a HUD overlay for a Cocoa application that runs in full screen mode?
I switch into full screen mode as follows.// An NSView.
[self enterFullScreenMode:m_screen withOptions:nil];
The HUD overlay is of type NSPanel
and a member of the above view. To display the HUD panel I run the following lines of code.
[m_hudPanel setFloatingPanel:YES];
[m_hudPanel orderFront:self];
[m_hudPanel orderWindow:NSWindowAbove relativeTo:[[self window] windowNumber]];
[m_hudPanel makeKeyAndOrderFront:self];
[m_hudPanel makeFirstResponder:se开发者_开发问答lf];
Though, the panel does not appear until I leave the full screen mode.
You have to increase the window level. I don't know about -enterFullScreenMode:withOptions
— but with the CoreGraphics fullscreen API, we did it this way:
int level = CGShieldingWindowLevel();
[m_hudPanel setLevel:level];
Or maybe you had to use level + 1
, I forget. Point is, windows are organized first by level and then within each level. When you move a window to the front, it only moves to the front of its level. This way, the background, menu bar, dock, and screen saver stay where they're supposed to (they're just special kinds of windows).
精彩评论