Search the FAQ Archives

3 - A - B - C - D - E - F - G - H - I - J - K - L - M
N - O - P - Q - R - S - T - U - V - W - X - Y - Z
faqs.org - Internet FAQ Archives

comp.windows.x Frequently Asked Questions (FAQ) 7/7
Section - 185) Can I have two applications draw to the same window?

( Part1 - Part2 - Part3 - Part4 - Part5 - Part6 - Part7 - Single Page )
[ Usenet FAQs | Web FAQs | Documents | RFC Index | Schools ]


Top Document: comp.windows.x Frequently Asked Questions (FAQ) 7/7
Previous Document: 184) How do I check whether a window ID is valid?
Next Document: 186) Why can't my program work with tvtwm or swm?
See reader questions & answers on this topic! - Help others by sharing your knowledge

Yes. The X server assigns IDs to windows and other resources (actually, the
server assigns some bits, the client others), and any application that knows
the ID can manipulate the resource (almost any X server resource, except for
GCs and private color cells, can be shared).

The problem you face is how to disseminate the window ID to multiple
applications. A simple way to handle this (and which solves the problem of
the applications' running on different machines) is in the first application
to create a specially-named property on the root-window and put the window ID
into it. The second application then retrieves the property, whose name it
also knows, and then can draw whatever it wants into the window.

[Note: this scheme works if and only if there is only one instance of the
first application running, and the scheme is subject to the limitations
mentioned in the Question about using window IDs on remote displays.]

Note also that you will still need to coordinate any higher-level cooperation
among your applications; you may find the Synchronization extension in R6
useful for this.

Note also that two processes can share a window but should not try to use the
same server connection. If one process is a child of the other, it should
close down the connection to the server and open its own connection.

Note also that Display IDs and GC values describe addresses local to an
application and cannot be transmitted to another application; note also that
if you are using Xt you may not share widget IDs, which are local to the
client.

Note also that several clients may draw to a window but for particular X
events such as button-presses only one client can receive the event.

[mostly courtesy Phil Karlton (karlton@wpd.sgi.com) 6/90]

User Contributions:

Comment about this article, ask questions, or add new information about this topic:




Top Document: comp.windows.x Frequently Asked Questions (FAQ) 7/7
Previous Document: 184) How do I check whether a window ID is valid?
Next Document: 186) Why can't my program work with tvtwm or swm?

Part1 - Part2 - Part3 - Part4 - Part5 - Part6 - Part7 - Single Page

[ Usenet FAQs | Web FAQs | Documents | RFC Index ]

Send corrections/additions to the FAQ Maintainer:
faq%craft@uunet.uu.net (X FAQ maintenance address)





Last Update March 27 2014 @ 02:12 PM