• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Questions about [NSApplication run]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Questions about [NSApplication run]


  • Subject: Questions about [NSApplication run]
  • From: "Slava Pestov" <email@hidden>
  • Date: Thu, 4 Dec 2008 23:53:04 -0600

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?

The documentation for [NSApplication run] does suggest that it is ok
to override it, and from this I inferred that the logic is simple
enough that one can duplicate it. Is this information out of date?
Have newer OS X features made it necessary to handle events by calling
[NSApplication run]?

Slava
_______________________________________________

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

  • Follow-Ups:
    • Re: Questions about [NSApplication run]
      • From: "Michael Ash" <email@hidden>
  • Prev by Date: How does MainMenu.xib get loaded in a Cocoa application?
  • Next by Date: secure dns resolution
  • Previous by thread: Re: How does MainMenu.xib get loaded in a Cocoa application?
  • Next by thread: Re: Questions about [NSApplication run]
  • Index(es):
    • Date
    • Thread