Debian Codegraph @

nx-X11/lib/src/GetGCVals.c

raw
1
2 /*
3
4 Copyright 1989, 1998 The Open Group
5
6 Permission to use, copy, modify, distribute, and sell this software and its
7 documentation for any purpose is hereby granted without fee, provided that
8 the above copyright notice appear in all copies and that both that
9 copyright notice and this permission notice appear in supporting
10 documentation.
11
12 The above copyright notice and this permission notice shall be included in
13 all copies or substantial portions of the Software.
14
15 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
19 AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
20 CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
21
22 Except as contained in this notice, the name of The Open Group shall not be
23 used in advertising or otherwise to promote the sale, use or other dealings
24 in this Software without prior written authorization from The Open Group.
25
26 */
27
28 #ifdef HAVE_CONFIG_H
29 #include <config.h>
30 #endif
31 #include "Xlibint.h"
32
33 /*
34 * All gc fields except GCClipMask and GCDashList
35 */
36 #define ValidGCValuesBits (GCFunction | GCPlaneMask | GCForeground | \
37 GCBackground | GCLineWidth | GCLineStyle | \
38 GCCapStyle | GCJoinStyle | GCFillStyle | \
39 GCFillRule | GCTile | GCStipple | \
40 GCTileStipXOrigin | GCTileStipYOrigin | \
41 GCFont | GCSubwindowMode | GCGraphicsExposures | \
42 GCClipXOrigin | GCClipYOrigin | GCDashOffset | \
43 GCArcMode)
44
45 /*ARGSUSED*/
46 Status XGetGCValues (
47 Display *dpy,
48 GC gc,
49 unsigned long valuemask,
50 XGCValues *values)
51 {
52 if (valuemask == ValidGCValuesBits) {
53 char dashes = values->dashes;
54 Pixmap clip_mask = values->clip_mask;
55 *values = gc->values;
56 values->dashes = dashes;
57 values->clip_mask = clip_mask;
58 return True;
59 }
60
61 if (valuemask & ~ValidGCValuesBits) return False;
62
63 if (valuemask & GCFunction)
64 values->function = gc->values.function;
65
66 if (valuemask & GCPlaneMask)
67 values->plane_mask = gc->values.plane_mask;
68
69 if (valuemask & GCForeground)
70 values->foreground = gc->values.foreground;
71
72 if (valuemask & GCBackground)
73 values->background = gc->values.background;
74
75 if (valuemask & GCLineWidth)
76 values->line_width = gc->values.line_width;
77
78 if (valuemask & GCLineStyle)
79 values->line_style = gc->values.line_style;
80
81 if (valuemask & GCCapStyle)
82 values->cap_style = gc->values.cap_style;
83
84 if (valuemask & GCJoinStyle)
85 values->join_style = gc->values.join_style;
86
87 if (valuemask & GCFillStyle)
88 values->fill_style = gc->values.fill_style;
89
90 if (valuemask & GCFillRule)
91 values->fill_rule = gc->values.fill_rule;
92
93 if (valuemask & GCTile)
94 values->tile = gc->values.tile;
95
96 if (valuemask & GCStipple)
97 values->stipple = gc->values.stipple;
98
99 if (valuemask & GCTileStipXOrigin)
100 values->ts_x_origin = gc->values.ts_x_origin;
101
102 if (valuemask & GCTileStipYOrigin)
103 values->ts_y_origin = gc->values.ts_y_origin;
104
105 if (valuemask & GCFont)
106 values->font = gc->values.font;
107
108 if (valuemask & GCSubwindowMode)
109 values->subwindow_mode = gc->values.subwindow_mode;
110
111 if (valuemask & GCGraphicsExposures)
112 values->graphics_exposures = gc->values.graphics_exposures;
113
114 if (valuemask & GCClipXOrigin)
115 values->clip_x_origin = gc->values.clip_x_origin;
116
117 if (valuemask & GCClipYOrigin)
118 values->clip_y_origin = gc->values.clip_y_origin;
119
120 if (valuemask & GCDashOffset)
121
122 values->dash_offset = gc->values.dash_offset;
123
124 if (valuemask & GCArcMode)
125 values->arc_mode = gc->values.arc_mode;
126
127 return True;
128 }