1XIfEvent(3)                     XLIB FUNCTIONS                     XIfEvent(3)
2
3
4

NAME

6       XIfEvent, XCheckIfEvent, XPeekIfEvent - check the event queue with a
7       predicate procedure
8

SYNTAX

10       int XIfEvent(Display *display, XEvent *event_return, Bool (*predi‐
11              cate)(), XPointer arg);
12
13       Bool XCheckIfEvent(Display *display, XEvent *event_return, Bool (*pred‐
14              icate)(), XPointer arg);
15
16       int XPeekIfEvent(Display *display, XEvent *event_return, Bool (*predi‐
17              cate)(), XPointer arg);
18

ARGUMENTS

20       arg       Specifies the user-supplied argument that will be passed to
21                 the predicate procedure.
22
23       display   Specifies the connection to the X server.
24
25       event_return
26                 Returns either a copy of or  the matched event's associated
27                 structure.
28
29       predicate Specifies the procedure that is to be called to determine if
30                 the next event in the queue matches what you want.
31

DESCRIPTION

33       The XIfEvent function completes only when the specified predicate pro‐
34       cedure returns True for an event, which indicates an event in the queue
35       matches.  XIfEvent flushes the output buffer if it blocks waiting for
36       additional events.  XIfEvent removes the matching event from the queue
37       and copies the structure into the client-supplied XEvent structure.
38
39       When the predicate procedure finds a match, XCheckIfEvent copies the
40       matched event into the client-supplied XEvent structure and returns
41       True.  (This event is removed from the queue.)  If the predicate proce‐
42       dure finds no match, XCheckIfEvent returns False, and the output buffer
43       will have been flushed.  All earlier events stored in the queue are not
44       discarded.
45
46       The XPeekIfEvent function returns only when the specified predicate
47       procedure returns True for an event.  After the predicate procedure
48       finds a match, XPeekIfEvent copies the matched event into the client-
49       supplied XEvent structure without removing the event from the queue.
50       XPeekIfEvent flushes the output buffer if it blocks waiting for addi‐
51       tional events.
52
53       Each of these functions requires you to pass a predicate procedure that
54       determines if an event matches what you want.  Your predicate procedure
55       must decide if the event is useful without calling any Xlib functions.
56       If the predicate directly or indirectly causes the state of the event
57       queue to change, the result is not defined.  If Xlib has been initial‐
58       ized for threads, the predicate is called with the display locked and
59       the result of a call by the predicate to any Xlib function that locks
60       the display is not defined unless the caller has first called XLockDis‐
61       play.
62
63       The predicate procedure and its associated arguments are:
64
65       Bool (*predicate)(Display *display, XEvent *event, XPointer arg)
66
67       display   Specifies the connection to the X server.
68
69       event     Specifies the XEvent structure.
70
71       arg       Specifies the argument passed in from the XIfEvent, XCheck‐
72                 IfEvent, or XPeekIfEvent function.
73
74       The predicate procedure is called once for each event in the queue
75       until it finds a match.  After finding a match, the predicate procedure
76       must return True.  If it did not find a match, it must return False.
77

SEE ALSO

79       XAnyEvent(3), XNextEvent(3), XPutBackEvent(3) XSendEvent(3)
80       Xlib - C Language X Interface
81
82
83
84X Version 11                     libX11 1.6.4                      XIfEvent(3)
Impressum