start on some efl coding startup docs

This commit is contained in:
Carsten Haitzler 2015-04-15 18:17:41 +09:00
parent 1afe7616c4
commit 5cce35c5f5
4 changed files with 386 additions and 0 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 26 KiB

View File

@ -0,0 +1,308 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
width="600"
height="350"
viewBox="0 0 600.00001 350.00001"
id="svg2"
version="1.1"
inkscape:version="0.91 r13725"
sodipodi:docname="mainloop.svg">
<defs
id="defs4" />
<sodipodi:namedview
id="base"
pagecolor="#303030"
bordercolor="#666666"
borderopacity="1.0"
inkscape:pageopacity="0"
inkscape:pageshadow="2"
inkscape:zoom="2.1933333"
inkscape:cx="300"
inkscape:cy="300"
inkscape:document-units="px"
inkscape:current-layer="layer1"
showgrid="true"
units="px"
inkscape:snap-bbox="true"
inkscape:bbox-nodes="true"
inkscape:snap-smooth-nodes="true"
inkscape:object-paths="true"
inkscape:snap-bbox-midpoints="true"
inkscape:bbox-paths="true"
inkscape:snap-perpendicular="false"
inkscape:snap-intersection-paths="true"
inkscape:object-nodes="true"
inkscape:window-width="1855"
inkscape:window-height="2092"
inkscape:window-x="1920"
inkscape:window-y="0"
inkscape:window-maximized="0">
<inkscape:grid
type="xygrid"
id="grid4136"
units="px"
spacingx="5.0000001"
spacingy="5.0000001" />
</sodipodi:namedview>
<metadata
id="metadata7">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
<dc:title></dc:title>
</cc:Work>
</rdf:RDF>
</metadata>
<g
inkscape:label="Layer 1"
inkscape:groupmode="layer"
id="layer1"
transform="translate(0,-702.36216)">
<rect
style="opacity:1;fill:#606060;fill-opacity:1;stroke:none;stroke-width:1;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
id="rect4431"
width="360"
height="300.00003"
x="120"
y="727.36218"
rx="1.40664e-06"
ry="1.40664e-06" />
<rect
style="opacity:1;fill:#3399ff;fill-opacity:1;stroke:none;stroke-width:1;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
id="rect4138"
width="70"
height="70.000046"
x="25.000004"
y="932.36212"
rx="1.40664e-06"
ry="1.40664e-06" />
<path
style="fill:#808080;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
d="m 104.89645,957.3621 0,19.99996 10,0 0,10 20,-19.99996 -20,-20 0,10 z"
id="path4140"
inkscape:connector-curvature="0"
sodipodi:nodetypes="cccccccc" />
<rect
style="opacity:1;fill:#808080;fill-opacity:1;stroke:none;stroke-width:1;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
id="rect4138-4"
width="70"
height="70.000046"
x="145"
y="932.36212"
rx="1.40664e-06"
ry="1.40664e-06" />
<rect
style="opacity:1;fill:#c0c0c0;fill-opacity:1;stroke:none;stroke-width:1;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
id="rect4138-4-0"
width="70"
height="70.000046"
x="265"
y="932.36212"
rx="1.40664e-06"
ry="1.40664e-06" />
<path
style="fill:#c0c0c0;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
d="m 225,957.3621 0,19.99996 10,0 0,10 20,-19.99996 -20,-20 0,10 z"
id="path4140-1"
inkscape:connector-curvature="0"
sodipodi:nodetypes="cccccccc" />
<rect
style="opacity:1;fill:#ffffff;fill-opacity:1;stroke:none;stroke-width:1;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
id="rect4138-4-0-3"
width="70"
height="70.000046"
x="385"
y="932.36212"
rx="1.40664e-06"
ry="1.40664e-06" />
<path
style="fill:#c0c0c0;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
d="m 345,957.36212 0,20.00004 10,0 0,10 20,-20.00004 -20,-20 0,10 z"
id="path4140-1-9"
inkscape:connector-curvature="0"
sodipodi:nodetypes="cccccccc" />
<rect
style="opacity:1;fill:#3399ff;fill-opacity:1;stroke:none;stroke-width:1;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
id="rect4138-4-0-3-8"
width="70"
height="70.000046"
x="505"
y="932.36212"
rx="1.40664e-06"
ry="1.40664e-06" />
<path
style="fill:#808080;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
d="m 465,957.36214 0,20.00002 10,0 0,10 20,-20.00002 -20,-20 0,10 z"
id="path4140-1-9-7"
inkscape:connector-curvature="0"
sodipodi:nodetypes="cccccccc" />
<path
style="fill:#c0c0c0;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
d="m 430,902.3621 c 0,-75 -65,-125 -130,-125 -65,0 -130,50 -130,125 l -10,0 20,20 20,-20 -10,0 c 0,-70 65,-105 110,-105 45,0 110,35 110,105 z"
id="path4244"
inkscape:connector-curvature="0"
sodipodi:nodetypes="cccccccccc" />
<text
xml:space="preserve"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:8px;line-height:125%;font-family:Elegante;-inkscape-font-specification:Elegante;text-align:center;letter-spacing:0px;word-spacing:0px;text-anchor:middle;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
x="60.103523"
y="954.56915"
id="text4246"
sodipodi:linespacing="125%"><tspan
sodipodi:role="line"
id="tspan4248"
x="60.103523"
y="954.56915">Initialize</tspan><tspan
sodipodi:role="line"
x="60.103523"
y="964.56915"
id="tspan4250">application</tspan><tspan
sodipodi:role="line"
x="60.103523"
y="974.56915"
id="tspan4252">state &amp;</tspan><tspan
sodipodi:role="line"
x="60.103523"
y="984.56915"
id="tspan4254">objects</tspan></text>
<text
xml:space="preserve"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:8px;line-height:125%;font-family:Elegante;-inkscape-font-specification:Elegante;text-align:center;letter-spacing:0px;word-spacing:0px;text-anchor:middle;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
x="180.30078"
y="950.34454"
id="text4246-7"
sodipodi:linespacing="125%"><tspan
sodipodi:role="line"
x="180.30078"
y="950.34454"
id="tspan4254-8">Sleep waiting</tspan><tspan
sodipodi:role="line"
x="180.30078"
y="960.34454"
id="tspan4292">for new input,</tspan><tspan
sodipodi:role="line"
x="180.30078"
y="970.34454"
id="tspan4294">output</tspan><tspan
sodipodi:role="line"
x="180.30078"
y="980.34454"
id="tspan4298">availability</tspan><tspan
sodipodi:role="line"
x="180.30078"
y="990.34454"
id="tspan4296">or timeouts</tspan></text>
<text
xml:space="preserve"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:8px;line-height:125%;font-family:Elegante;-inkscape-font-specification:Elegante;text-align:center;letter-spacing:0px;word-spacing:0px;text-anchor:middle;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
x="300"
y="945.2215"
id="text4246-6"
sodipodi:linespacing="125%"><tspan
sodipodi:role="line"
x="300"
y="945.2215"
id="tspan4254-0">Process events,</tspan><tspan
sodipodi:role="line"
x="300"
y="955.2215"
id="tspan4323">state changes,</tspan><tspan
sodipodi:role="line"
x="300"
y="965.2215"
id="tspan4325">timing</tspan><tspan
sodipodi:role="line"
x="300"
y="975.2215"
id="tspan4327">callbacks, I/O</tspan><tspan
sodipodi:role="line"
x="300"
y="985.2215"
id="tspan4393">&amp; change</tspan><tspan
sodipodi:role="line"
x="301.27344"
y="995.2215"
id="tspan4329">state </tspan></text>
<text
xml:space="preserve"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:8px;line-height:125%;font-family:Elegante;-inkscape-font-specification:Elegante;text-align:center;letter-spacing:0px;word-spacing:0px;text-anchor:middle;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
x="420"
y="955.34454"
id="text4246-1"
sodipodi:linespacing="125%"><tspan
sodipodi:role="line"
x="420"
y="955.34454"
id="tspan4254-1">Finalize state</tspan><tspan
sodipodi:role="line"
x="420"
y="965.34454"
id="tspan4354">changes &amp;</tspan><tspan
sodipodi:role="line"
x="420"
y="975.34454"
id="tspan4356">render updated</tspan><tspan
sodipodi:role="line"
x="420"
y="985.34454"
id="tspan4358">UI state</tspan></text>
<text
xml:space="preserve"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:8px;line-height:125%;font-family:Elegante;-inkscape-font-specification:Elegante;text-align:center;letter-spacing:0px;word-spacing:0px;text-anchor:middle;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
x="540.10352"
y="954.56915"
id="text4246-60"
sodipodi:linespacing="125%"><tspan
sodipodi:role="line"
x="540.10352"
y="954.56915"
id="tspan4254-81">Shutdown</tspan><tspan
sodipodi:role="line"
x="540.10352"
y="964.56915"
id="tspan4383">application</tspan><tspan
sodipodi:role="line"
x="540.10352"
y="974.56915"
id="tspan4385">state &amp;</tspan><tspan
sodipodi:role="line"
x="540.10352"
y="984.56915"
id="tspan4387">objects</tspan></text>
<text
xml:space="preserve"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:8px;line-height:125%;font-family:Elegante;-inkscape-font-specification:Elegante;text-align:center;letter-spacing:0px;word-spacing:0px;text-anchor:middle;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
x="299.59766"
y="790.2782"
id="text4246-2"
sodipodi:linespacing="125%"><tspan
sodipodi:role="line"
x="299.59766"
y="790.2782"
id="tspan4254-6">REPEAT</tspan></text>
<text
xml:space="preserve"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:8px;line-height:125%;font-family:Elegante;-inkscape-font-specification:Elegante;text-align:center;letter-spacing:0px;word-spacing:0px;text-anchor:middle;fill:#f9f9f9;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
x="299.55139"
y="750.2782"
id="text4246-2-8"
sodipodi:linespacing="125%"><tspan
sodipodi:role="line"
x="299.55139"
y="750.2782"
id="tspan4254-6-1"
style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-size:17.5px;font-family:Elegante;-inkscape-font-specification:'Elegante Bold'">MAINLOOP</tspan></text>
</g>
</svg>

After

Width:  |  Height:  |  Size: 13 KiB

View File

@ -9,6 +9,7 @@ continually. This is also the case if you want to contribute. Of
course you can use stable packages for your distribution as well.
* [[docs-efl-start|Get EFL installed]]
* [[docs/lib/efl/start|Get started with EFL]]
----

View File

@ -0,0 +1,77 @@
~~Title: EFL~~
==== EFL ====
EFL is a range of libraries that cover APIs to solve every day
problems we, and others have encountered. You can see it having
various API layers, with some intended for very low-level controls and
access that no one but specialists (eg writing a window manager
itself) will need, through to higher level "just writing a notepad"
application. The lower you go, the less portable things can be. Here
we will cover the EFL features and APIs used to make things portably
and cleanly. We will cover these topics here:
* Data structures (lists, hash tables, growable buffers/strings etc.)
* Main loop event, I/O and timing core
* Event queue and callhandling
* Canvas scene graph and rendering
* UI object element layout, animation and theme abstraction
* Widgets/controls (buttons, sliders, scrollers etc.)
* Input method framework
* Data archive storage & retrieval
* Data strcuture (de)serialization
* Video & audio codec playback, control and display
* IPC and network connectivty (TCP, UDP, unix domain & abstract sockets, HTTP)
* File utilities
* Freedesktop.org standards (desktop files, menus, mime types, icons)
* Async I/O
* D-Bus IPC integration
* Location API
* Basic Audio playback, recording and mixing
You will use a range of libraries to make use of the above, and so
learning the naming of these is important to know where to look. They
will be in Ecore, Evas, Edje, Elementary (Elm), Ecore_IMF, Eet,
Emotion, Ecore_Con, Ecore_IPC, Eio, Eldbus, Elocation, Ecore_Audio,
Ecore_File and Efreet.
----
=== Application Mainloop ===
It is assumed every application has a Mainloop, and that EFL is in
charge of that. If you are writing a library, then that assumption
would be made ulimately of the application using that library as well.
For the purposes of this introduction to EFL, we will talk about an
application, how it starts, runs and shuts down.
Every application is expected to have a lifecycle as follows. If you
have a design that is significantly different then you will be
struggling against EFL and what it is pushing you to use. This does
not mean we do not support threads, we just push you into a specific
design pattern.
{{ :docs:lib:efl:mainloop.png?nolink |Application Mainloop}}
An application would spend almost it's entire life inside the Mainloop
sleeping, processing events and then updating it's UI, until it
decides to exit. All of this would take place inside the mainloop
processing function ''elm_run()'' which will only return once the
mainloop voluntarily exits thanks to an ''elm_exit()'' function being
called, whihc marks the loop to exit, next time it has a chance.
Before and after this, will be initialization and shutdown of the
application. Your most basic application that just does nothing but
wait forever would be:
<code c example.c>
#include <Elementary.h>
EAPI_MAIN int
elm_main(int argc, char **argv)
{
elm_run();
return 0;
}
ELM_MAIN()
</code>
Compile it with:
cc example.c -o example `pkg-config --cflags --libs elementary`