[comp.windows.x] managing pixmaps in the server?

charles%hplcyy@HPLABS.HP.COM (Charles Young) (05/16/89)

   X does a good job in sharing server resources such as colors and fonts.
However, it does not seem to share Pixmaps (which is a server resource)
well between clients.  

   Is there a way to assign a property to a Pixmap, such as its name, 
and query the server for the pixmap given the name.

   It would be really wonderful if ther server can keep track of how many
clients are using the pixmap and free the pixmap when all the clients are 
gone.

   In general, I think the philosophy should be that any precious server
resource should be sharable and well managed by the server. I tried using
XrmDatabase to manage the pixmaps and found out that there isn't any way
to remove any entry from the database. More than that,  I have to keep
track of client usage and free the pixmap when it is no longer useful.
Definitely not as convienent as using fonts or colors.

   Is there a way to manage pixmaps in the server?

Thanks for Any suggestions

Charles Young, (cyoung@hplabs.hp.com)

rws@EXPO.LCS.MIT.EDU (05/16/89)

    Is there a way to assign a property to a Pixmap, such as its name, 
    and query the server for the pixmap given the name.

Pixmaps do not have properties.

    Is there a way to manage pixmaps in the server?

There is no defined way, but I suppose where there's a will ...

pds@quintus.UUCP (Peter Schachte) (05/19/89)

In article <8905161459.AA02423@hplcyy.HPL.HP.COM> charles%hplcyy@HPLABS.HP.COM (Charles Young) writes:
>   Is there a way to assign a property to a Pixmap, such as its name, 
>and query the server for the pixmap given the name.

You could always store the pixmap as a property of your root window.
Your program could then get the appropriate property, and if it's not
there, create the appropriate pixmap and store it there.

>   It would be really wonderful if ther server can keep track of how many
>clients are using the pixmap and free the pixmap when all the clients are 
>gone.

You could probably fake this by having an integer property to go with
the pixmap property, and have each application that uses the pixmap
increment it when it starts using the pixmap, and decrement it when it's
through.  You'll probably want to grab the server while you get the old
count, increment it, and put it back, in order to avoid race conditions.
This, of course, won't handle a client that increments the count and
then dies without decrementing it.
-- 
-Peter Schachte
pds@quintus.uucp
...!sun!quintus!pds