NAME
XGetWindowProperty, XListProperties, XChangeProperty, XRotateWindowProperties, XDeleteProperty - obtain and change window properties
SYNTAX
int XGetWindowProperty(Display *_d_i_s_p_l_a_y, Window _w, Atom
_p_r_o_p_e_r_t_y, long _l_o_n_g___o_f_f_s_e_t, long _l_o_n_g___l_e_n_g_t_h, Bool
_d_e_l_e_t_e, Atom _r_e_q___t_y_p_e, Atom *_a_c_t_u_a_l___t_y_p_e___r_e_t_u_r_n, int
*_a_c_t_u_a_l___f_o_r_m_a_t___r_e_t_u_r_n, unsigned long *_n_i_t_e_m_s___r_e_t_u_r_n, unsigned
long *_b_y_t_e_s___a_f_t_e_r___r_e_t_u_r_n, unsigned char **_p_r_o_p___r_e_t_u_r_n);
Atom *XListProperties(Display *_d_i_s_p_l_a_y, Window _w, int
*_n_u_m___p_r_o_p___r_e_t_u_r_n);
int XChangeProperty(Display *_d_i_s_p_l_a_y, Window _w, Atom
_p_r_o_p_e_r_t_y, Atom _t_y_p_e, int _f_o_r_m_a_t, int _m_o_d_e,
unsigned char *_d_a_t_a, int _n_e_l_e_m_e_n_t_s);
int XRotateWindowProperties(Display *_d_i_s_p_l_a_y, Window _w,
Atom _p_r_o_p_e_r_t_i_e_s[], int _n_u_m___p_r_o_p, int _n_p_o_s_i_t_i_o_n_s);
int XDeleteProperty(Display *_d_i_s_p_l_a_y, Window _w, Atom
_p_r_o_p_e_r_t_y);
ARGUMENTS
-
_a_c_t_u_a_l___f_o_r_m_a_t___r_e_t_u_r_n
Returns the actual format of the property.
-
-
_a_c_t_u_a_l___t_y_p_e___r_e_t_u_r_n
Returns the atom identifier that defines the actual type of the property.
-
-
_b_y_t_e_s___a_f_t_e_r___r_e_t_u_r_n
Returns the number of bytes remaining to be read in the property if
-
a partial read was performed.
-
_d_a_t_a
Specifies the property data.
-
-
_d_e_l_e_t_e
Specifies a Boolean value that determines whether the property is deleted.
-
-
_d_i_s_p_l_a_y
Specifies the connection to the X server.
-
-
_f_o_r_m_a_t
Specifies whether the data should be viewed as a list
-
of 8-bit, 16-bit, or 32-bit quantities.
Possible values are 8, 16, and 32.
This information allows the X server to correctly perform
byte-swap operations as necessary.
If the format is 16-bit or 32-bit,
you must explicitly cast your data pointer to an (unsigned char *) in the call
to
_X_C_h_a_n_g_e_P_r_o_p_e_r_t_y.
-
_l_o_n_g___l_e_n_g_t_h
Specifies the length in 32-bit multiples of the data to be retrieved.
-
-
_l_o_n_g___o_f_f_s_e_t
Specifies the offset in the specified property (in 32-bit quantities)
-
where the data is to be retrieved.
-
_m_o_d_e
Specifies the mode of the operation.
-
You can pass
_P_r_o_p_M_o_d_e_R_e_p_l_a_c_e,
_P_r_o_p_M_o_d_e_P_r_e_p_e_n_d,
or
_P_r_o_p_M_o_d_e_A_p_p_e_n_d.
-
_n_e_l_e_m_e_n_t_s
Specifies the number of elements of the specified data format.
-
-
_n_i_t_e_m_s___r_e_t_u_r_n
Returns the actual number of 8-bit, 16-bit, or 32-bit items
-
stored in the prop_return data.
-
_n_u_m___p_r_o_p
Specifies the length of the properties array.
-
-
_n_u_m___p_r_o_p___r_e_t_u_r_n
Returns the length of the properties array.
-
-
_n_p_o_s_i_t_i_o_n_s
Specifies the rotation amount.
-
-
_p_r_o_p___r_e_t_u_r_n
Returns the data in the specified format.
-
-
_p_r_o_p_e_r_t_y
Specifies the property name.
-
-
_p_r_o_p_e_r_t_i_e_s
Specifies the array of properties that are to be rotated.
-
-
_r_e_q___t_y_p_e
Specifies the atom identifier associated with the property type or
-
_A_n_y_P_r_o_p_e_r_t_y_T_y_p_e.
-
_t_y_p_e
Specifies the type of the property.
-
The X server does not interpret the type but simply
passes it back to an application that later calls
_X_G_e_t_W_i_n_d_o_w_P_r_o_p_e_r_t_y.
-
_w
Specifies the window whose property you want to obtain, change, rotate or delete.
-
DESCRIPTION
The
_X_G_e_t_W_i_n_d_o_w_P_r_o_p_e_r_t_y
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.
_X_G_e_t_W_i_n_d_o_w_P_r_o_p_e_r_t_y
sets the return arguments as follows:
-
·
If the specified property does not exist for the specified window,
-
_X_G_e_t_W_i_n_d_o_w_P_r_o_p_e_r_t_y
returns
_N_o_n_e
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.
-
·
If the specified property exists
-
but its type does not match the specified type,
_X_G_e_t_W_i_n_d_o_w_P_r_o_p_e_r_t_y
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.
-
·
If the specified property exists and either you assign
-
_A_n_y_P_r_o_p_e_r_t_y_T_y_p_e
to the req_type argument or the specified type matches the actual property type,
_X_G_e_t_W_i_n_d_o_w_P_r_o_p_e_r_t_y
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:
-
-
N = actual length of the stored property in bytes
(even if the format is 16 or 32)
I = 4 * long_offset
T = N - I
L = MINIMUM(T, 4 * long_length)
A = N - (I + L)
-
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
_B_a_d_V_a_l_u_e
error results.
The value of bytes_after_return is A,
giving the number of trailing unread bytes in the stored property.
If the returned format is 8, the returned data is represented as a
_c_h_a_r
array.
If the returned format is 16, the returned data is represented as a
_s_h_o_r_t
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
_l_o_n_g
array and should be cast to that type to obtain the elements.
_X_G_e_t_W_i_n_d_o_w_P_r_o_p_e_r_t_y
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.
If delete is
_T_r_u_e
and bytes_after_return is zero,
_X_G_e_t_W_i_n_d_o_w_P_r_o_p_e_r_t_y
deletes the property
from the window and generates a
_P_r_o_p_e_r_t_y_N_o_t_i_f_y
event on the window.
The function returns
_S_u_c_c_e_s_s
if it executes successfully.
To free the resulting data,
use
_X_F_r_e_e.
_X_G_e_t_W_i_n_d_o_w_P_r_o_p_e_r_t_y
can generate
_B_a_d_A_t_o_m,
_B_a_d_V_a_l_u_e,
and
_B_a_d_W_i_n_d_o_w
errors.
The
_X_L_i_s_t_P_r_o_p_e_r_t_i_e_s
function returns a pointer to an array of atom properties that are defined for
the specified window or returns NULL if no properties were found.
To free the memory allocated by this function, use
_X_F_r_e_e.
_X_L_i_s_t_P_r_o_p_e_r_t_i_e_s
can generate a
_B_a_d_W_i_n_d_o_w
error.
The
_X_C_h_a_n_g_e_P_r_o_p_e_r_t_y
function alters the property for the specified window and
causes the X server to generate a
_P_r_o_p_e_r_t_y_N_o_t_i_f_y
event on that window.
_X_C_h_a_n_g_e_P_r_o_p_e_r_t_y
performs the following:
-
·
If mode is
-
_P_r_o_p_M_o_d_e_R_e_p_l_a_c_e,
_X_C_h_a_n_g_e_P_r_o_p_e_r_t_y
discards the previous property value and stores the new data.
-
·
If mode is
-
_P_r_o_p_M_o_d_e_P_r_e_p_e_n_d
or
_P_r_o_p_M_o_d_e_A_p_p_e_n_d,
_X_C_h_a_n_g_e_P_r_o_p_e_r_t_y
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
_B_a_d_M_a_t_c_h
error results.
If the property is undefined,
it is treated as defined with the correct type and
format with zero-length data.
If the specified format is 8, the property data must be a
_c_h_a_r
array.
If the specified format is 16, the property data must be a
_s_h_o_r_t
array.
If the specified format is 32, the property data must be a
_l_o_n_g
array.
The lifetime of a property is not tied to the storing client.
Properties remain until explicitly deleted, until the window is destroyed,
or until the server resets.
For a discussion of what happens when the connection to the X server is closed,
see section 2.6.
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
_B_a_d_A_l_l_o_c
error results.)
_X_C_h_a_n_g_e_P_r_o_p_e_r_t_y
can generate
_B_a_d_A_l_l_o_c,
_B_a_d_A_t_o_m,
_B_a_d_M_a_t_c_h,
_B_a_d_V_a_l_u_e,
and
_B_a_d_W_i_n_d_o_w
errors.
The
_X_R_o_t_a_t_e_W_i_n_d_o_w_P_r_o_p_e_r_t_i_e_s
function allows you to rotate properties on a window and causes
the X server to generate
_P_r_o_p_e_r_t_y_N_o_t_i_f_y
events.
If the property names in the properties array are viewed as being numbered
starting from zero and if there are num_prop property names in the list,
then the value associated with property name I becomes the value associated
with property name (I + npositions) mod N for all I from zero to N - 1.
The effect is to rotate the states by npositions places around the virtual ring
of property names (right for positive npositions,
left for negative npositions).
If npositions mod N is nonzero,
the X server generates a
_P_r_o_p_e_r_t_y_N_o_t_i_f_y
event for each property in the order that they are listed in the array.
If an atom occurs more than once in the list or no property with that
name is defined for the window,
a
_B_a_d_M_a_t_c_h
error results.
If a
_B_a_d_A_t_o_m
or
_B_a_d_M_a_t_c_h
error results,
no properties are changed.
_X_R_o_t_a_t_e_W_i_n_d_o_w_P_r_o_p_e_r_t_i_e_s
can generate
_B_a_d_A_t_o_m,
_B_a_d_M_a_t_c_h,
and
_B_a_d_W_i_n_d_o_w
errors.
The
_X_D_e_l_e_t_e_P_r_o_p_e_r_t_y
function deletes the specified property only if the
property was defined on the specified window
and causes the X server to generate a
_P_r_o_p_e_r_t_y_N_o_t_i_f_y
event on the window unless the property does not exist.
_X_D_e_l_e_t_e_P_r_o_p_e_r_t_y
can generate
_B_a_d_A_t_o_m
and
_B_a_d_W_i_n_d_o_w
errors.
DIAGNOSTICS
-
_B_a_d_A_l_l_o_c
-
The server failed to allocate the requested resource or server memory.
-
_B_a_d_A_t_o_m
-
A value for an Atom argument does not name a defined Atom.
-
_B_a_d_V_a_l_u_e
-
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.
-
_B_a_d_W_i_n_d_o_w
-
A value for a Window argument does not name a defined Window.
SEE ALSO
XFree(3X11),
XInternAtom(3X11)
_X_l_i_b _- _C _L_a_n_g_u_a_g_e _X _I_n_t_e_r_f_a_c_e