From: ychouchane <fre...@gm...> - 2010-04-13 18:39:54
|
Hello, i m tring to make this : i want make a windows with little img following the mouse. for the moment i make this code : #include <Ecore.h> #include <Ecore_Evas.h> Evas_Object * zozor (Evas *evas,int move1,int move2) { Evas_Object *o; int iw, ih; o = evas_object_image_add (evas); evas_object_image_file_set (o, "zozor_transparent.png", NULL); evas_object_image_size_get(o, &iw, &ih); evas_object_image_size_set(o, iw, ih); evas_object_image_fill_set(o, 0, 0, iw, ih); evas_object_resize (o, iw, ih); evas_object_move (o, move1, move2); evas_object_show (o); return o; } void cb_down(void *data, Evas *e, Evas_Object *obj, void *event_info) { Evas_Event_Mouse_Move *event; // déclaration d'un évenement event = (Evas_Event_Mouse_Move *)event_info; //initialisation de la variable sur l'évenemnt produit par la souris printf("touche pressée: %d en coordonnée (%d,%d)\n", event->buttons,event->cur.output.x,event->cur.output.y );// Affiche la touche préssé zozor (e, event->cur.output.x,event->cur.output.y);// affiche un nouveau Zozor à l'applacemet du clique } int main (int argc, char *argv[]) { Ecore_Evas *ecran;//Déclaration de variable ecran, qui vas contenir nos images et autres ... Evas *evas; //Conteneur d'objet Evas_Object *surface_01; //Surface que l'on vas coloriser int iw,ih; if ( ecore_evas_init () == -1) // Démarrage des EFL. Si erreur alors... { printf( "Erreur d'initialisation des EFL "); // Ecriture de l'erreur exit(EXIT_FAILURE); // On quitte le programme } //NOTRE FENETRE VIDE ecran = ecore_evas_new ("software_x11", 0, 0, 800, 600, NULL); //On paramétre notre écran if (!ecran) // si probléme sur le driveur pour les EFL { ecore_evas_shutdown (); // Arrêt des EFL return EXIT_FAILURE; // On quitte le programme } ecore_evas_title_set(ecran, "Chargement d'images en Enlightenment !"); ecore_evas_show (ecran);// On affiche notre écran evas = ecore_evas_get (ecran);// conteneur qui prend notre écran //Notre surface qui vas contenir l'image surface_01 = evas_object_image_add (evas); evas_object_image_file_set (surface_01, "lac_en_montagne.jpg", NULL); evas_object_image_size_get(surface_01, &iw, &ih); evas_object_image_size_set(surface_01, iw, ih); evas_object_image_fill_set(surface_01, 0, 0, iw, ih); evas_object_resize (surface_01, iw, ih); evas_object_move (surface_01, 0, 0); evas_object_show (surface_01); evas_object_focus_set(surface_01 , 1); evas_object_event_callback_add(surface_01, EVAS_CALLBACK_MOUSE_MOVE, cb_down, NULL); //Fin du programme ecore_main_loop_begin();//notre bocle qui attend l'appuie sur la croix pour terminer le programme ecore_evas_shutdown (); // Arrêt des EFL (libération de la mémoire). return EXIT_SUCCESS; } but with this code i create a new evas object zozor every time i move my mouse. but if on my main, i create a new Evas object zozor, and i get focus on it, i can't move my evas_object zozor, so someon can explain me how focus object and make action on object not focus ? Thanks |