forked from enlightenment/enlightenment
Changed observer/observee system to use E_EVENT's instead of ECORE_EVENT's.
The enum of events is in observer.h, add any you can think of. Switched desktops over to observer system (which extends objects). Added ferite functionality for desktop observers. I will probably make functions to observe most of e's subsystems (views, iconbars, etc). There is probably a small bit of memory leakage in here (and callbacks) because any objects passed along have to have their refcounts increased (so ferite doesn't automatically clean them up, and i haven't put in code to decrease them yet. It should be fairly small, but I'll work on that. I also changed a few "sprintf(buf..."'s to "snprintf(buf, PATH_MAX..."'s. Is this the way to go about preventing buffer overflows? I think that's it. SVN revision: 5841
This commit is contained in:
parent
83dc2cd3fb
commit
934f425342
|
@ -453,7 +453,7 @@ e_focus_in(Ecore_Event * ev)
|
||||||
e_border_focus_grab_ended();
|
e_border_focus_grab_ended();
|
||||||
b->current.selected = 1;
|
b->current.selected = 1;
|
||||||
b->changed = 1;
|
b->changed = 1;
|
||||||
e_observee_notify_observers(E_OBSERVEE(b), ECORE_EVENT_WINDOW_FOCUS_IN);
|
e_observee_notify_observers(E_OBSERVEE(b), E_EVENT_WINDOW_FOCUS_IN);
|
||||||
g = b->click_grab;
|
g = b->click_grab;
|
||||||
if (g)
|
if (g)
|
||||||
{
|
{
|
||||||
|
@ -2646,7 +2646,7 @@ e_border_init(void)
|
||||||
ecore_event_filter_idle_handler_add(e_idle, NULL);
|
ecore_event_filter_idle_handler_add(e_idle, NULL);
|
||||||
|
|
||||||
delayed_window_raise =
|
delayed_window_raise =
|
||||||
e_delayed_action_new(ECORE_EVENT_WINDOW_FOCUS_IN,
|
e_delayed_action_new(E_EVENT_WINDOW_FOCUS_IN,
|
||||||
raise_delay, e_border_raise_delayed);
|
raise_delay, e_border_raise_delayed);
|
||||||
|
|
||||||
ecore_add_event_timer("e_border_poll()", 1.00, e_border_poll, 0, NULL);
|
ecore_add_event_timer("e_border_poll()", 1.00, e_border_poll, 0, NULL);
|
||||||
|
|
|
@ -15,7 +15,7 @@ e_delayed_action_cleanup(E_Delayed_Action *eda)
|
||||||
|
|
||||||
|
|
||||||
E_Delayed_Action *
|
E_Delayed_Action *
|
||||||
e_delayed_action_new(Ecore_Event_Type event,
|
e_delayed_action_new(E_Event_Type event,
|
||||||
double delay, E_Delay_Func delay_func)
|
double delay, E_Delay_Func delay_func)
|
||||||
{
|
{
|
||||||
E_Delayed_Action *eda = NULL;
|
E_Delayed_Action *eda = NULL;
|
||||||
|
|
|
@ -16,7 +16,7 @@ typedef struct _e_delayed_action
|
||||||
} E_Delayed_Action;
|
} E_Delayed_Action;
|
||||||
|
|
||||||
|
|
||||||
E_Delayed_Action *e_delayed_action_new(Ecore_Event_Type event,
|
E_Delayed_Action *e_delayed_action_new(E_Event_Type event,
|
||||||
double delay, E_Delay_Func delay_func);
|
double delay, E_Delay_Func delay_func);
|
||||||
|
|
||||||
void e_delayed_action_start(E_Observer *obs, E_Observee *obj);
|
void e_delayed_action_start(E_Observer *obs, E_Observee *obj);
|
||||||
|
|
|
@ -240,7 +240,7 @@ e_desktops_new(void)
|
||||||
desk = NEW(E_Desktop, 1);
|
desk = NEW(E_Desktop, 1);
|
||||||
ZERO(desk, E_Desktop, 1);
|
ZERO(desk, E_Desktop, 1);
|
||||||
|
|
||||||
e_object_init(E_OBJECT(desk), (E_Cleanup_Func) e_desktops_cleanup);
|
e_observee_init(E_OBSERVEE(desk), (E_Cleanup_Func) e_desktops_cleanup);
|
||||||
|
|
||||||
desk->win.main = ecore_window_override_new(e_base_win, 0, 0, screen_w, screen_h);
|
desk->win.main = ecore_window_override_new(e_base_win, 0, 0, screen_w, screen_h);
|
||||||
desk->win.container = ecore_window_override_new(desk->win.main, 0, 0, screen_w, screen_h);
|
desk->win.container = ecore_window_override_new(desk->win.main, 0, 0, screen_w, screen_h);
|
||||||
|
@ -362,6 +362,7 @@ e_desktops_goto_desk(int d)
|
||||||
|
|
||||||
e_desktops_goto(d, 0, 0);
|
e_desktops_goto(d, 0, 0);
|
||||||
|
|
||||||
|
|
||||||
D_RETURN;
|
D_RETURN;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -421,7 +422,16 @@ e_desktops_goto(int d, int ax, int ay)
|
||||||
desk->desk.area.y = ay;
|
desk->desk.area.y = ay;
|
||||||
e_icccm_set_desk_area(0, desk->desk.area.x, desk->desk.area.y);
|
e_icccm_set_desk_area(0, desk->desk.area.x, desk->desk.area.y);
|
||||||
e_icccm_set_desk(0, desk->desk.desk);
|
e_icccm_set_desk(0, desk->desk.desk);
|
||||||
|
e_observee_notify_observers(E_OBSERVEE(desk), E_EVENT_DESKTOP_SWITCH);
|
||||||
}
|
}
|
||||||
|
|
||||||
D_RETURN;
|
D_RETURN;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Evas_List
|
||||||
|
e_desktops_get_desktops_list()
|
||||||
|
{
|
||||||
|
D_ENTER;
|
||||||
|
D_RETURN_(desktops);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
|
@ -13,7 +13,7 @@ typedef struct _E_Desktop E_Desktop;
|
||||||
|
|
||||||
struct _E_Desktop
|
struct _E_Desktop
|
||||||
{
|
{
|
||||||
E_Object o;
|
E_Observee obs;
|
||||||
|
|
||||||
char *name;
|
char *name;
|
||||||
char *dir;
|
char *dir;
|
||||||
|
@ -83,5 +83,6 @@ E_Desktop *e_desktops_get(int d);
|
||||||
int e_desktops_get_current(void);
|
int e_desktops_get_current(void);
|
||||||
void e_desktops_goto_desk(int d);
|
void e_desktops_goto_desk(int d);
|
||||||
void e_desktops_goto(int d, int ax, int ay);
|
void e_desktops_goto(int d, int ax, int ay);
|
||||||
|
Evas_List e_desktops_get_desktops_list();
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -8,6 +8,7 @@ header %{
|
||||||
#include "epplet.h"
|
#include "epplet.h"
|
||||||
#include "debug.h"
|
#include "debug.h"
|
||||||
#include "globals.h"
|
#include "globals.h"
|
||||||
|
#include "observer.h"
|
||||||
|
|
||||||
#define BitsObj ((Ebits_Object)self->odata)
|
#define BitsObj ((Ebits_Object)self->odata)
|
||||||
#define EppObj ((E_Epplet *)(self->odata))
|
#define EppObj ((E_Epplet *)(self->odata))
|
||||||
|
@ -77,6 +78,7 @@ namespace e {
|
||||||
%{
|
%{
|
||||||
ecore_event_loop_quit();
|
ecore_event_loop_quit();
|
||||||
%}
|
%}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
class EvasObject
|
class EvasObject
|
||||||
|
@ -232,8 +234,6 @@ class EvasObject
|
||||||
%{
|
%{
|
||||||
E_Epplet_CB_Info *cb;
|
E_Epplet_CB_Info *cb;
|
||||||
|
|
||||||
D("create cb\n");
|
|
||||||
|
|
||||||
cb = e_epplet_cb_new(script, func, data, self);
|
cb = e_epplet_cb_new(script, func, data, self);
|
||||||
|
|
||||||
D("check for callback type\n");
|
D("check for callback type\n");
|
||||||
|
@ -258,7 +258,7 @@ class EvasObject
|
||||||
e_epplet_evas_cb, cb);
|
e_epplet_evas_cb, cb);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ffree(func);
|
ffree(func);
|
||||||
ffree(type);
|
ffree(type);
|
||||||
%}
|
%}
|
||||||
|
|
||||||
|
@ -472,7 +472,6 @@ class Epplet
|
||||||
{
|
{
|
||||||
D("adding bits for epplet `%s'\n", EppObj->context->name);
|
D("adding bits for epplet `%s'\n", EppObj->context->name);
|
||||||
D("x: %f, y: %f, w: %f, h: %f\n", EppObj->context->geom.x, EppObj->context->geom.y, EppObj->context->geom.w, EppObj->context->geom.h);
|
D("x: %f, y: %f, w: %f, h: %f\n", EppObj->context->geom.x, EppObj->context->geom.y, EppObj->context->geom.w, EppObj->context->geom.h);
|
||||||
// ebits_add_to_evas(EppObj->bits, EppObj->view->evas);
|
|
||||||
ebits_show(EppObj->bits);
|
ebits_show(EppObj->bits);
|
||||||
|
|
||||||
if ((EppObj->context->geom.w) && (EppObj->context->geom.h))
|
if ((EppObj->context->geom.w) && (EppObj->context->geom.h))
|
||||||
|
@ -538,5 +537,38 @@ class Epplet
|
||||||
FE_RETURN_STR(retval, 0);
|
FE_RETURN_STR(retval, 0);
|
||||||
%}
|
%}
|
||||||
|
|
||||||
|
/* This doesn't work Yet */
|
||||||
|
/*
|
||||||
|
function addTimer(string name, number time, string func, number val, object data)
|
||||||
|
%{
|
||||||
|
char *buf;
|
||||||
|
E_Epplet_CB_Info *cb;
|
||||||
|
|
||||||
|
cb = e_epplet_cb_new(script, func, data, NULL);
|
||||||
|
D("got cb info\n")
|
||||||
|
sprintf(buf, "%s:%s", EppObj->name, name);
|
||||||
|
D("add timer: %s, time: %f\n", buf, time);
|
||||||
|
ecore_add_event_timer(buf, time, e_epplet_timer_func, val, cb);
|
||||||
|
D("timer added\n");
|
||||||
|
ffree(func);
|
||||||
|
%}
|
||||||
|
|
||||||
|
function delTimer(string name)
|
||||||
|
%{
|
||||||
|
char *buf;
|
||||||
|
|
||||||
|
sprintf(buf, "%s:%s", EppObj->name, name);
|
||||||
|
ecore_del_event_timer(buf);
|
||||||
|
ffree(name);
|
||||||
|
%}
|
||||||
|
*/
|
||||||
|
function addDesktopObserver(string func_name, object data)
|
||||||
|
%{
|
||||||
|
E_Epplet_Observer *obs;
|
||||||
|
|
||||||
|
obs = e_epplet_observer_new(script, func_name, data);
|
||||||
|
e_epplet_observer_register_desktops(obs);
|
||||||
|
ffree(func_name);
|
||||||
|
%}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
162
src/epplet.c
162
src/epplet.c
|
@ -2,6 +2,8 @@
|
||||||
#include "epplet.h"
|
#include "epplet.h"
|
||||||
#include "globals.h"
|
#include "globals.h"
|
||||||
#include "file.h"
|
#include "file.h"
|
||||||
|
#include "observer.h"
|
||||||
|
#include "desktops.h"
|
||||||
|
|
||||||
#include "e_ferite.h"
|
#include "e_ferite.h"
|
||||||
|
|
||||||
|
@ -17,6 +19,7 @@ static void e_epplet_mouse_move_cb (void *_data, Ebits_Object _o,
|
||||||
char *_c, int _b, int _x, int _y,
|
char *_c, int _b, int _x, int _y,
|
||||||
int _ox, int _oy, int _ow, int _oh);
|
int _ox, int _oy, int _ow, int _oh);
|
||||||
|
|
||||||
|
static void e_epplet_observer_cleanup(E_Object *o);
|
||||||
|
|
||||||
void
|
void
|
||||||
e_epplet_load_from_layout (E_View * v)
|
e_epplet_load_from_layout (E_View * v)
|
||||||
|
@ -26,7 +29,7 @@ e_epplet_load_from_layout (E_View * v)
|
||||||
|
|
||||||
D_ENTER;
|
D_ENTER;
|
||||||
|
|
||||||
sprintf (buf, "%s/.e_epplets.bits.db", v->dir);
|
snprintf (buf, PATH_MAX, "%s/.e_epplets.bits.db", v->dir);
|
||||||
v->epplet_layout = ebits_load (buf);
|
v->epplet_layout = ebits_load (buf);
|
||||||
if (!v->epplet_layout)
|
if (!v->epplet_layout)
|
||||||
D_RETURN;
|
D_RETURN;
|
||||||
|
@ -59,7 +62,7 @@ e_epplet_load_from_layout (E_View * v)
|
||||||
|
|
||||||
v->epplet_contexts = evas_list_append (v->epplet_contexts, context);
|
v->epplet_contexts = evas_list_append (v->epplet_contexts, context);
|
||||||
|
|
||||||
sprintf (buf, "%s%s/%s.fe", e_config_get ("epplets"), context->name,
|
snprintf (buf, PATH_MAX, "%s%s/%s.fe", e_config_get ("epplets"), context->name,
|
||||||
context->name);
|
context->name);
|
||||||
if (e_file_exists (buf))
|
if (e_file_exists (buf))
|
||||||
e_epplet_script_load (context, buf);
|
e_epplet_script_load (context, buf);
|
||||||
|
@ -404,32 +407,14 @@ e_epplet_cb_new( FeriteScript *script, char *func_name, FeriteObject *data, Feri
|
||||||
cb = NEW(E_Epplet_CB_Info, 1);
|
cb = NEW(E_Epplet_CB_Info, 1);
|
||||||
ZERO(cb, E_Epplet_CB_Info, 1);
|
ZERO(cb, E_Epplet_CB_Info, 1);
|
||||||
|
|
||||||
if (data && data2)
|
|
||||||
{ D("d1: %s, d2: %s\n", data->name, data2->name);}
|
|
||||||
|
|
||||||
nsb = __ferite_find_namespace( script, script->mainns, func_name, FENS_FNC);
|
nsb = __ferite_find_namespace( script, script->mainns, func_name, FENS_FNC);
|
||||||
if (nsb != NULL)
|
if (nsb != NULL)
|
||||||
{
|
{
|
||||||
D("setting cb info\n");
|
|
||||||
cb->func = nsb->data;
|
cb->func = nsb->data;
|
||||||
if (data)
|
if (data)
|
||||||
{
|
{
|
||||||
cb->data = data;
|
cb->data = data;
|
||||||
data->refcount++;
|
data->refcount++;
|
||||||
/* cb->data = fmalloc(sizeof(FeriteObject));
|
|
||||||
memset(cb->data, 0, sizeof(FeriteObject));
|
|
||||||
|
|
||||||
cb->data->name = data->name;
|
|
||||||
cb->data->oid = data->oid;
|
|
||||||
cb->data->odata = data->odata;
|
|
||||||
cb->data->refcount = data->refcount;
|
|
||||||
cb->data-> = data->;
|
|
||||||
cb->data-> = data->;
|
|
||||||
cb->data-> = data->;
|
|
||||||
cb->data-> = data->;
|
|
||||||
cb->data-> = data->;
|
|
||||||
cb->data-> = data->;
|
|
||||||
*/
|
|
||||||
}
|
}
|
||||||
if (data2)
|
if (data2)
|
||||||
{
|
{
|
||||||
|
@ -437,12 +422,28 @@ e_epplet_cb_new( FeriteScript *script, char *func_name, FeriteObject *data, Feri
|
||||||
data2->refcount++;
|
data2->refcount++;
|
||||||
}
|
}
|
||||||
cb->script = script;
|
cb->script = script;
|
||||||
D("cb info set\n");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
D_RETURN_(cb);
|
D_RETURN_(cb);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
e_epplet_cb_cleanup(E_Epplet_CB_Info *cb)
|
||||||
|
{
|
||||||
|
if (cb->data)
|
||||||
|
{
|
||||||
|
cb->data->refcount--;
|
||||||
|
cb->data = NULL;
|
||||||
|
}
|
||||||
|
if (cb->data2)
|
||||||
|
{
|
||||||
|
cb->data2->refcount--;
|
||||||
|
cb->data2 = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
free(cb);
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
e_epplet_bits_cb (void *_data, Ebits_Object _o,
|
e_epplet_bits_cb (void *_data, Ebits_Object _o,
|
||||||
char *_c, int _b, int _x, int _y,
|
char *_c, int _b, int _x, int _y,
|
||||||
|
@ -467,6 +468,7 @@ e_epplet_bits_cb (void *_data, Ebits_Object _o,
|
||||||
{
|
{
|
||||||
D("ERROR: script does not exist\n");
|
D("ERROR: script does not exist\n");
|
||||||
}
|
}
|
||||||
|
/* e_epplet_cb_cleanup(cb); */
|
||||||
D_RETURN;
|
D_RETURN;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -488,6 +490,34 @@ e_epplet_evas_cb (void *_data, Evas _e, Evas_Object _o,
|
||||||
D("creating params\n");
|
D("creating params\n");
|
||||||
params = __ferite_create_parameter_list_from_data( cb->script, "oonnn",
|
params = __ferite_create_parameter_list_from_data( cb->script, "oonnn",
|
||||||
cb->data, cb->data2, (double)_b, (double)_x, (double)_y );
|
cb->data, cb->data2, (double)_b, (double)_x, (double)_y );
|
||||||
|
D("calling func: %s\n", cb->func->name);
|
||||||
|
__ferite_variable_destroy( cb->script, __ferite_call_function( cb->script, cb->func, params));
|
||||||
|
__ferite_delete_parameter_list( cb->script, params );
|
||||||
|
D("func called, params deleted\n");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
D("ERROR: script does not exist\n");
|
||||||
|
}
|
||||||
|
/* e_epplet_cb_cleanup(cb); */
|
||||||
|
D_RETURN;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* somthing is wrong here. segfault when calling ferite function */
|
||||||
|
void
|
||||||
|
e_epplet_timer_func(int val, void *data)
|
||||||
|
{
|
||||||
|
E_Epplet_CB_Info *cb;
|
||||||
|
FeriteVariable **params;
|
||||||
|
|
||||||
|
D_ENTER;
|
||||||
|
D("in timer func\n");
|
||||||
|
cb = data;
|
||||||
|
|
||||||
|
if (cb->script) {
|
||||||
|
D("creating params\n");
|
||||||
|
params = __ferite_create_parameter_list_from_data( cb->script, "on",
|
||||||
|
cb->data, (float)val );
|
||||||
D("calling func\n");
|
D("calling func\n");
|
||||||
__ferite_variable_destroy( cb->script, __ferite_call_function( cb->script, cb->func, params));
|
__ferite_variable_destroy( cb->script, __ferite_call_function( cb->script, cb->func, params));
|
||||||
__ferite_delete_parameter_list( cb->script, params );
|
__ferite_delete_parameter_list( cb->script, params );
|
||||||
|
@ -497,6 +527,96 @@ e_epplet_evas_cb (void *_data, Evas _e, Evas_Object _o,
|
||||||
{
|
{
|
||||||
D("ERROR: script does not exist\n");
|
D("ERROR: script does not exist\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* e_epplet_cb_cleanup(cb); */
|
||||||
|
D_RETURN;
|
||||||
|
}
|
||||||
|
|
||||||
|
E_Epplet_Observer *
|
||||||
|
e_epplet_observer_new(FeriteScript *script, char *func_name, FeriteObject *data)
|
||||||
|
{
|
||||||
|
E_Epplet_Observer *obs;
|
||||||
|
FeriteNamespaceBucket *nsb;
|
||||||
|
|
||||||
|
D_ENTER;
|
||||||
|
|
||||||
|
obs = NEW(E_Epplet_Observer, 1);
|
||||||
|
memset(obs, 0, sizeof(E_Epplet_Observer));
|
||||||
|
|
||||||
|
|
||||||
|
nsb = __ferite_find_namespace( script, script->mainns, func_name, FENS_FNC);
|
||||||
|
if (nsb != NULL)
|
||||||
|
{
|
||||||
|
e_observer_init(E_OBSERVER(obs), E_EVENT_DESKTOP_SWITCH,
|
||||||
|
e_epplet_desktop_observer_func, (E_Cleanup_Func)e_epplet_observer_cleanup);
|
||||||
|
D("initted, event: %i\n", E_OBSERVER(obs)->event);
|
||||||
|
|
||||||
|
obs->script = script;
|
||||||
|
obs->func = nsb->data;
|
||||||
|
if (data)
|
||||||
|
{
|
||||||
|
((E_Epplet_Observer *)obs)->data = data;
|
||||||
|
data->refcount++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
D("returning, event: %i\n", E_OBSERVER(obs)->event);
|
||||||
|
D_RETURN_(obs);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
e_epplet_observer_cleanup(E_Object *o)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
e_epplet_observer_register_desktops(E_Epplet_Observer *obs)
|
||||||
|
{
|
||||||
|
Evas_List l;
|
||||||
|
|
||||||
|
D_ENTER;
|
||||||
|
D("odeskregister, bserver func: %s\n", obs->func->name);
|
||||||
|
D("register each desktop in list\n");
|
||||||
|
for (l = e_desktops_get_desktops_list(); l; l = l->next)
|
||||||
|
{
|
||||||
|
E_Desktop *d = l->data;
|
||||||
|
D("registering desktop...\n")
|
||||||
|
e_observer_register_observee(E_OBSERVER(obs), E_OBSERVEE(d));
|
||||||
|
D("desktop registered\n")
|
||||||
|
}
|
||||||
|
D_RETURN;
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
e_epplet_desktop_observer_func(E_Observer *observer, E_Observee *observee)
|
||||||
|
{
|
||||||
|
E_Epplet_Observer *obs;
|
||||||
|
E_Desktop *desk;
|
||||||
|
FeriteVariable **params;
|
||||||
|
|
||||||
|
D_ENTER;
|
||||||
|
|
||||||
|
obs = (E_Epplet_Observer *)observer;
|
||||||
|
desk = (E_Desktop *)observee;
|
||||||
|
|
||||||
|
D("desktop: %i\n", desk->desk.desk);
|
||||||
|
D("current: %i\n", e_desktops_get_current());
|
||||||
|
if (obs->script)
|
||||||
|
{
|
||||||
|
D("creating params\n");
|
||||||
|
|
||||||
|
params = __ferite_create_parameter_list_from_data( obs->script, "on",
|
||||||
|
obs->data, (float)(desk->desk.desk) );
|
||||||
|
D("calling func: %s\n", obs->func->name);
|
||||||
|
__ferite_variable_destroy( obs->script, __ferite_call_function(
|
||||||
|
obs->script, obs->func, params));
|
||||||
|
D("function called\n");
|
||||||
|
__ferite_delete_parameter_list( obs->script, params );
|
||||||
|
D("func called, params deleted\n");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
D("ERROR: script does not exist\n");
|
||||||
|
}
|
||||||
D_RETURN;
|
D_RETURN;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
24
src/epplet.h
24
src/epplet.h
|
@ -3,13 +3,23 @@
|
||||||
|
|
||||||
#include "e.h"
|
#include "e.h"
|
||||||
#include "view.h"
|
#include "view.h"
|
||||||
|
#include "observer.h"
|
||||||
#include "e_ferite.h"
|
#include "e_ferite.h"
|
||||||
|
|
||||||
typedef struct _E_Epplet E_Epplet;
|
typedef struct _E_Epplet E_Epplet;
|
||||||
typedef struct _E_Epplet_Context E_Epplet_Context;
|
typedef struct _E_Epplet_Context E_Epplet_Context;
|
||||||
typedef struct _E_Epplet_CB_Info E_Epplet_CB_Info;
|
typedef struct _E_Epplet_CB_Info E_Epplet_CB_Info;
|
||||||
typedef struct _Evas_Object_Wrapper Evas_Object_Wrapper;
|
typedef struct _Evas_Object_Wrapper Evas_Object_Wrapper;
|
||||||
|
typedef struct _E_Epplet_Observer E_Epplet_Observer;
|
||||||
|
|
||||||
|
struct _E_Epplet_Observer
|
||||||
|
{
|
||||||
|
E_Observer o;
|
||||||
|
|
||||||
|
FeriteScript *script;
|
||||||
|
FeriteFunction *func;
|
||||||
|
FeriteObject *data;
|
||||||
|
};
|
||||||
|
|
||||||
struct _E_Epplet_CB_Info
|
struct _E_Epplet_CB_Info
|
||||||
{
|
{
|
||||||
|
@ -19,7 +29,6 @@ struct _E_Epplet_CB_Info
|
||||||
FeriteObject *data2;
|
FeriteObject *data2;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
struct _E_Epplet_Context
|
struct _E_Epplet_Context
|
||||||
{
|
{
|
||||||
char *name;
|
char *name;
|
||||||
|
@ -72,10 +81,17 @@ void e_epplet_load_from_layout(E_View *v);
|
||||||
E_Epplet_Context *e_epplet_get_context_from_script(FeriteScript *script);
|
E_Epplet_Context *e_epplet_get_context_from_script(FeriteScript *script);
|
||||||
void e_epplet_script_load(E_Epplet_Context *v, char *script_path);
|
void e_epplet_script_load(E_Epplet_Context *v, char *script_path);
|
||||||
void e_epplet_set_common_callbacks(E_Epplet *epp);
|
void e_epplet_set_common_callbacks(E_Epplet *epp);
|
||||||
E_Epplet_CB_Info *e_epplet_cb_new( FeriteScript *script, char *func_name, FeriteObject *data, FeriteObject *data2 );
|
E_Epplet_CB_Info *e_epplet_cb_new( FeriteScript *script, char *func_name,
|
||||||
|
FeriteObject *data, FeriteObject *data2 );
|
||||||
|
void e_epplet_cb_cleanup( E_Epplet_CB_Info *cb);
|
||||||
void e_epplet_bits_cb (void *_data, Ebits_Object _o, char *_c,
|
void e_epplet_bits_cb (void *_data, Ebits_Object _o, char *_c,
|
||||||
int _b, int _x, int _y, int _ox, int _oy, int _ow, int _oh);
|
int _b, int _x, int _y, int _ox, int _oy, int _ow, int _oh);
|
||||||
void e_epplet_evas_cb (void *_data, Evas _e, Evas_Object _o, int _b, int _x, int _y);
|
void e_epplet_evas_cb (void *_data, Evas _e, Evas_Object _o,
|
||||||
|
int _b, int _x, int _y);
|
||||||
|
void e_epplet_timer_func(int val, void *data);
|
||||||
|
E_Epplet_Observer *e_epplet_observer_new( FeriteScript *script,
|
||||||
|
char *func_name, FeriteObject *data);
|
||||||
|
void e_epplet_observer_register_desktops(E_Epplet_Observer *obs);
|
||||||
|
void e_epplet_desktop_observer_func(E_Observer *observer, E_Observee *observee);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
#include "observer.h"
|
#include "observer.h"
|
||||||
|
|
||||||
void
|
void
|
||||||
e_observer_init(E_Observer *obs, Ecore_Event_Type event,
|
e_observer_init(E_Observer *obs, E_Event_Type event,
|
||||||
E_Notify_Func notify_func,
|
E_Notify_Func notify_func,
|
||||||
E_Cleanup_Func cleanup_func)
|
E_Cleanup_Func cleanup_func)
|
||||||
{
|
{
|
||||||
|
@ -56,7 +56,6 @@ e_observer_register_observee(E_Observer *observer, E_Observee *observee)
|
||||||
|
|
||||||
observee->observers = evas_list_append(observee->observers, observer);
|
observee->observers = evas_list_append(observee->observers, observer);
|
||||||
observer->watched = evas_list_append(observer->watched, observee);
|
observer->watched = evas_list_append(observer->watched, observee);
|
||||||
|
|
||||||
D_RETURN;
|
D_RETURN;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -94,7 +93,7 @@ e_observee_init(E_Observee *obs, E_Cleanup_Func cleanup_func)
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
e_observee_notify_observers(E_Observee *o, Ecore_Event_Type event)
|
e_observee_notify_observers(E_Observee *o, E_Event_Type event)
|
||||||
{
|
{
|
||||||
Evas_List obs_list = NULL;
|
Evas_List obs_list = NULL;
|
||||||
E_Observer *obs = NULL;
|
E_Observer *obs = NULL;
|
||||||
|
|
|
@ -14,12 +14,18 @@ typedef struct _e_observee E_Observee;
|
||||||
|
|
||||||
typedef void(*E_Notify_Func)(E_Observer *observer, E_Observee *observee);
|
typedef void(*E_Notify_Func)(E_Observer *observer, E_Observee *observee);
|
||||||
|
|
||||||
|
typedef enum _e_event_type
|
||||||
|
{
|
||||||
|
E_EVENT_WINDOW_FOCUS_IN,
|
||||||
|
E_EVENT_DESKTOP_SWITCH
|
||||||
|
} E_Event_Type;
|
||||||
|
|
||||||
struct _e_observer
|
struct _e_observer
|
||||||
{
|
{
|
||||||
E_Object obj;
|
E_Object obj;
|
||||||
|
|
||||||
Evas_List watched; /* list<E_Observee> */
|
Evas_List watched; /* list<E_Observee> */
|
||||||
Ecore_Event_Type event;
|
E_Event_Type event;
|
||||||
E_Notify_Func notify_func;
|
E_Notify_Func notify_func;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -43,7 +49,7 @@ struct _e_observee
|
||||||
* e_observee_notify_observers() call. Observers are derived from
|
* e_observee_notify_observers() call. Observers are derived from
|
||||||
* E_Objects, therefore, this function also handles E_Object initalization.
|
* E_Objects, therefore, this function also handles E_Object initalization.
|
||||||
*/
|
*/
|
||||||
void e_observer_init(E_Observer *obs, Ecore_Event_Type event,
|
void e_observer_init(E_Observer *obs, E_Event_Type event,
|
||||||
E_Notify_Func notify_func,
|
E_Notify_Func notify_func,
|
||||||
E_Cleanup_Func cleanup_func);
|
E_Cleanup_Func cleanup_func);
|
||||||
|
|
||||||
|
@ -101,7 +107,7 @@ void e_observee_cleanup(E_Observee *obs);
|
||||||
* and calls the notify_func() of the observers that are
|
* and calls the notify_func() of the observers that are
|
||||||
* responsible for the given @event.
|
* responsible for the given @event.
|
||||||
*/
|
*/
|
||||||
void e_observee_notify_observers(E_Observee *o, Ecore_Event_Type event);
|
void e_observee_notify_observers(E_Observee *o, E_Event_Type event);
|
||||||
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in New Issue