Branch: r14.0.x

5aa7540f 2015-09-19 19:21:28 Timothy Pearson
Terminate keyboard LED sync daemon when Xorg server goes down
This resolves a bug where the number of running daemons would increase on every new X reservation, eventually consuming all available VTs
(cherry picked from commit 5351547aede0aef696099c10305c20d6b5d09ac0)
M tdekbdledsync/main.cpp
diff --git a/tdekbdledsync/main.cpp b/tdekbdledsync/main.cpp
index a439ebd..ccbb66b 100644
--- a/tdekbdledsync/main.cpp
+++ b/tdekbdledsync/main.cpp
@@ -440,6 +440,11 @@
 						}
 					}
 				}
+				else {
+					// Ensure the X server is still alive
+					// If the X server has terminated, this will fail and the program will terminate
+					XSync(display, False);
+				}
 
 				// Check the hotplug monitoring process to see if any keyboards were added or removed
 				fd_set readfds;
ab88cb07 2015-09-19 19:21:38 Timothy Pearson
Remove unnecessary call to XkbGetIndicatorState
This relates to Bug 2445
(cherry picked from commit a486f914fca3650fb67948633948310571ab6c85)
M tdekbdledsync/main.cpp
diff --git a/tdekbdledsync/main.cpp b/tdekbdledsync/main.cpp
index ccbb66b..42bb6c9 100644
--- a/tdekbdledsync/main.cpp
+++ b/tdekbdledsync/main.cpp
@@ -404,13 +404,11 @@
 
 				if (x11_vt_num == vtstat.v_active) {
 					// Get Virtual Core keyboard status
-					if (XkbGetIndicatorState(display, XkbUseCoreKbd, &states) != Success) {
+					if (XkbGetState(display, XkbUseCoreKbd, &state) != Success) {
 						fprintf(stderr, "[tdekbdledsync] Unable to query X11 Virtual Core keyboard!\n");
 						releaseLock(lockfd, lockFileName);
 						return -7;
 					}
-
-					XkbGetState(display, XkbUseCoreKbd, &state);
 
 					caps_lock_set = (state.mods & caps_lock_mask);
 					num_lock_set = (state.mods & num_lock_mask);