Enlightenment CVS committal Author : rbdpngn Project : e17 Module : libs/etox
Dir : e17/libs/etox/test Modified Files: Etox_test.h etox_test.c panel.c panel.h Log Message: Updated test program to ecore2. =================================================================== RCS file: /cvsroot/enlightenment/e17/libs/etox/test/Etox_test.h,v retrieving revision 1.7 retrieving revision 1.8 diff -u -3 -r1.7 -r1.8 --- Etox_test.h 14 Jan 2003 18:43:21 -0000 1.7 +++ Etox_test.h 22 Jul 2003 15:01:27 -0000 1.8 @@ -9,6 +9,7 @@ #include <Evas.h> #include <Evas_Engine_Software_X11.h> #include <Ecore.h> +#include <Ecore_X.h> #include "src/Etox.h" #include "etox-config.h" @@ -60,15 +61,15 @@ /* callbacks for evas handling */ /* when the event queue goes idle call this */ -void e_idle(void *data); +int e_idle(void *data); /* when the window gets exposed call this */ -void e_window_expose(Ecore_Event * ev); +int e_window_expose(void *data, int type, void * ev); /* when the mouse moves in the window call this */ -void e_mouse_move(Ecore_Event * ev); +int e_mouse_move(void *data, int type, void * ev); /* when a mouse button goes down in the window call this */ -void e_mouse_down(Ecore_Event * ev); +int e_mouse_down(void *data, int type, void * ev); /* when a mouse button is released in the window call this */ -void e_mouse_up(Ecore_Event * ev); +int e_mouse_up(void *data, int type, void * ev); /* when the mouse moves over a button */ void button_mouse_in(void *_data, Evas *_e, Evas_Object *_o, void *event_info); @@ -78,8 +79,8 @@ void *event_info); /* button functions */ -void button_next_new_all(Evas _e); -void button_next_new(Evas _e); +void button_next_new_all(Evas *_e); +void button_next_new(Evas *_e); #include "panel.h" #include "tests.h" =================================================================== RCS file: /cvsroot/enlightenment/e17/libs/etox/test/etox_test.c,v retrieving revision 1.23 retrieving revision 1.24 diff -u -3 -r1.23 -r1.24 --- etox_test.c 24 Jan 2003 17:06:17 -0000 1.23 +++ etox_test.c 22 Jul 2003 15:01:27 -0000 1.24 @@ -31,60 +31,72 @@ } /* Events */ -void e_idle(void *data) +int e_idle(void *data) { evas_render(evas); - return; + return 1; data = NULL; } -void e_window_expose(Ecore_Event * ev) +int e_window_expose(void *data, int type, void * ev) { - Ecore_Event_Window_Expose *e; + Ecore_X_Event_Window_Damage *e; Evas_Engine_Info_Software_X11 *info; - e = (Ecore_Event_Window_Expose *) ev->event; + e = (Ecore_X_Event_Window_Damage *) ev; info = (Evas_Engine_Info_Software_X11 *)evas_engine_info_get(evas); if (e->win != info->info.drawable) - return; + return 1; evas_damage_rectangle_add(evas, e->x, e->y, e->w, e->h); + return 1; + data = NULL; + type = 0; } -void e_mouse_move(Ecore_Event * ev) +int e_mouse_move(void *data, int type, void * ev) { - Ecore_Event_Mouse_Move *e; + Ecore_X_Event_Mouse_Move *e; Evas_Engine_Info_Software_X11 *info; - e = (Ecore_Event_Mouse_Move *) ev->event; + e = (Ecore_X_Event_Mouse_Move *) ev; info = (Evas_Engine_Info_Software_X11 *)evas_engine_info_get(evas); if (e->win != info->info.drawable) - return; + return 1; evas_event_feed_mouse_move(evas, e->x, e->y); + return 1; + data = NULL; + type = 0; } -void e_mouse_down(Ecore_Event * ev) +int e_mouse_down(void *data, int type, void * ev) { - Ecore_Event_Mouse_Down *e; + Ecore_X_Event_Mouse_Button_Down *e; Evas_Engine_Info_Software_X11 *info; - e = (Ecore_Event_Mouse_Down *) ev->event; + e = (Ecore_X_Event_Mouse_Button_Down *) ev; info = (Evas_Engine_Info_Software_X11 *)evas_engine_info_get(evas); if (e->win != info->info.drawable) - return; + return 1; evas_event_feed_mouse_down(evas, e->button); + return 1; + data = NULL; + type = 0; } -void e_mouse_up(Ecore_Event * ev) +int e_mouse_up(void *data, int type, void * ev) { - Ecore_Event_Mouse_Up *e; + Ecore_X_Event_Mouse_Button_Up *e; Evas_Engine_Info_Software_X11 *info; - e = (Ecore_Event_Mouse_Up *) ev->event; + e = (Ecore_X_Event_Mouse_Button_Up *) ev; info = (Evas_Engine_Info_Software_X11 *)evas_engine_info_get(evas); if (e->win != info->info.drawable) - return; + return 1; evas_event_feed_mouse_up(evas, e->button); + return 1; + data = NULL; + type = 0; } void @@ -240,22 +252,22 @@ " navigation panel on the left.\n"; /* setup callbacks for events */ - ecore_event_filter_handler_add(ECORE_EVENT_WINDOW_EXPOSE, - e_window_expose); - ecore_event_filter_handler_add(ECORE_EVENT_MOUSE_MOVE, - e_mouse_move); - ecore_event_filter_handler_add(ECORE_EVENT_MOUSE_DOWN, - e_mouse_down); - ecore_event_filter_handler_add(ECORE_EVENT_MOUSE_UP, e_mouse_up); + ecore_event_handler_add(ECORE_X_EVENT_WINDOW_DAMAGE, e_window_expose, + NULL); + ecore_event_handler_add(ECORE_X_EVENT_MOUSE_MOVE, e_mouse_move, NULL); + ecore_event_handler_add(ECORE_X_EVENT_MOUSE_BUTTON_DOWN, e_mouse_down, + NULL); + ecore_event_handler_add(ECORE_X_EVENT_MOUSE_BUTTON_UP, e_mouse_up, + NULL); /* handler for when the event queue goes idle */ - ecore_event_filter_idle_handler_add(e_idle, NULL); + ecore_idler_add(e_idle, NULL); /* create a toplevel window */ - win = ecore_window_new(0, 0, 0, win_w, win_h); - ecore_window_set_title(win, "Etox Test"); - ecore_window_set_min_size(win, win_w, win_h); - ecore_window_set_max_size(win, win_w, win_h); + win = ecore_x_window_new(0, 0, 0, win_w, win_h); + ecore_x_window_prop_title_set(win, "Etox Test"); + ecore_x_window_prop_min_size_set(win, win_w, win_h); + ecore_x_window_prop_max_size_set(win, win_w, win_h); main_win = win; /* create a evas rendering in software - convenience function that */ @@ -268,14 +280,14 @@ Display *disp; Evas_Engine_Info_Software_X11 *info; - disp = ecore_display_get(); + disp = ecore_x_display_get(); info = (Evas_Engine_Info_Software_X11 *)evas_engine_info_get(evas); info->info.display = disp; info->info.visual = DefaultVisual(disp, DefaultScreen(disp)); info->info.colormap = DefaultColormap(disp, DefaultScreen(disp)); - ewin = ecore_window_new(win, 0, 0, win_w, win_h); + ewin = ecore_x_window_new(win, 0, 0, win_w, win_h); info->info.drawable = ewin; info->info.depth = DefaultDepth(disp, DefaultScreen(disp)); @@ -290,14 +302,18 @@ /* get the window ID for the evas created for us */ /* show the evas window */ - ecore_window_show(ewin); + ecore_x_window_show(ewin); /* set the events this window accepts */ - ecore_window_set_events(ewin, - XEV_EXPOSE | XEV_BUTTON | XEV_MOUSE_MOVE); + /* FIXME: What function is this now in ecore2? + ecore_window_set_events(ewin, ECORE_X_EVENT_MASK_WINDOW_DAMAGE | + ECORE_X_EVENT_MASK_MOUSE_DOWN | + ECORE_X_EVENT_MASK_MOUSE_UP | + ECORE_X_EVENT_MASK_MOUSE_MOVE); + */ /* show the toplevel */ - ecore_window_show(win); + ecore_x_window_show(win); /* Create interface */ @@ -424,15 +440,17 @@ evas_object_event_callback_add(o_txt_prev_box, EVAS_CALLBACK_MOUSE_DOWN, prev_test, NULL); - e_slide_panel_in(0, NULL); + e_slide_panel_in(NULL); } int main(int argc, char **argv) { Evas_List *l; + ecore_init(); + /* init X */ - if (!ecore_display_init(NULL)) { + if (!ecore_x_init(NULL)) { if (getenv("DISPLAY")) { printf("Cannot initialize default display:\n"); printf("DISPLAY=%s\n", getenv("DISPLAY")); @@ -443,20 +461,11 @@ exit(-1); } - /* setup handlers for system signals */ - ecore_event_signal_init(); - - /* setup the event filter */ - ecore_event_filter_init(); - - /* setup the X event internals */ - ecore_event_x_init(); - /* program does its data setup here */ setup(); /* and now loop forever handling events */ - ecore_event_loop(); + ecore_main_loop_begin(); etox_free(e_msg); etox_free(e_test); =================================================================== RCS file: /cvsroot/enlightenment/e17/libs/etox/test/panel.c,v retrieving revision 1.6 retrieving revision 1.7 diff -u -3 -r1.6 -r1.7 --- panel.c 14 Jan 2003 18:43:33 -0000 1.6 +++ panel.c 22 Jul 2003 15:01:27 -0000 1.7 @@ -9,9 +9,10 @@ int panel_active = 0; -void e_slide_panel_in(int v, void *data) +int e_slide_panel_in(void *data) { static double start = 0.0; + static int v = 0; double duration = 0.5; double val; double px; @@ -22,10 +23,12 @@ panel_active = 1; - if (v == 0) + if (v == 0) { evas_object_layer_set(o_showpanel, 180); - if (v == 0) start = get_time(); + v = 1; + } + val = (get_time() - start) / duration; evas_object_image_size_get(o_panel, &w, NULL); @@ -35,7 +38,7 @@ /* Pack the buttons in the panel in reverse */ for (l = pbuttons->last; l; l = l->prev) { if (!(pbutton = l->data)) - return; + return 0; evas_object_move(pbutton->box, px + 5, win_h - y_offset); evas_object_move(pbutton->label, px + 8, win_h - y_offset + 2); @@ -46,17 +49,19 @@ evas_object_image_fill_set(pbutton->box, 0, 0, 108, ascent - descent + 4); } - if (val < 1.0) - ecore_add_event_timer("e_slide_panel()", 0.05, - e_slide_panel_in, v + 1, NULL); + if (val >= 1.0) { + panel_active = 0; + return 0; + } - return; + return 1; data = NULL; } -void e_slide_panel_out(int v, void *data) +int e_slide_panel_out(void *data) { static double start = 0.0; + static int v = 0; double duration = 0.5; double val; double px; @@ -65,10 +70,12 @@ double ascent, descent; Evas_List *l; - if (v == 0) + if (v == 0) { evas_object_layer_set(o_showpanel, 1000); - if (v == 0) start = get_time(); + v = 1; + } + val = (get_time() - start) / duration; evas_object_image_size_get(o_panel, &w, NULL); @@ -78,7 +85,7 @@ /* Pack the buttons in the panel in reverse */ for (l = pbuttons->last; l; l = l->prev) { if (!(pbutton = l->data)) - return; + return 0; evas_object_move(pbutton->box, px + 5, win_h - y_offset); evas_object_move(pbutton->label, px + 8, win_h - y_offset + 2); y_offset += 40; @@ -88,13 +95,12 @@ evas_object_image_fill_set(pbutton->box, 0, 0, 108, ascent - descent + 4); } - if (val < 1.0) - ecore_add_event_timer("e_slide_panel()", 0.05, - e_slide_panel_out, v + 1, NULL); - else + if (val >= 1.0) { panel_active = 0; + return 0; + } - return; + return 1; data = NULL; } @@ -102,7 +108,7 @@ show_panel(void *_data, Evas *_e, Evas_Object *_o, void *event_info) { if (!panel_active) - e_slide_panel_in(0, NULL); + e_slide_panel_in(NULL); return; _data = NULL; @@ -115,7 +121,7 @@ hide_panel(void *_data, Evas *_e, Evas_Object *_o, void *event_info) { if (panel_active) - e_slide_panel_out(0, NULL); + e_slide_panel_out(NULL); return; _data = NULL; @@ -173,7 +179,7 @@ pbutton3 = panel_button(evas, "Callbacks", callback_tests()); pbuttons = evas_list_append(pbuttons, pbutton3); - e_slide_panel_out(0, NULL); + e_slide_panel_out(NULL); /* Callbacks */ evas_object_event_callback_add(o_showpanel, EVAS_CALLBACK_MOUSE_IN, show_panel, =================================================================== RCS file: /cvsroot/enlightenment/e17/libs/etox/test/panel.h,v retrieving revision 1.5 retrieving revision 1.6 diff -u -3 -r1.5 -r1.6 --- panel.h 14 Jan 2003 18:43:37 -0000 1.5 +++ panel.h 22 Jul 2003 15:01:27 -0000 1.6 @@ -1,8 +1,8 @@ #ifndef __PANEL_H__ #define __PANEL_H__ -void e_slide_panel_in(int v, void *data); -void e_slide_panel_out(int v, void *data); +int e_slide_panel_in(void *data); +int e_slide_panel_out(void *data); void show_panel(void *_data, Evas *_e, Evas_Object *_o, void *event_info); void hide_panel(void *_data, Evas *_e, Evas_Object *_o, void *event_info); void setup_panel(Evas *_e); ------------------------------------------------------- This SF.net email is sponsored by: VM Ware With VMware you can run multiple operating systems on a single machine. WITHOUT REBOOTING! Mix Linux / Windows / Novell virtual machines at the same time. Free trial click here: http://www.vmware.com/wl/offer/345/0 _______________________________________________ enlightenment-cvs mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs