summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarcel Hollerbach <marcel-hollerbach@t-online.de>2017-11-01 15:23:09 +0100
committerMarcel Hollerbach <marcel-hollerbach@t-online.de>2017-11-01 15:23:09 +0100
commit83821cd4e5651486eea7ea113a20ad302d726243 (patch)
tree81680e837e5a5c867bc5717e16c92bea01d8d596
parent65d89b92c2795ce09435608de0d2404602c97a42 (diff)
-rw-r--r--src/lib/Clouseau_Debug.h1
-rw-r--r--src/lib/extensions/focus_inspector/gui.c3
-rw-r--r--src/lib/extensions/focus_inspector/gui.h12
-rw-r--r--src/lib/extensions/focus_inspector/tree_view.c84
4 files changed, 100 insertions, 0 deletions
diff --git a/src/lib/Clouseau_Debug.h b/src/lib/Clouseau_Debug.h
index 3f3b863..9a798d6 100644
--- a/src/lib/Clouseau_Debug.h
+++ b/src/lib/Clouseau_Debug.h
@@ -118,6 +118,7 @@ typedef struct {
118typedef struct { 118typedef struct {
119 Efl_Ui_Focus_Relations relation; 119 Efl_Ui_Focus_Relations relation;
120 const char *class_name; 120 const char *class_name;
121 Evas_Object *vis;
121} Clouseau_Focus_Relation; 122} Clouseau_Focus_Relation;
122 123
123 124
diff --git a/src/lib/extensions/focus_inspector/gui.c b/src/lib/extensions/focus_inspector/gui.c
index b5dd5e8..9801025 100644
--- a/src/lib/extensions/focus_inspector/gui.c
+++ b/src/lib/extensions/focus_inspector/gui.c
@@ -98,6 +98,8 @@ ui_manager_data_arrived(Instance *inst, Clouseau_Focus_Manager_Data *data)
98 EINA_LIST_FREE(inst->realized.objects, o) 98 EINA_LIST_FREE(inst->realized.objects, o)
99 evas_object_del(o); 99 evas_object_del(o);
100 100
101 inst->realized.focusable_to_cfr = eina_hash_pointer_new(NULL);
102
101 inst->realized.data = data; 103 inst->realized.data = data;
102 104
103 elm_hoversel_clear(history); 105 elm_hoversel_clear(history);
@@ -106,6 +108,7 @@ ui_manager_data_arrived(Instance *inst, Clouseau_Focus_Manager_Data *data)
106 { 108 {
107 if (rel->relation.position_in_history != -1) 109 if (rel->relation.position_in_history != -1)
108 sorted = eina_list_sorted_insert(sorted, _sort, rel); 110 sorted = eina_list_sorted_insert(sorted, _sort, rel);
111 eina_hash_add(inst->realized.focusable_to_cfr, &rel->relation.node, rel);
109 } 112 }
110 113
111 EINA_LIST_FOREACH(sorted, n, rel) 114 EINA_LIST_FOREACH(sorted, n, rel)
diff --git a/src/lib/extensions/focus_inspector/gui.h b/src/lib/extensions/focus_inspector/gui.h
index 683afe0..140754e 100644
--- a/src/lib/extensions/focus_inspector/gui.h
+++ b/src/lib/extensions/focus_inspector/gui.h
@@ -7,14 +7,26 @@
7typedef struct { 7typedef struct {
8 Clouseau_Extension *ext; 8 Clouseau_Extension *ext;
9 struct { 9 struct {
10 Eina_Hash *focusable_to_cfr;
10 Eina_List *objects; 11 Eina_List *objects;
11 Clouseau_Focus_Manager_Data *data; 12 Clouseau_Focus_Manager_Data *data;
12 } realized; 13 } realized;
13} Instance; 14} Instance;
14 15
16typedef enum {
17 RELATION_TREE = 0,
18 RELATION_NEXT = 1,
19 RELATION_PREV = 2,
20/* RELATION_RIGHT = 3,
21 RELATION_LEFT = 4,
22 RELATION_TOP = 5,
23 RELATION_DOWN = 6*/
24} Relations;
25
15#define PUSH_CLEANUP(inst, o) inst->realized.objects = eina_list_append(inst->realized.objects, o) 26#define PUSH_CLEANUP(inst, o) inst->realized.objects = eina_list_append(inst->realized.objects, o)
16 27
17EAPI void tree_view_update(Instance *inst, Evas_Object *scroller); 28EAPI void tree_view_update(Instance *inst, Evas_Object *scroller);
29EAPI void tree_view_relation_display(Instance *inst, Relations rel);
18 30
19EAPI void ui_managers_add(Instance *inst, Efl_Ui_Focus_Manager **manager, int size); 31EAPI void ui_managers_add(Instance *inst, Efl_Ui_Focus_Manager **manager, int size);
20EAPI void ui_manager_data_arrived(Instance *inst, Clouseau_Focus_Manager_Data *data); 32EAPI void ui_manager_data_arrived(Instance *inst, Clouseau_Focus_Manager_Data *data);
diff --git a/src/lib/extensions/focus_inspector/tree_view.c b/src/lib/extensions/focus_inspector/tree_view.c
index 94b652a..a13d480 100644
--- a/src/lib/extensions/focus_inspector/tree_view.c
+++ b/src/lib/extensions/focus_inspector/tree_view.c
@@ -57,6 +57,8 @@ tree_level(void *data, Instance *inst, Clouseau_Focus_Relation *relation)
57 evas_object_size_hint_max_set(vis, maxw, maxh); 57 evas_object_size_hint_max_set(vis, maxw, maxh);
58 evas_object_size_hint_min_set(vis, minw, minh); 58 evas_object_size_hint_min_set(vis, minw, minh);
59 59
60 relation->vis = vis;
61
60 PUSH_CLEANUP(inst, vis); 62 PUSH_CLEANUP(inst, vis);
61 63
62 childbox = evas_object_box_add(evas_object_evas_get(data)); 64 childbox = evas_object_box_add(evas_object_evas_get(data));
@@ -88,4 +90,86 @@ tree_view_update(Instance *inst, Evas_Object *scroller)
88 find(inst, NULL, tree_level, box); 90 find(inst, NULL, tree_level, box);
89 91
90 elm_object_content_set(scroller, box); 92 elm_object_content_set(scroller, box);
93
94 tree_view_relation_display(inst, RELATION_NEXT);
95}
96
97static void
98_geom_change(void *data, Evas *e, Evas_Object *obj, void *event_info)
99{
100 Eina_Rectangle pos1, pos2;
101 Eina_Position2D calc_from, calc_to, from, to;
102 Evas_Object *line, *vis1, *vis2;
103
104 line = data;
105 vis1 = evas_object_data_get(line, "__from");
106 vis2 = evas_object_data_get(line, "__to");
107
108 evas_object_geometry_get(vis1, &pos1.x, &pos1.y, &pos1.w, &pos1.h);
109 evas_object_geometry_get(vis2, &pos2.x, &pos2.y, &pos2.w, &pos2.h);
110
111 from.x = pos1.x + pos1.w / 2;
112 from.y = pos1.y + pos1.h / 2;
113 to.x = pos2.x + pos2.w / 2;
114 to.y = pos2.y + pos2.h / 2;
115
116 evas_object_line_xy_set(line, from.x, from.y, to.x, to.y);
117}
118
119static void
120_relation_display(Instance *inst, Evas_Object *vis1, Evas_Object *vis2)
121{
122 Evas_Object *line;
123
124 line = evas_object_line_add(evas_object_evas_get(vis1));
125 evas_object_anti_alias_set(line, EINA_FALSE);
126 evas_object_geometry_set(line, 0, 0, 1000, 1000);
127 evas_object_pass_events_set(line, EINA_TRUE);
128 evas_object_data_set(line, "__from", vis1);
129 evas_object_data_set(line, "__to", vis2);
130 evas_object_show(line);
131
132 PUSH_CLEANUP(inst, line);
133
134 evas_object_event_callback_add(vis1, EVAS_CALLBACK_MOVE, _geom_change, line);
135 evas_object_event_callback_add(vis1, EVAS_CALLBACK_RESIZE, _geom_change, line);
136 evas_object_event_callback_add(vis2, EVAS_CALLBACK_MOVE, _geom_change, line);
137 evas_object_event_callback_add(vis2, EVAS_CALLBACK_RESIZE, _geom_change, line);
138}
139
140EAPI void
141tree_view_relation_display(Instance *inst, Relations rel_type)
142{
143 if (rel_type == RELATION_TREE || rel_type == RELATION_NEXT || rel_type == RELATION_PREV)
144 {
145 Clouseau_Focus_Relation *rel;
146 Eina_List *n;
147
148 EINA_LIST_FOREACH(inst->realized.data->relations, n, rel)
149 {
150 Eo *relation_partner;
151
152 if (rel_type == RELATION_TREE)
153 {
154 relation_partner = rel->relation.parent;
155 if (!rel->relation.parent) continue;
156 }
157 else if (rel_type == RELATION_NEXT)
158 {
159 relation_partner = rel->relation.next;
160 }
161 else if (rel_type == RELATION_PREV)
162 {
163 relation_partner = rel->relation.prev;
164 }
165
166 Clouseau_Focus_Relation *c = eina_hash_find(inst->realized.focusable_to_cfr, &relation_partner);
167
168 EINA_SAFETY_ON_NULL_GOTO(c, next);
169
170 _relation_display(inst, c->vis, rel->vis);
171 next:
172 n = n;
173 }
174 }
91} 175}