After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 686714 - No horizontal natural scrolling
No horizontal natural scrolling
Status: RESOLVED FIXED
Product: gnome-control-center
Classification: Core
Component: Mouse
3.6.x
Other Linux
: Normal normal
: ---
Assigned To: Control-Center Maintainers
Control-Center Maintainers
Depends on:
Blocks:
 
 
Reported: 2012-10-23 16:16 UTC by andrey
Modified: 2012-11-09 16:43 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
mouse: natural horizontal scroll fix (1.20 KB, patch)
2012-10-25 13:37 UTC, Ondrej Holy
rejected Details | Review
mouse: natural horizontal scroll fix (1.20 KB, patch)
2012-11-01 13:21 UTC, Ondrej Holy
accepted-commit_now Details | Review

Description andrey 2012-10-23 16:16:17 UTC
When I open "Mouse & Touchpad" settings and enable "Content sticks to fingers" it enable only vertical natural scrolling, not horizontal (It is really strange to scroll with different x_distance and y_distance ;) ).

~ →  xinput list-props 14 | grep "Scrolling Distance"
	Synaptics Scrolling Distance (294):	-77, 77
	Synaptics Circular Scrolling Distance (307):	0.100000
Comment 1 andrey 2012-10-23 16:17:39 UTC
Now I use this hack to fix scrolling: http://askubuntu.com/questions/203018/natural-scrolling-not-working-for-horizontal-scroll-how-to-fix-this

I maybe useful for users, while developer fix GNOME :).
Comment 2 Ondrej Holy 2012-10-25 13:37:17 UTC
Created attachment 227249 [details] [review]
mouse: natural horizontal scroll fix

I have been looking to this in meantime. Attached patch fix it for me, but I'm not sure if it's right, because I don't know why XGetDeviceProperty gives me gint64, when format is set to 32.
Comment 3 Bastien Nocera 2012-10-26 10:06:38 UTC
Review of attachment 227249 [details] [review]:

::: plugins/mouse/gsd-mouse-manager.c
@@ +1001,2 @@
         if (rc == Success && act_type == XA_INTEGER && act_format == 32 && nitems >= 2) {
+                ptr = (gint64 *) data;

This is almost certainly wrong, the data type is 32-bit (act_format).
Comment 4 Bastien Nocera 2012-10-26 10:13:34 UTC
I think there's 2 problems:
1) You should enable horizontal scrolling when enabling natural scrolling (not sure what to do when disabling it...)
2) You almost certainly want:
                 if (natural_scroll) {
                         ptr[0] = -abs(ptr[0]);
-                        ptr[1] = -abs(ptr[1]);
+                        ptr[1] = -abs(ptr[0]);
                 } else {
                         ptr[0] = abs(ptr[0]);
-                        ptr[1] = abs(ptr[1]);
+                        ptr[1] = abs(ptr[0]);
                 }
Comment 5 Ondrej Holy 2012-11-01 10:36:50 UTC
(In reply to comment #4)
> I think there's 2 problems:
> 1) You should enable horizontal scrolling when enabling natural scrolling (not
> sure what to do when disabling it...)

Yes, this can be another problem, but I'm not able to test it currently...

> 2) You almost certainly want:
>                  if (natural_scroll) {
>                          ptr[0] = -abs(ptr[0]);
> -                        ptr[1] = -abs(ptr[1]);
> +                        ptr[1] = -abs(ptr[0]);
>                  } else {
>                          ptr[0] = abs(ptr[0]);
> -                        ptr[1] = abs(ptr[1]);
> +                        ptr[1] = abs(ptr[0]);
>                  }

But the problem is that ptr[1] doesn't change horizontal value of "Scrolling Distance", the value is changed using ptr[2] or gint64 which is weird, because nitems == 2 and act_format == 32...
Comment 6 Ondrej Holy 2012-11-01 13:21:13 UTC
Created attachment 227799 [details] [review]
mouse: natural horizontal scroll fix

Finally I have found the answer in man pages:

"If the returned format is 32, the property data will be stored as an array of longs (which in a 64-bit application will be 64-bit values that are padded in the upper 4 bytes)."

So attached patch change value type to glong.
Comment 7 Bastien Nocera 2012-11-05 17:28:33 UTC
Review of attachment 227799 [details] [review]:

Please, for gnome-3-6 and master.

Could you please also review other uses?
Comment 8 Ondrej Holy 2012-11-08 09:45:54 UTC
(In reply to comment #7)
> Review of attachment 227799 [details] [review]:
> 
> Please, for gnome-3-6 and master.

I have done...

git fetch origin
git merge origin/master
git checkout gnome-3-6
git am 0001-mouse-natural-horizontal-scroll-fix.patch
git checkout master
git am 0001-mouse-natural-horizontal-scroll-fix.patch

...and it works correctly, so what is wrong?

> 
> Could you please also review other uses?

There aren't other uses of troubled format 32 in gsd-mouse-manager.c, or where should I review other uses?
Comment 9 Bastien Nocera 2012-11-08 10:05:41 UTC
(In reply to comment #8)
> (In reply to comment #7)
> > Review of attachment 227799 [details] [review] [details]:
> > 
> > Please, for gnome-3-6 and master.
> 
> I have done...
> 
> git fetch origin
> git merge origin/master
> git checkout gnome-3-6
> git am 0001-mouse-natural-horizontal-scroll-fix.patch
> git checkout master
> git am 0001-mouse-natural-horizontal-scroll-fix.patch
> 
> ...and it works correctly, so what is wrong?

That you haven't committed yet? I've set the flag. Obviously, you won't see that if you just read it through the web interface, which is a problem...

> > Could you please also review other uses?
> 
> There aren't other uses of troubled format 32 in gsd-mouse-manager.c, or where
> should I review other uses?

In gnome-settings-daemon as a whole.
Comment 10 Ondrej Holy 2012-11-09 11:56:38 UTC
(In reply to comment #9)
> (In reply to comment #8)
> > (In reply to comment #7)
> > > Review of attachment 227799 [details] [review] [details] [details]:
> > > Could you please also review other uses?
> > 
> > There aren't other uses of troubled format 32 in gsd-mouse-manager.c, or where
> > should I review other uses?
> 
> In gnome-settings-daemon as a whole.

I haven't found any other problematic occurrences in gnome-settings-daemon.
Comment 11 Bastien Nocera 2012-11-09 16:43:13 UTC
commit e4edbc4639c9c177e60c711a1af9d318e17925c3
Author: Ondrej Holy <oholy@redhat.com>
Date:   Thu Oct 25 15:30:24 2012 +0200

    mouse: natural horizontal scroll fix
    
    https://bugzilla.gnome.org/show_bug.cgi?id=686714