Merge lp:~evfool/pantheon-photos/lp1274815 into lp:~pantheon-photos/pantheon-photos/trunk

Proposed by Danielle Foré
Status: Merged
Approved by: Robert Roth
Approved revision: 2521
Merged at revision: 2525
Proposed branch: lp:~evfool/pantheon-photos/lp1274815
Merge into: lp:~pantheon-photos/pantheon-photos/trunk
Diff against target: 21 lines (+3/-5)
1 file modified
src/Page.vala (+3/-5)
To merge this branch: bzr merge lp:~evfool/pantheon-photos/lp1274815
Reviewer Review Type Date Requested Status
Corentin Noël Approve
Victor Martinez (community) Approve
Review via email: mp+221316@code.launchpad.net

This proposal supersedes a proposal from 2014-05-22.

Commit message

Handle the SMOOTH_SCROLL events to enable smooth scrolling.

As the per-direction mousewheel events have been propagated to subclasses, and the smooth scroll (since 3.4) can have multiple directions (see [1]), check the delta values and propagate for all directions (at most two, one vertical and one horizontal scroll).

[1] https://developer.gnome.org/gdk3/stable/gdk3-Event-Structures.html#GdkScrollDirection

Description of the change

Handle the SMOOTH_SCROLL events to enable smooth scrolling.

As the per-direction mousewheel events have been propagated to subclasses, and the smooth scroll (since 3.4) can have multiple directions (see [1]), check the delta values and propagate for all directions (at most two, one vertical and one horizontal scroll).

[1] https://developer.gnome.org/gdk3/stable/gdk3-Event-Structures.html#GdkScrollDirection

To post a comment you must log in.
Revision history for this message
Corentin Noël (tintou) wrote : Posted in a previous version of this proposal

Nice work, it's working as expected!

review: Approve
Revision history for this message
Victor Martinez (victored) wrote : Posted in a previous version of this proposal

I'd really love to see a second iteration of this patch. This wasn't ready for merging.

1. Coding style is inconsistent with the rest of the file. Notice the space after 'get_scroll_deltas' and the unnecessary split of 'on_mousewheel_left' and 'on_mousewheel_up' to a second line. This surely looks cool in the diff, but not when you read the code as part of the whole file.

2. This patch could be smaller. Notice how the variables 'horizontal' and 'vertical' are not needed. They could have been returned right away from within their respective 'if' clauses.

PLEASE DON'T RUSH REVIEWS!

review: Needs Fixing
Revision history for this message
Robert Roth (evfool) wrote : Posted in a previous version of this proposal

Thanks Victor for your review.
I agree with point 1, have fixed it, and pushed it, spaces after function names removed, unnecessary line split removed.

With point 2. though, I'm not sure I agree or I can follow you:
In my opinion we can't return from the if cases, as we have to make sure to execute both the horizontal and the vertical scrolling (this won't happen in case of a mouse, but happens in case of a laptop touchpad in cases where we have both horizontal and vertical scrollbar). If we would return from the first if clause, we would ignore the vertical movement.

Revision history for this message
Corentin Noël (tintou) wrote : Posted in a previous version of this proposal

I disagree with you Victor, new code should now follow the elementary code
style.
Le 29 mai 2014 08:24, "Robert Roth" <email address hidden> a écrit :

> Thanks Victor for your review.
> I agree with point 1, have fixed it, and pushed it, spaces after function
> names removed, unnecessary line split removed.
>
> With point 2. though, I'm not sure I agree or I can follow you:
> In my opinion we can't return from the if cases, as we have to make sure
> to execute both the horizontal and the vertical scrolling (this won't
> happen in case of a mouse, but happens in case of a laptop touchpad in
> cases where we have both horizontal and vertical scrollbar). If we would
> return from the first if clause, we would ignore the vertical movement.
> --
> https://code.launchpad.net/~evfool/pantheon-photos/lp1274815/+merge/220611
> You are reviewing the proposed merge of
> lp:~evfool/pantheon-photos/lp1274815 into lp:pantheon-photos.
>

Revision history for this message
Victor Martinez (victored) wrote :

This looks better Robert, I appreciate you took the time to make the corrections!

I personally hate arguing over coding style because there's much more intellectual value in how the code works and its logic than how it actually looks, and I'm a big fan of elementary's coding style (I use it consistently) so I can understand why Corentin and Daniel want to enforce it everywhere :)

But there's one thing most people in the software industry will agree with, and it's that MIXING coding styles produce messy and unprofessional-looking code.

We want to improve this project and its code quality (which is great already), not decrease it.

For that reason, we should mark any branch not following Shotwell's coding style as "Needs Fixing" for the very same reason we'd prevent a branch using Shotwell's coding style from being merged into Granite: code base consistency, we want the whole file to look as if it was written by the same person.

I hope this is seen as a constructive suggestion rather than as the thoughts of someone trying to alienate other developers. That's definitely not my intention.

review: Approve
Revision history for this message
Corentin Noël (tintou) wrote :

This kind of question should not prevent a branch of being merged.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/Page.vala'
2--- src/Page.vala 2014-05-24 23:00:56 +0000
3+++ src/Page.vala 2014-05-29 06:36:37 +0000
4@@ -1048,14 +1048,12 @@
5 double dx, dy;
6 bool vertical = false;
7 bool horizontal = false;
8- if (event.get_scroll_deltas (out dx, out dy)) {
9+ if (event.get_scroll_deltas(out dx, out dy)) {
10 if (dx != 0) {
11- horizontal = dx > 0 ? on_mousewheel_right (event)
12- : on_mousewheel_left (event);
13+ horizontal = dx > 0 ? on_mousewheel_right(event) : on_mousewheel_left(event);
14 }
15 if (dy != 0) {
16- vertical = dy > 0 ? on_mousewheel_down (event)
17- : on_mousewheel_up (event);
18+ vertical = dy > 0 ? on_mousewheel_down(event) : on_mousewheel_up(event);
19 }
20 return horizontal || vertical;
21 }

Subscribers

People subscribed via source and target branches

to all changes: