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
1=== modified file 'src/Launcher.cpp'
2--- src/Launcher.cpp 2010-11-25 07:33:42 +0000
3+++ src/Launcher.cpp 2010-11-25 23:52:43 +0000
4@@ -331,24 +331,28 @@
5
6 bool Launcher::IconNeedsAnimation (LauncherIcon *icon, struct timespec current)
7 {
8- struct timespec visible_time = icon->GetQuirkTime (LAUNCHER_ICON_QUIRK_VISIBLE);
9- if (TimeDelta (&current, &visible_time) < ANIM_DURATION_SHORT)
10- return true;
11-
12- struct timespec running_time = icon->GetQuirkTime (LAUNCHER_ICON_QUIRK_RUNNING);
13- if (TimeDelta (&current, &running_time) < ANIM_DURATION_SHORT)
14- return true;
15-
16- struct timespec starting_time = icon->GetQuirkTime (LAUNCHER_ICON_QUIRK_STARTING);
17- if (TimeDelta (&current, &starting_time) < (ANIM_DURATION_LONG * MAX_STARTING_BLINKS * STARTING_BLINK_LAMBDA * 2))
18- return true;
19-
20- struct timespec urgent_time = icon->GetQuirkTime (LAUNCHER_ICON_QUIRK_URGENT);
21- if (TimeDelta (&current, &urgent_time) < (ANIM_DURATION_LONG * URGENT_BLINKS * 2))
22- return true;
23-
24- struct timespec present_time = icon->GetQuirkTime (LAUNCHER_ICON_QUIRK_PRESENTED);
25- if (TimeDelta (&current, &present_time) < ANIM_DURATION)
26+ struct timespec time = icon->GetQuirkTime (LAUNCHER_ICON_QUIRK_VISIBLE);
27+ if (TimeDelta (&current, &time) < ANIM_DURATION_SHORT)
28+ return true;
29+
30+ time = icon->GetQuirkTime (LAUNCHER_ICON_QUIRK_RUNNING);
31+ if (TimeDelta (&current, &time) < ANIM_DURATION_SHORT)
32+ return true;
33+
34+ time = icon->GetQuirkTime (LAUNCHER_ICON_QUIRK_STARTING);
35+ if (TimeDelta (&current, &time) < (ANIM_DURATION_LONG * MAX_STARTING_BLINKS * STARTING_BLINK_LAMBDA * 2))
36+ return true;
37+
38+ time = icon->GetQuirkTime (LAUNCHER_ICON_QUIRK_URGENT);
39+ if (TimeDelta (&current, &time) < (ANIM_DURATION_LONG * URGENT_BLINKS * 2))
40+ return true;
41+
42+ time = icon->GetQuirkTime (LAUNCHER_ICON_QUIRK_PRESENTED);
43+ if (TimeDelta (&current, &time) < ANIM_DURATION)
44+ return true;
45+
46+ time = icon->GetQuirkTime (LAUNCHER_ICON_QUIRK_SHIMMER);
47+ if (TimeDelta (&current, &time) < ANIM_DURATION_LONG)
48 return true;
49
50 return false;
51@@ -481,6 +485,13 @@
52 return 1.0f - result;
53 }
54
55+float Launcher::IconShimmerProgress (LauncherIcon *icon, struct timespec current)
56+{
57+ struct timespec shimmer_time = icon->GetQuirkTime (LAUNCHER_ICON_QUIRK_SHIMMER);
58+ int shimmer_ms = TimeDelta (&current, &shimmer_time);
59+ return CLAMP ((float) shimmer_ms / (float) ANIM_DURATION_LONG, 0.0f, 1.0f);
60+}
61+
62 float Launcher::IconUrgentPulseValue (LauncherIcon *icon, struct timespec current)
63 {
64 if (!icon->GetQuirk (LAUNCHER_ICON_QUIRK_URGENT))
65@@ -530,6 +541,29 @@
66 return result;
67 }
68
69+void Launcher::SetupRenderArg (LauncherIcon *icon, struct timespec current, RenderArg &arg)
70+{
71+ arg.icon = icon;
72+ arg.alpha = 1.0f;
73+ arg.running_arrow = false;
74+ arg.active_arrow = icon->GetQuirk (LAUNCHER_ICON_QUIRK_ACTIVE);
75+ arg.folding_rads = 0.0f;
76+ arg.skip = false;
77+
78+ arg.window_indicators = MIN (4, icon->RelatedWindows ());
79+
80+ // we dont need to show strays
81+ if (arg.window_indicators == 1 || !icon->GetQuirk (LAUNCHER_ICON_QUIRK_RUNNING))
82+ arg.window_indicators = 0;
83+
84+ arg.backlight_intensity = IconBackgroundIntensity (icon, current);
85+ arg.shimmer_progress = IconShimmerProgress (icon, current);
86+
87+ float urgent_progress = IconUrgentProgress (icon, current);
88+ urgent_progress = CLAMP (urgent_progress * 3, 0.0f, 1.0f); // we want to go 3x faster than the urgent normal cycle
89+ arg.glow_intensity = urgent_progress;
90+}
91+
92 void Launcher::RenderArgs (std::list<Launcher::RenderArg> &launcher_args,
93 std::list<Launcher::RenderArg> &shelf_args,
94 nux::Geometry &box_geo, nux::Geometry &shelf_geo)
95@@ -648,24 +682,7 @@
96 RenderArg arg;
97 LauncherIcon *icon = *it;
98
99- arg.icon = icon;
100- arg.alpha = 1.0f;
101- arg.running_arrow = false;
102- arg.active_arrow = icon->GetQuirk (LAUNCHER_ICON_QUIRK_ACTIVE);
103- arg.folding_rads = 0.0f;
104- arg.skip = false;
105-
106- arg.window_indicators = MIN (4, icon->RelatedWindows ());
107-
108- // we dont need to show strays
109- if (arg.window_indicators == 1 || !icon->GetQuirk (LAUNCHER_ICON_QUIRK_RUNNING))
110- arg.window_indicators = 0;
111-
112- arg.backlight_intensity = IconBackgroundIntensity (icon, current);
113-
114- float urgent_progress = IconUrgentProgress (icon, current);
115- urgent_progress = CLAMP (urgent_progress * 3, 0.0f, 1.0f); // we want to go 3x faster than the urgent normal cycle
116- arg.glow_intensity = urgent_progress;
117+ SetupRenderArg (icon, current, arg);
118
119 // reset z
120 center.z = 0;
121@@ -721,22 +738,8 @@
122 {
123 RenderArg arg;
124 LauncherIcon *icon = *it;
125-
126- arg.icon = icon;
127- arg.alpha = 1.0f;
128- arg.glow_intensity = 0.0f;
129- arg.running_arrow = false;
130- arg.active_arrow = icon->GetQuirk (LAUNCHER_ICON_QUIRK_ACTIVE);
131- arg.folding_rads = 0.0f;
132- arg.skip = false;
133-
134- arg.window_indicators = MIN (4, icon->RelatedWindows ());
135-
136- // we dont need to show strays
137- if (arg.window_indicators == 1 || !icon->GetQuirk (LAUNCHER_ICON_QUIRK_RUNNING))
138- arg.window_indicators = 0;
139-
140- arg.backlight_intensity = IconBackgroundIntensity (icon, current);
141+
142+ SetupRenderArg (icon, current, arg);
143
144 // reset z
145 center.z = 0;
146@@ -1241,6 +1244,30 @@
147 geo,
148 false);
149 }
150+
151+ if (arg.shimmer_progress > 0.0f && arg.shimmer_progress < 1.0f)
152+ {
153+ nux::Geometry base = GetGeometry ();
154+ int x1 = base.x + base.width;
155+ int x2 = base.x + base.width;
156+ float shimmer_constant = 1.9f;
157+
158+ x1 -= geo.width * arg.shimmer_progress * shimmer_constant;
159+ GfxContext.PushClippingRectangle(nux::Geometry (x1, geo.y, x2 - x1, geo.height));
160+
161+ float fade_out = 1.0f - CLAMP (((x2 - x1) - geo.width) / (geo.width * (shimmer_constant - 1.0f)), 0.0f, 1.0f);
162+
163+ RenderIcon(GfxContext,
164+ arg,
165+ _icon_glow_texture,
166+ arg.icon->GlowColor (),
167+ fade_out,
168+ arg.icon->_xform_coords["Glow"],
169+ geo,
170+ false);
171+
172+ GfxContext.PopClippingRectangle();
173+ }
174 }
175
176 void Launcher::DrawContent(nux::GraphicsEngine& GfxContext, bool force_draw)
177
178=== modified file 'src/Launcher.h'
179--- src/Launcher.h 2010-11-25 01:55:23 +0000
180+++ src/Launcher.h 2010-11-25 23:52:43 +0000
181@@ -23,7 +23,7 @@
182 #include <sys/time.h>
183
184 #include <Nux/View.h>
185-#include <Nux/BaseWindow.h>
186+#include <Nux/BaseWindow.h>
187 #include "Introspectable.h"
188 #include "LauncherIcon.h"
189 #include "NuxGraphics/IOpenGLAsmShader.h"
190@@ -65,20 +65,20 @@
191 virtual void RecvMouseEnter(int x, int y, unsigned long button_flags, unsigned long key_flags);
192 virtual void RecvMouseLeave(int x, int y, unsigned long button_flags, unsigned long key_flags);
193 virtual void RecvMouseMove(int x, int y, int dx, int dy, unsigned long button_flags, unsigned long key_flags);
194- virtual void RecvMouseWheel(int x, int y, int wheel_delta, unsigned long button_flags, unsigned long key_flags);
195-
196+ virtual void RecvMouseWheel(int x, int y, int wheel_delta, unsigned long button_flags, unsigned long key_flags);
197+
198 //! Called by LauncherIcon to signal that a Quicklist is becoming active.
199 void SetActiveQuicklist (QuicklistView *quicklist);
200 //! Get the active qicklist
201 QuicklistView *GetActiveQuicklist ();
202 //! Called by LauncherIcon to signal that a Quicklist is becoming unactive.
203 void CancelActiveQuicklist (QuicklistView *quicklist);
204-
205-protected:
206- // Introspectable methods
207- const gchar* GetName ();
208+
209+protected:
210+ // Introspectable methods
211+ const gchar* GetName ();
212 void AddProperties (GVariantBuilder *builder);
213-
214+
215 private:
216 typedef enum
217 {
218@@ -101,6 +101,7 @@
219 float alpha;
220 float backlight_intensity;
221 float glow_intensity;
222+ float shimmer_progress;
223 bool running_arrow;
224 bool active_arrow;
225 bool skip;
226@@ -126,6 +127,7 @@
227 float AutohideProgress ();
228 float IconPresentProgress (LauncherIcon *icon, struct timespec current);
229 float IconUrgentProgress (LauncherIcon *icon, struct timespec current);
230+ float IconShimmerProgress (LauncherIcon *icon, struct timespec current);
231 float IconUrgentPulseValue (LauncherIcon *icon, struct timespec current);
232 float IconStartingPulseValue (LauncherIcon *icon, struct timespec current);
233 float IconBackgroundIntensity (LauncherIcon *icon, struct timespec current);
234@@ -135,6 +137,8 @@
235 void SetHidden (bool hidden);
236
237 void SetDndDelta (float x, float y, nux::Geometry geo, struct timespec current);
238+
239+ void SetupRenderArg (LauncherIcon *icon, struct timespec current, RenderArg &arg);
240 void RenderArgs (std::list<Launcher::RenderArg> &launcher_args,
241 std::list<Launcher::RenderArg> &shelf_args,
242 nux::Geometry &box_geo, nux::Geometry &shelf_geo);
243
244=== modified file 'src/LauncherController.cpp'
245--- src/LauncherController.cpp 2010-11-25 05:40:01 +0000
246+++ src/LauncherController.cpp 2010-11-25 23:52:43 +0000
247@@ -52,24 +52,28 @@
248 LauncherController::PresentIconOwningWindow (Window window)
249 {
250 LauncherModel::iterator it;
251+ LauncherIcon *owner = 0;
252
253 for (it = _model->begin (); it != _model->end (); it++)
254 {
255 if ((*it)->IconOwnsWindow (window))
256 {
257- (*it)->Present (2, 600);
258- return;
259+ owner = *it;
260+ break;
261 }
262 }
263
264- for (it = _model->shelf_begin (); it != _model->shelf_end (); it++)
265+ for (it = _model->shelf_begin (); !owner && it != _model->shelf_end (); it++)
266 {
267 if ((*it)->IconOwnsWindow (window))
268 {
269- (*it)->Present (2, 600);
270- return;
271+ owner = *it;
272+ break;
273 }
274 }
275+
276+ owner->Present (2, 600);
277+ owner->UpdateQuirkTimeDelayed (300, LAUNCHER_ICON_QUIRK_SHIMMER);
278 }
279
280 void
281
282=== modified file 'src/LauncherIcon.cpp'
283--- src/LauncherIcon.cpp 2010-11-25 16:23:26 +0000
284+++ src/LauncherIcon.cpp 2010-11-25 23:52:43 +0000
285@@ -512,6 +512,28 @@
286 Present (1, 1500);
287 }
288
289+gboolean
290+LauncherIcon::OnDelayedUpdateTimeout (gpointer data)
291+{
292+ DelayedUpdateArg *arg = (DelayedUpdateArg *) data;
293+ LauncherIcon *self = arg->self;
294+
295+ clock_gettime (CLOCK_MONOTONIC, &(self->_quirk_times[arg->quirk]));
296+ self->needs_redraw.emit (self);
297+
298+ return false;
299+}
300+
301+void
302+LauncherIcon::UpdateQuirkTimeDelayed (guint ms, LauncherIconQuirk quirk)
303+{
304+ DelayedUpdateArg *arg = new DelayedUpdateArg ();
305+ arg->self = this;
306+ arg->quirk = quirk;
307+
308+ g_timeout_add (ms, &LauncherIcon::OnDelayedUpdateTimeout, arg);
309+}
310+
311 void
312 LauncherIcon::UpdateQuirkTime (LauncherIconQuirk quirk)
313 {
314
315=== modified file 'src/LauncherIcon.h'
316--- src/LauncherIcon.h 2010-11-25 16:23:26 +0000
317+++ src/LauncherIcon.h 2010-11-25 23:52:43 +0000
318@@ -58,6 +58,7 @@
319 LAUNCHER_ICON_QUIRK_URGENT,
320 LAUNCHER_ICON_QUIRK_PRESENTED,
321 LAUNCHER_ICON_QUIRK_STARTING,
322+ LAUNCHER_ICON_QUIRK_SHIMMER,
323
324 LAUNCHER_ICON_QUIRK_LAST,
325 } LauncherIconQuirk;
326@@ -116,6 +117,7 @@
327 protected:
328 void SetQuirk (LauncherIconQuirk quirk, bool value);
329
330+ void UpdateQuirkTimeDelayed (guint ms, LauncherIconQuirk quirk);
331 void UpdateQuirkTime (LauncherIconQuirk quirk);
332 void ResetQuirkTime (LauncherIconQuirk quirk);
333
334@@ -157,10 +159,17 @@
335 friend class LauncherController;
336
337 private:
338+ typedef struct
339+ {
340+ LauncherIcon *self;
341+ LauncherIconQuirk quirk;
342+ } DelayedUpdateArg;
343+
344 static void ChildRealized (DbusmenuMenuitem *newitem, QuicklistView *quicklist);
345 static void RootChanged (DbusmenuClient * client, DbusmenuMenuitem *newroot, QuicklistView *quicklist);
346 static gboolean OnPresentTimeout (gpointer data);
347 static gboolean OnCenterTimeout (gpointer data);
348+ static gboolean OnDelayedUpdateTimeout (gpointer data);
349
350 void ColorForIcon (GdkPixbuf *pixbuf, nux::Color &background, nux::Color &glow);
351