[gnome-settings-daemon] a11y-keyboard: only update GSettings on user input
- From: Ryan Lortie <ryanl src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-settings-daemon] a11y-keyboard: only update GSettings on user input
- Date: Thu, 19 Jan 2012 16:37:11 +0000 (UTC)
commit 5e4dcfbe15a05e3e92945194e86792b659d57716
Author: Ryan Lortie <desrt desrt ca>
Date: Wed Jan 18 17:47:01 2012 -0500
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.
https://bugzilla.gnome.org/show_bug.cgi?id=668213
plugins/a11y-keyboard/gsd-a11y-keyboard-manager.c | 11 ++++++++++-
1 files changed, 10 insertions(+), 1 deletions(-)
---
diff --git a/plugins/a11y-keyboard/gsd-a11y-keyboard-manager.c b/plugins/a11y-keyboard/gsd-a11y-keyboard-manager.c
index fbe4d5b..939dcc2 100644
--- a/plugins/a11y-keyboard/gsd-a11y-keyboard-manager.c
+++ b/plugins/a11y-keyboard/gsd-a11y-keyboard-manager.c
@@ -894,8 +894,17 @@ cb_xkb_event_filter (GdkXEvent *xevent,
XEvent *xev = (XEvent *) xevent;
XkbEvent *xkbEv = (XkbEvent *) xevent;
+ /* 'event_type' is set to zero on notifying us of updates in
+ * response to client requests (including our own) and non-zero
+ * to notify us of key/mouse events causing changes (like
+ * pressing shift 5 times to enable sticky keys).
+ *
+ * We only want to update GSettings when it's in response to an
+ * explicit user input event, so require a non-zero event_type.
+ */
if (xev->xany.type == (manager->priv->xkbEventBase + XkbEventCode) &&
- xkbEv->any.xkb_type == XkbControlsNotify) {
+ xkbEv->any.xkb_type == XkbControlsNotify &&
+ xkbEv->ctrls.event_type != 0) {
g_debug ("XKB state changed");
set_gsettings_from_server (manager);
} else if (xev->xany.type == (manager->priv->xkbEventBase + XkbEventCode) &&
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]