?? glib-the-main-event-loop.html
字號:
</div><hr><div class="refsect2" lang="en"><a name="id2858469"></a><h3><a name="GMainContext"></a>GMainContext</h3><a class="indexterm" name="id2858482"></a><pre class="programlisting">typedef struct _GMainContext GMainContext;</pre><p>The <span class="structname">GMainContext</span> struct is an opaque data type representing a set of sources to be handled in a main loop. </p></div><hr><div class="refsect2" lang="en"><a name="id2858503"></a><h3><a name="g-main-context-new"></a>g_main_context_new ()</h3><a class="indexterm" name="id2858516"></a><pre class="programlisting"><a class="link" href="glib-The-Main-Event-Loop.html#GMainContext">GMainContext</a>* g_main_context_new (void);</pre><p>Creates a new <a class="link" href="glib-The-Main-Event-Loop.html#GMainContext"><span class="type">GMainContext</span></a> structure.</p><p></p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td><td> the new <a class="link" href="glib-The-Main-Event-Loop.html#GMainContext"><span class="type">GMainContext</span></a></td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id2858572"></a><h3><a name="g-main-context-ref"></a>g_main_context_ref ()</h3><a class="indexterm" name="id2858585"></a><pre class="programlisting"><a class="link" href="glib-The-Main-Event-Loop.html#GMainContext">GMainContext</a>* g_main_context_ref (<a class="link" href="glib-The-Main-Event-Loop.html#GMainContext">GMainContext</a> *context);</pre><p>Increases the reference count on a <a class="link" href="glib-The-Main-Event-Loop.html#GMainContext"><span class="type">GMainContext</span></a> object by one.</p><p></p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><p><span class="term"><em class="parameter"><code>context</code></em> :</span></p></td><td> a <a class="link" href="glib-The-Main-Event-Loop.html#GMainContext"><span class="type">GMainContext</span></a></td></tr><tr><td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td><td> the <em class="parameter"><code>context</code></em> that was passed in (since 2.6)</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id2858668"></a><h3><a name="g-main-context-unref"></a>g_main_context_unref ()</h3><a class="indexterm" name="id2858681"></a><pre class="programlisting">void g_main_context_unref (<a class="link" href="glib-The-Main-Event-Loop.html#GMainContext">GMainContext</a> *context);</pre><p>Decreases the reference count on a <a class="link" href="glib-The-Main-Event-Loop.html#GMainContext"><span class="type">GMainContext</span></a> object by one. Ifthe result is zero, free the context and free all associated memory.</p><p></p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><p><span class="term"><em class="parameter"><code>context</code></em> :</span></p></td><td> a <a class="link" href="glib-The-Main-Event-Loop.html#GMainContext"><span class="type">GMainContext</span></a></td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id2858750"></a><h3><a name="g-main-context-default"></a>g_main_context_default ()</h3><a class="indexterm" name="id2858763"></a><pre class="programlisting"><a class="link" href="glib-The-Main-Event-Loop.html#GMainContext">GMainContext</a>* g_main_context_default (void);</pre><p>Returns the default main context. This is the main context usedfor main loop functions when a main loop is not explicitlyspecified.</p><p></p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td><td> the default main context.</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id2858805"></a><h3><a name="g-main-context-iteration"></a>g_main_context_iteration ()</h3><a class="indexterm" name="id2858819"></a><pre class="programlisting"><a class="link" href="glib-Basic-Types.html#gboolean">gboolean</a> g_main_context_iteration (<a class="link" href="glib-The-Main-Event-Loop.html#GMainContext">GMainContext</a> *context, <a class="link" href="glib-Basic-Types.html#gboolean">gboolean</a> may_block);</pre><p>Runs a single iteration for the given main loop. This involveschecking to see if any event sources are ready to be processed,then if no events sources are ready and <em class="parameter"><code>may_block</code></em> is <a class="link" href="glib-Standard-Macros.html#TRUE:CAPS"><code class="literal">TRUE</code></a>, waitingfor a source to become ready, then dispatching the highest priorityevents sources that are ready. Otherwise, if <em class="parameter"><code>may_block</code></em> is <a class="link" href="glib-Standard-Macros.html#FALSE:CAPS"><code class="literal">FALSE</code></a> sources are not waited to become ready, only those highest priority events sources will be dispatched (if any), that are ready at this given moment without further waiting.</p><p>Note that even when <em class="parameter"><code>may_block</code></em> is <a class="link" href="glib-Standard-Macros.html#TRUE:CAPS"><code class="literal">TRUE</code></a>, it is still possible for <a class="link" href="glib-The-Main-Event-Loop.html#g-main-context-iteration"><code class="function">g_main_context_iteration()</code></a> to return <a class="link" href="glib-Standard-Macros.html#FALSE:CAPS"><code class="literal">FALSE</code></a>, since the the wait may be interrupted for other reasons than an event source becoming ready.</p><p></p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><p><span class="term"><em class="parameter"><code>context</code></em> :</span></p></td><td> a <a class="link" href="glib-The-Main-Event-Loop.html#GMainContext"><span class="type">GMainContext</span></a> (if <a class="link" href="glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>, the default context will be used) </td></tr><tr><td><p><span class="term"><em class="parameter"><code>may_block</code></em> :</span></p></td><td> whether the call may block.</td></tr><tr><td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td><td> <a class="link" href="glib-Standard-Macros.html#TRUE:CAPS"><code class="literal">TRUE</code></a> if events were dispatched.</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id2859014"></a><h3><a name="g-main-iteration"></a>g_main_iteration()</h3><a class="indexterm" name="id2859030"></a><pre class="programlisting">#define g_main_iteration(may_block)</pre><div class="warning" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Warning</h3><p><code class="literal">g_main_iteration</code> has been deprecated since version 2.2 and should not be used in newly-written code. Use <a class="link" href="glib-The-Main-Event-Loop.html#g-main-context-iteration"><code class="function">g_main_context_iteration()</code></a> instead.</p></div><p>Runs a single iteration for the default <a class="link" href="glib-The-Main-Event-Loop.html#GMainContext"><span class="type">GMainContext</span></a>.</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><p><span class="term"><em class="parameter"><code>may_block</code></em> :</span></p></td><td>set to <a class="link" href="glib-Standard-Macros.html#TRUE:CAPS"><code class="literal">TRUE</code></a> if it should block (i.e. wait) until an event sourcebecomes ready. It will return after an event source has been processed.If set to <a class="link" href="glib-Standard-Macros.html#FALSE:CAPS"><code class="literal">FALSE</code></a> it will return immediately if no event source is ready to beprocessed.</td></tr><tr><td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td><td><a class="link" href="glib-Standard-Macros.html#TRUE:CAPS"><code class="literal">TRUE</code></a> if more events are pending.</td><
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -