25406b7f5f9feb95607f2f32386c5416db60ca5d
[platform/upstream/libXi.git] / man / XIChangeProperty.man
1 '\" t
2 .\"     Title: xichangeproperty
3 .\"    Author: [FIXME: author] [see http://docbook.sf.net/el/author]
4 .\" Generator: DocBook XSL Stylesheets v1.76.1 <http://docbook.sf.net/>
5 .\"      Date: 12/21/2011
6 .\"    Manual: [FIXME: manual]
7 .\"    Source: [FIXME: source]
8 .\"  Language: English
9 .\"
10 .TH "XICHANGEPROPERTY" "libmansuffix" "12/21/2011" "[FIXME: source]" "[FIXME: manual]"
11 .\" -----------------------------------------------------------------
12 .\" * Define some portability stuff
13 .\" -----------------------------------------------------------------
14 .\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
15 .\" http://bugs.debian.org/507673
16 .\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html
17 .\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
18 .ie \n(.g .ds Aq \(aq
19 .el       .ds Aq '
20 .\" -----------------------------------------------------------------
21 .\" * set default formatting
22 .\" -----------------------------------------------------------------
23 .\" disable hyphenation
24 .nh
25 .\" disable justification (adjust text to left margin only)
26 .ad l
27 .\" -----------------------------------------------------------------
28 .\" * MAIN CONTENT STARTS HERE *
29 .\" -----------------------------------------------------------------
30 .SH "NAME"
31 XIChangeProperty, XIGetProperty, XIDeleteProperty \- change, retrieve or delete a device\*(Aqs property\&.
32 .SH "SYNOPSIS"
33 .sp
34 .nf
35 #include <X11/extensions/XInput2\&.h>
36 .fi
37 .sp
38 .nf
39 void XIChangeProperty( Display* dpy,
40                        int deviceid,
41                        Atom property,
42                        Atom type,
43                        int format,
44                        int mode,
45                        unsigned char *data,
46                        int num_items)
47 .fi
48 .sp
49 .nf
50 void XIDeleteProperty( Display *dpy,
51                        int deviceid,
52                        Atom property)
53 .fi
54 .sp
55 .nf
56 Status XIGetProperty( Display *dpy,
57                       int deviceid,
58                       Atom property,
59                       long offset,
60                       long length,
61                       Bool delete_property,
62                       Atom type,
63                       Atom *type_return,
64                       int *format_return,
65                       unsigned long *num_items_return,
66                       unsigned long *bytes_after_return,
67                       unsigned char **data)
68 .fi
69 .sp
70 .nf
71 bytes_after_return
72        Returns the number of bytes remaining to be read in the prop\-
73        erty if a partial read was performed\&.
74 .fi
75 .sp
76 .nf
77 data
78        Specifies the property data\&.
79 .fi
80 .sp
81 .nf
82 display
83        Specifies the connection to the X server\&.
84 .fi
85 .sp
86 .nf
87 delete_property
88        Specifies a Boolean value that determines whether the property
89        is to be deleted\&.
90 .fi
91 .sp
92 .nf
93 deviceid
94        The device to list the properties for\&.
95 .fi
96 .sp
97 .nf
98 format
99        Specifies whether the data should be viewed as a list of
100        8\-bit, 16\-bit, or 32\-bit quantities\&.  Possible values are 8,
101        16, and 32\&.  This information allows the X server to correctly
102        perform byte\-swap operations as necessary\&. If the
103        format is 16\-bit or 32\-bit, you must explicitly cast your
104        data pointer to an (unsigned char *) in the call to
105        XIChangeProperty\&.
106 .fi
107 .sp
108 .nf
109 format_return
110        Returns the actual format of the property\&.
111 .fi
112 .sp
113 .nf
114 length
115        Specifies the length in 32\-bit multiples of the data to be
116        retrieved\&.
117 .fi
118 .sp
119 .nf
120 offset
121        Specifies the offset in the specified property (in 32\-bit
122        quantities) where the data is to be retrieved\&.
123 .fi
124 .sp
125 .nf
126 mode
127        One of XIPropModeAppend, XIPropModePrepend or XIPropModeReplace\&.
128 .fi
129 .sp
130 .nf
131 num_items
132        Number of items in data in the format specified\&.
133 .fi
134 .sp
135 .nf
136 nitems_return
137        Returns the actual number of 8\-bit, 16\-bit, or 32\-bit items
138        stored in data\&.
139 .fi
140 .sp
141 .nf
142 property
143        Specifies the property name\&.
144 .fi
145 .sp
146 .nf
147 type
148        Specifies the type of the property\&.  The X server does not
149        interpret the type but simply passes it back to an application
150        that later calls XIGetProperty\&.
151 .fi
152 .sp
153 .nf
154 type_return
155        Returns the atom identifier that defines the actual type of
156        the property\&.
157 .fi
158 .SH "DESCRIPTION"
159 .sp
160 The XIGetProperty function returns the actual type of the property; the actual format of the property; the number of 8\-bit, 16\-bit, or 32\-bit items transferred; the number of bytes remaining to be read in the property; and a pointer to the data actually returned\&. XIGetProperty sets the return arguments as follows:
161 .sp
162 .RS 4
163 .ie n \{\
164 \h'-04'\(bu\h'+03'\c
165 .\}
166 .el \{\
167 .sp -1
168 .IP \(bu 2.3
169 .\}
170 If the specified property does not exist for the specified device, XIGetProperty returns None to actual_type_return and the value zero to actual_format_return and bytes_after_return\&. The nitems_return argument is empty\&. In this case, the delete argument is ignored\&.
171 .RE
172 .sp
173 .RS 4
174 .ie n \{\
175 \h'-04'\(bu\h'+03'\c
176 .\}
177 .el \{\
178 .sp -1
179 .IP \(bu 2.3
180 .\}
181 If the specified property exists but its type does not match the specified type, XIGetProperty returns the actual property type to actual_type_return, the actual property format (never zero) to actual_format_return, and the property length in bytes (even if the actual_format_return is 16 or 32) to bytes_after_return\&. It also ignores the delete argument\&. The nitems_return argument is empty\&.
182 .RE
183 .sp
184 .RS 4
185 .ie n \{\
186 \h'-04'\(bu\h'+03'\c
187 .\}
188 .el \{\
189 .sp -1
190 .IP \(bu 2.3
191 .\}
192 If the specified property exists and either you assign XIAnyPropertyType to the req_type argument or the specified type matches the actual property type, XIGetProperty returns the actual property type to actual_type_return and the actual property format (never zero) to actual_format_return\&. It also returns a value to bytes_after_return and nitems_return, by defining the following values:
193 .sp
194 .if n \{\
195 .RS 4
196 .\}
197 .nf
198 N = length of the stored property in bytes
199 I = 4 * offset
200 T = N \- I
201 L = MINIMUM(T, 4 * length)
202 A = N \- (I + L)
203 .fi
204 .if n \{\
205 .RE
206 .\}
207 .RE
208 .sp
209 The returned value starts at byte index I in the property (indexing from zero), and its length in bytes is L\&. If the value for long_offset causes L to be negative, a BadValue error results\&. The value of bytes_after_return is A, giving the number of trailing unread bytes in the stored property\&.
210 .sp
211 If the returned format is 8, the returned data is represented as a char array\&. If the returned format is 16, the returned data is represented as a uint16_t array and should be cast to that type to obtain the ele\- ments\&. If the returned format is 32, the returned data is represented as a uint32_t array and should be cast to that type to obtain the elements\&.
212 .sp
213 XIGetProperty always allocates one extra byte in prop_return (even if the property is zero length) and sets it to zero so that simple properties consisting of characters do not have to be copied into yet another string before use\&.
214 .sp
215 If delete is True and bytes_after_return is zero, XIGetProperty deletes the property from the window and generates an XIPropertyNotify event on the window\&.
216 .sp
217 The function returns Success if it executes successfully\&. To free the resulting data, use XFree\&.
218 .sp
219 XIGetProperty can generate BadAtom, BadValue, and BadWindow errors\&.
220 .sp
221 The XIChangeProperty function alters the property for the specified device and causes the X server to generate a XIPropertyNotify event for that device\&. XIChangeProperty performs the following:
222 .sp
223 .RS 4
224 .ie n \{\
225 \h'-04'\(bu\h'+03'\c
226 .\}
227 .el \{\
228 .sp -1
229 .IP \(bu 2.3
230 .\}
231 If mode is XIPropModeReplace, XIChangeProperty discards the previous property value and stores the new data\&.
232 .RE
233 .sp
234 .RS 4
235 .ie n \{\
236 \h'-04'\(bu\h'+03'\c
237 .\}
238 .el \{\
239 .sp -1
240 .IP \(bu 2.3
241 .\}
242 If mode is XIPropModePrepend or XIPropModeAppend, XIChangeProperty inserts the specified data before the beginning of the existing data or onto the end of the existing data, respectively\&. The type and format must match the existing property value, or a BadMatch error results\&. If the property is undefined, it is treated as defined with the correct type and format with zero\-length data\&.
243 .RE
244 .sp
245 If the specified format is 8, the property data must be a char array\&. If the specified format is 16, the property data must be a uint16_t array\&. If the specified format is 32, the property data must be a uint32_t array\&.
246 .sp
247 The lifetime of a property is not tied to the storing client\&. Properties remain until explicitly deleted, until the device is removed, or until the server resets\&. The maximum size of a property is server dependent and can vary dynamically depending on the amount of memory the server has available\&. (If there is insufficient space, a BadAlloc error results\&.)
248 .sp
249 XIChangeProperty can generate BadAlloc, BadAtom, BadMatch, BadValue, and BadDevice errors\&.
250 .sp
251 The XIDeleteProperty function deletes the specified property only if the property was defined on the specified device and causes the X server to generate a XIPropertyNotify event for the device unless the property does not exist\&.
252 .sp
253 XIDeleteProperty can generate BadAtom and BadDevice errors\&.
254 .SH "DIAGNOSTICS"
255 .sp
256 BadAlloc The server failed to allocate the requested resource or server memory\&.
257 .sp
258 BadAtom A value for an Atom argument does not name a defined Atom\&.
259 .sp
260 BadValue Some numeric value falls outside the range of values accepted by the request\&. Unless a specific range is specified for an argument, the full range defined by the argument\(cqs type is accepted\&. Any argument defined as a set of alternatives can generate this error\&.
261 .sp
262 BadDevice An invalid device was specified\&. The device does not exist\&.
263 .sp
264 BadAtom An invalid property was specified\&. The property does not exist\&.
265 .SH "BUGS"
266 .sp
267 .if n \{\
268 .RS 4
269 .\}
270 .nf
271 The protocol headers for XI 2\&.0 did not provide
272 XIAnyPropertyType, XIPropModeReplace, XIPropModePrepend or
273 XIPropModeAppend\&. Use AnyPropertyType, PropModeReplace,
274 PropModePrepend and PropModeAppend instead, respectively\&.
275 .fi
276 .if n \{\
277 .RE
278 .\}
279 .SH "SEE ALSO"
280 .sp
281 XIListProperties(libmansuffix)