From 9bbc8158bd21dca5649ef75403b06474ce39bbb9 Mon Sep 17 00:00:00 2001 From: Viktor Kojouharov Date: Wed, 25 Feb 2009 22:21:46 +0000 Subject: [PATCH] edge and corner binding infrastructure. If you have an old config, enable the conf_edgebindings module and hit 'Reset to defaults' to get edge desktop switching. The edge/corner picker needs some love from someone who is not artistically challenged. And a proper module icon as well. SVN revision: 39220 --- config/default/e.src | 3 +- config/illume/e.src | 3 +- config/minimalist/e.src | 51 +- config/netbook/e.src | 51 +- config/scaleable/e.src | 51 +- config/standard/e.src | 63 +- configure.ac | 3 + data/themes/default.edc | 209 +++ src/bin/e_actions.c | 124 ++ src/bin/e_actions.h | 1 + src/bin/e_bindings.c | 222 ++- src/bin/e_bindings.h | 20 + src/bin/e_config.c | 52 +- src/bin/e_config.h | 16 +- src/bin/e_desk.c | 30 + src/bin/e_desk.h | 6 + src/bin/e_int_shelf_config.c | 1 - src/bin/e_ipc_handlers.h | 82 -- src/bin/e_shelf.c | 56 - src/bin/e_zone.c | 761 +++++----- src/bin/e_zone.h | 26 +- src/modules/Makefile.am | 5 + src/modules/conf_desks/e_int_config_desks.c | 20 - src/modules/conf_edgebindings/.cvsignore | 7 + src/modules/conf_edgebindings/Makefile.am | 31 + .../e-module-conf_edgebindings.edj | Bin 0 -> 8732 bytes .../e_int_config_edgebindings.c | 1291 +++++++++++++++++ .../e_int_config_edgebindings.h | 9 + src/modules/conf_edgebindings/e_mod_main.c | 56 + src/modules/conf_edgebindings/e_mod_main.h | 19 + .../conf_edgebindings/module.desktop.in | 6 + 31 files changed, 2695 insertions(+), 580 deletions(-) create mode 100644 src/modules/conf_edgebindings/.cvsignore create mode 100644 src/modules/conf_edgebindings/Makefile.am create mode 100644 src/modules/conf_edgebindings/e-module-conf_edgebindings.edj create mode 100644 src/modules/conf_edgebindings/e_int_config_edgebindings.c create mode 100644 src/modules/conf_edgebindings/e_int_config_edgebindings.h create mode 100644 src/modules/conf_edgebindings/e_mod_main.c create mode 100644 src/modules/conf_edgebindings/e_mod_main.h create mode 100644 src/modules/conf_edgebindings/module.desktop.in diff --git a/config/default/e.src b/config/default/e.src index 68fe2b872..eaa35e804 100644 --- a/config/default/e.src +++ b/config/default/e.src @@ -10,6 +10,7 @@ group "E_Config" struct { value "border_shade_transition" int: 3; value "border_shade_speed" double: 3000.0000000000000000000000000; value "framerate" double: 30.0000000000000000000000000; + value "priority" int: 1; value "image_cache" int: 4096; value "font_cache" int: 512; value "edje_cache" int: 10; @@ -19,8 +20,6 @@ group "E_Config" struct { value "use_virtual_roots" int: 0; value "show_desktop_icons" int: 1; value "edge_flip_dragging" int: 0; - value "edge_flip_moving" int: 0; - value "edge_flip_timeout" double: 0.2500000000000000000000000; value "evas_engine_default" int: 1; value "evas_engine_container" int: 0; value "evas_engine_init" int: 0; diff --git a/config/illume/e.src b/config/illume/e.src index c4090309c..10c6e62a6 100644 --- a/config/illume/e.src +++ b/config/illume/e.src @@ -10,6 +10,7 @@ group "E_Config" struct { value "border_shade_transition" int: 3; value "border_shade_speed" double: 3000.0000000000000000000000000; value "framerate" double: 30.0000000000000000000000000; + value "priority" int: 1; value "image_cache" int: 2048; value "font_cache" int: 512; value "edje_cache" int: 8; @@ -19,8 +20,6 @@ group "E_Config" struct { value "use_virtual_roots" int: 0; value "show_desktop_icons" int: 0; value "edge_flip_dragging" int: 0; - value "edge_flip_moving" int: 0; - value "edge_flip_timeout" double: 0.2500000000000000000000000; value "evas_engine_default" int: 1; value "evas_engine_container" int: 0; value "evas_engine_init" int: 0; diff --git a/config/minimalist/e.src b/config/minimalist/e.src index 8483ad77c..de931ea29 100644 --- a/config/minimalist/e.src +++ b/config/minimalist/e.src @@ -11,6 +11,7 @@ group "E_Config" struct { value "border_shade_transition" int: 3; value "border_shade_speed" double: 3000.0000000000000000000000000; value "framerate" double: 30.0000000000000000000000000; + value "priority" int: 1; value "image_cache" int: 4096; value "font_cache" int: 512; value "edje_cache" int: 32; @@ -20,8 +21,6 @@ group "E_Config" struct { value "use_virtual_roots" int: 0; value "show_desktop_icons" int: 1; value "edge_flip_dragging" int: 1; - value "edge_flip_moving" int: 1; - value "edge_flip_timeout" double: 0.2500000000000000000000000; value "evas_engine_default" int: 1; value "evas_engine_container" int: 0; value "evas_engine_init" int: 0; @@ -266,6 +265,14 @@ group "E_Config" struct { value "priority" int: 0; } } + group "modules" list { + group "E_Config_Module" struct { + value "name" string: "conf_edgebindings"; + value "enabled" uchar: 1; + value "delayed" uchar: 1; + value "priority" int: 0; + } + } group "modules" list { group "E_Config_Module" struct { value "name" string: "conf_profiles"; @@ -907,6 +914,46 @@ group "E_Config" struct { value "any_mod" uchar: 0; } } + group "edge_bindings" list { + group "E_Config_Binding_Edge" struct { + value "context" int: 3; + value "modifiers" int: 0; + value "action" string: "desk_flip_in_direction"; + value "edge" uchar: 1; + value "any_mod" uchar: 0; + value "delay" float: 0.3000000000000000000000000; + } + } + group "edge_bindings" list { + group "E_Config_Binding_Edge" struct { + value "context" int: 3; + value "modifiers" int: 0; + value "action" string: "desk_flip_in_direction"; + value "edge" uchar: 2; + value "any_mod" uchar: 0; + value "delay" float: 0.3000000000000000000000000; + } + } + group "edge_bindings" list { + group "E_Config_Binding_Edge" struct { + value "context" int: 3; + value "modifiers" int: 0; + value "action" string: "desk_flip_in_direction"; + value "edge" uchar: 3; + value "any_mod" uchar: 0; + value "delay" float: 0.3000000000000000000000000; + } + } + group "edge_bindings" list { + group "E_Config_Binding_Edge" struct { + value "context" int: 3; + value "modifiers" int: 0; + value "action" string: "desk_flip_in_direction"; + value "edge" uchar: 4; + value "any_mod" uchar: 0; + value "delay" float: 0.3000000000000000000000000; + } + } group "signal_bindings" list { group "E_Config_Binding_Signal" struct { value "context" int: 2; diff --git a/config/netbook/e.src b/config/netbook/e.src index 775a28df2..7335a5f6a 100644 --- a/config/netbook/e.src +++ b/config/netbook/e.src @@ -11,6 +11,7 @@ group "E_Config" struct { value "border_shade_transition" int: 3; value "border_shade_speed" double: 3000.0000000000000000000000000; value "framerate" double: 30.0000000000000000000000000; + value "priority" int: 1; value "image_cache" int: 4096; value "font_cache" int: 512; value "edje_cache" int: 32; @@ -20,8 +21,6 @@ group "E_Config" struct { value "use_virtual_roots" int: 0; value "show_desktop_icons" int: 1; value "edge_flip_dragging" int: 1; - value "edge_flip_moving" int: 1; - value "edge_flip_timeout" double: 0.2500000000000000000000000; value "evas_engine_default" int: 1; value "evas_engine_container" int: 0; value "evas_engine_init" int: 0; @@ -298,6 +297,14 @@ group "E_Config" struct { value "priority" int: 0; } } + group "modules" list { + group "E_Config_Module" struct { + value "name" string: "conf_edgebindings"; + value "enabled" uchar: 1; + value "delayed" uchar: 1; + value "priority" int: 0; + } + } group "modules" list { group "E_Config_Module" struct { value "name" string: "conf_profiles"; @@ -971,6 +978,46 @@ group "E_Config" struct { value "any_mod" uchar: 0; } } + group "edge_bindings" list { + group "E_Config_Binding_Edge" struct { + value "context" int: 3; + value "modifiers" int: 0; + value "action" string: "desk_flip_in_direction"; + value "edge" uchar: 1; + value "any_mod" uchar: 0; + value "delay" float: 0.3000000000000000000000000; + } + } + group "edge_bindings" list { + group "E_Config_Binding_Edge" struct { + value "context" int: 3; + value "modifiers" int: 0; + value "action" string: "desk_flip_in_direction"; + value "edge" uchar: 2; + value "any_mod" uchar: 0; + value "delay" float: 0.3000000000000000000000000; + } + } + group "edge_bindings" list { + group "E_Config_Binding_Edge" struct { + value "context" int: 3; + value "modifiers" int: 0; + value "action" string: "desk_flip_in_direction"; + value "edge" uchar: 3; + value "any_mod" uchar: 0; + value "delay" float: 0.3000000000000000000000000; + } + } + group "edge_bindings" list { + group "E_Config_Binding_Edge" struct { + value "context" int: 3; + value "modifiers" int: 0; + value "action" string: "desk_flip_in_direction"; + value "edge" uchar: 4; + value "any_mod" uchar: 0; + value "delay" float: 0.3000000000000000000000000; + } + } group "signal_bindings" list { group "E_Config_Binding_Signal" struct { value "context" int: 2; diff --git a/config/scaleable/e.src b/config/scaleable/e.src index 596653111..33c5806fc 100644 --- a/config/scaleable/e.src +++ b/config/scaleable/e.src @@ -10,6 +10,7 @@ group "E_Config" struct { value "border_shade_transition" int: 3; value "border_shade_speed" double: 3000.0000000000000000000000000; value "framerate" double: 30.0000000000000000000000000; + value "priority" int: 1; value "image_cache" int: 4096; value "font_cache" int: 512; value "edje_cache" int: 32; @@ -19,8 +20,6 @@ group "E_Config" struct { value "use_virtual_roots" int: 0; value "show_desktop_icons" int: 1; value "edge_flip_dragging" int: 1; - value "edge_flip_moving" int: 1; - value "edge_flip_timeout" double: 0.2500000000000000000000000; value "evas_engine_default" int: 1; value "evas_engine_container" int: 0; value "evas_engine_init" int: 0; @@ -177,6 +176,14 @@ group "E_Config" struct { value "priority" int: 0; } } + group "modules" list { + group "E_Config_Module" struct { + value "name" string: "conf_edgebindings"; + value "enabled" uchar: 1; + value "delayed" uchar: 1; + value "priority" int: 0; + } + } group "modules" list { group "E_Config_Module" struct { value "name" string: "conf_paths"; @@ -994,6 +1001,46 @@ group "E_Config" struct { value "any_mod" uchar: 0; } } + group "edge_bindings" list { + group "E_Config_Binding_Edge" struct { + value "context" int: 3; + value "modifiers" int: 0; + value "action" string: "desk_flip_in_direction"; + value "edge" uchar: 1; + value "any_mod" uchar: 0; + value "delay" float: 0.3000000000000000000000000; + } + } + group "edge_bindings" list { + group "E_Config_Binding_Edge" struct { + value "context" int: 3; + value "modifiers" int: 0; + value "action" string: "desk_flip_in_direction"; + value "edge" uchar: 2; + value "any_mod" uchar: 0; + value "delay" float: 0.3000000000000000000000000; + } + } + group "edge_bindings" list { + group "E_Config_Binding_Edge" struct { + value "context" int: 3; + value "modifiers" int: 0; + value "action" string: "desk_flip_in_direction"; + value "edge" uchar: 3; + value "any_mod" uchar: 0; + value "delay" float: 0.3000000000000000000000000; + } + } + group "edge_bindings" list { + group "E_Config_Binding_Edge" struct { + value "context" int: 3; + value "modifiers" int: 0; + value "action" string: "desk_flip_in_direction"; + value "edge" uchar: 4; + value "any_mod" uchar: 0; + value "delay" float: 0.3000000000000000000000000; + } + } group "signal_bindings" list { group "E_Config_Binding_Signal" struct { value "context" int: 2; diff --git a/config/standard/e.src b/config/standard/e.src index b3de6177a..9572b92c2 100644 --- a/config/standard/e.src +++ b/config/standard/e.src @@ -1,5 +1,5 @@ group "E_Config" struct { - value "config_version" int: 65836; + value "config_version" int: 65837; value "show_splash" int: 1; value "init_default_theme" string: "default.edj"; value "desktop_default_name" string: "Desktop %i, %i"; @@ -10,6 +10,7 @@ group "E_Config" struct { value "border_shade_transition" int: 3; value "border_shade_speed" double: 3000.0000000000000000000000000; value "framerate" double: 30.0000000000000000000000000; + value "priority" int: 1; value "image_cache" int: 4096; value "font_cache" int: 512; value "edje_cache" int: 32; @@ -19,8 +20,6 @@ group "E_Config" struct { value "use_virtual_roots" int: 0; value "show_desktop_icons" int: 1; value "edge_flip_dragging" int: 1; - value "edge_flip_moving" int: 1; - value "edge_flip_timeout" double: 0.2500000000000000000000000; value "evas_engine_default" int: 1; value "evas_engine_container" int: 0; value "evas_engine_init" int: 0; @@ -177,6 +176,14 @@ group "E_Config" struct { value "priority" int: 0; } } + group "modules" list { + group "E_Config_Module" struct { + value "name" string: "conf_edgebindings"; + value "enabled" uchar: 1; + value "delayed" uchar: 1; + value "priority" int: 0; + } + } group "modules" list { group "E_Config_Module" struct { value "name" string: "conf_paths"; @@ -994,6 +1001,56 @@ group "E_Config" struct { value "any_mod" uchar: 0; } } + group "edge_bindings" list { + group "E_Config_Binding_Edge" struct { + value "context" int: 3; + value "modifiers" int: 0; + value "action" string: "desk_flip_in_direction"; + value "edge" uchar: 1; + value "any_mod" uchar: 0; + value "delay" float: 0.3000000000000000000000000; + } + } + group "edge_bindings" list { + group "E_Config_Binding_Edge" struct { + value "context" int: 3; + value "modifiers" int: 0; + value "action" string: "desk_flip_in_direction"; + value "edge" uchar: 2; + value "any_mod" uchar: 0; + value "delay" float: 0.3000000000000000000000000; + } + } + group "edge_bindings" list { + group "E_Config_Binding_Edge" struct { + value "context" int: 3; + value "modifiers" int: 0; + value "action" string: "desk_flip_in_direction"; + value "edge" uchar: 3; + value "any_mod" uchar: 0; + value "delay" float: 0.3000000000000000000000000; + } + } + group "edge_bindings" list { + group "E_Config_Binding_Edge" struct { + value "context" int: 3; + value "modifiers" int: 0; + value "action" string: "desk_flip_in_direction"; + value "edge" uchar: 4; + value "any_mod" uchar: 0; + value "delay" float: 0.3000000000000000000000000; + } + } + group "edge_bindings" list { + group "E_Config_Binding_Edge" struct { + value "context" int: 3; + value "modifiers" int: 0; + value "action" string: "desk_deskshow_toggle"; + value "edge" uchar: 6; + value "any_mod" uchar: 0; + value "delay" float: 0.3000000000000000000000000; + } + } group "signal_bindings" list { group "E_Config_Binding_Signal" struct { value "context" int: 2; diff --git a/configure.ac b/configure.ac index 1428a26bf..26516d753 100644 --- a/configure.ac +++ b/configure.ac @@ -392,6 +392,7 @@ AC_E_OPTIONAL_MODULE([conf_dpms], true) AC_E_OPTIONAL_MODULE([conf_shelves], true) AC_E_OPTIONAL_MODULE([conf_keybindings], true) AC_E_OPTIONAL_MODULE([conf_mousebindings], true) +AC_E_OPTIONAL_MODULE([conf_edgebindings], true) AC_E_OPTIONAL_MODULE([conf_mouse], true) AC_E_OPTIONAL_MODULE([conf_window_display], true) AC_E_OPTIONAL_MODULE([conf_window_focus], true) @@ -496,6 +497,8 @@ src/modules/conf_keybindings/Makefile src/modules/conf_keybindings/module.desktop src/modules/conf_mousebindings/Makefile src/modules/conf_mousebindings/module.desktop +src/modules/conf_edgebindings/Makefile +src/modules/conf_edgebindings/module.desktop src/modules/conf_mouse/Makefile src/modules/conf_mouse/module.desktop src/modules/conf_window_display/Makefile diff --git a/data/themes/default.edc b/data/themes/default.edc index 712359156..62a3231f0 100644 --- a/data/themes/default.edc +++ b/data/themes/default.edc @@ -6873,6 +6873,215 @@ collections { /* begin the collection of edje groups that are in this file */ } } +///////////////////////////////////////////////////////////////////////////// + /*** MOD: CONF_EDGEBINDINGS ***/ + /* This group draws the edge and corners for the user to pick. + * XXX: Needs some love from masters of the brush! */ + group { + name: "e/modules/conf_edgebindings/selection"; // for gadget + parts { + part { name: "e.swallow.background"; + type: SWALLOW; + mouse_events: 0; + description { state: "default" 0.0; + min: 210 150; + rel1.offset: 4 4; + rel2 { + relative: 0.5 1; + offset: -2 -5; + } + } + } + part { name: "e.edge.top_left"; + type: RECT; + description { state: "default" 0.0; + rel1 { + to: "e.swallow.background"; + } + rel2 { + relative: 0 0; + offset: 20 20; + to: "e.swallow.background"; + } + color: 255 0 0 150; + } + } + part { name: "e.edge.top"; + type: RECT; + description { state: "default" 0.0; + rel1 { + offset: 20 0; + to: "e.swallow.background"; + } + rel2 { + relative: 1 0; + offset: -20 15; + to: "e.swallow.background"; + } + color: 255 255 0 150; + } + } + part { name: "e.edge.top_right"; + type: RECT; + description { state: "default" 0.0; + rel1 { + relative: 1 0; + offset: -20 0; + to: "e.swallow.background"; + } + rel2 { + relative: 1 0; + offset: 0 20; + to: "e.swallow.background"; + } + color: 255 0 0 150; + } + } + part { name: "e.edge.right"; + type: RECT; + description { state: "default" 0.0; + rel1 { + relative: 1 0; + offset: -15 20; + to: "e.swallow.background"; + } + rel2 { + relative: 1 1; + offset: 0 -20; + to: "e.swallow.background"; + } + color: 255 255 0 150; + } + } + part { name: "e.edge.bottom_right"; + type: RECT; + description { state: "default" 0.0; + rel1 { + relative: 1 1; + offset: -20 -20; + to: "e.swallow.background"; + } + rel2 { + relative: 1 1; + offset: 0 0; + to: "e.swallow.background"; + } + color: 255 0 0 150; + } + } + part { name: "e.edge.bottom"; + type: RECT; + description { state: "default" 0.0; + rel1 { + relative: 0 1; + offset: 20 -15; + to: "e.swallow.background"; + } + rel2 { + relative: 1 1; + offset: -20 0; + to: "e.swallow.background"; + } + color: 255 255 0 150; + } + } + part { name: "e.edge.bottom_left"; + type: RECT; + description { state: "default" 0.0; + rel1 { + relative: 0 1; + offset: 0 -20; + to: "e.swallow.background"; + } + rel2 { + relative: 0 1; + offset: 20 0; + to: "e.swallow.background"; + } + color: 255 0 0 150; + } + } + part { name: "e.edge.left"; + type: RECT; + description { state: "default" 0.0; + rel1 { + relative: 0 0; + offset: 0 20; + to: "e.swallow.background"; + } + rel2 { + relative: 0 1; + offset: 15 -20; + to: "e.swallow.background"; + } + color: 255 255 0 150; + } + } + part { name: "e.swallow.slider"; + type: SWALLOW; + description { state: "default" 0.0; + rel1 { + relative: 1 1; + offset: 5 4; + to_x: "e.swallow.background"; + to_y: "e.text.description"; + } + rel2 { + relative: 1 1; + offset: -5 -5; + to_y: "e.swallow.background"; + } + } + } + part { name: "e.text.description"; + type: TEXTBLOCK; + mouse_events: 0; + scale: 1; + description { state: "default" 0.0; + rel1 { + relative: 1 0; + offset: 5 4; + to_x: "e.swallow.background"; + } + rel2 { + relative: 1 1; + offset: -5 -45; + } + text { + style: "dialog_style"; + min: 1 1; + } + } + } + part { name: "e.text.selection"; + type: TEXT; + effect: SOFT_SHADOW; + mouse_events: 0; + description { state: "default" 0.0; + align: 0.5 0.5; + rel1 { + relative: 1 1; + offset: 5 5; + to: "e.edge.top_left"; + } + rel2 { + relative: 0 0; + offset: -5 -5; + to: "e.edge.bottom_right"; + } + color: 224 224 224 255; + color3: 0 0 0 64; + text { + font: "Sans:style=Bold"; + size: 12; + align: 0.5 0.5; + fit: 1 1; + } + } + } + } + } + ///////////////////////////////////////////////////////////////////////////// /*** MOD: START ***/ /* This is for the "start" module - i.e. a "start" button. It simply diff --git a/src/bin/e_actions.c b/src/bin/e_actions.c index 12b892b93..bd016822b 100644 --- a/src/bin/e_actions.c +++ b/src/bin/e_actions.c @@ -29,6 +29,13 @@ } #define ACT_FN_GO_WHEEL(act) \ static void _e_actions_act_##act##_go_wheel(E_Object *obj, const char *params, Ecore_X_Event_Mouse_Wheel *ev) +#define ACT_GO_EDGE(name) \ + { \ + act = e_action_add(#name); \ + if (act) act->func.go_edge = _e_actions_act_##name##_go_edge; \ + } +#define ACT_FN_GO_EDGE(act) \ + static void _e_actions_act_##act##_go_edge(E_Object *obj, const char *params, E_Event_Zone_Edge *ev) #define ACT_GO_SIGNAL(name) \ { \ act = e_action_add(#name); \ @@ -1096,6 +1103,118 @@ ACT_FN_GO(desk_flip_to) } } +/***************************************************************************/ +#define ACT_FLIP_LEFT(zone) ((e_config->desk_flip_wrap && ((zone)->desk_x_count > 1)) || ((zone)->desk_x_current > 0)) +#define ACT_FLIP_RIGHT(zone) ((e_config->desk_flip_wrap && ((zone)->desk_x_count > 1)) || (((zone)->desk_x_current + 1) < (zone)->desk_x_count)) +#define ACT_FLIP_UP(zone) ((e_config->desk_flip_wrap && ((zone)->desk_y_count > 1)) || ((zone)->desk_y_current > 0)) +#define ACT_FLIP_DOWN(zone) ((e_config->desk_flip_wrap && ((zone)->desk_y_count > 1)) || (((zone)->desk_y_current + 1) < (zone)->desk_y_count)) +#define ACT_FLIP_UP_LEFT(zone) ((e_config->desk_flip_wrap && ((zone)->desk_x_count > 1) && ((zone)->desk_y_count > 1)) || (((zone)->desk_x_current > 0) && ((zone)->desk_y_current > 0))) +#define ACT_FLIP_UP_RIGHT(zone) ((e_config->desk_flip_wrap && ((zone)->desk_x_count > 1) && ((zone)->desk_y_count > 1)) || ((((zone)->desk_x_current + 1) < (zone)->desk_x_count) && ((zone)->desk_y_current > 0))) +#define ACT_FLIP_DOWN_RIGHT(zone) ((e_config->desk_flip_wrap && ((zone)->desk_x_count > 1) && ((zone)->desk_y_count > 1)) || ((((zone)->desk_x_current + 1) < (zone)->desk_x_count) && (((zone)->desk_y_current + 1) < (zone)->desk_y_count))) +#define ACT_FLIP_DOWN_LEFT(zone) ((e_config->desk_flip_wrap && ((zone)->desk_x_count > 1) && ((zone)->desk_y_count > 1)) || (((zone)->desk_x_current > 0) && (((zone)->desk_y_current + 1) < (zone)->desk_y_count))) + +ACT_FN_GO_EDGE(desk_flip_in_direction) +{ + E_Zone *zone; + E_Desk *prev = NULL, *current = NULL; + E_Event_Pointer_Warp *wev; + int x, y, offset = 25; + + zone = _e_actions_zone_get(obj); + wev = E_NEW(E_Event_Pointer_Warp, 1); + if ((!wev) || (!zone)) return; + ecore_x_pointer_xy_get(zone->container->win, &x, &y); + wev->prev.x = x; + wev->prev.y = y; + prev = e_desk_at_xy_get(zone, zone->desk_x_current, zone->desk_y_current); + if (params) + { + if (sscanf(params, "%i", &offset) != 1) + offset = 25; + } + switch(ev->edge) + { + case E_ZONE_EDGE_LEFT: + if (ACT_FLIP_LEFT(zone)) + { + e_zone_desk_flip_by(zone, -1, 0); + ecore_x_pointer_warp(zone->container->win, zone->w - offset, y); + wev->curr.y = y; + wev->curr.x = zone->w - offset; + } + break; + case E_ZONE_EDGE_RIGHT: + if (ACT_FLIP_RIGHT(zone)) + { + e_zone_desk_flip_by(zone, 1, 0); + ecore_x_pointer_warp(zone->container->win, offset, y); + wev->curr.y = y; + wev->curr.x = offset; + } + break; + case E_ZONE_EDGE_TOP: + if (ACT_FLIP_UP(zone)) + { + e_zone_desk_flip_by(zone, 0, -1); + ecore_x_pointer_warp(zone->container->win, x, zone->h - offset); + wev->curr.x = x; + wev->curr.y = zone->h - offset; + } + break; + case E_ZONE_EDGE_BOTTOM: + if (ACT_FLIP_DOWN(zone)) + { + e_zone_desk_flip_by(zone, 0, 1); + ecore_x_pointer_warp(zone->container->win, x, offset); + wev->curr.x = x; + wev->curr.y = offset; + } + break; + case E_ZONE_EDGE_TOP_LEFT: + if (ACT_FLIP_UP_LEFT(zone)) + { + e_zone_desk_flip_by(zone, -1, -1); + ecore_x_pointer_warp(zone->container->win, zone->w - offset, zone->h - offset); + wev->curr.x = zone->w - offset; + wev->curr.y = zone->h - offset; + } + break; + case E_ZONE_EDGE_TOP_RIGHT: + if (ACT_FLIP_UP_RIGHT(zone)) + { + e_zone_desk_flip_by(zone, 1, -1); + ecore_x_pointer_warp(zone->container->win, offset, zone->h - offset); + wev->curr.x = offset; + wev->curr.y = zone->h - offset; + } + break; + case E_ZONE_EDGE_BOTTOM_LEFT: + if (ACT_FLIP_DOWN_LEFT(zone)) + { + e_zone_desk_flip_by(zone, -1, 1); + ecore_x_pointer_warp(zone->container->win, zone->w - offset, offset); + wev->curr.y = offset; + wev->curr.x = zone->w - offset; + } + break; + case E_ZONE_EDGE_BOTTOM_RIGHT: + if (ACT_FLIP_DOWN_RIGHT(zone)) + { + e_zone_desk_flip_by(zone, 1, 1); + ecore_x_pointer_warp(zone->container->win, offset, offset); + wev->curr.y = offset; + wev->curr.x = offset; + } + break; + } + + current = e_desk_current_get(zone); + if (current) + ecore_event_add(E_EVENT_POINTER_WARP, wev, NULL, NULL); + else + free(wev); +} + /***************************************************************************/ ACT_FN_GO(desk_linear_flip_by) { @@ -2501,6 +2620,11 @@ e_actions_init(void) "desk_linear_flip_by_all", NULL, "syntax: N-offset, example: -2", 1); + /* desk_flip_in_direction */ + ACT_GO_EDGE(desk_flip_in_direction); + e_action_predef_name_set(_("Desktop"), _("Flip Desktop In Direction..."), + "desk_flip_in_direction", NULL, "syntax: N-pixel-offset, example: 25", 1); + /* desk_linear_flip_to_all */ ACT_GO(desk_linear_flip_to_all); e_action_predef_name_set(_("Desktop"), _("Switch To Desktop 0 (All Screens)"), diff --git a/src/bin/e_actions.h b/src/bin/e_actions.h index 8f58aeca3..1987cc7ca 100644 --- a/src/bin/e_actions.h +++ b/src/bin/e_actions.h @@ -22,6 +22,7 @@ struct _E_Action void (*go) (E_Object *obj, const char *params); void (*go_mouse) (E_Object *obj, const char *params, Ecore_X_Event_Mouse_Button_Down *ev); void (*go_wheel) (E_Object *obj, const char *params, Ecore_X_Event_Mouse_Wheel *ev); + void (*go_edge) (E_Object *obj, const char *params, E_Event_Zone_Edge *ev); void (*go_key) (E_Object *obj, const char *params, Ecore_X_Event_Key_Down *ev); void (*go_signal) (E_Object *obj, const char *params, const char *sig, const char *src); void (*end) (E_Object *obj, const char *params); diff --git a/src/bin/e_bindings.c b/src/bin/e_bindings.c index f148f0c5e..bd6e58b39 100644 --- a/src/bin/e_bindings.c +++ b/src/bin/e_bindings.c @@ -7,16 +7,29 @@ static void _e_bindings_mouse_free(E_Binding_Mouse *bind); static void _e_bindings_key_free(E_Binding_Key *bind); +static void _e_bindings_edge_free(E_Binding_Edge *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); +static int _e_bindings_edge_cb_timer(void *data); /* local subsystem globals */ -static Eina_List *mouse_bindings = NULL; -static Eina_List *key_bindings = NULL; +static Eina_List *mouse_bindings = NULL; +static Eina_List *key_bindings = NULL; +static Eina_List *edge_bindings = NULL; static Eina_List *signal_bindings = NULL; -static Eina_List *wheel_bindings = NULL; +static Eina_List *wheel_bindings = NULL; + +typedef struct _E_Binding_Edge_Data E_Binding_Edge_Data; + +struct _E_Binding_Edge_Data +{ + E_Binding_Edge *bind; + E_Event_Zone_Edge *ev; + E_Action *act; + E_Object *obj; +}; /* externally accessible functions */ @@ -43,6 +56,15 @@ e_bindings_init(void) eb->any_mod, eb->action, eb->params); } + for (l = e_config->edge_bindings; l; l = l->next) + { + E_Config_Binding_Edge *eb; + + eb = l->data; + e_bindings_edge_add(eb->context, eb->edge, eb->modifiers, + eb->any_mod, eb->action, eb->params, eb->delay); + } + for (l = e_config->signal_bindings; l; l = l->next) { E_Config_Binding_Signal *eb; @@ -97,6 +119,14 @@ e_bindings_shutdown(void) key_bindings = eina_list_remove_list(key_bindings, key_bindings); _e_bindings_key_free(bind); } + while (edge_bindings) + { + E_Binding_Edge *bind; + + bind = edge_bindings->data; + edge_bindings = eina_list_remove_list(edge_bindings, edge_bindings); + _e_bindings_edge_free(bind); + } while (signal_bindings) { E_Binding_Signal *bind; @@ -516,6 +546,146 @@ e_bindings_key_up_event_handle(E_Binding_Context ctxt, E_Object *obj, Ecore_X_Ev return NULL; } +EAPI void +e_bindings_edge_add(E_Binding_Context ctxt, E_Zone_Edge edge, E_Binding_Modifier mod, int any_mod, const char *action, const char *params, float delay) +{ + E_Binding_Edge *bind; + + bind = calloc(1, sizeof(E_Binding_Edge)); + bind->ctxt = ctxt; + bind->edge = edge; + bind->mod = mod; + bind->any_mod = any_mod; + bind->delay = delay; + if (action) bind->action = eina_stringshare_add(action); + if (params) bind->params = eina_stringshare_add(params); + edge_bindings = eina_list_append(edge_bindings, bind); +} + +EAPI E_Binding_Edge * +e_bindings_edge_get(const char *action, E_Zone_Edge edge) +{ + Eina_List *l; + + for (l = edge_bindings; l; l = l->next) + { + E_Binding_Edge *bind; + + bind = l->data; + if ((bind->edge == edge) && bind->action && + action && !strcmp(action, bind->action)) + return bind; + } + return NULL; +} + +EAPI void +e_bindings_edge_del(E_Binding_Context ctxt, E_Zone_Edge edge, E_Binding_Modifier mod, int any_mod, const char *action, const char *params, float delay) +{ + Eina_List *l; + + for (l = edge_bindings; l; l = l->next) + { + E_Binding_Edge *bind; + + bind = l->data; + if ((bind->ctxt == ctxt) && + (bind->edge == edge) && + (bind->mod == mod) && + ((bind->delay * 1000) == (delay * 1000)) && + (bind->any_mod == any_mod) && + (((bind->action) && (action) && (!strcmp(bind->action, action))) || + ((!bind->action) && (!action))) && + (((bind->params) && (params) && (!strcmp(bind->params, params))) || + ((!bind->params) && (!params)))) + { + _e_bindings_edge_free(bind); + edge_bindings = eina_list_remove_list(edge_bindings, l); + break; + } + } +} + +EAPI E_Action * +e_bindings_edge_in_event_handle(E_Binding_Context ctxt, E_Object *obj, E_Event_Zone_Edge *ev) +{ + E_Binding_Modifier mod = 0; + E_Action *act = NULL; + Eina_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 = edge_bindings; l; l = l->next) + { + E_Binding_Edge *bind; + + bind = l->data; + if (((bind->edge == ev->edge)) && + ((bind->any_mod) || (bind->mod == mod))) + { + if (_e_bindings_context_match(bind->ctxt, ctxt)) + { + act = e_action_find(bind->action); + if (act) + { + E_Binding_Edge_Data *ed = E_NEW(E_Binding_Edge_Data, 1); + E_Event_Zone_Edge *ev2 = E_NEW(E_Event_Zone_Edge, 1); + + /* The original event will be freed before it can be + * used again */ + ev2->zone = ev->zone; + ev2->edge = ev->edge; + ev2->x = ev->x; + ev2->y = ev->y; + + ed->bind = bind; + ed->obj = obj; + ed->act = act; + ed->ev = ev2; + bind->timer = ecore_timer_add(((double) bind->delay), _e_bindings_edge_cb_timer, ed); + } + } + } + } + return act; +} + +EAPI E_Action * +e_bindings_edge_out_event_handle(E_Binding_Context ctxt, E_Object *obj, E_Event_Zone_Edge *ev) +{ + E_Binding_Modifier mod = 0; + E_Action *act = NULL; + Eina_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 = edge_bindings; l; l = l->next) + { + E_Binding_Edge *bind; + + bind = l->data; + if ((bind->edge == ev->edge) && + ((bind->any_mod) || (bind->mod == mod))) + { + if (_e_bindings_context_match(bind->ctxt, ctxt)) + { + if (bind->timer) + ecore_timer_del(bind->timer); + bind->timer = NULL; + + act = e_action_find(bind->action); + if (act && act->func.end) + act->func.end(obj, bind->params); + } + } + } + return act; +} + 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) { @@ -801,6 +971,21 @@ _e_bindings_key_free(E_Binding_Key *bind) free(bind); } +static void +_e_bindings_edge_free(E_Binding_Edge *bind) +{ + if (bind->action) eina_stringshare_del(bind->action); + if (bind->params) eina_stringshare_del(bind->params); + if (bind->timer) + { + E_Binding_Edge_Data *ed; + + ed = ecore_timer_del(bind->timer); + E_FREE(ed); + } + free(bind); +} + static void _e_bindings_signal_free(E_Binding_Signal *bind) { @@ -827,3 +1012,34 @@ _e_bindings_context_match(E_Binding_Context bctxt, E_Binding_Context ctxt) if (bctxt == ctxt) return 1; return 0; } + +static int +_e_bindings_edge_cb_timer(void *data) +{ + E_Binding_Edge_Data *ed; + E_Event_Zone_Edge *ev; + E_Binding_Edge *bind; + E_Action *act; + E_Object *obj; + + ed = data; + bind = ed->bind; + act = ed->act; + obj = ed->obj; + ev = ed->ev; + + E_FREE(ed); + + if (act->func.go_edge) + act->func.go_edge(obj, bind->params, ev); + else if (act->func.go) + act->func.go(obj, bind->params); + + bind->timer = NULL; + + /* Duplicate event */ + E_FREE(ev); + + return 0; +} + diff --git a/src/bin/e_bindings.h b/src/bin/e_bindings.h index 5428b9713..cbbc6f8aa 100644 --- a/src/bin/e_bindings.h +++ b/src/bin/e_bindings.h @@ -32,6 +32,7 @@ typedef enum _E_Binding_Modifier typedef struct _E_Binding_Mouse E_Binding_Mouse; typedef struct _E_Binding_Key E_Binding_Key; +typedef struct _E_Binding_Edge E_Binding_Edge; typedef struct _E_Binding_Signal E_Binding_Signal; typedef struct _E_Binding_Wheel E_Binding_Wheel; @@ -59,6 +60,19 @@ struct _E_Binding_Key const char *params; }; +struct _E_Binding_Edge +{ + E_Binding_Context ctxt; + E_Zone_Edge edge; + E_Binding_Modifier mod; + unsigned char any_mod : 1; + const char *action; + const char *params; + + float delay; + Ecore_Timer *timer; +}; + struct _E_Binding_Signal { E_Binding_Context ctxt; @@ -101,6 +115,12 @@ EAPI void e_bindings_key_ungrab(E_Binding_Context ctxt, Ecore_X_Window wi 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 void e_bindings_edge_add(E_Binding_Context ctxt, E_Zone_Edge edge, E_Binding_Modifier mod, int any_mod, const char *action, const char *params, float delay); +EAPI E_Binding_Edge *e_bindings_edge_get(const char *action, E_Zone_Edge edge); +EAPI void e_bindings_edge_del(E_Binding_Context ctxt, E_Zone_Edge edge, E_Binding_Modifier mod, int any_mod, const char *action, const char *params, float delay); +EAPI E_Action *e_bindings_edge_in_event_handle(E_Binding_Context ctxt, E_Object *obj, E_Event_Zone_Edge *ev); +EAPI E_Action *e_bindings_edge_out_event_handle(E_Binding_Context ctxt, E_Object *obj, E_Event_Zone_Edge *ev); + 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 E_Action *e_bindings_signal_find(E_Binding_Context ctxt, E_Object *obj, const char *sig, const char *src, E_Binding_Signal **bind_ret); diff --git a/src/bin/e_config.c b/src/bin/e_config.c index 76e72f600..a174b9b4b 100644 --- a/src/bin/e_config.c +++ b/src/bin/e_config.c @@ -29,6 +29,7 @@ static E_Config_DD *_e_config_font_default_edd = NULL; static E_Config_DD *_e_config_theme_edd = NULL; static E_Config_DD *_e_config_bindings_mouse_edd = NULL; static E_Config_DD *_e_config_bindings_key_edd = NULL; +static E_Config_DD *_e_config_bindings_edge_edd = NULL; static E_Config_DD *_e_config_bindings_signal_edd = NULL; static E_Config_DD *_e_config_bindings_wheel_edd = NULL; static E_Config_DD *_e_config_path_append_edd = NULL; @@ -266,6 +267,20 @@ e_config_init(void) E_CONFIG_VAL(D, T, params, STR); E_CONFIG_VAL(D, T, any_mod, UCHAR); + _e_config_bindings_edge_edd = E_CONFIG_DD_NEW("E_Config_Binding_Edge", + E_Config_Binding_Edge); +#undef T +#undef D +#define T E_Config_Binding_Edge +#define D _e_config_bindings_edge_edd + E_CONFIG_VAL(D, T, context, INT); + E_CONFIG_VAL(D, T, modifiers, INT); + E_CONFIG_VAL(D, T, action, STR); + E_CONFIG_VAL(D, T, params, STR); + E_CONFIG_VAL(D, T, edge, UCHAR); + E_CONFIG_VAL(D, T, any_mod, UCHAR); + E_CONFIG_VAL(D, T, delay, FLOAT); + _e_config_bindings_signal_edd = E_CONFIG_DD_NEW("E_Config_Binding_Signal", E_Config_Binding_Signal); #undef T @@ -424,8 +439,6 @@ e_config_init(void) E_CONFIG_VAL(D, T, use_virtual_roots, INT); /* should not make this a config option (for now) */ E_CONFIG_VAL(D, T, show_desktop_icons, INT); /**/ E_CONFIG_VAL(D, T, edge_flip_dragging, INT); /**/ - E_CONFIG_VAL(D, T, edge_flip_moving, INT); /**/ - E_CONFIG_VAL(D, T, edge_flip_timeout, DOUBLE); /**/ E_CONFIG_VAL(D, T, evas_engine_default, INT); /**/ E_CONFIG_VAL(D, T, evas_engine_container, INT); /**/ E_CONFIG_VAL(D, T, evas_engine_init, INT); /**/ @@ -444,6 +457,7 @@ e_config_init(void) E_CONFIG_LIST(D, T, themes, _e_config_theme_edd); /**/ E_CONFIG_LIST(D, T, mouse_bindings, _e_config_bindings_mouse_edd); /**/ E_CONFIG_LIST(D, T, key_bindings, _e_config_bindings_key_edd); /**/ + E_CONFIG_LIST(D, T, edge_bindings, _e_config_bindings_edge_edd); /**/ E_CONFIG_LIST(D, T, signal_bindings, _e_config_bindings_signal_edd); /**/ E_CONFIG_LIST(D, T, wheel_bindings, _e_config_bindings_wheel_edd); /**/ E_CONFIG_LIST(D, T, path_append_data, _e_config_path_append_edd); /**/ @@ -680,6 +694,7 @@ e_config_shutdown(void) E_CONFIG_DD_FREE(_e_config_theme_edd); E_CONFIG_DD_FREE(_e_config_bindings_mouse_edd); E_CONFIG_DD_FREE(_e_config_bindings_key_edd); + E_CONFIG_DD_FREE(_e_config_bindings_edge_edd); E_CONFIG_DD_FREE(_e_config_bindings_signal_edd); E_CONFIG_DD_FREE(_e_config_bindings_wheel_edd); E_CONFIG_DD_FREE(_e_config_path_append_edd); @@ -884,8 +899,6 @@ e_config_load(void) E_CONFIG_LIMIT(e_config->zone_desks_y_count, 1, 64); E_CONFIG_LIMIT(e_config->show_desktop_icons, 0, 1); E_CONFIG_LIMIT(e_config->edge_flip_dragging, 0, 1); - E_CONFIG_LIMIT(e_config->edge_flip_moving, 0, 1); - E_CONFIG_LIMIT(e_config->edge_flip_timeout, 0.0, 2.0); E_CONFIG_LIMIT(e_config->window_placement_policy, E_WINDOW_PLACEMENT_SMART, E_WINDOW_PLACEMENT_MANUAL); E_CONFIG_LIMIT(e_config->focus_policy, 0, 2); E_CONFIG_LIMIT(e_config->focus_setting, 0, 3); @@ -1351,6 +1364,30 @@ e_config_binding_key_match(E_Config_Binding_Key *eb_in) return NULL; } +EAPI E_Config_Binding_Edge * +e_config_binding_edge_match(E_Config_Binding_Edge *eb_in) +{ + Eina_List *l; + + for (l = e_config->edge_bindings; l; l = l->next) + { + E_Config_Binding_Edge *eb; + + eb = l->data; + if ((eb->context == eb_in->context) && + (eb->modifiers == eb_in->modifiers) && + (eb->any_mod == eb_in->any_mod) && + (eb->edge == eb_in->edge) && + (eb->delay == eb_in->delay) && + (((eb->action) && (eb_in->action) && (!strcmp(eb->action, eb_in->action))) || + ((!eb->action) && (!eb_in->action))) && + (((eb->params) && (eb_in->params) && (!strcmp(eb->params, eb_in->params))) || + ((!eb->params) && (!eb_in->params)))) + return eb; + } + return NULL; +} + EAPI E_Config_Binding_Signal * e_config_binding_signal_match(E_Config_Binding_Signal *eb_in) { @@ -1419,6 +1456,7 @@ _e_config_free(E_Config *ecf) E_Config_Binding_Wheel *ebw; E_Config_Syscon_Action *sca; E_Config_Binding_Key *ebk; + E_Config_Binding_Edge *ebe; E_Font_Fallback *eff; E_Config_Module *em; E_Font_Default *efd; @@ -1464,6 +1502,12 @@ _e_config_free(E_Config *ecf) if (ebk->params) eina_stringshare_del(ebk->params); E_FREE(ebk); } + EINA_LIST_FREE(ecf->edge_bindings, ebe) + { + if (ebe->action) eina_stringshare_del(ebe->action); + if (ebe->params) eina_stringshare_del(ebe->params); + E_FREE(ebe); + } EINA_LIST_FREE(ecf->signal_bindings, ebs) { if (ebs->signal) eina_stringshare_del(ebs->signal); diff --git a/src/bin/e_config.h b/src/bin/e_config.h index b321ab300..98bd48951 100644 --- a/src/bin/e_config.h +++ b/src/bin/e_config.h @@ -10,6 +10,7 @@ typedef struct _E_Config_Module E_Config_Module; typedef struct _E_Config_Theme E_Config_Theme; typedef struct _E_Config_Binding_Mouse E_Config_Binding_Mouse; typedef struct _E_Config_Binding_Key E_Config_Binding_Key; +typedef struct _E_Config_Binding_Edge E_Config_Binding_Edge; typedef struct _E_Config_Binding_Signal E_Config_Binding_Signal; typedef struct _E_Config_Binding_Wheel E_Config_Binding_Wheel; typedef struct _E_Config_Desktop_Background E_Config_Desktop_Background; @@ -82,8 +83,6 @@ struct _E_Config int use_virtual_roots; // NO GUI - maybe remove? int show_desktop_icons; // GUI int edge_flip_dragging; // GUI - int edge_flip_moving; // GUI - double edge_flip_timeout; // GUI int evas_engine_default; // GUI int evas_engine_container; // NO GUI - maybe remove? int evas_engine_init; // NO GUI - maybe remove? @@ -102,6 +101,7 @@ struct _E_Config Eina_List *themes; // GUI Eina_List *mouse_bindings; // GUI Eina_List *key_bindings; // GUI + Eina_List *edge_bindings; // GUI Eina_List *signal_bindings; Eina_List *wheel_bindings; // GUI Eina_List *path_append_data; // GUI @@ -374,6 +374,17 @@ struct _E_Config_Binding_Key unsigned char any_mod; }; +struct _E_Config_Binding_Edge +{ + int context; + int modifiers; + float delay; + const char *action; + const char *params; + unsigned char edge; + unsigned char any_mod; +}; + struct _E_Config_Binding_Signal { int context; @@ -503,6 +514,7 @@ EAPI int e_config_domain_save(const char *domain, E_Config_DD *edd, const EAPI E_Config_Binding_Mouse *e_config_binding_mouse_match(E_Config_Binding_Mouse *eb_in); EAPI E_Config_Binding_Key *e_config_binding_key_match(E_Config_Binding_Key *eb_in); +EAPI E_Config_Binding_Edge *e_config_binding_edge_match(E_Config_Binding_Edge *eb_in); EAPI E_Config_Binding_Signal *e_config_binding_signal_match(E_Config_Binding_Signal *eb_in); EAPI E_Config_Binding_Wheel *e_config_binding_wheel_match(E_Config_Binding_Wheel *eb_in); diff --git a/src/bin/e_desk.c b/src/bin/e_desk.c index 8d16c0614..aea955425 100644 --- a/src/bin/e_desk.c +++ b/src/bin/e_desk.c @@ -11,6 +11,7 @@ static void _e_desk_free(E_Desk *desk); static void _e_border_event_desk_show_free(void *data, void *ev); static void _e_border_event_desk_before_show_free(void *data, void *ev); +static void _e_border_event_desk_after_show_free(void *data, void *ev); static void _e_border_event_desk_deskshow_free(void *data, void *ev); static void _e_border_event_desk_name_change_free(void *data, void *ev); static void _e_desk_show_begin(E_Desk *desk, int mode, int dx, int dy); @@ -22,6 +23,7 @@ static int _e_desk_hide_animator(void *data); EAPI int E_EVENT_DESK_SHOW = 0; EAPI int E_EVENT_DESK_BEFORE_SHOW = 0; +EAPI int E_EVENT_DESK_AFTER_SHOW = 0; EAPI int E_EVENT_DESK_DESKSHOW = 0; EAPI int E_EVENT_DESK_NAME_CHANGE = 0; @@ -30,6 +32,7 @@ e_desk_init(void) { E_EVENT_DESK_SHOW = ecore_event_type_new(); E_EVENT_DESK_BEFORE_SHOW = ecore_event_type_new(); + E_EVENT_DESK_AFTER_SHOW = ecore_event_type_new(); E_EVENT_DESK_DESKSHOW = ecore_event_type_new(); E_EVENT_DESK_NAME_CHANGE = ecore_event_type_new(); return 1; @@ -204,6 +207,7 @@ e_desk_show(E_Desk *desk) E_Border *bd; E_Event_Desk_Show *ev; E_Event_Desk_Before_Show *eev; + E_Event_Desk_After_Show *eeev; Eina_List *l; int was_zone = 0, x, y, dx = 0, dy = 0; @@ -311,6 +315,16 @@ e_desk_show(E_Desk *desk) else e_shelf_hide(es); } + + if (e_config->desk_flip_animate_mode == 0) + { + eeev = E_NEW(E_Event_Desk_After_Show, 1); + eeev->desk = e_desk_current_get(desk->zone); + e_object_ref(E_OBJECT(eeev->desk)); + ecore_event_add(E_EVENT_DESK_AFTER_SHOW, eeev, + _e_border_event_desk_after_show_free, NULL); + } + } EAPI void @@ -532,6 +546,16 @@ _e_border_event_desk_before_show_free(void *data, void *event) free(ev); } +static void +_e_border_event_desk_after_show_free(void *data, void *event) +{ + E_Event_Desk_After_Show *ev; + + ev = event; + e_object_unref(E_OBJECT(ev->desk)); + free(ev); +} + static void _e_border_event_desk_deskshow_free(void *data, void *event) { @@ -628,6 +652,7 @@ _e_desk_show_begin(E_Desk *desk, int mode, int dx, int dy) static void _e_desk_show_end(E_Desk *desk) { + E_Event_Desk_After_Show *ev; E_Border_List *bl; E_Border *bd; @@ -644,6 +669,11 @@ _e_desk_show_end(E_Desk *desk) } e_container_border_list_free(bl); ecore_x_window_shadow_tree_flush(); + ev = E_NEW(E_Event_Desk_After_Show, 1); + ev->desk = e_desk_current_get(desk->zone); + e_object_ref(E_OBJECT(ev->desk)); + ecore_event_add(E_EVENT_DESK_AFTER_SHOW, ev, + _e_border_event_desk_after_show_free, NULL); } static int diff --git a/src/bin/e_desk.h b/src/bin/e_desk.h index 4b7f5e809..25f0d8502 100644 --- a/src/bin/e_desk.h +++ b/src/bin/e_desk.h @@ -6,6 +6,7 @@ typedef struct _E_Desk E_Desk; typedef struct _E_Event_Desk_Show E_Event_Desk_Show; typedef struct _E_Event_Desk_Before_Show E_Event_Desk_Before_Show; +typedef struct _E_Event_Desk_After_Show E_Event_Desk_After_Show; typedef struct _E_Event_Desk_DeskShow E_Event_Desk_DeskShow; typedef struct _E_Event_Desk_Name_Change E_Event_Desk_Name_Change; @@ -40,6 +41,10 @@ struct _E_Event_Desk_Before_Show E_Desk *desk; }; +struct _E_Event_Desk_After_Show +{ + E_Desk *desk; +}; struct _E_Event_Desk_Name_Change { @@ -69,6 +74,7 @@ EAPI void e_desk_col_remove(E_Zone *zone); extern EAPI int E_EVENT_DESK_SHOW; extern EAPI int E_EVENT_DESK_BEFORE_SHOW; +extern EAPI int E_EVENT_DESK_AFTER_SHOW; extern EAPI int E_EVENT_DESK_DESKSHOW; extern EAPI int E_EVENT_DESK_NAME_CHANGE; diff --git a/src/bin/e_int_shelf_config.c b/src/bin/e_int_shelf_config.c index 7a0d9d7af..d00522cfa 100644 --- a/src/bin/e_int_shelf_config.c +++ b/src/bin/e_int_shelf_config.c @@ -399,7 +399,6 @@ _advanced_apply_data(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata) e_shelf_toggle(cfdata->es, 0); else if (!cfdata->escfg->autohide && cfdata->es->hidden) e_shelf_toggle(cfdata->es, 1); - e_zone_update_flip_all(); cfdata->escfg->desk_show_mode = cfdata->desk_show_mode; cfdata->escfg->desk_list = NULL; diff --git a/src/bin/e_ipc_handlers.h b/src/bin/e_ipc_handlers.h index 78acb31d8..b6e98b784 100644 --- a/src/bin/e_ipc_handlers.h +++ b/src/bin/e_ipc_handlers.h @@ -1791,47 +1791,6 @@ break; #endif #undef HDL -/****************************************************************************/ -#define HDL E_IPC_OP_EDGE_FLIP_MOVING_SET -#if (TYPE == E_REMOTE_OPTIONS) - OP("-edge-flip-moving-set", 1, "Set the edge flip while moving policy flag (0/1)", 0, HDL) -#elif (TYPE == E_REMOTE_OUT) - REQ_INT(atoi(params[0]), HDL); -#elif (TYPE == E_WM_IN) - START_INT(value, HDL); - e_config->edge_flip_moving = value; - E_CONFIG_LIMIT(e_config->edge_flip_moving, 0, 1); - e_zone_update_flip_all(); - SAVE; - END_INT; -#elif (TYPE == E_REMOTE_IN) -#endif -#undef HDL - -/****************************************************************************/ -#define HDL E_IPC_OP_EDGE_FLIP_MOVING_GET -#if (TYPE == E_REMOTE_OPTIONS) - OP("-edge-flip-moving-get", 0, "Get the edge flip while moving policy flag", 1, HDL) -#elif (TYPE == E_REMOTE_OUT) - REQ_NULL(HDL) -#elif (TYPE == E_WM_IN) - SEND_INT(e_config->edge_flip_moving, E_IPC_OP_EDGE_FLIP_MOVING_GET_REPLY, HDL); -#elif (TYPE == E_REMOTE_IN) -#endif -#undef HDL - -/****************************************************************************/ -#define HDL E_IPC_OP_EDGE_FLIP_MOVING_GET_REPLY -#if (TYPE == E_REMOTE_OPTIONS) -#elif (TYPE == E_REMOTE_OUT) -#elif (TYPE == E_WM_IN) -#elif (TYPE == E_REMOTE_IN) - START_INT(val, HDL) - printf("REPLY: %i\n", val); - END_INT; -#endif -#undef HDL - /****************************************************************************/ #define HDL E_IPC_OP_EDGE_FLIP_DRAGGING_SET #if (TYPE == E_REMOTE_OPTIONS) @@ -1842,7 +1801,6 @@ break; START_INT(value, HDL); e_config->edge_flip_dragging = value; E_CONFIG_LIMIT(e_config->edge_flip_dragging, 0, 1); - e_zone_update_flip_all(); SAVE; END_INT; #elif (TYPE == E_REMOTE_IN) @@ -1873,46 +1831,6 @@ break; #endif #undef HDL -/****************************************************************************/ -#define HDL E_IPC_OP_EDGE_FLIP_TIMEOUT_SET -#if (TYPE == E_REMOTE_OPTIONS) - OP("-edge-flip-timeout-set", 1, "Set the edge flip timeout (sec)", 0, HDL) -#elif (TYPE == E_REMOTE_OUT) - REQ_DOUBLE(atof(params[0]), HDL) -#elif (TYPE == E_WM_IN) - START_DOUBLE(dbl, HDL); - e_config->edge_flip_timeout = dbl; - E_CONFIG_LIMIT(e_config->edge_flip_timeout, 0.0, 2.0); - SAVE; - END_DOUBLE; -#elif (TYPE == E_REMOTE_IN) -#endif -#undef HDL - -/****************************************************************************/ -#define HDL E_IPC_OP_EDGE_FLIP_TIMEOUT_GET -#if (TYPE == E_REMOTE_OPTIONS) - OP("-edge-flip-timeout-get", 0, "Get the edge flip timeout", 1, HDL) -#elif (TYPE == E_REMOTE_OUT) - REQ_NULL(HDL) -#elif (TYPE == E_WM_IN) - SEND_DOUBLE(e_config->edge_flip_timeout, E_IPC_OP_EDGE_FLIP_TIMEOUT_GET_REPLY, HDL); -#elif (TYPE == E_REMOTE_IN) -#endif -#undef HDL - -/****************************************************************************/ -#define HDL E_IPC_OP_EDGE_FLIP_TIMEOUT_GET_REPLY -#if (TYPE == E_REMOTE_OPTIONS) -#elif (TYPE == E_REMOTE_OUT) -#elif (TYPE == E_WM_IN) -#elif (TYPE == E_REMOTE_IN) - START_DOUBLE(val, HDL) - printf("REPLY: %3.3f\n", val); - END_DOUBLE; -#endif -#undef HDL - /****************************************************************************/ #define HDL E_IPC_OP_FONT_CACHE_SET #if (TYPE == E_REMOTE_OPTIONS) diff --git a/src/bin/e_shelf.c b/src/bin/e_shelf.c index 110491022..62c1b4e7b 100644 --- a/src/bin/e_shelf.c +++ b/src/bin/e_shelf.c @@ -26,8 +26,6 @@ static int _e_shelf_cb_hide_animator_timer(void *data); static int _e_shelf_cb_instant_hide_timer(void *data); static void _e_shelf_menu_pre_cb(void *data, E_Menu *m); -static void _e_shelf_edge_event_register(E_Shelf *es, int reg); - static Eina_List *shelves = NULL; static Eina_Hash *winid_shelves = NULL; @@ -628,8 +626,6 @@ e_shelf_popup_set(E_Shelf *es, int popup) evas_object_show(es->o_base); e_popup_edje_bg_object_set(es->popup, es->o_base); - _e_shelf_edge_event_register(es, 1); - e_drop_xdnd_register_set(es->popup->evas_win, 1); e_gadcon_xdnd_window_set(es->gadcon, es->popup->evas_win); e_gadcon_dnd_window_set(es->gadcon, es->popup->evas_win); @@ -648,7 +644,6 @@ e_shelf_popup_set(E_Shelf *es, int popup) evas_object_layer_set(es->o_event, es->cfg->layer); evas_object_layer_set(es->o_base, es->cfg->layer); - _e_shelf_edge_event_register(es, 0); e_drop_xdnd_register_set(es->zone->container->bg_win, 1); e_gadcon_xdnd_window_set(es->gadcon, es->zone->container->bg_win); e_gadcon_dnd_window_set(es->gadcon, es->zone->container->event_win); @@ -695,8 +690,6 @@ e_shelf_config_new(E_Zone *zone, E_Config_Shelf *cf_es) else e_shelf_show(es); - if (es->popup) - _e_shelf_edge_event_register(es, 1); e_shelf_toggle(es, 0); return es; } @@ -738,7 +731,6 @@ _e_shelf_free(E_Shelf *es) evas_object_del(es->o_base); if (es->popup) { - _e_shelf_edge_event_register(es, 0); e_drop_xdnd_register_set(es->popup->evas_win, 0); eina_hash_del(winid_shelves, e_util_winid_str_get(es->popup->evas_win), es); if (!eina_hash_population(winid_shelves)) @@ -1694,51 +1686,3 @@ _e_shelf_menu_pre_cb(void *data, E_Menu *m) e_util_menu_item_edje_icon_set(mi, "widget/del"); e_menu_item_callback_set(mi, _e_shelf_cb_menu_delete, es); } - -static void -_e_shelf_edge_event_register(E_Shelf *es, int reg) -{ - if (!es) return; - if ((!reg) && (!es->edge)) return; - if ((reg) && (es->edge)) return; - if ((reg) && ((!es->cfg->autohide) || (es->cfg->autohide_show_action) || (!es->popup))) return; - es->edge = reg; - - switch (es->gadcon->orient) - { - case E_GADCON_ORIENT_LEFT: - e_zone_edge_event_register(es->zone, E_ZONE_EDGE_LEFT, es->edge); - break; - case E_GADCON_ORIENT_RIGHT: - e_zone_edge_event_register(es->zone, E_ZONE_EDGE_RIGHT, es->edge); - break; - case E_GADCON_ORIENT_TOP: - e_zone_edge_event_register(es->zone, E_ZONE_EDGE_TOP, es->edge); - break; - case E_GADCON_ORIENT_BOTTOM: - e_zone_edge_event_register(es->zone, E_ZONE_EDGE_BOTTOM, es->edge); - break; - case E_GADCON_ORIENT_CORNER_TL: - case E_GADCON_ORIENT_CORNER_LT: - e_zone_edge_event_register(es->zone, E_ZONE_EDGE_TOP, es->edge); - e_zone_edge_event_register(es->zone, E_ZONE_EDGE_LEFT, es->edge); - break; - case E_GADCON_ORIENT_CORNER_TR: - case E_GADCON_ORIENT_CORNER_RT: - e_zone_edge_event_register(es->zone, E_ZONE_EDGE_TOP, es->edge); - e_zone_edge_event_register(es->zone, E_ZONE_EDGE_RIGHT, es->edge); - break; - case E_GADCON_ORIENT_CORNER_BL: - case E_GADCON_ORIENT_CORNER_LB: - e_zone_edge_event_register(es->zone, E_ZONE_EDGE_BOTTOM, es->edge); - e_zone_edge_event_register(es->zone, E_ZONE_EDGE_LEFT, es->edge); - break; - case E_GADCON_ORIENT_CORNER_BR: - case E_GADCON_ORIENT_CORNER_RB: - e_zone_edge_event_register(es->zone, E_ZONE_EDGE_BOTTOM, es->edge); - e_zone_edge_event_register(es->zone, E_ZONE_EDGE_RIGHT, es->edge); - break; - default: - break; - } -} diff --git a/src/bin/e_zone.c b/src/bin/e_zone.c index 41bb7c65c..eaecd2422 100644 --- a/src/bin/e_zone.c +++ b/src/bin/e_zone.c @@ -10,15 +10,12 @@ static void _e_zone_free(E_Zone *zone); static void _e_zone_cb_bg_mouse_down(void *data, Evas *evas, Evas_Object *obj, void *event_info); static void _e_zone_cb_bg_mouse_up(void *data, Evas *evas, Evas_Object *obj, void *event_info); -static void _e_zone_cb_bg_mouse_move(void *data, Evas *evas, Evas_Object *obj, void *event_info); static void _e_zone_event_zone_desk_count_set_free(void *data, void *ev); static int _e_zone_cb_mouse_in(void *data, int type, void *event); static int _e_zone_cb_mouse_out(void *data, int type, void *event); static int _e_zone_cb_mouse_move(void *data, int type, void *event); -static int _e_zone_cb_timer(void *data); -static int _e_zone_cb_desk_show(void *data, int type, void *event); -static void _e_zone_update_flip(E_Zone *zone); -static void _e_zone_update_edge(E_Zone *zone); +static int _e_zone_cb_desk_after_show(void *data, int type, void *event); +static int _e_zone_cb_edge_timer(void *data); static void _e_zone_event_move_resize_free(void *data, void *ev); static void _e_zone_event_add_free(void *data, void *ev); static void _e_zone_event_del_free(void *data, void *ev); @@ -38,6 +35,8 @@ EAPI int E_EVENT_ZONE_EDGE_MOVE = 0; #define E_ZONE_FLIP_UP(zone) ((e_config->desk_flip_wrap && ((zone)->desk_y_count > 1)) || ((zone)->desk_y_current > 0)) #define E_ZONE_FLIP_DOWN(zone) ((e_config->desk_flip_wrap && ((zone)->desk_y_count > 1)) || (((zone)->desk_y_current + 1) < (zone)->desk_y_count)) +#define E_ZONE_CORNER_RATIO 0.025; + EAPI int e_zone_init(void) { @@ -65,6 +64,7 @@ e_zone_new(E_Container *con, int num, int id, int x, int y, int w, int h) char name[40]; Evas_Object *o; E_Event_Zone_Add *ev; + int cw, ch; zone = E_OBJECT_ALLOC(E_Zone, E_ZONE_TYPE, _e_zone_free); if (!zone) return NULL; @@ -78,15 +78,64 @@ e_zone_new(E_Container *con, int num, int id, int x, int y, int w, int h) zone->num = num; zone->id = id; - zone->edge.left = ecore_x_window_input_new(con->win, zone->x, zone->y, 1, zone->h); + cw = w * E_ZONE_CORNER_RATIO; + ch = h * E_ZONE_CORNER_RATIO; + + zone->corner.left_bottom = ecore_x_window_input_new(con->win, + zone->x, zone->y + zone->h - ch, 1, ch); + zone->edge.left = ecore_x_window_input_new(con->win, + zone->x, zone->y + ch, 1, zone->h - 2 * ch); + zone->corner.left_top = ecore_x_window_input_new(con->win, + zone->x, zone->y, 1, ch); + + zone->corner.top_left = ecore_x_window_input_new(con->win, + zone->x + 1, zone->y, cw, 1); + zone->edge.top = ecore_x_window_input_new(con->win, + zone->x + 1 + cw, zone->y, zone->w - 2 * cw - 2, 1); + zone->corner.top_right = ecore_x_window_input_new(con->win, + zone->x + zone->w - cw - 2, zone->y, cw, 1); + + zone->corner.right_top = ecore_x_window_input_new(con->win, + zone->x + zone->w - 1, zone->y, 1, ch); + zone->edge.right = ecore_x_window_input_new(con->win, + zone->x + zone->w - 1, zone->y + ch, 1, zone->h - 2 * ch); + zone->corner.right_bottom = ecore_x_window_input_new(con->win, + zone->x + zone->w - 1, zone->y + zone->h - ch, 1, ch); + + zone->corner.bottom_right = ecore_x_window_input_new(con->win, + zone->x + 1, zone->y + zone->h - 1, cw, 1); + zone->edge.bottom = ecore_x_window_input_new(con->win, + zone->x + 1 + cw, zone->y + zone->h - 1, zone->w - 2 - 2 * cw, 1); + zone->corner.bottom_left = ecore_x_window_input_new(con->win, + zone->x + zone->w - cw - 2, zone->y + zone->h - 1, cw, 1); + + e_container_window_raise(zone->container, zone->corner.left_bottom, 999); + e_container_window_raise(zone->container, zone->corner.left_top, 999); + e_container_window_raise(zone->container, zone->corner.top_left, 999); + e_container_window_raise(zone->container, zone->corner.top_right, 999); + e_container_window_raise(zone->container, zone->corner.right_top, 999); + e_container_window_raise(zone->container, zone->corner.right_bottom, 999); + e_container_window_raise(zone->container, zone->corner.bottom_right, 999); + e_container_window_raise(zone->container, zone->corner.bottom_left, 999); + e_container_window_raise(zone->container, zone->edge.left, 999); - zone->edge.right = ecore_x_window_input_new(con->win, zone->x + zone->w - 1, zone->y, 1, zone->h); e_container_window_raise(zone->container, zone->edge.right, 999); - zone->edge.top = ecore_x_window_input_new(con->win, zone->x + 1, zone->y, zone->w - 2, 1); e_container_window_raise(zone->container, zone->edge.top, 999); - zone->edge.bottom = ecore_x_window_input_new(con->win, zone->x + 1, zone->y + zone->h - 1, zone->w - 2, 1); e_container_window_raise(zone->container, zone->edge.bottom, 999); + ecore_x_window_show(zone->edge.left); + ecore_x_window_show(zone->edge.right); + ecore_x_window_show(zone->edge.top); + ecore_x_window_show(zone->edge.bottom); + ecore_x_window_show(zone->corner.left_bottom); + ecore_x_window_show(zone->corner.left_top); + ecore_x_window_show(zone->corner.top_left); + ecore_x_window_show(zone->corner.top_right); + ecore_x_window_show(zone->corner.right_top); + ecore_x_window_show(zone->corner.right_bottom); + ecore_x_window_show(zone->corner.bottom_right); + ecore_x_window_show(zone->corner.bottom_left); + zone->handlers = eina_list_append(zone->handlers, ecore_event_handler_add(ECORE_X_EVENT_MOUSE_IN, @@ -101,8 +150,8 @@ e_zone_new(E_Container *con, int num, int id, int x, int y, int w, int h) _e_zone_cb_mouse_move, zone)); zone->handlers = eina_list_append(zone->handlers, - ecore_event_handler_add(E_EVENT_DESK_SHOW, - _e_zone_cb_desk_show, zone)); + ecore_event_handler_add(E_EVENT_DESK_AFTER_SHOW, + _e_zone_cb_desk_after_show, zone)); snprintf(name, sizeof(name), "Zone %d", zone->num); zone->name = eina_stringshare_add(name); @@ -126,7 +175,6 @@ e_zone_new(E_Container *con, int num, int id, int x, int y, int w, int h) evas_object_show(o); evas_object_event_callback_add(o, EVAS_CALLBACK_MOUSE_DOWN, _e_zone_cb_bg_mouse_down, zone); evas_object_event_callback_add(o, EVAS_CALLBACK_MOUSE_UP, _e_zone_cb_bg_mouse_up, zone); - evas_object_event_callback_add(o, EVAS_CALLBACK_MOUSE_MOVE, _e_zone_cb_bg_mouse_move, zone); /* TODO: config the ecore_evas type. */ zone->black_ecore_evas = @@ -153,9 +201,6 @@ e_zone_new(E_Container *con, int num, int id, int x, int y, int w, int h) e_zone_desk_count_set(zone, e_config->zone_desks_x_count, e_config->zone_desks_y_count); - _e_zone_update_flip(zone); - _e_zone_update_edge(zone); - e_object_del_attach_func_set(E_OBJECT(zone), _e_zone_object_del_attach); ev = E_NEW(E_Event_Zone_Add, 1); @@ -180,6 +225,7 @@ EAPI void e_zone_move(E_Zone *zone, int x, int y) { E_Event_Zone_Move_Resize *ev; + int cw, ch; E_OBJECT_CHECK(zone); E_OBJECT_TYPE_CHECK(zone, E_ZONE_TYPE); @@ -196,16 +242,42 @@ e_zone_move(E_Zone *zone, int x, int y) e_object_ref(E_OBJECT(ev->zone)); ecore_event_add(E_EVENT_ZONE_MOVE_RESIZE, ev, _e_zone_event_move_resize_free, NULL); - ecore_x_window_move_resize(zone->edge.left, zone->x, zone->y, 1, zone->h); - ecore_x_window_move_resize(zone->edge.right, zone->x + zone->w - 1, zone->y, 1, zone->h); - ecore_x_window_move_resize(zone->edge.top, zone->x + 1, zone->y, zone->w - 2, 1); - ecore_x_window_move_resize(zone->edge.bottom, zone->x + 1, zone->y + zone->h - 1, zone->w - 2, 1); + cw = zone->w * E_ZONE_CORNER_RATIO; + ch = zone->h * E_ZONE_CORNER_RATIO; + ecore_x_window_move_resize(zone->corner.left_bottom, + zone->x, zone->y + zone->h - ch, 1, ch); + ecore_x_window_move_resize(zone->edge.left, + zone->x, zone->y + ch, 1, zone->h - 2 * ch); + ecore_x_window_move_resize(zone->corner.left_top, + zone->x, zone->y, 1, ch); + + ecore_x_window_move_resize(zone->corner.top_left, + zone->x + 1, zone->y, cw, 1); + ecore_x_window_move_resize(zone->edge.top, + zone->x + 1 + cw, zone->y, zone->w - 2 * cw - 2, 1); + ecore_x_window_move_resize(zone->corner.top_right, + zone->x + zone->w - cw - 2, zone->y, cw, 1); + + ecore_x_window_move_resize(zone->corner.right_top, + zone->x + zone->w - 1, zone->y, 1, ch); + ecore_x_window_move_resize(zone->edge.right, + zone->x + zone->w - 1, zone->y + ch, 1, zone->h - 2 * ch); + ecore_x_window_move_resize(zone->corner.right_bottom, + zone->x + zone->w - 1, zone->y + zone->h - ch, 1, ch); + + ecore_x_window_move_resize(zone->corner.bottom_right, + zone->x + 1, zone->y + zone->h - 1, cw, 1); + ecore_x_window_move_resize(zone->edge.bottom, + zone->x + 1 + cw, zone->y + zone->h - 1, zone->w - 2 - 2 * cw, 1); + ecore_x_window_move_resize(zone->corner.bottom_left, + zone->x + zone->w - cw - 2, zone->y + zone->h - 1, cw, 1); } EAPI void e_zone_resize(E_Zone *zone, int w, int h) { E_Event_Zone_Move_Resize *ev; + int cw, ch; E_OBJECT_CHECK(zone); E_OBJECT_TYPE_CHECK(zone, E_ZONE_TYPE); @@ -223,19 +295,42 @@ e_zone_resize(E_Zone *zone, int w, int h) ecore_event_add(E_EVENT_ZONE_MOVE_RESIZE, ev, _e_zone_event_move_resize_free, NULL); - ecore_x_window_move_resize(zone->edge.left, zone->x, zone->y, 1, zone->h); - ecore_x_window_move_resize(zone->edge.right, zone->x + zone->w - 1, - zone->y, 1, zone->h); - ecore_x_window_move_resize(zone->edge.top, zone->x + 1, zone->y, - zone->w - 2, 1); - ecore_x_window_move_resize(zone->edge.bottom, zone->x + 1, - zone->y + zone->h - 1, zone->w - 2, 1); + cw = zone->w * E_ZONE_CORNER_RATIO; + ch = zone->h * E_ZONE_CORNER_RATIO; + ecore_x_window_move_resize(zone->corner.left_bottom, + zone->x, zone->y + zone->h - ch, 1, ch); + ecore_x_window_move_resize(zone->edge.left, + zone->x, zone->y + ch, 1, zone->h - 2 * ch); + ecore_x_window_move_resize(zone->corner.left_top, + zone->x, zone->y, 1, ch); + + ecore_x_window_move_resize(zone->corner.top_left, + zone->x + 1, zone->y, cw, 1); + ecore_x_window_move_resize(zone->edge.top, + zone->x + 1 + cw, zone->y, zone->w - 2 * cw - 2, 1); + ecore_x_window_move_resize(zone->corner.top_right, + zone->x + zone->w - cw - 2, zone->y, cw, 1); + + ecore_x_window_move_resize(zone->corner.right_top, + zone->x + zone->w - 1, zone->y, 1, ch); + ecore_x_window_move_resize(zone->edge.right, + zone->x + zone->w - 1, zone->y + ch, 1, zone->h - 2 * ch); + ecore_x_window_move_resize(zone->corner.right_bottom, + zone->x + zone->w - 1, zone->y + zone->h - ch, 1, ch); + + ecore_x_window_move_resize(zone->corner.bottom_right, + zone->x + 1, zone->y + zone->h - 1, cw, 1); + ecore_x_window_move_resize(zone->edge.bottom, + zone->x + 1 + cw, zone->y + zone->h - 1, zone->w - 2 - 2 * cw, 1); + ecore_x_window_move_resize(zone->corner.bottom_left, + zone->x + zone->w - cw - 2, zone->y + zone->h - 1, cw, 1); } EAPI void e_zone_move_resize(E_Zone *zone, int x, int y, int w, int h) { E_Event_Zone_Move_Resize *ev; + int cw, ch; E_OBJECT_CHECK(zone); E_OBJECT_TYPE_CHECK(zone, E_ZONE_TYPE); @@ -261,13 +356,35 @@ e_zone_move_resize(E_Zone *zone, int x, int y, int w, int h) ecore_event_add(E_EVENT_ZONE_MOVE_RESIZE, ev, _e_zone_event_move_resize_free, NULL); - ecore_x_window_move_resize(zone->edge.left, zone->x, zone->y, 1, zone->h); - ecore_x_window_move_resize(zone->edge.right, zone->x + zone->w - 1, - zone->y, 1, zone->h); - ecore_x_window_move_resize(zone->edge.top, zone->x + 1, zone->y, - zone->w - 2, 1); - ecore_x_window_move_resize(zone->edge.bottom, zone->x + 1, - zone->y + zone->h - 1, zone->w - 2, 1); + cw = zone->w * E_ZONE_CORNER_RATIO; + ch = zone->h * E_ZONE_CORNER_RATIO; + ecore_x_window_move_resize(zone->corner.left_bottom, + zone->x, zone->y + zone->h - ch, 1, ch); + ecore_x_window_move_resize(zone->edge.left, + zone->x, zone->y + ch, 1, zone->h - 2 * ch); + ecore_x_window_move_resize(zone->corner.left_top, + zone->x, zone->y, 1, ch); + + ecore_x_window_move_resize(zone->corner.top_left, + zone->x + 1, zone->y, cw, 1); + ecore_x_window_move_resize(zone->edge.top, + zone->x + 1 + cw, zone->y, zone->w - 2 * cw - 2, 1); + ecore_x_window_move_resize(zone->corner.top_right, + zone->x + zone->w - cw - 2, zone->y, cw, 1); + + ecore_x_window_move_resize(zone->corner.right_top, + zone->x + zone->w - 1, zone->y, 1, ch); + ecore_x_window_move_resize(zone->edge.right, + zone->x + zone->w - 1, zone->y + ch, 1, zone->h - 2 * ch); + ecore_x_window_move_resize(zone->corner.right_bottom, + zone->x + zone->w - 1, zone->y + zone->h - ch, 1, ch); + + ecore_x_window_move_resize(zone->corner.bottom_right, + zone->x + 1, zone->y + zone->h - 1, cw, 1); + ecore_x_window_move_resize(zone->edge.bottom, + zone->x + 1 + cw, zone->y + zone->h - 1, zone->w - 2 - 2 * cw, 1); + ecore_x_window_move_resize(zone->corner.bottom_left, + zone->x + zone->w - cw - 2, zone->y + zone->h - 1, cw, 1); } EAPI void @@ -327,13 +444,19 @@ e_zone_bg_reconfigure(E_Zone *zone) EAPI void e_zone_flip_coords_handle(E_Zone *zone, int x, int y) { + E_Event_Zone_Edge *zev; + E_Binding_Edge *bind; + E_Zone_Edge edge; + Eina_List *l; + E_Shelf *es; + int ok = 0; int one_row = 1; int one_col = 1; E_OBJECT_CHECK(zone); E_OBJECT_TYPE_CHECK(zone, E_ZONE_TYPE); - if (!e_config->edge_flip_dragging) return; + if (!e_config->edge_flip_dragging || zone->flip.switching) return; /* if we have only 1 row we can flip up/down even if we have xinerama */ if (eina_list_count(zone->container->zones) > 1) { @@ -358,44 +481,91 @@ e_zone_flip_coords_handle(E_Zone *zone, int x, int y) goto noflip; if (!E_INSIDE(x, y, zone->x, zone->y, zone->w, zone->h)) goto noflip; - if ((one_row) && (y == 0) && E_ZONE_FLIP_UP(zone)) - { - /* top */ - if (!zone->flip.timer) - zone->flip.timer = ecore_timer_add(e_config->edge_flip_timeout, - _e_zone_cb_timer, zone); - zone->flip.direction = E_DIRECTION_UP; - } - else if ((one_col) && (x == (zone->w - 1)) && E_ZONE_FLIP_RIGHT(zone)) - { - /* right */ - if (!zone->flip.timer) - zone->flip.timer = ecore_timer_add(e_config->edge_flip_timeout, - _e_zone_cb_timer, zone); - zone->flip.direction = E_DIRECTION_RIGHT; - } - else if ((one_row) && (y == (zone->h - 1)) && E_ZONE_FLIP_DOWN(zone)) - { - /* bottom */ - if (!zone->flip.timer) - zone->flip.timer = ecore_timer_add(e_config->edge_flip_timeout, - _e_zone_cb_timer, zone); - zone->flip.direction = E_DIRECTION_DOWN; - } - else if ((one_col) && (x == 0) && E_ZONE_FLIP_LEFT(zone)) - { - /* left */ - if (!zone->flip.timer) - zone->flip.timer = ecore_timer_add(e_config->edge_flip_timeout, - _e_zone_cb_timer, zone); - zone->flip.direction = E_DIRECTION_LEFT; - } + if ((one_row) && (y == 0)) + edge = E_ZONE_EDGE_TOP; + else if ((one_col) && (x == (zone->w - 1))) + edge = E_ZONE_EDGE_RIGHT; + else if ((one_row) && (y == (zone->h - 1))) + edge = E_ZONE_EDGE_BOTTOM; + else if ((one_col) && (x == 0)) + edge = E_ZONE_EDGE_LEFT; else { noflip: - /* in zone */ - if (zone->flip.timer) ecore_timer_del(zone->flip.timer); - zone->flip.timer = NULL; + + if (zone->flip.es) + e_shelf_toggle(zone->flip.es, 0); + zone->flip.es = NULL; + return; + } + EINA_LIST_FOREACH(e_shelf_list(), l, es) + { + ok = 0; + + if (es->zone != zone) continue; + switch(es->gadcon->orient) + { + case E_GADCON_ORIENT_TOP: + case E_GADCON_ORIENT_CORNER_TL: + case E_GADCON_ORIENT_CORNER_TR: + if (edge == E_ZONE_EDGE_TOP) ok = 1; + break; + case E_GADCON_ORIENT_BOTTOM: + case E_GADCON_ORIENT_CORNER_BL: + case E_GADCON_ORIENT_CORNER_BR: + if (edge == E_ZONE_EDGE_BOTTOM) ok = 1; + break; + case E_GADCON_ORIENT_LEFT: + case E_GADCON_ORIENT_CORNER_LT: + case E_GADCON_ORIENT_CORNER_LB: + if (edge == E_ZONE_EDGE_LEFT) ok = 1; + break; + case E_GADCON_ORIENT_RIGHT: + case E_GADCON_ORIENT_CORNER_RT: + case E_GADCON_ORIENT_CORNER_RB: + if (edge == E_ZONE_EDGE_RIGHT) ok = 1; + break; + } + + if (!ok) continue; + if (!E_INSIDE(x, y, es->x, es->y, es->w, es->h)) + continue; + + if (zone->flip.es) + e_shelf_toggle(zone->flip.es, 0); + + zone->flip.es = es; + e_shelf_toggle(es, 1); + } + ok = 0; + switch(edge) + { + case E_ZONE_EDGE_LEFT: + if (E_ZONE_FLIP_LEFT(zone)) ok = 1; + break; + case E_ZONE_EDGE_TOP: + if (E_ZONE_FLIP_UP(zone)) ok = 1; + break; + case E_ZONE_EDGE_RIGHT: + if (E_ZONE_FLIP_RIGHT(zone)) ok = 1; + break; + case E_ZONE_EDGE_BOTTOM: + if (E_ZONE_FLIP_DOWN(zone)) ok = 1; + break; + } + if (!ok) return; + bind = e_bindings_edge_get("desk_flip_in_direction", edge); + if (bind) + { + zev = E_NEW(E_Event_Zone_Edge, 1); + zev->zone = zone; + zev->x = x; + zev->y = y; + zev->edge = edge; + zone->flip.ev = zev; + zone->flip.bind = bind; + zone->flip.switching = 1; + bind->timer = ecore_timer_add(((double) bind->delay), _e_zone_cb_edge_timer, zone); } } @@ -522,36 +692,6 @@ e_zone_desk_count_get(E_Zone *zone, int *x_count, int *y_count) if (y_count) *y_count = zone->desk_y_count; } -EAPI void -e_zone_update_flip(E_Zone *zone) -{ - E_OBJECT_CHECK(zone); - E_OBJECT_TYPE_CHECK(zone, E_ZONE_TYPE); - - _e_zone_update_flip(zone); - _e_zone_update_edge(zone); -} - -EAPI void -e_zone_update_flip_all(void) -{ - Eina_List *l, *ll; - E_Manager *man; - E_Container *con; - E_Zone *zone; - - for (l = e_manager_list(); l; l = l->next) - { - man = l->data; - for (ll = man->containers; ll; ll = ll->next) - { - con = ll->data; - zone = e_zone_current_get(con); - e_zone_update_flip(zone); - } - } -} - EAPI void e_zone_desk_flip_by(E_Zone *zone, int dx, int dy) { @@ -638,6 +778,14 @@ e_zone_flip_win_disable(void) ecore_x_window_hide(zone->edge.right); ecore_x_window_hide(zone->edge.top); ecore_x_window_hide(zone->edge.bottom); + ecore_x_window_hide(zone->corner.left_bottom); + ecore_x_window_hide(zone->corner.left_top); + ecore_x_window_hide(zone->corner.top_left); + ecore_x_window_hide(zone->corner.top_right); + ecore_x_window_hide(zone->corner.right_top); + ecore_x_window_hide(zone->corner.right_bottom); + ecore_x_window_hide(zone->corner.bottom_right); + ecore_x_window_hide(zone->corner.bottom_left); } } } @@ -661,37 +809,23 @@ e_zone_flip_win_restore(void) E_Zone *zone; zone = lll->data; - _e_zone_update_edge(zone); + ecore_x_window_show(zone->edge.left); + ecore_x_window_show(zone->edge.right); + ecore_x_window_show(zone->edge.top); + ecore_x_window_show(zone->edge.bottom); + ecore_x_window_show(zone->corner.left_bottom); + ecore_x_window_show(zone->corner.left_top); + ecore_x_window_show(zone->corner.top_left); + ecore_x_window_show(zone->corner.top_right); + ecore_x_window_show(zone->corner.right_top); + ecore_x_window_show(zone->corner.right_bottom); + ecore_x_window_show(zone->corner.bottom_right); + ecore_x_window_show(zone->corner.bottom_left); } } } } -EAPI void -e_zone_edge_event_register(E_Zone *zone, E_Zone_Edge edge, int reg) -{ - switch (edge) - { - case E_ZONE_EDGE_LEFT: - if (reg) zone->show.left++; - else zone->show.left--; - break; - case E_ZONE_EDGE_RIGHT: - if (reg) zone->show.right++; - else zone->show.right--; - break; - case E_ZONE_EDGE_TOP: - if (reg) zone->show.top++; - else zone->show.top--; - break; - case E_ZONE_EDGE_BOTTOM: - if (reg) zone->show.bottom++; - else zone->show.bottom--; - break; - } - _e_zone_update_edge(zone); -} - /* local subsystem functions */ static void _e_zone_free(E_Zone *zone) @@ -705,6 +839,14 @@ _e_zone_free(E_Zone *zone) if (zone->edge.bottom) ecore_x_window_del(zone->edge.bottom); if (zone->edge.left) ecore_x_window_del(zone->edge.left); if (zone->edge.right) ecore_x_window_del(zone->edge.right); + if (zone->corner.left_bottom) ecore_x_window_del(zone->corner.left_bottom); + if (zone->corner.left_top) ecore_x_window_del(zone->corner.left_top); + if (zone->corner.top_left) ecore_x_window_del(zone->corner.top_left); + if (zone->corner.top_right) ecore_x_window_del(zone->corner.top_right); + if (zone->corner.right_top) ecore_x_window_del(zone->corner.right_top); + if (zone->corner.right_bottom) ecore_x_window_del(zone->corner.right_bottom); + if (zone->corner.bottom_right) ecore_x_window_del(zone->corner.bottom_right); + if (zone->corner.bottom_left) ecore_x_window_del(zone->corner.bottom_left); /* Delete the object event callbacks */ evas_object_event_callback_del(zone->bg_event_object, @@ -713,9 +855,6 @@ _e_zone_free(E_Zone *zone) evas_object_event_callback_del(zone->bg_event_object, EVAS_CALLBACK_MOUSE_UP, _e_zone_cb_bg_mouse_up); - evas_object_event_callback_del(zone->bg_event_object, - EVAS_CALLBACK_MOUSE_MOVE, - _e_zone_cb_bg_mouse_move); if (zone->black_ecore_evas) { @@ -826,16 +965,6 @@ _e_zone_cb_bg_mouse_up(void *data, Evas *evas, Evas_Object *obj, void *event_inf } } -static void -_e_zone_cb_bg_mouse_move(void *data, Evas *evas, Evas_Object *obj, void *event_info) -{ - E_Zone *zone; - Evas_Event_Mouse_Move *ev; - - ev = (Evas_Event_Mouse_Move *)event_info; - zone = data; -} - static void _e_zone_event_zone_desk_count_set_free(void *data, void *ev) { @@ -851,78 +980,43 @@ _e_zone_cb_mouse_in(void *data, int type, void *event) { Ecore_X_Event_Mouse_In *ev; E_Event_Zone_Edge *zev; + E_Zone_Edge edge; E_Zone *zone; ev = event; zone = data; - if (ev->win == zone->edge.top) - { - if (zone->flip.top) - { - if (!zone->flip.timer) - zone->flip.timer = ecore_timer_add(e_config->edge_flip_timeout, _e_zone_cb_timer, zone); - zone->flip.direction = E_DIRECTION_UP; - } - - zev = E_NEW(E_Event_Zone_Edge, 1); - zev->zone = zone; - zev->x = ev->x; - zev->y = ev->y; - zev->edge = E_ZONE_EDGE_TOP; - ecore_event_add(E_EVENT_ZONE_EDGE_IN, zev, NULL, NULL); - } + if (ev->win == zone->edge.left) + edge = E_ZONE_EDGE_LEFT; + else if (ev->win == zone->edge.top) + edge = E_ZONE_EDGE_TOP; else if (ev->win == zone->edge.right) - { - if (zone->flip.right) - { - if (!zone->flip.timer) - zone->flip.timer = ecore_timer_add(e_config->edge_flip_timeout, - _e_zone_cb_timer, zone); - zone->flip.direction = E_DIRECTION_RIGHT; - } - - zev = E_NEW(E_Event_Zone_Edge, 1); - zev->zone = zone; - zev->x = ev->x; - zev->y = ev->y; - zev->edge = E_ZONE_EDGE_RIGHT; - ecore_event_add(E_EVENT_ZONE_EDGE_IN, zev, NULL, NULL); - } + edge = E_ZONE_EDGE_RIGHT; else if (ev->win == zone->edge.bottom) - { - if (zone->flip.bottom) - { - if (!zone->flip.timer) - zone->flip.timer = ecore_timer_add(e_config->edge_flip_timeout, - _e_zone_cb_timer, zone); - zone->flip.direction = E_DIRECTION_DOWN; - } + edge = E_ZONE_EDGE_BOTTOM; + else if ((ev->win == zone->corner.left_top) || + (ev->win == zone->corner.top_left)) + edge = E_ZONE_EDGE_TOP_LEFT; + else if ((ev->win == zone->corner.right_top) || + (ev->win == zone->corner.top_right)) + edge = E_ZONE_EDGE_TOP_RIGHT; + else if ((ev->win == zone->corner.right_bottom) || + (ev->win == zone->corner.bottom_right)) + edge = E_ZONE_EDGE_BOTTOM_RIGHT; + else if ((ev->win == zone->corner.left_bottom) || + (ev->win == zone->corner.bottom_left)) + edge = E_ZONE_EDGE_BOTTOM_LEFT; + else return 1; - zev = E_NEW(E_Event_Zone_Edge, 1); - zev->zone = zone; - zev->x = ev->x; - zev->y = ev->y; - zev->edge = E_ZONE_EDGE_BOTTOM; - ecore_event_add(E_EVENT_ZONE_EDGE_IN, zev, NULL, NULL); - } - else if (ev->win == zone->edge.left) - { - if (zone->flip.left) - { - if (!zone->flip.timer) - zone->flip.timer = ecore_timer_add(e_config->edge_flip_timeout, - _e_zone_cb_timer, zone); - zone->flip.direction = E_DIRECTION_LEFT; - } + zev = E_NEW(E_Event_Zone_Edge, 1); + zev->zone = zone; + zev->edge = edge; + zev->x = ev->x; + zev->y = ev->y; + zev->modifiers = ev->modifiers; + ecore_event_add(E_EVENT_ZONE_EDGE_IN, zev, NULL, NULL); + e_bindings_edge_in_event_handle(E_BINDING_CONTEXT_ZONE, E_OBJECT(zone), zev); - zev = E_NEW(E_Event_Zone_Edge, 1); - zev->zone = zone; - zev->x = ev->x; - zev->y = ev->y; - zev->edge = E_ZONE_EDGE_LEFT; - ecore_event_add(E_EVENT_ZONE_EDGE_IN, zev, NULL, NULL); - } return 1; } @@ -931,29 +1025,42 @@ _e_zone_cb_mouse_out(void *data, int type, void *event) { Ecore_X_Event_Mouse_Out *ev; E_Event_Zone_Edge *zev; + E_Zone_Edge edge; E_Zone *zone; ev = event; zone = data; - if ((ev->win == zone->edge.top) || - (ev->win == zone->edge.bottom) || - (ev->win == zone->edge.left) || - (ev->win == zone->edge.right)) - { - if (zone->flip.timer) - ecore_timer_del(zone->flip.timer); - zone->flip.timer = NULL; - zev = E_NEW(E_Event_Zone_Edge, 1); - zev->zone = zone; - zev->x = ev->x; - zev->y = ev->y; - if (ev->win == zone->edge.top) zev->edge = E_ZONE_EDGE_TOP; - else if (ev->win == zone->edge.bottom) zev->edge = E_ZONE_EDGE_BOTTOM; - else if (ev->win == zone->edge.left) zev->edge = E_ZONE_EDGE_LEFT; - else if (ev->win == zone->edge.right) zev->edge = E_ZONE_EDGE_RIGHT; - ecore_event_add(E_EVENT_ZONE_EDGE_OUT, zev, NULL, NULL); - } + if (ev->win == zone->edge.left) + edge = E_ZONE_EDGE_LEFT; + else if (ev->win == zone->edge.top) + edge = E_ZONE_EDGE_TOP; + else if (ev->win == zone->edge.right) + edge = E_ZONE_EDGE_RIGHT; + else if (ev->win == zone->edge.bottom) + edge = E_ZONE_EDGE_BOTTOM; + else if ((ev->win == zone->corner.left_top) || + (ev->win == zone->corner.top_left)) + edge = E_ZONE_EDGE_TOP_LEFT; + else if ((ev->win == zone->corner.right_top) || + (ev->win == zone->corner.top_right)) + edge = E_ZONE_EDGE_TOP_RIGHT; + else if ((ev->win == zone->corner.right_bottom) || + (ev->win == zone->corner.bottom_right)) + edge = E_ZONE_EDGE_BOTTOM_RIGHT; + else if ((ev->win == zone->corner.left_bottom) || + (ev->win == zone->corner.bottom_left)) + edge = E_ZONE_EDGE_BOTTOM_LEFT; + else return 1; + + zev = E_NEW(E_Event_Zone_Edge, 1); + zev->zone = zone; + zev->edge = edge; + zev->x = ev->x; + zev->y = ev->y; + zev->modifiers = ev->modifiers; + ecore_event_add(E_EVENT_ZONE_EDGE_OUT, zev, NULL, NULL); + e_bindings_edge_out_event_handle(E_BINDING_CONTEXT_ZONE, E_OBJECT(zone), zev); return 1; } @@ -962,105 +1069,46 @@ _e_zone_cb_mouse_move(void *data, int type, void *event) { Ecore_X_Event_Mouse_Move *ev; E_Event_Zone_Edge *zev; + E_Zone_Edge edge; E_Zone *zone; ev = event; zone = data; - if ((ev->win == zone->edge.top) || - (ev->win == zone->edge.bottom) || - (ev->win == zone->edge.left) || - (ev->win == zone->edge.right)) - { - zev = E_NEW(E_Event_Zone_Edge, 1); - zev->zone = zone; - zev->x = ev->x; - zev->y = ev->y; - if (ev->win == zone->edge.top) zev->edge = E_ZONE_EDGE_TOP; - else if (ev->win == zone->edge.bottom) zev->edge = E_ZONE_EDGE_BOTTOM; - else if (ev->win == zone->edge.left) zev->edge = E_ZONE_EDGE_LEFT; - else if (ev->win == zone->edge.right) zev->edge = E_ZONE_EDGE_RIGHT; - ecore_event_add(E_EVENT_ZONE_EDGE_MOVE, zev, NULL, NULL); - } + if (ev->win == zone->edge.left) + edge = E_ZONE_EDGE_LEFT; + else if (ev->win == zone->edge.top) + edge = E_ZONE_EDGE_TOP; + else if (ev->win == zone->edge.right) + edge = E_ZONE_EDGE_RIGHT; + else if (ev->win == zone->edge.bottom) + edge = E_ZONE_EDGE_BOTTOM; + else if ((ev->win == zone->corner.left_top) || + (ev->win == zone->corner.top_left)) + edge = E_ZONE_EDGE_TOP_LEFT; + else if ((ev->win == zone->corner.right_top) || + (ev->win == zone->corner.top_right)) + edge = E_ZONE_EDGE_TOP_RIGHT; + else if ((ev->win == zone->corner.right_bottom) || + (ev->win == zone->corner.bottom_right)) + edge = E_ZONE_EDGE_BOTTOM_RIGHT; + else if ((ev->win == zone->corner.left_bottom) || + (ev->win == zone->corner.bottom_left)) + edge = E_ZONE_EDGE_BOTTOM_LEFT; + else return 1; + + zev = E_NEW(E_Event_Zone_Edge, 1); + zev->zone = zone; + zev->edge = edge; + zev->x = ev->x; + zev->y = ev->y; + zev->modifiers = ev->modifiers; + ecore_event_add(E_EVENT_ZONE_EDGE_MOVE, zev, NULL, NULL); return 1; } static int -_e_zone_cb_timer(void *data) -{ - E_Zone *zone; - E_Desk *prev = NULL, *current = NULL; - E_Event_Pointer_Warp *ev; - int x, y; - - ev = E_NEW(E_Event_Pointer_Warp, 1); - if (!ev) return 0; - - zone = data; - if (zone != e_zone_current_get(zone->container)) - { - zone->flip.timer = NULL; - return 0; - } - - ecore_x_pointer_xy_get(zone->container->win, &x, &y); - ev->prev.x = x; - ev->prev.y = y; - prev = e_desk_at_xy_get(zone, zone->desk_x_current, zone->desk_y_current); - - switch (zone->flip.direction) - { - case E_DIRECTION_UP: - if (E_ZONE_FLIP_UP(zone)) - { - e_zone_desk_flip_by(zone, 0, -1); - ecore_x_pointer_warp(zone->container->win, x, zone->h - 2); - ev->curr.x = x; - ev->curr.y = zone->h - 2; - } - break; - case E_DIRECTION_RIGHT: - if (E_ZONE_FLIP_RIGHT(zone)) - { - e_zone_desk_flip_by(zone, 1, 0); - ecore_x_pointer_warp(zone->container->win, 2, y); - ev->curr.y = y; - ev->curr.x = 2; - } - break; - case E_DIRECTION_DOWN: - if (E_ZONE_FLIP_DOWN(zone)) - { - e_zone_desk_flip_by(zone, 0, 1); - ecore_x_pointer_warp(zone->container->win, x, 2); - ev->curr.x = x; - ev->curr.y = 2; - } - break; - case E_DIRECTION_LEFT: - if (E_ZONE_FLIP_LEFT(zone)) - { - e_zone_desk_flip_by(zone, -1, 0); - ecore_x_pointer_warp(zone->container->win, zone->w - 2, y); - ev->curr.y = y; - ev->curr.x = zone->w - 2; - } - break; - } - - zone->flip.timer = NULL; - - current = e_desk_current_get(zone); - if (current) - ecore_event_add(E_EVENT_POINTER_WARP, ev, NULL, NULL); - else - free(ev); - - return 0; -} - -static int -_e_zone_cb_desk_show(void *data, int type, void *event) +_e_zone_cb_desk_after_show(void *data, int type, void *event) { E_Event_Desk_Show *ev; E_Zone *zone; @@ -1069,94 +1117,33 @@ _e_zone_cb_desk_show(void *data, int type, void *event) zone = data; if (ev->desk->zone != zone) return 1; - _e_zone_update_flip(zone); - _e_zone_update_edge(zone); + zone->flip.switching = 0; return 1; } -static void -_e_zone_update_flip(E_Zone *zone) +static int +_e_zone_cb_edge_timer(void *data) { - if (zone->flip.left) zone->show.left--; - zone->flip.left = 0; - if (zone->flip.right) zone->show.right--; - zone->flip.right = 0; - if (zone->flip.top) zone->show.top--; - zone->flip.top = 0; - if (zone->flip.bottom) zone->show.bottom--; - zone->flip.bottom = 0; + E_Zone *zone; + E_Action *act; - if (e_config->edge_flip_moving) + zone = data; + act = e_action_find(zone->flip.bind->action); + if (!act) { - /* if we have only 1 row we can flip up/down even if we have xinerama */ - int one_row = 1; - int one_col = 1; - - if (eina_list_count(zone->container->zones) > 1) - { - Eina_List *zones; - E_Zone *next_zone; - int x, y; - - zones = zone->container->zones; - next_zone = (E_Zone *)eina_list_data_get(zones); - x = next_zone->x; - y = next_zone->y; - zones = eina_list_next(zones); - while (zones) - { - next_zone = (E_Zone *)zones->data; - if (next_zone->x != x) one_col = 0; - if (next_zone->y != y) one_row = 0; - zones = zones->next; - } - } - if (eina_list_count(zone->container->manager->containers) > 1) - { - one_col = 0; - one_row = 0; - } - - if (one_col && E_ZONE_FLIP_LEFT(zone)) - { - zone->flip.left = 1; - zone->show.left++; - } - - if (one_col && E_ZONE_FLIP_RIGHT(zone)) - { - zone->flip.right = 1; - zone->show.right++; - } - - if (one_row && E_ZONE_FLIP_UP(zone)) - { - zone->flip.top = 1; - zone->show.top++; - } - - if (one_row && E_ZONE_FLIP_DOWN(zone)) - { - zone->flip.bottom = 1; - zone->show.bottom++; - } + E_FREE(zone->flip.ev); + return 0; } -} -static void -_e_zone_update_edge(E_Zone *zone) -{ - if (zone->show.left) ecore_x_window_show(zone->edge.left); - else ecore_x_window_hide(zone->edge.left); + if (act->func.go_edge) + act->func.go_edge(E_OBJECT(zone), zone->flip.bind->params, zone->flip.ev); + else if (act->func.go) + act->func.go(E_OBJECT(zone), zone->flip.bind->params); - if (zone->show.right) ecore_x_window_show(zone->edge.right); - else ecore_x_window_hide(zone->edge.right); + zone->flip.bind->timer = NULL; - if (zone->show.top) ecore_x_window_show(zone->edge.top); - else ecore_x_window_hide(zone->edge.top); - - if (zone->show.bottom) ecore_x_window_show(zone->edge.bottom); - else ecore_x_window_hide(zone->edge.bottom); + E_FREE(zone->flip.ev); + return 0; } static void diff --git a/src/bin/e_zone.h b/src/bin/e_zone.h index 278d056bc..9c84038c2 100644 --- a/src/bin/e_zone.h +++ b/src/bin/e_zone.h @@ -5,10 +5,15 @@ typedef enum _E_Zone_Edge { + E_ZONE_EDGE_NONE, E_ZONE_EDGE_LEFT, E_ZONE_EDGE_RIGHT, E_ZONE_EDGE_TOP, - E_ZONE_EDGE_BOTTOM + E_ZONE_EDGE_BOTTOM, + E_ZONE_EDGE_TOP_LEFT, + E_ZONE_EDGE_TOP_RIGHT, + E_ZONE_EDGE_BOTTOM_RIGHT, + E_ZONE_EDGE_BOTTOM_LEFT } E_Zone_Edge; typedef struct _E_Zone E_Zone; @@ -52,20 +57,19 @@ struct _E_Zone Eina_List *handlers; struct { - unsigned char top : 1; - unsigned char right : 1; - unsigned char bottom : 1; - unsigned char left : 1; - Ecore_Timer *timer; - E_Direction direction; + unsigned char switching : 1; + E_Shelf *es; + E_Event_Zone_Edge *ev; + E_Binding_Edge *bind; } flip; struct { Ecore_X_Window top, right, bottom, left; } edge; struct { - int top, right, bottom, left; - } show; + Ecore_X_Window left_top, top_left, top_right, right_top, + right_bottom, bottom_right, bottom_left, left_bottom; + } corner; E_Action *cur_mouse_action; Eina_List *popups; @@ -111,6 +115,7 @@ struct _E_Event_Zone_Edge E_Zone *zone; E_Zone_Edge edge; int x, y; + int modifiers; }; EAPI int e_zone_init(void); @@ -126,15 +131,12 @@ EAPI void e_zone_bg_reconfigure(E_Zone *zone); EAPI void e_zone_flip_coords_handle(E_Zone *zone, int x, int y); EAPI void e_zone_desk_count_set(E_Zone *zone, int x_count, int y_count); EAPI void e_zone_desk_count_get(E_Zone *zone, int *x_count, int *y_count); -EAPI void e_zone_update_flip(E_Zone *zone); -EAPI void e_zone_update_flip_all(void); EAPI void e_zone_desk_flip_by(E_Zone *zone, int dx, int dy); EAPI void e_zone_desk_flip_to(E_Zone *zone, int x, int y); EAPI void e_zone_desk_linear_flip_by(E_Zone *zone, int dx); EAPI void e_zone_desk_linear_flip_to(E_Zone *zone, int x); EAPI void e_zone_flip_win_disable(void); EAPI void e_zone_flip_win_restore(void); -EAPI void e_zone_edge_event_register(E_Zone *zone, E_Zone_Edge edge, int reg); extern EAPI int E_EVENT_ZONE_DESK_COUNT_SET; extern EAPI int E_EVENT_ZONE_MOVE_RESIZE; diff --git a/src/modules/Makefile.am b/src/modules/Makefile.am index 67fe0e47b..73a2afd01 100644 --- a/src/modules/Makefile.am +++ b/src/modules/Makefile.am @@ -154,6 +154,10 @@ if USE_MODULE_CONF_MOUSEBINDINGS SUBDIRS += conf_mousebindings endif +if USE_MODULE_CONF_EDGEBINDINGS +SUBDIRS += conf_edgebindings +endif + if USE_MODULE_CONF_MOUSE SUBDIRS += conf_mouse endif @@ -276,6 +280,7 @@ conf_dpms \ conf_shelves \ conf_keybindings \ conf_mousebindings \ +conf_edgebindings \ conf_mouse \ conf_window_display \ conf_window_focus \ diff --git a/src/modules/conf_desks/e_int_config_desks.c b/src/modules/conf_desks/e_int_config_desks.c index 03958eeba..2f83122a9 100644 --- a/src/modules/conf_desks/e_int_config_desks.c +++ b/src/modules/conf_desks/e_int_config_desks.c @@ -18,13 +18,10 @@ struct _E_Config_Dialog_Data /*- BASIC -*/ int x; int y; - int edge_flip_basic; int flip_animate; /*- ADVANCED -*/ - int edge_flip_moving; int edge_flip_dragging; - double edge_flip_timeout; int flip_wrap; int flip_mode; int flip_interp; @@ -65,11 +62,8 @@ _fill_data(E_Config_Dialog_Data *cfdata) { cfdata->x = e_config->zone_desks_x_count; cfdata->y = e_config->zone_desks_y_count; - cfdata->edge_flip_basic = e_config->edge_flip_moving || e_config->edge_flip_dragging; cfdata->flip_animate = e_config->desk_flip_animate_mode > 0; - cfdata->edge_flip_moving = e_config->edge_flip_moving; cfdata->edge_flip_dragging = e_config->edge_flip_dragging; - cfdata->edge_flip_timeout = e_config->edge_flip_timeout; cfdata->flip_wrap = e_config->desk_flip_wrap; cfdata->flip_mode = e_config->desk_flip_animate_mode; cfdata->flip_interp = e_config->desk_flip_animate_interpolation; @@ -132,9 +126,6 @@ _basic_apply_data(E_Config_Dialog *cdd, E_Config_Dialog_Data *cfdata) cfdata->flip_mode = 0; e_config->desk_flip_animate_mode = 0; } - e_config->edge_flip_dragging = cfdata->edge_flip_basic; - e_config->edge_flip_moving = cfdata->edge_flip_basic; - e_zone_update_flip_all(); e_config_save_queue(); return 1; /* Apply was OK */ @@ -167,12 +158,9 @@ _advanced_apply_data(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata) e_config->desk_flip_animate_interpolation = cfdata->flip_interp; e_config->desk_flip_animate_time = cfdata->flip_speed; - e_config->edge_flip_moving = cfdata->edge_flip_moving; e_config->edge_flip_dragging = cfdata->edge_flip_dragging; - e_config->edge_flip_timeout = cfdata->edge_flip_timeout; e_config->desk_flip_wrap = cfdata->flip_wrap; - e_zone_update_flip_all(); e_config_save_queue(); return 1; /* Apply was OK */ } @@ -206,8 +194,6 @@ _basic_create_widgets(E_Config_Dialog *cdd, Evas *evas, E_Config_Dialog_Data *cf e_widget_list_object_append(o, of, 1, 1, 0.5); of = e_widget_framelist_add(evas, _("Desktop Mouse Flip"), 0); - ob = e_widget_check_add(evas, _("Flip desktops when mouse at screen edge"), &(cfdata->edge_flip_basic)); - e_widget_framelist_object_append(of, ob); ob = e_widget_check_add(evas, _("Animated flip"), &(cfdata->flip_animate)); e_widget_framelist_object_append(of, ob); @@ -245,14 +231,8 @@ _advanced_create_widgets(E_Config_Dialog *cfd, Evas *evas, E_Config_Dialog_Data e_widget_table_object_append(ott, of, 0, 0, 1, 2, 1, 1, 1, 1); of = e_widget_framelist_add(evas, _("Desktop Mouse Flip"), 0); - ob = e_widget_check_add(evas, _("Flip when moving mouse to the screen edge"), &(cfdata->edge_flip_moving)); - e_widget_framelist_object_append(of, ob); ob = e_widget_check_add(evas, _("Flip when dragging objects to the screen edge"), &(cfdata->edge_flip_dragging)); e_widget_framelist_object_append(of, ob); - ob = e_widget_label_add(evas, _("Time the mouse is at the edge before flipping:")); - e_widget_framelist_object_append(of, ob); - ob = e_widget_slider_add(evas, 1, 0, _("%1.1f sec"), 0.0, 2.0, 0.05, 0, &(cfdata->edge_flip_timeout), NULL, 200); - e_widget_framelist_object_append(of, ob); ob = e_widget_check_add(evas, _("Wrap desktops around when flipping"), &(cfdata->flip_wrap)); e_widget_framelist_object_append(of, ob); e_widget_table_object_append(ott, of, 1, 0, 1, 1, 1, 0, 1, 0); diff --git a/src/modules/conf_edgebindings/.cvsignore b/src/modules/conf_edgebindings/.cvsignore new file mode 100644 index 000000000..06d064a84 --- /dev/null +++ b/src/modules/conf_edgebindings/.cvsignore @@ -0,0 +1,7 @@ +.deps +.libs +Makefile +Makefile.in +*.lo +module.la +module.desktop diff --git a/src/modules/conf_edgebindings/Makefile.am b/src/modules/conf_edgebindings/Makefile.am new file mode 100644 index 000000000..36e5b9967 --- /dev/null +++ b/src/modules/conf_edgebindings/Makefile.am @@ -0,0 +1,31 @@ +MAINTAINERCLEANFILES = Makefile.in +MODULE = conf_edgebindings + +# data files for the module +filesdir = $(libdir)/enlightenment/modules/$(MODULE) +files_DATA = \ +e-module-$(MODULE).edj module.desktop + +EXTRA_DIST = $(files_DATA) + +# the module .so file +INCLUDES = -I. \ + -I$(top_srcdir) \ + -I$(top_srcdir)/src/modules/$(MODULE) \ + -I$(top_srcdir)/src/bin \ + -I$(top_srcdir)/src/lib \ + -I$(top_srcdir)/src/modules \ + @e_cflags@ +pkgdir = $(libdir)/enlightenment/modules/$(MODULE)/$(MODULE_ARCH) +pkg_LTLIBRARIES = module.la +module_la_SOURCES = e_mod_main.c \ + e_mod_main.h \ + e_int_config_edgebindings.c \ + e_int_config_edgebindings.h + +module_la_LIBADD = @e_libs@ @dlopen_libs@ +module_la_LDFLAGS = -module -avoid-version +module_la_DEPENDENCIES = $(top_builddir)/config.h + +uninstall: + rm -rf $(DESTDIR)$(libdir)/enlightenment/modules/$(MODULE) diff --git a/src/modules/conf_edgebindings/e-module-conf_edgebindings.edj b/src/modules/conf_edgebindings/e-module-conf_edgebindings.edj new file mode 100644 index 0000000000000000000000000000000000000000..5c00d31c3bcf5fa5eaa1ba8dc13c287530ee9cc3 GIT binary patch literal 8732 zcmZ{o2|Sc*)WFA;Hp?gp*IJ4eq3j9m)Gg{(mlmeM7^7jBu?+^5V02P{L-w#9#=ZP!cauC{gf1hVWm&mcf8WsT}_FgA3x10bLXZ_^-(Xc@D-5 za3aX%^BnaX*q)#-g`vlW2c!@%e~?H_SuV2$778}vXT)VWz#_pGf#Jzzb-?1lUWVAn z1NtpscR?=7_zt`^sC8rXBNku~q*veUrIz!v12iv#u=m@EtnuAdvQHn5TP zZQ`=^z*SFj=9C>t*G2Iheq!b%_)LTM5Gp2GkLJz(LG#-)C^LaL%{w3$)798gD7(5$XVjK zbD{o3EqQ(*k@^Y*W{ofy&RjneV0K`0_RD2@z>wPDXEb0C^B49C7}Uov`6~r>aRGy~ z5?xpaurE=h4#bgfA`j?r2Sw9(3?#D7^T3cZ=dYn_z}_JYMlg4-ATYS=ztlMN647=Z z1BpD!!1_Rn!|>VSVOZ4e&GH~)8s!9>m+`R+09Tstr~fX#omY=I&7lEXm4 zI#6qX?Encif;z;VdluL}gdsNafPMy;`2uzX7;={Uety8tE@06A#0bF9+*qEV%K$^p zh`)BHfd%pTA@zO~7}VwbT<(0hKVts?6NYhy%aVaTK^S5q59lMn@<4LF%Vj5lRW4w0 zz`ib+i{u4zJs%IGF^omPkTc@{Mh!3~F#dhu;FECfoZ1criR88j7}A6I?`01#v;?$av$FS+X9k5_fS)4-36>07~G{_{04xTEnqK!L9T!C`vL6K z0@ex)YU>xjPGH0Z49*CR^k-hJnS%ZhSO7@m+z8zLZUlCT%R)d(z^DLr6JdxC@_-KY zh`zIcy#@Ao0XqQf`2q&{MZW^Z-?KLWqc31^htQ3{`0EAoj)pv-R&m#XtX%*Y@^2$2 z9!S^&>N{Lh11xbLB3+zvj zE0Av@59lAjMCwm+o^Y5YFeJYcd<^!r;xaJ)^*si53mAV-R0ej3$3W`CfU{ij2qfp< zGLViirhq}deu?J^tY85f2ljda^8tqBnYUkQ(8<7>Kyvy9NaW661BT?Dvp0}BFg604 z1xg@d0ONblw`3($>$A^noSzrej(3BN;r`XT4A9M~$5yxJAFBN2%>J9h%f zg`%N}A~<95I7GqOJK-=Ck_XuiN0~Pq2t?exW@m@8BRRW*O-6a*$P}21a=>BTJ;*o= z*eHS>$wl4O1&_kHxRa@<`6w87sw$XB5F6wGa8s0pz2Yy#z9>gG8oc_Hm{m zlL_$g|I1~5ofvz<{Kw{fj$p~|m_0wY^S=Ue0{y>Euq9q1IB_}N`;k3!a)NTfI^$5B zJ>VQ1V4)~yk_QEc!Fj?uDJU||6%xR+2zVC~Y zDFG%EC>VkZg#g5kNN~ltlQ57HBr28&zAjjIh(U63$2j946?PPqJmx6*L|BlzH&;?o4g_zUy}B1yI-;BjE?^;l zLC1O{I{bBnpg32U#t~Eqx0Mr&;tIQ02X7RXt70Mayb2q0fC3=nh+Ea+57wRFiNkm= zu&MJl$-#kwbLYL~THJR8dmaak!?rDm$7gfj^T*q!&L3}^Ixikaqt2fwK$Iy+W z6L|`mr?~SJTb|-V!oUq6Lehvtb&4~IyEJ zn>yD=i|3=oi=xHz(E=ZLoVU9=h2R4>0nr=?$oc(Lsq-q729F{tk7B)lQc$^+SDKs{ z^9J_~9NB#1m=6jj;`0l`!KI-PC@4G`Yfpe{h@9w89l1u3$o~KszZB(9&tG3q7tHus zR=@iHtS^4dSCrnrgyDPfYy6*uy3qe;{QtVvUL3`aOmIb7HLnw3?17=|$yhuVZam!8 zpDJ=`A>Ti3JCX-95P02~M|(6H?Pn>FA05QKDU>U?K&hW11tg6n@R z83oNAI;1O^md^9mFO29ES4d!rJCJ12bVH83~ce$dF) zV)a+GeCa}4DJrBE-~7`!;B58gxwwwgne8Rp{SQ6c(NWPZCze~U``z{U-5nC;rPgNU zW-E7RUHEh@Pj8yb0p)G3F>RqbsBV{S44lFUS4+Uz)h?5t~pp*c zk5Uq_)`f|>=agL5xg8GiC~{c&+1BbQDRoA--LqY+-Tc$%eNBg(_B8#$e1HGWF`E96 z|BotE4(+OW=lx0X@91MYc1|hZb&v9{%2;g}Q5lob_^otZ>8eugQjyg$`(pOQRK^R1 ztF2XAqjp)yx@~jK$cZ4GAdeu?pu<61h#k5`(YLTgEHUdl*7+H}+V^NqEP*TiS8eVn zzcaZvBk|58Rq9)K`YVH;BF(f)|0@+F$L!Pj%3jii_bbrlkK>I_93r-PCjiX{18C~{GjFx5I-Mpf&Mr`_z5qW*Y8C{vbU*~6<3L9 z63ez#WjxhV)7n`dl5^zi?uSRD?HSAe%CuU3!p>2G$V#40J$!1^e~QXOG1=2I=H4W++#1J1{rd+jM!q%qI&{Xf3R&c?VwSOqar8^ob^q?N z+`c>^_#f#@JoX%`tTb4-Y-Vb7&#`02Vhkt_ zG21v!WO=C@nN=iy5pU!pZDJ?CP z^?9w+wh?3#wrg>5RDUQk~!YYZXk-D_k1T6E2Z*NjsfOSMY8X=$L7}h;C@eId_<>Ss%E?rm$|c zn$_9S&JSAkfo~Td(mi|qypFbZ4DqGYxpRjR3*a`*w=bv1dhCpRC!Wz04DVATTuGm>=S>>%~szC)^Fk*gYl&XpdXDtbGo z+)QfD|Dx;Mu&Sstzx~2nsY7lrS1lQ6HNloHlGSrLv!CrY*KM7tbba5^qt`|QEUQ`h z|85Xp(s+YyW5kYil{g)$>KQ58DmZ!3HhH7&USm{%-<{0NkE@mtN4~xFs$*wh%ZNj* zuVflS18_LpSn=Jv>*#D*ABU8y(sQoIt1eHr3%?NgLG(yFFPR9l8f2UiC4$to@JwnG-JKq)Ofbujn_%i=rfDUXV?F6OWH?uqJU8y ztFt+U<=s~~(adbK=<97MDsYoOvgB{AVf3tOgvs_06FiDEBOk{s3~jbZGB(QcZC7wp zY~IW?&98n=bBplb?{ZgcQfDvl(N>0o2$qkfE6T7N5_OFhMnyGU7zG`9w6vNY#ARg65EO%s4MzG>#fVQ zTV?w9ma&in5dk&ZYiQky#glsZD!Eil*LG&?>Nu|=-$Ji}A6`%Pgo=Hf&C{E8yFPVn z^eD4TvG|*IZBDIgO=db}us35WuVt9prCxmW(7yCX5-UF>`2;jRcRo5(`BXqxtShg$ z!^o(xnUOs%<`ro1@ei%d2eamCpJGUnJ4Vc+*l%%xei2s$YxQ0vNDoe!$E$vQQDQer zPtei|N-*^LeKc#`D5H>?-QQfGccJ>cz98|U0SX^*#fIjvvt`IX%ztYHG!U61^4E^f zDUPLe-+R&JWa!>~WN|23@wu{Tgfu?jgKy=>6jQCI*#Y$G2zf)#C8uJ$LN8n}59%-<|cj2Z9LzrVE874ZH({RowF~`d-$I%HZ|d-b&uGx zXN+2>v(^ju_l$P+e@Y!3o$5YD2`Me5_dGX>Y-l8v*xfG~@ot~Av>a#WIajOue!pqi z|Dr3g+JJq%{hzULf<)iLY<&L}J^wee0UQ1Ph*2FAkJ*9duIlq#=nj3 z`xdt)RD}J45}TgFinj5oe@<#7TTIs0Udj5H;&lAGgd_5^mM&9T4k_ z``bD|qD5+AnO5-fHU4KM_5_92#Ic8QJ^ro*`&t$)`~pIYAM>Jrtws8 z++L;fD*lb~x1|o%V|S`B-LHCNZoksJJXHUO-`q}8`)mv|x#rxMa+bivA+~t2GI8}{ z;o*zY=L6JM(YH7frW|*T%5_yUIz>{~SLANm%!=y^oK|f>m)`cdVI*9j;-v9o@3&ow z?O8(!vXl)BJtaY(V?Nr0We=;{28s^&`x|e!XS_-84?MED9NoSvO!JJRq}XzdWa27% z%i@9twxmU`LiIAz^16;KV}m-2XaYu|qf8%xxvG@bNcooxd}P(SEaqW)l8unTgF#PO z|I^hwRKg{*&?AB@)AsNB*h`xIy7zkHg|&Ye_Xbf)tApaE(r8 zi4}pU##yl9;Vs*6(%|AGTFyF6*=nIXZr!nyiA8w3!3$eDK6f|2 zs2r8o9b~C=UVC$uRZ)EIYTl%VQL0g=-DsWuPR6&~KAHqI(aIwIeP;xnR{f4HN+nxZ zrz|O5ys|QBF8ueT_{e6v4%dk~k6hXfRza-+L}aC3(Hh_8Hs*_FObokjgQR9$yrlbK2j^E*2gGeh{@>> zEtA{f{cl!ViBw4WSZv{M`U&IF3Ayvf!U6w7uv^!(=Lzk((s`X+}vI`!S! zgDPH)S1S0bUBEDzsuqdbu0LuXip1QHH}Pt@rE$8vaJcLGF578F$Z*bcYKM>S#BKad zM#%js^Fng%{R>HKy$zc-9n#aGi;;@PkFgqVtHxZMTYF&U{-HnHfz4o7 z=oa`*ZSn0a6_VAz!!YWI6!9FK-hF*?FiKrL!GNMtIF+K<*tTa$+CQc>Dc`ClhL!si z2LcmP(x+xvpF2yYZ~FRZvOC!Eo=X{qwCS+1+;OA8oX4jVN|-$c29;Bha$6U%^4H2q z4(PILzx(=U;2*EnUCwy&lr*W8ueyKyN4x!U_i5q?Hd z?Cf)^6UA*Tjaes7o_xFH$H}=n%#!!(qXt_vwrnZ>y48f8o3CN0T8z&)D81oXLrsyG7R+-_NG^wFk_^~NpxAXRq_1a6df?qc}elmcU^iMR^<$Ho% zeq*&v>=+qywH0_CsQ%8b`%&$S3yf%d#(Vhv+Q*s`dU^Domv_VAs|8Nwn&SIzZd196 zf&ae}}jj#Im-pZtP$YDlJPQ~u~ZU{w|`bFN_!gSO5& zUb;zWt@+ngz1{tNf0b*VA<;Z6wJT|dI$4KgT;d55r?T($%e5}WYi@n^Y~!OKrI~M^ z=uc#n_bPlwEmJjqZ1p)rr}6coD6EdzG8-VKzAA@ixymoJr;meUnln&fuIUK98&(9c0UY1t*L zpTmRSl}y$PnvL$P-?}qaw$vPr`gG=qo0QUrFni<8;@L{KD?>EVRd~}5ic-^!c7eM> ecZjk|AJ93~sJF(FN*_WU6g5_lqSno>?)@K2rU$wJ literal 0 HcmV?d00001 diff --git a/src/modules/conf_edgebindings/e_int_config_edgebindings.c b/src/modules/conf_edgebindings/e_int_config_edgebindings.c new file mode 100644 index 000000000..47a1586da --- /dev/null +++ b/src/modules/conf_edgebindings/e_int_config_edgebindings.c @@ -0,0 +1,1291 @@ +/* + * vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2 + */ +#include "e.h" + +#define TEXT_NONE_ACTION_EDGE _("") +#define TEXT_PRESS_EDGE_SEQUENCE _("Please select an edge,
" \ + "or click Close to abort.

" \ + "To change the delay of this action,
use the slider:" \ + ) + +#define TEXT_NO_PARAMS _("") + +static void *_create_data(E_Config_Dialog *cfd); +static void _free_data(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata); +static int _basic_apply_data(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata); +static Evas_Object *_basic_create_widgets(E_Config_Dialog *cfd, Evas *evas, + E_Config_Dialog_Data *cfdata); + +/********* private functions ***************/ +static void _fill_actions_list(E_Config_Dialog_Data *cfdata); + +/**************** Updates ***********/ +static void _update_edge_binding_list(E_Config_Dialog_Data *cfdata); +static void _update_action_list(E_Config_Dialog_Data *cfdata); +static void _update_action_params(E_Config_Dialog_Data *cfdata); +static void _update_buttons(E_Config_Dialog_Data *cfdata); + +/**************** Callbacks *********/ +static void _binding_change_cb(void *data); +static void _action_change_cb(void *data); +static void _delete_all_edge_binding_cb(void *data, void *data2); +static void _delete_edge_binding_cb(void *data, void *data2); +static void _restore_edge_binding_defaults_cb(void *data, void *data2); +static void _add_edge_binding_cb(void *data, void *data2); +static void _modify_edge_binding_cb(void *data, void *data2); + +/********* Helper *************************/ +static char *_edge_binding_text_get(E_Zone_Edge edge, float delay, int mod); +static void _auto_apply_changes(E_Config_Dialog_Data *cfdata); +static void _find_edge_binding_action(const char *action, const char *params, int *g, int *a, int *n); + +/********* Sorting ************************/ +static int _edge_binding_sort_cb(const void *d1, const void *d2); + +/**************** grab window *******/ +static void _edge_grab_wnd_show(E_Config_Dialog_Data *cfdata); +static void _edge_grab_wnd_cb_apply(void *data, E_Dialog *dia); +static void _edge_grab_wnd_cb_close(void *data, E_Dialog *dia); +static void _edge_grab_wnd_slider_changed_cb(void *data, Evas_Object *obj); +static void _edge_grab_wnd_selected_edge_cb(void *data, Evas *e, Evas_Object *obj, void *event_info); +static void _edge_grab_wnd_selection_apply(E_Config_Dialog_Data *cfdata); + +struct _E_Config_Dialog_Data +{ + Evas *evas; + struct + { + Eina_List *edge; + } binding; + struct + { + char *binding, *action, *params; + const char *cur; + double delay; + int cur_act, add; + E_Zone_Edge edge; + int modifiers; + + E_Dialog *dia; + } locals; + struct + { + Evas_Object *o_add, *o_mod, *o_del, *o_del_all; + Evas_Object *o_binding_list, *o_action_list; + Evas_Object *o_params, *o_selector, *o_slider; + } gui; + + const char *params; + E_Config_Dialog *cfd; +}; + +EAPI E_Config_Dialog * +e_int_config_edgebindings(E_Container *con, const char *params) +{ + E_Config_Dialog *cfd; + E_Config_Dialog_View *v; + + if (e_config_dialog_find("E", "_config_edgebindings_dialog")) return NULL; + v = E_NEW(E_Config_Dialog_View, 1); + + v->create_cfdata = _create_data; + v->free_cfdata = _free_data; + v->basic.apply_cfdata = _basic_apply_data; + v->basic.create_widgets = _basic_create_widgets; + v->override_auto_apply = 1; + + cfd = e_config_dialog_new(con, _("Edge Binding Settings"), "E", + "_config_edgebindings_dialog", + "enlightenment/edges", 0, v, NULL); + if ((params) && (params[0])) + { + cfd->cfdata->params = eina_stringshare_add(params); + _add_edge_binding_cb(cfd->cfdata, NULL); + } + + return cfd; +} + +static void +_fill_data(E_Config_Dialog_Data *cfdata) +{ + Eina_List *l = NULL; + E_Config_Binding_Edge *bi, *bi2; + + cfdata->locals.action = strdup(""); + cfdata->locals.params = strdup(""); + cfdata->locals.binding = strdup(""); + cfdata->locals.cur = NULL; + cfdata->locals.dia = NULL; + cfdata->locals.delay = 0.3; + cfdata->binding.edge = NULL; + + for (l = e_config->edge_bindings; l; l = l->next) + { + bi = l->data; + if (!bi) continue; + + bi2 = E_NEW(E_Config_Binding_Edge, 1); + bi2->context = bi->context; + bi2->edge = bi->edge; + bi2->modifiers = bi->modifiers; + bi2->any_mod = bi->any_mod; + bi2->delay = bi->delay; + bi2->action = bi->action == NULL ? NULL : eina_stringshare_add(bi->action); + bi2->params = bi->params == NULL ? NULL : eina_stringshare_add(bi->params); + + cfdata->binding.edge = eina_list_append(cfdata->binding.edge, bi2); + } +} + +static void * +_create_data(E_Config_Dialog *cfd) +{ + E_Config_Dialog_Data *cfdata; + + cfdata = E_NEW(E_Config_Dialog_Data, 1); + cfdata->cfd = cfd; + _fill_data(cfdata); + + return cfdata; +} + +static void +_free_data(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata) +{ + E_Config_Binding_Edge *bi; + + while (cfdata->binding.edge) + { + bi = cfdata->binding.edge->data; + if (bi->action) eina_stringshare_del(bi->action); + if (bi->params) eina_stringshare_del(bi->params); + E_FREE(bi); + cfdata->binding.edge = eina_list_remove_list(cfdata->binding.edge, cfdata->binding.edge); + } + + if (cfdata->locals.cur) eina_stringshare_del(cfdata->locals.cur); + if (cfdata->locals.binding) free(cfdata->locals.binding); + if (cfdata->locals.action) free(cfdata->locals.action); + if (cfdata->locals.params) free(cfdata->locals.params); + if (cfdata->params) eina_stringshare_del(cfdata->params); + E_FREE(cfdata); +} + +static int +_basic_apply_data(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata) +{ + Eina_List *l = NULL; + E_Config_Binding_Edge *bi, *bi2; + + _auto_apply_changes(cfdata); + + while (e_config->edge_bindings) + { + bi = e_config->edge_bindings->data; + e_bindings_edge_del(bi->context, bi->edge, bi->modifiers, bi->any_mod, + bi->action, bi->params, bi->delay); + e_config->edge_bindings = + eina_list_remove_list(e_config->edge_bindings, e_config->edge_bindings); + + if (bi->action) eina_stringshare_del(bi->action); + if (bi->params) eina_stringshare_del(bi->params); + E_FREE(bi); + } + + for (l = cfdata->binding.edge; l; l = l->next) + { + bi2 = l->data; + + if (bi2->edge < 0) continue; + + bi = E_NEW(E_Config_Binding_Edge, 1); + bi->context = bi2->context; + bi->edge = bi2->edge; + bi->modifiers = bi2->modifiers; + bi->any_mod = bi2->any_mod; + bi->delay = bi2->delay; + bi->action = + ((!bi2->action) || (!bi2->action[0])) ? NULL : eina_stringshare_add(bi2->action); + bi->params = + ((!bi2->params) || (!bi2->params[0])) ? NULL : eina_stringshare_add(bi2->params); + + e_config->edge_bindings = eina_list_append(e_config->edge_bindings, bi); + e_bindings_edge_add(bi->context, bi->edge, bi->modifiers, bi->any_mod, + bi->action, bi->params, bi->delay); + } + e_config_save_queue(); + + return 1; +} + +static Evas_Object * +_basic_create_widgets(E_Config_Dialog *cfd, Evas *evas, E_Config_Dialog_Data *cfdata) +{ + Evas_Object *o, *ot, *of, *ob; + + cfdata->evas = evas; + o = e_widget_list_add(evas, 0, 1); + + of = e_widget_frametable_add(evas, _("Edge Bindings"), 0); + ob = e_widget_ilist_add(evas, 32, 32, &(cfdata->locals.binding)); + cfdata->gui.o_binding_list = ob; + e_widget_min_size_set(ob, 200, 200); + e_widget_frametable_object_append(of, ob, 0, 0, 2, 1, 1, 1, 1, 1); + ob = e_widget_button_add(evas, _("Add Edge"), NULL, _add_edge_binding_cb, cfdata, NULL); + cfdata->gui.o_add = ob; + e_widget_frametable_object_append(of, ob, 0, 1, 1, 1, 1, 0, 1, 0); + ob = e_widget_button_add(evas, _("Delete Edge"), NULL, _delete_edge_binding_cb, cfdata, NULL); + cfdata->gui.o_del = ob; + e_widget_disabled_set(ob, 1); + e_widget_frametable_object_append(of, ob, 1, 1, 1, 1, 1, 0, 1, 0); + ob = e_widget_button_add(evas, _("Modify Edge"), NULL, _modify_edge_binding_cb, cfdata, NULL); + cfdata->gui.o_mod = ob; + e_widget_disabled_set(ob, 1); + e_widget_frametable_object_append(of, ob, 0, 2, 1, 1, 1, 0, 1, 0); + ob = e_widget_button_add(evas, _("Delete All"), NULL, _delete_all_edge_binding_cb, cfdata, NULL); + cfdata->gui.o_del_all = ob; + e_widget_disabled_set(ob, 1); + e_widget_frametable_object_append(of, ob, 1, 2, 1, 1, 1, 0, 1, 0); + ob = e_widget_button_add(evas, _("Restore Default Bindings"), "enlightenment/e", _restore_edge_binding_defaults_cb, cfdata, NULL); + e_widget_frametable_object_append(of, ob, 0, 3, 2, 1, 1, 0, 1, 0); + e_widget_list_object_append(o, of, 1, 1, 0.5); + + ot = e_widget_table_add(evas, 0); + of = e_widget_framelist_add(evas, _("Action"), 0); + ob = e_widget_ilist_add(evas, 24, 24, &(cfdata->locals.action)); + cfdata->gui.o_action_list = ob; + e_widget_min_size_set(ob, 200, 280); + e_widget_framelist_object_append(of, ob); + e_widget_table_object_append(ot, of, 0, 0, 1, 1, 1, 1, 1, 1); + + of = e_widget_framelist_add(evas, _("Action Params"), 0); + ob = e_widget_entry_add(evas, &(cfdata->locals.params), NULL, NULL, NULL); + cfdata->gui.o_params = ob; + e_widget_disabled_set(ob, 1); + e_widget_framelist_object_append(of, ob); + e_widget_table_object_append(ot, of, 0, 1, 1, 1, 1, 1, 1, 0); + e_widget_list_object_append(o, ot, 1, 1, 0.5); + + _update_edge_binding_list(cfdata); + _fill_actions_list(cfdata); + + e_dialog_resizable_set(cfd->dia, 1); + return o; +} + +static void +_fill_actions_list(E_Config_Dialog_Data *cfdata) +{ + char buf[1024]; + Eina_List *l, *l2; + E_Action_Group *actg; + E_Action_Description *actd; + int g, a; + + evas_event_freeze(evas_object_evas_get(cfdata->gui.o_action_list)); + edje_freeze(); + e_widget_ilist_freeze(cfdata->gui.o_action_list); + + e_widget_ilist_clear(cfdata->gui.o_action_list); + for (l = e_action_groups_get(), g = 0; l; l = l->next, g++) + { + actg = l->data; + + if (!actg->acts) continue; + + e_widget_ilist_header_append(cfdata->gui.o_action_list, NULL, actg->act_grp); + + for (l2 = actg->acts, a = 0; l2; l2 = l2->next, a++) + { + actd = l2->data; + + snprintf(buf, sizeof(buf), "%d %d", g, a); + e_widget_ilist_append(cfdata->gui.o_action_list, NULL, actd->act_name, + _action_change_cb, cfdata, buf); + } + } + e_widget_ilist_go(cfdata->gui.o_action_list); + e_widget_ilist_thaw(cfdata->gui.o_action_list); + edje_thaw(); + evas_event_thaw(evas_object_evas_get(cfdata->gui.o_action_list)); +} + +/**************** Callbacks *********/ + +static void +_add_edge_binding_cb(void *data, void *data2) +{ + E_Config_Dialog_Data *cfdata; + + cfdata = data; + + _auto_apply_changes(cfdata); + + cfdata->locals.add = 1; + _edge_grab_wnd_show(cfdata); +} + +static void +_modify_edge_binding_cb(void *data, void *data2) +{ + E_Config_Dialog_Data *cfdata; + + cfdata = data; + + _auto_apply_changes(cfdata); + + cfdata->locals.add = 0; + if (cfdata->locals.cur && cfdata->locals.cur[0]) + { + E_Config_Binding_Edge *bi; + int n; + + if (sscanf(cfdata->locals.cur, "e%d", &n) != 1) + return; + + bi = eina_list_nth(cfdata->binding.edge, n); + cfdata->locals.edge = bi->edge; + cfdata->locals.delay = ((double) bi->delay); + cfdata->locals.modifiers = bi->modifiers; + } + else return; + _edge_grab_wnd_show(cfdata); +} + +static void +_binding_change_cb(void *data) +{ + E_Config_Dialog_Data *cfdata; + + cfdata = data; + + _auto_apply_changes(cfdata); + if (cfdata->locals.cur) eina_stringshare_del(cfdata->locals.cur); + cfdata->locals.cur = NULL; + + if ((!cfdata->locals.binding) || (!cfdata->locals.binding[0])) return; + + cfdata->locals.cur = eina_stringshare_add(cfdata->locals.binding); + + _update_buttons(cfdata); + _update_action_list(cfdata); +} + +static void +_action_change_cb(void *data) +{ + E_Config_Dialog_Data *cfdata; + + cfdata = data; + _update_action_params(cfdata); +} + +static void +_delete_all_edge_binding_cb(void *data, void *data2) +{ + E_Config_Binding_Edge *bi; + E_Config_Dialog_Data *cfdata; + + cfdata = data; + + while (cfdata->binding.edge) + { + bi = cfdata->binding.edge->data; + if (bi->action) eina_stringshare_del(bi->action); + if (bi->params) eina_stringshare_del(bi->params); + E_FREE(bi); + + cfdata->binding.edge = eina_list_remove_list(cfdata->binding.edge, cfdata->binding.edge); + } + + if (cfdata->locals.cur) eina_stringshare_del(cfdata->locals.cur); + cfdata->locals.cur = NULL; + + e_widget_ilist_clear(cfdata->gui.o_binding_list); + e_widget_ilist_go(cfdata->gui.o_binding_list); + e_widget_ilist_unselect(cfdata->gui.o_action_list); + e_widget_entry_clear(cfdata->gui.o_params); + e_widget_disabled_set(cfdata->gui.o_params, 1); + + _update_buttons(cfdata); +} + +static void +_delete_edge_binding_cb(void *data, void *data2) +{ + Eina_List *l = NULL; + int sel, n; + E_Config_Dialog_Data *cfdata; + E_Config_Binding_Edge *bi; + + cfdata = data; + + sel = e_widget_ilist_selected_get(cfdata->gui.o_binding_list); + if (cfdata->locals.binding[0] == 'e') + { + if (sscanf(cfdata->locals.binding, "e%d", &n) != 1) + return; + + l = eina_list_nth_list(cfdata->binding.edge, n); + + if (l) + { + bi = l->data; + if (bi->action) eina_stringshare_del(bi->action); + if (bi->params) eina_stringshare_del(bi->params); + E_FREE(bi); + cfdata->binding.edge = eina_list_remove_list(cfdata->binding.edge, l); + } + } + + _update_edge_binding_list(cfdata); + + if (sel >= e_widget_ilist_count(cfdata->gui.o_binding_list)) + sel = e_widget_ilist_count(cfdata->gui.o_binding_list) - 1; + + if (cfdata->locals.cur) eina_stringshare_del(cfdata->locals.cur); + cfdata->locals.cur = NULL; + + e_widget_ilist_selected_set(cfdata->gui.o_binding_list, sel); + if (sel < 0) + { + e_widget_ilist_unselect(cfdata->gui.o_action_list); + e_widget_entry_clear(cfdata->gui.o_params); + e_widget_disabled_set(cfdata->gui.o_params, 1); + _update_buttons(cfdata); + } +} +static void +_restore_edge_binding_defaults_cb(void *data, void *data2) +{ + E_Config_Dialog_Data *cfdata; + E_Config_Binding_Edge *bi; + + cfdata = data; + + while (cfdata->binding.edge) + { + bi = cfdata->binding.edge->data; + if (bi->action) eina_stringshare_del(bi->action); + if (bi->params) eina_stringshare_del(bi->params); + E_FREE(bi); + cfdata->binding.edge = eina_list_remove_list(cfdata->binding.edge, cfdata->binding.edge); + } + +#define CFG_EDGEBIND_DFLT(_context, _edge, _modifiers, _anymod, _action, _params, _delay) \ + bi = E_NEW(E_Config_Binding_Edge, 1); \ + bi->context = _context; \ + bi->edge = _edge; \ + bi->modifiers = _modifiers; \ + bi->any_mod = _anymod; \ + bi->delay = _delay; \ + bi->action = _action == NULL ? NULL : eina_stringshare_add(_action); \ + bi->params = _params == NULL ? NULL : eina_stringshare_add(_params); \ + cfdata->binding.edge = eina_list_append(cfdata->binding.edge, bi) + + CFG_EDGEBIND_DFLT(E_BINDING_CONTEXT_ZONE, E_ZONE_EDGE_LEFT, + 0, 0, "desk_flip_in_direction", NULL, 0.3); + CFG_EDGEBIND_DFLT(E_BINDING_CONTEXT_ZONE, E_ZONE_EDGE_RIGHT, + 0, 0, "desk_flip_in_direction", NULL, 0.3); + CFG_EDGEBIND_DFLT(E_BINDING_CONTEXT_ZONE, E_ZONE_EDGE_TOP, + 0, 0, "desk_flip_in_direction", NULL, 0.3); + CFG_EDGEBIND_DFLT(E_BINDING_CONTEXT_ZONE, E_ZONE_EDGE_BOTTOM, + 0, 0, "desk_flip_in_direction", NULL, 0.3); + + if (cfdata->locals.cur) eina_stringshare_del(cfdata->locals.cur); + cfdata->locals.cur = NULL; + + _update_edge_binding_list(cfdata); + _update_buttons(cfdata); + + e_widget_ilist_unselect(cfdata->gui.o_action_list); + e_widget_entry_clear(cfdata->gui.o_params); + e_widget_disabled_set(cfdata->gui.o_params, 1); +} + +/**************** Updates ***********/ +static void +_update_action_list(E_Config_Dialog_Data *cfdata) +{ + E_Config_Binding_Edge *bi; + int j = -1, i, n; + const char *action, *params; + + if (!cfdata->locals.cur) return; + + if (cfdata->locals.cur[0] == 'e') + { + if (sscanf(cfdata->locals.cur, "e%d", &n) != 1) + return; + + bi = eina_list_nth(cfdata->binding.edge, n); + if (!bi) + { + e_widget_ilist_unselect(cfdata->gui.o_action_list); + e_widget_entry_clear(cfdata->gui.o_params); + e_widget_disabled_set(cfdata->gui.o_params, 1); + return; + } + action = bi->action; + params = bi->params; + } + else + return; + + _find_edge_binding_action(action, params, NULL, NULL, &j); + + if (j >= 0) + { + for (i = 0; i < e_widget_ilist_count(cfdata->gui.o_action_list); i++) + { + if (i > j) break; + if (e_widget_ilist_nth_is_header(cfdata->gui.o_action_list, i)) j++; + } + } + + if (j >= 0) + { + if (j == e_widget_ilist_selected_get(cfdata->gui.o_action_list)) + _update_action_params(cfdata); + else + e_widget_ilist_selected_set(cfdata->gui.o_action_list, j); + } + else + { + e_widget_ilist_unselect(cfdata->gui.o_action_list); + if (cfdata->locals.action) free(cfdata->locals.action); + cfdata->locals.action = strdup(""); + e_widget_entry_clear(cfdata->gui.o_params); + } + + /*if (cfdata->locals.cur[0] == 'e') + { + sscanf(cfdata->locals.cur, "e%d", &n); + bi = eina_list_nth(cfdata->binding.edge, n); + if (!bi) + { + e_widget_ilist_unselect(cfdata->gui.o_action_list); + e_widget_entry_clear(cfdata->gui.o_params); + e_widget_disabled_set(cfdata->gui.o_params, 1); + return; + } + + _find_edge_binding_action(bi, NULL, NULL, &j); + if (j >= 0) + { + for (i = 0; i < e_widget_ilist_count(cfdata->gui.o_action_list); i++) + { + if (i > j) break; + if (e_widget_ilist_nth_is_header(cfdata->gui.o_action_list, i)) j++; + } + } + + if (j >= 0) + { + if (j == e_widget_ilist_selected_get(cfdata->gui.o_action_list)) + _update_action_params(cfdata); + else + e_widget_ilist_selected_set(cfdata->gui.o_action_list, j); + } + else + { + e_widget_ilist_unselect(cfdata->gui.o_action_list); + if (cfdata->locals.action) free(cfdata->locals.action); + cfdata->locals.action = strdup(""); + e_widget_entry_clear(cfdata->gui.o_params); + } + }*/ +} + +static void +_update_action_params(E_Config_Dialog_Data *cfdata) +{ + int g, a, b; + E_Action_Group *actg; + E_Action_Description *actd; + E_Config_Binding_Edge *bi; + const char *action, *params; + +#define EDGE_EXAMPLE_PARAMS \ + if ((!actd->param_example) || (!actd->param_example[0])) \ + e_widget_entry_text_set(cfdata->gui.o_params, TEXT_NO_PARAMS); \ + else \ + e_widget_entry_text_set(cfdata->gui.o_params, actd->param_example) + + + if ((!cfdata->locals.action) || (!cfdata->locals.action[0])) + { + e_widget_disabled_set(cfdata->gui.o_params, 1); + e_widget_entry_clear(cfdata->gui.o_params); + return; + } + if (sscanf(cfdata->locals.action, "%d %d", &g, &a) != 2) + return; + + actg = eina_list_nth(e_action_groups_get(), g); + if (!actg) return; + actd = eina_list_nth(actg->acts, a); + if (!actd) return; + + if (actd->act_params) + { + e_widget_disabled_set(cfdata->gui.o_params, 1); + e_widget_entry_text_set(cfdata->gui.o_params, actd->act_params); + return; + } + + if ((!cfdata->locals.cur) || (!cfdata->locals.cur[0])) + { + e_widget_disabled_set(cfdata->gui.o_params, 1); + EDGE_EXAMPLE_PARAMS; + return; + } + + if (!actd->editable) + e_widget_disabled_set(cfdata->gui.o_params, 1); + else + e_widget_disabled_set(cfdata->gui.o_params, 0); + + if (cfdata->locals.cur[0] == 'e') + { + if (sscanf(cfdata->locals.cur, "e%d", &b) != 1) + { + e_widget_disabled_set(cfdata->gui.o_params, 1); + EDGE_EXAMPLE_PARAMS; + return; + } + + bi = eina_list_nth(cfdata->binding.edge, b); + if (!bi) + { + e_widget_disabled_set(cfdata->gui.o_params, 1); + EDGE_EXAMPLE_PARAMS; + return; + } + action = bi->action; + params = bi->params; + } + else + { + e_widget_disabled_set(cfdata->gui.o_params, 1); + EDGE_EXAMPLE_PARAMS; + return; + } + + if (action) + { + if (!strcmp(action, actd->act_cmd)) + { + if ((!params) || (!params[0])) + EDGE_EXAMPLE_PARAMS; + else + e_widget_entry_text_set(cfdata->gui.o_params, params); + } + else + EDGE_EXAMPLE_PARAMS; + } + else + EDGE_EXAMPLE_PARAMS; +} + +static void +_update_edge_binding_list(E_Config_Dialog_Data *cfdata) +{ + int i; + char *b, b2[64]; + Eina_List *l; + E_Config_Binding_Edge *bi; + + evas_event_freeze(evas_object_evas_get(cfdata->gui.o_binding_list)); + edje_freeze(); + e_widget_ilist_freeze(cfdata->gui.o_binding_list); + + e_widget_ilist_clear(cfdata->gui.o_binding_list); + e_widget_ilist_go(cfdata->gui.o_binding_list); + + if (cfdata->binding.edge) + { + cfdata->binding.edge = eina_list_sort(cfdata->binding.edge, + eina_list_count(cfdata->binding.edge), _edge_binding_sort_cb); + } + + for (l = cfdata->binding.edge, i = 0; l; l = l->next, i++) + { + Evas_Object *ic; + + bi = l->data; + + b = _edge_binding_text_get(bi->edge, bi->delay, bi->modifiers); + if (!b) continue; + + ic = edje_object_add(cfdata->evas); + e_util_edje_icon_set(ic, "enlightenment/edges"); + + snprintf(b2, sizeof(b2), "e%d", i); + e_widget_ilist_append(cfdata->gui.o_binding_list, ic, b, + _binding_change_cb, cfdata, b2); + free(b); + } + e_widget_ilist_go(cfdata->gui.o_binding_list); + + e_widget_ilist_thaw(cfdata->gui.o_binding_list); + edje_thaw(); + evas_event_thaw(evas_object_evas_get(cfdata->gui.o_binding_list)); + + if (eina_list_count(cfdata->binding.edge)) + e_widget_disabled_set(cfdata->gui.o_del_all, 0); + else + e_widget_disabled_set(cfdata->gui.o_del_all, 1); +} + +static void +_update_buttons(E_Config_Dialog_Data *cfdata) +{ + if (e_widget_ilist_count(cfdata->gui.o_binding_list)) + e_widget_disabled_set(cfdata->gui.o_del_all, 0); + else + e_widget_disabled_set(cfdata->gui.o_del_all, 1); + + if (!cfdata->locals.cur) + { + e_widget_disabled_set(cfdata->gui.o_mod, 1); + e_widget_disabled_set(cfdata->gui.o_del, 1); + return; + } + e_widget_disabled_set(cfdata->gui.o_mod, 0); + e_widget_disabled_set(cfdata->gui.o_del, 0); +} + +/*************** Sorting *****************************/ +static int +_edge_binding_sort_cb(const void *d1, const void *d2) +{ + int i, j; + const E_Config_Binding_Edge *bi, *bi2; + + bi = d1; + bi2 = d2; + + i = 0; j = 0; + if (bi->modifiers & E_BINDING_MODIFIER_CTRL) i++; + if (bi->modifiers & E_BINDING_MODIFIER_ALT) i++; + if (bi->modifiers & E_BINDING_MODIFIER_SHIFT) i++; + if (bi->modifiers & E_BINDING_MODIFIER_WIN) i++; + + if (bi2->modifiers & E_BINDING_MODIFIER_CTRL) j++; + if (bi2->modifiers & E_BINDING_MODIFIER_ALT) j++; + if (bi2->modifiers & E_BINDING_MODIFIER_SHIFT) j++; + if (bi2->modifiers & E_BINDING_MODIFIER_WIN) j++; + + if (i < j) return -1; + else if (i > j) return 1; + + if (bi->modifiers < bi2->modifiers) return -1; + else if (bi->modifiers > bi2->modifiers) return 1; + + if (bi->edge < bi2->edge) return -1; + else if (bi->edge > bi2->edge) return 1; + + return 0; +} + +/**************** grab window *******/ +static void +_edge_grab_wnd_show(E_Config_Dialog_Data *cfdata) +{ + Evas_Object *o, *obg, *os; + E_Manager *man; + Evas *evas; + Evas_Coord minw, minh; + const char *bgfile; + int tw, th; + + if (cfdata->locals.dia != 0) return; + + man = e_manager_current_get(); + + cfdata->locals.dia = e_dialog_normal_win_new(e_container_current_get(man), + "E", "_edgebind_getedge_dialog"); + if (!cfdata->locals.dia) return; + e_dialog_title_set(cfdata->locals.dia, _("Edge Binding Sequence")); + e_dialog_icon_set(cfdata->locals.dia, "enlightenment/edges", 48); + e_dialog_button_add(cfdata->locals.dia, _("Apply"), NULL, _edge_grab_wnd_cb_apply, cfdata); + e_dialog_button_add(cfdata->locals.dia, _("Close"), NULL, _edge_grab_wnd_cb_close, cfdata); + e_win_centered_set(cfdata->locals.dia->win, 1); + + evas = e_win_evas_get(cfdata->locals.dia->win); + + cfdata->gui.o_selector = o = edje_object_add(evas); + e_theme_edje_object_set(o, "base/theme/modules/conf_edgebindings", + "e/modules/conf_edgebindings/selection"); + + cfdata->gui.o_slider = os = e_widget_slider_add(evas, 1, 0, _("%.2f seconds"), 0.0, 2.0, 0.05, 0, &(cfdata->locals.delay), NULL, 200); + edje_object_part_swallow(o, "e.swallow.slider", os); + e_widget_on_change_hook_set(os, _edge_grab_wnd_slider_changed_cb, cfdata); + evas_object_show(os); + + edje_object_part_text_set(o, "e.text.description", TEXT_PRESS_EDGE_SEQUENCE); + + edje_object_size_min_get(o, &minw, &minh); + if (!minw || !minh) + edje_object_size_min_calc(o, &minw, &minh); + + e_dialog_content_set(cfdata->locals.dia, o, minw, minh); + + bgfile = e_bg_file_get(0, 0, 0, 0); + obg = e_thumb_icon_add(evas); + e_icon_fill_inside_set(obg, 0); + e_thumb_icon_file_set(obg, bgfile, "e/desktop/background"); + edje_object_part_geometry_get(o, "e.swallow.background", NULL, NULL, &tw, &th); + e_thumb_icon_size_set(obg, tw, th); + edje_object_part_swallow(o, "e.swallow.background", obg); + e_thumb_icon_begin(obg); + evas_object_show(obg); + + evas_object_event_callback_add(o, EVAS_CALLBACK_MOUSE_DOWN, + _edge_grab_wnd_selected_edge_cb, cfdata); + + e_dialog_show(cfdata->locals.dia); + ecore_x_icccm_transient_for_set(cfdata->locals.dia->win->evas_win, cfdata->cfd->dia->win->evas_win); +} + +static void +_edge_grab_wnd_hide(E_Config_Dialog_Data *cfdata) +{ + e_object_del(E_OBJECT(cfdata->locals.dia)); + cfdata->locals.dia = NULL; +} + +static void +_edge_grab_wnd_cb_apply(void *data, E_Dialog *dia) +{ + E_Config_Dialog_Data *cfdata; + + cfdata = data; + _edge_grab_wnd_selection_apply(cfdata); + _edge_grab_wnd_hide(cfdata); +} + +static void +_edge_grab_wnd_cb_close(void *data, E_Dialog *dia) +{ + E_Config_Dialog_Data *cfdata; + + cfdata = data; + _edge_grab_wnd_hide(cfdata); +} + +static void +_edge_grab_wnd_slider_changed_cb(void *data, Evas_Object *obj) +{ + E_Config_Dialog_Data *cfdata; + cfdata = data; + char *label = NULL; + + if (!cfdata->locals.edge) return; + label = _edge_binding_text_get(cfdata->locals.edge, ((float) cfdata->locals.delay), cfdata->locals.modifiers); + edje_object_part_text_set(cfdata->gui.o_selector, "e.text.selection", label); + if (label) E_FREE(label); +} + +static void +_edge_grab_wnd_selected_edge_cb(void *data, Evas *e, Evas_Object *obj, void *event_info) +{ + Evas_Event_Mouse_Down *event; + E_Config_Dialog_Data *cfdata; + E_Zone_Edge edge; + Evas_Coord xx, yy, x, y, w, h; + char *label; + + if (!(cfdata = data)) return; + if (!(event = event_info)) return; + if (event->button != 1) return; + + evas_object_geometry_get(cfdata->gui.o_selector, &xx, &yy, NULL, NULL); + edje_object_part_geometry_get(cfdata->gui.o_selector, "e.edge.top_left", &x, &y, &w, &h); + if (E_INSIDE(event->canvas.x, event->canvas.y, x + xx, y + yy, w, h)) + { + edge = E_ZONE_EDGE_TOP_LEFT; + goto stop; + } + edje_object_part_geometry_get(cfdata->gui.o_selector, "e.edge.top", &x, &y, &w, &h); + if (E_INSIDE(event->canvas.x, event->canvas.y, x + xx, y + yy, w, h)) + { + edge = E_ZONE_EDGE_TOP; + goto stop; + } + edje_object_part_geometry_get(cfdata->gui.o_selector, "e.edge.top_right", &x, &y, &w, &h); + if (E_INSIDE(event->canvas.x, event->canvas.y, x + xx, y + yy, w, h)) + { + edge = E_ZONE_EDGE_TOP_RIGHT; + goto stop; + } + edje_object_part_geometry_get(cfdata->gui.o_selector, "e.edge.right", &x, &y, &w, &h); + if (E_INSIDE(event->canvas.x, event->canvas.y, x + xx, y + yy, w, h)) + { + edge = E_ZONE_EDGE_RIGHT; + goto stop; + } + edje_object_part_geometry_get(cfdata->gui.o_selector, "e.edge.bottom_right", &x, &y, &w, &h); + if (E_INSIDE(event->canvas.x, event->canvas.y, x + xx, y + yy, w, h)) + { + edge = E_ZONE_EDGE_BOTTOM_RIGHT; + goto stop; + } + edje_object_part_geometry_get(cfdata->gui.o_selector, "e.edge.bottom", &x, &y, &w, &h); + if (E_INSIDE(event->canvas.x, event->canvas.y, x + xx, y + yy, w, h)) + { + edge = E_ZONE_EDGE_BOTTOM; + goto stop; + } + edje_object_part_geometry_get(cfdata->gui.o_selector, "e.edge.bottom_left", &x, &y, &w, &h); + if (E_INSIDE(event->canvas.x, event->canvas.y, x + xx, y + yy, w, h)) + { + edge = E_ZONE_EDGE_BOTTOM_LEFT; + goto stop; + } + edje_object_part_geometry_get(cfdata->gui.o_selector, "e.edge.left", &x, &y, &w, &h); + if (E_INSIDE(event->canvas.x, event->canvas.y, x + xx, y + yy, w, h)) + { + edge = E_ZONE_EDGE_LEFT; + goto stop; + } + return; + +stop: + cfdata->locals.edge = edge; + cfdata->locals.modifiers = 0; + + if (evas_key_modifier_is_set(event->modifiers, "Control")) + cfdata->locals.modifiers |= E_BINDING_MODIFIER_CTRL; + if (evas_key_modifier_is_set(event->modifiers, "Shift")) + cfdata->locals.modifiers |= E_BINDING_MODIFIER_SHIFT; + if (evas_key_modifier_is_set(event->modifiers, "Alt")) + cfdata->locals.modifiers |= E_BINDING_MODIFIER_ALT; + if (evas_key_modifier_is_set(event->modifiers, "Win")) + cfdata->locals.modifiers |= E_BINDING_MODIFIER_WIN; + + label = _edge_binding_text_get(cfdata->locals.edge, ((float) cfdata->locals.delay), cfdata->locals.modifiers); + edje_object_part_text_set(cfdata->gui.o_selector, "e.text.selection", label); + if (label) E_FREE(label); +} + +static void +_edge_grab_wnd_selection_apply(E_Config_Dialog_Data *cfdata) +{ + E_Config_Binding_Edge *bi = NULL, *bi2 = NULL; + Eina_List *l; + char *label; + int found = 0, n = -1; + + if (cfdata->locals.add) + { + found = 0; + for (l = cfdata->binding.edge; l && !found; l = l->next) + { + bi = l->data; + if ((bi->modifiers == cfdata->locals.modifiers) && + (bi->edge == cfdata->locals.edge) && + ((bi->delay * 1000) == (cfdata->locals.delay * 1000))) + found = 1; + } + } + else + { + if (cfdata->locals.cur && cfdata->locals.cur[0] && + (sscanf(cfdata->locals.cur, "e%d", &n) == 1)) + { + found = 0; + bi = eina_list_nth(cfdata->binding.edge, n); + + for (l = cfdata->binding.edge; l && !found; l = l->next) + { + bi2 = l->data; + if (bi == bi2) continue; + if ((bi->modifiers == cfdata->locals.modifiers) && + (bi->edge == cfdata->locals.edge) && + ((bi->delay * 1000) == (cfdata->locals.delay * 1000))) + found = 1; + } + } + } + + if (!found) + { + if (cfdata->locals.add) + { + bi = E_NEW(E_Config_Binding_Edge, 1); + bi->context = E_BINDING_CONTEXT_ZONE; + bi->edge = cfdata->locals.edge; + bi->any_mod = 0; + bi->delay = (float) (cfdata->locals.delay); + bi->action = NULL; + bi->params = NULL; + bi->modifiers = cfdata->locals.modifiers; + cfdata->binding.edge = eina_list_append(cfdata->binding.edge, bi); + } + else + { + if (cfdata->locals.cur && cfdata->locals.cur[0] && + (sscanf(cfdata->locals.cur, "e%d", &n) == 1)) + { + bi = eina_list_nth(cfdata->binding.edge, n); + + bi->modifiers = cfdata->locals.modifiers; + bi->delay = cfdata->locals.delay; + bi->edge = cfdata->locals.edge; + } + } + + if (cfdata->locals.add) + { + _update_edge_binding_list(cfdata); + + for (l = cfdata->binding.edge, n = 0; l; l = l->next, n++) + { + if (l->data == bi) break; + } + e_widget_ilist_selected_set(cfdata->gui.o_binding_list, n); + e_widget_ilist_unselect(cfdata->gui.o_action_list); + if (cfdata->locals.action) free(cfdata->locals.action); + cfdata->locals.action = strdup(""); + if ((cfdata->params) && (cfdata->params[0])) + { + int j, g = -1; + _find_edge_binding_action("exec", NULL, &g, NULL, &j); + if (j >= 0) + { + e_widget_ilist_unselect(cfdata->gui.o_action_list); + e_widget_ilist_selected_set(cfdata->gui.o_action_list, (j + g + 1)); + e_widget_entry_clear(cfdata->gui.o_params); + e_widget_entry_text_set(cfdata->gui.o_params, cfdata->params); + } + } + else + { + e_widget_entry_clear(cfdata->gui.o_params); + e_widget_disabled_set(cfdata->gui.o_params, 1); + } + } + else + { + label = _edge_binding_text_get(bi->edge, bi->delay, bi->modifiers); + e_widget_ilist_nth_label_set(cfdata->gui.o_binding_list, n, label); + free(label); + } + } + else + { + int g, a, j; + const char *label = NULL; + E_Action_Group *actg = NULL; + E_Action_Description *actd = NULL; + + if (cfdata->locals.add) + _find_edge_binding_action(bi->action, bi->params, &g, &a, &j); + else + _find_edge_binding_action(bi2->action, bi2->params, &g, &a, &j); + + actg = eina_list_nth(e_action_groups_get(), g); + if (actg) actd = eina_list_nth(actg->acts, a); + + if (actd) label = actd->act_name; + + e_util_dialog_show(_("Binding Edge Error"), + _("The binding key sequence, that you choose," + " is already used by
" + "%s action.
" + "Please choose another binding edge sequence."), + label ? label : _("Unknown")); + } +} + + +/********** Helper *********************************/ +static void +_auto_apply_changes(E_Config_Dialog_Data *cfdata) +{ + int n, g, a, ok; + E_Config_Binding_Edge *bi; + E_Action_Group *actg; + E_Action_Description *actd; + + if ((!cfdata->locals.cur) || (!cfdata->locals.cur[0]) || + (!cfdata->locals.action) || (!cfdata->locals.action[0])) return; + + if (sscanf(cfdata->locals.cur, "e%d", &n) != 1) + return; + if (sscanf(cfdata->locals.action, "%d %d", &g, &a) != 2) + return; + + bi = eina_list_nth(cfdata->binding.edge, n); + if (!bi) return; + + actg = eina_list_nth(e_action_groups_get(), g); + if (!actg) return; + actd = eina_list_nth(actg->acts, a); + if (!actd) return; + + if (bi->action) eina_stringshare_del(bi->action); + bi->action = NULL; + + if (actd->act_cmd) bi->action = eina_stringshare_add(actd->act_cmd); + + if (bi->params) eina_stringshare_del(bi->params); + bi->params = NULL; + + if (actd->act_params) + bi->params = eina_stringshare_add(actd->act_params); + else + { + ok = 1; + if (cfdata->locals.params) + { + if (!strcmp(cfdata->locals.params, TEXT_NO_PARAMS)) + ok = 0; + + if ((actd->param_example) && (!strcmp(cfdata->locals.params, actd->param_example))) + ok = 0; + } + else + ok = 0; + + if (ok) + bi->params = eina_stringshare_add(cfdata->locals.params); + } +} + +static void +_find_edge_binding_action(const char *action, const char *params, int *g, int *a, int *n) +{ + Eina_List *l, *l2; + int gg = -1, aa = -1, nn = -1, found; + E_Action_Group *actg; + E_Action_Description *actd; + + if (g) *g = -1; + if (a) *a = -1; + if (n) *n = -1; + + found = 0; + for (l = e_action_groups_get(), gg = 0, nn = 0; l; l = l->next, gg++) + { + actg = l->data; + + for (l2 = actg->acts, aa = 0; l2; l2 = l2->next, aa++) + { + actd = l2->data; + if (!strcmp((!action ? "" : action), (!actd->act_cmd ? "" : actd->act_cmd))) + { + if (!params || !params[0]) + { + if ((!actd->act_params) || (!actd->act_params[0])) + { + if (g) *g = gg; + if (a) *a = aa; + if (n) *n = nn; + return; + } + else + continue; + } + else + { + if ((!actd->act_params) || (!actd->act_params[0])) + { + if (g) *g = gg; + if (a) *a = aa; + if (n) *n = nn; + found = 1; + } + else + { + if (!strcmp(params, actd->act_params)) + { + if (g) *g = gg; + if (a) *a = aa; + if (n) *n = nn; + return; + } + } + } + } + nn++; + } + if (found) break; + } + + if (!found) + { + if (g) *g = -1; + if (a) *a = -1; + if (n) *n = -1; + } +} + +static char * +_edge_binding_text_get(E_Zone_Edge edge, float delay, int mod) +{ + char b[256] = ""; + + if (mod & E_BINDING_MODIFIER_CTRL) + strcat(b, _("CTRL")); + + if (mod & E_BINDING_MODIFIER_ALT) + { + if (b[0]) strcat(b, " + "); + strcat(b, _("ALT")); + } + + if (mod & E_BINDING_MODIFIER_SHIFT) + { + if (b[0]) strcat(b, " + "); + strcat(b, _("SHIFT")); + } + + if (mod & E_BINDING_MODIFIER_WIN) + { + if (b[0]) strcat(b, " + "); + strcat(b, _("WIN")); + } + + if (edge) + { + char *l; + if (b[0]) strcat(b, " + "); + + if (edge == E_ZONE_EDGE_LEFT) + l = strdup("Left Edge"); + else if (edge == E_ZONE_EDGE_TOP) + l = strdup("Top Edge"); + else if (edge == E_ZONE_EDGE_RIGHT) + l = strdup("Right Edge"); + else if (edge == E_ZONE_EDGE_BOTTOM) + l = strdup("Bottom Edge"); + else if (edge == E_ZONE_EDGE_TOP_LEFT) + l = strdup("Top Left Edge"); + else if (edge == E_ZONE_EDGE_TOP_RIGHT) + l = strdup("Top Right Edge"); + else if (edge == E_ZONE_EDGE_BOTTOM_RIGHT) + l = strdup("Bottom Right Edge"); + else if (edge == E_ZONE_EDGE_BOTTOM_LEFT) + l = strdup("Bottom Left Edge"); + + strcat(b, l); + free(l); + } + + if (delay) + { + char buf[20]; + + if (b[0]) strcat(b, " "); + snprintf(buf, 20, "%.2fs", delay); + strcat(b, buf); + } + + if (!b[0]) return strdup(TEXT_NONE_ACTION_EDGE); + return strdup(b); +} diff --git a/src/modules/conf_edgebindings/e_int_config_edgebindings.h b/src/modules/conf_edgebindings/e_int_config_edgebindings.h new file mode 100644 index 000000000..60f7b912b --- /dev/null +++ b/src/modules/conf_edgebindings/e_int_config_edgebindings.h @@ -0,0 +1,9 @@ +#ifdef E_TYPEDEFS +#else +#ifndef E_INT_CONFIG_EDGEBINDINGS_H +#define E_INT_CONFIG_EDGEBINDINGS_H + +EAPI E_Config_Dialog *e_int_config_edgebindings(E_Container *con, const char *params __UNUSED__); + +#endif +#endif diff --git a/src/modules/conf_edgebindings/e_mod_main.c b/src/modules/conf_edgebindings/e_mod_main.c new file mode 100644 index 000000000..8869bcdc0 --- /dev/null +++ b/src/modules/conf_edgebindings/e_mod_main.c @@ -0,0 +1,56 @@ +/* + * vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2 + */ +#include "e.h" +#include "e_mod_main.h" + +/***************************************************************************/ +/**/ +/* actual module specifics */ + +static E_Module *conf_module = NULL; + +/**/ +/***************************************************************************/ + +/***************************************************************************/ +/**/ + +/**/ +/***************************************************************************/ + +/***************************************************************************/ +/**/ +/* module setup */ +EAPI E_Module_Api e_modapi = +{ + E_MODULE_API_VERSION, + "Settings - Edge Bindings" +}; + +EAPI void * +e_modapi_init(E_Module *m) +{ + e_configure_registry_category_add("keyboard_and_mouse", 40, _("Input"), NULL, "enlightenment/behavior"); + e_configure_registry_item_add("keyboard_and_mouse/edge_bindings", 10, _("Edge Bindings"), NULL, "enlightenment/edges", e_int_config_edgebindings); + conf_module = m; + e_module_delayed_set(m, 1); + return m; +} + +EAPI int +e_modapi_shutdown(E_Module *m) +{ + E_Config_Dialog *cfd; + while ((cfd = e_config_dialog_get("E", "_config_edgebindings_dialog"))) e_object_del(E_OBJECT(cfd)); + e_configure_registry_item_del("keyboard_and_mouse/edge_bindings"); + e_configure_registry_category_del("keyboard_and_mouse"); + conf_module = NULL; + return 1; +} + +EAPI int +e_modapi_save(E_Module *m) +{ + return 1; +} diff --git a/src/modules/conf_edgebindings/e_mod_main.h b/src/modules/conf_edgebindings/e_mod_main.h new file mode 100644 index 000000000..d24a08fae --- /dev/null +++ b/src/modules/conf_edgebindings/e_mod_main.h @@ -0,0 +1,19 @@ +/* + * vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2 + */ +#ifndef E_MOD_MAIN_H +#define E_MOD_MAIN_H + +#define E_TYPEDEFS 1 +#include "e_int_config_edgebindings.h" + +#undef E_TYPEDEFS +#include "e_int_config_edgebindings.h" + +EAPI extern E_Module_Api e_modapi; + +EAPI void *e_modapi_init (E_Module *m); +EAPI int e_modapi_shutdown (E_Module *m); +EAPI int e_modapi_save (E_Module *m); + +#endif diff --git a/src/modules/conf_edgebindings/module.desktop.in b/src/modules/conf_edgebindings/module.desktop.in new file mode 100644 index 000000000..91ea44ce5 --- /dev/null +++ b/src/modules/conf_edgebindings/module.desktop.in @@ -0,0 +1,6 @@ +[Desktop Entry] +Type=Link +Name=Settings - Edge Bindings +Icon=e-module-conf_edgebindings +Comment=E17 Settings Applet
Configure your edgebindings here. +X-Enlightenment-ModuleType=config