diff options
| author | Marco Trevisan (Treviño) <mail@3v1n0.net> | 2015-02-02 17:51:44 +0100 |
|---|---|---|
| committer | Marco Trevisan (Treviño) <mail@3v1n0.net> | 2015-02-02 17:51:44 +0100 |
| commit | ea07fbbce88bf8473aad22153344eb6824384a0f (patch) | |
| tree | 9cbd5fb7313d833d20f91727161abc7174c6cfbc /unity-shared | |
| parent | eb87f92ef035c6bd34af306ee4824f1f301db6c2 (diff) | |
PluginAdapter: return self on initialization
(bzr r3899.2.45)
Diffstat (limited to 'unity-shared')
| -rw-r--r-- | unity-shared/PluginAdapter.cpp | 13 | ||||
| -rw-r--r-- | unity-shared/PluginAdapter.h | 2 |
2 files changed, 12 insertions, 3 deletions
diff --git a/unity-shared/PluginAdapter.cpp b/unity-shared/PluginAdapter.cpp index 10573db86..4470fcddf 100644 --- a/unity-shared/PluginAdapter.cpp +++ b/unity-shared/PluginAdapter.cpp @@ -55,9 +55,18 @@ PluginAdapter& PluginAdapter::Default() } /* static */ -void PluginAdapter::Initialize(CompScreen* screen) +PluginAdapter& PluginAdapter::Initialize(CompScreen* screen) { - global_instance.reset(new PluginAdapter(screen)); + if (!global_instance) + { + global_instance.reset(new PluginAdapter(screen)); + } + else + { + LOG_ERROR(logger) << "Already Initialized!"; + } + + return *global_instance; } PluginAdapter::PluginAdapter(CompScreen* screen) diff --git a/unity-shared/PluginAdapter.h b/unity-shared/PluginAdapter.h index e5c14c7d0..d0a2ec7d7 100644 --- a/unity-shared/PluginAdapter.h +++ b/unity-shared/PluginAdapter.h @@ -60,7 +60,7 @@ public: // You shouldn't get the PluginAdapter if you really want a WindowManager. // The PluginAdapter::Default should really only be called from within unityshell plugin. static PluginAdapter& Default(); - static void Initialize(CompScreen* screen); + static PluginAdapter& Initialize(CompScreen* screen); nux::Property<bool> bias_active_to_viewport; |
