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 668213 - a11y-keyboard manager writes to GSettings on login
a11y-keyboard manager writes to GSettings on login
Status: RESOLVED FIXED
Product: gnome-settings-daemon
Classification: Core
Component: a11y-keyboard
unspecified
Other Linux
: Normal normal
: ---
Assigned To: gnome-settings-daemon-maint
gnome-settings-daemon-maint
Depends on:
Blocks:
 
 
Reported: 2012-01-18 20:42 UTC by Allison Karlitskaya (desrt)
Modified: 2012-06-25 12:43 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
a11y-keyboard: only update GSettings on user input (2.12 KB, patch)
2012-01-18 22:49 UTC, Allison Karlitskaya (desrt)
committed Details | Review

Description Allison Karlitskaya (desrt) 2012-01-18 20:42:08 UTC
The act of logging in to GNOME causes g-s-d to write a whole lot of stuff to GSettings.

This seems to happen from a function called set_gsettings_from_server in gsd-a11y-keyboard-manager.c.

GSettings should only be written to as a result of explicit user action.  It is definitely inappropriate to be storing transient information like this in it.
Comment 1 Allison Karlitskaya (desrt) 2012-01-18 21:34:55 UTC
On inspection, it appears that this schema is accessed by gnome-settings-daemon, gnome-control-center and gnome-shell (for the a11y icon).  It does not appear to be accessed by applications or ATs.

It's obvious that the shell and gnome-control-center have legit reasons for writing to these keys, but I can't imagine the settings daemon has any useful reason at all.
Comment 2 Allison Karlitskaya (desrt) 2012-01-18 21:53:03 UTC
Okay.  This code is useful for when the 'turn on accessibility features from the keyboard' feature is turned on and you do one of the special keystrokes (like holding down shift for 8 seconds) to enable the feature.

When this happens, the X server sends us a XkbControlsNotify.

It seems that we get XkbControlsNotify when one of these things has not happened, though.  In fact, we seem to get it when we setup the initial config for ourselves...

So now we have 3 options:

  1) Say that these keyboard-enabled accessibility modes are transient for
     the duration of the session and go back to the UI-selected settings at
     next login

  2) Reduce the severity of this problem by only running this function if
     the 'turn on from keyboard' option is set (which it is not, by default).

  3) Figure out a way to filter out the XkbControlsNotify messages that
     don't come in response to direct user input.
Comment 3 Allison Karlitskaya (desrt) 2012-01-18 21:54:29 UTC
unmentioned 4) do the sane thing and move the policy choices about enabling/disabling a11y settings out of the X server and into g-s-d...
Comment 4 Allison Karlitskaya (desrt) 2012-01-18 22:49:23 UTC
Created attachment 205588 [details] [review]
a11y-keyboard: only update GSettings on user input

X sends a message to us to tell us when the accessx settings are
changed.  They can change for two reasons: because a client (like
ourselves) has changed them or because the user did some keystroke (like
pressing shift 5 times to enable stickykeys).

We want to update GSettings in response to user requests, but prevent
spurious updates caused by the X server notifying us of the updates that
we just did for ourselves, so check that the update is actually caused
by user input.
Comment 5 Matthias Clasen 2012-01-19 16:29:01 UTC
Review of attachment 205588 [details] [review]:

Makes sense to me, fwiw
Comment 6 Bastien Nocera 2012-01-19 16:35:01 UTC
Review of attachment 205588 [details] [review]:

Looks good to me. Add to 3.2 if appropriate too.
Comment 7 Allison Karlitskaya (desrt) 2012-01-19 16:37:15 UTC
Attachment 205588 [details] pushed as 5e4dcfb - a11y-keyboard: only update GSettings on user input
Comment 8 Allison Karlitskaya (desrt) 2012-01-19 16:39:42 UTC
Pushed to gnome-3-2 as well.
Comment 9 Peter Hutterer 2012-06-20 05:45:00 UTC
This fix isn't quite correct. The server sets event_type for control notifies that are in direct reaction to a key event. SlowKeys is handled by a timer, and thus the event_type is always 0.
So with this commit we don't see the warning about slow keys turning on.

Suggested fix:
Expand the ctrls.event_type check to also check if the slow keys have changed. If so, then notify the user regardless.

if ((xkbEv->ctrls.changedControls & XkbControlsEnabledMask &&
     xkbEv->ctrls.enabledControlChanges & XbkSlowKeysMask) ||
    (xkbEv->ctrls.event_type != 0))
    ....
Comment 10 Allison Karlitskaya (desrt) 2012-06-21 03:46:03 UTC
Is there any way we could fix the X server to be more reasonable about this?  Even though slowkeys are based on a timer, it's a timer that's firing based on a particular keystroke...

There really ought to be some concrete way to tell the difference.
Comment 11 Peter Hutterer 2012-06-25 04:02:00 UTC
http://patchwork.freedesktop.org/patch/10795/
Comment 12 Allison Karlitskaya (desrt) 2012-06-25 12:43:46 UTC
Thanks so much Peter.  I was really not looking forward to having kludge this in GNOME, so this is great.