NAME

XGetWindowAttributes, XGetGeometry, XWindowAttributes - get current window attribute or geometry and current window attributes structure

SYNTAX

Status XGetWindowAttributes(Display *_d_i_s_p_l_a_y, Window _w, XWindowAttributes *_w_i_n_d_o_w___a_t_t_r_i_b_u_t_e_s___r_e_t_u_r_n); Status XGetGeometry(Display *_d_i_s_p_l_a_y, Drawable _d, Window *_r_o_o_t___r_e_t_u_r_n, int *_x___r_e_t_u_r_n, int *_y___r_e_t_u_r_n, unsigned int *_w_i_d_t_h___r_e_t_u_r_n, unsigned int *_h_e_i_g_h_t___r_e_t_u_r_n, unsigned int *_b_o_r_d_e_r___w_i_d_t_h___r_e_t_u_r_n, unsigned int *_d_e_p_t_h___r_e_t_u_r_n);

ARGUMENTS

_b_o_r_d_e_r___w_i_d_t_h___r_e_t_u_r_n Returns the border width in pixels.
_d Specifies the drawable, which can be a window or a pixmap.
_d_e_p_t_h___r_e_t_u_r_n Returns the depth of the drawable (bits per pixel for the object).
_d_i_s_p_l_a_y Specifies the connection to the X server.
_r_o_o_t___r_e_t_u_r_n Returns the root window.
_w Specifies the window whose current attributes you want to obtain.
_w_i_d_t_h___r_e_t_u_r_n
_h_e_i_g_h_t___r_e_t_u_r_n Return the drawable's dimensions (width and height).
_w_i_n_d_o_w___a_t_t_r_i_b_u_t_e_s___r_e_t_u_r_n Returns the specified window's attributes in the
_X_W_i_n_d_o_w_A_t_t_r_i_b_u_t_e_s structure.
_x___r_e_t_u_r_n
_y___r_e_t_u_r_n Return the x and y coordinates that define the location of the drawable.
For a window, these coordinates specify the upper-left outer corner relative to its parent's origin. For pixmaps, these coordinates are always zero.

DESCRIPTION

The _X_G_e_t_W_i_n_d_o_w_A_t_t_r_i_b_u_t_e_s function returns the current attributes for the specified window to an _X_W_i_n_d_o_w_A_t_t_r_i_b_u_t_e_s structure. It returns a nonzero status on success; otherwise, it returns a zero status.

_X_G_e_t_W_i_n_d_o_w_A_t_t_r_i_b_u_t_e_s can generate _B_a_d_D_r_a_w_a_b_l_e and _B_a_d_W_i_n_d_o_w errors.

The _X_G_e_t_G_e_o_m_e_t_r_y function returns the root window and the current geometry of the drawable. The geometry of the drawable includes the x and y coordinates, width and height, border width, and depth. These are described in the argument list. It is legal to pass to this function a window whose class is _I_n_p_u_t_O_n_l_y. It returns a nonzero status on success; otherwise, it returns a zero status.

STRUCTURES

The _X_W_i_n_d_o_w_A_t_t_r_i_b_u_t_e_s structure contains:


typedef struct {
     int x, y;                /* location of window */
     int width, height;       /* width and height of window */
     int border_width;        /* border width of window */
     int depth;               /* depth of window */
     Visual *visual;          /* the associated visual structure */
     Window root;             /* root of screen containing window */
     int class;               /* InputOutput, InputOnly*/
     int bit_gravity;         /* one of the bit gravity values */
     int win_gravity;         /* one of the window gravity values */
     int backing_store;       /* NotUseful, WhenMapped, Always */
     unsigned long backing_planes;/* planes to be preserved if possible */
     unsigned long backing_pixel;/* value to be used when restoring planes */
     Bool save_under;         /* boolean, should bits under be saved? */
     Colormap colormap;       /* color map to be associated with window */
     Bool map_installed;      /* boolean, is color map currently installed*/
     int map_state;           /* IsUnmapped, IsUnviewable, IsViewable */
     long all_event_masks;    /* set of events all people have interest in*/
     long your_event_mask;    /* my event mask */
     long do_not_propagate_mask;/* set of events that should not propagate */
     Bool override_redirect;  /* boolean value for override-redirect */
     Screen *screen;          /* back pointer to correct screen */
} XWindowAttributes;


The x and y members are set to the upper-left outer corner relative to the parent window's origin. The width and height members are set to the inside size of the window, not including the border. The border_width member is set to the window's border width in pixels. The depth member is set to the depth of the window (that is, bits per pixel for the object). The visual member is a pointer to the screen's associated _V_i_s_u_a_l structure. The root member is set to the root window of the screen containing the window. The class member is set to the window's class and can be either _I_n_p_u_t_O_u_t_p_u_t or _I_n_p_u_t_O_n_l_y.

The bit_gravity member is set to the window's bit gravity and can be one of the following:

lw(1.5i) lw(1.5i).
T{
_F_o_r_g_e_t_G_r_a_v_i_t_y
T}   T{
_E_a_s_t_G_r_a_v_i_t_y
T}
T{
_N_o_r_t_h_W_e_s_t_G_r_a_v_i_t_y
T}   T{
_S_o_u_t_h_W_e_s_t_G_r_a_v_i_t_y
T}
T{
_N_o_r_t_h_G_r_a_v_i_t_y
T}   T{
_S_o_u_t_h_G_r_a_v_i_t_y
T}
T{
_N_o_r_t_h_E_a_s_t_G_r_a_v_i_t_y
T}   T{
_S_o_u_t_h_E_a_s_t_G_r_a_v_i_t_y
T}
T{
_W_e_s_t_G_r_a_v_i_t_y
T}   T{
_S_t_a_t_i_c_G_r_a_v_i_t_y
T}
_C_e_n_t_e_r_G_r_a_v_i_t_y

The win_gravity member is set to the window's window gravity and can be one of the following:

lw(1.5i) lw(1.5i).
T{
_U_n_m_a_p_G_r_a_v_i_t_y
T}   T{
_E_a_s_t_G_r_a_v_i_t_y
T}
T{
_N_o_r_t_h_W_e_s_t_G_r_a_v_i_t_y
T}   T{
_S_o_u_t_h_W_e_s_t_G_r_a_v_i_t_y
T}
T{
_N_o_r_t_h_G_r_a_v_i_t_y
T}   T{
_S_o_u_t_h_G_r_a_v_i_t_y
T}
T{
_N_o_r_t_h_E_a_s_t_G_r_a_v_i_t_y
T}   T{
_S_o_u_t_h_E_a_s_t_G_r_a_v_i_t_y
T}
T{
_W_e_s_t_G_r_a_v_i_t_y
T}   T{
_S_t_a_t_i_c_G_r_a_v_i_t_y
T}
_C_e_n_t_e_r_G_r_a_v_i_t_y

For additional information on gravity, see section 3.3.

The backing_store member is set to indicate how the X server should maintain the contents of a window and can be _W_h_e_n_M_a_p_p_e_d, _A_l_w_a_y_s, or _N_o_t_U_s_e_f_u_l. The backing_planes member is set to indicate (with bits set to 1) which bit planes of the window hold dynamic data that must be preserved in backing_stores and during save_unders. The backing_pixel member is set to indicate what values to use for planes not set in backing_planes.

The save_under member is set to _T_r_u_e or _F_a_l_s_e. The colormap member is set to the colormap for the specified window and can be a colormap ID or _N_o_n_e. The map_installed member is set to indicate whether the colormap is currently installed and can be _T_r_u_e or _F_a_l_s_e. The map_state member is set to indicate the state of the window and can be _I_s_U_n_m_a_p_p_e_d, _I_s_U_n_v_i_e_w_a_b_l_e, or _I_s_V_i_e_w_a_b_l_e. _I_s_U_n_v_i_e_w_a_b_l_e is used if the window is mapped but some ancestor is unmapped.

The all_event_masks member is set to the bitwise inclusive OR of all event masks selected on the window by all clients. The your_event_mask member is set to the bitwise inclusive OR of all event masks selected by the querying client. The do_not_propagate_mask member is set to the bitwise inclusive OR of the set of events that should not propagate.

The override_redirect member is set to indicate whether this window overrides structure control facilities and can be _T_r_u_e or _F_a_l_s_e. Window manager clients should ignore the window if this member is _T_r_u_e.

The screen member is set to a screen pointer that gives you a back pointer to the correct screen. This makes it easier to obtain the screen information without having to loop over the root window fields to see which field matches.

DIAGNOSTICS

_B_a_d_D_r_a_w_a_b_l_e
A value for a Drawable argument does not name a defined Window or Pixmap.
_B_a_d_W_i_n_d_o_w
A value for a Window argument does not name a defined Window.

SEE ALSO

XQueryPointer(3X11), XQueryTree(3X11)
_X_l_i_b _- _C _L_a_n_g_u_a_g_e _X _I_n_t_e_r_f_a_c_e