diff options
| -rw-r--r-- | lockscreen/LockScreenShield.cpp | 27 |
1 files changed, 20 insertions, 7 deletions
diff --git a/lockscreen/LockScreenShield.cpp b/lockscreen/LockScreenShield.cpp index 26b15406d..aa273475e 100644 --- a/lockscreen/LockScreenShield.cpp +++ b/lockscreen/LockScreenShield.cpp @@ -46,7 +46,6 @@ Shield::Shield(session::Manager::Ptr const& session_manager, int monitor, bool i , prompt_view_(nullptr) { SetLayout(new nux::VLayout()); - is_primary ? ShowPrimaryView() : ShowSecondaryView(); EnableInputWindow(true); @@ -54,6 +53,19 @@ Shield::Shield(session::Manager::Ptr const& session_manager, int monitor, bool i geometry_changed.connect([this](nux::Area*, nux::Geometry&) { UpdateBackgroundTexture(); }); + + primary.changed.connect([this] (bool is_primary) { + if (!is_primary) + { + UnGrabPointer(); + UnGrabKeyboard(); + } + + GetLayout()->Clear(); + is_primary ? ShowPrimaryView() : ShowSecondaryView(); + QueueRelayout(); + QueueDraw(); + }); } void Shield::UpdateBackgroundTexture() @@ -125,22 +137,23 @@ nux::View* Shield::CreatePromptView() void Shield::OnIndicatorEntryShowMenu(std::string const&, unsigned, int, int, unsigned) { - UnGrabPointer(); - UnGrabKeyboard(); + if (primary()) + { + UnGrabPointer(); + UnGrabKeyboard(); + } } void Shield::OnIndicatorEntryActivated(std::string const& panel, std::string const& entry, nux::Geometry const& geo) { - if (entry.empty() and geo.IsNull()) /* on menu closed */ + if (primary() && entry.empty() and geo.IsNull()) /* on menu closed */ { GrabPointer(); GrabKeyboard(); } } -nux::Area* Shield::FindKeyFocusArea(unsigned int, - unsigned long, - unsigned long) +nux::Area* Shield::FindKeyFocusArea(unsigned int, unsigned long, unsigned long) { if (prompt_view_ && prompt_view_->focus_view() && prompt_view_->focus_view()->GetInputEventSensitivity()) return prompt_view_->focus_view(); |
