From 55da07757125cbc586eb7e89a8cc958569e12f03 Mon Sep 17 00:00:00 2001 From: Carsten Haitzler Date: Thu, 5 May 2005 08:33:17 +0000 Subject: [PATCH] mouse buttons on desktop are now configurable. you can configurew what buttons do what - default is what it was. you will need to rm your config to get this... SVN revision: 14611 --- src/bin/e_actions.c | 109 ++++++++++++++++++++++---------------------- src/bin/e_config.c | 27 +++++++++++ src/bin/e_zone.c | 41 ++++++++++++++++- src/bin/e_zone.h | 2 + 4 files changed, 124 insertions(+), 55 deletions(-) diff --git a/src/bin/e_actions.c b/src/bin/e_actions.c index 01e7dc35a..af7730a48 100644 --- a/src/bin/e_actions.c +++ b/src/bin/e_actions.c @@ -369,99 +369,100 @@ _e_actions_menu_find(char *name) } ACT_FN_GO(menu_show) { - E_Zone *zone; + E_Zone *zone = NULL; /* menu is active - abort */ if (e_menu_grab_window_get()) return; if (!obj) return; if (obj->type == E_MANAGER_TYPE) + zone = e_util_zone_current_get((E_Manager *)obj); + else if (obj->type == E_ZONE_TYPE) + zone = (E_Zone *)obj; + if (zone) { - zone = e_util_zone_current_get((E_Manager *)obj); - if (zone) + if (params) { - if (params) + E_Menu *m = NULL; + + m = _e_actions_menu_find(params); + if (m) { - E_Menu *m = NULL; + int x, y; - m = _e_actions_menu_find(params); - if (m) - { - int x, y; - - /* FIXME: this is a bit of a hack... setting m->con - bad hack */ - m->zone = zone; - ecore_x_pointer_xy_get(zone->container->win, &x, &y); - e_menu_post_deactivate_callback_set(m, _e_actions_cb_menu_end, NULL); - e_menu_activate_mouse(m, zone, x, y, 1, 1, - E_MENU_POP_DIRECTION_DOWN); - } + /* FIXME: this is a bit of a hack... setting m->con - bad hack */ + m->zone = zone; + ecore_x_pointer_xy_get(zone->container->win, &x, &y); + e_menu_post_deactivate_callback_set(m, _e_actions_cb_menu_end, NULL); + e_menu_activate_mouse(m, zone, x, y, 1, 1, + E_MENU_POP_DIRECTION_DOWN); } } } } ACT_FN_GO_MOUSE(menu_show) { - E_Zone *zone; + E_Zone *zone = NULL; /* menu is active - abort */ if (e_menu_grab_window_get()) return; if (!obj) return; if (obj->type == E_MANAGER_TYPE) + zone = e_util_zone_current_get((E_Manager *)obj); + else if (obj->type == E_ZONE_TYPE) + zone = (E_Zone *)obj; + if (zone) { - zone = e_util_zone_current_get((E_Manager *)obj); - if (zone) + if (params) { - if (params) + E_Menu *m = NULL; + + m = _e_actions_menu_find(params); + if (m) { - E_Menu *m = NULL; + int x, y; - m = _e_actions_menu_find(params); - if (m) - { - int x, y; - - /* FIXME: this is a bit of a hack... setting m->con - bad hack */ - m->zone = zone; - x = ev->root.x; - y = ev->root.y; - x -= zone->container->x; - y -= zone->container->y; - e_menu_post_deactivate_callback_set(m, _e_actions_cb_menu_end, NULL); - e_menu_activate_mouse(m, zone, x, y, 1, 1, - E_MENU_POP_DIRECTION_DOWN); - } + /* FIXME: this is a bit of a hack... setting m->con - bad hack */ + m->zone = zone; + x = ev->root.x; + y = ev->root.y; + x -= zone->container->x; + y -= zone->container->y; + e_menu_post_deactivate_callback_set(m, _e_actions_cb_menu_end, NULL); + e_menu_activate_mouse(m, zone, x, y, 1, 1, + E_MENU_POP_DIRECTION_DOWN); + e_util_container_fake_mouse_up_all_later(zone->container); } } } } ACT_FN_GO_KEY(menu_show) { - E_Zone *zone; + E_Zone *zone = NULL; /* menu is active - abort */ if (e_menu_grab_window_get()) return; if (!obj) return; if (obj->type == E_MANAGER_TYPE) + zone = e_util_zone_current_get((E_Manager *)obj); + else if (obj->type == E_ZONE_TYPE) + zone = (E_Zone *)obj; + if (zone) { - zone = e_util_zone_current_get((E_Manager *)obj); - if (zone) + if (params) { - if (params) + E_Menu *m = NULL; + + m = _e_actions_menu_find(params); + if (m) { - E_Menu *m = NULL; + int x, y; - m = _e_actions_menu_find(params); - if (m) - { - int x, y; - - /* FIXME: this is a bit of a hack... setting m->con - bad hack */ - m->zone = zone; - ecore_x_pointer_xy_get(zone->container->win, &x, &y); - e_menu_post_deactivate_callback_set(m, _e_actions_cb_menu_end, NULL); - e_menu_activate_key(m, zone, x, y, 1, 1, - E_MENU_POP_DIRECTION_DOWN); - } + /* FIXME: this is a bit of a hack... setting m->con - bad hack */ + m->zone = zone; + ecore_x_pointer_xy_get(zone->container->win, &x, &y); + e_menu_post_deactivate_callback_set(m, _e_actions_cb_menu_end, NULL); + e_menu_activate_key(m, zone, x, y, 1, 1, + E_MENU_POP_DIRECTION_DOWN); } } } diff --git a/src/bin/e_config.c b/src/bin/e_config.c index 8a08d1194..bd7aeb979 100644 --- a/src/bin/e_config.c +++ b/src/bin/e_config.c @@ -240,6 +240,33 @@ e_config_init(void) eb->action = strdup("window_menu"); eb->params = strdup(""); e_config->mouse_bindings = evas_list_append(e_config->mouse_bindings, eb); + + eb = E_NEW(E_Config_Binding_Mouse, 1); + eb->context = E_BINDING_CONTEXT_ZONE; + eb->button = 1; + eb->modifiers = 0; + eb->any_mod = 0; + eb->action = strdup("menu_show"); + eb->params = strdup("main"); + e_config->mouse_bindings = evas_list_append(e_config->mouse_bindings, eb); + + eb = E_NEW(E_Config_Binding_Mouse, 1); + eb->context = E_BINDING_CONTEXT_ZONE; + eb->button = 2; + eb->modifiers = 0; + eb->any_mod = 0; + eb->action = strdup("menu_show"); + eb->params = strdup("clients"); + e_config->mouse_bindings = evas_list_append(e_config->mouse_bindings, eb); + + eb = E_NEW(E_Config_Binding_Mouse, 1); + eb->context = E_BINDING_CONTEXT_ZONE; + eb->button = 3; + eb->modifiers = 0; + eb->any_mod = 0; + eb->action = strdup("menu_show"); + eb->params = strdup("favorites"); + e_config->mouse_bindings = evas_list_append(e_config->mouse_bindings, eb); } { E_Config_Binding_Key *eb; diff --git a/src/bin/e_zone.c b/src/bin/e_zone.c index ff29a80bc..6fbd7c245 100644 --- a/src/bin/e_zone.c +++ b/src/bin/e_zone.c @@ -328,7 +328,20 @@ _e_zone_cb_bg_mouse_down(void *data, Evas *evas, Evas_Object *obj, void *event_i ev = (Evas_Event_Mouse_Down *)event_info; zone = data; if (e_menu_grab_window_get()) return; - + + if (!zone->cur_mouse_action) + { + if (ecore_event_current_type_get() == ECORE_X_EVENT_MOUSE_BUTTON_DOWN) + { + Ecore_X_Event_Mouse_Button_Down *ev2; + + ev2 = ecore_event_current_event_get(); + zone->cur_mouse_action = + e_bindings_mouse_down_event_handle(E_BINDING_CONTEXT_ZONE, + E_OBJECT(zone), ev2); + } + } +#if 0 /* FIXME: nuke this later once the new configurable bindings settle */ if (ev->button == 1) { E_Menu *m; @@ -361,6 +374,7 @@ _e_zone_cb_bg_mouse_down(void *data, Evas *evas, Evas_Object *obj, void *event_i E_MENU_POP_DIRECTION_DOWN); e_util_container_fake_mouse_up_all_later(zone->container); } +#endif } static void @@ -371,6 +385,31 @@ _e_zone_cb_bg_mouse_up(void *data, Evas *evas, Evas_Object *obj, void *event_inf ev = (Evas_Event_Mouse_Up *)event_info; zone = data; + if (zone->cur_mouse_action) + { + if (ecore_event_current_type_get() == ECORE_X_EVENT_MOUSE_BUTTON_UP) + { + Ecore_X_Event_Mouse_Button_Up *ev2; + + ev2 = ecore_event_current_event_get(); + if (zone->cur_mouse_action->func.end_mouse) + zone->cur_mouse_action->func.end_mouse(E_OBJECT(zone), "", ev2); + else if (zone->cur_mouse_action->func.end) + zone->cur_mouse_action->func.end(E_OBJECT(zone), ""); + } + zone->cur_mouse_action = NULL; + } + else + { + if (ecore_event_current_type_get() == ECORE_X_EVENT_MOUSE_BUTTON_UP) + { + Ecore_X_Event_Mouse_Button_Up *ev2; + + ev2 = ecore_event_current_event_get(); + e_bindings_mouse_up_event_handle(E_BINDING_CONTEXT_ZONE, + E_OBJECT(zone), ev2); + } + } } static void diff --git a/src/bin/e_zone.h b/src/bin/e_zone.h index 7d98188e6..25dde243c 100644 --- a/src/bin/e_zone.h +++ b/src/bin/e_zone.h @@ -39,6 +39,8 @@ struct _E_Zone Ecore_Timer *timer; E_Direction direction; } flip; + + E_Action *cur_mouse_action; }; struct _E_Event_Zone_Desk_Count_Set