📄 hooks.sgml
字号:
</entry></row><row><entry align="right"><parameter>hook</parameter> :</entry><entry>the current <link linkend="GHook">GHook</link>.</entry></row><row><entry align="right"><parameter>may_be_in_call</parameter> :</entry><entry><literal>TRUE</literal> if hooks which are currently running (e.g. in anotherthread) are considered valid. If set to <literal>FALSE</literal>, these are skipped.</entry></row><row><entry align="right"><emphasis>Returns</emphasis> :</entry><entry>the next valid <link linkend="GHook">GHook</link>, or <literal>NULL</literal> if none are valid.</entry></row></tbody></tgroup></informaltable></refsect2><refsect2><title><anchor id="GHookFlagMask">enum GHookFlagMask</title><programlisting>typedef enum{ G_HOOK_FLAG_ACTIVE = 1 << 0, G_HOOK_FLAG_IN_CALL = 1 << 1, G_HOOK_FLAG_MASK = 0x0f} GHookFlagMask;</programlisting><para>Flags used internally in the <link linkend="GHook">GHook</link> implementation.</para><informaltable pgwide="1" frame="none" role="enum"><tgroup cols="2"><colspec colwidth="2*"><colspec colwidth="8*"><tbody><row><entry><literal>G_HOOK_FLAG_ACTIVE</literal></entry><entry>set if the hook has not been destroyed.</entry></row><row><entry><literal>G_HOOK_FLAG_IN_CALL</literal></entry><entry>set if the hook is currently being run.</entry></row><row><entry><literal>G_HOOK_FLAG_MASK</literal></entry><entry></entry></row></tbody></tgroup></informaltable></refsect2><refsect2><title><anchor id="G-HOOK-FLAGS-CAPS">G_HOOK_FLAGS()</title><programlisting>#define G_HOOK_FLAGS(hook) (G_HOOK (hook)->flags)</programlisting><para>Returns the flags of a hook.</para><informaltable pgwide="1" frame="none" role="params"><tgroup cols="2"><colspec colwidth="2*"><colspec colwidth="8*"><tbody><row><entry align="right"><parameter>hook</parameter> :</entry><entry>a <link linkend="GHook">GHook</link>.</entry></row></tbody></tgroup></informaltable></refsect2><refsect2><title><anchor id="G-HOOK-FLAG-USER-SHIFT-CAPS">G_HOOK_FLAG_USER_SHIFT</title><programlisting>#define G_HOOK_FLAG_USER_SHIFT (4)</programlisting><para>The position of the first bit which is not reserved for internaluse be the <link linkend="GHook">GHook</link> implementation, i.e. <literal>1 << G_HOOK_FLAG_USER_SHIFT</literal> is the first bitwhich can be used for application-defined flags.</para></refsect2><refsect2><title><anchor id="G-HOOK-CAPS">G_HOOK()</title><programlisting>#define G_HOOK(hook) ((GHook*) (hook))</programlisting><para>Casts a pointer to a <literal>GHook*</literal>.</para><informaltable pgwide="1" frame="none" role="params"><tgroup cols="2"><colspec colwidth="2*"><colspec colwidth="8*"><tbody><row><entry align="right"><parameter>hook</parameter> :</entry><entry>a pointer.</entry></row></tbody></tgroup></informaltable></refsect2><refsect2><title><anchor id="G-HOOK-IS-VALID-CAPS">G_HOOK_IS_VALID()</title><programlisting>#define G_HOOK_IS_VALID(hook)</programlisting><para>Returns <literal>TRUE</literal> if the <link linkend="GHook">GHook</link> is valid, i.e. it is in a <link linkend="GHookList">GHookList</link>, it is activeand it has not been destroyed.</para><informaltable pgwide="1" frame="none" role="params"><tgroup cols="2"><colspec colwidth="2*"><colspec colwidth="8*"><tbody><row><entry align="right"><parameter>hook</parameter> :</entry><entry>a <link linkend="GHook">GHook</link>.</entry></row><row><entry align="right"><emphasis>Returns</emphasis> :</entry><entry><literal>TRUE</literal> if the <link linkend="GHook">GHook</link> is valid.</entry></row></tbody></tgroup></informaltable></refsect2><refsect2><title><anchor id="G-HOOK-ACTIVE-CAPS">G_HOOK_ACTIVE()</title><programlisting>#define G_HOOK_ACTIVE(hook)</programlisting><para>Returns <literal>TRUE</literal> if the <link linkend="GHook">GHook</link> is active, which is normally <literal>TRUE</literal> until the <link linkend="GHook">GHook</link>is destroyed.</para><informaltable pgwide="1" frame="none" role="params"><tgroup cols="2"><colspec colwidth="2*"><colspec colwidth="8*"><tbody><row><entry align="right"><parameter>hook</parameter> :</entry><entry>a <link linkend="GHook">GHook</link>.</entry></row><row><entry align="right"><emphasis>Returns</emphasis> :</entry><entry><literal>TRUE</literal> if the <link linkend="GHook">GHook</link> is active.</entry></row></tbody></tgroup></informaltable></refsect2><refsect2><title><anchor id="G-HOOK-IN-CALL-CAPS">G_HOOK_IN_CALL()</title><programlisting>#define G_HOOK_IN_CALL(hook)</programlisting><para>Returns <literal>TRUE</literal> if the <link linkend="GHook">GHook</link> function is currently executing.</para><informaltable pgwide="1" frame="none" role="params"><tgroup cols="2"><colspec colwidth="2*"><colspec colwidth="8*"><tbody><row><entry align="right"><parameter>hook</parameter> :</entry><entry>a <link linkend="GHook">GHook</link>.</entry></row><row><entry align="right"><emphasis>Returns</emphasis> :</entry><entry><literal>TRUE</literal> if the <link linkend="GHook">GHook</link> function is currently executing.</entry></row></tbody></tgroup></informaltable></refsect2><refsect2><title><anchor id="G-HOOK-IS-UNLINKED-CAPS">G_HOOK_IS_UNLINKED()</title><programlisting>#define G_HOOK_IS_UNLINKED(hook)</programlisting><para>Returns <literal>TRUE</literal> if the <link linkend="GHook">GHook</link> is not in a <link linkend="GHookList">GHookList</link>.</para><informaltable pgwide="1" frame="none" role="params"><tgroup cols="2"><colspec colwidth="2*"><colspec colwidth="8*"><tbody><row><entry align="right"><parameter>hook</parameter> :</entry><entry>a <link linkend="GHook">GHook</link>.</entry></row><row><entry align="right"><emphasis>Returns</emphasis> :</entry><entry><literal>TRUE</literal> if the <link linkend="GHook">GHook</link> is not in a <link linkend="GHookList">GHookList</link>.</entry></row></tbody></tgroup></informaltable></refsect2><refsect2><title><anchor id="g-hook-ref">g_hook_ref ()</title><programlisting>void g_hook_ref (<link linkend="GHookList">GHookList</link> *hook_list, <link linkend="GHook">GHook</link> *hook);</programlisting><para>Increments the reference count for a <link linkend="GHook">GHook</link>.</para><informaltable pgwide="1" frame="none" role="params"><tgroup cols="2"><colspec colwidth="2*"><colspec colwidth="8*"><tbody><row><entry align="right"><parameter>hook_list</parameter> :</entry><entry>a <link linkend="GHookList">GHookList</link>.</entry></row><row><entry align="right"><parameter>hook</parameter> :</entry><entry>the <link linkend="GHook">GHook</link> to increment the reference count of.</entry></row></tbody></tgroup></informaltable></refsect2><refsect2><title><anchor id="g-hook-unref">g_hook_unref ()</title><programlisting>void g_hook_unref (<link linkend="GHookList">GHookList</link> *hook_list, <link linkend="GHook">GHook</link> *hook);</programlisting><para>Decrements the reference count of a <link linkend="GHook">GHook</link>.If the reference count falls to 0, the <link linkend="GHook">GHook</link> is removed from the <link linkend="GHookList">GHookList</link>and <link linkend="g-hook-free">g_hook_free</link>() is called to free it.</para><informaltable pgwide="1" frame="none" role="params"><tgroup cols="2"><colspec colwidth="2*"><colspec colwidth="8*"><tbody><row><entry align="right"><parameter>hook_list</parameter> :</entry><entry>a <link linkend="GHookList">GHookList</link>.</entry></row><row><entry align="right"><parameter>hook</parameter> :</entry><entry>the <link linkend="GHook">GHook</link> to unref.</entry></row></tbody></tgroup></informaltable></refsect2><refsect2><title><anchor id="g-hook-free">g_hook_free ()</title><programlisting>void g_hook_free (<link linkend="GHookList">GHookList</link> *hook_list, <link linkend="GHook">GHook</link> *hook);</programlisting><para>Calls the <link linkend="GHookList">GHookList</link> <parameter>hook_free</parameter> function if it exists, and frees the memoryallocated for the <link linkend="GHook">GHook</link>.</para><informaltable pgwide="1" frame="none" role="params"><tgroup cols="2"><colspec colwidth="2*"><colspec colwidth="8*"><tbody><row><entry align="right"><parameter>hook_list</parameter> :</entry><entry>a <link linkend="GHookList">GHookList</link>.</entry></row><row><entry align="right"><parameter>hook</parameter> :</entry><entry>the <link linkend="GHook">GHook</link> to free.</entry></row></tbody></tgroup></informaltable></refsect2><refsect2><title><anchor id="g-hook-destroy">g_hook_destroy ()</title><programlisting><link linkend="gboolean">gboolean</link> g_hook_destroy (<link linkend="GHookList">GHookList</link> *hook_list, <link linkend="gulong">gulong</link> hook_id);</programlisting><para>Destroys a <link linkend="GHook">GHook</link>, given its ID.</para><informaltable pgwide="1" frame="none" role="params"><tgroup cols="2"><colspec colwidth="2*"><colspec colwidth="8*"><tbody><row><entry align="right"><parameter>hook_list</parameter> :</entry><entry>a <link linkend="GHookList">GHookList</link>.</entry></row><row><entry align="right"><parameter>hook_id</parameter> :</entry><entry>a hook ID.</entry></row><row><entry align="right"><emphasis>Returns</emphasis> :</entry><entry><literal>TRUE</literal> if the <link linkend="GHook">GHook</link> was found in the <link linkend="GHookList">GHookList</link> and destroyed.</entry></row></tbody></tgroup></informaltable></refsect2><refsect2><title><anchor id="g-hook-destroy-link">g_hook_destroy_link ()</title><programlisting>void g_hook_destroy_link (<link linkend="GHookList">GHookList</link> *hook_list, <link linkend="GHook">GHook</link> *hook);</programlisting><para>Removes one <link linkend="GHook">GHook</link> from a <link linkend="GHookList">GHookList</link>, marking it inactive and calling<link linkend="g-hook-unref">g_hook_unref</link>() on it. </para><informaltable pgwide="1" frame="none" role="params"><tgroup cols="2"><colspec colwidth="2*"><colspec colwidth="8*"><tbody><row><entry align="right"><parameter>hook_list</parameter> :</entry><entry>a <link linkend="GHookList">GHookList</link>.</entry></row><row><entry align="right"><parameter>hook</parameter> :</entry><entry>the <link linkend="GHook">GHook</link> to remove.</entry></row></tbody></tgroup></informaltable></refsect2></refsect1></refentry>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -