summaryrefslogtreecommitdiff
diff options
-rw-r--r--com.canonical.Unity.gschema.xml7
-rw-r--r--debian/changelog10
-rw-r--r--launcher/ApplicationLauncherIcon.cpp1
-rw-r--r--launcher/ApplicationLauncherIcon.h3
-rw-r--r--launcher/FileManagerLauncherIcon.cpp8
-rw-r--r--lockscreen/CMakeLists.txt1
-rw-r--r--lockscreen/LockScreenAcceleratorController.cpp2
-rw-r--r--lockscreen/LockScreenButton.cpp148
-rw-r--r--lockscreen/LockScreenButton.h70
-rw-r--r--lockscreen/UserAuthenticatorPam.cpp17
-rw-r--r--lockscreen/UserPromptView.cpp126
-rw-r--r--lockscreen/UserPromptView.h10
-rw-r--r--panel/PanelView.cpp5
-rw-r--r--plugins/unityshell/src/unityshell.cpp2
-rwxr-xr-xunity-shared/DashStyle.cpp39
-rwxr-xr-xunity-shared/DashStyle.h5
-rw-r--r--unity-shared/UnitySettings.cpp7
-rw-r--r--unity-shared/UnitySettings.h1
18 files changed, 439 insertions, 23 deletions
diff --git a/com.canonical.Unity.gschema.xml b/com.canonical.Unity.gschema.xml
index 01123274a..bfeeb7dad 100644
--- a/com.canonical.Unity.gschema.xml
+++ b/com.canonical.Unity.gschema.xml
@@ -93,6 +93,13 @@
<summary>List of keycodes that should be processed even if auto-repated.</summary>
<description>These keycodes are processed even if they are auto-repeated.</description>
</key>
+ <key type="b" name="pam-check-account-type">
+ <default>false</default>
+ <summary>Enable/Disable PAM account checking</summary>
+ <description>Whether PAM should check the result of account modules
+ when authenticating. Only do this if you have account
+ configured properly on your system.</description>
+ </key>
</schema>
<schema path="/com/canonical/unity/interface/" id="com.canonical.Unity.Interface" gettext-domain="unity">
<key type="d" name="text-scale-factor">
diff --git a/debian/changelog b/debian/changelog
index 9c4dc38b8..c872c091c 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,13 @@
+unity (7.5.0+16.10.20160628.1-0ubuntu1) yakkety; urgency=medium
+
+ [ Andrea Azzarone ]
+ * UnitySettings: Add an option to enable/disable pam account checking.
+ (LP: #1460649)
+ * Lockscreen: Make sure warning and errors are properly shown to the
+ user (LP: #1593696)
+
+ -- Marco Trevisan (TreviƱo) <mail@3v1n0.net> Tue, 28 Jun 2016 16:23:47 +0000
+
unity (7.5.0+16.10.20160621.1-0ubuntu1) yakkety; urgency=medium
* LockScreenAcceleratorController: use key::Grabber to handle allowed
diff --git a/launcher/ApplicationLauncherIcon.cpp b/launcher/ApplicationLauncherIcon.cpp
index b5ee808e9..f92431c55 100644
--- a/launcher/ApplicationLauncherIcon.cpp
+++ b/launcher/ApplicationLauncherIcon.cpp
@@ -42,7 +42,6 @@ namespace
DECLARE_LOGGER(logger, "unity.launcher.icon.application");
// We use the "application-" prefix since the manager is protected, to avoid name clash
-const std::string ICON_REMOVE_TIMEOUT = "application-icon-remove";
const std::string DEFAULT_ICON = "application-default-icon";
enum MenuItemType
diff --git a/launcher/ApplicationLauncherIcon.h b/launcher/ApplicationLauncherIcon.h
index afdf0118e..1a21f1f22 100644
--- a/launcher/ApplicationLauncherIcon.h
+++ b/launcher/ApplicationLauncherIcon.h
@@ -54,6 +54,9 @@ public:
void UnStick() override;
protected:
+ // This must be defined here as it's used both in ApplicationLauncherIcon and in FileManagerLauncherIcon.
+ static constexpr const char* ICON_REMOVE_TIMEOUT = "application-icon-remove";
+
void SetApplication(ApplicationPtr const& app);
ApplicationPtr GetApplication() const;
diff --git a/launcher/FileManagerLauncherIcon.cpp b/launcher/FileManagerLauncherIcon.cpp
index d5895ad0f..e4cf98d55 100644
--- a/launcher/FileManagerLauncherIcon.cpp
+++ b/launcher/FileManagerLauncherIcon.cpp
@@ -67,6 +67,14 @@ FileManagerLauncherIcon::FileManagerLauncherIcon(ApplicationPtr const& app, Devi
icon_name = (icon.empty() ? DEFAULT_ICON : icon);
}));
+ signals_conn_.Add(app_->running.changed.connect([this](bool running) {
+ LOG_DEBUG(logger) << tooltip_text() << " running now " << (running ? "true" : "false");
+
+ if (running)
+ _source_manager.Remove(ICON_REMOVE_TIMEOUT);
+ }));
+
+
UpdateStorageWindows();
}
diff --git a/lockscreen/CMakeLists.txt b/lockscreen/CMakeLists.txt
index 357ac1010..2e64d1cab 100644
--- a/lockscreen/CMakeLists.txt
+++ b/lockscreen/CMakeLists.txt
@@ -23,6 +23,7 @@ set (LOCKSCREEN_SOURCES
KylinLockScreenShield.cpp
LockScreenController.cpp
LockScreenBaseShield.cpp
+ LockScreenButton.cpp
LockScreenSettings.cpp
LockScreenShield.cpp
LockScreenShieldFactory.cpp
diff --git a/lockscreen/LockScreenAcceleratorController.cpp b/lockscreen/LockScreenAcceleratorController.cpp
index fbbedbe38..80436881d 100644
--- a/lockscreen/LockScreenAcceleratorController.cpp
+++ b/lockscreen/LockScreenAcceleratorController.cpp
@@ -20,6 +20,8 @@
#include "LockScreenAcceleratorController.h"
+#include <sigc++/bind.h>
+
#include <NuxCore/Logger.h>
#include <UnityCore/GLibDBusProxy.h>
diff --git a/lockscreen/LockScreenButton.cpp b/lockscreen/LockScreenButton.cpp
new file mode 100644
index 000000000..85759043a
--- /dev/null
+++ b/lockscreen/LockScreenButton.cpp
@@ -0,0 +1,148 @@
+/*
+ * Copyright 2016 Canonical Ltd.
+ *
+ * This program is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License version 3, as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranties of
+ * MERCHANTABILITY, SATISFACTORY QUALITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the applicable version of the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of both the GNU Lesser General Public
+ * License version 3 along with this program. If not, see
+ * <http://www.gnu.org/licenses/>
+ *
+ * Authored by: Andrea Azzarone <andrea.azzarone@canonical.com>
+ *
+ */
+
+#include "LockScreenButton.h"
+
+#include <Nux/HLayout.h>
+
+#include "unity-shared/DashStyle.h"
+#include "unity-shared/IconTexture.h"
+#include "LockScreenSettings.h"
+
+namespace unity
+{
+namespace lockscreen
+{
+
+namespace
+{
+const RawPixel HLAYOUT_RIGHT_PADDING = 10_em;
+const int FONT_PX_SIZE = 17;
+}
+
+NUX_IMPLEMENT_OBJECT_TYPE(LockScreenButton);
+
+LockScreenButton::LockScreenButton(std::string const& label, NUX_FILE_LINE_DECL)
+ : nux::Button(NUX_FILE_LINE_PARAM)
+ , scale(1.0)
+ , label_(label)
+{
+ hlayout_ = new nux::HLayout(NUX_TRACKER_LOCATION);
+ hlayout_->SetLeftAndRightPadding(0, HLAYOUT_RIGHT_PADDING.CP(scale));
+ hlayout_->SetContentDistribution(nux::MAJOR_POSITION_END);
+ SetLayout(hlayout_);
+
+ activator_ = new IconTexture(dash::Style::Instance().GetLockScreenActivator(scale()));
+ hlayout_->AddView(activator_, 0, nux::MINOR_POSITION_CENTER, nux::MINOR_SIZE_FULL);
+
+ InitTheme();
+
+ scale.changed.connect([this] (double scale) {
+ activator_->SetTexture(dash::Style::Instance().GetLockScreenActivator(scale));
+ hlayout_->SetLeftAndRightPadding(0, HLAYOUT_RIGHT_PADDING.CP(scale));
+ InitTheme();
+ });
+
+ key_down.connect([this] (unsigned long, unsigned long, unsigned long, const char*, unsigned short) {
+ state_change.emit(this);
+ });
+}
+
+void LockScreenButton::InitTheme()
+{
+ SetMinimumHeight(Settings::GRID_SIZE.CP(scale));
+ SetMaximumHeight(Settings::GRID_SIZE.CP(scale));
+
+ nux::Geometry const& geo = GetGeometry();
+ normal_.reset(new nux::CairoWrapper(geo, sigc::mem_fun(this, &LockScreenButton::RedrawTheme)));
+}
+
+void LockScreenButton::RedrawTheme(nux::Geometry const& geom, cairo_t* cr)
+{
+ cairo_surface_set_device_scale(cairo_get_target(cr), scale, scale);
+ dash::Style::Instance().LockScreenButton(cr, label_, FONT_PX_SIZE);
+}
+
+long LockScreenButton::ComputeContentSize()
+{
+ long ret = nux::Button::ComputeContentSize();
+ nux::Geometry const& geo = GetGeometry();
+
+ if (cached_geometry_ != geo)
+ {
+ normal_->Invalidate(geo);
+ cached_geometry_ = geo;
+ }
+
+ return ret;
+}
+
+void LockScreenButton::DrawContent(nux::GraphicsEngine& GfxContext, bool force_draw)
+{
+ if (IsFullRedraw())
+ {
+ GfxContext.PushClippingRectangle(GetGeometry());
+ hlayout_->ProcessDraw(GfxContext, force_draw);
+ GfxContext.PopClippingRectangle();
+ }
+}
+
+void LockScreenButton::Draw(nux::GraphicsEngine& GfxContext, bool force_draw)
+{
+ nux::Geometry const& geo = GetGeometry();
+ GfxContext.PushClippingRectangle(geo);
+ gPainter.PaintBackground(GfxContext, geo);
+
+ nux::TexCoordXForm texxform;
+ texxform.SetWrap(nux::TEXWRAP_CLAMP, nux::TEXWRAP_CLAMP);
+ texxform.SetTexCoordType(nux::TexCoordXForm::OFFSET_COORD);
+
+ unsigned int alpha = 0, src = 0, dest = 0;
+ GfxContext.GetRenderStates().GetBlend(alpha, src, dest);
+ GfxContext.GetRenderStates().SetPremultipliedBlend(nux::SRC_OVER);
+ GfxContext.GetRenderStates().SetBlend(true);
+
+ nux::Color col(nux::color::Black);
+ col.alpha = 0;
+ GfxContext.QRP_Color(geo.x, geo.y,
+ geo.width, geo.height,
+ col);
+
+ nux::BaseTexture* texture = normal_->GetTexture();
+ GfxContext.QRP_1Tex(geo.x, geo.y,
+ texture->GetWidth(), texture->GetHeight(),
+ texture->GetDeviceTexture(),
+ texxform, nux::color::White);
+
+ GfxContext.GetRenderStates().SetBlend(alpha, src, dest);
+ GfxContext.PopClippingRectangle();
+}
+
+bool LockScreenButton::InspectKeyEvent(unsigned int eventType, unsigned int key_sym, const char* character)
+{
+ if ((eventType == nux::NUX_KEYDOWN) && (key_sym == NUX_VK_ENTER))
+ return true;
+ else
+ return false;
+}
+
+} // namespace lockscreen
+} // namespace unity \ No newline at end of file
diff --git a/lockscreen/LockScreenButton.h b/lockscreen/LockScreenButton.h
new file mode 100644
index 000000000..8afdfa032
--- /dev/null
+++ b/lockscreen/LockScreenButton.h
@@ -0,0 +1,70 @@
+/*
+ * Copyright 2016 Canonical Ltd.
+ *
+ * This program is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License version 3, as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranties of
+ * MERCHANTABILITY, SATISFACTORY QUALITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the applicable version of the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of both the GNU Lesser General Public
+ * License version 3 along with this program. If not, see
+ * <http://www.gnu.org/licenses/>
+ *
+ * Authored by: Andrea Azzarone <andrea.azzarone@canonical.com>
+ *
+ */
+
+#ifndef UNITY_LOCKSCREEN_BUTTON_H
+#define UNITY_LOCKSCREEN_BUTTON_H
+
+#include <Nux/Nux.h>
+#include <Nux/Button.h>
+#include <Nux/CairoWrapper.h>
+
+namespace unity
+{
+
+class IconTexture;
+
+namespace lockscreen
+{
+
+class LockScreenButton : public nux::Button
+{
+ NUX_DECLARE_OBJECT_TYPE(LockScreenButton, nux::Button);
+
+public:
+ LockScreenButton(std::string const&, NUX_FILE_LINE_PROTO);
+
+ nux::Property<double> scale;
+
+protected:
+ long ComputeContentSize() override;
+ void Draw(nux::GraphicsEngine&, bool) override;
+ void DrawContent(nux::GraphicsEngine&, bool) override;
+ bool InspectKeyEvent(unsigned int eventType, unsigned int key_sym, const char* character) override;
+
+private:
+ void InitTheme();
+ void RedrawTheme(nux::Geometry const&, cairo_t*);
+
+ typedef std::unique_ptr<nux::CairoWrapper> NuxCairoPtr;
+
+ std::string label_;
+ nux::Geometry cached_geometry_;
+
+ NuxCairoPtr normal_;
+
+ nux::HLayout* hlayout_;
+ IconTexture* activator_;
+};
+
+} // namespace lockscreen
+} // namespace unity
+
+#endif
diff --git a/lockscreen/UserAuthenticatorPam.cpp b/lockscreen/UserAuthenticatorPam.cpp
index c62af7913..1f4da84c5 100644
--- a/lockscreen/UserAuthenticatorPam.cpp
+++ b/lockscreen/UserAuthenticatorPam.cpp
@@ -22,6 +22,7 @@
// let's just fallcback to lightdm.
#include "UserAuthenticatorPam.h"
+#include "unity-shared/UnitySettings.h"
#include <cstring>
#include <security/pam_appl.h>
@@ -52,13 +53,21 @@ bool UserAuthenticatorPam::AuthenticateStart(std::string const& username,
g_task_run_in_thread(task, [] (GTask* task, gpointer, gpointer data, GCancellable*) {
auto self = static_cast<UserAuthenticatorPam*>(data);
+
self->status_ = pam_authenticate(self->pam_handle_, 0);
+
if (self->status_ == PAM_SUCCESS)
- self->status_ = pam_acct_mgmt(self->pam_handle_, 0);
- if (self->status_ == PAM_NEW_AUTHTOK_REQD)
- self->status_ = pam_chauthtok(self->pam_handle_, PAM_CHANGE_EXPIRED_AUTHTOK);
- if (self->status_ == PAM_SUCCESS)
+ {
+ int status2 = pam_acct_mgmt(self->pam_handle_, 0);
+
+ if (status2 == PAM_NEW_AUTHTOK_REQD)
+ status2 = pam_chauthtok(self->pam_handle_, PAM_CHANGE_EXPIRED_AUTHTOK);
+
+ if (unity::Settings::Instance().pam_check_account_type())
+ self->status_ = status2;
+
pam_setcred (self->pam_handle_, PAM_REINITIALIZE_CRED);
+ }
});
return true;
diff --git a/lockscreen/UserPromptView.cpp b/lockscreen/UserPromptView.cpp
index 229ff2417..3abb6c25a 100644
--- a/lockscreen/UserPromptView.cpp
+++ b/lockscreen/UserPromptView.cpp
@@ -26,6 +26,7 @@
#include <Nux/VLayout.h>
#include "LockScreenSettings.h"
+#include "LockScreenButton.h"
#include "unity-shared/CairoTexture.h"
#include "unity-shared/TextInput.h"
#include "unity-shared/StaticCairoText.h"
@@ -41,6 +42,7 @@ const RawPixel PADDING = 10_em;
const RawPixel LAYOUT_MARGIN = 10_em;
const RawPixel MSG_LAYOUT_MARGIN = 15_em;
const RawPixel PROMPT_LAYOUT_MARGIN = 5_em;
+const RawPixel BUTTON_LAYOUT_MARGIN = 5_em;
const int PROMPT_FONT_SIZE = 13;
nux::AbstractPaintLayer* CrateBackgroundLayer(double width, double height, double scale)
@@ -105,20 +107,29 @@ UserPromptView::UserPromptView(session::Manager::Ptr const& session_manager)
, username_(nullptr)
, msg_layout_(nullptr)
, prompt_layout_(nullptr)
+ , button_layout_(nullptr)
+ , prompted_(false)
+ , unacknowledged_messages_(false)
{
user_authenticator_.echo_on_requested.connect([this](std::string const& message, PromiseAuthCodePtr const& promise){
+ prompted_ = true;
+ unacknowledged_messages_ = false;
AddPrompt(message, /* visible */ true, promise);
});
user_authenticator_.echo_off_requested.connect([this](std::string const& message, PromiseAuthCodePtr const& promise){
+ prompted_ = true;
+ unacknowledged_messages_ = false;
AddPrompt(message, /* visible */ false, promise);
});
user_authenticator_.message_requested.connect([this](std::string const& message){
+ unacknowledged_messages_ = true;
AddMessage(message, nux::color::White);
});
user_authenticator_.error_requested.connect([this](std::string const& message){
+ unacknowledged_messages_ = true;
AddMessage(message, nux::color::Red);
});
@@ -131,8 +142,7 @@ UserPromptView::UserPromptView(session::Manager::Ptr const& session_manager)
UpdateSize();
ResetLayout();
- user_authenticator_.AuthenticateStart(session_manager_->UserName(),
- sigc::mem_fun(this, &UserPromptView::AuthenticationCb));
+ StartAuthentication();
}
void UserPromptView::UpdateSize()
@@ -178,6 +188,19 @@ void UserPromptView::UpdateSize()
}
}
+ if (button_layout_)
+ {
+ button_layout_->SetVerticalInternalMargin(BUTTON_LAYOUT_MARGIN.CP(scale));
+
+ for (auto* area : button_layout_->GetChildren())
+ {
+ auto* button = static_cast<LockScreenButton*>(area);
+ button->SetMinimumHeight(Settings::GRID_SIZE.CP(scale));
+ button->SetMaximumHeight(Settings::GRID_SIZE.CP(scale));
+ button->scale = scale();
+ }
+ }
+
bg_layer_.reset();
ComputeContentSize();
@@ -200,8 +223,13 @@ bool UserPromptView::InspectKeyEvent(unsigned int eventType, unsigned int key_sy
void UserPromptView::ResetLayout()
{
+ bool keep_msg_layout = msg_layout_ && (!prompted_ || unacknowledged_messages_);
+
focus_queue_.clear();
+ if (keep_msg_layout)
+ msg_layout_->Reference();
+
SetLayout(new nux::VLayout());
GetLayout()->SetLeftAndRightPadding(PADDING.CP(scale));
@@ -216,34 +244,54 @@ void UserPromptView::ResetLayout()
username_->SetFont("Ubuntu "+std::to_string(PROMPT_FONT_SIZE));
GetLayout()->AddView(username_);
- msg_layout_ = new nux::VLayout();
- msg_layout_->SetVerticalInternalMargin(MSG_LAYOUT_MARGIN.CP(scale));
- msg_layout_->SetReconfigureParentLayoutOnGeometryChange(true);
+ if (!keep_msg_layout)
+ {
+ msg_layout_ = new nux::VLayout();
+ msg_layout_->SetVerticalInternalMargin(MSG_LAYOUT_MARGIN.CP(scale));
+ msg_layout_->SetReconfigureParentLayoutOnGeometryChange(true);
+ }
+
GetLayout()->AddLayout(msg_layout_);
+ if (keep_msg_layout)
+ msg_layout_->UnReference();
+
prompt_layout_ = new nux::VLayout();
prompt_layout_->SetVerticalInternalMargin(PROMPT_LAYOUT_MARGIN.CP(scale));
prompt_layout_->SetReconfigureParentLayoutOnGeometryChange(true);
GetLayout()->AddLayout(prompt_layout_);
+ button_layout_ = new nux::VLayout();
+ button_layout_->SetVerticalInternalMargin(BUTTON_LAYOUT_MARGIN.CP(scale));
+ button_layout_->SetReconfigureParentLayoutOnGeometryChange(true);
+
QueueRelayout();
QueueDraw();
}
-void UserPromptView::AuthenticationCb(bool authenticated)
+void UserPromptView::AuthenticationCb(bool is_authenticated)
{
ResetLayout();
- if (authenticated)
+ if (is_authenticated)
{
- session_manager_->unlock_requested.emit();
+ if (prompted_ && !unacknowledged_messages_)
+ DoUnlock();
+ else
+ ShowAuthenticated(true);
}
else
{
- AddMessage(_("Invalid password, please try again"), nux::color::Red);
-
- user_authenticator_.AuthenticateStart(session_manager_->UserName(),
- sigc::mem_fun(this, &UserPromptView::AuthenticationCb));
+ if (prompted_)
+ {
+ AddMessage(_("Invalid password, please try again"), nux::color::Red);
+ StartAuthentication();
+ }
+ else
+ {
+ AddMessage(_("Failed to authenticate"), nux::color::Red);
+ ShowAuthenticated(false);
+ }
}
}
@@ -299,7 +347,16 @@ void UserPromptView::DrawContent(nux::GraphicsEngine& graphics_engine, bool forc
nux::View* UserPromptView::focus_view()
{
if (focus_queue_.empty())
- return nullptr;
+ {
+ if (button_layout_ && button_layout_->GetChildren().size() > 0)
+ {
+ return static_cast<nux::View*>(button_layout_->GetChildren().front());
+ }
+ else
+ {
+ return nullptr;
+ }
+ }
for (auto* view : focus_queue_)
if (view->text_entry()->HasKeyboardFocus())
@@ -378,5 +435,48 @@ void UserPromptView::AddMessage(std::string const& message, nux::Color const& co
QueueDraw();
}
+void UserPromptView::AddButton(std::string const& text, std::function<void()> const& cb)
+{
+ auto* button = new LockScreenButton (text, NUX_TRACKER_LOCATION);
+ button->scale = scale();
+ button_layout_->AddView(button, 1, nux::MINOR_POSITION_START, nux::MINOR_SIZE_FULL);
+
+ button->state_change.connect ([cb] (nux::View*) {
+ cb();
+ });
+
+ GetLayout()->ComputeContentPosition(0, 0);
+ ComputeContentSize();
+ QueueRelayout();
+ QueueDraw();
+}
+
+void UserPromptView::ShowAuthenticated(bool successful)
+{
+ prompted_ = true;
+ unacknowledged_messages_ = false;
+
+ if (successful)
+ AddButton(_("Unlock"), sigc::mem_fun(this, &UserPromptView::DoUnlock));
+ else
+ AddButton(_("Retry"), sigc::mem_fun(this, &UserPromptView::StartAuthentication));
+
+ GetLayout()->AddLayout(button_layout_);
+}
+
+void UserPromptView::StartAuthentication()
+{
+ prompted_ = false;
+ unacknowledged_messages_ = false;
+
+ user_authenticator_.AuthenticateStart(session_manager_->UserName(),
+ sigc::mem_fun(this, &UserPromptView::AuthenticationCb));
+}
+
+void UserPromptView::DoUnlock()
+{
+ session_manager_->unlock_requested.emit();
+}
+
}
}
diff --git a/lockscreen/UserPromptView.h b/lockscreen/UserPromptView.h
index 507a69a70..e0d4f9be1 100644
--- a/lockscreen/UserPromptView.h
+++ b/lockscreen/UserPromptView.h
@@ -52,6 +52,7 @@ public:
nux::View* focus_view();
+ void AddButton(std::string const& text, std::function<void()> const& cb);
void AddPrompt(std::string const& message, bool visible, PromiseAuthCodePtr const&);
void AddMessage(std::string const& message, nux::Color const& color);
void AuthenticationCb(bool authenticated);
@@ -59,13 +60,16 @@ public:
protected:
void Draw(nux::GraphicsEngine& graphics_engine, bool force_draw) override;
void DrawContent(nux::GraphicsEngine& graphics_engine, bool force_draw) override;
+ bool InspectKeyEvent(unsigned int eventType, unsigned int key_sym, const char* character) override;
private:
void ResetLayout();
void UpdateSize();
void EnsureBGLayer();
- bool InspectKeyEvent(unsigned int eventType, unsigned int key_sym, const char* character);
+ void ShowAuthenticated(bool successful);
+ void StartAuthentication();
+ void DoUnlock();
session::Manager::Ptr session_manager_;
UserAuthenticatorPam user_authenticator_;
@@ -73,9 +77,13 @@ private:
StaticCairoText* username_;
nux::VLayout* msg_layout_;
nux::VLayout* prompt_layout_;
+ nux::VLayout* button_layout_;
std::deque<TextInput*> focus_queue_;
nux::Geometry cached_focused_geo_;
+
+ bool prompted_;
+ bool unacknowledged_messages_;
};
}
diff --git a/panel/PanelView.cpp b/panel/PanelView.cpp
index af142dc05..6bbead08e 100644
--- a/panel/PanelView.cpp
+++ b/panel/PanelView.cpp
@@ -300,8 +300,9 @@ void
PanelView::Draw(nux::GraphicsEngine& GfxContext, bool force_draw)
{
nux::Geometry const& geo = GetGeometry();
+ nux::Geometry const& geo_absolute = GetAbsoluteGeometry();
nux::Geometry const& mgeo = UScreen::GetDefault()->GetMonitorGeometry(monitor_);
- nux::Geometry isect = mgeo.Intersect(geo);
+ nux::Geometry isect = mgeo.Intersect(geo_absolute);
if(!isect.width || !isect.height)
return;
@@ -313,8 +314,6 @@ PanelView::Draw(nux::GraphicsEngine& GfxContext, bool force_draw)
if (IsTransparent())
{
- nux::Geometry const& geo_absolute = GetAbsoluteGeometry();
-
if (BackgroundEffectHelper::blur_type != BLUR_NONE)
{
bg_blur_texture_ = bg_effect_helper_.GetBlurRegion();
diff --git a/plugins/unityshell/src/unityshell.cpp b/plugins/unityshell/src/unityshell.cpp
index 9aa9cdad0..848981202 100644
--- a/plugins/unityshell/src/unityshell.cpp
+++ b/plugins/unityshell/src/unityshell.cpp
@@ -2986,7 +2986,7 @@ bool UnityWindow::glPaint(const GLWindowPaintAttrib& attrib,
uScreen->windows_for_monitor_[monitor] = 1;
if (!(mask & nonOcclusionBits) &&
- (window->state() & CompWindowStateFullscreenMask && !window->minimized()) &&
+ (window->state() & CompWindowStateFullscreenMask && !window->minimized() && !window->inShowDesktopMode()) &&
uScreen->windows_for_monitor_[monitor] == 1)
// And I've been advised to test other things, but they don't work:
// && (attrib.opacity == OPAQUE)) <-- Doesn't work; Only set in glDraw
diff --git a/unity-shared/DashStyle.cpp b/unity-shared/DashStyle.cpp
index 2883bd172..22ee245d9 100755
--- a/unity-shared/DashStyle.cpp
+++ b/unity-shared/DashStyle.cpp
@@ -1672,6 +1672,41 @@ bool Style::Button(cairo_t* cr, nux::ButtonVisualState state,
return true;
}
+bool Style::LockScreenButton(cairo_t* cr, std::string const& label,
+ int font_px_size)
+{
+ if (cairo_status(cr) != CAIRO_STATUS_SUCCESS)
+ return false;
+
+ if (cairo_surface_get_type(cairo_get_target(cr)) != CAIRO_SURFACE_TYPE_IMAGE)
+ return false;
+
+ double w, h;
+ get_actual_cairo_size(cr, &w, &h);
+
+ cairo_set_line_width(cr, 1);
+
+ double radius = 5.0;
+ RoundedRect(cr, 1.0, 0.5, 0.5, radius, w - 1.0, h - 1.0);
+
+ cairo_set_source_rgba(cr, 0.0f, 0.0f, 0.0f, 0.35f);
+ cairo_fill_preserve(cr);
+
+ cairo_set_source_rgba(cr, 1.0f, 1.0f, 1.0f, 0.7f);
+ cairo_stroke(cr);
+
+ static double internal_padding = 10.0f;
+
+ pimpl->Text(cr,
+ nux::color::White,
+ label,
+ font_px_size,
+ internal_padding,
+ dash::Alignment::LEFT);
+
+ return true;
+}
+
nux::AbstractPaintLayer* Style::FocusOverlay(int width, int height)
{
nux::CairoGraphics cg(CAIRO_FORMAT_ARGB32, width, height);
@@ -2211,6 +2246,10 @@ BaseTexturePtr Style::GetSearchSpinIcon(double scale) const
return pimpl->LoadScaledTexture("search_spin", scale);
}
+BaseTexturePtr Style::GetLockScreenActivator(double scale) const
+{
+ return pimpl->LoadScaledTexture("arrow_right", scale);
+}
RawPixel Style::GetButtonGarnishSize() const
{
diff --git a/unity-shared/DashStyle.h b/unity-shared/DashStyle.h
index b4749c037..4d228a513 100755
--- a/unity-shared/DashStyle.h
+++ b/unity-shared/DashStyle.h
@@ -98,6 +98,9 @@ public:
static Style& Instance();
+ virtual bool LockScreenButton(cairo_t* cr, std::string const& label,
+ int font_px_size);
+
virtual bool Button(cairo_t* cr, nux::ButtonVisualState state,
std::string const& label, int font_px_size=-1,
Alignment alignment = Alignment::CENTER,
@@ -196,6 +199,8 @@ public:
BaseTexturePtr GetSearchCloseIcon(double scale) const;
BaseTexturePtr GetSearchSpinIcon(double scale) const;
+ BaseTexturePtr GetLockScreenActivator(double scale) const;
+
BaseTexturePtr const& GetGroupUnexpandIcon() const;
BaseTexturePtr const& GetGroupExpandIcon() const;
diff --git a/unity-shared/UnitySettings.cpp b/unity-shared/UnitySettings.cpp
index ec4d1374f..af03538e7 100644
--- a/unity-shared/UnitySettings.cpp
+++ b/unity-shared/UnitySettings.cpp
@@ -39,6 +39,7 @@ const std::string SETTINGS_NAME = "com.canonical.Unity";
const std::string FORM_FACTOR = "form-factor";
const std::string DOUBLE_CLICK_ACTIVATE = "double-click-activate";
const std::string DESKTOP_TYPE = "desktop-type";
+const std::string PAM_CHECK_ACCOUNT_TYPE = "pam-check-account-type";
const std::string LAUNCHER_SETTINGS = "com.canonical.Unity.Launcher";
const std::string LAUNCHER_POSITION = "launcher-position";
@@ -109,6 +110,7 @@ public:
parent_->launcher_position.SetGetterFunction(sigc::mem_fun(this, &Impl::GetLauncherPosition));
parent_->launcher_position.SetSetterFunction(sigc::mem_fun(this, &Impl::SetLauncherPosition));
parent_->desktop_type.SetGetterFunction(sigc::mem_fun(this, &Impl::GetDesktopType));
+ parent_->pam_check_account_type.SetGetterFunction(sigc::mem_fun(this, &Impl::GetPamCheckAccountType));
for (unsigned i = 0; i < monitors::MAX; ++i)
em_converters_.emplace_back(std::make_shared<EMConverter>());
@@ -273,6 +275,11 @@ public:
return static_cast<DesktopType>(g_settings_get_enum(usettings_, DESKTOP_TYPE.c_str()));
}
+ bool GetPamCheckAccountType() const
+ {
+ return g_settings_get_boolean(usettings_, PAM_CHECK_ACCOUNT_TYPE.c_str());
+ }
+
int GetFontSize() const
{
gint font_size;
diff --git a/unity-shared/UnitySettings.h b/unity-shared/UnitySettings.h
index 1081fef57..0a4dffea3 100644
--- a/unity-shared/UnitySettings.h
+++ b/unity-shared/UnitySettings.h
@@ -64,6 +64,7 @@ public:
nux::RWProperty<FormFactor> form_factor;
nux::Property<bool> is_standalone;
nux::ROProperty<DesktopType> desktop_type;
+ nux::ROProperty<bool> pam_check_account_type;
nux::ROProperty<bool> double_click_activate;
nux::Property<unsigned> lim_movement_thresold;
nux::Property<unsigned> lim_double_click_wait;