[I presume that you mean XSetWindowBackgroundPixmap; there is no Xlib function named XSetBackgroundPixmap.]
James Buren wrote: > When using this Xlib function to set a new background pixmap, how does the > old one get > freed? If I am setting the root window's background pixmap, I don't know how > I can get the > XID of the old one. If it is a window I created, I can cache it but that > seems overkill if I'm > just wanting to discard the old one. Can someone direct me to how I am > supposed to free > the old background pixmap? Thanks. The manual page for XSetWindowBackgroundPixmap says: The XSetWindowBackgroundPixmap function sets the background pixmap of the window to the specified pixmap. The background pixmap can immediately be freed if no further explicit references to it are to be made. That seems to imply that the X server makes a copy of the pixmap data rather than keeping a reference to the original pixmap. However, I don't believe that's how the X.org server actually implements it. I've encountered code which uses a background pixmap to implement a persistent screen, and drawing to the pixmap then calling XClearWindow (without calling XSetWindowBackgroundPixmap in between) results in the updated pixmap contents appearing in the window. So it appears to use reference counting or similar. The combination of the documentation and the observed behaviour implies that the X server *may* copy the pixmap data or it may just keep a reference. Either way, deleting the pixmap after setting it should be fine, but modifying a pixmap which has been used as a background pixmap has undefined behaviour. Regardless of the implementation, there isn't any way to query the current background pixmap. The background_pixmap field in the XSetWindowAttributes structure used by XChangeWindowAttributes isn't present in the XWindowAttributes structure used by XGetWindowAttributes. -- Glynn Clements <gl...@gclements.plus.com> _______________________________________________ xorg@lists.x.org: X.Org support Archives: http://lists.freedesktop.org/archives/xorg Info: http://lists.x.org/mailman/listinfo/xorg Your subscription address: arch...@mail-archive.com