📄 xgetwindowproperty.html
字号:
<HTML><HEAD><TITLE>Xlib Programming Manual: XGetWindowProperty</TITLE></HEAD><BODY><H1 ALIGN=center>XGetWindowProperty</H1><H2>Syntax</H2><!.IN "Property" "getting"><P><!.IN "XGetWindowProperty" "" "@DEF@"><CODE><PRE>int XGetWindowProperty(<B>display</B>, <B>w</B>, <B>property</B>, <B>long_offset</B>, <B>long_length</B>, <B>delete</B>, <B>req_type</B>, <B>actual_type_return</B>, <B>actual_format_return</B>, <B>nitems_return</B>, <B>bytes_after_return</B>, <B>prop_return</B>) Display *<B>display</B>; Window <B>w</B>; Atom <B>property</B>; long <B>long_offset</B>, <B>long_length</B>; Bool <B>delete</B>; Atom <B>req_type</B>; Atom *<B>actual_type_return</B>; int *<B>actual_format_return</B>; unsigned long *<B>nitems_return</B>; unsigned long *<B>bytes_after_return</B>; unsigned char **<B>prop_return</B>;</PRE></CODE><H2>Arguments</H2><TABLE><TR><TD> <B>display</B><TD> Specifies the connection to the X server.<TR><TD> <B>w</B><TD> Specifies the window whose property you want to obtain.<TR><TD> <B>property</B><TD> Specifies the property name.<TR><TD> <B>long_offset</B><TD> Specifies the offset in the specified property (in 32-bit quantities) where the data is to be retrieved.<TR><TD> <B>long_length</B><TD> Specifies the length in 32-bit multiples of the data to be retrieved.<TR><TD> <B>delete</B><TD> Specifies a Boolean value that determines whether the property is deleted.<TR><TD> <B>req_type</B><TD> Specifies the atom identifier associated with the property type or<B>AnyPropertyType</B>.<TR><TD> <B>actual_type_return</B><TD> Returns the atom identifier that defines the actual type of the property.<TR><TD> <B>actual_format_return</B><TD> Returns the actual format of the property.<TR><TD> <B>nitems_return</B><TD> Returns the actual number of 8-bit, 16-bit, or 32-bit items stored in the prop_return data.<TR><TD> <B>bytes_after_return</B><TD> Returns the number of bytes remaining to be read in the property if a partial read was performed.<TR><TD> <B>prop_return</B><TD> Returns the data in the specified format.</TABLE><H2>Description</H2>The<B>XGetWindowProperty()</B>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 remainingto be read in the property; and a pointer to the data actually returned.<B>XGetWindowProperty()</B>sets the return arguments as follows:<UL><P><LI>If the specified property does not exist for the specified window,<B>XGetWindowProperty()</B>returns <B>None</B>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.<P><LI>If the specified property exists but its type does not match the specified type,<B>XGetWindowProperty()</B>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.<P><LI>If the specified property exists and either you assign <B>AnyPropertyType</B>to the req_type argument or the specified type matches the actual property type,<B>XGetWindowProperty()</B>returns the actual property type to actual_type_return and the actualproperty format (never zero) to actual_format_return. It also returns a value to bytes_after_return and nitems_return, by defining the followingvalues:<BLOCKQUOTE>N = actual length of the stored property in bytes (even if the format is 16 or 32)<BR>I = 4 * long_offset<BR>T = N - I<BR>L = MINIMUM(T, 4 * long_length)<BR>A = N - (I + L)<BR></BLOCKQUOTE>The returned value starts at byte index I in the property (indexingfrom zero), and its length in bytes is L.If the value for long_offset causes L to be negative,a<B>BadValue</B>error results. The value of bytes_after_return is A, giving the number of trailing unread bytes in the stored property.</UL>If the returned format is 8, the returned data is represented as a<B>char</B>array.If the returned format is 16, the returned data is represented as a<B>short</B>array and should be cast to that type to obtain the elements.If the returned format is 32, the returned data is represented as a<B>long</B>array and should be cast to that type to obtain the elements.<P><B>XGetWindowProperty()</B>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 charactersdo not have to be copied into yet another string before use.<P>If delete is <B>True</B>and bytes_after_return is zero, <B>XGetWindowProperty()</B>deletes the property from the window and generates a <B><A HREF="../events/client-communication/property.html">PropertyNotify</A></B> event on the window.<P>The function returns<B>Success</B>if it executes successfully.To free the resulting data,use<B><A HREF="../display/XFree.html">XFree()</A></B>.<P><B>XGetWindowProperty()</B>can generate<B>BadAtom</B>,<B>BadValue</B> ,and<B>BadWindow</B> errors.<H2>Diagnostics</H2><TABLE><TR><TD><B>BadAtom</B><TD> A value for an Atom argument does not name a defined Atom.<TR><TD><B>BadValue</B><TD> 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's type is accepted. Any argument defined as a set of alternatives can generate this error.<TR><TD><B>BadWindow</B><TD>A value for a Window argument does not name a defined Window.</TABLE><H2>See also</H2><B><A HREF="XChangeProperty.html">XChangeProperty()</A></B>,<B><A HREF="XDeleteProperty.html">XDeleteProperty()</A></B>,<B><A HREF="XListProperties.html">XListProperties()</A></B>,<B><A HREF="XRotateWindowProperties.html">XRotateWindowProperties()</A></B>,"<A HREF="obtain-properties.html">Obtaining and Changing Window Properties</A>"<HR><ADDRESS><A HREF="http://tronche.com/">Christophe Tronche</A>, <A HREF="mailto:ch.tronche@computer.org">ch.tronche@computer.org</A></ADDRESS></BODY></HTML>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -