How to allow click-through and a cursor in a background app while not taking the active appearance a
- by Peter Hosey
Here are my goals:
My application displays an overlay window above all applications' window.
The user can draw in the overlay window.
The mouse cursor changes to a specific cursor while in the overlay window.
The application that has the active appearance before summoning the overlay window still has it while the overlay window is up and usable.
The user does not need to click on the overlay window to activate it before they can draw.
Drawing in the window does not steal the active appearance away from the application that has it.
With LSUIElement, I get #1, #2, #3, and #5.
With LSBackgroundOnly, I get #1, #2, #4, and #6.
How can I satisify all of these goals without installing an event tap and processing the mouse events myself?
Things I've tried:
[NSApp preventWindowOrdering] in mouseDown:
[NSApp activateIgnoringOtherApps:YES] in applicationWillFinishLaunching:
[myWindow orderFront:nil] in applicationWillFinishLaunching:
[myWindow makeKeyAndOrderFront:nil] in applicationWillFinishLaunching:
[myWindow orderFrontRegardless] in applicationWillFinishLaunching:
[myWindow makeMainWindow] in applicationWillFinishLaunching: (this caused failure of point 4 even with LSBackgroundOnly)
SetThemeCursor in applicationWillFinishLaunching:
(With LSUIElement) Implementing canBecomeMainWindow in my NSPanel subclass to return NO
Except where otherwise noted, none of these made any difference.
So, with LSUIElement, goals #4 and #6 remain; with LSBackgroundOnly, goals #3 and #5 remain. Any suggestions?