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 - 196) How can I have two applications communicate via the X server?

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


Top Document: comp.windows.x Frequently Asked Questions (FAQ) 7/7
Previous Document: 195) How can I ensure that only one instance of my application is running?
Next Document: 197) Where can I get information on internationalizing applications?
See reader questions & answers on this topic! - Help others by sharing your knowledge

The communication can take place via special property values; the two
applications can change the value of a property and each watch for changes to
it. If the communication is two-directional then two properties can be used.
The technique is appropriate for small messages which can be encoded easily.

It is expensive and unnecessary to communicate via properties on the root
window; a window owned by one of the applications is preferable.  There is a
problem, however, in communicating the window ID from one application to the
other.

The application owning the window can assert ownership of a specially-named
selection; the selection can be registered with the X Registry to ensure its
uniqueness. The second application loops, requesting the value of the
selection; the first application encodes the ID of its window and sends it.
The second application can then use XSelectInput() to get PropertyNotify
events on that window.

Thereafter, communication is via that window via XGetWindowProperty() and
XChangeProperty().

Watch also for the deletion of the property in order to disconnect properly;
one of the applications may have exited.

User Contributions:

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

CAPTCHA




Top Document: comp.windows.x Frequently Asked Questions (FAQ) 7/7
Previous Document: 195) How can I ensure that only one instance of my application is running?
Next Document: 197) Where can I get information on internationalizing applications?

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