2002-11-08 00:02:15 -08:00
|
|
|
#include "evas_common.h"
|
|
|
|
#include "evas_private.h"
|
|
|
|
#ifdef BUILD_ENGINE_SOFTWARE_X11
|
|
|
|
#include "evas_engine_api_software_x11.h"
|
|
|
|
#endif
|
|
|
|
#ifdef BUILD_ENGINE_DIRECTFB
|
|
|
|
#include "evas_engine_api_directfb.h"
|
|
|
|
#endif
|
|
|
|
#ifdef BUILD_ENGINE_FB
|
|
|
|
#include "evas_engine_api_fb.h"
|
|
|
|
#endif
|
2003-04-01 20:28:27 -08:00
|
|
|
#ifdef BUILD_ENGINE_BUFFER
|
|
|
|
#include "evas_engine_api_buffer.h"
|
|
|
|
#endif
|
2002-11-08 00:02:15 -08:00
|
|
|
#ifdef BUILD_ENGINE_SOFTWARE_WIN32_GDI
|
|
|
|
#include "evas_engine_api_software_win32_gdi.h"
|
|
|
|
#endif
|
|
|
|
#ifdef BUILD_ENGINE_SOFTWARE_QTOPIA
|
|
|
|
#include "evas_engine_api_software_qtopia.h"
|
|
|
|
#endif
|
|
|
|
#ifdef BUILD_ENGINE_GL_X11
|
|
|
|
#include "evas_engine_api_gl_x11.h"
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#include "Evas.h"
|
|
|
|
|
2004-01-12 18:24:03 -08:00
|
|
|
void
|
|
|
|
evas_shutdown(void)
|
|
|
|
{
|
|
|
|
evas_font_dir_cache_free();
|
|
|
|
}
|
|
|
|
|
2002-11-08 00:02:15 -08:00
|
|
|
/**
|
|
|
|
* Allocate and new Evas empty canvas.
|
|
|
|
* @return A zeroed out Evas, or NULL on failure
|
|
|
|
*
|
|
|
|
* This function creates a new Evas Canvas object that is completely
|
|
|
|
* uninitialised. You cannot sensibly use this until it has been initialised.
|
2004-02-16 11:22:48 -08:00
|
|
|
* You need to set up the rendering engine for the canvas before you can add any
|
|
|
|
* objects to the canvas or render it.
|
2002-11-08 00:02:15 -08:00
|
|
|
*
|
|
|
|
* This function will always succeed and return a valid canvas pointer unless
|
|
|
|
* the memory allocation fails, in which case NULL will be returned.
|
|
|
|
*
|
|
|
|
* Example:
|
|
|
|
* @code
|
|
|
|
* Evas *evas;
|
|
|
|
*
|
|
|
|
* evas = evas_new();
|
|
|
|
* @endcode
|
|
|
|
*/
|
|
|
|
Evas *
|
|
|
|
evas_new(void)
|
|
|
|
{
|
|
|
|
Evas *e;
|
|
|
|
|
|
|
|
e = calloc(1, sizeof(Evas));
|
|
|
|
if (!e) return NULL;
|
|
|
|
|
|
|
|
e->magic = MAGIC_EVAS;
|
|
|
|
e->output.render_method = RENDER_METHOD_INVALID;
|
|
|
|
|
|
|
|
return e;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Free an Evas.
|
|
|
|
* @param e The Pointer to the Evas to be freed
|
|
|
|
*
|
2004-02-16 11:22:48 -08:00
|
|
|
* When called this function frees the Evas Canvas @p e and all Evas Objects
|
|
|
|
* created on this canvas. As the objects are freed any that have 'free'
|
|
|
|
* callbacks will have them called during the execution of this function.
|
2002-11-08 00:02:15 -08:00
|
|
|
* Example:
|
|
|
|
* @code
|
|
|
|
* extern Evas *evas;
|
|
|
|
*
|
|
|
|
* evas_free(evas);
|
|
|
|
* @endcode
|
|
|
|
*/
|
|
|
|
void
|
|
|
|
evas_free(Evas *e)
|
|
|
|
{
|
2003-01-09 21:38:47 -08:00
|
|
|
Evas_Object_List *l;
|
2003-06-21 19:33:25 -07:00
|
|
|
int i;
|
2003-07-29 19:58:10 -07:00
|
|
|
int del = 1;
|
2003-01-09 21:38:47 -08:00
|
|
|
|
2002-11-08 00:02:15 -08:00
|
|
|
MAGIC_CHECK(e, Evas, MAGIC_EVAS);
|
|
|
|
return;
|
|
|
|
MAGIC_CHECK_END();
|
|
|
|
|
2003-07-29 19:58:10 -07:00
|
|
|
while (del != 0)
|
2003-01-09 21:38:47 -08:00
|
|
|
{
|
2003-07-29 19:58:10 -07:00
|
|
|
del = 0;
|
|
|
|
for (l = (Evas_Object_List *)(e->layers); l; l = l->next)
|
|
|
|
{
|
|
|
|
Evas_Layer *lay;
|
|
|
|
Evas_Object_List *ll;
|
|
|
|
|
|
|
|
lay = (Evas_Layer *)l;
|
|
|
|
evas_layer_pre_free(lay);
|
|
|
|
for (ll = (Evas_Object_List *)lay->objects; ll; ll = ll->next)
|
|
|
|
{
|
|
|
|
Evas_Object *o;
|
|
|
|
|
|
|
|
o = (Evas_Object *)ll;
|
|
|
|
if (!o->delete_me)
|
|
|
|
del += o->delete_me;
|
|
|
|
}
|
|
|
|
}
|
2003-01-09 21:38:47 -08:00
|
|
|
|
|
|
|
}
|
2002-11-08 00:02:15 -08:00
|
|
|
while (e->layers)
|
|
|
|
{
|
|
|
|
Evas_Layer *lay;
|
|
|
|
|
|
|
|
lay = e->layers;
|
|
|
|
evas_layer_del(lay);
|
|
|
|
evas_layer_free(lay);
|
|
|
|
}
|
|
|
|
|
2003-01-22 14:24:36 -08:00
|
|
|
evas_font_path_clear(e);
|
2003-01-09 21:38:47 -08:00
|
|
|
e->pointer.object.in = evas_list_free(e->pointer.object.in);
|
|
|
|
|
2002-11-08 00:02:15 -08:00
|
|
|
if (e->name_hash) evas_hash_free(e->name_hash);
|
|
|
|
|
|
|
|
while (e->damages)
|
|
|
|
{
|
|
|
|
free(e->damages->data);
|
|
|
|
e->damages = evas_list_remove(e->damages, e->damages->data);
|
|
|
|
}
|
|
|
|
while (e->obscures)
|
|
|
|
{
|
|
|
|
free(e->obscures->data);
|
|
|
|
e->obscures = evas_list_remove(e->obscures, e->obscures->data);
|
|
|
|
}
|
|
|
|
|
|
|
|
e->engine.func->info_free(e, e->engine.info);
|
|
|
|
e->engine.func->context_free(e->engine.data.output, e->engine.data.context);
|
|
|
|
e->engine.func->output_free(e->engine.data.output);
|
|
|
|
|
2003-06-21 19:33:25 -07:00
|
|
|
for (i = 0; i < e->modifiers.mod.count; i++)
|
|
|
|
free(e->modifiers.mod.list[i]);
|
|
|
|
if (e->modifiers.mod.list) free(e->modifiers.mod.list);
|
|
|
|
|
|
|
|
for (i = 0; i < e->locks.lock.count; i++)
|
|
|
|
free(e->locks.lock.list[i]);
|
|
|
|
if (e->locks.lock.list) free(e->locks.lock.list);
|
|
|
|
|
2002-11-08 00:02:15 -08:00
|
|
|
e->magic = 0;
|
|
|
|
free(e);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Set the output method (engine) for the Evas.
|
|
|
|
* @param e The pointer to the Evas Canvas have its engine set
|
|
|
|
* @param render_method The numeric engine value to use.
|
|
|
|
*
|
2004-02-16 11:22:48 -08:00
|
|
|
* This call sets up which engine an Evas Canvas is to use. This can only be
|
|
|
|
* done once and following calls of this function will do nothing. The @p
|
|
|
|
* render_method numeric value can be obtained using the
|
2002-11-08 00:02:15 -08:00
|
|
|
* evas_render_method_lookup() call.
|
|
|
|
*
|
|
|
|
* Example:
|
|
|
|
* @code
|
|
|
|
* int engine_id;
|
|
|
|
* Evas *evas;
|
|
|
|
*
|
|
|
|
* evas = evas_new();
|
|
|
|
* engine_id = evas_render_method_lookup("software_x11");
|
|
|
|
* evas_output_method_set(evas, engine_id);
|
|
|
|
* @endcode
|
|
|
|
*/
|
|
|
|
void
|
|
|
|
evas_output_method_set(Evas *e, int render_method)
|
|
|
|
{
|
|
|
|
MAGIC_CHECK(e, Evas, MAGIC_EVAS);
|
|
|
|
return;
|
|
|
|
MAGIC_CHECK_END();
|
|
|
|
|
|
|
|
/* if our engine to set it to is invalid - abort */
|
|
|
|
if (render_method == RENDER_METHOD_INVALID) return;
|
2004-02-16 11:22:48 -08:00
|
|
|
/* if the engine is already set up - abort */
|
2002-11-08 00:02:15 -08:00
|
|
|
if (e->output.render_method != RENDER_METHOD_INVALID) return;
|
|
|
|
/* set the render method */
|
|
|
|
e->output.render_method = render_method;
|
|
|
|
#ifdef BUILD_ENGINE_SOFTWARE_X11
|
|
|
|
if (e->output.render_method == RENDER_METHOD_SOFTWARE_X11)
|
|
|
|
e->engine.func = &evas_engine_software_x11_func;
|
|
|
|
else
|
|
|
|
#endif
|
|
|
|
#ifdef BUILD_ENGINE_GL_X11
|
|
|
|
if (e->output.render_method == RENDER_METHOD_GL_X11)
|
|
|
|
e->engine.func = &evas_engine_gl_x11_func;
|
|
|
|
else
|
|
|
|
#endif
|
|
|
|
#ifdef BUILD_ENGINE_DIRECTFB
|
|
|
|
if (e->output.render_method == RENDER_METHOD_DIRECTFB)
|
|
|
|
e->engine.func = &evas_engine_directfb_func;
|
|
|
|
else
|
|
|
|
#endif
|
|
|
|
#ifdef BUILD_ENGINE_FB
|
|
|
|
if (e->output.render_method == RENDER_METHOD_FB)
|
|
|
|
e->engine.func = &evas_engine_fb_func;
|
|
|
|
else
|
|
|
|
#endif
|
2003-04-01 20:28:27 -08:00
|
|
|
#ifdef BUILD_ENGINE_BUFFER
|
|
|
|
if (e->output.render_method == RENDER_METHOD_BUFFER)
|
|
|
|
e->engine.func = &evas_engine_buffer_func;
|
|
|
|
else
|
|
|
|
#endif
|
2002-11-08 00:02:15 -08:00
|
|
|
#ifdef BUILD_ENGINE_SOFTWARE_WIN32_GDI
|
|
|
|
if (e->output.render_method == RENDER_METHOD_SOFTWARE_WIN32_GDI)
|
|
|
|
e->engine.func = &evas_engine_software_win32_gdi_func;
|
|
|
|
else
|
|
|
|
#endif
|
|
|
|
#ifdef BUILD_ENGINE_SOFTWARE_QTOPIA
|
|
|
|
if (e->output.render_method == RENDER_METHOD_SOFTWARE_QTOPIA)
|
|
|
|
e->engine.func = &evas_engine_software_qtopia_func;
|
|
|
|
else
|
|
|
|
#endif
|
|
|
|
return;
|
|
|
|
/* get the engine info struct */
|
|
|
|
if (e->output.render_method != RENDER_METHOD_INVALID)
|
|
|
|
{
|
|
|
|
if (e->engine.func->info) e->engine.info = e->engine.func->info(e);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Get the output method (engine) for the Evas.
|
|
|
|
* @param e The pointer to the Evas Canvas
|
|
|
|
* @return A numeric engine value
|
|
|
|
*
|
2004-02-16 11:22:48 -08:00
|
|
|
* This function returns the rendering engine currently used by the given Evas
|
|
|
|
* Canvas. On success the numeric value of the rendering engine used
|
|
|
|
* by the Canvas is returned. On failure 0 is returned.
|
2002-11-08 00:02:15 -08:00
|
|
|
*
|
|
|
|
* Example:
|
|
|
|
* @code
|
|
|
|
* extern Evas *evas;
|
|
|
|
* int engine_id;
|
|
|
|
*
|
|
|
|
* engine_id = evas_output_method_get(evas);
|
|
|
|
*
|
|
|
|
* @endcode
|
|
|
|
*/
|
|
|
|
int
|
|
|
|
evas_output_method_get(Evas *e)
|
|
|
|
{
|
|
|
|
MAGIC_CHECK(e, Evas, MAGIC_EVAS);
|
|
|
|
return RENDER_METHOD_INVALID;
|
|
|
|
MAGIC_CHECK_END();
|
|
|
|
|
|
|
|
return e->output.render_method;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Get the render engine info struct from the canvas.
|
|
|
|
* @param e The pointer to the Evas Canvas
|
|
|
|
* @return A pointer to the Engine Info structure
|
|
|
|
*
|
2004-02-16 11:22:48 -08:00
|
|
|
* Calling this function returns a pointer to a publicly modifiable structure
|
|
|
|
* that the rendering engine for the given canvas has set up. Calling this
|
2002-11-08 00:02:15 -08:00
|
|
|
* function before the rendering engine has been set will result in NULL being
|
2004-02-16 11:22:48 -08:00
|
|
|
* returned, as will calling this function on an invalid canvas. The caller does
|
|
|
|
* not need to free this structure and should only assume that the pointer is
|
|
|
|
* valid until evas_engine_info_set() is called or until evas_render() is
|
|
|
|
* called. After these calls the contents of this structure and the pointer to
|
|
|
|
* it are not guaranteed to be valid.
|
2002-11-08 00:02:15 -08:00
|
|
|
*
|
2004-02-16 11:22:48 -08:00
|
|
|
* With some engines, calling this function and modifying structure parameters
|
|
|
|
* before calling evas_engine_info_set() is the method to modify engine
|
|
|
|
* parameters whilst the canvas is alive.
|
2002-11-08 00:02:15 -08:00
|
|
|
*
|
|
|
|
* Example:
|
|
|
|
* @code
|
|
|
|
* Evas *evas;
|
|
|
|
* Evas_Engine_Info_Software_X11 *einfo;
|
|
|
|
* extern Display *display;
|
|
|
|
* extern Window win;
|
|
|
|
*
|
|
|
|
* evas = evas_new();
|
|
|
|
* evas_output_method_set(evas, evas_render_method_lookup("software_x11"));
|
|
|
|
* evas_output_size_set(evas, 640, 480);
|
|
|
|
* evas_output_viewport_set(evas, 0, 0, 640, 480);
|
|
|
|
* einfo = (Evas_Engine_Info_Software_X11 *)evas_engine_info_get(evas);
|
|
|
|
* einfo->info.display = display;
|
|
|
|
* einfo->info.visual = DefaultVisual(display, DefaultScreen(display));
|
|
|
|
* einfo->info.colormap = DefaultColormap(display, DefaultScreen(display));
|
|
|
|
* einfo->info.drawable = win;
|
|
|
|
* einfo->info.depth = DefaultDepth(display, DefaultScreen(display));
|
|
|
|
* evas_engine_info_set(evas, (Evas_Engine_Info *)einfo);
|
|
|
|
* @endcode
|
|
|
|
*/
|
|
|
|
Evas_Engine_Info *
|
|
|
|
evas_engine_info_get(Evas *e)
|
|
|
|
{
|
|
|
|
Evas_Engine_Info *info;
|
|
|
|
|
|
|
|
MAGIC_CHECK(e, Evas, MAGIC_EVAS);
|
|
|
|
return NULL;
|
|
|
|
MAGIC_CHECK_END();
|
|
|
|
|
2002-11-25 21:25:02 -08:00
|
|
|
if (!e->engine.info) return NULL;
|
|
|
|
|
2002-11-08 00:02:15 -08:00
|
|
|
info = e->engine.info;
|
|
|
|
e->engine.info_magic = info->magic;
|
|
|
|
|
|
|
|
return info;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Set up the Engine Info from the info structure.
|
|
|
|
* @param e The pointer to the Evas Canvas
|
|
|
|
* @param info The pointer to the Engine Info to use
|
|
|
|
*
|
|
|
|
* This function takes any parameters set in the provided info structure and
|
|
|
|
* applies them to the rendering engine. You need to use the Engine Info
|
|
|
|
* structure pointer provided by evas_engine_info_get() and not anything else.
|
|
|
|
*
|
|
|
|
* You need to set up the Engine Info at least once before doing any rendering
|
2004-02-16 11:22:48 -08:00
|
|
|
* or creating any objects on the Evas Canvas. Some engines support the changing
|
|
|
|
* of engine parameters during runtime and so the application should call
|
|
|
|
* evas_engine_info_get(), modify parameters that need to be modified, and then
|
|
|
|
* call this function to have those changes take effect.
|
2002-11-08 00:02:15 -08:00
|
|
|
*
|
|
|
|
* Once evas_engine_info_set() is called the Engine Info structure pointer
|
|
|
|
* should be considered invalid and should not be used again. Use
|
2004-02-16 11:22:48 -08:00
|
|
|
* evas_engine_info_get() to fetch it again if needed.
|
2002-11-08 00:02:15 -08:00
|
|
|
*
|
|
|
|
* Example:
|
|
|
|
* @code
|
|
|
|
* Evas *evas;
|
|
|
|
* Evas_Engine_Info_Software_X11 *einfo;
|
|
|
|
* extern Display *display;
|
|
|
|
* extern Window win;
|
|
|
|
*
|
|
|
|
* evas = evas_new();
|
|
|
|
* evas_output_method_set(evas, evas_render_method_lookup("software_x11"));
|
|
|
|
* evas_output_size_set(evas, 640, 480);
|
|
|
|
* evas_output_viewport_set(evas, 0, 0, 640, 480);
|
|
|
|
* einfo = (Evas_Engine_Info_Software_X11 *)evas_engine_info_get(evas);
|
|
|
|
* einfo->info.display = display;
|
|
|
|
* einfo->info.visual = DefaultVisual(display, DefaultScreen(display));
|
|
|
|
* einfo->info.colormap = DefaultColormap(display, DefaultScreen(display));
|
|
|
|
* einfo->info.drawable = win;
|
|
|
|
* einfo->info.depth = DefaultDepth(display, DefaultScreen(display));
|
|
|
|
* evas_engine_info_set(evas, (Evas_Engine_Info *)einfo);
|
|
|
|
* @endcode
|
|
|
|
*/
|
|
|
|
void
|
|
|
|
evas_engine_info_set(Evas *e, Evas_Engine_Info *info)
|
|
|
|
{
|
|
|
|
MAGIC_CHECK(e, Evas, MAGIC_EVAS);
|
|
|
|
return;
|
|
|
|
MAGIC_CHECK_END();
|
|
|
|
if (!info) return;
|
|
|
|
if (info != e->engine.info) return;
|
|
|
|
if (info->magic != e->engine.info_magic) return;
|
|
|
|
e->engine.func->setup(e, info);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Set the render engine's output size in output units.
|
|
|
|
* @param e The pointer to the Evas Canvas
|
|
|
|
* @param w The width in output units
|
|
|
|
* @param h The height in output units
|
|
|
|
*
|
2004-02-16 11:22:48 -08:00
|
|
|
* This function sets the output display size for the Evas Canvas indicated (for
|
|
|
|
* most engines these values are in pixels). The Canvas will render to a
|
|
|
|
* rectangle of this size on the output target once this call is called. This is
|
|
|
|
* independent of the viewport (view into the canvas world) and will simply
|
2002-11-08 00:02:15 -08:00
|
|
|
* stretch the viewport to fill the rectangle indicated by this call.
|
|
|
|
*
|
|
|
|
* Example:
|
|
|
|
* @code
|
|
|
|
* extern Evas *evas;
|
|
|
|
*
|
|
|
|
* evas_output_size_set(evas, 640, 480);
|
|
|
|
* @endcode
|
|
|
|
*/
|
|
|
|
void
|
|
|
|
evas_output_size_set(Evas *e, int w, int h)
|
|
|
|
{
|
|
|
|
MAGIC_CHECK(e, Evas, MAGIC_EVAS);
|
|
|
|
return;
|
|
|
|
MAGIC_CHECK_END();
|
|
|
|
|
|
|
|
if ((w == e->output.w) && (h == e->output.h)) return;
|
|
|
|
if (w < 1) w = 1;
|
|
|
|
if (h < 1) h = 1;
|
|
|
|
e->output.w = w;
|
|
|
|
e->output.h = h;
|
|
|
|
e->output.changed = 1;
|
|
|
|
e->output_validity++;
|
|
|
|
e->changed = 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Get the render engine's output size in output units.
|
|
|
|
* @param e The pointer to the Evas Canvas
|
|
|
|
* @param w The pointer to a width variable to be filled in
|
|
|
|
* @param h The pointer to a height variable to be filled in
|
|
|
|
*
|
|
|
|
* Calling this function writes the current canvas output size values into the
|
|
|
|
* variables pointed to by @p w and @p h. On success the variables have the
|
|
|
|
* output size values written to them in output units. If either @p w or @p h
|
|
|
|
* is NULL, it will not be written to. If @p e is invalid, the results are
|
|
|
|
* undefined.
|
|
|
|
*
|
|
|
|
* Example:
|
|
|
|
* @code
|
|
|
|
* extern Evas *evas;
|
|
|
|
* int width, height;
|
|
|
|
*
|
|
|
|
* evas_output_size_get(evas, &width, &height);
|
|
|
|
* @endcode
|
|
|
|
*/
|
|
|
|
void
|
|
|
|
evas_output_size_get(Evas *e, int *w, int *h)
|
|
|
|
{
|
|
|
|
MAGIC_CHECK(e, Evas, MAGIC_EVAS);
|
|
|
|
if (w) *w = 0;
|
|
|
|
if (h) *h = 0;
|
|
|
|
return;
|
|
|
|
MAGIC_CHECK_END();
|
|
|
|
|
|
|
|
if (w) *w = e->output.w;
|
|
|
|
if (h) *h = e->output.h;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Set the render engine's output viewport in canvas units.
|
|
|
|
* @param e The pointer to the Evas Canvas
|
|
|
|
* @param x The top-left corner x value of the viewport
|
|
|
|
* @param y The top-left corner y value of the viewport
|
|
|
|
* @param w The width of the viewport
|
|
|
|
* @param h The height of the viewport
|
|
|
|
*
|
|
|
|
* This function sets the viewport (in canvas co-ordinate space) that will
|
|
|
|
* be visible in the canvas ouput. The width and height of the viewport must
|
2004-02-16 11:22:48 -08:00
|
|
|
* both be strictly greater than 0. The rectangle described by the co-ordinates
|
|
|
|
* is the rectangular region of the canvas co-ordinate space that is visibly
|
|
|
|
* mapped and stretched to fill the output target of the canvas when rendering
|
|
|
|
* is performed.
|
2002-11-08 00:02:15 -08:00
|
|
|
*
|
2004-02-16 11:22:48 -08:00
|
|
|
* Co-ordinates do not have to map 1-to-1, but it is generally advised for ease
|
|
|
|
* of use that canvas co-ordinates match output target units (e.g. pixels).
|
2002-11-08 00:02:15 -08:00
|
|
|
*
|
|
|
|
* Example:
|
|
|
|
* @code
|
|
|
|
* extern Evas *evas;
|
|
|
|
*
|
|
|
|
* evas_output_viewport_set(evas, 0, 0, 640, 480);
|
|
|
|
* @endcode
|
|
|
|
*/
|
|
|
|
void
|
2003-10-17 20:34:00 -07:00
|
|
|
evas_output_viewport_set(Evas *e, Evas_Coord x, Evas_Coord y, Evas_Coord w, Evas_Coord h)
|
2002-11-08 00:02:15 -08:00
|
|
|
{
|
|
|
|
MAGIC_CHECK(e, Evas, MAGIC_EVAS);
|
|
|
|
return;
|
|
|
|
MAGIC_CHECK_END();
|
|
|
|
|
|
|
|
if ((x == e->viewport.x) && (y == e->viewport.y) &&
|
|
|
|
(w == e->viewport.w) && (h == e->viewport.h)) return;
|
|
|
|
if (w <= 0) return;
|
|
|
|
if (h <= 0) return;
|
|
|
|
e->viewport.x = x;
|
|
|
|
e->viewport.y = y;
|
|
|
|
e->viewport.w = w;
|
|
|
|
e->viewport.h = h;
|
|
|
|
e->viewport.changed = 1;
|
|
|
|
e->output_validity++;
|
|
|
|
e->changed = 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Get the render engine's output viewport co-ordinates in canvas units.
|
|
|
|
* @param e The pointer to the Evas Canvas
|
|
|
|
* @param x The pointer to a x variable to be filled in
|
|
|
|
* @param y The pointer to a y variable to be filled in
|
|
|
|
* @param w The pointer to a width variable to be filled in
|
|
|
|
* @param h The pointer to a height variable to be filled in
|
|
|
|
*
|
|
|
|
* Calling this function writes the current canvas output viewport size and
|
|
|
|
* location values into the variables pointed to by @p x, @p y, @p w and @p h.
|
2004-02-16 11:22:48 -08:00
|
|
|
* On success the variables have the output location and size values written to
|
|
|
|
* them in canvas units. Any of @p x, @p y, @p w or @p h that are NULL will not
|
|
|
|
* be written to. If @p e is invalid, the results are undefined.
|
2002-11-08 00:02:15 -08:00
|
|
|
*
|
|
|
|
* Example:
|
|
|
|
* @code
|
|
|
|
* extern Evas *evas;
|
2003-10-17 20:34:00 -07:00
|
|
|
* Evas_Coord x, y, width, height;
|
2002-11-08 00:02:15 -08:00
|
|
|
*
|
|
|
|
* evas_output_viewport_get(evas, &x, &y, &w, &h);
|
|
|
|
* @endcode
|
|
|
|
*/
|
|
|
|
void
|
2003-10-17 20:34:00 -07:00
|
|
|
evas_output_viewport_get(Evas *e, Evas_Coord *x, Evas_Coord *y, Evas_Coord *w, Evas_Coord *h)
|
2002-11-08 00:02:15 -08:00
|
|
|
{
|
|
|
|
MAGIC_CHECK(e, Evas, MAGIC_EVAS);
|
|
|
|
if (x) *x = 0;
|
|
|
|
if (y) *y = 0;
|
|
|
|
if (w) *w = 0;
|
|
|
|
if (h) *h = 0;
|
|
|
|
return;
|
|
|
|
MAGIC_CHECK_END();
|
|
|
|
|
|
|
|
if (x) *x = e->viewport.x;
|
|
|
|
if (y) *y = e->viewport.y;
|
|
|
|
if (w) *w = e->viewport.w;
|
|
|
|
if (h) *h = e->viewport.h;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Convert/scale an ouput screen co-ordinate into canvas co-ordinates
|
|
|
|
*
|
|
|
|
* @param e The pointer to the Evas Canvas
|
|
|
|
* @param x The screen/output x co-ordinate
|
|
|
|
* @return The screen co-ordinate translated to canvas unit co-ordinates
|
|
|
|
*
|
|
|
|
* This function takes in a horizontal co-ordinate as the @p x parameter and
|
|
|
|
* converts it into canvas units, accounting for output size, viewport size
|
|
|
|
* and location, returning it as the function return value. If @p e is
|
|
|
|
* invalid, the results are undefined.
|
|
|
|
*
|
|
|
|
* Example:
|
|
|
|
* @code
|
|
|
|
* extern Evas *evas;
|
|
|
|
* extern int screen_x;
|
2003-10-17 20:34:00 -07:00
|
|
|
* Evas_Coord canvas_x;
|
2002-11-08 00:02:15 -08:00
|
|
|
*
|
|
|
|
* canvas_x = evas_coord_screen_x_to_world(evas, screen_x);
|
|
|
|
* @endcode
|
|
|
|
*/
|
2003-10-17 20:34:00 -07:00
|
|
|
Evas_Coord
|
2002-11-08 00:02:15 -08:00
|
|
|
evas_coord_screen_x_to_world(Evas *e, int x)
|
|
|
|
{
|
|
|
|
MAGIC_CHECK(e, Evas, MAGIC_EVAS);
|
|
|
|
return 0;
|
|
|
|
MAGIC_CHECK_END();
|
2004-04-27 18:52:16 -07:00
|
|
|
if (e->output.w == e->viewport.w) return e->viewport.x + x;
|
|
|
|
return (long long)e->viewport.x + (((long long)x * (long long)e->viewport.w) / (long long)e->output.w);
|
2002-11-08 00:02:15 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Convert/scale an ouput screen co-ordinate into canvas co-ordinates
|
|
|
|
*
|
|
|
|
* @param e The pointer to the Evas Canvas
|
|
|
|
* @param y The screen/output y co-ordinate
|
|
|
|
* @return The screen co-ordinate translated to canvas unit co-ordinates
|
|
|
|
*
|
|
|
|
* This function takes in a vertical co-ordinate as the @p y parameter and
|
|
|
|
* converts it into canvas units, accounting for output size, viewport size
|
|
|
|
* and location, returning it as the function return value. If @p e is
|
|
|
|
* invalid, the results are undefined.
|
|
|
|
*
|
|
|
|
* Example:
|
|
|
|
* @code
|
|
|
|
* extern Evas *evas;
|
|
|
|
* extern int screen_y;
|
2003-10-17 20:34:00 -07:00
|
|
|
* Evas_Coord canvas_y;
|
2002-11-08 00:02:15 -08:00
|
|
|
*
|
|
|
|
* canvas_y = evas_coord_screen_y_to_world(evas, screen_y);
|
|
|
|
* @endcode
|
|
|
|
*/
|
2003-10-17 20:34:00 -07:00
|
|
|
Evas_Coord
|
2002-11-08 00:02:15 -08:00
|
|
|
evas_coord_screen_y_to_world(Evas *e, int y)
|
|
|
|
{
|
|
|
|
MAGIC_CHECK(e, Evas, MAGIC_EVAS);
|
|
|
|
return 0;
|
|
|
|
MAGIC_CHECK_END();
|
2004-04-27 18:52:16 -07:00
|
|
|
if (e->output.h == e->viewport.h) return e->viewport.y + y;
|
|
|
|
return (long long)e->viewport.y + (((long long)y * (long long)e->viewport.h) / (long long)e->output.h);
|
2002-11-08 00:02:15 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Convert/scale a canvas co-ordinate into output screen co-ordinates
|
|
|
|
*
|
|
|
|
* @param e The pointer to the Evas Canvas
|
|
|
|
* @param x The canvas x co-ordinate
|
|
|
|
* @return The output/screen co-ordinate translated to output co-ordinates
|
|
|
|
*
|
|
|
|
* This function takes in a horizontal co-ordinate as the @p x parameter and
|
|
|
|
* converts it into output units, accounting for output size, viewport size
|
|
|
|
* and location, returning it as the function return value. If @p e is
|
|
|
|
* invalid, the results are undefined.
|
|
|
|
*
|
|
|
|
* Example:
|
|
|
|
* @code
|
|
|
|
* extern Evas *evas;
|
|
|
|
* int screen_x;
|
2003-10-17 20:34:00 -07:00
|
|
|
* extern Evas_Coord canvas_x;
|
2002-11-08 00:02:15 -08:00
|
|
|
*
|
|
|
|
* screen_x = evas_coord_world_x_to_screen(evas, canvas_x);
|
|
|
|
* @endcode
|
|
|
|
*/
|
|
|
|
int
|
2003-10-17 20:34:00 -07:00
|
|
|
evas_coord_world_x_to_screen(Evas *e, Evas_Coord x)
|
2002-11-08 00:02:15 -08:00
|
|
|
{
|
|
|
|
MAGIC_CHECK(e, Evas, MAGIC_EVAS);
|
|
|
|
return 0;
|
|
|
|
MAGIC_CHECK_END();
|
2004-04-27 18:52:16 -07:00
|
|
|
if (e->output.w == e->viewport.w) return x - e->viewport.x;
|
|
|
|
return (int)((((long long)x - (long long)e->viewport.x) * (long long)e->output.w) / (long long)e->viewport.w);
|
2002-11-08 00:02:15 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Convert/scale a canvas co-ordinate into output screen co-ordinates
|
|
|
|
*
|
|
|
|
* @param e The pointer to the Evas Canvas
|
|
|
|
* @param y The canvas y co-ordinate
|
|
|
|
* @return The output/screen co-ordinate translated to output co-ordinates
|
|
|
|
*
|
|
|
|
* This function takes in a vertical co-ordinate as the @p x parameter and
|
|
|
|
* converts it into output units, accounting for output size, viewport size
|
|
|
|
* and location, returning it as the function return value. If @p e is
|
|
|
|
* invalid, the results are undefined.
|
|
|
|
*
|
|
|
|
* Example:
|
|
|
|
* @code
|
|
|
|
* extern Evas *evas;
|
|
|
|
* int screen_y;
|
2003-10-17 20:34:00 -07:00
|
|
|
* extern Evas_Coord canvas_y;
|
2002-11-08 00:02:15 -08:00
|
|
|
*
|
|
|
|
* screen_y = evas_coord_world_y_to_screen(evas, canvas_y);
|
|
|
|
* @endcode
|
|
|
|
*/
|
|
|
|
int
|
2003-10-17 20:34:00 -07:00
|
|
|
evas_coord_world_y_to_screen(Evas *e, Evas_Coord y)
|
2002-11-08 00:02:15 -08:00
|
|
|
{
|
|
|
|
MAGIC_CHECK(e, Evas, MAGIC_EVAS);
|
|
|
|
return 0;
|
|
|
|
MAGIC_CHECK_END();
|
2004-04-27 18:52:16 -07:00
|
|
|
if (e->output.h == e->viewport.h) return y - e->viewport.y;
|
|
|
|
return (int)((((long long)y - (long long)e->viewport.y) * (long long)e->output.h) / (long long)e->viewport.h);
|
2002-11-08 00:02:15 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Look up a numeric ID from a string name of a rendering engine.
|
|
|
|
*
|
|
|
|
* @param name The string name of an engine
|
|
|
|
* @return A numeric (opaque) ID for the rendering engine
|
|
|
|
*
|
|
|
|
* This function looks up a numeric return value for the named engine in the
|
|
|
|
* string @p name. This is a normal C string, NUL byte terminated. The name
|
|
|
|
* is case sensitive. If the rendering engine is available, a numeric ID for
|
2004-02-16 11:22:48 -08:00
|
|
|
* that engine is returned that is not 0. If the engine is not available, 0
|
2002-11-08 00:02:15 -08:00
|
|
|
* is returned, indicating an invalid engine.
|
|
|
|
*
|
2004-02-16 11:22:48 -08:00
|
|
|
* The programmer should NEVER rely on the numeric ID of an engine unless it is
|
2002-11-08 00:02:15 -08:00
|
|
|
* returned by this function. Programs should NOT be written accessing render
|
|
|
|
* method ID's directly, without first obtaining it from this function.
|
|
|
|
*
|
|
|
|
* Example:
|
|
|
|
* @code
|
|
|
|
* int engine_id;
|
|
|
|
* Evas *evas;
|
|
|
|
*
|
|
|
|
* evas = evas_new();
|
|
|
|
* if (!evas)
|
|
|
|
* {
|
|
|
|
* fprintf(stderr, "ERROR: Canvas creation failed. Fatal error.\n");
|
|
|
|
* exit(-1);
|
|
|
|
* }
|
|
|
|
* engine_id = evas_render_method_lookup("software_x11");
|
|
|
|
* if (!engine_id)
|
|
|
|
* {
|
|
|
|
* fprintf(stderr, "ERROR: Requested rendering engine is absent.\n");
|
|
|
|
* exit(-1);
|
|
|
|
* }
|
|
|
|
* evas_output_method_set(evas, engine_id);
|
|
|
|
* @endcode
|
|
|
|
*/
|
|
|
|
int
|
|
|
|
evas_render_method_lookup(const char *name)
|
|
|
|
{
|
|
|
|
if (!name) return RENDER_METHOD_INVALID;
|
|
|
|
|
|
|
|
#ifdef BUILD_ENGINE_SOFTWARE_X11
|
|
|
|
if (!strcmp(name, "software_x11")) return RENDER_METHOD_SOFTWARE_X11;
|
|
|
|
#endif
|
|
|
|
#ifdef BUILD_ENGINE_GL_X11
|
|
|
|
if (!strcmp(name, "gl_x11")) return RENDER_METHOD_GL_X11;
|
|
|
|
#endif
|
|
|
|
#ifdef BUILD_ENGINE_DIRECTFB
|
2003-04-01 20:28:27 -08:00
|
|
|
if (!strcmp(name, "directfb")) return RENDER_METHOD_DIRECTFB;
|
2002-11-08 00:02:15 -08:00
|
|
|
#endif
|
|
|
|
#ifdef BUILD_ENGINE_FB
|
2003-04-01 20:28:27 -08:00
|
|
|
if (!strcmp(name, "fb")) return RENDER_METHOD_FB;
|
|
|
|
#endif
|
|
|
|
#ifdef BUILD_ENGINE_BUFFER
|
|
|
|
if (!strcmp(name, "buffer")) return RENDER_METHOD_BUFFER;
|
2002-11-08 00:02:15 -08:00
|
|
|
#endif
|
|
|
|
#ifdef BUILD_ENGINE_SOFTWARE_WIN32_GDI
|
|
|
|
if (!strcmp(name, "software_win32_gdi")) return RENDER_METHOD_SOFTWARE_WIN32_GDI;
|
|
|
|
#endif
|
|
|
|
#ifdef BUILD_ENGINE_SOFTWARE_QTOPIA
|
|
|
|
if (!strcmp(name, "software_qtopia")) return RENDER_METHOD_SOFTWARE_QTOPIA;
|
|
|
|
#endif
|
|
|
|
return RENDER_METHOD_INVALID;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* List all the rendering engines compiled into the copy of the Evas library
|
|
|
|
*
|
2004-02-16 11:22:48 -08:00
|
|
|
* @return A linked list whose data members are C strings of engine names
|
2002-11-08 00:02:15 -08:00
|
|
|
*
|
2004-02-16 11:22:48 -08:00
|
|
|
* Calling this will return a handle (pointer) to an Evas linked list. Each node
|
|
|
|
* in the linked list will have the data pointer be a (char *) pointer to the
|
|
|
|
* string name of the rendering engine available. The strings should never be
|
|
|
|
* modified, neither should the list be modified. This list should be cleaned up
|
|
|
|
* as soon as the program no longer needs it using
|
2002-11-08 00:02:15 -08:00
|
|
|
* evas_render_method_list_free(). If no engines are available from Evas, NULL
|
|
|
|
* will be returned.
|
|
|
|
*
|
|
|
|
* Example:
|
|
|
|
* @code
|
|
|
|
* Evas_List *engine_list, *l;
|
|
|
|
*
|
|
|
|
* engine_list = evas_render_method_list();
|
|
|
|
* if (!engine_list)
|
|
|
|
* {
|
|
|
|
* fprintf(stderr, "ERROR: Evas supports no engines! Exit.\n");
|
|
|
|
* exit(-1);
|
|
|
|
* }
|
|
|
|
* printf("Availible Evas Engines:\n");
|
|
|
|
* for (l = engine_list; l; l = l->next)
|
|
|
|
* {
|
|
|
|
* char *engine_name;
|
|
|
|
*
|
|
|
|
* engine_name = l->data;
|
|
|
|
* printf("%s\n", engine_name);
|
|
|
|
* }
|
|
|
|
* evas_render_method_list_free(engine_list);
|
|
|
|
* @endcode
|
|
|
|
*/
|
|
|
|
Evas_List *
|
|
|
|
evas_render_method_list(void)
|
|
|
|
{
|
|
|
|
Evas_List *methods = NULL;
|
|
|
|
|
2003-04-01 20:28:27 -08:00
|
|
|
#ifdef BUILD_ENGINE_SOFTWARE_X11
|
2002-11-08 00:02:15 -08:00
|
|
|
methods = evas_list_append(methods, strdup("software_x11"));
|
|
|
|
#endif
|
2003-04-01 20:28:27 -08:00
|
|
|
#ifdef BUILD_ENGINE_GL_X11
|
2002-11-08 00:02:15 -08:00
|
|
|
methods = evas_list_append(methods, strdup("gl_x11"));
|
|
|
|
#endif
|
2003-04-01 20:28:27 -08:00
|
|
|
#ifdef BUILD_ENGINE_DIRECTFB
|
2002-11-08 00:02:15 -08:00
|
|
|
methods = evas_list_append(methods, strdup("directfb"));
|
|
|
|
#endif
|
2003-04-01 20:28:27 -08:00
|
|
|
#ifdef BUILD_ENGINE_FB
|
2002-11-08 00:02:15 -08:00
|
|
|
methods = evas_list_append(methods, strdup("fb"));
|
|
|
|
#endif
|
2003-04-01 20:28:27 -08:00
|
|
|
#ifdef BUILD_ENGINE_BUFFER
|
|
|
|
methods = evas_list_append(methods, strdup("buffer"));
|
|
|
|
#endif
|
2004-02-03 20:38:34 -08:00
|
|
|
#ifdef BUILD_ENGINE_SOFTWARE_WIN32_GDI
|
2002-11-08 00:02:15 -08:00
|
|
|
methods = evas_list_append(methods, strdup("software_win32_gdi"));
|
|
|
|
#endif
|
2004-02-03 20:38:34 -08:00
|
|
|
#ifdef BUILD_ENGINE_SOFTWARE_QTOPIA
|
2002-11-08 00:02:15 -08:00
|
|
|
methods = evas_list_append(methods, strdup("software_qtopia"));
|
|
|
|
#endif
|
|
|
|
|
2004-02-03 20:38:34 -08:00
|
|
|
return methods;
|
2002-11-08 00:02:15 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* This function should be called to free a list of engine names
|
|
|
|
*
|
|
|
|
* @param list The Evas_List base pointer for the engine list to be freed
|
|
|
|
*
|
|
|
|
* When this function is called it will free the engine list passed in as
|
|
|
|
* @p list. The list should only be a list of engines generated by calling
|
|
|
|
* evas_render_method_list(). If @p list is NULL, nothing will happen.
|
|
|
|
*
|
|
|
|
* Example:
|
|
|
|
* @code
|
|
|
|
* Evas_List *engine_list, *l;
|
|
|
|
*
|
|
|
|
* engine_list = evas_render_method_list();
|
|
|
|
* if (!engine_list)
|
|
|
|
* {
|
|
|
|
* fprintf(stderr, "ERROR: Evas supports no engines! Exit.\n");
|
|
|
|
* exit(-1);
|
|
|
|
* }
|
|
|
|
* printf("Availible Evas Engines:\n");
|
|
|
|
* for (l = engine_list; l; l = l->next)
|
|
|
|
* {
|
|
|
|
* char *engine_name;
|
|
|
|
*
|
|
|
|
* engine_name = l->data;
|
|
|
|
* printf("%s\n", engine_name);
|
|
|
|
* }
|
|
|
|
* evas_render_method_list_free(engine_list);
|
|
|
|
* @endcode
|
|
|
|
*/
|
|
|
|
void
|
|
|
|
evas_render_method_list_free(Evas_List *list)
|
|
|
|
{
|
|
|
|
while (list)
|
|
|
|
{
|
|
|
|
free(list->data);
|
|
|
|
list = evas_list_remove(list, list->data);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* This function returns the current known pointer co-ordinates
|
|
|
|
*
|
|
|
|
* @param e The pointer to the Evas Canvas
|
|
|
|
* @param x The pointer to an integer to be filled in
|
|
|
|
* @param y The pointer to an integer to be filled in
|
|
|
|
*
|
|
|
|
* This function returns the current known screen/output co-ordinates of the
|
|
|
|
* mouse pointer and sets the contents of the integers pointed to by @p x
|
|
|
|
* and @p y to contain these co-ordinates. If @p e is not a valid canvas the
|
|
|
|
* results of this function are undefined.
|
|
|
|
*
|
|
|
|
* Example:
|
|
|
|
* @code
|
|
|
|
* extern Evas *evas;
|
|
|
|
* int mouse_x, mouse_y;
|
|
|
|
*
|
|
|
|
* evas_pointer_output_xy_get(evas, &mouse_x, &mouse_y);
|
|
|
|
* printf("Mouse is at screen position %i, %i\n", mouse_x, mouse_y);
|
|
|
|
* @endcode
|
|
|
|
*/
|
|
|
|
void
|
|
|
|
evas_pointer_output_xy_get(Evas *e, int *x, int *y)
|
|
|
|
{
|
|
|
|
MAGIC_CHECK(e, Evas, MAGIC_EVAS);
|
|
|
|
if (x) *x = 0;
|
|
|
|
if (y) *y = 0;
|
|
|
|
return;
|
|
|
|
MAGIC_CHECK_END();
|
|
|
|
if (x) *x = e->pointer.x;
|
|
|
|
if (y) *y = e->pointer.y;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* This function returns the current known pointer co-ordinates
|
|
|
|
*
|
|
|
|
* @param e The pointer to the Evas Canvas
|
2003-10-17 20:34:00 -07:00
|
|
|
* @param x The pointer to a Evas_Coord to be filled in
|
|
|
|
* @param y The pointer to a Evas_Coord to be filled in
|
2002-11-08 00:02:15 -08:00
|
|
|
*
|
|
|
|
* This function returns the current known canvas unit co-ordinates of the
|
2003-10-17 20:34:00 -07:00
|
|
|
* mouse pointer and sets the contents of the Evas_Coords pointed to by @p x
|
2002-11-08 00:02:15 -08:00
|
|
|
* and @p y to contain these co-ordinates. If @p e is not a valid canvas the
|
|
|
|
* results of this function are undefined.
|
|
|
|
*
|
|
|
|
* Example:
|
|
|
|
* @code
|
|
|
|
* extern Evas *evas;
|
2003-10-17 20:34:00 -07:00
|
|
|
* Evas_Coord mouse_x, mouse_y;
|
2002-11-08 00:02:15 -08:00
|
|
|
*
|
|
|
|
* evas_pointer_output_xy_get(evas, &mouse_x, &mouse_y);
|
|
|
|
* printf("Mouse is at canvas position %f, %f\n", mouse_x, mouse_y);
|
|
|
|
* @endcode
|
|
|
|
*/
|
|
|
|
void
|
2003-10-17 20:34:00 -07:00
|
|
|
evas_pointer_canvas_xy_get(Evas *e, Evas_Coord *x, Evas_Coord *y)
|
2002-11-08 00:02:15 -08:00
|
|
|
{
|
|
|
|
MAGIC_CHECK(e, Evas, MAGIC_EVAS);
|
|
|
|
if (x) *x = 0;
|
|
|
|
if (y) *y = 0;
|
|
|
|
return;
|
|
|
|
MAGIC_CHECK_END();
|
|
|
|
if (x) *x = e->pointer.x;
|
|
|
|
if (y) *y = e->pointer.y;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns a bitmask with the mouse buttons currently pressed, set to 1
|
|
|
|
*
|
|
|
|
* @param e The pointer to the Evas Canvas
|
|
|
|
* @return A bitmask of the currently depressed buttons on the cavas
|
|
|
|
*
|
2004-02-16 11:22:48 -08:00
|
|
|
* Calling this function will return a 32-bit integer with the appropriate bits
|
2002-11-08 00:02:15 -08:00
|
|
|
* set to 1 that correspond to a mouse button being depressed. This limits
|
|
|
|
* Evas to a mouse devices with a maximum of 32 buttons, but that is generally
|
2004-02-16 11:22:48 -08:00
|
|
|
* in excess of any host system's pointing device abilities.
|
2002-11-08 00:02:15 -08:00
|
|
|
*
|
|
|
|
* A canvas by default begins with no mouse buttons being pressed and only
|
|
|
|
* calls to evas_event_feed_mouse_down(), evas_event_feed_mouse_down_data(),
|
|
|
|
* evas_event_feed_mouse_up() and evas_event_feed_mouse_up_data() will alter
|
|
|
|
* that.
|
|
|
|
*
|
|
|
|
* The least significant bit corresponds to the first mouse button (button 1)
|
|
|
|
* and the most significant bit corresponds to the last mouse button
|
|
|
|
* (button 32).
|
|
|
|
*
|
|
|
|
* If @p e is not a valid canvas, the return value is undefined.
|
|
|
|
*
|
|
|
|
* Example:
|
|
|
|
* @code
|
|
|
|
* extern Evas *evas;
|
|
|
|
* int button_mask, i;
|
|
|
|
*
|
|
|
|
* button_mask = evas_pointer_button_down_mask_get(evas);
|
|
|
|
* printf("Buttons currently pressed:\n");
|
|
|
|
* for (i = 0; i < 32; i++)
|
|
|
|
* {
|
|
|
|
* if ((button_mask & (1 << i)) != 0) printf("Button %i\n", i + 1);
|
|
|
|
* }
|
|
|
|
* @endcode
|
|
|
|
*/
|
|
|
|
int
|
|
|
|
evas_pointer_button_down_mask_get(Evas *e)
|
|
|
|
{
|
|
|
|
MAGIC_CHECK(e, Evas, MAGIC_EVAS);
|
|
|
|
return 0;
|
|
|
|
MAGIC_CHECK_END();
|
|
|
|
return (int)e->pointer.button;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2004-02-16 11:22:48 -08:00
|
|
|
* Returns whether the mouse pointer is logically inside the canvas
|
2002-11-08 00:02:15 -08:00
|
|
|
*
|
|
|
|
* @param e The pointer to the Evas Canvas
|
2004-02-16 11:22:48 -08:00
|
|
|
* @return An integer that is 1 if the mouse is inside the canvas, 0 otherwise
|
2002-11-08 00:02:15 -08:00
|
|
|
*
|
|
|
|
* When this function is called it will return a value of either 0 or 1,
|
|
|
|
* depending on if evas_event_feed_mouse_in(), evas_event_feed_mouse_in_data(),
|
|
|
|
* or evas_event_feed_mouse_out(), evas_event_feed_mouse_out_data() have been
|
|
|
|
* called to feed in a mouse enter event into the canvas.
|
|
|
|
*
|
|
|
|
* A return value of 1 indicates the mouse is logically inside the canvas, and
|
|
|
|
* 0 implies it is logically outside the canvas.
|
|
|
|
*
|
|
|
|
* A canvas begins with the mouse being assumed outside (0).
|
|
|
|
*
|
|
|
|
* If @p e is not a valid canvas, the return value is undefined.
|
|
|
|
*
|
|
|
|
* Example:
|
|
|
|
* @code
|
|
|
|
* extern Evas *evas;
|
|
|
|
*
|
|
|
|
* if (evas_pointer_inside_get(evas)) printf("Mouse is in!\n");
|
2004-02-16 11:22:48 -08:00
|
|
|
* else printf("Mouse is out!\n");
|
2002-11-08 00:02:15 -08:00
|
|
|
* @endcode
|
|
|
|
*/
|
2003-10-17 20:34:00 -07:00
|
|
|
Evas_Bool
|
2002-11-08 00:02:15 -08:00
|
|
|
evas_pointer_inside_get(Evas *e)
|
|
|
|
{
|
|
|
|
MAGIC_CHECK(e, Evas, MAGIC_EVAS);
|
|
|
|
return 0;
|
|
|
|
MAGIC_CHECK_END();
|
|
|
|
return (int)e->pointer.inside;
|
|
|
|
}
|