Re: Seeking advice and information
- From: zentara <zzmiloschxx gmail com>
- To: Duncan Ferguson <duncan_j_ferguson yahoo co uk>
- Cc: gtk-perl-list gnome org
- Subject: Re: Seeking advice and information
- Date: Tue, 5 Jul 2011 14:49:34 -0400
On Tue, 5 Jul 2011 17:38:49 +0100
Duncan Ferguson <duncan_j_ferguson yahoo co uk> wrote:
Hiya all,
I am the author of ClusterSSH, a cluster admin tool. In essence a terminal window is opened to a number of
remote machines and a console window - anything typed into the console is replicated to all the terminal
windows.
It works with some rather horrible hacks and I am considering moving away from Tk to Gtk2 and would like to
know if I can simplify how the replication is done.
At the moment, to get the replication done, i have these hoops to jump through
At program start
- start up a terminal window for each ssh connection and set 'allowSendEvents' to true
- run a piece of perl code to get the window ID before exec'ing ssh in the window with the correct params
to connect to the remote host
- grab the window ID of each of the windows and store it in the main program
When text is typed into the console
- grab the Tk event
- best attempts at converting the Tk event keypress event into an X window event
- send the X window event to each stored window ID
The problems I have include the mess for grabbing the window ID and then having to convert the Tk key event
into an X event to send on, and this event is not easily or reliably converted
I would much prefer to start up a number of Tk/Gtk2 windows with the terminal or shell embedded in them,
then when a key press event is received i just forward on to each window - then this avoids the X event
conversion which means the key pressed is actually the one put into each terminal and there isn't an issue
with the terminal window supporting allowSendEvents.
Is this possible with Gtk2? It certainly wasn't with Tk when i tried a similar approach there. I have yet
to write any Gtk2 code but looking at the docs there doesn't seem to be too much work to convert from Tk to
Gtk2, but I'd certainly like to work out the potentially best way to code from the start instead of the many
dead-ends I had with Tk until I had a working solution.
TIA
Duncs
You don't show any code, but any Tk script can be rewritten in Gtk2.
For some example code of how Gtk2 sockets work, see:
See http://perlmonks.org?node_id=662931 Simple threaded chat server
and http://perlmonks.org?node_id=663428 Gtk2 Interactive Chat client
0m,
zentara
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]