[lug] X11 Protocol, migrating windows to remote displays

Michael J. Hammel mjhammel at graphics-muse.org
Sun May 18 18:59:23 MDT 2003


On Sun, 2003-05-18 at 18:01, D. Stimits wrote:
> Does anyone here know the X11 protocol well enough to say how easy it 
> would be to write an app (or modify xterm/konsole/gnome-terminal) to 
> allow migrating an X11 terminal to a remote display *after* the app has 
> started? I have an integrated app that I want to run entirely on one 
> machine, but I want the multiple windows it produces to be able to 
> migrate to/from a remote display. If I set $DISPLAY ahead of time, the 
> entire app goes to the remote display; even if I wanted that, it would 
> not allow me to migrate the window back to the original machine at a 
> later time. I'd like to be able to take an ID from a visible window or 
> widget, and tell X11 to redisplay on some other machine.

The easiest way to do this would be to have the first app fork a child
that displays on the remote system and has its own event processing loop
and then use TCP or Unix sockets to send data to the child for display
on the remote monitor.  

If you don't want a forked child, you can connect to different remote X
servers using the XOpenDisplay() call of Xlib.  GDK 1.2 does not allow
you to do this (haven't checked 2.x yet) so you'd have to do it directly
from Xlib and fake gdk into doing the right thing. I have no idea what
Qt can do in this area since I don't do C++.

I'd probably use the forked child method.  If the data needs to be real
time then you might not want this, but if you're doing real time display
you probably aren't mucking with remote terminals either.

-- 
Michael J. Hammel           |  Politicians are the same all over: they promise 
The Graphics Muse           |  to build a bridge even where there is no river.
mjhammel at graphics-muse.org  |  Nikita Khrushchev (1894-1971), Soviet premier. 
http://www.graphics-muse.com 



More information about the LUG mailing list