diff options
| author | Marco Trevisan (Treviño) <mail@3v1n0.net> | 2013-03-19 17:03:05 +0100 |
|---|---|---|
| committer | Marco Trevisan (Treviño) <mail@3v1n0.net> | 2013-03-19 17:03:05 +0100 |
| commit | ce8b1b11843dcb6edb93c513d409e8f2aeeac7d2 (patch) | |
| tree | 3afa204931741a4287e8786bdb4249d426e31a47 /shutdown | |
| parent | 9f9f3d7374816bebea3261b8e5968c924d4d5a49 (diff) | |
SessionView: save the button to key-focus into a RO property
(bzr r3227.1.9)
Diffstat (limited to 'shutdown')
| -rw-r--r-- | shutdown/SessionView.cpp | 5 | ||||
| -rw-r--r-- | shutdown/SessionView.h | 2 |
2 files changed, 7 insertions, 0 deletions
diff --git a/shutdown/SessionView.cpp b/shutdown/SessionView.cpp index 2fa8cf0cd..71f78e703 100644 --- a/shutdown/SessionView.cpp +++ b/shutdown/SessionView.cpp @@ -47,7 +47,9 @@ NUX_IMPLEMENT_OBJECT_TYPE(View); View::View(Manager::Ptr const& manager) : mode(Mode::FULL) + , key_focus_area([this] { return key_focus_area_; }) , manager_(manager) + , key_focus_area_(this) { closable = true; auto main_layout = new nux::VLayout(); @@ -170,6 +172,7 @@ void View::Populate() { debug::Introspectable::RemoveAllChildren(); buttons_layout_->Clear(); + key_focus_area_ = this; if (mode() == Mode::LOGOUT) { @@ -179,6 +182,7 @@ void View::Populate() button = new Button(Button::Action::LOGOUT, NUX_TRACKER_LOCATION); button->activated.connect(sigc::mem_fun(manager_.get(), &Manager::Logout)); + key_focus_area_ = button; AddButton(button); } else @@ -212,6 +216,7 @@ void View::Populate() button = new Button(Button::Action::SHUTDOWN, NUX_TRACKER_LOCATION); button->activated.connect(sigc::mem_fun(manager_.get(), &Manager::Shutdown)); + key_focus_area_ = (mode() == Mode::SHUTDOWN) ? button : key_focus_area_; AddButton(button); } else if (mode() == Mode::FULL) diff --git a/shutdown/SessionView.h b/shutdown/SessionView.h index 05deb8fa3..b7ec5728f 100644 --- a/shutdown/SessionView.h +++ b/shutdown/SessionView.h @@ -50,6 +50,7 @@ public: nux::Property<Mode> mode; nux::Property<bool> have_inhibitors; + nux::ROProperty<nux::InputArea*> key_focus_area; sigc::signal<void> request_hide; @@ -76,6 +77,7 @@ private: StaticCairoText* title_; StaticCairoText* subtitle_; nux::HLayout* buttons_layout_; + nux::InputArea* key_focus_area_; }; } // namespace session |
