📄 gdk-input.html
字号:
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"><html><head><meta http-equiv="Content-Type" content="text/html; charset=US-ASCII"><title>Input</title><meta name="generator" content="DocBook XSL Stylesheets V1.73.2"><link rel="start" href="index.html" title="GDK Reference Manual"><link rel="up" href="reference.html" title="API Reference"><link rel="prev" href="gdk-Threads.html" title="Threads"><link rel="next" href="gdk-Input-Devices.html" title="Input Devices"><meta name="generator" content="GTK-Doc V1.9 (XML mode)"><link rel="stylesheet" href="style.css" type="text/css"><link rel="reference" href="reference.html" title="API Reference"><link rel="index" href="ix01.html" title="Index"><link rel="index" href="ix02.html" title="Index of deprecated symbols"><link rel="index" href="ix03.html" title="Index of new symbols in 2.2"><link rel="index" href="ix04.html" title="Index of new symbols in 2.4"><link rel="index" href="ix05.html" title="Index of new symbols in 2.6"><link rel="index" href="ix06.html" title="Index of new symbols in 2.8"><link rel="index" href="ix07.html" title="Index of new symbols in 2.10"><link rel="index" href="ix08.html" title="Index of new symbols in 2.12"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><table class="navigation" id="top" width="100%" summary="Navigation header" cellpadding="2" cellspacing="2"><tr valign="middle"><td><a accesskey="p" href="gdk-Threads.html"><img src="left.png" width="24" height="24" border="0" alt="Prev"></a></td><td><a accesskey="u" href="reference.html"><img src="up.png" width="24" height="24" border="0" alt="Up"></a></td><td><a accesskey="h" href="index.html"><img src="home.png" width="24" height="24" border="0" alt="Home"></a></td><th width="100%" align="center">GDK Reference Manual</th><td><a accesskey="n" href="gdk-Input-Devices.html"><img src="right.png" width="24" height="24" border="0" alt="Next"></a></td></tr><tr><td colspan="5" class="shortcuts"><nobr><a href="#id3284746" class="shortcut">Top</a>  |  <a href="#id3284953" class="shortcut">Description</a></nobr></td></tr></table><div class="refentry" lang="en"><a name="gdk-Input"></a><div class="titlepage"></div><div class="refnamediv"><table width="100%"><tr><td valign="top"><h2><a name="id3284746"></a><span class="refentrytitle">Input</span></h2><p>Input — Callbacks on file descriptors</p></td><td valign="top" align="right"></td></tr></table></div><div class="refsynopsisdiv"><h2>Synopsis</h2><pre class="synopsis">#include <gdk/gdk.h><ahref="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gint">gint</a> <a class="link" href="gdk-Input.html#gdk-input-add-full">gdk_input_add_full</a> (<ahref="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gint">gint</a> source, <a class="link" href="gdk-Input.html#GdkInputCondition">GdkInputCondition</a> condition, <a class="link" href="gdk-Input.html#GdkInputFunction">GdkInputFunction</a> function, <ahref="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gpointer">gpointer</a> data, <a class="link" href="gdk-Input.html#GdkDestroyNotify">GdkDestroyNotify</a> destroy);enum <a class="link" href="gdk-Input.html#GdkInputCondition">GdkInputCondition</a>;void (<a class="link" href="gdk-Input.html#GdkInputFunction">*GdkInputFunction</a>) (<ahref="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gpointer">gpointer</a> data, <ahref="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gint">gint</a> source, <a class="link" href="gdk-Input.html#GdkInputCondition">GdkInputCondition</a> condition);void (<a class="link" href="gdk-Input.html#GdkDestroyNotify">*GdkDestroyNotify</a>) (<ahref="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gpointer">gpointer</a> data);<ahref="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gint">gint</a> <a class="link" href="gdk-Input.html#gdk-input-add">gdk_input_add</a> (<ahref="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gint">gint</a> source, <a class="link" href="gdk-Input.html#GdkInputCondition">GdkInputCondition</a> condition, <a class="link" href="gdk-Input.html#GdkInputFunction">GdkInputFunction</a> function, <ahref="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gpointer">gpointer</a> data);void <a class="link" href="gdk-Input.html#gdk-input-remove">gdk_input_remove</a> (<ahref="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gint">gint</a> tag);</pre></div><div class="refsect1" lang="en"><a name="id3284953"></a><h2>Description</h2><p>The functions in this section are used to establishcallbacks when some condition becomes true fora file descriptor. They are currently just wrappers aroundthe <ahref="/usr/share/gtk-doc/html/glib/glib-IO-Channels.html">IO Channel</a>facility.</p></div><div class="refsect1" lang="en"><a name="id3284979"></a><h2>Details</h2><div class="refsect2" lang="en"><a name="id3284989"></a><h3><a name="gdk-input-add-full"></a>gdk_input_add_full ()</h3><a class="indexterm" name="id3285004"></a><pre class="programlisting"><ahref="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gint">gint</a> gdk_input_add_full (<ahref="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gint">gint</a> source, <a class="link" href="gdk-Input.html#GdkInputCondition">GdkInputCondition</a> condition, <a class="link" href="gdk-Input.html#GdkInputFunction">GdkInputFunction</a> function, <ahref="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gpointer">gpointer</a> data, <a class="link" href="gdk-Input.html#GdkDestroyNotify">GdkDestroyNotify</a> destroy);</pre><div class="warning" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Warning</h3><p><code class="literal">gdk_input_add_full</code> is deprecated and should not be used in newly-written code.</p></div><p>Establish a callback when a condition becomes true ona file descriptor.</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><p><span class="term"><em class="parameter"><code>source</code></em> :</span></p></td><td>a file descriptor.</td></tr><tr><td><p><span class="term"><em class="parameter"><code>condition</code></em> :</span></p></td><td>the condition.</td></tr><tr><td><p><span class="term"><em class="parameter"><code>function</code></em> :</span></p></td><td>the callback function.</td></tr><tr><td><p><span class="term"><em class="parameter"><code>data</code></em> :</span></p></td><td>callback data passed to <em class="parameter"><code>function</code></em>.</td></tr><tr><td><p><span class="term"><em class="parameter"><code>destroy</code></em> :</span></p></td><td>callback function to call with <em class="parameter"><code>data</code></em> when the input handler is removed.</td></tr><tr><td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td><td>a tag that can later be used as an argument to <a class="link" href="gdk-Input.html#gdk-input-remove"><code class="function">gdk_input_remove()</code></a>.</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id3285187"></a><h3><a name="GdkInputCondition"></a>enum GdkInputCondition</h3><a class="indexterm" name="id3285201"></a><pre class="programlisting">typedef enum{ GDK_INPUT_READ = 1 << 0, GDK_INPUT_WRITE = 1 << 1, GDK_INPUT_EXCEPTION = 1 << 2} GdkInputCondition;</pre><p>A set of bit flags used to specify conditions for whichan input callback will be triggered. The three membersof this enumeration correspond to the <em class="parameter"><code>readfds</code></em>, <em class="parameter"><code>writefds</code></em>, and <em class="parameter"><code>exceptfds</code></em> arguments to the <code class="function">select</code> system call.</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><p><span class="term"><a name="GDK-INPUT-READ:CAPS"></a><code class="literal">GDK_INPUT_READ</code></span></p></td><td>the file descriptor has become available for reading.(Or, as is standard in Unix, a socket or pipe was closedat the other end; this is the case if a subsequent readon the file descriptor returns a count of zero.)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -