summaryrefslogtreecommitdiffstats
path: root/abs/mv-core/ghosd/ghosd-0.0.1/doc/xml/main-loop.xml
blob: 645bd967e55c10bc5c6e3d5cf4d6b6617599638f (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
<?xml version="1.0"?>
<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.1.2//EN" 
               "http://www.oasis-open.org/docbook/xml/4.1.2/docbookx.dtd">
<refentry id="ghosd-Main-Loop">
<refmeta>
<refentrytitle>Main Loop</refentrytitle>
<manvolnum>3</manvolnum>
<refmiscinfo>GHOSD Library</refmiscinfo>
</refmeta>

<refnamediv>
<refname>Main Loop</refname><refpurpose>Running an app using Ghosd.</refpurpose>
</refnamediv>

<refsynopsisdiv><title>Synopsis</title>

<synopsis>

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


<link linkend="void">void</link>        <link linkend="ghosd-main-iterations">ghosd_main_iterations</link>           (<link linkend="Ghosd">Ghosd</link> *ghosd);
<link linkend="void">void</link>        <link linkend="ghosd-main-until">ghosd_main_until</link>                (<link linkend="Ghosd">Ghosd</link> *ghosd,
                                             struct <link linkend="timeval">timeval</link> *until);
<link linkend="void">void</link>        <link linkend="ghosd-flash">ghosd_flash</link>                     (<link linkend="Ghosd">Ghosd</link> *ghosd,
                                             <link linkend="int">int</link> fade_ms,
                                             <link linkend="int">int</link> total_display_ms);
<link linkend="int">int</link>         <link linkend="ghosd-get-socket">ghosd_get_socket</link>                (<link linkend="Ghosd">Ghosd</link> *ghosd);
</synopsis>
</refsynopsisdiv>









<refsect1>
<title>Description</title>
<para>

</para>
</refsect1>

<refsect1>
<title>Details</title>
<refsect2>
<title><anchor id="ghosd-main-iterations"/>ghosd_main_iterations ()</title>
<indexterm><primary>ghosd_main_iterations</primary></indexterm><programlisting><link linkend="void">void</link>        ghosd_main_iterations           (<link linkend="Ghosd">Ghosd</link> *ghosd);</programlisting>
<para>
Iterate the main loop on the <link linkend="Ghosd"><type>Ghosd</type></link>, handling all pending X events.
This function does not wait for X events, so it returns immediately
unless there are already events pending.</para>
<para>

</para><variablelist role="params">
<varlistentry><term><parameter>ghosd</parameter>&nbsp;:</term>
<listitem><simpara> a <link linkend="Ghosd"><type>Ghosd</type></link> object.
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2>
<title><anchor id="ghosd-main-until"/>ghosd_main_until ()</title>
<indexterm><primary>ghosd_main_until</primary></indexterm><programlisting><link linkend="void">void</link>        ghosd_main_until                (<link linkend="Ghosd">Ghosd</link> *ghosd,
                                             struct <link linkend="timeval">timeval</link> *until);</programlisting>
<para>
Efficiently iterate the main loop on the <link linkend="Ghosd"><type>Ghosd</type></link>, handling all pending X
events, until the current time reaches the time specified in <parameter>until</parameter>.</para>
<para>

</para><variablelist role="params">
<varlistentry><term><parameter>ghosd</parameter>&nbsp;:</term>
<listitem><simpara> a <link linkend="Ghosd"><type>Ghosd</type></link> object.
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>until</parameter>&nbsp;:</term>
<listitem><simpara> a pointer to a timeval to update until.
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2>
<title><anchor id="ghosd-flash"/>ghosd_flash ()</title>
<indexterm><primary>ghosd_flash</primary></indexterm><programlisting><link linkend="void">void</link>        ghosd_flash                     (<link linkend="Ghosd">Ghosd</link> *ghosd,
                                             <link linkend="int">int</link> fade_ms,
                                             <link linkend="int">int</link> total_display_ms);</programlisting>
<para>
Fade in a <link linkend="Ghosd"><type>Ghosd</type></link>, display at full opacity for a while, fade out, and then
return.
This is easy enough to implement using <link linkend="ghosd-main-until"><function>ghosd_main_until()</function></link>, but is a 
a common enough use of Ghosd to make it a builtin.</para>
<para>

</para><variablelist role="params">
<varlistentry><term><parameter>ghosd</parameter>&nbsp;:</term>
<listitem><simpara> a <link linkend="Ghosd"><type>Ghosd</type></link> object.
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>fade_ms</parameter>&nbsp;:</term>
<listitem><simpara> how long to fade, in milliseconds.
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>total_display_ms</parameter>&nbsp;:</term>
<listitem><simpara> total display time, including fades, in milliseconds.
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2>
<title><anchor id="ghosd-get-socket"/>ghosd_get_socket ()</title>
<indexterm><primary>ghosd_get_socket</primary></indexterm><programlisting><link linkend="int">int</link>         ghosd_get_socket                (<link linkend="Ghosd">Ghosd</link> *ghosd);</programlisting>
<para>
Get the file descriptor of the Ghosd X socket.  When this file descriptor
has data available, call <link linkend="ghosd-main-iterations"><function>ghosd_main_iterations()</function></link> to process the pending X
events.  Use this with <link linkend="select"><function>select()</function></link>/<link linkend="poll"><function>poll()</function></link> etc. to multiplex Ghosd with other
processing.</para>
<para>

</para><variablelist role="params">
<varlistentry><term><parameter>ghosd</parameter>&nbsp;:</term>
<listitem><simpara> a <link linkend="Ghosd"><type>Ghosd</type></link> object.
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&nbsp;:</term><listitem><simpara> a file descriptor, suitable for use in <link linkend="select"><function>select()</function></link> or <link linkend="poll"><function>poll()</function></link>.
</simpara></listitem></varlistentry>
</variablelist></refsect2>

</refsect1>




</refentry>