#ifdef HAVE_CONFIG_H
#include "config.h"
#else
#define PACKAGE_EXAMPLES_DIR "."
#endif
 
#include <Ecore.h>
#include <stdio.h>
#include <errno.h>
#include "evas-common.h"
 
#define WIDTH  (320)
#define HEIGHT (240)
 
static const char *img_path = PACKAGE_EXAMPLES_DIR EVAS_IMAGE_FOLDER "/enlightenment.png";
 
static const char *commands = \
  "commands are:\n"
  "\ta - toggle animation timer\n"
  "\tc - cycle between focus and key grabs for key input\n"
  "\td - delete canvas callbacks\n"
  "\tf - freeze input for 3 seconds\n"
  "\tp - toggle precise point collision detection on image\n"
  "\tControl + o - add an obscured rectangle\n"
  "\th - print help\n";
 
struct test_data
{
   Ecore_Evas  *ee;
   Evas        *canvas;
   Evas_Object *img, *bg;
};
 
static struct test_data d = {0};
 
static void
_canvas_resize_cb(Ecore_Evas *ee)
{
   int w, h;
 
}
 
static void
                    Evas *e,
                    void *event_info)
{
   printf("An object got focused: %s\n",
 
   printf("Let's recheck it: %s\n",
 
          "OK!" : "Oops, something is bad.");
}
 
static void
{
   printf("Canvas is about to flush its rendering pipeline!\n");
}
 
{
   int w, h, cw, ch;
 
 
   if (w < cw)
   else
 
}
 
{
   printf("Canvas was frozen %d times, now thawing.\n",
          evas_event_freeze_get(d.canvas));
   evas_event_thaw(d.canvas);
}
 
static void
{
   printf("Enlightenment logo has had the mouse in.\n");
}
 
static void
{
   printf("Enlightenment logo has had the mouse out.\n");
} 
 
static void
            Evas        *evas,
            void        *einfo)
{
   const Evas_Modifier *mods;
 
   printf(
"We've got key input: %s\n", ev->
key);
 
   printf("It actually came from %s\n",
          d.focus ? "focus" : "key grab");
 
   if (strcmp(ev->
key, 
"h") == 0) 
 
     {
        puts(commands);
        return;
     }
 
   if (strcmp(ev->
key, 
"a") == 0) 
 
     {
        if (d.resize_timer != NULL)
          {
             printf("Stopping animation timer\n");
             d.resize_timer = NULL;
          }
        else
          {
             printf("Re-issuing animation timer\n");
          }
        return;
     }
 
   if (strcmp(ev->
key, 
"c") == 0) 
 
     {
 
        printf("Switching to %s for key input\n",
               d.focus ? "key grabs" : "focus");
 
        if (d.focus)
          {
             printf("Focused object is now %s\n",
                    "still valid! Something went wrong." : "none.");
 
             ret = evas_object_key_grab(d.bg, 
"a", 0, 0, 
EINA_TRUE);
 
             if (!ret)
               {
                  printf("Something went wrong with key grabs.\n");
                  goto c_end;
               }
             ret = evas_object_key_grab(d.bg, 
"c", 0, 0, 
EINA_TRUE);
 
             if (!ret)
               {
                  printf("Something went wrong with key grabs.\n");
                  goto c_end;
               }
             ret = evas_object_key_grab(d.bg, 
"d", 0, 0, 
EINA_TRUE);
 
             if (!ret)
               {
                  printf("Something went wrong with key grabs.\n");
                  goto c_end;
               }
             ret = evas_object_key_grab(d.bg, 
"f", 0, 0, 
EINA_TRUE);
 
             if (!ret)
               {
                  printf("Something went wrong with key grabs.\n");
                  goto c_end;
               }
             ret = evas_object_key_grab(d.bg, 
"p", 0, 0, 
EINA_TRUE);
 
             if (!ret)
               {
                  printf("Something went wrong with key grabs.\n");
                  goto c_end;
               }
             ret = evas_object_key_grab(d.bg, 
"o", mask, 0, 
EINA_TRUE);
 
             if (!ret)
               {
                  printf("Something went wrong with key grabs.\n");
                  goto c_end;
               }
             ret = evas_object_key_grab(d.bg, 
"h", 0, 0, 
EINA_TRUE);
 
             if (!ret)
               {
                  printf("Something went wrong with key grabs.\n");
                  goto c_end;
               }
          }
        else 
          {
             evas_object_key_ungrab(d.bg, "a", 0, 0);
             evas_object_key_ungrab(d.bg, "c", 0, 0);
             evas_object_key_ungrab(d.bg, "d", 0, 0);
             evas_object_key_ungrab(d.bg, "f", 0, 0);
             evas_object_key_ungrab(d.bg, "p", 0, 0);
             evas_object_key_ungrab(d.bg, "o", mask, 0);
             evas_object_key_ungrab(d.bg, "h", 0, 0);
 
          }
 
c_end:
        d.focus = !d.focus;
 
        return;
     }
 
   if (strcmp(ev->
key, 
"d") == 0) 
 
     {
        printf("Deleting canvas event callbacks\n");
                                     _render_flush_cb, NULL);
          _object_focus_in_cb, NULL);
        return;
     }
 
   if (strcmp(ev->
key, 
"f") == 0) 
 
     {
        printf("Freezing input for 3 seconds\n");
        return;
     }
 
   if (strcmp(ev->
key, 
"p") == 0) 
 
     {
 
        printf("Toggling precise point collision detection %s on Enlightenment logo\n",
               precise ? "off" : "on");
 
        return;
     }
 
       (strcmp(ev->
key, 
"o") == 0)) 
 
     {
        printf("Toggling obscured rectangle on canvas\n");
        if (!d.obscured)
          {
             int w, h;
          }
        else
          {
             int w, h;
 
 
             
 
 
               {
                  printf("Rectangle (%d, %d, %d, %d) on canvas got a"
                                  " rendering update.\n", rect->
x, rect->
y,
 
               }
          }
        d.obscured = !d.obscured;
     } 
}
 
int
main(void)
{
   int err;
 
     return EXIT_FAILURE;
 
   
   if (!d.ee)
     goto error;
 
 
   
 
                           _render_flush_cb, NULL);
     {
        fprintf(stderr, "ERROR: Callback registering failed! Aborting.\n");
        goto panic;
     }
 
                           _object_focus_in_cb, NULL);
     {
        fprintf(stderr, "ERROR: Callback registering failed! Aborting.\n");
        goto panic;
     } 
 
 
 
     {
        fprintf(stderr, "ERROR: Callback registering failed! Aborting.\n");
        goto panic;
     }
 
     {
        fprintf(stderr, "ERROR: Image loading failed! Aborting.\n");
        goto panic;
     }
   else
     {
     }
 
 
   puts(commands);
 
   return 0;
 
error:
   fprintf(stderr, "error: Requires at least one Evas engine built and linked"
                   " to ecore-evas for this example to run properly.\n");
panic:
   return -1;
}
@ EVAS_ALLOC_ERROR_NONE
No allocation error.
Definition Evas_Common.h:270
 
@ EVAS_CALLBACK_KEY_DOWN
Key Press Event.
Definition Evas_Common.h:430
 
@ EVAS_CALLBACK_MOUSE_IN
Mouse In Event.
Definition Evas_Common.h:420
 
@ EVAS_CALLBACK_RENDER_FLUSH_PRE
Called after render update regions have been calculated, but only if update regions exist.
Definition Evas_Common.h:445
 
@ EVAS_CALLBACK_CANVAS_OBJECT_FOCUS_IN
Canvas object got focus.
Definition Evas_Common.h:450
 
@ EVAS_CALLBACK_MOUSE_OUT
Mouse Out Event.
Definition Evas_Common.h:421
 
EAPI int ecore_evas_init(void)
Inits the Ecore_Evas system.
Definition ecore_evas.c:608
 
EAPI void ecore_evas_show(Ecore_Evas *ee)
Shows an Ecore_Evas' window.
Definition ecore_evas.c:1494
 
EAPI Evas * ecore_evas_get(const Ecore_Evas *ee)
Gets an Ecore_Evas's Evas.
Definition ecore_evas.c:1314
 
EAPI void ecore_evas_geometry_get(const Ecore_Evas *ee, int *x, int *y, int *w, int *h)
Gets the geometry of an Ecore_Evas.
Definition ecore_evas.c:1376
 
EAPI Ecore_Evas * ecore_evas_new(const char *engine_name, int x, int y, int w, int h, const char *extra_options)
Creates a new Ecore_Evas based on engine name and common parameters.
Definition ecore_evas.c:1053
 
EAPI void ecore_evas_callback_resize_set(Ecore_Evas *ee, Ecore_Evas_Event_Cb func)
Sets a callback for Ecore_Evas resize events.
Definition ecore_evas.c:1154
 
EAPI int ecore_evas_shutdown(void)
Shuts down the Ecore_Evas system.
Definition ecore_evas.c:672
 
EAPI void ecore_evas_free(Ecore_Evas *ee)
Frees an Ecore_Evas.
Definition ecore_evas.c:1097
 
void ecore_main_loop_begin(void)
Runs the application main loop.
Definition ecore_main.c:1311
 
void * ecore_timer_del(Ecore_Timer *timer)
Deletes the specified timer from the timer list.
Definition ecore_timer.c:238
 
Ecore_Timer * ecore_timer_add(double in, Ecore_Task_Cb func, const void *data)
Creates a timer to call the given function in the given period of time.
Definition ecore_timer.c:189
 
Eo Ecore_Timer
A handle for timers.
Definition Ecore_Common.h:3085
 
#define EINA_LIST_FOREACH(list, l, _data)
Definition for the macro to iterate over a list.
Definition eina_list.h:1415
 
#define EINA_TRUE
boolean value TRUE (numerical value 1)
Definition eina_types.h:539
 
#define EINA_FALSE
boolean value FALSE (numerical value 0)
Definition eina_types.h:533
 
unsigned char Eina_Bool
Type to mimic a boolean.
Definition eina_types.h:527
 
#define EINA_UNUSED
Used to indicate that a function parameter is purposely unused.
Definition eina_types.h:339
 
EVAS_API void evas_event_callback_add(Evas *eo_e, Evas_Callback_Type type, Evas_Event_Cb func, const void *data)
Add (register) a callback function to a given canvas event.
Definition evas_callbacks.c:573
 
EVAS_API void * evas_event_callback_del_full(Evas *eo_e, Evas_Callback_Type type, Evas_Event_Cb func, const void *data)
Delete (unregister) a callback function registered to a given canvas event.
Definition evas_callbacks.c:678
 
EVAS_API void evas_output_viewport_get(const Evas *eo_e, Evas_Coord *x, Evas_Coord *y, Evas_Coord *w, Evas_Coord *h)
Get the render engine's output viewport coordinates in canvas units.
Definition evas_main.c:1441
 
EVAS_API const Evas_Modifier * evas_key_modifier_get(const Evas *eo_e)
Returns a handle to the list of modifier keys registered in the canvas e.
Definition evas_key.c:35
 
EVAS_API Eina_List * evas_render_updates(Evas_Canvas *obj)
Force immediate renderization of the given Evas canvas.
Definition evas_canvas_eo.legacy.c:297
 
EVAS_API void evas_render_updates_free(Eina_List *updates)
Free the rectangles returned by evas_render_updates().
Definition evas_render.c:4078
 
EVAS_API void evas_obscured_clear(Evas_Canvas *obj)
Remove all "obscured regions" from an Evas canvas.
Definition evas_canvas_eo.legacy.c:351
 
EVAS_API void evas_obscured_rectangle_add(Evas_Canvas *obj, int x, int y, int w, int h)
Add an "obscured region" to an Evas canvas.
Definition evas_canvas_eo.legacy.c:327
 
EVAS_API Evas_Modifier_Mask evas_key_modifier_mask_get(const Evas *eo_e, const char *keyname)
Creates a bit mask from the keyname modifier key.
Definition evas_key.c:271
 
EVAS_API Efl_Canvas_Object * evas_focus_get(const Evas_Canvas *obj)
Retrieve the object focused by the default seat.
Definition evas_canvas_eo.legacy.c:51
 
EVAS_API void evas_damage_rectangle_add(Evas_Canvas *obj, int x, int y, int w, int h)
Add a damage rectangle.
Definition evas_canvas_eo.legacy.c:267
 
EVAS_API void evas_event_freeze(Evas *eo_e)
Freeze all input events processing.
Definition evas_events.c:1540
 
@ EVAS_LOAD_ERROR_NONE
No error on load.
Definition Evas_Loader.h:141
 
unsigned long long Evas_Modifier_Mask
A bitmask of modifier keys.
Definition Evas_Legacy.h:132
 
EVAS_API Eina_Bool evas_key_modifier_is_set(const Evas_Modifier *m, const char *keyname)
Checks the state of a given modifier of the default seat, at the time of the call.
Definition evas_key.c:76
 
EVAS_API Evas_Alloc_Error evas_alloc_error(void)
Get the error status of the most recent memory allocation call.
Definition main.c:17
 
EVAS_API void evas_object_show(Evas_Object *eo_obj)
Makes the given Evas object visible.
Definition evas_object_main.c:1814
 
EVAS_API const char * evas_object_name_get(const Evas_Object *eo_obj)
Retrieves the name of the given Evas object.
Definition evas_name.c:26
 
EVAS_API void evas_object_name_set(Evas_Object *eo_obj, const char *name)
Sets the name of the given Evas object to the given name.
Definition evas_name.c:5
 
EVAS_API void evas_object_geometry_get(const Evas_Object *eo_obj, Evas_Coord *x, Evas_Coord *y, Evas_Coord *w, Evas_Coord *h)
Retrieves the position and (rectangular) size of the given Evas object.
Definition evas_object_main.c:1335
 
EVAS_API void evas_object_color_set(Evas_Object *obj, int r, int g, int b, int a)
Sets the general/main color of the given Evas object to the given one.
Definition evas_object_main.c:2024
 
EVAS_API void evas_object_event_callback_add(Evas_Object *eo_obj, Evas_Callback_Type type, Evas_Object_Event_Cb func, const void *data)
Add (register) a callback function to a given Evas object event.
Definition evas_callbacks.c:478
 
EVAS_API void evas_object_move(Evas_Object *obj, Evas_Coord x, Evas_Coord y)
Move the given Evas object to the given location inside its canvas' viewport.
Definition evas_object_main.c:1171
 
EVAS_API Eina_Bool evas_object_precise_is_inside_get(const Efl_Canvas_Object *obj)
Determine whether an object is set to use precise point collision detection.
Definition efl_canvas_object_eo.legacy.c:57
 
EVAS_API void evas_object_precise_is_inside_set(Efl_Canvas_Object *obj, Eina_Bool precise)
Set whether to use precise (usually expensive) point collision detection for a given Evas object.
Definition efl_canvas_object_eo.legacy.c:51
 
EVAS_API Eina_Bool evas_object_focus_get(const Efl_Canvas_Object *obj)
Indicates that this object is the keyboard event receiver on its canvas.
Definition efl_canvas_object_eo.legacy.c:45
 
EVAS_API void evas_object_focus_set(Efl_Canvas_Object *obj, Eina_Bool focus)
Indicates that this object is the keyboard event receiver on its canvas.
Definition efl_canvas_object_eo.legacy.c:39
 
EVAS_API void evas_object_resize(Evas_Object *obj, Evas_Coord w, Evas_Coord h)
Changes the size of the given Evas object.
Definition evas_object_main.c:1236
 
EVAS_API Evas_Load_Error evas_object_image_load_error_get(const Evas_Object *obj)
Retrieves a number representing any error that occurred during the last loading of the given image ob...
Definition evas_image_legacy.c:400
 
EVAS_API void evas_object_image_file_set(Evas_Object *obj, const char *file, const char *key)
Set the source file from where an image object must fetch the real image data (it may be an Eet file,...
Definition evas_image_legacy.c:194
 
EVAS_API Evas_Object * evas_object_image_filled_add(Evas *eo_e)
Creates a new image object that automatically scales its bound image to the object's area,...
Definition evas_image_legacy.c:35
 
EVAS_API Evas_Object * evas_object_rectangle_add(Evas *e)
Adds a rectangle to the given evas.
Definition evas_object_rectangle.c:78
 
Type for a generic double linked list.
Definition eina_list.h:318
 
Definition eina_rectangle.h:109
 
int h
height of rectangle
Definition eina_rectangle.h:113
 
int x
top-left x coordinate of rectangle
Definition eina_rectangle.h:110
 
int y
top-left y coordinate of rectangle
Definition eina_rectangle.h:111
 
int w
width of rectangle
Definition eina_rectangle.h:112
 
Key press event.
Definition Evas_Legacy.h:314
 
const char * key
The logical key : (eg shift+1 == exclamation)
Definition Evas_Legacy.h:320