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 645666 - Add the ability to deal with mouse wheel emulation
Add the ability to deal with mouse wheel emulation
Status: RESOLVED FIXED
Product: gnome-settings-daemon
Classification: Core
Component: mouse
unspecified
Other Linux
: Normal normal
: ---
Assigned To: gnome-settings-daemon-maint
gnome-settings-daemon-maint
3.10
Depends on:
Blocks:
 
 
Reported: 2011-03-25 20:42 UTC by Josef Bacik
Modified: 2015-04-10 11:24 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Patch to add the functionality (7.20 KB, patch)
2011-03-25 20:42 UTC, Josef Bacik
needs-work Details | Review
Proposed behavior for scroll-wheel-emulation-button=0 (975 bytes, patch)
2015-04-10 10:58 UTC, Daniel Kao
none Details | Review

Description Josef Bacik 2011-03-25 20:42:25 UTC
Created attachment 184225 [details] [review]
Patch to add the functionality

I have one of these mouses

http://ecx.images-amazon.com/images/I/417FCRZRJ9L.jpg

So mouse wheel emulation is very handy for me, and I'm tired of having to put in xinput commands to make sure my mouse works the way I want it to.  This patch adds 2 keys, one for enabling the mouse wheel emulation and one for setting the proper mouse button for using the wheel emulation stuff.  I don't do userspace stuff normally so any feedback is welcome, I tried to follow the format and everything so hopefully it looks fine.  I've tested this patch in conjunction with a gnome-control-center patch to let me setup these settings and it all works great.  Thanks,

Josef
Comment 1 Bastien Nocera 2011-03-31 15:52:39 UTC
I would rather this was handled through the script infrastructure we have for pointer devices:
http://who-t.blogspot.com/2011/03/custom-input-device-configuration-in.html

And if we implemented that, it would be through trackball specific changes. See bug 637618.

So, no for now, and if we implement trackball specific changes, then we'd probably want to do it automatically.
Comment 2 Bastien Nocera 2011-05-04 13:15:48 UTC
Review of attachment 184225 [details] [review]:

2 things:
- follow the existing style for error handling (I cleaned this up recently)
- make sure that only trackballs ever have the functions called on them

You'll probably need to add a device_is_trackball to plugins/common/gsd-input-helper.c

::: data/org.gnome.settings-daemon.peripherals.gschema.xml.in.in
@@ +132,3 @@
       <_description>Enables middle mouse button emulation through simultaneous left and right button click.</_description>
     </key>
+    <key name="mouse-wheel-emulation" type="b">

This needs to move inside a trackball specific sub-schema, like the touchpad settings.

::: plugins/mouse/gsd-mouse-manager.c
@@ +598,3 @@
+        wheel_button = g_settings_get_int (settings, KEY_WHEEL_BUTTON);
+
+                gdk_error_trap_push ();

add rc = XGetDeviceProperty(...);

@@ +602,3 @@
+                            &nitems, &bytes_after, &data);
+
+                                       xdevice, prop, type, format, PropModeReplace, data, nitems);

Remove this.

@@ +607,3 @@
+        }
+
+        }

if (rc == Success && format etc.)

@@ +614,3 @@
+                                       xdevice, prop, type, format, PropModeReplace, data, nitems);
+
+        XCloseDevice (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), xdevice);

Remove.

@@ +617,3 @@
+        }
+
+

if (rc == Success)
   XFree (data);

if (gdk_error_trap_pop ())
  g_warning (...);

@@ +966,3 @@
         set_horiz_scroll (device, g_settings_get_boolean (manager->priv->touchpad_settings, KEY_PAD_HORIZ_SCROLL));
         set_touchpad_enabled (device, g_settings_get_boolean (manager->priv->touchpad_settings, KEY_TOUCHPAD_ENABLED));
+        set_wheel_emulation(manager, device, g_settings_get_boolean (manager->priv->mouse_settings, KEY_WHEEL_EMULATION));

Those need to only be called for trackballs.
Comment 3 Bastien Nocera 2014-10-26 14:24:07 UTC
Added mouse wheel emulation support to master, for GNOME 3.16.
Comment 4 Bastien Nocera 2014-10-26 14:50:45 UTC
On the Logitech Marble, I did:
gsettings set org.gnome.settings-daemon.peripherals.trackball scroll-wheel-emulation-button 8
to have the back button enable the scroll wheel.

More discussion about the UI in bug 637618, though it might be split from that.
Comment 5 Daniel Kao 2015-04-10 10:58:42 UTC
Created attachment 301267 [details] [review]
Proposed behavior for scroll-wheel-emulation-button=0

While the UI is still being discussed, would it be acceptable to skip device reconfiguration if scroll-wheel-emulation-button=0?
For example I use a Logitech Trackman Marble at home and a Kensington Expert Mouse at work. Because of the button layouts, button 9 is more comfortable for wheel emulation on the Logitech and button 8 on the Kensington.
These are already set up in xorg.conf based on MatchProduct, I really don't need g-s-d to disable my configuration then force me to choose a single button for wheel emulation.
Comment 6 Bastien Nocera 2015-04-10 11:24:23 UTC
(In reply to Daniel Kao from comment #5)
> Created attachment 301267 [details] [review] [review]
> Proposed behavior for scroll-wheel-emulation-button=0
> 
> While the UI is still being discussed, would it be acceptable to skip device
> reconfiguration if scroll-wheel-emulation-button=0?
> For example I use a Logitech Trackman Marble at home and a Kensington Expert
> Mouse at work. Because of the button layouts, button 9 is more comfortable
> for wheel emulation on the Logitech and button 8 on the Kensington.
> These are already set up in xorg.conf based on MatchProduct, I really don't
> need g-s-d to disable my configuration then force me to choose a single
> button for wheel emulation.

This bug is closed. Also note that the support code for this was moved to libinput, so the bug would need to be handled there.