Commit | Line | Data |
---|---|---|
a09e091a JB |
1 | /* |
2 | ||
3 | Copyright 1993 by Davor Matic | |
4 | ||
5 | Permission to use, copy, modify, distribute, and sell this software | |
6 | and its documentation for any purpose is hereby granted without fee, | |
7 | provided that the above copyright notice appear in all copies and that | |
8 | both that copyright notice and this permission notice appear in | |
9 | supporting documentation. Davor Matic makes no representations about | |
10 | the suitability of this software for any purpose. It is provided "as | |
11 | is" without express or implied warranty. | |
12 | ||
13 | */ | |
14 | ||
15 | #ifdef HAVE_XNEST_CONFIG_H | |
16 | #include <xnest-config.h> | |
17 | #endif | |
18 | ||
19 | #include <X11/X.h> | |
20 | #include <X11/Xproto.h> | |
21 | #include "scrnintstr.h" | |
22 | #include "dix.h" | |
23 | #include "mi.h" | |
24 | #include "Xnest.h" | |
25 | ||
26 | #include "Display.h" | |
27 | #include "Visual.h" | |
28 | ||
29 | Visual * | |
30 | xnestVisual(VisualPtr pVisual) | |
31 | { | |
32 | int i; | |
33 | ||
34 | for (i = 0; i < xnestNumVisuals; i++) | |
35 | if (pVisual->class == xnestVisuals[i].class && | |
36 | pVisual->bitsPerRGBValue == xnestVisuals[i].bits_per_rgb && | |
37 | pVisual->ColormapEntries == xnestVisuals[i].colormap_size && | |
38 | pVisual->nplanes == xnestVisuals[i].depth && | |
39 | pVisual->redMask == xnestVisuals[i].red_mask && | |
40 | pVisual->greenMask == xnestVisuals[i].green_mask && | |
41 | pVisual->blueMask == xnestVisuals[i].blue_mask) | |
42 | return xnestVisuals[i].visual; | |
43 | ||
44 | return NULL; | |
45 | } | |
46 | ||
47 | Visual * | |
48 | xnestVisualFromID(ScreenPtr pScreen, VisualID visual) | |
49 | { | |
50 | int i; | |
51 | ||
52 | for (i = 0; i < pScreen->numVisuals; i++) | |
53 | if (pScreen->visuals[i].vid == visual) | |
54 | return xnestVisual(&pScreen->visuals[i]); | |
55 | ||
56 | return NULL; | |
57 | } | |
58 | ||
59 | Colormap | |
60 | xnestDefaultVisualColormap(Visual * visual) | |
61 | { | |
62 | int i; | |
63 | ||
64 | for (i = 0; i < xnestNumVisuals; i++) | |
65 | if (xnestVisuals[i].visual == visual) | |
66 | return xnestDefaultColormaps[i]; | |
67 | ||
68 | return None; | |
69 | } |