Wise monks,
I have a copy of perlpanel, a dead project aimed to make a lightweight replacement for gnome-panel or KDE's kicker. It has been discontinued due to some changes in gnome 2 libraries, that prevent perlpanel to display gnome's menus. This isn't a problem for me, so I'll give it a try.
It features a button that displays a menu, with the typical actions "Run program", "Close panel" and so on. Currently the button only works when clicked, and it doesn't seem to react upon any key press. I'd like to implement that. The button should act whether the panel has the focus or not.
My first try was with X11::Protocol. This test programs receives all keyboard events but, unfortunately, prevents the rest of the programs to get any keyboard event:
use warnings; use strict; use X11::Protocol; my $x = X11::Protocol->new; $x->event_handler ('queue'); $x->GrabKeyboard ($x->root, 0, 'Asynchronous', 'Asynchronous', 'Curren +tTime'); my $count = 0; while ($count++ < 30) { my %event = $x->next_event; my $name = $event{'name'}; if ('KeyPress' eq $name) { ## process event print "key pressed!\n"; } } $x->UngrabKeyboard ('CurrentTime');
The man page for XGrabKeyboard states it clearly: "Further key events are reported only to the grabbing client" but I see no mention to some mechanism to let the events pass through to the rest of running programs. How could I achieve the desired behaviour?
--
David Serrano
In reply to Grabbing keyboard in X11 by Hue-Bond
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |