2016-12-27 16:09:31 +00:00
|
|
|
/*
|
2017-02-21 00:16:01 +00:00
|
|
|
This code is based upon some lines(actually two lines :-)
|
2016-12-27 16:09:31 +00:00
|
|
|
in E-Leds by Mathias Meisfjordskar<mathiasm@ifi.uio.no>
|
|
|
|
Released under GPL.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <stdio.h>
|
|
|
|
#include <X11/XKBlib.h>
|
2017-02-28 01:50:41 +00:00
|
|
|
#include <libdockapp/dockapp.h>
|
2016-12-27 16:09:31 +00:00
|
|
|
|
|
|
|
#include "include/kleds.h"
|
|
|
|
|
|
|
|
/*
|
|
|
|
Returns the turned on leds:
|
|
|
|
Bit 0 is Capslock
|
|
|
|
Bit 1 is Numlock
|
|
|
|
Bit 2 is Scrollock
|
|
|
|
*/
|
|
|
|
|
|
|
|
int check_kleds()
|
|
|
|
{
|
|
|
|
unsigned int states;
|
|
|
|
|
2017-02-28 01:50:41 +00:00
|
|
|
if (XkbGetIndicatorState(DADisplay, XkbUseCoreKbd, &states) != Success)
|
2016-12-27 16:09:31 +00:00
|
|
|
{
|
|
|
|
perror("Error while reading Indicator status\n");
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
return (states & 0x7);
|
|
|
|
}
|