~ctwm/ctwm/trunk

« back to all changes in this revision

Viewing changes to util.c

  • Committer: Richard Levitte
  • Author(s): Claude Lecommandeur
  • Date: 2003-02-02 16:57:07 UTC
  • Revision ID: richard@levitte.org-20030202165707-iui8wsl36rsoqwpf
Tags: ctwm-1.2
CTWM version 1.2

Monotone-Parent: b3c7582e14387de7b1a24f0c48c00e8c1f9fbe52
Monotone-Revision: c2a6cbc82eb21a8c0e88685c2b2d50136fe1d772

Show diffs side-by-side

added added

removed removed

Lines of Context:
401
401
}
402
402
 
403
403
 
 
404
#if defined (XPM)
 
405
XpmIcon *GetXpmPixmap (name)
 
406
char *name;
 
407
{
 
408
    char fullPath [1024];
 
409
    int  status;
 
410
    XpmIcon *ret;
 
411
 
 
412
    if (Scr->XPMIconDirectory) {
 
413
        sprintf (fullPath, "%s/%s", Scr->XPMIconDirectory, name);
 
414
        ret = (XpmIcon*) malloc (sizeof (XpmIcon));
 
415
        if (ret == NULL) {
 
416
            ret = None;
 
417
            goto finish;
 
418
        }
 
419
        ret->attributes.valuemask  = 0;
 
420
        ret->attributes.valuemask |= XpmSize;
 
421
        ret->attributes.valuemask |= XpmReturnPixels;
 
422
        status = XpmReadFileToPixmap(dpy, Scr->Root, fullPath,
 
423
                                          &(ret->pixmap), &(ret->mask), &(ret->attributes));
 
424
        switch (status) {
 
425
            case XpmSuccess:
 
426
                break;
 
427
            case XpmColorError:
 
428
                fprintf (stderr, "Could not parse or alloc requested color : %s\n", fullPath);
 
429
                free (ret);
 
430
                ret = None;
 
431
                break;
 
432
            case XpmOpenFailed:
 
433
                fprintf (stderr, "Cannot open XPM file : %s\n", fullPath);
 
434
                ret = None;
 
435
                free (ret);
 
436
                break;
 
437
            case XpmFileInvalid:
 
438
                fprintf (stderr, "invalid XPM file : %s\n", fullPath);
 
439
                free (ret);
 
440
                ret = None;
 
441
                break;
 
442
            case XpmNoMemory:
 
443
                fprintf (stderr, "Not enough memory for XPM file : %s\n", fullPath);
 
444
                free (ret);
 
445
                ret = None;
 
446
                break;
 
447
            case XpmColorFailed:
 
448
                fprintf (stderr, "Color not found in : %s\n", fullPath);
 
449
                free (ret);
 
450
                ret = None;
 
451
                break;
 
452
            default :
 
453
                fprintf (stderr, "Unknown error in : %s\n", fullPath);
 
454
                free (ret);
 
455
                ret = None;
 
456
                break;
 
457
        }
 
458
 
 
459
    }
 
460
    else {
 
461
        ret = None;
 
462
    }
 
463
finish:
 
464
    return (ret);
 
465
}
 
466
#endif
 
467
 
404
468
InsertRGBColormap (a, maps, nmaps, replace)
405
469
    Atom a;
406
470
    XStandardColormap *maps;