2 * CDE - Common Desktop Environment
4 * Copyright (c) 1993-2012, The Open Group. All rights reserved.
6 * These libraries and programs are free software; you can
7 * redistribute them and/or modify them under the terms of the GNU
8 * Lesser General Public License as published by the Free Software
9 * Foundation; either version 2 of the License, or (at your option)
12 * These libraries and programs are distributed in the hope that
13 * they will be useful, but WITHOUT ANY WARRANTY; without even the
14 * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
15 * PURPOSE. See the GNU Lesser General Public License for more
18 * You should have received a copy of the GNU Lesser General Public
19 * License along with these libraries and programs; if not, write
20 * to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
21 * Floor, Boston, MA 02110-1301 USA
24 * (c) Copyright 1989, 1990, 1991, 1992, 1993 OPEN SOFTWARE FOUNDATION, INC.
31 * (c) Copyright 1987, 1988, 1989, 1990 HEWLETT-PACKARD COMPANY */
39 #define MWM_NEED_IIMAGE
40 #include "WmIBitmap.h"
43 /* Copied from XmosI.h */
44 extern String _XmOSInitPath(
48 #include <Xm/IconFile.h>
49 #include <Dt/GetDispRes.h>
51 #define MATCH_XBM 'B' /* .xbm character: see XmGetPixmap */
52 #define MATCH_PATH "XBMLANGPATH"
55 * include extern functions
59 #include "WmGraphics.h"
60 #include "WmResource.h"
61 #include "WmResParse.h"
65 /******************************<->*************************************
67 * MakeClientIconPixmap (pCD, iconBitmap, iconMask)
72 * This function takes a client supplied icon image pixmap and mask
73 * bitmap and makes it into a colored pixmap suitable for use as an
79 * pCD = pointer to client data (icon colors and tiles)
81 * iconBitmap = icon bitmap
82 * iconMask = mask bitmap
87 * RETURN = icon pixmap (NULL if error)
89 ******************************<->***********************************/
91 Pixmap MakeClientIconPixmap (
99 unsigned int bitmapWidth;
100 unsigned int bitmapHeight;
106 * Check out the attributes of the bitmap to insure that it is usable.
109 if (!XGetGeometry (DISPLAY, iconBitmap, &root, &x, &y,
110 &bitmapWidth, &bitmapHeight, &border, &depth))
112 Warning (((char *)GETMESSAGE(38, 1, "Invalid icon bitmap")));
113 return ((Pixmap)NULL);
116 if (ROOT_FOR_CLIENT(pCD) != root)
119 * The bitmap was not made with usable parameters.
121 Warning (((char *)GETMESSAGE(38, 9, "Icon bitmap cannot be used on this screen")));
122 return ((Pixmap)NULL);
125 #ifdef DISALLOW_DEEP_ICONS
128 Warning (((char *)GETMESSAGE(38, 10, "Color icon pixmap not supported")));
129 return ((Pixmap)NULL);
134 * Color the bitmap, center it in a pixmap ....
137 return (MakeIconPixmap (pCD, iconBitmap, (Pixmap)iconMask,
138 bitmapWidth, bitmapHeight, depth));
141 } /* END OF FUNCTION MakeClientIconPixmap */
145 /*************************************<->*************************************
147 * MakeNamedIconPixmap (pCD, iconName)
152 * This function makes an icon pixmap for a particular client given the
153 * name of a bitmap file.
158 * pCD = (nonNULL) pointer to client data
159 * iconName = pointer to the icon name (bitmap file path name or NULL)
164 * RETURN = icon pixmap or NULL
166 *************************************<->***********************************/
168 Pixmap MakeNamedIconPixmap (ClientData *pCD, String iconName)
171 Pixmap pixmap, pixmap_r, mask;
174 unsigned int width, height, border_width, depth;
175 String sIconFileName;
179 * Get the bitmap cache entry (will read data from file if necessary).
180 * If unable to find the iconName file return NULL.
183 if ((bitmapIndex = GetBitmapIndex (PSD_FOR_CLIENT(pCD), iconName,
186 if ((PSD_FOR_CLIENT(pCD)->displayResolutionType == LOW_RES_DISPLAY) ||
187 (PSD_FOR_CLIENT(pCD)->displayResolutionType == VGA_RES_DISPLAY))
189 iconSizeDesired = XmMEDIUM_ICON_SIZE;
193 iconSizeDesired = XmLARGE_ICON_SIZE;
196 pixmap = XmUNSPECIFIED_PIXMAP;
198 sIconFileName = XmGetIconFileName(
199 XtScreen(PSD_FOR_CLIENT(pCD)->screenTopLevelW1),
205 if (sIconFileName != NULL)
207 pixmap = XmGetPixmap (
208 XtScreen (PSD_FOR_CLIENT(pCD)->screenTopLevelW1),
210 pCD->iconImageForeground,
211 pCD->iconImageBackground);
214 if (pixmap == XmUNSPECIFIED_PIXMAP)
216 pixmap = XmGetPixmap (
217 XtScreen (PSD_FOR_CLIENT(pCD)->screenTopLevelW1),
219 pCD->iconImageForeground,
220 pCD->iconImageBackground);
223 if (pixmap == XmUNSPECIFIED_PIXMAP)
225 MWarning (((char *)GETMESSAGE(38, 7, "Unable to read bitmap file %s\n")), iconName);
229 mask = XmeGetMask (XtScreen(PSD_FOR_CLIENT(pCD)->screenTopLevelW1),
230 (sIconFileName == NULL) ? iconName : sIconFileName);
231 if (mask == XmUNSPECIFIED_PIXMAP)
233 mask = (Pixmap) NULL;
236 if (sIconFileName != NULL)
237 XtFree(sIconFileName);
240 * We need to synchronize DISPLAY1 here because the pixmap and mask
241 * were created on that display connection, and we must ensure that
242 * the server has processed those requests before we attempt to use
243 * the pixmap and mask on DISPLAY. We thus assume that the
244 * subsequent XGetGeometry() call is successful.
246 XSync(DISPLAY1, False);
248 (void) XGetGeometry (DISPLAY, pixmap, &root, &x, &y, &width,
249 &height, &border_width, &depth);
251 pixmap_r = MakeIconPixmap (pCD, pixmap, mask,
252 width, height, depth);
254 XmDestroyPixmap (XtScreen (PSD_FOR_CLIENT(pCD)->screenTopLevelW1),
258 XtScreen (PSD_FOR_CLIENT(pCD)->screenTopLevelW1), mask);
263 if (sIconFileName != NULL)
264 XtFree (sIconFileName);
265 return ((Pixmap)NULL);
269 * Color the bitmap, center it in a pixmap ....
272 return (MakeCachedIconPixmap (pCD, bitmapIndex, (Pixmap)NULL));
274 } /* END OF FUNCTION MakeNamedIconPixmap */
279 /*************************************<->*************************************
282 * MakeCachedIconPixmap (pCD, bitmapIndex, mask)
287 * Convert the cached bitmap and mask into an icon pixmap.
292 * pCD - (nonNULL) pointer to client data (icon colors and tiles)
293 * bitmapIndex - bitmap cache index of image to be converted
294 * mask - bitmap mask, 1 for bits of "bitmap" to be kept
299 * RETURN - icon pixmap or NULL
304 * o "mask" is not used.
306 *************************************<->***********************************/
307 Pixmap MakeCachedIconPixmap (ClientData *pCD, int bitmapIndex, Pixmap mask)
309 BitmapCache *bitmapc;
310 PixmapCache *pixmapc;
311 Pixmap pixmap = (Pixmap)NULL;
312 WmScreenData *pSD = PSD_FOR_CLIENT(pCD);
316 return ((Pixmap)NULL);
318 bitmapc = &(pSD->bitmapCache[bitmapIndex]);
321 * Search for an icon pixmap matching the client icon colors.
324 pixmapc = bitmapc->pixmapCache;
327 if ((pixmapc->pixmapType == ICON_PIXMAP) &&
328 (pixmapc->foreground == pCD->iconImageForeground) &&
329 (pixmapc->background == pCD->iconImageBackground))
331 pixmap = pixmapc->pixmap;
334 pixmapc = pixmapc->next;
338 * If a matching pixmap was not found in the pixmap cache for this bitmap
339 * then create the icon pixmap with the appropriate colors.
340 * If have sufficient memory, save the pixmap info in the pixmapCache.
344 (pixmap = MakeIconPixmap (pCD, bitmapc->bitmap, mask,
345 bitmapc->width, bitmapc->height, 1)) &&
346 (pixmapc = (PixmapCache *) XtMalloc (sizeof (PixmapCache))))
349 pixmapc->pixmapType = ICON_PIXMAP;
350 pixmapc->foreground = pCD->iconImageForeground;
351 pixmapc->background = pCD->iconImageBackground;
352 pixmapc->pixmap = pixmap;
353 pixmapc->next = bitmapc->pixmapCache;
354 bitmapc->pixmapCache = pixmapc;
359 } /* END OF FUNCTION MakeCachedIconPixmap */
363 /*************************************<->*************************************
365 * MakeIconPixmap (pCD, bitmap, mask, width, height, depth)
370 * Convert the bitmap and mask into an icon pixmap.
375 * pCD - pointer to client data (icon colors and tiles)
376 * pWS - pointer to workspace data
377 * bitmap - bitmap image to be converted
378 * mask - bitmap mask, 1 for bits of "bitmap" to be kept
379 * width - pixel width of bitmap
380 * height - pixel height of bitmap
381 * depth - depth of bitmap (pixmap, really)
386 * RETURN - icon pixmap or NULL
391 * o "mask" is not used.
393 *************************************<->***********************************/
394 Pixmap MakeIconPixmap (ClientData *pCD, Pixmap bitmap, Pixmap mask, unsigned int width, unsigned int height, unsigned int depth)
397 GC imageGC, topGC, botGC;
399 unsigned long gc_mask;
400 XmPixelSet *pPS = NULL;
401 unsigned int imageWidth;
402 unsigned int imageHeight;
404 #ifndef NO_CLIP_CENTER
406 #endif /* NO_CLIP_CENTER */
409 static RList *top_rects = NULL;
410 static RList *bot_rects = NULL;
413 if ((top_rects == NULL) &&
414 (top_rects = AllocateRList
415 ((unsigned)2 * ICON_INTERNAL_SHADOW_WIDTH)) == NULL)
418 Warning (((char *)GETMESSAGE(38, 3, "Insufficient memory to bevel icon image")));
419 return ((Pixmap)NULL);
422 if ((bot_rects == NULL) &&
423 (bot_rects = AllocateRList
424 ((unsigned)2 * ICON_INTERNAL_SHADOW_WIDTH)) == NULL)
427 Warning (((char *)GETMESSAGE(38, 4, "Insufficient memory to bevel icon image")));
428 return ((Pixmap)NULL);
437 pSD = wmGD.pActiveSD;
440 /* don't make icon pixmap if bitmap is too small */
442 if ((width < pSD->iconImageMinimum.width) ||
443 (height < pSD->iconImageMinimum.height))
445 /* bitmap is too small */
446 return ((Pixmap)NULL);
448 #ifndef NO_CLIP_CENTER
450 /* copy the center of the icon if too big */
451 if (width > pSD->iconImageMaximum.width)
453 src_x = (width - pSD->iconImageMaximum.width)/2;
459 if (height > pSD->iconImageMaximum.height)
461 src_y = (height - pSD->iconImageMaximum.height)/2;
467 #endif /* NO_CLIP_CENTER */
470 * SLAB frameStyle adds a single pixel of background color around
471 * the image to set it off from the beveling.
473 imageWidth = pSD->iconImageMaximum.width +
474 2 * ICON_INTERNAL_SHADOW_WIDTH +
475 ((wmGD.frameStyle == WmSLAB) ? 2 : 0);
476 imageHeight = pSD->iconImageMaximum.height +
477 2 * ICON_INTERNAL_SHADOW_WIDTH +
478 ((wmGD.frameStyle == WmSLAB) ? 2 : 0);
480 /* create a pixmap (to be returned) */
482 iconPixmap = XCreatePixmap (DISPLAY, pSD->rootWindow,
483 imageWidth, imageHeight,
484 DefaultDepth(DISPLAY, pSD->screen));
487 * If a client is not specified use icon component colors, otherwise
488 * use the client-specific icon colors.
493 bg = pCD->iconImageBackground;
494 fg = pCD->iconImageForeground;
498 bg = pSD->iconAppearance.background;
499 fg = pSD->iconAppearance.foreground;
502 /* create a GC to use */
503 gc_mask = GCForeground | GCBackground | GCGraphicsExposures;
506 if (pSD->pPrimaryPixelSet != NULL)
508 pPS = pSD->pPrimaryPixelSet;
509 gcv.background = pPS->bg;
510 /* set fg to bg color to clear it first */
511 gcv.foreground = pPS->bg;
515 gcv.background = ICON_APPEARANCE(pCD).background;
516 /* set fg to bg color to clear it first */
517 gcv.foreground = ICON_APPEARANCE(pCD).background;
522 gcv.foreground = bg; /* clear it first! */
525 gcv.graphics_exposures = False;
527 imageGC = XCreateGC (DISPLAY, iconPixmap, gc_mask, &gcv);
533 /* fill in background */
535 XFillRectangle(DISPLAY, iconPixmap, imageGC, 0, 0,
536 imageWidth, imageHeight);
538 /* center the image */
540 if (width > pSD->iconImageMaximum.width)
542 width = pSD->iconImageMaximum.width;
544 if (height > pSD->iconImageMaximum.height)
546 height = pSD->iconImageMaximum.height;
548 /* center the image */
550 dest_x = (imageWidth - width) / 2;
551 dest_y = (imageHeight - height) / 2;
557 gcv.foreground = pPS->fg;
561 gcv.foreground = ICON_APPEARANCE(pCD).foreground;
568 gc_mask = GCForeground;
571 gcv.clip_mask = mask;
572 #ifndef NO_CLIP_CENTER
573 gcv.clip_x_origin = dest_x - src_x;
574 gcv.clip_y_origin = dest_y - src_y;
575 #else /* NO_CLIP_CENTER */
576 gcv.clip_x_origin = dest_x;
577 gcv.clip_y_origin = dest_y;
578 #endif /* NO_CLIP_CENTER */
579 gc_mask |= GCClipXOrigin | GCClipYOrigin | GCClipMask;
582 XChangeGC (DISPLAY, imageGC, gc_mask, &gcv);
584 /* copy the bitmap to the pixmap */
585 #ifndef DISALLOW_DEEP_ICONS
587 (depth == DefaultDepth(DISPLAY, pSD->screen)))
589 #ifndef NO_CLIP_CENTER
590 XCopyArea (DISPLAY, bitmap, iconPixmap, imageGC, src_x, src_y,
591 width, height, dest_x, dest_y);
592 #else /* NO_CLIP_CENTER */
593 XCopyArea (DISPLAY, bitmap, iconPixmap, imageGC, 0, 0,
594 width, height, dest_x, dest_y);
595 #endif /* NO_CLIP_CENTER */
598 #endif /* DISALLOW_DEEP_ICONS */
599 #ifndef NO_CLIP_CENTER
600 XCopyPlane (DISPLAY, bitmap, iconPixmap, imageGC, src_x, src_y, width,
601 height, dest_x, dest_y, 1L);
602 #else /* NO_CLIP_CENTER */
603 XCopyPlane (DISPLAY, bitmap, iconPixmap, imageGC, 0, 0, width, height,
605 #endif /* NO_CLIP_CENTER */
608 XFreeGC (DISPLAY, imageGC);
616 if (mask && (pPS != NULL))
618 topGC = GetHighlightGC (pSD, pPS->ts, pPS->bg,
619 pCD->iconImageTopShadowPixmap);
621 botGC = GetHighlightGC (pSD, pPS->bs, pPS->bg,
622 pCD->iconImageBottomShadowPixmap);
626 topGC = GetHighlightGC (pSD, pCD->iconImageTopShadowColor,
627 pCD->iconImageBackground,
628 pCD->iconImageTopShadowPixmap);
630 botGC = GetHighlightGC (pSD, pCD->iconImageBottomShadowColor,
631 pCD->iconImageBackground,
632 pCD->iconImageBottomShadowPixmap);
636 * CR5208 - Better fix than from OSF!
637 * Zero out the rectangle count in our
638 * static structures so that BevelRectangle
639 * won't extend the RList causing a memory leak.
640 * Old fix allocated and freed rectangle structure
643 top_rects->used = 0; /* reset count */
646 BevelRectangle (top_rects,
649 imageWidth, imageHeight,
650 ICON_INTERNAL_SHADOW_WIDTH,
651 ICON_INTERNAL_SHADOW_WIDTH,
652 ICON_INTERNAL_SHADOW_WIDTH,
653 ICON_INTERNAL_SHADOW_WIDTH);
655 XFillRectangles (DISPLAY, iconPixmap, topGC, top_rects->prect,
657 XFillRectangles (DISPLAY, iconPixmap, botGC, bot_rects->prect,
662 } /* END OF FUNCTION MakeIconPixmap */
666 /*************************************<->*************************************
669 * MakeCachedLabelPixmap (pSD, menuW, bitmapIndex)
674 * Creates and returns a label pixmap.
679 * pSD = pointer to screen data
680 * menuW = menu widget (for foreground and background colors)
681 * bitmapIndex = bitmap cache index
686 * Return = label pixmap or NULL.
691 * Assumes bitmapIndex is valid.
693 *************************************<->***********************************/
695 Pixmap MakeCachedLabelPixmap (WmScreenData *pSD, Widget menuW, int bitmapIndex)
697 BitmapCache *bitmapc;
698 PixmapCache *pixmapc;
702 Pixmap pixmap = (Pixmap)NULL;
708 return ((Pixmap)NULL);
710 bitmapc = &(pSD->bitmapCache[bitmapIndex]);
713 * Get the foreground and background colors from the menu widget.
714 * Search for a label pixmap matching those colors.
718 XtSetArg (args[i], XtNforeground, &fg); i++;
719 XtSetArg (args[i], XtNbackground, &bg); i++;
720 XtGetValues (menuW, (ArgList)args, i);
722 pixmapc = bitmapc->pixmapCache;
725 if ((pixmapc->pixmapType == LABEL_PIXMAP) &&
726 (pixmapc->foreground == fg) &&
727 (pixmapc->background == bg))
729 pixmap = pixmapc->pixmap;
732 pixmapc = pixmapc->next;
737 * A matching pixmap was not found in the pixmap cache for this bitmap.
738 * Create and save the label pixmap with appropriate colors.
742 * Create a pixmap of the appropriate size, root, and depth.
743 * Only BadAlloc error possible; BadDrawable and BadValue are avoided.
746 pixmap = XCreatePixmap (DISPLAY, pSD->rootWindow,
747 bitmapc->width, bitmapc->height,
748 DefaultDepth (DISPLAY, pSD->screen));
751 * Create a GC and copy the bitmap to the pixmap.
752 * Only BadAlloc and BadDrawable errors are possible; others are avoided
757 gcv.graphics_exposures = False;
758 gc = XCreateGC(DISPLAY, pixmap, (GCForeground|GCBackground), &gcv);
761 * Fill in the background, set the foreground, copy the bitmap to the
762 * pixmap, and free the gc.
765 XFillRectangle (DISPLAY, pixmap, gc, 0, 0,
766 bitmapc->width, bitmapc->height);
767 XSetForeground (DISPLAY, gc, fg);
768 XCopyPlane (DISPLAY, bitmapc->bitmap, pixmap, gc, 0, 0,
769 bitmapc->width, bitmapc->height, 0, 0, 1L);
770 XFreeGC (DISPLAY, gc);
773 * If have sufficient memory, save the pixmap info in the pixmapCache.
776 if ((pixmapc = (PixmapCache *) XtMalloc(sizeof(PixmapCache))) != NULL)
778 pixmapc->pixmapType = LABEL_PIXMAP;
779 pixmapc->foreground = fg;
780 pixmapc->background = bg;
781 pixmapc->pixmap = pixmap;
782 pixmapc->next = bitmapc->pixmapCache;
783 bitmapc->pixmapCache = pixmapc;
789 } /* END OF FUNCTION MakeCachedLabelPixmap */
793 /*************************************<->*************************************
796 * GetBitmapIndex (pSD, name)
801 * Retrieve bitmap from cache.
806 * pSD = pointer to screen data
807 * name = bitmap file name or NULL pointer
818 * Return = bitmap cache index or -1
825 *************************************<->***********************************/
827 #define BITMAP_CACHE_INC 5
829 int GetBitmapIndex (WmScreenData *pSD, char *name, Boolean bReportError)
832 BitmapCache *bitmapc;
837 * Search a nonempty bitmap cache for a pathname match.
839 path = BitmapPathName (name);
840 for (n = 0, bitmapc = pSD->bitmapCache;
841 n < pSD->bitmapCacheCount;
844 if ((!path && !bitmapc->path) ||
845 (path && bitmapc->path &&
846 !strcmp (path, bitmapc->path)))
853 * The bitmap path name was not found in bitmapCache.
854 * Find the next BitmapCache entry, creating or enlarging bitmapCache if
857 if (pSD->bitmapCacheSize == 0)
860 pSD->bitmapCacheSize = BITMAP_CACHE_INC;
862 (BitmapCache *) XtMalloc (BITMAP_CACHE_INC * sizeof (BitmapCache));
864 else if (pSD->bitmapCacheCount == pSD->bitmapCacheSize)
867 pSD->bitmapCacheSize += BITMAP_CACHE_INC;
868 pSD->bitmapCache = (BitmapCache *)
869 XtRealloc ((char*)pSD->bitmapCache,
870 pSD->bitmapCacheSize * sizeof (BitmapCache));
873 if (pSD->bitmapCache == NULL)
875 MWarning (((char *)GETMESSAGE(38, 5, "Insufficient memory for bitmap %s\n")), name);
876 pSD->bitmapCacheSize = 0;
877 pSD->bitmapCacheCount = 0;
881 bitmapc = &(pSD->bitmapCache[pSD->bitmapCacheCount]);
884 * Fill the entry with the bitmap info.
885 * A NULL path indicates the builtin icon bitmap.
886 * Indicate that no pixmapCache exists yet.
891 if ((bitmapc->path = (String)
892 XtMalloc ((unsigned int)(strlen (path) + 1))) == NULL)
894 MWarning (((char *)GETMESSAGE(38, 6, "Insufficient memory for bitmap %s\n")), name);
897 strcpy (bitmapc->path, path);
899 if (XReadBitmapFile (DISPLAY, pSD->rootWindow, path,
900 &bitmapc->width, &bitmapc->height,
901 &bitmapc->bitmap, &x, &y)
905 MWarning (((char *)GETMESSAGE(38, 7, "Unable to read bitmap file %s\n")), path);
906 XtFree ((char *)bitmapc->path);
910 if (bitmapc->width == 0 || bitmapc->height == 0)
913 MWarning (((char *)GETMESSAGE(38, 8, "Invalid bitmap file %s\n")), path);
914 XtFree ((char *)bitmapc->path);
919 /* builtin icon bitmap */
921 bitmapc->path = NULL;
922 bitmapc->bitmap = pSD->builtinIconPixmap;
923 bitmapc->width = iImage_width;
924 bitmapc->height = iImage_height;
927 bitmapc->pixmapCache = NULL;
929 return (pSD->bitmapCacheCount++);
931 } /* END OF FUNCTION GetBitmapIndex */
935 /*************************************<->*************************************
937 * BitmapPathName (string)
942 * Constructs a bitmap file pathname from the bitmap file name and the
943 * bitmapDirectory resource value.
948 * string = bitmap file name or NULL
949 * wmGD.bitmapDirectory = bitmapDirectory resource value
950 * HOME = environment variable for home directory
957 * Return = string containing the bitmap file pathname or NULL.
962 * If the bitmap file does not exist, searches using XBMLANGPATH.
963 * Returns NULL path name for a NULL file name.
965 *************************************<->***********************************/
967 char *BitmapPathName (char *string)
969 static char fileName[MAXWMPATH+1];
971 SubstitutionRec subs[1];
972 char *homeDir = XmeGetHomeDirName();
974 if (!string || !*string)
980 * Interpret "~/.." as relative to the user's home directory.
981 * Interpret "/.." as an absolute pathname.
982 * If the bitmapDirectory resource is nonNULL, interpret path as relative
984 * Else, or if bitmapDirectory has no such file, use a XBMLANGPATH lookup.
987 if ((string[0] == '~') && (string[1] == '/'))
992 strcpy (fileName, homeDir);
993 strncat (fileName, &(string[1]), MAXWMPATH - strlen (fileName));
997 if (string[0] == '/')
1002 if (wmGD.bitmapDirectory && *wmGD.bitmapDirectory)
1004 * Relative to nonNULL bitmapDirectory (which may have relative to HOME)
1007 if ((wmGD.bitmapDirectory[0] == '~') &&
1008 (wmGD.bitmapDirectory[1] == '/'))
1010 strcpy (fileName, homeDir);
1011 strncat (fileName, &wmGD.bitmapDirectory[1],
1012 MAXWMPATH - strlen (fileName));
1014 snprintf(fileName, sizeof(fileName), "%s", wmGD.bitmapDirectory);
1016 strncat (fileName, "/", MAXWMPATH - strlen (fileName));
1017 strncat (fileName, string, MAXWMPATH - strlen (fileName));
1019 /* Test file for existence. */
1021 subs[0].substitution = "";
1022 if ((retname = XtFindFile(fileName, subs, 0,
1023 (XtFilePredicate) NULL)) != NULL) {
1029 /* Fall back on a path search */
1035 search_path = _XmOSInitPath(string, MATCH_PATH, &user_path);
1036 subs[0].match = user_path ? MATCH_XBM : MATCH_CHAR;
1037 subs[0].substitution = string;
1038 retname = XtResolvePathname(DISPLAY, "bitmaps", NULL, NULL,
1039 search_path, subs, XtNumber(subs),
1040 (XtFilePredicate)NULL);
1041 XtFree(search_path);
1046 strncpy(fileName, retname, MAXWMPATH);
1051 } /* END OF FUNCTION BitmapPathName */
1053 /**************************** eof ***************************/