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

Proposed by Andrea Azzarone
Status: Merged
Approved by: Marco Trevisan (Treviño)
Approved revision: no longer in the source branch.
Merged at revision: 2396
Proposed branch: lp:~azzar1/unity/fix-987223-5.0
Merge into: lp:unity/5.0
Diff against target: 175 lines (+46/-33)
3 files modified
manual-tests/Launcher.txt (+12/-0)
plugins/unityshell/src/Launcher.cpp (+32/-33)
plugins/unityshell/src/Launcher.h (+2/-0)
To merge this branch: bzr merge lp:~azzar1/unity/fix-987223-5.0
Reviewer Review Type Date Requested Status
Marco Trevisan (Treviño) Approve
Review via email: mp+118155@code.launchpad.net

Commit message

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.
Revision history for this message
Marco Trevisan (Treviño) (3v1n0) wrote :

+1

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'manual-tests/Launcher.txt'
--- manual-tests/Launcher.txt 2012-07-26 04:38:01 +0000
+++ manual-tests/Launcher.txt 2012-08-03 17:05:27 +0000
@@ -601,3 +601,15 @@
601Expected Results:601Expected Results:
602 * All the valid drop icons should unfold during the drag and drop.602 * All the valid drop icons should unfold during the drag and drop.
603603
604
605Test launcher autoscrolls when holding an icon
606----------------------------------------------
607Setup:
608 * Add icons to the laucnher so that some of them in the bottom are folded.
609
610Actions:
611 * Drag a launcher icon of the top side of the launcher. Don't release the mouse.
612 * Move the mouse at the bottom of the launcher.
613
614Expected Results:
615 * The launcher should autoscroll so you can reach the trash icon.
604616
=== modified file 'plugins/unityshell/src/Launcher.cpp'
--- plugins/unityshell/src/Launcher.cpp 2012-07-26 04:27:23 +0000
+++ plugins/unityshell/src/Launcher.cpp 2012-08-03 17:05:27 +0000
@@ -140,6 +140,8 @@
140Launcher::Launcher(nux::BaseWindow* parent,140Launcher::Launcher(nux::BaseWindow* parent,
141 NUX_FILE_LINE_DECL)141 NUX_FILE_LINE_DECL)
142 : View(NUX_FILE_LINE_PARAM)142 : View(NUX_FILE_LINE_PARAM)
143 , _launcher_drag_delta_max(0)
144 , _launcher_drag_delta_min(0)
143 , _model(0)145 , _model(0)
144 , _collection_window(NULL)146 , _collection_window(NULL)
145 , _background_color(nux::color::DimGray)147 , _background_color(nux::color::DimGray)
@@ -200,7 +202,6 @@
200 _folded_angle = 1.0f;202 _folded_angle = 1.0f;
201 _neg_folded_angle = -1.0f;203 _neg_folded_angle = -1.0f;
202 _space_between_icons = 5;204 _space_between_icons = 5;
203 _last_delta_y = 0.0f;
204 _folded_z_distance = 10.0f;205 _folded_z_distance = 10.0f;
205 _launcher_action_state = ACTION_NONE;206 _launcher_action_state = ACTION_NONE;
206 _icon_under_mouse = NULL;207 _icon_under_mouse = NULL;
@@ -225,7 +226,6 @@
225 _shortcuts_shown = false;226 _shortcuts_shown = false;
226 _hovered = false;227 _hovered = false;
227 _hidden = false;228 _hidden = false;
228 _scroll_limit_reached = false;
229 _render_drag_window = false;229 _render_drag_window = false;
230 _drag_edge_touching = false;230 _drag_edge_touching = false;
231 _steal_drag = false;231 _steal_drag = false;
@@ -1202,28 +1202,28 @@
1202 last_geo = box_geo;1202 last_geo = box_geo;
1203 _enter_y = 0;1203 _enter_y = 0;
12041204
1205 // logically dnd exit only restores to the clamped ranges
1206 // hover_progress restores to 0
1207 _launcher_drag_delta_max = 0.0f;
1208 _launcher_drag_delta_min = std::min(0.0f, launcher_height - sum);
1209
1205 if (hover_progress > 0.0f && _launcher_drag_delta != 0)1210 if (hover_progress > 0.0f && _launcher_drag_delta != 0)
1206 {1211 {
1207 float delta_y = _launcher_drag_delta;1212 float delta_y = _launcher_drag_delta;
12081213
1209 // logically dnd exit only restores to the clamped ranges1214 if (_launcher_drag_delta > _launcher_drag_delta_max)
1210 // hover_progress restores to 01215 delta_y = _launcher_drag_delta_max + DragLimiter(delta_y - _launcher_drag_delta_max);
1211 float max = 0.0f;1216 else if (_launcher_drag_delta < _launcher_drag_delta_min)
1212 float min = MIN(0.0f, launcher_height - sum);1217 delta_y = _launcher_drag_delta_min + DragLimiter(delta_y - _launcher_drag_delta_min);
1213
1214 if (_launcher_drag_delta > max)
1215 delta_y = max + DragLimiter(delta_y - max);
1216 else if (_launcher_drag_delta < min)
1217 delta_y = min + DragLimiter(delta_y - min);
12181218
1219 if (GetActionState() != ACTION_DRAG_LAUNCHER)1219 if (GetActionState() != ACTION_DRAG_LAUNCHER)
1220 {1220 {
1221 float dnd_progress = DnDExitProgress(current);1221 float dnd_progress = DnDExitProgress(current);
12221222
1223 if (_launcher_drag_delta > max)1223 if (_launcher_drag_delta > _launcher_drag_delta_max)
1224 delta_y = max + (delta_y - max) * dnd_progress;1224 delta_y = _launcher_drag_delta_max + (delta_y - _launcher_drag_delta_max) * dnd_progress;
1225 else if (_launcher_drag_delta < min)1225 else if (_launcher_drag_delta < _launcher_drag_delta_min)
1226 delta_y = min + (delta_y - min) * dnd_progress;1226 delta_y = _launcher_drag_delta_min + (delta_y - _launcher_drag_delta_min) * dnd_progress;
12271227
1228 if (dnd_progress == 0.0f)1228 if (dnd_progress == 0.0f)
1229 _launcher_drag_delta = (int) delta_y;1229 _launcher_drag_delta = (int) delta_y;
@@ -1232,9 +1232,6 @@
1232 delta_y *= hover_progress;1232 delta_y *= hover_progress;
1233 center.y += delta_y;1233 center.y += delta_y;
1234 folding_threshold += delta_y;1234 folding_threshold += delta_y;
1235
1236 _scroll_limit_reached = (delta_y == _last_delta_y);
1237 _last_delta_y = delta_y;
1238 }1235 }
1239 else1236 else
1240 {1237 {
@@ -1729,44 +1726,46 @@
1729gboolean Launcher::OnScrollTimeout(gpointer data)1726gboolean Launcher::OnScrollTimeout(gpointer data)
1730{1727{
1731 Launcher* self = (Launcher*) data;1728 Launcher* self = (Launcher*) data;
1732 nux::Geometry geo = self->GetGeometry();1729 gboolean continue_animation = TRUE;
1733 gboolean anim = TRUE;
17341730
1735 //
1736 // Always check _scroll_limit_reached to ensure we don't keep spinning
1737 // this timer if the mouse happens to be left idle over one of the autoscroll
1738 // hotspots on the launcher.
1739 //
1740 if (self->IsInKeyNavMode() || !self->_hovered ||1731 if (self->IsInKeyNavMode() || !self->_hovered ||
1741 self->_scroll_limit_reached ||
1742 self->GetActionState() == ACTION_DRAG_LAUNCHER)1732 self->GetActionState() == ACTION_DRAG_LAUNCHER)
1743 anim = FALSE;1733 {
1734 continue_animation = FALSE;
1735 }
1744 else if (self->MouseOverTopScrollArea())1736 else if (self->MouseOverTopScrollArea())
1745 {1737 {
1746 if (self->MouseOverTopScrollExtrema())1738 if (self->_launcher_drag_delta >= self->_launcher_drag_delta_max)
1739 continue_animation = FALSE;
1740 else if (self->MouseOverTopScrollExtrema())
1747 self->_launcher_drag_delta += 6;1741 self->_launcher_drag_delta += 6;
1748 else1742 else
1749 self->_launcher_drag_delta += 3;1743 self->_launcher_drag_delta += 3;
1750 }1744 }
1751 else if (self->MouseOverBottomScrollArea())1745 else if (self->MouseOverBottomScrollArea())
1752 {1746 {
1753 if (self->MouseOverBottomScrollExtrema())1747 if (self->_launcher_drag_delta <= self->_launcher_drag_delta_min)
1748 continue_animation = FALSE;
1749 else if (self->MouseOverBottomScrollExtrema())
1754 self->_launcher_drag_delta -= 6;1750 self->_launcher_drag_delta -= 6;
1755 else1751 else
1756 self->_launcher_drag_delta -= 3;1752 self->_launcher_drag_delta -= 3;
1757 }1753 }
1758 else1754 else
1759 anim = FALSE;1755 {
1756 continue_animation = FALSE;
1757 }
17601758
1761 if (anim)1759 if (continue_animation != FALSE)
1760 {
1762 self->EnsureAnimation();1761 self->EnsureAnimation();
1762 }
1763 else1763 else
1764 {1764 {
1765 self->_autoscroll_handle = 0;1765 self->_autoscroll_handle = 0;
1766 self->_scroll_limit_reached = false;
1767 }1766 }
17681767
1769 return anim;1768 return continue_animation;
1770}1769}
17711770
1772void Launcher::EnsureScrollTimer()1771void Launcher::EnsureScrollTimer()
17731772
=== modified file 'plugins/unityshell/src/Launcher.h'
--- plugins/unityshell/src/Launcher.h 2012-07-26 04:27:23 +0000
+++ plugins/unityshell/src/Launcher.h 2012-08-03 17:05:27 +0000
@@ -359,6 +359,8 @@
359 int _postreveal_mousemove_delta_x;359 int _postreveal_mousemove_delta_x;
360 int _postreveal_mousemove_delta_y;360 int _postreveal_mousemove_delta_y;
361 int _launcher_drag_delta;361 int _launcher_drag_delta;
362 int _launcher_drag_delta_max;
363 int _launcher_drag_delta_min;
362 int _enter_y;364 int _enter_y;
363 int _last_button_press;365 int _last_button_press;
364 int _drag_out_id;366 int _drag_out_id;

Subscribers

People subscribed via source and target branches

to all changes: