X-Git-Url: https://git.brokenzipper.com/gitweb?a=blobdiff_plain;f=util%2Fbsetroot.cc;h=69dd8c4e7de28ef1eb62de5df1a2631d9f16bbe9;hb=83347770a6f3ebdeec85945a7e28246030f53571;hp=303323dff7e6f35b675808ee0616a49bcffb814a;hpb=c1bf229290194d5768a43f68b09ff0320848dc8e;p=chaz%2Fopenbox diff --git a/util/bsetroot.cc b/util/bsetroot.cc index 303323df..69dd8c4e 100644 --- a/util/bsetroot.cc +++ b/util/bsetroot.cc @@ -44,6 +44,8 @@ #include +I18n i18n("openbox.cat"); + bsetroot::bsetroot(int argc, char **argv, char *dpy_name) : BaseDisplay(argv[0], dpy_name) { @@ -99,9 +101,8 @@ bsetroot::bsetroot(int argc, char **argv, char *dpy_name) if ((mod + sol + grd) != True) { fprintf(stderr, - i18n->getMessage(bsetrootSet, bsetrootMustSpecify, - "%s: error: must specify one of: " - "-solid, -mod, -gradient\n"), + i18n(bsetrootSet, bsetrootMustSpecify, + "%s: error: must specify one of: -solid, -mod, -gradient\n"), getApplicationName()); usage(2); @@ -136,8 +137,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 +146,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(), @@ -337,7 +329,7 @@ void bsetroot::gradient(void) { void bsetroot::usage(int exit_code) { fprintf(stderr, - i18n->getMessage(bsetrootSet, bsetrootUsage, + i18n(bsetrootSet, bsetrootUsage, "%s 2.0\n\n" "Copyright (c) 1997-2000, 2002 Bradley T Hughes\n" "Copyright (c) 2001-2002 Sean 'Shaleh' Perry\n\n" @@ -358,15 +350,13 @@ void bsetroot::usage(int exit_code) { int main(int argc, char **argv) { char *display_name = (char *) 0; - NLSInit("openbox.cat"); - for (int i = 1; i < argc; i++) { if (! strcmp(argv[i], "-display")) { // check for -display option if ((++i) >= argc) { - fprintf(stderr, i18n->getMessage(mainSet, mainDISPLAYRequiresArg, - "error: '-display' requires an argument\n")); + fprintf(stderr, i18n(mainSet, mainDISPLAYRequiresArg, + "error: '-display' requires an argument\n")); ::exit(1); }