[gnome-settings-daemon/gnome-3-6] keyboard: Prevent potential infinite loop



commit d5e7d85b5195a4f0012f7830627ec078b6dd1359
Author: Bastien Nocera <hadess hadess net>
Date:   Tue Nov 6 19:13:12 2012 +0100

    keyboard: Prevent potential infinite loop
    
    XKB would notify us in the same way if the lockedMods
    changed because of a programmatic, or a physical/human change.
    
    This causes us changing the Num-Lock state generating another
    event on top of the one we just processed, and might cause
    infinite loops and 100% CPU usage.
    
    Instead, we now only apply the settings:
    - on startup
    - when remember-num-lock is changed to true
    
    https://bugzilla.gnome.org/show_bug.cgi?id=679151

 plugins/keyboard/gsd-keyboard-manager.c |    7 ++++---
 1 files changed, 4 insertions(+), 3 deletions(-)
---
diff --git a/plugins/keyboard/gsd-keyboard-manager.c b/plugins/keyboard/gsd-keyboard-manager.c
index 71c34ad..eec525f 100644
--- a/plugins/keyboard/gsd-keyboard-manager.c
+++ b/plugins/keyboard/gsd-keyboard-manager.c
@@ -1309,10 +1309,11 @@ settings_changed (GSettings          *settings,
 	    g_strcmp0 (key, KEY_BELL_MODE) == 0) {
 		g_debug ("Bell setting '%s' changed, applying bell settings", key);
 		apply_bell (manager);
-	} else if (g_strcmp0 (key, KEY_REMEMBER_NUMLOCK_STATE) == 0 ||
-		 g_strcmp0 (key, KEY_NUMLOCK_STATE) == 0) {
-		g_debug ("Num-Lock state '%s' changed, applying num-lock state settings", key);
+	} else if (g_strcmp0 (key, KEY_REMEMBER_NUMLOCK_STATE) == 0) {
+		g_debug ("Remember Num-Lock state '%s' changed, applying num-lock settings", key);
 		apply_numlock (manager);
+	} else if (g_strcmp0 (key, KEY_NUMLOCK_STATE) == 0) {
+		g_debug ("Num-Lock state '%s' changed, will apply at next startup", key);
 	} else if (g_strcmp0 (key, KEY_REPEAT) == 0 ||
 		 g_strcmp0 (key, KEY_INTERVAL) == 0 ||
 		 g_strcmp0 (key, KEY_DELAY) == 0) {



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]