NAME

XQueryDeviceState - query the state of an extension input device.

SYNTAX

int XQueryDeviceState(Display *_d_i_s_p_l_a_y, XDevice *_d_e_v_i_c_e);

ARGUMENTS

display
Specifies the connection to the X server.
device
Specifies the device whose state is to be queried.

DESCRIPTION

The _X_Q_u_e_r_y_D_e_v_i_c_e_S_t_a_t_e request queries the state of an input device. The current state of keys and buttons (up or down), and valuators (current value) on the device is reported by this request. Each key or button is represented by a bit in the _X_D_e_v_i_c_e_S_t_a_t_e structure that is returned. Valuators on the device report 0 if they are reporting relative information, and the current value if they are reporting absolute information.

_X_Q_u_e_r_y_D_e_v_i_c_e_S_t_a_t_e can generate a _B_a_d_D_e_v_i_c_e error.

STRUCTURES

The _X_D_e_v_i_c_e_S_t_a_t_e structure contains:


typedef struct {
        XID device_id;
        int num_classes;
        XInputClass *data;
} XDeviceState;

The _X_V_a_l_u_a_t_o_r_S_t_a_t_e structure contains:


typedef struct {
        unsigned char class;
        unsigned char length;
        unsigned char num_valuators;
        unsigned char mode;
        int *valuators;
} XValuatorState;

The _X_K_e_y_S_t_a_t_e structure contains:


typedef struct {
        unsigned char class;
        unsigned char length;
        short         num_keys;
        char keys[32];
} XKeyState;

The _X_B_u_t_t_o_n_S_t_a_t_e structure contains:


typedef struct {
        unsigned char class;
        unsigned char length;
        short         num_buttons;
        char buttons[32];
} XButtonState;

DIAGNOSTICS

_B_a_d_D_e_v_i_c_e
An invalid device was specified. The specified device does not exist or has not been opened by this client via _X_O_p_e_n_I_n_p_u_t_D_e_v_i_c_e. This error may also occur if some other client has caused the specified device to become the X keyboard or X pointer device via the _X_C_h_a_n_g_e_K_e_y_b_o_a_r_d_D_e_v_i_c_e or _X_C_h_a_n_g_e_P_o_i_n_t_e_r_D_e_v_i_c_e requests.

SEE ALSO


_P_r_o_g_r_a_m_m_i_n_g _w_i_t_h _X_l_i_b