Can I change the current cursor from an inactive application?
Asked Answered
B

1

10

I’ve got a utility Mac application that runs in the background (LSUIElement enabled). Under some condition this application displays a menu window with several buttons. The problem is that when I hover over this window the mouse cursor still behaves according to the application beneath it – when there’s text under the menu, cursor changes to the insertion “I beam” shape.

Obviously I’d prefer a regular pointer arrow. I’ve dived into NSTrackingArea and friends after a bit of hacking I can detect the mouse-enter and mouse-exit events. But when I try to change the current cursor using NSCursor on mouse enter, nothing happens. Looks like the machine refuses to change cursor from an inactive application, because when I activate the application before the mouse-enter event, the cursor changes.

I don’t want to switch the active application just to change the cursor. Is there a way to fiddle with the cursor from an inactive application?

P.S. Same problem on cocoa-dev: one, two.

Businessman answered 4/4, 2011 at 8:43 Comment(3)
I'm looking for a solution to this too. Did you ever find anything?Kitsch
@zadam: No. Fortunately we have changed the application concept anyway, so that we got rid of this requirement.Businessman
Same problem here. Oddly, before I converted my app from Carbon (HI windows) to Cocoa, I could successfully change the cursor using NSCursor.Monarch
R
0

I'm affraid this is not possible due the OS X restrictions.

Remembrance answered 26/10, 2015 at 17:51 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.