#include <stdio.h>#include <math.h>#include <X11/Xlib.h>#include <X11/Xatom.h>#include <X11/Xutil.h>#include <X11/Xmu/StdCmap.h>Include dependency graph for VisCmap.c:

Go to the source code of this file.
Functions | |
| Status | XmuVisualStandardColormaps (Display *dpy, int screen, VisualID visualid, unsigned int depth, Bool replace, Bool retain) |
| Status XmuVisualStandardColormaps | ( | Display * | dpy, | |
| int | screen, | |||
| VisualID | visualid, | |||
| unsigned int | depth, | |||
| Bool | replace, | |||
| Bool | retain | |||
| ) |
Definition at line 72 of file VisCmap.c.
References n, NULL, XmuDeleteStandardColormap(), and XmuLookupStandardColormap().
Referenced by XmuAllStandardColormaps().
00082 { 00083 Status status; 00084 int n; 00085 long vinfo_mask; 00086 XVisualInfo vinfo_template, *vinfo; 00087 00088 status = 0; 00089 vinfo_template.screen = screen; 00090 vinfo_template.visualid = visualid; 00091 vinfo_template.depth = depth; 00092 vinfo_mask = VisualScreenMask | VisualIDMask | VisualDepthMask; 00093 if ((vinfo = XGetVisualInfo(dpy, vinfo_mask, &vinfo_template, &n)) == NULL) 00094 return 0; 00095 00096 if (vinfo->colormap_size <= 2) { 00097 /* Monochrome visuals have no standard maps; considered successful */ 00098 XFree((char *) vinfo); 00099 return 1; 00100 } 00101 00102 switch (vinfo->class) 00103 { 00104 case PseudoColor: 00105 case DirectColor: 00106 status = XmuLookupStandardColormap(dpy, screen, visualid, depth, 00107 XA_RGB_DEFAULT_MAP, replace,retain); 00108 if (!status) break; 00109 00110 status = XmuLookupStandardColormap(dpy, screen, visualid, depth, 00111 XA_RGB_GRAY_MAP, replace, retain); 00112 if (!status) { 00113 XmuDeleteStandardColormap(dpy, screen, XA_RGB_DEFAULT_MAP); 00114 break; 00115 } 00116 00117 status = XmuLookupStandardColormap(dpy, screen, visualid, depth, 00118 XA_RGB_RED_MAP, replace, retain); 00119 if (!status) { 00120 XmuDeleteStandardColormap(dpy, screen, XA_RGB_DEFAULT_MAP); 00121 XmuDeleteStandardColormap(dpy, screen, XA_RGB_GRAY_MAP); 00122 break; 00123 } 00124 00125 status = XmuLookupStandardColormap(dpy, screen, visualid, depth, 00126 XA_RGB_GREEN_MAP, replace, retain); 00127 if (!status) { 00128 XmuDeleteStandardColormap(dpy, screen, XA_RGB_DEFAULT_MAP); 00129 XmuDeleteStandardColormap(dpy, screen, XA_RGB_GRAY_MAP); 00130 XmuDeleteStandardColormap(dpy, screen, XA_RGB_RED_MAP); 00131 break; 00132 } 00133 00134 status = XmuLookupStandardColormap(dpy, screen, visualid, depth, 00135 XA_RGB_BLUE_MAP, replace, retain); 00136 if (!status) { 00137 XmuDeleteStandardColormap(dpy, screen, XA_RGB_DEFAULT_MAP); 00138 XmuDeleteStandardColormap(dpy, screen, XA_RGB_GRAY_MAP); 00139 XmuDeleteStandardColormap(dpy, screen, XA_RGB_RED_MAP); 00140 XmuDeleteStandardColormap(dpy, screen, XA_RGB_GREEN_MAP); 00141 break; 00142 } 00143 /* fall through */ 00144 00145 case StaticColor: 00146 case TrueColor: 00147 00148 status = XmuLookupStandardColormap(dpy, screen, visualid, depth, 00149 XA_RGB_BEST_MAP, replace, retain); 00150 if (!status && (vinfo->class == PseudoColor || 00151 vinfo->class == DirectColor)) { 00152 XmuDeleteStandardColormap(dpy, screen, XA_RGB_DEFAULT_MAP); 00153 XmuDeleteStandardColormap(dpy, screen, XA_RGB_GRAY_MAP); 00154 XmuDeleteStandardColormap(dpy, screen, XA_RGB_RED_MAP); 00155 XmuDeleteStandardColormap(dpy, screen, XA_RGB_GREEN_MAP); 00156 XmuDeleteStandardColormap(dpy, screen, XA_RGB_BLUE_MAP); 00157 } 00158 break; 00159 /* the end for PseudoColor, DirectColor, StaticColor, and TrueColor */ 00160 00161 case GrayScale: 00162 status = XmuLookupStandardColormap(dpy, screen, visualid, depth, 00163 XA_RGB_DEFAULT_MAP, replace, 00164 retain); 00165 if (! status) break; 00166 /*FALLTHROUGH*/ 00167 00168 case StaticGray: 00169 00170 status = XmuLookupStandardColormap(dpy, screen, visualid, depth, 00171 XA_RGB_GRAY_MAP, replace, retain); 00172 if (! status && vinfo->class == GrayScale) { 00173 XmuDeleteStandardColormap(dpy, screen, XA_RGB_DEFAULT_MAP); 00174 break; 00175 } 00176 } 00177 00178 XFree((char *) vinfo); 00179 return status; 00180 }
Here is the call graph for this function:

Here is the caller graph for this function:

1.5.1