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 Log Message: Port of test app to ecore_evas, this should fix the problem with it's cpu hogging. =================================================================== RCS file: /cvsroot/enlightenment/e17/libs/etox/test/Etox_test.h,v retrieving revision 1.9 retrieving revision 1.10 diff -u -3 -r1.9 -r1.10 --- Etox_test.h 26 Jul 2003 06:35:22 -0000 1.9 +++ Etox_test.h 29 Jul 2003 03:17:51 -0000 1.10 @@ -10,6 +10,7 @@ #include <Evas_Engine_Software_X11.h> #include <Ecore.h> #include <Ecore_X.h> +#include <Ecore_Evas.h> #include "src/Etox.h" #include "etox-config.h" =================================================================== RCS file: /cvsroot/enlightenment/e17/libs/etox/test/etox_test.c,v retrieving revision 1.25 retrieving revision 1.26 diff -u -3 -r1.25 -r1.26 --- etox_test.c 26 Jul 2003 06:35:22 -0000 1.25 +++ etox_test.c 29 Jul 2003 03:17:51 -0000 1.26 @@ -9,6 +9,7 @@ Evas_Object *o_txt_prev_box; Evas_List *pbuttons; +Ecore_Evas *ee; Evas *evas; int render_method = 0; @@ -19,7 +20,6 @@ int win_w = W, win_h = H; int win_x = 0, win_y = 0; -Window main_win; double get_time(void) { @@ -30,30 +30,6 @@ (((double) timev.tv_usec) / 1000000); } -/* Events */ -int e_idle(void *data) -{ - evas_render(evas); - - return 1; - data = NULL; -} - -int e_window_expose(void *data, int type, void * ev) -{ - Ecore_X_Event_Window_Damage *e; - Evas_Engine_Info_Software_X11 *info; - - 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 1; - evas_damage_rectangle_add(evas, e->x, e->y, e->w, e->h); - return 1; - data = NULL; - type = 0; -} - int e_mouse_move(void *data, int type, void * ev) { Ecore_X_Event_Mouse_Move *e; @@ -238,7 +214,6 @@ void setup(void) { double width, height; - Window win, ewin; Evas_Object *o_bg; Evas_Object *o_bg_etox; char msg[] = @@ -251,70 +226,6 @@ "To start a test suite, select it from the\n" "navigation panel on the left.\n"; - /* setup callbacks for events */ - 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_idler_add(e_idle, NULL); - - /* create a toplevel window */ - 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 */ - /* also creates the window for us in the right colormap & visual */ - evas = evas_new(); - evas_output_method_set(evas, evas_render_method_lookup("software_x11")); - evas_output_size_set(evas, win_w, win_h); - evas_output_viewport_set(evas, 0, 0, win_w, win_h); - { - Display *disp; - Evas_Engine_Info_Software_X11 *info; - - 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_x_window_new(win, 0, 0, win_w, win_h); - - info->info.drawable = ewin; - info->info.depth = DefaultDepth(disp, DefaultScreen(disp)); - - evas_engine_info_set(evas, (Evas_Engine_Info *)info); - } - - evas_image_cache_set(evas, MAX_IMAGE_CACHE); - evas_font_cache_set(evas, MAX_FONT_CACHE); - evas_font_path_append(evas, FONT_DIRECTORY); - - /* get the window ID for the evas created for us */ - - /* show the evas window */ - ecore_x_window_show(ewin); - - /* set the events this window accepts */ - /* 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_x_window_show(win); - /* Create interface */ /* Background */ @@ -441,21 +352,30 @@ prev_test, NULL); } -int main(int argc, char **argv) +int main(int argc, const char **argv) { ecore_init(); + ecore_app_args_set(argc, argv); - /* init X */ - if (!ecore_x_init(NULL)) { - if (getenv("DISPLAY")) { - printf("Cannot initialize default display:\n"); - printf("DISPLAY=%s\n", getenv("DISPLAY")); - } else { - printf("No DISPLAY variable set!\n"); - } - printf("Exit.\n"); - exit(-1); - } + if (!ecore_evas_init()) + return -1; + + ee = ecore_evas_software_x11_new(NULL, 0, 0, 0, win_w, win_h); + if (!ee) + return 1; + + ecore_evas_title_set(ee, "Etox Selection Test"); + ecore_evas_show(ee); + + /* setup callbacks for events */ + 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); + + evas = ecore_evas_get(ee); + evas_font_path_append(evas, FONT_DIRECTORY); /* program does its data setup here */ setup(); =================================================================== RCS file: /cvsroot/enlightenment/e17/libs/etox/test/panel.c,v retrieving revision 1.8 retrieving revision 1.9 diff -u -3 -r1.8 -r1.9 --- panel.c 26 Jul 2003 06:35:22 -0000 1.8 +++ panel.c 29 Jul 2003 03:17:51 -0000 1.9 @@ -73,7 +73,7 @@ evas_object_text_font_set(o, "andover", 24); evas_object_text_text_set(o, _label); evas_object_color_set(o, 0, 0, 0, 160); - evas_object_layer_set(o, 250); + evas_object_layer_set(o, 251); evas_object_move(o, 15, y + 5); evas_object_show(o); pbutton->label = o; ------------------------------------------------------- This SF.Net email sponsored by: Free pre-built ASP.NET sites including Data Reports, E-commerce, Portals, and Forums are available now. Download today and enter to win an XBOX or Visual Studio .NET. http://aspnet.click-url.com/go/psa00100003ave/direct;at.aspnet_072303_01/01 _______________________________________________ enlightenment-cvs mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs