From: Dana Jansens Date: Wed, 15 May 2002 10:14:45 +0000 (+0000) Subject: better setting of atoms. plugged memory leak. X-Git-Url: https://git.brokenzipper.com/gitweb?a=commitdiff_plain;h=788754fec3eb30dca567c047601d4c5791457c8c;p=chaz%2Fopenbox better setting of atoms. plugged memory leak. --- diff --git a/util/bsetroot.cc b/util/bsetroot.cc index 303323df..918a31fe 100644 --- a/util/bsetroot.cc +++ b/util/bsetroot.cc @@ -136,8 +136,6 @@ void bsetroot::setPixmapProperty(int screen, Pixmap pixmap) { int format; unsigned long length, after; unsigned char *data; - int mode = PropModeAppend; - int emode = PropModeAppend; const ScreenInfo *screen_info = getScreenInfo(screen); if (rootpmap_id == None) { @@ -147,29 +145,22 @@ void bsetroot::setPixmapProperty(int screen, Pixmap pixmap) { XGrabServer(getXDisplay()); - // Clear out the old pixmap? + // Clear out the old pixmap XGetWindowProperty(getXDisplay(), screen_info->getRootWindow(), - rootpmap_id, 0L, 1L, False, AnyPropertyType, + rootpmap_id, 0L, 1L, False, XA_PIXMAP, &type, &format, &length, &after, &data); - if ((type == XA_PIXMAP) && (format == 32) && (length == 1)) { + if (type == XA_PIXMAP && format == 32) { XKillClient(getXDisplay(), *((Pixmap *) data)); XSync(getXDisplay(), False); - mode = PropModeReplace; + XFree(data); } - // Clear out the old esetroot pixmap? - XGetWindowProperty(getXDisplay(), screen_info->getRootWindow(), - esetroot_id, 0L, 1L, False, AnyPropertyType, - &type, &format, &length, &after, &data); - if ((type == XA_PIXMAP) && (format == 32) && (length == 1)) - emode = PropModeReplace; - if (pixmap) { XChangeProperty(getXDisplay(), screen_info->getRootWindow(), - rootpmap_id, XA_PIXMAP, 32, mode, + rootpmap_id, XA_PIXMAP, 32, PropModeReplace, (unsigned char *) &pixmap, 1); XChangeProperty(getXDisplay(), screen_info->getRootWindow(), - esetroot_id, XA_PIXMAP, 32, emode, + esetroot_id, XA_PIXMAP, 32, PropModeReplace, (unsigned char *) &pixmap, 1); } else { XDeleteProperty(getXDisplay(), screen_info->getRootWindow(),