Perl Tk and X11 events

Duncan Ferguson <[email protected]> Thu, 16 Jul 2009 16:29:27 +0100
Newsgroups gmane.comp.lang.perl.tk
Message-ID <[email protected]>
Hiya,

I am the author of ClusterSSH (http://clusterssh.sourceforge.net/)  
which is software that provides a console window that when typed in  
puts the text into a number of terminals.

This is currently based around Tk to provide the console X11::Protocol  
to send the key and paste events to each terminal.

The problem I have is that I currently need to translate the Tk::event  
structure into an X event to send onwards to each terminal and that  
conversion code is quite flakey.  Instead I would like to grab the  
event, modify it slightly and use the same event handlers to pass the  
event on, i.e. either

   Tk->bind key event
   check event and if appropriate
   modify event for target window
   Tk->eventGenerate

or instead use X windows event handlers end to end.

The problem I am having with the first method is I haven't yet found a  
way to grab the event and modify it and pass the structure onto  
eventGenerate - something like this

   my (%event) = $Tk::event;
   $event{win} = <new window id>
   $mw->eventGenerate(%event);

I cannot see how to get a hash out of $Tk::event (its all object  
methods and there isn't a $Tk::event->as_hash or similar that I can  
find) and eventGenerate isnt well enough documented to show if I can  
just pass the event hash onto it anyhow.

The problem I am having with the second method is that the X events  
are not being triggered at all so I am not picking up on key presses -  
I guess Tk is grabbing the events all to itself from key bindings I  
have on the menu bar.  I haven't yet looked to see if I can remove  
those Tk bindings to grab the events via X11 instead and then post the  
menus if the key sequence is used.

What method should I be using?  Translating from Tk to X11 events is  
losing too much data and proving to be too unreliable.

Thanks

   Duncs
--++**==--++**==--++**==--++**==--++**==--++**==--++**==
ptk mailing list
[email protected]
https://mailman.stanford.edu/mailman/listinfo/ptk