Merge lp:~canonical-dx-team/unity/unity.shimmer into lp:unity

Proposed by Jason Smith
Status: Merged
Merged at revision: 635
Proposed branch: lp:~canonical-dx-team/unity/unity.shimmer
Merge into: lp:unity
Diff against target: 350 lines (+131/-65)
5 files modified
src/Launcher.cpp (+79/-52)
src/Launcher.h (+12/-8)
src/LauncherController.cpp (+9/-5)
src/LauncherIcon.cpp (+22/-0)
src/LauncherIcon.h (+9/-0)
To merge this branch: bzr merge lp:~canonical-dx-team/unity/unity.shimmer
Reviewer Review Type Date Requested Status
Sam Spilsbury (community) Approve
Review via email: mp+41912@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Sam Spilsbury (smspillaz) wrote :
Download full text (3.5 KiB)

Looks good to merge, although it would be nice if you could fix these:

1) You need to either change these to const gchar * or create stack or heap memory for them

/home/smspillaz/Source/compiz/compiz-glib/unity.shimmer/src/IntrospectionDBusInterface.cpp:41:1: warning: deprecated conversion from string constant to ‘gchar*’
/home/smspillaz/Source/compiz/compiz-glib/unity.shimmer/src/IntrospectionDBusInterface.cpp:41:1: warning: deprecated conversion from string constant to ‘gchar*’
/home/smspillaz/Source/compiz/compiz-glib/unity.shimmer/src/IntrospectionDBusInterface.cpp:51:1: warning: deprecated conversion from string constant to ‘gchar*’
/home/smspillaz/Source/compiz/compiz-glib/unity.shimmer/src/IntrospectionDBusInterface.cpp:51:1: warning: deprecated conversion from string constant to ‘gchar*’
/home/smspillaz/Source/compiz/compiz-glib/unity.shimmer/src/IntrospectionDBusInterface.cpp:61:1: warning: deprecated conversion from string constant to ‘gchar*’
/home/smspillaz/Source/compiz/compiz-glib/unity.shimmer/src/IntrospectionDBusInterface.cpp:73:1: warning: deprecated conversion from string constant to ‘gchar*’

2) Remove these unused variables

/home/smspillaz/Source/compiz/compiz-glib/unity.shimmer/build/libunity/unity-place.c: In function ‘_dbus_handle_unity_place_service_entry_added’:
/home/smspillaz/Source/compiz/compiz-glib/unity.shimmer/build/libunity/unity-place.c:2664:15: warning: unused variable ‘reply’
/home/smspillaz/Source/compiz/compiz-glib/unity.shimmer/build/libunity/unity-place.c: In function ‘_dbus_handle_unity_place_service_entry_removed’:
/home/smspillaz/Source/compiz/compiz-glib/unity.shimmer/build/libunity/unity-place.c:2799:15: warning: unused variable ‘reply’
/home/smspillaz/Source/compiz/compiz-glib/unity.shimmer/build/libunity/unity-place.c: In function ‘_dbus_handle_unity_place_entry_service_entry_renderer_info_changed’:
/home/smspillaz/Source/compiz/compiz-glib/unity.shimmer/build/libunity/unity-place.c:4102:15: warning: unused variable ‘reply’
/home/smspillaz/Source/compiz/compiz-glib/unity.shimmer/build/libunity/unity-place.c: In function ‘_dbus_handle_unity_place_entry_service_global_renderer_info_changed’:
/home/smspillaz/Source/compiz/compiz-glib/unity.shimmer/build/libunity/unity-place.c:4154:15: warning: unused variable ‘reply’
/home/smspillaz/Source/compiz/compiz-glib/unity.shimmer/build/libunity/unity-place.c: In function ‘_dbus_handle_unity_place_entry_service_place_entry_info_changed’:
/home/smspillaz/Source/compiz/compiz-glib/unity.shimmer/build/libunity/unity-place.c:4214:15: warning: unused variable ‘reply’

3) This is bad

/home/smspillaz/Source/compiz/compiz-glib/unity.shimmer/build/libunity/unity-place.c: In function ‘unity_place_service_impl_dbus_message’:
/home/smspillaz/Source/compiz/compiz-glib/unity.shimmer/build/libunity/unity-place.c:4851:2: warning: implicit declaration of function ‘unity_place_activation_dbus_message’
/home/smspillaz/Source/compiz/compiz-glib/unity.shimmer/build/libunity/unity-place.c: In function ‘unity_place_service_impl_dbus_register_object’:
/home/smspillaz/Source/compiz/compiz-glib/unity.shimmer/build/libunity/unity-place.c:4866:2: warning: implicit declaration of f...

Read more...

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'src/Launcher.cpp'
--- src/Launcher.cpp 2010-11-25 07:33:42 +0000
+++ src/Launcher.cpp 2010-11-25 23:52:43 +0000
@@ -331,24 +331,28 @@
331331
332bool Launcher::IconNeedsAnimation (LauncherIcon *icon, struct timespec current)332bool Launcher::IconNeedsAnimation (LauncherIcon *icon, struct timespec current)
333{333{
334 struct timespec visible_time = icon->GetQuirkTime (LAUNCHER_ICON_QUIRK_VISIBLE);334 struct timespec time = icon->GetQuirkTime (LAUNCHER_ICON_QUIRK_VISIBLE);
335 if (TimeDelta (&current, &visible_time) < ANIM_DURATION_SHORT)335 if (TimeDelta (&current, &time) < ANIM_DURATION_SHORT)
336 return true;336 return true;
337 337
338 struct timespec running_time = icon->GetQuirkTime (LAUNCHER_ICON_QUIRK_RUNNING);338 time = icon->GetQuirkTime (LAUNCHER_ICON_QUIRK_RUNNING);
339 if (TimeDelta (&current, &running_time) < ANIM_DURATION_SHORT)339 if (TimeDelta (&current, &time) < ANIM_DURATION_SHORT)
340 return true;340 return true;
341 341
342 struct timespec starting_time = icon->GetQuirkTime (LAUNCHER_ICON_QUIRK_STARTING);342 time = icon->GetQuirkTime (LAUNCHER_ICON_QUIRK_STARTING);
343 if (TimeDelta (&current, &starting_time) < (ANIM_DURATION_LONG * MAX_STARTING_BLINKS * STARTING_BLINK_LAMBDA * 2))343 if (TimeDelta (&current, &time) < (ANIM_DURATION_LONG * MAX_STARTING_BLINKS * STARTING_BLINK_LAMBDA * 2))
344 return true;344 return true;
345 345
346 struct timespec urgent_time = icon->GetQuirkTime (LAUNCHER_ICON_QUIRK_URGENT);346 time = icon->GetQuirkTime (LAUNCHER_ICON_QUIRK_URGENT);
347 if (TimeDelta (&current, &urgent_time) < (ANIM_DURATION_LONG * URGENT_BLINKS * 2))347 if (TimeDelta (&current, &time) < (ANIM_DURATION_LONG * URGENT_BLINKS * 2))
348 return true;348 return true;
349 349
350 struct timespec present_time = icon->GetQuirkTime (LAUNCHER_ICON_QUIRK_PRESENTED);350 time = icon->GetQuirkTime (LAUNCHER_ICON_QUIRK_PRESENTED);
351 if (TimeDelta (&current, &present_time) < ANIM_DURATION)351 if (TimeDelta (&current, &time) < ANIM_DURATION)
352 return true;
353
354 time = icon->GetQuirkTime (LAUNCHER_ICON_QUIRK_SHIMMER);
355 if (TimeDelta (&current, &time) < ANIM_DURATION_LONG)
352 return true;356 return true;
353 357
354 return false;358 return false;
@@ -481,6 +485,13 @@
481 return 1.0f - result;485 return 1.0f - result;
482}486}
483487
488float Launcher::IconShimmerProgress (LauncherIcon *icon, struct timespec current)
489{
490 struct timespec shimmer_time = icon->GetQuirkTime (LAUNCHER_ICON_QUIRK_SHIMMER);
491 int shimmer_ms = TimeDelta (&current, &shimmer_time);
492 return CLAMP ((float) shimmer_ms / (float) ANIM_DURATION_LONG, 0.0f, 1.0f);
493}
494
484float Launcher::IconUrgentPulseValue (LauncherIcon *icon, struct timespec current)495float Launcher::IconUrgentPulseValue (LauncherIcon *icon, struct timespec current)
485{496{
486 if (!icon->GetQuirk (LAUNCHER_ICON_QUIRK_URGENT))497 if (!icon->GetQuirk (LAUNCHER_ICON_QUIRK_URGENT))
@@ -530,6 +541,29 @@
530 return result;541 return result;
531}542}
532543
544void Launcher::SetupRenderArg (LauncherIcon *icon, struct timespec current, RenderArg &arg)
545{
546 arg.icon = icon;
547 arg.alpha = 1.0f;
548 arg.running_arrow = false;
549 arg.active_arrow = icon->GetQuirk (LAUNCHER_ICON_QUIRK_ACTIVE);
550 arg.folding_rads = 0.0f;
551 arg.skip = false;
552
553 arg.window_indicators = MIN (4, icon->RelatedWindows ());
554
555 // we dont need to show strays
556 if (arg.window_indicators == 1 || !icon->GetQuirk (LAUNCHER_ICON_QUIRK_RUNNING))
557 arg.window_indicators = 0;
558
559 arg.backlight_intensity = IconBackgroundIntensity (icon, current);
560 arg.shimmer_progress = IconShimmerProgress (icon, current);
561
562 float urgent_progress = IconUrgentProgress (icon, current);
563 urgent_progress = CLAMP (urgent_progress * 3, 0.0f, 1.0f); // we want to go 3x faster than the urgent normal cycle
564 arg.glow_intensity = urgent_progress;
565}
566
533void Launcher::RenderArgs (std::list<Launcher::RenderArg> &launcher_args, 567void Launcher::RenderArgs (std::list<Launcher::RenderArg> &launcher_args,
534 std::list<Launcher::RenderArg> &shelf_args, 568 std::list<Launcher::RenderArg> &shelf_args,
535 nux::Geometry &box_geo, nux::Geometry &shelf_geo)569 nux::Geometry &box_geo, nux::Geometry &shelf_geo)
@@ -648,24 +682,7 @@
648 RenderArg arg;682 RenderArg arg;
649 LauncherIcon *icon = *it;683 LauncherIcon *icon = *it;
650 684
651 arg.icon = icon;685 SetupRenderArg (icon, current, arg);
652 arg.alpha = 1.0f;
653 arg.running_arrow = false;
654 arg.active_arrow = icon->GetQuirk (LAUNCHER_ICON_QUIRK_ACTIVE);
655 arg.folding_rads = 0.0f;
656 arg.skip = false;
657
658 arg.window_indicators = MIN (4, icon->RelatedWindows ());
659
660 // we dont need to show strays
661 if (arg.window_indicators == 1 || !icon->GetQuirk (LAUNCHER_ICON_QUIRK_RUNNING))
662 arg.window_indicators = 0;
663
664 arg.backlight_intensity = IconBackgroundIntensity (icon, current);
665
666 float urgent_progress = IconUrgentProgress (icon, current);
667 urgent_progress = CLAMP (urgent_progress * 3, 0.0f, 1.0f); // we want to go 3x faster than the urgent normal cycle
668 arg.glow_intensity = urgent_progress;
669 686
670 // reset z687 // reset z
671 center.z = 0;688 center.z = 0;
@@ -721,22 +738,8 @@
721 {738 {
722 RenderArg arg;739 RenderArg arg;
723 LauncherIcon *icon = *it;740 LauncherIcon *icon = *it;
724 741
725 arg.icon = icon;742 SetupRenderArg (icon, current, arg);
726 arg.alpha = 1.0f;
727 arg.glow_intensity = 0.0f;
728 arg.running_arrow = false;
729 arg.active_arrow = icon->GetQuirk (LAUNCHER_ICON_QUIRK_ACTIVE);
730 arg.folding_rads = 0.0f;
731 arg.skip = false;
732
733 arg.window_indicators = MIN (4, icon->RelatedWindows ());
734
735 // we dont need to show strays
736 if (arg.window_indicators == 1 || !icon->GetQuirk (LAUNCHER_ICON_QUIRK_RUNNING))
737 arg.window_indicators = 0;
738
739 arg.backlight_intensity = IconBackgroundIntensity (icon, current);
740 743
741 // reset z744 // reset z
742 center.z = 0;745 center.z = 0;
@@ -1241,6 +1244,30 @@
1241 geo,1244 geo,
1242 false);1245 false);
1243 }1246 }
1247
1248 if (arg.shimmer_progress > 0.0f && arg.shimmer_progress < 1.0f)
1249 {
1250 nux::Geometry base = GetGeometry ();
1251 int x1 = base.x + base.width;
1252 int x2 = base.x + base.width;
1253 float shimmer_constant = 1.9f;
1254
1255 x1 -= geo.width * arg.shimmer_progress * shimmer_constant;
1256 GfxContext.PushClippingRectangle(nux::Geometry (x1, geo.y, x2 - x1, geo.height));
1257
1258 float fade_out = 1.0f - CLAMP (((x2 - x1) - geo.width) / (geo.width * (shimmer_constant - 1.0f)), 0.0f, 1.0f);
1259
1260 RenderIcon(GfxContext,
1261 arg,
1262 _icon_glow_texture,
1263 arg.icon->GlowColor (),
1264 fade_out,
1265 arg.icon->_xform_coords["Glow"],
1266 geo,
1267 false);
1268
1269 GfxContext.PopClippingRectangle();
1270 }
1244}1271}
12451272
1246void Launcher::DrawContent(nux::GraphicsEngine& GfxContext, bool force_draw)1273void Launcher::DrawContent(nux::GraphicsEngine& GfxContext, bool force_draw)
12471274
=== modified file 'src/Launcher.h'
--- src/Launcher.h 2010-11-25 01:55:23 +0000
+++ src/Launcher.h 2010-11-25 23:52:43 +0000
@@ -23,7 +23,7 @@
23#include <sys/time.h>23#include <sys/time.h>
2424
25#include <Nux/View.h>25#include <Nux/View.h>
26#include <Nux/BaseWindow.h>26#include <Nux/BaseWindow.h>
27#include "Introspectable.h"27#include "Introspectable.h"
28#include "LauncherIcon.h"28#include "LauncherIcon.h"
29#include "NuxGraphics/IOpenGLAsmShader.h"29#include "NuxGraphics/IOpenGLAsmShader.h"
@@ -65,20 +65,20 @@
65 virtual void RecvMouseEnter(int x, int y, unsigned long button_flags, unsigned long key_flags);65 virtual void RecvMouseEnter(int x, int y, unsigned long button_flags, unsigned long key_flags);
66 virtual void RecvMouseLeave(int x, int y, unsigned long button_flags, unsigned long key_flags);66 virtual void RecvMouseLeave(int x, int y, unsigned long button_flags, unsigned long key_flags);
67 virtual void RecvMouseMove(int x, int y, int dx, int dy, unsigned long button_flags, unsigned long key_flags);67 virtual void RecvMouseMove(int x, int y, int dx, int dy, unsigned long button_flags, unsigned long key_flags);
68 virtual void RecvMouseWheel(int x, int y, int wheel_delta, unsigned long button_flags, unsigned long key_flags);68 virtual void RecvMouseWheel(int x, int y, int wheel_delta, unsigned long button_flags, unsigned long key_flags);
6969
70 //! Called by LauncherIcon to signal that a Quicklist is becoming active.70 //! Called by LauncherIcon to signal that a Quicklist is becoming active.
71 void SetActiveQuicklist (QuicklistView *quicklist);71 void SetActiveQuicklist (QuicklistView *quicklist);
72 //! Get the active qicklist72 //! Get the active qicklist
73 QuicklistView *GetActiveQuicklist ();73 QuicklistView *GetActiveQuicklist ();
74 //! Called by LauncherIcon to signal that a Quicklist is becoming unactive.74 //! Called by LauncherIcon to signal that a Quicklist is becoming unactive.
75 void CancelActiveQuicklist (QuicklistView *quicklist);75 void CancelActiveQuicklist (QuicklistView *quicklist);
7676
77protected: 77protected:
78 // Introspectable methods78 // Introspectable methods
79 const gchar* GetName ();79 const gchar* GetName ();
80 void AddProperties (GVariantBuilder *builder);80 void AddProperties (GVariantBuilder *builder);
8181
82private:82private:
83 typedef enum83 typedef enum
84 {84 {
@@ -101,6 +101,7 @@
101 float alpha;101 float alpha;
102 float backlight_intensity;102 float backlight_intensity;
103 float glow_intensity;103 float glow_intensity;
104 float shimmer_progress;
104 bool running_arrow;105 bool running_arrow;
105 bool active_arrow;106 bool active_arrow;
106 bool skip;107 bool skip;
@@ -126,6 +127,7 @@
126 float AutohideProgress ();127 float AutohideProgress ();
127 float IconPresentProgress (LauncherIcon *icon, struct timespec current);128 float IconPresentProgress (LauncherIcon *icon, struct timespec current);
128 float IconUrgentProgress (LauncherIcon *icon, struct timespec current);129 float IconUrgentProgress (LauncherIcon *icon, struct timespec current);
130 float IconShimmerProgress (LauncherIcon *icon, struct timespec current);
129 float IconUrgentPulseValue (LauncherIcon *icon, struct timespec current);131 float IconUrgentPulseValue (LauncherIcon *icon, struct timespec current);
130 float IconStartingPulseValue (LauncherIcon *icon, struct timespec current);132 float IconStartingPulseValue (LauncherIcon *icon, struct timespec current);
131 float IconBackgroundIntensity (LauncherIcon *icon, struct timespec current);133 float IconBackgroundIntensity (LauncherIcon *icon, struct timespec current);
@@ -135,6 +137,8 @@
135 void SetHidden (bool hidden);137 void SetHidden (bool hidden);
136 138
137 void SetDndDelta (float x, float y, nux::Geometry geo, struct timespec current);139 void SetDndDelta (float x, float y, nux::Geometry geo, struct timespec current);
140
141 void SetupRenderArg (LauncherIcon *icon, struct timespec current, RenderArg &arg);
138 void RenderArgs (std::list<Launcher::RenderArg> &launcher_args, 142 void RenderArgs (std::list<Launcher::RenderArg> &launcher_args,
139 std::list<Launcher::RenderArg> &shelf_args, 143 std::list<Launcher::RenderArg> &shelf_args,
140 nux::Geometry &box_geo, nux::Geometry &shelf_geo);144 nux::Geometry &box_geo, nux::Geometry &shelf_geo);
141145
=== modified file 'src/LauncherController.cpp'
--- src/LauncherController.cpp 2010-11-25 05:40:01 +0000
+++ src/LauncherController.cpp 2010-11-25 23:52:43 +0000
@@ -52,24 +52,28 @@
52LauncherController::PresentIconOwningWindow (Window window)52LauncherController::PresentIconOwningWindow (Window window)
53{53{
54 LauncherModel::iterator it;54 LauncherModel::iterator it;
55 LauncherIcon *owner = 0;
55 56
56 for (it = _model->begin (); it != _model->end (); it++)57 for (it = _model->begin (); it != _model->end (); it++)
57 {58 {
58 if ((*it)->IconOwnsWindow (window))59 if ((*it)->IconOwnsWindow (window))
59 {60 {
60 (*it)->Present (2, 600);61 owner = *it;
61 return;62 break;
62 }63 }
63 }64 }
64 65
65 for (it = _model->shelf_begin (); it != _model->shelf_end (); it++)66 for (it = _model->shelf_begin (); !owner && it != _model->shelf_end (); it++)
66 {67 {
67 if ((*it)->IconOwnsWindow (window))68 if ((*it)->IconOwnsWindow (window))
68 {69 {
69 (*it)->Present (2, 600);70 owner = *it;
70 return;71 break;
71 }72 }
72 }73 }
74
75 owner->Present (2, 600);
76 owner->UpdateQuirkTimeDelayed (300, LAUNCHER_ICON_QUIRK_SHIMMER);
73}77}
7478
75void79void
7680
=== modified file 'src/LauncherIcon.cpp'
--- src/LauncherIcon.cpp 2010-11-25 16:23:26 +0000
+++ src/LauncherIcon.cpp 2010-11-25 23:52:43 +0000
@@ -512,6 +512,28 @@
512 Present (1, 1500);512 Present (1, 1500);
513}513}
514514
515gboolean
516LauncherIcon::OnDelayedUpdateTimeout (gpointer data)
517{
518 DelayedUpdateArg *arg = (DelayedUpdateArg *) data;
519 LauncherIcon *self = arg->self;
520
521 clock_gettime (CLOCK_MONOTONIC, &(self->_quirk_times[arg->quirk]));
522 self->needs_redraw.emit (self);
523
524 return false;
525}
526
527void
528LauncherIcon::UpdateQuirkTimeDelayed (guint ms, LauncherIconQuirk quirk)
529{
530 DelayedUpdateArg *arg = new DelayedUpdateArg ();
531 arg->self = this;
532 arg->quirk = quirk;
533
534 g_timeout_add (ms, &LauncherIcon::OnDelayedUpdateTimeout, arg);
535}
536
515void537void
516LauncherIcon::UpdateQuirkTime (LauncherIconQuirk quirk)538LauncherIcon::UpdateQuirkTime (LauncherIconQuirk quirk)
517{539{
518540
=== modified file 'src/LauncherIcon.h'
--- src/LauncherIcon.h 2010-11-25 16:23:26 +0000
+++ src/LauncherIcon.h 2010-11-25 23:52:43 +0000
@@ -58,6 +58,7 @@
58 LAUNCHER_ICON_QUIRK_URGENT,58 LAUNCHER_ICON_QUIRK_URGENT,
59 LAUNCHER_ICON_QUIRK_PRESENTED,59 LAUNCHER_ICON_QUIRK_PRESENTED,
60 LAUNCHER_ICON_QUIRK_STARTING,60 LAUNCHER_ICON_QUIRK_STARTING,
61 LAUNCHER_ICON_QUIRK_SHIMMER,
61 62
62 LAUNCHER_ICON_QUIRK_LAST,63 LAUNCHER_ICON_QUIRK_LAST,
63} LauncherIconQuirk;64} LauncherIconQuirk;
@@ -116,6 +117,7 @@
116protected:117protected:
117 void SetQuirk (LauncherIconQuirk quirk, bool value);118 void SetQuirk (LauncherIconQuirk quirk, bool value);
118119
120 void UpdateQuirkTimeDelayed (guint ms, LauncherIconQuirk quirk);
119 void UpdateQuirkTime (LauncherIconQuirk quirk);121 void UpdateQuirkTime (LauncherIconQuirk quirk);
120 void ResetQuirkTime (LauncherIconQuirk quirk);122 void ResetQuirkTime (LauncherIconQuirk quirk);
121123
@@ -157,10 +159,17 @@
157 friend class LauncherController;159 friend class LauncherController;
158160
159private:161private:
162 typedef struct
163 {
164 LauncherIcon *self;
165 LauncherIconQuirk quirk;
166 } DelayedUpdateArg;
167
160 static void ChildRealized (DbusmenuMenuitem *newitem, QuicklistView *quicklist);168 static void ChildRealized (DbusmenuMenuitem *newitem, QuicklistView *quicklist);
161 static void RootChanged (DbusmenuClient * client, DbusmenuMenuitem *newroot, QuicklistView *quicklist);169 static void RootChanged (DbusmenuClient * client, DbusmenuMenuitem *newroot, QuicklistView *quicklist);
162 static gboolean OnPresentTimeout (gpointer data);170 static gboolean OnPresentTimeout (gpointer data);
163 static gboolean OnCenterTimeout (gpointer data);171 static gboolean OnCenterTimeout (gpointer data);
172 static gboolean OnDelayedUpdateTimeout (gpointer data);
164173
165 void ColorForIcon (GdkPixbuf *pixbuf, nux::Color &background, nux::Color &glow);174 void ColorForIcon (GdkPixbuf *pixbuf, nux::Color &background, nux::Color &glow);
166175