summaryrefslogtreecommitdiff
path: root/lockscreen
diff options
authorMarco Trevisan (Treviño) <mail@3v1n0.net>2014-03-05 17:47:59 +0100
committerMarco Trevisan (Treviño) <mail@3v1n0.net>2014-03-05 17:47:59 +0100
commitb269ce9c9ac29c21f202e617aed976f51326a443 (patch)
tree4d6f74d61381ef2ef8d829401fb6bc371f6486b0 /lockscreen
parent47fb2fdc5362f38b38703531c8d3407c2318ac13 (diff)
LockScreenShield: change kind of view on primary changed
(bzr r3695.4.11)
Diffstat (limited to 'lockscreen')
-rw-r--r--lockscreen/LockScreenShield.cpp27
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();