summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCedric Bail <cedric.bail@samsung.com>2013-07-19 15:39:49 +0900
committerCedric Bail <cedric.bail@samsung.com>2013-07-19 15:40:11 +0900
commitcf9b0180d62ffc2341364499ea3a0b756bc2675a (patch)
tree150e6f4610d97a36ad2e3ee3736bf7349ac2c4af
parente7862929e4aa5217b634f08dc7ea387781e157ea (diff)
edje: add threshold to draggable part.
Diffstat (limited to '')
-rw-r--r--ChangeLog4
-rw-r--r--NEWS1
-rw-r--r--src/bin/edje/edje_cc_handlers.c33
-rw-r--r--src/examples/edje/Makefile.am1
-rw-r--r--src/examples/edje/edje-threshold.edc87
-rw-r--r--src/lib/edje/edje_calc.c113
-rw-r--r--src/lib/edje/edje_callbacks.c19
-rw-r--r--src/lib/edje/edje_data.c23
-rw-r--r--src/lib/edje/edje_load.c2
-rw-r--r--src/lib/edje/edje_private.h9
10 files changed, 265 insertions, 27 deletions
diff --git a/ChangeLog b/ChangeLog
index 85c6c8bd93..6a42020c7b 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
12013-07-19 Cedric Bail
2
3 * Edje: add threshold to draggable part.
4
12013-07-18 Mike Blumenkrantz 52013-07-18 Mike Blumenkrantz
2 6
3 * Ecore-X: add ECORE_X_SYNC env variable for xlib backend 7 * Ecore-X: add ECORE_X_SYNC env variable for xlib backend
diff --git a/NEWS b/NEWS
index f323149450..446aeb09ad 100644
--- a/NEWS
+++ b/NEWS
@@ -120,6 +120,7 @@ Additions:
120 - Add EDJE_INPUT_PANEL_LAYOUT_DATETIME layout 120 - Add EDJE_INPUT_PANEL_LAYOUT_DATETIME layout
121 - support edc proxy.source_visible, proxy.source_clip 121 - support edc proxy.source_visible, proxy.source_clip
122 - support edc map color set 122 - support edc map color set
123 - Add threshold support to Edje draggable part.
123 * Eeze: 124 * Eeze:
124 - Add a dummy libmount replacement for when libmount is not there. 125 - Add a dummy libmount replacement for when libmount is not there.
125 * Ecore_Con: 126 * Ecore_Con:
diff --git a/src/bin/edje/edje_cc_handlers.c b/src/bin/edje/edje_cc_handlers.c
index ad645fa2f6..0c1905c5ce 100644
--- a/src/bin/edje/edje_cc_handlers.c
+++ b/src/bin/edje/edje_cc_handlers.c
@@ -234,6 +234,7 @@ static void st_collections_group_parts_part_access(void);
234static void st_collections_group_parts_part_dragable_x(void); 234static void st_collections_group_parts_part_dragable_x(void);
235static void st_collections_group_parts_part_dragable_y(void); 235static void st_collections_group_parts_part_dragable_y(void);
236static void st_collections_group_parts_part_dragable_confine(void); 236static void st_collections_group_parts_part_dragable_confine(void);
237static void st_collections_group_parts_part_dragable_threshold(void);
237static void st_collections_group_parts_part_dragable_events(void); 238static void st_collections_group_parts_part_dragable_events(void);
238 239
239/* box and table items share these */ 240/* box and table items share these */
@@ -512,6 +513,7 @@ New_Statement_Handler statement_handlers[] =
512 {"collections.group.parts.part.dragable.x", st_collections_group_parts_part_dragable_x}, 513 {"collections.group.parts.part.dragable.x", st_collections_group_parts_part_dragable_x},
513 {"collections.group.parts.part.dragable.y", st_collections_group_parts_part_dragable_y}, 514 {"collections.group.parts.part.dragable.y", st_collections_group_parts_part_dragable_y},
514 {"collections.group.parts.part.dragable.confine", st_collections_group_parts_part_dragable_confine}, 515 {"collections.group.parts.part.dragable.confine", st_collections_group_parts_part_dragable_confine},
516 {"collections.group.parts.part.dragable.threshold", st_collections_group_parts_part_dragable_threshold},
515 {"collections.group.parts.part.dragable.events", st_collections_group_parts_part_dragable_events}, 517 {"collections.group.parts.part.dragable.events", st_collections_group_parts_part_dragable_events},
516 {"collections.group.parts.part.entry_mode", st_collections_group_parts_part_entry_mode}, 518 {"collections.group.parts.part.entry_mode", st_collections_group_parts_part_entry_mode},
517 {"collections.group.parts.part.select_mode", st_collections_group_parts_part_select_mode}, 519 {"collections.group.parts.part.select_mode", st_collections_group_parts_part_select_mode},
@@ -2719,6 +2721,7 @@ st_collections_group_inherit(void)
2719 ep->nested_children_count = ep2->nested_children_count; 2721 ep->nested_children_count = ep2->nested_children_count;
2720 2722
2721 data_queue_copied_part_lookup(pc, &(ep2->dragable.confine_id), &(ep->dragable.confine_id)); 2723 data_queue_copied_part_lookup(pc, &(ep2->dragable.confine_id), &(ep->dragable.confine_id));
2724 data_queue_copied_part_lookup(pc, &(ep2->dragable.threshold_id), &(ep->dragable.threshold_id));
2722 data_queue_copied_part_lookup(pc, &(ep2->dragable.event_id), &(ep->dragable.event_id)); 2725 data_queue_copied_part_lookup(pc, &(ep2->dragable.event_id), &(ep->dragable.event_id));
2723 2726
2724 epp = (Edje_Part_Parser *)ep; 2727 epp = (Edje_Part_Parser *)ep;
@@ -3353,6 +3356,7 @@ edje_cc_handlers_part_make(void)
3353 ep->access = 0; 3356 ep->access = 0;
3354 ep->clip_to_id = -1; 3357 ep->clip_to_id = -1;
3355 ep->dragable.confine_id = -1; 3358 ep->dragable.confine_id = -1;
3359 ep->dragable.threshold_id = -1;
3356 ep->dragable.event_id = -1; 3360 ep->dragable.event_id = -1;
3357 ep->items = NULL; 3361 ep->items = NULL;
3358 ep->nested_children_count = 0; 3362 ep->nested_children_count = 0;
@@ -4227,6 +4231,7 @@ st_collections_group_parts_part_access(void)
4227 .. 4231 ..
4228 dragable { 4232 dragable {
4229 confine: "another part"; 4233 confine: "another part";
4234 threshold: "another part";
4230 events: "another dragable part"; 4235 events: "another dragable part";
4231 x: 0 0 0; 4236 x: 0 0 0;
4232 y: 0 0 0; 4237 y: 0 0 0;
@@ -4322,6 +4327,34 @@ st_collections_group_parts_part_dragable_confine(void)
4322/** 4327/**
4323 @page edcref 4328 @page edcref
4324 @property 4329 @property
4330 threshold
4331 @parameters
4332 [another part's name]
4333 @effect
4334 When set, the movement of the dragged part can only start when it get
4335 moved enough to be outside of the threshold part.
4336 @endproperty
4337*/
4338static void
4339st_collections_group_parts_part_dragable_threshold(void)
4340{
4341 Edje_Part_Collection *pc;
4342
4343 check_arg_count(1);
4344
4345 pc = eina_list_data_get(eina_list_last(edje_collections));
4346 {
4347 char *name;
4348
4349 name = parse_str(0);
4350 data_queue_part_lookup(pc, name, &(current_part->dragable.threshold_id));
4351 free(name);
4352 }
4353}
4354
4355/**
4356 @page edcref
4357 @property
4325 events 4358 events
4326 @parameters 4359 @parameters
4327 [another dragable part's name] 4360 [another dragable part's name]
diff --git a/src/examples/edje/Makefile.am b/src/examples/edje/Makefile.am
index fc3ec351b1..5d5dfa8589 100644
--- a/src/examples/edje/Makefile.am
+++ b/src/examples/edje/Makefile.am
@@ -11,6 +11,7 @@ endif
11 11
12#put here all EDCs one needs to the examples 12#put here all EDCs one needs to the examples
13EDCS = \ 13EDCS = \
14edje-threshold.edc \
14animations2.edc \ 15animations2.edc \
15animations.edc \ 16animations.edc \
16basic2.edc \ 17basic2.edc \
diff --git a/src/examples/edje/edje-threshold.edc b/src/examples/edje/edje-threshold.edc
new file mode 100644
index 0000000000..1216c2bbdd
--- /dev/null
+++ b/src/examples/edje/edje-threshold.edc
@@ -0,0 +1,87 @@
1collections {
2 group {
3 name: "main";
4 parts {
5 part {
6 type: RECT;
7 name: background;
8 mouse_events: 0;
9 description {
10 color: 0 0 0 255;
11 }
12 }
13 part {
14 type: RECT;
15 name: "area/vertical";
16 mouse_events: 0;
17 description {
18 color: 255 0 0 255;
19 align: 0.5 0;
20 min: 20 30;
21 max: 20 -1;
22 }
23 }
24 part {
25 type: RECT;
26 name: "area/horizontal";
27 mouse_events: 0;
28 description {
29 color: 255 0 0 255;
30 align: 0 0.5;
31 min: 30 20;
32 max: -1 20;
33 }
34 }
35 part {
36 type: RECT;
37 name: "threshold/horizontal";
38 mouse_events: 0;
39 description {
40 color: 0 0 255 255;
41 rel1 {
42 to: "drag/horizontal";
43 offset: -13 -13;
44 }
45 rel2 {
46 to: "drag/horizontal";
47 offset: +12 +12;
48 }
49 }
50 }
51 part {
52 type: RECT;
53 name: "drag/horizontal";
54 mouse_events: 1;
55 dragable {
56 confine: "area/horizontal";
57 threshold: "threshold/horizontal";
58 x: 1 1 0;
59 y: 0 0 0;
60 }
61 description {
62 aspect: 1 1;
63 color: 0 255 0 255;
64 min: 20 20;
65 max: 20 20;
66 }
67 }
68 part {
69 type: RECT;
70 name: "drag/vertical";
71 mouse_events: 1;
72 dragable {
73 confine: "area/vertical";
74 threshold: "threshold/horizontal";
75 x: 0 0 0;
76 y: 1 1 0;
77 }
78 description {
79 aspect: 1 1;
80 color: 0 255 255 255;
81 min: 20 20;
82 max: 20 20;
83 }
84 }
85 }
86 }
87}
diff --git a/src/lib/edje/edje_calc.c b/src/lib/edje/edje_calc.c
index d75c35046c..a11fb7c057 100644
--- a/src/lib/edje/edje_calc.c
+++ b/src/lib/edje/edje_calc.c
@@ -8,7 +8,8 @@ static void _edje_part_recalc_single(Edje *ed, Edje_Real_Part *ep,
8 Edje_Real_Part *center, Edje_Real_Part *light, Edje_Real_Part *persp, 8 Edje_Real_Part *center, Edje_Real_Part *light, Edje_Real_Part *persp,
9 Edje_Real_Part *rel1_to_x, Edje_Real_Part *rel1_to_y, 9 Edje_Real_Part *rel1_to_x, Edje_Real_Part *rel1_to_y,
10 Edje_Real_Part *rel2_to_x, Edje_Real_Part *rel2_to_y, 10 Edje_Real_Part *rel2_to_x, Edje_Real_Part *rel2_to_y,
11 Edje_Real_Part *confine_to, Edje_Calc_Params *params, 11 Edje_Real_Part *confine_to, Edje_Real_Part *threshold,
12 Edje_Calc_Params *params,
12 Evas_Coord mmw, Evas_Coord mmh, 13 Evas_Coord mmw, Evas_Coord mmh,
13 FLOAT_T pos); 14 FLOAT_T pos);
14 15
@@ -775,6 +776,15 @@ _edje_part_dragable_calc(Edje *ed EINA_UNUSED, Edje_Real_Part *ep, FLOAT_T *x, F
775{ 776{
776 if (ep->drag) 777 if (ep->drag)
777 { 778 {
779 Eina_Bool tx = EINA_FALSE;
780 Eina_Bool ty = EINA_FALSE;
781
782 if (ep->drag->threshold)
783 {
784 // Check if we are in the threshold or not and cancel the movement.
785 tx = ep->drag->threshold_x && ep->drag->threshold_started_x;
786 ty = ep->drag->threshold_y && ep->drag->threshold_started_y;
787 }
778 if (ep->drag->confine_to) 788 if (ep->drag->confine_to)
779 { 789 {
780 FLOAT_T dx, dy, dw, dh; 790 FLOAT_T dx, dy, dw, dh;
@@ -795,15 +805,15 @@ _edje_part_dragable_calc(Edje *ed EINA_UNUSED, Edje_Real_Part *ep, FLOAT_T *x, F
795 if (dh != ZERO) dy = DIV(dy, dh); 805 if (dh != ZERO) dy = DIV(dy, dh);
796 else dy = ZERO; 806 else dy = ZERO;
797 807
798 if (x) *x = dx; 808 if (x) *x = tx ? ep->drag->x : dx;
799 if (y) *y = dy; 809 if (y) *y = ty ? ep->drag->y : dy;
800 810
801 return ret; 811 return ret;
802 } 812 }
803 else 813 else
804 { 814 {
805 if (x) *x = ADD(FROM_INT(ep->drag->tmp.x), ep->drag->x); 815 if (x) *x = tx ? ep->drag->x : ADD(FROM_INT(ep->drag->tmp.x), ep->drag->x);
806 if (y) *y = ADD(FROM_INT(ep->drag->tmp.y), ep->drag->y); 816 if (y) *y = ty ? ep->drag->y : ADD(FROM_INT(ep->drag->tmp.y), ep->drag->y);
807 return 0; 817 return 0;
808 } 818 }
809 } 819 }
@@ -1799,8 +1809,56 @@ _edje_part_recalc_single_max(Edje_Part_Description_Common *desc,
1799} 1809}
1800 1810
1801static void 1811static void
1812_edje_part_recalc_single_drag_threshold(Edje_Real_Part *ep,
1813 Edje_Real_Part *threshold,
1814 Edje_Calc_Params *params)
1815{
1816 if (threshold)
1817 {
1818 if (ep->drag->threshold_started_x &&
1819 threshold->x < TO_INT(params->eval.x) &&
1820 TO_INT(params->eval.x) + TO_INT(params->eval.w) < threshold->x + threshold->w)
1821 {
1822 // Cancel movement to previous position due to our presence inside the threshold
1823 params->eval.x = FROM_INT(params->req_drag.x);
1824 params->eval.w = FROM_INT(params->req_drag.w);
1825 ep->drag->threshold_x = EINA_TRUE;
1826 }
1827 else
1828 {
1829 params->req_drag.x = TO_INT(params->eval.x);
1830 params->req_drag.w = TO_INT(params->eval.w);
1831 ep->drag->threshold_started_x = EINA_FALSE;
1832 }
1833 if (ep->drag->threshold_started_y &&
1834 threshold->y < TO_INT(params->eval.y) &&
1835 TO_INT(params->eval.y) + TO_INT(params->eval.h) < threshold->y + threshold->h)
1836 {
1837 // Cancel movement to previous position due to our presence inside the threshold
1838 params->eval.y = FROM_INT(params->req_drag.y);
1839 params->eval.h = FROM_INT(params->req_drag.h);
1840 ep->drag->threshold_y = EINA_TRUE;
1841 }
1842 else
1843 {
1844 params->req_drag.y = TO_INT(params->eval.y);
1845 params->req_drag.h = TO_INT(params->eval.h);
1846 ep->drag->threshold_started_y = EINA_FALSE;
1847 }
1848 }
1849 else
1850 {
1851 params->req_drag.x = TO_INT(params->eval.x);
1852 params->req_drag.w = TO_INT(params->eval.w);
1853 params->req_drag.y = TO_INT(params->eval.y);
1854 params->req_drag.h = TO_INT(params->eval.h);
1855 }
1856}
1857
1858static void
1802_edje_part_recalc_single_drag(Edje_Real_Part *ep, 1859_edje_part_recalc_single_drag(Edje_Real_Part *ep,
1803 Edje_Real_Part *confine_to, 1860 Edje_Real_Part *confine_to,
1861 Edje_Real_Part *threshold,
1804 Edje_Calc_Params *params, 1862 Edje_Calc_Params *params,
1805 int minw, int minh, 1863 int minw, int minh,
1806 int maxw, int maxh) 1864 int maxw, int maxh)
@@ -1833,8 +1891,6 @@ _edje_part_recalc_single_drag(Edje_Real_Part *ep,
1833 params->eval.x = FROM_INT(confine_to->x + 1891 params->eval.x = FROM_INT(confine_to->x +
1834 ((offset / step) * step)); 1892 ((offset / step) * step));
1835 } 1893 }
1836 params->req_drag.x = TO_INT(params->eval.x);
1837 params->req_drag.w = TO_INT(params->eval.w);
1838 1894
1839 v = SCALE(ep->drag->size.y, confine_to->h); 1895 v = SCALE(ep->drag->size.y, confine_to->h);
1840 1896
@@ -1856,8 +1912,8 @@ _edje_part_recalc_single_drag(Edje_Real_Part *ep,
1856 params->eval.y = FROM_INT(confine_to->y + 1912 params->eval.y = FROM_INT(confine_to->y +
1857 ((offset / step) * step)); 1913 ((offset / step) * step));
1858 } 1914 }
1859 params->req_drag.y = TO_INT(params->eval.y); 1915
1860 params->req_drag.h = TO_INT(params->eval.h); 1916 _edje_part_recalc_single_drag_threshold(ep, threshold, params);
1861 1917
1862 /* limit to confine */ 1918 /* limit to confine */
1863 if (params->eval.x < FROM_INT(confine_to->x)) 1919 if (params->eval.x < FROM_INT(confine_to->x))
@@ -1881,12 +1937,9 @@ _edje_part_recalc_single_drag(Edje_Real_Part *ep,
1881 { 1937 {
1882 /* simple dragable params */ 1938 /* simple dragable params */
1883 params->eval.x = ADD(ADD(params->eval.x, ep->drag->x), FROM_INT(ep->drag->tmp.x)); 1939 params->eval.x = ADD(ADD(params->eval.x, ep->drag->x), FROM_INT(ep->drag->tmp.x));
1884 params->req_drag.x = FROM_INT(params->eval.x);
1885 params->req_drag.w = FROM_INT(params->eval.w);
1886
1887 params->eval.y = ADD(ADD(params->eval.y, ep->drag->y), FROM_INT(ep->drag->tmp.y)); 1940 params->eval.y = ADD(ADD(params->eval.y, ep->drag->y), FROM_INT(ep->drag->tmp.y));
1888 params->req_drag.y = FROM_INT(params->eval.y); 1941
1889 params->req_drag.h = FROM_INT(params->eval.h); 1942 _edje_part_recalc_single_drag_threshold(ep, threshold, params);
1890 } 1943 }
1891} 1944}
1892 1945
@@ -2183,6 +2236,7 @@ _edje_part_recalc_single(Edje *ed,
2183 Edje_Real_Part *rel2_to_x, 2236 Edje_Real_Part *rel2_to_x,
2184 Edje_Real_Part *rel2_to_y, 2237 Edje_Real_Part *rel2_to_y,
2185 Edje_Real_Part *confine_to, 2238 Edje_Real_Part *confine_to,
2239 Edje_Real_Part *threshold,
2186 Edje_Calc_Params *params, 2240 Edje_Calc_Params *params,
2187 Evas_Coord mmw, Evas_Coord mmh, 2241 Evas_Coord mmw, Evas_Coord mmh,
2188 FLOAT_T pos) 2242 FLOAT_T pos)
@@ -2289,7 +2343,7 @@ _edje_part_recalc_single(Edje *ed,
2289 2343
2290 /* take care of dragable part */ 2344 /* take care of dragable part */
2291 if (ep->drag) 2345 if (ep->drag)
2292 _edje_part_recalc_single_drag(ep, confine_to, params, minw, minh, maxw, maxh); 2346 _edje_part_recalc_single_drag(ep, confine_to, threshold, params, minw, minh, maxw, maxh);
2293 2347
2294 /* fill */ 2348 /* fill */
2295 if (ep->part->type == EDJE_PART_TYPE_IMAGE) 2349 if (ep->part->type == EDJE_PART_TYPE_IMAGE)
@@ -2962,6 +3016,7 @@ _edje_part_recalc(Edje *ed, Edje_Real_Part *ep, int flags, Edje_Calc_Params *sta
2962 int state1 = -1; 3016 int state1 = -1;
2963 int state2 = -1; 3017 int state2 = -1;
2964 int statec = -1; 3018 int statec = -1;
3019 int statet = -1;
2965#else 3020#else
2966 Edje_Calc_Params lp1, lp2; 3021 Edje_Calc_Params lp1, lp2;
2967#endif 3022#endif
@@ -2979,6 +3034,7 @@ _edje_part_recalc(Edje *ed, Edje_Real_Part *ep, int flags, Edje_Calc_Params *sta
2979 Edje_Calc_Params *p1, *pf; 3034 Edje_Calc_Params *p1, *pf;
2980 Edje_Part_Description_Common *chosen_desc; 3035 Edje_Part_Description_Common *chosen_desc;
2981 Edje_Real_Part *confine_to = NULL; 3036 Edje_Real_Part *confine_to = NULL;
3037 Edje_Real_Part *threshold = NULL;
2982 FLOAT_T pos = ZERO, pos2; 3038 FLOAT_T pos = ZERO, pos2;
2983 Edje_Calc_Params lp3; 3039 Edje_Calc_Params lp3;
2984 Evas_Coord mmw = 0, mmh = 0; 3040 Evas_Coord mmw = 0, mmh = 0;
@@ -3160,13 +3216,26 @@ _edje_part_recalc(Edje *ed, Edje_Real_Part *ep, int flags, Edje_Calc_Params *sta
3160 } 3216 }
3161 } 3217 }
3162 } 3218 }
3163 if (ep->drag && ep->drag->confine_to) 3219 if (ep->drag)
3164 { 3220 {
3165 confine_to = ep->drag->confine_to; 3221 if (ep->drag->confine_to)
3166 _edje_part_recalc(ed, confine_to, flags, NULL); 3222 {
3223 confine_to = ep->drag->confine_to;
3224 _edje_part_recalc(ed, confine_to, flags, NULL);
3167#ifdef EDJE_CALC_CACHE 3225#ifdef EDJE_CALC_CACHE
3168 statec = confine_to->state; 3226 statec = confine_to->state;
3169#endif 3227#endif
3228 }
3229 if (ep->drag->threshold)
3230 {
3231 threshold = ep->drag->threshold;
3232 // We shall not recalculate the threshold position as
3233 // we use it's previous position to assert the threshold
3234 // the one before moving take action.
3235#ifdef EDJE_CALC_CACHE
3236 statet = threshold->state;
3237#endif
3238 }
3170 } 3239 }
3171 // if (ep->text.source) _edje_part_recalc(ed, ep->text.source, flags); 3240 // if (ep->text.source) _edje_part_recalc(ed, ep->text.source, flags);
3172 // if (ep->text.text_source) _edje_part_recalc(ed, ep->text.text_source, flags); 3241 // if (ep->text.text_source) _edje_part_recalc(ed, ep->text.text_source, flags);
@@ -3240,6 +3309,7 @@ _edje_part_recalc(Edje *ed, Edje_Real_Part *ep, int flags, Edje_Calc_Params *sta
3240 ep->invalidate || 3309 ep->invalidate ||
3241 state1 >= ep->param1.state || 3310 state1 >= ep->param1.state ||
3242 statec >= ep->param1.state || 3311 statec >= ep->param1.state ||
3312 statet >= ep->param1.state ||
3243 statec1 >= ep->param1.state || 3313 statec1 >= ep->param1.state ||
3244 statel1 >= ep->param1.state || 3314 statel1 >= ep->param1.state ||
3245 statep1 >= ep->param1.state || 3315 statep1 >= ep->param1.state ||
@@ -3250,7 +3320,7 @@ _edje_part_recalc(Edje *ed, Edje_Real_Part *ep, int flags, Edje_Calc_Params *sta
3250 { 3320 {
3251 _edje_part_recalc_single(ed, ep, ep->param1.description, chosen_desc, center[0], light[0], persp[0], 3321 _edje_part_recalc_single(ed, ep, ep->param1.description, chosen_desc, center[0], light[0], persp[0],
3252 rp1[Rel1X], rp1[Rel1Y], rp1[Rel2X], rp1[Rel2Y], 3322 rp1[Rel1X], rp1[Rel1Y], rp1[Rel2X], rp1[Rel2Y],
3253 confine_to, 3323 confine_to, threshold,
3254 p1, mmw, mmh, pos); 3324 p1, mmw, mmh, pos);
3255#ifdef EDJE_CALC_CACHE 3325#ifdef EDJE_CALC_CACHE
3256 if (flags == FLAG_XY) 3326 if (flags == FLAG_XY)
@@ -3304,6 +3374,7 @@ _edje_part_recalc(Edje *ed, Edje_Real_Part *ep, int flags, Edje_Calc_Params *sta
3304 ep->invalidate || 3374 ep->invalidate ||
3305 state2 >= ep->param2->state || 3375 state2 >= ep->param2->state ||
3306 statec >= ep->param2->state || 3376 statec >= ep->param2->state ||
3377 statet >= ep->param2->state ||
3307 statec2 >= ep->param2->state || 3378 statec2 >= ep->param2->state ||
3308 statel2 >= ep->param2->state || 3379 statel2 >= ep->param2->state ||
3309 statep2 >= ep->param2->state || 3380 statep2 >= ep->param2->state ||
@@ -3319,7 +3390,7 @@ _edje_part_recalc(Edje *ed, Edje_Real_Part *ep, int flags, Edje_Calc_Params *sta
3319 rp2[Rel1Y], 3390 rp2[Rel1Y],
3320 rp2[Rel2X], 3391 rp2[Rel2X],
3321 rp2[Rel2Y], 3392 rp2[Rel2Y],
3322 confine_to, 3393 confine_to, threshold,
3323 p2, mmw, mmh, pos); 3394 p2, mmw, mmh, pos);
3324#ifdef EDJE_CALC_CACHE 3395#ifdef EDJE_CALC_CACHE
3325 if (flags == FLAG_XY) 3396 if (flags == FLAG_XY)
diff --git a/src/lib/edje/edje_callbacks.c b/src/lib/edje/edje_callbacks.c
index 3be7cf0513..9a508c78e1 100644
--- a/src/lib/edje/edje_callbacks.c
+++ b/src/lib/edje/edje_callbacks.c
@@ -139,8 +139,10 @@ _edje_mouse_down_signal_cb(void *data, Eo *obj, const Eo_Event_Description *desc
139 rp->drag->down.x = ev->canvas.x; 139 rp->drag->down.x = ev->canvas.x;
140 if (rp->part->dragable.y) 140 if (rp->part->dragable.y)
141 rp->drag->down.y = ev->canvas.y; 141 rp->drag->down.y = ev->canvas.y;
142 if (!ignored) 142 rp->drag->threshold_x = EINA_FALSE;
143 _edje_emit(ed, "drag,start", rp->part->name); 143 rp->drag->threshold_y = EINA_FALSE;
144 rp->drag->threshold_started_x = EINA_TRUE;
145 rp->drag->threshold_started_y = EINA_TRUE;
144 } 146 }
145 rp->drag->down.count++; 147 rp->drag->down.count++;
146 } 148 }
@@ -201,14 +203,18 @@ _edje_mouse_up_signal_cb(void *data, Eo *obj, const Eo_Event_Description *desc E
201 rp->drag->down.count--; 203 rp->drag->down.count--;
202 if (rp->drag->down.count == 0) 204 if (rp->drag->down.count == 0)
203 { 205 {
206 rp->drag->threshold_started_x = EINA_FALSE;
207 rp->drag->threshold_started_y = EINA_FALSE;
204 rp->drag->need_reset = 1; 208 rp->drag->need_reset = 1;
205 ed->recalc_call = EINA_TRUE; 209 ed->recalc_call = EINA_TRUE;
206 ed->dirty = EINA_TRUE; 210 ed->dirty = EINA_TRUE;
207#ifdef EDJE_CALC_CACHE 211#ifdef EDJE_CALC_CACHE
208 rp->invalidate = 1; 212 rp->invalidate = 1;
209#endif 213#endif
210 if (!ignored) 214 if (!ignored && rp->drag->started)
211 _edje_emit(ed, "drag,stop", rp->part->name); 215 _edje_emit(ed, "drag,stop", rp->part->name);
216 rp->drag->started = EINA_FALSE;
217 _edje_recalc_do(ed);
212 } 218 }
213 } 219 }
214 } 220 }
@@ -306,7 +312,12 @@ _edje_mouse_move_signal_cb(void *data, Eo *obj, const Eo_Event_Description *desc
306 rp->drag->val.x = dx; 312 rp->drag->val.x = dx;
307 rp->drag->val.y = dy; 313 rp->drag->val.y = dy;
308 if (!ignored) 314 if (!ignored)
309 _edje_emit(ed, "drag", rp->part->name); 315 {
316 if (!rp->drag->started)
317 _edje_emit(ed, "drag,start", rp->part->name);
318 _edje_emit(ed, "drag", rp->part->name);
319 rp->drag->started = EINA_TRUE;
320 }
310 ed->recalc_call = EINA_TRUE; 321 ed->recalc_call = EINA_TRUE;
311 ed->dirty = EINA_TRUE; 322 ed->dirty = EINA_TRUE;
312#ifdef EDJE_CALC_CACHE 323#ifdef EDJE_CALC_CACHE
diff --git a/src/lib/edje/edje_data.c b/src/lib/edje/edje_data.c
index da990e8797..f8f9bb713f 100644
--- a/src/lib/edje/edje_data.c
+++ b/src/lib/edje/edje_data.c
@@ -90,7 +90,27 @@ EMP(BOX, box);
90EMP(TABLE, table); 90EMP(TABLE, table);
91EMP(EXTERNAL, external); 91EMP(EXTERNAL, external);
92EMP(SPACER, spacer); 92EMP(SPACER, spacer);
93EMP(part, part); 93
94EAPI Eina_Mempool *_emp_part = NULL;
95
96static void *
97mem_alloc_part(size_t size)
98{
99 Edje_Part *ep;
100
101 ep = eina_mempool_malloc(_emp_part, size);
102 memset(ep, 0, size);
103 // This value need to be defined for older file that didn't provide it
104 // as it should -1 by default instead of 0.
105 ep->dragable.threshold_id = -1;
106 return ep;
107}
108
109static void
110mem_free_part(void *data)
111{
112 eina_mempool_free(_emp_part, data);
113}
94 114
95#define FREED(eed) \ 115#define FREED(eed) \
96 if (eed) \ 116 if (eed) \
@@ -956,6 +976,7 @@ _edje_edd_init(void)
956 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part, Edje_Part, "dragable.step_y", dragable.step_y, EET_T_INT); 976 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part, Edje_Part, "dragable.step_y", dragable.step_y, EET_T_INT);
957 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part, Edje_Part, "dragable.count_y", dragable.count_y, EET_T_INT); 977 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part, Edje_Part, "dragable.count_y", dragable.count_y, EET_T_INT);
958 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part, Edje_Part, "dragable.counfine_id", dragable.confine_id, EET_T_INT); 978 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part, Edje_Part, "dragable.counfine_id", dragable.confine_id, EET_T_INT);
979 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part, Edje_Part, "dragable.threshold_id", dragable.threshold_id, EET_T_INT);
959 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part, Edje_Part, "dragable.events_id", dragable.event_id, EET_T_INT); 980 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part, Edje_Part, "dragable.events_id", dragable.event_id, EET_T_INT);
960 EET_DATA_DESCRIPTOR_ADD_VAR_ARRAY(_edje_edd_edje_part, Edje_Part, "items", items, _edje_edd_edje_pack_element_pointer); 981 EET_DATA_DESCRIPTOR_ADD_VAR_ARRAY(_edje_edd_edje_part, Edje_Part, "items", items, _edje_edd_edje_pack_element_pointer);
961 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part, Edje_Part, "type", type, EET_T_UCHAR); 982 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part, Edje_Part, "type", type, EET_T_UCHAR);
diff --git a/src/lib/edje/edje_load.c b/src/lib/edje/edje_load.c
index 70388be20a..df2b16892e 100644
--- a/src/lib/edje/edje_load.c
+++ b/src/lib/edje/edje_load.c
@@ -688,6 +688,8 @@ _edje_object_file_set_internal(Evas_Object *obj, const char *file, const char *g
688 { 688 {
689 if (rp->part->dragable.confine_id >= 0) 689 if (rp->part->dragable.confine_id >= 0)
690 rp->drag->confine_to = ed->table_parts[rp->part->dragable.confine_id % ed->table_parts_size]; 690 rp->drag->confine_to = ed->table_parts[rp->part->dragable.confine_id % ed->table_parts_size];
691 if (rp->part->dragable.threshold_id >= 0)
692 rp->drag->threshold = ed->table_parts[rp->part->dragable.threshold_id % ed->table_parts_size];
691 } 693 }
692 694
693 if ((rp->type == EDJE_RP_TYPE_SWALLOW) && 695 if ((rp->type == EDJE_RP_TYPE_SWALLOW) &&
diff --git a/src/lib/edje/edje_private.h b/src/lib/edje/edje_private.h
index 3ecd20fe09..d2bb323f0c 100644
--- a/src/lib/edje/edje_private.h
+++ b/src/lib/edje/edje_private.h
@@ -942,6 +942,7 @@ struct _Edje_Part_Dragable
942 int count_y; /* drag area divided by n (0 = no limit) */ 942 int count_y; /* drag area divided by n (0 = no limit) */
943 943
944 int confine_id; /* dragging within this bit, -1 = no */ 944 int confine_id; /* dragging within this bit, -1 = no */
945 int threshold_id; /* dragging outside this bit, -1 = no */
945 946
946 /* davinchi */ 947 /* davinchi */
947 int event_id; /* If it is used as scrollbar */ 948 int event_id; /* If it is used as scrollbar */
@@ -1487,8 +1488,14 @@ struct _Edje_Real_Part_Drag
1487 struct { 1488 struct {
1488 int x, y; // 8 1489 int x, y; // 8
1489 } tmp; 1490 } tmp;
1490 unsigned char need_reset : 1; // 4
1491 Edje_Real_Part *confine_to; // 4 1491 Edje_Real_Part *confine_to; // 4
1492 Edje_Real_Part *threshold; // 4
1493 Eina_Bool need_reset : 1; // 4
1494 Eina_Bool threshold_started_x : 1;
1495 Eina_Bool threshold_started_y : 1;
1496 Eina_Bool threshold_x : 1;
1497 Eina_Bool threshold_y : 1;
1498 Eina_Bool started : 1;
1492}; // 104 1499}; // 104
1493 1500
1494#define EDJE_RP_TYPE_NONE 0 1501#define EDJE_RP_TYPE_NONE 0