1XGetWindowProperty(3)           XLIB FUNCTIONS           XGetWindowProperty(3)
2
3
4

NAME

6       XGetWindowProperty,  XListProperties,  XChangeProperty,  XRotateWindow‐
7       Properties, XDeleteProperty - obtain and change window properties
8

SYNTAX

10       int XGetWindowProperty(Display *display, Window w, Atom property,  long
11              long_offset,  long long_length, Bool delete, Atom req_type, Atom
12              *actual_type_return, int  *actual_format_return,  unsigned  long
13              *nitems_return, unsigned long *bytes_after_return, unsigned char
14              **prop_return);
15
16       Atom    *XListProperties(Display    *display,     Window     w,     int
17              *num_prop_return);
18
19       int  XChangeProperty(Display  *display,  Window  w, Atom property, Atom
20              type, int format, int mode, unsigned char *data, int nelements);
21
22       int XRotateWindowProperties(Display *display, Window  w,  Atom  proper‐
23              ties[], int num_prop, int npositions);
24
25       int XDeleteProperty(Display *display, Window w, Atom property);
26

ARGUMENTS

28       actual_format_return
29                 Returns the actual format of the property.
30
31       actual_type_return
32                 Returns  the atom identifier  that defines the actual type of
33                 the property.
34
35       bytes_after_return
36                 Returns the number of bytes remaining to be read in the prop‐
37                 erty if a partial read was performed.
38
39       data      Specifies the property data.
40
41       delete    Specifies  a  Boolean value that determines whether the prop‐
42                 erty is deleted.
43
44       display   Specifies the connection to the X server.
45
46       format    Specifies whether the data should be  viewed  as  a  list  of
47                 8-bit,  16-bit, or 32-bit quantities.  Possible values are 8,
48                 16, and 32.  This information allows the  X  server  to  cor‐
49                 rectly  perform  byte-swap  operations  as necessary.  If the
50                 format is 16-bit or 32-bit, you  must  explicitly  cast  your
51                 data  pointer to an (unsigned char *) in the call to XChange‐
52                 Property.
53
54       long_length
55                 Specifies the length in 32-bit multiples of the  data  to  be
56                 retrieved.
57
58       long_offset
59                 Specifies  the  offset  in  the specified property (in 32-bit
60                 quantities) where the data is to be retrieved.
61
62       mode      Specifies the mode of the operation.  You can  pass  PropMod‐
63                 eReplace, PropModePrepend, or PropModeAppend.
64
65       nelements Specifies  the  number of elements of the specified data for‐
66                 mat.
67
68       nitems_return
69                 Returns the actual number of 8-bit, 16-bit, or  32-bit  items
70                 stored in the prop_return data.
71
72       num_prop  Specifies the length of the properties array.
73
74       num_prop_return
75                 Returns the length of the properties array.
76
77       npositions
78                 Specifies the rotation amount.
79
80       prop_return
81                 Returns  the  data  in the specified format.  If the returned
82                 format is 8, the returned  data  is  represented  as  a  char
83                 array.   If  the  returned format is 16, the returned data is
84                 represented as a array of short int type and should  be  cast
85                 to  that type to obtain the elements.  If the returned format
86                 is 32, the property data will be stored as an array of  longs
87                 (which in a 64-bit application will be 64-bit values that are
88                 padded in the upper 4 bytes).
89
90       property  Specifies the property name.
91
92       properties
93                 Specifies the array of properties that are to be rotated.
94
95       req_type  Specifies the atom identifier associated  with  the  property
96                 type or AnyPropertyType.
97
98       type      Specifies  the  type  of the property.  The X server does not
99                 interpret the type but simply passes it back to  an  applica‐
100                 tion that later calls XGetWindowProperty.
101
102       w         Specifies  the  window  whose  property  you  want to obtain,
103                 change, rotate or delete.
104

DESCRIPTION

106       The XGetWindowProperty function returns the actual type  of  the  prop‐
107       erty;  the  actual format of the property; the number of 8-bit, 16-bit,
108       or 32-bit items transferred; the number of bytes remaining to  be  read
109       in the property; and a pointer to the data actually returned.  XGetWin‐
110       dowProperty sets the return arguments as follows:
111
112       ·    If the specified property does not exist for the specified window,
113            XGetWindowProperty  returns  None  to  actual_type_return  and the
114            value zero to actual_format_return  and  bytes_after_return.   The
115            nitems_return  argument  is empty.  In this case, the delete argu‐
116            ment is ignored.
117
118       ·    If the specified property exists but its type does not  match  the
119            specified  type,  XGetWindowProperty  returns  the actual property
120            type to actual_type_return,  the  actual  property  format  (never
121            zero)  to  actual_format_return,  and the property length in bytes
122            (even   if   the   actual_format_return   is   16   or   32)    to
123            bytes_after_return.   It  also  ignores  the delete argument.  The
124            nitems_return argument is empty.
125
126       ·    If the specified property exists and either you assign  AnyProper‐
127            tyType  to the req_type argument or the specified type matches the
128            actual property type, XGetWindowProperty returns the actual  prop‐
129            erty  type  to  actual_type_return  and the actual property format
130            (never zero) to actual_format_return.  It also returns a value  to
131            bytes_after_return  and  nitems_return,  by defining the following
132            values:
133
134                 N = actual length of the stored property in bytes
135                      (even if the format is 16 or 32)
136                 I = 4 * long_offset
137                 T = N - I
138                 L = MINIMUM(T, 4 * long_length)
139                 A = N - (I + L)
140
141            The returned value starts at byte index I in the property  (index‐
142            ing  from  zero),  and its length in bytes is L.  If the value for
143            long_offset causes L to be negative,  a  BadValue  error  results.
144            The  value of bytes_after_return is A, giving the number of trail‐
145            ing unread bytes in the stored property.
146
147       If the returned format is 8, the returned data is represented as a char
148       array.   If the returned format is 16, the returned data is represented
149       as a short array and should be cast to that type  to  obtain  the  ele‐
150       ments.   If the returned format is 32, the returned data is represented
151       as a long array and should be cast to that type to obtain the elements.
152
153       XGetWindowProperty always allocates one extra byte in prop_return (even
154       if  the  property  is  zero  length) and sets it to zero so that simple
155       properties consisting of characters do not have to be copied  into  yet
156       another string before use.
157
158       If  delete  is  True and bytes_after_return is zero, XGetWindowProperty
159       deletes the property from the window  and  generates  a  PropertyNotify
160       event on the window.
161
162       The  function returns Success if it executes successfully.  To free the
163       resulting data, use XFree.
164
165       XGetWindowProperty  can  generate  BadAtom,  BadValue,  and   BadWindow
166       errors.
167
168       The  XListProperties  function  returns  a  pointer to an array of atom
169       properties that are defined for the specified window or returns NULL if
170       no  properties  were found.  To free the memory allocated by this func‐
171       tion, use XFree.
172
173       XListProperties can generate a BadWindow error.
174
175       The XChangeProperty function alters the property for the specified win‐
176       dow  and causes the X server to generate a PropertyNotify event on that
177       window.  XChangeProperty performs the following:
178
179       ·    If mode is PropModeReplace, XChangeProperty discards the  previous
180            property value and stores the new data.
181
182       ·    If  mode  is  PropModePrepend  or  PropModeAppend, XChangeProperty
183            inserts the specified data before the beginning  of  the  existing
184            data or onto the end of the existing data, respectively.  The type
185            and format must match the existing property value, or  a  BadMatch
186            error  results.   If  the  property is undefined, it is treated as
187            defined with the correct type and format with zero-length data.
188
189       If the specified format is 8, the property data must be a  char  array.
190       If the specified format is 16, the property data must be a short array.
191       If the specified format is 32, the property data must be a long array.
192
193       The lifetime of a property is not tied to the storing client.   Proper‐
194       ties remain until explicitly deleted, until the window is destroyed, or
195       until the server resets.  For a discussion of  what  happens  when  the
196       connection  to  the  X  server is closed, see section 2.6.  The maximum
197       size of a property is server dependent and can vary dynamically depend‐
198       ing  on  the  amount  of memory the server has available.  (If there is
199       insufficient space, a BadAlloc error results.)
200
201       XChangeProperty can generate BadAlloc, BadAtom, BadMatch, BadValue, and
202       BadWindow errors.
203
204       The XRotateWindowProperties function allows you to rotate properties on
205       a window and causes the X server to generate PropertyNotify events.  If
206       the property names in the properties array are viewed as being numbered
207       starting from zero and if there are  num_prop  property  names  in  the
208       list,  then the value associated with property name I becomes the value
209       associated with property name (I + npositions) mod N  for  all  I  from
210       zero to N - 1.  The effect is to rotate the states by npositions places
211       around the virtual ring of property names (right  for  positive  nposi‐
212       tions,  left for negative npositions).  If npositions mod N is nonzero,
213       the X server generates a PropertyNotify event for each property in  the
214       order  that  they are listed in the array.  If an atom occurs more than
215       once in the list or no property with that name is defined for the  win‐
216       dow, a BadMatch error results.  If a BadAtom or BadMatch error results,
217       no properties are changed.
218
219       XRotateWindowProperties can generate BadAtom, BadMatch,  and  BadWindow
220       errors.
221
222       The XDeleteProperty function deletes the specified property only if the
223       property was defined on the specified window and causes the X server to
224       generate  a PropertyNotify event on the window unless the property does
225       not exist.
226
227       XDeleteProperty can generate BadAtom and BadWindow errors.
228

DIAGNOSTICS

230       BadAlloc  The server failed  to  allocate  the  requested  resource  or
231                 server memory.
232
233       BadAtom   A value for an Atom argument does not name a defined Atom.
234
235       BadValue  Some numeric value falls outside the range of values accepted
236                 by the request.  Unless a specific range is specified for  an
237                 argument,  the  full  range defined by the argument's type is
238                 accepted.  Any argument defined as a set of alternatives  can
239                 generate this error.
240
241       BadWindow A value for a Window argument does not name a defined Window.
242

SEE ALSO

244       XFree(3), XInternAtom(3)
245       Xlib - C Language X Interface
246
247
248
249X Version 11                     libX11 1.6.9            XGetWindowProperty(3)
Impressum