Merge lp:~canonical-dx-team/unity/unity.launcher-action-items into lp:unity
- unity.launcher-action-items
- Merge into trunk
Proposed by
Jason Smith
Status: | Merged |
---|---|
Merged at revision: | 664 |
Proposed branch: | lp:~canonical-dx-team/unity/unity.launcher-action-items |
Merge into: | lp:unity |
Diff against target: |
1911 lines (+695/-555) 8 files modified
src/BamfLauncherIcon.cpp (+113/-45) src/BamfLauncherIcon.h (+2/-0) src/Launcher.cpp (+289/-272) src/Launcher.h (+22/-17) src/LauncherModel.cpp (+55/-16) src/LauncherModel.h (+9/-1) src/unity.cpp (+203/-203) src/unity.h (+2/-1) |
To merge this branch: | bzr merge lp:~canonical-dx-team/unity/unity.launcher-action-items |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Neil J. Patel (community) | Approve | ||
Review via email: mp+42730@code.launchpad.net |
Commit message
Description of the change
To post a comment you must log in.
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | === modified file 'resources/focused_indicator.png' |
2 | Binary files resources/focused_indicator.png 2010-11-02 23:27:40 +0000 and resources/focused_indicator.png 2010-12-04 21:47:02 +0000 differ |
3 | === modified file 'resources/running_indicator.png' |
4 | Binary files resources/running_indicator.png 2010-11-02 23:27:40 +0000 and resources/running_indicator.png 2010-12-04 21:47:02 +0000 differ |
5 | === modified file 'src/BamfLauncherIcon.cpp' |
6 | --- src/BamfLauncherIcon.cpp 2010-12-03 00:01:41 +0000 |
7 | +++ src/BamfLauncherIcon.cpp 2010-12-04 21:47:02 +0000 |
8 | @@ -129,64 +129,124 @@ |
9 | } |
10 | |
11 | void |
12 | +BamfLauncherIcon::Focus () |
13 | +{ |
14 | + GList *children, *l; |
15 | + BamfView *view; |
16 | + |
17 | + children = bamf_view_get_children (BAMF_VIEW (m_App)); |
18 | + |
19 | + CompWindowList windows; |
20 | + |
21 | + /* get the list of windows */ |
22 | + for (l = children; l; l = l->next) |
23 | + { |
24 | + view = (BamfView *) l->data; |
25 | + |
26 | + if (BAMF_IS_WINDOW (view)) |
27 | + { |
28 | + guint32 xid = bamf_window_get_xid (BAMF_WINDOW (view)); |
29 | + |
30 | + CompWindow *window = m_Screen->findWindow ((Window) xid); |
31 | + |
32 | + if (window) |
33 | + windows.push_back (window); |
34 | + } |
35 | + } |
36 | + |
37 | + if (windows.empty ()) |
38 | + return; |
39 | + |
40 | + /* sort the list */ |
41 | + CompWindowList tmp; |
42 | + CompWindowList::iterator it; |
43 | + for (it = m_Screen->windows ().begin (); it != m_Screen->windows ().end (); it++) |
44 | + { |
45 | + if (std::find (windows.begin (), windows.end (), *it) != windows.end ()) |
46 | + tmp.push_back (*it); |
47 | + } |
48 | + windows = tmp; |
49 | + |
50 | + |
51 | + /* filter based on workspace */ |
52 | + bool any_on_current = false; |
53 | + |
54 | + for (it = windows.begin (); it != windows.end (); it++) |
55 | + { |
56 | + if ((*it)->defaultViewport () == m_Screen->vp ()) |
57 | + { |
58 | + any_on_current = true; |
59 | + break; |
60 | + } |
61 | + } |
62 | + |
63 | + /* activate our windows */ |
64 | + |
65 | + if (any_on_current) |
66 | + { |
67 | + for (it = windows.begin (); it != windows.end (); it++) |
68 | + { |
69 | + if ((*it)->defaultViewport () == m_Screen->vp ()) |
70 | + { |
71 | + (*it)->activate (); |
72 | + } |
73 | + } |
74 | + } |
75 | + else |
76 | + { |
77 | + (*(windows.rbegin ()))->activate (); |
78 | + } |
79 | + |
80 | + g_list_free (children); |
81 | +} |
82 | + |
83 | +void |
84 | +BamfLauncherIcon::Spread () |
85 | +{ |
86 | + BamfView *view; |
87 | + GList *children, *l; |
88 | + children = bamf_view_get_children (BAMF_VIEW (m_App)); |
89 | + |
90 | + std::list<Window> windowList; |
91 | + for (l = children; l; l = l->next) |
92 | + { |
93 | + view = (BamfView *) l->data; |
94 | + |
95 | + if (BAMF_IS_WINDOW (view)) |
96 | + { |
97 | + guint32 xid = bamf_window_get_xid (BAMF_WINDOW (view)); |
98 | + |
99 | + windowList.push_back ((Window) xid); |
100 | + } |
101 | + } |
102 | + |
103 | + if (windowList.size () > 1) |
104 | + { |
105 | + std::string *match = PluginAdapter::Default ()->MatchStringForXids (&windowList); |
106 | + PluginAdapter::Default ()->InitiateScale (match); |
107 | + delete match; |
108 | + } |
109 | + |
110 | + g_list_free (children); |
111 | +} |
112 | + |
113 | +void |
114 | BamfLauncherIcon::OnMouseClick (int button) |
115 | { |
116 | if (button != 1) |
117 | return; |
118 | |
119 | - BamfView *view; |
120 | - GList *children, *l; |
121 | bool active, running; |
122 | |
123 | - children = bamf_view_get_children (BAMF_VIEW (m_App)); |
124 | active = bamf_view_is_active (BAMF_VIEW (m_App)); |
125 | running = bamf_view_is_running (BAMF_VIEW (m_App)); |
126 | |
127 | if (!running) |
128 | - { |
129 | OpenInstance (); |
130 | - return; |
131 | - } |
132 | - |
133 | - if (active) |
134 | - { |
135 | - std::list<Window> windowList; |
136 | - for (l = children; l; l = l->next) |
137 | - { |
138 | - view = (BamfView *) l->data; |
139 | - |
140 | - if (BAMF_IS_WINDOW (view)) |
141 | - { |
142 | - guint32 xid = bamf_window_get_xid (BAMF_WINDOW (view)); |
143 | - |
144 | - windowList.push_back ((Window) xid); |
145 | - } |
146 | - } |
147 | - |
148 | - if (windowList.size () > 1) |
149 | - { |
150 | - std::string *match = PluginAdapter::Default ()->MatchStringForXids (&windowList); |
151 | - PluginAdapter::Default ()->InitiateScale (match); |
152 | - delete match; |
153 | - } |
154 | - } |
155 | + else if (active) |
156 | + Spread (); |
157 | else |
158 | - { |
159 | - for (l = children; l; l = l->next) |
160 | - { |
161 | - view = (BamfView *) l->data; |
162 | - |
163 | - if (BAMF_IS_WINDOW (view)) |
164 | - { |
165 | - guint32 xid = bamf_window_get_xid (BAMF_WINDOW (view)); |
166 | - |
167 | - CompWindow *window = m_Screen->findWindow ((Window) xid); |
168 | - |
169 | - if (window) |
170 | - window->activate (); |
171 | - } |
172 | - } |
173 | - } |
174 | + Focus (); |
175 | } |
176 | |
177 | void |
178 | @@ -248,6 +308,8 @@ |
179 | } |
180 | |
181 | SetRelatedWindows (count); |
182 | + |
183 | + g_list_free (children); |
184 | } |
185 | |
186 | void |
187 | @@ -287,6 +349,8 @@ |
188 | DbusmenuClient *client = dbusmenu_client_new (bamf_indicator_get_remote_address (indicator), path.c_str ()); |
189 | _menu_clients[path] = client; |
190 | } |
191 | + |
192 | + g_list_free (children); |
193 | } |
194 | |
195 | void |
196 | @@ -316,6 +380,8 @@ |
197 | window->close (self->m_Screen->getCurrentTime ()); |
198 | } |
199 | } |
200 | + |
201 | + g_list_free (children); |
202 | } |
203 | |
204 | void |
205 | @@ -461,6 +527,8 @@ |
206 | (unsigned char *) data, 4); |
207 | } |
208 | } |
209 | + |
210 | + g_list_free (children); |
211 | } |
212 | |
213 | void |
214 | |
215 | === modified file 'src/BamfLauncherIcon.h' |
216 | --- src/BamfLauncherIcon.h 2010-12-02 16:01:38 +0000 |
217 | +++ src/BamfLauncherIcon.h 2010-12-04 21:47:02 +0000 |
218 | @@ -61,6 +61,8 @@ |
219 | void UpdateMenus (); |
220 | |
221 | void OpenInstance (); |
222 | + void Focus (); |
223 | + void Spread (); |
224 | |
225 | void EnsureMenuItemsReady (); |
226 | |
227 | |
228 | === modified file 'src/Launcher.cpp' |
229 | --- src/Launcher.cpp 2010-12-03 16:27:48 +0000 |
230 | +++ src/Launcher.cpp 2010-12-04 21:47:02 +0000 |
231 | @@ -49,7 +49,7 @@ |
232 | #define BACKLIGHT_STRENGTH 0.9f |
233 | |
234 | int |
235 | -TimeDelta (struct timespec *x, struct timespec *y) |
236 | +TimeDelta (struct timespec const *x, struct timespec const *y) |
237 | { |
238 | return ((x->tv_sec - y->tv_sec) * 1000) + ((x->tv_nsec - y->tv_nsec) / 1000000); |
239 | } |
240 | @@ -279,9 +279,12 @@ |
241 | void |
242 | Launcher::AddProperties (GVariantBuilder *builder) |
243 | { |
244 | - g_variant_builder_add (builder, "{sv}", "hover-progress", g_variant_new_double ((double) GetHoverProgress ())); |
245 | - g_variant_builder_add (builder, "{sv}", "dnd-exit-progress", g_variant_new_double ((double) DnDExitProgress ())); |
246 | - g_variant_builder_add (builder, "{sv}", "autohide-progress", g_variant_new_double ((double) AutohideProgress ())); |
247 | + struct timespec current; |
248 | + clock_gettime (CLOCK_MONOTONIC, ¤t); |
249 | + |
250 | + g_variant_builder_add (builder, "{sv}", "hover-progress", g_variant_new_double ((double) GetHoverProgress (current))); |
251 | + g_variant_builder_add (builder, "{sv}", "dnd-exit-progress", g_variant_new_double ((double) DnDExitProgress (current))); |
252 | + g_variant_builder_add (builder, "{sv}", "autohide-progress", g_variant_new_double ((double) AutohideProgress (current))); |
253 | |
254 | g_variant_builder_add (builder, "{sv}", "dnd-delta", g_variant_new_int32 (_dnd_delta)); |
255 | g_variant_builder_add (builder, "{sv}", "floating", g_variant_new_boolean (_floating)); |
256 | @@ -294,33 +297,24 @@ |
257 | |
258 | /* Render Layout Logic */ |
259 | |
260 | -float Launcher::GetHoverProgress () |
261 | +float Launcher::GetHoverProgress (struct timespec const ¤t) |
262 | { |
263 | - struct timespec current; |
264 | - clock_gettime (CLOCK_MONOTONIC, ¤t); |
265 | - |
266 | if (_hovered) |
267 | return CLAMP ((float) (TimeDelta (¤t, &_enter_time)) / (float) ANIM_DURATION, 0.0f, 1.0f); |
268 | else |
269 | return 1.0f - CLAMP ((float) (TimeDelta (¤t, &_exit_time)) / (float) ANIM_DURATION, 0.0f, 1.0f); |
270 | } |
271 | |
272 | -float Launcher::DnDExitProgress () |
273 | +float Launcher::DnDExitProgress (struct timespec const ¤t) |
274 | { |
275 | - struct timespec current; |
276 | - clock_gettime (CLOCK_MONOTONIC, ¤t); |
277 | - |
278 | return 1.0f - CLAMP ((float) (TimeDelta (¤t, &_drag_end_time)) / (float) ANIM_DURATION_LONG, 0.0f, 1.0f); |
279 | } |
280 | |
281 | -float Launcher::AutohideProgress () |
282 | +float Launcher::AutohideProgress (struct timespec const ¤t) |
283 | { |
284 | if (!_autohide) |
285 | return 0.0f; |
286 | |
287 | - struct timespec current; |
288 | - clock_gettime (CLOCK_MONOTONIC, ¤t); |
289 | - |
290 | if (_hidden) |
291 | return CLAMP ((float) (TimeDelta (¤t, &_autohide_time)) / (float) ANIM_DURATION_SHORT, 0.0f, 1.0f); |
292 | else |
293 | @@ -352,7 +346,7 @@ |
294 | _anim_handle = g_timeout_add (1000 / 60 - 1, &Launcher::AnimationTimeout, this); |
295 | } |
296 | |
297 | -bool Launcher::IconNeedsAnimation (LauncherIcon *icon, struct timespec current) |
298 | +bool Launcher::IconNeedsAnimation (LauncherIcon *icon, struct timespec const ¤t) |
299 | { |
300 | struct timespec time = icon->GetQuirkTime (LAUNCHER_ICON_QUIRK_VISIBLE); |
301 | if (TimeDelta (¤t, &time) < ANIM_DURATION_SHORT) |
302 | @@ -442,7 +436,7 @@ |
303 | timer->tv_nsec = current.tv_nsec; |
304 | } |
305 | |
306 | -float IconVisibleProgress (LauncherIcon *icon, struct timespec current) |
307 | +float IconVisibleProgress (LauncherIcon *icon, struct timespec const ¤t) |
308 | { |
309 | if (icon->GetQuirk (LAUNCHER_ICON_QUIRK_VISIBLE)) |
310 | { |
311 | @@ -458,7 +452,7 @@ |
312 | } |
313 | } |
314 | |
315 | -void Launcher::SetDndDelta (float x, float y, nux::Geometry geo, struct timespec current) |
316 | +void Launcher::SetDndDelta (float x, float y, nux::Geometry geo, struct timespec const ¤t) |
317 | { |
318 | LauncherIcon *anchor = 0; |
319 | LauncherModel::iterator it; |
320 | @@ -484,7 +478,7 @@ |
321 | } |
322 | } |
323 | |
324 | -float Launcher::IconPresentProgress (LauncherIcon *icon, struct timespec current) |
325 | +float Launcher::IconPresentProgress (LauncherIcon *icon, struct timespec const ¤t) |
326 | { |
327 | struct timespec icon_present_time = icon->GetQuirkTime (LAUNCHER_ICON_QUIRK_PRESENTED); |
328 | int ms = TimeDelta (¤t, &icon_present_time); |
329 | @@ -496,7 +490,7 @@ |
330 | return 1.0f - result; |
331 | } |
332 | |
333 | -float Launcher::IconUrgentProgress (LauncherIcon *icon, struct timespec current) |
334 | +float Launcher::IconUrgentProgress (LauncherIcon *icon, struct timespec const ¤t) |
335 | { |
336 | struct timespec urgent_time = icon->GetQuirkTime (LAUNCHER_ICON_QUIRK_URGENT); |
337 | int urgent_ms = TimeDelta (¤t, &urgent_time); |
338 | @@ -508,14 +502,14 @@ |
339 | return 1.0f - result; |
340 | } |
341 | |
342 | -float Launcher::IconShimmerProgress (LauncherIcon *icon, struct timespec current) |
343 | +float Launcher::IconShimmerProgress (LauncherIcon *icon, struct timespec const ¤t) |
344 | { |
345 | struct timespec shimmer_time = icon->GetQuirkTime (LAUNCHER_ICON_QUIRK_SHIMMER); |
346 | int shimmer_ms = TimeDelta (¤t, &shimmer_time); |
347 | return CLAMP ((float) shimmer_ms / (float) ANIM_DURATION_LONG, 0.0f, 1.0f); |
348 | } |
349 | |
350 | -float Launcher::IconUrgentPulseValue (LauncherIcon *icon, struct timespec current) |
351 | +float Launcher::IconUrgentPulseValue (LauncherIcon *icon, struct timespec const ¤t) |
352 | { |
353 | if (!icon->GetQuirk (LAUNCHER_ICON_QUIRK_URGENT)) |
354 | return 1.0f; // we are full on in a normal condition |
355 | @@ -524,7 +518,7 @@ |
356 | return 0.5f + (float) (std::cos (M_PI * (float) (URGENT_BLINKS * 2) * urgent_progress)) * 0.5f; |
357 | } |
358 | |
359 | -float Launcher::IconStartingPulseValue (LauncherIcon *icon, struct timespec current) |
360 | +float Launcher::IconStartingPulseValue (LauncherIcon *icon, struct timespec const ¤t) |
361 | { |
362 | struct timespec starting_time = icon->GetQuirkTime (LAUNCHER_ICON_QUIRK_STARTING); |
363 | int starting_ms = TimeDelta (¤t, &starting_time); |
364 | @@ -533,7 +527,7 @@ |
365 | return 1.0f - (0.5f + (float) (std::cos (M_PI * (float) (MAX_STARTING_BLINKS * 2) * starting_progress)) * 0.5f); |
366 | } |
367 | |
368 | -float Launcher::IconBackgroundIntensity (LauncherIcon *icon, struct timespec current) |
369 | +float Launcher::IconBackgroundIntensity (LauncherIcon *icon, struct timespec const ¤t) |
370 | { |
371 | float result = 0.0f; |
372 | struct timespec running_time = icon->GetQuirkTime (LAUNCHER_ICON_QUIRK_RUNNING); |
373 | @@ -564,20 +558,23 @@ |
374 | return result; |
375 | } |
376 | |
377 | -void Launcher::SetupRenderArg (LauncherIcon *icon, struct timespec current, RenderArg &arg) |
378 | +void Launcher::SetupRenderArg (LauncherIcon *icon, struct timespec const ¤t, RenderArg &arg) |
379 | { |
380 | - arg.icon = icon; |
381 | - arg.alpha = 1.0f; |
382 | - arg.running_arrow = false; |
383 | - arg.active_arrow = icon->GetQuirk (LAUNCHER_ICON_QUIRK_ACTIVE); |
384 | - arg.folding_rads = 0.0f; |
385 | - arg.skip = false; |
386 | + arg.icon = icon; |
387 | + arg.alpha = 1.0f; |
388 | + arg.running_arrow = icon->GetQuirk (LAUNCHER_ICON_QUIRK_RUNNING); |
389 | + arg.active_arrow = icon->GetQuirk (LAUNCHER_ICON_QUIRK_ACTIVE); |
390 | + arg.running_colored = icon->GetQuirk (LAUNCHER_ICON_QUIRK_URGENT); |
391 | + arg.active_colored = false; |
392 | + arg.folding_rads = 0.0f; |
393 | + arg.skip = false; |
394 | |
395 | - arg.window_indicators = MIN (4, icon->RelatedWindows ()); |
396 | |
397 | // we dont need to show strays |
398 | - if (arg.window_indicators == 1 || !icon->GetQuirk (LAUNCHER_ICON_QUIRK_RUNNING)) |
399 | + if (!icon->GetQuirk (LAUNCHER_ICON_QUIRK_RUNNING)) |
400 | arg.window_indicators = 0; |
401 | + else |
402 | + arg.window_indicators = MIN (4, icon->RelatedWindows ()); |
403 | |
404 | arg.backlight_intensity = IconBackgroundIntensity (icon, current); |
405 | arg.shimmer_progress = IconShimmerProgress (icon, current); |
406 | @@ -597,18 +594,18 @@ |
407 | } |
408 | |
409 | void Launcher::RenderArgs (std::list<Launcher::RenderArg> &launcher_args, |
410 | - std::list<Launcher::RenderArg> &shelf_args, |
411 | - nux::Geometry &box_geo, nux::Geometry &shelf_geo) |
412 | + nux::Geometry &box_geo) |
413 | { |
414 | nux::Geometry geo = GetGeometry (); |
415 | LauncherModel::iterator it; |
416 | nux::Point3 center; |
417 | - float hover_progress = GetHoverProgress (); |
418 | + struct timespec current; |
419 | + clock_gettime (CLOCK_MONOTONIC, ¤t); |
420 | + |
421 | + float hover_progress = GetHoverProgress (current); |
422 | float folded_z_distance = _folded_z_distance * (1.0f - hover_progress); |
423 | float animation_neg_rads = _neg_folded_angle * (1.0f - hover_progress); |
424 | int vertical_offset = _parent->GetGeometry ().y; |
425 | - struct timespec current; |
426 | - clock_gettime (CLOCK_MONOTONIC, ¤t); |
427 | |
428 | float folding_constant = 0.25f; |
429 | float folding_not_constant = folding_constant + ((1.0f - folding_constant) * hover_progress); |
430 | @@ -620,19 +617,7 @@ |
431 | center.y = _space_between_icons; |
432 | center.z = 0; |
433 | |
434 | - // compute required height of shelf |
435 | - float shelf_sum = 0.0f; |
436 | - for (it = _model->shelf_begin (); it != _model->shelf_end (); it++) |
437 | - { |
438 | - float height = (_icon_size + _space_between_icons) * IconVisibleProgress (*it, current); |
439 | - shelf_sum += height; |
440 | - } |
441 | - |
442 | - // add bottom padding |
443 | - if (shelf_sum > 0.0f) |
444 | - shelf_sum += _space_between_icons; |
445 | - |
446 | - int launcher_height = geo.height - shelf_sum; |
447 | + int launcher_height = geo.height; |
448 | |
449 | // compute required height of launcher AND folding threshold |
450 | float sum = 0.0f + center.y; |
451 | @@ -648,10 +633,10 @@ |
452 | float present_progress = IconPresentProgress (*it, current); |
453 | folding_threshold -= CLAMP (sum - launcher_height, 0.0f, height * magic_constant) * (folding_constant + (1.0f - folding_constant) * present_progress); |
454 | } |
455 | - |
456 | + |
457 | // this happens on hover, basically its a flag and a value in one, we translate this into a dnd offset |
458 | if (_enter_y != 0 && _enter_y + _icon_size / 2 > folding_threshold) |
459 | - SetDndDelta (center.x, center.y, nux::Geometry (geo.x, geo.y, geo.width, geo.height - shelf_sum), current); |
460 | + SetDndDelta (center.x, center.y, nux::Geometry (geo.x, geo.y, geo.width, geo.height), current); |
461 | |
462 | _enter_y = 0; |
463 | |
464 | @@ -671,7 +656,7 @@ |
465 | |
466 | if (_launcher_action_state != ACTION_DRAG_LAUNCHER) |
467 | { |
468 | - float dnd_progress = DnDExitProgress (); |
469 | + float dnd_progress = DnDExitProgress (current); |
470 | |
471 | if (_dnd_delta > max) |
472 | delta_y = max + (delta_y - max) * dnd_progress; |
473 | @@ -690,7 +675,7 @@ |
474 | _dnd_delta = 0; |
475 | } |
476 | |
477 | - float autohide_progress = AutohideProgress (); |
478 | + float autohide_progress = AutohideProgress (current); |
479 | float autohide_offset = 0.0f; |
480 | if (_autohide && autohide_progress > 0.0f) |
481 | { |
482 | @@ -700,108 +685,136 @@ |
483 | // Inform the painter where to paint the box |
484 | box_geo = geo; |
485 | |
486 | - if (_floating) |
487 | - box_geo.height = sum + shelf_sum + _space_between_icons; |
488 | - |
489 | if (_autohide) |
490 | box_geo.x += autohide_offset; |
491 | |
492 | - shelf_geo = nux::Geometry (box_geo.x, box_geo.height - shelf_sum, box_geo.width, shelf_sum); |
493 | - |
494 | // The functional position we wish to represent for these icons is not smooth. Rather than introducing |
495 | // special casing to represent this, we use MIN/MAX functions. This helps ensure that even though our |
496 | // function is not smooth it is continuous, which is more important for our visual representation (icons |
497 | // wont start jumping around). As a general rule ANY if () statements that modify center.y should be seen |
498 | // as bugs. |
499 | - for (it = _model->begin (); it != _model->end (); it++) |
500 | - { |
501 | - RenderArg arg; |
502 | - LauncherIcon *icon = *it; |
503 | - |
504 | - SetupRenderArg (icon, current, arg); |
505 | - |
506 | - // reset z |
507 | - center.z = 0; |
508 | - |
509 | - float size_modifier = IconVisibleProgress (icon, current); |
510 | - if (size_modifier < 1.0f) |
511 | - { |
512 | - arg.alpha = size_modifier; |
513 | - center.z = 300.0f * (1.0f - size_modifier); |
514 | - } |
515 | - |
516 | - if (size_modifier <= 0.0f) |
517 | - { |
518 | - arg.skip = true; |
519 | - continue; |
520 | - } |
521 | - |
522 | - // goes for 0.0f when fully unfolded, to 1.0f folded |
523 | - float folding_progress = CLAMP ((center.y + _icon_size - folding_threshold) / (float) _icon_size, 0.0f, 1.0f); |
524 | - float present_progress = IconPresentProgress (icon, current); |
525 | - |
526 | - folding_progress *= 1.0f - present_progress; |
527 | - |
528 | - float half_size = (folded_size / 2.0f) + (_icon_size / 2.0f - folded_size / 2.0f) * (1.0f - folding_progress); |
529 | - |
530 | - float icon_hide_offset = autohide_offset; |
531 | - |
532 | - if (icon->PresentUrgency () == 1) |
533 | - icon_hide_offset *= 0.5f + 0.5f * (1.0f - present_progress); |
534 | - else if (icon->PresentUrgency () >= 2) |
535 | - icon_hide_offset *= 1.0f - present_progress; |
536 | - |
537 | - // icon is crossing threshold, start folding |
538 | - center.z += folded_z_distance * folding_progress; |
539 | - arg.folding_rads = animation_neg_rads * folding_progress; |
540 | - |
541 | - center.y += half_size * size_modifier; // move to center |
542 | - arg.center = nux::Point3 (center.x + icon_hide_offset, center.y, center.z); // copy center |
543 | - icon->SetCenter (nux::Point3 (center.x, center.y + vertical_offset, center.z)); |
544 | - center.y += half_size * size_modifier; // move to end |
545 | - |
546 | - float spacing_overlap = CLAMP ((float) (center.y + (_space_between_icons * size_modifier) - folding_threshold) / (float) _icon_size, 0.0f, 1.0f); |
547 | - //add spacing |
548 | - center.y += (_space_between_icons * (1.0f - spacing_overlap) + folded_spacing * spacing_overlap) * size_modifier; |
549 | - |
550 | - launcher_args.push_back (arg); |
551 | - } |
552 | - |
553 | - center.y = (box_geo.y + box_geo.height) - shelf_sum + _space_between_icons; |
554 | - |
555 | - // Place shelf icons |
556 | - for (it = _model->shelf_begin (); it != _model->shelf_end (); it++) |
557 | - { |
558 | - RenderArg arg; |
559 | - LauncherIcon *icon = *it; |
560 | - |
561 | - SetupRenderArg (icon, current, arg); |
562 | - |
563 | - // reset z |
564 | - center.z = 0; |
565 | - |
566 | - float size_modifier = IconVisibleProgress (icon, current); |
567 | - if (size_modifier < 1.0f) |
568 | - { |
569 | - arg.alpha = size_modifier; |
570 | - center.z = 300.0f * (1.0f - size_modifier); |
571 | - } |
572 | - |
573 | - if (size_modifier <= 0.0f) |
574 | - { |
575 | - arg.skip = true; |
576 | - continue; |
577 | - } |
578 | - |
579 | - float half_size = _icon_size / 2.0f; |
580 | - |
581 | - center.y += half_size * size_modifier; // move to center |
582 | - arg.center = nux::Point3 (center.x + autohide_offset, center.y, center.z); // copy center |
583 | - icon->SetCenter (nux::Point3 (center.x, center.y + vertical_offset, center.z)); |
584 | - center.y += half_size * size_modifier; // move to end |
585 | - center.y += _space_between_icons * size_modifier; |
586 | - |
587 | - shelf_args.push_back (arg); |
588 | + for (it = _model->main_begin (); it != _model->main_end (); it++) |
589 | + { |
590 | + RenderArg arg; |
591 | + LauncherIcon *icon = *it; |
592 | + |
593 | + SetupRenderArg (icon, current, arg); |
594 | + |
595 | + // reset z |
596 | + center.z = 0; |
597 | + |
598 | + float size_modifier = IconVisibleProgress (icon, current); |
599 | + if (size_modifier < 1.0f) |
600 | + { |
601 | + arg.alpha = size_modifier; |
602 | + center.z = 300.0f * (1.0f - size_modifier); |
603 | + } |
604 | + |
605 | + if (size_modifier <= 0.0f) |
606 | + { |
607 | + arg.skip = true; |
608 | + continue; |
609 | + } |
610 | + |
611 | + // goes for 0.0f when fully unfolded, to 1.0f folded |
612 | + float folding_progress = CLAMP ((center.y + _icon_size - folding_threshold) / (float) _icon_size, 0.0f, 1.0f); |
613 | + float present_progress = IconPresentProgress (icon, current); |
614 | + |
615 | + folding_progress *= 1.0f - present_progress; |
616 | + |
617 | + float half_size = (folded_size / 2.0f) + (_icon_size / 2.0f - folded_size / 2.0f) * (1.0f - folding_progress); |
618 | + |
619 | + float icon_hide_offset = autohide_offset; |
620 | + |
621 | + if (icon->PresentUrgency () == 1) |
622 | + icon_hide_offset *= 0.5f + 0.5f * (1.0f - present_progress); |
623 | + else if (icon->PresentUrgency () >= 2) |
624 | + icon_hide_offset *= 1.0f - present_progress; |
625 | + |
626 | + // icon is crossing threshold, start folding |
627 | + center.z += folded_z_distance * folding_progress; |
628 | + arg.folding_rads = animation_neg_rads * folding_progress; |
629 | + |
630 | + center.y += half_size * size_modifier; // move to center |
631 | + arg.center = nux::Point3 (center.x + icon_hide_offset, center.y, center.z); // copy center |
632 | + icon->SetCenter (nux::Point3 (center.x, center.y + vertical_offset, center.z)); |
633 | + center.y += half_size * size_modifier; // move to end |
634 | + |
635 | + float spacing_overlap = CLAMP ((float) (center.y + (_space_between_icons * size_modifier) - folding_threshold) / (float) _icon_size, 0.0f, 1.0f); |
636 | + //add spacing |
637 | + center.y += (_space_between_icons * (1.0f - spacing_overlap) + folded_spacing * spacing_overlap) * size_modifier; |
638 | + |
639 | + launcher_args.push_back (arg); |
640 | + } |
641 | + |
642 | + // compute maximum height of shelf |
643 | + float shelf_sum = 0.0f; |
644 | + for (it = _model->shelf_begin (); it != _model->shelf_end (); it++) |
645 | + { |
646 | + float height = (_icon_size + _space_between_icons) * IconVisibleProgress (*it, current); |
647 | + shelf_sum += height; |
648 | + } |
649 | + |
650 | + // add bottom padding |
651 | + if (shelf_sum > 0.0f) |
652 | + shelf_sum += _space_between_icons; |
653 | + |
654 | + float shelf_delta = MAX (((launcher_height - shelf_sum) + _space_between_icons) - center.y, 0.0f); |
655 | + folding_threshold += shelf_delta; |
656 | + center.y += shelf_delta; |
657 | + |
658 | + for (it = _model->shelf_begin (); it != _model->shelf_end (); it++) |
659 | + { |
660 | + RenderArg arg; |
661 | + LauncherIcon *icon = *it; |
662 | + |
663 | + SetupRenderArg (icon, current, arg); |
664 | + |
665 | + // reset z |
666 | + center.z = 0; |
667 | + |
668 | + float size_modifier = IconVisibleProgress (icon, current); |
669 | + if (size_modifier < 1.0f) |
670 | + { |
671 | + arg.alpha = size_modifier; |
672 | + center.z = 300.0f * (1.0f - size_modifier); |
673 | + } |
674 | + |
675 | + if (size_modifier <= 0.0f) |
676 | + { |
677 | + arg.skip = true; |
678 | + continue; |
679 | + } |
680 | + |
681 | + // goes for 0.0f when fully unfolded, to 1.0f folded |
682 | + float folding_progress = CLAMP ((center.y + _icon_size - folding_threshold) / (float) _icon_size, 0.0f, 1.0f); |
683 | + float present_progress = IconPresentProgress (icon, current); |
684 | + |
685 | + folding_progress *= 1.0f - present_progress; |
686 | + |
687 | + float half_size = (folded_size / 2.0f) + (_icon_size / 2.0f - folded_size / 2.0f) * (1.0f - folding_progress); |
688 | + |
689 | + float icon_hide_offset = autohide_offset; |
690 | + |
691 | + if (icon->PresentUrgency () == 1) |
692 | + icon_hide_offset *= 0.5f + 0.5f * (1.0f - present_progress); |
693 | + else if (icon->PresentUrgency () >= 2) |
694 | + icon_hide_offset *= 1.0f - present_progress; |
695 | + |
696 | + // icon is crossing threshold, start folding |
697 | + center.z += folded_z_distance * folding_progress; |
698 | + arg.folding_rads = animation_neg_rads * folding_progress; |
699 | + |
700 | + center.y += half_size * size_modifier; // move to center |
701 | + arg.center = nux::Point3 (center.x + icon_hide_offset, center.y, center.z); // copy center |
702 | + icon->SetCenter (nux::Point3 (center.x, center.y + vertical_offset, center.z)); |
703 | + center.y += half_size * size_modifier; // move to end |
704 | + |
705 | + float spacing_overlap = CLAMP ((float) (center.y + (_space_between_icons * size_modifier) - folding_threshold) / (float) _icon_size, 0.0f, 1.0f); |
706 | + //add spacing |
707 | + center.y += (_space_between_icons * (1.0f - spacing_overlap) + folded_spacing * spacing_overlap) * size_modifier; |
708 | + |
709 | + launcher_args.push_back (arg); |
710 | } |
711 | } |
712 | |
713 | @@ -909,9 +922,6 @@ |
714 | |
715 | _enter_y = (int) _mouse_position.y; |
716 | |
717 | - if (_last_shelf_area.y - _enter_y < 5 && _last_shelf_area.y - _enter_y >= 0) |
718 | - _enter_y = _last_shelf_area.y - 5; |
719 | - |
720 | _hovered = true; |
721 | SetTimeStruct (&_enter_time, &_exit_time, ANIM_DURATION); |
722 | } |
723 | @@ -969,7 +979,7 @@ |
724 | |
725 | void Launcher::OnOrderChanged () |
726 | { |
727 | - |
728 | + EnsureAnimation (); |
729 | } |
730 | |
731 | void Launcher::SetModel (LauncherModel *model) |
732 | @@ -997,14 +1007,88 @@ |
733 | |
734 | } |
735 | |
736 | +void Launcher::RenderIndicators (nux::GraphicsEngine& GfxContext, |
737 | + RenderArg arg, |
738 | + int running, |
739 | + int active, |
740 | + nux::Geometry geo) |
741 | +{ |
742 | + int markerCenter = (int) arg.center.y; |
743 | + |
744 | + if (running > 0) |
745 | + { |
746 | + if (!m_RunningIndicator) |
747 | + { |
748 | + GdkPixbuf *pbuf = gdk_pixbuf_new_from_file (PKGDATADIR"/running_indicator.png", NULL); |
749 | + m_RunningIndicator = nux::CreateTextureFromPixbuf (pbuf); |
750 | + g_object_unref (pbuf); |
751 | + } |
752 | + nux::TexCoordXForm texxform; |
753 | + |
754 | + nux::Color color = nux::Color::White; |
755 | + |
756 | + if (arg.running_colored) |
757 | + color = nux::Color::SkyBlue; |
758 | + |
759 | + std::vector<int> markers; |
760 | + if (running == 1) |
761 | + { |
762 | + markers.push_back (markerCenter); |
763 | + } |
764 | + else if (running == 2) |
765 | + { |
766 | + markers.push_back (markerCenter - 2); |
767 | + markers.push_back (markerCenter + 2); |
768 | + } |
769 | + else |
770 | + { |
771 | + markers.push_back (markerCenter - 4); |
772 | + markers.push_back (markerCenter); |
773 | + markers.push_back (markerCenter + 4); |
774 | + } |
775 | + |
776 | + std::vector<int>::iterator it; |
777 | + for (it = markers.begin (); it != markers.end (); it++) |
778 | + { |
779 | + int center = *it; |
780 | + GfxContext.QRP_GLSL_1Tex (geo.x, |
781 | + center - (m_RunningIndicator->GetHeight () / 2), |
782 | + (float) m_RunningIndicator->GetWidth(), |
783 | + (float) m_RunningIndicator->GetHeight(), |
784 | + m_RunningIndicator->GetDeviceTexture(), |
785 | + texxform, |
786 | + color); |
787 | + } |
788 | + } |
789 | + |
790 | + if (active > 0) |
791 | + { |
792 | + if (!m_ActiveIndicator) |
793 | + { |
794 | + GdkPixbuf *pbuf = gdk_pixbuf_new_from_file (PKGDATADIR"/focused_indicator.png", NULL); |
795 | + m_ActiveIndicator = nux::CreateTextureFromPixbuf (pbuf); |
796 | + g_object_unref (pbuf); |
797 | + } |
798 | + nux::TexCoordXForm texxform; |
799 | + |
800 | + nux::Color color = nux::Color::White; |
801 | + GfxContext.QRP_GLSL_1Tex ((geo.x + geo.width) - m_ActiveIndicator->GetWidth (), |
802 | + markerCenter - (m_ActiveIndicator->GetHeight () / 2), |
803 | + (float) m_ActiveIndicator->GetWidth(), |
804 | + (float) m_ActiveIndicator->GetHeight(), |
805 | + m_ActiveIndicator->GetDeviceTexture(), |
806 | + texxform, |
807 | + color); |
808 | + } |
809 | +} |
810 | + |
811 | void Launcher::RenderIcon(nux::GraphicsEngine& GfxContext, |
812 | RenderArg arg, |
813 | nux::BaseTexture *icon, |
814 | nux::Color bkg_color, |
815 | float alpha, |
816 | nux::Vector4 xform_coords[], |
817 | - nux::Geometry geo, |
818 | - bool render_indicators) |
819 | + nux::Geometry geo) |
820 | { |
821 | nux::Matrix4 ObjectMatrix; |
822 | nux::Matrix4 ViewMatrix; |
823 | @@ -1151,30 +1235,6 @@ |
824 | { |
825 | _AsmShaderProg->End(); |
826 | } |
827 | - |
828 | - int markerCenter = (v1.y + v0.y) / 2; |
829 | - |
830 | - if (arg.running_arrow && render_indicators) |
831 | - { |
832 | - if (!m_RunningIndicator) |
833 | - { |
834 | - GdkPixbuf *pbuf = gdk_pixbuf_new_from_file (PKGDATADIR"/running_indicator.png", NULL); |
835 | - m_RunningIndicator = nux::CreateTextureFromPixbuf (pbuf); |
836 | - g_object_unref (pbuf); |
837 | - } |
838 | - gPainter.Draw2DTexture (GfxContext, m_RunningIndicator, geo.x, markerCenter - (m_ActiveIndicator->GetHeight () / 2)); |
839 | - } |
840 | - |
841 | - if (arg.active_arrow && render_indicators) |
842 | - { |
843 | - if (!m_ActiveIndicator) |
844 | - { |
845 | - GdkPixbuf *pbuf = gdk_pixbuf_new_from_file (PKGDATADIR"/focused_indicator.png", NULL); |
846 | - m_ActiveIndicator = nux::CreateTextureFromPixbuf (pbuf); |
847 | - g_object_unref (pbuf); |
848 | - } |
849 | - gPainter.Draw2DTexture (GfxContext, m_ActiveIndicator, (geo.x + geo.width) - m_ActiveIndicator->GetWidth (), markerCenter - (m_ActiveIndicator->GetHeight () / 2)); |
850 | - } |
851 | } |
852 | |
853 | void Launcher::DrawRenderArg (nux::GraphicsEngine& GfxContext, RenderArg arg, nux::Geometry geo) |
854 | @@ -1195,8 +1255,7 @@ |
855 | nux::Color(0xAAFFFFFF), |
856 | 1.0f - arg.backlight_intensity, |
857 | arg.icon->_xform_coords["Tile"], |
858 | - geo, |
859 | - false); |
860 | + geo); |
861 | } |
862 | |
863 | if (arg.backlight_intensity > 0.0f) |
864 | @@ -1207,8 +1266,7 @@ |
865 | arg.icon->BackgroundColor (), |
866 | arg.backlight_intensity, |
867 | arg.icon->_xform_coords["Tile"], |
868 | - geo, |
869 | - false); |
870 | + geo); |
871 | } |
872 | |
873 | GfxContext.GetRenderStates ().SetSeparateBlend (true, |
874 | @@ -1224,8 +1282,7 @@ |
875 | nux::Color::White, |
876 | arg.alpha, |
877 | arg.icon->_xform_coords["Image"], |
878 | - geo, |
879 | - true); |
880 | + geo); |
881 | |
882 | if (arg.backlight_intensity > 0.0f) |
883 | { |
884 | @@ -1235,42 +1292,41 @@ |
885 | nux::Color::White, |
886 | arg.backlight_intensity, |
887 | arg.icon->_xform_coords["Tile"], |
888 | - geo, |
889 | - false); |
890 | + geo); |
891 | } |
892 | |
893 | - switch (arg.window_indicators) |
894 | + if (false) |
895 | { |
896 | - case 2: |
897 | - RenderIcon(GfxContext, |
898 | - arg, |
899 | - _icon_2indicator, |
900 | - nux::Color::White, |
901 | - 1.0f, |
902 | - arg.icon->_xform_coords["Tile"], |
903 | - geo, |
904 | - false); |
905 | - break; |
906 | - case 3: |
907 | - RenderIcon(GfxContext, |
908 | - arg, |
909 | - _icon_3indicator, |
910 | - nux::Color::White, |
911 | - 1.0f, |
912 | - arg.icon->_xform_coords["Tile"], |
913 | - geo, |
914 | - false); |
915 | - break; |
916 | - case 4: |
917 | - RenderIcon(GfxContext, |
918 | - arg, |
919 | - _icon_4indicator, |
920 | - nux::Color::White, |
921 | - 1.0f, |
922 | - arg.icon->_xform_coords["Tile"], |
923 | - geo, |
924 | - false); |
925 | - break; |
926 | + switch (arg.window_indicators) |
927 | + { |
928 | + case 2: |
929 | + RenderIcon(GfxContext, |
930 | + arg, |
931 | + _icon_2indicator, |
932 | + nux::Color::White, |
933 | + 1.0f, |
934 | + arg.icon->_xform_coords["Tile"], |
935 | + geo); |
936 | + break; |
937 | + case 3: |
938 | + RenderIcon(GfxContext, |
939 | + arg, |
940 | + _icon_3indicator, |
941 | + nux::Color::White, |
942 | + 1.0f, |
943 | + arg.icon->_xform_coords["Tile"], |
944 | + geo); |
945 | + break; |
946 | + case 4: |
947 | + RenderIcon(GfxContext, |
948 | + arg, |
949 | + _icon_4indicator, |
950 | + nux::Color::White, |
951 | + 1.0f, |
952 | + arg.icon->_xform_coords["Tile"], |
953 | + geo); |
954 | + break; |
955 | + } |
956 | } |
957 | |
958 | if (arg.glow_intensity > 0.0f) |
959 | @@ -1281,8 +1337,7 @@ |
960 | arg.icon->GlowColor (), |
961 | arg.glow_intensity, |
962 | arg.icon->_xform_coords["Glow"], |
963 | - geo, |
964 | - false); |
965 | + geo); |
966 | } |
967 | |
968 | if (arg.shimmer_progress > 0.0f && arg.shimmer_progress < 1.0f) |
969 | @@ -1303,11 +1358,16 @@ |
970 | arg.icon->GlowColor (), |
971 | fade_out, |
972 | arg.icon->_xform_coords["Glow"], |
973 | - geo, |
974 | - false); |
975 | + geo); |
976 | |
977 | GfxContext.PopClippingRectangle(); |
978 | } |
979 | + |
980 | + RenderIndicators (GfxContext, |
981 | + arg, |
982 | + arg.running_arrow ? arg.window_indicators : 0, |
983 | + arg.active_arrow ? 1 : 0, |
984 | + geo); |
985 | } |
986 | |
987 | void Launcher::DrawContent(nux::GraphicsEngine& GfxContext, bool force_draw) |
988 | @@ -1315,17 +1375,16 @@ |
989 | nux::Geometry base = GetGeometry(); |
990 | GfxContext.PushClippingRectangle(base); |
991 | nux::Geometry bkg_box; |
992 | - nux::Geometry shelf_box; |
993 | std::list<Launcher::RenderArg> args; |
994 | - std::list<Launcher::RenderArg> shelf_args; |
995 | + std::list<Launcher::RenderArg>::reverse_iterator rev_it; |
996 | + std::list<Launcher::RenderArg>::iterator it; |
997 | |
998 | nux::ROPConfig ROP; |
999 | ROP.Blend = false; |
1000 | ROP.SrcBlend = GL_SRC_ALPHA; |
1001 | ROP.DstBlend = GL_ONE_MINUS_SRC_ALPHA; |
1002 | |
1003 | - RenderArgs (args, shelf_args, bkg_box, shelf_box); |
1004 | - _last_shelf_area = shelf_box; |
1005 | + RenderArgs (args, bkg_box); |
1006 | |
1007 | // clear region |
1008 | gPainter.PushDrawColorLayer(GfxContext, base, nux::Color(0x00000000), true, ROP); |
1009 | @@ -1341,11 +1400,9 @@ |
1010 | gPainter.Paint2DQuadColor (GfxContext, bkg_box, nux::Color(0xAA000000)); |
1011 | |
1012 | UpdateIconXForm (args); |
1013 | - UpdateIconXForm (shelf_args); |
1014 | EventLogic (); |
1015 | - |
1016 | - /* drag launcher */ |
1017 | - std::list<Launcher::RenderArg>::reverse_iterator rev_it; |
1018 | + |
1019 | + /* draw launcher */ |
1020 | for (rev_it = args.rbegin (); rev_it != args.rend (); rev_it++) |
1021 | { |
1022 | if ((*rev_it).folding_rads >= 0.0f || (*rev_it).skip) |
1023 | @@ -1354,7 +1411,6 @@ |
1024 | DrawRenderArg (GfxContext, *rev_it, bkg_box); |
1025 | } |
1026 | |
1027 | - std::list<Launcher::RenderArg>::iterator it; |
1028 | for (it = args.begin(); it != args.end(); it++) |
1029 | { |
1030 | if ((*it).folding_rads < 0.0f || (*it).skip) |
1031 | @@ -1363,22 +1419,6 @@ |
1032 | DrawRenderArg (GfxContext, *it, bkg_box); |
1033 | } |
1034 | |
1035 | - /* draw shelf */ |
1036 | - nux::Color shelf_color = nux::Color (0xCC000000); |
1037 | - nux::Color shelf_zero = nux::Color (0x00000000); |
1038 | - int shelf_shadow_height = 35; |
1039 | - |
1040 | - nux::Geometry shelf_shadow = nux::Geometry (shelf_box.x, shelf_box.y - shelf_shadow_height, shelf_box.width, shelf_shadow_height); |
1041 | - gPainter.Paint2DQuadColor (GfxContext, shelf_shadow, shelf_zero, shelf_color, shelf_color, shelf_zero); |
1042 | - gPainter.Paint2DQuadColor (GfxContext, shelf_box, shelf_color); |
1043 | - |
1044 | - for (it = shelf_args.begin(); it != shelf_args.end(); it++) |
1045 | - { |
1046 | - if ((*it).skip) |
1047 | - continue; |
1048 | - |
1049 | - DrawRenderArg (GfxContext, *it, bkg_box); |
1050 | - } |
1051 | |
1052 | gPainter.Paint2DQuadColor (GfxContext, nux::Geometry (bkg_box.x + bkg_box.width - 1, bkg_box.y, 1, bkg_box.height), nux::Color(0x60FFFFFF)); |
1053 | |
1054 | @@ -1487,8 +1527,7 @@ |
1055 | _mouse_position = nux::Point2 (x, y); |
1056 | _mouse_inside_launcher = true; |
1057 | |
1058 | - if (!_last_shelf_area.IsInside (nux::Point (x, y))) |
1059 | - SetHover (); |
1060 | + SetHover (); |
1061 | |
1062 | EventLogic (); |
1063 | EnsureAnimation (); |
1064 | @@ -1510,13 +1549,7 @@ |
1065 | { |
1066 | _mouse_position = nux::Point2 (x, y); |
1067 | |
1068 | - if (!_last_shelf_area.IsInside (nux::Point (x, y))) |
1069 | - { |
1070 | - SetHover (); |
1071 | - EnsureAnimation (); |
1072 | - } |
1073 | // Every time the mouse moves, we check if it is inside an icon... |
1074 | - |
1075 | EventLogic (); |
1076 | } |
1077 | |
1078 | @@ -1595,22 +1628,6 @@ |
1079 | nux::Point2 mouse_position(x, y); |
1080 | int inside = 0; |
1081 | |
1082 | - for (it = _model->shelf_begin(); it != _model->shelf_end (); it++) |
1083 | - { |
1084 | - if (!(*it)->GetQuirk (LAUNCHER_ICON_QUIRK_VISIBLE)) |
1085 | - continue; |
1086 | - |
1087 | - nux::Point2 screen_coord [4]; |
1088 | - for (int i = 0; i < 4; i++) |
1089 | - { |
1090 | - screen_coord [i].x = (*it)->_xform_coords["HitArea"] [i].x; |
1091 | - screen_coord [i].y = (*it)->_xform_coords["HitArea"] [i].y; |
1092 | - } |
1093 | - inside = PointInside2DPolygon (screen_coord, 4, mouse_position, 1); |
1094 | - if (inside) |
1095 | - return (*it); |
1096 | - } |
1097 | - |
1098 | // Because of the way icons fold and stack on one another, we must proceed in 2 steps. |
1099 | for (rev_it = _model->rbegin (); rev_it != _model->rend (); rev_it++) |
1100 | { |
1101 | |
1102 | === modified file 'src/Launcher.h' |
1103 | --- src/Launcher.h 2010-12-02 15:56:08 +0000 |
1104 | +++ src/Launcher.h 2010-12-04 21:47:02 +0000 |
1105 | @@ -103,7 +103,9 @@ |
1106 | float glow_intensity; |
1107 | float shimmer_progress; |
1108 | bool running_arrow; |
1109 | + bool running_colored; |
1110 | bool active_arrow; |
1111 | + bool active_colored; |
1112 | bool skip; |
1113 | int window_indicators; |
1114 | } RenderArg; |
1115 | @@ -115,34 +117,33 @@ |
1116 | void OnTriggerMouseEnter (int x, int y, unsigned long button_flags, unsigned long key_flags); |
1117 | void OnTriggerMouseLeave (int x, int y, unsigned long button_flags, unsigned long key_flags); |
1118 | |
1119 | - bool IconNeedsAnimation (LauncherIcon *icon, struct timespec current); |
1120 | + bool IconNeedsAnimation (LauncherIcon *icon, struct timespec const ¤t); |
1121 | bool AnimationInProgress (); |
1122 | void SetTimeStruct (struct timespec *timer, struct timespec *sister = 0, int sister_relation = 0); |
1123 | |
1124 | void EnsureAnimation (); |
1125 | void SetupAutohideTimer (); |
1126 | |
1127 | - float DnDExitProgress (); |
1128 | - float GetHoverProgress (); |
1129 | - float AutohideProgress (); |
1130 | - float IconPresentProgress (LauncherIcon *icon, struct timespec current); |
1131 | - float IconUrgentProgress (LauncherIcon *icon, struct timespec current); |
1132 | - float IconShimmerProgress (LauncherIcon *icon, struct timespec current); |
1133 | - float IconUrgentPulseValue (LauncherIcon *icon, struct timespec current); |
1134 | - float IconStartingPulseValue (LauncherIcon *icon, struct timespec current); |
1135 | - float IconBackgroundIntensity (LauncherIcon *icon, struct timespec current); |
1136 | + float DnDExitProgress (struct timespec const ¤t); |
1137 | + float GetHoverProgress (struct timespec const ¤t); |
1138 | + float AutohideProgress (struct timespec const ¤t); |
1139 | + float IconPresentProgress (LauncherIcon *icon, struct timespec const ¤t); |
1140 | + float IconUrgentProgress (LauncherIcon *icon, struct timespec const ¤t); |
1141 | + float IconShimmerProgress (LauncherIcon *icon, struct timespec const ¤t); |
1142 | + float IconUrgentPulseValue (LauncherIcon *icon, struct timespec const ¤t); |
1143 | + float IconStartingPulseValue (LauncherIcon *icon, struct timespec const ¤t); |
1144 | + float IconBackgroundIntensity (LauncherIcon *icon, struct timespec const ¤t); |
1145 | |
1146 | void SetHover (); |
1147 | void UnsetHover (); |
1148 | void SetHidden (bool hidden); |
1149 | |
1150 | - void SetDndDelta (float x, float y, nux::Geometry geo, struct timespec current); |
1151 | + void SetDndDelta (float x, float y, nux::Geometry geo, struct timespec const ¤t); |
1152 | int DragLimiter (int x); |
1153 | |
1154 | - void SetupRenderArg (LauncherIcon *icon, struct timespec current, RenderArg &arg); |
1155 | + void SetupRenderArg (LauncherIcon *icon, struct timespec const ¤t, RenderArg &arg); |
1156 | void RenderArgs (std::list<Launcher::RenderArg> &launcher_args, |
1157 | - std::list<Launcher::RenderArg> &shelf_args, |
1158 | - nux::Geometry &box_geo, nux::Geometry &shelf_geo); |
1159 | + nux::Geometry &box_geo); |
1160 | |
1161 | void DrawRenderArg (nux::GraphicsEngine& GfxContext, RenderArg arg, nux::Geometry geo); |
1162 | |
1163 | @@ -152,14 +153,19 @@ |
1164 | |
1165 | void OnIconNeedsRedraw (void *icon); |
1166 | |
1167 | + void RenderIndicators (nux::GraphicsEngine& GfxContext, |
1168 | + RenderArg arg, |
1169 | + int running, |
1170 | + int active, |
1171 | + nux::Geometry geo); |
1172 | + |
1173 | void RenderIcon (nux::GraphicsEngine& GfxContext, |
1174 | RenderArg arg, |
1175 | nux::BaseTexture *icon, |
1176 | nux::Color bkg_color, |
1177 | float alpha, |
1178 | nux::Vector4 xform_coords[], |
1179 | - nux::Geometry geo, |
1180 | - bool render_indicators); |
1181 | + nux::Geometry geo); |
1182 | |
1183 | void SetIconXForm (LauncherIcon *icon, nux::Matrix4 ViewProjectionMatrix, nux::Geometry geo, |
1184 | float x, float y, float w, float h, float z, std::string name); |
1185 | @@ -231,7 +237,6 @@ |
1186 | nux::AbstractPaintLayer* m_BackgroundLayer; |
1187 | nux::BaseWindow* _parent; |
1188 | nux::View* _autohide_trigger; |
1189 | - nux::Geometry _last_shelf_area; |
1190 | LauncherModel* _model; |
1191 | |
1192 | /* event times */ |
1193 | |
1194 | === modified file 'src/LauncherModel.cpp' |
1195 | --- src/LauncherModel.cpp 2010-11-24 18:59:55 +0000 |
1196 | +++ src/LauncherModel.cpp 2010-12-04 21:47:02 +0000 |
1197 | @@ -39,6 +39,20 @@ |
1198 | return icon->Type () == LAUNCHER_ICON_TYPE_TRASH; |
1199 | } |
1200 | |
1201 | +void |
1202 | +LauncherModel::Populate () |
1203 | +{ |
1204 | + _inner.clear (); |
1205 | + |
1206 | + iterator it; |
1207 | + |
1208 | + for (it = main_begin (); it != main_end (); it++) |
1209 | + _inner.push_back (*it); |
1210 | + |
1211 | + for (it = shelf_begin (); it != shelf_end (); it++) |
1212 | + _inner.push_back (*it); |
1213 | +} |
1214 | + |
1215 | void |
1216 | LauncherModel::AddIcon (LauncherIcon *icon) |
1217 | { |
1218 | @@ -47,8 +61,10 @@ |
1219 | if (IconShouldShelf (icon)) |
1220 | _inner_shelf.push_front (icon); |
1221 | else |
1222 | - _inner_launcher.push_front (icon); |
1223 | - |
1224 | + _inner_main.push_front (icon); |
1225 | + |
1226 | + Populate (); |
1227 | + |
1228 | icon_added.emit (icon); |
1229 | icon->remove.connect (sigc::mem_fun (this, &LauncherModel::OnIconRemove)); |
1230 | } |
1231 | @@ -58,16 +74,13 @@ |
1232 | { |
1233 | size_t size; |
1234 | |
1235 | - size = _inner_shelf.size (); |
1236 | _inner_shelf.remove (icon); |
1237 | - |
1238 | - if (size != _inner_shelf.size ()) |
1239 | - icon_removed.emit (icon); |
1240 | + _inner_main.remove (icon); |
1241 | |
1242 | - size = _inner_launcher.size (); |
1243 | - _inner_launcher.remove (icon); |
1244 | + size = _inner.size (); |
1245 | + _inner.remove (icon); |
1246 | |
1247 | - if (size != _inner_launcher.size ()) |
1248 | + if (size != _inner.size ()) |
1249 | icon_removed.emit (icon); |
1250 | |
1251 | icon->UnReference (); |
1252 | @@ -97,38 +110,64 @@ |
1253 | void |
1254 | LauncherModel::Sort (SortFunc func) |
1255 | { |
1256 | - _inner_launcher.sort (func); |
1257 | - _inner_shelf.sort (func); |
1258 | + _inner.sort (func); |
1259 | + _inner_main.sort (func); |
1260 | + |
1261 | + Populate (); |
1262 | } |
1263 | |
1264 | int |
1265 | LauncherModel::Size () |
1266 | { |
1267 | - return _inner_shelf.size () + _inner_launcher.size (); |
1268 | + return _inner.size (); |
1269 | } |
1270 | |
1271 | LauncherModel::iterator |
1272 | LauncherModel::begin () |
1273 | { |
1274 | - return _inner_launcher.begin (); |
1275 | + return _inner.begin (); |
1276 | } |
1277 | |
1278 | LauncherModel::iterator |
1279 | LauncherModel::end () |
1280 | { |
1281 | - return _inner_launcher.end (); |
1282 | + return _inner.end (); |
1283 | } |
1284 | |
1285 | LauncherModel::reverse_iterator |
1286 | LauncherModel::rbegin () |
1287 | { |
1288 | - return _inner_launcher.rbegin (); |
1289 | + return _inner.rbegin (); |
1290 | } |
1291 | |
1292 | LauncherModel::reverse_iterator |
1293 | LauncherModel::rend () |
1294 | { |
1295 | - return _inner_launcher.rend (); |
1296 | + return _inner.rend (); |
1297 | +} |
1298 | + |
1299 | +LauncherModel::iterator |
1300 | +LauncherModel::main_begin () |
1301 | +{ |
1302 | + return _inner_main.begin (); |
1303 | +} |
1304 | + |
1305 | +LauncherModel::iterator |
1306 | +LauncherModel::main_end () |
1307 | +{ |
1308 | + return _inner_main.end (); |
1309 | +} |
1310 | + |
1311 | +LauncherModel::reverse_iterator |
1312 | +LauncherModel::main_rbegin () |
1313 | +{ |
1314 | + return _inner_main.rbegin (); |
1315 | +} |
1316 | + |
1317 | +LauncherModel::reverse_iterator |
1318 | +LauncherModel::main_rend () |
1319 | +{ |
1320 | + return _inner_main.rend (); |
1321 | } |
1322 | |
1323 | LauncherModel::iterator |
1324 | |
1325 | === modified file 'src/LauncherModel.h' |
1326 | --- src/LauncherModel.h 2010-11-16 00:25:17 +0000 |
1327 | +++ src/LauncherModel.h 2010-12-04 21:47:02 +0000 |
1328 | @@ -47,6 +47,11 @@ |
1329 | reverse_iterator rbegin (); |
1330 | reverse_iterator rend (); |
1331 | |
1332 | + iterator main_begin (); |
1333 | + iterator main_end (); |
1334 | + reverse_iterator main_rbegin (); |
1335 | + reverse_iterator main_rend (); |
1336 | + |
1337 | iterator shelf_begin (); |
1338 | iterator shelf_end (); |
1339 | reverse_iterator shelf_rbegin (); |
1340 | @@ -57,8 +62,11 @@ |
1341 | sigc::signal<void> order_changed; |
1342 | |
1343 | private: |
1344 | - Base _inner_launcher; |
1345 | + Base _inner; |
1346 | Base _inner_shelf; |
1347 | + Base _inner_main; |
1348 | + |
1349 | + void Populate (); |
1350 | |
1351 | bool IconShouldShelf (LauncherIcon *icon); |
1352 | |
1353 | |
1354 | === modified file 'src/unity.cpp' |
1355 | --- src/unity.cpp 2010-11-26 09:11:52 +0000 |
1356 | +++ src/unity.cpp 2010-12-04 21:47:02 +0000 |
1357 | @@ -47,52 +47,52 @@ |
1358 | void |
1359 | UnityScreen::nuxPrologue () |
1360 | { |
1361 | - /* reset matrices */ |
1362 | - glPushAttrib (GL_VIEWPORT_BIT | GL_ENABLE_BIT | GL_TEXTURE_BIT | GL_COLOR_BUFFER_BIT); |
1363 | - |
1364 | - glMatrixMode (GL_PROJECTION); |
1365 | - glPushMatrix (); |
1366 | - |
1367 | - glMatrixMode (GL_MODELVIEW); |
1368 | - glPushMatrix (); |
1369 | - |
1370 | - glGetError(); |
1371 | + /* reset matrices */ |
1372 | + glPushAttrib (GL_VIEWPORT_BIT | GL_ENABLE_BIT | GL_TEXTURE_BIT | GL_COLOR_BUFFER_BIT); |
1373 | + |
1374 | + glMatrixMode (GL_PROJECTION); |
1375 | + glPushMatrix (); |
1376 | + |
1377 | + glMatrixMode (GL_MODELVIEW); |
1378 | + glPushMatrix (); |
1379 | + |
1380 | + glGetError(); |
1381 | } |
1382 | |
1383 | void |
1384 | UnityScreen::nuxEpilogue () |
1385 | { |
1386 | - (*GL::bindFramebuffer) (GL_FRAMEBUFFER_EXT, 0); |
1387 | - |
1388 | - glMatrixMode (GL_PROJECTION); |
1389 | - glLoadIdentity (); |
1390 | - glMatrixMode (GL_MODELVIEW); |
1391 | - glLoadIdentity (); |
1392 | - glDepthRange (0, 1); |
1393 | - glViewport (-1, -1, 2, 2); |
1394 | - glRasterPos2f (0, 0); |
1395 | - |
1396 | - gScreen->resetRasterPos (); |
1397 | - |
1398 | - glMatrixMode (GL_PROJECTION); |
1399 | - glPopMatrix (); |
1400 | - glMatrixMode (GL_MODELVIEW); |
1401 | - glPopMatrix (); |
1402 | - |
1403 | - glDrawBuffer (GL_BACK); |
1404 | - glReadBuffer (GL_BACK); |
1405 | - |
1406 | - glPopAttrib (); |
1407 | + (*GL::bindFramebuffer) (GL_FRAMEBUFFER_EXT, 0); |
1408 | + |
1409 | + glMatrixMode (GL_PROJECTION); |
1410 | + glLoadIdentity (); |
1411 | + glMatrixMode (GL_MODELVIEW); |
1412 | + glLoadIdentity (); |
1413 | + glDepthRange (0, 1); |
1414 | + glViewport (-1, -1, 2, 2); |
1415 | + glRasterPos2f (0, 0); |
1416 | + |
1417 | + gScreen->resetRasterPos (); |
1418 | + |
1419 | + glMatrixMode (GL_PROJECTION); |
1420 | + glPopMatrix (); |
1421 | + glMatrixMode (GL_MODELVIEW); |
1422 | + glPopMatrix (); |
1423 | + |
1424 | + glDrawBuffer (GL_BACK); |
1425 | + glReadBuffer (GL_BACK); |
1426 | + |
1427 | + glPopAttrib (); |
1428 | } |
1429 | |
1430 | void |
1431 | UnityScreen::paintDisplay (const CompRegion ®ion) |
1432 | { |
1433 | - nuxPrologue (); |
1434 | - wt->RenderInterfaceFromForeignCmd (); |
1435 | - nuxEpilogue (); |
1436 | + nuxPrologue (); |
1437 | + wt->RenderInterfaceFromForeignCmd (); |
1438 | + nuxEpilogue (); |
1439 | |
1440 | - doShellRepaint = false; |
1441 | + doShellRepaint = false; |
1442 | } |
1443 | |
1444 | /* called whenever we need to repaint parts of the screen */ |
1445 | @@ -103,18 +103,18 @@ |
1446 | CompOutput *output, |
1447 | unsigned int mask) |
1448 | { |
1449 | - bool ret; |
1450 | - |
1451 | - doShellRepaint = true; |
1452 | - allowWindowPaint = true; |
1453 | - |
1454 | - /* glPaintOutput is part of the opengl plugin, so we need the GLScreen base class. */ |
1455 | - ret = gScreen->glPaintOutput (attrib, transform, region, output, mask); |
1456 | - |
1457 | - if (doShellRepaint) |
1458 | - paintDisplay (region); |
1459 | - |
1460 | - return ret; |
1461 | + bool ret; |
1462 | + |
1463 | + doShellRepaint = true; |
1464 | + allowWindowPaint = true; |
1465 | + |
1466 | + /* glPaintOutput is part of the opengl plugin, so we need the GLScreen base class. */ |
1467 | + ret = gScreen->glPaintOutput (attrib, transform, region, output, mask); |
1468 | + |
1469 | + if (doShellRepaint) |
1470 | + paintDisplay (region); |
1471 | + |
1472 | + return ret; |
1473 | } |
1474 | |
1475 | /* called whenever a plugin needs to paint the entire scene |
1476 | @@ -127,96 +127,96 @@ |
1477 | CompOutput *output, |
1478 | unsigned int mask) |
1479 | { |
1480 | - allowWindowPaint = false; |
1481 | - gScreen->glPaintOutput (attrib, transform, region, output, mask); |
1482 | + allowWindowPaint = false; |
1483 | + gScreen->glPaintOutput (attrib, transform, region, output, mask); |
1484 | } |
1485 | |
1486 | /* Grab changed nux regions and add damage rects for them */ |
1487 | void |
1488 | UnityScreen::damageNuxRegions () |
1489 | { |
1490 | - CompRegion region; |
1491 | - std::vector<nux::Geometry>::iterator it; |
1492 | - std::vector<nux::Geometry> dirty = wt->GetDrawList (); |
1493 | - nux::Geometry geo; |
1494 | - |
1495 | - for (it = dirty.begin (); it != dirty.end (); it++) |
1496 | - { |
1497 | - geo = *it; |
1498 | - cScreen->damageRegion (CompRegion (geo.x, geo.y, geo.width, geo.height)); |
1499 | - } |
1500 | - |
1501 | - geo = wt->GetWindowCompositor ().GetTooltipMainWindowGeometry(); |
1502 | + CompRegion region; |
1503 | + std::vector<nux::Geometry>::iterator it; |
1504 | + std::vector<nux::Geometry> dirty = wt->GetDrawList (); |
1505 | + nux::Geometry geo; |
1506 | + |
1507 | + for (it = dirty.begin (); it != dirty.end (); it++) |
1508 | + { |
1509 | + geo = *it; |
1510 | cScreen->damageRegion (CompRegion (geo.x, geo.y, geo.width, geo.height)); |
1511 | - cScreen->damageRegion (CompRegion (lastTooltipArea.x, lastTooltipArea.y, lastTooltipArea.width, lastTooltipArea.height)); |
1512 | - |
1513 | - lastTooltipArea = geo; |
1514 | - |
1515 | - wt->ClearDrawList (); |
1516 | + } |
1517 | + |
1518 | + geo = wt->GetWindowCompositor ().GetTooltipMainWindowGeometry(); |
1519 | + cScreen->damageRegion (CompRegion (geo.x, geo.y, geo.width, geo.height)); |
1520 | + cScreen->damageRegion (CompRegion (lastTooltipArea.x, lastTooltipArea.y, lastTooltipArea.width, lastTooltipArea.height)); |
1521 | + |
1522 | + lastTooltipArea = geo; |
1523 | + |
1524 | + wt->ClearDrawList (); |
1525 | } |
1526 | |
1527 | /* handle X Events */ |
1528 | void |
1529 | UnityScreen::handleEvent (XEvent *event) |
1530 | { |
1531 | - screen->handleEvent (event); |
1532 | + screen->handleEvent (event); |
1533 | |
1534 | - if (screen->otherGrabExist ("deco", "move", NULL)) |
1535 | - { |
1536 | - wt->ProcessForeignEvent (event, NULL); |
1537 | - } |
1538 | + if (screen->otherGrabExist ("deco", "move", NULL)) |
1539 | + { |
1540 | + wt->ProcessForeignEvent (event, NULL); |
1541 | + } |
1542 | } |
1543 | |
1544 | |
1545 | gboolean |
1546 | UnityScreen::initPluginActions (gpointer data) |
1547 | { |
1548 | - CompPlugin *p; |
1549 | - |
1550 | - p = CompPlugin::find ("expo"); |
1551 | - |
1552 | - if (p) |
1553 | - { |
1554 | - foreach (CompOption &option, p->vTable->getOptions ()) |
1555 | - { |
1556 | - if (option.name () == "expo_key") |
1557 | - { |
1558 | - CompAction *action = &option.value ().action (); |
1559 | - PluginAdapter::Default ()->SetExpoAction (action); |
1560 | - break; |
1561 | - } |
1562 | - } |
1563 | - } |
1564 | - |
1565 | - p = CompPlugin::find ("scale"); |
1566 | - |
1567 | - if (p) |
1568 | - { |
1569 | - foreach (CompOption &option, p->vTable->getOptions ()) |
1570 | - { |
1571 | - if (option.name () == "initiate_all_key") |
1572 | - { |
1573 | - CompAction *action = &option.value ().action (); |
1574 | - PluginAdapter::Default ()->SetScaleAction (action); |
1575 | - break; |
1576 | - } |
1577 | - } |
1578 | - } |
1579 | - |
1580 | - return FALSE; |
1581 | + CompPlugin *p; |
1582 | + |
1583 | + p = CompPlugin::find ("expo"); |
1584 | + |
1585 | + if (p) |
1586 | + { |
1587 | + foreach (CompOption &option, p->vTable->getOptions ()) |
1588 | + { |
1589 | + if (option.name () == "expo_key") |
1590 | + { |
1591 | + CompAction *action = &option.value ().action (); |
1592 | + PluginAdapter::Default ()->SetExpoAction (action); |
1593 | + break; |
1594 | + } |
1595 | + } |
1596 | + } |
1597 | + |
1598 | + p = CompPlugin::find ("scale"); |
1599 | + |
1600 | + if (p) |
1601 | + { |
1602 | + foreach (CompOption &option, p->vTable->getOptions ()) |
1603 | + { |
1604 | + if (option.name () == "initiate_all_key") |
1605 | + { |
1606 | + CompAction *action = &option.value ().action (); |
1607 | + PluginAdapter::Default ()->SetScaleAction (action); |
1608 | + break; |
1609 | + } |
1610 | + } |
1611 | + } |
1612 | + |
1613 | + return FALSE; |
1614 | } |
1615 | |
1616 | /* Set up expo and scale actions on the launcher */ |
1617 | bool |
1618 | UnityScreen::initPluginForScreen (CompPlugin *p) |
1619 | { |
1620 | - if (p->vTable->name () == "expo" || |
1621 | - p->vTable->name () == "scale") |
1622 | - { |
1623 | - initPluginActions ((void *) this); |
1624 | - } |
1625 | + if (p->vTable->name () == "expo" || |
1626 | + p->vTable->name () == "scale") |
1627 | + { |
1628 | + initPluginActions ((void *) this); |
1629 | + } |
1630 | |
1631 | - return screen->initPluginForScreen (p); |
1632 | + return screen->initPluginForScreen (p); |
1633 | } |
1634 | |
1635 | void |
1636 | @@ -227,7 +227,7 @@ |
1637 | const gchar* |
1638 | UnityScreen::GetName () |
1639 | { |
1640 | - return "Unity"; |
1641 | + return "Unity"; |
1642 | } |
1643 | |
1644 | const CompWindowList & |
1645 | @@ -264,57 +264,57 @@ |
1646 | const CompRegion ®ion, |
1647 | unsigned int mask) |
1648 | { |
1649 | - if (uScreen->doShellRepaint && uScreen->allowWindowPaint) |
1650 | + if (uScreen->doShellRepaint && uScreen->allowWindowPaint) |
1651 | + { |
1652 | + const std::list <Window> &xwns = nux::XInputWindow::NativeHandleList (); |
1653 | + |
1654 | + for (CompWindow *w = window; w && uScreen->doShellRepaint; w = w->prev) |
1655 | { |
1656 | - const std::list <Window> &xwns = nux::XInputWindow::NativeHandleList (); |
1657 | - |
1658 | - for (CompWindow *w = window; w && uScreen->doShellRepaint; w = w->prev) |
1659 | - { |
1660 | - if (std::find (xwns.begin (), xwns.end (), w->id ()) != xwns.end ()) |
1661 | - { |
1662 | - uScreen->paintDisplay (region); |
1663 | - } |
1664 | - } |
1665 | + if (std::find (xwns.begin (), xwns.end (), w->id ()) != xwns.end ()) |
1666 | + { |
1667 | + uScreen->paintDisplay (region); |
1668 | + } |
1669 | } |
1670 | - |
1671 | - bool ret = gWindow->glDraw (matrix, attrib, region, mask); |
1672 | - |
1673 | - return ret; |
1674 | + } |
1675 | + |
1676 | + bool ret = gWindow->glDraw (matrix, attrib, region, mask); |
1677 | + |
1678 | + return ret; |
1679 | } |
1680 | |
1681 | /* Called whenever a window is mapped, unmapped, minimized etc */ |
1682 | void |
1683 | UnityWindow::windowNotify (CompWindowNotify n) |
1684 | { |
1685 | - if (n == CompWindowNotifyMinimize) |
1686 | - uScreen->controller->PresentIconOwningWindow (window->id ()); |
1687 | + if (n == CompWindowNotifyMinimize) |
1688 | + uScreen->controller->PresentIconOwningWindow (window->id ()); |
1689 | |
1690 | - window->windowNotify (n); |
1691 | + window->windowNotify (n); |
1692 | } |
1693 | |
1694 | /* Configure callback for the launcher window */ |
1695 | void |
1696 | UnityScreen::launcherWindowConfigureCallback(int WindowWidth, int WindowHeight, nux::Geometry& geo, void *user_data) |
1697 | { |
1698 | - int OurWindowHeight = WindowHeight - 24; |
1699 | - geo = nux::Geometry(0, 24, geo.width, OurWindowHeight); |
1700 | + int OurWindowHeight = WindowHeight - 24; |
1701 | + geo = nux::Geometry(0, 24, geo.width, OurWindowHeight); |
1702 | } |
1703 | |
1704 | /* Configure callback for the panel window */ |
1705 | void |
1706 | UnityScreen::panelWindowConfigureCallback(int WindowWidth, int WindowHeight, nux::Geometry& geo, void *user_data) |
1707 | { |
1708 | - geo = nux::Geometry(0, 0, WindowWidth, 24); |
1709 | + geo = nux::Geometry(0, 0, WindowWidth, 24); |
1710 | } |
1711 | |
1712 | /* Start up nux after OpenGL is initialized */ |
1713 | void |
1714 | UnityScreen::initUnity(nux::NThread* thread, void* InitData) |
1715 | { |
1716 | - initLauncher(thread, InitData); |
1717 | - |
1718 | - nux::ColorLayer background(nux::Color(0x00000000)); |
1719 | - static_cast<nux::WindowThread*>(thread)->SetWindowBackgroundPaintLayer(&background); |
1720 | + initLauncher(thread, InitData); |
1721 | + |
1722 | + nux::ColorLayer background(nux::Color(0x00000000)); |
1723 | + static_cast<nux::WindowThread*>(thread)->SetWindowBackgroundPaintLayer(&background); |
1724 | } |
1725 | |
1726 | void |
1727 | @@ -328,18 +328,18 @@ |
1728 | UnityScreen::optionChanged (CompOption *opt, |
1729 | UnityshellOptions::Options num) |
1730 | { |
1731 | - switch (num) |
1732 | - { |
1733 | - case UnityshellOptions::LauncherAutohide: |
1734 | - launcher->SetAutohide (optionGetLauncherAutohide (), |
1735 | - (nux::View *) panelView->HomeButton ()); |
1736 | - break; |
1737 | - case UnityshellOptions::LauncherFloat: |
1738 | - launcher->SetFloating (optionGetLauncherFloat ()); |
1739 | - break; |
1740 | - default: |
1741 | - break; |
1742 | - } |
1743 | + switch (num) |
1744 | + { |
1745 | + case UnityshellOptions::LauncherAutohide: |
1746 | + launcher->SetAutohide (optionGetLauncherAutohide (), |
1747 | + (nux::View *) panelView->HomeButton ()); |
1748 | + break; |
1749 | + case UnityshellOptions::LauncherFloat: |
1750 | + launcher->SetFloating (optionGetLauncherFloat ()); |
1751 | + break; |
1752 | + default: |
1753 | + break; |
1754 | + } |
1755 | } |
1756 | |
1757 | UnityScreen::UnityScreen (CompScreen *screen) : |
1758 | @@ -349,41 +349,41 @@ |
1759 | gScreen (GLScreen::get (screen)), |
1760 | doShellRepaint (false) |
1761 | { |
1762 | - int (*old_handler) (Display *, XErrorEvent *); |
1763 | - old_handler = XSetErrorHandler (NULL); |
1764 | - |
1765 | - g_thread_init (NULL); |
1766 | - dbus_g_thread_init (); |
1767 | - gtk_init (NULL, NULL); |
1768 | - |
1769 | - XSetErrorHandler (old_handler); |
1770 | - |
1771 | - /* Wrap compiz interfaces */ |
1772 | - ScreenInterface::setHandler (screen); |
1773 | - CompositeScreenInterface::setHandler (cScreen); |
1774 | - GLScreenInterface::setHandler (gScreen); |
1775 | - |
1776 | - StartupNotifyService::Default ()->SetSnDisplay (screen->snDisplay (), screen->screenNum ()); |
1777 | - |
1778 | - nux::NuxInitialize (0); |
1779 | - wt = nux::CreateFromForeignWindow (cScreen->output (), |
1780 | - glXGetCurrentContext (), |
1781 | - &UnityScreen::initUnity, |
1782 | - this); |
1783 | - |
1784 | - wt->RedrawRequested.connect (sigc::mem_fun (this, &UnityScreen::onRedrawRequested)); |
1785 | - |
1786 | - wt->Run (NULL); |
1787 | - uScreen = this; |
1788 | - |
1789 | - debugger = new IntrospectionDBusInterface (this); |
1790 | - |
1791 | - PluginAdapter::Initialize (screen); |
1792 | - |
1793 | - optionSetLauncherAutohideNotify (boost::bind (&UnityScreen::optionChanged, this, _1, _2)); |
1794 | - optionSetLauncherFloatNotify (boost::bind (&UnityScreen::optionChanged, this, _1, _2)); |
1795 | - |
1796 | - g_timeout_add (0, &UnityScreen::initPluginActions, this); |
1797 | + int (*old_handler) (Display *, XErrorEvent *); |
1798 | + old_handler = XSetErrorHandler (NULL); |
1799 | + |
1800 | + g_thread_init (NULL); |
1801 | + dbus_g_thread_init (); |
1802 | + gtk_init (NULL, NULL); |
1803 | + |
1804 | + XSetErrorHandler (old_handler); |
1805 | + |
1806 | + /* Wrap compiz interfaces */ |
1807 | + ScreenInterface::setHandler (screen); |
1808 | + CompositeScreenInterface::setHandler (cScreen); |
1809 | + GLScreenInterface::setHandler (gScreen); |
1810 | + |
1811 | + StartupNotifyService::Default ()->SetSnDisplay (screen->snDisplay (), screen->screenNum ()); |
1812 | + |
1813 | + nux::NuxInitialize (0); |
1814 | + wt = nux::CreateFromForeignWindow (cScreen->output (), |
1815 | + glXGetCurrentContext (), |
1816 | + &UnityScreen::initUnity, |
1817 | + this); |
1818 | + |
1819 | + wt->RedrawRequested.connect (sigc::mem_fun (this, &UnityScreen::onRedrawRequested)); |
1820 | + |
1821 | + wt->Run (NULL); |
1822 | + uScreen = this; |
1823 | + |
1824 | + debugger = new IntrospectionDBusInterface (this); |
1825 | + |
1826 | + PluginAdapter::Initialize (screen); |
1827 | + |
1828 | + optionSetLauncherAutohideNotify (boost::bind (&UnityScreen::optionChanged, this, _1, _2)); |
1829 | + optionSetLauncherFloatNotify (boost::bind (&UnityScreen::optionChanged, this, _1, _2)); |
1830 | + |
1831 | + g_timeout_add (0, &UnityScreen::initPluginActions, this); |
1832 | } |
1833 | |
1834 | UnityScreen::~UnityScreen () |
1835 | @@ -393,18 +393,18 @@ |
1836 | /* Can't create windows until after we have initialized everything */ |
1837 | gboolean UnityScreen::strutHackTimeout (gpointer data) |
1838 | { |
1839 | - UnityScreen *self = (UnityScreen*) data; |
1840 | - |
1841 | - if (!self->launcher->AutohideEnabled ()) |
1842 | - { |
1843 | - self->launcherWindow->InputWindowEnableStruts(false); |
1844 | - self->launcherWindow->InputWindowEnableStruts(true); |
1845 | - } |
1846 | - |
1847 | - self->panelWindow->InputWindowEnableStruts(false); |
1848 | - self->panelWindow->InputWindowEnableStruts(true); |
1849 | - |
1850 | - return FALSE; |
1851 | + UnityScreen *self = (UnityScreen*) data; |
1852 | + |
1853 | + if (!self->launcher->AutohideEnabled ()) |
1854 | + { |
1855 | + self->launcherWindow->InputWindowEnableStruts(false); |
1856 | + self->launcherWindow->InputWindowEnableStruts(true); |
1857 | + } |
1858 | + |
1859 | + self->panelWindow->InputWindowEnableStruts(false); |
1860 | + self->panelWindow->InputWindowEnableStruts(true); |
1861 | + |
1862 | + return FALSE; |
1863 | } |
1864 | |
1865 | /* Start up the launcher */ |
1866 | @@ -466,8 +466,8 @@ |
1867 | window (window), |
1868 | gWindow (GLWindow::get (window)) |
1869 | { |
1870 | - WindowInterface::setHandler (window); |
1871 | - GLWindowInterface::setHandler (gWindow); |
1872 | + WindowInterface::setHandler (window); |
1873 | + GLWindowInterface::setHandler (gWindow); |
1874 | } |
1875 | |
1876 | UnityWindow::~UnityWindow () |
1877 | @@ -478,13 +478,13 @@ |
1878 | bool |
1879 | UnityPluginVTable::init () |
1880 | { |
1881 | - if (!CompPlugin::checkPluginABI ("core", CORE_ABIVERSION)) |
1882 | - return false; |
1883 | - if (!CompPlugin::checkPluginABI ("composite", COMPIZ_COMPOSITE_ABI)) |
1884 | - return false; |
1885 | - if (!CompPlugin::checkPluginABI ("opengl", COMPIZ_OPENGL_ABI)) |
1886 | - return false; |
1887 | + if (!CompPlugin::checkPluginABI ("core", CORE_ABIVERSION)) |
1888 | + return false; |
1889 | + if (!CompPlugin::checkPluginABI ("composite", COMPIZ_COMPOSITE_ABI)) |
1890 | + return false; |
1891 | + if (!CompPlugin::checkPluginABI ("opengl", COMPIZ_OPENGL_ABI)) |
1892 | + return false; |
1893 | |
1894 | - return true; |
1895 | + return true; |
1896 | } |
1897 | |
1898 | |
1899 | === modified file 'src/unity.h' |
1900 | --- src/unity.h 2010-11-26 09:11:52 +0000 |
1901 | +++ src/unity.h 2010-12-04 21:47:02 +0000 |
1902 | @@ -140,7 +140,8 @@ |
1903 | |
1904 | /* handle paint order */ |
1905 | bool doShellRepaint; |
1906 | - bool allowWindowPaint; |
1907 | + bool allowWindowPaint; |
1908 | + bool damaged; |
1909 | CompWindowList _withRemovedNuxWindows; |
1910 | |
1911 | friend class UnityWindow; |
Works as expected, code looks good. Approved.