raster pushed a commit to branch master.

commit 8462dc3c04060e33a5664f47838c3d0a3217497c
Author: Carsten Haitzler (Rasterman) <[email protected]>
Date:   Thu Jun 13 20:10:52 2013 +0900

    put in "key allowed" call in e_bindings for keys to filter out
    problematic key binds. :)
---
 src/bin/e_bindings.c                               | 36 +++++++++++++++++++---
 src/bin/e_bindings.h                               |  2 ++
 .../conf_bindings/e_int_config_keybindings.c       |  3 ++
 3 files changed, 37 insertions(+), 4 deletions(-)

diff --git a/src/bin/e_bindings.c b/src/bin/e_bindings.c
index 012167b..6e66626 100644
--- a/src/bin/e_bindings.c
+++ b/src/bin/e_bindings.c
@@ -591,8 +591,9 @@ e_bindings_key_grab(E_Binding_Context ctxt, Ecore_X_Window 
win)
      {
         if (_e_bindings_context_match(binding->ctxt, ctxt))
           {
-             ecore_x_window_key_grab(win, binding->key,
-                                     
e_bindings_modifiers_to_ecore_convert(binding->mod), binding->any_mod);
+             if (e_bindings_key_allowed(binding->key))
+               ecore_x_window_key_grab(win, binding->key,
+                                       
e_bindings_modifiers_to_ecore_convert(binding->mod), binding->any_mod);
           }
      }
 }
@@ -607,8 +608,9 @@ e_bindings_key_ungrab(E_Binding_Context ctxt, 
Ecore_X_Window win)
      {
         if (_e_bindings_context_match(binding->ctxt, ctxt))
           {
-             ecore_x_window_key_ungrab(win, binding->key,
-                                       
e_bindings_modifiers_to_ecore_convert(binding->mod), binding->any_mod);
+             if (e_bindings_key_allowed(binding->key))
+               ecore_x_window_key_ungrab(win, binding->key,
+                                         
e_bindings_modifiers_to_ecore_convert(binding->mod), binding->any_mod);
           }
      }
 }
@@ -729,6 +731,32 @@ e_bindings_key_up_event_find(E_Binding_Context ctxt, 
Ecore_Event_Key *ev)
    return NULL;
 }
 
+EAPI Eina_Bool
+e_bindings_key_allowed(const char *key)
+{
+   if ((!strcmp(key, "Shift_L")) ||
+       (!strcmp(key, "Shift_R")) ||
+       (!strcmp(key, "Control_L")) ||
+       (!strcmp(key, "Control_R")) ||
+       (!strcmp(key, "Alt_L")) ||
+       (!strcmp(key, "Alt_R")) ||
+       (!strcmp(key, "Meta_L")) ||
+       (!strcmp(key, "Meta_R")) ||
+       (!strcmp(key, "Hyper_L")) ||
+       (!strcmp(key, "Hyper_R")) ||
+       (!strcmp(key, "Super_L")) ||
+       (!strcmp(key, "Super_R")) ||
+       (!strcmp(key, "AltGr")) ||
+       (!strcmp(key, "Caps_Lock")) ||
+       (!strcmp(key, "Shift_Lock")) ||
+       (!strcmp(key, "Kana_Lock")) ||
+       (!strcmp(key, "Num_Lock")) ||
+       (!strcmp(key, "Scroll_Lock")))
+     return EINA_FALSE;
+   return EINA_TRUE;
+}
+
+
 EAPI void
 e_bindings_edge_add(E_Binding_Context ctxt, E_Zone_Edge edge, Eina_Bool 
drag_only, E_Binding_Modifier mod, int any_mod, const char *action, const char 
*params, float delay)
 {
diff --git a/src/bin/e_bindings.h b/src/bin/e_bindings.h
index d51bce5..489f825 100644
--- a/src/bin/e_bindings.h
+++ b/src/bin/e_bindings.h
@@ -163,6 +163,8 @@ EAPI E_Action   
*e_bindings_key_up_event_handle(E_Binding_Context ctxt, E_Object
 EAPI E_Action   *e_bindings_key_down_event_find(E_Binding_Context ctxt, 
Ecore_Event_Key *ev);
 EAPI E_Action   *e_bindings_key_up_event_find(E_Binding_Context ctxt, 
Ecore_Event_Key *ev);
 
+EAPI Eina_Bool   e_bindings_key_allowed(const char *key);
+
 EAPI void        e_bindings_edge_add(E_Binding_Context ctxt, E_Zone_Edge edge, 
Eina_Bool drag_only, E_Binding_Modifier mod, int any_mod, const char *action, 
const char *params, float delay);
 EAPI Eina_Bool   e_bindings_edge_flippable_get(E_Zone_Edge edge);
 EAPI Eina_Bool   e_bindings_edge_non_flippable_get(E_Zone_Edge edge);
diff --git a/src/modules/conf_bindings/e_int_config_keybindings.c 
b/src/modules/conf_bindings/e_int_config_keybindings.c
index 431345f..3005925 100644
--- a/src/modules/conf_bindings/e_int_config_keybindings.c
+++ b/src/modules/conf_bindings/e_int_config_keybindings.c
@@ -854,6 +854,9 @@ _grab_key_down_cb(void *data,
         unsigned int mod = E_BINDING_MODIFIER_NONE;
         unsigned int n, found = 0;
 
+        if (!e_bindings_key_allowed(ev->keyname))
+          return ECORE_CALLBACK_PASS_ON;
+
         if (ev->modifiers & ECORE_EVENT_MODIFIER_SHIFT)
           mod |= E_BINDING_MODIFIER_SHIFT;
         if (ev->modifiers & ECORE_EVENT_MODIFIER_CTRL)

-- 

------------------------------------------------------------------------------
This SF.net email is sponsored by Windows:

Build for Windows Store.

http://p.sf.net/sfu/windows-dev2dev

Reply via email to