Hi!

Here's a patch to include ipc handlers for clearing all
Mouse/Key/Signal/Wheel bindings in E. Though it is theoretically
possible for an external program to read through the existing
keybindings and erase them one after the other, this offers a faster
and cleaner solution. This is useful when an external script is used
to fully configure the keybindings from scratch, ignoring the default
keybindings of E.

Regards,
Ramkumar.

--
April 1: This is the day upon which we are reminded of
what we are on the other three hundred and sixty-four.
         -- Mark Twain, "Pudd'nhead Wilson's Calendar"
ProxyChains-3.1 (http://proxychains.sf.net)
Index: e_bindings.c
===================================================================
RCS file: /cvs/e/e17/apps/e/src/bin/e_bindings.c,v
retrieving revision 1.33
diff -u -r1.33 e_bindings.c
--- e_bindings.c        23 Aug 2006 00:34:33 -0000      1.33
+++ e_bindings.c        6 Sep 2006 13:44:36 -0000
@@ -81,38 +81,10 @@
 EAPI int
 e_bindings_shutdown(void)
 {
-   while (mouse_bindings)
-     {
-       E_Binding_Mouse *bind;
-       
-       bind = mouse_bindings->data;
-       mouse_bindings  = evas_list_remove_list(mouse_bindings, mouse_bindings);
-       _e_bindings_mouse_free(bind);
-     }
-   while (key_bindings)
-     {
-       E_Binding_Key *bind;
-       
-       bind = key_bindings->data;
-       key_bindings  = evas_list_remove_list(key_bindings, key_bindings);
-       _e_bindings_key_free(bind);
-     }
-   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);
-     }
+   e_bindings_mouse_clear();
+   e_bindings_key_clear();
+   e_bindings_signal_clear();
+   e_bindings_wheel_clear();
    return 1;
 }
 
@@ -158,6 +130,19 @@
 }
 
 EAPI void
+e_bindings_mouse_clear()
+{
+   while (mouse_bindings)
+     {
+       E_Binding_Mouse *bind;
+
+       bind = mouse_bindings->data;
+       mouse_bindings  = evas_list_remove_list(mouse_bindings, mouse_bindings);
+       _e_bindings_mouse_free(bind);
+     }
+}
+
+EAPI void
 e_bindings_mouse_grab(E_Binding_Context ctxt, Ecore_X_Window win)
 {
    Evas_List *l;
@@ -350,6 +335,19 @@
 }
 
 EAPI void
+e_bindings_key_clear()
+{
+   while (key_bindings)
+     {
+       E_Binding_Key *bind;
+
+       bind = key_bindings->data;
+       key_bindings  = evas_list_remove_list(key_bindings, key_bindings);
+       _e_bindings_key_free(bind);
+     }
+}
+
+EAPI void
 e_bindings_key_grab(E_Binding_Context ctxt, Ecore_X_Window win)
 {
    Evas_List *l;
@@ -520,6 +518,19 @@
      }
 }
 
+EAPI void
+e_bindings_signal_clear()
+{
+   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);
+     }
+}
+
 EAPI E_Action  *
 e_bindings_signal_find(E_Binding_Context ctxt, E_Object *obj, const char *sig, 
const char *src, E_Binding_Signal **bind_ret)
 {
@@ -612,6 +623,19 @@
             wheel_bindings = evas_list_remove_list(wheel_bindings, l);
             break;
          }
+     }
+}
+
+EAPI void
+e_bindings_wheel_clear()
+{
+   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);
      }
 }
 
Index: e_bindings.h
===================================================================
RCS file: /cvs/e/e17/apps/e/src/bin/e_bindings.h,v
retrieving revision 1.14
diff -u -r1.14 e_bindings.h
--- e_bindings.h        21 Aug 2006 16:25:57 -0000      1.14
+++ e_bindings.h        6 Sep 2006 13:44:36 -0000
@@ -86,6 +86,7 @@
 
 EAPI void        e_bindings_mouse_add(E_Binding_Context ctxt, int button, 
E_Binding_Modifier mod, int any_mod, const char *action, const char *params);
 EAPI void        e_bindings_mouse_del(E_Binding_Context ctxt, int button, 
E_Binding_Modifier mod, int any_mod, const char *action, const char *params);
+EAPI void        e_bindings_mouse_clear(void);
 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 E_Action   *e_bindings_mouse_down_find(E_Binding_Context ctxt, E_Object 
*obj, Ecore_X_Event_Mouse_Button_Down *ev, E_Binding_Mouse **bind_ret);
@@ -95,6 +96,7 @@
 
 EAPI void        e_bindings_key_add(E_Binding_Context ctxt, const char *key, 
E_Binding_Modifier mod, int any_mod, const char *action, const char *params);
 EAPI void        e_bindings_key_del(E_Binding_Context ctxt, const char *key, 
E_Binding_Modifier mod, int any_mod, const char *action, const char *params);
+EAPI void        e_bindings_key_clear(void);
 EAPI void        e_bindings_key_grab(E_Binding_Context ctxt, Ecore_X_Window 
win);
 EAPI void        e_bindings_key_ungrab(E_Binding_Context ctxt, Ecore_X_Window 
win);
 EAPI E_Action   *e_bindings_key_down_event_handle(E_Binding_Context ctxt, 
E_Object *obj, Ecore_X_Event_Key_Down *ev);
@@ -102,11 +104,13 @@
 
 EAPI void        e_bindings_signal_add(E_Binding_Context ctxt, const char 
*sig, const char *src, E_Binding_Modifier mod, int any_mod, const char *action, 
const char *params);
 EAPI void        e_bindings_signal_del(E_Binding_Context ctxt, const char 
*sig, const char *src, E_Binding_Modifier mod, int any_mod, const char *action, 
const char *params);
+EAPI void        e_bindings_signal_clear(void);
 EAPI E_Action   *e_bindings_signal_find(E_Binding_Context ctxt, E_Object *obj, 
const char *sig, const char *src, E_Binding_Signal **bind_ret);
 EAPI E_Action   *e_bindings_signal_handle(E_Binding_Context ctxt, E_Object 
*obj, const char *sig, const char *src);
                                         
 EAPI void        e_bindings_wheel_add(E_Binding_Context ctxt, int direction, 
int z, E_Binding_Modifier mod, int any_mod, const char *action, const char 
*params);
 EAPI void        e_bindings_wheel_del(E_Binding_Context ctxt, int direction, 
int z, E_Binding_Modifier mod, int any_mod, const char *action, const char 
*params);
+EAPI void        e_bindings_wheel_clear(void);
 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);
Index: e_ipc_handlers.h
===================================================================
RCS file: /cvs/e/e17/apps/e/src/bin/e_ipc_handlers.h,v
retrieving revision 1.135
diff -u -r1.135 e_ipc_handlers.h
--- e_ipc_handlers.h    6 Sep 2006 08:06:19 -0000       1.135
+++ e_ipc_handlers.h    6 Sep 2006 13:44:38 -0000
@@ -6,7 +6,7 @@
  * This is a very SPECIAL file. This serves as a kind of "auto code generator"
  * to handle the encoder, decoder etc. aspects of ipc requests. the aim here
  * is to make writing support for a new opcode simple and compact. It intends
- * to centralize the handling into 1 spot, instead of having ti spread around
+ * to centralize the handling into 1 spot, instead of having to spread around
  * the code in N different places, as well as providing common construct macros
  * to help make the code more compact and easier to create.
  */
@@ -16,7 +16,7 @@
 # define E_IPC_HANDLERS_H
 
 /* 
- * add a new ooption for enlightenment_remote
+ * add a new option for enlightenment_remote
  * OP(opt, num_params, description, num_expected_replies, HDL) 
  */
 # define OP(__a, __b, __c, __d, __e) \
@@ -2836,6 +2836,33 @@
 #undef HDL
 
 /****************************************************************************/
+#define HDL E_IPC_OP_BINDING_MOUSE_CLEAR
+#if (TYPE == E_REMOTE_OPTIONS)
+   OP("-binding-mouse-clear", 0, "Clear all existing mouse bindings.", 0, HDL)
+#elif (TYPE == E_REMOTE_OUT)
+   REQ_NULL(HDL);
+#elif (TYPE == E_WM_IN)
+   GENERIC(HDL);
+   Evas_List *l;
+   for (l = e_config->mouse_bindings; l; l = evas_list_next (l))
+     {
+        E_Config_Binding_Mouse *eb;
+        eb = l->data;
+        e_config->mouse_bindings = 
evas_list_remove_list(e_config->mouse_bindings, l);
+        if (eb->action) evas_stringshare_del(eb->action);
+        if (eb->params) evas_stringshare_del(eb->params);
+        E_FREE(eb);
+     }
+   e_border_button_bindings_ungrab_all();
+   e_bindings_mouse_clear();
+   e_border_button_bindings_grab_all();
+   e_config_save_queue();
+   END_GENERIC();
+#elif (TYPE == E_REMOTE_IN)
+#endif
+#undef HDL
+
+/****************************************************************************/
 #define HDL E_IPC_OP_BINDING_KEY_LIST 
 #if (TYPE == E_REMOTE_OPTIONS)
    /* e_remote define command line args */
@@ -3162,6 +3189,34 @@
 #undef HDL
 
 /****************************************************************************/
+#define HDL E_IPC_OP_BINDING_KEY_CLEAR
+#if (TYPE == E_REMOTE_OPTIONS)
+   OP("-binding-key-clear", 0, "Clear all existing key bindings.", 0, HDL)
+#elif (TYPE == E_REMOTE_OUT)
+   REQ_NULL(HDL);
+#elif (TYPE == E_WM_IN)
+   GENERIC(HDL);
+   Evas_List *l;
+   for (l = e_config->key_bindings; l; l = evas_list_next (l))
+     {
+        E_Config_Binding_Key *eb;
+        eb = l->data;
+        e_config->key_bindings = evas_list_remove_list(e_config->key_bindings, 
l);
+        if (eb->key) evas_stringshare_del(eb->key);
+        if (eb->action) evas_stringshare_del(eb->action);
+        if (eb->params) evas_stringshare_del(eb->params);
+        E_FREE(eb);
+     }
+   e_managers_keys_ungrab();
+   e_bindings_key_clear();
+   e_managers_keys_grab();
+   e_config_save_queue();
+   END_GENERIC();
+#elif (TYPE == E_REMOTE_IN)
+#endif
+#undef HDL
+
+/****************************************************************************/
 #define HDL E_IPC_OP_ALWAYS_CLICK_TO_RAISE_SET
 #if (TYPE == E_REMOTE_OPTIONS)
    OP("-always-click-to-raise-set", 1, "Set the always click to raise policy, 
1 for enabled 0 for disabled", 0, HDL)
@@ -6250,6 +6305,33 @@
 #undef HDL
 
 /****************************************************************************/
+#define HDL E_IPC_OP_BINDING_SIGNAL_CLEAR
+#if (TYPE == E_REMOTE_OPTIONS)
+   OP("-binding-signal-clear", 0, "Clear all existing signal bindings.", 0, 
HDL)
+#elif (TYPE == E_REMOTE_OUT)
+   REQ_NULL(HDL);
+#elif (TYPE == E_WM_IN)
+   GENERIC(HDL);
+   Evas_List *l;
+   for (l = e_config->signal_bindings; l; l = evas_list_next (l))
+     {
+        E_Config_Binding_Signal *eb;
+        eb = l->data;
+        e_config->signal_bindings = 
evas_list_remove_list(e_config->signal_bindings, l);
+        if (eb->signal) evas_stringshare_del(eb->signal);
+        if (eb->source) evas_stringshare_del(eb->source);
+        if (eb->action) evas_stringshare_del(eb->action);
+        if (eb->params) evas_stringshare_del(eb->params);
+        E_FREE(eb);
+     }
+   e_bindings_signal_clear();
+   e_config_save_queue();
+   END_GENERIC();
+#elif (TYPE == E_REMOTE_IN)
+#endif
+#undef HDL
+
+/****************************************************************************/
 #define HDL E_IPC_OP_BINDING_WHEEL_LIST 
 #if (TYPE == E_REMOTE_OPTIONS)
    /* e_remote define command line args */
@@ -6573,6 +6655,31 @@
         e_config_save_queue();
      }
    END_INT5_STRING2(v);
+#elif (TYPE == E_REMOTE_IN)
+#endif
+#undef HDL
+
+/****************************************************************************/
+#define HDL E_IPC_OP_BINDING_WHEEL_CLEAR
+#if (TYPE == E_REMOTE_OPTIONS)
+   OP("-binding-wheel-clear", 0, "Clear all existing wheel bindings.", 0, HDL)
+#elif (TYPE == E_REMOTE_OUT)
+   REQ_NULL(HDL);
+#elif (TYPE == E_WM_IN)
+   GENERIC(HDL);
+   Evas_List *l;
+   for (l = e_config->wheel_bindings; l; l = evas_list_next (l))
+     {
+        E_Config_Binding_Wheel *eb;
+        eb = l->data;
+        e_config->wheel_bindings = 
evas_list_remove_list(e_config->wheel_bindings, l);
+        if (eb->action) evas_stringshare_del(eb->action);
+        if (eb->params) evas_stringshare_del(eb->params);
+        E_FREE(eb);
+     }
+   e_bindings_wheel_clear();
+   e_config_save_queue();
+   END_GENERIC();
 #elif (TYPE == E_REMOTE_IN)
 #endif
 #undef HDL
Index: e_ipc_handlers_list.h
===================================================================
RCS file: /cvs/e/e17/apps/e/src/bin/e_ipc_handlers_list.h,v
retrieving revision 1.49
diff -u -r1.49 e_ipc_handlers_list.h
--- e_ipc_handlers_list.h       6 Sep 2006 08:06:19 -0000       1.49
+++ e_ipc_handlers_list.h       6 Sep 2006 13:44:40 -0000
@@ -389,3 +389,8 @@
 #define E_IPC_OP_EDGE_FLIP_DRAGGING_SET 360
 #define E_IPC_OP_EDGE_FLIP_DRAGGING_GET 361
 #define E_IPC_OP_EDGE_FLIP_DRAGGING_GET_REPLY 362
+
+#define E_IPC_OP_BINDING_KEY_CLEAR 363
+#define E_IPC_OP_BINDING_MOUSE_CLEAR 364
+#define E_IPC_OP_BINDING_SIGNAL_CLEAR 365
+#define E_IPC_OP_BINDING_WHEEL_CLEAR 366
-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
enlightenment-devel mailing list
enlightenment-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-devel

Reply via email to