Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to setup the event loop (something like using NSApplicationMain in C)? #746

Open
quantonganh opened this issue Dec 12, 2018 · 2 comments

Comments

@quantonganh
Copy link
Contributor

I'm trying Sparkle to update my app automatically.

Problem: sparkle-project/Sparkle#1326

and the author said that I have to setup the event loop, something like this:

#import <Cocoa/Cocoa.h>

int main(int argc, const char *argv[])
{
    return NSApplicationMain(argc, argv);
}

How can I do the samething in Go?

@therecipe
Copy link
Owner

Hey

Yeah, the problem is probably that the NSApplication event loop is not running.
But it seems like Qt's event loop can integrate itself into an already running native event loop.
At least that's how I did understood https://wiki.qt.io/Application_Start-up_Patterns

Maybe try to start an NSApplication and then start Go's main function from within that event loop.
I would take a look myself, but I'm currently busy working on the changes for Qt 5.12 and also some other stuff.

@quantonganh
Copy link
Contributor Author

Maybe try to start an NSApplication and then start Go's main function from within that event loop.

I found something:

void NSApplicationMain(int argc, char *argv[]) {
    [NSApplication sharedApplication];
    [NSBundle loadNibNamed:@"myMain" owner:NSApp];
    [NSApp run];
}

but I don't know how can I call Go's main function from within NSApplication event loop?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants