I'm working on a screenshot Mac app. I'm trying to rebuilt what happens when you press Cmd-Ctrl-Shift-4: the cross hair cursor and the selection rectangle for the screenshot.
I'm using a custom borderless NSWindow on top of all other windows. I disabled the cursor to draw my own along with the selection rectangle.
My problem is that as soon as I click & drag to capture a screenshot, my app gets activated (because the click is intercepted by my shielding window).
Is there a way how I can receive the click in my custom view/window without having my app get activated?
I tried using an NSPanel
with the NSNonactivatingPanelMask
flag, but in this case, I have a problem with the cursor: I can't draw my own when another app is active, because I can't hide the cursor for other apps...
ctrl
key to take a screenshot to the clipboard... dont know if that is all you are trying to do. otherwise, yes, one of the suggestions in the linked thread may be the best (or my answer below) – Brad AllredNSApplicationActivationPolicy.Prohibited
is another approach... depending on the app's needs, of course. – Milos