Merge lp:~bilalakhtar/unity/launcher-scroll-speed-906072 into lp:unity

Proposed by Bilal Akhtar
Status: Merged
Approved by: Bilal Akhtar
Approved revision: no longer in the source branch.
Merged at revision: 2616
Proposed branch: lp:~bilalakhtar/unity/launcher-scroll-speed-906072
Merge into: lp:unity
Diff against target: 84 lines (+27/-4)
3 files modified
launcher/Launcher.cpp (+7/-2)
launcher/Launcher.h (+3/-1)
tests/test_launcher.cpp (+17/-1)
To merge this branch: bzr merge lp:~bilalakhtar/unity/launcher-scroll-speed-906072
Reviewer Review Type Date Requested Status
Andrea Azzarone (community) Approve
Review via email: mp+118407@code.launchpad.net

Commit message

Increases launcher scroll speed using mouse wheel by 2.5 times the original.

Description of the change

Increases launcher scroll speed using mouse wheel by 2.5 times the original. In the original bug report, John said "at least twice", and 2.5x seems good for me. Since everyone's tastes differ, I'm sure others might prefer 3x or 2x or something. Feel free to add your comments.

Bug #906072

To post a comment you must log in.
Revision history for this message
Marco Trevisan (Treviño) (3v1n0) wrote :

+1 for the change, could you add some unit-tests for it?

Revision history for this message
Bilal Akhtar (bilalakhtar) wrote :

I sure will, thanks Marco for the suggestion!

Revision history for this message
Andrea Azzarone (azzar1) wrote :

LGTM. BTW I'd prefer to use EmitMouseWheel.

review: Approve
Revision history for this message
Bilal Akhtar (bilalakhtar) wrote :

I've added unit tests now, the branch is ready for a re-review.

Revision history for this message
Andrea Azzarone (azzar1) wrote :

Ok approving again. Note that unit-test should not depend on global state (**launcher_->SetHover(true);***) but Launcher code is not test-friendly.

review: Approve
Revision history for this message
Unity Merger (unity-merger) wrote :

No commit message specified.

Revision history for this message
Omer Akram (om26er) wrote :

added commit message and status approved again.

Revision history for this message
Unity Merger (unity-merger) wrote :

Attempt to merge into lp:unity failed due to conflicts:

text conflict in tests/test_launcher.cpp

Revision history for this message
Bilal Akhtar (bilalakhtar) wrote :

Branch ready to be merged again. I've resolved the conflicts.

Revision history for this message
Unity Merger (unity-merger) wrote :

The Jenkins job https://jenkins.qa.ubuntu.com/job/automerge-unity/1110/console reported an error when processing this lp:~bilalakhtar/unity/launcher-scroll-speed-906072 branch.
Not merging it.

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-08-17 06:19:06 +0000
3+++ launcher/Launcher.cpp 2012-08-21 17:48:18 +0000
4@@ -2293,12 +2293,12 @@
5 if (wheel_delta < 0)
6 {
7 // scroll up
8- _launcher_drag_delta -= 10;
9+ _launcher_drag_delta -= 25;
10 }
11 else
12 {
13 // scroll down
14- _launcher_drag_delta += 10;
15+ _launcher_drag_delta += 25;
16 }
17
18 EnsureAnimation();
19@@ -2865,5 +2865,10 @@
20 return true;
21 }
22
23+int Launcher::GetDragDelta() const
24+{
25+ return _launcher_drag_delta;
26+}
27+
28 } // namespace launcher
29 } // namespace unity
30
31=== modified file 'launcher/Launcher.h'
32--- launcher/Launcher.h 2012-08-17 00:27:16 +0000
33+++ launcher/Launcher.h 2012-08-21 17:48:18 +0000
34@@ -115,6 +115,9 @@
35
36 void Resize();
37
38+ int GetDragDelta() const;
39+ void SetHover(bool hovered);
40+
41 sigc::signal<void, char*, AbstractLauncherIcon::Ptr> launcher_addrequest;
42 sigc::signal<void, AbstractLauncherIcon::Ptr> launcher_removerequest;
43 sigc::signal<void, AbstractLauncherIcon::Ptr> icon_animation_complete;
44@@ -246,7 +249,6 @@
45 float IconCenterTransitionProgress(AbstractLauncherIcon::Ptr icon, struct timespec const& current) const;
46 float IconVisibleProgress(AbstractLauncherIcon::Ptr icon, struct timespec const& current) const;
47
48- void SetHover(bool hovered);
49 void SetHidden(bool hidden);
50
51 void UpdateChangeInMousePosition(int delta_x, int delta_y);
52
53=== modified file 'tests/test_launcher.cpp'
54--- tests/test_launcher.cpp 2012-08-13 09:44:44 +0000
55+++ tests/test_launcher.cpp 2012-08-21 17:48:18 +0000
56@@ -109,6 +109,23 @@
57 EXPECT_TRUE(third->GetQuirk(launcher::AbstractLauncherIcon::Quirk::DESAT));
58 }
59
60+TEST_F(TestLauncher, TestMouseWheelScroll)
61+{
62+ int initial_scroll_delta;
63+
64+ launcher_->SetHover(true);
65+ initial_scroll_delta = launcher_->GetDragDelta();
66+
67+ // scroll down
68+ launcher_->RecvMouseWheel(0,0,20,0,0);
69+ EXPECT_EQ((launcher_->GetDragDelta() - initial_scroll_delta), 25);
70+
71+ // scroll up
72+ launcher_->RecvMouseWheel(0,0,-20,0,0);
73+ EXPECT_EQ(launcher_->GetDragDelta(), initial_scroll_delta);
74+
75+ launcher_->SetHover(false);
76+}
77
78 TEST_F(TestLauncher, TestIconBackgroundIntensity)
79 {
80@@ -139,4 +156,3 @@
81
82 }
83 }
84-