Enlightenment CVS committal

Author  : raster
Project : e17
Module  : apps/e

Dir     : e17/apps/e/src/bin


Modified Files:
        e_actions.c e_actions.h e_bindings.c e_bindings.h e_border.c 
        e_container.c e_focus.c e_popup.c e_winlist.c 


Log Message:


wheel bindings! WERD! hard-coded ones for now, need to make these config
values that can be set/changed/deleted via ipc and are saved/loaded :)

===================================================================
RCS file: /cvsroot/enlightenment/e17/apps/e/src/bin/e_actions.c,v
retrieving revision 1.25
retrieving revision 1.26
diff -u -3 -r1.25 -r1.26
--- e_actions.c 19 Sep 2005 13:08:17 -0000      1.25
+++ e_actions.c 22 Sep 2005 12:47:45 -0000      1.26
@@ -18,6 +18,13 @@
    }
 #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_GO_WHEEL(name) \
+   { \
+      act = e_action_add(#name); \
+      if (act) act->func.go_wheel = _e_actions_act_##name##_go_wheel; \
+   }
+#define ACT_FN_GO_WHEEL(act) \
+   static void _e_actions_act_##act##_go_wheel(E_Object *obj, char *params, 
Ecore_X_Event_Mouse_Wheel *ev)
 #define ACT_GO_KEY(name) \
    { \
       act = e_action_add(#name); \
@@ -395,13 +402,28 @@
 }
 
 /***************************************************************************/
+static E_Zone *
+_e_actions_zone_get(E_Object *obj)
+{
+   if (obj)
+     {
+       if (obj->type == E_MANAGER_TYPE)
+         return e_util_zone_current_get((E_Manager *)obj);
+       else if (obj->type == E_CONTAINER_TYPE)
+         return e_util_zone_current_get(((E_Container *)obj)->manager);
+       else if (obj->type == E_ZONE_TYPE)
+         return e_util_zone_current_get(((E_Zone *)obj)->container->manager);
+       else
+         return e_util_zone_current_get(e_manager_current_get());
+     }
+   return e_util_zone_current_get(e_manager_current_get());
+}
+         
 ACT_FN_GO(desk_flip_by)
 {
    E_Zone *zone;
-   
-   if (!obj) return;
-   if (obj->type != E_MANAGER_TYPE) return;
-   zone = e_util_zone_current_get((E_Manager *)obj);
+
+   zone = _e_actions_zone_get(obj);
    if (zone)
      {
        if (params)
@@ -418,10 +440,8 @@
 ACT_FN_GO(desk_flip_to)
 {
    E_Zone *zone;
-   
-   if (!obj) return;
-   if (obj->type != E_MANAGER_TYPE) return;
-   zone = e_util_zone_current_get((E_Manager *)obj);
+
+   zone = _e_actions_zone_get(obj);
    if (zone)
      {
        if (params)
@@ -438,10 +458,8 @@
 ACT_FN_GO(desk_linear_flip_by)
 {
    E_Zone *zone;
-   
-   if (!obj) return;
-   if (obj->type != E_MANAGER_TYPE) return;
-   zone = e_util_zone_current_get((E_Manager *)obj);
+
+   zone = _e_actions_zone_get(obj);
    if (zone)
      {
        if (params)
@@ -458,10 +476,8 @@
 ACT_FN_GO(desk_linear_flip_to)
 {
    E_Zone *zone;
-   
-   if (!obj) return;
-   if (obj->type != E_MANAGER_TYPE) return;
-   zone = e_util_zone_current_get((E_Manager *)obj);
+
+   zone = _e_actions_zone_get(obj);
    if (zone)
      {
        if (params)
@@ -589,15 +605,11 @@
 }
 ACT_FN_GO(menu_show)
 {
-   E_Zone *zone = NULL;
+   E_Zone *zone;
 
    /* 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;
+   zone = _e_actions_zone_get(obj);
    if (zone)
      {
        if (params)
@@ -622,15 +634,11 @@
 }
 ACT_FN_GO_MOUSE(menu_show)
 {
-   E_Zone *zone = NULL;
+   E_Zone *zone;
 
    /* 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;
+   zone = _e_actions_zone_get(obj);
    if (zone)
      {
        if (params)
@@ -658,15 +666,11 @@
 }
 ACT_FN_GO_KEY(menu_show)
 {
-   E_Zone *zone = NULL;
+   E_Zone *zone;
 
    /* 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;
+   zone = _e_actions_zone_get(obj);
    if (zone)
      {
        if (params)
@@ -706,9 +710,7 @@
 {
    E_Zone *zone;
    
-   if (!obj) return;
-   if (obj->type != E_MANAGER_TYPE) return;
-   zone = e_util_zone_current_get((E_Manager *)obj);
+   zone = _e_actions_zone_get(obj);
    if (zone)
      {
        if (params)
@@ -743,13 +745,9 @@
 /***************************************************************************/
 ACT_FN_GO(winlist)
 {
-   E_Zone *zone = NULL;
+   E_Zone *zone;
    
-   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;
+   zone = _e_actions_zone_get(obj);
    if (zone)
      {
        if (params)
@@ -774,13 +772,9 @@
 }
 ACT_FN_GO_MOUSE(winlist)
 {
-   E_Zone *zone = NULL;
+   E_Zone *zone;
    
-   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;
+   zone = _e_actions_zone_get(obj);
    if (zone)
      {
        if (params)
@@ -811,13 +805,9 @@
 }
 ACT_FN_GO_KEY(winlist)
 {
-   E_Zone *zone = NULL;
+   E_Zone *zone;
    
-   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;
+   zone = _e_actions_zone_get(obj);
    if (zone)
      {
        if (params)
===================================================================
RCS file: /cvsroot/enlightenment/e17/apps/e/src/bin/e_actions.h,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -3 -r1.4 -r1.5
--- e_actions.h 28 Jun 2005 04:00:15 -0000      1.4
+++ e_actions.h 22 Sep 2005 12:47:45 -0000      1.5
@@ -19,6 +19,7 @@
    struct {
       void (*go)        (E_Object *obj, char *params);
       void (*go_mouse)  (E_Object *obj, char *params, 
Ecore_X_Event_Mouse_Button_Down *ev);
+      void (*go_wheel)  (E_Object *obj, char *params, 
Ecore_X_Event_Mouse_Wheel *ev);
       void (*go_key)    (E_Object *obj, char *params, Ecore_X_Event_Key_Down 
*ev);
       void (*end)       (E_Object *obj, char *params);
       void (*end_mouse) (E_Object *obj, char *params, 
Ecore_X_Event_Mouse_Button_Up *ev);
===================================================================
RCS file: /cvsroot/enlightenment/e17/apps/e/src/bin/e_bindings.c,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -3 -r1.16 -r1.17
--- e_bindings.c        14 Aug 2005 17:08:09 -0000      1.16
+++ e_bindings.c        22 Sep 2005 12:47:45 -0000      1.17
@@ -7,6 +7,8 @@
 
 static void _e_bindings_mouse_free(E_Binding_Mouse *bind);
 static void _e_bindings_key_free(E_Binding_Key *bind);
+static void _e_bindings_signal_free(E_Binding_Signal *bind);
+static void _e_bindings_wheel_free(E_Binding_Wheel *bind);
 static int _e_bindings_context_match(E_Binding_Context bctxt, 
E_Binding_Context ctxt);
 
 /* local subsystem globals */
@@ -14,6 +16,7 @@
 static Evas_List *mouse_bindings = NULL;
 static Evas_List *key_bindings = NULL;
 static Evas_List *signal_bindings = NULL;
+static Evas_List *wheel_bindings = NULL;
 
 /* externally accessible functions */
 
@@ -39,34 +42,85 @@
        e_bindings_key_add(eb->context, eb->key, eb->modifiers,
                           eb->any_mod, eb->action, eb->params);
      }
+   
+   /* FIXME: these need to be come normal e_config bindings that you can
+    * modify via ipc and are saved/loaded to/from the user's config
+    */
+   e_bindings_wheel_add(E_BINDING_CONTEXT_CONTAINER,
+                       0, -1, E_BINDING_MODIFIER_NONE, 1,
+                       "desk_linear_flip_by", "-1");
+   e_bindings_wheel_add(E_BINDING_CONTEXT_CONTAINER,
+                       1, -1, E_BINDING_MODIFIER_NONE, 1, 
+                       "desk_linear_flip_by", "-1");
+   e_bindings_wheel_add(E_BINDING_CONTEXT_CONTAINER,
+                       0, 1, E_BINDING_MODIFIER_NONE, 1, 
+                       "desk_linear_flip_by", "1");
+   e_bindings_wheel_add(E_BINDING_CONTEXT_CONTAINER,
+                       1, 1, E_BINDING_MODIFIER_NONE, 1, 
+                       "desk_linear_flip_by", "1");
+   e_bindings_wheel_add(E_BINDING_CONTEXT_POPUP,
+                       0, -1, E_BINDING_MODIFIER_NONE, 1,
+                       "desk_linear_flip_by", "-1");
+   e_bindings_wheel_add(E_BINDING_CONTEXT_POPUP,
+                       1, -1, E_BINDING_MODIFIER_NONE, 1, 
+                       "desk_linear_flip_by", "-1");
+   e_bindings_wheel_add(E_BINDING_CONTEXT_POPUP,
+                       0, 1, E_BINDING_MODIFIER_NONE, 1, 
+                       "desk_linear_flip_by", "1");
+   e_bindings_wheel_add(E_BINDING_CONTEXT_POPUP,
+                       1, 1, E_BINDING_MODIFIER_NONE, 1, 
+                       "desk_linear_flip_by", "1");
+   e_bindings_wheel_add(E_BINDING_CONTEXT_BORDER,
+                       0, -1, E_BINDING_MODIFIER_ALT, 0,
+                       "desk_linear_flip_by", "-1");
+   e_bindings_wheel_add(E_BINDING_CONTEXT_BORDER,
+                       1, -1, E_BINDING_MODIFIER_ALT, 0, 
+                       "desk_linear_flip_by", "-1");
+   e_bindings_wheel_add(E_BINDING_CONTEXT_BORDER,
+                       0, 1, E_BINDING_MODIFIER_ALT, 0, 
+                       "desk_linear_flip_by", "1");
+   e_bindings_wheel_add(E_BINDING_CONTEXT_BORDER,
+                       1, 1, E_BINDING_MODIFIER_ALT, 0, 
+                       "desk_linear_flip_by", "1");
+   
    return 1;
 }
 
 int
 e_bindings_shutdown(void)
 {
-   Evas_List *l;
-   
-   for (l = mouse_bindings; l; l = l->next)
+   while (mouse_bindings)
      {
        E_Binding_Mouse *bind;
        
-       bind = l->data;
+       bind = mouse_bindings->data;
+       mouse_bindings  = evas_list_remove_list(mouse_bindings, mouse_bindings);
        _e_bindings_mouse_free(bind);
      }
-   evas_list_free(mouse_bindings);
-   mouse_bindings = NULL;
-
-   for (l = key_bindings; l; l = l->next)
+   while (key_bindings)
      {
        E_Binding_Key *bind;
        
-       bind = l->data;
+       bind = key_bindings->data;
+       key_bindings  = evas_list_remove_list(key_bindings, key_bindings);
        _e_bindings_key_free(bind);
      }
-   evas_list_free(key_bindings);
-   key_bindings = NULL;
-
+   while (signal_bindings)
+     {
+       E_Binding_Signal *bind;
+       
+       bind = signal_bindings->data;
+       signal_bindings  = evas_list_remove_list(signal_bindings, 
signal_bindings);
+       _e_bindings_signal_free(bind);
+     }
+   while (wheel_bindings)
+     {
+       E_Binding_Wheel *bind;
+       
+       bind = wheel_bindings->data;
+       wheel_bindings  = evas_list_remove_list(wheel_bindings, wheel_bindings);
+       _e_bindings_wheel_free(bind);
+     }
    return 1;
 }
 
@@ -426,10 +480,261 @@
 }
 
 /* FIXME: finish off signal bindings */
-int
+void
+e_bindings_signal_add(E_Binding_Context ctxt, char *sig, char *src, 
E_Binding_Modifier mod, int any_mod, char *action, char *params)
+{
+   E_Binding_Signal *bind;
+   
+   bind = calloc(1, sizeof(E_Binding_Signal));
+   bind->ctxt = ctxt;
+   bind->sig = strdup(sig);
+   bind->src = strdup(src);
+   bind->mod = mod;
+   bind->any_mod = any_mod;
+   bind->action = strdup(action);
+   bind->params = strdup(params);
+   signal_bindings = evas_list_append(signal_bindings, bind);
+}
+
+void
+e_bindings_signal_del(E_Binding_Context ctxt, char *sig, char *src, 
E_Binding_Modifier mod, int any_mod, char *action, char *params)
+{
+   Evas_List *l;
+   
+   for (l = signal_bindings; l; l = l->next)
+     {
+       E_Binding_Signal *bind;
+       
+       bind = l->data;
+       if ((bind->ctxt == ctxt) &&
+           (!strcmp(bind->sig, sig)) &&
+           (!strcmp(bind->src, src)) &&
+           (bind->mod == mod) &&
+           (bind->any_mod == any_mod) &&
+           (!strcmp(bind->action, action)) &&
+           (!strcmp(bind->params, params)))
+         {
+            _e_bindings_signal_free(bind);
+            signal_bindings = evas_list_remove_list(signal_bindings, l);
+            break;
+         }
+     }
+}
+
+E_Action  *
+e_bindings_signal_find(E_Binding_Context ctxt, E_Object *obj, char *sig, char 
*src, E_Binding_Signal **bind_ret)
+{
+   E_Binding_Modifier mod = 0;
+   Evas_List *l;
+   
+   if (strstr(sig, "MOD:Shift")) mod |= E_BINDING_MODIFIER_SHIFT;
+   if (strstr(sig, "MOD:Control")) mod |= E_BINDING_MODIFIER_CTRL;
+   if (strstr(sig, "MOD:Alt")) mod |= E_BINDING_MODIFIER_ALT;
+   if (strstr(sig, "MOD:Super")) mod |= E_BINDING_MODIFIER_WIN;
+   for (l = signal_bindings; l; l = l->next)
+     {
+       E_Binding_Signal *bind;
+       
+       bind = l->data;
+       if ((e_util_glob_match(sig, bind->sig)) &&
+           (e_util_glob_match(src, bind->src)) &&
+           ((bind->any_mod) || (bind->mod == mod)))
+         {
+            if (_e_bindings_context_match(bind->ctxt, ctxt))
+              {
+                 E_Action *act;
+                 
+                 act = e_action_find(bind->action);
+                 if (bind_ret) *bind_ret = bind;
+                 return act;
+              }
+         }
+     }
+   return NULL;
+}
+
+E_Action *
 e_bindings_signal_handle(E_Binding_Context ctxt, E_Object *obj, char *sig, 
char *src)
 {
-   return 0;
+   E_Action *act;
+   E_Binding_Signal *bind;
+   
+   act = e_bindings_signal_find(ctxt, obj, sig, src, &bind);
+   if (act)
+     {
+       if (act->func.go)
+         act->func.go(obj, bind->params);
+       return act;
+     }
+   return act;
+}
+
+/* FIXME: finish off wheel bindings */
+void
+e_bindings_wheel_add(E_Binding_Context ctxt, int direction, int z, 
E_Binding_Modifier mod, int any_mod, char *action, char *params)
+{
+   E_Binding_Wheel *bind;
+   
+   bind = calloc(1, sizeof(E_Binding_Wheel));
+   bind->ctxt = ctxt;
+   bind->direction = direction;
+   bind->z = z;
+   bind->mod = mod;
+   bind->any_mod = any_mod;
+   bind->action = strdup(action);
+   bind->params = strdup(params);
+   wheel_bindings = evas_list_append(wheel_bindings, bind);
+}
+
+void
+e_bindings_wheel_del(E_Binding_Context ctxt, int direction, int z, 
E_Binding_Modifier mod, int any_mod, char *action, char *params)
+{
+   Evas_List *l;
+   
+   for (l = wheel_bindings; l; l = l->next)
+     {
+       E_Binding_Wheel *bind;
+       
+       bind = l->data;
+       if ((bind->ctxt == ctxt) &&
+           (bind->direction == direction) &&
+           (bind->z == z) &&
+           (bind->mod == mod) &&
+           (bind->any_mod == any_mod) &&
+           (!strcmp(bind->action, action)) &&
+           (!strcmp(bind->params, params)))
+         {
+            _e_bindings_wheel_free(bind);
+            wheel_bindings = evas_list_remove_list(wheel_bindings, l);
+            break;
+         }
+     }
+}
+
+void
+e_bindings_wheel_grab(E_Binding_Context ctxt, Ecore_X_Window win)
+{
+   Evas_List *l;
+
+   for (l = wheel_bindings; l; l = l->next)
+     {
+       E_Binding_Wheel *bind;
+       
+       bind = l->data;
+       if (_e_bindings_context_match(bind->ctxt, ctxt))
+         {
+            int mod;
+            int button = 0;
+            
+            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;
+            
+            if (bind->direction == 0)
+              {
+                 if (bind->z < 0) button = 4;
+                 else if (bind->z > 0) button = 5;
+              }
+            else if (bind->direction == 1)
+              {
+                 if (bind->z < 0) button = 6;
+                 else if (bind->z > 0) button = 7;
+              }
+            if (button != 0)
+              ecore_x_window_button_grab(win, button,
+                                         ECORE_X_EVENT_MASK_MOUSE_DOWN,
+                                         mod, bind->any_mod);
+         }
+     }
+}
+
+void
+e_bindings_wheel_ungrab(E_Binding_Context ctxt, Ecore_X_Window win)
+{
+   Evas_List *l;
+   
+   for (l = wheel_bindings; l; l = l->next)
+     {
+       E_Binding_Wheel *bind;
+       
+       bind = l->data;
+       if (_e_bindings_context_match(bind->ctxt, ctxt))
+         {
+            int mod;
+            int button = 0;
+            
+            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;
+            if (bind->direction == 0)
+              {
+                 if (bind->z < 0) button = 4;
+                 else if (bind->z > 0) button = 5;
+              }
+            else if (bind->direction == 1)
+              {
+                 if (bind->z < 0) button = 6;
+                 else if (bind->z > 0) button = 7;
+              }
+            if (button != 0)
+              ecore_x_window_button_ungrab(win, button,
+                                           mod, bind->any_mod);
+         }
+     }
+}
+
+E_Action *
+e_bindings_wheel_find(E_Binding_Context ctxt, E_Object *obj, 
Ecore_X_Event_Mouse_Wheel *ev, E_Binding_Wheel **bind_ret)
+{
+   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 = wheel_bindings; l; l = l->next)
+     {
+       E_Binding_Wheel *bind;
+       
+       bind = l->data;
+       if ((bind->direction == ev->direction) &&
+           (((bind->z < 0) && (ev->z < 0)) || ((bind->z > 0) && (ev->z > 0))) 
&&
+           ((bind->any_mod) || (bind->mod == mod)))
+         {
+            if (_e_bindings_context_match(bind->ctxt, ctxt))
+              {
+                 E_Action *act;
+                 
+                 act = e_action_find(bind->action);
+                 if (bind_ret) *bind_ret = bind;
+                 return act;
+              }
+         }
+     }
+   return NULL;
+}
+
+E_Action *
+e_bindings_wheel_event_handle(E_Binding_Context ctxt, E_Object *obj, 
Ecore_X_Event_Mouse_Wheel *ev)
+{
+   E_Action *act;
+   E_Binding_Wheel *bind;
+
+   act = e_bindings_wheel_find(ctxt, obj, ev, &bind);
+   if (act)
+     {
+       if (act->func.go_wheel)
+         act->func.go_wheel(obj, bind->params, ev);
+       else if (act->func.go)
+         act->func.go(obj, bind->params);
+       return act;
+     }
+   return act;
 }
 
 /* local subsystem functions */
@@ -451,6 +756,24 @@
    free(bind);
 }
 
+static void
+_e_bindings_signal_free(E_Binding_Signal *bind)
+{
+   E_FREE(bind->sig);
+   E_FREE(bind->src);
+   E_FREE(bind->action);
+   E_FREE(bind->params);
+   free(bind);
+}
+
+static void
+_e_bindings_wheel_free(E_Binding_Wheel *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)
 {
===================================================================
RCS file: /cvsroot/enlightenment/e17/apps/e/src/bin/e_bindings.h,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -3 -r1.11 -r1.12
--- e_bindings.h        31 Jul 2005 06:22:31 -0000      1.11
+++ e_bindings.h        22 Sep 2005 12:47:45 -0000      1.12
@@ -13,6 +13,7 @@
    E_BINDING_CONTEXT_MANAGER,
    E_BINDING_CONTEXT_MENU,
    E_BINDING_CONTEXT_WINLIST,
+   E_BINDING_CONTEXT_POPUP,
    E_BINDING_CONTEXT_ANY
 } E_Binding_Context;
 
@@ -32,6 +33,7 @@
 typedef struct _E_Binding_Mouse  E_Binding_Mouse;
 typedef struct _E_Binding_Key    E_Binding_Key;
 typedef struct _E_Binding_Signal E_Binding_Signal;
+typedef struct _E_Binding_Wheel  E_Binding_Wheel;
 
 #else
 #ifndef E_BINDINGS_H
@@ -62,6 +64,19 @@
    E_Binding_Context ctxt;
    char *sig;
    char *src;
+   E_Binding_Modifier mod;
+   unsigned char any_mod : 1;
+   char *action;
+   char *params;
+};
+
+struct _E_Binding_Wheel
+{
+   E_Binding_Context ctxt;
+   int direction;
+   int z;
+   E_Binding_Modifier mod;
+   unsigned char any_mod : 1;
    char *action;
    char *params;
 };
@@ -85,7 +100,17 @@
 EAPI E_Action   *e_bindings_key_down_event_handle(E_Binding_Context ctxt, 
E_Object *obj, Ecore_X_Event_Key_Down *ev);
 EAPI E_Action   *e_bindings_key_up_event_handle(E_Binding_Context ctxt, 
E_Object *obj, Ecore_X_Event_Key_Up *ev);
 
-EAPI int         e_bindings_signal_handle(E_Binding_Context ctxt, E_Object 
*obj, char *sig, char *src);
+EAPI void        e_bindings_signal_add(E_Binding_Context ctxt, char *sig, char 
*src, E_Binding_Modifier mod, int any_mod, char *action, char *params);
+EAPI void        e_bindings_signal_del(E_Binding_Context ctxt, char *sig, char 
*src, E_Binding_Modifier mod, int any_mod, char *action, char *params);
+EAPI E_Action   *e_bindings_signal_find(E_Binding_Context ctxt, E_Object *obj, 
char *sig, char *src, E_Binding_Signal **bind_ret);
+EAPI E_Action   *e_bindings_signal_handle(E_Binding_Context ctxt, E_Object 
*obj, char *sig, char *src);
                                         
+EAPI void        e_bindings_wheel_add(E_Binding_Context ctxt, int direction, 
int z, E_Binding_Modifier mod, int any_mod, char *action, char *params);
+EAPI void        e_bindings_wheel_del(E_Binding_Context ctxt, int direction, 
int z, E_Binding_Modifier mod, int any_mod, char *action, char *params);
+EAPI void        e_bindings_wheel_grab(E_Binding_Context ctxt, Ecore_X_Window 
win);
+EAPI void        e_bindings_wheel_ungrab(E_Binding_Context ctxt, 
Ecore_X_Window win);
+EAPI E_Action   *e_bindings_wheel_find(E_Binding_Context ctxt, E_Object *obj, 
Ecore_X_Event_Mouse_Wheel *ev, E_Binding_Wheel **bind_ret);
+EAPI E_Action   *e_bindings_wheel_event_handle(E_Binding_Context ctxt, 
E_Object *obj, Ecore_X_Event_Mouse_Wheel *ev);
+
 #endif
 #endif
===================================================================
RCS file: /cvsroot/enlightenment/e17/apps/e/src/bin/e_border.c,v
retrieving revision 1.402
retrieving revision 1.403
diff -u -3 -r1.402 -r1.403
--- e_border.c  22 Sep 2005 07:36:47 -0000      1.402
+++ e_border.c  22 Sep 2005 12:47:45 -0000      1.403
@@ -63,10 +63,10 @@
 static void _e_border_cb_signal_drag(void *data, Evas_Object *obj, const char 
*emission, const char *source);
 static int  _e_border_cb_mouse_in(void *data, int type, void *event);
 static int  _e_border_cb_mouse_out(void *data, int type, void *event);
+static int  _e_border_cb_mouse_wheel(void *data, int type, void *event);
 static int  _e_border_cb_mouse_down(void *data, int type, void *event);
 static int  _e_border_cb_mouse_up(void *data, int type, void *event);
 static int  _e_border_cb_mouse_move(void *data, int type, void *event);
-static int  _e_border_cb_mouse_wheel(void *data, int type, void *event);
 static int  _e_border_cb_grab_replay(void *data, int type, void *event);
 
 static void _e_border_eval(E_Border *bd);
@@ -234,6 +234,7 @@
    bd->win = ecore_x_window_override_new(con->win, 0, 0, bd->w, bd->h);
    ecore_x_window_shape_events_select(bd->win, 1);
    e_bindings_mouse_grab(E_BINDING_CONTEXT_BORDER, bd->win);
+   e_bindings_wheel_grab(E_BINDING_CONTEXT_BORDER, bd->win);
    e_focus_setup(bd);
    if (e_canvas_engine_decide(e_config->evas_engine_borders) ==
        E_EVAS_ENGINE_GL_X11)
@@ -271,6 +272,7 @@
        ecore_evas_free(bd->bg_ecore_evas);
        ecore_x_window_del(bd->client.shell_win);
        e_bindings_mouse_ungrab(E_BINDING_CONTEXT_BORDER, bd->win);
+       e_bindings_wheel_ungrab(E_BINDING_CONTEXT_BORDER, bd->win);
        ecore_x_window_del(bd->win);
        free(bd);
        return NULL;
@@ -2122,6 +2124,7 @@
        bd = l->data;
        e_focus_setdown(bd);
        e_bindings_mouse_ungrab(E_BINDING_CONTEXT_BORDER, bd->win);
+       e_bindings_wheel_ungrab(E_BINDING_CONTEXT_BORDER, bd->win);
      }
 }
 
@@ -2136,6 +2139,7 @@
        
        bd = l->data;
        e_bindings_mouse_grab(E_BINDING_CONTEXT_BORDER, bd->win);
+       e_bindings_wheel_grab(E_BINDING_CONTEXT_BORDER, bd->win);
        e_focus_setup(bd);
      }
 }
@@ -2405,6 +2409,7 @@
    ecore_x_window_del(bd->client.shell_win);
    e_focus_setdown(bd);
    e_bindings_mouse_ungrab(E_BINDING_CONTEXT_BORDER, bd->win);
+   e_bindings_wheel_ungrab(E_BINDING_CONTEXT_BORDER, bd->win);
    ecore_x_window_del(bd->win);
 
    e_container_border_remove(bd);
@@ -3809,7 +3814,6 @@
 #endif
    bd->mouse.current.mx = ev->root.x;
    bd->mouse.current.my = ev->root.y;
-   evas_event_feed_mouse_move(bd->bg_evas, ev->x, ev->y, ev->time, NULL);
    evas_event_feed_mouse_in(bd->bg_evas, ev->time, NULL);
    return 1;
 }
@@ -3881,12 +3885,31 @@
 #endif
    bd->mouse.current.mx = ev->root.x;
    bd->mouse.current.my = ev->root.y;
-   evas_event_feed_mouse_move(bd->bg_evas, ev->x, ev->y, ev->time, NULL);
    evas_event_feed_mouse_out(bd->bg_evas, ev->time, NULL);
    return 1;
 }
 
 static int
+_e_border_cb_mouse_wheel(void *data, int type, void *event)
+{
+   Ecore_X_Event_Mouse_Wheel *ev;
+   E_Border *bd;
+
+   ev = event;
+   bd = data;
+   if (ev->event_win == bd->win)
+     {
+       bd->mouse.current.mx = ev->root.x;
+       bd->mouse.current.my = ev->root.y;
+       if (!bd->cur_mouse_action)
+         e_bindings_wheel_event_handle(E_BINDING_CONTEXT_BORDER,
+                                       E_OBJECT(bd), ev);
+     }
+   evas_event_feed_mouse_wheel(bd->bg_evas, ev->direction, ev->z, ev->time, 
NULL);
+   return 1;
+}
+
+static int
 _e_border_cb_mouse_down(void *data, int type, void *event)
 {
    Ecore_X_Event_Mouse_Button_Down *ev;
@@ -3973,7 +3996,6 @@
 
        if (ev->double_click) flags |= EVAS_BUTTON_DOUBLE_CLICK;
        if (ev->triple_click) flags |= EVAS_BUTTON_TRIPLE_CLICK;
-       evas_event_feed_mouse_move(bd->bg_evas, ev->x, ev->y, ev->time, NULL);
        evas_event_feed_mouse_down(bd->bg_evas, ev->button, flags, ev->time, 
NULL);
      }
    return 1;
@@ -4030,7 +4052,6 @@
 
    bd->drag.start = 0;
 
-   evas_event_feed_mouse_move(bd->bg_evas, ev->x, ev->y, ev->time, NULL);
    evas_event_feed_mouse_up(bd->bg_evas, ev->button, EVAS_BUTTON_NONE, 
ev->time, NULL);
    return 1;
 }
@@ -4157,22 +4178,6 @@
 }
 
 static int
-_e_border_cb_mouse_wheel(void *data, int type, void *event)
-{
-   Ecore_X_Event_Mouse_Wheel *ev;
-   E_Border *bd;
-
-   ev = event;
-   bd = data;
-   if (ev->win != bd->event_win) return 1;
-   bd->mouse.current.mx = ev->root.x;
-   bd->mouse.current.my = ev->root.y;
-   evas_event_feed_mouse_move(bd->bg_evas, ev->x, ev->y, ev->time, NULL);
-   evas_event_feed_mouse_wheel(bd->bg_evas, ev->direction, ev->z, ev->time, 
NULL);
-   return 1;
-}
-
-static int
 _e_border_cb_grab_replay(void *data, int type, void *event)
 { 
    Ecore_X_Event_Mouse_Button_Down *ev;
===================================================================
RCS file: /cvsroot/enlightenment/e17/apps/e/src/bin/e_container.c,v
retrieving revision 1.82
retrieving revision 1.83
diff -u -3 -r1.82 -r1.83
--- e_container.c       15 Sep 2005 06:25:28 -0000      1.82
+++ e_container.c       22 Sep 2005 12:47:45 -0000      1.83
@@ -1017,7 +1017,6 @@
      {
        bd = e_border_focused_get();
        if (bd) e_focus_event_mouse_out(bd);
-       evas_event_feed_mouse_move(con->bg_evas, ev->x, ev->y, ev->time, NULL);
         evas_event_feed_mouse_in(con->bg_evas, ev->time, NULL);
      }
    return 1;
@@ -1033,7 +1032,6 @@
    con = _e_container_find_by_event_window(ev->event_win);
    if (con)
      {
-       evas_event_feed_mouse_move(con->bg_evas, ev->x, ev->y, ev->time, NULL);
         evas_event_feed_mouse_out(con->bg_evas, ev->time, NULL);
      }
    return 1;
@@ -1055,7 +1053,6 @@
                                           E_OBJECT(con), ev);
        if (ev->double_click) flags |= EVAS_BUTTON_DOUBLE_CLICK;
        if (ev->triple_click) flags |= EVAS_BUTTON_TRIPLE_CLICK;
-       evas_event_feed_mouse_move(con->bg_evas, ev->x, ev->y, ev->time, NULL);
        evas_event_feed_mouse_down(con->bg_evas, ev->button, flags, ev->time, 
NULL);
      }
    return 1;
@@ -1071,7 +1068,6 @@
    con = _e_container_find_by_event_window(ev->event_win);
    if (con)
      {
-       evas_event_feed_mouse_move(con->bg_evas, ev->x, ev->y, ev->time, NULL);
         evas_event_feed_mouse_up(con->bg_evas, ev->button, EVAS_BUTTON_NONE, 
ev->time, NULL);
        e_bindings_mouse_up_event_handle(E_BINDING_CONTEXT_CONTAINER,
                                         E_OBJECT(con), ev);
@@ -1104,6 +1100,8 @@
    con = _e_container_find_by_event_window(ev->event_win);
    if (con)
      {
+       e_bindings_wheel_event_handle(E_BINDING_CONTEXT_CONTAINER,
+                                     E_OBJECT(con), ev);
        evas_event_feed_mouse_wheel(con->bg_evas, ev->direction, ev->z, 
ev->time, NULL);
      }
    return 1;
===================================================================
RCS file: /cvsroot/enlightenment/e17/apps/e/src/bin/e_focus.c,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -3 -r1.14 -r1.15
--- e_focus.c   31 Jul 2005 06:22:31 -0000      1.14
+++ e_focus.c   22 Sep 2005 12:47:45 -0000      1.15
@@ -94,10 +94,12 @@
      {
        if (!bd->button_grabbed) return;
        e_bindings_mouse_ungrab(E_BINDING_CONTEXT_BORDER, bd->win);
+       e_bindings_wheel_ungrab(E_BINDING_CONTEXT_BORDER, bd->win);
        ecore_x_window_button_ungrab(bd->win, 1, 0, 1);
        ecore_x_window_button_ungrab(bd->win, 2, 0, 1);
        ecore_x_window_button_ungrab(bd->win, 3, 0, 1);
        e_bindings_mouse_grab(E_BINDING_CONTEXT_BORDER, bd->win);
+       e_bindings_wheel_grab(E_BINDING_CONTEXT_BORDER, bd->win);
        bd->button_grabbed = 0;
      }
 }
@@ -153,10 +155,12 @@
 {
    if (!bd->button_grabbed) return;
    e_bindings_mouse_ungrab(E_BINDING_CONTEXT_BORDER, bd->win);
+   e_bindings_wheel_ungrab(E_BINDING_CONTEXT_BORDER, bd->win);
    ecore_x_window_button_ungrab(bd->win, 1, 0, 1);
    ecore_x_window_button_ungrab(bd->win, 2, 0, 1);
    ecore_x_window_button_ungrab(bd->win, 3, 0, 1);
    e_bindings_mouse_grab(E_BINDING_CONTEXT_BORDER, bd->win);
+   e_bindings_wheel_grab(E_BINDING_CONTEXT_BORDER, bd->win);
    bd->button_grabbed = 0;
 }
 
===================================================================
RCS file: /cvsroot/enlightenment/e17/apps/e/src/bin/e_popup.c,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -3 -r1.6 -r1.7
--- e_popup.c   5 Sep 2005 15:24:07 -0000       1.6
+++ e_popup.c   22 Sep 2005 12:47:45 -0000      1.7
@@ -6,9 +6,16 @@
 /* local subsystem functions */
 static void _e_popup_free(E_Popup *pop);
 static int  _e_popup_cb_window_shape(void *data, int ev_type, void *ev);
+static E_Popup *_e_popup_find_by_window(Ecore_X_Window win);
+static int _e_popup_cb_mouse_down(void *data, int type, void *event);
+static int _e_popup_cb_mouse_up(void *data, int type, void *event);
+static int _e_popup_cb_mouse_wheel(void *data, int type, void *event);
 
 /* local subsystem globals */
 static Ecore_Event_Handler *_e_popup_window_shape_handler = NULL;
+static Ecore_Event_Handler *_e_popup_mouse_down_handler = NULL;
+static Ecore_Event_Handler *_e_popup_mouse_up_handler = NULL;
+static Ecore_Event_Handler *_e_popup_mouse_wheel_handler = NULL;
 static Evas_List *_e_popup_list = NULL;
 
 /* externally accessible functions */
@@ -18,6 +25,12 @@
 {
    _e_popup_window_shape_handler = 
ecore_event_handler_add(ECORE_X_EVENT_WINDOW_SHAPE,
                                                           
_e_popup_cb_window_shape, NULL);
+   _e_popup_mouse_down_handler = 
ecore_event_handler_add(ECORE_X_EVENT_MOUSE_BUTTON_DOWN,
+                                                        
_e_popup_cb_mouse_down, NULL);
+   _e_popup_mouse_up_handler = 
ecore_event_handler_add(ECORE_X_EVENT_MOUSE_BUTTON_UP,
+                                                      _e_popup_cb_mouse_up, 
NULL);
+   _e_popup_mouse_wheel_handler = 
ecore_event_handler_add(ECORE_X_EVENT_MOUSE_WHEEL,
+                                                         
_e_popup_cb_mouse_wheel, NULL);
    return 1;
 }
 
@@ -25,6 +38,9 @@
 e_popup_shutdown(void)
 {
    E_FN_DEL(ecore_event_handler_del, _e_popup_window_shape_handler);
+   E_FN_DEL(ecore_event_handler_del, _e_popup_mouse_down_handler);
+   E_FN_DEL(ecore_event_handler_del, _e_popup_mouse_up_handler);
+   E_FN_DEL(ecore_event_handler_del, _e_popup_mouse_wheel_handler);
    return 1;
 }
 
@@ -272,3 +288,72 @@
      }
    return 1;
 }
+
+static E_Popup *
+_e_popup_find_by_window(Ecore_X_Window win)
+{
+   E_Popup *pop;
+   Evas_List *l;
+   
+   for (l = _e_popup_list; l; l = l->next)
+     {
+       pop = l->data;
+       if (pop->evas_win == win) return pop;
+     }
+   return NULL;
+}
+
+static int
+_e_popup_cb_mouse_down(void *data, int type, void *event)
+{
+   Ecore_X_Event_Mouse_Button_Down *ev;
+   E_Popup *pop;
+   
+   ev = event;
+   pop = _e_popup_find_by_window(ev->event_win);
+   if (pop)
+     {
+       Evas_Button_Flags flags = EVAS_BUTTON_NONE;
+       
+       e_bindings_mouse_down_event_handle(E_BINDING_CONTEXT_POPUP,
+                                          E_OBJECT(pop), ev);
+       if (ev->double_click) flags |= EVAS_BUTTON_DOUBLE_CLICK;
+       if (ev->triple_click) flags |= EVAS_BUTTON_TRIPLE_CLICK;
+       evas_event_feed_mouse_down(pop->evas, ev->button, flags, ev->time, 
NULL);
+     }
+   return 1;
+}
+
+static int
+_e_popup_cb_mouse_up(void *data, int type, void *event)
+{
+   Ecore_X_Event_Mouse_Button_Up *ev;
+   E_Popup *pop;
+   
+   ev = event;
+   pop = _e_popup_find_by_window(ev->event_win);
+   if (pop)
+     {
+       evas_event_feed_mouse_up(pop->evas, ev->button, EVAS_BUTTON_NONE, 
ev->time, NULL);
+       e_bindings_mouse_up_event_handle(E_BINDING_CONTEXT_POPUP,
+                                        E_OBJECT(pop), ev);
+     }
+   return 1;
+}
+
+static int
+_e_popup_cb_mouse_wheel(void *data, int type, void *event)
+{
+   Ecore_X_Event_Mouse_Wheel *ev;
+   E_Popup *pop;
+   
+   ev = event;
+   pop = _e_popup_find_by_window(ev->event_win);
+   if (pop)
+     {
+       e_bindings_wheel_event_handle(E_BINDING_CONTEXT_POPUP,
+                                     E_OBJECT(pop), ev);
+       evas_event_feed_mouse_wheel(pop->evas, ev->direction, ev->z, ev->time, 
NULL);
+     }
+   return 1;
+}
===================================================================
RCS file: /cvsroot/enlightenment/e17/apps/e/src/bin/e_winlist.c,v
retrieving revision 1.31
retrieving revision 1.32
diff -u -3 -r1.31 -r1.32
--- e_winlist.c 30 Aug 2005 01:42:56 -0000      1.31
+++ e_winlist.c 22 Sep 2005 12:47:45 -0000      1.32
@@ -769,6 +769,8 @@
    
    ev = event;
    if (ev->win != input_window) return 1;
+   e_bindings_wheel_event_handle(E_BINDING_CONTEXT_WINLIST,
+                                E_OBJECT(winlist->zone), ev);
    if (ev->z < 0) /* up */
      {
        int i;




-------------------------------------------------------
SF.Net email is sponsored by:
Tame your development challenges with Apache's Geronimo App Server. Download
it for free - -and be entered to win a 42" plasma tv or your very own
Sony(tm)PSP.  Click here to play: http://sourceforge.net/geronimo.php
_______________________________________________
enlightenment-cvs mailing list
enlightenment-cvs@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs

Reply via email to