GNOME Bugzilla – Bug 645666
Add the ability to deal with mouse wheel emulation
Last modified: 2015-04-10 11:24:23 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
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.
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.
Added mouse wheel emulation support to master, for GNOME 3.16.
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.
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.
(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.