This is an automated email from the git hooks/post-receive script. thansen pushed a commit to branch master in repository aseprite.
commit e4c46a761ad50beedfe2dbad28eb5c43e14bdc8e Author: David Capello <[email protected]> Date: Mon Apr 11 19:15:42 2016 -0300 Fix loading two times a file specified in the command line on OS X To avoid receiving a she::DropFiles event (from application:openFiles:) when we're loading files specified in the command line (i.e. when we are showing the progress bar/processing "ui" layer events/CustomizedGuiManager is listening for kDropFilesMessages) we call NSApp finishLauching after we've processed the whole command line. --- src/app/app.cpp | 2 ++ src/she/alleg4/she.cpp | 5 +++++ src/she/osx/app.h | 3 +++ src/she/osx/app.mm | 22 +++++++++++++++++++++- src/she/skia/skia_system.h | 10 ++++++++++ src/she/system.h | 1 + 6 files changed, 42 insertions(+), 1 deletion(-) diff --git a/src/app/app.cpp b/src/app/app.cpp index 65d718b..425d7c5 100644 --- a/src/app/app.cpp +++ b/src/app/app.cpp @@ -658,6 +658,8 @@ void App::initialize(const AppOptions& options) LOG("Export sprite sheet: Done\n"); } + + she::instance()->finishLaunching(); } void App::run() diff --git a/src/she/alleg4/she.cpp b/src/she/alleg4/she.cpp index 37e1407..b9ada00 100644 --- a/src/she/alleg4/she.cpp +++ b/src/she/alleg4/she.cpp @@ -144,6 +144,10 @@ public: delete this; } + void finishLaunching() override { + // Do nothing + } + Capabilities capabilities() const override { return (Capabilities)(Capabilities::CanResizeDisplay); } @@ -197,6 +201,7 @@ public: set_color_conversion(old_color_conv); return sur; } + }; System* create_system() { diff --git a/src/she/osx/app.h b/src/she/osx/app.h index fa039f8..f0352b8 100644 --- a/src/she/osx/app.h +++ b/src/she/osx/app.h @@ -16,10 +16,13 @@ namespace she { class OSXApp { public: + static OSXApp* instance(); + OSXApp(); ~OSXApp(); bool init(); + void finishLaunching(); private: class Impl; diff --git a/src/she/osx/app.mm b/src/she/osx/app.mm index 37c9cdb..801b0c9 100644 --- a/src/she/osx/app.mm +++ b/src/she/osx/app.mm @@ -28,23 +28,38 @@ public: [m_app setActivationPolicy:NSApplicationActivationPolicyRegular]; [m_app setDelegate:m_appDelegate]; [m_app activateIgnoringOtherApps:YES]; - [m_app finishLaunching]; return true; } + void finishLaunching() { + [m_app finishLaunching]; + } + private: NSApplication* m_app; OSXAppDelegate* m_appDelegate; }; +static OSXApp* g_instance = nullptr; + +// static +OSXApp* OSXApp::instance() +{ + return g_instance; +} + OSXApp::OSXApp() : m_impl(new Impl) { + ASSERT(!g_instance); + g_instance = this; } OSXApp::~OSXApp() { + ASSERT(g_instance == this); + g_instance = nullptr; } bool OSXApp::init() @@ -52,4 +67,9 @@ bool OSXApp::init() return m_impl->init(); } +void OSXApp::finishLaunching() +{ + m_impl->finishLaunching(); +} + } // namespace she diff --git a/src/she/skia/skia_system.h b/src/she/skia/skia_system.h index fcee2c9..a8a6d61 100644 --- a/src/she/skia/skia_system.h +++ b/src/she/skia/skia_system.h @@ -21,6 +21,7 @@ #ifdef _WIN32 #include "she/win/event_queue.h" #elif __APPLE__ + #include "she/osx/app.h" #include "she/osx/event_queue.h" #else #include "she/x11/event_queue.h" @@ -51,6 +52,15 @@ public: delete this; } + void finishLaunching() override { +#if __APPLE__ + // Start processing NSApplicationDelegate events. (E.g. after + // calling this we'll receive application:openFiles: and we'll + // generate DropFiles events.) events + OSXApp::instance()->finishLaunching(); +#endif + } + Capabilities capabilities() const override { return Capabilities( int(Capabilities::MultipleDisplays) | diff --git a/src/she/system.h b/src/she/system.h index 7e7f040..2b1535b 100644 --- a/src/she/system.h +++ b/src/she/system.h @@ -33,6 +33,7 @@ namespace she { public: virtual ~System() { } virtual void dispose() = 0; + virtual void finishLaunching() = 0; virtual Capabilities capabilities() const = 0; virtual Logger* logger() = 0; virtual NativeDialogs* nativeDialogs() = 0; -- Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-games/aseprite.git _______________________________________________ Pkg-games-commits mailing list [email protected] http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/pkg-games-commits

