From 67bc506c7a4ce7558315272fe966f02de245ce20 Mon Sep 17 00:00:00 2001 From: Carsten Haitzler Date: Fri, 29 Apr 2005 16:04:43 +0000 Subject: [PATCH] bindings + action system gets its first test run with button bindings. seems to work well. grabs buttons. responds to input events and context. calls appropriate action callbacks. you can add actions fairly easily. the cool bit is that actions can be added on the fly... like ooh - lets say from... MODULES :) ie module could load and enable then add lots of custom actions. these could be custom in c code in the module.. OR... they could even be bits of embryo loaded ... or perl... or python... or... anyway - you can figure it out. it's justa bi-product of doing the action system this way. (btw - the actions can be overridden too by modules so a module could change a default action or even just augment it...) SVN revision: 14495 --- src/bin/e_actions.c | 149 ++++++++++++++++++++++++++++- src/bin/e_actions.h | 6 +- src/bin/e_bindings.c | 53 ++++++++++- src/bin/e_bindings.h | 9 +- src/bin/e_border.c | 216 ++++++++++++++++++++----------------------- src/bin/e_border.h | 6 ++ src/bin/e_config.c | 49 ---------- src/bin/e_config.h | 18 ---- src/bin/e_main.c | 28 +++--- 9 files changed, 331 insertions(+), 203 deletions(-) diff --git a/src/bin/e_actions.c b/src/bin/e_actions.c index cf5bcd774..3855f80a7 100644 --- a/src/bin/e_actions.c +++ b/src/bin/e_actions.c @@ -3,28 +3,175 @@ */ #include "e.h" +#define INITS +#define ACT_GO(name) \ + { \ + act = e_action_set(#name); \ + if (act) act->func.go = _e_actions_act_##name##_go; \ + } +#define ACT_FN_GO(act) \ + static void _e_actions_act_##act##_go(E_Object *obj, char *params) +#define ACT_GO_MOUSE(name) \ + { \ + act = e_action_set(#name); \ + if (act) act->func.go_mouse = _e_actions_act_##name##_go_mouse; \ + } +#define ACT_FN_GO_MOUSE(act) \ + static void _e_actions_act_##act##_go_mouse(E_Object *obj, char *params, Ecore_X_Event_Mouse_Button_Down *ev) +#define ACT_END(name) \ + { \ + act = e_action_set(#name); \ + if (act) act->func.end = _e_actions_act_##name##_end; \ + } +#define ACT_FN_END(act) \ + static void _e_actions_act_##act##_end(E_Object *obj, char *params) +#define ACT_END_MOUSE(name) \ + { \ + act = e_action_set(#name); \ + if (act) act->func.end_mouse = _e_actions_act_##name##_end_mouse; \ + } +#define ACT_FN_END_MOUSE(act) \ + static void _e_actions_act_##act##_end_mouse(E_Object *obj, char *params, Ecore_X_Event_Mouse_Button_Up *ev) + /* local subsystem functions */ +/* to save writing this in N places - the sctions are defined here */ +/***************************************************************************/ +ACT_FN_GO(window_move) +{ + if (!obj) obj = E_OBJECT(e_border_focused_get()); + if (obj->type != E_BORDER_TYPE) return; + e_border_act_move_begin((E_Border *)obj, NULL); +} +ACT_FN_GO_MOUSE(window_move) +{ + if (!obj) obj = E_OBJECT(e_border_focused_get()); + if (obj->type != E_BORDER_TYPE) return; + e_border_act_move_begin((E_Border *)obj, ev); +} +ACT_FN_END(window_move) +{ + if (!obj) obj = E_OBJECT(e_border_focused_get()); + if (obj->type != E_BORDER_TYPE) return; + e_border_act_move_end((E_Border *)obj, NULL); +} +ACT_FN_END_MOUSE(window_move) +{ + if (!obj) obj = E_OBJECT(e_border_focused_get()); + if (obj->type != E_BORDER_TYPE) return; + e_border_act_move_end((E_Border *)obj, ev); +} + +/***************************************************************************/ +ACT_FN_GO(window_resize) +{ + if (!obj) obj = E_OBJECT(e_border_focused_get()); + if (obj->type != E_BORDER_TYPE) return; + e_border_act_resize_begin((E_Border *)obj, NULL); +} +ACT_FN_GO_MOUSE(window_resize) +{ + if (!obj) obj = E_OBJECT(e_border_focused_get()); + if (obj->type != E_BORDER_TYPE) return; + e_border_act_resize_begin((E_Border *)obj, ev); +} +ACT_FN_END(window_resize) +{ + if (!obj) obj = E_OBJECT(e_border_focused_get()); + if (obj->type != E_BORDER_TYPE) return; + e_border_act_resize_end((E_Border *)obj, NULL); +} +ACT_FN_END_MOUSE(window_resize) +{ + if (!obj) obj = E_OBJECT(e_border_focused_get()); + if (obj->type != E_BORDER_TYPE) return; + e_border_act_resize_end((E_Border *)obj, ev); +} + +/***************************************************************************/ +ACT_FN_GO(window_menu) +{ + if (!obj) obj = E_OBJECT(e_border_focused_get()); + if (obj->type != E_BORDER_TYPE) return; + e_border_act_menu_begin((E_Border *)obj, NULL); +} +ACT_FN_GO_MOUSE(window_menu) +{ + if (!obj) obj = E_OBJECT(e_border_focused_get()); + if (obj->type != E_BORDER_TYPE) return; + e_border_act_menu_begin((E_Border *)obj, ev); +} + /* local subsystem globals */ +static Evas_Hash *actions = NULL; /* externally accessible functions */ int e_actions_init(void) { + E_Action *act; + + ACT_GO(window_move); + ACT_GO_MOUSE(window_move); + ACT_END(window_move); + ACT_END_MOUSE(window_move); + + ACT_GO(window_resize); + ACT_GO_MOUSE(window_resize); + ACT_END(window_resize); + ACT_END_MOUSE(window_resize); + + ACT_GO(window_menu); + ACT_GO_MOUSE(window_menu); + return 1; } int e_actions_shutdown(void) { + /* FIXME: free actions */ return 1; } E_Action * e_action_find(char *name) { - return NULL; + E_Action *act; + + act = evas_hash_find(actions, name); + return act; +} + +E_Action * +e_action_set(char *name) +{ + E_Action *act; + + act = e_action_find(name); + if (!act) + { + act = calloc(1, sizeof(E_Action)); + if (!act) return NULL; + act->name = strdup(name); + actions = evas_hash_add(actions, name, act); + } + return act; +} + +void +e_action_del(char *name) +{ + E_Action *act; + + act = e_action_find(name); + if (act) + { + actions = evas_hash_del(actions, name, act); + IF_FREE(act->name); + free(act); + } } /* local subsystem functions */ diff --git a/src/bin/e_actions.h b/src/bin/e_actions.h index cace8cb30..e47440dc1 100644 --- a/src/bin/e_actions.h +++ b/src/bin/e_actions.h @@ -11,6 +11,8 @@ struct _E_Action struct { void (*go) (E_Object *obj, char *params); void (*go_mouse) (E_Object *obj, char *params, Ecore_X_Event_Mouse_Button_Down *ev); + void (*end) (E_Object *obj, char *params); + void (*end_mouse) (E_Object *obj, char *params, Ecore_X_Event_Mouse_Button_Up *ev); } func; }; @@ -22,6 +24,8 @@ EAPI int e_actions_init(void); EAPI int e_actions_shutdown(void); EAPI E_Action *e_action_find(char *name); - +EAPI E_Action *e_action_set(char *name); +EAPI void e_action_del(char *name); + #endif #endif diff --git a/src/bin/e_bindings.c b/src/bin/e_bindings.c index 01de30695..9e5768270 100644 --- a/src/bin/e_bindings.c +++ b/src/bin/e_bindings.c @@ -51,6 +51,15 @@ static Evas_List *signal_bindings = NULL; int e_bindings_init(void) { + e_bindings_mouse_add(E_BINDING_CONTEXT_BORDER, + 1, E_BINDING_MODIFIER_ALT, 0, + "window_move", ""); + e_bindings_mouse_add(E_BINDING_CONTEXT_BORDER, + 2, E_BINDING_MODIFIER_ALT, 0, + "window_resize", ""); + e_bindings_mouse_add(E_BINDING_CONTEXT_BORDER, + 3, E_BINDING_MODIFIER_ALT, 0, + "window_menu", ""); return 1; } @@ -65,7 +74,6 @@ e_bindings_mouse_add(E_Binding_Context ctxt, int button, E_Binding_Modifier mod, { E_Binding_Mouse *bind; - if (!params) params = ""; bind = calloc(1, sizeof(E_Binding_Mouse)); bind->ctxt = ctxt; bind->button = button; @@ -81,7 +89,6 @@ e_bindings_mouse_del(E_Binding_Context ctxt, int button, E_Binding_Modifier mod, { Evas_List *l; - if (!params) params = ""; for (l = mouse_bindings; l; l = l->next) { E_Binding_Mouse *bind; @@ -105,7 +112,7 @@ void 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; @@ -121,7 +128,7 @@ e_bindings_mouse_grab(E_Binding_Context ctxt, Ecore_X_Window win) 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_DOWN | ECORE_X_EVENT_MASK_MOUSE_UP | ECORE_X_EVENT_MASK_MOUSE_MOVE, mod, bind->any_mod); @@ -192,6 +199,44 @@ e_bindings_mouse_down_event_handle(E_Binding_Context ctxt, E_Object *obj, Ecore_ return 0; } +int +e_bindings_mouse_up_event_handle(E_Binding_Context ctxt, E_Object *obj, Ecore_X_Event_Mouse_Button_Up *ev) +{ + E_Binding_Modifier mod = 0; + Evas_List *l; + + if (ev->modifiers & ECORE_X_MODIFIER_SHIFT) mod |= E_BINDING_MODIFIER_SHIFT; + 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.end_mouse) + act->func.end_mouse(obj, bind->params, ev); + else if (act->func.end) + act->func.end(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) diff --git a/src/bin/e_bindings.h b/src/bin/e_bindings.h index fd4e7c50d..a4bb4f03e 100644 --- a/src/bin/e_bindings.h +++ b/src/bin/e_bindings.h @@ -31,9 +31,16 @@ typedef enum _E_Binding_Modifier EAPI int e_bindings_init(void); EAPI int e_bindings_shutdown(void); +EAPI void e_bindings_mouse_add(E_Binding_Context ctxt, int button, E_Binding_Modifier mod, int any_mod, char *action, char *params); +EAPI void e_bindings_mouse_del(E_Binding_Context ctxt, int button, E_Binding_Modifier mod, int any_mod, char *action, char *params); +EAPI void e_bindings_mouse_grab(E_Binding_Context ctxt, Ecore_X_Window win); +EAPI void e_bindings_mouse_ungrab(E_Binding_Context ctxt, Ecore_X_Window win); 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_mouse_up_event_handle(E_Binding_Context ctxt, E_Object *obj, Ecore_X_Event_Mouse_Button_Up *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); + +EAPI int e_bindings_signal_handle(E_Binding_Context ctxt, E_Object *obj, char *sig, char *src); #endif #endif diff --git a/src/bin/e_border.c b/src/bin/e_border.c index 05dd4a1d7..f74dc3a49 100644 --- a/src/bin/e_border.c +++ b/src/bin/e_border.c @@ -200,7 +200,6 @@ e_border_new(E_Container *con, Ecore_X_Window win, int first_map) E_Border *bd; Ecore_X_Window_Attributes *att; Evas_List *list; - E_Config_Binding *eb; unsigned int managed, desk[2]; int deskx, desky; @@ -214,16 +213,7 @@ e_border_new(E_Container *con, Ecore_X_Window win, int first_map) bd->h = 1; bd->win = ecore_x_window_override_new(bd->container->win, 0, 0, bd->w, bd->h); ecore_x_window_shape_events_select(bd->win, 1); - /* Bindings */ - for (list = e_config->bindings; list; list = list->next) - { - eb = list->data; - ecore_x_window_button_grab(bd->win, - eb->button, - eb->mask, - eb->modifiers, - 0); - } + e_bindings_mouse_grab(E_BINDING_CONTEXT_BORDER, bd->win); bd->bg_ecore_evas = ecore_evas_software_x11_new(NULL, bd->win, 0, 0, bd->w, bd->h); ecore_evas_software_x11_direct_resize_set(bd->bg_ecore_evas, 1); e_canvas_add(bd->bg_ecore_evas); @@ -1188,12 +1178,109 @@ e_border_clients_get() return borders; } +void +e_border_act_move_begin(E_Border *bd, Ecore_X_Event_Mouse_Button_Down *ev) +{ + if (!bd->moving) + { + bd->moving = 1; + if (ev) + { + char source[256]; + + snprintf(source, sizeof(source) - 1, "mouse,%i", ev->button); + _e_border_moveinfo_gather(bd, source); + } + e_border_raise(bd); + _e_border_move_begin(bd); + } +} + +void +e_border_act_move_end(E_Border *bd, Ecore_X_Event_Mouse_Button_Down *ev) +{ + if (bd->moving) + { + bd->moving = 0; + _e_border_move_end(bd); + e_zone_flip_coords_handle(bd->zone, -1, -1); + } +} + +void +e_border_act_resize_begin(E_Border *bd, Ecore_X_Event_Mouse_Button_Down *ev) +{ + if (bd->resize_mode == RESIZE_NONE) + { + if (bd->mouse.current.mx < (bd->x + bd-> w / 2)) + { + if (bd->mouse.current.my < (bd->y + bd->h / 2)) + { + bd->resize_mode = RESIZE_TL; + GRAV_SET(bd, ECORE_X_GRAVITY_SE); + } + else + { + bd->resize_mode = RESIZE_BL; + GRAV_SET(bd, ECORE_X_GRAVITY_NE); + } + } + else + { + if (bd->mouse.current.my < (bd->y + bd->h / 2)) + { + bd->resize_mode = RESIZE_TR; + GRAV_SET(bd, ECORE_X_GRAVITY_SW); + } + else + { + bd->resize_mode = RESIZE_BR; + GRAV_SET(bd, ECORE_X_GRAVITY_NW); + } + } + if (ev) + { + char source[256]; + + snprintf(source, sizeof(source) - 1, "mouse,%i", ev->button); + _e_border_moveinfo_gather(bd, source); + } + e_border_raise(bd); + _e_border_resize_begin(bd); + } +} + +void +e_border_act_resize_end(E_Border *bd, Ecore_X_Event_Mouse_Button_Down *ev) +{ + if (bd->resize_mode != RESIZE_NONE) + { + bd->resize_mode = RESIZE_NONE; + _e_border_resize_end(bd); + } +} + +void +e_border_act_menu_begin(E_Border *bd, Ecore_X_Event_Mouse_Button_Down *ev) +{ + if (ev) + { + _e_border_menu_show(bd, bd->x + ev->x, bd->y + ev->y); + } + else + { + int x, y; + + ecore_x_pointer_last_xy_get(&x, &y); + _e_border_menu_show(bd, x, y); + } +} + /* local subsystem functions */ static void _e_border_free(E_Border *bd) { Evas_List *list; - E_Config_Binding *eb; if (resize == bd) _e_border_resize_end(bd); @@ -1233,15 +1320,6 @@ _e_border_free(E_Border *bd) e_canvas_del(bd->bg_ecore_evas); ecore_evas_free(bd->bg_ecore_evas); ecore_x_window_del(bd->client.shell_win); - /* Bindings */ - for (list = e_config->bindings; list; list = list->next) - { - eb = list->data; - ecore_x_window_button_ungrab(bd->win, - eb->button, - eb->modifiers, - 0); - } ecore_x_window_del(bd->win); bd->container->clients = evas_list_remove(bd->container->clients, bd); @@ -2235,15 +2313,9 @@ _e_border_cb_mouse_down(void *data, int type, void *event) { Ecore_X_Event_Mouse_Button_Down *ev; E_Border *bd; - Evas_List *list; - E_Config_Binding *eb; - int x, y, w, h; - char source[16]; - int modifiers; ev = event; bd = data; - modifiers = ev->modifiers; if (ev->event_win == bd->win) { if ((ev->button >= 1) && (ev->button <= 3)) @@ -2257,67 +2329,8 @@ _e_border_cb_mouse_down(void *data, int type, void *event) } bd->mouse.current.mx = ev->root.x; bd->mouse.current.my = ev->root.y; - /* Bindings */ - /* Remove LOCK keys */ - modifiers &= ~(ECORE_X_LOCK_SCROLL|ECORE_X_LOCK_NUM|ECORE_X_LOCK_CAPS); - for (list = e_config->bindings; list; list = list->next) + if (e_bindings_mouse_down_event_handle(E_BINDING_CONTEXT_BORDER, E_OBJECT(bd), ev)) { - eb = list->data; - if ((ev->button == eb->button) && (modifiers == eb->modifiers)) - { - snprintf(source, sizeof(source) - 1, "mouse,%d", eb->button); - switch (eb->action) - { - case E_BINDING_ACTION_MENU: - _e_border_menu_show(bd, bd->x + ev->x, bd->y + ev->y); - break; - case E_BINDING_ACTION_MOVE: - if (!bd->moving) - { - bd->moving = 1; - _e_border_moveinfo_gather(bd, source); - e_border_raise(bd); - _e_border_move_begin(bd); - } - break; - case E_BINDING_ACTION_RESIZE: - if (bd->resize_mode == RESIZE_NONE) - { - ecore_x_window_geometry_get(bd->win, &x, &y, &w, &h); - if (bd->mouse.current.mx < (x + w/2)) - { - if (bd->mouse.current.my < (y + h/2)) - { - bd->resize_mode = RESIZE_TL; - GRAV_SET(bd, ECORE_X_GRAVITY_SE); - } - else - { - bd->resize_mode = RESIZE_BL; - GRAV_SET(bd, ECORE_X_GRAVITY_NE); - } - } - else - { - if (bd->mouse.current.my < (y + h/2)) - { - bd->resize_mode = RESIZE_TR; - GRAV_SET(bd, ECORE_X_GRAVITY_SW); - } - else - { - bd->resize_mode = RESIZE_BR; - GRAV_SET(bd, ECORE_X_GRAVITY_NW); - } - } - _e_border_moveinfo_gather(bd, source); - e_border_raise(bd); - _e_border_resize_begin(bd); - } - } - /* We only want one action */ - break; - } } } if (ev->win != bd->event_win) return 1; @@ -2355,8 +2368,6 @@ _e_border_cb_mouse_up(void *data, int type, void *event) { Ecore_X_Event_Mouse_Button_Up *ev; E_Border *bd; - Evas_List *list; - E_Config_Binding *eb; ev = event; bd = data; @@ -2371,33 +2382,8 @@ _e_border_cb_mouse_up(void *data, int type, void *event) } bd->mouse.current.mx = ev->root.x; bd->mouse.current.my = ev->root.y; - /* Bindings */ - for (list = e_config->bindings; list; list = list->next) + if (e_bindings_mouse_up_event_handle(E_BINDING_CONTEXT_BORDER, E_OBJECT(bd), ev)) { - eb = list->data; - if (ev->button == eb->button) - { - switch (eb->action) - { - case E_BINDING_ACTION_MOVE: - if (bd->moving) - { - bd->moving = 0; - _e_border_move_end(bd); - e_zone_flip_coords_handle(bd->zone, -1, -1); - } - break; - case E_BINDING_ACTION_RESIZE: - if (bd->resize_mode != RESIZE_NONE) - { - bd->resize_mode = RESIZE_NONE; - _e_border_resize_end(bd); - } - break; - default: - break; - } - } } } if (ev->win != bd->event_win) return 1; diff --git a/src/bin/e_border.h b/src/bin/e_border.h index b51833fd5..aaa6e9dc8 100644 --- a/src/bin/e_border.h +++ b/src/bin/e_border.h @@ -347,6 +347,12 @@ EAPI void e_border_idler_before(void); EAPI Evas_List *e_border_clients_get(); +EAPI void e_border_act_move_begin(E_Border *bd, Ecore_X_Event_Mouse_Button_Down *ev); +EAPI void e_border_act_move_end(E_Border *bd, Ecore_X_Event_Mouse_Button_Down *ev); +EAPI void e_border_act_resize_begin(E_Border *bd, Ecore_X_Event_Mouse_Button_Down *ev); +EAPI void e_border_act_resize_end(E_Border *bd, Ecore_X_Event_Mouse_Button_Down *ev); +EAPI void e_border_act_menu_begin(E_Border *bd, Ecore_X_Event_Mouse_Button_Down *ev); + extern EAPI int E_EVENT_BORDER_RESIZE; extern EAPI int E_EVENT_BORDER_MOVE; extern EAPI int E_EVENT_BORDER_ADD; diff --git a/src/bin/e_config.c b/src/bin/e_config.c index e00ae539f..91f72869b 100644 --- a/src/bin/e_config.c +++ b/src/bin/e_config.c @@ -24,7 +24,6 @@ static Ecore_Job *_e_config_save_job = NULL; static E_Config_DD *_e_config_edd = NULL; static E_Config_DD *_e_config_module_edd = NULL; -static E_Config_DD *_e_config_binding_edd = NULL; static E_Config_DD *_e_config_font_fallback_edd = NULL; static E_Config_DD *_e_config_font_default_edd = NULL; @@ -40,16 +39,6 @@ e_config_init(void) E_CONFIG_VAL(D, T, name, STR); E_CONFIG_VAL(D, T, enabled, UCHAR); - _e_config_binding_edd = E_CONFIG_DD_NEW("E_Config_Binding", E_Config_Binding); -#undef T -#undef D -#define T E_Config_Binding -#define D _e_config_binding_edd - E_CONFIG_VAL(D, T, button, INT); - E_CONFIG_VAL(D, T, mask, INT); - E_CONFIG_VAL(D, T, modifiers, INT); - E_CONFIG_VAL(D, T, action, INT); - _e_config_font_default_edd = E_CONFIG_DD_NEW("E_Font_Default", E_Font_Default); #undef T @@ -86,7 +75,6 @@ e_config_init(void) E_CONFIG_VAL(D, T, zone_desks_x_count, INT); E_CONFIG_VAL(D, T, zone_desks_y_count, INT); E_CONFIG_LIST(D, T, modules, _e_config_module_edd); - E_CONFIG_LIST(D, T, bindings, _e_config_binding_edd); E_CONFIG_LIST(D, T, font_fallbacks, _e_config_font_fallback_edd); E_CONFIG_LIST(D, T, font_defaults, _e_config_font_default_edd); @@ -140,34 +128,6 @@ e_config_init(void) em->enabled = 1; e_config->modules = evas_list_append(e_config->modules, em); } - { - E_Config_Binding *eb; - - eb = E_NEW(E_Config_Binding, 1); - eb->button = 1; - eb->mask = ECORE_X_EVENT_MASK_MOUSE_DOWN | - ECORE_X_EVENT_MASK_MOUSE_UP | - ECORE_X_EVENT_MASK_MOUSE_MOVE; - eb->modifiers = ECORE_X_MODIFIER_ALT; - eb->action = E_BINDING_ACTION_MOVE; - e_config->bindings = evas_list_append(e_config->bindings, eb); - - eb = E_NEW(E_Config_Binding, 1); - eb->button = 2; - eb->mask = ECORE_X_EVENT_MASK_MOUSE_DOWN | - ECORE_X_EVENT_MASK_MOUSE_UP | - ECORE_X_EVENT_MASK_MOUSE_MOVE; - eb->modifiers = ECORE_X_MODIFIER_ALT; - eb->action = E_BINDING_ACTION_RESIZE; - e_config->bindings = evas_list_append(e_config->bindings, eb); - - eb = E_NEW(E_Config_Binding, 1); - eb->button = 3; - eb->mask = ECORE_X_EVENT_MASK_MOUSE_DOWN; - eb->modifiers = ECORE_X_MODIFIER_ALT; - eb->action = E_BINDING_ACTION_MENU; - e_config->bindings = evas_list_append(e_config->bindings, eb); - } { E_Font_Fallback* eff; @@ -232,14 +192,6 @@ e_config_shutdown(void) E_FREE(em->name); E_FREE(em); } - while (e_config->bindings) - { - E_Config_Binding *eb; - - eb = e_config->bindings->data; - e_config->bindings = evas_list_remove_list(e_config->bindings, e_config->bindings); - E_FREE(eb); - } while (e_config->font_fallbacks) { E_Font_Fallback *eff; @@ -265,7 +217,6 @@ e_config_shutdown(void) } E_CONFIG_DD_FREE(_e_config_edd); E_CONFIG_DD_FREE(_e_config_module_edd); - E_CONFIG_DD_FREE(_e_config_binding_edd); E_CONFIG_DD_FREE(_e_config_font_default_edd); E_CONFIG_DD_FREE(_e_config_font_fallback_edd); return 1; diff --git a/src/bin/e_config.h b/src/bin/e_config.h index 7ca2b695f..e499a23bf 100644 --- a/src/bin/e_config.h +++ b/src/bin/e_config.h @@ -33,16 +33,8 @@ typedef struct _E_Config E_Config; typedef struct _E_Config_Module E_Config_Module; -typedef struct _E_Config_Binding E_Config_Binding; typedef Eet_Data_Descriptor E_Config_DD; -typedef enum _E_Binding_Action -{ - E_BINDING_ACTION_MOVE, - E_BINDING_ACTION_RESIZE, - E_BINDING_ACTION_MENU -} E_Binding_Action; - #else #ifndef E_CONFIG_H #define E_CONFIG_H @@ -63,7 +55,6 @@ struct _E_Config int zone_desks_y_count; int use_virtual_roots; Evas_List *modules; - Evas_List *bindings; Evas_List *font_fallbacks; Evas_List *font_defaults; }; @@ -74,15 +65,6 @@ struct _E_Config_Module unsigned char enabled; }; -struct _E_Config_Binding -{ - int button; - Ecore_X_Event_Mask mask; - int modifiers; - E_Binding_Action action; - -}; - EAPI int e_config_init(void); EAPI int e_config_shutdown(void); diff --git a/src/bin/e_main.c b/src/bin/e_main.c index 8f457a144..c58e12042 100644 --- a/src/bin/e_main.c +++ b/src/bin/e_main.c @@ -258,6 +258,20 @@ main(int argc, char **argv) _e_main_shutdown(-1); } _e_main_shutdown_push(e_config_shutdown); + /* 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()) + { + e_error_message_show(_("Enlightenment cannot set up its bindings system.")); + _e_main_shutdown(-1); + } + _e_main_shutdown_push(e_bindings_shutdown); /* setup edje to animate @ e_config->framerate frames per sec. */ edje_frametime_set(1.0 / e_config->framerate); @@ -307,20 +321,6 @@ main(int argc, char **argv) /* 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()) - { - e_error_message_show(_("Enlightenment cannot set up its bindings system.")); - _e_main_shutdown(-1); - } - _e_main_shutdown_push(e_bindings_shutdown); /* setup e ipc service */ if (!_e_main_ipc_init()) {