

In this example we illustrate how to interact with canvas\textquotesingle{} (and its objects\textquotesingle{}) events, including the key input ones. We also demonstrate precise point collision on objects and canvas \char`\"{}obscured regions\char`\"{}, here.

The example application consists of a window with a white background and an image -- the Enlightenment logo. The application begins with this image switching back and forth into two sizes\+: the exact canvas\textquotesingle{} size and one quarter of it (when it\textquotesingle{}s placed on the top left quadrant). Thus, we\textquotesingle{}ll have an {\bfseries{animation}} going on, with image states set to change each 2 elapsed seconds.

There\textquotesingle{}s a global variable to aid accessing our desired context variables from anywhere in the code\+:  
\begin{DoxyCodeInclude}{0}
\DoxyCodeLine{\textcolor{keyword}{struct }test\_data}
\DoxyCodeLine{\{}
\DoxyCodeLine{   Ecore\_Evas  *ee;}
\DoxyCodeLine{   \mbox{\hyperlink{group__Evas__Canvas_ga5ff87cc4ce6bc43e3b640a6d37f73043}{Evas}}        *canvas;}
\DoxyCodeLine{   \mbox{\hyperlink{group__Evas__Object__Group_ga9e19e6dd1f517a0ba437c0114d3e7c97}{Evas\_Object}} *img, *bg;}
\DoxyCodeLine{   \mbox{\hyperlink{group__Ecore__Timer__Group_gaf96ffb609956658ec038e54bd39f46f0}{Ecore\_Timer}} *resize\_timer, *freeze\_timer;}
\DoxyCodeLine{   \mbox{\hyperlink{group__Eina__Types__Group_ga3fe0caf72e93b1bab1ca8ee3ccf3f226}{Eina\_Bool}}    obscured, focus;}
\DoxyCodeLine{\};}
\DoxyCodeLine{}
\DoxyCodeLine{\textcolor{keyword}{static} \textcolor{keyword}{struct }test\_data d = \{0\};}

\end{DoxyCodeInclude}


What interests us there are the {\ttfamily canvas} pointer, our image handle -- {\ttfamily img} -- and the background one, {\ttfamily bg}.

The first interesting thing on the example is the registration of a callback on each canvas resizing event, where we put our canvas\textquotesingle{} size and the background rectangle\textquotesingle{}s one in synchrony, so that we don\textquotesingle{}t get bogus content on rendering with canvas resizes\+:  
\begin{DoxyCodeInclude}{0}
\DoxyCodeLine{   \mbox{\hyperlink{group__Ecore__Evas__Group_gaac67f679c9027059a34519fbdea360df}{ecore\_evas\_callback\_resize\_set}}(d.ee, \_canvas\_resize\_cb);}

\end{DoxyCodeInclude}
  
\begin{DoxyCodeInclude}{0}
\DoxyCodeLine{\}}

\end{DoxyCodeInclude}


Than, after grabbing our canvas pointer from the Ecore Evas helper infrastructure, we registrate an event callbacks on it\+: 
\begin{DoxyCodeInclude}{0}

\end{DoxyCodeInclude}
  
\begin{DoxyCodeInclude}{0}
\DoxyCodeLine{\textcolor{comment}{/* render flush callback */}}
\DoxyCodeLine{\textcolor{keyword}{static} \textcolor{keywordtype}{void}}
\DoxyCodeLine{\_render\_flush\_cb(\textcolor{keywordtype}{void} *data \mbox{\hyperlink{group__Eina__Types__Group_ga82d751be730f849719ca292f9558be87}{EINA\_UNUSED}},}
\DoxyCodeLine{                 \mbox{\hyperlink{group__Evas__Canvas_ga5ff87cc4ce6bc43e3b640a6d37f73043}{Evas}} *e \mbox{\hyperlink{group__Eina__Types__Group_ga82d751be730f849719ca292f9558be87}{EINA\_UNUSED}},}
\DoxyCodeLine{                 \textcolor{keywordtype}{void} *event\_info \mbox{\hyperlink{group__Eina__Types__Group_ga82d751be730f849719ca292f9558be87}{EINA\_UNUSED}})}
\DoxyCodeLine{\{}
\DoxyCodeLine{   printf(\textcolor{stringliteral}{"Canvas is about to flush its rendering pipeline!\(\backslash\)n"});}
\DoxyCodeLine{\}}

\end{DoxyCodeInclude}
 It will be called whenever our canvas has to flush its rendering pipeline. In this example, two ways of observing that message which is printed in the cited callback are\+:
\begin{DoxyItemize}
\item to resize the example\textquotesingle{}s window (thus resizing the canvas\textquotesingle{} viewport)
\item let the animation run
\end{DoxyItemize}

When one resizes the canvas, there\textquotesingle{}s at least one operation it has to do which will require new calculation for rendering\+: the resizing of the background rectangle, in a callback we already shown you.

The creation of our background rectangle is so that we give it a {\bfseries{name}}, via \mbox{\hyperlink{group__Evas__Object__Group__Basic_ga88bfcce07ad3bcef31687e29075ae2d2}{evas\+\_\+object\+\_\+name\+\_\+set()}} and we give it the canvas {\bfseries{focus\+:}}  
\begin{DoxyCodeInclude}{0}
\DoxyCodeLine{   d.bg = \mbox{\hyperlink{group__Evas__Object__Rectangle_ga4d80fc32ad1cac28428cebd65d746751}{evas\_object\_rectangle\_add}}(d.canvas);}
\DoxyCodeLine{   \mbox{\hyperlink{group__Evas__Object__Group__Basic_ga88bfcce07ad3bcef31687e29075ae2d2}{evas\_object\_name\_set}}(d.bg, \textcolor{stringliteral}{"our dear rectangle"});}
\DoxyCodeLine{   \mbox{\hyperlink{group__Evas__Object__Group__Basic_gae34bdcfd7f5100151f6ea8ef4a392949}{evas\_object\_color\_set}}(d.bg, 255, 255, 255, 255); \textcolor{comment}{/* white bg */}}
\DoxyCodeLine{   evas\_object\_move(d.bg, 0, 0); \textcolor{comment}{/* at canvas' origin */}}
\DoxyCodeLine{   evas\_object\_resize(d.bg, WIDTH, HEIGHT); \textcolor{comment}{/* covers full canvas */}}
\DoxyCodeLine{   \mbox{\hyperlink{group__Evas__Object__Group__Basic_ga9cbc13661584e49fb9d9cdab514a1eeb}{evas\_object\_show}}(d.bg);}
\DoxyCodeLine{}
\DoxyCodeLine{   \mbox{\hyperlink{group__Evas__Object__Group_ga4405e118e1fb762987af1269b6848db5}{evas\_object\_focus\_set}}(d.bg, \mbox{\hyperlink{group__Eina__Types__Group_ga05c12dacc8b4058994df842b41be85fc}{EINA\_TRUE}}); \textcolor{comment}{/* so we get input events */}}

\end{DoxyCodeInclude}


Still exemplifying events and callbacks, we register a callback on the canvas event of an object being focused\+:  
\begin{DoxyCodeInclude}{0}
\DoxyCodeLine{   evas\_event\_callback\_add(d.canvas, \mbox{\hyperlink{Evas__Common_8h_ad64cde0da38a60e7cb7905b3ab216968a7380ca16bf87762e96309473d3d306c5}{EVAS\_CALLBACK\_CANVAS\_OBJECT\_FOCUS\_IN}},}
\DoxyCodeLine{                           \_object\_focus\_in\_cb, NULL);}
\DoxyCodeLine{   \textcolor{keywordflow}{if} (\mbox{\hyperlink{group__Evas__Main__Group_gacfae4f589c777003f58d51e502c52835}{evas\_alloc\_error}}() != \mbox{\hyperlink{Evas__Common_8h_a1adf9f604f763f2a8db12a484ca199cba22bbdd0a96a670bbddd6789f91921af8}{EVAS\_ALLOC\_ERROR\_NONE}})}
\DoxyCodeLine{     \{}
\DoxyCodeLine{        fprintf(stderr, \textcolor{stringliteral}{"ERROR: Callback registering failed! Aborting.\(\backslash\)n"});}
\DoxyCodeLine{        \textcolor{keywordflow}{goto} panic;}
\DoxyCodeLine{     \} \textcolor{comment}{/* two canvas event callbacks */}}

\end{DoxyCodeInclude}
  
\begin{DoxyCodeInclude}{0}
\DoxyCodeLine{\textcolor{comment}{/* called when our rectangle gets focus */}}
\DoxyCodeLine{\textcolor{keyword}{static} \textcolor{keywordtype}{void}}
\DoxyCodeLine{\_object\_focus\_in\_cb(\textcolor{keywordtype}{void} *data \mbox{\hyperlink{group__Eina__Types__Group_ga82d751be730f849719ca292f9558be87}{EINA\_UNUSED}},}
\DoxyCodeLine{                    \mbox{\hyperlink{group__Evas__Canvas_ga5ff87cc4ce6bc43e3b640a6d37f73043}{Evas}} *e,}
\DoxyCodeLine{                    \textcolor{keywordtype}{void} *event\_info)}
\DoxyCodeLine{\{}
\DoxyCodeLine{   printf(\textcolor{stringliteral}{"An object got focused: \%s\(\backslash\)n"},}
\DoxyCodeLine{          \mbox{\hyperlink{group__Evas__Object__Group__Basic_ga7934106d84f6a019fcb421b6b4d860a3}{evas\_object\_name\_get}}(event\_info));}
\DoxyCodeLine{}
\DoxyCodeLine{   printf(\textcolor{stringliteral}{"Let's recheck it: \%s\(\backslash\)n"},}
\DoxyCodeLine{          \mbox{\hyperlink{group__Evas__Object__Group__Basic_ga7934106d84f6a019fcb421b6b4d860a3}{evas\_object\_name\_get}}(evas\_focus\_get(e)));}
\DoxyCodeLine{}
\DoxyCodeLine{   printf(\textcolor{stringliteral}{"And again: \%s\(\backslash\)n"}, \mbox{\hyperlink{group__Evas__Object__Group_ga797d900504cf98d5f3c711b17ab5eaba}{evas\_object\_focus\_get}}(event\_info) ?}
\DoxyCodeLine{          \textcolor{stringliteral}{"OK!"} : \textcolor{stringliteral}{"Oops, something is bad."});}
\DoxyCodeLine{\}}

\end{DoxyCodeInclude}


In that call, {\ttfamily event\+\_\+info} is going to be the focused object\textquotesingle{}s handle, in this case our background rectangle. We print its name, so you can check it\textquotesingle{}s the same. We check that pointer is the same reported by Evas\textquotesingle{} A\+PI with regard to the newest focused object. Finally, we check whether that object is really flagged as focused, now using an Evas object A\+PI function.

The animation we talked about comes from a timer we register just before we start the example\textquotesingle{}s main loop. As we said, the resizing of the image will also force the canvas to repaint itself, thus flushing the rendering pipeline whenever the timer ticks\+:  
\begin{DoxyCodeInclude}{0}
\DoxyCodeLine{             d.resize\_timer = \mbox{\hyperlink{group__Ecore__Timer__Group_ga7b9cb9d24ecebfdbb957436e2e669402}{ecore\_timer\_add}}(2, \_resize\_cb, NULL);}

\end{DoxyCodeInclude}
  
\begin{DoxyCodeInclude}{0}
\DoxyCodeLine{\textcolor{comment}{/* put some action in the canvas */}}
\DoxyCodeLine{\textcolor{keyword}{static} \mbox{\hyperlink{group__Eina__Types__Group_ga3fe0caf72e93b1bab1ca8ee3ccf3f226}{Eina\_Bool}}}
\DoxyCodeLine{\_resize\_cb(\textcolor{keywordtype}{void} *data \mbox{\hyperlink{group__Eina__Types__Group_ga82d751be730f849719ca292f9558be87}{EINA\_UNUSED}})}
\DoxyCodeLine{\{}
\DoxyCodeLine{   \textcolor{keywordtype}{int} w, h, cw, ch;}
\DoxyCodeLine{}
\DoxyCodeLine{   \mbox{\hyperlink{group__Evas__Object__Group__Basic_ga6f52fab1a96dc58c85ee481d84bac871}{evas\_object\_geometry\_get}}(d.img, NULL, NULL, \&w, \&h);}
\DoxyCodeLine{   \mbox{\hyperlink{group__Ecore__Evas__Group_ga931aadf4603731e73e8a84e4b14f1493}{ecore\_evas\_geometry\_get}}(d.ee, NULL, NULL, \&cw, \&ch);}
\DoxyCodeLine{}
\DoxyCodeLine{   \textcolor{keywordflow}{if} (w < cw)}
\DoxyCodeLine{     evas\_object\_resize(d.img, cw, ch);}
\DoxyCodeLine{   \textcolor{keywordflow}{else}}
\DoxyCodeLine{     evas\_object\_resize(d.img, cw / 2, ch / 2);}
\DoxyCodeLine{}
\DoxyCodeLine{   \textcolor{keywordflow}{return} \mbox{\hyperlink{group__Eina__Types__Group_ga05c12dacc8b4058994df842b41be85fc}{EINA\_TRUE}}; \textcolor{comment}{/* re-\/issue the timer */}}
\DoxyCodeLine{\}}

\end{DoxyCodeInclude}
 When you start this example, this animation will be running, by default. To interact with the program, there\textquotesingle{}s a command line interface. A help string can be asked for with the \textquotesingle{}h\textquotesingle{} key\+:  
\begin{DoxyCodeInclude}{0}
\DoxyCodeLine{\textcolor{keyword}{static} \textcolor{keyword}{const} \textcolor{keywordtype}{char} *commands = \(\backslash\)}
\DoxyCodeLine{  \textcolor{stringliteral}{"commands are:\(\backslash\)n"}}
\DoxyCodeLine{  \textcolor{stringliteral}{"\(\backslash\)ta -\/ toggle animation timer\(\backslash\)n"}}
\DoxyCodeLine{  \textcolor{stringliteral}{"\(\backslash\)tc -\/ cycle between focus and key grabs for key input\(\backslash\)n"}}
\DoxyCodeLine{  \textcolor{stringliteral}{"\(\backslash\)td -\/ delete canvas callbacks\(\backslash\)n"}}
\DoxyCodeLine{  \textcolor{stringliteral}{"\(\backslash\)tf -\/ freeze input for 3 seconds\(\backslash\)n"}}
\DoxyCodeLine{  \textcolor{stringliteral}{"\(\backslash\)tp -\/ toggle precise point collision detection on image\(\backslash\)n"}}
\DoxyCodeLine{  \textcolor{stringliteral}{"\(\backslash\)tControl + o -\/ add an obscured rectangle\(\backslash\)n"}}
\DoxyCodeLine{  \textcolor{stringliteral}{"\(\backslash\)th -\/ print help\(\backslash\)n"};}

\end{DoxyCodeInclude}
 These are the commands the example will accept at any time, except when one triggers the \textquotesingle{}f\textquotesingle{} one. This command will exemplify \mbox{\hyperlink{group__Evas__Event__Feeding__Group_ga4f6046343eab8b062e5509d984100ec8}{evas\+\_\+event\+\_\+freeze()}}, which interrupts {\bfseries{all}} input events processing for the canvas (in the example, just for 3 seconds). Try to issue events for it during that freeze time\+:  
\begin{DoxyCodeInclude}{0}
\DoxyCodeLine{   \textcolor{keywordflow}{if} (strcmp(ev-\/>\mbox{\hyperlink{struct__Evas__Event__Key__Down_a70473bba88a1afaee180a54150513824}{key}}, \textcolor{stringliteral}{"f"}) == 0) \textcolor{comment}{/* freeze input for 3 seconds */}}
\DoxyCodeLine{     \{}
\DoxyCodeLine{        printf(\textcolor{stringliteral}{"Freezing input for 3 seconds\(\backslash\)n"});}
\DoxyCodeLine{        \mbox{\hyperlink{group__Evas__Event__Feeding__Group_ga4f6046343eab8b062e5509d984100ec8}{evas\_event\_freeze}}(evas);}
\DoxyCodeLine{        d.freeze\_timer = \mbox{\hyperlink{group__Ecore__Timer__Group_ga7b9cb9d24ecebfdbb957436e2e669402}{ecore\_timer\_add}}(3, \_thaw\_cb, NULL);}
\DoxyCodeLine{        \textcolor{keywordflow}{return};}
\DoxyCodeLine{     \}}

\end{DoxyCodeInclude}
 The \textquotesingle{}d\textquotesingle{} command will unregister those two canvas callbacks for you, so you won\textquotesingle{}t see the messages about the focused object and the rendering process anymore\+:  
\begin{DoxyCodeInclude}{0}
\DoxyCodeLine{   \textcolor{keywordflow}{if} (strcmp(ev-\/>\mbox{\hyperlink{struct__Evas__Event__Key__Down_a70473bba88a1afaee180a54150513824}{key}}, \textcolor{stringliteral}{"d"}) == 0) \textcolor{comment}{/* delete canvas' callbacks */}}
\DoxyCodeLine{     \{}
\DoxyCodeLine{        printf(\textcolor{stringliteral}{"Deleting canvas event callbacks\(\backslash\)n"});}
\DoxyCodeLine{        evas\_event\_callback\_del\_full(evas, \mbox{\hyperlink{Evas__Common_8h_ad64cde0da38a60e7cb7905b3ab216968a5a68e4f5dccdc18a393ef4a4773236c3}{EVAS\_CALLBACK\_RENDER\_FLUSH\_PRE}},}
\DoxyCodeLine{                                     \_render\_flush\_cb, NULL);}
\DoxyCodeLine{        evas\_event\_callback\_del\_full(}
\DoxyCodeLine{          evas, \mbox{\hyperlink{Evas__Common_8h_ad64cde0da38a60e7cb7905b3ab216968a7380ca16bf87762e96309473d3d306c5}{EVAS\_CALLBACK\_CANVAS\_OBJECT\_FOCUS\_IN}},}
\DoxyCodeLine{          \_object\_focus\_in\_cb, NULL);}
\DoxyCodeLine{        \textcolor{keywordflow}{return};}
\DoxyCodeLine{     \}}

\end{DoxyCodeInclude}
 In this example, we start using a focused object to handle the input events -- the background rectangle. We register a callback on an key input event occurring on it, so that we can act on each key stroke\+: 
\begin{DoxyCodeInclude}{0}
\DoxyCodeLine{   \mbox{\hyperlink{group__Evas__Object__Group__Events_ga23be30ac5cdfb780f1ff82e9108ec26b}{evas\_object\_event\_callback\_add}}(}
\DoxyCodeLine{     d.bg, \mbox{\hyperlink{Evas__Common_8h_ad64cde0da38a60e7cb7905b3ab216968a336b86bad4f145f84c155e4922335584}{EVAS\_CALLBACK\_KEY\_DOWN}}, \_on\_keydown, NULL);}
\DoxyCodeLine{   \textcolor{keywordflow}{if} (\mbox{\hyperlink{group__Evas__Main__Group_gacfae4f589c777003f58d51e502c52835}{evas\_alloc\_error}}() != \mbox{\hyperlink{Evas__Common_8h_a1adf9f604f763f2a8db12a484ca199cba22bbdd0a96a670bbddd6789f91921af8}{EVAS\_ALLOC\_ERROR\_NONE}})}
\DoxyCodeLine{     \{}
\DoxyCodeLine{        fprintf(stderr, \textcolor{stringliteral}{"ERROR: Callback registering failed! Aborting.\(\backslash\)n"});}
\DoxyCodeLine{        \textcolor{keywordflow}{goto} panic;}
\DoxyCodeLine{     \}}

\end{DoxyCodeInclude}
  
\begin{DoxyCodeInclude}{0}
\DoxyCodeLine{\textcolor{comment}{/* examine the keys pressed */}}
\DoxyCodeLine{\textcolor{keyword}{static} \textcolor{keywordtype}{void}}
\DoxyCodeLine{\_on\_keydown(\textcolor{keywordtype}{void}        *data \mbox{\hyperlink{group__Eina__Types__Group_ga82d751be730f849719ca292f9558be87}{EINA\_UNUSED}},}
\DoxyCodeLine{            \mbox{\hyperlink{group__Evas__Canvas_ga5ff87cc4ce6bc43e3b640a6d37f73043}{Evas}}        *evas,}
\DoxyCodeLine{            \mbox{\hyperlink{group__Evas__Object__Group_ga9e19e6dd1f517a0ba437c0114d3e7c97}{Evas\_Object}} *o \mbox{\hyperlink{group__Eina__Types__Group_ga82d751be730f849719ca292f9558be87}{EINA\_UNUSED}},}
\DoxyCodeLine{            \textcolor{keywordtype}{void}        *einfo)}
\DoxyCodeLine{\{}
\DoxyCodeLine{   \textcolor{keyword}{const} Evas\_Modifier *mods;}
\DoxyCodeLine{   \mbox{\hyperlink{struct__Evas__Event__Key__Down}{Evas\_Event\_Key\_Down}} *ev = einfo;}
\DoxyCodeLine{}
\DoxyCodeLine{   printf(\textcolor{stringliteral}{"We've got key input: \%s\(\backslash\)n"}, ev-\/>\mbox{\hyperlink{struct__Evas__Event__Key__Down_a70473bba88a1afaee180a54150513824}{key}});}
\DoxyCodeLine{   printf(\textcolor{stringliteral}{"It actually came from \%s\(\backslash\)n"},}
\DoxyCodeLine{          d.focus ? \textcolor{stringliteral}{"focus"} : \textcolor{stringliteral}{"key grab"});}

\end{DoxyCodeInclude}
 We do so by examining the {\ttfamily ev-\/$>$key} string (remember the event information struct for key down events is the \#\+Evas\+\_\+\+Event\+\_\+\+Key\+\_\+\+Down one). There\textquotesingle{}s one more trick for grabbing input events on this example -- \mbox{\hyperlink{group__Evas__Object__Group__Events_ga85828f3c1f252391def19e179b850def}{evas\+\_\+object\+\_\+key\+\_\+grab()}}. The \textquotesingle{}c\textquotesingle{} command will, when firstly used, {\bfseries{unfocus}} the background rectangle. Unfocused objects on an Evas canvas will {\bfseries{never}} receive key events. We grab, then, the keys we\textquotesingle{}re interested at to the object forcefully\+: 
\begin{DoxyCodeInclude}{0}
\DoxyCodeLine{        \textcolor{keywordflow}{if} (d.focus)}
\DoxyCodeLine{          \{}
\DoxyCodeLine{             \mbox{\hyperlink{group__Evas__Object__Group_ga4405e118e1fb762987af1269b6848db5}{evas\_object\_focus\_set}}(d.bg, \mbox{\hyperlink{group__Eina__Types__Group_ga1feb115f8e9913e806e090d9bd5a7301}{EINA\_FALSE}});}
\DoxyCodeLine{             printf(\textcolor{stringliteral}{"Focused object is now \%s\(\backslash\)n"},}
\DoxyCodeLine{                    evas\_focus\_get(d.canvas) ?}
\DoxyCodeLine{                    \textcolor{stringliteral}{"still valid! Something went wrong."} : \textcolor{stringliteral}{"none."});}
\DoxyCodeLine{}
\DoxyCodeLine{             ret = \mbox{\hyperlink{group__Evas__Object__Group__Events_ga85828f3c1f252391def19e179b850def}{evas\_object\_key\_grab}}(d.bg, \textcolor{stringliteral}{"a"}, 0, 0, \mbox{\hyperlink{group__Eina__Types__Group_ga05c12dacc8b4058994df842b41be85fc}{EINA\_TRUE}});}
\DoxyCodeLine{             \textcolor{keywordflow}{if} (!ret)}
\DoxyCodeLine{               \{}
\DoxyCodeLine{                  printf(\textcolor{stringliteral}{"Something went wrong with key grabs.\(\backslash\)n"});}
\DoxyCodeLine{                  \textcolor{keywordflow}{goto} c\_end;}
\DoxyCodeLine{               \}}
\DoxyCodeLine{             ret = \mbox{\hyperlink{group__Evas__Object__Group__Events_ga85828f3c1f252391def19e179b850def}{evas\_object\_key\_grab}}(d.bg, \textcolor{stringliteral}{"c"}, 0, 0, \mbox{\hyperlink{group__Eina__Types__Group_ga05c12dacc8b4058994df842b41be85fc}{EINA\_TRUE}});}
\DoxyCodeLine{             \textcolor{keywordflow}{if} (!ret)}
\DoxyCodeLine{               \{}
\DoxyCodeLine{                  printf(\textcolor{stringliteral}{"Something went wrong with key grabs.\(\backslash\)n"});}
\DoxyCodeLine{                  \textcolor{keywordflow}{goto} c\_end;}
\DoxyCodeLine{               \}}
\DoxyCodeLine{             ret = \mbox{\hyperlink{group__Evas__Object__Group__Events_ga85828f3c1f252391def19e179b850def}{evas\_object\_key\_grab}}(d.bg, \textcolor{stringliteral}{"d"}, 0, 0, \mbox{\hyperlink{group__Eina__Types__Group_ga05c12dacc8b4058994df842b41be85fc}{EINA\_TRUE}});}
\DoxyCodeLine{             \textcolor{keywordflow}{if} (!ret)}
\DoxyCodeLine{               \{}
\DoxyCodeLine{                  printf(\textcolor{stringliteral}{"Something went wrong with key grabs.\(\backslash\)n"});}
\DoxyCodeLine{                  \textcolor{keywordflow}{goto} c\_end;}
\DoxyCodeLine{               \}}
\DoxyCodeLine{             ret = \mbox{\hyperlink{group__Evas__Object__Group__Events_ga85828f3c1f252391def19e179b850def}{evas\_object\_key\_grab}}(d.bg, \textcolor{stringliteral}{"f"}, 0, 0, \mbox{\hyperlink{group__Eina__Types__Group_ga05c12dacc8b4058994df842b41be85fc}{EINA\_TRUE}});}
\DoxyCodeLine{             \textcolor{keywordflow}{if} (!ret)}
\DoxyCodeLine{               \{}
\DoxyCodeLine{                  printf(\textcolor{stringliteral}{"Something went wrong with key grabs.\(\backslash\)n"});}
\DoxyCodeLine{                  \textcolor{keywordflow}{goto} c\_end;}
\DoxyCodeLine{               \}}
\DoxyCodeLine{             ret = \mbox{\hyperlink{group__Evas__Object__Group__Events_ga85828f3c1f252391def19e179b850def}{evas\_object\_key\_grab}}(d.bg, \textcolor{stringliteral}{"p"}, 0, 0, \mbox{\hyperlink{group__Eina__Types__Group_ga05c12dacc8b4058994df842b41be85fc}{EINA\_TRUE}});}
\DoxyCodeLine{             \textcolor{keywordflow}{if} (!ret)}
\DoxyCodeLine{               \{}
\DoxyCodeLine{                  printf(\textcolor{stringliteral}{"Something went wrong with key grabs.\(\backslash\)n"});}
\DoxyCodeLine{                  \textcolor{keywordflow}{goto} c\_end;}
\DoxyCodeLine{               \}}
\DoxyCodeLine{             ret = \mbox{\hyperlink{group__Evas__Object__Group__Events_ga85828f3c1f252391def19e179b850def}{evas\_object\_key\_grab}}(d.bg, \textcolor{stringliteral}{"o"}, mask, 0, \mbox{\hyperlink{group__Eina__Types__Group_ga05c12dacc8b4058994df842b41be85fc}{EINA\_TRUE}});}
\DoxyCodeLine{             \textcolor{keywordflow}{if} (!ret)}
\DoxyCodeLine{               \{}
\DoxyCodeLine{                  printf(\textcolor{stringliteral}{"Something went wrong with key grabs.\(\backslash\)n"});}
\DoxyCodeLine{                  \textcolor{keywordflow}{goto} c\_end;}
\DoxyCodeLine{               \}}
\DoxyCodeLine{             ret = \mbox{\hyperlink{group__Evas__Object__Group__Events_ga85828f3c1f252391def19e179b850def}{evas\_object\_key\_grab}}(d.bg, \textcolor{stringliteral}{"h"}, 0, 0, \mbox{\hyperlink{group__Eina__Types__Group_ga05c12dacc8b4058994df842b41be85fc}{EINA\_TRUE}});}
\DoxyCodeLine{             \textcolor{keywordflow}{if} (!ret)}
\DoxyCodeLine{               \{}
\DoxyCodeLine{                  printf(\textcolor{stringliteral}{"Something went wrong with key grabs.\(\backslash\)n"});}
\DoxyCodeLine{                  \textcolor{keywordflow}{goto} c\_end;}
\DoxyCodeLine{               \}}
\DoxyCodeLine{          \}}
\DoxyCodeLine{        \textcolor{keywordflow}{else} \textcolor{comment}{/* got here by key grabs */}}

\end{DoxyCodeInclude}
 This shows how one can handle input not depending on focus issues -- you can grab them globally. Switch back and forth focus and forced key grabbing with the \textquotesingle{}c\textquotesingle{} key, and observe the messages printed about the focused object. Observe, also, that we register two more {\bfseries{object}} callbacks, this time on the image object (Enlightenment logo), where we just print messages telling the mouse pointer has entered or exited it area\+: 
\begin{DoxyCodeInclude}{0}
\DoxyCodeLine{        \mbox{\hyperlink{group__Evas__Object__Group__Basic_ga9cbc13661584e49fb9d9cdab514a1eeb}{evas\_object\_show}}(d.img);}
\DoxyCodeLine{        \mbox{\hyperlink{group__Evas__Object__Group__Events_ga23be30ac5cdfb780f1ff82e9108ec26b}{evas\_object\_event\_callback\_add}}(}
\DoxyCodeLine{          d.img, \mbox{\hyperlink{Evas__Common_8h_ad64cde0da38a60e7cb7905b3ab216968a598c57bc146639618157159a319f11af}{EVAS\_CALLBACK\_MOUSE\_IN}}, \_on\_mouse\_in, NULL);}
\DoxyCodeLine{        \mbox{\hyperlink{group__Evas__Object__Group__Events_ga23be30ac5cdfb780f1ff82e9108ec26b}{evas\_object\_event\_callback\_add}}(}
\DoxyCodeLine{          d.img, \mbox{\hyperlink{Evas__Common_8h_ad64cde0da38a60e7cb7905b3ab216968a91aaa30a57047d0ee8a734e603751c25}{EVAS\_CALLBACK\_MOUSE\_OUT}}, \_on\_mouse\_out, NULL);}

\end{DoxyCodeInclude}
  
\begin{DoxyCodeInclude}{0}
\DoxyCodeLine{\textcolor{comment}{/* mouse enters the object's area */}}
\DoxyCodeLine{\textcolor{keyword}{static} \textcolor{keywordtype}{void}}
\DoxyCodeLine{\_on\_mouse\_in(\textcolor{keywordtype}{void}        *data \mbox{\hyperlink{group__Eina__Types__Group_ga82d751be730f849719ca292f9558be87}{EINA\_UNUSED}},}
\DoxyCodeLine{             \mbox{\hyperlink{group__Evas__Canvas_ga5ff87cc4ce6bc43e3b640a6d37f73043}{Evas}}        *evas \mbox{\hyperlink{group__Eina__Types__Group_ga82d751be730f849719ca292f9558be87}{EINA\_UNUSED}},}
\DoxyCodeLine{             \mbox{\hyperlink{group__Evas__Object__Group_ga9e19e6dd1f517a0ba437c0114d3e7c97}{Evas\_Object}} *o \mbox{\hyperlink{group__Eina__Types__Group_ga82d751be730f849719ca292f9558be87}{EINA\_UNUSED}},}
\DoxyCodeLine{             \textcolor{keywordtype}{void}        *einfo \mbox{\hyperlink{group__Eina__Types__Group_ga82d751be730f849719ca292f9558be87}{EINA\_UNUSED}})}
\DoxyCodeLine{\{}
\DoxyCodeLine{   printf(\textcolor{stringliteral}{"Enlightenment logo has had the mouse in.\(\backslash\)n"});}
\DoxyCodeLine{\}}
\DoxyCodeLine{}
\DoxyCodeLine{\textcolor{keyword}{static} \textcolor{keywordtype}{void}}
\DoxyCodeLine{\_on\_mouse\_out(\textcolor{keywordtype}{void}        *data \mbox{\hyperlink{group__Eina__Types__Group_ga82d751be730f849719ca292f9558be87}{EINA\_UNUSED}},}
\DoxyCodeLine{              \mbox{\hyperlink{group__Evas__Canvas_ga5ff87cc4ce6bc43e3b640a6d37f73043}{Evas}}        *evas \mbox{\hyperlink{group__Eina__Types__Group_ga82d751be730f849719ca292f9558be87}{EINA\_UNUSED}},}
\DoxyCodeLine{              \mbox{\hyperlink{group__Evas__Object__Group_ga9e19e6dd1f517a0ba437c0114d3e7c97}{Evas\_Object}} *o \mbox{\hyperlink{group__Eina__Types__Group_ga82d751be730f849719ca292f9558be87}{EINA\_UNUSED}},}
\DoxyCodeLine{              \textcolor{keywordtype}{void}        *einfo \mbox{\hyperlink{group__Eina__Types__Group_ga82d751be730f849719ca292f9558be87}{EINA\_UNUSED}})}
\DoxyCodeLine{\{}
\DoxyCodeLine{   printf(\textcolor{stringliteral}{"Enlightenment logo has had the mouse out.\(\backslash\)n"});}
\DoxyCodeLine{\} \textcolor{comment}{/* mouse exits the object's area */}}

\end{DoxyCodeInclude}
 Experiment with moving the mouse pointer over the image, letting it enter and exit its area (stop the animation with \textquotesingle{}a\textquotesingle{}, for a better experience). When you start the example, Evas will consider this area by being the whole boundary rectangle around the picture. If you issue the \textquotesingle{}p\textquotesingle{} command, though, you get a demonstration of Evas\textquotesingle{} precise point collision detection on objects. With \mbox{\hyperlink{group__Evas__Object__Group_ga98701c8e66ca7c96032fdb486728e270}{evas\+\_\+object\+\_\+precise\+\_\+is\+\_\+inside\+\_\+get()}}, one can make Evas consider the transparent areas of an object (the middle of the logo\textquotesingle{}s E letter, in the case) as not belonging to it when calculating mouse in/out/up/down events\+:  
\begin{DoxyCodeInclude}{0}
\DoxyCodeLine{   \textcolor{keywordflow}{if} (strcmp(ev-\/>\mbox{\hyperlink{struct__Evas__Event__Key__Down_a70473bba88a1afaee180a54150513824}{key}}, \textcolor{stringliteral}{"p"}) == 0) \textcolor{comment}{/* toggle precise point}}
\DoxyCodeLine{\textcolor{comment}{                                       * collision detection */}}
\DoxyCodeLine{     \{}
\DoxyCodeLine{        \mbox{\hyperlink{group__Eina__Types__Group_ga3fe0caf72e93b1bab1ca8ee3ccf3f226}{Eina\_Bool}} precise = \mbox{\hyperlink{group__Evas__Object__Group_ga98701c8e66ca7c96032fdb486728e270}{evas\_object\_precise\_is\_inside\_get}}(d.img);}
\DoxyCodeLine{}
\DoxyCodeLine{        printf(\textcolor{stringliteral}{"Toggling precise point collision detection \%s on Enlightenment logo\(\backslash\)n"},}
\DoxyCodeLine{               precise ? \textcolor{stringliteral}{"off"} : \textcolor{stringliteral}{"on"});}
\DoxyCodeLine{        \mbox{\hyperlink{group__Evas__Object__Group_ga02844427c0e15ef2fb61412debf40ce3}{evas\_object\_precise\_is\_inside\_set}}(d.img, !precise);}
\DoxyCodeLine{}
\DoxyCodeLine{        \textcolor{keywordflow}{return};}
\DoxyCodeLine{     \}}

\end{DoxyCodeInclude}
 To finish the example, try the command bound to Control + \textquotesingle{}o\textquotesingle{}, which exemplifies Evas\textquotesingle{} {\bfseries{obscured regions}}. When firstly pressed, you\textquotesingle{}ll get the same contents, in a region in the middle of the canvas, at the time the key was pressed, until you toggle the effect off again (make sure the animation is running on to get the idea better). When you toggle this effect off, we also demonstrate the use of evas\+\_\+render\+\_\+updates(), which will force immediate updates on the canvas rendering, bringing back the obscured region\textquotesingle{}s contents to normal. 
\begin{DoxyCodeInclude}{0}
\DoxyCodeLine{   mods = \mbox{\hyperlink{group__Evas__Canvas_gaad42bb4caa43c1cfef4096f6ac2b99ec}{evas\_key\_modifier\_get}}(evas);}
\DoxyCodeLine{   \textcolor{keywordflow}{if} (\mbox{\hyperlink{group__Evas__Keys_ga6cc24a5ea4b39b84c7a3e617de3db261}{evas\_key\_modifier\_is\_set}}(mods, \textcolor{stringliteral}{"Control"}) \&\&}
\DoxyCodeLine{       (strcmp(ev-\/>\mbox{\hyperlink{struct__Evas__Event__Key__Down_a70473bba88a1afaee180a54150513824}{key}}, \textcolor{stringliteral}{"o"}) == 0)) \textcolor{comment}{/* add an obscured}}
\DoxyCodeLine{\textcolor{comment}{                                        * rectangle to the middle}}
\DoxyCodeLine{\textcolor{comment}{                                        * of the canvas */}}
\DoxyCodeLine{     \{}
\DoxyCodeLine{        printf(\textcolor{stringliteral}{"Toggling obscured rectangle on canvas\(\backslash\)n"});}
\DoxyCodeLine{        \textcolor{keywordflow}{if} (!d.obscured)}
\DoxyCodeLine{          \{}
\DoxyCodeLine{             \textcolor{keywordtype}{int} w, h;}
\DoxyCodeLine{             \mbox{\hyperlink{group__Evas__Canvas_ga346bb724a254e8681c382b84886045b4}{evas\_output\_viewport\_get}}(evas, NULL, NULL, \&w, \&h);}
\DoxyCodeLine{             evas\_obscured\_rectangle\_add(evas, w / 4, h / 4, w / 2, h / 2);}
\DoxyCodeLine{          \}}
\DoxyCodeLine{        \textcolor{keywordflow}{else}}
\DoxyCodeLine{          \{}
\DoxyCodeLine{             \textcolor{keywordtype}{int} w, h;}
\DoxyCodeLine{             \mbox{\hyperlink{struct__Eina__Rectangle}{Eina\_Rectangle}} *rect;}
\DoxyCodeLine{             \mbox{\hyperlink{struct__Eina__List}{Eina\_List}} *updates, *l;}
\DoxyCodeLine{}
\DoxyCodeLine{             \mbox{\hyperlink{group__Evas__Canvas_ga346bb724a254e8681c382b84886045b4}{evas\_output\_viewport\_get}}(evas, NULL, NULL, \&w, \&h);}
\DoxyCodeLine{             evas\_obscured\_clear(evas);}
\DoxyCodeLine{}
\DoxyCodeLine{             \textcolor{comment}{/* we have to flag a damage region here because}}
\DoxyCodeLine{\textcolor{comment}{              * evas\_obscured\_clear() doesn't change the canvas'}}
\DoxyCodeLine{\textcolor{comment}{              * state. we'd have to wait for an animation step, for}}
\DoxyCodeLine{\textcolor{comment}{              * example, to get the result, without it */}}
\DoxyCodeLine{             evas\_damage\_rectangle\_add(evas, 0, 0, w, h);}
\DoxyCodeLine{}
\DoxyCodeLine{             updates = evas\_render\_updates(evas);}
\DoxyCodeLine{}
\DoxyCodeLine{             \mbox{\hyperlink{group__Eina__List__Group_gac6efafc19f526d916cdb9757240a8773}{EINA\_LIST\_FOREACH}}(updates, l, rect)}
\DoxyCodeLine{               \{}
\DoxyCodeLine{                  printf(\textcolor{stringliteral}{"Rectangle (\%d, \%d, \%d, \%d) on canvas got a"}}
\DoxyCodeLine{                                  \textcolor{stringliteral}{" rendering update.\(\backslash\)n"}, rect-\/>\mbox{\hyperlink{struct__Eina__Rectangle_a8358c0791dcf476432687510ca4e5d5c}{x}}, rect-\/>\mbox{\hyperlink{struct__Eina__Rectangle_ae74dc834fb71a1f4cd9e3fe11dec3940}{y}},}
\DoxyCodeLine{                          rect-\/>\mbox{\hyperlink{struct__Eina__Rectangle_af6a92d51ec25ee3464c81297ffc3a330}{w}},}
\DoxyCodeLine{                          rect-\/>\mbox{\hyperlink{struct__Eina__Rectangle_a7570ed17f58fc94be997414a86130074}{h}});}
\DoxyCodeLine{               \}}
\DoxyCodeLine{             \mbox{\hyperlink{group__Evas__Canvas_ga038d98c7c13a86b6ba4de51f8aba3595}{evas\_render\_updates\_free}}(updates);}
\DoxyCodeLine{          \}}
\DoxyCodeLine{        d.obscured = !d.obscured;}
\DoxyCodeLine{     \} \textcolor{comment}{/* end of obscured region command */}}

\end{DoxyCodeInclude}


What follows is the complete code for this example.


\begin{DoxyCodeInclude}{0}
\DoxyCodeLine{}
\DoxyCodeLine{\textcolor{preprocessor}{\#ifdef HAVE\_CONFIG\_H}}
\DoxyCodeLine{\textcolor{preprocessor}{\#include "config.h"}}
\DoxyCodeLine{\textcolor{preprocessor}{\#else}}
\DoxyCodeLine{\textcolor{preprocessor}{\#define PACKAGE\_EXAMPLES\_DIR "."}}
\DoxyCodeLine{\textcolor{preprocessor}{\#endif}}
\DoxyCodeLine{}
\DoxyCodeLine{\textcolor{preprocessor}{\#include <Ecore.h>}}
\DoxyCodeLine{\textcolor{preprocessor}{\#include <\mbox{\hyperlink{Ecore__Evas_8h}{Ecore\_Evas.h}}>}}
\DoxyCodeLine{\textcolor{preprocessor}{\#include <stdio.h>}}
\DoxyCodeLine{\textcolor{preprocessor}{\#include <errno.h>}}
\DoxyCodeLine{\textcolor{preprocessor}{\#include "evas-\/common.h"}}
\DoxyCodeLine{}
\DoxyCodeLine{\textcolor{preprocessor}{\#define WIDTH  (320)}}
\DoxyCodeLine{\textcolor{preprocessor}{\#define HEIGHT (240)}}
\DoxyCodeLine{}
\DoxyCodeLine{\textcolor{keyword}{static} \textcolor{keyword}{const} \textcolor{keywordtype}{char} *img\_path = PACKAGE\_EXAMPLES\_DIR EVAS\_IMAGE\_FOLDER \textcolor{stringliteral}{"/enlightenment.png"};}
\DoxyCodeLine{}
\DoxyCodeLine{\textcolor{keyword}{static} \textcolor{keyword}{const} \textcolor{keywordtype}{char} *commands = \(\backslash\)}
\DoxyCodeLine{  \textcolor{stringliteral}{"commands are:\(\backslash\)n"}}
\DoxyCodeLine{  \textcolor{stringliteral}{"\(\backslash\)ta -\/ toggle animation timer\(\backslash\)n"}}
\DoxyCodeLine{  \textcolor{stringliteral}{"\(\backslash\)tc -\/ cycle between focus and key grabs for key input\(\backslash\)n"}}
\DoxyCodeLine{  \textcolor{stringliteral}{"\(\backslash\)td -\/ delete canvas callbacks\(\backslash\)n"}}
\DoxyCodeLine{  \textcolor{stringliteral}{"\(\backslash\)tf -\/ freeze input for 3 seconds\(\backslash\)n"}}
\DoxyCodeLine{  \textcolor{stringliteral}{"\(\backslash\)tp -\/ toggle precise point collision detection on image\(\backslash\)n"}}
\DoxyCodeLine{  \textcolor{stringliteral}{"\(\backslash\)tControl + o -\/ add an obscured rectangle\(\backslash\)n"}}
\DoxyCodeLine{  \textcolor{stringliteral}{"\(\backslash\)th -\/ print help\(\backslash\)n"};}
\DoxyCodeLine{}
\DoxyCodeLine{\textcolor{keyword}{struct }test\_data}
\DoxyCodeLine{\{}
\DoxyCodeLine{   Ecore\_Evas  *ee;}
\DoxyCodeLine{   \mbox{\hyperlink{group__Evas__Canvas_ga5ff87cc4ce6bc43e3b640a6d37f73043}{Evas}}        *canvas;}
\DoxyCodeLine{   \mbox{\hyperlink{group__Evas__Object__Group_ga9e19e6dd1f517a0ba437c0114d3e7c97}{Evas\_Object}} *img, *bg;}
\DoxyCodeLine{   \mbox{\hyperlink{group__Ecore__Timer__Group_gaf96ffb609956658ec038e54bd39f46f0}{Ecore\_Timer}} *resize\_timer, *freeze\_timer;}
\DoxyCodeLine{   \mbox{\hyperlink{group__Eina__Types__Group_ga3fe0caf72e93b1bab1ca8ee3ccf3f226}{Eina\_Bool}}    obscured, focus;}
\DoxyCodeLine{\};}
\DoxyCodeLine{}
\DoxyCodeLine{\textcolor{keyword}{static} \textcolor{keyword}{struct }test\_data d = \{0\};}
\DoxyCodeLine{}
\DoxyCodeLine{\textcolor{comment}{/* Keep the example's window size in sync with the background image's size */}}
\DoxyCodeLine{\textcolor{keyword}{static} \textcolor{keywordtype}{void}}
\DoxyCodeLine{\_canvas\_resize\_cb(Ecore\_Evas *ee)}
\DoxyCodeLine{\{}
\DoxyCodeLine{   \textcolor{keywordtype}{int} w, h;}
\DoxyCodeLine{}
\DoxyCodeLine{   \mbox{\hyperlink{group__Ecore__Evas__Group_ga931aadf4603731e73e8a84e4b14f1493}{ecore\_evas\_geometry\_get}}(ee, NULL, NULL, \&w, \&h);}
\DoxyCodeLine{   evas\_object\_resize(d.bg, w, h);}
\DoxyCodeLine{\}}
\DoxyCodeLine{}
\DoxyCodeLine{\textcolor{comment}{/* called when our rectangle gets focus */}}
\DoxyCodeLine{\textcolor{keyword}{static} \textcolor{keywordtype}{void}}
\DoxyCodeLine{\_object\_focus\_in\_cb(\textcolor{keywordtype}{void} *data \mbox{\hyperlink{group__Eina__Types__Group_ga82d751be730f849719ca292f9558be87}{EINA\_UNUSED}},}
\DoxyCodeLine{                    \mbox{\hyperlink{group__Evas__Canvas_ga5ff87cc4ce6bc43e3b640a6d37f73043}{Evas}} *e,}
\DoxyCodeLine{                    \textcolor{keywordtype}{void} *event\_info)}
\DoxyCodeLine{\{}
\DoxyCodeLine{   printf(\textcolor{stringliteral}{"An object got focused: \%s\(\backslash\)n"},}
\DoxyCodeLine{          \mbox{\hyperlink{group__Evas__Object__Group__Basic_ga7934106d84f6a019fcb421b6b4d860a3}{evas\_object\_name\_get}}(event\_info));}
\DoxyCodeLine{}
\DoxyCodeLine{   printf(\textcolor{stringliteral}{"Let's recheck it: \%s\(\backslash\)n"},}
\DoxyCodeLine{          \mbox{\hyperlink{group__Evas__Object__Group__Basic_ga7934106d84f6a019fcb421b6b4d860a3}{evas\_object\_name\_get}}(evas\_focus\_get(e)));}
\DoxyCodeLine{}
\DoxyCodeLine{   printf(\textcolor{stringliteral}{"And again: \%s\(\backslash\)n"}, \mbox{\hyperlink{group__Evas__Object__Group_ga797d900504cf98d5f3c711b17ab5eaba}{evas\_object\_focus\_get}}(event\_info) ?}
\DoxyCodeLine{          \textcolor{stringliteral}{"OK!"} : \textcolor{stringliteral}{"Oops, something is bad."});}
\DoxyCodeLine{\}}
\DoxyCodeLine{}
\DoxyCodeLine{\textcolor{comment}{/* render flush callback */}}
\DoxyCodeLine{\textcolor{keyword}{static} \textcolor{keywordtype}{void}}
\DoxyCodeLine{\_render\_flush\_cb(\textcolor{keywordtype}{void} *data \mbox{\hyperlink{group__Eina__Types__Group_ga82d751be730f849719ca292f9558be87}{EINA\_UNUSED}},}
\DoxyCodeLine{                 \mbox{\hyperlink{group__Evas__Canvas_ga5ff87cc4ce6bc43e3b640a6d37f73043}{Evas}} *e \mbox{\hyperlink{group__Eina__Types__Group_ga82d751be730f849719ca292f9558be87}{EINA\_UNUSED}},}
\DoxyCodeLine{                 \textcolor{keywordtype}{void} *event\_info \mbox{\hyperlink{group__Eina__Types__Group_ga82d751be730f849719ca292f9558be87}{EINA\_UNUSED}})}
\DoxyCodeLine{\{}
\DoxyCodeLine{   printf(\textcolor{stringliteral}{"Canvas is about to flush its rendering pipeline!\(\backslash\)n"});}
\DoxyCodeLine{\}}
\DoxyCodeLine{}
\DoxyCodeLine{\textcolor{comment}{/* put some action in the canvas */}}
\DoxyCodeLine{\textcolor{keyword}{static} \mbox{\hyperlink{group__Eina__Types__Group_ga3fe0caf72e93b1bab1ca8ee3ccf3f226}{Eina\_Bool}}}
\DoxyCodeLine{\_resize\_cb(\textcolor{keywordtype}{void} *data \mbox{\hyperlink{group__Eina__Types__Group_ga82d751be730f849719ca292f9558be87}{EINA\_UNUSED}})}
\DoxyCodeLine{\{}
\DoxyCodeLine{   \textcolor{keywordtype}{int} w, h, cw, ch;}
\DoxyCodeLine{}
\DoxyCodeLine{   \mbox{\hyperlink{group__Evas__Object__Group__Basic_ga6f52fab1a96dc58c85ee481d84bac871}{evas\_object\_geometry\_get}}(d.img, NULL, NULL, \&w, \&h);}
\DoxyCodeLine{   \mbox{\hyperlink{group__Ecore__Evas__Group_ga931aadf4603731e73e8a84e4b14f1493}{ecore\_evas\_geometry\_get}}(d.ee, NULL, NULL, \&cw, \&ch);}
\DoxyCodeLine{}
\DoxyCodeLine{   \textcolor{keywordflow}{if} (w < cw)}
\DoxyCodeLine{     evas\_object\_resize(d.img, cw, ch);}
\DoxyCodeLine{   \textcolor{keywordflow}{else}}
\DoxyCodeLine{     evas\_object\_resize(d.img, cw / 2, ch / 2);}
\DoxyCodeLine{}
\DoxyCodeLine{   \textcolor{keywordflow}{return} \mbox{\hyperlink{group__Eina__Types__Group_ga05c12dacc8b4058994df842b41be85fc}{EINA\_TRUE}}; \textcolor{comment}{/* re-\/issue the timer */}}
\DoxyCodeLine{\}}
\DoxyCodeLine{}
\DoxyCodeLine{\textcolor{comment}{/* let's have our events back */}}
\DoxyCodeLine{\textcolor{keyword}{static} \mbox{\hyperlink{group__Eina__Types__Group_ga3fe0caf72e93b1bab1ca8ee3ccf3f226}{Eina\_Bool}}}
\DoxyCodeLine{\_thaw\_cb(\textcolor{keywordtype}{void} *data \mbox{\hyperlink{group__Eina__Types__Group_ga82d751be730f849719ca292f9558be87}{EINA\_UNUSED}})}
\DoxyCodeLine{\{}
\DoxyCodeLine{   printf(\textcolor{stringliteral}{"Canvas was frozen \%d times, now thawing.\(\backslash\)n"},}
\DoxyCodeLine{          \mbox{\hyperlink{group__Evas__Event__Feeding__Group_gaca66af7f9b72ddbd63104d59c1fdf894}{evas\_event\_freeze\_get}}(d.canvas));}
\DoxyCodeLine{   \mbox{\hyperlink{group__Evas__Event__Feeding__Group_ga376918c56c3dc588a059da7fe8629b70}{evas\_event\_thaw}}(d.canvas);}
\DoxyCodeLine{   \textcolor{keywordflow}{return} \mbox{\hyperlink{group__Eina__Types__Group_ga1feb115f8e9913e806e090d9bd5a7301}{EINA\_FALSE}}; \textcolor{comment}{/* do not re-\/issue the timer */}}
\DoxyCodeLine{\}}
\DoxyCodeLine{}
\DoxyCodeLine{\textcolor{comment}{/* mouse enters the object's area */}}
\DoxyCodeLine{\textcolor{keyword}{static} \textcolor{keywordtype}{void}}
\DoxyCodeLine{\_on\_mouse\_in(\textcolor{keywordtype}{void}        *data \mbox{\hyperlink{group__Eina__Types__Group_ga82d751be730f849719ca292f9558be87}{EINA\_UNUSED}},}
\DoxyCodeLine{             \mbox{\hyperlink{group__Evas__Canvas_ga5ff87cc4ce6bc43e3b640a6d37f73043}{Evas}}        *evas \mbox{\hyperlink{group__Eina__Types__Group_ga82d751be730f849719ca292f9558be87}{EINA\_UNUSED}},}
\DoxyCodeLine{             \mbox{\hyperlink{group__Evas__Object__Group_ga9e19e6dd1f517a0ba437c0114d3e7c97}{Evas\_Object}} *o \mbox{\hyperlink{group__Eina__Types__Group_ga82d751be730f849719ca292f9558be87}{EINA\_UNUSED}},}
\DoxyCodeLine{             \textcolor{keywordtype}{void}        *einfo \mbox{\hyperlink{group__Eina__Types__Group_ga82d751be730f849719ca292f9558be87}{EINA\_UNUSED}})}
\DoxyCodeLine{\{}
\DoxyCodeLine{   printf(\textcolor{stringliteral}{"Enlightenment logo has had the mouse in.\(\backslash\)n"});}
\DoxyCodeLine{\}}
\DoxyCodeLine{}
\DoxyCodeLine{\textcolor{keyword}{static} \textcolor{keywordtype}{void}}
\DoxyCodeLine{\_on\_mouse\_out(\textcolor{keywordtype}{void}        *data \mbox{\hyperlink{group__Eina__Types__Group_ga82d751be730f849719ca292f9558be87}{EINA\_UNUSED}},}
\DoxyCodeLine{              \mbox{\hyperlink{group__Evas__Canvas_ga5ff87cc4ce6bc43e3b640a6d37f73043}{Evas}}        *evas \mbox{\hyperlink{group__Eina__Types__Group_ga82d751be730f849719ca292f9558be87}{EINA\_UNUSED}},}
\DoxyCodeLine{              \mbox{\hyperlink{group__Evas__Object__Group_ga9e19e6dd1f517a0ba437c0114d3e7c97}{Evas\_Object}} *o \mbox{\hyperlink{group__Eina__Types__Group_ga82d751be730f849719ca292f9558be87}{EINA\_UNUSED}},}
\DoxyCodeLine{              \textcolor{keywordtype}{void}        *einfo \mbox{\hyperlink{group__Eina__Types__Group_ga82d751be730f849719ca292f9558be87}{EINA\_UNUSED}})}
\DoxyCodeLine{\{}
\DoxyCodeLine{   printf(\textcolor{stringliteral}{"Enlightenment logo has had the mouse out.\(\backslash\)n"});}
\DoxyCodeLine{\} \textcolor{comment}{/* mouse exits the object's area */}}
\DoxyCodeLine{}
\DoxyCodeLine{\textcolor{comment}{/* examine the keys pressed */}}
\DoxyCodeLine{\textcolor{keyword}{static} \textcolor{keywordtype}{void}}
\DoxyCodeLine{\_on\_keydown(\textcolor{keywordtype}{void}        *data \mbox{\hyperlink{group__Eina__Types__Group_ga82d751be730f849719ca292f9558be87}{EINA\_UNUSED}},}
\DoxyCodeLine{            \mbox{\hyperlink{group__Evas__Canvas_ga5ff87cc4ce6bc43e3b640a6d37f73043}{Evas}}        *evas,}
\DoxyCodeLine{            \mbox{\hyperlink{group__Evas__Object__Group_ga9e19e6dd1f517a0ba437c0114d3e7c97}{Evas\_Object}} *o \mbox{\hyperlink{group__Eina__Types__Group_ga82d751be730f849719ca292f9558be87}{EINA\_UNUSED}},}
\DoxyCodeLine{            \textcolor{keywordtype}{void}        *einfo)}
\DoxyCodeLine{\{}
\DoxyCodeLine{   \textcolor{keyword}{const} Evas\_Modifier *mods;}
\DoxyCodeLine{   \mbox{\hyperlink{struct__Evas__Event__Key__Down}{Evas\_Event\_Key\_Down}} *ev = einfo;}
\DoxyCodeLine{}
\DoxyCodeLine{   printf(\textcolor{stringliteral}{"We've got key input: \%s\(\backslash\)n"}, ev-\/>\mbox{\hyperlink{struct__Evas__Event__Key__Down_a70473bba88a1afaee180a54150513824}{key}});}
\DoxyCodeLine{   printf(\textcolor{stringliteral}{"It actually came from \%s\(\backslash\)n"},}
\DoxyCodeLine{          d.focus ? \textcolor{stringliteral}{"focus"} : \textcolor{stringliteral}{"key grab"});}
\DoxyCodeLine{}
\DoxyCodeLine{   \textcolor{keywordflow}{if} (strcmp(ev-\/>\mbox{\hyperlink{struct__Evas__Event__Key__Down_a70473bba88a1afaee180a54150513824}{key}}, \textcolor{stringliteral}{"h"}) == 0) \textcolor{comment}{/* print help */}}
\DoxyCodeLine{     \{}
\DoxyCodeLine{        puts(commands);}
\DoxyCodeLine{        \textcolor{keywordflow}{return};}
\DoxyCodeLine{     \}}
\DoxyCodeLine{}
\DoxyCodeLine{   \textcolor{keywordflow}{if} (strcmp(ev-\/>\mbox{\hyperlink{struct__Evas__Event__Key__Down_a70473bba88a1afaee180a54150513824}{key}}, \textcolor{stringliteral}{"a"}) == 0) \textcolor{comment}{/* toggle animation timer */}}
\DoxyCodeLine{     \{}
\DoxyCodeLine{        \textcolor{keywordflow}{if} (d.resize\_timer != NULL)}
\DoxyCodeLine{          \{}
\DoxyCodeLine{             printf(\textcolor{stringliteral}{"Stopping animation timer\(\backslash\)n"});}
\DoxyCodeLine{             \mbox{\hyperlink{group__Ecore__Timer__Group_gaba2b599c7aabe3ab664dc3d47f62a33a}{ecore\_timer\_del}}(d.resize\_timer);}
\DoxyCodeLine{             d.resize\_timer = NULL;}
\DoxyCodeLine{          \}}
\DoxyCodeLine{        \textcolor{keywordflow}{else}}
\DoxyCodeLine{          \{}
\DoxyCodeLine{             printf(\textcolor{stringliteral}{"Re-\/issuing animation timer\(\backslash\)n"});}
\DoxyCodeLine{             d.resize\_timer = \mbox{\hyperlink{group__Ecore__Timer__Group_ga7b9cb9d24ecebfdbb957436e2e669402}{ecore\_timer\_add}}(2, \_resize\_cb, NULL);}
\DoxyCodeLine{          \}}
\DoxyCodeLine{        \textcolor{keywordflow}{return};}
\DoxyCodeLine{     \}}
\DoxyCodeLine{}
\DoxyCodeLine{   \textcolor{keywordflow}{if} (strcmp(ev-\/>\mbox{\hyperlink{struct__Evas__Event__Key__Down_a70473bba88a1afaee180a54150513824}{key}}, \textcolor{stringliteral}{"c"}) == 0) \textcolor{comment}{/* cycle between focus and key}}
\DoxyCodeLine{\textcolor{comment}{                                       * grabs for key input */}}
\DoxyCodeLine{     \{}
\DoxyCodeLine{        \mbox{\hyperlink{group__Eina__Types__Group_ga3fe0caf72e93b1bab1ca8ee3ccf3f226}{Eina\_Bool}} ret;}
\DoxyCodeLine{        \mbox{\hyperlink{group__Evas__Keys_ga111c7333a7d49e44698bd19dd5bc9059}{Evas\_Modifier\_Mask}} mask =}
\DoxyCodeLine{          \mbox{\hyperlink{group__Evas__Canvas_ga668f8e34ce152d130f37b6b903db3ee2}{evas\_key\_modifier\_mask\_get}}(d.canvas, \textcolor{stringliteral}{"Control"});}
\DoxyCodeLine{}
\DoxyCodeLine{        printf(\textcolor{stringliteral}{"Switching to \%s for key input\(\backslash\)n"},}
\DoxyCodeLine{               d.focus ? \textcolor{stringliteral}{"key grabs"} : \textcolor{stringliteral}{"focus"});}
\DoxyCodeLine{}
\DoxyCodeLine{        \textcolor{keywordflow}{if} (d.focus)}
\DoxyCodeLine{          \{}
\DoxyCodeLine{             \mbox{\hyperlink{group__Evas__Object__Group_ga4405e118e1fb762987af1269b6848db5}{evas\_object\_focus\_set}}(d.bg, \mbox{\hyperlink{group__Eina__Types__Group_ga1feb115f8e9913e806e090d9bd5a7301}{EINA\_FALSE}});}
\DoxyCodeLine{             printf(\textcolor{stringliteral}{"Focused object is now \%s\(\backslash\)n"},}
\DoxyCodeLine{                    evas\_focus\_get(d.canvas) ?}
\DoxyCodeLine{                    \textcolor{stringliteral}{"still valid! Something went wrong."} : \textcolor{stringliteral}{"none."});}
\DoxyCodeLine{}
\DoxyCodeLine{             ret = \mbox{\hyperlink{group__Evas__Object__Group__Events_ga85828f3c1f252391def19e179b850def}{evas\_object\_key\_grab}}(d.bg, \textcolor{stringliteral}{"a"}, 0, 0, \mbox{\hyperlink{group__Eina__Types__Group_ga05c12dacc8b4058994df842b41be85fc}{EINA\_TRUE}});}
\DoxyCodeLine{             \textcolor{keywordflow}{if} (!ret)}
\DoxyCodeLine{               \{}
\DoxyCodeLine{                  printf(\textcolor{stringliteral}{"Something went wrong with key grabs.\(\backslash\)n"});}
\DoxyCodeLine{                  \textcolor{keywordflow}{goto} c\_end;}
\DoxyCodeLine{               \}}
\DoxyCodeLine{             ret = \mbox{\hyperlink{group__Evas__Object__Group__Events_ga85828f3c1f252391def19e179b850def}{evas\_object\_key\_grab}}(d.bg, \textcolor{stringliteral}{"c"}, 0, 0, \mbox{\hyperlink{group__Eina__Types__Group_ga05c12dacc8b4058994df842b41be85fc}{EINA\_TRUE}});}
\DoxyCodeLine{             \textcolor{keywordflow}{if} (!ret)}
\DoxyCodeLine{               \{}
\DoxyCodeLine{                  printf(\textcolor{stringliteral}{"Something went wrong with key grabs.\(\backslash\)n"});}
\DoxyCodeLine{                  \textcolor{keywordflow}{goto} c\_end;}
\DoxyCodeLine{               \}}
\DoxyCodeLine{             ret = \mbox{\hyperlink{group__Evas__Object__Group__Events_ga85828f3c1f252391def19e179b850def}{evas\_object\_key\_grab}}(d.bg, \textcolor{stringliteral}{"d"}, 0, 0, \mbox{\hyperlink{group__Eina__Types__Group_ga05c12dacc8b4058994df842b41be85fc}{EINA\_TRUE}});}
\DoxyCodeLine{             \textcolor{keywordflow}{if} (!ret)}
\DoxyCodeLine{               \{}
\DoxyCodeLine{                  printf(\textcolor{stringliteral}{"Something went wrong with key grabs.\(\backslash\)n"});}
\DoxyCodeLine{                  \textcolor{keywordflow}{goto} c\_end;}
\DoxyCodeLine{               \}}
\DoxyCodeLine{             ret = \mbox{\hyperlink{group__Evas__Object__Group__Events_ga85828f3c1f252391def19e179b850def}{evas\_object\_key\_grab}}(d.bg, \textcolor{stringliteral}{"f"}, 0, 0, \mbox{\hyperlink{group__Eina__Types__Group_ga05c12dacc8b4058994df842b41be85fc}{EINA\_TRUE}});}
\DoxyCodeLine{             \textcolor{keywordflow}{if} (!ret)}
\DoxyCodeLine{               \{}
\DoxyCodeLine{                  printf(\textcolor{stringliteral}{"Something went wrong with key grabs.\(\backslash\)n"});}
\DoxyCodeLine{                  \textcolor{keywordflow}{goto} c\_end;}
\DoxyCodeLine{               \}}
\DoxyCodeLine{             ret = \mbox{\hyperlink{group__Evas__Object__Group__Events_ga85828f3c1f252391def19e179b850def}{evas\_object\_key\_grab}}(d.bg, \textcolor{stringliteral}{"p"}, 0, 0, \mbox{\hyperlink{group__Eina__Types__Group_ga05c12dacc8b4058994df842b41be85fc}{EINA\_TRUE}});}
\DoxyCodeLine{             \textcolor{keywordflow}{if} (!ret)}
\DoxyCodeLine{               \{}
\DoxyCodeLine{                  printf(\textcolor{stringliteral}{"Something went wrong with key grabs.\(\backslash\)n"});}
\DoxyCodeLine{                  \textcolor{keywordflow}{goto} c\_end;}
\DoxyCodeLine{               \}}
\DoxyCodeLine{             ret = \mbox{\hyperlink{group__Evas__Object__Group__Events_ga85828f3c1f252391def19e179b850def}{evas\_object\_key\_grab}}(d.bg, \textcolor{stringliteral}{"o"}, mask, 0, \mbox{\hyperlink{group__Eina__Types__Group_ga05c12dacc8b4058994df842b41be85fc}{EINA\_TRUE}});}
\DoxyCodeLine{             \textcolor{keywordflow}{if} (!ret)}
\DoxyCodeLine{               \{}
\DoxyCodeLine{                  printf(\textcolor{stringliteral}{"Something went wrong with key grabs.\(\backslash\)n"});}
\DoxyCodeLine{                  \textcolor{keywordflow}{goto} c\_end;}
\DoxyCodeLine{               \}}
\DoxyCodeLine{             ret = \mbox{\hyperlink{group__Evas__Object__Group__Events_ga85828f3c1f252391def19e179b850def}{evas\_object\_key\_grab}}(d.bg, \textcolor{stringliteral}{"h"}, 0, 0, \mbox{\hyperlink{group__Eina__Types__Group_ga05c12dacc8b4058994df842b41be85fc}{EINA\_TRUE}});}
\DoxyCodeLine{             \textcolor{keywordflow}{if} (!ret)}
\DoxyCodeLine{               \{}
\DoxyCodeLine{                  printf(\textcolor{stringliteral}{"Something went wrong with key grabs.\(\backslash\)n"});}
\DoxyCodeLine{                  \textcolor{keywordflow}{goto} c\_end;}
\DoxyCodeLine{               \}}
\DoxyCodeLine{          \}}
\DoxyCodeLine{        \textcolor{keywordflow}{else} \textcolor{comment}{/* got here by key grabs */}}
\DoxyCodeLine{          \{}
\DoxyCodeLine{             \mbox{\hyperlink{group__Evas__Object__Group__Events_ga4bf730e4f650c51a9a76d76bc63f44c9}{evas\_object\_key\_ungrab}}(d.bg, \textcolor{stringliteral}{"a"}, 0, 0);}
\DoxyCodeLine{             \mbox{\hyperlink{group__Evas__Object__Group__Events_ga4bf730e4f650c51a9a76d76bc63f44c9}{evas\_object\_key\_ungrab}}(d.bg, \textcolor{stringliteral}{"c"}, 0, 0);}
\DoxyCodeLine{             \mbox{\hyperlink{group__Evas__Object__Group__Events_ga4bf730e4f650c51a9a76d76bc63f44c9}{evas\_object\_key\_ungrab}}(d.bg, \textcolor{stringliteral}{"d"}, 0, 0);}
\DoxyCodeLine{             \mbox{\hyperlink{group__Evas__Object__Group__Events_ga4bf730e4f650c51a9a76d76bc63f44c9}{evas\_object\_key\_ungrab}}(d.bg, \textcolor{stringliteral}{"f"}, 0, 0);}
\DoxyCodeLine{             \mbox{\hyperlink{group__Evas__Object__Group__Events_ga4bf730e4f650c51a9a76d76bc63f44c9}{evas\_object\_key\_ungrab}}(d.bg, \textcolor{stringliteral}{"p"}, 0, 0);}
\DoxyCodeLine{             \mbox{\hyperlink{group__Evas__Object__Group__Events_ga4bf730e4f650c51a9a76d76bc63f44c9}{evas\_object\_key\_ungrab}}(d.bg, \textcolor{stringliteral}{"o"}, mask, 0);}
\DoxyCodeLine{             \mbox{\hyperlink{group__Evas__Object__Group__Events_ga4bf730e4f650c51a9a76d76bc63f44c9}{evas\_object\_key\_ungrab}}(d.bg, \textcolor{stringliteral}{"h"}, 0, 0);}
\DoxyCodeLine{}
\DoxyCodeLine{             \mbox{\hyperlink{group__Evas__Object__Group_ga4405e118e1fb762987af1269b6848db5}{evas\_object\_focus\_set}}(d.bg, \mbox{\hyperlink{group__Eina__Types__Group_ga05c12dacc8b4058994df842b41be85fc}{EINA\_TRUE}});}
\DoxyCodeLine{          \}}
\DoxyCodeLine{}
\DoxyCodeLine{c\_end:}
\DoxyCodeLine{        d.focus = !d.focus;}
\DoxyCodeLine{}
\DoxyCodeLine{        \textcolor{keywordflow}{return};}
\DoxyCodeLine{     \}}
\DoxyCodeLine{}
\DoxyCodeLine{   \textcolor{keywordflow}{if} (strcmp(ev-\/>\mbox{\hyperlink{struct__Evas__Event__Key__Down_a70473bba88a1afaee180a54150513824}{key}}, \textcolor{stringliteral}{"d"}) == 0) \textcolor{comment}{/* delete canvas' callbacks */}}
\DoxyCodeLine{     \{}
\DoxyCodeLine{        printf(\textcolor{stringliteral}{"Deleting canvas event callbacks\(\backslash\)n"});}
\DoxyCodeLine{        evas\_event\_callback\_del\_full(evas, \mbox{\hyperlink{Evas__Common_8h_ad64cde0da38a60e7cb7905b3ab216968a5a68e4f5dccdc18a393ef4a4773236c3}{EVAS\_CALLBACK\_RENDER\_FLUSH\_PRE}},}
\DoxyCodeLine{                                     \_render\_flush\_cb, NULL);}
\DoxyCodeLine{        evas\_event\_callback\_del\_full(}
\DoxyCodeLine{          evas, \mbox{\hyperlink{Evas__Common_8h_ad64cde0da38a60e7cb7905b3ab216968a7380ca16bf87762e96309473d3d306c5}{EVAS\_CALLBACK\_CANVAS\_OBJECT\_FOCUS\_IN}},}
\DoxyCodeLine{          \_object\_focus\_in\_cb, NULL);}
\DoxyCodeLine{        \textcolor{keywordflow}{return};}
\DoxyCodeLine{     \}}
\DoxyCodeLine{}
\DoxyCodeLine{   \textcolor{keywordflow}{if} (strcmp(ev-\/>\mbox{\hyperlink{struct__Evas__Event__Key__Down_a70473bba88a1afaee180a54150513824}{key}}, \textcolor{stringliteral}{"f"}) == 0) \textcolor{comment}{/* freeze input for 3 seconds */}}
\DoxyCodeLine{     \{}
\DoxyCodeLine{        printf(\textcolor{stringliteral}{"Freezing input for 3 seconds\(\backslash\)n"});}
\DoxyCodeLine{        \mbox{\hyperlink{group__Evas__Event__Feeding__Group_ga4f6046343eab8b062e5509d984100ec8}{evas\_event\_freeze}}(evas);}
\DoxyCodeLine{        d.freeze\_timer = \mbox{\hyperlink{group__Ecore__Timer__Group_ga7b9cb9d24ecebfdbb957436e2e669402}{ecore\_timer\_add}}(3, \_thaw\_cb, NULL);}
\DoxyCodeLine{        \textcolor{keywordflow}{return};}
\DoxyCodeLine{     \}}
\DoxyCodeLine{}
\DoxyCodeLine{   \textcolor{keywordflow}{if} (strcmp(ev-\/>\mbox{\hyperlink{struct__Evas__Event__Key__Down_a70473bba88a1afaee180a54150513824}{key}}, \textcolor{stringliteral}{"p"}) == 0) \textcolor{comment}{/* toggle precise point}}
\DoxyCodeLine{\textcolor{comment}{                                       * collision detection */}}
\DoxyCodeLine{     \{}
\DoxyCodeLine{        \mbox{\hyperlink{group__Eina__Types__Group_ga3fe0caf72e93b1bab1ca8ee3ccf3f226}{Eina\_Bool}} precise = \mbox{\hyperlink{group__Evas__Object__Group_ga98701c8e66ca7c96032fdb486728e270}{evas\_object\_precise\_is\_inside\_get}}(d.img);}
\DoxyCodeLine{}
\DoxyCodeLine{        printf(\textcolor{stringliteral}{"Toggling precise point collision detection \%s on Enlightenment logo\(\backslash\)n"},}
\DoxyCodeLine{               precise ? \textcolor{stringliteral}{"off"} : \textcolor{stringliteral}{"on"});}
\DoxyCodeLine{        \mbox{\hyperlink{group__Evas__Object__Group_ga02844427c0e15ef2fb61412debf40ce3}{evas\_object\_precise\_is\_inside\_set}}(d.img, !precise);}
\DoxyCodeLine{}
\DoxyCodeLine{        \textcolor{keywordflow}{return};}
\DoxyCodeLine{     \}}
\DoxyCodeLine{}
\DoxyCodeLine{   mods = \mbox{\hyperlink{group__Evas__Canvas_gaad42bb4caa43c1cfef4096f6ac2b99ec}{evas\_key\_modifier\_get}}(evas);}
\DoxyCodeLine{   \textcolor{keywordflow}{if} (\mbox{\hyperlink{group__Evas__Keys_ga6cc24a5ea4b39b84c7a3e617de3db261}{evas\_key\_modifier\_is\_set}}(mods, \textcolor{stringliteral}{"Control"}) \&\&}
\DoxyCodeLine{       (strcmp(ev-\/>\mbox{\hyperlink{struct__Evas__Event__Key__Down_a70473bba88a1afaee180a54150513824}{key}}, \textcolor{stringliteral}{"o"}) == 0)) \textcolor{comment}{/* add an obscured}}
\DoxyCodeLine{\textcolor{comment}{                                        * rectangle to the middle}}
\DoxyCodeLine{\textcolor{comment}{                                        * of the canvas */}}
\DoxyCodeLine{     \{}
\DoxyCodeLine{        printf(\textcolor{stringliteral}{"Toggling obscured rectangle on canvas\(\backslash\)n"});}
\DoxyCodeLine{        \textcolor{keywordflow}{if} (!d.obscured)}
\DoxyCodeLine{          \{}
\DoxyCodeLine{             \textcolor{keywordtype}{int} w, h;}
\DoxyCodeLine{             \mbox{\hyperlink{group__Evas__Canvas_ga346bb724a254e8681c382b84886045b4}{evas\_output\_viewport\_get}}(evas, NULL, NULL, \&w, \&h);}
\DoxyCodeLine{             evas\_obscured\_rectangle\_add(evas, w / 4, h / 4, w / 2, h / 2);}
\DoxyCodeLine{          \}}
\DoxyCodeLine{        \textcolor{keywordflow}{else}}
\DoxyCodeLine{          \{}
\DoxyCodeLine{             \textcolor{keywordtype}{int} w, h;}
\DoxyCodeLine{             \mbox{\hyperlink{struct__Eina__Rectangle}{Eina\_Rectangle}} *rect;}
\DoxyCodeLine{             \mbox{\hyperlink{struct__Eina__List}{Eina\_List}} *updates, *l;}
\DoxyCodeLine{}
\DoxyCodeLine{             \mbox{\hyperlink{group__Evas__Canvas_ga346bb724a254e8681c382b84886045b4}{evas\_output\_viewport\_get}}(evas, NULL, NULL, \&w, \&h);}
\DoxyCodeLine{             evas\_obscured\_clear(evas);}
\DoxyCodeLine{}
\DoxyCodeLine{             \textcolor{comment}{/* we have to flag a damage region here because}}
\DoxyCodeLine{\textcolor{comment}{              * evas\_obscured\_clear() doesn't change the canvas'}}
\DoxyCodeLine{\textcolor{comment}{              * state. we'd have to wait for an animation step, for}}
\DoxyCodeLine{\textcolor{comment}{              * example, to get the result, without it */}}
\DoxyCodeLine{             evas\_damage\_rectangle\_add(evas, 0, 0, w, h);}
\DoxyCodeLine{}
\DoxyCodeLine{             updates = evas\_render\_updates(evas);}
\DoxyCodeLine{}
\DoxyCodeLine{             \mbox{\hyperlink{group__Eina__List__Group_gac6efafc19f526d916cdb9757240a8773}{EINA\_LIST\_FOREACH}}(updates, l, rect)}
\DoxyCodeLine{               \{}
\DoxyCodeLine{                  printf(\textcolor{stringliteral}{"Rectangle (\%d, \%d, \%d, \%d) on canvas got a"}}
\DoxyCodeLine{                                  \textcolor{stringliteral}{" rendering update.\(\backslash\)n"}, rect-\/>\mbox{\hyperlink{struct__Eina__Rectangle_a8358c0791dcf476432687510ca4e5d5c}{x}}, rect-\/>\mbox{\hyperlink{struct__Eina__Rectangle_ae74dc834fb71a1f4cd9e3fe11dec3940}{y}},}
\DoxyCodeLine{                          rect-\/>\mbox{\hyperlink{struct__Eina__Rectangle_af6a92d51ec25ee3464c81297ffc3a330}{w}},}
\DoxyCodeLine{                          rect-\/>\mbox{\hyperlink{struct__Eina__Rectangle_a7570ed17f58fc94be997414a86130074}{h}});}
\DoxyCodeLine{               \}}
\DoxyCodeLine{             \mbox{\hyperlink{group__Evas__Canvas_ga038d98c7c13a86b6ba4de51f8aba3595}{evas\_render\_updates\_free}}(updates);}
\DoxyCodeLine{          \}}
\DoxyCodeLine{        d.obscured = !d.obscured;}
\DoxyCodeLine{     \} \textcolor{comment}{/* end of obscured region command */}}
\DoxyCodeLine{\}}
\DoxyCodeLine{}
\DoxyCodeLine{\textcolor{keywordtype}{int}}
\DoxyCodeLine{main(\textcolor{keywordtype}{void})}
\DoxyCodeLine{\{}
\DoxyCodeLine{   \textcolor{keywordtype}{int} err;}
\DoxyCodeLine{}
\DoxyCodeLine{   \textcolor{keywordflow}{if} (!\mbox{\hyperlink{group__Ecore__Evas__Group_ga32ddbb6457033ad435a177eb0c4fe235}{ecore\_evas\_init}}())}
\DoxyCodeLine{     \textcolor{keywordflow}{return} EXIT\_FAILURE;}
\DoxyCodeLine{}
\DoxyCodeLine{   \textcolor{comment}{/* this will give you a window with an Evas canvas under the first}}
\DoxyCodeLine{\textcolor{comment}{    * engine available */}}
\DoxyCodeLine{   d.ee = \mbox{\hyperlink{group__Ecore__Evas__Group_gac7f2cdbcb79635c34317c1183dd04cb0}{ecore\_evas\_new}}(NULL, 10, 10, WIDTH, HEIGHT, NULL);}
\DoxyCodeLine{   \textcolor{keywordflow}{if} (!d.ee)}
\DoxyCodeLine{     \textcolor{keywordflow}{goto} error;}
\DoxyCodeLine{}
\DoxyCodeLine{   \mbox{\hyperlink{group__Ecore__Evas__Group_gaac67f679c9027059a34519fbdea360df}{ecore\_evas\_callback\_resize\_set}}(d.ee, \_canvas\_resize\_cb);}
\DoxyCodeLine{   \mbox{\hyperlink{group__Ecore__Evas__Group_ga4953047ff97d4f1b0d75a7d513d4f317}{ecore\_evas\_show}}(d.ee);}
\DoxyCodeLine{}
\DoxyCodeLine{   \textcolor{comment}{/* the canvas pointer, de facto */}}
\DoxyCodeLine{   d.canvas = \mbox{\hyperlink{group__Ecore__Evas__Group_ga75a7cc694b6069e78df47dab0b0f2d20}{ecore\_evas\_get}}(d.ee);}
\DoxyCodeLine{}
\DoxyCodeLine{   evas\_event\_callback\_add(d.canvas, \mbox{\hyperlink{Evas__Common_8h_ad64cde0da38a60e7cb7905b3ab216968a5a68e4f5dccdc18a393ef4a4773236c3}{EVAS\_CALLBACK\_RENDER\_FLUSH\_PRE}},}
\DoxyCodeLine{                           \_render\_flush\_cb, NULL);}
\DoxyCodeLine{   \textcolor{keywordflow}{if} (\mbox{\hyperlink{group__Evas__Main__Group_gacfae4f589c777003f58d51e502c52835}{evas\_alloc\_error}}() != \mbox{\hyperlink{Evas__Common_8h_a1adf9f604f763f2a8db12a484ca199cba22bbdd0a96a670bbddd6789f91921af8}{EVAS\_ALLOC\_ERROR\_NONE}})}
\DoxyCodeLine{     \{}
\DoxyCodeLine{        fprintf(stderr, \textcolor{stringliteral}{"ERROR: Callback registering failed! Aborting.\(\backslash\)n"});}
\DoxyCodeLine{        \textcolor{keywordflow}{goto} panic;}
\DoxyCodeLine{     \}}
\DoxyCodeLine{}
\DoxyCodeLine{   evas\_event\_callback\_add(d.canvas, \mbox{\hyperlink{Evas__Common_8h_ad64cde0da38a60e7cb7905b3ab216968a7380ca16bf87762e96309473d3d306c5}{EVAS\_CALLBACK\_CANVAS\_OBJECT\_FOCUS\_IN}},}
\DoxyCodeLine{                           \_object\_focus\_in\_cb, NULL);}
\DoxyCodeLine{   \textcolor{keywordflow}{if} (\mbox{\hyperlink{group__Evas__Main__Group_gacfae4f589c777003f58d51e502c52835}{evas\_alloc\_error}}() != \mbox{\hyperlink{Evas__Common_8h_a1adf9f604f763f2a8db12a484ca199cba22bbdd0a96a670bbddd6789f91921af8}{EVAS\_ALLOC\_ERROR\_NONE}})}
\DoxyCodeLine{     \{}
\DoxyCodeLine{        fprintf(stderr, \textcolor{stringliteral}{"ERROR: Callback registering failed! Aborting.\(\backslash\)n"});}
\DoxyCodeLine{        \textcolor{keywordflow}{goto} panic;}
\DoxyCodeLine{     \} \textcolor{comment}{/* two canvas event callbacks */}}
\DoxyCodeLine{}
\DoxyCodeLine{   d.bg = \mbox{\hyperlink{group__Evas__Object__Rectangle_ga4d80fc32ad1cac28428cebd65d746751}{evas\_object\_rectangle\_add}}(d.canvas);}
\DoxyCodeLine{   \mbox{\hyperlink{group__Evas__Object__Group__Basic_ga88bfcce07ad3bcef31687e29075ae2d2}{evas\_object\_name\_set}}(d.bg, \textcolor{stringliteral}{"our dear rectangle"});}
\DoxyCodeLine{   \mbox{\hyperlink{group__Evas__Object__Group__Basic_gae34bdcfd7f5100151f6ea8ef4a392949}{evas\_object\_color\_set}}(d.bg, 255, 255, 255, 255); \textcolor{comment}{/* white bg */}}
\DoxyCodeLine{   evas\_object\_move(d.bg, 0, 0); \textcolor{comment}{/* at canvas' origin */}}
\DoxyCodeLine{   evas\_object\_resize(d.bg, WIDTH, HEIGHT); \textcolor{comment}{/* covers full canvas */}}
\DoxyCodeLine{   \mbox{\hyperlink{group__Evas__Object__Group__Basic_ga9cbc13661584e49fb9d9cdab514a1eeb}{evas\_object\_show}}(d.bg);}
\DoxyCodeLine{}
\DoxyCodeLine{   \mbox{\hyperlink{group__Evas__Object__Group_ga4405e118e1fb762987af1269b6848db5}{evas\_object\_focus\_set}}(d.bg, \mbox{\hyperlink{group__Eina__Types__Group_ga05c12dacc8b4058994df842b41be85fc}{EINA\_TRUE}}); \textcolor{comment}{/* so we get input events */}}
\DoxyCodeLine{   d.focus = \mbox{\hyperlink{group__Eina__Types__Group_ga05c12dacc8b4058994df842b41be85fc}{EINA\_TRUE}};}
\DoxyCodeLine{}
\DoxyCodeLine{   \mbox{\hyperlink{group__Evas__Object__Group__Events_ga23be30ac5cdfb780f1ff82e9108ec26b}{evas\_object\_event\_callback\_add}}(}
\DoxyCodeLine{     d.bg, \mbox{\hyperlink{Evas__Common_8h_ad64cde0da38a60e7cb7905b3ab216968a336b86bad4f145f84c155e4922335584}{EVAS\_CALLBACK\_KEY\_DOWN}}, \_on\_keydown, NULL);}
\DoxyCodeLine{   \textcolor{keywordflow}{if} (\mbox{\hyperlink{group__Evas__Main__Group_gacfae4f589c777003f58d51e502c52835}{evas\_alloc\_error}}() != \mbox{\hyperlink{Evas__Common_8h_a1adf9f604f763f2a8db12a484ca199cba22bbdd0a96a670bbddd6789f91921af8}{EVAS\_ALLOC\_ERROR\_NONE}})}
\DoxyCodeLine{     \{}
\DoxyCodeLine{        fprintf(stderr, \textcolor{stringliteral}{"ERROR: Callback registering failed! Aborting.\(\backslash\)n"});}
\DoxyCodeLine{        \textcolor{keywordflow}{goto} panic;}
\DoxyCodeLine{     \}}
\DoxyCodeLine{}
\DoxyCodeLine{   d.img = evas\_object\_image\_filled\_add(d.canvas);}
\DoxyCodeLine{   evas\_object\_image\_file\_set(d.img, img\_path, NULL);}
\DoxyCodeLine{   err = evas\_object\_image\_load\_error\_get(d.img);}
\DoxyCodeLine{   \textcolor{keywordflow}{if} (err != EVAS\_LOAD\_ERROR\_NONE)}
\DoxyCodeLine{     \{}
\DoxyCodeLine{        fprintf(stderr, \textcolor{stringliteral}{"ERROR: Image loading failed! Aborting.\(\backslash\)n"});}
\DoxyCodeLine{        \textcolor{keywordflow}{goto} panic;}
\DoxyCodeLine{     \}}
\DoxyCodeLine{   \textcolor{keywordflow}{else}}
\DoxyCodeLine{     \{}
\DoxyCodeLine{        evas\_object\_move(d.img, 0, 0);}
\DoxyCodeLine{        evas\_object\_resize(d.img, WIDTH, HEIGHT);}
\DoxyCodeLine{        \mbox{\hyperlink{group__Evas__Object__Group__Basic_ga9cbc13661584e49fb9d9cdab514a1eeb}{evas\_object\_show}}(d.img);}
\DoxyCodeLine{        \mbox{\hyperlink{group__Evas__Object__Group__Events_ga23be30ac5cdfb780f1ff82e9108ec26b}{evas\_object\_event\_callback\_add}}(}
\DoxyCodeLine{          d.img, \mbox{\hyperlink{Evas__Common_8h_ad64cde0da38a60e7cb7905b3ab216968a598c57bc146639618157159a319f11af}{EVAS\_CALLBACK\_MOUSE\_IN}}, \_on\_mouse\_in, NULL);}
\DoxyCodeLine{        \mbox{\hyperlink{group__Evas__Object__Group__Events_ga23be30ac5cdfb780f1ff82e9108ec26b}{evas\_object\_event\_callback\_add}}(}
\DoxyCodeLine{          d.img, \mbox{\hyperlink{Evas__Common_8h_ad64cde0da38a60e7cb7905b3ab216968a91aaa30a57047d0ee8a734e603751c25}{EVAS\_CALLBACK\_MOUSE\_OUT}}, \_on\_mouse\_out, NULL);}
\DoxyCodeLine{     \}}
\DoxyCodeLine{}
\DoxyCodeLine{   d.resize\_timer = \mbox{\hyperlink{group__Ecore__Timer__Group_ga7b9cb9d24ecebfdbb957436e2e669402}{ecore\_timer\_add}}(2, \_resize\_cb, NULL);}
\DoxyCodeLine{}
\DoxyCodeLine{   puts(commands);}
\DoxyCodeLine{   \mbox{\hyperlink{group__Ecore__Main__Loop__Group_gaf103b9f668bb3e4fed12e52c6180132d}{ecore\_main\_loop\_begin}}();}
\DoxyCodeLine{}
\DoxyCodeLine{   \mbox{\hyperlink{group__Ecore__Evas__Group_gad3ec61f2aa03df4d3dbfd0d311e0c8dc}{ecore\_evas\_free}}(d.ee);}
\DoxyCodeLine{   \mbox{\hyperlink{group__Ecore__Evas__Group_gab8fa311077f749190c9b622f672b2214}{ecore\_evas\_shutdown}}();}
\DoxyCodeLine{   \textcolor{keywordflow}{return} 0;}
\DoxyCodeLine{}
\DoxyCodeLine{error:}
\DoxyCodeLine{   fprintf(stderr, \textcolor{stringliteral}{"error: Requires at least one Evas engine built and linked"}}
\DoxyCodeLine{                   \textcolor{stringliteral}{" to ecore-\/evas for this example to run properly.\(\backslash\)n"});}
\DoxyCodeLine{panic:}
\DoxyCodeLine{   \mbox{\hyperlink{group__Ecore__Evas__Group_gab8fa311077f749190c9b622f672b2214}{ecore\_evas\_shutdown}}();}
\DoxyCodeLine{   \textcolor{keywordflow}{return} -\/1;}
\DoxyCodeLine{\}}
\end{DoxyCodeInclude}
 