How to prevent keynote from exiting fullscreen?

I am making a macOS app in Swift and the window of my app is always on top of other apps. This is working fine with all apps even if those apps are in full-screen mode. However, when Keynote runs in full-screen mode and my app is on top of it, all the mouse events meant for my app also go to keynote and it exits fullscreen.


I am not sure what's going on but I need to prevent keynote from exiting full-screen. How can I do that?


The window level of my app is `NSWindow.Level.popUpMenu`. And, I have tried the following but nothing has worked so far:


window.orderFrontRegardless()
window.makeKeyAndOrderFront(self)
window.order(.above, relativeTo: 0)

Something I don't understand here.


my app is always on top of other apps.

Well.

And if keynote says

Keynote is always on top of other apps.


So I probably missed something. Didn't think that an app could remain atop of all other apps…

If both apps are configured to stay on top of all other apps then the most recent app activated stays on the top.
And, regarding apps staying on top, yes, you can easily configure it by setting the appropriate Window Level.

How to prevent keynote from exiting fullscreen?
 
 
Q