Merge lp:~azzar1/unity/fix-987223 into lp:unity

Proposed by Andrea Azzarone on 2012-07-16
Status: Merged
Approved by: Andrea Azzarone on 2012-07-16
Approved revision: 2494
Merged at revision: 2505
Proposed branch: lp:~azzar1/unity/fix-987223
Merge into: lp:unity
Diff against target: 149 lines (+33/-27)
3 files modified
launcher/Launcher.cpp (+19/-27)
launcher/Launcher.h (+2/-0)
manual-tests/Launcher.txt (+12/-0)
To merge this branch: bzr merge lp:~azzar1/unity/fix-987223
Reviewer Review Type Date Requested Status
Brandon Schaefer (community) 2012-07-16 Approve on 2012-07-16
jenkins (community) continuous-integration 2012-07-16 Approve on 2012-07-16
Review via email: mp+115080@code.launchpad.net

This proposal supersedes a proposal from 2012-07-12.

Commit message

Fix launcher autoscroll during dnd.

Description of the change

== Problem ==
Launcher doesn't autoscroll when holding an icon (can't reach trash)

== Fix ==
Don't use _scroll_limit_reached. _launcher_drag_delta_max and _launcher_drag_delta_min should be just fine.

== Test ==
Manual test added.

To post a comment you must log in.
jenkins (martin-mrazik+qa) wrote : Posted in a previous version of this proposal
review: Needs Fixing (continuous-integration)
Brandon Schaefer (brandontschaefer) wrote :

Looks good and works :).

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'launcher/Launcher.cpp'
2--- launcher/Launcher.cpp 2012-07-16 01:08:04 +0000
3+++ launcher/Launcher.cpp 2012-07-16 08:13:38 +0000
4@@ -111,7 +111,6 @@
5 , _active_quicklist(nullptr)
6 , _hovered(false)
7 , _hidden(false)
8- , _scroll_limit_reached(false)
9 , _render_drag_window(false)
10 , _shortcuts_shown(false)
11 , _data_checked(false)
12@@ -122,7 +121,6 @@
13 , _folded_angle(1.0f)
14 , _neg_folded_angle(-1.0f)
15 , _folded_z_distance(10.0f)
16- , _last_delta_y(0.0f)
17 , _edge_overcome_pressure(0.0f)
18 , _launcher_action_state(ACTION_NONE)
19 , _space_between_icons(5)
20@@ -135,6 +133,8 @@
21 , _postreveal_mousemove_delta_x(0)
22 , _postreveal_mousemove_delta_y(0)
23 , _launcher_drag_delta(0)
24+ , _launcher_drag_delta_max(0)
25+ , _launcher_drag_delta_min(0)
26 , _enter_y(0)
27 , _last_button_press(0)
28 , _drag_out_id(0)
29@@ -1071,22 +1071,22 @@
30
31 // logically dnd exit only restores to the clamped ranges
32 // hover_progress restores to 0
33- float max = 0.0f;
34- float min = MIN(0.0f, launcher_height - sum);
35+ _launcher_drag_delta_max = 0.0f;
36+ _launcher_drag_delta_min = MIN(0.0f, launcher_height - sum);
37
38- if (_launcher_drag_delta > max)
39- delta_y = max + DragLimiter(delta_y - max);
40- else if (_launcher_drag_delta < min)
41- delta_y = min + DragLimiter(delta_y - min);
42+ if (_launcher_drag_delta > _launcher_drag_delta_max)
43+ delta_y = _launcher_drag_delta_max + DragLimiter(delta_y - _launcher_drag_delta_max);
44+ else if (_launcher_drag_delta < _launcher_drag_delta_min)
45+ delta_y = _launcher_drag_delta_min + DragLimiter(delta_y - _launcher_drag_delta_min);
46
47 if (GetActionState() != ACTION_DRAG_LAUNCHER)
48 {
49 float dnd_progress = DnDExitProgress(current);
50
51- if (_launcher_drag_delta > max)
52- delta_y = max + (delta_y - max) * dnd_progress;
53- else if (_launcher_drag_delta < min)
54- delta_y = min + (delta_y - min) * dnd_progress;
55+ if (_launcher_drag_delta > _launcher_drag_delta_max)
56+ delta_y = _launcher_drag_delta_max + (delta_y - _launcher_drag_delta_max) * dnd_progress;
57+ else if (_launcher_drag_delta < _launcher_drag_delta_min)
58+ delta_y = _launcher_drag_delta_min + (delta_y - _launcher_drag_delta_min) * dnd_progress;
59
60 if (dnd_progress == 0.0f)
61 _launcher_drag_delta = (int) delta_y;
62@@ -1095,9 +1095,6 @@
63 delta_y *= hover_progress;
64 center.y += delta_y;
65 folding_threshold += delta_y;
66-
67- _scroll_limit_reached = (delta_y == _last_delta_y);
68- _last_delta_y = delta_y;
69 }
70 else
71 {
72@@ -1589,26 +1586,25 @@
73 {
74 bool continue_animation = true;
75
76- //
77- // Always check _scroll_limit_reached to ensure we don't keep spinning
78- // this timer if the mouse happens to be left idle over one of the autoscroll
79- // hotspots on the launcher.
80- //
81- if (IsInKeyNavMode() || !_hovered || _scroll_limit_reached ||
82+ if (IsInKeyNavMode() || !_hovered ||
83 GetActionState() == ACTION_DRAG_LAUNCHER)
84 {
85 continue_animation = false;
86 }
87 else if (MouseOverTopScrollArea())
88 {
89- if (MouseOverTopScrollExtrema())
90+ if (_launcher_drag_delta >= _launcher_drag_delta_max)
91+ continue_animation = false;
92+ else if (MouseOverTopScrollExtrema())
93 _launcher_drag_delta += 6;
94 else
95 _launcher_drag_delta += 3;
96 }
97 else if (MouseOverBottomScrollArea())
98 {
99- if (MouseOverBottomScrollExtrema())
100+ if (_launcher_drag_delta <= _launcher_drag_delta_min)
101+ continue_animation = false;
102+ else if (MouseOverBottomScrollExtrema())
103 _launcher_drag_delta -= 6;
104 else
105 _launcher_drag_delta -= 3;
106@@ -1622,10 +1618,6 @@
107 {
108 EnsureAnimation();
109 }
110- else
111- {
112- _scroll_limit_reached = false;
113- }
114
115 return continue_animation;
116 }
117
118=== modified file 'launcher/Launcher.h'
119--- launcher/Launcher.h 2012-07-12 19:01:51 +0000
120+++ launcher/Launcher.h 2012-07-16 08:13:38 +0000
121@@ -359,6 +359,8 @@
122 int _postreveal_mousemove_delta_x;
123 int _postreveal_mousemove_delta_y;
124 int _launcher_drag_delta;
125+ int _launcher_drag_delta_max;
126+ int _launcher_drag_delta_min;
127 int _enter_y;
128 int _last_button_press;
129 int _drag_out_id;
130
131=== modified file 'manual-tests/Launcher.txt'
132--- manual-tests/Launcher.txt 2012-07-10 15:51:59 +0000
133+++ manual-tests/Launcher.txt 2012-07-16 08:13:38 +0000
134@@ -623,3 +623,15 @@
135 Expected Results:
136 * All the valid drop icons should unfold during the drag and drop.
137
138+
139+Test launcher autoscrolls when holding an icon
140+----------------------------------------------
141+Setup:
142+ * Add icons to the laucnher so that some of them in the bottom are folded.
143+
144+Actions:
145+ * Drag a launcher icon of the top side of the launcher. Don't release the mouse.
146+ * Move the mouse at the bottom of the launcher.
147+
148+Expected Results:
149+ * The launcher should autoscroll so you can reach the trash icon.