⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 selecting-using-predicate.html

📁 linux图形界面x liberary手册
💻 HTML
字号:
<HTML><HEAD><TITLE>Xlib Programming Manual: Selecting Events Using a Predicate Procedure</TITLE></HEAD><BODY><H1 ALIGN=center>11.4.2 Selecting Events Using a Predicate Procedure</H1>Each of the functions discussed in this section requires you topass a predicate procedure that determines if an event matches what you want.Your predicate procedure must decide if the event is usefulwithout calling any Xlib functions.If the predicate directly or indirectly causes the state of the event queueto change, the result is not defined.If Xlib has been initialized for threads, the predicate is called withthe display locked and the result of a call by the predicate to anyXlib function that locks the display is not defined unless the callerhas first called<B><A HREF="../../display/XLockDisplay.html">XLockDisplay()</A></B>.<A NAME="predicate"></A><P>The predicate procedure and its associated arguments are:<CODE><PRE>Bool (*<B>predicate</B>)(<B>display</B>, <B>event</B>, <B>arg</B>)     <A HREF="../../display/opening.html#Display">Display</A> *<B>display</B>;     <A HREF="../../events/structures.html#XEvent">XEvent</A> *<B>event</B>;     XPointer <B>arg</B>;</PRE></CODE><TABLE><TR><TD> <B>display</B><TD>Specifies the connection to the X server.<TR><TD> <B>event</B><TD>Specifies the<A HREF="../../events/structures.html#XEvent">XEvent</A>structure.<TR><TD> <B>arg</B><TD>Specifies the argument passed in from the <B><A HREF="XIfEvent.html">XIfEvent()</A></B>,<B><A HREF="XCheckIfEvent.html">XCheckIfEvent()</A></B>,or<B><A HREF="XPeekIfEvent.html">XPeekIfEvent()</A></B>function.</TABLE><P>The predicate procedure is called once for eachevent in the queue until it finds a match. After finding a match, the predicate procedure must return <B>True</B>.If it did not find a match, it must return<B>False</B>.<P>To check the event queue for a matching eventand, if found, remove the event from the queue, use<B><A HREF="XIfEvent.html">XIfEvent()</A></B>.<P>To check the event queue for a matching event without blocking, use<B><A HREF="XCheckIfEvent.html">XCheckIfEvent()</A></B>.<P>To check the event queue for a matching eventwithout removing the event from the queue, use<B><A HREF="XPeekIfEvent.html">XPeekIfEvent()</A></B>.<H5 ALIGN=right><I>Next: <A HREF="selecting-using-window-or-event-mask.html">Selecting Events Using a Window or Event Mask</A></I></H5><HR><ADDRESS><A HREF="http://tronche.com/">Christophe Tronche</A>, <A HREF="mailto:ch.tronche@computer.org">ch.tronche@computer.org</A></ADDRESS></BODY></HTML>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -