summaryrefslogtreecommitdiff
path: root/lockscreen
diff options
authorMarco Trevisan (Treviño) <mail@3v1n0.net>2014-04-09 17:39:34 +0200
committerMarco Trevisan (Treviño) <mail@3v1n0.net>2014-04-09 17:39:34 +0200
commita4ba6f5ccfded81084da084286cc608e34a0a377 (patch)
tree92fcb9555429f25e904bd68a8f5ff1df2267bda1 /lockscreen
parentab4e93795c6255d40c847fbe99a0490148612fb4 (diff)
LockScreenController: add support to PromptLockScreen
(bzr r3736.1.29)
Diffstat (limited to 'lockscreen')
-rw-r--r--lockscreen/LockScreenController.cpp22
-rw-r--r--lockscreen/LockScreenController.h4
2 files changed, 8 insertions, 18 deletions
diff --git a/lockscreen/LockScreenController.cpp b/lockscreen/LockScreenController.cpp
index a7b93b263..6c90f3ac2 100644
--- a/lockscreen/LockScreenController.cpp
+++ b/lockscreen/LockScreenController.cpp
@@ -54,7 +54,6 @@ Controller::Controller(DBusManager::Ptr const& dbus_manager,
, fade_animator_(LOCK_FADE_DURATION)
, blank_window_animator_(IDLE_FADE_DURATION)
, test_mode_(test_mode)
- , skip_animation_(false)
{
auto* uscreen = UScreen::GetDefault();
uscreen_connection_ = uscreen->changed.connect([this] (int, std::vector<nux::Geometry> const& monitors) {
@@ -66,12 +65,13 @@ Controller::Controller(DBusManager::Ptr const& dbus_manager,
suspend_connection_ = uscreen->suspending.connect([this] {
if (Settings::Instance().lock_on_suspend())
- RequestPromptScreenLock();
+ session_manager_->PromptLockScreen();
});
dbus_manager_->simulate_activity.connect(sigc::mem_fun(this, &Controller::SimulateActivity));
dbus_manager_->request_activate.connect(sigc::mem_fun(this, &Controller::OnScreenSaverActivationRequest));
- session_manager_->lock_requested.connect(sigc::mem_fun(this, &Controller::OnLockRequested));
+ session_manager_->lock_requested.connect(sigc::bind(sigc::mem_fun(this, &Controller::OnLockRequested), false));
+ session_manager_->prompt_lock_requested.connect(sigc::bind(sigc::mem_fun(this, &Controller::OnLockRequested), true));
session_manager_->unlock_requested.connect(sigc::mem_fun(this, &Controller::OnUnlockRequested));
session_manager_->presence_status_changed.connect(sigc::mem_fun(this, &Controller::OnPresenceStatusChanged));
@@ -117,7 +117,7 @@ Controller::Controller(DBusManager::Ptr const& dbus_manager,
int lock_delay = Settings::Instance().lock_delay();
lockscreen_delay_timeout_.reset(new glib::TimeoutSeconds(lock_delay, [this] {
- RequestPromptScreenLock();
+ session_manager_->PromptLockScreen();
return false;
}));
}
@@ -251,13 +251,6 @@ void Controller::EnsureBlankWindow()
blank_window_->SetMinMaxSize(screen_geo.width, screen_geo.height);
}
-void Controller::RequestPromptScreenLock()
-{
- skip_animation_ = true;
- session_manager_->LockScreen();
- skip_animation_ = false;
-}
-
void Controller::ShowBlankWindow()
{
EnsureBlankWindow();
@@ -274,7 +267,7 @@ void Controller::HideBlankWindow()
animation::SetValue(blank_window_animator_, animation::Direction::BACKWARD);
}
-void Controller::OnLockRequested()
+void Controller::OnLockRequested(bool prompt)
{
if (Settings::Instance().use_legacy())
{
@@ -292,9 +285,8 @@ void Controller::OnLockRequested()
}
HideBlankWindow();
- bool skip_animation = skip_animation_;
- lockscreen_timeout_.reset(new glib::Timeout(10, [this, skip_animation] {
+ lockscreen_timeout_.reset(new glib::Timeout(10, [this, prompt] {
bool grabbed_by_blank = (blank_window_ && blank_window_->OwnsPointerGrab());
if (WindowManager::Default().IsScreenGrabbed() && !grabbed_by_blank)
@@ -306,7 +298,7 @@ void Controller::OnLockRequested()
LockScreen();
session_manager_->locked.emit();
- if (skip_animation)
+ if (prompt)
{
animation::Skip(fade_animator_);
}
diff --git a/lockscreen/LockScreenController.h b/lockscreen/LockScreenController.h
index 165292173..f3d8db164 100644
--- a/lockscreen/LockScreenController.h
+++ b/lockscreen/LockScreenController.h
@@ -57,11 +57,10 @@ private:
void HideShields();
void ShowBlankWindow();
void HideBlankWindow();
- void RequestPromptScreenLock();
void SimulateActivity();
void ResetPostLockScreenSaver();
- void OnLockRequested();
+ void OnLockRequested(bool prompt);
void OnUnlockRequested();
void OnPresenceStatusChanged(bool idle);
void OnScreenSaverActivationRequest(bool activate);
@@ -81,7 +80,6 @@ private:
nux::animation::AnimateValue<double> blank_window_animator_;
bool test_mode_;
- bool skip_animation_;
BlurType old_blur_type_;
connection::Wrapper uscreen_connection_;