How to allow click-through and a cursor in a background app while not taking the active appearance a

Posted by Peter Hosey on Stack Overflow See other posts from Stack Overflow or by Peter Hosey
Published on 2010-04-03T17:41:49Z Indexed on 2010/04/03 17:53 UTC
Read the original article Hit count: 240

Filed under:
|
|
|
|

Here are my goals:

  1. My application displays an overlay window above all applications' window.
  2. The user can draw in the overlay window.
  3. The mouse cursor changes to a specific cursor while in the overlay window.
  4. The application that has the active appearance before summoning the overlay window still has it while the overlay window is up and usable.
  5. The user does not need to click on the overlay window to activate it before they can draw.
  6. 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?

© Stack Overflow or respective owner

Related posts about macosx

Related posts about mac