Hi,

I managed to get global key press and release events using 
XGrabKey(display,keycode,0,rootwin,True, GrabModeAsync, GrabModeSyn);

It's a Qt application, which provides a function x11EventFilter(), where I 
get the x11 events.

It looks like this:

bool App::x11EventFilter(XEvent *e)
{
   if (e->type==KeyPress)
   {
      XAllowEvents(display, AsyncKeyboard, CurrentTime);
      XSync(display,true);
      XFlush(display);
      //do some things depending on the pressed key...
   }
   if (e->type==KeyRelease)
   {
      XAllowEvents(display, AsyncKeyboard, CurrentTime);
      XSync(display,true);
      XFlush(display);
      //do some things depending on the released key...
   }
}

I get all (at least I didn't notice if I missed some) KeyPress events, but I 
miss some KeyRelease events (I start some actions on KeyPress and stop them 
at KeyRelease, sometimes they don't stop when releasing the key, then I have 
to press and release it again).
Well, this is not nice, but not the real problem.
Sometimes (even depending on the box on which it runs, which should differ 
*only* in the speed of the cpu) the keyboards "freezes", i.e. I don't get any 
of these events anymore.

Any ideas what I do wrong or what is missing ?

Thanks
Alex


_______________________________________________
Xpert mailing list
[EMAIL PROTECTED]
http://XFree86.Org/mailman/listinfo/xpert

Reply via email to