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 747504 - do not disable touchpad buttons
do not disable touchpad buttons
Status: RESOLVED FIXED
Product: gnome-settings-daemon
Classification: Core
Component: mouse
unspecified
Other Linux
: Normal normal
: ---
Assigned To: Ondrej Holy
gnome-settings-daemon-maint
: 747502 749269 (view as bug list)
Depends on:
Blocks:
 
 
Reported: 2015-04-08 12:05 UTC by Ondrej Holy
Modified: 2016-04-30 00:15 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
mouse: do not disable touchpad buttons (3.19 KB, patch)
2015-04-08 12:05 UTC, Ondrej Holy
none Details | Review
mouse: Do not disable touchpad buttons (5.67 KB, patch)
2015-04-20 11:16 UTC, Ondrej Holy
none Details | Review
mouse: Do not disable touchpad buttons (9.78 KB, patch)
2015-04-22 11:22 UTC, Ondrej Holy
committed Details | Review
mouse: Do not disable touchpad buttons (gnome-3-14) (5.71 KB, patch)
2015-05-21 14:38 UTC, Ondrej Holy
none Details | Review
mouse: Do not disable touchpad buttons (gnome-3-14) (6.14 KB, patch)
2015-05-22 14:24 UTC, Ondrej Holy
committed Details | Review
mouse: Change disable while typing before state (2.13 KB, patch)
2016-04-29 17:12 UTC, João Paulo Rechi Vita
none Details | Review

Description Ondrej Holy 2015-04-08 12:05:47 UTC
Created attachment 301125 [details] [review]
mouse: do not disable touchpad buttons

Also touchpad buttons are disabled if touchpad is disabled using "Device Enabled" property. Unfortunately some touchpads share those buttons with trackpoint, which is consequently unusable. Disable touchpad using "Synaptics Off" property instead to avoid disabling the buttons.

This also fixes Bug 747502 which I've found during testing this patch.

It was originally reported downstream:
https://bugzilla.redhat.com/show_bug.cgi?id=1075190
Comment 1 Rui Matos 2015-04-17 16:44:19 UTC
Review of attachment 301125 [details] [review]:

This would break ensure_touchpad_active() because that function relies on get_disabled_devices() which asks X for a list of disabled devices and by disabling touchpads via this synaptics property would still make them enabled from X's point of view. So, ensure_touchpad_active() needs to be changed to determine that touchpads are disabled by looking at this synaptics property too.
Comment 2 Ondrej Holy 2015-04-20 11:16:19 UTC
Created attachment 301984 [details] [review]
mouse: Do not disable touchpad buttons

Thanks for the review! I've modified get_disabled_devices to return also devices with positive value of "Synaptics Off" property. This slightly reduces usability of the get_disabled_devices function, but the function is used only in ensure_touchpad_active currently...
Comment 3 Bastien Nocera 2015-04-20 12:02:12 UTC
Review of attachment 301984 [details] [review]:

Looks fine to me otherwise.

::: plugins/common/gsd-input-helper.c
@@ +583,3 @@
 get_disabled_devices (GdkDeviceManager *manager)
 {
+        GdkDisplay *display = gdk_display_get_default ();

Don't assign in the declaration please, do this at the top of the function.

@@ +610,3 @@
                 device = gdk_x11_device_manager_lookup (manager, device_info[i].id);
+                if (device != NULL) {
+                        prop = gdk_x11_get_xatom_by_name ("Synaptics Off");

You should do this outside the loop.
Comment 4 Rui Matos 2015-04-20 13:28:15 UTC
(In reply to Ondrej Holy from comment #2)
> Thanks for the review! I've modified get_disabled_devices to return also
> devices with positive value of "Synaptics Off" property. This slightly
> reduces usability of the get_disabled_devices function, but the function is
> used only in ensure_touchpad_active currently...

1. Since the function isn't used by anything else we should rename it (get_disabled_touchpads?) to make its purpose clear

2. Since we are not disabling touchpads at the X level anymore, it doesn't make sense to return disabled devices from this function. For instance if I disable a keyboard device with 'xinput disable <keyboard-device-id>' we would then try to enable it with the synaptics property which wouldn't obviously work.

Basically I think this should all be made specific to touchpads and rely solely on the synaptics prop.
Comment 5 Ondrej Holy 2015-04-20 16:34:32 UTC
Thanks for the reviews! I realized that the patch currently interfering with syndaemon, because syndaemon isn't terminated properly and use "Synaptics Off" property also... will fix it.

(In reply to Rui Matos from comment #4)
> (In reply to Ondrej Holy from comment #2)
> 2. Since we are not disabling touchpads at the X level anymore, it doesn't
> make sense to return disabled devices from this function. For instance if I
> disable a keyboard device with 'xinput disable <keyboard-device-id>' we
> would then try to enable it with the synaptics property which wouldn't
> obviously work.

I think we should list all the disabled devices also as we do before, but we should enable them also, so to call both set_device_enabled and set_touchpad_device_enabled. It will be useful for people who has disabled touchpad and update to g-s-d with this patch, otherwise they won't be able to enable their touchpad using g-s-d after the update... don't you think?

Also it would be still good to make patch also for g-c-c to show the disabled touchpad at the X level - Bug 747502.
Comment 6 Bastien Nocera 2015-04-21 12:57:14 UTC
Comment on attachment 301984 [details] [review]
mouse: Do not disable touchpad buttons

What Rui said.
Comment 7 Ondrej Holy 2015-04-22 11:22:37 UTC
Created attachment 302140 [details] [review]
mouse: Do not disable touchpad buttons

Comments applied. Also removed some redundant calls to enable/disable touchpad and syndaemon is terminated if the touchpads are disabled...
Comment 8 Rui Matos 2015-04-22 13:23:00 UTC
Review of attachment 302140 [details] [review]:

With these comments addressed, a-c-n

::: plugins/common/gsd-input-helper.c
@@ +601,2 @@
         for (i = 0; i < n_devices; i++) {
+                gdk_error_trap_push ();

The error trap push/pop should be done outside the loop

::: plugins/mouse/gsd-mouse-manager.c
@@ +552,3 @@
 set_disable_w_typing (GsdMouseManager *manager, gboolean state)
 {
+        if (state && touchpad_is_present () && get_touchpad_enabled (manager)) {

If you do what I suggest below this added check wouldn't be needed

@@ +1217,2 @@
         if (g_str_equal (key, KEY_SEND_EVENTS)) {
+                set_disable_w_typing (manager, TRUE);

We should move all the calls to set_disable_w_typing() into ensure_touchpad_active() instead since they are always called together.
Comment 9 Ondrej Holy 2015-04-23 07:15:53 UTC
Comment on attachment 302140 [details] [review]
mouse: Do not disable touchpad buttons

commit b23917f0a279aba4599cdc7a5b34055f3d8975ba
Comment 10 Ondrej Holy 2015-04-23 07:19:33 UTC
*** Bug 747502 has been marked as a duplicate of this bug. ***
Comment 11 Rui Matos 2015-05-12 15:51:44 UTC
*** Bug 749269 has been marked as a duplicate of this bug. ***
Comment 12 Ondrej Holy 2015-05-21 14:38:11 UTC
It would be nice to add fix also for gnome-3-14, unfortunately the patch isn't applicable on gnome-3-14, because the code was changed a lot (added _DISABLED_ON_EXTERNAL_MOUSE, missing _DISABLE_W_TYPING...). So reopening...
Comment 13 Ondrej Holy 2015-05-21 14:38:55 UTC
Created attachment 303764 [details] [review]
mouse: Do not disable touchpad buttons (gnome-3-14)

There is simplified patch for gnome-3-14.
Comment 14 Rui Matos 2015-05-22 12:41:53 UTC
Review of attachment 303764 [details] [review]:

otherwise looks fine

::: plugins/mouse/gsd-mouse-manager.c
@@ +1069,3 @@
+        if (g_str_equal (key, KEY_TOUCHPAD_ENABLED)) {
+                set_disable_w_typing (manager, g_settings_get_boolean (manager->priv->touchpad_settings, KEY_TOUCHPAD_DISABLE_W_TYPING));
+        }

no need for curly braces for a single statement

@@ -1234,3 @@
         ensure_touchpad_active (manager);
 
-        if (g_settings_get_boolean (manager->priv->touchpad_settings, KEY_TOUCHPAD_ENABLED)) {

we should still do this on initialization IMO, we just need to use the full device list instead of only the disabled ones
Comment 15 Rui Matos 2015-05-22 12:55:09 UTC
Review of attachment 303764 [details] [review]:

::: plugins/mouse/gsd-mouse-manager.c
@@ -1240,3 @@
-
-                        device_id = GPOINTER_TO_INT (l->data);
-                        set_touchpad_enabled (device_id);

now that I think about it, we should ensure that touchpads are enabled *or* disabled according to the setting on initialization.

this code here was just incomplete in that regard since it didn't ensure that touchpads were disabled if the setting said so
Comment 16 Ondrej Holy 2015-05-22 13:20:38 UTC
Thanks for review!

(In reply to Rui Matos from comment #14)
> @@ -1234,3 @@
>          ensure_touchpad_active (manager);
>  
> -        if (g_settings_get_boolean (manager->priv->touchpad_settings,
> KEY_TOUCHPAD_ENABLED)) {
> 
> we should still do this on initialization IMO, we just need to use the full
> device list instead of only the disabled ones

There is such loop few lines above...

(Removed loop was there before to enable disabled devices, because they are not returned from gdk_device_manager_list_devices in the above loop).

(In reply to Rui Matos from comment #15)
> Review of attachment 303764 [details] [review] [review]:
> 
> ::: plugins/mouse/gsd-mouse-manager.c
> @@ -1240,3 @@
> -
> -                        device_id = GPOINTER_TO_INT (l->data);
> -                        set_touchpad_enabled (device_id);
> 
> now that I think about it, we should ensure that touchpads are enabled *or*
> disabled according to the setting on initialization.
> 
> this code here was just incomplete in that regard since it didn't ensure
> that touchpads were disabled if the setting said so

...the above loop calls set_mouse_settings() and there is set_touchpad_disabled(). The touchpads are there just disabled, but the devices should be enabled by default, so it should be enough, do you agree?
Comment 17 Rui Matos 2015-05-22 13:53:05 UTC
(In reply to Ondrej Holy from comment #16)
> ...the above loop calls set_mouse_settings() and there is
> set_touchpad_disabled(). The touchpads are there just disabled, but the
> devices should be enabled by default, so it should be enough, do you agree?

No, I think we shouldn't rely on existing state in the X server and instead be explicit so that we don't end up in an inconsistent state where we think devices are enabled but in reality they aren't however unlikely that might be.
Comment 18 Ondrej Holy 2015-05-22 14:24:32 UTC
Created attachment 303824 [details] [review]
mouse: Do not disable touchpad buttons (gnome-3-14)

Ok, removed brackets and enable touchpads explicitly :-)
Comment 19 Rui Matos 2015-05-22 14:35:08 UTC
Review of attachment 303824 [details] [review]:

push it
Comment 20 Ondrej Holy 2015-05-22 14:54:01 UTC
Comment on attachment 303824 [details] [review]
mouse: Do not disable touchpad buttons (gnome-3-14)

commit 7a4c41dc709bab94f684efcfc04325797d432912
Comment 21 Ondrej Holy 2015-05-22 14:54:28 UTC
Thanks for review!
Comment 22 João Paulo Rechi Vita 2016-04-29 17:11:15 UTC
This change affects the "toggle touchpad" media key on the Lenovo Yoga 900. The keypress event is sent through the legacy keyboard device, and syndaemon interprets it as typing, so it changes the "Synaptics Off" property back to 0 after 1s (checked with xinput watch-props). Simply changing the order between changing the "disable while typing" setting and the "Synaptics Off" property makes syndaemon die earlier and not interfere with the "toggle touchpad" media key.

I'm attaching a patch that fixes the problem. I was developed on top of a slightly modified 3.18.3, but the changes there should not affect this. From the comments here this probably also affects the 3.14 and 3.16 branches, but it looks like this code was removed on 3.20.

Let me know if any extra info is needed.
Comment 23 João Paulo Rechi Vita 2016-04-29 17:12:14 UTC
Created attachment 327049 [details] [review]
mouse: Change disable while typing before state
Comment 24 Bastien Nocera 2016-04-29 17:18:24 UTC
(In reply to João Paulo Rechi Vita from comment #22)
> This change affects the "toggle touchpad" media key on the Lenovo Yoga 900.
> The keypress event is sent through the legacy keyboard device, and syndaemon
> interprets it as typing, so it changes the "Synaptics Off" property back to
> 0 after 1s (checked with xinput watch-props). Simply changing the order
> between changing the "disable while typing" setting and the "Synaptics Off"
> property makes syndaemon die earlier and not interfere with the "toggle
> touchpad" media key.
> 
> I'm attaching a patch that fixes the problem. I was developed on top of a
> slightly modified 3.18.3, but the changes there should not affect this. From
> the comments here this probably also affects the 3.14 and 3.16 branches, but
> it looks like this code was removed on 3.20.
> 
> Let me know if any extra info is needed.

That code doesn't exist anymore, the code above was only used if you didn't use the libinput Xorg driver. File a new bug if you're still interested in that, but it's likely not going to change.
Comment 25 João Paulo Rechi Vita 2016-04-29 19:29:14 UTC
I understand that it does not exist on master anymore, I just commented and attached a patch here because I thought you would be interested in picking this fix for the stable branches affected by this problem (we'll carry this downstrean at Endless anyway). If you are interested, I'm happy to file a separate bug (I guess you want the version to specify 3.18, right?). Please let me know, as your previous comment suggests the opposite. Also, I apologize if this was reported on the wrong place, I'm not very familiar with GNOME's contribution process.
Comment 26 Bastien Nocera 2016-04-30 00:15:21 UTC
(In reply to João Paulo Rechi Vita from comment #25)
> I understand that it does not exist on master anymore, I just commented and
> attached a patch here because I thought you would be interested in picking
> this fix for the stable branches affected by this problem (we'll carry this
> downstrean at Endless anyway).

I'd advise you to remove the synaptics driver and use the libinput Xorg driver instead. This is already what was recommended on Linux, and the synaptics code was only there for non-Linux platforms.

> If you are interested, I'm happy to file a
> separate bug (I guess you want the version to specify 3.18, right?). Please
> let me know, as your previous comment suggests the opposite. Also, I
> apologize if this was reported on the wrong place, I'm not very familiar
> with GNOME's contribution process.

We prefer separate bugs, especially in this case where the bug was already fixed for 3.14 and later.