[comp.windows.x] Does XGCFromGContext exist?

grunwald@foobar.colorado.edu (Dirk Grunwald) (10/31/90)

I know that function

	XGContextFromGC

exists, and, given a GC, I can get the 'gid'.

But I want the reverse mapping. One program passes a window id & 'gid'
to another program. That second program would like to use the window &
graphics context to paint in that window.

Any clues how to do this?

Dirk Grunwald -- Univ. of Colorado at Boulder	(grunwald@foobar.colorado.edu)
						(grunwald@boulder.colorado.edu)

rws@EXPO.LCS.MIT.EDU (Bob Scheifler) (10/31/90)

Xlib provides no support for sharing GCs across clients, sorry.

klee@wsl.dec.com (Ken Lee) (11/01/90)

In article <28982@boulder.Colorado.EDU>, grunwald@foobar.colorado.edu (Dirk Grunwald) writes:
|> I know that function
|> 
|> 	XGContextFromGC
|> 
|> exists, and, given a GC, I can get the 'gid'.
|> 
|> But I want the reverse mapping. One program passes a window id & 'gid'
|> to another program. That second program would like to use the window &
|> graphics context to paint in that window.


1.  A GC is an Xlib identifier, not an X server resource, and thus is
not useful outside the client that created it.

2.  A GContext (what you call 'gid') is an X server resource, so, in
theory, may be used by other clients of that server.  In practice,
however, most Xlib implementations cache GContexts to improve
performance, so sharing them between clients may not get you what you
expect.  You're probably best off passing the XCreateGC parameters
between your programs so they may each create their own GCs and GContexts.

-- 
Ken Lee
DEC Western Software Laboratory, Palo Alto, Calif.
Internet: klee@wsl.dec.com
uucp: uunet!decwrl!klee