AllCmap.c File Reference

#include <stdio.h>
#include <X11/Xlib.h>
#include <X11/Xatom.h>
#include <X11/Xutil.h>
#include <X11/Xmu/StdCmap.h>

Include dependency graph for AllCmap.c:

Go to the source code of this file.

Functions

static XVisualInfo * getDeepestVisual (int, XVisualInfo *, int)
Status XmuAllStandardColormaps (Display *dpy)


Function Documentation

static XVisualInfo * getDeepestVisual ( int  ,
XVisualInfo *  ,
int   
) [static]

Definition at line 141 of file AllCmap.c.

References i, NULL, and v.

Referenced by XmuAllStandardColormaps().

00142 {
00143     register int        i;
00144     register int        maxdepth = 0;
00145     XVisualInfo         *v = NULL;
00146     
00147     for (i=0; i < nvisuals; i++, vinfo++)
00148         if (vinfo->class == visual_class && vinfo->depth > maxdepth)
00149         {
00150             maxdepth = vinfo->depth;
00151             v = vinfo;
00152         }
00153     return(v);
00154 }

Here is the caller graph for this function:

Status XmuAllStandardColormaps ( Display *  dpy  ) 

Definition at line 92 of file AllCmap.c.

References getDeepestVisual(), NULL, and XmuVisualStandardColormaps().

00093 {
00094     int         nvisuals, scr;
00095     Status      status;
00096     long        vinfo_mask;
00097     XVisualInfo template, *vinfo, *v1, *v2;
00098 
00099     status = 0;
00100     /* for each screen, determine all visuals of this server */
00101     for (scr=0; scr < ScreenCount(dpy); scr++)
00102     {
00103         template.screen = scr;
00104         vinfo_mask = VisualScreenMask;
00105         vinfo = XGetVisualInfo(dpy, vinfo_mask, &template, &nvisuals);
00106         if (vinfo == NULL) /* unexpected: a screen with no visuals */
00107             continue;
00108 
00109         v1 = getDeepestVisual(DirectColor, vinfo, nvisuals);
00110         v2 = getDeepestVisual(PseudoColor, vinfo, nvisuals);
00111 
00112         if (v2 &&
00113             (!v1 || (v2->colormap_size >=
00114                      ((v1->red_mask | v1->green_mask | v1->blue_mask) + 1))))
00115             status = XmuVisualStandardColormaps(dpy, scr, v2->visualid,
00116                                                 (unsigned) v2->depth, 1, 1);
00117         else if (v1)
00118             status = XmuVisualStandardColormaps(dpy, scr, v1->visualid,
00119                                                 (unsigned) v1->depth, 1, 1);
00120 
00121         else {
00122             if (((v1 = getDeepestVisual(TrueColor, vinfo, nvisuals)) != NULL)
00123                 || ((v1 = getDeepestVisual(StaticColor, vinfo, nvisuals)) !=
00124                 NULL))
00125                 status = XmuVisualStandardColormaps(dpy, scr, v1->visualid,
00126                                                    (unsigned) v1->depth, 1, 1);
00127             if (status && 
00128                (((v1 = getDeepestVisual(GrayScale, vinfo, nvisuals)) != NULL)
00129                 || ((v1 = getDeepestVisual(StaticGray, vinfo, nvisuals)) != 
00130                     NULL)))
00131                 status = XmuVisualStandardColormaps(dpy, scr, v1->visualid,
00132                                                    (unsigned) v1->depth, 1, 1);
00133         }
00134         XFree ((char *) vinfo);
00135         if (!status) break;
00136     }
00137     return status;
00138 }

Here is the call graph for this function:


Generated on Sun Mar 4 16:03:23 2007 for Scilab [trunk] by  doxygen 1.5.1