Re: how to tell if my app is visible.
Re: how to tell if my app is visible.
- Subject: Re: how to tell if my app is visible.
- From: "Michael Ash" <email@hidden>
- Date: Mon, 22 Sep 2008 10:36:26 -0400
On Mon, Sep 22, 2008 at 7:07 AM, Memo Akten <email@hidden> wrote:
>
> Hi All, i have an app which is running on the desktop :
>
> windowRect = [[NSScreen mainScreen] visibleFrame];
> window = [[NSWindow alloc] initWithContentRect:windowRect
> styleMask:NSBorderlessWindowMask backing:NSBackingStoreBuffered defer:NO];
> [window setFrame:windowRect display:NO];
> [window setOpaque:NO];
> [window setBackgroundColor:[NSColor clearColor]];
> [window setMovableByWindowBackground:NO];
> [window setLevel:kCGDesktopIconWindowLevel];
> [window setAcceptsMouseMovedEvents:YES];
>
> The app is running a quartz composition, which has custom QCPlugin in it.
>
> My first problem was, that even where there are other app windows (e.g.
> finder) on top of my app, the app (the quartz composition) responds to mouse
> events whilst its in the background (e.g. I want animations to trigger if
> the mouse is over something, but not if its obscured by finder or safari
> etc.). So I did a check to see if my app was active or not ([[NSApplication
> sharedApplication] isActive]) before responding to mouse position and
> events.
>
> That works to some degree, but if I have a window to the side and my app is
> fully visible, it doesn't respond to mouse position and events - because its
> not active. But is there a solution to this?
Sounds like your end goal is not to detect whether your window is
visible, but rather to limit mouse events to visible regions.
NSTrackingArea on 10.5 can do this. If you need to support 10.4, you
may be able to do the same thing with NSView's old-style tracking rect
support.
Mike
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden