NAME

XFlush, XSync, XEventsQueued, XPending - handle output buffer or event queue

SYNTAX

int XFlush(Display *_d_i_s_p_l_a_y); int XSync(Display *_d_i_s_p_l_a_y, Bool _d_i_s_c_a_r_d); int XEventsQueued(Display *_d_i_s_p_l_a_y, int _m_o_d_e); int XPending(Display *_d_i_s_p_l_a_y);

ARGUMENTS

_d_i_s_c_a_r_d Specifies a Boolean value that indicates whether
_X_S_y_n_c discards all events on the event queue.
_d_i_s_p_l_a_y Specifies the connection to the X server.
_m_o_d_e Specifies the mode.
You can pass _Q_u_e_u_e_d_A_l_r_e_a_d_y, _Q_u_e_u_e_d_A_f_t_e_r_F_l_u_s_h, or _Q_u_e_u_e_d_A_f_t_e_r_R_e_a_d_i_n_g.

DESCRIPTION

The _X_F_l_u_s_h function flushes the output buffer. Most client applications need not use this function because the output buffer is automatically flushed as needed by calls to _X_P_e_n_d_i_n_g, _X_N_e_x_t_E_v_e_n_t, and _X_W_i_n_d_o_w_E_v_e_n_t. Events generated by the server may be enqueued into the library's event queue.

The _X_S_y_n_c function flushes the output buffer and then waits until all requests have been received and processed by the X server. Any errors generated must be handled by the error handler. For each protocol error received by Xlib, _X_S_y_n_c calls the client application's error handling routine (see section 11.8.2). Any events generated by the server are enqueued into the library's event queue.

Finally, if you passed _F_a_l_s_e, _X_S_y_n_c does not discard the events in the queue. If you passed _T_r_u_e, _X_S_y_n_c discards all events in the queue, including those events that were on the queue before _X_S_y_n_c was called. Client applications seldom need to call _X_S_y_n_c.

If mode is _Q_u_e_u_e_d_A_l_r_e_a_d_y, _X_E_v_e_n_t_s_Q_u_e_u_e_d returns the number of events already in the event queue (and never performs a system call). If mode is _Q_u_e_u_e_d_A_f_t_e_r_F_l_u_s_h, _X_E_v_e_n_t_s_Q_u_e_u_e_d returns the number of events already in the queue if the number is nonzero. If there are no events in the queue, _X_E_v_e_n_t_s_Q_u_e_u_e_d flushes the output buffer, attempts to read more events out of the application's connection, and returns the number read. If mode is _Q_u_e_u_e_d_A_f_t_e_r_R_e_a_d_i_n_g, _X_E_v_e_n_t_s_Q_u_e_u_e_d returns the number of events already in the queue if the number is nonzero. If there are no events in the queue, _X_E_v_e_n_t_s_Q_u_e_u_e_d attempts to read more events out of the application's connection without flushing the output buffer and returns the number read.

_X_E_v_e_n_t_s_Q_u_e_u_e_d always returns immediately without I/O if there are events already in the queue. _X_E_v_e_n_t_s_Q_u_e_u_e_d with mode _Q_u_e_u_e_d_A_f_t_e_r_F_l_u_s_h is identical in behavior to _X_P_e_n_d_i_n_g. _X_E_v_e_n_t_s_Q_u_e_u_e_d with mode _Q_u_e_u_e_d_A_l_r_e_a_d_y is identical to the _X_Q_L_e_n_g_t_h function.

The _X_P_e_n_d_i_n_g function returns the number of events that have been received from the X server but have not been removed from the event queue. _X_P_e_n_d_i_n_g is identical to _X_E_v_e_n_t_s_Q_u_e_u_e_d with the mode _Q_u_e_u_e_d_A_f_t_e_r_F_l_u_s_h specified.

SEE ALSO

AllPlanes(3X11), XIfEvent(3X11), XNextEvent(3X11), XPutBackEvent(3X11)
_X_l_i_b _- _C _L_a_n_g_u_a_g_e _X _I_n_t_e_r_f_a_c_e