summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJean-Philippe Andre <jp.andre@samsung.com>2016-07-27 16:31:52 +0900
committerJean-Philippe Andre <jp.andre@samsung.com>2016-07-27 16:48:45 +0900
commitccac110d712c8f035f79dcf8818a298f20a44494 (patch)
tree5670a3c7679f4d7bf83282610d465d4283ce75f7
parentbd91ebbbd76069d364e903f5ec3d82d7c3403635 (diff)
elm: Fix extra mouse,in events in layout_content_unset
Problem: crash in assert() in terminology. Scenario: Open Terminology, Split V by keyboard, Move mouse to split 2, Create tab by keyboard --> abort() in terminology Cause: An extra mouse,in event happens during edje_object_unswallow inside elm_layout_content_unset. Root cause: efl_part() in elm_layout had a side effect: edje_recalc on the edje object. Causing its geometry to be "properly" defined and the mouse event to trigger callbacks. Solution: Avoid calling recalc... somehow. Conclusion: Without adding any new API, edje edit provides internally the information that we want: type of an edje part (for box & table). Fixes T4221 See T4028 See T3509
-rw-r--r--src/lib/elementary/efl_ui_layout_internal_box.eo1
-rw-r--r--src/lib/elementary/efl_ui_layout_internal_table.eo1
-rw-r--r--src/lib/elementary/elm_layout.c20
-rw-r--r--src/lib/elementary/elm_layout_pack.c75
4 files changed, 50 insertions, 47 deletions
diff --git a/src/lib/elementary/efl_ui_layout_internal_box.eo b/src/lib/elementary/efl_ui_layout_internal_box.eo
index f945157..d8aa6c5 100644
--- a/src/lib/elementary/efl_ui_layout_internal_box.eo
+++ b/src/lib/elementary/efl_ui_layout_internal_box.eo
@@ -12,7 +12,6 @@ class Efl.Ui.Layout_Internal.Box (Eo.Base, Efl.Pack.Linear,
12 set {} 12 set {}
13 values { 13 values {
14 layout: Eo.Base; 14 layout: Eo.Base;
15 pack: Eo.Base;
16 part: string; 15 part: string;
17 } 16 }
18 } 17 }
diff --git a/src/lib/elementary/efl_ui_layout_internal_table.eo b/src/lib/elementary/efl_ui_layout_internal_table.eo
index 85cbded..5e4f8bf 100644
--- a/src/lib/elementary/efl_ui_layout_internal_table.eo
+++ b/src/lib/elementary/efl_ui_layout_internal_table.eo
@@ -11,7 +11,6 @@ class Efl.Ui.Layout_Internal.Table (Eo.Base, Efl.Pack.Grid)
11 set {} 11 set {}
12 values { 12 values {
13 layout: Eo.Base; 13 layout: Eo.Base;
14 pack: Eo.Base;
15 part: string; 14 part: string;
16 } 15 }
17 } 16 }
diff --git a/src/lib/elementary/elm_layout.c b/src/lib/elementary/elm_layout.c
index 737c1d5..ebc21cd 100644
--- a/src/lib/elementary/elm_layout.c
+++ b/src/lib/elementary/elm_layout.c
@@ -13,12 +13,15 @@
13#include "elm_layout_internal_part.eo.h" 13#include "elm_layout_internal_part.eo.h"
14#include "elm_part_helper.h" 14#include "elm_part_helper.h"
15 15
16#define EDJE_EDIT_IS_UNSTABLE_AND_I_KNOW_ABOUT_IT
17#include <Edje_Edit.h>
18
16#define MY_CLASS ELM_LAYOUT_CLASS 19#define MY_CLASS ELM_LAYOUT_CLASS
17 20
18#define MY_CLASS_NAME "Elm_Layout" 21#define MY_CLASS_NAME "Elm_Layout"
19#define MY_CLASS_NAME_LEGACY "elm_layout" 22#define MY_CLASS_NAME_LEGACY "elm_layout"
20 23
21Eo *_elm_layout_pack_proxy_get(Elm_Layout *obj, Evas_Object *pack, const char *part); 24Eo *_elm_layout_pack_proxy_get(Elm_Layout *obj, Edje_Part_Type type, const char *part);
22 25
23static const char SIG_THEME_CHANGED[] = "theme,changed"; 26static const char SIG_THEME_CHANGED[] = "theme,changed";
24const char SIG_LAYOUT_FOCUSED[] = "focused"; 27const char SIG_LAYOUT_FOCUSED[] = "focused";
@@ -2020,7 +2023,7 @@ static EOLIAN Eo_Base *
2020_elm_layout_efl_part_part(const Eo *obj, Elm_Layout_Smart_Data *sd, 2023_elm_layout_efl_part_part(const Eo *obj, Elm_Layout_Smart_Data *sd,
2021 const char *part) 2024 const char *part)
2022{ 2025{
2023 const Evas_Object *subobj; 2026 Edje_Part_Type type;
2024 Elm_Part_Data *pd; 2027 Elm_Part_Data *pd;
2025 Eo *proxy; 2028 Eo *proxy;
2026 2029
@@ -2029,14 +2032,11 @@ _elm_layout_efl_part_part(const Eo *obj, Elm_Layout_Smart_Data *sd,
2029 2032
2030 ELM_WIDGET_DATA_GET_OR_RETURN((Eo *) obj, wd, NULL); 2033 ELM_WIDGET_DATA_GET_OR_RETURN((Eo *) obj, wd, NULL);
2031 2034
2032 // Ask edje for existing parts 2035 // Check part type with edje_edit, as edje_object_part_object_get()
2033 subobj = edje_object_part_object_get(wd->resize_obj, part); 2036 // has side effects (it calls recalc, which may be really bad).
2034 if (subobj) 2037 type = edje_edit_part_type_get(wd->resize_obj, part);
2035 { 2038 if ((type == EDJE_PART_TYPE_BOX) || (type == EDJE_PART_TYPE_TABLE))
2036 // Support BOX & TABLE 2039 return _elm_layout_pack_proxy_get((Eo *) obj, type, part);
2037 proxy = _elm_layout_pack_proxy_get((Eo *) obj, (Eo *) subobj, part);
2038 if (proxy) return proxy;
2039 }
2040 2040
2041 // Generic parts (text, anything, ...) 2041 // Generic parts (text, anything, ...)
2042 proxy = eo_add(ELM_LAYOUT_INTERNAL_PART_CLASS, (Eo *) obj); 2042 proxy = eo_add(ELM_LAYOUT_INTERNAL_PART_CLASS, (Eo *) obj);
diff --git a/src/lib/elementary/elm_layout_pack.c b/src/lib/elementary/elm_layout_pack.c
index bd5fc5a..66108c9 100644
--- a/src/lib/elementary/elm_layout_pack.c
+++ b/src/lib/elementary/elm_layout_pack.c
@@ -40,7 +40,6 @@ struct _Layout_Part_Data
40 Elm_Layout *obj; // no ref 40 Elm_Layout *obj; // no ref
41 Elm_Layout_Smart_Data *sd; // data xref 41 Elm_Layout_Smart_Data *sd; // data xref
42 Eina_Stringshare *part; 42 Eina_Stringshare *part;
43 Evas_Object *pack;
44 unsigned char temp; 43 unsigned char temp;
45}; 44};
46 45
@@ -53,20 +52,16 @@ struct _Part_Item_Iterator
53}; 52};
54 53
55Eo * 54Eo *
56_elm_layout_pack_proxy_get(Elm_Layout *obj, Evas_Object *pack, const char *part) 55_elm_layout_pack_proxy_get(Elm_Layout *obj, Edje_Part_Type type, const char *part)
57{ 56{
58 Efl_Ui_Layout_Internal_Box *eo; 57 if (type == EDJE_PART_TYPE_BOX)
59 58 return eo_add(BOX_CLASS, obj,
60 if (eo_isa(pack, EVAS_BOX_CLASS)) 59 efl_ui_layout_internal_box_real_part_set(eo_self, obj, part));
61 eo = eo_add(BOX_CLASS, obj, 60 else if (type == EDJE_PART_TYPE_TABLE)
62 efl_ui_layout_internal_box_real_part_set(eo_self, obj, pack, part)); 61 return eo_add(TABLE_CLASS, obj,
63 else if (eo_isa(pack, EVAS_TABLE_CLASS)) 62 efl_ui_layout_internal_table_real_part_set(eo_self, obj, part));
64 eo = eo_add(TABLE_CLASS, obj,
65 efl_ui_layout_internal_table_real_part_set(eo_self, obj, pack, part));
66 else 63 else
67 return NULL; 64 return NULL;
68
69 return eo;
70} 65}
71 66
72EOLIAN static void 67EOLIAN static void
@@ -79,12 +74,11 @@ _efl_ui_layout_internal_box_eo_base_destructor(Eo *obj, Efl_Ui_Layout_Table_Data
79} 74}
80 75
81EOLIAN static void 76EOLIAN static void
82_efl_ui_layout_internal_box_real_part_set(Eo *obj, Efl_Ui_Layout_Box_Data *pd, Eo *layout, Eo *pack, const char *part) 77_efl_ui_layout_internal_box_real_part_set(Eo *obj, Efl_Ui_Layout_Box_Data *pd, Eo *layout, const char *part)
83{ 78{
84 pd->obj = layout; 79 pd->obj = layout;
85 pd->sd = eo_data_xref(pd->obj, ELM_LAYOUT_CLASS, obj); 80 pd->sd = eo_data_xref(pd->obj, ELM_LAYOUT_CLASS, obj);
86 eina_stringshare_replace(&pd->part, part); 81 eina_stringshare_replace(&pd->part, part);
87 pd->pack = pack;
88 pd->temp = 1; 82 pd->temp = 1;
89} 83}
90 84
@@ -142,15 +136,16 @@ EOLIAN static Eina_Iterator *
142_efl_ui_layout_internal_box_efl_container_content_iterate(Eo *obj, Efl_Ui_Layout_Box_Data *pd) 136_efl_ui_layout_internal_box_efl_container_content_iterate(Eo *obj, Efl_Ui_Layout_Box_Data *pd)
143{ 137{
144 Eina_Iterator *it; 138 Eina_Iterator *it;
145 139 Eo *pack = (Eo *) edje_object_part_object_get(pd->obj, pd->part);
146 it = evas_object_box_iterator_new(pd->pack); 140 it = evas_object_box_iterator_new(pack);
147 ELM_PART_RETURN_VAL(_part_item_iterator_create(obj, it, NULL)); 141 ELM_PART_RETURN_VAL(_part_item_iterator_create(obj, it, NULL));
148} 142}
149 143
150EOLIAN static int 144EOLIAN static int
151_efl_ui_layout_internal_box_efl_container_content_count(Eo *obj EINA_UNUSED, Efl_Ui_Layout_Box_Data *pd) 145_efl_ui_layout_internal_box_efl_container_content_count(Eo *obj EINA_UNUSED, Efl_Ui_Layout_Box_Data *pd)
152{ 146{
153 ELM_PART_RETURN_VAL(evas_obj_box_count(pd->pack)); 147 Eo *pack = (Eo *) edje_object_part_object_get(pd->obj, pd->part);
148 ELM_PART_RETURN_VAL(evas_obj_box_count(pack));
154} 149}
155 150
156EOLIAN static Eina_Bool 151EOLIAN static Eina_Bool
@@ -207,11 +202,11 @@ _efl_ui_layout_internal_box_efl_pack_linear_pack_after(Eo *obj EINA_UNUSED, Efl_
207{ 202{
208 const Efl_Gfx *other; 203 const Efl_Gfx *other;
209 int index; 204 int index;
210 205 Eo *pack = (Eo *) edje_object_part_object_get(pd->obj, pd->part);
211 index = efl_pack_index_get(pd->pack, existing); 206 index = efl_pack_index_get(pack, existing);
212 if (index < 0) ELM_PART_RETURN_VAL(EINA_FALSE); 207 if (index < 0) ELM_PART_RETURN_VAL(EINA_FALSE);
213 208
214 other = efl_pack_content_get(pd->pack, index + 1); 209 other = efl_pack_content_get(pack, index + 1);
215 if (other) 210 if (other)
216 ELM_PART_RETURN_VAL(_elm_layout_box_insert_before(pd->obj, pd->sd, pd->part, subobj, other)); 211 ELM_PART_RETURN_VAL(_elm_layout_box_insert_before(pd->obj, pd->sd, pd->part, subobj, other));
217 212
@@ -230,8 +225,9 @@ _efl_ui_layout_internal_box_efl_pack_linear_pack_content_get(Eo *obj EINA_UNUSED
230{ 225{
231 Evas_Object_Box_Option *opt; 226 Evas_Object_Box_Option *opt;
232 Evas_Object_Box_Data *priv; 227 Evas_Object_Box_Data *priv;
228 Eo *pack = (Eo *) edje_object_part_object_get(pd->obj, pd->part);
233 229
234 priv = eo_data_scope_get(pd->pack, EVAS_BOX_CLASS); 230 priv = eo_data_scope_get(pack, EVAS_BOX_CLASS);
235 opt = eina_list_nth(priv->children, index); 231 opt = eina_list_nth(priv->children, index);
236 if (!opt) ELM_PART_RETURN_VAL(NULL); 232 if (!opt) ELM_PART_RETURN_VAL(NULL);
237 ELM_PART_RETURN_VAL(opt->obj); 233 ELM_PART_RETURN_VAL(opt->obj);
@@ -241,8 +237,9 @@ EOLIAN static Efl_Gfx *
241_efl_ui_layout_internal_box_efl_pack_linear_pack_unpack_at(Eo *obj, Efl_Ui_Layout_Box_Data *pd, int index) 237_efl_ui_layout_internal_box_efl_pack_linear_pack_unpack_at(Eo *obj, Efl_Ui_Layout_Box_Data *pd, int index)
242{ 238{
243 Efl_Gfx *subobj; 239 Efl_Gfx *subobj;
240 Eo *pack = (Eo *) edje_object_part_object_get(pd->obj, pd->part);
244 241
245 subobj = efl_pack_content_get(pd->pack, index); 242 subobj = efl_pack_content_get(pack, index);
246 if (!subobj) ELM_PART_RETURN_VAL(NULL); 243 if (!subobj) ELM_PART_RETURN_VAL(NULL);
247 if (efl_pack_unpack(obj, subobj)) 244 if (efl_pack_unpack(obj, subobj))
248 ELM_PART_RETURN_VAL(subobj); 245 ELM_PART_RETURN_VAL(subobj);
@@ -254,7 +251,8 @@ _efl_ui_layout_internal_box_efl_pack_linear_pack_unpack_at(Eo *obj, Efl_Ui_Layou
254EOLIAN static int 251EOLIAN static int
255_efl_ui_layout_internal_box_efl_pack_linear_pack_index_get(Eo *obj EINA_UNUSED, Efl_Ui_Layout_Box_Data *pd, const Efl_Gfx *subobj) 252_efl_ui_layout_internal_box_efl_pack_linear_pack_index_get(Eo *obj EINA_UNUSED, Efl_Ui_Layout_Box_Data *pd, const Efl_Gfx *subobj)
256{ 253{
257 ELM_PART_RETURN_VAL(efl_pack_index_get(pd->pack, subobj)); 254 Eo *pack = (Eo *) edje_object_part_object_get(pd->obj, pd->part);
255 ELM_PART_RETURN_VAL(efl_pack_index_get(pack, subobj));
258} 256}
259 257
260EOLIAN static Efl_Orient 258EOLIAN static Efl_Orient
@@ -269,12 +267,11 @@ _efl_ui_layout_internal_box_efl_orientation_orientation_get(Eo *obj EINA_UNUSED,
269/* Table proxy implementation */ 267/* Table proxy implementation */
270 268
271EOLIAN static void 269EOLIAN static void
272_efl_ui_layout_internal_table_real_part_set(Eo *obj, Efl_Ui_Layout_Table_Data *pd, Eo *layout, Eo *pack, const char *part) 270_efl_ui_layout_internal_table_real_part_set(Eo *obj, Efl_Ui_Layout_Table_Data *pd, Eo *layout, const char *part)
273{ 271{
274 pd->obj = layout; 272 pd->obj = layout;
275 pd->sd = eo_data_xref(pd->obj, ELM_LAYOUT_CLASS, obj); 273 pd->sd = eo_data_xref(pd->obj, ELM_LAYOUT_CLASS, obj);
276 eina_stringshare_replace(&pd->part, part); 274 eina_stringshare_replace(&pd->part, part);
277 pd->pack = pack;
278 pd->temp = 1; 275 pd->temp = 1;
279} 276}
280 277
@@ -291,8 +288,9 @@ EOLIAN static Eina_Iterator *
291_efl_ui_layout_internal_table_efl_container_content_iterate(Eo *obj, Efl_Ui_Layout_Table_Data *pd) 288_efl_ui_layout_internal_table_efl_container_content_iterate(Eo *obj, Efl_Ui_Layout_Table_Data *pd)
292{ 289{
293 Eina_Iterator *it; 290 Eina_Iterator *it;
291 Eo *pack = (Eo *) edje_object_part_object_get(pd->obj, pd->part);
294 292
295 it = evas_object_table_iterator_new(pd->pack); 293 it = evas_object_table_iterator_new(pack);
296 294
297 ELM_PART_RETURN_VAL(_part_item_iterator_create(obj, it, NULL)); 295 ELM_PART_RETURN_VAL(_part_item_iterator_create(obj, it, NULL));
298} 296}
@@ -300,7 +298,8 @@ _efl_ui_layout_internal_table_efl_container_content_iterate(Eo *obj, Efl_Ui_Layo
300EOLIAN static int 298EOLIAN static int
301_efl_ui_layout_internal_table_efl_container_content_count(Eo *obj EINA_UNUSED, Efl_Ui_Layout_Table_Data *pd) 299_efl_ui_layout_internal_table_efl_container_content_count(Eo *obj EINA_UNUSED, Efl_Ui_Layout_Table_Data *pd)
302{ 300{
303 ELM_PART_RETURN_VAL(evas_obj_table_count(pd->pack)); 301 Eo *pack = (Eo *) edje_object_part_object_get(pd->obj, pd->part);
302 ELM_PART_RETURN_VAL(evas_obj_table_count(pack));
304} 303}
305 304
306EOLIAN static Eina_Bool 305EOLIAN static Eina_Bool
@@ -338,7 +337,8 @@ _efl_ui_layout_internal_table_efl_pack_grid_pack_grid(Eo *obj EINA_UNUSED, Efl_U
338EOLIAN static Efl_Gfx * 337EOLIAN static Efl_Gfx *
339_efl_ui_layout_internal_table_efl_pack_grid_grid_content_get(Eo *obj EINA_UNUSED, Efl_Ui_Layout_Table_Data *pd, int col, int row) 338_efl_ui_layout_internal_table_efl_pack_grid_grid_content_get(Eo *obj EINA_UNUSED, Efl_Ui_Layout_Table_Data *pd, int col, int row)
340{ 339{
341 ELM_PART_RETURN_VAL(evas_object_table_child_get(pd->pack, col, row)); 340 Eo *pack = (Eo *) edje_object_part_object_get(pd->obj, pd->part);
341 ELM_PART_RETURN_VAL(evas_object_table_child_get(pack, col, row));
342} 342}
343 343
344EOLIAN static Eina_Iterator * 344EOLIAN static Eina_Iterator *
@@ -350,11 +350,12 @@ _efl_ui_layout_internal_table_efl_pack_grid_grid_contents_get(Eo *obj EINA_UNUSE
350 Eina_List *list, *l = NULL; 350 Eina_List *list, *l = NULL;
351 Evas_Object *sobj; 351 Evas_Object *sobj;
352 unsigned short c, r, cs, rs; 352 unsigned short c, r, cs, rs;
353 Eo *pack = (Eo *) edje_object_part_object_get(pd->obj, pd->part);
353 354
354 list = evas_object_table_children_get(pd->pack); 355 list = evas_object_table_children_get(pack);
355 EINA_LIST_FREE(list, sobj) 356 EINA_LIST_FREE(list, sobj)
356 { 357 {
357 evas_object_table_pack_get(pd->pack, sobj, &c, &r, &cs, &rs); 358 evas_object_table_pack_get(pack, sobj, &c, &r, &cs, &rs);
358 359
359 if (((int) c == col) && ((int) r == row)) 360 if (((int) c == col) && ((int) r == row))
360 list = eina_list_append(list, sobj); 361 list = eina_list_append(list, sobj);
@@ -374,8 +375,9 @@ _efl_ui_layout_internal_table_efl_pack_grid_grid_position_get(Eo *obj EINA_UNUSE
374{ 375{
375 unsigned short c, r, cs, rs; 376 unsigned short c, r, cs, rs;
376 Eina_Bool ret; 377 Eina_Bool ret;
378 Eo *pack = (Eo *) edje_object_part_object_get(pd->obj, pd->part);
377 379
378 ret = evas_object_table_pack_get(pd->pack, subobj, &c, &r, &cs, &rs); 380 ret = evas_object_table_pack_get(pack, subobj, &c, &r, &cs, &rs);
379 if (col) *col = c; 381 if (col) *col = c;
380 if (row) *row = r; 382 if (row) *row = r;
381 if (colspan) *colspan = cs; 383 if (colspan) *colspan = cs;
@@ -387,14 +389,16 @@ _efl_ui_layout_internal_table_efl_pack_grid_grid_position_get(Eo *obj EINA_UNUSE
387EOLIAN static void 389EOLIAN static void
388_efl_ui_layout_internal_table_efl_pack_grid_grid_size_get(Eo *obj EINA_UNUSED, Efl_Ui_Layout_Table_Data *pd, int *cols, int *rows) 390_efl_ui_layout_internal_table_efl_pack_grid_grid_size_get(Eo *obj EINA_UNUSED, Efl_Ui_Layout_Table_Data *pd, int *cols, int *rows)
389{ 391{
390 evas_object_table_col_row_size_get(pd->pack, cols, rows); 392 Eo *pack = (Eo *) edje_object_part_object_get(pd->obj, pd->part);
393 evas_object_table_col_row_size_get(pack, cols, rows);
391} 394}
392 395
393EOLIAN static int 396EOLIAN static int
394_efl_ui_layout_internal_table_efl_pack_grid_grid_columns_get(Eo *obj EINA_UNUSED, Efl_Ui_Layout_Table_Data *pd) 397_efl_ui_layout_internal_table_efl_pack_grid_grid_columns_get(Eo *obj EINA_UNUSED, Efl_Ui_Layout_Table_Data *pd)
395{ 398{
396 int cols, rows; 399 int cols, rows;
397 evas_object_table_col_row_size_get(pd->pack, &cols, &rows); 400 Eo *pack = (Eo *) edje_object_part_object_get(pd->obj, pd->part);
401 evas_object_table_col_row_size_get(pack, &cols, &rows);
398 ELM_PART_RETURN_VAL(cols); 402 ELM_PART_RETURN_VAL(cols);
399} 403}
400 404
@@ -402,7 +406,8 @@ EOLIAN static int
402_efl_ui_layout_internal_table_efl_pack_grid_grid_rows_get(Eo *obj EINA_UNUSED, Efl_Ui_Layout_Table_Data *pd) 406_efl_ui_layout_internal_table_efl_pack_grid_grid_rows_get(Eo *obj EINA_UNUSED, Efl_Ui_Layout_Table_Data *pd)
403{ 407{
404 int cols, rows; 408 int cols, rows;
405 evas_object_table_col_row_size_get(pd->pack, &cols, &rows); 409 Eo *pack = (Eo *) edje_object_part_object_get(pd->obj, pd->part);
410 evas_object_table_col_row_size_get(pack, &cols, &rows);
406 ELM_PART_RETURN_VAL(rows); 411 ELM_PART_RETURN_VAL(rows);
407} 412}
408 413