diff options
| author | Marco Trevisan (Treviño) <mail@3v1n0.net> | 2012-12-11 21:39:16 +0100 |
|---|---|---|
| committer | Marco Trevisan (Treviño) <mail@3v1n0.net> | 2012-12-11 21:39:16 +0100 |
| commit | 19d1859b74a75edccdc53c03460af18f1fba9118 (patch) | |
| tree | 805748c5191b2483aff26f4a249b98bae97634d7 /shortcuts | |
| parent | d99424df488104c3bd52816d970c610dd2947edc (diff) | |
StandaloneShortcuts: add animation controller, use a cleaner struct to init everything
(bzr r2970.2.2)
Diffstat (limited to 'shortcuts')
| -rw-r--r-- | shortcuts/StandaloneShortcuts.cpp | 42 |
1 files changed, 32 insertions, 10 deletions
diff --git a/shortcuts/StandaloneShortcuts.cpp b/shortcuts/StandaloneShortcuts.cpp index 20c395f37..710757a62 100644 --- a/shortcuts/StandaloneShortcuts.cpp +++ b/shortcuts/StandaloneShortcuts.cpp @@ -21,7 +21,9 @@ #include <glib/gi18n-lib.h> #include <gtk/gtk.h> #include <Nux/Nux.h> +#include <Nux/NuxTimerTickSource.h> #include <Nux/WindowThread.h> +#include <NuxCore/AnimationController.h> #include "unity-shared/BackgroundEffectHelper.h" #include "BaseWindowRaiserImp.h" @@ -31,10 +33,36 @@ using namespace unity; -static shortcut::Controller::Ptr controller; +struct ShortcutsWindow +{ + ShortcutsWindow() + : wt(nux::CreateGUIThread("Unity Shortcut Hint Overlay", 1024, 768, 0, &ShortcutsWindow::ThreadWidgetInit, this)) + , animation_controller(tick_source) + {} + + void Show() + { + wt->Run(nullptr); + } + +private: + void Init(); + + static void ThreadWidgetInit(nux::NThread* thread, void* self) + { + static_cast<ShortcutsWindow*>(self)->Init(); + } + + unity::Settings settings; + std::shared_ptr<nux::WindowThread> wt; + nux::NuxTimerTickSource tick_source; + nux::animation::AnimationController animation_controller; + shortcut::Controller::Ptr controller; +}; -void ThreadWidgetInit(nux::NThread* thread, void* InitData) +void ShortcutsWindow::Init() { + BackgroundEffectHelper::blur_type = BLUR_NONE; std::list<std::shared_ptr<shortcut::AbstractHint>> hints; // Launcher... @@ -232,22 +260,16 @@ void ThreadWidgetInit(nux::NThread* thread, void* InitData) "initiate_key"))); auto base_window_raiser_ = std::make_shared<shortcut::BaseWindowRaiserImp>(); - controller.reset(new shortcut::Controller(hints, base_window_raiser_)); + controller = std::make_shared<shortcut::Controller>(hints, base_window_raiser_); controller->Show(); } int main(int argc, char** argv) { - g_type_init(); gtk_init(&argc, &argv); nux::NuxInitialize(0); - unity::Settings settings; - - BackgroundEffectHelper::blur_type = BLUR_NONE; - nux::WindowThread* wt = nux::CreateGUIThread(TEXT("Unity Shortcut Hint Overlay"), 1200, 720, 0, &ThreadWidgetInit, 0); + ShortcutsWindow().Show(); - wt->Run(NULL); - delete wt; return 0; } |
