Re: [gtk-osx-users] when to call gtkosx_application_ready() in an application that initializes in an idle callback

On Jun 15, 2013, at 4:16 AM, Andrius <andriusr yahoo com> wrote:

Apparently guys doing gedit also had similar problem. They found kind of clever solution, which I do not understand completely, however, it might give some clues for You. See in attached file comment around line 289.

Ah, that makes sense. Thanks for finding it.

To expand a bit for Olivier's benefit: [NSApplication finishLaunching] is normally called by Cocoa at the 
same time as starting the runloop (OSX's name for mainloop), and the OpenFile notification depends upon 
the regular event polling and dispatching, which ordinarily begins in a Gtk app when you call gtk_main(). 
Apple doesn't share that code, so we have to guess what they're doing, and one possibility is that they're 
stepping through the first iteration in order to issue those notifications in the right sequence.

On Jun 15, 2013, at 6:15 AM, Olivier Sessink <oliviersessink gmail com> wrote:

Your explanation still seems to suggest that the sequence
1) attach the signal
2) start gtk_main()
3) call gtkosx_application_ready()
should work. Or is there something I am missing here? (I have little OSX knowledge so...)

From the gedit example it would seem that starting gtk_main() before calling gtkosx_application_ready()
might cause the OpenFile event to get dispatched before the GtkApplicationDelegate is ready for it and
for it to be lost. If you really need to have the mainloop running before calling gtkosx_application_ready()
the gedit hack is probably the best solution.

John Ralls

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]