XOpenDevice(3X11) AIX (X FUNCTIONS) XOpenDevice(3X11) NAME XOpenDevice, XCloseDevice - open or close an extension input device SYNTAX XXXXDDDDeeeevvvviiiicccceeee ****XXXXOOOOppppeeeennnnDDDDeeeevvvviiiicccceeee((((_d_i_s_p_l_a_y,,,, _d_e_v_i_c_e__i_d)))) DDDDiiiissssppppllllaaaayyyy ****_d_i_s_p_l_a_y;;;; XXXXIIIIDDDD _d_e_v_i_c_e__i_d;;;; XXXXCCCClllloooosssseeeeDDDDeeeevvvviiiicccceeee((((_d_i_s_p_l_a_y,,,, _d_e_v_i_c_e)))) DDDDiiiissssppppllllaaaayyyy ****_d_i_s_p_l_a_y;;;; XXXXDDDDeeeevvvviiiicccceeee ****_d_e_v_i_c_e;;;; ARGUMENTS _d_i_s_p_l_a_y Specifies the connection to the X server. _d_e_v_i_c_e__i_d Specifies the id of the device to be opened _d_e_v_i_c_e Specifies the device to be closed DESCRIPTION The _X_O_p_e_n_D_e_v_i_c_e request makes an input device accessible to a client through input extension protocol requests. If suc- cessful, it returns a pointer to an XXXXDDDDeeeevvvviiiicccceeee structure. The _X_C_l_o_s_e_D_e_v_i_c_e request makes an input device inaccessible to a client through input extension protocol requests. Before terminating, and client that has opened input devices through the input extension should close them via _C_l_o_s_e_D_e_v_- _i_c_e. When a client makes an _X_C_l_o_s_e_D_e_v_i_c_e request, any active grabs that the client has on the device are released. Any event selections that the client has are deleted, as well as any passive grabs. If the requesting client is the last client accessing the device, the server may disable all access by X to the device. _X_O_p_e_n_D_e_v_i_c_e and _X_C_l_o_s_e_D_e_v_i_c_e can generate a _B_a_d_D_e_v_i_c_e error. STRUCTURES The _X_D_e_v_i_c_e structure returned by _X_O_p_e_n_D_e_v_i_c_e contains: typedef struct { XID device_id; int num_classes; XInputClassInfo *classes; } XDevice; The classes field is a pointer to an array of XInputClas- sInfo structures. Each element of this array contains an event type base for a class of input supported by the speci- fied device. The num_classes field indicates the number of Rev. Release 5 Page 1 XOpenDevice(3X11) AIX (X FUNCTIONS) XOpenDevice(3X11) elements in the classes array. The _X_I_n_p_u_t_C_l_a_s_s_I_n_f_o structure contains: typedef struct { unsigned char input_class; unsigned char event_type_base; } XInputClassInfo; The input_class field identifies one class of input sup- ported by the device. Defined types include _K_e_y_C_l_a_s_s, _B_u_t_- _t_o_n_C_l_a_s_s, _V_a_l_u_a_t_o_r_C_l_a_s_s, _P_r_o_x_i_m_i_t_y_C_l_a_s_s, _F_e_e_d_b_a_c_k_C_l_a_s_s, _F_o_c_u_s_C_l_a_s_s, and _O_t_h_e_r_C_l_a_s_s. The event_type_base identifies the event type of the first event in that class. The information contained in the _X_I_n_p_u_t_C_l_a_s_s_I_n_f_o structure is used by macros to obtain the event classes that clients use in making _X_S_e_l_e_c_t_E_x_t_e_n_s_i_o_n_E_v_e_n_t requests. Currently defined macros include _D_e_v_i_c_e_K_e_y_P_r_e_s_s, _D_e_v_i_c_e_K_e_y_R_e_l_e_a_s_e, _D_e_v_i_c_e_B_u_t_t_o_n_P_r_e_s_s, _D_e_v_i_c_e_B_u_t_t_o_n_R_e_l_e_s_e, _D_e_v_i_c_e_M_o_t_i_o_n_N_o_t_i_f_y, _D_e_v_i_c_e_F_o_c_u_s_I_n, _D_e_v_i_c_e_F_o_c_u_s_O_u_t, _P_r_o_x_i_m_i_t_y_I_n, _P_r_o_x_i_m_i_t_y_O_u_t, _D_e_v_i_c_e_S_t_a_t_e_N_o_t_i_f_y, _D_e_v_i_c_e_M_a_p_p_i_i_n_g_N_o_t_i_f_y, _C_h_a_n_g_e_D_e_v_i_c_e_N_o_t_i_f_y, _D_e_v_i_c_e_P_o_i_n_t_e_r_M_o_t_i_o_n_H_i_n_t, _D_e_v_i_c_e_B_u_t_t_o_n_1_M_o_t_i_o_n, _D_e_v_i_c_e_B_u_t_t_o_n_2_M_o_t_i_o_n, _D_e_v_i_c_e_B_u_t_t_o_n_3_M_o_t_i_o_n, _D_e_v_i_c_e_B_u_t_t_o_n_4_M_o_t_i_o_n, _D_e_v_i_c_e_B_u_t_t_o_n_5_M_o_t_i_o_n, _D_e_v_i_c_e_B_u_t_t_o_n_M_o_- _t_i_o_n, _D_e_v_i_c_e_O_w_n_e_r_G_r_a_b_B_u_t_t_o_n, _D_e_v_i_c_e_B_u_t_t_o_n_P_r_e_s_s_G_r_a_b, and _N_o_E_x_t_e_n_s_i_o_n_E_v_e_n_t. To obtain the proper event class for a particular device, one of the above macros is invoked using the _X_D_e_v_i_c_e struc- ture for that device. For example, DeviceKeyPress (*device, type, eventclass); returns the _D_e_v_i_c_e_K_e_y_P_r_e_s_s event type and the eventclass for _D_e_v_i_c_e_K_e_y_P_r_e_s_s events from the specified device. This _e_v_e_n_t_c_l_a_s_s can then be used in an _X_S_e_l_e_c_t_E_x_t_e_n_s_i_o_n_E_v_e_n_t request to ask the server to send _D_e_v_i_c_e_K_e_y_P_r_e_s_s events from this device. When a selected event is received via _X_N_e_x_- _t_E_v_e_n_t, the _t_y_p_e can be used for comparison with the type in the event. DIAGNOSTICS _B_a_d_D_e_v_i_c_e An invalid device was specified. The specified device does not exist, or is the X keyboard or X pointer. 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 Rev. Release 5 Page 2 XOpenDevice(3X11) AIX (X FUNCTIONS) XOpenDevice(3X11) _P_r_o_g_r_a_m_m_i_n_g _w_i_t_h _X_l_i_b Rev. Release 5 Page 3