On Mon, 08 Apr 2013 20:17:31 -0700, Greg Ercolano <e...@seriss.com> wrote: > unsigned n; > XkbGetIndicatorState(d, XkbUseCoreKbd, &n); > caps_state = (n & 0x01) == 1;
That works perfectly, and even better, needs no timer. Test program below. Will this be fixed in a future release of FLTK? - Howard Rubin ====================== #include <FL/Fl.H> #include <FL/Fl_Window.H> #include <FL/Fl_Output.H> #include <FL/Fl_Secret_Input.H> #include <iostream> #include <X11/XKBlib.h> bool isCapsLock() { Display* d = XOpenDisplay(NULL); if (!d) return false; unsigned n; XkbGetIndicatorState(d, XkbUseCoreKbd, &n); return (n & 0x01) == 1; } class myWindow : public Fl_Window { public: myWindow(int x, int y, const char* l) : Fl_Window(x, y, l), pOutput(NULL) { } Fl_Output* pOutput; virtual int handle(int event) { static bool haveDoneOnce = false; if (!haveDoneOnce || (event== FL_SHORTCUT && Fl::event_key() == FL_Caps_Lock)) { haveDoneOnce = true; if (isCapsLock()) { pOutput->show(); } else { pOutput->hide(); } } return Fl_Window::handle(event); } }; int main(int argc, char* argv[]) { myWindow* win = new myWindow(300, 200, ""); new Fl_Secret_Input(20, 20, 100, 15, ""); win->pOutput = new Fl_Output(120, 50, 0, 15, "Caps Lock"); win->end(); win->show(); return Fl::run(); } _______________________________________________ fltk mailing list fltk@easysw.com http://lists.easysw.com/mailman/listinfo/fltk