Enlightenment CVS committal

Author  : moom
Project : e17
Module  : proto

Dir     : e17/proto/etk/src/engines/ecore_evas


Modified Files:
        ecore_evas.c 


Log Message:
* Write comments for engines
* Fix a leak in the engines


===================================================================
RCS file: /cvs/e/e17/proto/etk/src/engines/ecore_evas/ecore_evas.c,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -3 -r1.11 -r1.12
--- ecore_evas.c        3 Sep 2006 18:36:11 -0000       1.11
+++ ecore_evas.c        3 Sep 2006 21:15:31 -0000       1.12
@@ -8,6 +8,7 @@
 
 /* General engine functions */
 Etk_Engine *engine_open();
+void engine_close();
 
 static Etk_Bool _engine_init();
 static void _engine_shutdown();
@@ -43,8 +44,7 @@
 static Etk_Bool _window_decorated_get(Etk_Window *window);
 static void _window_shaped_set(Etk_Window *window, Etk_Bool shaped);  
 static Etk_Bool _window_shaped_get(Etk_Window *window);
-  
-/* Etk_Window callbacks */
+
 static void _window_move_cb(Ecore_Evas *ecore_evas);
 static void _window_resize_cb(Ecore_Evas *ecore_evas);
 static void _window_focus_in_cb(Ecore_Evas *ecore_evas);
@@ -52,6 +52,7 @@
 static void _window_sticky_changed_cb(Ecore_Evas *ecore_evas);
 static void _window_delete_request_cb(Ecore_Evas *ecore_evas);
 
+
 static Etk_Engine engine_info = {
    
    NULL, /* engine specific data */
@@ -103,7 +104,7 @@
    NULL, /* window_pointer_set */
    
    NULL, /* popup_window_constructor */
-   NULL, /* popup_window_popup_at_xy */
+   NULL, /* popup_window_popup */
    NULL, /* popup_window_popdown */
    
    NULL, /* event_callback_set */
@@ -130,6 +131,7 @@
  *
  **************************/
 
+/* Called when the engine is loaded */
 Etk_Engine *engine_open()
 {
    engine_info.engine_data = NULL;
@@ -137,6 +139,13 @@
    return &engine_info;
 }
 
+/* Called when the engine is unloaded */
+void engine_close()
+{
+   free(engine_info.engine_name);
+}
+
+/* Initializes the engine */
 static Etk_Bool _engine_init()
 {
    if (!ecore_evas_init())
@@ -147,6 +156,7 @@
    return ETK_TRUE;
 }
 
+/* Shutdowns the engine */
 static void _engine_shutdown()
 {
    ecore_evas_shutdown();
@@ -158,6 +168,7 @@
  *
  **************************/
 
+/* Initializes the created window */
 static void _window_constructor(Etk_Window *window)
 {
    Etk_Engine_Window_Data *engine_data;
@@ -165,7 +176,7 @@
    engine_data = window->engine_data;
 
    ETK_TOPLEVEL_WIDGET(window)->evas = ecore_evas_get(engine_data->ecore_evas);
-   ecore_evas_data_set(engine_data->ecore_evas, "etk_window", window);
+   ecore_evas_data_set(engine_data->ecore_evas, "_Etk_Engine::Window", window);
    ecore_evas_callback_move_set(engine_data->ecore_evas, _window_move_cb);
    ecore_evas_callback_resize_set(engine_data->ecore_evas, _window_resize_cb);
    ecore_evas_callback_focus_in_set(engine_data->ecore_evas, 
_window_focus_in_cb);
@@ -175,6 +186,7 @@
    ecore_evas_callback_delete_request_set(engine_data->ecore_evas, 
_window_delete_request_cb);
 }
 
+/* Destroys the window */
 static void _window_destructor(Etk_Window *window)
 {
    Etk_Engine_Window_Data *engine_data;
@@ -183,6 +195,7 @@
    ecore_evas_free(engine_data->ecore_evas);
 }
 
+/* Shows the window */
 static void _window_show(Etk_Window *window)
 {
    Etk_Engine_Window_Data *engine_data;
@@ -191,6 +204,7 @@
    ecore_evas_show(engine_data->ecore_evas);
 }
 
+/* Hides the window */
 static void _window_hide(Etk_Window *window)
 {
    Etk_Engine_Window_Data *engine_data;
@@ -199,6 +213,7 @@
    ecore_evas_hide(engine_data->ecore_evas);
 }
 
+/* Returns the evas of the window */
 static Evas *_window_evas_get(Etk_Window *window)
 {
    Etk_Engine_Window_Data *engine_data;
@@ -207,6 +222,7 @@
    return ecore_evas_get(engine_data->ecore_evas);
 }
 
+/* Sets the title of the window */
 static void _window_title_set(Etk_Window *window, const char *title)
 {
    Etk_Engine_Window_Data *engine_data;
@@ -216,6 +232,7 @@
    etk_object_notify(ETK_OBJECT(window), "title");
 }
 
+/* Returns the title of the window */
 static const char *_window_title_get(Etk_Window *window)
 {
    Etk_Engine_Window_Data *engine_data;
@@ -224,6 +241,7 @@
    return ecore_evas_title_get(engine_data->ecore_evas);
 }
 
+/* Sets the WM class of the window */
 static void _window_wmclass_set(Etk_Window *window, const char *window_name, 
const char *window_class)
 {
    Etk_Engine_Window_Data *engine_data;
@@ -232,6 +250,7 @@
    ecore_evas_name_class_set(engine_data->ecore_evas, window_name, 
window_class);
 }
 
+/* Moves the window to the given position */
 static void _window_move(Etk_Window *window, int x, int y)
 {
    Etk_Engine_Window_Data *engine_data;
@@ -240,6 +259,7 @@
    ecore_evas_move(engine_data->ecore_evas, x, y);
 }
 
+/* Resizes the window */
 static void _window_resize(Etk_Window *window, int w, int h)
 {
    Etk_Engine_Window_Data *engine_data;
@@ -252,6 +272,7 @@
    ecore_evas_resize(engine_data->ecore_evas, window->width, window->height);
 }
 
+/* Sets the minimum size of the window */
 static void _window_size_min_set(Etk_Window *window, int w, int h)
 {
    Etk_Engine_Window_Data *engine_data;
@@ -260,12 +281,14 @@
    ecore_evas_size_min_set(engine_data->ecore_evas, w, h);
 }
 
+/* Gets the position of the window, relative to the Evas where the widgets are 
drawn */
 static void _window_evas_position_get(Etk_Window *window, int *x, int *y)
 {
    if (x)   *x = 0;
    if (y)   *y = 0;
 }
 
+/* Gets the position of the window, relative to the screen */
 static void _window_screen_position_get(Etk_Window *window, int *x, int *y)
 {
    Etk_Engine_Window_Data *engine_data;
@@ -274,12 +297,14 @@
    ecore_evas_geometry_get(engine_data->ecore_evas, x, y, NULL, NULL);
 }
 
+/* Gets the size of the window */
 static void _window_size_get(Etk_Window *window, int *w, int *h)
 {
    if (w)   *w = window->width;
    if (h)   *h = window->height;
 }
 
+/* Sets whether or not the window is iconified */
 static void _window_iconified_set(Etk_Window *window, Etk_Bool iconified)
 {
    Etk_Engine_Window_Data *engine_data;
@@ -288,6 +313,7 @@
    ecore_evas_iconified_set(engine_data->ecore_evas, iconified);
 }
 
+/* Gets whether or not the window is iconified */
 static Etk_Bool _window_iconified_get(Etk_Window *window)
 {
    Etk_Engine_Window_Data *engine_data;
@@ -296,6 +322,7 @@
    return ecore_evas_iconified_get(engine_data->ecore_evas);
 }
 
+/* Sets whether or not the window is maximized */
 static void _window_maximized_set(Etk_Window *window, Etk_Bool maximized)
 {
    Etk_Engine_Window_Data *engine_data;
@@ -305,6 +332,7 @@
    etk_object_notify(ETK_OBJECT(window), "maximized");
 }
 
+/* Gets whether or not the window is maximized */
 Etk_Bool _window_maximized_get(Etk_Window *window)
 {
    Etk_Engine_Window_Data *engine_data;
@@ -313,6 +341,7 @@
    return ecore_evas_maximized_get(engine_data->ecore_evas);
 }
 
+/* Sets whether or not the window is in fullscreen mode */
 static void _window_fullscreen_set(Etk_Window *window, Etk_Bool fullscreen)
 {
    Etk_Engine_Window_Data *engine_data;
@@ -322,6 +351,7 @@
    etk_object_notify(ETK_OBJECT(window), "fullscreen");
 }
 
+/* Gets whether or not the window is in fullscreen mode */
 static Etk_Bool _window_fullscreen_get(Etk_Window *window)
 {
    Etk_Engine_Window_Data *engine_data;
@@ -330,6 +360,7 @@
    return ecore_evas_fullscreen_get(engine_data->ecore_evas);
 }
 
+/* Raises the window above the other windows */
 static void _window_raise(Etk_Window *window)
 {
    Etk_Engine_Window_Data *engine_data;
@@ -338,6 +369,7 @@
    return ecore_evas_raise(engine_data->ecore_evas);
 }
 
+/* Lowers the window below the other windows */
 static void _window_lower(Etk_Window *window)
 {
    Etk_Engine_Window_Data *engine_data;
@@ -346,6 +378,7 @@
    return ecore_evas_lower(engine_data->ecore_evas);
 }
 
+/* Sets whether or not the window is sticky (i.e. the window appears on all 
the virtual desks */
 static void _window_sticky_set(Etk_Window *window, Etk_Bool on)
 {
    Etk_Engine_Window_Data *engine_data;
@@ -354,6 +387,7 @@
    ecore_evas_sticky_set(engine_data->ecore_evas, on);
 }
 
+/* Gets whether or not the window is sticky */
 static Etk_Bool _window_sticky_get(Etk_Window *window)
 {
    Etk_Engine_Window_Data *engine_data;
@@ -362,6 +396,7 @@
    return ecore_evas_sticky_get(engine_data->ecore_evas);
 }
 
+/* Sets whether or not the window is focused */
 static void _window_focused_set(Etk_Window *window, Etk_Bool focused)
 {   
    Etk_Engine_Window_Data *engine_data;
@@ -370,6 +405,7 @@
    ecore_evas_focus_set(engine_data->ecore_evas, focused);
 }
 
+/* Gets whether or not the window is focused */
 static Etk_Bool _window_focused_get(Etk_Window *window)
 {
    Etk_Engine_Window_Data *engine_data;
@@ -378,6 +414,7 @@
    return ecore_evas_focus_get(engine_data->ecore_evas);
 }
 
+/* Sets whether or not the window is decorated (i.e. the window has a border) 
*/
 static void _window_decorated_set(Etk_Window *window, Etk_Bool decorated)
 {
    Etk_Engine_Window_Data *engine_data;
@@ -387,6 +424,7 @@
    etk_object_notify(ETK_OBJECT(window), "decorated");
 }
 
+/* Gets whether or not the window is decorated */
 static Etk_Bool _window_decorated_get(Etk_Window *window)
 {
    Etk_Engine_Window_Data *engine_data;
@@ -395,6 +433,7 @@
    return !ecore_evas_borderless_get(engine_data->ecore_evas);   
 }
 
+/* Sets whether or not the window is shaped (i.e. the window is not 
rectangular) */
 static void _window_shaped_set(Etk_Window *window, Etk_Bool shaped)
 {   
    Etk_Engine_Window_Data *engine_data;
@@ -404,6 +443,7 @@
    etk_object_notify(ETK_OBJECT(window), "shaped");
 }
 
+/* Gets whether or not the window is shaped */
 static Etk_Bool _window_shaped_get(Etk_Window *window)
 {
    Etk_Engine_Window_Data *engine_data;
@@ -423,20 +463,22 @@
 {
    Etk_Window *window;
    
-   if (!(window = ETK_WINDOW(ecore_evas_data_get(ecore_evas, "etk_window"))))
+   if (!(window = ETK_WINDOW(ecore_evas_data_get(ecore_evas, 
"_Etk_Engine::Window"))))
      return;
+   /* TODO: why use a func pointer here? */
    window->move_cb(window);
 }
-      
+
 /* Called when the window is resized */
 static void _window_resize_cb(Ecore_Evas *ecore_evas)
 {
    Etk_Window *window;
    
-   if (!(window = ETK_WINDOW(ecore_evas_data_get(ecore_evas, "etk_window"))))
+   if (!(window = ETK_WINDOW(ecore_evas_data_get(ecore_evas, 
"_Etk_Engine::Window"))))
      return;
    
    ecore_evas_geometry_get(ecore_evas, NULL, NULL, &window->width, 
&window->height);
+   /* TODO: why use a func pointer here? */
    window->resize_cb(window);
 }
 
@@ -445,8 +487,9 @@
 {
    Etk_Window *window;
    
-   if (!(window = ETK_WINDOW(ecore_evas_data_get(ecore_evas, "etk_window"))))
+   if (!(window = ETK_WINDOW(ecore_evas_data_get(ecore_evas, 
"_Etk_Engine::Window"))))
      return;
+   /* TODO: why use a func pointer here? We may just notify the "focused" 
property */
    window->focus_in_cb(window);
 }
 
@@ -455,8 +498,9 @@
 {
    Etk_Window *window;
    
-   if (!(window = ETK_WINDOW(ecore_evas_data_get(ecore_evas, "etk_window"))))
+   if (!(window = ETK_WINDOW(ecore_evas_data_get(ecore_evas, 
"_Etk_Engine::Window"))))
      return;
+   /* TODO: why use a func pointer here? We may just notify the "focused" 
property */
    window->focus_out_cb(window);
 }
 
@@ -465,8 +509,9 @@
 {
    Etk_Window *window;
    
-   if (!(window = ETK_WINDOW(ecore_evas_data_get(ecore_evas, "etk_window"))))
+   if (!(window = ETK_WINDOW(ecore_evas_data_get(ecore_evas, 
"_Etk_Engine::Window"))))
      return;
+   /* TODO: why use a func pointer here? We may just notify the "sticky" 
property */
    window->sticky_changed_cb(window);
 }
 
@@ -475,7 +520,8 @@
 {
    Etk_Window *window;
    
-   if (!(window = ETK_WINDOW(ecore_evas_data_get(ecore_evas, "etk_window"))))
+   if (!(window = ETK_WINDOW(ecore_evas_data_get(ecore_evas, 
"_Etk_Engine::Window"))))
      return;
+   /* TODO: why use a func pointer here? */
    window->delete_request_cb(window);   
 }



-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
enlightenment-cvs mailing list
enlightenment-cvs@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs

Reply via email to