in reply to Gtk2 X11 GrabKey

but it's OK for C, and not OK for perl.

Why not?

You can always setup a timer (say 30ms) and check