vp01@GTE.COM (Vincent Phuah) (10/14/89)
Hi there, I am looking for suggestions on how to implement the following problem prefably using widgets and the X Intrinsics. Problem: How to implement an X client running on one workstation that is able to control, when required, the user-interface interactions of the same client running on another workstation and vice-versa. (Presumebly, the client is running locally on a workstation equipped with the X server). Let me clarify the problem with the following example. I want to build a simple X client which has two buttons labelled WA and WB and a scrollbar. (WA and WB represent workstation A and B respectively.) When the user on WA presses the WA button, he has control over the scrollbar, which means that if he slids the thumb of the scrollbar, the user on WB should "see" the same effect on WB's screen. User on WB can get control of the scrollbar by pressing the WB button. Remember that each workstation is running a copy of the same client. Thanks in advance. +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ * Vincent Phuah * * Software Technologies Dept. * * GTE Laboratories Email: vphuah@gte.com * * 40 Sylvan Road Tel: (617) 466-4130 * * Waltham, MA 02254 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
rlh2@ukc.ac.uk (R.L.Hesketh) (10/16/89)
In article <7639@bunny.GTE.COM> vp01@GTE.COM (Vincent Phuah) writes: >Hi there, hello >I am looking for suggestions on how to implement the following >problem prefably using widgets and the X Intrinsics. good man 8-} > >Problem: > > How to implement an X client running on one workstation > that is able to control, when required, the user-interface interactions of > the same client running on another workstation and vice-versa. There is a very good book which covers just this subject in a whole chapter on Inter-Client Communication. The book is the (now-famous?) X Window Systems Programming and Applications With Xt by Douglas Young, published by Prentice-Hall. Sorry I don't have my copy with me so I can't give the ISBN Essentially you could use a combination of Window Properties and XSendEvent() calls. You set up a "connection" between the two applications by setting a property on a window known to both applications, the root window will do. You could use two properties for each application one giving the Display and one giving the window id to send events to. This is described in much better terms in Doug's book .. I recommend you by a copy! Anyway, once each application knows the others display and the id. of the window, which would in this case be the scrollbar widget's window. They can send events to the others scrollbar by calling XSendEvent() with the other applications display and window id. Say WA has been pressed .. whenever the scrollbar of WA gets moved a copy of the event that caused the scrollbar to move will be sent to the other application, WB. The other application will get this event just like any other from the server .. the only difference is that this event has the "send_event" field set to true. The window and display ids. should be set to those of the window that the event is going to .. otherwise the toolkit will not be able to dispatch it properly. I have used this same approach to produce remote Xt{Set,Get}Values() calls that allow one program to change anothers resources ... the basis of an interactive resource editor. Hope that helps, Richard Richard Hesketh : rlh2@ukc.ac.uk ..!mcvax!ukc!rlh2 : @nsfnet-relay.ac.uk:rlh2@ukc.ac.uk --- Computing Lab., University of Kent at Canterbury, Canterbury, Kent, CT2 7NF, United Kingdom. Tel: (0227) 764000 ext. 3682