Hello everyone,
could anyone maybe help me to understand the attached Evas program. It
is a small example which changes the color of a centered rectangle with
mouse in/out.
I'm trying to understand why the mouse pointer is not being released
after a mouse click onto the rectangle with has pointer mode
EVAS_OBJECT_POINTER_MODE_NOGRAB_NO_REPEAT_UPDOWN. I would expect it to
_not_ grab the pointer.
Many thanks in advance!
Thomas
/*
* @verbatim
* gcc -o test_nograb_no_repeat_updown test_nograb_no_repeat_updown.c `pkg-config --libs --cflags evas ecore ecore-evas edje`
* @endverbatim
*/
#ifdef HAVE_CONFIG_H
# include "config.h"
#else
# define __UNUSED__
#endif
#include <Ecore.h>
#include <Ecore_Evas.h>
static void
_on_delete(Ecore_Evas *ee __UNUSED__)
{
ecore_main_loop_quit();
}
/* here just to keep our example's window size and background image's
* size in synchrony */
static void
_on_canvas_resize(Ecore_Evas *ee)
{
Evas_Object *bg;
int w;
int h;
bg = ecore_evas_data_get(ee, "background");
ecore_evas_geometry_get(ee, NULL, NULL, &w, &h);
evas_object_resize(bg, w, h);
}
static void
_on_mouse_in(void *data, Evas *evas, Evas_Object *o, void *einfo)
{
evas_object_color_set(o, 0, 255, 0, 255); // 100% opaque green
}
static void
_on_mouse_out(void *data, Evas *evas, Evas_Object *o, void *einfo)
{
evas_object_color_set(o, 255, 0, 0, 255); // 100% opaque red
}
int
main(int argc __UNUSED__, char *argv[])
{
Ecore_Evas *ee;
Evas *evas;
Evas_Object *bg;
if (!ecore_evas_init())
return EXIT_FAILURE;
if (!edje_init())
goto panic;
ee = ecore_evas_new(NULL, 0, 0, 500, 500, NULL);
if (!ee)
goto panic;
ecore_evas_callback_delete_request_set(ee, _on_delete);
ecore_evas_callback_resize_set(ee, _on_canvas_resize);
evas = ecore_evas_get(ee);
bg = evas_object_rectangle_add(evas);
evas_object_color_set(bg, 210, 210, 210, 255);
evas_object_move(bg, 0, 0);
evas_object_resize(bg, 500, 500);
evas_object_show(bg);
ecore_evas_data_set(ee, "background", bg);
Evas_Object *rect = evas_object_rectangle_add(evas);
evas_object_pointer_mode_set(rect, EVAS_OBJECT_POINTER_MODE_NOGRAB_NO_REPEAT_UPDOWN);
evas_object_color_set(rect, 255, 0, 0, 255); // 100% opaque red
evas_object_resize(rect, 160, 160);
evas_object_move(rect, 170, 170);
evas_object_show(rect);
evas_object_event_callback_add(rect, EVAS_CALLBACK_MOUSE_IN, _on_mouse_in, NULL);
evas_object_event_callback_add(rect, EVAS_CALLBACK_MOUSE_OUT, _on_mouse_out, NULL);
ecore_evas_show(ee);
ecore_main_loop_begin();
ecore_evas_hide(ee);
ecore_evas_free(ee);
ecore_evas_shutdown();
return EXIT_SUCCESS;
panic:
ecore_evas_shutdown();
return EXIT_FAILURE;
}
------------------------------------------------------------------------------
Android is increasing in popularity, but the open development platform that
developers love is also attractive to malware creators. Download this white
paper to learn more about secure code signing practices that can help keep
Android apps secure.
http://pubads.g.doubleclick.net/gampad/clk?id=65839951&iu=/4140/ostg.clktrk
_______________________________________________
enlightenment-devel mailing list
enlightenment-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-devel