summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Blumenkrantz <zmike@osg.samsung.com>2016-01-22 12:41:43 -0500
committerMike Blumenkrantz <zmike@osg.samsung.com>2016-02-02 13:36:42 -0500
commit9c22c5d12ac4108fb977214341d96d06e0aa921a (patch)
tree3e7daa340dcc52f16f05adca6698b8659013cf0e
parenta28eae0ca9c80bdabd4bb1f4bd73a54da648d80c (diff)
add function for disabling mouse/key/wheel/signal bindings
currently there are a lot of workarounds for inhibiting these bindings, but it's getting harder to keep track of all the conditions and cases where bindings need to be worked around this should greatly simplify the process of toggling binding activation in cases where such behavior is undesirable acpi bindings are always allowed since they are unlikely to interfere with operations where direct-input bindings would be harmful
-rw-r--r--src/bin/e_bindings.c46
-rw-r--r--src/bin/e_bindings.h2
2 files changed, 48 insertions, 0 deletions
diff --git a/src/bin/e_bindings.c b/src/bin/e_bindings.c
index fffb68a8c..13605295c 100644
--- a/src/bin/e_bindings.c
+++ b/src/bin/e_bindings.c
@@ -20,6 +20,8 @@ static Eina_List *signal_bindings = NULL;
20static Eina_List *wheel_bindings = NULL; 20static Eina_List *wheel_bindings = NULL;
21static Eina_List *acpi_bindings = NULL; 21static Eina_List *acpi_bindings = NULL;
22 22
23static unsigned int bindings_disabled = 0;
24
23typedef struct _E_Binding_Edge_Data E_Binding_Edge_Data; 25typedef struct _E_Binding_Edge_Data E_Binding_Edge_Data;
24 26
25struct _E_Binding_Edge_Data 27struct _E_Binding_Edge_Data
@@ -447,6 +449,7 @@ e_bindings_mouse_down_event_handle(E_Binding_Context ctxt, E_Object *obj, E_Bind
447 E_Action *act; 449 E_Action *act;
448 E_Binding_Mouse *binding; 450 E_Binding_Mouse *binding;
449 451
452 if (bindings_disabled) return NULL;
450 act = e_bindings_mouse_button_find(ctxt, ev, &binding); 453 act = e_bindings_mouse_button_find(ctxt, ev, &binding);
451 if (act) 454 if (act)
452 { 455 {
@@ -485,6 +488,7 @@ e_bindings_mouse_up_event_handle(E_Binding_Context ctxt, E_Object *obj, E_Bindin
485 E_Action *act; 488 E_Action *act;
486 E_Binding_Mouse *binding; 489 E_Binding_Mouse *binding;
487 490
491 if (bindings_disabled) return NULL;
488 act = e_bindings_mouse_button_find(ctxt, ev, &binding); 492 act = e_bindings_mouse_button_find(ctxt, ev, &binding);
489 if (act) 493 if (act)
490 { 494 {
@@ -643,6 +647,7 @@ e_bindings_key_down_event_handle(E_Binding_Context ctxt, E_Object *obj, Ecore_Ev
643 E_Binding_Key *binding; 647 E_Binding_Key *binding;
644 Eina_List *l; 648 Eina_List *l;
645 649
650 if (bindings_disabled) return NULL;
646 mod = _e_bindings_modifiers(ev->modifiers); 651 mod = _e_bindings_modifiers(ev->modifiers);
647 EINA_LIST_FOREACH(key_bindings, l, binding) 652 EINA_LIST_FOREACH(key_bindings, l, binding)
648 { 653 {
@@ -676,6 +681,7 @@ e_bindings_key_up_event_handle(E_Binding_Context ctxt, E_Object *obj, Ecore_Even
676 E_Binding_Key *binding; 681 E_Binding_Key *binding;
677 Eina_List *l; 682 Eina_List *l;
678 683
684 if (bindings_disabled) return NULL;
679 mod = _e_bindings_modifiers(ev->modifiers); 685 mod = _e_bindings_modifiers(ev->modifiers);
680 EINA_LIST_FOREACH(key_bindings, l, binding) 686 EINA_LIST_FOREACH(key_bindings, l, binding)
681 { 687 {
@@ -894,6 +900,7 @@ e_bindings_edge_in_event_handle(E_Binding_Context ctxt, E_Object *obj, E_Event_Z
894 E_Action *act = NULL; 900 E_Action *act = NULL;
895 Eina_List *l; 901 Eina_List *l;
896 902
903 if (bindings_disabled) return NULL;
897 current = e_desk_at_xy_get(ev->zone, ev->zone->desk_x_current, ev->zone->desk_y_current); 904 current = e_desk_at_xy_get(ev->zone, ev->zone->desk_x_current, ev->zone->desk_y_current);
898 if (current->fullscreen_clients && (!e_config->fullscreen_flip)) return NULL; 905 if (current->fullscreen_clients && (!e_config->fullscreen_flip)) return NULL;
899 906
@@ -943,6 +950,7 @@ e_bindings_edge_out_event_handle(E_Binding_Context ctxt, E_Object *obj, E_Event_
943 E_Action *act = NULL; 950 E_Action *act = NULL;
944 Eina_List *l; 951 Eina_List *l;
945 952
953 if (bindings_disabled) return NULL;
946 if (ev->modifiers & ECORE_EVENT_MODIFIER_SHIFT) mod |= E_BINDING_MODIFIER_SHIFT; 954 if (ev->modifiers & ECORE_EVENT_MODIFIER_SHIFT) mod |= E_BINDING_MODIFIER_SHIFT;
947 if (ev->modifiers & ECORE_EVENT_MODIFIER_CTRL) mod |= E_BINDING_MODIFIER_CTRL; 955 if (ev->modifiers & ECORE_EVENT_MODIFIER_CTRL) mod |= E_BINDING_MODIFIER_CTRL;
948 if (ev->modifiers & ECORE_EVENT_MODIFIER_ALT) mod |= E_BINDING_MODIFIER_ALT; 956 if (ev->modifiers & ECORE_EVENT_MODIFIER_ALT) mod |= E_BINDING_MODIFIER_ALT;
@@ -986,6 +994,7 @@ e_bindings_edge_down_event_handle(E_Binding_Context ctxt, E_Object *obj, E_Event
986 E_Action *act = NULL; 994 E_Action *act = NULL;
987 Eina_List *l; 995 Eina_List *l;
988 996
997 if (bindings_disabled) return NULL;
989 current = e_desk_at_xy_get(ev->zone, ev->zone->desk_x_current, ev->zone->desk_y_current); 998 current = e_desk_at_xy_get(ev->zone, ev->zone->desk_x_current, ev->zone->desk_y_current);
990 if (current->fullscreen_clients && (!e_config->fullscreen_flip)) return NULL; 999 if (current->fullscreen_clients && (!e_config->fullscreen_flip)) return NULL;
991 1000
@@ -1022,6 +1031,7 @@ e_bindings_edge_up_event_handle(E_Binding_Context ctxt, E_Object *obj, E_Event_Z
1022 E_Action *act = NULL; 1031 E_Action *act = NULL;
1023 Eina_List *l; 1032 Eina_List *l;
1024 1033
1034 if (bindings_disabled) return NULL;
1025 if (ev->modifiers & ECORE_EVENT_MODIFIER_SHIFT) mod |= E_BINDING_MODIFIER_SHIFT; 1035 if (ev->modifiers & ECORE_EVENT_MODIFIER_SHIFT) mod |= E_BINDING_MODIFIER_SHIFT;
1026 if (ev->modifiers & ECORE_EVENT_MODIFIER_CTRL) mod |= E_BINDING_MODIFIER_CTRL; 1036 if (ev->modifiers & ECORE_EVENT_MODIFIER_CTRL) mod |= E_BINDING_MODIFIER_CTRL;
1027 if (ev->modifiers & ECORE_EVENT_MODIFIER_ALT) mod |= E_BINDING_MODIFIER_ALT; 1037 if (ev->modifiers & ECORE_EVENT_MODIFIER_ALT) mod |= E_BINDING_MODIFIER_ALT;
@@ -1121,6 +1131,7 @@ e_bindings_signal_handle(E_Binding_Context ctxt, E_Object *obj, const char *sig,
1121 E_Action *act; 1131 E_Action *act;
1122 E_Binding_Signal *binding; 1132 E_Binding_Signal *binding;
1123 1133
1134 if (bindings_disabled) return NULL;
1124 if ((!sig) || (sig && (sig[0] == 0))) 1135 if ((!sig) || (sig && (sig[0] == 0)))
1125 return NULL; 1136 return NULL;
1126 if (src && (src[0] == 0)) src = NULL; 1137 if (src && (src[0] == 0)) src = NULL;
@@ -1285,6 +1296,7 @@ e_bindings_wheel_event_handle(E_Binding_Context ctxt, E_Object *obj, E_Binding_E
1285 E_Action *act; 1296 E_Action *act;
1286 E_Binding_Wheel *binding; 1297 E_Binding_Wheel *binding;
1287 1298
1299 if (bindings_disabled) return NULL;
1288 act = e_bindings_wheel_find(ctxt, ev, &binding); 1300 act = e_bindings_wheel_find(ctxt, ev, &binding);
1289 if (act) 1301 if (act)
1290 { 1302 {
@@ -1400,6 +1412,40 @@ e_bindings_acpi_event_handle(E_Binding_Context ctxt, E_Object *obj, E_Event_Acpi
1400 return act; 1412 return act;
1401} 1413}
1402 1414
1415E_API void
1416e_bindings_disabled_set(Eina_Bool disabled)
1417{
1418 E_Client *ec;
1419 Ecore_Window win;
1420
1421 if (disabled)
1422 {
1423 if ((!bindings_disabled) && (e_comp->comp_type == E_PIXMAP_TYPE_X))
1424 {
1425 e_bindings_key_ungrab(E_BINDING_CONTEXT_ANY, e_comp->root);
1426 E_CLIENT_FOREACH(ec)
1427 {
1428 if (e_client_util_ignored_get(ec)) continue;
1429 win = e_client_util_win_get(ec);
1430 e_bindings_mouse_ungrab(E_BINDING_CONTEXT_WINDOW, win);
1431 e_bindings_wheel_ungrab(E_BINDING_CONTEXT_WINDOW, win);
1432 }
1433 }
1434 bindings_disabled++;
1435 }
1436 else if (bindings_disabled)
1437 bindings_disabled--;
1438 if (bindings_disabled || (e_comp->comp_type != E_PIXMAP_TYPE_X)) return;
1439 e_bindings_key_grab(E_BINDING_CONTEXT_ANY, e_comp->root);
1440 E_CLIENT_FOREACH(ec)
1441 {
1442 if (e_client_util_ignored_get(ec)) continue;
1443 win = e_client_util_win_get(ec);
1444 e_bindings_mouse_grab(E_BINDING_CONTEXT_WINDOW, win);
1445 e_bindings_wheel_grab(E_BINDING_CONTEXT_WINDOW, win);
1446 }
1447}
1448
1403static void 1449static void
1404_e_bindings_mouse_free(E_Binding_Mouse *binding) 1450_e_bindings_mouse_free(E_Binding_Mouse *binding)
1405{ 1451{
diff --git a/src/bin/e_bindings.h b/src/bin/e_bindings.h
index effec66ab..dbd8c366e 100644
--- a/src/bin/e_bindings.h
+++ b/src/bin/e_bindings.h
@@ -201,5 +201,7 @@ E_API void e_bindings_evas_event_mouse_wheel_convert(const Evas_Event_Mouse_Whee
201E_API void e_bindings_ecore_event_mouse_button_convert(const Ecore_Event_Mouse_Button *ev, E_Binding_Event_Mouse_Button *event); 201E_API void e_bindings_ecore_event_mouse_button_convert(const Ecore_Event_Mouse_Button *ev, E_Binding_Event_Mouse_Button *event);
202E_API void e_bindings_ecore_event_mouse_wheel_convert(const Ecore_Event_Mouse_Wheel *ev, E_Binding_Event_Wheel *event); 202E_API void e_bindings_ecore_event_mouse_wheel_convert(const Ecore_Event_Mouse_Wheel *ev, E_Binding_Event_Wheel *event);
203 203
204
205E_API void e_bindings_disabled_set(Eina_Bool disabled);
204#endif 206#endif
205#endif 207#endif