NAME
XOpenDevice, XCloseDevice - open or close an extension input device
SYNTAX
XDevice *XOpenDevice(Display *_d_i_s_p_l_a_y, XID _d_e_v_i_c_e___i_d);
XCloseDevice(Display *_d_i_s_p_l_a_y, XDevice *_d_e_v_i_c_e);
_<_h_3 _i_d_=_"_A_R_G_U_M_E_N_T_S_"_> _A_R_G_U_M_E_N_T_S _<_/_h_3_>
_<_d_l _c_o_m_p_a_c_t_>
_<_d_t_>
_<_i_>_d_i_s_p_l_a_y_<_/_i_>
_<_d_d_>
_S_p_e_c_i_f_i_e_s _t_h_e _c_o_n_n_e_c_t_i_o_n _t_o _t_h_e _X _s_e_r_v_e_r_.
_<_d_t_>
_<_i_>_d_e_v_i_c_e___i_d_<_/_i_>
_<_d_d_>
_S_p_e_c_i_f_i_e_s _t_h_e _i_d _o_f _t_h_e _d_e_v_i_c_e _t_o _b_e _o_p_e_n_e_d
_<_d_t_>
_<_i_>_d_e_v_i_c_e_<_/_i_>
_<_d_d_>
_S_p_e_c_i_f_i_e_s _t_h_e _d_e_v_i_c_e _t_o _b_e _c_l_o_s_e_d
_<_/_d_l_>
_<_h_3 _i_d_=_"_D_E_S_C_R_I_P_T_I_O_N_"_> _D_E_S_C_R_I_P_T_I_O_N _<_/_h_3_>
_T_h_e _X_O_p_e_n_D_e_v_i_c_e
_r_e_q_u_e_s_t _m_a_k_e_s _a_n _i_n_p_u_t _d_e_v_i_c_e _a_c_c_e_s_s_i_b_l_e _t_o _a _c_l_i_e_n_t _t_h_r_o_u_g_h _i_n_p_u_t _e_x_t_e_n_s_i_o_n
_p_r_o_t_o_c_o_l _r_e_q_u_e_s_t_s_. _I_f _s_u_c_c_e_s_s_f_u_l_, _i_t _r_e_t_u_r_n_s _a _p_o_i_n_t_e_r _t_o _a_n XXDDeevviiccee
_s_t_r_u_c_t_u_r_e_.
_<_p_>
_T_h_e _X_C_l_o_s_e_D_e_v_i_c_e _r_e_q_u_e_s_t _m_a_k_e_s _a_n _i_n_p_u_t _d_e_v_i_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