[aseprite] 174/196: Don't call app_main() from OSXApp
Tobias Hansen
thansen at moszumanska.debian.org
Wed Apr 20 18:50:17 UTC 2016
This is an automated email from the git hooks/post-receive script.
thansen pushed a commit to branch master
in repository aseprite.
commit c900e4aa3cee35c7ff92a2ca0950a62034bb5fda
Author: David Capello <davidcapello at gmail.com>
Date: Mon Apr 11 16:19:32 2016 -0300
Don't call app_main() from OSXApp
---
src/she/osx/app.h | 9 ++++-----
src/she/osx/app.mm | 33 ++++++++++++++++++++-------------
src/she/skia/she.cpp | 14 +++++---------
3 files changed, 29 insertions(+), 27 deletions(-)
diff --git a/src/she/osx/app.h b/src/she/osx/app.h
index ff1ebcd..fa039f8 100644
--- a/src/she/osx/app.h
+++ b/src/she/osx/app.h
@@ -1,5 +1,5 @@
// SHE library
-// Copyright (C) 2012-2015 David Capello
+// Copyright (C) 2012-2016 David Capello
//
// This file is released under the terms of the MIT license.
// Read LICENSE.txt for more information.
@@ -16,15 +16,14 @@ namespace she {
class OSXApp {
public:
- static OSXApp* instance() { return g_instance; }
-
OSXApp();
~OSXApp();
- int run(int argc, char* argv[]);
+ bool init();
private:
- static OSXApp* g_instance;
+ class Impl;
+ Impl* m_impl;
};
} // namespace she
diff --git a/src/she/osx/app.mm b/src/she/osx/app.mm
index 2f537cf..327829a 100644
--- a/src/she/osx/app.mm
+++ b/src/she/osx/app.mm
@@ -19,29 +19,36 @@ extern int app_main(int argc, char* argv[]);
namespace she {
-OSXApp* OSXApp::g_instance = nullptr;
+class OSXApp::Impl {
+public:
+ bool init() {
+ m_app = [NSApplication sharedApplication];
+ m_appDelegate = [OSXAppDelegate new];
+
+ [m_app setActivationPolicy:NSApplicationActivationPolicyRegular];
+ [m_app setDelegate:m_appDelegate];
+ [m_app activateIgnoringOtherApps:YES];
+
+ return true;
+ }
+
+private:
+ NSApplication* m_app;
+ id m_appDelegate;
+};
OSXApp::OSXApp()
+ : m_impl(new Impl)
{
- g_instance = this;
}
OSXApp::~OSXApp()
{
- g_instance = nullptr;
}
-int OSXApp::run(int argc, char* argv[])
+bool OSXApp::init()
{
- NSApplication* app = [NSApplication sharedApplication];
- id appDelegate = [OSXAppDelegate new];
-
- [app setActivationPolicy:NSApplicationActivationPolicyRegular];
- [app setDelegate:appDelegate];
- [app activateIgnoringOtherApps:YES];
-
- app_main(argc, argv);
- return 0;
+ return m_impl->init();
}
} // namespace she
diff --git a/src/she/skia/she.cpp b/src/she/skia/she.cpp
index de5674b..e45ac5d 100644
--- a/src/she/skia/she.cpp
+++ b/src/she/skia/she.cpp
@@ -54,8 +54,7 @@ extern int app_main(int argc, char* argv[]);
#if _WIN32
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,
- LPSTR lpCmdLine, int nCmdShow)
-{
+ LPSTR lpCmdLine, int nCmdShow) {
int argc = 0;
LPWSTR* argvW = CommandLineToArgvW(GetCommandLineW(), &argc);
char** argv;
@@ -70,19 +69,16 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,
argv[0] = base_strdup("");
}
#else
-int main(int argc, char* argv[])
-{
+int main(int argc, char* argv[]) {
#endif
#if __APPLE__
she::OSXApp app;
- return app.run(argc, argv);
-#else
-
-#ifndef _WIN32
+ if (!app.init())
+ return 1;
+#elif !defined(_WIN32)
she::X11 x11;
#endif
return app_main(argc, argv);
-#endif
}
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-games/aseprite.git
More information about the Pkg-games-commits
mailing list