summaryrefslogtreecommitdiff
diff options
-rw-r--r--CMakeLists.txt4
-rw-r--r--UnityCore/DBusIndicators.cpp9
-rw-r--r--UnityCore/DBusIndicators.h2
-rw-r--r--lockscreen/CMakeLists.txt4
-rw-r--r--lockscreen/LockScreenShield.cpp23
-rw-r--r--lockscreen/LockScreenShield.h5
-rw-r--r--lockscreen/StandaloneLockScreen.cpp16
-rw-r--r--plugins/unityshell/CMakeLists.txt6
-rw-r--r--plugins/unityshell/src/unityshell.cpp44
-rw-r--r--plugins/unityshell/src/unityshell.h2
-rw-r--r--services/CMakeLists.txt3
-rw-r--r--services/panel-main.c23
-rw-r--r--services/panel-service.c15
-rw-r--r--services/panel-service.h2
-rw-r--r--services/unity-panel-service.conf.in2
-rw-r--r--unity-shared/UScreen.cpp4
16 files changed, 130 insertions, 34 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index d5cf1f70a..0ae7b8bfa 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -236,6 +236,10 @@ set(UNITY_PLUGIN_SHARED_DEPS
unity-misc>=0.4.0
xpathselect=1.4
zeitgeist-2.0
+ libupstart
+ libnih
+ libnih-dbus
+ dbus-1
)
set(UNITY_PLUGIN_DEPS ${UNITY_PLUGIN_SHARED_DEPS})
diff --git a/UnityCore/DBusIndicators.cpp b/UnityCore/DBusIndicators.cpp
index 29b9467e0..d73fded34 100644
--- a/UnityCore/DBusIndicators.cpp
+++ b/UnityCore/DBusIndicators.cpp
@@ -36,7 +36,8 @@ DECLARE_LOGGER(logger, "unity.indicator.dbus");
namespace
{
-const std::string SERVICE_NAME("com.canonical.Unity.Panel.Service");
+const std::string SERVICE_NAME_DESKTOP("com.canonical.Unity.Panel.ServiceDesktop");
+const std::string SERVICE_NAME_LOCKSCREEN("com.canonical.Unity.Panel.ServiceLockscreen");
const std::string SERVICE_PATH("/com/canonical/Unity/Panel/Service");
const std::string SERVICE_IFACE("com.canonical.Unity.Panel.Service");
} // anonymous namespace
@@ -81,7 +82,7 @@ public:
// Public Methods
-DBusIndicators::Impl::Impl(std::string const& dbus_name, DBusIndicators* owner)
+DBusIndicators::Impl::Impl(std::string const& dbus_name ,DBusIndicators* owner)
: owner_(owner)
, gproxy_(dbus_name, SERVICE_PATH, SERVICE_IFACE,
G_BUS_TYPE_SESSION, G_DBUS_PROXY_FLAGS_DO_NOT_LOAD_PROPERTIES)
@@ -389,8 +390,8 @@ void DBusIndicators::Impl::SyncGeometries(std::string const& name,
cached_locations = locations;
}
-DBusIndicators::DBusIndicators()
- : pimpl(new Impl(SERVICE_NAME, this))
+DBusIndicators::DBusIndicators(bool lockscreen_mode)
+ : pimpl(new Impl(lockscreen_mode ? SERVICE_NAME_LOCKSCREEN : SERVICE_NAME_DESKTOP, this))
{}
DBusIndicators::DBusIndicators(std::string const& dbus_name)
diff --git a/UnityCore/DBusIndicators.h b/UnityCore/DBusIndicators.h
index fe5dbc178..fc034a1be 100644
--- a/UnityCore/DBusIndicators.h
+++ b/UnityCore/DBusIndicators.h
@@ -35,7 +35,7 @@ class DBusIndicators : public Indicators
public:
typedef std::shared_ptr<DBusIndicators> Ptr;
- DBusIndicators();
+ DBusIndicators(bool lockscreen_mode = false);
~DBusIndicators();
void SyncGeometries(std::string const& name, EntryLocationMap const& locations);
diff --git a/lockscreen/CMakeLists.txt b/lockscreen/CMakeLists.txt
index 4d6a0f443..66474cbb5 100644
--- a/lockscreen/CMakeLists.txt
+++ b/lockscreen/CMakeLists.txt
@@ -25,11 +25,11 @@ set (LOCKSCREEN_SOURCES
)
add_library (lockscreen-lib STATIC ${LOCKSCREEN_SOURCES})
-add_dependencies (lockscreen-lib unity-core-${UNITY_API_VERSION} unity-shared)
+add_dependencies (lockscreen-lib unity-core-${UNITY_API_VERSION} unity-shared panel-lib)
add_pch(pch/lockscreen_pch.hh lockscreen-lib)
#
# Standalone variant
#
add_executable (lockscreen StandaloneLockScreen.cpp)
-target_link_libraries (lockscreen lockscreen-lib unity-shared unity-shared-standalone)
+target_link_libraries (lockscreen lockscreen-lib panel-lib unity-shared unity-shared-standalone)
diff --git a/lockscreen/LockScreenShield.cpp b/lockscreen/LockScreenShield.cpp
index 4ac661cf6..c30a3b26d 100644
--- a/lockscreen/LockScreenShield.cpp
+++ b/lockscreen/LockScreenShield.cpp
@@ -23,6 +23,8 @@
#include "BackgroundSettingsGnome.h" // FIXME: remove this
#include "CofView.h"
+#include "unity-shared/PanelStyle.h"
+#include "panel/PanelView.h"
#include <Nux/VLayout.h>
#include <Nux/HLayout.h>
@@ -34,19 +36,16 @@ namespace unity
{
namespace lockscreen
{
-namespace
-{
-
-}
Shield::Shield(bool is_primary)
: primary(is_primary)
, bg_settings_(new BackgroundSettingsGnome) // FIXME (andy) inject it!
{
- UpdateBackgroundTexture();
-
SetLayout(new nux::VLayout());
+ UpdateBackgroundTexture();
+ primary ? ShowPrimaryView() : ShowSecondaryView();
+
mouse_enter.connect(sigc::mem_fun(this, &Shield::OnMouseEnter));
mouse_leave.connect(sigc::mem_fun(this, &Shield::OnMouseLeave));
primary.changed.connect(sigc::mem_fun(this, &Shield::OnPrimaryChanged));
@@ -67,12 +66,13 @@ void Shield::UpdateBackgroundTexture()
void Shield::OnMouseEnter(int /*x*/, int /*y*/, unsigned long /**/, unsigned long /**/)
{
- primary = true;
+ // FIXME: does not work well!
+ //primary = true;
}
void Shield::OnMouseLeave(int /*x*/, int /**/, unsigned long /**/, unsigned long /**/)
{
- primary = false;
+ //primary = false;
}
void Shield::OnPrimaryChanged(bool value)
@@ -90,6 +90,13 @@ void Shield::ShowPrimaryView()
{
nux::Layout* main_layout = GetLayout();
main_layout->Clear();
+
+ PanelView* view = new PanelView(this, std::make_shared<indicator::DBusIndicators>(true));
+ view->SetMaximumHeight(panel::Style::Instance().panel_height);
+ view->SetOpacity(0.5);
+
+ main_layout->AddView(view);
+
}
void Shield::ShowSecondaryView()
diff --git a/lockscreen/LockScreenShield.h b/lockscreen/LockScreenShield.h
index b45043b3a..4ab285ded 100644
--- a/lockscreen/LockScreenShield.h
+++ b/lockscreen/LockScreenShield.h
@@ -20,11 +20,12 @@
#ifndef UNITY_LOCKSCREEN_SHIELD_H
#define UNITY_LOCKSCREEN_SHIELD_H
-#include <Nux/BaseWindow.h>
#include <NuxCore/Property.h>
#include <UnityCore/GLibWrapper.h>
#include <UnityCore/GLibSignal.h>
+#include "unity-shared/MockableBaseWindow.h"
+
namespace unity
{
namespace lockscreen
@@ -32,7 +33,7 @@ namespace lockscreen
class BackgroundSettings;
-class Shield : public nux::BaseWindow
+class Shield : public MockableBaseWindow
{
public:
Shield(bool is_primary);
diff --git a/lockscreen/StandaloneLockScreen.cpp b/lockscreen/StandaloneLockScreen.cpp
index cba7a30c2..43f50f1b3 100644
--- a/lockscreen/StandaloneLockScreen.cpp
+++ b/lockscreen/StandaloneLockScreen.cpp
@@ -21,12 +21,13 @@
//#include <glib/gi18n-lib.h>
#include <gtk/gtk.h>
#include <Nux/Nux.h>
-//#include <Nux/NuxTimerTickSource.h>
+#include <Nux/NuxTimerTickSource.h>
#include <Nux/WindowThread.h>
-//#include <NuxCore/AnimationController.h>
+#include <NuxCore/AnimationController.h>
#include "LockScreenController.h"
-//#include "unity-shared/UnitySettings.h"
+#include "unity-shared/PanelStyle.h"
+#include "unity-shared/UnitySettings.h"
class MockSessionManager : public unity::session::Manager
{
@@ -52,7 +53,7 @@ struct LockScreenWindow
{
LockScreenWindow()
: wt(nux::CreateGUIThread("Unity LockScreen Controller", 1024, 300, 0, &LockScreenWindow::ThreadWidgetInit, this))
- //, animation_controller(tick_source)
+ , animation_controller(tick_source)
{}
void Show()
@@ -68,10 +69,11 @@ private:
static_cast<LockScreenWindow*>(self)->Init();
}
- //unity::Settings settings;
+ unity::Settings settings;
+ unity::panel::Style panel_style;
std::shared_ptr<nux::WindowThread> wt;
- //nux::NuxTimerTickSource tick_source;
- //nux::animation::AnimationController animation_controller;
+ nux::NuxTimerTickSource tick_source;
+ nux::animation::AnimationController animation_controller;
std::shared_ptr<unity::lockscreen::Controller> controller;
};
diff --git a/plugins/unityshell/CMakeLists.txt b/plugins/unityshell/CMakeLists.txt
index 401c92cad..0bd61ec67 100644
--- a/plugins/unityshell/CMakeLists.txt
+++ b/plugins/unityshell/CMakeLists.txt
@@ -13,7 +13,7 @@ endif()
compiz_plugin (unityshell
PKGDEPS ${UNITY_PLUGIN_DEPS}
PLUGINDEPS composite opengl compiztoolbox scale
- CFLAGSADD "-DINSTALLPREFIX='\"${CMAKE_INSTALL_PREFIX}\"' -DPKGDATADIR='\"${PKGDATADIR}\"' -I${CMAKE_BINARY_DIR} -I${CMAKE_SOURCE_DIR} ${BOOT_LOGGER_FLAG} -DGETTEXT_PACKAGE='\"unity\"' ${MAINTAINER_CXXFLAGS} -I${CMAKE_SOURCE_DIR}/dash/ -I${CMAKE_SOURCE_DIR}/launcher/ -I${CMAKE_SOURCE_DIR}/hud/ -I${CMAKE_SOURCE_DIR}/panel/ -I${CMAKE_SOURCE_DIR}/shortcuts/ -I${CMAKE_SOURCE_DIR}/shutdown/ -I${CMAKE_SOURCE_DIR}/unity-shared/"
+ CFLAGSADD "-DINSTALLPREFIX='\"${CMAKE_INSTALL_PREFIX}\"' -DPKGDATADIR='\"${PKGDATADIR}\"' -I${CMAKE_BINARY_DIR} -I${CMAKE_SOURCE_DIR} ${BOOT_LOGGER_FLAG} -DGETTEXT_PACKAGE='\"unity\"' ${MAINTAINER_CXXFLAGS} -I${CMAKE_SOURCE_DIR}/dash/ -I${CMAKE_SOURCE_DIR}/launcher/ -I${CMAKE_SOURCE_DIR}/lockscreen/ -I${CMAKE_SOURCE_DIR}/hud/ -I${CMAKE_SOURCE_DIR}/panel/ -I${CMAKE_SOURCE_DIR}/shortcuts/ -I${CMAKE_SOURCE_DIR}/shutdown/ -I${CMAKE_SOURCE_DIR}/unity-shared/"
LIBDIRS "${CMAKE_BINARY_DIR}/UnityCore"
)
@@ -21,8 +21,8 @@ if(revert_compiz)
set (CMAKE_BUILD_TYPE "" CACHE STRING "Build type (Debug/Release/RelWithDebInfo/MinSizeRe)" FORCE)
endif()
-add_dependencies(unityshell unity-core-${UNITY_API_VERSION} dash-lib launcher-lib switcher-lib hud-lib panel-lib shortcuts-lib shutdown-lib unity-shared unity-shared-compiz)
-target_link_libraries(unityshell unity-core-${UNITY_API_VERSION} launcher-lib dash-lib switcher-lib hud-lib panel-lib shortcuts-lib shutdown-lib unity-shared unity-shared-bamf unity-shared-compiz)
+add_dependencies(unityshell unity-core-${UNITY_API_VERSION} dash-lib launcher-lib lockscreen-lib switcher-lib hud-lib panel-lib shortcuts-lib shutdown-lib unity-shared unity-shared-compiz)
+target_link_libraries(unityshell unity-core-${UNITY_API_VERSION} launcher-lib lockscreen-lib dash-lib switcher-lib hud-lib panel-lib shortcuts-lib shutdown-lib unity-shared unity-shared-bamf unity-shared-compiz)
set_target_properties(unityshell
PROPERTIES INSTALL_RPATH "${CACHED_UNITY_PRIVATE_DEPS_LIBRARY_DIRS}"
INSTALL_RPATH_USE_LINK_PATH TRUE)
diff --git a/plugins/unityshell/src/unityshell.cpp b/plugins/unityshell/src/unityshell.cpp
index 3601ffbb8..46c92b6d6 100644
--- a/plugins/unityshell/src/unityshell.cpp
+++ b/plugins/unityshell/src/unityshell.cpp
@@ -71,6 +71,11 @@
#include "UBusWrapper.h"
#include "UScreen.h"
+#include <upstart.h>
+#include <nih/alloc.h>
+#include <nih/error.h>
+
+
#include "config.h"
/* FIXME: once we get a better method to add the toplevel windows to
@@ -3487,6 +3492,45 @@ void UnityScreen::initLauncher()
session_controller_ = std::make_shared<session::Controller>(manager);
AddChild(session_controller_.get());
+ // Setup Lockscreen Controller
+ lockscreen_controller_ = std::make_shared<lockscreen::Controller>(manager);
+ manager->lock_requested();
+
+ {
+ NihDBusProxy * upstart;
+ const gchar *upstartsession = g_getenv ("UPSTART_SESSION");
+ if (upstartsession != NULL)
+ {
+ DBusConnection *conn = dbus_connection_open (upstartsession, NULL);
+ if (conn != NULL)
+ {
+ upstart = nih_dbus_proxy_new (NULL, conn,
+ NULL,
+ DBUS_PATH_UPSTART,
+ NULL, NULL);
+ if (upstart == NULL)
+ {
+ NihError * err = nih_error_get();
+ g_warning("Unable to get Upstart proxy: %s", err->message);
+ nih_free(err);
+ }
+ dbus_connection_unref (conn);
+ }
+ }
+
+ int event_sent = 0;
+ event_sent = upstart_emit_event_sync (NULL, upstart,
+ "desktop-lock", NULL, 0);
+ if (event_sent != 0)
+ {
+ NihError * err = nih_error_get();
+ g_warning("Unable to signal for indicator services to stop: %s", err->message);
+ nih_free(err);
+ }
+
+ nih_unref (upstart, NULL);
+ }
+
launcher_controller_->launcher().size_changed.connect([this] (nux::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 */
diff --git a/plugins/unityshell/src/unityshell.h b/plugins/unityshell/src/unityshell.h
index 56b389b4b..54c095d7a 100644
--- a/plugins/unityshell/src/unityshell.h
+++ b/plugins/unityshell/src/unityshell.h
@@ -58,6 +58,7 @@
#include "FontSettings.h"
#include "ShortcutController.h"
#include "LauncherController.h"
+#include "LockScreenController.h"
#include "PanelController.h"
#include "PanelStyle.h"
#include "UScreen.h"
@@ -301,6 +302,7 @@ private:
hud::Controller::Ptr hud_controller_;
shortcut::Controller::Ptr shortcut_controller_;
session::Controller::Ptr session_controller_;
+ std::shared_ptr<lockscreen::Controller> lockscreen_controller_;
debug::DebugDBusInterface debugger_;
std::unique_ptr<BGHash> bghash_;
diff --git a/services/CMakeLists.txt b/services/CMakeLists.txt
index 8ce92ca10..103c8854c 100644
--- a/services/CMakeLists.txt
+++ b/services/CMakeLists.txt
@@ -58,3 +58,6 @@ install(TARGETS unity-panel-service DESTINATION ${CMAKE_INSTALL_PREFIX}/lib/unit
configure_file(unity-panel-service.conf.in ${CMAKE_CURRENT_BINARY_DIR}/unity-panel-service.conf)
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/unity-panel-service.conf DESTINATION ${CMAKE_INSTALL_PREFIX}/share/upstart/sessions)
+
+configure_file(unity-panel-service-lockscreen.conf.in ${CMAKE_CURRENT_BINARY_DIR}/unity-panel-service-lockscreen.conf)
+install(FILES ${CMAKE_CURRENT_BINARY_DIR}/unity-panel-service-lockscreen.conf DESTINATION ${CMAKE_INSTALL_PREFIX}/share/upstart/sessions)
diff --git a/services/panel-main.c b/services/panel-main.c
index a43304e66..142cc1c8d 100644
--- a/services/panel-main.c
+++ b/services/panel-main.c
@@ -91,7 +91,8 @@ static const gchar introspection_xml[] =
" </interface>"
"</node>";
-#define S_NAME "com.canonical.Unity.Panel.Service"
+#define S_NAME_DESKTOP "com.canonical.Unity.Panel.ServiceDesktop"
+#define S_NAME_LOCKSCREEN "com.canonical.Unity.Panel.ServiceLockscreen"
#define S_PATH "/com/canonical/Unity/Panel/Service"
#define S_IFACE "com.canonical.Unity.Panel.Service"
@@ -381,6 +382,13 @@ main (gint argc, gchar **argv)
{
PanelService *service;
guint owner_id;
+ gboolean lockscreen_mode = FALSE;
+ GError *error = NULL;
+ GOptionContext *context;
+ GOptionEntry entries[] = {
+ { "lockscreen-mode", 0, 0, G_OPTION_ARG_NONE, &lockscreen_mode, "Average over N repetitions", NULL },
+ { NULL }};
+
g_unsetenv ("UBUNTU_MENUPROXY");
g_setenv ("NO_AT_BRIDGE", "1", TRUE);
@@ -391,6 +399,17 @@ main (gint argc, gchar **argv)
INDICATORICONDIR);
ido_init ();
+ context = g_option_context_new ("- Unity Panel Service");
+ g_option_context_add_main_entries (context, entries, GETTEXT_PACKAGE);
+ if (!g_option_context_parse (context, &argc, &argv, &error))
+ {
+ g_print ("unity-panel-service: %s\n", error->message);
+ g_print ("Try --help for more information.\n");
+ return 1;
+ }
+
+ panel_service_set_lockscreen_mode (lockscreen_mode);
+
if (g_getenv ("SILENT_PANEL_SERVICE") != NULL)
{
g_log_set_default_handler (discard_log_message, NULL);
@@ -404,7 +423,7 @@ main (gint argc, gchar **argv)
service = panel_service_get_default ();
owner_id = g_bus_own_name (G_BUS_TYPE_SESSION,
- S_NAME,
+ !lockscreen_mode ? S_NAME_DESKTOP : S_NAME_LOCKSCREEN,
G_BUS_NAME_OWNER_FLAGS_NONE,
on_bus_acquired,
on_name_acquired,
diff --git a/services/panel-service.c b/services/panel-service.c
index 22bc2a311..c746e97c5 100644
--- a/services/panel-service.c
+++ b/services/panel-service.c
@@ -53,6 +53,7 @@ G_DEFINE_TYPE (PanelService, panel_service, G_TYPE_OBJECT);
#define SHOW_HUD_KEY "show-hud"
static PanelService *static_service = NULL;
+static gboolean lockscreen_mode = FALSE;
struct _PanelServicePrivate
{
@@ -826,7 +827,11 @@ initial_load_default_or_custom_indicators (PanelService *self, GList *indicators
if (!indicators)
{
- load_indicators (self);
+ if (!lockscreen_mode)
+ {
+ load_indicators (self);
+ }
+
load_indicators_from_indicator_files (self);
sort_indicators (self);
}
@@ -875,6 +880,12 @@ panel_service_get_default_with_indicators (GList *indicators)
return self;
}
+void
+panel_service_set_lockscreen_mode (gboolean enable)
+{
+ lockscreen_mode = enable;
+}
+
guint
panel_service_get_n_indicators (PanelService *self)
{
@@ -1280,7 +1291,7 @@ load_indicators_from_indicator_files (PanelService *self)
IndicatorNg *indicator;
filename = g_build_filename (INDICATOR_SERVICE_DIR, name, NULL);
- indicator = indicator_ng_new_for_profile (filename, "desktop", &error);
+ indicator = indicator_ng_new_for_profile (filename, !lockscreen_mode ? "desktop" : "desktop_greeter", &error);
if (indicator)
{
load_indicator (self, INDICATOR_OBJECT (indicator), name);
diff --git a/services/panel-service.h b/services/panel-service.h
index 06d5c35f0..ad2195e77 100644
--- a/services/panel-service.h
+++ b/services/panel-service.h
@@ -71,6 +71,8 @@ GType panel_service_get_type (void) G_GNUC_CONST;
PanelService * panel_service_get_default ();
PanelService * panel_service_get_default_with_indicators (GList *indicators);
+void panel_service_set_lockscreen_mode (gboolean enable);
+
guint panel_service_get_n_indicators (PanelService *self);
IndicatorObject * panel_service_get_indicator_nth (PanelService *self, guint position);
diff --git a/services/unity-panel-service.conf.in b/services/unity-panel-service.conf.in
index 742e39b1f..3d15a5969 100644
--- a/services/unity-panel-service.conf.in
+++ b/services/unity-panel-service.conf.in
@@ -15,4 +15,4 @@ emits indicator-services-start
emits indicator-services-end
respawn
-exec ${CMAKE_INSTALL_PREFIX}/lib/unity/unity-panel-service
+exec ${CMAKE_INSTALL_PREFIX}/lib/unity/unity-panel-service --lockscreen-mode
diff --git a/unity-shared/UScreen.cpp b/unity-shared/UScreen.cpp
index 35a0f4f8a..4a52331ac 100644
--- a/unity-shared/UScreen.cpp
+++ b/unity-shared/UScreen.cpp
@@ -86,9 +86,9 @@ nux::Geometry& UScreen::GetMonitorGeometry(int monitor)
std::vector<nux::Geometry>& UScreen::GetMonitors()
{
- monitors_.clear();
+ /*monitors_.clear();
monitors_.push_back(nux::Geometry(0,0,800,500));
- monitors_.push_back(nux::Geometry(800,200,500,300));
+ monitors_.push_back(nux::Geometry(800,200,500,300));*/
return monitors_;
}