[comp.windows.x] X routines running on child processes

tongz@MN.ECN.PURDUE.EDU (Tong Zheng) (07/28/90)

Here is a problem I met when I try to integrate a program
into X.  The program looks like this:

After the program starts, it generates two child processes,
first one does normal purpose of this program, the second one
runs X rountines to generate a graphical interface. They
communicate each via signal and pipe. Second process which 
runs X rountines keep updating the screen whenever it recieves
signal from the first process.  Then the parent(main) process
exists, leaves two child processes alive(running on background).
All communications work fine, the process contains X part 
is able to receive the signal from the first process and
to update the screen, e.g, change the XtNlabel for a label widget.
The problem is that all changes are not seen on the window
until I move the cursor to the window.

I am running R4 on a SUN4 and using twm.  Anyone has any idea
about why this happens? The process running X is self contained,
all widgets are Managed.

Any help is appreciated!!



---

| Zheng, Tong                  | major: Computer Science   |
|  - student programmer, Mechanical Eng., Purdue University|
| ARPA: tongz@mn.ecn.purdue.edu  BITNET: xdpc@puccvm.BITNET|
------------------------------------------------------------

rlh2@ukc.ac.uk (Richard Hesketh) (07/29/90)

In article <9007281621.AA07911@mn.ecn.purdue.edu> tongz@MN.ECN.PURDUE.EDU (Tong Zheng) writes:

> ...
>to update the screen, e.g, change the XtNlabel for a label widget.
>The problem is that all changes are not seen on the window
>until I move the cursor to the window.

I've seen this sort of problem before when using multiple event sources.
Try using XFlush() after you make the necessary screen changes.
This flushes any buffered requests off to the server which would then
generate any events (such as the expose caused by the set values) which
you will then be able to process.  I suspect this flushing is being done
for you by the window manager setting the input focus when you move
the cursor back in the window; well thats a guess anyway.