How to force an NSWindow to be always active/focused?
cocoa, macos, nswindow, objective-c, xcode
Solution
If you add a borderless NSButton instance to your window's view and set your image as the button's image (and as its alternate image, to make it more beautiful), it will work out of the box: Just connect the button's action method to your app delegate (or the object where you want to process the click action). A click on the image (i.e. the button) will then trigger the button's action method, no matter which window is active.
Problem
I have a transparent `NSWindow` that follows the user's screen everywhere he goes (the `NSWindow`stays in front of every app, no matter what, even fullscreen apps). In that `NSWindow` i have a `mouseDown` event that shows a popup. Let's say i'm on safari in fullscreen mode and i have my Window in front of it, i click on safari and i click again on my Window: nothing happens, the mouseDown doesn't occur. I have to click again so the `mouseDown` event is triggered. How can i force my `NSWindow` to be always active so i don't have to click it 2x to trigger the `mouseDown` when i click on a background app and click in my window again? Thank you!