summaryrefslogtreecommitdiffstats
path: root/opensuse/core/tdebase/dont-always-start-kaccess.diff
blob: f50747274ca0fcdacad7f6029572f5626a2df894 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
Index: kcontrol/access/kcmaccess.cpp
===================================================================
--- kcontrol/access/kcmaccess.cpp.orig
+++ kcontrol/access/kcmaccess.cpp
@@ -103,10 +103,57 @@ void ExtendedIntNumInput::slotSliderValu
 
 static bool needToRunKAccessDaemon( KConfig *config )
 {
-	// We always start the KAccess Daemon, if it is not needed,
-	// it will terminate itself after configuring the AccessX
-	// features.
-	return true;
+     KConfigGroup bell( config, "Bell" );
+     
+     if (!bell.readBoolEntry("SystemBell", true))
+         return true;
+     if (bell.readBoolEntry("ArtsBell", false))
+         return true;
+     if (bell.readBoolEntry("VisibleBell", false))
+         return true;
+     
+   KConfigGroup keyboard( config, "Keyboard" );
+ 
+   if (keyboard.readBoolEntry("StickyKeys", false))
+         return true;
+   if (keyboard.readBoolEntry("SlowKeys", false))
+         return true;
+   if (keyboard.readBoolEntry("BounceKeys", false))
+         return true;
+   if (keyboard.readBoolEntry("Gestures", true))
+         return true;
+   // Find out whether the gestures are activated by default in the X configuration or not.
+   int major = XkbMajorVersion;
+   int minor = XkbMinorVersion;
+   if (XkbLibraryVersion(&major, &minor))
+     {
+     int opcode_rtrn;
+     int error_rtrn;
+     int xkb_opcode;
+     if (XkbQueryExtension(qt_xdisplay(), &opcode_rtrn, &xkb_opcode, &error_rtrn,
+ 			 &major, &minor))
+       {
+       if(XkbDescPtr xkbdesc = XkbGetMap(qt_xdisplay(), 0, XkbUseCoreKbd))
+         {
+         if(XkbGetControls(qt_xdisplay(), XkbAllControlsMask/*XkbAccessXKeysMask*/, xkbdesc ) == Success )
+           {
+           if(xkbdesc->ctrls->enabled_ctrls & XkbAccessXKeysMask)
+             {
+             XkbFreeClientMap(xkbdesc,0,True);
+             return true;
+             }
+           }
+         XkbFreeClientMap(xkbdesc,0,True);
+         }
+       }
+     }
+ 
+   KConfigGroup mouse( config, "Mouse" );
+   
+   if (mouse.readBoolEntry("MouseKeys", false))
+         return true;
+ 
+     return false; // don't need it
 }
 
 QString mouseKeysShortcut (Display *display) {