> On 10. Aug 2019, at 23:02, Kurt Bigler <kkbli...@breathsense.com> wrote:
> Currently if I call NSApplicationMain instead of my regular Carbon event loop 
> (which is based on ReceiveNextEvent), NSApplicationMain returns immediately.  
> I don't call NSApplicationMain immedately because there is scads of 
> initialization that I do without relation to incoming events.

 NSApplicationMain looks at your Info.plist to decide which Cocoa NIB to load 
at startup and what your NSPrincipalClass is (usually NSApplication). If you 
haven't set up your app as a proper Cocoa app, NSApplicationMain will be 
unhappy and won't work. Every time I've ported a Carbon app to Cocoa so far, I 
basically moved the main() function's contents (except the call to 
RunApplicationEventLoop()) into applicationDidFinishLaunching: etc. in an app 
delegate. Then it usually worked as before.

 ReceiveNextEvent() seems a bit of an odd choice. In general, you want 
RunApplicationEventLoop() and timers, performSelector:afterDelay:0.0 or threads 
to get processing time reliably for other things during the event loop.

> This makes me wonder about NSApplicationLoad, which I do call.

 NSApplicationLoad() is basically the "turn a Carbon app into enough of a Cocoa 
app to run Cocoa code"-call, so shouldn't be needed in a fully Cocoa app. And 
your guess why NSApplicationMain didn't work was pretty close, I think.

Cheers,
-- Uli Kusterer
http://www.zathras.de

_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to