Enlightenment CVS committal

Author  : moom
Project : e17
Module  : proto

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


Modified Files:
        Etk_Engine_Ecore_Fb.h Makefile.am ecore_fb.c 


Log Message:
* [Engine] Update the Ecore_FB engine to the new engine API


===================================================================
RCS file: /cvs/e/e17/proto/etk/src/engines/ecore_fb/Etk_Engine_Ecore_Fb.h,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -3 -r1.1 -r1.2
--- Etk_Engine_Ecore_Fb.h       30 Jul 2006 21:09:32 -0000      1.1
+++ Etk_Engine_Ecore_Fb.h       5 Sep 2006 00:14:57 -0000       1.2
@@ -1,5 +1,5 @@
-#ifndef _ETK_ENGINE_ECORE_EVAS_FB_H
-#define _ETK_ENGINE_ECORE_EVAS_FB_H
+#ifndef _ETK_ENGINE_ECORE_EVAS_FB_H_
+#define _ETK_ENGINE_ECORE_EVAS_FB_H_
 
 #include <Evas.h>
 
===================================================================
RCS file: /cvs/e/e17/proto/etk/src/engines/ecore_fb/Makefile.am,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -3 -r1.3 -r1.4
--- Makefile.am 4 Aug 2006 18:46:26 -0000       1.3
+++ Makefile.am 5 Sep 2006 00:14:57 -0000       1.4
@@ -4,7 +4,7 @@
 
 INCLUDES = -I$(top_srcdir)/src/lib \
           -I$(top_srcdir)/src/engines/ecore_evas \
-          @EVAS_CFLAGS@ @ECORE_CFLAGS@ -g
+          @EVAS_CFLAGS@ @ECORE_CFLAGS@ -g -Wall
 
 pkgdir = $(libdir)/etk/engines
 
===================================================================
RCS file: /cvs/e/e17/proto/etk/src/engines/ecore_fb/ecore_fb.c,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -3 -r1.6 -r1.7
--- ecore_fb.c  7 Aug 2006 20:01:21 -0000       1.6
+++ ecore_fb.c  5 Sep 2006 00:14:57 -0000       1.7
@@ -1,32 +1,19 @@
 #include <stdio.h>
 #include <string.h>
 #include <stdlib.h>
-#include <limits.h>
 #include <Evas.h>
 #include <Edje.h>
 #include <Ecore_Evas.h>
 #include <Ecore_Fb.h>
-#include <Ecore_File.h>
-
-#include "etk_types.h"
-#include "etk_engine.h"
-#include "etk_signal.h"
-#include "etk_signal_callback.h"
-#include "etk_theme.h"
-#include "etk_utils.h"
-#include "config.h"
-
+#include <Etk.h>
 #include "Etk_Engine_Ecore_Fb.h"
+#include "config.h"
 
-/* TODO: prop notify ? */
-
-/* Engine specific data for Etk_Window
- * We do this to shorten the name for internal use */
 typedef Etk_Engine_Ecore_Fb_Window_Data Etk_Engine_Window_Data;
 
-
 /* General engine functions */
 Etk_Engine *engine_open();
+void engine_close();
 
 static Etk_Bool _engine_init();
 static void _engine_shutdown();
@@ -42,15 +29,35 @@
 static void _window_evas_position_get(Etk_Window *window, int *x, int *y);
 static void _window_screen_position_get(Etk_Window *window, int *x, int *y);
 static void _window_size_get(Etk_Window *window, int *w, int *h);
+static void _window_screen_geometry_get(Etk_Window *window, int *x, int *y, 
int *w, int *h);
 static void _window_raise(Etk_Window *window);
 static void _window_lower(Etk_Window *window);
 
-/* Handlers and callbacks */
-static int _mouse_move_handler(void *data, int ev_type, void *ev);
 static void _window_realized_cb(Etk_Object *object, void *data);
 static void _window_titlebar_mouse_down_cb(void *data, Evas_Object *obj, const 
char *emission, const char *source);
 static void _window_titlebar_mouse_up_cb(void *data, Evas_Object *obj, const 
char *emission, const char *source);
 
+/* Event and mouse functions */
+static void _event_callback_set(void (*callback)(Etk_Event_Type event, 
Etk_Event_Global event_info));
+static void _mouse_position_get(int *x, int *y);
+static void _mouse_screen_geometry_get(int *x, int *y, int *w, int *h);
+static int _mouse_move_handler_cb(void *data, int ev_type, void *ev);
+
+/* Private vars */
+static Ecore_Evas *_ecore_evas = NULL;
+static Evas *_evas = NULL;
+static Evas_Object *_background_object = NULL;
+static int _fb_width = 0;
+static int _fb_height = 0;
+
+static void (*_event_callback)(Etk_Event_Type event, Etk_Event_Global 
event_info) = NULL;
+static int _mouse_x = 0;
+static int _mouse_y = 0;
+static Etk_Window *_window_dragged = NULL;
+static int _window_drag_offset_x = 0;
+static int _window_drag_offset_y = 0;
+
+
 static Etk_Engine engine_info = {
    
    NULL, /* engine specific data */
@@ -75,8 +82,7 @@
    _window_evas_position_get,
    _window_screen_position_get,
    _window_size_get,
-   NULL, /* window_center_on_window */
-   NULL, /* window_move_to_mouse */
+   _window_screen_geometry_get,
    NULL, /* window_modal_for_window */
    NULL, /* window_iconified_set */
    NULL, /* window_iconified_get */
@@ -86,6 +92,8 @@
    NULL, /* window_fullscreen_get */
    _window_raise,
    _window_lower,
+   NULL, /* window_stacking_set */
+   NULL, /* window_stacking_get */
    NULL, /* window_sticky_set */
    NULL, /* window_sticky_get */
    NULL, /* window_focused_set */
@@ -98,15 +106,15 @@
    NULL, /* window_skip_taskbar_hint_get */
    NULL, /* window_skip_pager_hint_set */
    NULL, /* window_skip_pager_hint_get */
-   NULL, /* window_dnd_aware_set */
-   NULL, /* window_dnd_aware_get */
    NULL, /* window_pointer_set */
 
    NULL, /* popup_window_constructor */
-   NULL, /* popup_window_popup_at_xy */
    NULL, /* popup_window_popup */
    NULL, /* popup_window_popdown */
-   NULL, /* popup_window_popped_get */
+   
+   _event_callback_set,
+   _mouse_position_get,
+   _mouse_screen_geometry_get,
    
    NULL, /* drag_constructor */
    NULL, /* drag_begin */
@@ -122,25 +130,13 @@
    NULL, /* _selection_clear */
 };
 
-static Ecore_Evas *_ecore_evas = NULL;
-static Evas *_evas = NULL;
-static Evas_Object *_background_object = NULL;
-static int _fb_width = 0;
-static int _fb_height = 0;
-
-static int _mouse_x = 0;
-static int _mouse_y = 0;
-static Etk_Window *_drag_window = NULL;
-static int _drag_offset_x = 0;
-static int _drag_offset_y = 0;
-
 /**************************
  *
  * General engine functions
  *
  **************************/
 
-/* Opens the engine */
+/* Called when the engine is loaded */
 Etk_Engine *engine_open()
 {
    engine_info.engine_data = NULL;
@@ -148,13 +144,15 @@
    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()
 {
-   Ecore_List *files;
-   char *filename;
-   char device_path[PATH_MAX];
-   
    if (!ecore_fb_init(NULL))
    {
       ETK_WARNING("Ecore_Fb initialization failed!");
@@ -165,7 +163,7 @@
       ETK_WARNING("Ecore_Evas initialization failed!");
       return ETK_FALSE;
    }
-   ecore_event_handler_add(ECORE_FB_EVENT_MOUSE_MOVE, _mouse_move_handler, 
NULL);
+   ecore_event_handler_add(ECORE_FB_EVENT_MOUSE_MOVE, _mouse_move_handler_cb, 
NULL);
    ecore_fb_size_get(&_fb_width, &_fb_height);
    
    /* Create the evas where all the windows will be drawn */
@@ -186,6 +184,7 @@
    
    /* Create the background */
    _background_object = etk_theme_object_load(_evas, 
etk_theme_widget_theme_get(), "wm_background");
+   printf("Background Object: %s %p\n", etk_theme_widget_theme_get(), 
_background_object);
    evas_object_resize(_background_object, _fb_width, _fb_height);
    evas_object_show(_background_object);
   
@@ -199,7 +198,7 @@
    _ecore_evas = NULL;
    _evas = NULL;
    _background_object = NULL;
-   _drag_window = NULL;
+   _window_dragged = NULL;
    
    ecore_evas_shutdown();
    ecore_fb_shutdown();
@@ -337,6 +336,15 @@
    if (h)   *h = engine_data->size.h;
 }
 
+/* Gets the geometry of the screen containing the window */
+static void _window_screen_geometry_get(Etk_Window *window, int *x, int *y, 
int *w, int *h)
+{
+   if (x)   *x = 0;
+   if (y)   *y = 0;
+   if (w)   *w = _fb_width;
+   if (h)   *h = _fb_height;
+}
+
 /* Raises the window */
 static void _window_raise(Etk_Window *window)
 {
@@ -359,6 +367,34 @@
 
 /**************************
  *
+ * Etk_Event's functions
+ *
+ **************************/
+
+/* Sets the function to call when an input event is received */
+static void _event_callback_set(void (*callback)(Etk_Event_Type event, 
Etk_Event_Global event_info))
+{
+   _event_callback = callback;
+}
+
+/* Gets the position of the mouse pointer */
+static void _mouse_position_get(int *x, int *y)
+{
+   if (x)   *x = _mouse_x;
+   if (y)   *y = _mouse_y;
+}
+
+/* Gets the geometry of the screen containing the mouse pointer */
+static void _mouse_screen_geometry_get(int *x, int *y, int *w, int *h)
+{
+   if (x)   *x = 0;
+   if (y)   *y = 0;
+   if (w)   *w = _fb_width;
+   if (h)   *h = _fb_height;
+}
+
+/**************************
+ *
  * Handlers and callbacks
  *
  **************************/
@@ -398,9 +434,9 @@
       return;
    engine_data = window->engine_data;
    
-   _drag_window = window;
-   _drag_offset_x = _mouse_x - engine_data->border_position.x;
-   _drag_offset_y = _mouse_y - engine_data->border_position.y;
+   _window_dragged = window;
+   _window_drag_offset_x = _mouse_x - engine_data->border_position.x;
+   _window_drag_offset_y = _mouse_y - engine_data->border_position.y;
    
    etk_window_raise(window);
 }
@@ -408,11 +444,11 @@
 /* Called when the titlebar of the window is released */
 static void _window_titlebar_mouse_up_cb(void *data, Evas_Object *obj, const 
char *emission, const char *source)
 {
-   _drag_window = NULL;
+   _window_dragged = NULL;
 }
 
 /* Called when the mouse is moved */
-static int _mouse_move_handler(void *data, int ev_type, void *ev)
+static int _mouse_move_handler_cb(void *data, int ev_type, void *ev)
 {
    Ecore_Fb_Event_Mouse_Move *event = ev;
    
@@ -420,8 +456,8 @@
    _mouse_y = event->y;
    
    /* Move the window to drag */
-   if (_drag_window)
-      etk_window_move(_drag_window, _mouse_x - _drag_offset_x, _mouse_y - 
_drag_offset_y);
+   if (_window_dragged)
+      etk_window_move(_window_dragged, _mouse_x - _window_drag_offset_x, 
_mouse_y - _window_drag_offset_y);
    
    return 1;
 }



-------------------------------------------------------------------------
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