summaryrefslogtreecommitdiffstats
path: root/kxkb/kcmmisc.cpp
diff options
context:
space:
mode:
authorTimothy Pearson <[email protected]>2012-01-10 15:25:57 -0600
committerTimothy Pearson <[email protected]>2012-01-10 15:25:57 -0600
commit45fb5561be6e828c78180c781f74d0ae9d1c3ea4 (patch)
treeeeb055a813e58ec2d68ae00d8bf19e076b52bff3 /kxkb/kcmmisc.cpp
parentd6707f9679373588ae165f19d97d94580a8501fe (diff)
downloadtdebase-45fb5561be6e828c78180c781f74d0ae9d1c3ea4.tar.gz
tdebase-45fb5561be6e828c78180c781f74d0ae9d1c3ea4.zip
Enable xtest support flag
Diffstat (limited to 'kxkb/kcmmisc.cpp')
-rw-r--r--kxkb/kcmmisc.cpp22
1 files changed, 22 insertions, 0 deletions
diff --git a/kxkb/kcmmisc.cpp b/kxkb/kcmmisc.cpp
index b4c18a483..8850d8906 100644
--- a/kxkb/kcmmisc.cpp
+++ b/kxkb/kcmmisc.cpp
@@ -344,6 +344,21 @@ int xkb_set_off()
return 1;
}
+int xkb_state()
+ {
+ unsigned int mask;
+ unsigned int numlockState;
+ XkbStateRec xkbState;
+ if( !xkb_init())
+ return 0;
+ mask = xkb_numlock_mask();
+ if( mask == 0 )
+ return 0;
+ XkbGetState( dpy, XkbUseCoreKbd, &xkbState);
+ numlockState = xkbState.locked_mods & mask;
+ return numlockState;
+ }
+
int xkb_toggle()
{
unsigned int mask;
@@ -443,7 +458,14 @@ void numlock_toggle()
return;
#endif
#ifdef HAVE_XTEST
+#ifdef HAVE_XKB
+ if (xkb_state())
+ xtest_set_on();
+ else
+ xtest_set_off();
+#else // HAVE_XKB
xtest_toggle();
+#endif // HAVE_XKB
#endif
}
// This code is taken from xset utility from XFree 4.3 (http://www.xfree86.org/)