Re: Questions about [NSApplication run]
Re: Questions about [NSApplication run]
- Subject: Re: Questions about [NSApplication run]
- From: "Michael Ash" <email@hidden>
- Date: Fri, 5 Dec 2008 17:51:00 -0500
On Fri, Dec 5, 2008 at 12:53 AM, Slava Pestov <email@hidden> wrote:
> Hi everybody,
>
> For various reasons, my Cocoa app runs its own event loop instead of
> using [NSApplication run]. What I do is roughly the following, in a
> loop:
>
> e = [self nextEventMatchingMask: NSAnyEventMask
> untilDate: [NSDate distantFuture]
> inMode: NSDefaultRunLoopMode
> dequeue: YES];
> if (e)
> [self sendEvent: e];
>
> ... more logic ...
>
> This works fine except for one issue; when switching between windows
> using Expose, clicking on one of my app's windows doesn't always bring
> it to the front.
>
> Is there something magical that [NSApplication run] does which my app
> is not doing?
I'm afraid I don't know the answer to your question, but can I ask why
you're doing this in the first place? If you just need to run some
custom code every time through the event loop,
NSApplicationDidUpdateNotification or CFRunLoopObserver will do it for
you.
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