X-Git-Url: https://git.librecmc.org/?a=blobdiff_plain;f=cde%2Fprograms%2Fdtstyle%2FBackdrop.c;h=2168a13a1d8b5f9df81bf220195035e6d7226a8e;hb=4f5e7fe5e3b8ef48be3b7129d0a4411c2a100170;hp=7beb4687272b18ed136c9a058d68873dc394167d;hpb=c742edcb2ff2c8d33d985eee7193ac232b671272;p=oweals%2Fcde.git diff --git a/cde/programs/dtstyle/Backdrop.c b/cde/programs/dtstyle/Backdrop.c index 7beb4687..2168a13a 100644 --- a/cde/programs/dtstyle/Backdrop.c +++ b/cde/programs/dtstyle/Backdrop.c @@ -16,7 +16,7 @@ * details. * * You should have received a copy of the GNU Lesser General Public - * License along with these librararies and programs; if not, write + * License along with these libraries and programs; if not, write * to the Free Software Foundation, Inc., 51 Franklin Street, Fifth * Floor, Boston, MA 02110-1301 USA */ @@ -45,6 +45,7 @@ #include #include #include +#include #if defined(_AIX) || defined(__apollo) #include @@ -593,10 +594,12 @@ static /* read the directory $HOME/.dt/backdrops */ string = (char *)XtMalloc(strlen(style.home) + strlen("/.dt/backdrops") + 1); - sprintf(string, "%s/.dt/backdrops", style.home); - ReadBitmapDirectory(string); if (string != NULL) + { + sprintf(string, "%s/.dt/backdrops", style.home); + ReadBitmapDirectory(string); XtFree(string); + } if (backdrops.tmpNumBitmaps == 0) { @@ -736,12 +739,20 @@ ReadBitmapDirectory( filep = readdir(dirp); continue; } - - /* strip suffix off filename */ name = (char *) XtMalloc(strlen(filep->d_name) + 1); strcpy (name, filep->d_name); - (void)strtok(name, "."); + + /* strip suffix off filename if it's a .pm or .bm + * motif requires other formats like jpg, png etc to + * have the extension on to work with the XmGetPixmap() calls */ + if(strlen(name) > 3 + && (0 == strcmp(name + strlen(name) - 3, ".pm") + || 0 == strcmp(name + strlen(name) - 3, ".bm"))) + { + (void)strtok(name, "."); + } + /* check for duplicates */ duplicate = 0; @@ -1235,7 +1246,9 @@ saveBackdrop( backdrops.selected); sprintf(bufr, "%s*backdropsDialog.selectedItem: %s\n", bufr, backdrops.bitmapNames[backdrops.selected]); - write (fd, bufr, strlen(bufr)); + if(-1 == write (fd, bufr, strlen(bufr))) { + perror(strerror(errno)); + } } }