summaryrefslogtreecommitdiffstats
path: root/abs/mv-core/ghosd/ghosd-0.0.1/doc/html/ghosd-Main-Loop.html
blob: 07a6e515af9b00748fef91e70cce9efa5cbcc2c1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
<title>Main Loop</title>
<meta name="generator" content="DocBook XSL Stylesheets V1.68.1">
<link rel="start" href="index.html" title="Ghosd Manual">
<link rel="up" href="ch01.html" title="Reference">
<link rel="prev" href="ghosd-Basics.html" title="Basics">
<link rel="next" href="ghosd-Text.html" title="Text">
<meta name="generator" content="GTK-Doc V1.4 (XML mode)">
<link rel="stylesheet" href="style.css" type="text/css">
<link rel="chapter" href="ch01.html" title="Reference">
</head>
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
<table class="navigation" width="100%" summary="Navigation header" cellpadding="2" cellspacing="2"><tr valign="middle">
<td><a accesskey="p" href="ghosd-Basics.html"><img src="left.png" width="24" height="24" border="0" alt="Prev"></a></td>
<td><a accesskey="u" href="ch01.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">Ghosd Manual</th>
<td><a accesskey="n" href="ghosd-Text.html"><img src="right.png" width="24" height="24" border="0" alt="Next"></a></td>
</tr></table>
<div class="refentry" lang="en">
<a name="ghosd-Main-Loop"></a><div class="titlepage"></div>
<div class="refnamediv"><table width="100%"><tr>
<td valign="top">
<h2><span class="refentrytitle">Main Loop</span></h2>
<p>Main Loop &#8212; Running an app using Ghosd.</p>
</td>
<td valign="top" align="right"></td>
</tr></table></div>
<div class="refsynopsisdiv">
<h2>Synopsis</h2>
<pre class="synopsis">

#include &lt;ghosd/ghosd.h&gt;


void        <a href="ghosd-Main-Loop.html#ghosd-main-iterations">ghosd_main_iterations</a>           (<a href="ghosd-Basics.html#Ghosd">Ghosd</a> *ghosd);
void        <a href="ghosd-Main-Loop.html#ghosd-main-until">ghosd_main_until</a>                (<a href="ghosd-Basics.html#Ghosd">Ghosd</a> *ghosd,
                                             struct timeval *until);
void        <a href="ghosd-Main-Loop.html#ghosd-flash">ghosd_flash</a>                     (<a href="ghosd-Basics.html#Ghosd">Ghosd</a> *ghosd,
                                             int fade_ms,
                                             int total_display_ms);
int         <a href="ghosd-Main-Loop.html#ghosd-get-socket">ghosd_get_socket</a>                (<a href="ghosd-Basics.html#Ghosd">Ghosd</a> *ghosd);
</pre>
</div>
<div class="refsect1" lang="en">
<a name="id2545628"></a><h2>Description</h2>
<p>

</p>
</div>
<div class="refsect1" lang="en">
<a name="id2545639"></a><h2>Details</h2>
<div class="refsect2" lang="en">
<a name="id2545646"></a><h3>
<a name="ghosd-main-iterations"></a>ghosd_main_iterations ()</h3>
<a class="indexterm" name="id2545654"></a><pre class="programlisting">void        ghosd_main_iterations           (<a href="ghosd-Basics.html#Ghosd">Ghosd</a> *ghosd);</pre>
<p>
Iterate the main loop on the <a href="ghosd-Basics.html#Ghosd"><span class="type">Ghosd</span></a>, handling all pending X events.
This function does not wait for X events, so it returns immediately
unless there are already events pending.</p>
<p>

</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody><tr>
<td>
<span class="term"><em class="parameter"><code>ghosd</code></em>&#160;:</span></td>
<td> a <a href="ghosd-Basics.html#Ghosd"><span class="type">Ghosd</span></a> object.
</td>
</tr></tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2545719"></a><h3>
<a name="ghosd-main-until"></a>ghosd_main_until ()</h3>
<a class="indexterm" name="id2545729"></a><pre class="programlisting">void        ghosd_main_until                (<a href="ghosd-Basics.html#Ghosd">Ghosd</a> *ghosd,
                                             struct timeval *until);</pre>
<p>
Efficiently iterate the main loop on the <a href="ghosd-Basics.html#Ghosd"><span class="type">Ghosd</span></a>, handling all pending X
events, until the current time reaches the time specified in <em class="parameter"><code>until</code></em>.</p>
<p>

</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td>
<span class="term"><em class="parameter"><code>ghosd</code></em>&#160;:</span></td>
<td> a <a href="ghosd-Basics.html#Ghosd"><span class="type">Ghosd</span></a> object.
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>until</code></em>&#160;:</span></td>
<td> a pointer to a timeval to update until.
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2540527"></a><h3>
<a name="ghosd-flash"></a>ghosd_flash ()</h3>
<a class="indexterm" name="id2540537"></a><pre class="programlisting">void        ghosd_flash                     (<a href="ghosd-Basics.html#Ghosd">Ghosd</a> *ghosd,
                                             int fade_ms,
                                             int total_display_ms);</pre>
<p>
Fade in a <a href="ghosd-Basics.html#Ghosd"><span class="type">Ghosd</span></a>, display at full opacity for a while, fade out, and then
return.
This is easy enough to implement using <a href="ghosd-Main-Loop.html#ghosd-main-until"><code class="function">ghosd_main_until()</code></a>, but is a 
a common enough use of Ghosd to make it a builtin.</p>
<p>

</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td>
<span class="term"><em class="parameter"><code>ghosd</code></em>&#160;:</span></td>
<td> a <a href="ghosd-Basics.html#Ghosd"><span class="type">Ghosd</span></a> object.
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>fade_ms</code></em>&#160;:</span></td>
<td> how long to fade, in milliseconds.
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>total_display_ms</code></em>&#160;:</span></td>
<td> total display time, including fades, in milliseconds.
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2552181"></a><h3>
<a name="ghosd-get-socket"></a>ghosd_get_socket ()</h3>
<a class="indexterm" name="id2552191"></a><pre class="programlisting">int         ghosd_get_socket                (<a href="ghosd-Basics.html#Ghosd">Ghosd</a> *ghosd);</pre>
<p>
Get the file descriptor of the Ghosd X socket.  When this file descriptor
has data available, call <a href="ghosd-Main-Loop.html#ghosd-main-iterations"><code class="function">ghosd_main_iterations()</code></a> to process the pending X
events.  Use this with <code class="function">select()</code>/<code class="function">poll()</code> etc. to multiplex Ghosd with other
processing.</p>
<p>

</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td>
<span class="term"><em class="parameter"><code>ghosd</code></em>&#160;:</span></td>
<td> a <a href="ghosd-Basics.html#Ghosd"><span class="type">Ghosd</span></a> object.
</td>
</tr>
<tr>
<td>
<span class="term"><span class="emphasis"><em>Returns</em></span>&#160;:</span></td>
<td> a file descriptor, suitable for use in <code class="function">select()</code> or <code class="function">poll()</code>.
</td>
</tr>
</tbody>
</table></div>
</div>
</div>
</div>
<table class="navigation" width="100%" summary="Navigation footer" cellpadding="2" cellspacing="0"><tr valign="middle">
<td align="left"><a accesskey="p" href="ghosd-Basics.html"><b>&lt;&lt;&#160;Basics</b></a></td>
<td align="right"><a accesskey="n" href="ghosd-Text.html"><b>Text&#160;&gt;&gt;</b></a></td>
</tr></table>
</body>
</html>