Enlightenment CVS committal Author : raster Project : e17 Module : apps/e
Dir : e17/apps/e/src/bin Modified Files: Makefile.am e_bindings.c e_bindings.h e_includes.h e_intl.c e_main.c Added Files: e_actions.c e_actions.h Log Message: hungarian po fix zh_CN probs work on bindings code - add actions system framework. it's not ready for sliding in yet as i need to fill out actions but once i do i can slide the current code across and then work on sliding keybindings in. =================================================================== RCS file: /cvsroot/enlightenment/e17/apps/e/src/bin/Makefile.am,v retrieving revision 1.25 retrieving revision 1.26 diff -u -3 -r1.25 -r1.26 --- Makefile.am 25 Apr 2005 03:06:05 -0000 1.25 +++ Makefile.am 26 Apr 2005 15:06:04 -0000 1.26 @@ -49,7 +49,8 @@ e_theme.h \ e_dnd.h \ e_bindings.h \ -e_moveresize.h +e_moveresize.h \ +e_actions.h enlightenment_SOURCES = \ e_main.c \ @@ -92,6 +93,7 @@ e_dnd.c \ e_bindings.c \ e_moveresize.c \ +e_actions.c \ $(ENLIGHTENMENTHEADERS) enlightenment_LDFLAGS = -export-dynamic @e_libs@ @dlopen_libs@ =================================================================== RCS file: /cvsroot/enlightenment/e17/apps/e/src/bin/e_bindings.c,v retrieving revision 1.3 retrieving revision 1.4 diff -u -3 -r1.3 -r1.4 --- e_bindings.c 25 Apr 2005 08:29:52 -0000 1.3 +++ e_bindings.c 26 Apr 2005 15:06:05 -0000 1.4 @@ -4,9 +4,48 @@ #include "e.h" /* local subsystem functions */ +typedef struct _E_Binding_Mouse E_Binding_Mouse; +typedef struct _E_Binding_Key E_Binding_Key; +typedef struct _E_Binding_Signal E_Binding_Signal; + +struct _E_Binding_Mouse +{ + E_Binding_Context ctxt; + int button; + E_Binding_Modifier mod; + unsigned char any_mod : 1; + char *action; + char *params; +}; + +struct _E_Binding_Key +{ + E_Binding_Context ctxt; + char *key; + E_Binding_Modifier mod; + unsigned char any_mod : 1; + char *action; + char *params; +}; + +struct _E_Binding_Signal +{ + E_Binding_Context ctxt; + char *sig; + char *src; + char *action; + char *params; +}; + +static void _e_bindings_mouse_free(E_Binding_Mouse *bind); +static int _e_bindings_context_match(E_Binding_Context bctxt, E_Binding_Context ctxt); /* local subsystem globals */ +static Evas_List *mouse_bindings = NULL; +static Evas_List *key_bindings = NULL; +static Evas_List *signal_bindings = NULL; + /* externally accessible functions */ int @@ -22,18 +61,97 @@ } void -e_bindings_mouse_add(E_Binding_Context ctxt, int button, E_Binding_Modifier mod, int any_mod, char *action, char *param) +e_bindings_mouse_add(E_Binding_Context ctxt, int button, E_Binding_Modifier mod, int any_mod, char *action, char *params) +{ + E_Binding_Mouse *bind; + + if (!params) params = ""; + bind = calloc(1, sizeof(E_Binding_Mouse)); + bind->ctxt = ctxt; + bind->button = button; + bind->mod = mod; + bind->any_mod = any_mod; + bind->action = strdup(action); + bind->params = strdup(params); + mouse_bindings = evas_list_append(mouse_bindings, bind); +} + +void +e_bindings_mouse_del(E_Binding_Context ctxt, int button, E_Binding_Modifier mod, int any_mod, char *action, char *params) { + Evas_List *l; + + if (!params) params = ""; + for (l = mouse_bindings; l; l = l->next) + { + E_Binding_Mouse *bind; + + bind = l->data; + if ((bind->ctxt == ctxt) && + (bind->button == button) && + (bind->mod == mod) && + (bind->any_mod == any_mod) && + (!strcmp(bind->action, action)) && + (!strcmp(bind->params, params))) + { + _e_bindings_mouse_free(bind); + mouse_bindings = evas_list_remove_list(mouse_bindings, l); + break; + } + } } void -e_bindings_mouse_grab(Ecore_X_Window win) +e_bindings_mouse_grab(E_Binding_Context ctxt, Ecore_X_Window win) { + Evas_List *l; + + for (l = mouse_bindings; l; l = l->next) + { + E_Binding_Mouse *bind; + + bind = l->data; + if (bind->ctxt == ctxt) + { + int mod; + + mod = 0; + if (bind->mod & E_BINDING_MODIFIER_SHIFT) mod |= ECORE_X_MODIFIER_SHIFT; + if (bind->mod & E_BINDING_MODIFIER_CTRL) mod |= ECORE_X_MODIFIER_CTRL; + if (bind->mod & E_BINDING_MODIFIER_ALT) mod |= ECORE_X_MODIFIER_ALT; + if (bind->mod & E_BINDING_MODIFIER_WIN) mod |= ECORE_X_MODIFIER_WIN; + ecore_x_window_button_grab(win, bind->button, + ECORE_X_EVENT_MASK_KEY_DOWN | + ECORE_X_EVENT_MASK_MOUSE_UP | + ECORE_X_EVENT_MASK_MOUSE_MOVE, + mod, bind->any_mod); + } + } } void -e_bindings_mouse_ungrab(Ecore_X_Window win) +e_bindings_mouse_ungrab(E_Binding_Context ctxt, Ecore_X_Window win) { + Evas_List *l; + + for (l = mouse_bindings; l; l = l->next) + { + E_Binding_Mouse *bind; + + bind = l->data; + if (bind->ctxt == ctxt) + { + int mod; + + mod = 0; + if (bind->mod & E_BINDING_MODIFIER_SHIFT) mod |= ECORE_X_MODIFIER_SHIFT; + if (bind->mod & E_BINDING_MODIFIER_CTRL) mod |= ECORE_X_MODIFIER_CTRL; + if (bind->mod & E_BINDING_MODIFIER_ALT) mod |= ECORE_X_MODIFIER_ALT; + if (bind->mod & E_BINDING_MODIFIER_WIN) mod |= ECORE_X_MODIFIER_WIN; + ecore_x_window_button_ungrab(win, bind->button, + mod, bind->any_mod); + } + } } int @@ -46,10 +164,35 @@ if (ev->modifiers & ECORE_X_MODIFIER_CTRL) mod |= E_BINDING_MODIFIER_CTRL; if (ev->modifiers & ECORE_X_MODIFIER_ALT) mod |= E_BINDING_MODIFIER_ALT; if (ev->modifiers & ECORE_X_MODIFIER_WIN) mod |= E_BINDING_MODIFIER_WIN; - + for (l = mouse_bindings; l; l = l->next) + { + E_Binding_Mouse *bind; + + bind = l->data; + if ((bind->button == ev->button) && + ((bind->any_mod) || (bind->mod == mod))) + { + if (_e_bindings_context_match(bind->ctxt, ctxt)) + { + E_Action *act; + + act = e_action_find(bind->action); + if (act) + { + if (act->func.go_mouse) + act->func.go_mouse(obj, bind->params, ev); + else if (act->func.go) + act->func.go(obj, bind->params); + return 1; + } + return 0; + } + } + } return 0; } +/* FIXME: finish off key bindings */ int e_bindings_key_down_event_handle(E_Binding_Context ctxt, E_Object *obj, Ecore_X_Event_Key_Down *ev) { @@ -64,4 +207,30 @@ return 0; } +/* FIXME: finish off signal bindings */ +int +e_bindings_signal_handle(E_Binding_Context ctxt, E_Object *obj, char *sig, char *src) +{ + Evas_List *l; + + return 0; +} + /* local subsystem functions */ + +static void +_e_bindings_mouse_free(E_Binding_Mouse *bind) +{ + E_FREE(bind->action); + E_FREE(bind->params); + free(bind); +} + +static int +_e_bindings_context_match(E_Binding_Context bctxt, E_Binding_Context ctxt) +{ + if (bctxt) return 1; + if (ctxt == E_BINDING_CONTEXT_UNKNOWN) return 0; + if (bctxt == ctxt) return 1; + return 0; +} =================================================================== RCS file: /cvsroot/enlightenment/e17/apps/e/src/bin/e_bindings.h,v retrieving revision 1.3 retrieving revision 1.4 diff -u -3 -r1.3 -r1.4 --- e_bindings.h 25 Apr 2005 08:29:53 -0000 1.3 +++ e_bindings.h 26 Apr 2005 15:06:05 -0000 1.4 @@ -6,9 +6,10 @@ typedef enum _E_Binding_Context { E_BINDING_CONTEXT_NONE, - E_BINDING_CONTEXT_UNKOWN, + E_BINDING_CONTEXT_UNKNOWN, E_BINDING_CONTEXT_BORDER, - E_BINDING_CONTEXT_ZONE + E_BINDING_CONTEXT_ZONE, + E_BINDING_CONTEXT_ANY } E_Binding_Context; /* why do we do this? config stored bindings must be fixed. x's modifier masks @@ -32,6 +33,7 @@ EAPI int e_bindings_mouse_down_event_handle(E_Binding_Context ctxt, E_Object *obj, Ecore_X_Event_Mouse_Button_Down *ev); EAPI int e_bindings_key_down_event_handle(E_Binding_Context ctxt, E_Object *obj, Ecore_X_Event_Key_Down *ev); +EAPI int e_bindings_signale_handle(E_Binding_Context ctxt, E_Object *obj, char *sig, char *src); #endif #endif =================================================================== RCS file: /cvsroot/enlightenment/e17/apps/e/src/bin/e_includes.h,v retrieving revision 1.15 retrieving revision 1.16 diff -u -3 -r1.15 -r1.16 --- e_includes.h 25 Apr 2005 03:06:06 -0000 1.15 +++ e_includes.h 26 Apr 2005 15:06:06 -0000 1.16 @@ -39,3 +39,4 @@ #include "e_dnd.h" #include "e_bindings.h" #include "e_moveresize.h" +#include "e_actions.h" =================================================================== RCS file: /cvsroot/enlightenment/e17/apps/e/src/bin/e_intl.c,v retrieving revision 1.22 retrieving revision 1.23 diff -u -3 -r1.22 -r1.23 --- e_intl.c 24 Apr 2005 19:56:42 -0000 1.22 +++ e_intl.c 26 Apr 2005 15:06:06 -0000 1.23 @@ -49,6 +49,8 @@ ADD_LANG("bg"); ADD_LANG("de"); ADD_LANG("pl"); + ADD_LANG("zh_CN"); + ADD_LANG("hu"); /* FIXME: NULL == use LANG. make this read a config value if it exists */ e_intl_language_set(getenv("LANG")); @@ -146,7 +148,7 @@ IFL("uk") "Ukrainian"; IFL("vi") "Vietnamese"; /* must keep both - politically sensitive */ - IFL("zh") "Chinese (Simplified)"; + IFL("zh_CN") "Chinese (Simplified)"; IFL("zh_TW") "Chinese (Traditional)"; return "Unknown"; } @@ -191,6 +193,12 @@ return "de"; if (ISL("pl") || ISL("pl_PL") || ISL("PL") || ISL("[EMAIL PROTECTED]")) return "pl"; + if (ISL("zh") || ISL("zh_CN") || ISL("CN")) + return "zh_CN"; + if (ISL("zh") || ISL("zh_TW") || ISL("TW")) + return "zh_TW"; + if (ISL("hu") || ISL("hu_HU") || ISL("HU")) + return "hu"; /* this is the default fallback - we have no special cases for this lang * so just strip off anything after and including the _ for country region * and just return the language encoding =================================================================== RCS file: /cvsroot/enlightenment/e17/apps/e/src/bin/e_main.c,v retrieving revision 1.68 retrieving revision 1.69 diff -u -3 -r1.68 -r1.69 --- e_main.c 25 Apr 2005 03:06:06 -0000 1.68 +++ e_main.c 26 Apr 2005 15:06:06 -0000 1.69 @@ -307,6 +307,13 @@ /* tell the error system that it can use gui dialogs now */ e_error_gui_set(1); + /* init actions system */ + if (!e_actions_init()) + { + e_error_message_show(_("Enlightenment cannot set up its actions system.")); + _e_main_shutdown(-1); + } + _e_main_shutdown_push(e_actions_shutdown); /* init bindings system */ if (!e_bindings_init()) { ------------------------------------------------------- SF email is sponsored by - The IT Product Guide Read honest & candid reviews on hundreds of IT Products from real users. Discover which products truly live up to the hype. Start reading now. http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click _______________________________________________ enlightenment-cvs mailing list enlightenment-cvs@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs