diff -Nru unity-7.2.0+14.04.20140414.1/debian/changelog unity-7.2.0+14.04.20140416/debian/changelog --- unity-7.2.0+14.04.20140414.1/debian/changelog 2014-04-16 22:50:18.000000000 +0000 +++ unity-7.2.0+14.04.20140416/debian/changelog 2014-04-16 22:50:19.000000000 +0000 @@ -1,3 +1,15 @@ +unity (7.2.0+14.04.20140416-0ubuntu1) trusty; urgency=low + + [ Andrea Azzarone ] + * Do not allow to activate twice the same entry! (LP: #1308572) + + [ Marco Trevisan (TreviƱo) ] + * UnityScreen: save a locked.stamp file when locking/unlocking, to + relock on startup This makes unity to relocks if it was locked + before crashing... (LP: #1308572) + + -- Ubuntu daily release Wed, 16 Apr 2014 22:41:19 +0000 + unity (7.2.0+14.04.20140414.1-0ubuntu1) trusty; urgency=low [ Alfred Neumayer ] diff -Nru unity-7.2.0+14.04.20140414.1/lockscreen/UserPromptView.cpp unity-7.2.0+14.04.20140416/lockscreen/UserPromptView.cpp --- unity-7.2.0+14.04.20140414.1/lockscreen/UserPromptView.cpp 2014-04-14 14:21:22.000000000 +0000 +++ unity-7.2.0+14.04.20140416/lockscreen/UserPromptView.cpp 2014-04-16 22:41:08.000000000 +0000 @@ -348,6 +348,11 @@ nux::GetWindowCompositor().SetKeyFocusArea(text_entry); text_entry->activated.connect([this, text_input, promise](){ + auto* text_entry = text_input->text_entry(); + + if (!text_entry->GetInputEventSensitivity()) + return; + if (focus_queue_.size() == 1) { text_input->SetSpinnerVisible(true); @@ -355,7 +360,6 @@ } focus_queue_.pop_front(); - auto* text_entry = text_input->text_entry(); cached_focused_geo_ = text_entry->GetGeometry(); text_entry->SetInputEventSensitivity(false); QueueRelayout(); diff -Nru unity-7.2.0+14.04.20140414.1/plugins/unityshell/src/unityshell.cpp unity-7.2.0+14.04.20140416/plugins/unityshell/src/unityshell.cpp --- unity-7.2.0+14.04.20140414.1/plugins/unityshell/src/unityshell.cpp 2014-04-14 14:21:45.000000000 +0000 +++ unity-7.2.0+14.04.20140416/plugins/unityshell/src/unityshell.cpp 2014-04-16 22:40:59.000000000 +0000 @@ -1,6 +1,6 @@ // -*- Mode: C++; indent-tabs-mode: nil; tab-width: 2 -*- /* Compiz unity plugin - * unity.cpp + * unityshell.cpp * * Copyright (c) 2010-11 Canonical Ltd. * @@ -26,6 +26,7 @@ #include #include +#include #include #include @@ -58,6 +59,7 @@ #include "decorations/DecorationsManager.h" #include +#include #include #include #include @@ -142,6 +144,7 @@ const RawPixel SCALE_SPACING = 20_em; const std::string RELAYOUT_TIMEOUT = "relayout-timeout"; const std::string FIRST_RUN_STAMP = "first_run.stamp"; +const std::string LOCKED_STAMP = "locked.stamp"; } // namespace local } // anon namespace @@ -466,6 +469,7 @@ unity_a11y_finalize(); QuicklistManager::Destroy(); decoration::DataPool::Reset(); + SaveLockStamp(false); reset_glib_logging(); } @@ -3727,7 +3731,7 @@ RaiseOSK(); } -void UnityScreen::LockscreenRequested() +void UnityScreen::OnLockScreenRequested() { if (switcher_controller_->Visible()) { @@ -3748,6 +3752,32 @@ RaiseOSK(); } +void UnityScreen::SaveLockStamp(bool save) +{ + auto const& cache_dir = DesktopUtilities::GetUserRuntimeDirectory(); + + if (cache_dir.empty()) + return; + + if (save) + { + glib::Error error; + g_file_set_contents((cache_dir+local::LOCKED_STAMP).c_str(), "", 0, &error); + + if (error) + { + LOG_ERROR(logger) << "Impossible to save the unity locked stamp file: " << error; + } + } + else + { + if (g_unlink((cache_dir+local::LOCKED_STAMP).c_str()) < 0) + { + LOG_ERROR(logger) << "Impossible to delete the unity locked stamp file"; + } + } +} + void UnityScreen::RaiseOSK() { /* stack any windows named "onboard" above us */ @@ -3813,7 +3843,9 @@ // Setup Session Controller auto manager = std::make_shared(); - manager->lock_requested.connect(sigc::mem_fun(this, &UnityScreen::LockscreenRequested)); + manager->lock_requested.connect(sigc::mem_fun(this, &UnityScreen::OnLockScreenRequested)); + manager->locked.connect(sigc::bind(sigc::mem_fun(this, &UnityScreen::SaveLockStamp), true)); + manager->unlocked.connect(sigc::bind(sigc::mem_fun(this, &UnityScreen::SaveLockStamp), false)); session_dbus_manager_ = std::make_shared(manager); session_controller_ = std::make_shared(manager); AddChild(session_controller_.get()); @@ -3823,6 +3855,9 @@ lockscreen_controller_ = std::make_shared(screensaver_dbus_manager_, manager); UpdateActivateIndicatorsKey(); + if (g_file_test((DesktopUtilities::GetUserRuntimeDirectory()+local::LOCKED_STAMP).c_str(), G_FILE_TEST_EXISTS)) + manager->PromptLockScreen(); + auto on_launcher_size_changed = [this] (nux::Area* area, int w, int h) { /* The launcher geometry includes 1px used to draw the right margin * that must not be considered when drawing an overlay */ @@ -3907,8 +3942,8 @@ void UnityScreen::ShowFirstRunHints() { sources_.AddTimeoutSeconds(1, [this] { - auto const& cache_dir = glib::gchar_to_string(g_get_user_cache_dir())+"/unity/"; - if (!g_file_test((cache_dir+local::FIRST_RUN_STAMP).c_str(), G_FILE_TEST_EXISTS)) + auto const& cache_dir = DesktopUtilities::GetUserCacheDirectory(); + if (!cache_dir.empty() && !g_file_test((cache_dir+local::FIRST_RUN_STAMP).c_str(), G_FILE_TEST_EXISTS)) { // We focus the panel, so the shortcut hint will be hidden at first user input auto const& panels = panel_controller_->panels(); @@ -3920,19 +3955,12 @@ shortcut_controller_->first_run = true; shortcut_controller_->Show(); - if (g_mkdir_with_parents(cache_dir.c_str(), 0700) >= 0) - { - glib::Error error; - g_file_set_contents((cache_dir+local::FIRST_RUN_STAMP).c_str(), "", 0, &error); + glib::Error error; + g_file_set_contents((cache_dir+local::FIRST_RUN_STAMP).c_str(), "", 0, &error); - if (error) - { - LOG_ERROR(logger) << "Impossible to save the unity stamp file: " << error; - } - } - else + if (error) { - LOG_ERROR(logger) << "Impossible to create unity cache folder!"; + LOG_ERROR(logger) << "Impossible to save the unity stamp file: " << error; } } return false; diff -Nru unity-7.2.0+14.04.20140414.1/plugins/unityshell/src/unityshell.h unity-7.2.0+14.04.20140416/plugins/unityshell/src/unityshell.h --- unity-7.2.0+14.04.20140414.1/plugins/unityshell/src/unityshell.h 2014-04-14 14:21:33.000000000 +0000 +++ unity-7.2.0+14.04.20140416/plugins/unityshell/src/unityshell.h 2014-04-16 22:40:59.000000000 +0000 @@ -232,7 +232,8 @@ void OnMinimizeDurationChanged(); - void LockscreenRequested(); + void OnLockScreenRequested(); + void SaveLockStamp(bool); switcher::Controller::Ptr switcher_controller(); launcher::Controller::Ptr launcher_controller(); diff -Nru unity-7.2.0+14.04.20140414.1/UnityCore/DesktopUtilities.cpp unity-7.2.0+14.04.20140416/UnityCore/DesktopUtilities.cpp --- unity-7.2.0+14.04.20140414.1/UnityCore/DesktopUtilities.cpp 2014-04-14 14:21:22.000000000 +0000 +++ unity-7.2.0+14.04.20140416/UnityCore/DesktopUtilities.cpp 2014-04-16 22:40:59.000000000 +0000 @@ -23,12 +23,17 @@ #include #include +#include #include "DesktopUtilities.h" #include "GLibWrapper.h" namespace unity { +namespace +{ +DECLARE_LOGGER(logger, "unity.desktop.utilities"); +} std::string DesktopUtilities::GetUserDataDirectory() { @@ -49,6 +54,30 @@ return ""; } +std::string DesktopUtilities::GetUserCacheDirectory() +{ + const char *cache_dir = g_get_user_cache_dir(); + auto unity_cache = glib::gchar_to_string(cache_dir).append(G_DIR_SEPARATOR_S "unity" G_DIR_SEPARATOR_S); + + if (g_mkdir_with_parents(unity_cache.c_str(), 0700) >= 0) + return unity_cache; + + LOG_ERROR(logger) << "Impossible to create unity cache folder '"<< unity_cache <<"' !"; + return ""; +} + +std::string DesktopUtilities::GetUserRuntimeDirectory() +{ + const char *runtime_dir = g_get_user_runtime_dir(); + auto unity_runtime = glib::gchar_to_string(runtime_dir).append(G_DIR_SEPARATOR_S "unity" G_DIR_SEPARATOR_S); + + if (g_mkdir_with_parents(unity_runtime.c_str(), 0700) >= 0) + return unity_runtime; + + LOG_ERROR(logger) << "Impossible to create unity runtime folder '"<< unity_runtime <<"' !"; + return ""; +} + std::vector DesktopUtilities::GetSystemDataDirectories() { const char* const* system_dirs = g_get_system_data_dirs(); diff -Nru unity-7.2.0+14.04.20140414.1/UnityCore/DesktopUtilities.h unity-7.2.0+14.04.20140416/UnityCore/DesktopUtilities.h --- unity-7.2.0+14.04.20140414.1/UnityCore/DesktopUtilities.h 2014-04-14 14:21:22.000000000 +0000 +++ unity-7.2.0+14.04.20140416/UnityCore/DesktopUtilities.h 2014-04-16 22:40:59.000000000 +0000 @@ -30,6 +30,8 @@ { public: static std::string GetUserDataDirectory(); + static std::string GetUserCacheDirectory(); + static std::string GetUserRuntimeDirectory(); static std::vector GetSystemDataDirectories(); static std::vector GetDataDirectories();