blob: 7b69e182121f9e143f21bf0ee6b2a9d9793772f0 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
|
/*
* xutil.c --
*
* This function contains generic X emulation routines.
*
* Copyright (c) 1995-1996 Sun Microsystems, Inc.
*
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
*/
#include <stdlib.h>
#include <tk.h>
#include <X11/Xlib.h>
#include <X11/Xutil.h>
#include <X11/Xatom.h>
/*
*----------------------------------------------------------------------
*
* XInternAtom --
*
* This procedure simulates the XInternAtom function by calling Tk_Uid to
* get a unique id for every atom. This is only a partial implementation,
* since it doesn't work across applications.
*
* Results:
* A new Atom.
*
* Side effects:
* None.
*
*----------------------------------------------------------------------
*/
Atom
XInternAtom(
Display *display,
_Xconst char *atom_name,
Bool only_if_exists)
{
static Atom atom = XA_LAST_PREDEFINED;
display->request++;
return ++atom;
}
/*
*----------------------------------------------------------------------
*
* XGetVisualInfo --
*
* Returns information about the specified visual.
*
* Results:
* Returns a newly allocated XVisualInfo structure.
*
* Side effects:
* Allocates storage.
*
*----------------------------------------------------------------------
*/
XVisualInfo *
XGetVisualInfo(
Display *display,
long vinfo_mask,
XVisualInfo *vinfo_template,
int *nitems_return)
{
XVisualInfo *info = ckalloc(sizeof(XVisualInfo));
info->visual = DefaultVisual(display, 0);
info->visualid = info->visual->visualid;
info->screen = 0;
info->depth = info->visual->bits_per_rgb;
info->class = info->visual->class;
info->colormap_size = info->visual->map_entries;
info->bits_per_rgb = info->visual->bits_per_rgb;
info->red_mask = info->visual->red_mask;
info->green_mask = info->visual->green_mask;
info->blue_mask = info->visual->blue_mask;
if (((vinfo_mask & VisualIDMask)
&& (vinfo_template->visualid != info->visualid))
|| ((vinfo_mask & VisualScreenMask)
&& (vinfo_template->screen != info->screen))
|| ((vinfo_mask & VisualDepthMask)
&& (vinfo_template->depth != info->depth))
|| ((vinfo_mask & VisualClassMask)
&& (vinfo_template->class != info->class))
|| ((vinfo_mask & VisualColormapSizeMask)
&& (vinfo_template->colormap_size != info->colormap_size))
|| ((vinfo_mask & VisualBitsPerRGBMask)
&& (vinfo_template->bits_per_rgb != info->bits_per_rgb))
|| ((vinfo_mask & VisualRedMaskMask)
&& (vinfo_template->red_mask != info->red_mask))
|| ((vinfo_mask & VisualGreenMaskMask)
&& (vinfo_template->green_mask != info->green_mask))
|| ((vinfo_mask & VisualBlueMaskMask)
&& (vinfo_template->blue_mask != info->blue_mask))
) {
ckfree(info);
return NULL;
}
*nitems_return = 1;
return info;
}
/*
* Local Variables:
* mode: c
* c-basic-offset: 4
* fill-column: 78
* End:
*/
|