summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThiep Ha <thiepha@gmail.com>2018-01-09 16:37:27 +0900
committerThiep Ha <thiepha@gmail.com>2018-01-11 17:56:24 +0900
commit35339504b0db553083abeccd0bf5c1dcd05b4acc (patch)
tree606b393e5bcb242890a8abf40acb0f1e935314f7
parente6ab4b41ed8487bf93c5a174a7b06317c2b7e824 (diff)
dnd: add efl_ui_dnd_container
efl_ui_dnd_container is the interface of dnd for container objects.
-rw-r--r--src/Makefile_Elementary.am1
-rw-r--r--src/lib/elementary/Elementary.h1
-rw-r--r--src/lib/elementary/efl_ui_dnd.c67
-rw-r--r--src/lib/elementary/efl_ui_dnd_container.eo50
-rw-r--r--src/lib/elementary/elm_config.c21
-rw-r--r--src/lib/elementary/elm_config.h19
-rw-r--r--src/lib/elementary/elm_priv.h2
7 files changed, 155 insertions, 6 deletions
diff --git a/src/Makefile_Elementary.am b/src/Makefile_Elementary.am
index c000a86fd3..75204582fe 100644
--- a/src/Makefile_Elementary.am
+++ b/src/Makefile_Elementary.am
@@ -99,6 +99,7 @@ elm_public_eolian_files = \
99 lib/elementary/elm_code_widget.eo \ 99 lib/elementary/elm_code_widget.eo \
100 lib/elementary/efl_selection.eo \ 100 lib/elementary/efl_selection.eo \
101 lib/elementary/efl_ui_dnd.eo \ 101 lib/elementary/efl_ui_dnd.eo \
102 lib/elementary/efl_ui_dnd_container.eo \
102 $(NULL) 103 $(NULL)
103 104
104# More public files -- FIXME 105# More public files -- FIXME
diff --git a/src/lib/elementary/Elementary.h b/src/lib/elementary/Elementary.h
index a9cdb945c9..36057bdcea 100644
--- a/src/lib/elementary/Elementary.h
+++ b/src/lib/elementary/Elementary.h
@@ -326,6 +326,7 @@ EAPI extern Elm_Version *elm_version;
326# include <efl_ui_pan.eo.h> 326# include <efl_ui_pan.eo.h>
327# include <efl_selection.eo.h> 327# include <efl_selection.eo.h>
328# include <efl_ui_dnd.eo.h> 328# include <efl_ui_dnd.eo.h>
329# include <efl_ui_dnd_container.eo.h>
329#endif 330#endif
330 331
331/* include deprecated calls last of all */ 332/* include deprecated calls last of all */
diff --git a/src/lib/elementary/efl_ui_dnd.c b/src/lib/elementary/efl_ui_dnd.c
index 761abfe474..731229d121 100644
--- a/src/lib/elementary/efl_ui_dnd.c
+++ b/src/lib/elementary/efl_ui_dnd.c
@@ -13,6 +13,12 @@
13#include <Elementary_Cursor.h> 13#include <Elementary_Cursor.h>
14#include "elm_priv.h" 14#include "elm_priv.h"
15 15
16typedef struct _Efl_Ui_Dnd_Container_Data Efl_Ui_Dnd_Container_Data;
17struct _Efl_Ui_Dnd_Container_Data
18{
19 unsigned int drag_delay_time;
20};
21
16extern int _wl_default_seat_id_get(Evas_Object *obj); 22extern int _wl_default_seat_id_get(Evas_Object *obj);
17 23
18static inline Eo* 24static inline Eo*
@@ -37,7 +43,6 @@ _efl_ui_dnd_drag_start(Eo *obj, void *pd EINA_UNUSED, Efl_Selection_Format forma
37 Efl_Selection_Action action, void *icon_func_data, Efl_Dnd_Drag_Icon_Create icon_func, Eina_Free_Cb icon_func_free_cb, 43 Efl_Selection_Action action, void *icon_func_data, Efl_Dnd_Drag_Icon_Create icon_func, Eina_Free_Cb icon_func_free_cb,
38 unsigned int seat) 44 unsigned int seat)
39{ 45{
40 ERR("In");
41 Eo *sel_man = _selection_manager_get(obj); 46 Eo *sel_man = _selection_manager_get(obj);
42 efl_selection_manager_drag_start(sel_man, obj, format, data, action, 47 efl_selection_manager_drag_start(sel_man, obj, format, data, action,
43 icon_func_data, icon_func, icon_func_free_cb, 48 icon_func_data, icon_func, icon_func_free_cb,
@@ -47,7 +52,6 @@ _efl_ui_dnd_drag_start(Eo *obj, void *pd EINA_UNUSED, Efl_Selection_Format forma
47EOLIAN static void 52EOLIAN static void
48_efl_ui_dnd_drag_cancel(Eo *obj, void *pd EINA_UNUSED, unsigned int seat) 53_efl_ui_dnd_drag_cancel(Eo *obj, void *pd EINA_UNUSED, unsigned int seat)
49{ 54{
50 ERR("In");
51 Eo *sel_man = _selection_manager_get(obj); 55 Eo *sel_man = _selection_manager_get(obj);
52 efl_selection_manager_drag_cancel(sel_man, obj, seat); 56 efl_selection_manager_drag_cancel(sel_man, obj, seat);
53} 57}
@@ -55,7 +59,6 @@ _efl_ui_dnd_drag_cancel(Eo *obj, void *pd EINA_UNUSED, unsigned int seat)
55EOLIAN static void 59EOLIAN static void
56_efl_ui_dnd_drag_action_set(Eo *obj, void *pd EINA_UNUSED, Efl_Selection_Action action, unsigned int seat) 60_efl_ui_dnd_drag_action_set(Eo *obj, void *pd EINA_UNUSED, Efl_Selection_Action action, unsigned int seat)
57{ 61{
58 ERR("In");
59 Eo *sel_man = _selection_manager_get(obj); 62 Eo *sel_man = _selection_manager_get(obj);
60 efl_selection_manager_drag_action_set(sel_man, obj, action, seat); 63 efl_selection_manager_drag_action_set(sel_man, obj, action, seat);
61} 64}
@@ -64,8 +67,6 @@ _efl_ui_dnd_drag_action_set(Eo *obj, void *pd EINA_UNUSED, Efl_Selection_Action
64EOLIAN static void 67EOLIAN static void
65_efl_ui_dnd_drop_target_add(Eo *obj, void *pd EINA_UNUSED, Efl_Selection_Format format, unsigned int seat) 68_efl_ui_dnd_drop_target_add(Eo *obj, void *pd EINA_UNUSED, Efl_Selection_Format format, unsigned int seat)
66{ 69{
67 ERR("In");
68
69 Eo *sel_man = _selection_manager_get(obj); 70 Eo *sel_man = _selection_manager_get(obj);
70 efl_selection_manager_drop_target_add(sel_man, obj, format, seat); 71 efl_selection_manager_drop_target_add(sel_man, obj, format, seat);
71} 72}
@@ -73,9 +74,63 @@ _efl_ui_dnd_drop_target_add(Eo *obj, void *pd EINA_UNUSED, Efl_Selection_Format
73EOLIAN static void 74EOLIAN static void
74_efl_ui_dnd_drop_target_del(Eo *obj, void *pd EINA_UNUSED, Efl_Selection_Format format, unsigned int seat) 75_efl_ui_dnd_drop_target_del(Eo *obj, void *pd EINA_UNUSED, Efl_Selection_Format format, unsigned int seat)
75{ 76{
76 ERR("In");
77 Eo *sel_man = _selection_manager_get(obj); 77 Eo *sel_man = _selection_manager_get(obj);
78 efl_selection_manager_drop_target_del(sel_man, obj, format, seat); 78 efl_selection_manager_drop_target_del(sel_man, obj, format, seat);
79} 79}
80 80
81EOLIAN static double
82_efl_ui_dnd_container_drag_delay_time_get(Eo *obj EINA_UNUSED, Efl_Ui_Dnd_Container_Data *pd)
83{
84 return pd->drag_delay_time;
85}
86
87EOLIAN static void
88_efl_ui_dnd_container_drag_delay_time_set(Eo *obj EINA_UNUSED, Efl_Ui_Dnd_Container_Data *pd, double drag_delay_time)
89{
90 pd->drag_delay_time = drag_delay_time;
91}
92
93EOLIAN static void
94_efl_ui_dnd_container_drag_item_add(Eo *obj, Efl_Ui_Dnd_Container_Data *pd,
95 void *data_func_data, Efl_Dnd_Drag_Data_Get data_func, Eina_Free_Cb data_func_free_cb,
96 void *item_func_data, Efl_Dnd_Item_Get item_func, Eina_Free_Cb item_func_free_cb,
97 void *icon_func_data, Efl_Dnd_Drag_Icon_Create icon_func, Eina_Free_Cb icon_func_free_cb,
98 void *icon_list_func_data, Efl_Dnd_Drag_Icon_List_Create icon_list_func, Eina_Free_Cb icon_list_func_free_cb,
99 unsigned int seat)
100{
101 double drag_delay_time = pd->drag_delay_time;
102 double anim_time = elm_config_drag_anim_duration_get();
103 Eo *sel_man = _selection_manager_get(obj);
104 efl_selection_manager_container_drag_item_add(sel_man, obj, drag_delay_time, anim_time,
105 data_func_data, data_func, data_func_free_cb,
106 item_func_data, item_func, item_func_free_cb,
107 icon_func_data, icon_func, icon_func_free_cb,
108 icon_list_func_data, icon_list_func, icon_list_func_free_cb,
109 seat);
110}
111
112static void
113_efl_ui_dnd_container_drag_item_del(Eo *obj, Efl_Ui_Dnd_Container_Data *pd EINA_UNUSED, unsigned int seat)
114{
115 Eo *sel_man = _selection_manager_get(obj);
116 efl_selection_manager_container_drag_item_del(sel_man, obj, seat);
117}
118EOLIAN static void
119_efl_ui_dnd_container_drop_item_add(Eo *obj, Efl_Ui_Dnd_Container_Data *pd EINA_UNUSED,
120 Efl_Selection_Format format,
121 void *item_func_data, Efl_Dnd_Item_Get item_func, Eina_Free_Cb item_func_free_cb,
122 unsigned int seat)
123{
124 Eo *sel_man = _selection_manager_get(obj);
125 efl_selection_manager_container_drop_item_add(sel_man, obj, format, item_func_data, item_func, item_func_free_cb, seat);
126}
127
128EOLIAN static void
129_efl_ui_dnd_container_drop_item_del(Eo *obj, Efl_Ui_Dnd_Container_Data *pd EINA_UNUSED, unsigned int seat)
130{
131 Eo *sel_man = _selection_manager_get(obj);
132 efl_selection_manager_container_drop_item_del(sel_man, obj, seat);
133}
134
81#include "efl_ui_dnd.eo.c" 135#include "efl_ui_dnd.eo.c"
136#include "efl_ui_dnd_container.eo.c"
diff --git a/src/lib/elementary/efl_ui_dnd_container.eo b/src/lib/elementary/efl_ui_dnd_container.eo
new file mode 100644
index 0000000000..abafe55661
--- /dev/null
+++ b/src/lib/elementary/efl_ui_dnd_container.eo
@@ -0,0 +1,50 @@
1import efl_ui_dnd_types;
2
3mixin Efl.Ui.Dnd.Container {
4 methods {
5 @property drag_delay_time {
6 [[The time since mouse down happens to drag starts.]]
7 set {
8 legacy: null;
9 }
10 get {
11 legacy: null;
12 }
13 values {
14 time: double; [[The drag delay time]]
15 }
16 }
17 drag_item_add { //drag_item_callback //property
18 [[This registers a drag for items in a container. Many items can be
19 dragged at a time. During dragging, there are three events emitted:
20 EFL_DND_EVENT_DRAG_POS, EFL_DND_EVENT_DRAG_ACCEPT, EFL_DND_EVENT_DRAG_DONE.]]
21 params {
22 //@in time_to_drag: double; [[Time since mouse down happens to drag starts]] //drag_delay: property
23 //@in anim_durataion: double; [[animation duration]] //just config
24 @in data_func: Efl.Dnd.Drag_Data_Get; [[Data and its format]]
25 @in item_func: Efl.Dnd.Item_Get; [[Item to determine drag start]]
26 @in icon_func: Efl.Dnd.Drag_Icon_Create; [[Icon used during drag]]
27 @in icon_list_func: Efl.Dnd.Drag_Icon_List_Create; [[Icons used for animations CHECKING ]]
28 @in seat: uint; [[Specified seat for multiple seats case.]]
29 }
30 }
31 drag_item_del { //remove
32 [[Remove drag function of items in the container object.]]
33 params {
34 @in seat: uint; [[Specified seat for multiple seats case.]]
35 }
36 }
37 drop_item_add {
38 params {
39 @in format: Efl.Selection.Format; [[Accepted data formats]]
40 @in item_func: Efl.Dnd.Item_Get; [[Get item at specific position]]
41 @in seat: uint; [[Specified seat for multiple seats case.]]
42 }
43 }
44 drop_item_del {
45 params {
46 @in seat: uint; [[Specified seat for multiple seats case.]]
47 }
48 }
49 }
50}
diff --git a/src/lib/elementary/elm_config.c b/src/lib/elementary/elm_config.c
index 8d83a5686a..2841c140cf 100644
--- a/src/lib/elementary/elm_config.c
+++ b/src/lib/elementary/elm_config.c
@@ -508,6 +508,7 @@ _desc_init(void)
508 ELM_CONFIG_VAL(D, T, entry_select_allow, T_UCHAR); 508 ELM_CONFIG_VAL(D, T, entry_select_allow, T_UCHAR);
509 ELM_CONFIG_VAL(D, T, offline, T_UCHAR); 509 ELM_CONFIG_VAL(D, T, offline, T_UCHAR);
510 ELM_CONFIG_VAL(D, T, powersave, T_INT); 510 ELM_CONFIG_VAL(D, T, powersave, T_INT);
511 ELM_CONFIG_VAL(D, T, drag_anim_duration, T_DOUBLE);
511#undef T 512#undef T
512#undef D 513#undef D
513#undef T_INT 514#undef T_INT
@@ -1821,6 +1822,7 @@ _config_load(void)
1821 _elm_config->icon_theme = eina_stringshare_add(ELM_CONFIG_ICON_THEME_ELEMENTARY); 1822 _elm_config->icon_theme = eina_stringshare_add(ELM_CONFIG_ICON_THEME_ELEMENTARY);
1822 _elm_config->popup_scrollable = EINA_FALSE; 1823 _elm_config->popup_scrollable = EINA_FALSE;
1823 _elm_config->entry_select_allow = EINA_TRUE; 1824 _elm_config->entry_select_allow = EINA_TRUE;
1825 _elm_config->drag_anim_duration = 0.0;
1824 _env_get(); 1826 _env_get();
1825} 1827}
1826 1828
@@ -2021,6 +2023,7 @@ _elm_config_reload_do(void)
2021 KEEP_VAL(gl_msaa); 2023 KEEP_VAL(gl_msaa);
2022 KEEP_STR(icon_theme); 2024 KEEP_STR(icon_theme);
2023 KEEP_VAL(entry_select_allow); 2025 KEEP_VAL(entry_select_allow);
2026 KEEP_VAL(drag_anim_duration);
2024 2027
2025 _elm_config->priv = prev_config->priv; 2028 _elm_config->priv = prev_config->priv;
2026 _config_free(prev_config); 2029 _config_free(prev_config);
@@ -2791,6 +2794,9 @@ _env_get(void)
2791 if (s) _elm_config->popup_vertical_align = _elm_atof(s); 2794 if (s) _elm_config->popup_vertical_align = _elm_atof(s);
2792 s = getenv("ELM_POPUP_SCROLLABLE"); 2795 s = getenv("ELM_POPUP_SCROLLABLE");
2793 if (s) _elm_config->popup_scrollable = atoi(s); 2796 if (s) _elm_config->popup_scrollable = atoi(s);
2797
2798 s = getenv("EFL_UI_DND_DRAG_ANIM_DURATION");
2799 if (s) _elm_config->drag_anim_duration = _elm_atof(s);
2794} 2800}
2795 2801
2796static void 2802static void
@@ -4637,6 +4643,20 @@ elm_config_powersave_set(int set)
4637 _elm_config->powersave = set; 4643 _elm_config->powersave = set;
4638} 4644}
4639 4645
4646EAPI double
4647elm_config_drag_anim_duration_get(void)
4648{
4649 if (!_elm_config) return 0.0;
4650 return _elm_config->drag_anim_duration;
4651}
4652
4653EAPI void
4654elm_config_drag_anim_duration_set(double set)
4655{
4656 if (!_elm_config) return;
4657 _elm_config->drag_anim_duration = set;
4658}
4659
4640void 4660void
4641_elm_config_profile_set(const char *profile) 4661_elm_config_profile_set(const char *profile)
4642{ 4662{
@@ -5074,6 +5094,7 @@ _efl_config_global_efl_config_config_get(Eo *obj EINA_UNUSED, void *_pd EINA_UNU
5074 CONFIG_GETS(web_backend); 5094 CONFIG_GETS(web_backend);
5075 CONFIG_GETB(offline); 5095 CONFIG_GETB(offline);
5076 CONFIG_GETI(powersave); 5096 CONFIG_GETI(powersave);
5097 CONFIG_GETD(drag_anim_duration);
5077 5098
5078 const size_t len = sizeof("audio_mute") - 1; 5099 const size_t len = sizeof("audio_mute") - 1;
5079 if (!strncmp(name, "audio_mute", len)) 5100 if (!strncmp(name, "audio_mute", len))
diff --git a/src/lib/elementary/elm_config.h b/src/lib/elementary/elm_config.h
index aa83915d1b..a9f428f01d 100644
--- a/src/lib/elementary/elm_config.h
+++ b/src/lib/elementary/elm_config.h
@@ -2201,6 +2201,25 @@ EAPI int elm_config_powersave_get(void);
2201 */ 2201 */
2202EAPI void elm_config_powersave_set(int set); 2202EAPI void elm_config_powersave_set(int set);
2203 2203
2204/**
2205 * Get the animation duration for container objects
2206 *
2207 * @return Animation duration
2208 *
2209 * @since 1.21
2210 * @see elm_config_drag_anim_duration_set()
2211 */
2212EAPI double elm_config_drag_anim_duration_get();
2213
2214/**
2215 * Set the animation duration for container objects
2216 *
2217 * @param set Animation duration
2218 *
2219 * @since 1.21
2220 * @see elm_config_drag_anim_duration_get()
2221 */
2222EAPI void elm_config_drag_anim_duration_set();
2204 2223
2205/* new efl.config interface helpers in C */ 2224/* new efl.config interface helpers in C */
2206 2225
diff --git a/src/lib/elementary/elm_priv.h b/src/lib/elementary/elm_priv.h
index 1a79d5ba81..bfb77147b4 100644
--- a/src/lib/elementary/elm_priv.h
+++ b/src/lib/elementary/elm_priv.h
@@ -327,6 +327,7 @@ struct _Elm_Config_Flags
327 Eina_Bool gl_msaa : 1; 327 Eina_Bool gl_msaa : 1;
328 Eina_Bool icon_theme : 1; 328 Eina_Bool icon_theme : 1;
329 Eina_Bool entry_select_allow : 1; // unused 329 Eina_Bool entry_select_allow : 1; // unused
330 Eina_Bool drag_anim_duration : 1;
330}; 331};
331 332
332struct _Elm_Config 333struct _Elm_Config
@@ -463,6 +464,7 @@ struct _Elm_Config
463 unsigned char entry_select_allow; 464 unsigned char entry_select_allow;
464 Eina_Bool offline; 465 Eina_Bool offline;
465 int powersave; 466 int powersave;
467 double drag_anim_duration;
466 468
467 /* Not part of the EET file */ 469 /* Not part of the EET file */
468 Eina_Bool is_mirrored : 1; 470 Eina_Bool is_mirrored : 1;