diff options
Diffstat (limited to 'Xext/sampleEVI.c')
-rw-r--r-- | Xext/sampleEVI.c | 123 |
1 files changed, 0 insertions, 123 deletions
diff --git a/Xext/sampleEVI.c b/Xext/sampleEVI.c deleted file mode 100644 index b871bfd74..000000000 --- a/Xext/sampleEVI.c +++ /dev/null | |||
@@ -1,123 +0,0 @@ | |||
1 | /************************************************************ | ||
2 | Copyright (c) 1997 by Silicon Graphics Computer Systems, Inc. | ||
3 | Permission to use, copy, modify, and distribute this | ||
4 | software and its documentation for any purpose and without | ||
5 | fee is hereby granted, provided that the above copyright | ||
6 | notice appear in all copies and that both that copyright | ||
7 | notice and this permission notice appear in supporting | ||
8 | documentation, and that the name of Silicon Graphics not be | ||
9 | used in advertising or publicity pertaining to distribution | ||
10 | of the software without specific prior written permission. | ||
11 | Silicon Graphics makes no representation about the suitability | ||
12 | of this software for any purpose. It is provided "as is" | ||
13 | without any express or implied warranty. | ||
14 | SILICON GRAPHICS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS | ||
15 | SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY | ||
16 | AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SILICON | ||
17 | GRAPHICS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL | ||
18 | DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, | ||
19 | DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE | ||
20 | OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH | ||
21 | THE USE OR PERFORMANCE OF THIS SOFTWARE. | ||
22 | ********************************************************/ | ||
23 | |||
24 | #ifdef HAVE_DIX_CONFIG_H | ||
25 | #include <dix-config.h> | ||
26 | #endif | ||
27 | |||
28 | #include <X11/X.h> | ||
29 | #include <X11/Xproto.h> | ||
30 | #include "dixstruct.h" | ||
31 | #include "extnsionst.h" | ||
32 | #include "dix.h" | ||
33 | #define _XEVI_SERVER_ | ||
34 | #include <X11/extensions/XEVIstr.h> | ||
35 | #include "EVIstruct.h" | ||
36 | #include "scrnintstr.h" | ||
37 | |||
38 | #if HAVE_STDINT_H | ||
39 | #include <stdint.h> | ||
40 | #elif !defined(UINT32_MAX) | ||
41 | #define UINT32_MAX 0xffffffffU | ||
42 | #endif | ||
43 | |||
44 | static int sampleGetVisualInfo( | ||
45 | VisualID32 *visual, | ||
46 | int n_visual, | ||
47 | xExtendedVisualInfo **evi_rn, | ||
48 | int *n_info_rn, | ||
49 | VisualID32 **conflict_rn, | ||
50 | int *n_conflict_rn) | ||
51 | { | ||
52 | unsigned int max_sz_evi; | ||
53 | VisualID32 *temp_conflict; | ||
54 | xExtendedVisualInfo *evi; | ||
55 | unsigned int max_visuals = 0, max_sz_conflict, sz_conflict = 0; | ||
56 | register int visualI, scrI, sz_evi = 0, conflictI, n_conflict; | ||
57 | |||
58 | if (n_visual > UINT32_MAX/(sz_xExtendedVisualInfo * screenInfo.numScreens)) | ||
59 | return BadAlloc; | ||
60 | max_sz_evi = n_visual * sz_xExtendedVisualInfo * screenInfo.numScreens; | ||
61 | |||
62 | for (scrI = 0; scrI < screenInfo.numScreens; scrI++) { | ||
63 | if (screenInfo.screens[scrI]->numVisuals > max_visuals) | ||
64 | max_visuals = screenInfo.screens[scrI]->numVisuals; | ||
65 | } | ||
66 | |||
67 | if (n_visual > UINT32_MAX/(sz_VisualID32 * screenInfo.numScreens | ||
68 | * max_visuals)) | ||
69 | return BadAlloc; | ||
70 | max_sz_conflict = n_visual * sz_VisualID32 * screenInfo.numScreens * max_visuals; | ||
71 | |||
72 | *evi_rn = evi = (xExtendedVisualInfo *)xalloc(max_sz_evi); | ||
73 | if (!*evi_rn) | ||
74 | return BadAlloc; | ||
75 | |||
76 | temp_conflict = (VisualID32 *)xalloc(max_sz_conflict); | ||
77 | if (!temp_conflict) { | ||
78 | xfree(*evi_rn); | ||
79 | return BadAlloc; | ||
80 | } | ||
81 | |||
82 | for (scrI = 0; scrI < screenInfo.numScreens; scrI++) { | ||
83 | for (visualI = 0; visualI < n_visual; visualI++) { | ||
84 | evi[sz_evi].core_visual_id = visual[visualI]; | ||
85 | evi[sz_evi].screen = scrI; | ||
86 | evi[sz_evi].level = 0; | ||
87 | evi[sz_evi].transparency_type = XEVI_TRANSPARENCY_NONE; | ||
88 | evi[sz_evi].transparency_value = 0; | ||
89 | evi[sz_evi].min_hw_colormaps = 1; | ||
90 | evi[sz_evi].max_hw_colormaps = 1; | ||
91 | evi[sz_evi].num_colormap_conflicts = n_conflict = 0; | ||
92 | for (conflictI = 0; conflictI < n_conflict; conflictI++) | ||
93 | temp_conflict[sz_conflict++] = visual[visualI]; | ||
94 | sz_evi++; | ||
95 | } | ||
96 | } | ||
97 | *conflict_rn = temp_conflict; | ||
98 | *n_conflict_rn = sz_conflict; | ||
99 | *n_info_rn = sz_evi; | ||
100 | return Success; | ||
101 | } | ||
102 | |||
103 | static void sampleFreeVisualInfo( | ||
104 | xExtendedVisualInfo *evi, | ||
105 | VisualID32 *conflict) | ||
106 | { | ||
107 | if (evi) | ||
108 | xfree(evi); | ||
109 | if (conflict) | ||
110 | xfree(conflict); | ||
111 | } | ||
112 | |||
113 | EviPrivPtr eviDDXInit(void) | ||
114 | { | ||
115 | static EviPrivRec eviPriv; | ||
116 | eviPriv.getVisualInfo = sampleGetVisualInfo; | ||
117 | eviPriv.freeVisualInfo = sampleFreeVisualInfo; | ||
118 | return &eviPriv; | ||
119 | } | ||
120 | |||
121 | void eviDDXReset(void) | ||
122 | { | ||
123 | } | ||