Merge lp:~unity-team/unity/7.2.4 into lp:unity/7.2

Proposed by Stephen M. Webb
Status: Merged
Approved by: Marco Trevisan (Treviño)
Approved revision: no longer in the source branch.
Merged at revision: 3806
Proposed branch: lp:~unity-team/unity/7.2.4
Merge into: lp:unity/7.2
Diff against target: 6023 lines (+2168/-709)
105 files modified
CMakeLists.txt (+1/-0)
UnityCore/DBusIndicators.cpp (+11/-0)
UnityCore/DBusIndicators.h (+1/-0)
UnityCore/DesktopUtilities.cpp (+12/-0)
UnityCore/DesktopUtilities.h (+1/-0)
UnityCore/GLibDBusProxy.cpp (+100/-3)
UnityCore/GLibDBusProxy.h (+6/-0)
UnityCore/GLibWrapper-inl.h (+12/-0)
UnityCore/GLibWrapper.h (+1/-0)
UnityCore/GnomeSessionManager.cpp (+0/-1)
UnityCore/Indicators.h (+1/-0)
dash/FilterBasicButton.cpp (+6/-3)
dash/previews/ActionButton.cpp (+5/-2)
dash/previews/ErrorPreview.cpp (+1/-0)
dash/previews/PaymentPreview.cpp (+3/-1)
data/CMakeLists.txt (+1/-0)
data/pam/CMakeLists.txt (+1/-0)
data/pam/unity (+2/-0)
debian/changelog (+59/-0)
debian/rules (+1/-1)
debian/unity.install (+1/-0)
debian/unity.migrations (+1/-0)
decorations/DecoratedWindow.cpp (+155/-64)
decorations/DecorationsEdgeBorders.cpp (+32/-19)
decorations/DecorationsForceQuitDialog.cpp (+17/-3)
decorations/DecorationsManager.cpp (+17/-26)
decorations/DecorationsPriv.h (+12/-3)
decorations/DecorationsTitle.cpp (+1/-0)
decorations/DecorationsWidgets.cpp (+13/-1)
decorations/DecorationsWidgets.h (+5/-0)
doc/unity.1 (+35/-10)
hud/HudIconTextureSource.cpp (+0/-5)
hud/HudIconTextureSource.h (+0/-1)
launcher/ApplicationLauncherIcon.cpp (+2/-0)
launcher/DesktopLauncherIcon.cpp (+13/-1)
launcher/DesktopLauncherIcon.h (+2/-0)
launcher/Launcher.cpp (+1/-3)
launcher/LauncherIcon.cpp (+117/-104)
launcher/LauncherIcon.h (+12/-8)
launcher/MockLauncherIcon.h (+0/-5)
launcher/SwitcherView.cpp (+9/-1)
launcher/Tooltip.cpp (+5/-4)
lockscreen/BackgroundSettings.cpp (+13/-11)
lockscreen/BackgroundSettings.h (+0/-1)
lockscreen/CMakeLists.txt (+2/-0)
lockscreen/CofView.cpp (+15/-2)
lockscreen/CofView.h (+3/-1)
lockscreen/LockScreenAbstractShield.h (+14/-1)
lockscreen/LockScreenController.cpp (+54/-14)
lockscreen/LockScreenController.h (+12/-3)
lockscreen/LockScreenPanel.cpp (+31/-2)
lockscreen/LockScreenSettings.cpp (+2/-0)
lockscreen/LockScreenSettings.h (+2/-1)
lockscreen/LockScreenShield.cpp (+60/-29)
lockscreen/LockScreenShield.h (+10/-3)
lockscreen/LockScreenShieldFactory.cpp (+7/-2)
lockscreen/LockScreenShieldFactory.h (+12/-2)
lockscreen/ShutdownNotifier.cpp (+152/-0)
lockscreen/ShutdownNotifier.h (+51/-0)
lockscreen/SuspendNotifier.cpp (+153/-0)
lockscreen/SuspendNotifier.h (+51/-0)
lockscreen/UserAuthenticatorPam.cpp (+1/-2)
lockscreen/UserPromptView.cpp (+96/-17)
lockscreen/UserPromptView.h (+5/-4)
panel/PanelIndicatorEntryView.cpp (+1/-1)
panel/PanelMenuView.cpp (+83/-38)
panel/PanelMenuView.h (+1/-1)
plugins/unityshell/src/unityshell.cpp (+29/-35)
plugins/unityshell/src/unityshell.h (+2/-2)
services/panel-main.c (+8/-0)
services/panel-service.c (+15/-0)
services/panel-service.h (+2/-0)
tests/CMakeLists.txt (+1/-1)
tests/mock_indicators.h (+1/-0)
tests/test_lockscreen_controller.cpp (+10/-2)
tests/test_main_xless.cpp (+4/-5)
tests/test_previews_music_payment.cpp (+1/-0)
tests/test_text_input.cpp (+1/-0)
tools/migration-scripts/03_unity_first_run_stamp_move (+35/-0)
unity-shared/CompizUtils.cpp (+77/-58)
unity-shared/CompizUtils.h (+36/-5)
unity-shared/DashStyle.cpp (+8/-11)
unity-shared/DecorationStyle.cpp (+2/-2)
unity-shared/GnomeKeyGrabber.cpp (+9/-0)
unity-shared/IconRenderer.cpp (+73/-43)
unity-shared/IconRenderer.h (+0/-2)
unity-shared/IconTexture.cpp (+1/-1)
unity-shared/IconTextureSource.cpp (+37/-1)
unity-shared/IconTextureSource.h (+10/-4)
unity-shared/LayoutSystem.cpp (+28/-4)
unity-shared/LayoutSystem.h (+2/-1)
unity-shared/PluginAdapter.cpp (+39/-2)
unity-shared/PluginAdapter.h (+3/-0)
unity-shared/SearchBar.cpp (+18/-12)
unity-shared/SearchBar.h (+9/-9)
unity-shared/SearchBarSpinner.h (+0/-2)
unity-shared/SpreadFilter.cpp (+3/-1)
unity-shared/StandaloneWindowManager.h (+2/-0)
unity-shared/TextInput.cpp (+138/-76)
unity-shared/TextInput.h (+17/-19)
unity-shared/UScreen.cpp (+26/-4)
unity-shared/UScreen.h (+0/-1)
unity-shared/UnitySettings.cpp (+9/-1)
unity-shared/WindowManager.h (+5/-0)
unity-shared/XWindowManager.cpp (+1/-1)
To merge this branch: bzr merge lp:~unity-team/unity/7.2.4
Reviewer Review Type Date Requested Status
Marco Trevisan (Treviño) Approve
Review via email: mp+244802@code.launchpad.net

Commit message

release 7.2.4

Description of the change

Backported fixes for Trusty SRU-4.

 [ Andrea Azzarone ]
 * Share lockscreen password between screens (lp: #1308540)
 * Allow a distinct pam config file for greeter and for lock-screen.
 (lp: #1305440)
 * Add an arrow activator in the lockscreen. (lp: #1332509)
 * Make sure GetScreenGeometry returns the correct value (lp: #1374785).

 [ Brandon Schaefer ]
 * fix tooltip for the "Show Desktop / Restore Windows" icon in the Alt-Tab
   switcher (lp: #1237132)
 * Use CONFIG instead of CACHE to store the first_run.stamp (lp: #1328677)

 [ Eleni Maria Stea ]
 * LayoutSystem: make sure the exposed open windows are displayed in the
   preserved order (lp: #1349281).

 [ handsome_feng ]
 * added support for getting the distro name from /etc/os-release
 (lp: #1329584)

 [ Iain Lane ]
 * When grabbing keys, try prefixing "XF86" if the key isn't found. GNOME
   gives us unprefixed keys sometimes (lp: #1302885).

 [ Marco Trevisan (Treviño) ]
 * make the Launcher icon count badge width depend on the text value width
   and scaling (lp: #1353070) (lp: #1354498) (lp: #796527) (lp: #1066971)
   (lp: #1361713)
 * DecoratedWindow: make edges independent from borders and properly update
   them on actions change (lp: #1276177), (lp: #1299741), (lp: #1301776),
   (lp: #1324104), (lp: #1364225), (lp: #1373695)
 * Lockscreen: scale the UI elements based on current monitor scaling
   (lp: #1292218)
 * UnityScreen: when filtering out windows in spread, make sure we unscale
   them (lp: #1316265).
 * PanelMenuView: ensure that proper window tiles and buttons are shown at
   the right place (lp: #1384910) (lp: #1384958) (lp: #1385285)
 * SearchBar, ActionButtons, IconRenderer: include the font scaling when
   scaling textual items (lp: #1332947) (lp: #1361751) (lp: #1362162)
   (lp: #1362346).
 * ApplicationLauncherIcon: make sure we close the dash if DnD is accepted
   and the application window is about to be focused (lp: #1350331).
 * SwitcherView: set progress on icon render args (lp: #1361679).
 * LockScreenController: wait for the primary shield to get the grab
   before setting the session locked (lp: #1368427) (lp: #1371764).

 [ Stephen M. Webb ]
 * updated the unity(1) manpage to match the actual command (lp: #1059275)
 * packaging version bump

To post a comment you must log in.
Revision history for this message
Marco Trevisan (Treviño) (3v1n0) wrote :

Looks good!

There are some old fixes for bugs #1363534 and #1351591 that are not included here, but we might include them later.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'CMakeLists.txt'
--- CMakeLists.txt 2014-10-29 16:43:57 +0000
+++ CMakeLists.txt 2014-12-17 12:14:47 +0000
@@ -259,6 +259,7 @@
259add_subdirectory(unity-shared)259add_subdirectory(unity-shared)
260add_subdirectory(dash)260add_subdirectory(dash)
261add_subdirectory(launcher)261add_subdirectory(launcher)
262add_subdirectory(data)
262if (ENABLE_X_SUPPORT)263if (ENABLE_X_SUPPORT)
263 add_subdirectory(hud)264 add_subdirectory(hud)
264 add_subdirectory(lockscreen)265 add_subdirectory(lockscreen)
265266
=== modified file 'UnityCore/DBusIndicators.cpp'
--- UnityCore/DBusIndicators.cpp 2014-03-05 17:19:50 +0000
+++ UnityCore/DBusIndicators.cpp 2014-12-17 12:14:47 +0000
@@ -55,6 +55,7 @@
55 void Sync(GVariant* args, glib::Error const&);55 void Sync(GVariant* args, glib::Error const&);
56 void SyncGeometries(std::string const& name, EntryLocationMap const& locations);56 void SyncGeometries(std::string const& name, EntryLocationMap const& locations);
57 void ShowEntriesDropdown(Indicator::Entries const&, Entry::Ptr const&, unsigned xid, int x, int y);57 void ShowEntriesDropdown(Indicator::Entries const&, Entry::Ptr const&, unsigned xid, int x, int y);
58 void CloseActiveEntry();
5859
59 void OnConnected();60 void OnConnected();
60 void OnDisconnected();61 void OnDisconnected();
@@ -313,6 +314,11 @@
313 gproxy_.Call("ScrollEntry", g_variant_new("(si)", entry_id.c_str(), delta));314 gproxy_.Call("ScrollEntry", g_variant_new("(si)", entry_id.c_str(), delta));
314}315}
315316
317void DBusIndicators::Impl::CloseActiveEntry()
318{
319 gproxy_.Call("CloseActiveEntry");
320}
321
316void DBusIndicators::Impl::Sync(GVariant* args, glib::Error const& error)322void DBusIndicators::Impl::Sync(GVariant* args, glib::Error const& error)
317{323{
318 if (!args || error)324 if (!args || error)
@@ -489,6 +495,11 @@
489 pimpl->ShowEntriesDropdown(entries, selected, xid, x, y);495 pimpl->ShowEntriesDropdown(entries, selected, xid, x, y);
490}496}
491497
498void DBusIndicators::CloseActiveEntry()
499{
500 pimpl->CloseActiveEntry();
501}
502
492void DBusIndicators::OnEntryScroll(std::string const& entry_id, int delta)503void DBusIndicators::OnEntryScroll(std::string const& entry_id, int delta)
493{504{
494 pimpl->OnEntryScroll(entry_id, delta);505 pimpl->OnEntryScroll(entry_id, delta);
495506
=== modified file 'UnityCore/DBusIndicators.h'
--- UnityCore/DBusIndicators.h 2014-03-04 13:14:12 +0000
+++ UnityCore/DBusIndicators.h 2014-12-17 12:14:47 +0000
@@ -40,6 +40,7 @@
40 std::vector<std::string> const& IconPaths() const;40 std::vector<std::string> const& IconPaths() const;
41 void ShowEntriesDropdown(Indicator::Entries const&, Entry::Ptr const&, unsigned xid, int x, int y);41 void ShowEntriesDropdown(Indicator::Entries const&, Entry::Ptr const&, unsigned xid, int x, int y);
42 void SyncGeometries(std::string const& name, EntryLocationMap const& locations);42 void SyncGeometries(std::string const& name, EntryLocationMap const& locations);
43 void CloseActiveEntry();
4344
44protected:45protected:
45 virtual void OnEntryScroll(std::string const& entry_id, int delta);46 virtual void OnEntryScroll(std::string const& entry_id, int delta);
4647
=== modified file 'UnityCore/DesktopUtilities.cpp'
--- UnityCore/DesktopUtilities.cpp 2014-04-16 22:17:11 +0000
+++ UnityCore/DesktopUtilities.cpp 2014-12-17 12:14:47 +0000
@@ -66,6 +66,18 @@
66 return "";66 return "";
67}67}
6868
69std::string DesktopUtilities::GetUserConfigDirectory()
70{
71 const char *config_dir = g_get_user_config_dir();
72 auto unity_config = glib::gchar_to_string(config_dir).append(G_DIR_SEPARATOR_S "unity" G_DIR_SEPARATOR_S);
73
74 if (g_mkdir_with_parents(unity_config.c_str(), 0700) >= 0)
75 return unity_config;
76
77 LOG_ERROR(logger) << "Impossible to create unity config folder '"<< unity_config <<"' !";
78 return "";
79}
80
69std::string DesktopUtilities::GetUserRuntimeDirectory()81std::string DesktopUtilities::GetUserRuntimeDirectory()
70{82{
71 const char *runtime_dir = g_get_user_runtime_dir();83 const char *runtime_dir = g_get_user_runtime_dir();
7284
=== modified file 'UnityCore/DesktopUtilities.h'
--- UnityCore/DesktopUtilities.h 2014-04-16 22:17:11 +0000
+++ UnityCore/DesktopUtilities.h 2014-12-17 12:14:47 +0000
@@ -32,6 +32,7 @@
32 static std::string GetUserDataDirectory();32 static std::string GetUserDataDirectory();
33 static std::string GetUserCacheDirectory();33 static std::string GetUserCacheDirectory();
34 static std::string GetUserRuntimeDirectory();34 static std::string GetUserRuntimeDirectory();
35 static std::string GetUserConfigDirectory();
35 static std::vector<std::string> GetSystemDataDirectories();36 static std::vector<std::string> GetSystemDataDirectories();
36 static std::vector<std::string> GetDataDirectories();37 static std::vector<std::string> GetDataDirectories();
3738
3839
=== modified file 'UnityCore/GLibDBusProxy.cpp'
--- UnityCore/GLibDBusProxy.cpp 2013-11-19 18:48:35 +0000
+++ UnityCore/GLibDBusProxy.cpp 2014-12-17 12:14:47 +0000
@@ -21,7 +21,7 @@
2121
22#include "GLibDBusProxy.h"22#include "GLibDBusProxy.h"
2323
24#include <map>24#include <unordered_map>
25#include <memory>25#include <memory>
26#include <NuxCore/Logger.h>26#include <NuxCore/Logger.h>
27#include <vector>27#include <vector>
@@ -30,6 +30,8 @@
30#include "GLibSignal.h"30#include "GLibSignal.h"
31#include "GLibSource.h"31#include "GLibSource.h"
3232
33#include <gio/gunixfdlist.h>
34
33namespace unity35namespace unity
34{36{
35namespace glib37namespace glib
@@ -47,7 +49,7 @@
47{49{
48public:50public:
49 typedef std::vector<ReplyCallback> Callbacks;51 typedef std::vector<ReplyCallback> Callbacks;
50 typedef std::map<string, Callbacks> SignalHandlers;52 typedef std::unordered_map<string, Callbacks> SignalHandlers;
5153
52 Impl(DBusProxy* owner,54 Impl(DBusProxy* owner,
53 string const& name,55 string const& name,
@@ -74,6 +76,12 @@
74 GCancellable *cancellable,76 GCancellable *cancellable,
75 GDBusCallFlags flags,77 GDBusCallFlags flags,
76 int timeout_msec);78 int timeout_msec);
79 void CallWithUnixFdList(std::string const& method_name,
80 GVariant* parameters,
81 CallFinishedCallback const& callback,
82 GCancellable *cancellable,
83 GDBusCallFlags flags,
84 int timeout_msec);
7785
78 void Connect(string const& signal_name, ReplyCallback const& callback);86 void Connect(string const& signal_name, ReplyCallback const& callback);
79 void DisconnectSignal(string const& signal_name);87 void DisconnectSignal(string const& signal_name);
@@ -85,6 +93,7 @@
8593
86 static void OnProxyConnectCallback(GObject* source, GAsyncResult* res, gpointer impl);94 static void OnProxyConnectCallback(GObject* source, GAsyncResult* res, gpointer impl);
87 static void OnCallCallback(GObject* source, GAsyncResult* res, gpointer call_data);95 static void OnCallCallback(GObject* source, GAsyncResult* res, gpointer call_data);
96 static void OnCallWithUnixFdListCallback(GObject* source, GAsyncResult* res, gpointer call_data);
8897
89 struct CallData98 struct CallData
90 {99 {
@@ -399,6 +408,50 @@
399 data);408 data);
400}409}
401410
411void DBusProxy::Impl::CallWithUnixFdList(string const& method_name,
412 GVariant* parameters,
413 CallFinishedCallback const& callback,
414 GCancellable* cancellable,
415 GDBusCallFlags flags,
416 int timeout_msec)
417{
418 GCancellable* target_canc = cancellable != NULL ? cancellable : cancellable_;
419
420 if (!proxy_)
421 {
422 glib::Variant sinked_parameters(parameters);
423 glib::Object<GCancellable> canc(target_canc, glib::AddRef());
424 WaitForProxy(canc, timeout_msec, [this, method_name, sinked_parameters, callback, canc, flags, timeout_msec] (glib::Error const& err)
425 {
426 if (err)
427 {
428 callback(glib::Variant(), err);
429 LOG_WARNING(logger) << "Cannot call method " << method_name
430 << ": " << err;
431 }
432 else
433 {
434 CallWithUnixFdList(method_name, sinked_parameters, callback, canc, flags, timeout_msec);
435 }
436 });
437 return;
438 }
439
440 CallData* data = new CallData();
441 data->callback = callback;
442 data->method_name = method_name;
443
444 g_dbus_proxy_call_with_unix_fd_list(proxy_,
445 method_name.c_str(),
446 parameters,
447 flags,
448 timeout_msec,
449 nullptr,
450 target_canc,
451 DBusProxy::Impl::OnCallWithUnixFdListCallback,
452 data);
453}
454
402void DBusProxy::Impl::OnCallCallback(GObject* source, GAsyncResult* res, gpointer call_data)455void DBusProxy::Impl::OnCallCallback(GObject* source, GAsyncResult* res, gpointer call_data)
403{456{
404 glib::Error error;457 glib::Error error;
@@ -407,7 +460,7 @@
407460
408 if (error)461 if (error)
409 {462 {
410 if (g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED))463 if (g_error_matches(error, G_IO_ERROR, G_IO_ERROR_CANCELLED))
411 {464 {
412 // silently ignore, don't even invoke callback, FIXME: really?465 // silently ignore, don't even invoke callback, FIXME: really?
413 return;466 return;
@@ -425,6 +478,39 @@
425 data->callback(result, error);478 data->callback(result, error);
426}479}
427480
481void DBusProxy::Impl::OnCallWithUnixFdListCallback(GObject* source, GAsyncResult* res, gpointer call_data)
482{
483 glib::Object<GUnixFDList> fd_list;
484
485 glib::Error error;
486 std::unique_ptr<CallData> data(static_cast<CallData*>(call_data));
487 glib::Variant result(g_dbus_proxy_call_with_unix_fd_list_finish(G_DBUS_PROXY(source), &fd_list, res, &error), glib::StealRef());
488
489 if (error)
490 {
491 if (g_error_matches(error, G_IO_ERROR, G_IO_ERROR_CANCELLED))
492 {
493 // silently ignore, don't even invoke callback, FIXME: really?
494 return;
495 }
496 else
497 {
498 LOG_WARNING(logger) << "Calling method \"" << data->method_name
499 << "\" on object path: \""
500 << g_dbus_proxy_get_object_path(G_DBUS_PROXY(source))
501 << "\" failed: " << error;
502 }
503 }
504
505 if (data->callback)
506 {
507 gint idx;
508 g_variant_get(result, "(h)", &idx);
509 gint fd = g_unix_fd_list_get(fd_list, idx, nullptr);
510 data->callback(glib::Variant(fd), error);
511 }
512}
513
428void DBusProxy::Impl::Connect(std::string const& signal_name, ReplyCallback const& callback)514void DBusProxy::Impl::Connect(std::string const& signal_name, ReplyCallback const& callback)
429{515{
430 if (!callback)516 if (!callback)
@@ -487,6 +573,17 @@
487 timeout_msec);573 timeout_msec);
488}574}
489575
576void DBusProxy::CallWithUnixFdList(std::string const& method_name,
577 GVariant* parameters,
578 CallFinishedCallback const& callback,
579 GCancellable *cancellable,
580 GDBusCallFlags flags,
581 int timeout_msec)
582{
583 pimpl->CallWithUnixFdList(method_name, parameters, callback, cancellable,
584 flags, timeout_msec);
585}
586
490glib::Variant DBusProxy::GetProperty(std::string const& name) const587glib::Variant DBusProxy::GetProperty(std::string const& name) const
491{588{
492 if (IsConnected())589 if (IsConnected())
493590
=== modified file 'UnityCore/GLibDBusProxy.h'
--- UnityCore/GLibDBusProxy.h 2013-03-25 12:09:41 +0000
+++ UnityCore/GLibDBusProxy.h 2014-12-17 12:14:47 +0000
@@ -64,6 +64,12 @@
64 GCancellable *cancellable = nullptr,64 GCancellable *cancellable = nullptr,
65 GDBusCallFlags flags = G_DBUS_CALL_FLAGS_NONE,65 GDBusCallFlags flags = G_DBUS_CALL_FLAGS_NONE,
66 int timeout_msec = -1);66 int timeout_msec = -1);
67 void CallWithUnixFdList(std::string const& method_name,
68 GVariant* parameters = nullptr,
69 CallFinishedCallback const& callback = nullptr,
70 GCancellable *cancellable = nullptr,
71 GDBusCallFlags flags = G_DBUS_CALL_FLAGS_NONE,
72 int timeout_msec = -1);
6773
68 bool IsConnected() const;74 bool IsConnected() const;
6975
7076
=== modified file 'UnityCore/GLibWrapper-inl.h'
--- UnityCore/GLibWrapper-inl.h 2012-07-04 20:16:06 +0000
+++ UnityCore/GLibWrapper-inl.h 2014-12-17 12:14:47 +0000
@@ -94,6 +94,18 @@
94}94}
9595
96template <typename T>96template <typename T>
97T** Object<T>::operator&()
98{
99 if (object_)
100 {
101 g_object_unref(object_);
102 object_ = nullptr;
103 }
104
105 return &object_;
106}
107
108template <typename T>
97Object<T>::operator bool() const109Object<T>::operator bool() const
98{110{
99 return bool(object_);111 return bool(object_);
100112
=== modified file 'UnityCore/GLibWrapper.h'
--- UnityCore/GLibWrapper.h 2013-05-17 16:52:19 +0000
+++ UnityCore/GLibWrapper.h 2014-12-17 12:14:47 +0000
@@ -56,6 +56,7 @@
56 operator T* () const;56 operator T* () const;
57 operator bool() const;57 operator bool() const;
58 T* operator->() const;58 T* operator->() const;
59 T** operator&();
59 T* RawPtr() const;60 T* RawPtr() const;
60 // Release ownership of the object. No unref will occur.61 // Release ownership of the object. No unref will occur.
61 T* Release();62 T* Release();
6263
=== modified file 'UnityCore/GnomeSessionManager.cpp'
--- UnityCore/GnomeSessionManager.cpp 2014-07-23 18:56:11 +0000
+++ UnityCore/GnomeSessionManager.cpp 2014-12-17 12:14:47 +0000
@@ -432,7 +432,6 @@
432 return;432 return;
433 }433 }
434434
435 // FIXME (andy) we should ask gnome-session to emit the logind signal
436 prompt ? manager_->prompt_lock_requested.emit() : manager_->lock_requested.emit();435 prompt ? manager_->prompt_lock_requested.emit() : manager_->lock_requested.emit();
437}436}
438437
439438
=== modified file 'UnityCore/Indicators.h'
--- UnityCore/Indicators.h 2014-02-28 05:16:10 +0000
+++ UnityCore/Indicators.h 2014-12-17 12:14:47 +0000
@@ -44,6 +44,7 @@
4444
45 virtual void SyncGeometries(std::string const& panel, EntryLocationMap const&) = 0;45 virtual void SyncGeometries(std::string const& panel, EntryLocationMap const&) = 0;
46 virtual void ShowEntriesDropdown(Indicator::Entries const&, Entry::Ptr const&, unsigned xid, int x, int y) = 0;46 virtual void ShowEntriesDropdown(Indicator::Entries const&, Entry::Ptr const&, unsigned xid, int x, int y) = 0;
47 virtual void CloseActiveEntry() = 0;
4748
48 // Signals49 // Signals
49 sigc::signal<void, Indicator::Ptr const&> on_object_added;50 sigc::signal<void, Indicator::Ptr const&> on_object_added;
5051
=== modified file 'dash/FilterBasicButton.cpp'
--- dash/FilterBasicButton.cpp 2014-07-24 14:03:10 +0000
+++ dash/FilterBasicButton.cpp 2014-12-17 12:14:47 +0000
@@ -20,6 +20,7 @@
20 */20 */
2121
22#include "unity-shared/DashStyle.h"22#include "unity-shared/DashStyle.h"
23#include "unity-shared/UnitySettings.h"
23#include "FilterBasicButton.h"24#include "FilterBasicButton.h"
2425
25namespace unity26namespace unity
@@ -70,6 +71,7 @@
70 });71 });
7172
72 scale.changed.connect(sigc::mem_fun(this, &FilterBasicButton::UpdateScale));73 scale.changed.connect(sigc::mem_fun(this, &FilterBasicButton::UpdateScale));
74 Settings::Instance().font_scaling.changed.connect(sigc::hide(sigc::mem_fun(this, &FilterBasicButton::InitTheme)));
73}75}
7476
75void FilterBasicButton::InitTheme()77void FilterBasicButton::InitTheme()
@@ -81,11 +83,12 @@
81 normal_.reset(new nux::CairoWrapper(geo, sigc::bind(sigc::mem_fun(this, &FilterBasicButton::RedrawTheme), nux::ButtonVisualState::VISUAL_STATE_NORMAL)));83 normal_.reset(new nux::CairoWrapper(geo, sigc::bind(sigc::mem_fun(this, &FilterBasicButton::RedrawTheme), nux::ButtonVisualState::VISUAL_STATE_NORMAL)));
82 focus_.reset(new nux::CairoWrapper(geo, sigc::mem_fun(this, &FilterBasicButton::RedrawFocusOverlay)));84 focus_.reset(new nux::CairoWrapper(geo, sigc::mem_fun(this, &FilterBasicButton::RedrawFocusOverlay)));
8385
84 SetMinimumWidth(MIN_BUTTON_WIDTH.CP(scale));86 double font_scaling = Settings::Instance().font_scaling() * scale;
87 SetMinimumWidth(MIN_BUTTON_WIDTH.CP(font_scaling));
85 ApplyMinWidth();88 ApplyMinWidth();
8689
87 SetMinimumHeight(BUTTON_HEIGHT.CP(scale));90 SetMinimumHeight(BUTTON_HEIGHT.CP(font_scaling));
88 SetMaximumHeight(BUTTON_HEIGHT.CP(scale));91 SetMaximumHeight(BUTTON_HEIGHT.CP(font_scaling));
89}92}
9093
91void FilterBasicButton::RedrawTheme(nux::Geometry const& geom, cairo_t* cr, nux::ButtonVisualState faked_state)94void FilterBasicButton::RedrawTheme(nux::Geometry const& geom, cairo_t* cr, nux::ButtonVisualState faked_state)
9295
=== modified file 'dash/previews/ActionButton.cpp'
--- dash/previews/ActionButton.cpp 2014-07-24 14:03:10 +0000
+++ dash/previews/ActionButton.cpp 2014-12-17 12:14:47 +0000
@@ -25,6 +25,7 @@
25#include <Nux/HLayout.h>25#include <Nux/HLayout.h>
26#include "unity-shared/IconTexture.h"26#include "unity-shared/IconTexture.h"
27#include "unity-shared/StaticCairoText.h"27#include "unity-shared/StaticCairoText.h"
28#include "unity-shared/UnitySettings.h"
2829
29namespace unity30namespace unity
30{31{
@@ -51,6 +52,7 @@
51 Init();52 Init();
52 BuildLayout(label, icon_hint, "");53 BuildLayout(label, icon_hint, "");
53 scale.changed.connect(sigc::mem_fun(this, &ActionButton::UpdateScale));54 scale.changed.connect(sigc::mem_fun(this, &ActionButton::UpdateScale));
55 Settings::Instance().font_scaling.changed.connect(sigc::hide(sigc::mem_fun(this, &ActionButton::InitTheme)));
54}56}
5557
56ActionButton::~ActionButton()58ActionButton::~ActionButton()
@@ -93,8 +95,9 @@
93 cr_normal_.reset(new nux::CairoWrapper(geo, sigc::bind(sigc::mem_fun(this, &ActionButton::RedrawTheme), nux::ButtonVisualState::VISUAL_STATE_NORMAL)));95 cr_normal_.reset(new nux::CairoWrapper(geo, sigc::bind(sigc::mem_fun(this, &ActionButton::RedrawTheme), nux::ButtonVisualState::VISUAL_STATE_NORMAL)));
94 cr_focus_.reset(new nux::CairoWrapper(geo, sigc::mem_fun(this, &ActionButton::RedrawFocusOverlay)));96 cr_focus_.reset(new nux::CairoWrapper(geo, sigc::mem_fun(this, &ActionButton::RedrawFocusOverlay)));
9597
96 SetMinimumHeight(MIN_BUTTON_HEIGHT.CP(scale));98 double font_scaling = Settings::Instance().font_scaling() * scale;
97 SetMinimumWidth(MIN_BUTTON_WIDTH.CP(scale));99 SetMinimumHeight(MIN_BUTTON_HEIGHT.CP(font_scaling));
100 SetMinimumWidth(MIN_BUTTON_WIDTH.CP(font_scaling));
98}101}
99102
100void ActionButton::SetExtraHint(std::string const& extra_hint, std::string const& font_hint)103void ActionButton::SetExtraHint(std::string const& extra_hint, std::string const& font_hint)
101104
=== modified file 'dash/previews/ErrorPreview.cpp'
--- dash/previews/ErrorPreview.cpp 2014-08-06 14:09:30 +0000
+++ dash/previews/ErrorPreview.cpp 2014-12-17 12:14:47 +0000
@@ -37,6 +37,7 @@
3737
38#include "stdio.h"38#include "stdio.h"
39#include "config.h"39#include "config.h"
40#include <glib/gi18n-lib.h>
4041
41namespace unity42namespace unity
42{43{
4344
=== modified file 'dash/previews/PaymentPreview.cpp'
--- dash/previews/PaymentPreview.cpp 2014-07-24 14:14:47 +0000
+++ dash/previews/PaymentPreview.cpp 2014-12-17 12:14:47 +0000
@@ -20,8 +20,10 @@
20 * Manuel de la Pena <manuel.delapena@canonical.com>20 * Manuel de la Pena <manuel.delapena@canonical.com>
21 *21 *
22 */22 */
23#include "PaymentPreview.h"
24
25#include <Nux/VLayout.h>
23#include <NuxCore/Logger.h>26#include <NuxCore/Logger.h>
24#include "PaymentPreview.h"
25#include "unity-shared/CoverArt.h"27#include "unity-shared/CoverArt.h"
26#include "unity-shared/DashStyle.h"28#include "unity-shared/DashStyle.h"
27#include "unity-shared/PreviewStyle.h"29#include "unity-shared/PreviewStyle.h"
2830
=== added directory 'data'
=== added file 'data/CMakeLists.txt'
--- data/CMakeLists.txt 1970-01-01 00:00:00 +0000
+++ data/CMakeLists.txt 2014-12-17 12:14:47 +0000
@@ -0,0 +1,1 @@
1add_subdirectory(pam)
0\ No newline at end of file2\ No newline at end of file
13
=== added directory 'data/pam'
=== added file 'data/pam/CMakeLists.txt'
--- data/pam/CMakeLists.txt 1970-01-01 00:00:00 +0000
+++ data/pam/CMakeLists.txt 2014-12-17 12:14:47 +0000
@@ -0,0 +1,1 @@
1install(FILES unity DESTINATION ${CMAKE_SYSCONFDIR}/pam.d)
0\ No newline at end of file2\ No newline at end of file
13
=== added file 'data/pam/unity'
--- data/pam/unity 1970-01-01 00:00:00 +0000
+++ data/pam/unity 2014-12-17 12:14:47 +0000
@@ -0,0 +1,2 @@
1@include common-auth
2auth optional pam_gnome_keyring.so
03
=== modified file 'debian/changelog'
--- debian/changelog 2014-08-26 13:49:00 +0000
+++ debian/changelog 2014-12-17 12:14:47 +0000
@@ -1,3 +1,59 @@
1unity (7.2.4-0ubuntu1) UNRELEASED; urgency=medium
2
3 [ Andrea Azzarone ]
4 * Share lockscreen password between screens (lp: #1308540)
5 * Allow a distinct pam config file for greeter and for lock-screen.
6 (lp: #1305440)
7 * Add an arrow activator in the lockscreen. (lp: #1332509)
8 * Make sure GetScreenGeometry returns the correct value (lp: #1374785).
9 * unmapped all windows prior to shutdown (lp: #1370017) (lp: #1375271)
10
11 [ Brandon Schaefer ]
12 * fix tooltip for the "Show Desktop / Restore Windows" icon in the Alt-Tab
13 switcher (lp: #1237132)
14 * Use CONFIG instead of CACHE to store the first_run.stamp (lp: #1328677)
15
16 [ Eleni Maria Stea ]
17 * LayoutSystem: make sure the exposed open windows are displayed in the
18 preserved order (lp: #1349281).
19
20 [ handsome_feng ]
21 * added support for getting the distro name from /etc/os-release
22 (lp: #1329584)
23
24 [ Iain Lane ]
25 * When grabbing keys, try prefixing "XF86" if the key isn't found. GNOME
26 gives us unprefixed keys sometimes (lp: #1302885).
27
28 [ Marco Trevisan (Treviño) ]
29 * make the Launcher icon count badge width depend on the text value width
30 and scaling (lp: #1353070) (lp: #1354498) (lp: #796527) (lp: #1066971)
31 (lp: #1361713)
32 * DecoratedWindow: make edges independent from borders and properly update
33 them on actions change (lp: #1276177), (lp: #1299741), (lp: #1301776),
34 (lp: #1324104), (lp: #1364225), (lp: #1373695)
35 * Lockscreen: scale the UI elements based on current monitor scaling
36 (lp: #1292218)
37 * UnityScreen: when filtering out windows in spread, make sure we unscale
38 them (lp: #1316265).
39 * PanelMenuView: ensure that proper window tiles and buttons are shown at
40 the right place (lp: #1384910) (lp: #1384958) (lp: #1385285)
41 * SearchBar, ActionButtons, IconRenderer: include the font scaling when
42 scaling textual items (lp: #1332947) (lp: #1361751) (lp: #1362162)
43 (lp: #1362346).
44 * ApplicationLauncherIcon: make sure we close the dash if DnD is accepted
45 and the application window is about to be focused (lp: #1350331).
46 * SwitcherView: set progress on icon render args (lp: #1361679).
47 * LockScreenController: wait for the primary shield to get the grab
48 before setting the session locked (lp: #1368427) (lp: #1371764).
49 * added decorations to windows in non-focused workspaces (lp: #1383468)
50
51 [ Stephen M. Webb ]
52 * updated the unity(1) manpage to match the actual command (lp: #1059275)
53 * bumped package version to match upstream
54
55 -- Stephen M. Webb <stephen.webb@canonical.coma> Mon, 08 Dec 2014 14:29:17 -0500
56
1unity (7.2.3+14.04.20140826-0ubuntu1) trusty; urgency=medium57unity (7.2.3+14.04.20140826-0ubuntu1) trusty; urgency=medium
258
3 [ Andrea Azzarone ]59 [ Andrea Azzarone ]
@@ -2189,6 +2245,9 @@
2189unity (7.0.0daily13.05.08ubuntu.unity.next-0ubuntu1) raring; urgency=low2245unity (7.0.0daily13.05.08ubuntu.unity.next-0ubuntu1) raring; urgency=low
21902246
2191 * Automatic snapshot from revision 3317 (ubuntu-unity/next)2247 * Automatic snapshot from revision 3317 (ubuntu-unity/next)
2248
2249 -- Ubuntu daily release <ps-jenkins@lists.canonical.com> Fri, 31 May 2013 04:06:11 +0000
2250
2192unity (7.0.0daily13.05.01.1ubuntu.unity.next-0ubuntu1) raring; urgency=low2251unity (7.0.0daily13.05.01.1ubuntu.unity.next-0ubuntu1) raring; urgency=low
21932252
2194 [ Sebastien Bacher ]2253 [ Sebastien Bacher ]
21952254
=== modified file 'debian/rules'
--- debian/rules 2014-05-12 18:04:20 +0000
+++ debian/rules 2014-12-17 12:14:47 +0000
@@ -23,7 +23,7 @@
2323
24SCOPES_RECOMMENDS := $(shell perl debian/scopes-recommends-generator /usr/share/unity/client-scopes.json)24SCOPES_RECOMMENDS := $(shell perl debian/scopes-recommends-generator /usr/share/unity/client-scopes.json)
2525
26cmake_base_options := -DUSE_GSETTINGS=TRUE -DCOMPIZ_BUILD_WITH_RPATH=FALSE -DCOMPIZ_PACKAGING_ENABLED=TRUE -DCOMPIZ_PLUGIN_INSTALL_TYPE=package26cmake_base_options := -DUSE_GSETTINGS=TRUE -DCOMPIZ_BUILD_WITH_RPATH=FALSE -DCOMPIZ_PACKAGING_ENABLED=TRUE -DCMAKE_SYSCONFDIR=/etc -DCOMPIZ_PLUGIN_INSTALL_TYPE=package
27ifeq ($(DEB_HOST_ARCH),$(findstring $(DEB_HOST_ARCH), $(gles2_architectures)))27ifeq ($(DEB_HOST_ARCH),$(findstring $(DEB_HOST_ARCH), $(gles2_architectures)))
28 cmake_gl_options := -DBUILD_GLES=TRUE -DDISABLE_MAINTAINER_CFLAGS=ON28 cmake_gl_options := -DBUILD_GLES=TRUE -DDISABLE_MAINTAINER_CFLAGS=ON
29endif29endif
3030
=== modified file 'debian/unity.install'
--- debian/unity.install 2011-09-15 16:42:23 +0000
+++ debian/unity.install 2014-12-17 12:14:47 +0000
@@ -1,3 +1,4 @@
1etc/pam.d
1usr/bin2usr/bin
2usr/lib/compiz3usr/lib/compiz
3usr/share/man/*/unity.14usr/share/man/*/unity.1
45
=== modified file 'debian/unity.migrations'
--- debian/unity.migrations 2014-03-21 02:58:13 +0000
+++ debian/unity.migrations 2014-12-17 12:14:47 +0000
@@ -1,2 +1,3 @@
1tools/migration-scripts/01_unity_change_dconf_path1tools/migration-scripts/01_unity_change_dconf_path
2tools/migration-scripts/02_unity_setup_text_scale_factor2tools/migration-scripts/02_unity_setup_text_scale_factor
3tools/migration-scripts/03_unity_first_run_stamp_move
34
=== modified file 'decorations/DecoratedWindow.cpp'
--- decorations/DecoratedWindow.cpp 2014-04-02 12:26:14 +0000
+++ decorations/DecoratedWindow.cpp 2014-12-17 12:14:47 +0000
@@ -1,6 +1,6 @@
1// -*- Mode: C++; indent-tabs-mode: nil; tab-width: 2 -*-1// -*- Mode: C++; indent-tabs-mode: nil; tab-width: 2 -*-
2/*2/*
3 * Copyright (C) 2013 Canonical Ltd3 * Copyright (C) 2013-2014 Canonical Ltd
4 *4 *
5 * This program is free software: you can redistribute it and/or modify5 * This program is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License version 3 as6 * it under the terms of the GNU General Public License version 3 as
@@ -46,8 +46,12 @@
46 , cwin_(CompositeWindow::get(win_))46 , cwin_(CompositeWindow::get(win_))
47 , glwin_(GLWindow::get(win_))47 , glwin_(GLWindow::get(win_))
48 , frame_(0)48 , frame_(0)
49 , monitor_(0)
49 , dirty_geo_(true)50 , dirty_geo_(true)
50 , monitor_(0)51 , dirty_frame_(false)
52 , deco_elements_(cu::DecorationElement::NONE)
53 , last_mwm_decor_(win_->mwmDecor())
54 , last_actions_(win_->actions())
51 , cv_(Settings::Instance().em())55 , cv_(Settings::Instance().em())
52{56{
53 active.changed.connect([this] (bool active) {57 active.changed.connect([this] (bool active) {
@@ -107,14 +111,32 @@
107111
108void Window::Impl::Update()112void Window::Impl::Update()
109{113{
110 ShouldBeDecorated() ? Decorate() : Undecorate();114 UpdateElements();
115
116 if (deco_elements_ & (cu::DecorationElement::EDGE | cu::DecorationElement::BORDER))
117 Decorate();
118 else
119 Undecorate();
120
121 last_mwm_decor_ = win_->mwmDecor();
122 last_actions_ = win_->actions();
111}123}
112124
113void Window::Impl::Decorate()125void Window::Impl::Decorate()
114{126{
115 SetupExtents();127 SetupExtents();
116 UpdateFrame();128 UpdateFrame();
117 SetupWindowControls();129 SetupWindowEdges();
130
131 if (deco_elements_ & cu::DecorationElement::BORDER)
132 {
133 SetupWindowControls();
134 }
135 else
136 {
137 CleanupWindowControls();
138 bg_textures_.clear();
139 }
118}140}
119141
120void Window::Impl::Undecorate()142void Window::Impl::Undecorate()
@@ -122,6 +144,7 @@
122 UnsetExtents();144 UnsetExtents();
123 UnsetFrame();145 UnsetFrame();
124 CleanupWindowControls();146 CleanupWindowControls();
147 CleanupWindowEdges();
125 bg_textures_.clear();148 bg_textures_.clear();
126}149}
127150
@@ -141,22 +164,39 @@
141 if (win_->hasUnmapReference())164 if (win_->hasUnmapReference())
142 return;165 return;
143166
144 auto const& sb = Style::Get()->Border();167 CompWindowExtents border;
145 CompWindowExtents border(cv_->CP(sb.left),168
146 cv_->CP(sb.right),169 if (deco_elements_ & cu::DecorationElement::BORDER)
147 cv_->CP(sb.top),170 {
148 cv_->CP(sb.bottom));171 auto const& sb = Style::Get()->Border();
149172 border.left = cv_->CP(sb.left);
150 auto const& ib = Style::Get()->InputBorder();173 border.right = cv_->CP(sb.right);
151 CompWindowExtents input(cv_->CP(sb.left + ib.left),174 border.top = cv_->CP(sb.top);
152 cv_->CP(sb.right + ib.right),175 border.bottom = cv_->CP(sb.bottom);
153 cv_->CP(sb.top + ib.top),176 }
154 cv_->CP(sb.bottom + ib.bottom));177
178 CompWindowExtents input(border);
179
180 if (deco_elements_ & cu::DecorationElement::EDGE)
181 {
182 auto const& ib = Style::Get()->InputBorder();
183 input.left += cv_->CP(ib.left);
184 input.right += cv_->CP(ib.right);
185 input.top += cv_->CP(ib.top);
186 input.bottom += cv_->CP(ib.bottom);
187 }
155188
156 if (win_->border() != border || win_->input() != input)189 if (win_->border() != border || win_->input() != input)
157 win_->setWindowFrameExtents(&border, &input);190 win_->setWindowFrameExtents(&border, &input);
158}191}
159192
193void Window::Impl::SendFrameExtents()
194{
195 UpdateElements(cu::WindowFilter::UNMAPPED);
196 SetupExtents();
197 win_->setWindowFrameExtents(&win_->border(), &win_->input());
198}
199
160void Window::Impl::UnsetFrame()200void Window::Impl::UnsetFrame()
161{201{
162 if (!frame_)202 if (!frame_)
@@ -185,6 +225,15 @@
185 UpdateFrameGeo(frame_geo);225 UpdateFrameGeo(frame_geo);
186}226}
187227
228void Window::Impl::UpdateFrameActions()
229{
230 if (!dirty_frame_ && (win_->mwmDecor() != last_mwm_decor_ || win_->actions() != last_actions_))
231 {
232 dirty_frame_ = true;
233 Damage();
234 }
235}
236
188void Window::Impl::CreateFrame(nux::Geometry const& frame_geo)237void Window::Impl::CreateFrame(nux::Geometry const& frame_geo)
189{238{
190 /* Since we're reparenting windows here, we need to grab the server239 /* Since we're reparenting windows here, we need to grab the server
@@ -282,6 +331,42 @@
282 win_->updateFrameRegion();331 win_->updateFrameRegion();
283}332}
284333
334void Window::Impl::SetupWindowEdges()
335{
336 if (input_mixer_)
337 return;
338
339 dpi_changed_ = Settings::Instance().dpi_changed.connect([this] {
340 Update();
341 edge_borders_->scale = cv_->DPIScale();
342 if (top_layout_) top_layout_->scale = cv_->DPIScale();
343 });
344
345 input_mixer_ = std::make_shared<InputMixer>();
346 edge_borders_ = std::make_shared<EdgeBorders>(win_);
347 edge_borders_->scale = cv_->DPIScale();
348 input_mixer_->PushToFront(edge_borders_);
349
350 UpdateWindowEdgesGeo();
351}
352
353void Window::Impl::UpdateWindowEdgesGeo()
354{
355 if (!edge_borders_)
356 return;
357
358 auto const& input = win_->inputRect();
359 edge_borders_->SetCoords(input.x(), input.y());
360 edge_borders_->SetSize(input.width(), input.height());
361}
362
363void Window::Impl::CleanupWindowEdges()
364{
365 input_mixer_.reset();
366 edge_borders_.reset();
367 dpi_changed_->disconnect();
368}
369
285void Window::Impl::SetupWindowControls()370void Window::Impl::SetupWindowControls()
286{371{
287 if (top_layout_)372 if (top_layout_)
@@ -293,26 +378,7 @@
293 Decorate();378 Decorate();
294 });379 });
295380
296 dpi_changed_ = Settings::Instance().dpi_changed.connect([this] {381 grab_edge_ = std::static_pointer_cast<EdgeBorders>(edge_borders_)->GetEdge(Edge::Type::GRAB);
297 Update();
298 top_layout_->scale = cv_->DPIScale();
299 });
300
301 input_mixer_ = std::make_shared<InputMixer>();
302
303 if (win_->actions() & CompWindowActionResizeMask)
304 {
305 auto edges = std::make_shared<EdgeBorders>(win_);
306 grab_edge_ = edges->GetEdge(Edge::Type::GRAB);
307 edge_borders_ = edges;
308 }
309 else /*if (win_->actions() & CompWindowActionMoveMask)*/
310 {
311 edge_borders_ = std::make_shared<GrabEdge>(win_);
312 grab_edge_ = edge_borders_;
313 }
314
315 input_mixer_->PushToFront(edge_borders_);
316382
317 auto padding = style->Padding(Side::TOP);383 auto padding = style->Padding(Side::TOP);
318 top_layout_ = std::make_shared<Layout>();384 top_layout_ = std::make_shared<Layout>();
@@ -347,6 +413,7 @@
347 top_layout_->Append(title_layout);413 top_layout_->Append(title_layout);
348414
349 input_mixer_->PushToFront(top_layout_);415 input_mixer_->PushToFront(top_layout_);
416 dirty_frame_ = false;
350417
351 SetupAppMenu();418 SetupAppMenu();
352 RedrawDecorations();419 RedrawDecorations();
@@ -357,12 +424,12 @@
357 if (title_)424 if (title_)
358 last_title_ = title_->text();425 last_title_ = title_->text();
359426
427 if (input_mixer_)
428 input_mixer_->Remove(top_layout_);
429
360 UnsetAppMenu();430 UnsetAppMenu();
361 theme_changed_->disconnect();431 theme_changed_->disconnect();
362 dpi_changed_->disconnect();
363 top_layout_.reset();432 top_layout_.reset();
364 input_mixer_.reset();
365 edge_borders_.reset();
366}433}
367434
368bool Window::Impl::IsMaximized() const435bool Window::Impl::IsMaximized() const
@@ -370,26 +437,25 @@
370 return (win_->state() & MAXIMIZE_STATE) == MAXIMIZE_STATE;437 return (win_->state() & MAXIMIZE_STATE) == MAXIMIZE_STATE;
371}438}
372439
440void Window::Impl::UpdateElements(cu::WindowFilter::Value wf)
441{
442 if (!parent_->scaled() && IsMaximized())
443 {
444 deco_elements_ = cu::DecorationElement::NONE;
445 return;
446 }
447
448 deco_elements_ = cu::WindowDecorationElements(win_, wf);
449}
450
373bool Window::Impl::ShadowDecorated() const451bool Window::Impl::ShadowDecorated() const
374{452{
375 if (!parent_->scaled() && IsMaximized())453 return deco_elements_ & cu::DecorationElement::SHADOW;
376 return false;
377
378 if (!cu::IsWindowShadowDecorable(win_))
379 return false;
380
381 return true;
382}454}
383455
384bool Window::Impl::FullyDecorated() const456bool Window::Impl::FullyDecorated() const
385{457{
386 if (!parent_->scaled() && IsMaximized())458 return deco_elements_ & cu::DecorationElement::BORDER;
387 return false;
388
389 if (!cu::IsWindowFullyDecorable(win_))
390 return false;
391
392 return true;
393}459}
394460
395bool Window::Impl::ShouldBeDecorated() const461bool Window::Impl::ShouldBeDecorated() const
@@ -431,6 +497,7 @@
431 }497 }
432498
433 deco_tex.SetCoords(geo.x, geo.y);499 deco_tex.SetCoords(geo.x, geo.y);
500 deco_tex.quad.region = deco_tex.quad.box;
434}501}
435502
436void Window::Impl::UpdateDecorationTextures()503void Window::Impl::UpdateDecorationTextures()
@@ -442,7 +509,6 @@
442 }509 }
443510
444 auto const& geo = win_->borderRect();511 auto const& geo = win_->borderRect();
445 auto const& input = win_->inputRect();
446 auto const& border = win_->border();512 auto const& border = win_->border();
447513
448 bg_textures_.resize(4);514 bg_textures_.resize(4);
@@ -454,19 +520,18 @@
454 top_layout_->SetCoords(geo.x(), geo.y());520 top_layout_->SetCoords(geo.x(), geo.y());
455 top_layout_->SetSize(geo.width(), border.top);521 top_layout_->SetSize(geo.width(), border.top);
456522
457 if (edge_borders_)
458 {
459 edge_borders_->SetCoords(input.x(), input.y());
460 edge_borders_->SetSize(input.width(), input.height());
461 }
462
463 SyncMenusGeometries();523 SyncMenusGeometries();
464}524}
465525
466void Window::Impl::ComputeShadowQuads()526void Window::Impl::ComputeShadowQuads()
467{527{
468 if (last_shadow_rect_.isEmpty() && !ShadowDecorated())528 if (!(deco_elements_ & cu::DecorationElement::SHADOW))
529 {
530 if (!last_shadow_rect_.isEmpty())
531 last_shadow_rect_.setGeometry(0, 0, 0, 0);
532
469 return;533 return;
534 }
470535
471 const auto* texture = ShadowTexture();536 const auto* texture = ShadowTexture();
472537
@@ -554,6 +619,12 @@
554619
555 if (shadows_rect != last_shadow_rect_)620 if (shadows_rect != last_shadow_rect_)
556 {621 {
622 auto const& win_region = win_->region();
623 quads[Quads::Pos::TOP_LEFT].region = CompRegion(quads[Quads::Pos::TOP_LEFT].box) - win_region;
624 quads[Quads::Pos::TOP_RIGHT].region = CompRegion(quads[Quads::Pos::TOP_RIGHT].box) - win_region;
625 quads[Quads::Pos::BOTTOM_LEFT].region = CompRegion(quads[Quads::Pos::BOTTOM_LEFT].box) - win_region;
626 quads[Quads::Pos::BOTTOM_RIGHT].region = CompRegion(quads[Quads::Pos::BOTTOM_RIGHT].box) - win_region;
627
557 last_shadow_rect_ = shadows_rect;628 last_shadow_rect_ = shadows_rect;
558 win_->updateWindowOutputExtents();629 win_->updateWindowOutputExtents();
559 }630 }
@@ -563,16 +634,31 @@
563 GLWindowPaintAttrib const& attrib,634 GLWindowPaintAttrib const& attrib,
564 CompRegion const& region, unsigned mask)635 CompRegion const& region, unsigned mask)
565{636{
637 if (!(mask & PAINT_SCREEN_TRANSFORMED_MASK) && win_->defaultViewport() != screen->vp())
638 {
639 return;
640 }
641
566 if (dirty_geo_)642 if (dirty_geo_)
567 parent_->UpdateDecorationPosition();643 parent_->UpdateDecorationPosition();
644
645 if (dirty_frame_)
646 {
647 dirty_frame_ = false;
648 CleanupWindowControls();
649 CleanupWindowEdges();
650 Update();
651 }
568}652}
569653
570void Window::Impl::Draw(GLMatrix const& transformation,654void Window::Impl::Draw(GLMatrix const& transformation,
571 GLWindowPaintAttrib const& attrib,655 GLWindowPaintAttrib const& attrib,
572 CompRegion const& region, unsigned mask)656 CompRegion const& region, unsigned mask)
573{657{
574 if (last_shadow_rect_.isEmpty())658 if (last_shadow_rect_.isEmpty() || (!(mask & PAINT_SCREEN_TRANSFORMED_MASK) && win_->defaultViewport() != screen->vp()))
659 {
575 return;660 return;
661 }
576662
577 auto const& clip_region = (mask & PAINT_WINDOW_TRANSFORMED_MASK) ? infiniteRegion : region;663 auto const& clip_region = (mask & PAINT_WINDOW_TRANSFORMED_MASK) ? infiniteRegion : region;
578 mask |= PAINT_WINDOW_BLEND_MASK;664 mask |= PAINT_WINDOW_BLEND_MASK;
@@ -582,7 +668,7 @@
582 for (unsigned i = 0; i < shadow_quads_.size(); ++i)668 for (unsigned i = 0; i < shadow_quads_.size(); ++i)
583 {669 {
584 auto& quad = shadow_quads_[Quads::Pos(i)];670 auto& quad = shadow_quads_[Quads::Pos(i)];
585 glwin_->glAddGeometry({quad.matrix}, CompRegion(quad.box) - win_->region(), clip_region);671 glwin_->glAddGeometry(quad.matrices, quad.region, clip_region);
586 }672 }
587673
588 if (glwin_->vertexBuffer()->end())674 if (glwin_->vertexBuffer()->end())
@@ -594,7 +680,7 @@
594 continue;680 continue;
595681
596 glwin_->vertexBuffer()->begin();682 glwin_->vertexBuffer()->begin();
597 glwin_->glAddGeometry({dtex.quad.matrix}, dtex.quad.box, clip_region);683 glwin_->glAddGeometry(dtex.quad.matrices, dtex.quad.region, clip_region);
598684
599 if (glwin_->vertexBuffer()->end())685 if (glwin_->vertexBuffer()->end())
600 glwin_->glDrawTexture(dtex, transformation, attrib, mask);686 glwin_->glDrawTexture(dtex, transformation, attrib, mask);
@@ -707,6 +793,9 @@
707793
708 if (top_layout_)794 if (top_layout_)
709 top_layout_->scale = cv_->DPIScale();795 top_layout_->scale = cv_->DPIScale();
796
797 if (edge_borders_)
798 edge_borders_->scale = cv_->DPIScale();
710 }799 }
711}800}
712801
@@ -789,6 +878,7 @@
789{878{
790 impl_->UpdateMonitor();879 impl_->UpdateMonitor();
791 impl_->ComputeShadowQuads();880 impl_->ComputeShadowQuads();
881 impl_->UpdateWindowEdgesGeo();
792 impl_->UpdateDecorationTextures();882 impl_->UpdateDecorationTextures();
793 impl_->UpdateForceQuitDialogPosition();883 impl_->UpdateForceQuitDialogPosition();
794 impl_->dirty_geo_ = false;884 impl_->dirty_geo_ = false;
@@ -808,7 +898,8 @@
808{898{
809 data.add(impl_->win_->borderRect())899 data.add(impl_->win_->borderRect())
810 .add("input_geo", impl_->win_->inputRect())900 .add("input_geo", impl_->win_->inputRect())
811 .add("content_geo", impl_->win_->region().boundingRect())901 .add("content_geo", impl_->win_->geometry())
902 .add("region", impl_->win_->region().boundingRect())
812 .add("title", title())903 .add("title", title())
813 .add("active", impl_->active())904 .add("active", impl_->active())
814 .add("scaled", scaled())905 .add("scaled", scaled())
815906
=== modified file 'decorations/DecorationsEdgeBorders.cpp'
--- decorations/DecorationsEdgeBorders.cpp 2014-02-18 23:01:33 +0000
+++ decorations/DecorationsEdgeBorders.cpp 2014-12-17 12:14:47 +0000
@@ -26,21 +26,31 @@
26{26{
27namespace27namespace
28{28{
29const int MIN_CORNER_EDGE = 10;29const RawPixel MIN_CORNER_EDGE = 10_em;
30}30}
3131
32EdgeBorders::EdgeBorders(CompWindow* win)32EdgeBorders::EdgeBorders(CompWindow* win)
33{33{
34 items_.resize(size_t(Edge::Type::Size));34 scale.changed.connect(sigc::hide(sigc::mem_fun(this, &EdgeBorders::Relayout)));
3535
36 for (unsigned i = 0; i < unsigned(Edge::Type::Size); ++i)36 if (win->actions() & CompWindowActionResizeMask)
37 {37 {
38 auto type = Edge::Type(i);38 items_.resize(size_t(Edge::Type::Size));
3939
40 if (type == Edge::Type::GRAB)40 for (unsigned i = 0; i < unsigned(Edge::Type::Size); ++i)
41 items_[i] = std::make_shared<GrabEdge>(win);41 {
42 else42 auto type = Edge::Type(i);
43 items_[i] = std::make_shared<Edge>(win, type);43
44 if (type == Edge::Type::GRAB)
45 items_[i] = std::make_shared<GrabEdge>(win);
46 else
47 items_[i] = std::make_shared<Edge>(win, type);
48 }
49 }
50 else /*if (win->actions() & CompWindowActionMoveMask)*/
51 {
52 items_.resize(size_t(Edge::Type::GRAB) + 1);
53 items_[unsigned(Edge::Type::GRAB)] = std::make_shared<GrabEdge>(win);
44 }54 }
4555
46 Relayout();56 Relayout();
@@ -54,10 +64,17 @@
54 auto const& ib = win->input();64 auto const& ib = win->input();
5565
56 using namespace compiz::window::extents;66 using namespace compiz::window::extents;
57 Extents edges(std::max(ib.left, MIN_CORNER_EDGE),67 int min_corner_edge = MIN_CORNER_EDGE.CP(scale);
58 std::max(ib.right, MIN_CORNER_EDGE),68 Extents edges(std::max(ib.left, min_corner_edge),
59 std::max(ib.top, MIN_CORNER_EDGE),69 std::max(ib.right, min_corner_edge),
60 std::max(ib.bottom, MIN_CORNER_EDGE));70 std::max(ib.top, min_corner_edge),
71 std::max(ib.bottom, min_corner_edge));
72
73 grab_edge->SetCoords(rect_.x() + ib.left, rect_.y() + ib.top - b.top);
74 grab_edge->SetSize(rect_.width() - ib.left - ib.right, b.top);
75
76 if (items_.size() != size_t(Edge::Type::Size))
77 return;
6178
62 auto item = items_[unsigned(Edge::Type::TOP)];79 auto item = items_[unsigned(Edge::Type::TOP)];
63 item->SetCoords(rect_.x() + edges.left, rect_.y());80 item->SetCoords(rect_.x() + edges.left, rect_.y());
@@ -90,10 +107,6 @@
90 item = items_[unsigned(Edge::Type::BOTTOM_RIGHT)];107 item = items_[unsigned(Edge::Type::BOTTOM_RIGHT)];
91 item->SetCoords(rect_.x2() - edges.right, rect_.y2() - edges.bottom);108 item->SetCoords(rect_.x2() - edges.right, rect_.y2() - edges.bottom);
92 item->SetSize(edges.right, edges.bottom);109 item->SetSize(edges.right, edges.bottom);
93
94 item = items_[unsigned(Edge::Type::GRAB)];
95 item->SetCoords(rect_.x() + ib.left, rect_.y() + ib.top - b.top);
96 item->SetSize(rect_.width() - ib.left - ib.right, b.top);
97}110}
98111
99Item::Ptr const& EdgeBorders::GetEdge(Edge::Type type) const112Item::Ptr const& EdgeBorders::GetEdge(Edge::Type type) const
100113
=== modified file 'decorations/DecorationsForceQuitDialog.cpp'
--- decorations/DecorationsForceQuitDialog.cpp 2014-04-02 13:14:43 +0000
+++ decorations/DecorationsForceQuitDialog.cpp 2014-12-17 12:14:47 +0000
@@ -141,7 +141,7 @@
141141
142 auto const& deco_style = decoration::Style::Get();142 auto const& deco_style = decoration::Style::Get();
143 auto const& offset = deco_style->ShadowOffset();143 auto const& offset = deco_style->ShadowOffset();
144 int max_offset = std::max(std::abs(offset.x), std::abs(offset.y));144 int max_offset = std::max(std::abs(offset.x * 4), std::abs(offset.y * 4));
145 gtk_container_set_border_width(GTK_CONTAINER(self), deco_style->ActiveShadowRadius()+max_offset);145 gtk_container_set_border_width(GTK_CONTAINER(self), deco_style->ActiveShadowRadius()+max_offset);
146146
147 auto* screen = gtk_window_get_screen(self);147 auto* screen = gtk_window_get_screen(self);
@@ -259,18 +259,32 @@
259 auto const& radius = deco_style->CornerRadius();259 auto const& radius = deco_style->CornerRadius();
260 auto const& offset = deco_style->ShadowOffset();260 auto const& offset = deco_style->ShadowOffset();
261 auto const& color = deco_style->ActiveShadowColor();261 auto const& color = deco_style->ActiveShadowColor();
262 auto const& backcolor = deco_style->InactiveShadowColor();
262 int decoration_radius = std::max({radius.top, radius.left, radius.right, radius.bottom});263 int decoration_radius = std::max({radius.top, radius.left, radius.right, radius.bottom});
263264
264 gtk_css_provider_load_from_data(style, (R"(SheetStyleDialog {265 gtk_css_provider_load_from_data(style, (R"(
266 SheetStyleDialog {
265 background-color: #f7f6f5;267 background-color: #f7f6f5;
266 color: #4a4a4a;268 color: #4a4a4a;
267 border-radius: )"+std::to_string(decoration_radius)+R"(px;269 border-radius: )"+std::to_string(decoration_radius)+R"(px;
268 box-shadow: )"+std::to_string(offset.x)+"px "+std::to_string(offset.y)+"px "+270 box-shadow: )"+std::to_string(2 * offset.x)+"px "+std::to_string(2 * offset.y)+"px "+
269 std::to_string(deco_style->ActiveShadowRadius())+"px "+271 std::to_string(deco_style->ActiveShadowRadius())+"px "+
270 "rgba("+std::to_string(int(color.red * 255.0))+", "+272 "rgba("+std::to_string(int(color.red * 255.0))+", "+
271 std::to_string(int(color.green * 255.0))+", "+273 std::to_string(int(color.green * 255.0))+", "+
272 std::to_string(int(color.blue * 255.0))+", "+274 std::to_string(int(color.blue * 255.0))+", "+
273 std::to_string(int(color.alpha))+'.'+std::to_string(int(color.alpha*10000.0))+')'+R"(;275 std::to_string(int(color.alpha))+'.'+std::to_string(int(color.alpha*10000.0))+')'+R"(;
276 }
277
278 SheetStyleDialog:backdrop {
279 background-color: shade(#f7f6f5, 1.2);
280 color: shade(#4a4a4a, 1.5);
281 border-radius: )"+std::to_string(decoration_radius)+R"(px;
282 box-shadow: )"+std::to_string(2 * offset.x)+"px "+std::to_string(2 * offset.y)+"px "+
283 std::to_string(deco_style->InactiveShadowRadius())+"px "+
284 "rgba("+std::to_string(int(backcolor.red * 255.0))+", "+
285 std::to_string(int(backcolor.green * 255.0))+", "+
286 std::to_string(int(backcolor.blue * 255.0))+", "+
287 std::to_string(int(backcolor.alpha))+'.'+std::to_string(int(backcolor.alpha*10000.0))+')'+R"(;
274 })").c_str(), -1, nullptr);288 })").c_str(), -1, nullptr);
275289
276 auto* style_ctx = gtk_widget_get_style_context(self);290 auto* style_ctx = gtk_widget_get_style_context(self);
277291
=== modified file 'decorations/DecorationsManager.cpp'
--- decorations/DecorationsManager.cpp 2014-04-02 09:04:37 +0000
+++ decorations/DecorationsManager.cpp 2014-12-17 12:14:47 +0000
@@ -44,8 +44,7 @@
44}44}
4545
46Manager::Impl::Impl(decoration::Manager* parent, menu::Manager::Ptr const& menu)46Manager::Impl::Impl(decoration::Manager* parent, menu::Manager::Ptr const& menu)
47 : active_window_(0)47 : enable_add_supported_atoms_(true)
48 , enable_add_supported_atoms_(true)
49 , data_pool_(DataPool::Get())48 , data_pool_(DataPool::Get())
50 , menu_manager_(menu)49 , menu_manager_(menu)
51{50{
@@ -55,7 +54,6 @@
55 Display* dpy = screen->dpy();54 Display* dpy = screen->dpy();
56 atom::_NET_REQUEST_FRAME_EXTENTS = XInternAtom(dpy, "_NET_REQUEST_FRAME_EXTENTS", False);55 atom::_NET_REQUEST_FRAME_EXTENTS = XInternAtom(dpy, "_NET_REQUEST_FRAME_EXTENTS", False);
57 atom::_NET_WM_VISIBLE_NAME = XInternAtom(dpy, "_NET_WM_VISIBLE_NAME", False);56 atom::_NET_WM_VISIBLE_NAME = XInternAtom(dpy, "_NET_WM_VISIBLE_NAME", False);
58 screen->updateSupportedWmHints();
5957
60 auto rebuild_cb = sigc::mem_fun(this, &Impl::OnShadowOptionsChanged);58 auto rebuild_cb = sigc::mem_fun(this, &Impl::OnShadowOptionsChanged);
61 manager_->active_shadow_color.changed.connect(sigc::hide(sigc::bind(rebuild_cb, true)));59 manager_->active_shadow_color.changed.connect(sigc::hide(sigc::bind(rebuild_cb, true)));
@@ -208,15 +206,13 @@
208206
209bool Manager::Impl::HandleEventBefore(XEvent* event)207bool Manager::Impl::HandleEventBefore(XEvent* event)
210{208{
211 active_window_ = screen->activeWindow();
212
213 switch (event->type)209 switch (event->type)
214 {210 {
215 case ClientMessage:211 case ClientMessage:
216 if (event->xclient.message_type == atom::_NET_REQUEST_FRAME_EXTENTS)212 if (event->xclient.message_type == atom::_NET_REQUEST_FRAME_EXTENTS)
217 {213 {
218 if (Window::Ptr const& win = GetWindowByXid(event->xclient.window))214 if (Window::Ptr const& win = GetWindowByXid(event->xclient.window))
219 win->impl_->Decorate();215 win->impl_->SendFrameExtents();
220 }216 }
221 else if (event->xclient.message_type == Atoms::toolkitAction)217 else if (event->xclient.message_type == Atoms::toolkitAction)
222 {218 {
@@ -254,31 +250,26 @@
254250
255bool Manager::Impl::HandleEventAfter(XEvent* event)251bool Manager::Impl::HandleEventAfter(XEvent* event)
256{252{
257 if (screen->activeWindow() != active_window_)
258 {
259 // Do this when _NET_ACTIVE_WINDOW changes on root!
260 if (active_deco_win_)
261 active_deco_win_->impl_->active = false;
262
263 active_window_ = screen->activeWindow();
264 auto const& new_active = GetWindowByXid(active_window_);
265 active_deco_win_ = new_active;
266
267 if (new_active)
268 new_active->impl_->active = true;
269 }
270
271 switch (event->type)253 switch (event->type)
272 {254 {
273 case PropertyNotify:255 case PropertyNotify:
274 {256 {
275 if (event->xproperty.atom == Atoms::mwmHints)257 if (event->xproperty.atom == Atoms::winActive)
258 {
259 if (active_deco_win_)
260 active_deco_win_->impl_->active = false;
261
262 auto const& new_active = GetWindowByXid(screen->activeWindow());
263 active_deco_win_ = new_active;
264
265 if (new_active)
266 new_active->impl_->active = true;
267 }
268 else if (event->xproperty.atom == Atoms::mwmHints ||
269 event->xproperty.atom == Atoms::wmAllowedActions)
276 {270 {
277 if (Window::Ptr const& win = GetWindowByXid(event->xproperty.window))271 if (Window::Ptr const& win = GetWindowByXid(event->xproperty.window))
278 {272 win->impl_->UpdateFrameActions();
279 win->impl_->CleanupWindowControls();
280 win->Update();
281 }
282 }273 }
283 else if (event->xproperty.atom == XA_WM_NAME ||274 else if (event->xproperty.atom == XA_WM_NAME ||
284 event->xproperty.atom == Atoms::wmName ||275 event->xproperty.atom == Atoms::wmName ||
@@ -445,7 +436,7 @@
445 .add("active_shadow_radius", active_shadow_radius())436 .add("active_shadow_radius", active_shadow_radius())
446 .add("inactive_shadow_color", inactive_shadow_color())437 .add("inactive_shadow_color", inactive_shadow_color())
447 .add("inactive_shadow_radius", inactive_shadow_radius())438 .add("inactive_shadow_radius", inactive_shadow_radius())
448 .add("active_window", impl_->active_window_);439 .add("active_window", screen->activeWindow());
449}440}
450441
451debug::Introspectable::IntrospectableList Manager::GetIntrospectableChildren()442debug::Introspectable::IntrospectableList Manager::GetIntrospectableChildren()
452443
=== modified file 'decorations/DecorationsPriv.h'
--- decorations/DecorationsPriv.h 2014-04-02 09:05:59 +0000
+++ decorations/DecorationsPriv.h 2014-12-17 12:14:47 +0000
@@ -1,6 +1,6 @@
1// -*- Mode: C++; indent-tabs-mode: nil; tab-width: 2 -*-1// -*- Mode: C++; indent-tabs-mode: nil; tab-width: 2 -*-
2/*2/*
3 * Copyright (C) 2013 Canonical Ltd3 * Copyright (C) 2013-2014 Canonical Ltd
4 *4 *
5 * This program is free software: you can redistribute it and/or modify5 * This program is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License version 3 as6 * it under the terms of the GNU General Public License version 3 as
@@ -88,15 +88,20 @@
88 void SetupAppMenu();88 void SetupAppMenu();
89 bool ActivateMenu(std::string const&);89 bool ActivateMenu(std::string const&);
90 void ShowForceQuitDialog(bool, Time);90 void ShowForceQuitDialog(bool, Time);
91 void SendFrameExtents();
9192
92private:93private:
93 void UnsetExtents();94 void UnsetExtents();
94 void SetupExtents();95 void SetupExtents();
96 void UpdateElements(cu::WindowFilter::Value wf = cu::WindowFilter::NONE);
95 void UpdateMonitor();97 void UpdateMonitor();
96 void UpdateFrame();98 void UpdateFrame();
97 void CreateFrame(nux::Geometry const&);99 void CreateFrame(nux::Geometry const&);
98 void UpdateFrameGeo(nux::Geometry const&);100 void UpdateFrameGeo(nux::Geometry const&);
101 void UpdateFrameActions();
99 void UnsetFrame();102 void UnsetFrame();
103 void SetupWindowEdges();
104 void CleanupWindowEdges();
100 void SetupWindowControls();105 void SetupWindowControls();
101 void CleanupWindowControls();106 void CleanupWindowControls();
102 void UnsetAppMenu();107 void UnsetAppMenu();
@@ -109,6 +114,7 @@
109114
110 void ComputeShadowQuads();115 void ComputeShadowQuads();
111 void UpdateDecorationTextures();116 void UpdateDecorationTextures();
117 void UpdateWindowEdgesGeo();
112 void UpdateForceQuitDialogPosition();118 void UpdateForceQuitDialogPosition();
113 void RenderDecorationTexture(Side, nux::Geometry const&);119 void RenderDecorationTexture(Side, nux::Geometry const&);
114 void Paint(GLMatrix const&, GLWindowPaintAttrib const&, CompRegion const&, unsigned mask);120 void Paint(GLMatrix const&, GLWindowPaintAttrib const&, CompRegion const&, unsigned mask);
@@ -122,8 +128,12 @@
122 ::CompositeWindow* cwin_;128 ::CompositeWindow* cwin_;
123 ::GLWindow* glwin_;129 ::GLWindow* glwin_;
124 ::Window frame_;130 ::Window frame_;
131 int monitor_;
125 bool dirty_geo_;132 bool dirty_geo_;
126 int monitor_;133 bool dirty_frame_;
134 unsigned deco_elements_;
135 unsigned last_mwm_decor_;
136 unsigned last_actions_;
127137
128 CompRect last_shadow_rect_;138 CompRect last_shadow_rect_;
129 Quads shadow_quads_;139 Quads shadow_quads_;
@@ -176,7 +186,6 @@
176 friend class Manager;186 friend class Manager;
177 friend struct Window::Impl;187 friend struct Window::Impl;
178188
179 ::Window active_window_;
180 bool enable_add_supported_atoms_;189 bool enable_add_supported_atoms_;
181190
182 DataPool::Ptr data_pool_;191 DataPool::Ptr data_pool_;
183192
=== modified file 'decorations/DecorationsTitle.cpp'
--- decorations/DecorationsTitle.cpp 2014-03-31 18:36:07 +0000
+++ decorations/DecorationsTitle.cpp 2014-12-17 12:14:47 +0000
@@ -80,6 +80,7 @@
8080
81 Style::Get()->DrawTitle(text(), state, text_ctx, texture_size_.width / scale(), texture_size_.height / scale(), bg_geo * (1.0/scale));81 Style::Get()->DrawTitle(text(), state, text_ctx, texture_size_.width / scale(), texture_size_.height / scale(), bg_geo * (1.0/scale));
82 SetTexture(text_ctx);82 SetTexture(text_ctx);
83 texture_.UpdateMatrix();
83}84}
8485
85void Title::SetX(int x)86void Title::SetX(int x)
8687
=== modified file 'decorations/DecorationsWidgets.cpp'
--- decorations/DecorationsWidgets.cpp 2014-02-27 07:10:31 +0000
+++ decorations/DecorationsWidgets.cpp 2014-12-17 12:14:47 +0000
@@ -226,6 +226,12 @@
226226
227//227//
228228
229TexturedItem::TexturedItem()
230 : dirty_region_(false)
231{
232 geo_parameters_changed.connect([this] { dirty_region_ = true; });
233}
234
229void TexturedItem::SetTexture(cu::SimpleTexture::Ptr const& tex)235void TexturedItem::SetTexture(cu::SimpleTexture::Ptr const& tex)
230{236{
231 auto prev_geo = Geometry();237 auto prev_geo = Geometry();
@@ -254,8 +260,14 @@
254 if (!visible || Geometry().isEmpty() || !texture_)260 if (!visible || Geometry().isEmpty() || !texture_)
255 return;261 return;
256262
263 if (dirty_region_)
264 {
265 texture_.quad.region = texture_.quad.box;
266 dirty_region_ = false;
267 }
268
257 ctx->vertexBuffer()->begin();269 ctx->vertexBuffer()->begin();
258 ctx->glAddGeometry({texture_.quad.matrix}, texture_.quad.box, clip);270 ctx->glAddGeometry(texture_.quad.matrices, texture_.quad.region, clip);
259271
260 if (ctx->vertexBuffer()->end())272 if (ctx->vertexBuffer()->end())
261 ctx->glDrawTexture(texture_, transformation, attrib, mask);273 ctx->glDrawTexture(texture_, transformation, attrib, mask);
262274
=== modified file 'decorations/DecorationsWidgets.h'
--- decorations/DecorationsWidgets.h 2014-02-27 07:10:31 +0000
+++ decorations/DecorationsWidgets.h 2014-12-17 12:14:47 +0000
@@ -121,6 +121,8 @@
121public:121public:
122 typedef std::shared_ptr<TexturedItem> Ptr;122 typedef std::shared_ptr<TexturedItem> Ptr;
123123
124 TexturedItem();
125
124 void SetTexture(cu::SimpleTexture::Ptr const&);126 void SetTexture(cu::SimpleTexture::Ptr const&);
125 void Draw(GLWindow*, GLMatrix const&, GLWindowPaintAttrib const&, CompRegion const&, unsigned mask);127 void Draw(GLWindow*, GLMatrix const&, GLWindowPaintAttrib const&, CompRegion const&, unsigned mask);
126 void SetCoords(int x, int y);128 void SetCoords(int x, int y);
@@ -133,6 +135,9 @@
133135
134 CompRect& InternalGeo();136 CompRect& InternalGeo();
135 cu::SimpleTextureQuad texture_;137 cu::SimpleTextureQuad texture_;
138
139private:
140 bool dirty_region_;
136};141};
137142
138143
139144
=== modified file 'doc/unity.1'
--- doc/unity.1 2010-12-24 20:05:57 +0000
+++ doc/unity.1 2014-12-17 12:14:47 +0000
@@ -1,4 +1,4 @@
1.TH unity "1" "9 December 2010" "" "Linux User's Manual"1.TH unity "1" "09 August 2014" "" "Linux User's Manual"
22
3.SH NAME3.SH NAME
4unity \- wrapper for starting the unity shell and handling fallback4unity \- wrapper for starting the unity shell and handling fallback
@@ -12,17 +12,42 @@
12The \fBunity\fP program can be used to start the Unity shell as a compiz module, and to specify how to handle logging, debugging, as well as how to deal with the user's profile.12The \fBunity\fP program can be used to start the Unity shell as a compiz module, and to specify how to handle logging, debugging, as well as how to deal with the user's profile.
1313
14.SH OPTIONS14.SH OPTIONS
15.IP \fB\-\-advanced\-debug\fP15.TP
16Runs unity under debugging (using GDB or another debugger tool) to help tracking issues. Should only be used on request from a developper following a bug report.16.BR \-\-advanced\-debug
1717Runs unity under debugging (using \fBgdb\fR or another debugger tool) to help tracking issues. Should only be used on request from a developer following a bug report.
18.IP \fB\-\-log\fP\ \fIfilename\fP18
19.TP
20.BR "-\-compiz-path \fICOMPIZ_PATH\fR"
21Runs the compositor from a non-standard location.
22
23.TP
24.BR \-\-debug
25Runs Unity under
26.B gdb
27and prints a stack trace on crash.
28
29.TP
30.BR \-h ", " \-\-help
31Prints a usage message and exits.
32
33.TP
34.BR "\-\-log \fIfilename\fR"
19This parameter, followed by a path or filename, tells the Unity shell to store logs in the specified file.35This parameter, followed by a path or filename, tells the Unity shell to store logs in the specified file.
2036
21.IP \fB\-\-reset\fP37.TP
22This option allows the user to reset profile parameters in compiz and restart the Unity shell with default settings.38.BR \-\-replace
2339Deprecated option for backwards compatibility. Has no effect.
24.IP \fB\-\-verbose\fP40
25This option turns on displaying additional debugging output for the Unity shell. It can be used by the user to debug configuration issues. This option is often used along with the \fB\-\-log\fP option to save output to a file.41.TP
42.BR \-\-reset\-icons
43Resets the default Launcher icons.
44
45.TP
46.BR \-v ", " \-\-version
47Shows the program version number and exits.
48
49.TP
50.BR \-\-verbose
2651
27.SH "SEE ALSO"52.SH "SEE ALSO"
28.B unity-panel-service53.B unity-panel-service
2954
=== modified file 'hud/HudIconTextureSource.cpp'
--- hud/HudIconTextureSource.cpp 2012-10-29 09:34:54 +0000
+++ hud/HudIconTextureSource.cpp 2014-12-17 12:14:47 +0000
@@ -109,11 +109,6 @@
109 return nux::Color(0.0f, 0.0f, 0.0f, 0.0f); 109 return nux::Color(0.0f, 0.0f, 0.0f, 0.0f);
110}110}
111111
112nux::BaseTexture* HudIconTextureSource::Emblem()
113{
114 return nullptr;
115}
116
117}112}
118}113}
119114
120115
=== modified file 'hud/HudIconTextureSource.h'
--- hud/HudIconTextureSource.h 2013-11-06 11:21:43 +0000
+++ hud/HudIconTextureSource.h 2014-12-17 12:14:47 +0000
@@ -37,7 +37,6 @@
37 virtual nux::Color BackgroundColor() const;37 virtual nux::Color BackgroundColor() const;
38 virtual nux::BaseTexture* TextureForSize(int size);38 virtual nux::BaseTexture* TextureForSize(int size);
39 virtual nux::Color GlowColor();39 virtual nux::Color GlowColor();
40 virtual nux::BaseTexture* Emblem();
41 void ColorForIcon(GdkPixbuf* pixbuf);40 void ColorForIcon(GdkPixbuf* pixbuf);
42 41
43private:42private:
4443
=== modified file 'launcher/ApplicationLauncherIcon.cpp'
--- launcher/ApplicationLauncherIcon.cpp 2014-06-23 19:42:24 +0000
+++ launcher/ApplicationLauncherIcon.cpp 2014-12-17 12:14:47 +0000
@@ -33,6 +33,7 @@
33#include "MultiMonitor.h"33#include "MultiMonitor.h"
34#include "unity-shared/DesktopApplicationManager.h"34#include "unity-shared/DesktopApplicationManager.h"
35#include "unity-shared/GnomeFileManager.h"35#include "unity-shared/GnomeFileManager.h"
36#include "unity-shared/UBusWrapper.h"
36#include "unity-shared/UBusMessages.h"37#include "unity-shared/UBusMessages.h"
37#include "unity-shared/UScreen.h"38#include "unity-shared/UScreen.h"
3839
@@ -1168,6 +1169,7 @@
1168 if (!IsRunning())1169 if (!IsRunning())
1169 return false;1170 return false;
11701171
1172 UBusManager::SendMessage(UBUS_OVERLAY_CLOSE_REQUEST);
1171 Focus(ActionArg(ActionArg::Source::LAUNCHER, 1, timestamp));1173 Focus(ActionArg(ActionArg::Source::LAUNCHER, 1, timestamp));
11721174
1173 if (GetWindows(WindowFilter::ON_CURRENT_DESKTOP).size() > 1)1175 if (GetWindows(WindowFilter::ON_CURRENT_DESKTOP).size() > 1)
11741176
=== modified file 'launcher/DesktopLauncherIcon.cpp'
--- launcher/DesktopLauncherIcon.cpp 2013-10-13 23:09:05 +0000
+++ launcher/DesktopLauncherIcon.cpp 2014-12-17 12:14:47 +0000
@@ -33,7 +33,9 @@
33 : SimpleLauncherIcon(IconType::DESKTOP)33 : SimpleLauncherIcon(IconType::DESKTOP)
34 , show_in_switcher_(true)34 , show_in_switcher_(true)
35{35{
36 tooltip_text = _("Show Desktop");36 WindowManager::Default().show_desktop_changed.connect(sigc::mem_fun(this, &DesktopLauncherIcon::UpdateTooltipText));
37
38 UpdateTooltipText();
37 icon_name = "desktop";39 icon_name = "desktop";
38 SetQuirk(Quirk::VISIBLE, true);40 SetQuirk(Quirk::VISIBLE, true);
39 SetShortcut('d');41 SetShortcut('d');
@@ -43,6 +45,16 @@
43{45{
44 SimpleLauncherIcon::ActivateLauncherIcon(arg);46 SimpleLauncherIcon::ActivateLauncherIcon(arg);
45 WindowManager::Default().ShowDesktop();47 WindowManager::Default().ShowDesktop();
48 UpdateTooltipText();
49}
50
51void DesktopLauncherIcon::UpdateTooltipText()
52{
53 auto const& wm = WindowManager::Default();
54 if (wm.InShowDesktop())
55 tooltip_text = _("Restore Windows");
56 else
57 tooltip_text = _("Show Desktop");
46}58}
4759
48std::string DesktopLauncherIcon::GetName() const60std::string DesktopLauncherIcon::GetName() const
4961
=== modified file 'launcher/DesktopLauncherIcon.h'
--- launcher/DesktopLauncherIcon.h 2013-08-05 13:59:08 +0000
+++ launcher/DesktopLauncherIcon.h 2014-12-17 12:14:47 +0000
@@ -41,6 +41,8 @@
41 std::string GetRemoteUri() const;41 std::string GetRemoteUri() const;
4242
43private:43private:
44 void UpdateTooltipText();
45
44 bool show_in_switcher_;46 bool show_in_switcher_;
45};47};
4648
4749
=== modified file 'launcher/Launcher.cpp'
--- launcher/Launcher.cpp 2014-08-06 14:19:10 +0000
+++ launcher/Launcher.cpp 2014-12-17 12:14:47 +0000
@@ -1219,6 +1219,7 @@
1219 Resize(nux::Point(monitor_geo.x, monitor_geo.y + panel_height), monitor_geo.height - panel_height);1219 Resize(nux::Point(monitor_geo.x, monitor_geo.y + panel_height), monitor_geo.height - panel_height);
12201220
1221 icon_renderer_->monitor = new_monitor;1221 icon_renderer_->monitor = new_monitor;
1222 icon_renderer_->scale = cv_->DPIScale();
1222 SetIconSize(options()->tile_size, options()->icon_size);1223 SetIconSize(options()->tile_size, options()->icon_size);
1223}1224}
12241225
@@ -1516,10 +1517,7 @@
15161517
1517void Launcher::SetIconSize(int tile_size, int icon_size)1518void Launcher::SetIconSize(int tile_size, int icon_size)
1518{1519{
1519 ui::IconRenderer::DestroyShortcutTextures();
1520
1521 icon_size_ = tile_size;1520 icon_size_ = tile_size;
1522 icon_renderer_->scale = cv_->DPIScale();
1523 icon_renderer_->SetTargetSize(icon_size_.CP(cv_), RawPixel(icon_size).CP(cv_), SPACE_BETWEEN_ICONS.CP(cv_));1521 icon_renderer_->SetTargetSize(icon_size_.CP(cv_), RawPixel(icon_size).CP(cv_), SPACE_BETWEEN_ICONS.CP(cv_));
1524 AbstractLauncherIcon::icon_size = icon_size_;1522 AbstractLauncherIcon::icon_size = icon_size_;
15251523
15261524
=== modified file 'launcher/LauncherIcon.cpp'
--- launcher/LauncherIcon.cpp 2014-05-28 12:14:44 +0000
+++ launcher/LauncherIcon.cpp 2014-12-17 12:14:47 +0000
@@ -59,6 +59,9 @@
59const std::string CENTER_STABILIZE_TIMEOUT = "center-stabilize-timeout";59const std::string CENTER_STABILIZE_TIMEOUT = "center-stabilize-timeout";
60const std::string PRESENT_TIMEOUT = "present-timeout";60const std::string PRESENT_TIMEOUT = "present-timeout";
61const std::string QUIRK_DELAY_TIMEOUT = "quirk-delay-timeout";61const std::string QUIRK_DELAY_TIMEOUT = "quirk-delay-timeout";
62
63const int COUNT_FONT_SIZE = 11;
64const int COUNT_PADDING = 2;
62}65}
6366
64NUX_IMPLEMENT_OBJECT_TYPE(LauncherIcon);67NUX_IMPLEMENT_OBJECT_TYPE(LauncherIcon);
@@ -69,7 +72,6 @@
69LauncherIcon::LauncherIcon(IconType type)72LauncherIcon::LauncherIcon(IconType type)
70 : _icon_type(type)73 : _icon_type(type)
71 , _sticky(false)74 , _sticky(false)
72 , _remote_urgent(false)
73 , _present_urgency(0)75 , _present_urgency(0)
74 , _progress(0.0f)76 , _progress(0.0f)
75 , _sort_priority(DefaultPriority(type))77 , _sort_priority(DefaultPriority(type))
@@ -100,6 +102,11 @@
100 mouse_up.connect(sigc::mem_fun(this, &LauncherIcon::RecvMouseUp));102 mouse_up.connect(sigc::mem_fun(this, &LauncherIcon::RecvMouseUp));
101 mouse_click.connect(sigc::mem_fun(this, &LauncherIcon::RecvMouseClick));103 mouse_click.connect(sigc::mem_fun(this, &LauncherIcon::RecvMouseClick));
102104
105 auto const& count_rebuild_cb = sigc::mem_fun(this, &LauncherIcon::CleanCountTextures);
106 Settings::Instance().dpi_changed.connect(count_rebuild_cb);
107 Settings::Instance().font_scaling.changed.connect(sigc::hide(count_rebuild_cb));
108 icon_size.changed.connect(sigc::hide(count_rebuild_cb));
109
103 for (unsigned i = 0; i < monitors::MAX; ++i)110 for (unsigned i = 0; i < monitors::MAX; ++i)
104 {111 {
105 for (unsigned j = 0; j < static_cast<unsigned>(Quirk::LAST); ++j)112 for (unsigned j = 0; j < static_cast<unsigned>(Quirk::LAST); ++j)
@@ -966,14 +973,42 @@
966 return result;973 return result;
967}974}
968975
969nux::BaseTexture*976nux::BaseTexture* LauncherIcon::Emblem() const
970LauncherIcon::Emblem()
971{977{
972 return _emblem.GetPointer();978 return _emblem.GetPointer();
973}979}
974980
975void981nux::BaseTexture* LauncherIcon::CountTexture(double scale)
976LauncherIcon::SetEmblem(LauncherIcon::BaseTexturePtr const& emblem)982{
983 int count = Count();
984
985 if (!count)
986 return nullptr;
987
988 auto it = _counts.find(scale);
989
990 if (it != _counts.end())
991 return it->second.GetPointer();
992
993 auto const& texture = DrawCountTexture(count, scale);
994 _counts[scale] = texture;
995 return texture.GetPointer();
996}
997
998unsigned LauncherIcon::Count() const
999{
1000 if (!_remote_entries.empty())
1001 {
1002 auto const& remote = _remote_entries.front();
1003
1004 if (remote->CountVisible())
1005 return remote->Count();
1006 }
1007
1008 return 0;
1009}
1010
1011void LauncherIcon::SetEmblem(LauncherIcon::BaseTexturePtr const& emblem)
977{1012{
978 _emblem = emblem;1013 _emblem = emblem;
979 EmitNeedsRedraw();1014 EmitNeedsRedraw();
@@ -994,56 +1029,43 @@
994 emblem->UnReference();1029 emblem->UnReference();
995}1030}
9961031
997void1032void LauncherIcon::CleanCountTextures()
998LauncherIcon::SetEmblemText(std::string const& text)1033{
999{1034 _counts.clear();
1000 PangoLayout* layout = NULL;1035 EmitNeedsRedraw();
10011036}
1002 PangoContext* pangoCtx = NULL;1037
1003 PangoFontDescription* desc = NULL;1038BaseTexturePtr LauncherIcon::DrawCountTexture(unsigned count, double scale)
1004 GdkScreen* screen = gdk_screen_get_default(); // not ref'ed1039{
1005 GtkSettings* settings = gtk_settings_get_default(); // not ref'ed1040 glib::Object<PangoContext> pango_ctx(gdk_pango_context_get());
1006 gchar* fontName = NULL;1041 glib::Object<PangoLayout> layout(pango_layout_new(pango_ctx));
10071042
1008 int width = 32;1043 glib::String font_name;
1009 int height = 8 * 2;1044 g_object_get(gtk_settings_get_default(), "gtk-font-name", &font_name, nullptr);
1010 int font_height = height - 5;1045 std::shared_ptr<PangoFontDescription> desc(pango_font_description_from_string(font_name), pango_font_description_free);
10111046 int font_size = pango_units_from_double(Settings::Instance().font_scaling() * COUNT_FONT_SIZE);
10121047 pango_font_description_set_absolute_size(desc.get(), font_size);
1013 nux::CairoGraphics cg(CAIRO_FORMAT_ARGB32, width, height);1048 pango_layout_set_font_description(layout, desc.get());
1049
1050 pango_layout_set_width(layout, pango_units_from_double(icon_size() * 0.75));
1051 pango_layout_set_height(layout, -1);
1052 pango_layout_set_wrap(layout, PANGO_WRAP_CHAR);
1053 pango_layout_set_ellipsize(layout, PANGO_ELLIPSIZE_MIDDLE);
1054 pango_layout_set_text(layout, std::to_string(count).c_str(), -1);
1055
1056 PangoRectangle ink_rect;
1057 pango_layout_get_pixel_extents(layout, &ink_rect, nullptr);
1058
1059 /* DRAW OUTLINE */
1060 const float height = ink_rect.height + COUNT_PADDING * 4;
1061 const float inset = height / 2.0;
1062 const float radius = inset - 1.0f;
1063 const float width = ink_rect.width + inset + COUNT_PADDING * 2;
1064
1065 nux::CairoGraphics cg(CAIRO_FORMAT_ARGB32, std::round(width * scale), std::round(height * scale));
1066 cairo_surface_set_device_scale(cg.GetSurface(), scale, scale);
1014 cairo_t* cr = cg.GetInternalContext();1067 cairo_t* cr = cg.GetInternalContext();
10151068
1016 cairo_set_operator(cr, CAIRO_OPERATOR_CLEAR);
1017 cairo_paint(cr);
1018
1019 cairo_set_operator(cr, CAIRO_OPERATOR_OVER);
1020
1021
1022 layout = pango_cairo_create_layout(cr);
1023
1024 g_object_get(settings, "gtk-font-name", &fontName, NULL);
1025 desc = pango_font_description_from_string(fontName);
1026 pango_font_description_set_absolute_size(desc, pango_units_from_double(font_height));
1027
1028 pango_layout_set_font_description(layout, desc);
1029 pango_font_description_free(desc);
1030
1031 pango_layout_set_width(layout, pango_units_from_double(width - 4.0f));
1032 pango_layout_set_wrap(layout, PANGO_WRAP_WORD_CHAR);
1033 pango_layout_set_ellipsize(layout, PANGO_ELLIPSIZE_NONE);
1034 pango_layout_set_markup_with_accel(layout, text.c_str(), -1, '_', NULL);
1035
1036 pangoCtx = pango_layout_get_context(layout); // is not ref'ed
1037 pango_cairo_context_set_font_options(pangoCtx,
1038 gdk_screen_get_font_options(screen));
1039
1040 PangoRectangle logical_rect, ink_rect;
1041 pango_layout_get_extents(layout, &logical_rect, &ink_rect);
1042
1043 /* DRAW OUTLINE */
1044 float radius = height / 2.0f - 1.0f;
1045 float inset = radius + 1.0f;
1046
1047 cairo_move_to(cr, inset, height - 1.0f);1069 cairo_move_to(cr, inset, height - 1.0f);
1048 cairo_arc(cr, inset, inset, radius, 0.5 * M_PI, 1.5 * M_PI);1070 cairo_arc(cr, inset, inset, radius, 0.5 * M_PI, 1.5 * M_PI);
1049 cairo_arc(cr, width - inset, inset, radius, 1.5 * M_PI, 0.5 * M_PI);1071 cairo_arc(cr, width - inset, inset, radius, 1.5 * M_PI, 0.5 * M_PI);
@@ -1059,16 +1081,11 @@
1059 cairo_set_line_width(cr, 1.0f);1081 cairo_set_line_width(cr, 1.0f);
10601082
1061 /* DRAW TEXT */1083 /* DRAW TEXT */
1062 cairo_move_to(cr,1084 cairo_move_to(cr, (width - ink_rect.width) / 2.0 - ink_rect.x,
1063 (int)((width - pango_units_to_double(logical_rect.width)) / 2.0f),1085 (height - ink_rect.height) / 2.0 - ink_rect.y);
1064 (int)((height - pango_units_to_double(logical_rect.height)) / 2.0f - pango_units_to_double(logical_rect.y)));
1065 pango_cairo_show_layout(cr, layout);1086 pango_cairo_show_layout(cr, layout);
10661087
1067 SetEmblem(texture_ptr_from_cairo_graphics(cg));1088 return texture_ptr_from_cairo_graphics(cg);
1068
1069 // clean up
1070 g_object_unref(layout);
1071 g_free(fontName);
1072}1089}
10731090
1074void1091void
@@ -1077,26 +1094,34 @@
1077 SetEmblem(BaseTexturePtr());1094 SetEmblem(BaseTexturePtr());
1078}1095}
10791096
1080void1097void LauncherIcon::InsertEntryRemote(LauncherEntryRemote::Ptr const& remote)
1081LauncherIcon::InsertEntryRemote(LauncherEntryRemote::Ptr const& remote)
1082{1098{
1083 if (std::find(_entry_list.begin(), _entry_list.end(), remote) != _entry_list.end())1099 if (!remote || std::find(_remote_entries.begin(), _remote_entries.end(), remote) != _remote_entries.end())
1084 return;1100 return;
10851101
1086 _entry_list.push_front(remote);1102 _remote_entries.push_back(remote);
1087 AddChild(remote.get());1103 AddChild(remote.get());
10881104 SelectEntryRemote(remote);
1089 remote->emblem_changed.connect(sigc::mem_fun(this, &LauncherIcon::OnRemoteEmblemChanged));1105}
1090 remote->count_changed.connect(sigc::mem_fun(this, &LauncherIcon::OnRemoteCountChanged));1106
1091 remote->progress_changed.connect(sigc::mem_fun(this, &LauncherIcon::OnRemoteProgressChanged));1107void LauncherIcon::SelectEntryRemote(LauncherEntryRemote::Ptr const& remote)
1092 remote->quicklist_changed.connect(sigc::mem_fun(this, &LauncherIcon::OnRemoteQuicklistChanged));1108{
10931109 if (!remote)
1094 remote->emblem_visible_changed.connect(sigc::mem_fun(this, &LauncherIcon::OnRemoteEmblemVisibleChanged));1110 return;
1095 remote->count_visible_changed.connect(sigc::mem_fun(this, &LauncherIcon::OnRemoteCountVisibleChanged));1111
1096 remote->progress_visible_changed.connect(sigc::mem_fun(this, &LauncherIcon::OnRemoteProgressVisibleChanged));1112 auto& cm = _remote_connections;
10971113 cm.Clear();
1098 remote->urgent_changed.connect(sigc::mem_fun(this, &LauncherIcon::OnRemoteUrgentChanged));1114
10991115 cm.Add(remote->emblem_changed.connect(sigc::mem_fun(this, &LauncherIcon::OnRemoteEmblemChanged)));
1116 cm.Add(remote->count_changed.connect(sigc::mem_fun(this, &LauncherIcon::OnRemoteCountChanged)));
1117 cm.Add(remote->progress_changed.connect(sigc::mem_fun(this, &LauncherIcon::OnRemoteProgressChanged)));
1118 cm.Add(remote->quicklist_changed.connect(sigc::mem_fun(this, &LauncherIcon::OnRemoteQuicklistChanged)));
1119
1120 cm.Add(remote->emblem_visible_changed.connect(sigc::mem_fun(this, &LauncherIcon::OnRemoteEmblemVisibleChanged)));
1121 cm.Add(remote->count_visible_changed.connect(sigc::mem_fun(this, &LauncherIcon::OnRemoteCountVisibleChanged)));
1122 cm.Add(remote->progress_visible_changed.connect(sigc::mem_fun(this, &LauncherIcon::OnRemoteProgressVisibleChanged)));
1123
1124 cm.Add(remote->urgent_changed.connect(sigc::mem_fun(this, &LauncherIcon::OnRemoteUrgentChanged)));
11001125
1101 if (remote->EmblemVisible())1126 if (remote->EmblemVisible())
1102 OnRemoteEmblemVisibleChanged(remote.get());1127 OnRemoteEmblemVisibleChanged(remote.get());
@@ -1113,28 +1138,30 @@
1113 OnRemoteQuicklistChanged(remote.get());1138 OnRemoteQuicklistChanged(remote.get());
1114}1139}
11151140
1116void1141void LauncherIcon::RemoveEntryRemote(LauncherEntryRemote::Ptr const& remote)
1117LauncherIcon::RemoveEntryRemote(LauncherEntryRemote::Ptr const& remote)
1118{1142{
1119 if (std::find(_entry_list.begin(), _entry_list.end(), remote) == _entry_list.end())1143 auto remote_it = std::find(_remote_entries.begin(), _remote_entries.end(), remote);
1144
1145 if (remote_it == _remote_entries.end())
1120 return;1146 return;
11211147
1122 _entry_list.remove(remote);1148 SetQuirk(Quirk::PROGRESS, false);
1149
1150 if (remote->Urgent())
1151 SetQuirk(Quirk::URGENT, false);
1152
1153 _remote_entries.erase(remote_it);
1123 RemoveChild(remote.get());1154 RemoveChild(remote.get());
1124
1125 DeleteEmblem();1155 DeleteEmblem();
1126 SetQuirk(Quirk::PROGRESS, false);
1127
1128 if (_remote_urgent)
1129 SetQuirk(Quirk::URGENT, false);
1130
1131 _remote_menus = nullptr;1156 _remote_menus = nullptr;
1157
1158 if (!_remote_entries.empty())
1159 SelectEntryRemote(_remote_entries.back());
1132}1160}
11331161
1134void1162void
1135LauncherIcon::OnRemoteUrgentChanged(LauncherEntryRemote* remote)1163LauncherIcon::OnRemoteUrgentChanged(LauncherEntryRemote* remote)
1136{1164{
1137 _remote_urgent = remote->Urgent();
1138 SetQuirk(Quirk::URGENT, remote->Urgent());1165 SetQuirk(Quirk::URGENT, remote->Urgent());
1139}1166}
11401167
@@ -1153,14 +1180,7 @@
1153 if (!remote->CountVisible())1180 if (!remote->CountVisible())
1154 return;1181 return;
11551182
1156 if (remote->Count() / 10000 != 0)1183 CleanCountTextures();
1157 {
1158 SetEmblemText("****");
1159 }
1160 else
1161 {
1162 SetEmblemText(std::to_string(remote->Count()));
1163 }
1164}1184}
11651185
1166void1186void
@@ -1190,14 +1210,7 @@
1190void1210void
1191LauncherIcon::OnRemoteCountVisibleChanged(LauncherEntryRemote* remote)1211LauncherIcon::OnRemoteCountVisibleChanged(LauncherEntryRemote* remote)
1192{1212{
1193 if (remote->CountVisible())1213 CleanCountTextures();
1194 {
1195 SetEmblemText(std::to_string(remote->Count()));
1196 }
1197 else
1198 {
1199 DeleteEmblem();
1200 }
1201}1214}
12021215
1203void1216void
12041217
=== modified file 'launcher/LauncherIcon.h'
--- launcher/LauncherIcon.h 2014-05-28 09:56:00 +0000
+++ launcher/LauncherIcon.h 2014-12-17 12:14:47 +0000
@@ -154,14 +154,15 @@
154 }154 }
155155
156 nux::BaseTexture* TextureForSize(int size);156 nux::BaseTexture* TextureForSize(int size);
157157 nux::BaseTexture* Emblem() const override;
158 nux::BaseTexture* Emblem();158 nux::BaseTexture* CountTexture(double scale) override;
159159
160 MenuItemsVector Menus();160 MenuItemsVector Menus();
161161 unsigned Count() const;
162 void InsertEntryRemote(LauncherEntryRemote::Ptr const& remote);162
163163 void InsertEntryRemote(LauncherEntryRemote::Ptr const&);
164 void RemoveEntryRemote(LauncherEntryRemote::Ptr const& remote);164 void SelectEntryRemote(LauncherEntryRemote::Ptr const&);
165 void RemoveEntryRemote(LauncherEntryRemote::Ptr const&);
165166
166 nux::DndAction QueryAcceptDrop(DndData const& dnd_data)167 nux::DndAction QueryAcceptDrop(DndData const& dnd_data)
167 {168 {
@@ -323,9 +324,10 @@
323 void LoadQuicklist();324 void LoadQuicklist();
324325
325 void OnTooltipEnabledChanged(bool value);326 void OnTooltipEnabledChanged(bool value);
327 void CleanCountTextures();
328 BaseTexturePtr DrawCountTexture(unsigned count, double scale);
326329
327 bool _sticky;330 bool _sticky;
328 bool _remote_urgent;
329 float _present_urgency;331 float _present_urgency;
330 float _progress;332 float _progress;
331 int _sort_priority;333 int _sort_priority;
@@ -346,8 +348,10 @@
346 time::Spec _last_action;348 time::Spec _last_action;
347349
348 BaseTexturePtr _emblem;350 BaseTexturePtr _emblem;
351 std::unordered_map<double, BaseTexturePtr> _counts;
349352
350 std::list<LauncherEntryRemote::Ptr> _entry_list;353 std::vector<LauncherEntryRemote::Ptr> _remote_entries;
354 connection::Manager _remote_connections;
351 glib::Object<DbusmenuClient> _remote_menus;355 glib::Object<DbusmenuClient> _remote_menus;
352356
353 static glib::Object<GtkIconTheme> _unity_theme;357 static glib::Object<GtkIconTheme> _unity_theme;
354358
=== modified file 'launcher/MockLauncherIcon.h'
--- launcher/MockLauncherIcon.h 2013-12-11 15:03:25 +0000
+++ launcher/MockLauncherIcon.h 2014-12-17 12:14:47 +0000
@@ -329,11 +329,6 @@
329 return icon_;329 return icon_;
330 }330 }
331331
332 nux::BaseTexture* Emblem()
333 {
334 return 0;
335 }
336
337 MenuItemsVector Menus()332 MenuItemsVector Menus()
338 {333 {
339 return MenuItemsVector ();334 return MenuItemsVector ();
340335
=== modified file 'launcher/SwitcherView.cpp'
--- launcher/SwitcherView.cpp 2014-08-06 14:19:10 +0000
+++ launcher/SwitcherView.cpp 2014-12-17 12:14:47 +0000
@@ -76,9 +76,10 @@
76 icon_renderer_->pip_style = OVER_TILE;76 icon_renderer_->pip_style = OVER_TILE;
77 icon_renderer_->monitor = monitors::MAX;77 icon_renderer_->monitor = monitors::MAX;
78 icon_renderer_->SetTargetSize(tile_size, icon_size, minimum_spacing);78 icon_renderer_->SetTargetSize(tile_size, icon_size, minimum_spacing);
79 icon_renderer_->scale = scale();
7980
80 text_view_->SetMaximumWidth(tile_size * TEXT_TILE_MULTIPLIER);81 text_view_->SetMaximumWidth(tile_size * TEXT_TILE_MULTIPLIER);
81 text_view_->SetLines(1);82 text_view_->SetLines(-1);
82 text_view_->SetTextColor(nux::color::White);83 text_view_->SetTextColor(nux::color::White);
83 text_view_->SetFont("Ubuntu Bold 10");84 text_view_->SetFont("Ubuntu Bold 10");
84 text_view_->SetScale(scale);85 text_view_->SetScale(scale);
@@ -196,6 +197,7 @@
196 tile_size = TILE_SIZE.CP(scale);197 tile_size = TILE_SIZE.CP(scale);
197 text_size = TEXT_SIZE.CP(scale);198 text_size = TEXT_SIZE.CP(scale);
198 vertical_size = tile_size + VERTICAL_PADDING.CP(scale) * 2;199 vertical_size = tile_size + VERTICAL_PADDING.CP(scale) * 2;
200 icon_renderer_->scale = scale;
199}201}
200202
201void SwitcherView::StartAnimation()203void SwitcherView::StartAnimation()
@@ -540,6 +542,12 @@
540 arg.backlight_intensity = 0.7f;542 arg.backlight_intensity = 0.7f;
541 }543 }
542544
545 if (icon->GetQuirk(AbstractLauncherIcon::Quirk::PROGRESS, monitor))
546 {
547 arg.progress_bias = 0.0;
548 arg.progress = CLAMP(icon->GetProgress(), 0.0f, 1.0f);
549 }
550
543 return arg;551 return arg;
544}552}
545553
546554
=== modified file 'launcher/Tooltip.cpp'
--- launcher/Tooltip.cpp 2014-03-24 23:44:58 +0000
+++ launcher/Tooltip.cpp 2014-12-17 12:14:47 +0000
@@ -144,11 +144,12 @@
144 _tooltip_text->SetMinimumWidth(text_min_width);144 _tooltip_text->SetMinimumWidth(text_min_width);
145 _tooltip_text->SetMinimumHeight(text_height);145 _tooltip_text->SetMinimumHeight(text_height);
146146
147 int space_height = _padding.CP(cv_) + CORNER_RADIUS.CP(cv_);
147 if (text_height < ANCHOR_HEIGHT.CP(cv_))148 if (text_height < ANCHOR_HEIGHT.CP(cv_))
148 {149 space_height += (ANCHOR_HEIGHT.CP(cv_) - text_height) / 2;
149 _top_space->SetMinMaxSize(1, (ANCHOR_HEIGHT.CP(cv_) - text_height) / 2 + _padding.CP(cv_) + CORNER_RADIUS.CP(cv_));150
150 _bottom_space->SetMinMaxSize(1, (ANCHOR_HEIGHT.CP(cv_) - text_height) / 2 + 1 + _padding.CP(cv_) + CORNER_RADIUS.CP(cv_));151 _top_space->SetMinMaxSize(1, space_height);
151 }152 _bottom_space->SetMinMaxSize(1, space_height + 1);
152153
153 CairoBaseWindow::PreLayoutManagement();154 CairoBaseWindow::PreLayoutManagement();
154}155}
155156
=== modified file 'lockscreen/BackgroundSettings.cpp'
--- lockscreen/BackgroundSettings.cpp 2014-04-10 01:16:32 +0000
+++ lockscreen/BackgroundSettings.cpp 2014-12-17 12:14:47 +0000
@@ -25,6 +25,7 @@
25#include "LockScreenSettings.h"25#include "LockScreenSettings.h"
26#include "unity-shared/CairoTexture.h"26#include "unity-shared/CairoTexture.h"
27#include "unity-shared/PanelStyle.h"27#include "unity-shared/PanelStyle.h"
28#include "unity-shared/UnitySettings.h"
28#include "unity-shared/UScreen.h"29#include "unity-shared/UScreen.h"
2930
30namespace unity31namespace unity
@@ -35,7 +36,7 @@
35{36{
36const std::string SETTINGS_NAME = "org.gnome.desktop.background";37const std::string SETTINGS_NAME = "org.gnome.desktop.background";
3738
38constexpr int GetGridOffset(int size) { return (size % Settings::GRID_SIZE) / 2; }39inline int GetGridOffset(int size) { return (size % Settings::GRID_SIZE) / 2; }
39}40}
4041
41BackgroundSettings::BackgroundSettings()42BackgroundSettings::BackgroundSettings()
@@ -45,26 +46,27 @@
45 gnome_bg_load_from_preferences(gnome_bg_, settings);46 gnome_bg_load_from_preferences(gnome_bg_, settings);
46}47}
4748
48BackgroundSettings::~BackgroundSettings()
49{}
50
51BaseTexturePtr BackgroundSettings::GetBackgroundTexture(int monitor)49BaseTexturePtr BackgroundSettings::GetBackgroundTexture(int monitor)
52{50{
53 nux::Geometry const& geo = UScreen::GetDefault()->GetMonitorGeometry(monitor);51 nux::Geometry const& geo = UScreen::GetDefault()->GetMonitorGeometry(monitor);
52 double scale = unity::Settings::Instance().em(monitor)->DPIScale();
54 auto& settings = Settings::Instance();53 auto& settings = Settings::Instance();
5554
56 nux::CairoGraphics cairo_graphics(CAIRO_FORMAT_ARGB32, geo.width, geo.height);55 nux::CairoGraphics cairo_graphics(CAIRO_FORMAT_ARGB32, geo.width, geo.height);
56 cairo_surface_set_device_scale(cairo_graphics.GetSurface(), scale, scale);
57 cairo_t* c = cairo_graphics.GetInternalContext();57 cairo_t* c = cairo_graphics.GetInternalContext();
5858
59 double s_width = geo.width / scale;
60 double s_height = geo.height / scale;
59 cairo_surface_t* bg_surface = nullptr;61 cairo_surface_t* bg_surface = nullptr;
6062
61 if (settings.use_user_background())63 if (settings.use_user_background())
62 {64 {
63 bg_surface = gnome_bg_create_surface(gnome_bg_, gdk_get_default_root_window(), geo.width, geo.height, FALSE);65 bg_surface = gnome_bg_create_surface(gnome_bg_, gdk_get_default_root_window(), s_width, s_height, FALSE);
64 }66 }
65 else if (!settings.background().empty())67 else if (!settings.background().empty())
66 {68 {
67 glib::Object<GdkPixbuf> pixbuf(gdk_pixbuf_new_from_file_at_scale(settings.background().c_str(), geo.width, geo.height, FALSE, NULL));69 glib::Object<GdkPixbuf> pixbuf(gdk_pixbuf_new_from_file_at_scale(settings.background().c_str(), s_width, s_height, FALSE, NULL));
6870
69 if (pixbuf)71 if (pixbuf)
70 bg_surface = gdk_cairo_surface_create_from_pixbuf(pixbuf, 0, NULL);72 bg_surface = gdk_cairo_surface_create_from_pixbuf(pixbuf, 0, NULL);
@@ -85,15 +87,15 @@
8587
86 if (!settings.logo().empty())88 if (!settings.logo().empty())
87 {89 {
88 int grid_x_offset = GetGridOffset(geo.width);90 int grid_x_offset = GetGridOffset(s_width);
89 int grid_y_offset = GetGridOffset(geo.height);91 int grid_y_offset = GetGridOffset(s_height);
90 cairo_surface_t* logo_surface = cairo_image_surface_create_from_png(settings.logo().c_str());92 cairo_surface_t* logo_surface = cairo_image_surface_create_from_png(settings.logo().c_str());
9193
92 if (logo_surface)94 if (logo_surface)
93 {95 {
94 int height = cairo_image_surface_get_height(logo_surface);96 int height = cairo_image_surface_get_height(logo_surface);
95 int x = grid_x_offset;97 int x = grid_x_offset;
96 int y = grid_y_offset + Settings::GRID_SIZE * (geo.height / Settings::GRID_SIZE - 1) - height;98 int y = grid_y_offset + Settings::GRID_SIZE * (s_height / Settings::GRID_SIZE - 1) - height;
9799
98 cairo_save(c);100 cairo_save(c);
99 cairo_translate(c, x, y);101 cairo_translate(c, x, y);
@@ -107,8 +109,8 @@
107109
108 if (settings.draw_grid())110 if (settings.draw_grid())
109 {111 {
110 int width = geo.width;112 double width = s_width;
111 int height = geo.height;113 double height = s_height;
112 int grid_x_offset = GetGridOffset(width);114 int grid_x_offset = GetGridOffset(width);
113 int grid_y_offset = GetGridOffset(height) + panel::Style::Instance().PanelHeight(monitor);115 int grid_y_offset = GetGridOffset(height) + panel::Style::Instance().PanelHeight(monitor);
114116
115117
=== modified file 'lockscreen/BackgroundSettings.h'
--- lockscreen/BackgroundSettings.h 2014-03-06 03:55:03 +0000
+++ lockscreen/BackgroundSettings.h 2014-12-17 12:14:47 +0000
@@ -41,7 +41,6 @@
41{41{
42public:42public:
43 BackgroundSettings();43 BackgroundSettings();
44 ~BackgroundSettings();
4544
46 BaseTexturePtr GetBackgroundTexture(int monitor);45 BaseTexturePtr GetBackgroundTexture(int monitor);
4746
4847
=== modified file 'lockscreen/CMakeLists.txt'
--- lockscreen/CMakeLists.txt 2014-04-18 11:45:59 +0000
+++ lockscreen/CMakeLists.txt 2014-12-17 12:14:47 +0000
@@ -27,6 +27,8 @@
27 LockScreenAcceleratorController.cpp27 LockScreenAcceleratorController.cpp
28 LockScreenAccelerators.cpp28 LockScreenAccelerators.cpp
29 ScreenSaverDBusManager.cpp29 ScreenSaverDBusManager.cpp
30 ShutdownNotifier.cpp
31 SuspendNotifier.cpp
30 UserAuthenticatorPam.cpp32 UserAuthenticatorPam.cpp
31 UserPromptView.cpp33 UserPromptView.cpp
32 )34 )
3335
=== modified file 'lockscreen/CofView.cpp'
--- lockscreen/CofView.cpp 2014-02-13 13:57:57 +0000
+++ lockscreen/CofView.cpp 2014-12-17 12:14:47 +0000
@@ -18,6 +18,7 @@
18*/18*/
1919
20#include "CofView.h"20#include "CofView.h"
21#include "unity-shared/RawPixel.h"
2122
22#include "config.h"23#include "config.h"
2324
@@ -25,11 +26,23 @@
25{26{
26namespace lockscreen27namespace lockscreen
27{28{
29namespace
30{
31const std::string COF_FILE = "cof.png";
32}
2833
29CofView::CofView()34CofView::CofView()
30 // FIXME (andy) if we get an svg cof we can make it fullscreen independent.35 // FIXME (andy) if we get an svg cof we can make it fullscreen independent.
31 : IconTexture(PKGDATADIR"/cof.png", 66)36 : IconTexture(PKGDATADIR"/"+COF_FILE, -1)
32{}37 , scale(1.0)
38{
39 scale.changed.connect([this] (double scale) {
40 int w, h;
41 gdk_pixbuf_get_file_info((PKGDATADIR"/" + COF_FILE).c_str(), &w, &h);
42 SetSize(RawPixel(std::max(w, h)).CP(scale));
43 ReLoadIcon();
44 });
45}
3346
34nux::Area* CofView::FindAreaUnderMouse(nux::Point const& mouse_position,47nux::Area* CofView::FindAreaUnderMouse(nux::Point const& mouse_position,
35 nux::NuxEventType event_type)48 nux::NuxEventType event_type)
3649
=== modified file 'lockscreen/CofView.h'
--- lockscreen/CofView.h 2014-02-13 13:57:57 +0000
+++ lockscreen/CofView.h 2014-12-17 12:14:47 +0000
@@ -27,11 +27,13 @@
27namespace lockscreen27namespace lockscreen
28{28{
2929
30class CofView : public unity::IconTexture30class CofView : public IconTexture
31{31{
32public:32public:
33 CofView();33 CofView();
3434
35 nux::Property<double> scale;
36
35 nux::Area* FindAreaUnderMouse(nux::Point const& mouse_position,37 nux::Area* FindAreaUnderMouse(nux::Point const& mouse_position,
36 nux::NuxEventType event_type) override;38 nux::NuxEventType event_type) override;
37};39};
3840
=== modified file 'lockscreen/LockScreenAbstractShield.h'
--- lockscreen/LockScreenAbstractShield.h 2014-06-23 19:42:24 +0000
+++ lockscreen/LockScreenAbstractShield.h 2014-12-17 12:14:47 +0000
@@ -32,25 +32,37 @@
32namespace lockscreen32namespace lockscreen
33{33{
3434
35class UserPromptView;
36
35class AbstractShield : public MockableBaseWindow37class AbstractShield : public MockableBaseWindow
36{38{
37public:39public:
38 AbstractShield(session::Manager::Ptr const& session, indicator::Indicators::Ptr const& indicators, Accelerators::Ptr const& accelerators, int monitor_num, bool is_primary)40 AbstractShield(session::Manager::Ptr const& session,
41 indicator::Indicators::Ptr const& indicators,
42 Accelerators::Ptr const& accelerators,
43 nux::ObjectPtr<UserPromptView> const& prompt_view,
44 int monitor_num, bool is_primary)
39 : MockableBaseWindow("Unity Lockscreen")45 : MockableBaseWindow("Unity Lockscreen")
40 , primary(is_primary)46 , primary(is_primary)
41 , monitor(monitor_num)47 , monitor(monitor_num)
48 , scale(1.0)
42 , session_manager_(session)49 , session_manager_(session)
43 , indicators_(indicators)50 , indicators_(indicators)
44 , accelerators_(accelerators)51 , accelerators_(accelerators)
52 , prompt_view_(prompt_view)
45 {}53 {}
4654
47 nux::Property<bool> primary;55 nux::Property<bool> primary;
48 nux::Property<int> monitor;56 nux::Property<int> monitor;
57 nux::Property<double> scale;
4958
50 using MockableBaseWindow::RemoveLayout;59 using MockableBaseWindow::RemoveLayout;
60 virtual bool HasGrab() const = 0;
51 virtual bool IsIndicatorOpen() const = 0;61 virtual bool IsIndicatorOpen() const = 0;
52 virtual void ActivatePanel() = 0;62 virtual void ActivatePanel() = 0;
5363
64 sigc::signal<void> grabbed;
65 sigc::signal<void> grab_failed;
54 sigc::signal<void, int, int> grab_motion;66 sigc::signal<void, int, int> grab_motion;
55 sigc::signal<void, unsigned long, unsigned long> grab_key;67 sigc::signal<void, unsigned long, unsigned long> grab_key;
5668
@@ -58,6 +70,7 @@
58 session::Manager::Ptr session_manager_;70 session::Manager::Ptr session_manager_;
59 indicator::Indicators::Ptr indicators_;71 indicator::Indicators::Ptr indicators_;
60 Accelerators::Ptr accelerators_;72 Accelerators::Ptr accelerators_;
73 nux::ObjectPtr<UserPromptView> prompt_view_;
61};74};
6275
63} // lockscreen76} // lockscreen
6477
=== modified file 'lockscreen/LockScreenController.cpp'
--- lockscreen/LockScreenController.cpp 2014-08-06 14:11:17 +0000
+++ lockscreen/LockScreenController.cpp 2014-12-17 12:14:47 +0000
@@ -20,6 +20,7 @@
20#include "LockScreenController.h"20#include "LockScreenController.h"
2121
22#include <UnityCore/DBusIndicators.h>22#include <UnityCore/DBusIndicators.h>
23#include <UnityCore/GLibDBusProxy.h>
23#include <NuxCore/Logger.h>24#include <NuxCore/Logger.h>
2425
25#include "LockScreenShield.h"26#include "LockScreenShield.h"
@@ -59,6 +60,7 @@
59 , session_manager_(session_manager)60 , session_manager_(session_manager)
60 , upstart_wrapper_(upstart_wrapper)61 , upstart_wrapper_(upstart_wrapper)
61 , shield_factory_(shield_factory)62 , shield_factory_(shield_factory)
63 , suspend_notifier_(std::make_shared<SuspendNotifier>())
62 , fade_animator_(LOCK_FADE_DURATION)64 , fade_animator_(LOCK_FADE_DURATION)
63 , blank_window_animator_(IDLE_FADE_DURATION)65 , blank_window_animator_(IDLE_FADE_DURATION)
64 , test_mode_(test_mode)66 , test_mode_(test_mode)
@@ -77,7 +79,7 @@
77 });79 });
78 hidden_window_connection_->block();80 hidden_window_connection_->block();
7981
80 suspend_connection_ = uscreen->suspending.connect([this] {82 suspend_notifier_->RegisterInterest([this](){
81 if (Settings::Instance().lock_on_suspend())83 if (Settings::Instance().lock_on_suspend())
82 session_manager_->PromptLockScreen();84 session_manager_->PromptLockScreen();
83 });85 });
@@ -100,8 +102,7 @@
100 fade_animator_.finished.connect([this] {102 fade_animator_.finished.connect([this] {
101 if (animation::GetDirection(fade_animator_) == animation::Direction::BACKWARD)103 if (animation::GetDirection(fade_animator_) == animation::Direction::BACKWARD)
102 {104 {
103 motion_connection_->disconnect();105 primary_shield_connections_.Clear();
104 key_connection_->disconnect();
105 uscreen_connection_->block();106 uscreen_connection_->block();
106 hidden_window_connection_->block();107 hidden_window_connection_->block();
107 session_manager_->is_locked = false;108 session_manager_->is_locked = false;
@@ -173,10 +174,7 @@
173 primary_shield_ = shield;174 primary_shield_ = shield;
174 shield->primary = true;175 shield->primary = true;
175 nux::GetWindowCompositor().SetAlwaysOnFrontWindow(primary_shield_.GetPointer());176 nux::GetWindowCompositor().SetAlwaysOnFrontWindow(primary_shield_.GetPointer());
176 auto move_cb = sigc::mem_fun(this, &Controller::OnPrimaryShieldMotion);177 SetupPrimaryShieldConnections();
177 motion_connection_ = shield->grab_motion.connect(move_cb);
178 auto key_cb = sigc::hide(sigc::hide(sigc::mem_fun(this, &Controller::ResetPostLockScreenSaver)));
179 key_connection_ = shield->grab_key.connect(key_cb);
180 break;178 break;
181 }179 }
182 }180 }
@@ -184,14 +182,52 @@
184 ResetPostLockScreenSaver();182 ResetPostLockScreenSaver();
185}183}
186184
185void Controller::SetupPrimaryShieldConnections()
186{
187 if (!primary_shield_.IsValid())
188 return;
189
190 primary_shield_connections_.Clear();
191
192 auto move_cb = sigc::mem_fun(this, &Controller::OnPrimaryShieldMotion);
193 primary_shield_connections_.Add(primary_shield_->grab_motion.connect(move_cb));
194
195 auto key_cb = sigc::hide(sigc::hide(sigc::mem_fun(this, &Controller::ResetPostLockScreenSaver)));
196 primary_shield_connections_.Add(primary_shield_->grab_key.connect(key_cb));
197
198 if (!session_manager_->is_locked())
199 {
200 primary_shield_connections_.Add(primary_shield_->grabbed.connect([this] {
201 session_manager_->is_locked = true;
202 }));
203
204 primary_shield_connections_.Add(primary_shield_->grab_failed.connect([this] {
205 if (!session_manager_->is_locked())
206 {
207 LOG_ERROR(logger) << "Impossible to get the grab to lock the screen";
208 session_manager_->unlock_requested.emit();
209 }
210 }));
211 }
212}
213
187void Controller::EnsureShields(std::vector<nux::Geometry> const& monitors)214void Controller::EnsureShields(std::vector<nux::Geometry> const& monitors)
188{215{
189 int num_monitors = monitors.size();216 int num_monitors = monitors.size();
190 int shields_size = shields_.size();217 int shields_size = shields_.size();
191 int primary = UScreen::GetDefault()->GetMonitorWithMouse();218 int primary = UScreen::GetDefault()->GetMonitorWithMouse();
192219
220 // Keep a reference of the old prompt_view
221 nux::ObjectPtr<UserPromptView> prompt_view(prompt_view_.GetPointer());
222
193 shields_.resize(num_monitors);223 shields_.resize(num_monitors);
194224
225 if (!prompt_view)
226 {
227 prompt_view = test_mode_ ? nullptr : new UserPromptView(session_manager_);
228 prompt_view_ = prompt_view.GetPointer();
229 }
230
195 for (int i = 0; i < num_monitors; ++i)231 for (int i = 0; i < num_monitors; ++i)
196 {232 {
197 auto& shield = shields_[i];233 auto& shield = shields_[i];
@@ -199,7 +235,7 @@
199235
200 if (i >= shields_size)236 if (i >= shields_size)
201 {237 {
202 shield = shield_factory_->CreateShield(session_manager_, indicators_, accelerator_controller_->GetAccelerators(), i, i == primary);238 shield = shield_factory_->CreateShield(session_manager_, indicators_, accelerator_controller_->GetAccelerators(), prompt_view, i, i == primary);
203 is_new = true;239 is_new = true;
204 }240 }
205241
@@ -208,7 +244,7 @@
208244
209 shield->SetGeometry(new_geo);245 shield->SetGeometry(new_geo);
210 shield->SetMinMaxSize(new_geo.width, new_geo.height);246 shield->SetMinMaxSize(new_geo.width, new_geo.height);
211 shield->primary = (i == primary);247 shield->primary = false;
212 shield->monitor = i;248 shield->monitor = i;
213249
214 // XXX: manually emit nux::Area::geometry_changed beucase nux can fail to emit it.250 // XXX: manually emit nux::Area::geometry_changed beucase nux can fail to emit it.
@@ -224,10 +260,7 @@
224260
225 primary_shield_ = shields_[primary];261 primary_shield_ = shields_[primary];
226 primary_shield_->primary = true;262 primary_shield_->primary = true;
227 auto move_cb = sigc::mem_fun(this, &Controller::OnPrimaryShieldMotion);263 SetupPrimaryShieldConnections();
228 motion_connection_ = primary_shield_->grab_motion.connect(move_cb);
229 auto key_cb = sigc::hide(sigc::hide(sigc::mem_fun(this, &Controller::ResetPostLockScreenSaver)));
230 key_connection_ = primary_shield_->grab_key.connect(key_cb);
231}264}
232265
233void Controller::EnsureBlankWindow()266void Controller::EnsureBlankWindow()
@@ -349,7 +382,6 @@
349 HideBlankWindow();382 HideBlankWindow();
350383
351 LockScreen();384 LockScreen();
352 session_manager_->is_locked = true;
353385
354 if (prompt_activation_)386 if (prompt_activation_)
355 {387 {
@@ -410,6 +442,11 @@
410 indicators_ = std::make_shared<indicator::LockScreenDBusIndicators>();442 indicators_ = std::make_shared<indicator::LockScreenDBusIndicators>();
411 upstart_wrapper_->Emit("desktop-lock");443 upstart_wrapper_->Emit("desktop-lock");
412444
445 shutdown_notifier_ = std::make_shared<ShutdownNotifier>();
446 shutdown_notifier_->RegisterInterest([](){
447 WindowManager::Default().UnmapAllNoNuxWindowsSync();
448 });
449
413 accelerator_controller_ = std::make_shared<AcceleratorController>(session_manager_);450 accelerator_controller_ = std::make_shared<AcceleratorController>(session_manager_);
414 auto activate_key = WindowManager::Default().activate_indicators_key();451 auto activate_key = WindowManager::Default().activate_indicators_key();
415 auto accelerator = std::make_shared<Accelerator>(activate_key.second, 0, activate_key.first);452 auto accelerator = std::make_shared<Accelerator>(activate_key.second, 0, activate_key.first);
@@ -435,6 +472,7 @@
435 shield->PushToFront();472 shield->PushToFront();
436 });473 });
437474
475 session_manager_->is_locked = primary_shield_->HasGrab();
438 nux::GetWindowCompositor().SetAlwaysOnFrontWindow(primary_shield_.GetPointer());476 nux::GetWindowCompositor().SetAlwaysOnFrontWindow(primary_shield_.GetPointer());
439 animation::StartOrReverse(fade_animator_, animation::Direction::FORWARD);477 animation::StartOrReverse(fade_animator_, animation::Direction::FORWARD);
440}478}
@@ -447,6 +485,8 @@
447485
448void Controller::OnUnlockRequested()486void Controller::OnUnlockRequested()
449{487{
488 shutdown_notifier_.reset();
489
450 lockscreen_timeout_.reset();490 lockscreen_timeout_.reset();
451 screensaver_post_lock_timeout_.reset();491 screensaver_post_lock_timeout_.reset();
452492
453493
=== modified file 'lockscreen/LockScreenController.h'
--- lockscreen/LockScreenController.h 2014-06-23 19:21:17 +0000
+++ lockscreen/LockScreenController.h 2014-12-17 12:14:47 +0000
@@ -27,6 +27,9 @@
27#include "LockScreenShieldFactory.h"27#include "LockScreenShieldFactory.h"
28#include "LockScreenAcceleratorController.h"28#include "LockScreenAcceleratorController.h"
29#include "ScreenSaverDBusManager.h"29#include "ScreenSaverDBusManager.h"
30#include "ShutdownNotifier.h"
31#include "SuspendNotifier.h"
32#include "UserPromptView.h"
30#include "unity-shared/BackgroundEffectHelper.h"33#include "unity-shared/BackgroundEffectHelper.h"
31#include "unity-shared/UpstartWrapper.h"34#include "unity-shared/UpstartWrapper.h"
3235
@@ -35,9 +38,13 @@
35namespace lockscreen38namespace lockscreen
36{39{
3740
41class UserPromptView;
42
38class Controller : public sigc::trackable43class Controller : public sigc::trackable
39{44{
40public:45public:
46 typedef std::shared_ptr<Controller> Ptr;
47
41 Controller(DBusManager::Ptr const&, session::Manager::Ptr const&,48 Controller(DBusManager::Ptr const&, session::Manager::Ptr const&,
42 UpstartWrapper::Ptr const& upstart_wrapper = std::make_shared<UpstartWrapper>(),49 UpstartWrapper::Ptr const& upstart_wrapper = std::make_shared<UpstartWrapper>(),
43 ShieldFactoryInterface::Ptr const& shield_factory = std::make_shared<ShieldFactory>(),50 ShieldFactoryInterface::Ptr const& shield_factory = std::make_shared<ShieldFactory>(),
@@ -61,6 +68,7 @@
61 void BlankWindowGrabEnable(bool grab);68 void BlankWindowGrabEnable(bool grab);
62 void SimulateActivity();69 void SimulateActivity();
63 void ResetPostLockScreenSaver();70 void ResetPostLockScreenSaver();
71 void SetupPrimaryShieldConnections();
64 void ActivatePanel();72 void ActivatePanel();
6573
66 void OnLockRequested(bool prompt);74 void OnLockRequested(bool prompt);
@@ -71,6 +79,7 @@
7179
72 std::vector<nux::ObjectPtr<AbstractShield>> shields_;80 std::vector<nux::ObjectPtr<AbstractShield>> shields_;
73 nux::ObjectWeakPtr<AbstractShield> primary_shield_;81 nux::ObjectWeakPtr<AbstractShield> primary_shield_;
82 nux::ObjectWeakPtr<UserPromptView> prompt_view_;
74 nux::ObjectPtr<nux::BaseWindow> blank_window_;83 nux::ObjectPtr<nux::BaseWindow> blank_window_;
7584
76 DBusManager::Ptr dbus_manager_;85 DBusManager::Ptr dbus_manager_;
@@ -79,6 +88,8 @@
79 AcceleratorController::Ptr accelerator_controller_;88 AcceleratorController::Ptr accelerator_controller_;
80 UpstartWrapper::Ptr upstart_wrapper_;89 UpstartWrapper::Ptr upstart_wrapper_;
81 ShieldFactoryInterface::Ptr shield_factory_;90 ShieldFactoryInterface::Ptr shield_factory_;
91 ShutdownNotifier::Ptr shutdown_notifier_;
92 SuspendNotifier::Ptr suspend_notifier_;
8293
83 nux::animation::AnimateValue<double> fade_animator_;94 nux::animation::AnimateValue<double> fade_animator_;
84 nux::animation::AnimateValue<double> blank_window_animator_;95 nux::animation::AnimateValue<double> blank_window_animator_;
@@ -88,10 +99,8 @@
88 BlurType old_blur_type_;99 BlurType old_blur_type_;
89100
90 connection::Wrapper uscreen_connection_;101 connection::Wrapper uscreen_connection_;
91 connection::Wrapper suspend_connection_;
92 connection::Wrapper hidden_window_connection_;102 connection::Wrapper hidden_window_connection_;
93 connection::Wrapper motion_connection_;103 connection::Manager primary_shield_connections_;
94 connection::Wrapper key_connection_;
95104
96 glib::Source::UniquePtr lockscreen_timeout_;105 glib::Source::UniquePtr lockscreen_timeout_;
97 glib::Source::UniquePtr lockscreen_delay_timeout_;106 glib::Source::UniquePtr lockscreen_delay_timeout_;
98107
=== modified file 'lockscreen/LockScreenPanel.cpp'
--- lockscreen/LockScreenPanel.cpp 2014-06-23 15:29:36 +0000
+++ lockscreen/LockScreenPanel.cpp 2014-12-17 12:14:47 +0000
@@ -82,7 +82,9 @@
82 indicators_->on_entry_activate_request.connect(sigc::mem_fun(this, &Panel::OnEntryActivateRequest));82 indicators_->on_entry_activate_request.connect(sigc::mem_fun(this, &Panel::OnEntryActivateRequest));
8383
84 monitor.changed.connect([this, hostname] (int monitor) {84 monitor.changed.connect([this, hostname] (int monitor) {
85 hostname->SetScale(unity::Settings::Instance().em(monitor)->DPIScale());85 double scale = unity::Settings::Instance().em(monitor)->DPIScale();
86 hostname->SetScale(scale);
87 static_cast<nux::HLayout*>(GetLayout())->SetLeftAndRightPadding(PADDING.CP(scale), 0);
86 indicators_view_->SetMonitor(monitor);88 indicators_view_->SetMonitor(monitor);
87 BuildTexture();89 BuildTexture();
88 QueueRelayout();90 QueueRelayout();
@@ -108,12 +110,39 @@
108 return;110 return;
109111
110 indicators_view_->AddIndicator(indicator);112 indicators_view_->AddIndicator(indicator);
113
114 if (!active)
115 {
116 for (auto const& entry : indicator->GetEntries())
117 {
118 if (entry->active())
119 {
120 active = true;
121 indicators_view_->ActivateEntry(entry->id());
122 OnEntryActivated(GetPanelName(), entry->id(), entry->geometry());
123 break;
124 }
125 }
126 }
127
111 QueueRelayout();128 QueueRelayout();
112 QueueDraw();129 QueueDraw();
113}130}
114131
115void Panel::RemoveIndicator(indicator::Indicator::Ptr const& indicator)132void Panel::RemoveIndicator(indicator::Indicator::Ptr const& indicator)
116{133{
134 if (active)
135 {
136 for (auto const& entry : indicator->GetEntries())
137 {
138 if (entry->active())
139 {
140 active = false;
141 break;
142 }
143 }
144 }
145
117 indicators_view_->RemoveIndicator(indicator);146 indicators_view_->RemoveIndicator(indicator);
118 QueueRelayout();147 QueueRelayout();
119 QueueDraw();148 QueueDraw();
@@ -121,7 +150,7 @@
121150
122std::string Panel::GetPanelName() const151std::string Panel::GetPanelName() const
123{152{
124 return "LockScreenPanel" + std::to_string(monitor);153 return "LockScreenPanel";
125}154}
126155
127void Panel::OnIndicatorViewUpdated()156void Panel::OnIndicatorViewUpdated()
128157
=== modified file 'lockscreen/LockScreenSettings.cpp'
--- lockscreen/LockScreenSettings.cpp 2014-04-09 01:36:22 +0000
+++ lockscreen/LockScreenSettings.cpp 2014-12-17 12:14:47 +0000
@@ -55,6 +55,8 @@
55const std::string USE_OSK = "screen-keyboard-enabled";55const std::string USE_OSK = "screen-keyboard-enabled";
56}56}
5757
58const RawPixel Settings::GRID_SIZE = 40_em;
59
58struct Settings::Impl60struct Settings::Impl
59{61{
60 Impl()62 Impl()
6163
=== modified file 'lockscreen/LockScreenSettings.h'
--- lockscreen/LockScreenSettings.h 2014-04-09 01:36:22 +0000
+++ lockscreen/LockScreenSettings.h 2014-12-17 12:14:47 +0000
@@ -21,6 +21,7 @@
21#define UNITY_LOCKSCREEN_SETTINGS_H21#define UNITY_LOCKSCREEN_SETTINGS_H
2222
23#include <NuxCore/Property.h>23#include <NuxCore/Property.h>
24#include "unity-shared/RawPixel.h"
2425
25namespace unity26namespace unity
26{27{
@@ -48,7 +49,7 @@
48 nux::Property<bool> lock_on_suspend;49 nux::Property<bool> lock_on_suspend;
49 nux::Property<bool> use_legacy;50 nux::Property<bool> use_legacy;
5051
51 static const int GRID_SIZE = 40;52 static const RawPixel GRID_SIZE;
5253
53private:54private:
54 struct Impl;55 struct Impl;
5556
=== modified file 'lockscreen/LockScreenShield.cpp'
--- lockscreen/LockScreenShield.cpp 2014-08-06 14:11:17 +0000
+++ lockscreen/LockScreenShield.cpp 2014-12-17 12:14:47 +0000
@@ -19,7 +19,6 @@
1919
20#include "LockScreenShield.h"20#include "LockScreenShield.h"
2121
22#include <NuxCore/Logger.h>
23#include <Nux/VLayout.h>22#include <Nux/VLayout.h>
24#include <Nux/HLayout.h>23#include <Nux/HLayout.h>
25#include <Nux/PaintLayer.h>24#include <Nux/PaintLayer.h>
@@ -30,6 +29,7 @@
30#include "LockScreenSettings.h"29#include "LockScreenSettings.h"
31#include "UserPromptView.h"30#include "UserPromptView.h"
32#include "unity-shared/UScreen.h"31#include "unity-shared/UScreen.h"
32#include "unity-shared/UnitySettings.h"
33#include "unity-shared/WindowManager.h"33#include "unity-shared/WindowManager.h"
3434
35namespace unity35namespace unity
@@ -38,23 +38,30 @@
38{38{
39namespace39namespace
40{40{
41DECLARE_LOGGER(logger, "unity.lockscreen.shield");41const unsigned MAX_GRAB_WAIT = 100;
42const unsigned MAX_GRAB_WAIT = 50;
43}42}
4443
45Shield::Shield(session::Manager::Ptr const& session_manager, indicator::Indicators::Ptr const& indicators, Accelerators::Ptr const& accelerators, int monitor_num, bool is_primary)44Shield::Shield(session::Manager::Ptr const& session_manager,
46 : AbstractShield(session_manager, indicators, accelerators, monitor_num, is_primary)45 indicator::Indicators::Ptr const& indicators,
46 Accelerators::Ptr const& accelerators,
47 nux::ObjectPtr<UserPromptView> const& prompt_view,
48 int monitor_num, bool is_primary)
49 : AbstractShield(session_manager, indicators, accelerators, prompt_view, monitor_num, is_primary)
47 , bg_settings_(std::make_shared<BackgroundSettings>())50 , bg_settings_(std::make_shared<BackgroundSettings>())
48 , prompt_view_(nullptr)
49 , panel_view_(nullptr)51 , panel_view_(nullptr)
52 , cof_view_(nullptr)
50{53{
54 UpdateScale();
51 is_primary ? ShowPrimaryView() : ShowSecondaryView();55 is_primary ? ShowPrimaryView() : ShowSecondaryView();
5256
53 EnableInputWindow(true);57 EnableInputWindow(true);
5458
59 unity::Settings::Instance().dpi_changed.connect(sigc::mem_fun(this, &Shield::UpdateScale));
55 geometry_changed.connect([this] (nux::Area*, nux::Geometry&) { UpdateBackgroundTexture();});60 geometry_changed.connect([this] (nux::Area*, nux::Geometry&) { UpdateBackgroundTexture();});
5661
57 monitor.changed.connect([this] (int monitor) {62 monitor.changed.connect([this] (int monitor) {
63 UpdateScale();
64
58 if (panel_view_)65 if (panel_view_)
59 panel_view_->monitor = monitor;66 panel_view_->monitor = monitor;
6067
@@ -69,12 +76,31 @@
69 QueueDraw();76 QueueDraw();
70 });77 });
7178
79 scale.changed.connect([this] (double scale) {
80 if (prompt_view_ && primary())
81 prompt_view_->scale = scale;
82
83 if (cof_view_)
84 cof_view_->scale = scale;
85
86 if (prompt_layout_)
87 prompt_layout_->SetLeftAndRightPadding(2 * Settings::GRID_SIZE.CP(scale));
88
89 background_layer_.reset();
90 UpdateBackgroundTexture();
91 });
92
72 mouse_move.connect([this] (int x, int y, int, int, unsigned long, unsigned long) {93 mouse_move.connect([this] (int x, int y, int, int, unsigned long, unsigned long) {
73 auto const& abs_geo = GetAbsoluteGeometry();94 auto const& abs_geo = GetAbsoluteGeometry();
74 grab_motion.emit(abs_geo.x + x, abs_geo.y + y);95 grab_motion.emit(abs_geo.x + x, abs_geo.y + y);
75 });96 });
76}97}
7798
99void Shield::UpdateScale()
100{
101 scale = unity::Settings::Instance().em(monitor)->DPIScale();
102}
103
78void Shield::UpdateBackgroundTexture()104void Shield::UpdateBackgroundTexture()
79{105{
80 auto const& monitor_geo = UScreen::GetDefault()->GetMonitorGeometry(monitor);106 auto const& monitor_geo = UScreen::GetDefault()->GetMonitorGeometry(monitor);
@@ -95,6 +121,7 @@
95 {121 {
96 regrab_conn_->disconnect();122 regrab_conn_->disconnect();
97 regrab_timeout_.reset();123 regrab_timeout_.reset();
124 grabbed.emit();
98 }125 }
99 else126 else
100 {127 {
@@ -104,18 +131,29 @@
104 if (cancel_on_failure)131 if (cancel_on_failure)
105 {132 {
106 regrab_timeout_.reset(new glib::Timeout(MAX_GRAB_WAIT, [this] {133 regrab_timeout_.reset(new glib::Timeout(MAX_GRAB_WAIT, [this] {
107 LOG_ERROR(logger) << "Impossible to get the grab to lock the screen";134 grab_failed.emit();
108 session_manager_->unlock_requested.emit();
109 return false;135 return false;
110 }));136 }));
111 }137 }
112 }138 }
113}139}
114140
141bool Shield::HasGrab() const
142{
143 auto& wc = nux::GetWindowCompositor();
144 return (wc.GetPointerGrabArea() == this && wc.GetKeyboardGrabArea() == this);
145}
146
115void Shield::ShowPrimaryView()147void Shield::ShowPrimaryView()
116{148{
117 if (primary_layout_)149 if (primary_layout_)
118 {150 {
151 if (prompt_view_)
152 {
153 prompt_view_->scale = scale();
154 prompt_layout_->AddView(prompt_view_.GetPointer());
155 }
156
119 GrabScreen(false);157 GrabScreen(false);
120 SetLayout(primary_layout_.GetPointer());158 SetLayout(primary_layout_.GetPointer());
121 return;159 return;
@@ -128,20 +166,26 @@
128166
129 main_layout->AddView(CreatePanel());167 main_layout->AddView(CreatePanel());
130168
131 nux::HLayout* prompt_layout = new nux::HLayout();169 prompt_layout_ = new nux::HLayout();
132 prompt_layout->SetLeftAndRightPadding(2 * Settings::GRID_SIZE);170 prompt_layout_->SetLeftAndRightPadding(2 * Settings::GRID_SIZE.CP(scale));
133171
134 prompt_view_ = CreatePromptView();172 if (prompt_view_)
135 prompt_layout->AddView(prompt_view_);173 {
174 prompt_view_->scale = scale();
175 prompt_layout_->AddView(prompt_view_.GetPointer());
176 }
136177
137 // 10 is just a random number to center the prompt view.178 // 10 is just a random number to center the prompt view.
138 main_layout->AddSpace(0, 10);179 main_layout->AddSpace(0, 10);
139 main_layout->AddLayout(prompt_layout);180 main_layout->AddLayout(prompt_layout_.GetPointer());
140 main_layout->AddSpace(0, 10);181 main_layout->AddSpace(0, 10);
141}182}
142183
143void Shield::ShowSecondaryView()184void Shield::ShowSecondaryView()
144{185{
186 if (prompt_layout_)
187 prompt_layout_->RemoveChildObject(prompt_view_.GetPointer());
188
145 if (cof_layout_)189 if (cof_layout_)
146 {190 {
147 SetLayout(cof_layout_.GetPointer());191 SetLayout(cof_layout_.GetPointer());
@@ -153,8 +197,9 @@
153 SetLayout(cof_layout_.GetPointer());197 SetLayout(cof_layout_.GetPointer());
154198
155 // The circle of friends199 // The circle of friends
156 CofView* cof_view = new CofView();200 cof_view_ = new CofView();
157 main_layout->AddView(cof_view);201 cof_view_->scale = scale();
202 main_layout->AddView(cof_view_);
158}203}
159204
160Panel* Shield::CreatePanel()205Panel* Shield::CreatePanel()
@@ -182,20 +227,6 @@
182 return panel_view_;227 return panel_view_;
183}228}
184229
185UserPromptView* Shield::CreatePromptView()
186{
187 auto* prompt_view = new UserPromptView(session_manager_);
188
189 auto width = 8 * Settings::GRID_SIZE;
190 auto height = 3 * Settings::GRID_SIZE;
191
192 prompt_view->SetMinimumWidth(width);
193 prompt_view->SetMaximumWidth(width);
194 prompt_view->SetMinimumHeight(height);
195
196 return prompt_view;
197}
198
199nux::Area* Shield::FindKeyFocusArea(unsigned etype, unsigned long keysym, unsigned long modifiers)230nux::Area* Shield::FindKeyFocusArea(unsigned etype, unsigned long keysym, unsigned long modifiers)
200{231{
201 if (primary)232 if (primary)
202233
=== modified file 'lockscreen/LockScreenShield.h'
--- lockscreen/LockScreenShield.h 2014-08-06 14:11:17 +0000
+++ lockscreen/LockScreenShield.h 2014-12-17 12:14:47 +0000
@@ -33,12 +33,18 @@
33class UserAuthenticator;33class UserAuthenticator;
34class UserPromptView;34class UserPromptView;
35class Panel;35class Panel;
36class CofView;
3637
37class Shield : public AbstractShield38class Shield : public AbstractShield
38{39{
39public:40public:
40 Shield(session::Manager::Ptr const&, indicator::Indicators::Ptr const&, Accelerators::Ptr const&, int monitor, bool is_primary);41 Shield(session::Manager::Ptr const&,
42 indicator::Indicators::Ptr const&,
43 Accelerators::Ptr const&,
44 nux::ObjectPtr<UserPromptView> const&,
45 int monitor, bool is_primary);
4146
47 bool HasGrab() const override;
42 bool IsIndicatorOpen() const override;48 bool IsIndicatorOpen() const override;
43 void ActivatePanel() override;49 void ActivatePanel() override;
4450
@@ -52,18 +58,19 @@
52 void GrabScreen(bool cancel_on_failure);58 void GrabScreen(bool cancel_on_failure);
53 void ShowPrimaryView();59 void ShowPrimaryView();
54 void ShowSecondaryView();60 void ShowSecondaryView();
61 void UpdateScale();
55 Panel* CreatePanel();62 Panel* CreatePanel();
56 UserPromptView* CreatePromptView();
5763
58 std::shared_ptr<BackgroundSettings> bg_settings_;64 std::shared_ptr<BackgroundSettings> bg_settings_;
59 std::unique_ptr<nux::AbstractPaintLayer> background_layer_;65 std::unique_ptr<nux::AbstractPaintLayer> background_layer_;
60 nux::ObjectPtr<nux::Layout> primary_layout_;66 nux::ObjectPtr<nux::Layout> primary_layout_;
67 nux::ObjectPtr<nux::Layout> prompt_layout_;
61 nux::ObjectPtr<nux::Layout> cof_layout_;68 nux::ObjectPtr<nux::Layout> cof_layout_;
62 connection::Wrapper panel_active_conn_;69 connection::Wrapper panel_active_conn_;
63 connection::Wrapper regrab_conn_;70 connection::Wrapper regrab_conn_;
64 glib::Source::UniquePtr regrab_timeout_;71 glib::Source::UniquePtr regrab_timeout_;
65 UserPromptView* prompt_view_;
66 Panel* panel_view_;72 Panel* panel_view_;
73 CofView* cof_view_;
67};74};
6875
69}76}
7077
=== modified file 'lockscreen/LockScreenShieldFactory.cpp'
--- lockscreen/LockScreenShieldFactory.cpp 2014-04-17 13:08:05 +0000
+++ lockscreen/LockScreenShieldFactory.cpp 2014-12-17 12:14:47 +0000
@@ -19,15 +19,20 @@
1919
20#include "LockScreenShieldFactory.h"20#include "LockScreenShieldFactory.h"
21#include "LockScreenShield.h"21#include "LockScreenShield.h"
22#include "UserPromptView.h"
2223
23namespace unity24namespace unity
24{25{
25namespace lockscreen26namespace lockscreen
26{27{
2728
28nux::ObjectPtr<AbstractShield> ShieldFactory::CreateShield(session::Manager::Ptr const& session_manager, indicator::Indicators::Ptr const& indicators, Accelerators::Ptr const& accelerators, int monitor, bool is_primary)29nux::ObjectPtr<AbstractShield> ShieldFactory::CreateShield(session::Manager::Ptr const& session_manager,
30 indicator::Indicators::Ptr const& indicators,
31 Accelerators::Ptr const& accelerators,
32 nux::ObjectPtr<UserPromptView> const& prompt_view,
33 int monitor, bool is_primary)
29{34{
30 return nux::ObjectPtr<Shield>(new Shield(session_manager, indicators, accelerators, monitor, is_primary));35 return nux::ObjectPtr<Shield>(new Shield(session_manager, indicators, accelerators, prompt_view, monitor, is_primary));
31}36}
3237
33}38}
3439
=== modified file 'lockscreen/LockScreenShieldFactory.h'
--- lockscreen/LockScreenShieldFactory.h 2014-04-17 13:08:05 +0000
+++ lockscreen/LockScreenShieldFactory.h 2014-12-17 12:14:47 +0000
@@ -31,18 +31,28 @@
31namespace lockscreen31namespace lockscreen
32{32{
3333
34class UserPromptView;
35
34struct ShieldFactoryInterface36struct ShieldFactoryInterface
35{37{
36 typedef std::shared_ptr<ShieldFactoryInterface> Ptr;38 typedef std::shared_ptr<ShieldFactoryInterface> Ptr;
3739
38 virtual ~ShieldFactoryInterface() = default;40 virtual ~ShieldFactoryInterface() = default;
3941
40 virtual nux::ObjectPtr<AbstractShield> CreateShield(session::Manager::Ptr const&, indicator::Indicators::Ptr const&, Accelerators::Ptr const&, int monitor, bool is_primary) = 0;42 virtual nux::ObjectPtr<AbstractShield> CreateShield(session::Manager::Ptr const&,
43 indicator::Indicators::Ptr const&,
44 Accelerators::Ptr const&,
45 nux::ObjectPtr<UserPromptView> const&,
46 int monitor, bool is_primary) = 0;
41};47};
4248
43struct ShieldFactory : ShieldFactoryInterface49struct ShieldFactory : ShieldFactoryInterface
44{50{
45 nux::ObjectPtr<AbstractShield> CreateShield(session::Manager::Ptr const&, indicator::Indicators::Ptr const&, Accelerators::Ptr const&, int monitor, bool is_primary) override;51 nux::ObjectPtr<AbstractShield> CreateShield(session::Manager::Ptr const&,
52 indicator::Indicators::Ptr const&,
53 Accelerators::Ptr const&,
54 nux::ObjectPtr<UserPromptView> const&,
55 int monitor, bool is_primary) override;
46};56};
4757
48}58}
4959
=== added file 'lockscreen/ShutdownNotifier.cpp'
--- lockscreen/ShutdownNotifier.cpp 1970-01-01 00:00:00 +0000
+++ lockscreen/ShutdownNotifier.cpp 2014-12-17 12:14:47 +0000
@@ -0,0 +1,152 @@
1/*
2 * Copyright (C) 2014 Canonical Ltd
3 *
4 * This program is free software: you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 3 as
6 * published by the Free Software Foundation.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 *
16 * Authored by: Andrea Azzarone <andrea.azzarone@canonical.com>
17 */
18
19#include "ShutdownNotifier.h"
20
21#include <NuxCore/Logger.h>
22#include "UnityCore/GLibDBusProxy.h"
23
24namespace unity
25{
26namespace lockscreen
27{
28
29DECLARE_LOGGER(logger, "unity.lockscreen.shutdownnotifier");
30
31//
32// Private Implementation
33//
34
35class ShutdownNotifier::Impl
36{
37public:
38 Impl();
39 ~Impl();
40
41 bool RegisterInterest(ShutdownCallback const& cb);
42 void UnregisterInterest();
43
44 void Inhibit();
45 void Uninhibit();
46 bool IsInhibited() const;
47
48private:
49 std::shared_ptr<glib::DBusProxy> logind_proxy_;
50 ShutdownCallback cb_;
51 gint delay_inhibit_fd_;
52};
53
54ShutdownNotifier::Impl::Impl()
55 : logind_proxy_(std::make_shared<glib::DBusProxy>("org.freedesktop.login1",
56 "/org/freedesktop/login1",
57 "org.freedesktop.login1.Manager",
58 G_BUS_TYPE_SYSTEM))
59 , delay_inhibit_fd_(-1)
60{}
61
62ShutdownNotifier::Impl::~Impl()
63{
64 UnregisterInterest();
65}
66
67bool ShutdownNotifier::Impl::RegisterInterest(ShutdownCallback const& cb)
68{
69 if (!cb or cb_)
70 return false;
71
72 cb_ = cb;
73
74 Inhibit();
75
76 logind_proxy_->Connect("PrepareForShutdown", [this](GVariant* variant) {
77 bool active = glib::Variant(variant).GetBool();
78
79 if (active)
80 {
81 cb_();
82 UnregisterInterest();
83 }
84 });
85
86 return true;
87}
88
89void ShutdownNotifier::Impl::UnregisterInterest()
90{
91 if (!cb_)
92 return;
93
94 Uninhibit();
95
96 logind_proxy_->DisconnectSignal("PrepareForShutdown");
97 cb_ = nullptr;
98}
99
100void ShutdownNotifier::Impl::Inhibit()
101{
102 if (IsInhibited())
103 return;
104
105 GVariant* args = g_variant_new("(ssss)", "shutdown", "Unity Lockscreen", "Screen is locked", "delay");
106
107 logind_proxy_->CallWithUnixFdList("Inhibit", args, [this] (GVariant* variant, glib::Error const& e) {
108 if (e)
109 {
110 LOG_ERROR(logger) << "Failed to inhbit suspend";
111 }
112 delay_inhibit_fd_ = glib::Variant(variant).GetInt32();
113 });
114}
115
116void ShutdownNotifier::Impl::Uninhibit()
117{
118 if (!IsInhibited())
119 return;
120
121 close(delay_inhibit_fd_);
122 delay_inhibit_fd_ = -1;
123}
124
125bool ShutdownNotifier::Impl::IsInhibited() const
126{
127 return delay_inhibit_fd_ != -1;
128}
129
130//
131// End Private Implementation
132//
133
134ShutdownNotifier::ShutdownNotifier()
135 : pimpl_(new(Impl))
136{}
137
138ShutdownNotifier::~ShutdownNotifier()
139{}
140
141bool ShutdownNotifier::RegisterInterest(ShutdownCallback const& cb)
142{
143 return pimpl_->RegisterInterest(cb);
144}
145
146void ShutdownNotifier::UnregisterInterest()
147{
148 pimpl_->UnregisterInterest();
149}
150
151}
152}
0153
=== added file 'lockscreen/ShutdownNotifier.h'
--- lockscreen/ShutdownNotifier.h 1970-01-01 00:00:00 +0000
+++ lockscreen/ShutdownNotifier.h 2014-12-17 12:14:47 +0000
@@ -0,0 +1,51 @@
1/*
2 * Copyright (C) 2014 Canonical Ltd
3 *
4 * This program is free software: you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 3 as
6 * published by the Free Software Foundation.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 *
16 * Authored by: Andrea Azzarone <andrea.azzarone@canonical.com>
17 */
18
19#ifndef UNITY_LOCKSCREEN_SHUTDOWN_NOTIFIER
20#define UNITY_LOCKSCREEN_SHUTDOWN_NOTIFIER
21
22#include <memory>
23#include <functional>
24
25namespace unity
26{
27namespace lockscreen
28{
29
30typedef std::function<void()> ShutdownCallback;
31
32class ShutdownNotifier
33{
34public:
35 typedef std::shared_ptr<ShutdownNotifier> Ptr;
36
37 ShutdownNotifier();
38 ~ShutdownNotifier();
39
40 bool RegisterInterest(ShutdownCallback const&);
41 void UnregisterInterest();
42
43private:
44 class Impl;
45 std::unique_ptr<Impl> pimpl_;
46};
47
48}
49}
50
51#endif
052
=== added file 'lockscreen/SuspendNotifier.cpp'
--- lockscreen/SuspendNotifier.cpp 1970-01-01 00:00:00 +0000
+++ lockscreen/SuspendNotifier.cpp 2014-12-17 12:14:47 +0000
@@ -0,0 +1,153 @@
1/*
2 * Copyright (C) 2014 Canonical Ltd
3 *
4 * This program is free software: you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 3 as
6 * published by the Free Software Foundation.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 *
16 * Authored by: Andrea Azzarone <andrea.azzarone@canonical.com>
17 */
18
19#include "SuspendNotifier.h"
20
21#include <NuxCore/Logger.h>
22#include "UnityCore/GLibDBusProxy.h"
23
24namespace unity
25{
26namespace lockscreen
27{
28
29DECLARE_LOGGER(logger, "unity.lockscreen.suspendnotifier");
30
31//
32// Private Implementation
33//
34
35class SuspendNotifier::Impl
36{
37public:
38 Impl();
39 ~Impl();
40
41 bool RegisterInterest(SuspendCallback const& cb);
42 void UnregisterInterest();
43
44 void Inhibit();
45 void Uninhibit();
46 bool IsInhibited() const;
47
48private:
49 std::shared_ptr<glib::DBusProxy> logind_proxy_;
50 SuspendCallback cb_;
51 gint delay_inhibit_fd_;
52};
53
54SuspendNotifier::Impl::Impl()
55 : logind_proxy_(std::make_shared<glib::DBusProxy>("org.freedesktop.login1",
56 "/org/freedesktop/login1",
57 "org.freedesktop.login1.Manager",
58 G_BUS_TYPE_SYSTEM))
59 , delay_inhibit_fd_(-1)
60{}
61
62SuspendNotifier::Impl::~Impl()
63{
64 UnregisterInterest();
65}
66
67bool SuspendNotifier::Impl::RegisterInterest(SuspendCallback const& cb)
68{
69 if (!cb or cb_)
70 return false;
71
72 cb_ = cb;
73
74 Inhibit();
75
76 logind_proxy_->Connect("PrepareForSleep", [this](GVariant* variant) {
77 bool active = glib::Variant(variant).GetBool();
78
79 if (active) // suspending
80 {
81 cb_();
82 Uninhibit();
83 }
84 else // resuming
85 {
86 Inhibit();
87 }
88 });
89
90 return true;
91}
92
93void SuspendNotifier::Impl::UnregisterInterest()
94{
95 Uninhibit();
96
97 logind_proxy_->DisconnectSignal("PrepareForSleep");
98 cb_ = nullptr;
99}
100
101void SuspendNotifier::Impl::Inhibit()
102{
103 if (IsInhibited())
104 return;
105
106 GVariant* args = g_variant_new("(ssss)", "sleep", "Unity Lockscreen", "Unity wants to lock screen before suspending.", "delay");
107
108 logind_proxy_->CallWithUnixFdList("Inhibit", args, [this] (GVariant* variant, glib::Error const& e) {
109 if (e)
110 {
111 LOG_ERROR(logger) << "Failed to inhbit suspend";
112 }
113 delay_inhibit_fd_ = glib::Variant(variant).GetInt32();
114 });
115}
116
117void SuspendNotifier::Impl::Uninhibit()
118{
119 if (!IsInhibited())
120 return;
121
122 close(delay_inhibit_fd_);
123 delay_inhibit_fd_ = -1;
124}
125
126bool SuspendNotifier::Impl::IsInhibited() const
127{
128 return delay_inhibit_fd_ != -1;
129}
130
131//
132// End Private Implementation
133//
134
135SuspendNotifier::SuspendNotifier()
136 : pimpl_(new(Impl))
137{}
138
139SuspendNotifier::~SuspendNotifier()
140{}
141
142bool SuspendNotifier::RegisterInterest(SuspendCallback const& cb)
143{
144 return pimpl_->RegisterInterest(cb);
145}
146
147void SuspendNotifier::UnregisterInterest()
148{
149 pimpl_->UnregisterInterest();
150}
151
152}
153}
0154
=== added file 'lockscreen/SuspendNotifier.h'
--- lockscreen/SuspendNotifier.h 1970-01-01 00:00:00 +0000
+++ lockscreen/SuspendNotifier.h 2014-12-17 12:14:47 +0000
@@ -0,0 +1,51 @@
1/*
2 * Copyright (C) 2014 Canonical Ltd
3 *
4 * This program is free software: you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 3 as
6 * published by the Free Software Foundation.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 *
16 * Authored by: Andrea Azzarone <andrea.azzarone@canonical.com>
17 */
18
19#ifndef UNITY_LOCKSCREEN_SUSPEND_NOTIFIER
20#define UNITY_LOCKSCREEN_SHUTDOWN_NOTIFIER
21
22#include <memory>
23#include <functional>
24
25namespace unity
26{
27namespace lockscreen
28{
29
30typedef std::function<void()> SuspendCallback;
31
32class SuspendNotifier
33{
34public:
35 typedef std::shared_ptr<SuspendNotifier> Ptr;
36
37 SuspendNotifier();
38 ~SuspendNotifier();
39
40 bool RegisterInterest(SuspendCallback const&);
41 void UnregisterInterest();
42
43private:
44 class Impl;
45 std::unique_ptr<Impl> pimpl_;
46};
47
48}
49}
50
51#endif
0\ No newline at end of file52\ No newline at end of file
153
=== modified file 'lockscreen/UserAuthenticatorPam.cpp'
--- lockscreen/UserAuthenticatorPam.cpp 2014-03-24 00:16:06 +0000
+++ lockscreen/UserAuthenticatorPam.cpp 2014-12-17 12:14:47 +0000
@@ -70,8 +70,7 @@
70 conversation.conv = ConversationFunction;70 conversation.conv = ConversationFunction;
71 conversation.appdata_ptr = static_cast<void*>(this);71 conversation.appdata_ptr = static_cast<void*>(this);
7272
73 // FIXME (andy) We should install our own unityshell pam file.73 return pam_start("unity", username_.c_str(),
74 return pam_start("lightdm", username_.c_str(),
75 &conversation, &pam_handle_) == PAM_SUCCESS;74 &conversation, &pam_handle_) == PAM_SUCCESS;
76}75}
7776
7877
=== modified file 'lockscreen/UserPromptView.cpp'
--- lockscreen/UserPromptView.cpp 2014-07-24 14:03:10 +0000
+++ lockscreen/UserPromptView.cpp 2014-12-17 12:14:47 +0000
@@ -19,6 +19,9 @@
1919
20#include "UserPromptView.h"20#include "UserPromptView.h"
2121
22#include "config.h"
23#include <glib/gi18n-lib.h>
24
22#include <boost/algorithm/string/trim.hpp>25#include <boost/algorithm/string/trim.hpp>
23#include <Nux/VLayout.h>26#include <Nux/VLayout.h>
2427
@@ -38,12 +41,12 @@
38const RawPixel LAYOUT_MARGIN = 10_em;41const RawPixel LAYOUT_MARGIN = 10_em;
39const RawPixel MSG_LAYOUT_MARGIN = 15_em;42const RawPixel MSG_LAYOUT_MARGIN = 15_em;
40const RawPixel PROMPT_LAYOUT_MARGIN = 5_em;43const RawPixel PROMPT_LAYOUT_MARGIN = 5_em;
41
42const int PROMPT_FONT_SIZE = 13;44const int PROMPT_FONT_SIZE = 13;
4345
44nux::AbstractPaintLayer* CrateBackgroundLayer(int width, int height)46nux::AbstractPaintLayer* CrateBackgroundLayer(double width, double height, double scale)
45{47{
46 nux::CairoGraphics cg(CAIRO_FORMAT_ARGB32, width, height);48 nux::CairoGraphics cg(CAIRO_FORMAT_ARGB32, width, height);
49 cairo_surface_set_device_scale(cg.GetSurface(), scale, scale);
47 cairo_t* cr = cg.GetInternalContext();50 cairo_t* cr = cg.GetInternalContext();
4851
49 cairo_set_source_rgba(cr, 0.1, 0.1, 0.1, 0.4);52 cairo_set_source_rgba(cr, 0.1, 0.1, 0.1, 0.4);
@@ -52,12 +55,12 @@
52 1.0,55 1.0,
53 0, 0,56 0, 0,
54 Settings::GRID_SIZE * 0.3,57 Settings::GRID_SIZE * 0.3,
55 width, height);58 width/scale, height/scale);
5659
57 cairo_fill_preserve(cr);60 cairo_fill_preserve(cr);
5861
59 cairo_set_source_rgba (cr, 0.4, 0.4, 0.4, 0.4);62 cairo_set_source_rgba(cr, 0.4, 0.4, 0.4, 0.4);
60 cairo_set_line_width (cr, 1);63 cairo_set_line_width(cr, 1);
61 cairo_stroke (cr);64 cairo_stroke (cr);
6265
63 // Create the texture layer66 // Create the texture layer
@@ -98,7 +101,11 @@
98101
99UserPromptView::UserPromptView(session::Manager::Ptr const& session_manager)102UserPromptView::UserPromptView(session::Manager::Ptr const& session_manager)
100 : nux::View(NUX_TRACKER_LOCATION)103 : nux::View(NUX_TRACKER_LOCATION)
104 , scale(1.0)
101 , session_manager_(session_manager)105 , session_manager_(session_manager)
106 , username_(nullptr)
107 , msg_layout_(nullptr)
108 , prompt_layout_(nullptr)
102{109{
103 user_authenticator_.echo_on_requested.connect([this](std::string const& message, PromiseAuthCodePtr const& promise){110 user_authenticator_.echo_on_requested.connect([this](std::string const& message, PromiseAuthCodePtr const& promise){
104 AddPrompt(message, /* visible */ true, promise);111 AddPrompt(message, /* visible */ true, promise);
@@ -120,12 +127,65 @@
120 ResetLayout();127 ResetLayout();
121 });128 });
122129
130 scale.changed.connect(sigc::hide(sigc::mem_fun(this, &UserPromptView::UpdateSize)));
131
132 UpdateSize();
123 ResetLayout();133 ResetLayout();
124134
125 user_authenticator_.AuthenticateStart(session_manager_->UserName(),135 user_authenticator_.AuthenticateStart(session_manager_->UserName(),
126 sigc::mem_fun(this, &UserPromptView::AuthenticationCb));136 sigc::mem_fun(this, &UserPromptView::AuthenticationCb));
127}137}
128138
139void UserPromptView::UpdateSize()
140{
141 auto width = 8 * Settings::GRID_SIZE.CP(scale);
142 auto height = 3 * Settings::GRID_SIZE.CP(scale);
143
144 SetMinimumWidth(width);
145 SetMaximumWidth(width);
146 SetMinimumHeight(height);
147
148 if (nux::Layout* layout = GetLayout())
149 {
150 layout->SetLeftAndRightPadding(PADDING.CP(scale));
151 layout->SetTopAndBottomPadding(PADDING.CP(scale));
152 static_cast<nux::VLayout*>(layout)->SetVerticalInternalMargin(LAYOUT_MARGIN.CP(scale));
153 }
154
155 if (username_)
156 username_->SetScale(scale);
157
158 if (msg_layout_)
159 {
160 msg_layout_->SetVerticalInternalMargin(MSG_LAYOUT_MARGIN.CP(scale));
161
162 for (auto* area : msg_layout_->GetChildren())
163 {
164 area->SetMaximumWidth(width);
165 static_cast<StaticCairoText*>(area)->SetScale(scale);
166 }
167 }
168
169 if (prompt_layout_)
170 {
171 prompt_layout_->SetVerticalInternalMargin(PROMPT_LAYOUT_MARGIN.CP(scale));
172
173 for (auto* area : prompt_layout_->GetChildren())
174 {
175 auto* text_input = static_cast<TextInput*>(area);
176 text_input->SetMinimumHeight(Settings::GRID_SIZE.CP(scale));
177 text_input->SetMaximumHeight(Settings::GRID_SIZE.CP(scale));
178 text_input->scale = scale();
179 }
180 }
181
182 bg_layer_.reset();
183
184 ComputeContentSize();
185 QueueRelayout();
186 QueueDraw();
187}
188
129bool UserPromptView::InspectKeyEvent(unsigned int eventType, unsigned int key_sym, const char* character)189bool UserPromptView::InspectKeyEvent(unsigned int eventType, unsigned int key_sym, const char* character)
130{190{
131 if ((eventType == nux::NUX_KEYDOWN) && (key_sym == NUX_VK_ESCAPE))191 if ((eventType == nux::NUX_KEYDOWN) && (key_sym == NUX_VK_ESCAPE))
@@ -145,24 +205,25 @@
145205
146 SetLayout(new nux::VLayout());206 SetLayout(new nux::VLayout());
147207
148 GetLayout()->SetLeftAndRightPadding(PADDING);208 GetLayout()->SetLeftAndRightPadding(PADDING.CP(scale));
149 GetLayout()->SetTopAndBottomPadding(PADDING);209 GetLayout()->SetTopAndBottomPadding(PADDING.CP(scale));
150 static_cast<nux::VLayout*>(GetLayout())->SetVerticalInternalMargin(LAYOUT_MARGIN);210 static_cast<nux::VLayout*>(GetLayout())->SetVerticalInternalMargin(LAYOUT_MARGIN.CP(scale));
151211
152 auto const& real_name = session_manager_->RealName();212 auto const& real_name = session_manager_->RealName();
153 auto const& name = (real_name.empty() ? session_manager_->UserName() : real_name);213 auto const& name = (real_name.empty() ? session_manager_->UserName() : real_name);
154214
155 unity::StaticCairoText* username = new unity::StaticCairoText(name);215 username_ = new unity::StaticCairoText(name);
156 username->SetFont("Ubuntu "+std::to_string(PROMPT_FONT_SIZE));216 username_->SetScale(scale);
157 GetLayout()->AddView(username);217 username_->SetFont("Ubuntu "+std::to_string(PROMPT_FONT_SIZE));
218 GetLayout()->AddView(username_);
158219
159 msg_layout_ = new nux::VLayout();220 msg_layout_ = new nux::VLayout();
160 msg_layout_->SetVerticalInternalMargin(MSG_LAYOUT_MARGIN);221 msg_layout_->SetVerticalInternalMargin(MSG_LAYOUT_MARGIN.CP(scale));
161 msg_layout_->SetReconfigureParentLayoutOnGeometryChange(true);222 msg_layout_->SetReconfigureParentLayoutOnGeometryChange(true);
162 GetLayout()->AddLayout(msg_layout_);223 GetLayout()->AddLayout(msg_layout_);
163224
164 prompt_layout_ = new nux::VLayout();225 prompt_layout_ = new nux::VLayout();
165 prompt_layout_->SetVerticalInternalMargin(PROMPT_LAYOUT_MARGIN);226 prompt_layout_->SetVerticalInternalMargin(PROMPT_LAYOUT_MARGIN.CP(scale));
166 prompt_layout_->SetReconfigureParentLayoutOnGeometryChange(true);227 prompt_layout_->SetReconfigureParentLayoutOnGeometryChange(true);
167 GetLayout()->AddLayout(prompt_layout_);228 GetLayout()->AddLayout(prompt_layout_);
168229
@@ -187,6 +248,21 @@
187 }248 }
188}249}
189250
251void UserPromptView::EnsureBGLayer()
252{
253 auto const& geo = GetGeometry();
254
255 if (bg_layer_)
256 {
257 auto const& layer_geo = bg_layer_->GetGeometry();
258
259 if (layer_geo.width == geo.width && layer_geo.height == geo.height)
260 return;
261 }
262
263 bg_layer_.reset(CrateBackgroundLayer(geo.width, geo.height, scale));
264}
265
190void UserPromptView::Draw(nux::GraphicsEngine& graphics_engine, bool /* force_draw */)266void UserPromptView::Draw(nux::GraphicsEngine& graphics_engine, bool /* force_draw */)
191{267{
192 nux::Geometry const& geo = GetGeometry();268 nux::Geometry const& geo = GetGeometry();
@@ -194,7 +270,7 @@
194 graphics_engine.PushClippingRectangle(geo);270 graphics_engine.PushClippingRectangle(geo);
195 nux::GetPainter().PaintBackground(graphics_engine, geo);271 nux::GetPainter().PaintBackground(graphics_engine, geo);
196272
197 bg_layer_.reset(CrateBackgroundLayer(geo.width, geo.height));273 EnsureBGLayer();
198 nux::GetPainter().PushDrawLayer(graphics_engine, geo, bg_layer_.get());274 nux::GetPainter().PushDrawLayer(graphics_engine, geo, bg_layer_.get());
199275
200 nux::GetPainter().PopBackground();276 nux::GetPainter().PopBackground();
@@ -208,7 +284,7 @@
208284
209 if (!IsFullRedraw())285 if (!IsFullRedraw())
210 {286 {
211 bg_layer_.reset(CrateBackgroundLayer(geo.width, geo.height));287 EnsureBGLayer();
212 nux::GetPainter().PushLayer(graphics_engine, geo, bg_layer_.get());288 nux::GetPainter().PushLayer(graphics_engine, geo, bg_layer_.get());
213 }289 }
214290
@@ -238,16 +314,18 @@
238 auto* text_input = new unity::TextInput();314 auto* text_input = new unity::TextInput();
239 auto* text_entry = text_input->text_entry();315 auto* text_entry = text_input->text_entry();
240316
317 text_input->scale = scale();
241 text_input->input_hint = SanitizeMessage(message);318 text_input->input_hint = SanitizeMessage(message);
242 text_input->hint_font_size = PROMPT_FONT_SIZE;319 text_input->hint_font_size = PROMPT_FONT_SIZE;
243 text_input->show_caps_lock = true;320 text_input->show_caps_lock = true;
321 text_input->show_activator = true;
244 text_entry->SetPasswordMode(!visible);322 text_entry->SetPasswordMode(!visible);
245 text_entry->SetPasswordChar("•");323 text_entry->SetPasswordChar("•");
246 text_entry->SetToggleCursorVisibilityOnKeyFocus(true);324 text_entry->SetToggleCursorVisibilityOnKeyFocus(true);
247 text_entry->clipboard_enabled = false;325 text_entry->clipboard_enabled = false;
248326
249 text_input->SetMinimumHeight(Settings::GRID_SIZE);327 text_input->SetMinimumHeight(Settings::GRID_SIZE.CP(scale));
250 text_input->SetMaximumHeight(Settings::GRID_SIZE);328 text_input->SetMaximumHeight(Settings::GRID_SIZE.CP(scale));
251 prompt_layout_->AddView(text_input, 1);329 prompt_layout_->AddView(text_input, 1);
252 focus_queue_.push_back(text_input);330 focus_queue_.push_back(text_input);
253331
@@ -288,6 +366,7 @@
288{366{
289 nux::Geometry const& geo = GetGeometry();367 nux::Geometry const& geo = GetGeometry();
290 auto* view = new unity::StaticCairoText("");368 auto* view = new unity::StaticCairoText("");
369 view->SetScale(scale);
291 view->SetFont(Settings::Instance().font_name());370 view->SetFont(Settings::Instance().font_name());
292 view->SetTextColor(color);371 view->SetTextColor(color);
293 view->SetText(message);372 view->SetText(message);
294373
=== modified file 'lockscreen/UserPromptView.h'
--- lockscreen/UserPromptView.h 2014-04-16 19:19:41 +0000
+++ lockscreen/UserPromptView.h 2014-12-17 12:14:47 +0000
@@ -48,7 +48,8 @@
48{48{
49public:49public:
50 UserPromptView(session::Manager::Ptr const& session_manager);50 UserPromptView(session::Manager::Ptr const& session_manager);
51 ~UserPromptView() {};51
52 nux::Property<double> scale;
5253
53 nux::View* focus_view();54 nux::View* focus_view();
5455
@@ -62,17 +63,17 @@
6263
63private:64private:
64 void ResetLayout();65 void ResetLayout();
66 void UpdateSize();
67 void EnsureBGLayer();
6568
66 bool InspectKeyEvent(unsigned int eventType, unsigned int key_sym, const char* character);69 bool InspectKeyEvent(unsigned int eventType, unsigned int key_sym, const char* character);
6770
68 session::Manager::Ptr session_manager_;71 session::Manager::Ptr session_manager_;
69 UserAuthenticatorPam user_authenticator_;72 UserAuthenticatorPam user_authenticator_;
70 std::shared_ptr<nux::AbstractPaintLayer> bg_layer_;73 std::shared_ptr<nux::AbstractPaintLayer> bg_layer_;
74 StaticCairoText* username_;
71 nux::VLayout* msg_layout_;75 nux::VLayout* msg_layout_;
72 nux::VLayout* prompt_layout_;76 nux::VLayout* prompt_layout_;
73 StaticCairoText* message_;
74 StaticCairoText* error_;
75 StaticCairoText* invalid_login_;
76 std::deque<TextInput*> focus_queue_;77 std::deque<TextInput*> focus_queue_;
7778
78 nux::Geometry cached_focused_geo_;79 nux::Geometry cached_focused_geo_;
7980
=== modified file 'panel/PanelIndicatorEntryView.cpp'
--- panel/PanelIndicatorEntryView.cpp 2014-05-30 07:20:13 +0000
+++ panel/PanelIndicatorEntryView.cpp 2014-12-17 12:14:47 +0000
@@ -426,7 +426,7 @@
426 }426 }
427 }427 }
428428
429 glib::Object<PangoContext> context(gdk_pango_context_get_for_screen(gdk_screen_get_default()));429 glib::Object<PangoContext> context(gdk_pango_context_get());
430 std::shared_ptr<PangoFontDescription> desc(pango_font_description_from_string(font.c_str()), pango_font_description_free);430 std::shared_ptr<PangoFontDescription> desc(pango_font_description_from_string(font.c_str()), pango_font_description_free);
431 pango_context_set_font_description(context, desc.get());431 pango_context_set_font_description(context, desc.get());
432 pango_context_set_language(context, gtk_get_default_language());432 pango_context_set_language(context, gtk_get_default_language());
433433
=== modified file 'panel/PanelMenuView.cpp'
--- panel/PanelMenuView.cpp 2014-04-02 21:42:44 +0000
+++ panel/PanelMenuView.cpp 2014-12-17 12:14:47 +0000
@@ -20,6 +20,7 @@
2020
21#include <Nux/Nux.h>21#include <Nux/Nux.h>
22#include <NuxCore/Logger.h>22#include <NuxCore/Logger.h>
23#include <boost/algorithm/string/erase.hpp>
2324
24#include "PanelMenuView.h"25#include "PanelMenuView.h"
25#include "unity-shared/AnimationUtils.h"26#include "unity-shared/AnimationUtils.h"
@@ -53,6 +54,32 @@
53 const std::string WINDOW_ACTIVATED_TIMEOUT = "window-activated-timeout";54 const std::string WINDOW_ACTIVATED_TIMEOUT = "window-activated-timeout";
54 const std::string UPDATE_SHOW_NOW_TIMEOUT = "update-show-now-timeout";55 const std::string UPDATE_SHOW_NOW_TIMEOUT = "update-show-now-timeout";
55 const std::string INTEGRATED_MENUS_DOUBLE_CLICK_TIMEOUT = "integrated-menus-double-click-timeout";56 const std::string INTEGRATED_MENUS_DOUBLE_CLICK_TIMEOUT = "integrated-menus-double-click-timeout";
57
58std::string get_current_desktop()
59{
60 std::ifstream fin("/etc/os-release");
61 std::string temp;
62 std::string os_release_name("Ubuntu");
63
64 if (fin.is_open())
65 {
66 while (getline(fin, temp))
67 {
68 if (temp.substr(0,4) == "NAME")
69 {
70 os_release_name = boost::erase_all_copy(temp.substr(temp.find_last_of('=')+1), "\"");
71 break;
72 }
73 }
74 fin.close();
75 }
76
77 //this is done to avoid breaking translation before 14.10.
78 if (os_release_name.empty() || os_release_name == "Ubuntu")
79 return _("Ubuntu Desktop");
80 else
81 return glib::String(g_strdup_printf(_("%s Desktop"), os_release_name.c_str())).Str();
82}
56}83}
5784
58PanelMenuView::PanelMenuView(menu::Manager::Ptr const& menus)85PanelMenuView::PanelMenuView(menu::Manager::Ptr const& menus)
@@ -73,9 +100,8 @@
73 , ignore_menu_visibility_(false)100 , ignore_menu_visibility_(false)
74 , integrated_menus_(decoration::Style::Get()->integrated_menus())101 , integrated_menus_(decoration::Style::Get()->integrated_menus())
75 , active_xid_(0)102 , active_xid_(0)
76 , desktop_name_(_("Ubuntu Desktop"))103 , desktop_name_(get_current_desktop())
77{104{
78
79 BamfWindow* active_win = bamf_matcher_get_active_window(matcher_);105 BamfWindow* active_win = bamf_matcher_get_active_window(matcher_);
80 if (BAMF_IS_WINDOW(active_win))106 if (BAMF_IS_WINDOW(active_win))
81 active_xid_ = bamf_window_get_xid(active_win);107 active_xid_ = bamf_window_get_xid(active_win);
@@ -249,6 +275,9 @@
249 if (!mouse_inside)275 if (!mouse_inside)
250 return nullptr;276 return nullptr;
251277
278 if (WindowManager::Default().IsExpoActive())
279 return nullptr;
280
252 Area* found_area = nullptr;281 Area* found_area = nullptr;
253282
254 if (!integrated_menus_ && !we_control_active_ && !spread_showing_)283 if (!integrated_menus_ && !we_control_active_ && !spread_showing_)
@@ -360,14 +389,12 @@
360389
361bool PanelMenuView::ShouldDrawButtons() const390bool PanelMenuView::ShouldDrawButtons() const
362{391{
392 if (spread_showing_)
393 return true;
394
363 if (integrated_menus_)395 if (integrated_menus_)
364 {396 {
365 if (spread_showing_)397 if (!WindowManager::Default().IsExpoActive())
366 return true;
367
368 WindowManager& wm = WindowManager::Default();
369
370 if (!wm.IsExpoActive() && !wm.IsScaleActive())
371 return (GetMaximizedWindow() != 0);398 return (GetMaximizedWindow() != 0);
372399
373 return false;400 return false;
@@ -375,9 +402,7 @@
375402
376 if (we_control_active_ && is_maximized_ && !launcher_keynav_ && !switcher_showing_)403 if (we_control_active_ && is_maximized_ && !launcher_keynav_ && !switcher_showing_)
377 {404 {
378 WindowManager& wm = WindowManager::Default();405 if (!WindowManager::Default().IsExpoActive())
379
380 if (!wm.IsExpoActive())
381 {406 {
382 if (is_inside_ || show_now_activated_ || new_application_)407 if (is_inside_ || show_now_activated_ || new_application_)
383 return true;408 return true;
@@ -387,9 +412,6 @@
387 }412 }
388 }413 }
389414
390 if (spread_showing_)
391 return true;
392
393 return false;415 return false;
394}416}
395417
@@ -795,7 +817,7 @@
795 auto state = WidgetState::NORMAL;817 auto state = WidgetState::NORMAL;
796 float dpi_scale = Settings::Instance().em(monitor_)->DPIScale();818 float dpi_scale = Settings::Instance().em(monitor_)->DPIScale();
797819
798 if (integrated_menus_ && !is_desktop_focused_ && !WindowManager::Default().IsScaleActive())820 if (integrated_menus_ && !is_desktop_focused_ && !WindowManager::Default().IsExpoActive())
799 {821 {
800 title_geo_.x = geo.x + window_buttons_->GetBaseWidth() + (style->TitleIndent() * dpi_scale);822 title_geo_.x = geo.x + window_buttons_->GetBaseWidth() + (style->TitleIndent() * dpi_scale);
801823
@@ -828,10 +850,9 @@
828{850{
829 if (integrated_menus_ || (!switcher_showing_ && !launcher_keynav_))851 if (integrated_menus_ || (!switcher_showing_ && !launcher_keynav_))
830 {852 {
831 WindowManager& wm = WindowManager::Default();
832 std::string new_title;853 std::string new_title;
833854
834 if (wm.IsExpoActive())855 if (WindowManager::Default().IsExpoActive())
835 {856 {
836 new_title = desktop_name_;857 new_title = desktop_name_;
837 }858 }
@@ -1103,7 +1124,10 @@
1103 }1124 }
11041125
1105 if (is_maximized_)1126 if (is_maximized_)
1106 maximized_set_.insert(active_xid_);1127 {
1128 maximized_wins_.erase(std::remove(maximized_wins_.begin(), maximized_wins_.end(), active_xid_), maximized_wins_.end());
1129 maximized_wins_.push_front(active_xid_);
1130 }
11071131
1108 // register callback for new view1132 // register callback for new view
1109 view_name_changed_signal_.Connect(new_view, "name-changed",1133 view_name_changed_signal_.Connect(new_view, "name-changed",
@@ -1159,7 +1183,7 @@
11591183
1160void PanelMenuView::OnWindowMinimized(Window xid)1184void PanelMenuView::OnWindowMinimized(Window xid)
1161{1185{
1162 maximized_set_.erase(xid);1186 maximized_wins_.erase(std::remove(maximized_wins_.begin(), maximized_wins_.end(), xid), maximized_wins_.end());
11631187
1164 if (xid == active_xid_)1188 if (xid == active_xid_)
1165 {1189 {
@@ -1175,18 +1199,24 @@
11751199
1176void PanelMenuView::OnWindowUnminimized(Window xid)1200void PanelMenuView::OnWindowUnminimized(Window xid)
1177{1201{
1178 if (WindowManager::Default().IsWindowMaximized(xid))
1179 maximized_set_.insert(xid);
1180
1181 if (xid == active_xid_)1202 if (xid == active_xid_)
1182 {1203 {
1204 if (WindowManager::Default().IsWindowMaximized(xid))
1205 maximized_wins_.push_front(xid);
1206
1183 if (Refresh())1207 if (Refresh())
1184 QueueDraw();1208 QueueDraw();
1185 }1209 }
1186 else if (integrated_menus_ && IsWindowUnderOurControl(xid))1210 else
1187 {1211 {
1188 if (Refresh())1212 if (WindowManager::Default().IsWindowMaximized(xid))
1189 QueueDraw();1213 maximized_wins_.push_back(xid);
1214
1215 if (integrated_menus_ && IsWindowUnderOurControl(xid))
1216 {
1217 if (Refresh())
1218 QueueDraw();
1219 }
1190 }1220 }
1191}1221}
11921222
@@ -1194,7 +1224,7 @@
1194{1224{
1195 // FIXME: compiz doesn't give us a valid xid (is always 0 on unmap)1225 // FIXME: compiz doesn't give us a valid xid (is always 0 on unmap)
1196 // we need to do this again on BamfView closed signal.1226 // we need to do this again on BamfView closed signal.
1197 maximized_set_.erase(xid);1227 maximized_wins_.erase(std::remove(maximized_wins_.begin(), maximized_wins_.end(), xid), maximized_wins_.end());
11981228
1199 if (xid == active_xid_)1229 if (xid == active_xid_)
1200 {1230 {
@@ -1212,22 +1242,26 @@
1212{1242{
1213 if (WindowManager::Default().IsWindowMaximized(xid))1243 if (WindowManager::Default().IsWindowMaximized(xid))
1214 {1244 {
1215 maximized_set_.insert(xid);
1216
1217 if (xid == active_xid_)1245 if (xid == active_xid_)
1218 {1246 {
1247 maximized_wins_.push_front(xid);
1248
1219 if (Refresh())1249 if (Refresh())
1220 QueueDraw();1250 QueueDraw();
1221 }1251 }
1252 else
1253 {
1254 maximized_wins_.push_back(xid);
1255 }
1222 }1256 }
1223}1257}
12241258
1225void PanelMenuView::OnWindowMaximized(Window xid)1259void PanelMenuView::OnWindowMaximized(Window xid)
1226{1260{
1227 maximized_set_.insert(xid);
1228
1229 if (xid == active_xid_)1261 if (xid == active_xid_)
1230 {1262 {
1263 maximized_wins_.push_front(xid);
1264
1231 // We need to update the is_inside_ state in the case of maximization by grab1265 // We need to update the is_inside_ state in the case of maximization by grab
1232 auto mouse = nux::GetGraphicsDisplay()->GetMouseScreenCoord();1266 auto mouse = nux::GetGraphicsDisplay()->GetMouseScreenCoord();
1233 is_inside_ = GetAbsoluteGeometry().IsInside(mouse);1267 is_inside_ = GetAbsoluteGeometry().IsInside(mouse);
@@ -1236,16 +1270,21 @@
1236 if (Refresh())1270 if (Refresh())
1237 FullRedraw();1271 FullRedraw();
1238 }1272 }
1239 else if (integrated_menus_ && IsWindowUnderOurControl(xid))1273 else
1240 {1274 {
1241 if (Refresh())1275 maximized_wins_.push_back(xid);
1242 QueueDraw();1276
1277 if (integrated_menus_ && IsWindowUnderOurControl(xid))
1278 {
1279 if (Refresh())
1280 QueueDraw();
1281 }
1243 }1282 }
1244}1283}
12451284
1246void PanelMenuView::OnWindowRestored(Window xid)1285void PanelMenuView::OnWindowRestored(Window xid)
1247{1286{
1248 maximized_set_.erase(xid);1287 maximized_wins_.erase(std::remove(maximized_wins_.begin(), maximized_wins_.end(), xid), maximized_wins_.end());
12491288
1250 if (active_xid_ == xid)1289 if (active_xid_ == xid)
1251 {1290 {
@@ -1344,7 +1383,7 @@
1344 Window window_xid = 0;1383 Window window_xid = 0;
13451384
1346 // Find the front-most of the maximized windows we are controlling1385 // Find the front-most of the maximized windows we are controlling
1347 for (auto xid : maximized_set_)1386 for (auto xid : maximized_wins_)
1348 {1387 {
1349 // We can safely assume only the front-most is visible1388 // We can safely assume only the front-most is visible
1350 if (IsValidWindow(xid))1389 if (IsValidWindow(xid))
@@ -1769,8 +1808,8 @@
1769{1808{
1770 PanelIndicatorsView::SetMonitor(monitor);1809 PanelIndicatorsView::SetMonitor(monitor);
17711810
1811 maximized_wins_.clear();
1772 monitor_geo_ = UScreen::GetDefault()->GetMonitorGeometry(monitor_);1812 monitor_geo_ = UScreen::GetDefault()->GetMonitorGeometry(monitor_);
1773 maximized_set_.clear();
1774 GList* windows = bamf_matcher_get_window_stack_for_monitor(matcher_, monitor_);1813 GList* windows = bamf_matcher_get_window_stack_for_monitor(matcher_, monitor_);
17751814
1776 for (GList* l = windows; l; l = l->next)1815 for (GList* l = windows; l; l = l->next)
@@ -1780,12 +1819,18 @@
17801819
1781 auto window = static_cast<BamfWindow*>(l->data);1820 auto window = static_cast<BamfWindow*>(l->data);
1782 auto view = static_cast<BamfView*>(l->data);1821 auto view = static_cast<BamfView*>(l->data);
1822 auto xid = bamf_window_get_xid(window);
17831823
1784 if (bamf_view_is_active(view))1824 if (bamf_view_is_active(view))
1785 active_xid_ = bamf_window_get_xid(window);1825 active_xid_ = xid;
17861826
1787 if (bamf_window_maximized(window) == BAMF_WINDOW_MAXIMIZED)1827 if (bamf_window_maximized(window) == BAMF_WINDOW_MAXIMIZED)
1788 maximized_set_.insert(bamf_window_get_xid(window));1828 {
1829 if (xid == active_xid_)
1830 maximized_wins_.push_front(xid);
1831 else
1832 maximized_wins_.push_back(xid);
1833 }
1789 }1834 }
17901835
1791 Window maximized = GetMaximizedWindow();1836 Window maximized = GetMaximizedWindow();
17921837
=== modified file 'panel/PanelMenuView.h'
--- panel/PanelMenuView.h 2014-04-02 21:42:44 +0000
+++ panel/PanelMenuView.h 2014-12-17 12:14:47 +0000
@@ -170,7 +170,7 @@
170 bool is_desktop_focused_;170 bool is_desktop_focused_;
171171
172 PanelIndicatorEntryView* last_active_view_;172 PanelIndicatorEntryView* last_active_view_;
173 std::set<Window> maximized_set_;173 std::deque<Window> maximized_wins_;
174 glib::Object<BamfApplication> new_application_;174 glib::Object<BamfApplication> new_application_;
175 std::list<glib::Object<BamfApplication>> new_apps_;175 std::list<glib::Object<BamfApplication>> new_apps_;
176 std::string panel_title_;176 std::string panel_title_;
177177
=== modified file 'plugins/unityshell/src/unityshell.cpp'
--- plugins/unityshell/src/unityshell.cpp 2014-08-06 14:19:10 +0000
+++ plugins/unityshell/src/unityshell.cpp 2014-12-17 12:14:47 +0000
@@ -278,6 +278,7 @@
278 CompositeScreenInterface::setHandler(cScreen);278 CompositeScreenInterface::setHandler(cScreen);
279 GLScreenInterface::setHandler(gScreen);279 GLScreenInterface::setHandler(gScreen);
280 ScaleScreenInterface::setHandler(sScreen);280 ScaleScreenInterface::setHandler(sScreen);
281 screen->updateSupportedWmHints();
281282
282 PluginAdapter::Initialize(screen);283 PluginAdapter::Initialize(screen);
283 AddChild(&WindowManager::Default());284 AddChild(&WindowManager::Default());
@@ -534,7 +535,19 @@
534 else535 else
535 {536 {
536 CompMatch windows_match;537 CompMatch windows_match;
537 for (auto xid : spread_filter_->FilteredWindows())538 auto const& filtered_windows = spread_filter_->FilteredWindows();
539
540 for (auto const& swin : sScreen->getWindows())
541 {
542 if (filtered_windows.find(swin->window->id()) != filtered_windows.end())
543 continue;
544
545 auto* uwin = UnityWindow::get(swin->window);
546 uwin->OnTerminateSpread();
547 fake_decorated_windows_.erase(uwin);
548 }
549
550 for (auto xid : filtered_windows)
538 windows_match |= "xid="+std::to_string(xid);551 windows_match |= "xid="+std::to_string(xid);
539552
540 auto match = sScreen->getCustomMatch();553 auto match = sScreen->getCustomMatch();
@@ -2791,23 +2804,6 @@
2791 return "Unity";2804 return "Unity";
2792}2805}
27932806
2794bool isNuxWindow(CompWindow* value)
2795{
2796 std::vector<Window> const& xwns = nux::XInputWindow::NativeHandleList();
2797 auto id = value->id();
2798
2799 // iterate loop by hand rather than use std::find as this is considerably faster
2800 // we care about performance here because of the high frequency in which this function is
2801 // called (nearly every frame)
2802 unsigned int size = xwns.size();
2803 for (unsigned int i = 0; i < size; ++i)
2804 {
2805 if (xwns[i] == id)
2806 return true;
2807 }
2808 return false;
2809}
2810
2811void UnityScreen::RaiseInputWindows()2807void UnityScreen::RaiseInputWindows()
2812{2808{
2813 std::vector<Window> const& xwns = nux::XInputWindow::NativeHandleList();2809 std::vector<Window> const& xwns = nux::XInputWindow::NativeHandleList();
@@ -3715,7 +3711,6 @@
3715 }3711 }
37163712
3717 auto max_bounds = NuxGeometryFromCompRect(output.workArea());3713 auto max_bounds = NuxGeometryFromCompRect(output.workArea());
3718
3719 if (launcher_controller_->options()->hide_mode != LAUNCHER_HIDE_NEVER)3714 if (launcher_controller_->options()->hide_mode != LAUNCHER_HIDE_NEVER)
3720 {3715 {
3721 int monitor_width = unity_settings_.LauncherWidth(monitor);3716 int monitor_width = unity_settings_.LauncherWidth(monitor);
@@ -3729,19 +3724,18 @@
3729 layout.spacing = local::SCALE_SPACING.CP(monitor_scale);3724 layout.spacing = local::SCALE_SPACING.CP(monitor_scale);
3730 int padding = local::SCALE_PADDING.CP(monitor_scale);3725 int padding = local::SCALE_PADDING.CP(monitor_scale);
3731 max_bounds.Expand(-padding, -padding);3726 max_bounds.Expand(-padding, -padding);
3732 layout.LayoutWindows(layout_windows, max_bounds, final_bounds);3727 layout.LayoutWindowsNearest(layout_windows, max_bounds, final_bounds);
37333728
3734 auto lw_it = layout_windows.begin();3729 for (auto const& lw : layout_windows)
3735 for (auto const& sw : scaled_windows)
3736 {3730 {
3737 if (lw_it == layout_windows.end())3731 auto sw_it = std::find_if(scaled_windows.begin(), scaled_windows.end(), [&lw] (ScaleWindow* sw) {
3738 break;3732 return sw->window->id() == lw->xid;
37393733 });
3740 LayoutWindow::Ptr const& lw = *lw_it;3734
37413735 if (sw_it == scaled_windows.end())
3742 if (sw->window->id() != lw->xid)
3743 continue;3736 continue;
37443737
3738 ScaleWindow* sw = *sw_it;
3745 ScaleSlot slot(CompRectFromNuxGeo(lw->result));3739 ScaleSlot slot(CompRectFromNuxGeo(lw->result));
3746 slot.scale = lw->scale;3740 slot.scale = lw->scale;
37473741
@@ -3758,7 +3752,6 @@
3758 slot.filled = true;3752 slot.filled = true;
37593753
3760 sw->setSlot(slot);3754 sw->setSlot(slot);
3761 ++lw_it;
3762 }3755 }
3763 }3756 }
37643757
@@ -3781,6 +3774,7 @@
3781 if (hud_controller_->IsVisible())3774 if (hud_controller_->IsVisible())
3782 hud_controller_->HideHud();3775 hud_controller_->HideHud();
37833776
3777 menus_->Indicators()->CloseActiveEntry();
3784 launcher_controller_->ClearTooltips();3778 launcher_controller_->ClearTooltips();
37853779
3786 if (launcher_controller_->KeyNavIsActive())3780 if (launcher_controller_->KeyNavIsActive())
@@ -3999,7 +3993,7 @@
3999 return launcher_controller_;3993 return launcher_controller_;
4000}3994}
40013995
4002std::shared_ptr<lockscreen::Controller> UnityScreen::lockscreen_controller()3996lockscreen::Controller::Ptr UnityScreen::lockscreen_controller()
4003{3997{
4004 return lockscreen_controller_;3998 return lockscreen_controller_;
4005}3999}
@@ -4038,8 +4032,8 @@
4038void UnityScreen::ShowFirstRunHints()4032void UnityScreen::ShowFirstRunHints()
4039{4033{
4040 sources_.AddTimeoutSeconds(1, [this] {4034 sources_.AddTimeoutSeconds(1, [this] {
4041 auto const& cache_dir = DesktopUtilities::GetUserCacheDirectory();4035 auto const& config_dir = DesktopUtilities::GetUserConfigDirectory();
4042 if (!cache_dir.empty() && !g_file_test((cache_dir+local::FIRST_RUN_STAMP).c_str(), G_FILE_TEST_EXISTS))4036 if (!config_dir.empty() && !g_file_test((config_dir+local::FIRST_RUN_STAMP).c_str(), G_FILE_TEST_EXISTS))
4043 {4037 {
4044 // We focus the panel, so the shortcut hint will be hidden at first user input4038 // We focus the panel, so the shortcut hint will be hidden at first user input
4045 auto const& panels = panel_controller_->panels();4039 auto const& panels = panel_controller_->panels();
@@ -4052,7 +4046,7 @@
4052 shortcut_controller_->Show();4046 shortcut_controller_->Show();
40534047
4054 glib::Error error;4048 glib::Error error;
4055 g_file_set_contents((cache_dir+local::FIRST_RUN_STAMP).c_str(), "", 0, &error);4049 g_file_set_contents((config_dir+local::FIRST_RUN_STAMP).c_str(), "", 0, &error);
40564050
4057 if (error)4051 if (error)
4058 {4052 {
@@ -4092,7 +4086,7 @@
4092 , close_icon_state_(decoration::WidgetState::NORMAL)4086 , close_icon_state_(decoration::WidgetState::NORMAL)
4093 , deco_win_(uScreen->deco_manager_->HandleWindow(window))4087 , deco_win_(uScreen->deco_manager_->HandleWindow(window))
4094 , need_fake_deco_redraw_(false)4088 , need_fake_deco_redraw_(false)
4095 , is_nux_window_(isNuxWindow(window))4089 , is_nux_window_(PluginAdapter::IsNuxWindow(window))
4096{4090{
4097 WindowInterface::setHandler(window);4091 WindowInterface::setHandler(window);
4098 GLWindowInterface::setHandler(gWindow);4092 GLWindowInterface::setHandler(gWindow);
@@ -4428,7 +4422,7 @@
4428 }4422 }
4429 else4423 else
4430 {4424 {
4431 window->setShowDesktopMode (false);4425 window->setShowDesktopMode(false);
4432 }4426 }
4433 }4427 }
4434}4428}
44354429
=== modified file 'plugins/unityshell/src/unityshell.h'
--- plugins/unityshell/src/unityshell.h 2014-07-24 14:14:47 +0000
+++ plugins/unityshell/src/unityshell.h 2014-12-17 12:14:47 +0000
@@ -239,7 +239,7 @@
239239
240 switcher::Controller::Ptr switcher_controller();240 switcher::Controller::Ptr switcher_controller();
241 launcher::Controller::Ptr launcher_controller();241 launcher::Controller::Ptr launcher_controller();
242 std::shared_ptr<lockscreen::Controller> lockscreen_controller();242 lockscreen::Controller::Ptr lockscreen_controller();
243243
244 bool DoesPointIntersectUnityGeos(nux::Point const& pt);244 bool DoesPointIntersectUnityGeos(nux::Point const& pt);
245245
@@ -348,7 +348,7 @@
348 session::DBusManager::Ptr session_dbus_manager_;348 session::DBusManager::Ptr session_dbus_manager_;
349 session::Controller::Ptr session_controller_;349 session::Controller::Ptr session_controller_;
350 lockscreen::DBusManager::Ptr screensaver_dbus_manager_;350 lockscreen::DBusManager::Ptr screensaver_dbus_manager_;
351 std::shared_ptr<lockscreen::Controller> lockscreen_controller_;351 lockscreen::Controller::Ptr lockscreen_controller_;
352 debug::DebugDBusInterface debugger_;352 debug::DebugDBusInterface debugger_;
353 std::unique_ptr<BGHash> bghash_;353 std::unique_ptr<BGHash> bghash_;
354 spread::Filter::Ptr spread_filter_;354 spread::Filter::Ptr spread_filter_;
355355
=== added file 'resources/arrow_right.png'
356Binary files resources/arrow_right.png 1970-01-01 00:00:00 +0000 and resources/arrow_right.png 2014-12-17 12:14:47 +0000 differ356Binary files resources/arrow_right.png 1970-01-01 00:00:00 +0000 and resources/arrow_right.png 2014-12-17 12:14:47 +0000 differ
=== modified file 'services/panel-main.c'
--- services/panel-main.c 2014-03-05 17:19:50 +0000
+++ services/panel-main.c 2014-12-17 12:14:47 +0000
@@ -82,6 +82,9 @@
82 " <arg type='i' name='delta' direction='in'/>"82 " <arg type='i' name='delta' direction='in'/>"
83 " </method>"83 " </method>"
84 ""84 ""
85 ""
86 " <method name='CloseActiveEntry' />"
87 ""
85 " <signal name='EntryActivated'>"88 " <signal name='EntryActivated'>"
86 " <arg type='s' name='panel_id' />"89 " <arg type='s' name='panel_id' />"
87 " <arg type='s' name='entry_id' />"90 " <arg type='s' name='entry_id' />"
@@ -254,6 +257,11 @@
254 g_dbus_method_invocation_return_value (invocation, NULL);257 g_dbus_method_invocation_return_value (invocation, NULL);
255 g_free(entry_id);258 g_free(entry_id);
256 }259 }
260 else if (g_strcmp0 (method_name, "CloseActiveEntry") == 0)
261 {
262 panel_service_close_active_entry (service);
263 g_dbus_method_invocation_return_value (invocation, NULL);
264 }
257}265}
258266
259static void267static void
260268
=== modified file 'services/panel-service.c'
--- services/panel-service.c 2014-08-06 14:19:10 +0000
+++ services/panel-service.c 2014-12-17 12:14:47 +0000
@@ -2383,6 +2383,8 @@
2383 IndicatorObject *object;2383 IndicatorObject *object;
2384 IndicatorObjectEntry *entry;2384 IndicatorObjectEntry *entry;
23852385
2386 g_return_if_fail (PANEL_IS_SERVICE (self));
2387
2386 entry = get_indicator_entry_by_id (self, entry_id);2388 entry = get_indicator_entry_by_id (self, entry_id);
2387 g_return_if_fail (entry);2389 g_return_if_fail (entry);
23882390
@@ -2399,6 +2401,8 @@
2399 IndicatorObject *object;2401 IndicatorObject *object;
2400 IndicatorObjectEntry *entry;2402 IndicatorObjectEntry *entry;
24012403
2404 g_return_if_fail (PANEL_IS_SERVICE (self));
2405
2402 entry = get_indicator_entry_by_id (self, entry_id);2406 entry = get_indicator_entry_by_id (self, entry_id);
2403 g_return_if_fail (entry);2407 g_return_if_fail (entry);
24042408
@@ -2427,3 +2431,14 @@
2427 entry, 1, direction);2431 entry, 1, direction);
2428 }2432 }
2429}2433}
2434
2435void
2436panel_service_close_active_entry (PanelService *self)
2437{
2438 g_return_if_fail (PANEL_IS_SERVICE (self));
2439
2440 if (GTK_IS_MENU (self->priv->last_menu))
2441 {
2442 gtk_menu_popdown (GTK_MENU (self->priv->last_menu));
2443 }
2444}
24302445
=== modified file 'services/panel-service.h'
--- services/panel-service.h 2014-02-06 12:02:48 +0000
+++ services/panel-service.h 2014-12-17 12:14:47 +0000
@@ -122,6 +122,8 @@
122 const gchar *entry_id,122 const gchar *entry_id,
123 gint32 delta);123 gint32 delta);
124124
125void panel_service_close_active_entry (PanelService *self);
126
125G_END_DECLS127G_END_DECLS
126128
127#endif /* _PANEL_SERVICE_H_ */129#endif /* _PANEL_SERVICE_H_ */
128130
=== modified file 'tests/CMakeLists.txt'
--- tests/CMakeLists.txt 2014-02-20 20:52:57 +0000
+++ tests/CMakeLists.txt 2014-12-17 12:14:47 +0000
@@ -131,7 +131,6 @@
131 test_favorite_store_gsettings.cpp131 test_favorite_store_gsettings.cpp
132 test_favorite_store_private.cpp132 test_favorite_store_private.cpp
133 test_launcher_entry_remote.cpp133 test_launcher_entry_remote.cpp
134 test_launcher_model.cpp
135 test_launcher_options.cpp134 test_launcher_options.cpp
136 test_layout_system.cpp135 test_layout_system.cpp
137 test_model_iterator.cpp136 test_model_iterator.cpp
@@ -242,6 +241,7 @@
242 test_launcher_hover_machine.cpp241 test_launcher_hover_machine.cpp
243 test_launcher_icon.cpp242 test_launcher_icon.cpp
244 test_launcher_minimize_speed.cpp243 test_launcher_minimize_speed.cpp
244 test_launcher_model.cpp
245 test_launcher_tooltip.cpp245 test_launcher_tooltip.cpp
246 test_lockscreen_controller.cpp246 test_lockscreen_controller.cpp
247 test_panel_controller.cpp247 test_panel_controller.cpp
248248
=== modified file 'tests/mock_indicators.h'
--- tests/mock_indicators.h 2014-02-28 05:16:10 +0000
+++ tests/mock_indicators.h 2014-12-17 12:14:47 +0000
@@ -36,6 +36,7 @@
36 // Implementing Indicators virtual functions36 // Implementing Indicators virtual functions
37 MOCK_METHOD2(SyncGeometries, void(std::string const&, EntryLocationMap const&));37 MOCK_METHOD2(SyncGeometries, void(std::string const&, EntryLocationMap const&));
38 MOCK_METHOD5(ShowEntriesDropdown, void(Indicator::Entries const&, Entry::Ptr const&, unsigned xid, int x, int y));38 MOCK_METHOD5(ShowEntriesDropdown, void(Indicator::Entries const&, Entry::Ptr const&, unsigned xid, int x, int y));
39 MOCK_METHOD0(CloseActiveEntry, void());
39 MOCK_CONST_METHOD0(IconPaths, std::vector<std::string> const&());40 MOCK_CONST_METHOD0(IconPaths, std::vector<std::string> const&());
40 MOCK_METHOD2(OnEntryScroll, void(std::string const&, int delta));41 MOCK_METHOD2(OnEntryScroll, void(std::string const&, int delta));
41 MOCK_METHOD5(OnEntryShowMenu, void(std::string const&, unsigned xid, int x, int y, unsigned button));42 MOCK_METHOD5(OnEntryShowMenu, void(std::string const&, unsigned xid, int x, int y, unsigned button));
4243
=== modified file 'tests/test_lockscreen_controller.cpp'
--- tests/test_lockscreen_controller.cpp 2014-06-23 19:42:24 +0000
+++ tests/test_lockscreen_controller.cpp 2014-12-17 12:14:47 +0000
@@ -20,6 +20,7 @@
20#include <gmock/gmock.h>20#include <gmock/gmock.h>
21using namespace testing;21using namespace testing;
2222
23#include "lockscreen/UserPromptView.h"
23#include "lockscreen/LockScreenController.h"24#include "lockscreen/LockScreenController.h"
2425
25#include <Nux/NuxTimerTickSource.h>26#include <Nux/NuxTimerTickSource.h>
@@ -29,6 +30,7 @@
2930
30#include "lockscreen/LockScreenSettings.h"31#include "lockscreen/LockScreenSettings.h"
31#include "lockscreen/ScreenSaverDBusManager.h"32#include "lockscreen/ScreenSaverDBusManager.h"
33#include "unity-shared/DashStyle.h"
32#include "unity-shared/PanelStyle.h"34#include "unity-shared/PanelStyle.h"
33#include "unity-shared/UScreen.h"35#include "unity-shared/UScreen.h"
34#include "test_mock_session_manager.h"36#include "test_mock_session_manager.h"
@@ -52,16 +54,21 @@
52struct MockShield : AbstractShield54struct MockShield : AbstractShield
53{55{
54 MockShield()56 MockShield()
55 : AbstractShield(nullptr, nullptr, nullptr, 0, false)57 : AbstractShield(nullptr, nullptr, nullptr, nux::ObjectPtr<UserPromptView>(), 0, false)
56 {}58 {}
5759
58 MOCK_CONST_METHOD0(IsIndicatorOpen, bool());60 MOCK_CONST_METHOD0(IsIndicatorOpen, bool());
59 MOCK_METHOD0(ActivatePanel, void());61 MOCK_METHOD0(ActivatePanel, void());
62 MOCK_CONST_METHOD0(HasGrab, bool());
60};63};
6164
62struct ShieldFactoryMock : ShieldFactoryInterface65struct ShieldFactoryMock : ShieldFactoryInterface
63{66{
64 nux::ObjectPtr<AbstractShield> CreateShield(session::Manager::Ptr const&, indicator::Indicators::Ptr const&, Accelerators::Ptr const&, int, bool) override67 nux::ObjectPtr<AbstractShield> CreateShield(session::Manager::Ptr const&,
68 indicator::Indicators::Ptr const&,
69 Accelerators::Ptr const&,
70 nux::ObjectPtr<UserPromptView> const&,
71 int, bool) override
65 {72 {
66 return nux::ObjectPtr<AbstractShield>(new MockShield());73 return nux::ObjectPtr<AbstractShield>(new MockShield());
67 }74 }
@@ -95,6 +102,7 @@
95 nux::animation::AnimationController animation_controller;102 nux::animation::AnimationController animation_controller;
96103
97 MockUScreen uscreen;104 MockUScreen uscreen;
105 unity::dash::Style dash_style;
98 unity::panel::Style panel_style;106 unity::panel::Style panel_style;
99 unity::lockscreen::Settings lockscreen_settings;107 unity::lockscreen::Settings lockscreen_settings;
100 session::MockManager::Ptr session_manager;108 session::MockManager::Ptr session_manager;
101109
=== modified file 'tests/test_main_xless.cpp'
--- tests/test_main_xless.cpp 2013-02-21 10:47:14 +0000
+++ tests/test_main_xless.cpp 2014-12-17 12:14:47 +0000
@@ -3,18 +3,17 @@
3#include <NuxCore/Logger.h>3#include <NuxCore/Logger.h>
4#include <Nux/Nux.h>4#include <Nux/Nux.h>
5#include <config.h>5#include <config.h>
66#include "test_utils.h"
77
8const gchar* LOCAL_DATA_DIR = BUILDDIR"/tests/data:/usr/share";8const gchar* LOCAL_DATA_DIR = BUILDDIR"/tests/data:/usr/share";
99
10int main(int argc, char** argv)10int main(int argc, char** argv)
11{11{
12 ::testing::InitGoogleTest(&argc, argv);12 ::testing::InitGoogleTest(&argc, argv);
13#if G_ENCODE_VERSION (GLIB_MAJOR_VERSION, GLIB_MINOR_VERSION) <= GLIB_VERSION_2_3413
14 g_type_init();
15#endif
16 setlocale(LC_ALL, "C");14 setlocale(LC_ALL, "C");
1715 g_setenv("LC_ALL", "C", TRUE);
16 Utils::init_gsettings_test_environment();
18 g_setenv("XDG_DATA_DIRS", LOCAL_DATA_DIR, TRUE);17 g_setenv("XDG_DATA_DIRS", LOCAL_DATA_DIR, TRUE);
1918
20 // Slightly higher as we're more likely to test things we know will fail19 // Slightly higher as we're more likely to test things we know will fail
2120
=== modified file 'tests/test_previews_music_payment.cpp'
--- tests/test_previews_music_payment.cpp 2014-03-21 04:40:12 +0000
+++ tests/test_previews_music_payment.cpp 2014-12-17 12:14:47 +0000
@@ -21,6 +21,7 @@
21#include <gmock/gmock.h>21#include <gmock/gmock.h>
2222
23#include <Nux/Nux.h>23#include <Nux/Nux.h>
24#include <Nux/VLayout.h>
24#include <Nux/BaseWindow.h>25#include <Nux/BaseWindow.h>
25#include <unity-shared/StaticCairoText.h>26#include <unity-shared/StaticCairoText.h>
26#include <unity-shared/CoverArt.h>27#include <unity-shared/CoverArt.h>
2728
=== modified file 'tests/test_text_input.cpp'
--- tests/test_text_input.cpp 2014-03-21 04:40:12 +0000
+++ tests/test_text_input.cpp 2014-12-17 12:14:47 +0000
@@ -23,6 +23,7 @@
23#include <gtest/gtest.h>23#include <gtest/gtest.h>
2424
25#include "unity-shared/DashStyle.h"25#include "unity-shared/DashStyle.h"
26#include "unity-shared/StaticCairoText.h"
26#include "unity-shared/TextInput.h"27#include "unity-shared/TextInput.h"
27#include "test_utils.h"28#include "test_utils.h"
2829
2930
=== added file 'tools/migration-scripts/03_unity_first_run_stamp_move'
--- tools/migration-scripts/03_unity_first_run_stamp_move 1970-01-01 00:00:00 +0000
+++ tools/migration-scripts/03_unity_first_run_stamp_move 2014-12-17 12:14:47 +0000
@@ -0,0 +1,35 @@
1#!/usr/bin/python
2# -*- coding: utf-8 -*-
3# Copyright (C) 2014 Canonical
4#
5# Authors:
6# Brandon Schaefer <brandon.schaefer@canonical.com>
7#
8# This program is free software; you can redistribute it and/or modify it under
9# the terms of the GNU General Public License as published by the Free Software
10# Foundation; version 3.
11#
12# This program is distributed in the hope that it will be useful, but WITHOUTa
13# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
14# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
15# details.
16#
17# You should have received a copy of the GNU General Public License along with
18# this program; if not, write to the Free Software Foundation, Inc.,
19# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20
21from gi.repository import GLib
22from os import path, rename, mkdir
23
24old_first_run_path = GLib.get_user_cache_dir() + "/unity/first_run.stamp"
25new_first_run_path = GLib.get_user_config_dir() + "/unity"
26
27# If we have the old first_run.stamp file, we must move it to the new location
28if path.isfile(old_first_run_path):
29
30 # make sure the new dir exists before attempting to move
31 if not path.isdir(new_first_run_path):
32 mkdir(new_first_run_path)
33
34 new_first_run_path += "/first_run.stamp"
35 rename(old_first_run_path, new_first_run_path)
036
=== modified file 'unity-shared/CompizUtils.cpp'
--- unity-shared/CompizUtils.cpp 2014-04-14 13:51:58 +0000
+++ unity-shared/CompizUtils.cpp 2014-12-17 12:14:47 +0000
@@ -1,6 +1,6 @@
1// -*- Mode: C++; indent-tabs-mode: nil; tab-width: 2 -*-1// -*- Mode: C++; indent-tabs-mode: nil; tab-width: 2 -*-
2/*2/*
3* Copyright (C) 2013 Canonical Ltd3* Copyright (C) 2013-2014 Canonical Ltd
4*4*
5* This program is free software: you can redistribute it and/or modify5* This program is free software: you can redistribute it and/or modify
6* it under the terms of the GNU General Public License version 3 as6* it under the terms of the GNU General Public License version 3 as
@@ -30,6 +30,11 @@
30{30{
31 const unsigned PIXMAP_DEPTH = 32;31 const unsigned PIXMAP_DEPTH = 32;
32 const float DEFAULT_SCALE = 1.0f;32 const float DEFAULT_SCALE = 1.0f;
33 const unsigned DECORABLE_WINDOW_TYPES = CompWindowTypeDialogMask |
34 CompWindowTypeModalDialogMask |
35 CompWindowTypeUtilMask |
36 CompWindowTypeMenuMask |
37 CompWindowTypeNormalMask;
33}38}
3439
35SimpleTexture::SimpleTexture(GLTexture::List const& tex)40SimpleTexture::SimpleTexture(GLTexture::List const& tex)
@@ -39,7 +44,7 @@
39//44//
4045
41SimpleTextureQuad::SimpleTextureQuad()46SimpleTextureQuad::SimpleTextureQuad()
42 : scale(DEFAULT_SCALE)47 : scale_(DEFAULT_SCALE)
43{}48{}
4449
45bool SimpleTextureQuad::SetTexture(SimpleTexture::Ptr const& simple_texture)50bool SimpleTextureQuad::SetTexture(SimpleTexture::Ptr const& simple_texture)
@@ -52,24 +57,27 @@
52 if (st && st->texture())57 if (st && st->texture())
53 {58 {
54 auto* tex = st->texture();59 auto* tex = st->texture();
55 CompPoint old_coords(quad.box.x(), quad.box.y());60 CompSize size(tex->width() * scale_, tex->height() * scale_);
56 short invalid = std::numeric_limits<short>::min();61
57 quad.box.setGeometry(invalid, invalid, tex->width() * scale, tex->height() * scale);62 if (quad.box.width() != size.width() || quad.box.height() != size.height())
58 SetCoords(old_coords.x(), old_coords.y());63 {
64 quad.box.setSize(size);
65 UpdateMatrix();
66 }
59 }67 }
6068
61 return true;69 return true;
62}70}
6371
64bool SimpleTextureQuad::SetScale(float s)72bool SimpleTextureQuad::SetScale(double s)
65{73{
66 if (!st || scale == s)74 if (!st || scale_ == s)
67 return false;75 return false;
6876
69 scale = s;77 scale_ = s;
70 auto* tex = st->texture();78 auto* tex = st->texture();
71 quad.box.setWidth(tex->width() * scale);79 quad.box.setWidth(tex->width() * scale_);
72 quad.box.setHeight(tex->height() * scale);80 quad.box.setHeight(tex->height() * scale_);
73 UpdateMatrix();81 UpdateMatrix();
74 return true;82 return true;
75}83}
@@ -91,8 +99,8 @@
91 int y = quad.box.y();99 int y = quad.box.y();
92100
93 quad.matrix = (st && st->texture()) ? st->texture()->matrix() : GLTexture::Matrix();101 quad.matrix = (st && st->texture()) ? st->texture()->matrix() : GLTexture::Matrix();
94 quad.matrix.xx /= scale;102 quad.matrix.xx /= scale_;
95 quad.matrix.yy /= scale;103 quad.matrix.yy /= scale_;
96 quad.matrix.x0 = 0.0f - COMP_TEX_COORD_X(quad.matrix, x);104 quad.matrix.x0 = 0.0f - COMP_TEX_COORD_X(quad.matrix, x);
97 quad.matrix.y0 = 0.0f - COMP_TEX_COORD_Y(quad.matrix, y);105 quad.matrix.y0 = 0.0f - COMP_TEX_COORD_Y(quad.matrix, y);
98}106}
@@ -166,57 +174,68 @@
166 return cairo_xlib_surface_get_height(surface_);174 return cairo_xlib_surface_get_height(surface_);
167}175}
168176
177//
178//
179
180unsigned WindowDecorationElements(CompWindow* win, WindowFilter::Value wf)
181{
182 unsigned elements = DecorationElement::NONE;
183
184 if (!win)
185 return elements;
186
187 if (!win->isViewable() && wf == WindowFilter::NONE)
188 return elements;
189
190 if (win->wmType() & (CompWindowTypeDockMask | CompWindowTypeDesktopMask))
191 return elements;
192
193 if (win->inShowDesktopMode())
194 return elements;
195
196 auto const& region = win->region();
197 bool rectangular = (region.numRects() == 1);
198 bool alpha = win->alpha();
199
200 if (!rectangular && alpha) // Non-rectangular windows with alpha channel
201 return elements;
202
203 if (region.boundingRect() != win->geometry()) // Shaped windows
204 return elements;
205
206 if (rectangular)
207 elements |= DecorationElement::SHADOW;
208
209 if (!win->overrideRedirect() &&
210 (win->type() & DECORABLE_WINDOW_TYPES) &&
211 (win->frame() || win->hasUnmapReference() || wf == WindowFilter::UNMAPPED))
212 {
213 if (win->actions() & CompWindowActionResizeMask)
214 elements |= DecorationElement::EDGE;
215
216 if (rectangular && (win->mwmDecor() & (MwmDecorAll | MwmDecorTitle)))
217 elements |= DecorationElement::BORDER;
218 }
219
220 if (alpha && !(elements & DecorationElement::BORDER) && !(win->mwmDecor() & MwmDecorBorder))
221 elements &= ~DecorationElement::SHADOW;
222
223 return elements;
224}
225
226bool IsWindowEdgeDecorable(CompWindow* win)
227{
228 return WindowDecorationElements(win) & DecorationElement::EDGE;
229}
230
169bool IsWindowShadowDecorable(CompWindow* win)231bool IsWindowShadowDecorable(CompWindow* win)
170{232{
171 if (!win)233 return WindowDecorationElements(win) & DecorationElement::SHADOW;
172 return false;
173
174 if (!win->isViewable())
175 return false;
176
177 if (win->wmType() & (CompWindowTypeDockMask | CompWindowTypeDesktopMask))
178 return false;
179
180 if (win->region().numRects() != 1) // Non rectangular windows
181 return false;
182
183 if (win->alpha())
184 return WindowHasMotifDecorations(win);
185
186 return true;
187}234}
188235
189bool IsWindowFullyDecorable(CompWindow* win)236bool IsWindowFullyDecorable(CompWindow* win)
190{237{
191 if (!win)238 return WindowDecorationElements(win) & DecorationElement::BORDER;
192 return false;
193
194 if (!IsWindowShadowDecorable(win))
195 return false;
196
197 return WindowHasMotifDecorations(win);
198}
199
200bool WindowHasMotifDecorations(CompWindow* win)
201{
202 if (!win)
203 return false;
204
205 if (win->overrideRedirect())
206 return false;
207
208 switch (win->type())
209 {
210 case CompWindowTypeDialogMask:
211 case CompWindowTypeModalDialogMask:
212 case CompWindowTypeUtilMask:
213 case CompWindowTypeMenuMask:
214 case CompWindowTypeNormalMask:
215 if (win->mwmDecor() & (MwmDecorAll | MwmDecorTitle))
216 return true;
217 }
218
219 return false;
220}239}
221240
222} // compiz_utils namespace241} // compiz_utils namespace
223242
=== modified file 'unity-shared/CompizUtils.h'
--- unity-shared/CompizUtils.h 2014-04-14 13:51:58 +0000
+++ unity-shared/CompizUtils.h 2014-12-17 12:14:47 +0000
@@ -31,8 +31,15 @@
3131
32struct TextureQuad32struct TextureQuad
33{33{
34 TextureQuad()
35 : matrices(1)
36 , matrix(matrices[0])
37 {}
38
34 CompRect box;39 CompRect box;
35 GLTexture::Matrix matrix;40 CompRegion region;
41 GLTexture::MatrixList matrices;
42 GLTexture::Matrix& matrix;
36};43};
3744
38struct SimpleTexture45struct SimpleTexture
@@ -59,11 +66,13 @@
59{66{
60 SimpleTextureQuad();67 SimpleTextureQuad();
61 bool SetTexture(SimpleTexture::Ptr const&);68 bool SetTexture(SimpleTexture::Ptr const&);
62 bool SetScale(float scale);69 bool SetScale(double scale);
63 bool SetCoords(int x, int y);70 bool SetCoords(int x, int y);
64 bool SetX(int x);71 bool SetX(int x);
65 bool SetY(int y);72 bool SetY(int y);
6673
74 void UpdateMatrix();
75
67 operator SimpleTexture::Ptr() const { return st; }76 operator SimpleTexture::Ptr() const { return st; }
68 operator bool() const { return st && st->texture(); }77 operator bool() const { return st && st->texture(); }
69 operator GLTexture*() const { return st ? st->texture() : nullptr; }78 operator GLTexture*() const { return st ? st->texture() : nullptr; }
@@ -73,8 +82,7 @@
73 TextureQuad quad;82 TextureQuad quad;
7483
75private:84private:
76 void UpdateMatrix();85 double scale_;
77 float scale;
78};86};
7987
80struct PixmapTexture : SimpleTexture88struct PixmapTexture : SimpleTexture
@@ -111,9 +119,32 @@
111 cairo_t *cr_;119 cairo_t *cr_;
112};120};
113121
122namespace WindowFilter
123{
124enum Value
125{
126 NONE,
127 UNMAPPED
128};
129}
130
131namespace DecorationElement
132{
133enum
134{
135 NONE = 0,
136 EDGE = (1 << 0),
137 SHADOW = (1 << 1),
138 BORDER = (1 << 2),
139 FULL = EDGE|SHADOW|BORDER
140};
141}
142
143unsigned WindowDecorationElements(CompWindow*, WindowFilter::Value wf = WindowFilter::NONE);
144
145bool IsWindowEdgeDecorable(CompWindow*);
114bool IsWindowShadowDecorable(CompWindow*);146bool IsWindowShadowDecorable(CompWindow*);
115bool IsWindowFullyDecorable(CompWindow*);147bool IsWindowFullyDecorable(CompWindow*);
116bool WindowHasMotifDecorations(CompWindow*);
117148
118} // compiz_utils namespace149} // compiz_utils namespace
119} // unity namespace150} // unity namespace
120151
=== modified file 'unity-shared/DashStyle.cpp'
--- unity-shared/DashStyle.cpp 2014-07-24 14:14:47 +0000
+++ unity-shared/DashStyle.cpp 2014-12-17 12:14:47 +0000
@@ -383,9 +383,9 @@
383 ::pango_layout_context_changed(layout);383 ::pango_layout_context_changed(layout);
384384
385 PangoRectangle log_rect;385 PangoRectangle log_rect;
386 ::pango_layout_get_extents(layout, NULL, &log_rect);386 ::pango_layout_get_pixel_extents(layout, NULL, &log_rect);
387 text_width_ = log_rect.width / PANGO_SCALE;387 text_width_ = log_rect.width;
388 text_height_ = log_rect.height / PANGO_SCALE;388 text_height_ = log_rect.height;
389389
390 owner_->changed.emit();390 owner_->changed.emit();
391391
@@ -1396,10 +1396,10 @@
13961396
1397 pango_cairo_context_set_resolution(pangoCtx, 96.0 * Settings::Instance().font_scaling());1397 pango_cairo_context_set_resolution(pangoCtx, 96.0 * Settings::Instance().font_scaling());
1398 pango_layout_context_changed(layout);1398 pango_layout_context_changed(layout);
1399 pango_layout_get_extents(layout, &inkRect, NULL);1399 pango_layout_get_pixel_extents(layout, &inkRect, NULL);
14001400
1401 width = inkRect.width / PANGO_SCALE;1401 width = inkRect.width;
1402 height = inkRect.height / PANGO_SCALE;1402 height = inkRect.height;
14031403
1404 // clean up1404 // clean up
1405 pango_font_description_free(desc);1405 pango_font_description_free(desc);
@@ -1444,11 +1444,8 @@
14441444
1445 if (text_size > 0)1445 if (text_size > 0)
1446 {1446 {
1447 pango_font_description_set_absolute_size(desc, text_size * PANGO_SCALE);1447 text_size = pango_units_from_double(Settings::Instance().font_scaling() * text_size);
1448 }1448 pango_font_description_set_absolute_size(desc, text_size);
1449 else if (desc)
1450 {
1451 text_size = pango_font_description_get_size(desc) / PANGO_SCALE;
1452 }1449 }
14531450
1454 PangoWeight weight;1451 PangoWeight weight;
14551452
=== modified file 'unity-shared/DecorationStyle.cpp'
--- unity-shared/DecorationStyle.cpp 2014-04-02 17:05:04 +0000
+++ unity-shared/DecorationStyle.cpp 2014-12-17 12:14:47 +0000
@@ -147,8 +147,8 @@
147 , ctx_(gtk_style_context_new())147 , ctx_(gtk_style_context_new())
148 , settings_(g_settings_new(SETTINGS_NAME.c_str()))148 , settings_(g_settings_new(SETTINGS_NAME.c_str()))
149 , usettings_(g_settings_new(UNITY_SETTINGS_NAME.c_str()))149 , usettings_(g_settings_new(UNITY_SETTINGS_NAME.c_str()))
150 , title_pango_ctx_(gdk_pango_context_get_for_screen(gdk_screen_get_default()))150 , title_pango_ctx_(gdk_pango_context_get())
151 , menu_item_pango_ctx_(gdk_pango_context_get_for_screen(gdk_screen_get_default()))151 , menu_item_pango_ctx_(gdk_pango_context_get())
152 , title_alignment_(0)152 , title_alignment_(0)
153 , title_indent_(0)153 , title_indent_(0)
154 , title_fade_(0)154 , title_fade_(0)
155155
=== modified file 'unity-shared/GnomeKeyGrabber.cpp'
--- unity-shared/GnomeKeyGrabber.cpp 2014-02-28 18:52:30 +0000
+++ unity-shared/GnomeKeyGrabber.cpp 2014-12-17 12:14:47 +0000
@@ -200,6 +200,15 @@
200 CompAction action;200 CompAction action;
201 action.keyFromString(accelerator);201 action.keyFromString(accelerator);
202202
203 if (action.key().toString().empty())
204 {
205 CompString prefixed = "XF86" + CompString(accelerator);
206 LOG_DEBUG(logger) << "Can't grab \"" << accelerator << "\", trying \"" << prefixed << "\"";
207 action.keyFromString(prefixed);
208 }
209 else
210 LOG_DEBUG(logger) << "grabAccelerator \"" << accelerator << "\"";
211
203 if (!isActionPostponed(action))212 if (!isActionPostponed(action))
204 {213 {
205 action.setState(CompAction::StateInitKey);214 action.setState(CompAction::StateInitKey);
206215
=== modified file 'unity-shared/IconRenderer.cpp'
--- unity-shared/IconRenderer.cpp 2014-05-08 18:52:16 +0000
+++ unity-shared/IconRenderer.cpp 2014-12-17 12:14:47 +0000
@@ -31,6 +31,8 @@
31#include "unity-shared/CairoTexture.h"31#include "unity-shared/CairoTexture.h"
32#include "unity-shared/DecorationStyle.h"32#include "unity-shared/DecorationStyle.h"
33#include "unity-shared/TextureCache.h"33#include "unity-shared/TextureCache.h"
34#include "unity-shared/UnitySettings.h"
35#include "unity-shared/WindowManager.h"
34#include "GraphicsUtils.h"36#include "GraphicsUtils.h"
3537
36#include <gtk/gtk.h>38#include <gtk/gtk.h>
@@ -199,6 +201,8 @@
199const std::array<int, IconSize::SIZE> TILE_SIZES = { 54, 150 };201const std::array<int, IconSize::SIZE> TILE_SIZES = { 54, 150 };
200const std::array<int, IconSize::SIZE> GLOW_SIZES = { 62, 200 };202const std::array<int, IconSize::SIZE> GLOW_SIZES = { 62, 200 };
201const std::array<int, IconSize::SIZE> MARKER_SIZES = { 19, 37 };203const std::array<int, IconSize::SIZE> MARKER_SIZES = { 19, 37 };
204
205constexpr double count_scaling(double icon_size, bool switcher) { return icon_size / (TILE_SIZES[local::IconSize::SMALL] * (switcher ? 2.0 : 1.0)); }
202} // anonymous namespace206} // anonymous namespace
203} // local namespace207} // local namespace
204208
@@ -210,7 +214,6 @@
210 return instance;214 return instance;
211 }215 }
212216
213 nux::ObjectPtr<nux::BaseTexture> RenderLabelTexture(char label, int icon_size, nux::Color const& bg_color);
214 nux::ObjectPtr<nux::IOpenGLBaseTexture> offscreen_progress_texture;217 nux::ObjectPtr<nux::IOpenGLBaseTexture> offscreen_progress_texture;
215 nux::ObjectPtr<nux::IOpenGLShaderProgram> shader_program_uv_persp_correction;218 nux::ObjectPtr<nux::IOpenGLShaderProgram> shader_program_uv_persp_correction;
216#ifndef USE_GLES219#ifndef USE_GLES
@@ -224,8 +227,6 @@
224 int ColorifyColor;227 int ColorifyColor;
225 int DesatFactor;228 int DesatFactor;
226229
227 std::map<char, BaseTexturePtr> labels;
228
229private:230private:
230 TexturesPool();231 TexturesPool();
231232
@@ -249,14 +250,18 @@
249 LocalTextures(IconRenderer* parent)250 LocalTextures(IconRenderer* parent)
250 : parent_(parent)251 : parent_(parent)
251 {252 {
252 theme_conn_ = decoration::Style::Get()->theme.changed.connect([this] (std::string const&) {253 connections_.Add(decoration::Style::Get()->theme.changed.connect([this] (std::string const&) {
253 auto& cache = TextureCache::GetDefault();254 auto& cache = TextureCache::GetDefault();
254255
255 for (auto const& tex_data : texture_files_)256 for (auto const& tex_data : texture_files_)
256 cache.Invalidate(tex_data.name, tex_data.size, tex_data.size);257 cache.Invalidate(tex_data.name, tex_data.size, tex_data.size);
257258
258 ReloadIconSizedTextures(parent_->icon_size, parent_->image_size);259 ReloadIconSizedTextures(parent_->icon_size, parent_->image_size);
259 });260 }));
261
262 auto clear_labels = sigc::hide(sigc::mem_fun(this, &LocalTextures::ClearLabels));
263 connections_.Add(Settings::Instance().font_scaling.changed.connect(clear_labels));
264 connections_.Add(WindowManager::Default().average_color.changed.connect(clear_labels));
260 }265 }
261266
262 void ReloadIconSizedTextures(int icon_size, int image_size)267 void ReloadIconSizedTextures(int icon_size, int image_size)
@@ -298,6 +303,22 @@
298 *tex_data.tex_ptr = cache.FindTexture(tex_data.name, tex_data.size, tex_data.size, texture_loader);303 *tex_data.tex_ptr = cache.FindTexture(tex_data.name, tex_data.size, tex_data.size, texture_loader);
299 }304 }
300305
306 nux::BaseTexture* RenderLabelTexture(char label, int icon_size, nux::Color const&);
307
308 BaseTexturePtr const& GetLabelTexture(char label, int icon_size, nux::Color const& color)
309 {
310 labels_.push_back(TextureCache::GetDefault().FindTexture(std::string(1, label), icon_size, icon_size, [this, &color] (std::string const& label, int size, int) {
311 return RenderLabelTexture(label[0], size, color);
312 }));
313
314 return labels_.back();
315 }
316
317 void ClearLabels()
318 {
319 labels_.clear();
320 }
321
301 BaseTexturePtr icon_background;322 BaseTexturePtr icon_background;
302 BaseTexturePtr icon_selected_background;323 BaseTexturePtr icon_selected_background;
303 BaseTexturePtr icon_edge;324 BaseTexturePtr icon_edge;
@@ -315,7 +336,8 @@
315 IconRenderer* parent_;336 IconRenderer* parent_;
316 struct TextureData { BaseTexturePtr* tex_ptr; std::string name; int size; };337 struct TextureData { BaseTexturePtr* tex_ptr; std::string name; int size; };
317 std::vector<TextureData> texture_files_;338 std::vector<TextureData> texture_files_;
318 connection::Wrapper theme_conn_;339 std::vector<BaseTexturePtr> labels_;
340 connection::Manager connections_;
319};341};
320342
321IconRenderer::IconRenderer()343IconRenderer::IconRenderer()
@@ -335,6 +357,7 @@
335 icon_size = tile_size;357 icon_size = tile_size;
336 image_size = image_size_;358 image_size = image_size_;
337 local_textures_->ReloadIconSizedTextures(icon_size, image_size);359 local_textures_->ReloadIconSizedTextures(icon_size, image_size);
360 local_textures_->ClearLabels();
338 }361 }
339362
340 spacing = spacing_;363 spacing = spacing_;
@@ -352,6 +375,7 @@
352 GetInverseScreenPerspectiveMatrix(ViewMatrix, ProjectionMatrix, geo.width, geo.height, 0.1f, 1000.0f, DEGTORAD(90));375 GetInverseScreenPerspectiveMatrix(ViewMatrix, ProjectionMatrix, geo.width, geo.height, 0.1f, 1000.0f, DEGTORAD(90));
353376
354 nux::Matrix4 const& PremultMatrix = ProjectionMatrix * ViewMatrix;377 nux::Matrix4 const& PremultMatrix = ProjectionMatrix * ViewMatrix;
378 int monitor = this->monitor();
355379
356 std::list<RenderArg>::iterator it;380 std::list<RenderArg>::iterator it;
357 int i;381 int i;
@@ -363,6 +387,7 @@
363 it->logical_center == launcher_icon->LastLogicalCenter(monitor) &&387 it->logical_center == launcher_icon->LastLogicalCenter(monitor) &&
364 it->rotation == launcher_icon->LastRotation(monitor) &&388 it->rotation == launcher_icon->LastRotation(monitor) &&
365 it->skip == launcher_icon->WasSkipping(monitor) &&389 it->skip == launcher_icon->WasSkipping(monitor) &&
390 launcher_icon->Count() == launcher_icon->LastCount(monitor) &&
366 (launcher_icon->Emblem() != nullptr) == launcher_icon->HadEmblem(monitor))391 (launcher_icon->Emblem() != nullptr) == launcher_icon->HadEmblem(monitor))
367 {392 {
368 continue;393 continue;
@@ -372,6 +397,7 @@
372 launcher_icon->RememberRotation(monitor, it->rotation);397 launcher_icon->RememberRotation(monitor, it->rotation);
373 launcher_icon->RememberSkip(monitor, it->skip);398 launcher_icon->RememberSkip(monitor, it->skip);
374 launcher_icon->RememberEmblem(monitor, launcher_icon->Emblem() != nullptr);399 launcher_icon->RememberEmblem(monitor, launcher_icon->Emblem() != nullptr);
400 launcher_icon->RememberCount(monitor, launcher_icon->Count());
375401
376 float w = icon_size;402 float w = icon_size;
377 float h = icon_size;403 float h = icon_size;
@@ -423,16 +449,26 @@
423449
424 UpdateIconTransform(launcher_icon, ViewProjectionMatrix, geo, x, y, w, h, z, ui::IconTextureSource::TRANSFORM_HIT_AREA);450 UpdateIconTransform(launcher_icon, ViewProjectionMatrix, geo, x, y, w, h, z, ui::IconTextureSource::TRANSFORM_HIT_AREA);
425451
426 if (launcher_icon->Emblem())452 float emb_w, emb_h;
427 {453 nux::BaseTexture* emblem = launcher_icon->Emblem();
428 nux::BaseTexture* emblem = launcher_icon->Emblem();454
429455 if (nux::BaseTexture* count_texture = launcher_icon->CountTexture(local::count_scaling(icon_size, pip_style != OUTSIDE_TILE)))
456 {
457 emblem = count_texture;
458 emb_w = emblem->GetWidth();
459 emb_h = emblem->GetHeight();
460 }
461 else if (emblem)
462 {
463 emb_w = std::round(emblem->GetWidth() * scale());
464 emb_h = std::round(emblem->GetHeight() * scale());
465 }
466
467 if (emblem)
468 {
430 float w = icon_size;469 float w = icon_size;
431 float h = icon_size;470 float h = icon_size;
432471
433 float emb_w = emblem->GetWidth();
434 float emb_h = emblem->GetHeight();
435
436 x = it->render_center.x + (icon_size * 0.50f - emb_w - icon_size * 0.05f); // puts right edge of emblem just over the edge of the launcher icon472 x = it->render_center.x + (icon_size * 0.50f - emb_w - icon_size * 0.05f); // puts right edge of emblem just over the edge of the launcher icon
437 y = it->render_center.y - icon_size * 0.50f; // y = top left corner position of emblem473 y = it->render_center.y - icon_size * 0.50f; // y = top left corner position of emblem
438 z = it->render_center.z;474 z = it->render_center.z;
@@ -718,7 +754,18 @@
718 tile_transform);754 tile_transform);
719 }755 }
720756
721 if (arg.icon->Emblem())757 if (nux::BaseTexture* count_texture = arg.icon->CountTexture(local::count_scaling(icon_size, pip_style != OUTSIDE_TILE)))
758 {
759 RenderElement(GfxContext,
760 arg,
761 count_texture->GetDeviceTexture(),
762 nux::color::White,
763 nux::color::White,
764 arg.alpha,
765 force_filter,
766 arg.icon->GetTransform(ui::IconTextureSource::TRANSFORM_EMBLEM, monitor));
767 }
768 else if (arg.icon->Emblem())
722 {769 {
723 RenderElement(GfxContext,770 RenderElement(GfxContext,
724 arg,771 arg,
@@ -726,7 +773,7 @@
726 nux::color::White,773 nux::color::White,
727 nux::color::White,774 nux::color::White,
728 arg.alpha,775 arg.alpha,
729 force_filter,776 force_filter || scale != 1.0,
730 arg.icon->GetTransform(ui::IconTextureSource::TRANSFORM_EMBLEM, monitor));777 arg.icon->GetTransform(ui::IconTextureSource::TRANSFORM_EMBLEM, monitor));
731 }778 }
732779
@@ -741,20 +788,8 @@
741 // draw superkey-shortcut label788 // draw superkey-shortcut label
742 if (arg.draw_shortcut && arg.shortcut_label)789 if (arg.draw_shortcut && arg.shortcut_label)
743 {790 {
744 char shortcut = (char) arg.shortcut_label;791 char shortcut = static_cast<char>(arg.shortcut_label);
745792 auto const& label = local_textures_->GetLabelTexture(shortcut, icon_size, shortcut_color);
746 BaseTexturePtr label;
747 auto label_it = textures_->labels.find(shortcut);
748
749 if (label_it != textures_->labels.end())
750 {
751 label = label_it->second;
752 }
753 else
754 {
755 label = textures_->RenderLabelTexture(shortcut, icon_size, shortcut_color);
756 textures_->labels[shortcut] = label;
757 }
758793
759 RenderElement(GfxContext,794 RenderElement(GfxContext,
760 arg,795 arg,
@@ -767,7 +802,7 @@
767 }802 }
768}803}
769804
770nux::ObjectPtr<nux::BaseTexture> IconRenderer::TexturesPool::RenderLabelTexture(char label, int icon_size, nux::Color const& bg_color)805nux::BaseTexture* IconRenderer::LocalTextures::RenderLabelTexture(char label, int icon_size, nux::Color const& bg_color)
771{806{
772 nux::CairoGraphics cg(CAIRO_FORMAT_ARGB32, icon_size, icon_size);807 nux::CairoGraphics cg(CAIRO_FORMAT_ARGB32, icon_size, icon_size);
773 cairo_t* cr = cg.GetInternalContext();808 cairo_t* cr = cg.GetInternalContext();
@@ -791,27 +826,27 @@
791 cairo_set_source_rgba(cr, bg_color.red, bg_color.green, bg_color.blue, 0.20f);826 cairo_set_source_rgba(cr, bg_color.red, bg_color.green, bg_color.blue, 0.20f);
792 cairo_fill(cr);827 cairo_fill(cr);
793828
794 const double text_ratio = 0.75;
795 double text_size = label_size * text_ratio;
796 glib::Object<PangoLayout> layout(pango_cairo_create_layout(cr));829 glib::Object<PangoLayout> layout(pango_cairo_create_layout(cr));
797 g_object_get(gtk_settings_get_default(), "gtk-font-name", &font_name, NULL);830 g_object_get(gtk_settings_get_default(), "gtk-font-name", &font_name, NULL);
798 std::shared_ptr<PangoFontDescription> desc(pango_font_description_from_string(font_name),831 std::shared_ptr<PangoFontDescription> desc(pango_font_description_from_string(font_name),
799 pango_font_description_free);832 pango_font_description_free);
800 pango_font_description_set_absolute_size(desc.get(), text_size * PANGO_SCALE);833 const double text_ratio = 0.75;
834 int text_size = pango_units_from_double(label_size * text_ratio * Settings::Instance().font_scaling());
835 pango_font_description_set_absolute_size(desc.get(), text_size);
801 pango_layout_set_font_description(layout, desc.get());836 pango_layout_set_font_description(layout, desc.get());
802 pango_layout_set_text(layout, &label, 1);837 pango_layout_set_text(layout, &label, 1);
803838
804 nux::Size extents;839 PangoRectangle ink_rect;
805 pango_layout_get_pixel_size(layout, &extents.width, &extents.height);840 pango_layout_get_pixel_extents(layout, &ink_rect, nullptr);
806841
807 // position and paint text842 // position and paint text
808 cairo_set_source_rgba(cr, 1.0f, 1.0f, 1.0f, 1.0f);843 cairo_set_source_rgba(cr, 1.0f, 1.0f, 1.0f, 1.0f);
809 double x = label_x - std::round((extents.width - label_w) / 2.0f);844 double x = label_x - std::round((ink_rect.width - label_w) / 2.0f) - ink_rect.x;
810 double y = label_y - std::round((extents.height - label_h) / 2.0f);845 double y = label_y - std::round((ink_rect.height - label_h) / 2.0f) - ink_rect.y;
811 cairo_move_to(cr, x, y);846 cairo_move_to(cr, x, y);
812 pango_cairo_show_layout(cr, layout);847 pango_cairo_show_layout(cr, layout);
813848
814 return texture_ptr_from_cairo_graphics(cg);849 return texture_from_cairo_graphics(cg);
815}850}
816851
817void IconRenderer::RenderElement(nux::GraphicsEngine& GfxContext,852void IconRenderer::RenderElement(nux::GraphicsEngine& GfxContext,
@@ -1153,11 +1188,6 @@
1153 unity::graphics::PopOffscreenRenderTarget();1188 unity::graphics::PopOffscreenRenderTarget();
1154}1189}
11551190
1156void IconRenderer::DestroyShortcutTextures()
1157{
1158 TexturesPool::Get()->labels.clear();
1159}
1160
1161void IconRenderer::GetInverseScreenPerspectiveMatrix(nux::Matrix4& ViewMatrix, nux::Matrix4& PerspectiveMatrix,1191void IconRenderer::GetInverseScreenPerspectiveMatrix(nux::Matrix4& ViewMatrix, nux::Matrix4& PerspectiveMatrix,
1162 int ViewportWidth,1192 int ViewportWidth,
1163 int ViewportHeight,1193 int ViewportHeight,
11641194
=== modified file 'unity-shared/IconRenderer.h'
--- unity-shared/IconRenderer.h 2014-02-27 02:37:18 +0000
+++ unity-shared/IconRenderer.h 2014-12-17 12:14:47 +0000
@@ -44,8 +44,6 @@
4444
45 void SetTargetSize(int tile_size, int image_size, int spacing);45 void SetTargetSize(int tile_size, int image_size, int spacing);
4646
47 static void DestroyShortcutTextures();
48
49protected:47protected:
50 void RenderElement(nux::GraphicsEngine& GfxContext,48 void RenderElement(nux::GraphicsEngine& GfxContext,
51 RenderArg const& arg,49 RenderArg const& arg,
5250
=== modified file 'unity-shared/IconTexture.cpp'
--- unity-shared/IconTexture.cpp 2014-07-24 13:49:53 +0000
+++ unity-shared/IconTexture.cpp 2014-12-17 12:14:47 +0000
@@ -142,7 +142,7 @@
142 -1, _size,142 -1, _size,
143 sigc::mem_fun(this, &IconTexture::IconLoaded));143 sigc::mem_fun(this, &IconTexture::IconLoaded));
144 }144 }
145 else if (_icon_name.find("http://") == 0)145 else if (_icon_name.find("://") != std::string::npos)
146 {146 {
147 _handle = IconLoader::GetDefault().LoadFromURI(_icon_name,147 _handle = IconLoader::GetDefault().LoadFromURI(_icon_name,
148 -1, _size, sigc::mem_fun(this, &IconTexture::IconLoaded));148 -1, _size, sigc::mem_fun(this, &IconTexture::IconLoaded));
149149
=== modified file 'unity-shared/IconTextureSource.cpp'
--- unity-shared/IconTextureSource.cpp 2013-10-04 00:46:07 +0000
+++ unity-shared/IconTextureSource.cpp 2014-12-17 12:14:47 +0000
@@ -19,6 +19,7 @@
1919
20#include "IconTextureSource.h"20#include "IconTextureSource.h"
21#include "MultiMonitor.h"21#include "MultiMonitor.h"
22#include "unity-shared/UnitySettings.h"
2223
23namespace unity24namespace unity
24{25{
@@ -34,11 +35,16 @@
34IconTextureSource::IconTextureSource()35IconTextureSource::IconTextureSource()
35 : skip_(RENDERERS_SIZE, false)36 : skip_(RENDERERS_SIZE, false)
36 , had_emblem_(RENDERERS_SIZE, false)37 , had_emblem_(RENDERERS_SIZE, false)
38 , last_count_(RENDERERS_SIZE, 0)
37 , last_render_center_(RENDERERS_SIZE)39 , last_render_center_(RENDERERS_SIZE)
38 , last_logical_center_(RENDERERS_SIZE)40 , last_logical_center_(RENDERERS_SIZE)
39 , last_rotation_(RENDERERS_SIZE)41 , last_rotation_(RENDERERS_SIZE)
40 , transformations_(RENDERERS_SIZE, decltype(transformations_)::value_type(TRANSFORM_SIZE, std::vector<nux::Vector4>(4)))42 , transformations_(RENDERERS_SIZE, decltype(transformations_)::value_type(TRANSFORM_SIZE, std::vector<nux::Vector4>(4)))
41{}43{
44 auto reset_count_cb = sigc::mem_fun(this, &IconTextureSource::ResetLastCount);
45 Settings::Instance().dpi_changed.connect(reset_count_cb);
46 Settings::Instance().font_scaling.changed.connect(sigc::hide(reset_count_cb));
47}
4248
43std::vector<nux::Vector4> & IconTextureSource::GetTransform(TransformIndex index, int monitor)49std::vector<nux::Vector4> & IconTextureSource::GetTransform(TransformIndex index, int monitor)
44{50{
@@ -91,5 +97,35 @@
91 return had_emblem_[monitor];97 return had_emblem_[monitor];
92}98}
9399
100void IconTextureSource::RememberCount(int monitor, unsigned count)
101{
102 last_count_[monitor] = count;
103}
104
105unsigned IconTextureSource::LastCount(int monitor) const
106{
107 return last_count_[monitor];
108}
109
110unsigned IconTextureSource::Count() const
111{
112 return 0;
113}
114
115void IconTextureSource::ResetLastCount()
116{
117 std::fill(last_count_.begin(), last_count_.end(), 0);
118}
119
120nux::BaseTexture* IconTextureSource::Emblem() const
121{
122 return nullptr;
123}
124
125nux::BaseTexture* IconTextureSource::CountTexture(double scale)
126{
127 return nullptr;
128}
129
94}130}
95}131}
96\ No newline at end of file132\ No newline at end of file
97133
=== modified file 'unity-shared/IconTextureSource.h'
--- unity-shared/IconTextureSource.h 2013-11-06 11:21:43 +0000
+++ unity-shared/IconTextureSource.h 2014-12-17 12:14:47 +0000
@@ -46,7 +46,7 @@
46 };46 };
4747
48 IconTextureSource();48 IconTextureSource();
49 virtual ~IconTextureSource() {}49 virtual ~IconTextureSource() = default;
5050
51 std::vector<nux::Vector4> & GetTransform(TransformIndex index, int monitor);51 std::vector<nux::Vector4> & GetTransform(TransformIndex index, int monitor);
5252
@@ -62,17 +62,23 @@
62 void RememberEmblem(int monitor, bool has_emblem);62 void RememberEmblem(int monitor, bool has_emblem);
63 bool HadEmblem(int monitor) const;63 bool HadEmblem(int monitor) const;
6464
65 void RememberCount(int monitor, unsigned count);
66 unsigned LastCount(int monitor) const;
67
65 virtual nux::Color BackgroundColor() const = 0;68 virtual nux::Color BackgroundColor() const = 0;
66
67 virtual nux::Color GlowColor() = 0;69 virtual nux::Color GlowColor() = 0;
68
69 virtual nux::BaseTexture* TextureForSize(int size) = 0;70 virtual nux::BaseTexture* TextureForSize(int size) = 0;
7071
71 virtual nux::BaseTexture* Emblem() = 0;72 virtual unsigned Count() const;
73 virtual nux::BaseTexture* CountTexture(double scale);
74 virtual nux::BaseTexture* Emblem() const;
7275
73private:76private:
77 void ResetLastCount();
78
74 std::vector<bool> skip_;79 std::vector<bool> skip_;
75 std::vector<bool> had_emblem_;80 std::vector<bool> had_emblem_;
81 std::vector<unsigned> last_count_;
76 std::vector<nux::Point3> last_render_center_;82 std::vector<nux::Point3> last_render_center_;
77 std::vector<nux::Point3> last_logical_center_;83 std::vector<nux::Point3> last_logical_center_;
78 std::vector<nux::Vector3> last_rotation_;84 std::vector<nux::Vector3> last_rotation_;
7985
=== modified file 'unity-shared/LayoutSystem.cpp'
--- unity-shared/LayoutSystem.cpp 2014-03-10 13:17:01 +0000
+++ unity-shared/LayoutSystem.cpp 2014-12-17 12:14:47 +0000
@@ -32,7 +32,33 @@
32 if (windows.empty())32 if (windows.empty())
The diff has been truncated for viewing.

Subscribers

People subscribed via source and target branches

to all changes:
to status/vote changes: