NSAlert in Fullscreen - cocoa

I am creating a fullscreen app and am wondering if there is some way to make NSAlert go above the CGDisplayCapture that I created. Right now, the NSAlert is displaying behind the display capture. My main window is displaying just fine (after adjusting it with setLevel:) but NSAlert doesn't seem to be working as well. I attempted to do:
[[alertBox window] setLevel:CGShieldingWindowLevel()];
But that doesn't seem to work either. I imagine that there must be some way to do this, but I am just not sure where to start.
Any help would be appreciated.

There is no supported way to display a window when the display is captured. That’s what capturing the display means.

If you want to display a multiwindowed UI but prohibit app switching, etc., use SetSystemUIMode instead of CGDisplayCapture.

Related

Override window drop in Cocoa

I'm looking for a way to customize the drag/drop of windows/tabs. I have a document based app, with a custom window controller. I am able to create tabs for it and have them all along the top, they all show, everything works great with that.
Where I'm running into trouble is if I create a different unconnected windows and start trying to drag windows or tabs into different windows or tab bars to have it dock or merge. Sometimes it works how I want, sometimes it doesn't allow docking or anything. Other times it does what I don't want it to do. I need a way to help it along...
I'm looking for a way to tie into those events but in all my searching I can't find what api or where it is that is controlling the window drags/drops. I looked into the NSDraggingDestination but that has nothing relating to windows, just pasteboard stuff. Looked at NSWindowController and didn't see anything there either. Anyone know if this is possible?

Make a window on screen using window id

I am new to Mac API. I can get the list of window from the following function.
NSArray *windowInfos = (__bridge_transfer NSArray*)CGWindowListCopyWindowInfo(kCGWindowListOptionAll, kCGNullWindowID);
Is it possible to make a window on screen if the window is not on screen. If so, How can I do that?
Thanks in advance
Does the window you are trying to make visible belong to your application? If so, you more likely to just want to do something like [myWindow makeKeyAndOrderFront:nil], where myWindow is an NSWindow* outlet connected to a window in a nib file in your app. Or does the window you are trying to make visible belong to a different application? If so, it would seem rather strange to be trying to control the visibility of windows in a different app; perhaps in that case you could be more specific about what exactly you are trying to achieve, and perhaps there would be a better mechanism (distributed notifications, for example) to achieve it.

How can I prevent a window from showing background colouring

I have an application which pops up a NSTextView in its main window.
Under Yosemite this shows the main window background colouring, which is very distracting.
If users select Reduce transparency it works as before.
How can I prevent this view from showing background colouring?
The NSTextView uses addSubView to add itself to the enclosing view.
I have tried subclassing and returning opaque YES, but can't seem to find any way of preventing other views showing through.
I guess I could remove the existing views, but this seems a little drastic.
Any suggestions?

Disable All Interaction with a Cocoa WebView

I'm having difficulty in using a WebView that is being used purely to display a preview of a website - and I want to ignore all/any interactions the user may try to make with it.
I've already tried Cocoa webView - Disable all interaction to no avail; you can still easily spam-click and it will recognise the presses. (at least there's no context menu)
This one seems overkill; Disable a WebKit WebView - there must be an easier way.
In iOS I know exactly how to solve this, but as a Cocoa newcomer I am stumped - does anyone have any suggestions or better ways to achieve this? Or dump a transparent NSView on top and gobble up interactions? (tried this as well by subclassing an NSView, also to no effect)
Whole project is in IB currently, if this makes any difference.
I think you want to implement a WebPolicy Delegate and have it deny navigation events.

which delegate method will be invoked when click the tab of safari?

As we know , When we load frame from webpage of safari, we will invoke the delegate methods of webkit informal protocol(WebFrameLoadDelegate):
webView:didStartProvisionalLoadForFrame:
webView:didChangeLocationWithinPageForFrame:
and When we click or change the tabs of safari,which delegate methods will be invoked? Thank you very much!
"We" don't know since this is entirely up to Safari what it fancies doing. At a guess, Safari encloses a WebView for each tab in a tabless NSTabView and switches between them. But again, that's just what it chooses to do at the moment, and might change its mind at any time.
As ever to your incessant questions, Safari has no plug-in API. WebKit does, but anything outside of that defined API is unknown, dangerous, and just asking for trouble. Please don't try it.
Well it's very likely that each tab in safari is using it's own webkit control, as they don't reload when you switch between them.
So I'd have to venture a guess and say neither unless you're actually loading a page.

Resources