Merge lp:~unity-team/unity/unity.gord-design-launcher-bug-fixes into lp:unity

Proposed by Gord Allott
Status: Merged
Merged at revision: 497
Proposed branch: lp:~unity-team/unity/unity.gord-design-launcher-bug-fixes
Merge into: lp:unity
Diff against target: 204 lines (+70/-22)
4 files modified
unity-private/launcher/quicklist-controller.vala (+3/-0)
unity-private/launcher/scroller-controller.vala (+2/-1)
unity-private/launcher/scroller-view.vala (+61/-17)
unity-private/launcher/scrollerchild-controller.vala (+4/-4)
To merge this branch: bzr merge lp:~unity-team/unity/unity.gord-design-launcher-bug-fixes
Reviewer Review Type Date Requested Status
Mikkel Kamstrup Erlandsen (community) Approve
Review via email: mp+35392@code.launchpad.net

Description of the change

Fixes a whole bunch of design bugs, hopefully launchpad is being smart and has linked them

To post a comment you must log in.
Revision history for this message
Mikkel Kamstrup Erlandsen (kamstrup) wrote :

CODE:
Can you please convert this to keep us all sane :-) :

  - (get_total_children_height () - get_available_height ())
 |
 V
  get_available_height () - get_total_children_height ()

If you only used 'QuicklistController? attached_menu' in on_menu_close() i'd maybe let you get away with inline declarations like this, but it appears you access it from other methods as well. Please move that declaration to the class header.

It should definitely give more than 20 exp to defeat Unity. I am thinking 1021 is a good number (it's a prime close to 1024 so you gotta love it!)

FUNCTIONAL:
Bug #631443: Launcher tile dragging shouldn't be masked
 - I can still see a tiny bit of clipping when dragging off the launcher, but much better than before

Bug #631452: Launcher tile vertical dragging
 - Dragging feels much more natural, and the white drop indicator matches my expectations as a user much better

Bug #632079: launcher shouldn't 'fold' when hovering on a quicklist
 - Fixed

Bug #632991: launcher mouse wheel dragging elastic band jittering
 - Fixed

Bug #633045: launcher auto-scroll speed
 - Autoscrolling feels much more useful now. Fixed

THE VERDICT
Approved! Nice work! :-D

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'unity-private/launcher/quicklist-controller.vala'
2--- unity-private/launcher/quicklist-controller.vala 2010-09-13 10:17:19 +0000
3+++ unity-private/launcher/quicklist-controller.vala 2010-09-14 11:52:42 +0000
4@@ -124,6 +124,9 @@
5 private void new_menu ()
6 {
7 menu = new QuicklistMenu () as Ctk.MenuExpandable;
8+ menu.destroy.connect (() => {
9+ state = QuicklistControllerState.CLOSED;
10+ });
11 if (Unity.global_shell is Unity.Shell)
12 {
13 menu.destroy.connect (() => {
14
15=== modified file 'unity-private/launcher/scroller-controller.vala'
16--- unity-private/launcher/scroller-controller.vala 2010-09-02 10:59:35 +0000
17+++ unity-private/launcher/scroller-controller.vala 2010-09-14 11:52:42 +0000
18@@ -351,7 +351,8 @@
19
20 // if the actor is not in the model, add it. because its now in there!
21 // find the index at this position
22- int model_index = view.get_model_index_at_y_pos_no_anim (y, true);
23+
24+ int model_index = view.get_model_index_at_y_pos_no_anim (y - 24, true);
25 if (model_index < 0) return;
26
27 //we have to check to see if we would still be over the index
28
29=== modified file 'unity-private/launcher/scroller-view.vala'
30--- unity-private/launcher/scroller-view.vala 2010-09-01 13:28:11 +0000
31+++ unity-private/launcher/scroller-view.vala 2010-09-14 11:52:42 +0000
32@@ -663,36 +663,43 @@
33 }
34
35 // will move the scroller by the given pixels
36- private void move_scroll_position (float pixels, bool check_bounds=false, float limit = 160.0f)
37+ private float calculate_scroll_position (bool check_bounds=false, float limit = 160.0f)
38 {
39- scroll_position += pixels;
40- float old_scroll_position = scroll_position;
41+ float new_scroll_position = scroll_position;
42 if (check_bounds)
43 {
44- scroll_position = Math.fminf (scroll_position, 0);
45- scroll_position = Math.fmaxf (scroll_position, - (get_total_children_height () - get_available_height ()));
46+ new_scroll_position = Math.fminf (new_scroll_position, 0);
47+ new_scroll_position = Math.fmaxf (new_scroll_position, - (get_total_children_height () - get_available_height ()));
48 }
49- else if (scroll_position > 0)
50+ else if (new_scroll_position > 0)
51 {
52- float new_scroll_position = scroll_position;
53 new_scroll_position = limit * ( 1 - Math.powf ((limit - 1) / limit, new_scroll_position));
54- scroll_position = new_scroll_position;
55 }
56 else if (get_total_children_height () < get_available_height () &&
57- scroll_position < 0)
58+ new_scroll_position < 0)
59 {
60- float new_scroll_position = -scroll_position;
61+ new_scroll_position = -new_scroll_position;
62 new_scroll_position = limit * ( 1 - Math.powf ((limit - 1) / limit, new_scroll_position));
63- scroll_position = -new_scroll_position;
64+ new_scroll_position = -new_scroll_position;
65 }
66 else if (get_total_children_height () >= get_available_height () &&
67- scroll_position < -(get_total_children_height () - get_available_height ()))
68+ new_scroll_position < -(get_total_children_height () - get_available_height ()))
69 {
70- float diff = scroll_position + (get_total_children_height () - get_available_height ());
71- float new_scroll_position = limit * ( 1 - Math.powf ((limit - 1) / limit, Math.fabsf (diff)));
72+ float diff = new_scroll_position + (get_total_children_height () - get_available_height ());
73+ new_scroll_position = limit * ( 1 - Math.powf ((limit - 1) / limit, Math.fabsf (diff)));
74 new_scroll_position = -(get_total_children_height () - get_available_height ()) - new_scroll_position;
75- scroll_position = new_scroll_position;
76 }
77+
78+ return new_scroll_position;
79+ }
80+
81+ private void move_scroll_position (float pixels, bool check_bounds=false, float limit = 160.0f)
82+ {
83+ scroll_position += pixels;
84+ float old_scroll_position = scroll_position;
85+
86+ scroll_position = calculate_scroll_position (check_bounds, limit);
87+
88 order_children (true);
89 queue_relayout ();
90
91@@ -826,8 +833,9 @@
92 if (autoscroll_anim_active == false && is_autoscrolling)
93 {
94 Timeout.add (33, () => {
95- float speed = 12.0f - autoscroll_mouse_pos_cache;
96+ float speed = 12.0f - Math.fabsf (autoscroll_mouse_pos_cache);
97 speed /= 12.0f;
98+ speed *= 30;
99 speed *= autoscroll_direction;
100 move_scroll_position (speed, true);
101 autoscroll_anim_active = is_autoscrolling;
102@@ -920,6 +928,12 @@
103 queue_contract_launcher = 0;
104 }
105
106+ if (attached_menu is QuicklistController)
107+ {
108+ attached_menu.notify["status"].disconnect (on_menu_close);
109+ attached_menu = null;
110+ }
111+
112 expand_launcher (event.crossing.y);
113 return false;
114 }
115@@ -941,12 +955,41 @@
116 return false;
117 }
118
119+ QuicklistController? attached_menu = null;
120+ private void on_menu_close ()
121+ {
122+ if (attached_menu is QuicklistController)
123+ {
124+ if (attached_menu.state != QuicklistControllerState.MENU)
125+ {
126+ if (last_known_pointer_x > get_width ())
127+ do_queue_contract_launcher ();
128+
129+ attached_menu.notify["status"].disconnect (on_menu_close);
130+ attached_menu = null;
131+ }
132+ }
133+ }
134+
135 private bool on_leave_event (Clutter.Event event)
136 {
137 last_known_pointer_x = 200;
138 var drag_controller = Drag.Controller.get_default ();
139 if (drag_controller.is_dragging) return false;
140 if (is_scrolling) return false;
141+
142+ // if a menu is open, don't fold the launcher, wait until its closed (if ever)
143+ QuicklistController? menu = QuicklistController.get_current_menu ();
144+ if (menu is QuicklistController)
145+ {
146+ if (menu.state == QuicklistControllerState.MENU)
147+ {
148+ attached_menu = menu;
149+ attached_menu.notify["state"].connect (on_menu_close);
150+ return false;
151+ }
152+ }
153+
154 do_queue_contract_launcher ();
155
156 if (last_picked_actor is Clutter.Actor &&
157@@ -1129,9 +1172,10 @@
158 private void do_anim_settle (Clutter.Timeline timeline, int msecs)
159 {
160 var distance = settle_position - scroll_position;
161- move_scroll_position (distance * 0.2f);
162+ move_scroll_position (distance * 0.2f, false, 60.0f);
163 if (Math.fabs (distance) < 1 )
164 {
165+ move_scroll_position (distance);
166 current_phase = ScrollerPhase.NONE;
167 }
168
169
170=== modified file 'unity-private/launcher/scrollerchild-controller.vala'
171--- unity-private/launcher/scrollerchild-controller.vala 2010-08-31 10:11:05 +0000
172+++ unity-private/launcher/scrollerchild-controller.vala 2010-09-14 11:52:42 +0000
173@@ -59,7 +59,7 @@
174 construct
175 {
176 theme_file_path = new Unity.ThemeFilePath ();
177- name = "Bug Found, You Defeated Unity";
178+ name = "Bug Found, You Defeated Unity, +20 exp";
179 child.controller = this;
180 child.button_press_event.connect (on_press_event);
181 child.button_release_event.connect (on_release_event);
182@@ -106,12 +106,12 @@
183 private bool on_leave_event (Clutter.Event event)
184 {
185 button_down = false;
186+ menu_state = ScrollerChildControllerMenuState.NO_MENU;
187 if (menu_state != ScrollerChildControllerMenuState.MENU)
188 {
189- menu_state = ScrollerChildControllerMenuState.NO_MENU;
190+ ensure_menu_state ();
191 }
192
193- ensure_menu_state ();
194 return false;
195 }
196 private bool no_activate = false;
197@@ -199,7 +199,7 @@
198 {
199 // there is a menu open already, attach to the destroy so we can
200 // re-ensure later
201- QuicklistController.get_current_menu ().get_view ().destroy.connect (ensure_menu_state);
202+ //QuicklistController.get_current_menu ().get_view ().destroy.connect (ensure_menu_state);
203 return;
204 }
205