Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Accept mouse clicks without activating the application?

Tags:

focus

macos

cocoa

I am working on a utility application that controls other running applications. On certain input event my application displays a window, user can pick some operation from the window, the window disappears and control returns to the previous app. My problem is that clicking in my app’s window activates my application, thus removing focus from the previous application’s window. I can re-activate the previous application when my window closes, but I’d rather keep the original application activated all the time. Is that possible?

like image 872
zoul Avatar asked Mar 30 '11 09:03

zoul


1 Answers

It's quite easy to to, just make your window an instance of NSPanel (a subclass of NSWindow), and set it as non-activating in Xcode/IB (or create it programatically, with NSNonactivatingPanelMask in the style mask).

enter image description here

like image 115
Nick Moore Avatar answered Nov 06 '22 04:11

Nick Moore