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

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.