summaryrefslogtreecommitdiff
path: root/plugins
diff options
Diffstat (limited to 'plugins')
-rw-r--r--plugins/unityshell/src/unityshell.cpp83
-rw-r--r--plugins/unityshell/src/unityshell.h6
2 files changed, 61 insertions, 28 deletions
diff --git a/plugins/unityshell/src/unityshell.cpp b/plugins/unityshell/src/unityshell.cpp
index b8a1c4877..41aed941d 100644
--- a/plugins/unityshell/src/unityshell.cpp
+++ b/plugins/unityshell/src/unityshell.cpp
@@ -197,6 +197,7 @@ UnityScreen::UnityScreen(CompScreen* screen)
, menus_(std::make_shared<menu::Manager>(std::make_shared<indicator::DBusIndicators>(), std::make_shared<key::GnomeGrabber>()))
, deco_manager_(std::make_shared<decoration::Manager>(menus_))
, debugger_(this)
+ , session_(std::make_shared<session::GnomeManager>())
, needsRelayout(false)
, super_keypressed_(false)
, newFocusedWindow(nullptr)
@@ -519,7 +520,10 @@ UnityScreen::~UnityScreen()
unity_a11y_finalize();
QuicklistManager::Destroy();
decoration::DataPool::Reset();
- SaveLockStamp(false);
+
+ if (!session_->AutomaticLogin())
+ SaveLockStamp(false);
+
reset_glib_logging();
screen->addSupportedAtomsSetEnabled(this, false);
@@ -587,12 +591,14 @@ void UnityScreen::OnInitiateSpread()
for (auto const& swin : sScreen->getWindows())
{
- if (filtered_windows.find(swin->window->id()) != filtered_windows.end())
+ if (!swin->window || filtered_windows.find(swin->window->id()) != filtered_windows.end())
continue;
- auto* uwin = UnityWindow::get(swin->window);
- uwin->OnTerminateSpread();
- fake_decorated_windows_.erase(uwin);
+ if (UnityWindow* uwin = UnityWindow::get(swin->window))
+ {
+ uwin->OnTerminateSpread();
+ fake_decorated_windows_.erase(uwin);
+ }
}
for (auto xid : filtered_windows)
@@ -606,6 +612,9 @@ void UnityScreen::OnInitiateSpread()
for (auto const& swin : sScreen->getWindows())
{
+ if (!swin->window)
+ continue;
+
auto* uwin = UnityWindow::get(swin->window);
fake_decorated_windows_.insert(uwin);
uwin->OnInitiateSpread();
@@ -617,7 +626,13 @@ void UnityScreen::OnTerminateSpread()
spread_widgets_.reset();
for (auto const& swin : sScreen->getWindows())
- UnityWindow::get(swin->window)->OnTerminateSpread();
+ {
+ if (!swin->window)
+ continue;
+
+ if (UnityWindow* uwin = UnityWindow::get(swin->window))
+ uwin->OnTerminateSpread();
+ }
fake_decorated_windows_.clear();
}
@@ -867,7 +882,7 @@ void UnityScreen::DamageBlurUpdateRegion(nux::Geometry const& blur_update)
cScreen->damageRegion(CompRegionFromNuxGeo(blur_update));
}
-void UnityScreen::paintDisplay()
+void UnityScreen::paintOutput()
{
CompOutput *output = last_output_;
@@ -1508,7 +1523,7 @@ bool UnityScreen::glPaintOutput(const GLScreenPaintAttrib& attrib,
doShellRepaint = false;
if (doShellRepaint)
- paintDisplay();
+ paintOutput();
return ret;
}
@@ -3108,18 +3123,18 @@ bool UnityWindow::glDraw(const GLMatrix& matrix,
if (uScreen->doShellRepaint && window == uScreen->onboard_)
{
- uScreen->paintDisplay();
+ uScreen->paintOutput();
}
else if (uScreen->doShellRepaint &&
window == uScreen->firstWindowAboveShell &&
!uScreen->forcePaintOnTop() &&
!uScreen->fullscreenRegion.contains(window->geometry()))
{
- uScreen->paintDisplay();
+ uScreen->paintOutput();
}
else if (locked && CanBypassLockScreen())
{
- uScreen->paintDisplay();
+ uScreen->paintOutput();
}
enum class DrawPanelShadow
@@ -3851,7 +3866,7 @@ bool UnityScreen::layoutSlotsAndAssignWindows()
for (ScaleWindow *sw : scaled_windows)
{
- if (sw->window->outputDevice() == static_cast<int>(output.id()))
+ if (sw->window && sw->window->outputDevice() == static_cast<int>(output.id()))
{
UnityWindow::get(sw->window)->deco_win_->scaled = true;
layout_windows.emplace_back(std::make_shared<LayoutWindow>(sw->window->id()));
@@ -4001,17 +4016,32 @@ void UnityScreen::OnScreenUnlocked()
UpdateGesturesSupport();
}
-void UnityScreen::SaveLockStamp(bool save)
+std::string UnityScreen::GetLockStampFile() const
{
- auto const& cache_dir = DesktopUtilities::GetUserRuntimeDirectory();
+ std::string cache_dir;
+
+ if (session_->AutomaticLogin())
+ cache_dir = DesktopUtilities::GetUserCacheDirectory();
+ else
+ cache_dir = DesktopUtilities::GetUserRuntimeDirectory();
if (cache_dir.empty())
+ return std::string();
+
+ return cache_dir+local::LOCKED_STAMP;
+}
+
+void UnityScreen::SaveLockStamp(bool save)
+{
+ std::string file_path = GetLockStampFile();
+
+ if (file_path.empty())
return;
if (save)
{
glib::Error error;
- g_file_set_contents((cache_dir+local::LOCKED_STAMP).c_str(), "", 0, &error);
+ g_file_set_contents(file_path.c_str(), "", 0, &error);
if (error)
{
@@ -4020,7 +4050,7 @@ void UnityScreen::SaveLockStamp(bool save)
}
else
{
- if (g_unlink((cache_dir+local::LOCKED_STAMP).c_str()) < 0)
+ if (g_unlink(file_path.c_str()) < 0)
{
LOG_ERROR(logger) << "Impossible to delete the unity locked stamp file";
}
@@ -4096,24 +4126,23 @@ void UnityScreen::InitUnityComponents()
ShowFirstRunHints();
// Setup Session Controller
- auto session = std::make_shared<session::GnomeManager>();
- session->lock_requested.connect(sigc::mem_fun(this, &UnityScreen::OnLockScreenRequested));
- session->prompt_lock_requested.connect(sigc::mem_fun(this, &UnityScreen::OnLockScreenRequested));
- session->locked.connect(sigc::mem_fun(this, &UnityScreen::OnScreenLocked));
- session->unlocked.connect(sigc::mem_fun(this, &UnityScreen::OnScreenUnlocked));
- session_dbus_manager_ = std::make_shared<session::DBusManager>(session);
- session_controller_ = std::make_shared<session::Controller>(session);
+ session_->lock_requested.connect(sigc::mem_fun(this, &UnityScreen::OnLockScreenRequested));
+ session_->prompt_lock_requested.connect(sigc::mem_fun(this, &UnityScreen::OnLockScreenRequested));
+ session_->locked.connect(sigc::mem_fun(this, &UnityScreen::OnScreenLocked));
+ session_->unlocked.connect(sigc::mem_fun(this, &UnityScreen::OnScreenUnlocked));
+ session_dbus_manager_ = std::make_shared<session::DBusManager>(session_);
+ session_controller_ = std::make_shared<session::Controller>(session_);
LOG_INFO(logger) << "InitUnityComponents-Session " << timer.ElapsedSeconds() << "s";
Introspectable::AddChild(session_controller_.get());
// Setup Lockscreen Controller
- screensaver_dbus_manager_ = std::make_shared<lockscreen::DBusManager>(session);
- lockscreen_controller_ = std::make_shared<lockscreen::Controller>(screensaver_dbus_manager_, session, menus_->KeyGrabber());
+ screensaver_dbus_manager_ = std::make_shared<lockscreen::DBusManager>(session_);
+ lockscreen_controller_ = std::make_shared<lockscreen::Controller>(screensaver_dbus_manager_, session_, menus_->KeyGrabber());
UpdateActivateIndicatorsKey();
LOG_INFO(logger) << "InitUnityComponents-Lockscreen " << timer.ElapsedSeconds() << "s";
- if (g_file_test((DesktopUtilities::GetUserRuntimeDirectory()+local::LOCKED_STAMP).c_str(), G_FILE_TEST_EXISTS))
- session->PromptLockScreen();
+ if (g_file_test(GetLockStampFile().c_str(), G_FILE_TEST_EXISTS))
+ session_->PromptLockScreen();
auto on_launcher_size_changed = [this] (nux::Area* area, int w, int h) {
/* The launcher geometry includes 1px used to draw the right/top margin
diff --git a/plugins/unityshell/src/unityshell.h b/plugins/unityshell/src/unityshell.h
index 43df66e72..a630a99c0 100644
--- a/plugins/unityshell/src/unityshell.h
+++ b/plugins/unityshell/src/unityshell.h
@@ -76,6 +76,7 @@
#include "UnityShowdesktopHandler.h"
#include "ThumbnailGenerator.h"
#include "MenuManager.h"
+#include "UnityCore/SessionManager.h"
#include "compizminimizedwindowhandler.h"
#include "BGHash.h"
@@ -180,7 +181,7 @@ private:
void nuxEpilogue();
/* nux draw wrapper */
- void paintDisplay();
+ void paintOutput();
void paintPanelShadow(CompRegion const& clip);
void setPanelShadowMatrix(const GLMatrix& matrix);
void updateBlurDamage();
@@ -231,6 +232,7 @@ private:
void OnScreenLocked();
void OnScreenUnlocked();
void SaveLockStamp(bool);
+ std::string GetLockStampFile() const;
bool DoesPointIntersectUnityGeos(nux::Point const& pt);
@@ -344,6 +346,8 @@ private:
std::unique_ptr<BGHash> bghash_;
spread::Widgets::Ptr spread_widgets_;
+ session::Manager::Ptr session_;
+
/* Subscription for gestures that manipulate Unity launcher */
std::unique_ptr<nux::GesturesSubscription> gestures_sub_launcher_;