[comp.windows.x] xloadimage -onroot

aw@cellar.bae.bellcore.com (Andrew Wason) (10/04/90)

When I do an xloadimage -onroot, how do I later free and get rid of
the pixmap on the root window?

I noticed xloadimage does an
   XSetCloseDownMode(dpy, RetainPermanent);
so that the pixmap will not be freed when it exits.

It also puts a property on the root window with the pixmap id.
"xprop -root" returns:
   XA_XLOADIMAGE_COLORS_XID(PIXMAP): pixmap id # 0x1500003

If I do an "xkill -id 0x1500003", will that free the pixmap?
The image remains on the root window after I do this.
Is it still using memory in the server?
If I do an "xsetroot -solid blue", the root window clears to blue,
but is the pixmap I previously loaded with xloadimage still
wasting memory?

Thanks,
Andrew

--------------------------------------------------------------------------------
Andrew Wason                                        Bell Communications Research
aw@cellar.bae.bellcore.com                          Piscataway, NJ
bellcore!cellar!aw

klute@heike.informatik.uni-dortmund.de (Rainer Klute) (10/04/90)

In article <27506@bellcore.bellcore.com>, aw@cellar.bae.bellcore.com
(Andrew Wason) writes:
|> When I do an xloadimage -onroot, how do I later free and get rid of
|> the pixmap on the root window?

xsetroot -default

--
  Dipl.-Inform. Rainer Klute      klute@irb.informatik.uni-dortmund.de
  Univ. Dortmund, IRB             klute@unido.uucp, klute@unido.bitnet
  Postfach 500500         |)|/    Tel.: +49 231 755-4663
D-4600 Dortmund 50        |\|\    Fax : +49 231 755-2386

jimf@SABER.COM (10/04/90)

|When I do an xloadimage -onroot, how do I later free and get rid of
|the pixmap on the root window?

The pixmap will be freed automatically when you load another one.  I'm
not sure if it gets freed if you set the background pixel, perhaps one
of the server internals people would know.

|I noticed xloadimage does an
|   XSetCloseDownMode(dpy, RetainPermanent);
|so that the pixmap will not be freed when it exits.
|
|It also puts a property on the root window with the pixmap id.
|"xprop -root" returns:
|   XA_XLOADIMAGE_COLORS_XID(PIXMAP): pixmap id # 0x1500003
|
|If I do an "xkill -id 0x1500003", will that free the pixmap?

It will free the colormap; the pixmap used for the property is a dummy
placeholder.  Doing this might confuse future runs of xloadimage
because the property will still be around although the ID will be
invalid.

The next patchlevel of xloadimage will address these problems, thanks
for bringing them up.

jim frost
saber software
jimf@saber.com

jimf@SABER.COM (10/04/90)

||> When I do an xloadimage -onroot, how do I later free and get rid of
||> the pixmap on the root window?
|
|xsetroot -default

This will *not* free colormap entries used by the pixmap.

jim frost
saber software
jimf@saber.com

cristy@eplrx7.uucp (John Cristy) (10/05/90)

In article <9010041412.AA02689@armory> you write:
>|When I do an xloadimage -onroot, how do I later free and get rid of
>|the pixmap on the root window?
>

I addressed this same problem with my X image utilities (ImageMagick).

To fix xloadimage, change in root.c

#define RETAIN_PROP_NAME "XA_XLOADIMAGE_COLORS_XID"

to

#define RETAIN_PROP_NAME "_XSETROOT_ID"

xsetroot will then properly free the pixmap resources of xloadimage.

cristy@dupont.com
--
The UUCP Mailer