1 #include "evas_common.h"
2 #include "evas_private.h"
4 extern Evas_List *evas_modules;
5 static int initcount = 0;
21 evas_font_dir_cache_free();
22 evas_common_shutdown();
23 evas_module_shutdown();
29 * @defgroup Evas_Canvas Evas Canvas
31 * Functions that deal with the basic evas object. They are the
32 * functions you need to use at a minimum to get a working evas, and
38 * Creates a new empty evas.
40 * Note that before you can use the evas, you will to at a minimum:
41 * @li Set its render method with @ref evas_output_method_set .
42 * @li Set its viewport size with @ref evas_output_viewport_set .
43 * @li Set its size of the canvas with @ref evas_output_size_set .
44 * @li Ensure that the render engine is given the correct settings with
45 * @ref evas_engine_info_set .
47 * This function should only fail if the memory allocation fails.
49 * @return A new uninitialised Evas canvas on success. Otherwise, @c NULL.
50 * @ingroup Evas_Canvas
57 e = calloc(1, sizeof(Evas));
60 e->magic = MAGIC_EVAS;
61 e->output.render_method = RENDER_METHOD_INVALID;
64 e->hinting = EVAS_FONT_HINTING_BYTECODE;
66 evas_array_setup(&e->delete_objects, 16);
67 evas_array_setup(&e->active_objects, 16);
68 evas_array_setup(&e->restack_objects, 16);
69 evas_array_setup(&e->render_objects, 16);
70 evas_array_setup(&e->pending_objects, 16);
71 evas_array_setup(&e->obscuring_objects, 16);
72 evas_array_setup(&e->temporary_objects, 16);
78 * Frees the given evas and any objects created on it.
80 * Any objects with 'free' callbacks will have those callbacks called
83 * @param e The given evas.
84 * @ingroup Evas_Canvas
93 MAGIC_CHECK(e, Evas, MAGIC_EVAS);
97 if (e->walking_list == 0) evas_render_idle_flush(e);
99 if (e->walking_list > 0) return;
106 for (l = (Evas_Object_List *)(e->layers); l; l = l->next)
109 Evas_Object_List *ll;
111 lay = (Evas_Layer *)l;
112 evas_layer_pre_free(lay);
113 for (ll = (Evas_Object_List *)lay->objects; ll; ll = ll->next)
117 o = (Evas_Object *)ll;
118 if ((o->callbacks) && (o->callbacks->walking_list))
136 evas_layer_free(lay);
140 evas_font_path_clear(e);
141 e->pointer.object.in = evas_list_free(e->pointer.object.in);
143 if (e->name_hash) evas_hash_free(e->name_hash);
147 free(e->damages->data);
148 e->damages = evas_list_remove(e->damages, e->damages->data);
152 free(e->obscures->data);
153 e->obscures = evas_list_remove(e->obscures, e->obscures->data);
158 e->engine.func->info_free(e, e->engine.info);
159 e->engine.func->context_free(e->engine.data.output, e->engine.data.context);
160 e->engine.func->output_free(e->engine.data.output);
163 for (i = 0; i < e->modifiers.mod.count; i++)
164 free(e->modifiers.mod.list[i]);
165 if (e->modifiers.mod.list) free(e->modifiers.mod.list);
167 for (i = 0; i < e->locks.lock.count; i++)
168 free(e->locks.lock.list[i]);
169 if (e->locks.lock.list) free(e->locks.lock.list);
171 if (e->engine.module) evas_module_unref(e->engine.module);
173 evas_array_flush(&e->delete_objects);
174 evas_array_flush(&e->active_objects);
175 evas_array_flush(&e->restack_objects);
176 evas_array_flush(&e->render_objects);
177 evas_array_flush(&e->pending_objects);
178 evas_array_flush(&e->obscuring_objects);
179 evas_array_flush(&e->temporary_objects);
186 * @defgroup Evas_Output_Method Evas Render Engine Functions
188 * Functions that are used to set the render engine for a given function, and
189 * then get that engine working.
191 * The following code snippet shows how they can be used to
192 * initialise an evas that uses the X11 software engine:
195 * Evas_Engine_Info_Software_X11 *einfo;
196 * extern Display *display;
200 * evas_output_method_set(evas, evas_render_method_lookup("software_x11"));
201 * evas_output_size_set(evas, 640, 480);
202 * evas_output_viewport_set(evas, 0, 0, 640, 480);
203 * einfo = (Evas_Engine_Info_Software_X11 *)evas_engine_info_get(evas);
204 * einfo->info.display = display;
205 * einfo->info.visual = DefaultVisual(display, DefaultScreen(display));
206 * einfo->info.colormap = DefaultColormap(display, DefaultScreen(display));
207 * einfo->info.drawable = win;
208 * einfo->info.depth = DefaultDepth(display, DefaultScreen(display));
209 * evas_engine_info_set(evas, (Evas_Engine_Info *)einfo);
214 * Sets the output engine for the given evas.
216 * Once the output engine for an evas is set, any attempt to change it
217 * will be ignored. The value for @p render_method can be found using
218 * @ref evas_render_method_lookup .
220 * @param e The given evas.
221 * @param render_method The numeric engine value to use.
222 * @ingroup Evas_Output_Method
225 evas_output_method_set(Evas *e, int render_method)
228 MAGIC_CHECK(e, Evas, MAGIC_EVAS);
232 /* if our engine to set it to is invalid - abort */
233 if (render_method == RENDER_METHOD_INVALID) return;
234 /* if the engine is already set up - abort */
235 if (e->output.render_method != RENDER_METHOD_INVALID) return;
236 /* iterate trough the list to find the id */
237 for (l = evas_modules; l; l = l->next)
240 Evas_Module_Engine *eme;
243 if (em->type != EVAS_MODULE_TYPE_ENGINE) continue;
244 if (!em->data) continue;
245 eme = (Evas_Module_Engine *)em->data;
246 if (eme->id != render_method) continue;
247 if (!evas_module_load(em)) return;
248 /* set the correct render */
249 e->output.render_method = render_method;
250 e->engine.func = (em->functions);
252 if (e->engine.module) evas_module_unref(e->engine.module);
253 e->engine.module = em;
255 /* get the engine info struct */
256 if (e->engine.func->info) e->engine.info = e->engine.func->info(e);
262 * Retrieves the number of the output engine used for the given evas.
263 * @param e The given evas.
264 * @return The ID number of the output engine being used. @c 0 is
265 * returned if there is an error.
266 * @ingroup Evas_Output_Method
269 evas_output_method_get(const Evas *e)
271 MAGIC_CHECK(e, Evas, MAGIC_EVAS);
272 return RENDER_METHOD_INVALID;
275 return e->output.render_method;
279 * Retrieves the current render engine info struct from the given evas.
281 * The returned structure is publicly modifiable. The contents are valid
282 * until either @ref evas_engine_info_set or @ref evas_render are called.
284 * This structure does not need to be freed by the caller.
286 * @param e The given evas.
287 * @return A pointer to the Engine Info structure. @c NULL is returned if
288 * an engine has not yet been assigned.
289 * @ingroup Evas_Output_Method
291 EAPI Evas_Engine_Info *
292 evas_engine_info_get(const Evas *e)
294 Evas_Engine_Info *info;
296 MAGIC_CHECK(e, Evas, MAGIC_EVAS);
300 if (!e->engine.info) return NULL;
302 info = e->engine.info;
303 ((Evas *)e)->engine.info_magic = info->magic;
309 * Applies the engine settings for the given evas from the given @c
310 * Evas_Engine_Info structure.
312 * To get the Evas_Engine_Info structure to use, call @ref
313 * evas_engine_info_get . Do not try to obtain a pointer to an
314 * @c Evas_Engine_Info structure in any other way.
316 * You will need to call this function at least once before you can
317 * create objects on an evas or render that evas. Some engines allow
318 * their settings to be changed more than once.
320 * Once called, the @p info pointer should be considered invalid.
324 * @param e The pointer to the Evas Canvas
325 * @param info The pointer to the Engine Info to use
326 * @ingroup Evas_Output_Method
329 evas_engine_info_set(Evas *e, Evas_Engine_Info *info)
331 MAGIC_CHECK(e, Evas, MAGIC_EVAS);
335 if (info != e->engine.info) return;
336 if (info->magic != e->engine.info_magic) return;
337 e->engine.func->setup(e, info);
341 * @defgroup Evas_Output_Size Evas Output and Viewport Resizing Functions
343 * Functions that set and retrieve the output and viewport size of an evas.
347 * Sets the output size of the render engine of the given evas.
349 * The evas will render to a rectangle of the given size once this
350 * function is called. The output size is independent of the viewport
351 * size. The viewport will be stretched to fill the given rectangle.
353 * The units used for @p w and @p h depend on the engine used by the
356 * @param e The given evas.
357 * @param w The width in output units, usually pixels.
358 * @param h The height in output units, usually pixels.
359 * @ingroup Evas_Output_Size
362 evas_output_size_set(Evas *e, int w, int h)
364 MAGIC_CHECK(e, Evas, MAGIC_EVAS);
368 if ((w == e->output.w) && (h == e->output.h)) return;
373 e->output.changed = 1;
374 e->output_validity++;
376 evas_render_invalidate(e);
380 * Retrieve the output size of the render engine of the given evas.
382 * The output size is given in whatever the output units are for the
385 * If either @p w or @p h is @c NULL, then it is ignored. If @p e is
386 * invalid, the returned results are undefined.
388 * @param e The given evas.
389 * @param w The pointer to an integer to store the width in.
390 * @param h The pointer to an integer to store the height in.
391 * @ingroup Evas_Output_Size
394 evas_output_size_get(const Evas *e, int *w, int *h)
396 MAGIC_CHECK(e, Evas, MAGIC_EVAS);
402 if (w) *w = e->output.w;
403 if (h) *h = e->output.h;
407 * Sets the output viewport of the given evas in evas units.
409 * The output viewport is the area of the evas that will be visible to the
410 * viewer. The viewport will be stretched to fit the output target of the
411 * evas when rendering is performed.
413 * @note The coordinate values do not have to map 1-to-1 with the output
414 * target. However, it is generally advised that it is done for ease
417 * @param e The given evas.
418 * @param x The top-left corner x value of the viewport.
419 * @param y The top-left corner y value of the viewport.
420 * @param w The width of the viewport. Must be greater than 0.
421 * @param h The height of the viewport. Must be greater than 0.
422 * @ingroup Evas_Output_Size
425 evas_output_viewport_set(Evas *e, Evas_Coord x, Evas_Coord y, Evas_Coord w, Evas_Coord h)
427 MAGIC_CHECK(e, Evas, MAGIC_EVAS);
431 if ((x == e->viewport.x) && (y == e->viewport.y) &&
432 (w == e->viewport.w) && (h == e->viewport.h)) return;
435 if ((x != 0) || (y != 0))
437 printf("EVAS: compat error. viewport x,y != 0,0 not supported\n");
445 e->viewport.changed = 1;
446 e->output_validity++;
451 * Get the render engine's output viewport co-ordinates in canvas units.
452 * @param e The pointer to the Evas Canvas
453 * @param x The pointer to a x variable to be filled in
454 * @param y The pointer to a y variable to be filled in
455 * @param w The pointer to a width variable to be filled in
456 * @param h The pointer to a height variable to be filled in
457 * @ingroup Evas_Output_Size
459 * Calling this function writes the current canvas output viewport size and
460 * location values into the variables pointed to by @p x, @p y, @p w and @p h.
461 * On success the variables have the output location and size values written to
462 * them in canvas units. Any of @p x, @p y, @p w or @p h that are NULL will not
463 * be written to. If @p e is invalid, the results are undefined.
468 * Evas_Coord x, y, width, height;
470 * evas_output_viewport_get(evas, &x, &y, &w, &h);
474 evas_output_viewport_get(const Evas *e, Evas_Coord *x, Evas_Coord *y, Evas_Coord *w, Evas_Coord *h)
476 MAGIC_CHECK(e, Evas, MAGIC_EVAS);
484 if (x) *x = e->viewport.x;
485 if (y) *y = e->viewport.y;
486 if (w) *w = e->viewport.w;
487 if (h) *h = e->viewport.h;
491 * @defgroup Evas_Coord_Mapping_Group Evas Coordinate Mapping Functions
493 * Functions that are used to map coordinates from the canvas to the
494 * screen or the screen to the canvas.
498 * Convert/scale an ouput screen co-ordinate into canvas co-ordinates
500 * @param e The pointer to the Evas Canvas
501 * @param x The screen/output x co-ordinate
502 * @return The screen co-ordinate translated to canvas unit co-ordinates
503 * @ingroup Evas_Coord_Mapping_Group
505 * This function takes in a horizontal co-ordinate as the @p x parameter and
506 * converts it into canvas units, accounting for output size, viewport size
507 * and location, returning it as the function return value. If @p e is
508 * invalid, the results are undefined.
513 * extern int screen_x;
514 * Evas_Coord canvas_x;
516 * canvas_x = evas_coord_screen_x_to_world(evas, screen_x);
520 evas_coord_screen_x_to_world(const Evas *e, int x)
522 MAGIC_CHECK(e, Evas, MAGIC_EVAS);
525 if (e->output.w == e->viewport.w) return e->viewport.x + x;
526 return (long long)e->viewport.x + (((long long)x * (long long)e->viewport.w) / (long long)e->output.w);
530 * Convert/scale an ouput screen co-ordinate into canvas co-ordinates
532 * @param e The pointer to the Evas Canvas
533 * @param y The screen/output y co-ordinate
534 * @return The screen co-ordinate translated to canvas unit co-ordinates
535 * @ingroup Evas_Coord_Mapping_Group
537 * This function takes in a vertical co-ordinate as the @p y parameter and
538 * converts it into canvas units, accounting for output size, viewport size
539 * and location, returning it as the function return value. If @p e is
540 * invalid, the results are undefined.
545 * extern int screen_y;
546 * Evas_Coord canvas_y;
548 * canvas_y = evas_coord_screen_y_to_world(evas, screen_y);
552 evas_coord_screen_y_to_world(const Evas *e, int y)
554 MAGIC_CHECK(e, Evas, MAGIC_EVAS);
557 if (e->output.h == e->viewport.h) return e->viewport.y + y;
558 return (long long)e->viewport.y + (((long long)y * (long long)e->viewport.h) / (long long)e->output.h);
562 * Convert/scale a canvas co-ordinate into output screen co-ordinates
564 * @param e The pointer to the Evas Canvas
565 * @param x The canvas x co-ordinate
566 * @return The output/screen co-ordinate translated to output co-ordinates
567 * @ingroup Evas_Coord_Mapping_Group
569 * This function takes in a horizontal co-ordinate as the @p x parameter and
570 * converts it into output units, accounting for output size, viewport size
571 * and location, returning it as the function return value. If @p e is
572 * invalid, the results are undefined.
578 * extern Evas_Coord canvas_x;
580 * screen_x = evas_coord_world_x_to_screen(evas, canvas_x);
584 evas_coord_world_x_to_screen(const Evas *e, Evas_Coord x)
586 MAGIC_CHECK(e, Evas, MAGIC_EVAS);
589 if (e->output.w == e->viewport.w) return x - e->viewport.x;
590 return (int)((((long long)x - (long long)e->viewport.x) * (long long)e->output.w) / (long long)e->viewport.w);
594 * Convert/scale a canvas co-ordinate into output screen co-ordinates
596 * @param e The pointer to the Evas Canvas
597 * @param y The canvas y co-ordinate
598 * @return The output/screen co-ordinate translated to output co-ordinates
599 * @ingroup Evas_Coord_Mapping_Group
601 * This function takes in a vertical co-ordinate as the @p x parameter and
602 * converts it into output units, accounting for output size, viewport size
603 * and location, returning it as the function return value. If @p e is
604 * invalid, the results are undefined.
610 * extern Evas_Coord canvas_y;
612 * screen_y = evas_coord_world_y_to_screen(evas, canvas_y);
616 evas_coord_world_y_to_screen(const Evas *e, Evas_Coord y)
618 MAGIC_CHECK(e, Evas, MAGIC_EVAS);
621 if (e->output.h == e->viewport.h) return y - e->viewport.y;
622 return (int)((((long long)y - (long long)e->viewport.y) * (long long)e->output.h) / (long long)e->viewport.h);
626 * Look up a numeric ID from a string name of a rendering engine.
628 * @param name The string name of an engine
629 * @return A numeric (opaque) ID for the rendering engine
630 * @ingroup Evas_Output_Method
632 * This function looks up a numeric return value for the named engine in the
633 * string @p name. This is a normal C string, NUL byte terminated. The name
634 * is case sensitive. If the rendering engine is available, a numeric ID for
635 * that engine is returned that is not 0. If the engine is not available, 0
636 * is returned, indicating an invalid engine.
638 * The programmer should NEVER rely on the numeric ID of an engine unless it is
639 * returned by this function. Programs should NOT be written accessing render
640 * method ID's directly, without first obtaining it from this function.
650 * fprintf(stderr, "ERROR: Canvas creation failed. Fatal error.\n");
653 * engine_id = evas_render_method_lookup("software_x11");
656 * fprintf(stderr, "ERROR: Requested rendering engine is absent.\n");
659 * evas_output_method_set(evas, engine_id);
663 evas_render_method_lookup(const char *name)
667 Evas_Module_Engine *eem;
669 if (!name) return RENDER_METHOD_INVALID;
670 /* search on the engines list for the name */
671 em = evas_module_find_type(EVAS_MODULE_TYPE_ENGINE, name);
673 if (!em) return RENDER_METHOD_INVALID;
675 eem = (Evas_Module_Engine *)em->data;
678 eem = malloc(sizeof(Evas_Module_Engine));
687 * List all the rendering engines compiled into the copy of the Evas library
689 * @return A linked list whose data members are C strings of engine names
690 * @ingroup Evas_Output_Method
692 * Calling this will return a handle (pointer) to an Evas linked list. Each node
693 * in the linked list will have the data pointer be a (char *) pointer to the
694 * string name of the rendering engine available. The strings should never be
695 * modified, neither should the list be modified. This list should be cleaned up
696 * as soon as the program no longer needs it using
697 * evas_render_method_list_free(). If no engines are available from Evas, NULL
702 * Evas_List *engine_list, *l;
704 * engine_list = evas_render_method_list();
707 * fprintf(stderr, "ERROR: Evas supports no engines! Exit.\n");
710 * printf("Availible Evas Engines:\n");
711 * for (l = engine_list; l; l = l->next)
715 * engine_name = l->data;
716 * printf("%s\n", engine_name);
718 * evas_render_method_list_free(engine_list);
722 evas_render_method_list(void)
724 Evas_List *methods = NULL;
726 /* FIXME: get from modules - this is currently coded-in */
727 #ifdef BUILD_ENGINE_SOFTWARE_DDRAW
728 methods = evas_list_append(methods, strdup("software_ddraw"));
730 #ifdef BUILD_ENGINE_SOFTWARE_16_DDRAW
731 methods = evas_list_append(methods, strdup("software_16_ddraw"));
733 #ifdef BUILD_ENGINE_DIRECT3D
734 methods = evas_list_append(methods, strdup("direct3d"));
736 #ifdef BUILD_ENGINE_SOFTWARE_16_WINCE
737 methods = evas_list_append(methods, strdup("software_16_wince"));
739 #ifdef BUILD_ENGINE_SOFTWARE_X11
740 methods = evas_list_append(methods, strdup("software_x11"));
742 #ifdef BUILD_ENGINE_XRENDER_X11
743 methods = evas_list_append(methods, strdup("xrender_x11"));
745 #ifdef BUILD_ENGINE_SOFTWARE_XCB
746 methods = evas_list_append(methods, strdup("software_xcb"));
748 #ifdef BUILD_ENGINE_XRENDER_XCB
749 methods = evas_list_append(methods, strdup("xrender_xcb"));
751 #ifdef BUILD_ENGINE_SOFTWARE_16_X11
752 methods = evas_list_append(methods, strdup("software_16_x11"));
754 #ifdef BUILD_ENGINE_GL_X11
755 methods = evas_list_append(methods, strdup("gl_x11"));
757 #ifdef BUILD_ENGINE_GL_GLEW
758 methods = evas_list_append(methods, strdup("gl_glew"));
760 #ifdef BUILD_ENGINE_CAIRO_X11
761 methods = evas_list_append(methods, strdup("cairo_x11"));
763 #ifdef BUILD_ENGINE_DIRECTFB
764 methods = evas_list_append(methods, strdup("directfb"));
766 #ifdef BUILD_ENGINE_FB
767 methods = evas_list_append(methods, strdup("fb"));
769 #ifdef BUILD_ENGINE_BUFFER
770 methods = evas_list_append(methods, strdup("buffer"));
772 #ifdef BUILD_ENGINE_SOFTWARE_WIN32_GDI
773 methods = evas_list_append(methods, strdup("software_win32_gdi"));
775 #ifdef BUILD_ENGINE_SOFTWARE_QTOPIA
776 methods = evas_list_append(methods, strdup("software_qtopia"));
778 #ifdef BUILD_ENGINE_SDL
779 methods = evas_list_append(methods, strdup("software_sdl"));
786 * This function should be called to free a list of engine names
788 * @param list The Evas_List base pointer for the engine list to be freed
789 * @ingroup Evas_Output_Method
791 * When this function is called it will free the engine list passed in as
792 * @p list. The list should only be a list of engines generated by calling
793 * evas_render_method_list(). If @p list is NULL, nothing will happen.
797 * Evas_List *engine_list, *l;
799 * engine_list = evas_render_method_list();
802 * fprintf(stderr, "ERROR: Evas supports no engines! Exit.\n");
805 * printf("Availible Evas Engines:\n");
806 * for (l = engine_list; l; l = l->next)
810 * engine_name = l->data;
811 * printf("%s\n", engine_name);
813 * evas_render_method_list_free(engine_list);
817 evas_render_method_list_free(Evas_List *list)
822 list = evas_list_remove(list, list->data);
827 * @defgroup Evas_Pointer_Group Evas Pointer Functions
829 * Functions that deal with the status of the pointer.
833 * This function returns the current known pointer co-ordinates
835 * @param e The pointer to the Evas Canvas
836 * @param x The pointer to an integer to be filled in
837 * @param y The pointer to an integer to be filled in
838 * @ingroup Evas_Pointer_Group
840 * This function returns the current known screen/output co-ordinates of the
841 * mouse pointer and sets the contents of the integers pointed to by @p x
842 * and @p y to contain these co-ordinates. If @p e is not a valid canvas the
843 * results of this function are undefined.
848 * int mouse_x, mouse_y;
850 * evas_pointer_output_xy_get(evas, &mouse_x, &mouse_y);
851 * printf("Mouse is at screen position %i, %i\n", mouse_x, mouse_y);
855 evas_pointer_output_xy_get(const Evas *e, int *x, int *y)
857 MAGIC_CHECK(e, Evas, MAGIC_EVAS);
862 if (x) *x = e->pointer.x;
863 if (y) *y = e->pointer.y;
867 * This function returns the current known pointer co-ordinates
869 * @param e The pointer to the Evas Canvas
870 * @param x The pointer to a Evas_Coord to be filled in
871 * @param y The pointer to a Evas_Coord to be filled in
872 * @ingroup Evas_Pointer_Group
874 * This function returns the current known canvas unit co-ordinates of the
875 * mouse pointer and sets the contents of the Evas_Coords pointed to by @p x
876 * and @p y to contain these co-ordinates. If @p e is not a valid canvas the
877 * results of this function are undefined.
882 * Evas_Coord mouse_x, mouse_y;
884 * evas_pointer_output_xy_get(evas, &mouse_x, &mouse_y);
885 * printf("Mouse is at canvas position %f, %f\n", mouse_x, mouse_y);
889 evas_pointer_canvas_xy_get(const Evas *e, Evas_Coord *x, Evas_Coord *y)
891 MAGIC_CHECK(e, Evas, MAGIC_EVAS);
896 if (x) *x = e->pointer.x;
897 if (y) *y = e->pointer.y;
901 * Returns a bitmask with the mouse buttons currently pressed, set to 1
903 * @param e The pointer to the Evas Canvas
904 * @return A bitmask of the currently depressed buttons on the cavas
905 * @ingroup Evas_Pointer_Group
907 * Calling this function will return a 32-bit integer with the appropriate bits
908 * set to 1 that correspond to a mouse button being depressed. This limits
909 * Evas to a mouse devices with a maximum of 32 buttons, but that is generally
910 * in excess of any host system's pointing device abilities.
912 * A canvas by default begins with no mouse buttons being pressed and only
913 * calls to evas_event_feed_mouse_down(), evas_event_feed_mouse_down_data(),
914 * evas_event_feed_mouse_up() and evas_event_feed_mouse_up_data() will alter
917 * The least significant bit corresponds to the first mouse button (button 1)
918 * and the most significant bit corresponds to the last mouse button
921 * If @p e is not a valid canvas, the return value is undefined.
926 * int button_mask, i;
928 * button_mask = evas_pointer_button_down_mask_get(evas);
929 * printf("Buttons currently pressed:\n");
930 * for (i = 0; i < 32; i++)
932 * if ((button_mask & (1 << i)) != 0) printf("Button %i\n", i + 1);
937 evas_pointer_button_down_mask_get(const Evas *e)
939 MAGIC_CHECK(e, Evas, MAGIC_EVAS);
942 return (int)e->pointer.button;
946 * Returns whether the mouse pointer is logically inside the canvas
948 * @param e The pointer to the Evas Canvas
949 * @return An integer that is 1 if the mouse is inside the canvas, 0 otherwise
950 * @ingroup Evas_Pointer_Group
952 * When this function is called it will return a value of either 0 or 1,
953 * depending on if evas_event_feed_mouse_in(), evas_event_feed_mouse_in_data(),
954 * or evas_event_feed_mouse_out(), evas_event_feed_mouse_out_data() have been
955 * called to feed in a mouse enter event into the canvas.
957 * A return value of 1 indicates the mouse is logically inside the canvas, and
958 * 0 implies it is logically outside the canvas.
960 * A canvas begins with the mouse being assumed outside (0).
962 * If @p e is not a valid canvas, the return value is undefined.
968 * if (evas_pointer_inside_get(evas)) printf("Mouse is in!\n");
969 * else printf("Mouse is out!\n");
973 evas_pointer_inside_get(const Evas *e)
975 MAGIC_CHECK(e, Evas, MAGIC_EVAS);
978 return (int)e->pointer.inside;
982 * Attaches a specific pointer to the evas for fetching later
984 * @param e The canvas to attach the pointer to
985 * @param data The pointer to attach
988 evas_data_attach_set(Evas *e, void *data)
990 MAGIC_CHECK(e, Evas, MAGIC_EVAS);
993 e->attach_data = data;
997 * Returns the pointer attached by evas_data_attach_set()
999 * @param e The canvas to attach the pointer to
1000 * @return The pointer attached
1003 evas_data_attach_get(const Evas *e)
1005 MAGIC_CHECK(e, Evas, MAGIC_EVAS);
1008 return e->attach_data;
1018 _evas_unwalk(Evas *e)
1021 if ((e->walking_list == 0) && (e->delete_me)) evas_free(e);