diff options
Diffstat (limited to 'src/lib/elementary')
420 files changed, 9835 insertions, 13062 deletions
diff --git a/src/lib/elementary/Efl_Ui.h b/src/lib/elementary/Efl_Ui.h index 209fa44f46..3a64e9fdb0 100644 --- a/src/lib/elementary/Efl_Ui.h +++ b/src/lib/elementary/Efl_Ui.h @@ -40,13 +40,6 @@ #include <alloca.h> #endif -#ifdef ELM_WIN32 -#include <malloc.h> -#ifndef alloca -#define alloca _alloca -#endif -#endif - #ifdef _WIN32 # define WIN32_LEAN_AND_MEAN # include <winsock2.h> @@ -112,15 +105,13 @@ extern "C" { #endif -extern EAPI double _efl_startup_time; +EAPI extern double _efl_startup_time; /** Successfully applied the requested style from the current theme. */ -extern EAPI Eina_Error EFL_UI_THEME_APPLY_ERROR_NONE; +EAPI extern Eina_Error EFL_UI_THEME_APPLY_ERROR_NONE; // EO types. Defined for legacy-only builds as legacy uses typedef of EO types. #include "efl_ui.eot.h" -#include "efl_ui_selection_types.eot.h" -#include "efl_ui_dnd_types.eot.h" //define focus manager earlier since focus object and manager is circular typedef Eo Efl_Ui_Focus_Manager; @@ -148,7 +139,6 @@ EAPI void efl_ui_focus_relation_free(Efl_Ui_Focus_Relations *rel); # include <efl_access_component.eo.h> # include <efl_access_editable_text.eo.h> # include <efl_access_selection.eo.h> -# include <efl_access_value.eo.h> # include <efl_ui_theme.eo.h> # include <efl_config_global.eo.h> @@ -229,7 +219,7 @@ typedef void (*Context_Item_Clicked_Cb)(void *data, Eo *obj, void *event_info); # include <efl_ui_textbox.eo.h> # include <efl_ui_textbox_async.eo.h> -# include <efl_ui_animation_view.eo.h> +# include <efl_ui_vg_animation.eo.h> # include <efl_ui_clock.eo.h> # include <efl_ui_video.eo.h> @@ -266,9 +256,10 @@ typedef Eo Efl_Ui_Spotlight_Indicator; # include <efl_ui_spotlight_container.eo.h> # include <efl_ui_spotlight_manager.eo.h> # include <efl_ui_spotlight_indicator.eo.h> -# include <efl_ui_spotlight_indicator_icon.eo.h> -# include <efl_ui_spotlight_manager_scroll.eo.h> -# include <efl_ui_spotlight_manager_stack.eo.h> +# include <efl_ui_spotlight_icon_indicator.eo.h> +# include <efl_ui_spotlight_scroll_manager.eo.h> +# include <efl_ui_spotlight_fade_manager.eo.h> +# include <efl_ui_spotlight_animation_manager.eo.h> # include <efl_ui_spotlight_util.eo.h> # include <efl_ui_stack.eo.h> # include <efl_ui_pager.eo.h> @@ -323,11 +314,11 @@ typedef Eo Efl_Ui_Spotlight_Indicator; # include <efl_ui_widget_focus_manager.eo.h> # include <efl_ui_selection.eo.h> # include <efl_ui_dnd.eo.h> -# include <efl_ui_dnd_container.eo.h> # include <efl_ui_timepicker.eo.h> # include <efl_ui_datepicker.eo.h> # include <efl_ui_calendar.eo.h> +# include <efl_ui_separator.eo.h> /** * Initialize Elementary diff --git a/src/lib/elementary/Elementary.h b/src/lib/elementary/Elementary.h index a3fa4f4412..8e8c198829 100644 --- a/src/lib/elementary/Elementary.h +++ b/src/lib/elementary/Elementary.h @@ -83,6 +83,9 @@ #ifdef EWAPI # undef EWAPI #endif +#ifdef EAPI_WEAK +# undef EAPI_WEAK +#endif #ifdef _WIN32 # ifdef EFL_BUILD @@ -135,6 +138,11 @@ typedef struct _Elm_Version int revision; } Elm_Version; +/** + * Elementary Version Information + * + * @ingroup Elm_General + */ EAPI extern Elm_Version *elm_version; @@ -193,7 +201,7 @@ EAPI extern Elm_Version *elm_version; #include <elm_cache.h> #include <elm_calendar.h> /* this is elm_animation_view */ -#include <efl_ui_animation_view.h> +#include <efl_ui_vg_animation.h> #include <elm_check.h> #include <elm_clock.h> #include <elm_cnp.h> diff --git a/src/lib/elementary/efl_access_object.eo b/src/lib/elementary/efl_access_object.eo index f3e70dee40..d077eaa481 100644 --- a/src/lib/elementary/efl_access_object.eo +++ b/src/lib/elementary/efl_access_object.eo @@ -1,3 +1,5 @@ +import eina_types; + enum @beta Efl.Access.Type { [[Type of accessibility object]] diff --git a/src/lib/elementary/efl_access_text.c b/src/lib/elementary/efl_access_text.c index 6f35f71471..1db4827c0d 100644 --- a/src/lib/elementary/efl_access_text.c +++ b/src/lib/elementary/efl_access_text.c @@ -18,7 +18,7 @@ EAPI elm_atspi_text_text_attribute_free(Efl_Access_Text_Attribute *attr) EAPI void elm_atspi_text_text_range_free(Efl_Access_Text_Range *range) { - free(range->content); + free((char*)range->content); free(range); } diff --git a/src/lib/elementary/efl_access_text.eo b/src/lib/elementary/efl_access_text.eo index fe76de5b6e..b40dc1a4eb 100644 --- a/src/lib/elementary/efl_access_text.eo +++ b/src/lib/elementary/efl_access_text.eo @@ -31,7 +31,7 @@ struct @beta @free(elm_atspi_text_text_range_free) Efl.Access.Text_Range [[Text range]] start_offset: int; [[Range start offset]] end_offset : int; [[Range end offset]] - content: ptr(char); [[Range content]] + content: string; [[Range content]] } struct @beta Efl.Access.Text_Change_Info @@ -66,12 +66,12 @@ interface @beta Efl.Access.Text } keys { granularity: Efl.Access.Text_Granularity; [[Text granularity]] - start_offset: ptr(int); [[Offset indicating start of string according to given granularity. - -1 in case of error.]] - end_offset: ptr(int); [[Offset indicating end of string according to given granularity. - -1 in case of error.]] } values { + start_offset: int; [[Offset indicating start of string according to given granularity. + -1 in case of error.]] + end_offset: int; [[Offset indicating end of string according to given granularity. + -1 in case of error.]] string: mstring @move; [[Newly allocated UTF-8 encoded string. Must be free by a user.]] } } @@ -105,10 +105,10 @@ interface @beta Efl.Access.Text } keys { name: string; [[Text attribute name]] - start_offset: ptr(int); [[Position in text from which given attribute is set.]] - end_offset: ptr(int); [[Position in text to which given attribute is set.]] } values { + start_offset: int; [[Position in text from which given attribute is set.]] + end_offset: int; [[Position in text to which given attribute is set.]] value: mstring @move; [[Value of text attribute. Should be free()]] } } @@ -116,11 +116,9 @@ interface @beta Efl.Access.Text [[Gets list of all text attributes.]] get { } - keys { - start_offset: ptr(int); [[Start offset]] - end_offset: ptr(int); [[End offset]] - } values { + start_offset: int; [[Start offset]] + end_offset: int; [[End offset]] attributes: list<Efl.Access.Text_Attribute> @move; [[List of text attributes]] } } diff --git a/src/lib/elementary/efl_text_interactive.eo b/src/lib/elementary/efl_text_interactive.eo index 85b5a811d7..5f463f3c41 100644 --- a/src/lib/elementary/efl_text_interactive.eo +++ b/src/lib/elementary/efl_text_interactive.eo @@ -1,18 +1,19 @@ import efl_text_types; -interface @beta Efl.Text_Interactive extends Efl.Text, Efl.Text.Font.Properties, +interface Efl.Text_Interactive extends Efl.Text, Efl.Text_Font_Properties, Efl.Text_Format, Efl.Text_Style { [[Interface for interactive (editable) text inputs (text entries). It handles cursors, edition and selection. + @since 1.24 ]] methods { @property main_cursor { [[The cursor used to insert new text, the one that's visible to the user.]] get {} values { - cursor: Efl.Text.Cursor; [[The cursor visible to the user.]] + cursor: Efl.Text_Cursor.Object; [[The cursor visible to the user.]] } } @property selection_allowed { @@ -25,16 +26,20 @@ interface @beta Efl.Text_Interactive extends Efl.Text, Efl.Text.Font.Properties, } @property selection_cursors { [[The cursors used for selection handling. - If the cursors are equal there's no selection. - - You are allowed to retain and modify them. Modifying them modifies - the selection of the object. ]] - get {} + get { + [[You are allowed to retain and modify them. Modifying them modifies + the selection of the object (recommended to extend selection range).]] + } + set { + [[The positions of passed cursors will be used to set selection cursors positions. + Further modification for passed @Efl.Text_Cursor.Object objects, will not affect selection. + Setter is recommended to set new range for selection.]] + } values { - start: Efl.Text.Cursor; [[The start of the selection.]] - end: Efl.Text.Cursor; [[The end of the selection.]] + start: Efl.Text_Cursor.Object; [[The start of the selection.]] + end: Efl.Text_Cursor.Object; [[The end of the selection.]] } } @property editable { @@ -75,7 +80,7 @@ interface @beta Efl.Text_Interactive extends Efl.Text, Efl.Text.Font.Properties, event but only the last one will emit a @[.changed,user] event. ]] have_selection,changed: bool; [[Emitted when the @.have_selection property value changes.]] - selection,changed: Efl.Text_Range; [[Emitted when selection has changed. Query using @.selection_cursors.]] + selection,changed: Eina.Range; [[Emitted when selection has changed. Query using @.selection_cursors.]] redo,request: void; [[Emitted when a redo operation is requested.]] undo,request: void; [[Emitted when a undo operation is requested.]] changed,user: Efl.Text_Change_Info; [[Emitted when the text content has changed due to user interaction.]] diff --git a/src/lib/elementary/efl_ui.eot b/src/lib/elementary/efl_ui.eot index 29832b53ba..f8be696cc0 100644 --- a/src/lib/elementary/efl_ui.eot +++ b/src/lib/elementary/efl_ui.eot @@ -1,5 +1,4 @@ /* Efl.Ui enum and struct types */ -import eina_types; /* FIXME: find a better way to express this */ error @extern Efl.Ui.Theme.Apply_Error.NONE = "Succcess"; [[Successfully applied the requested style from the current theme.]] @@ -33,7 +32,7 @@ enum Efl.Ui.Focus.Direction enum Efl.Ui.Focus.Move_Policy { [[Focus Movement Policy. - @since 1.10]] + @since 1.22]] click, [[Move focus by mouse click or touch. Elementary focus is set on mouse click and this is checked at mouse up time. (default)]] move_in, [[Move focus by mouse in. Elementary focus is set on mouse move when the @@ -45,6 +44,8 @@ enum Efl.Ui.Focus.Move_Policy enum @beta Efl.Ui.Focus.Autoscroll_Mode { [[Focus Autoscroll Mode + + @since 1.22 ]] show, [[Directly show the focused region or item automatically.]] none, [[Do not show the focused region or item automatically.]] @@ -53,10 +54,7 @@ enum @beta Efl.Ui.Focus.Autoscroll_Mode enum @beta Efl.Ui.Softcursor_Mode { - [[Software cursor mode. - - @since 1.7 - ]] + [[Software cursor mode.]] auto, [[Auto-detect if a software cursor should be used (default).]] on, [[Always use a softcursor.]] off [[Never use a softcursor.]] diff --git a/src/lib/elementary/efl_ui_alert_popup.c b/src/lib/elementary/efl_ui_alert_popup.c index 65dcb4914c..bb3d26b8de 100644 --- a/src/lib/elementary/efl_ui_alert_popup.c +++ b/src/lib/elementary/efl_ui_alert_popup.c @@ -61,7 +61,7 @@ const char * _efl_ui_alert_popup_text_get(Eo *obj EINA_UNUSED, Efl_Ui_Alert_Popup_Data *pd, const char *part) { if (!_elm_layout_part_aliasing_eval(obj, &part, EINA_TRUE)) - return EINA_FALSE; + return NULL; if (eina_streq(part, "efl.text.title")) { if (pd->title_text) diff --git a/src/lib/elementary/efl_ui_animation_view.c b/src/lib/elementary/efl_ui_animation_view.c deleted file mode 100644 index 074ebfdf8d..0000000000 --- a/src/lib/elementary/efl_ui_animation_view.c +++ /dev/null @@ -1,803 +0,0 @@ -#ifdef HAVE_CONFIG_H -# include "elementary_config.h" -#endif - -#define EFL_ACCESS_OBJECT_PROTECTED - -#include <Elementary.h> - -#include "elm_priv.h" -#include "efl_ui_animation_view_private.h" - -#define MY_CLASS EFL_UI_ANIMATION_VIEW_CLASS - -#define MY_CLASS_NAME "Efl_Ui_Animation_View" -#define MY_CLASS_NAME_LEGACY "efl_ui_animation_view" - -static const char SIG_FOCUSED[] = "focused"; -static const char SIG_UNFOCUSED[] = "unfocused"; -static const char SIG_PLAY_START[] = "play,start"; -static const char SIG_PLAY_REPEAT[] = "play,repeat"; -static const char SIG_PLAY_DONE[] = "play,done"; -static const char SIG_PLAY_PAUSE[] = "play,pause"; -static const char SIG_PLAY_RESUME[] = "play,resume"; -static const char SIG_PLAY_STOP[] = "play,stop"; -static const char SIG_PLAY_UPDATE[] = "play,update"; - -/* smart callbacks coming from Efl_Ui_Animation_View objects: */ -static const Evas_Smart_Cb_Description _smart_callbacks[] = { - {SIG_FOCUSED, ""}, - {SIG_UNFOCUSED, ""}, - {SIG_WIDGET_LANG_CHANGED, ""}, /**< handled by elm_widget */ - {SIG_PLAY_START, ""}, - {SIG_PLAY_REPEAT, ""}, - {SIG_PLAY_DONE, ""}, - {SIG_PLAY_PAUSE, ""}, - {SIG_PLAY_RESUME, ""}, - {SIG_PLAY_STOP, ""}, - {NULL, NULL} -}; - -static void -_sizing_eval(Eo *obj, void *data) -{ - Efl_Ui_Animation_View_Data *pd = data; - if (!efl_file_loaded_get(obj)) return; - - double hw,hh; - efl_gfx_hint_weight_get(obj, &hw, &hh); - - Eina_Size2D size = efl_canvas_vg_object_default_size_get(pd->vg); - - Eina_Size2D min = {-1, -1}; - if (hw == 0) min.w = size.w; - if (hh == 0) min.h = size.h; - - efl_gfx_hint_size_min_set(obj, min); -} - -static void -_size_hint_event_cb(void *data, const Efl_Event *event) -{ - _sizing_eval(event->object, data); -} - -static void -_transit_go_facade(Eo* obj, Efl_Ui_Animation_View_Data *pd) -{ - pd->repeat_times = 0; - if (pd->play_back) - pd->state = EFL_UI_ANIMATION_VIEW_STATE_PLAY_BACK; - else - pd->state = EFL_UI_ANIMATION_VIEW_STATE_PLAY; - evas_object_smart_callback_call(obj, SIG_PLAY_START, NULL); - if (pd->transit) elm_transit_go(pd->transit); -} - -static Eina_Bool -_visible_check(Eo *obj) -{ - if (!efl_gfx_entity_visible_get(obj)) return EINA_FALSE; - - //TODO: Check Smart parents visibilities? - - Eina_Size2D size = efl_gfx_entity_size_get(obj); - if (size.w == 0 || size.h == 0) return EINA_FALSE; - - Evas_Coord output_w, output_h; - evas_output_size_get(evas_object_evas_get(obj), &output_w, &output_h); - - Eina_Position2D pos = efl_gfx_entity_position_get(obj); - - //Outside viewport - if ((pos.x + size.w < 0) || (pos.x > output_w) || - (pos.y + size.h < 0) || (pos.y > output_h)) - return EINA_FALSE; - - //Inside viewport - return EINA_TRUE; -} - -static void -_auto_play(Eo *obj, Efl_Ui_Animation_View_Data *pd, Eina_Bool vis) -{ - if (!pd->auto_play || !pd->transit) return; - - //Resume Animation - if (vis) - { - if (pd->state == EFL_UI_ANIMATION_VIEW_STATE_PAUSE && pd->auto_play_pause) - { - elm_transit_paused_set(pd->transit, EINA_FALSE); - if (pd->play_back) - pd->state = EFL_UI_ANIMATION_VIEW_STATE_PLAY_BACK; - else - pd->state = EFL_UI_ANIMATION_VIEW_STATE_PLAY; - pd->auto_play_pause = EINA_FALSE; - evas_object_smart_callback_call(obj, SIG_PLAY_RESUME, NULL); - } - } - //Pause Animation - else - { - if ((pd->state == EFL_UI_ANIMATION_VIEW_STATE_PLAY) || - (pd->state == EFL_UI_ANIMATION_VIEW_STATE_PLAY_BACK)) - { - elm_transit_paused_set(pd->transit, EINA_TRUE); - pd->state = EFL_UI_ANIMATION_VIEW_STATE_PAUSE; - pd->auto_play_pause = EINA_TRUE; - evas_object_smart_callback_call(obj, SIG_PLAY_PAUSE, NULL); - } - } -} - -static void -_transit_del_cb(Elm_Transit_Effect *effect, Elm_Transit *transit) -{ - Eo *obj = (Eo *) effect; - EFL_UI_ANIMATION_VIEW_DATA_GET(obj, pd); - if (!pd) return; - - if ((pd->state == EFL_UI_ANIMATION_VIEW_STATE_PLAY && pd->progress == 1) || - (pd->state == EFL_UI_ANIMATION_VIEW_STATE_PLAY_BACK && pd->progress == 0)) - evas_object_smart_callback_call(obj, SIG_PLAY_DONE, NULL); - - if (pd->transit != transit) return; - - Efl_Ui_Animation_View_State prev_state = pd->state; - pd->state = EFL_UI_ANIMATION_VIEW_STATE_STOP; - pd->transit = NULL; - pd->auto_play_pause = EINA_FALSE; - - if (prev_state != EFL_UI_ANIMATION_VIEW_STATE_STOP) - { - evas_object_smart_callback_call(obj, SIG_PLAY_STOP, NULL); - pd->progress = 0; - } -} - -static void -_transit_cb(Elm_Transit_Effect *effect, Elm_Transit *transit, double progress) -{ - Eo *obj = (Eo *) effect; - EFL_UI_ANIMATION_VIEW_DATA_GET(obj, pd); - - if (!pd || !pd->vg) - { - ERR("Vector Object is removed in wrong way!, Efl_Ui_Animation_View = %p", obj); - elm_transit_del(transit); - return; - } - - if (pd->play_back) - { - pd->state = EFL_UI_ANIMATION_VIEW_STATE_PLAY_BACK; - progress = 1 - progress; - } - else pd->state = EFL_UI_ANIMATION_VIEW_STATE_PLAY; - - pd->progress = progress; - int minframe = (pd->frame_cnt - 1) * pd->min_progress; - int maxframe = (pd->frame_cnt - 1) * pd->max_progress; - - int update_frame = (int)((maxframe - minframe) * progress) + minframe; - int current_frame = evas_object_vg_animated_frame_get(pd->vg); - evas_object_vg_animated_frame_set(pd->vg, update_frame); - - if (pd->auto_repeat) - { - int repeat_times = elm_transit_current_repeat_times_get(pd->transit); - if (pd->repeat_times != repeat_times) - { - evas_object_smart_callback_call(obj, SIG_PLAY_REPEAT, NULL); - pd->repeat_times = repeat_times; - } - } - - //transit_cb is always called with a progress value 0 ~ 1. - //SIG_PLAY_UPDATE callback is called only when there is a real change. - if (update_frame != current_frame) - evas_object_smart_callback_call(obj, SIG_PLAY_UPDATE, NULL); -} - -EOLIAN static void -_efl_ui_animation_view_efl_canvas_group_group_add(Eo *obj, Efl_Ui_Animation_View_Data *priv) -{ - efl_canvas_group_add(efl_super(obj, MY_CLASS)); - elm_widget_sub_object_parent_add(obj); - - // Create vg to render vector animation - Eo *vg = evas_object_vg_add(evas_object_evas_get(obj)); - elm_widget_resize_object_set(obj, vg); - efl_event_callback_add(obj, EFL_GFX_ENTITY_EVENT_HINTS_CHANGED, _size_hint_event_cb, priv); - - priv->vg = vg; - priv->speed = 1; - priv->frame_duration = 0; - priv->min_progress = 0.0; - priv->max_progress = 1.0; -} - -EOLIAN static void -_efl_ui_animation_view_efl_canvas_group_group_del(Eo *obj, Efl_Ui_Animation_View_Data *pd EINA_UNUSED) -{ - if (pd->transit) - { - Elm_Transit *transit = pd->transit; - pd->transit = NULL; //Skip perform transit_del_cb() - elm_transit_del(transit); - } - pd->state = EFL_UI_ANIMATION_VIEW_STATE_NOT_READY; - - efl_canvas_group_del(efl_super(obj, MY_CLASS)); -} - -EOLIAN static void -_efl_ui_animation_view_efl_object_destructor(Eo *obj, - Efl_Ui_Animation_View_Data *pd EINA_UNUSED) -{ - Efl_Gfx_Vg_Value_Provider *vp; - EINA_LIST_FREE(pd->vp_list, vp) - efl_unref(vp); - eina_list_free(pd->vp_list); - - efl_destructor(efl_super(obj, MY_CLASS)); -} - -EOLIAN static Eo * -_efl_ui_animation_view_efl_object_constructor(Eo *obj, - Efl_Ui_Animation_View_Data *pd EINA_UNUSED) -{ - obj = efl_constructor(efl_super(obj, MY_CLASS)); - efl_canvas_object_type_set(obj, MY_CLASS_NAME_LEGACY); - evas_object_smart_callbacks_descriptions_set(obj, _smart_callbacks); - - return obj; -} - -static void -_update_frame_duration(Efl_Ui_Animation_View_Data *pd) -{ - int frame_count = evas_object_vg_animated_frame_count_get(pd->vg); - int min_frame = (frame_count - 1) * pd->min_progress; - int max_frame = (frame_count - 1) * pd->max_progress; - double frame_rate = round((double)frame_count / evas_object_vg_animated_frame_duration_get(pd->vg, 0, 0)); - - pd->frame_duration = (double)(max_frame - min_frame) / frame_rate; - if (pd->transit) - elm_transit_duration_set(pd->transit, pd->frame_duration * (1/pd->speed)); -} - -static Eina_Bool -_ready_play(Eo *obj, Efl_Ui_Animation_View_Data *pd) -{ - pd->auto_play_pause = EINA_FALSE; - pd->state = EFL_UI_ANIMATION_VIEW_STATE_STOP; - - if (pd->transit) elm_transit_del(pd->transit); - - pd->frame_cnt = (double) evas_object_vg_animated_frame_count_get(pd->vg); - pd->frame_duration = evas_object_vg_animated_frame_duration_get(pd->vg, 0, 0); - evas_object_vg_animated_frame_set(pd->vg, 0); - - if (pd->frame_duration > 0) - { - Elm_Transit *transit = elm_transit_add(); - elm_transit_object_add(transit, pd->vg); - if (pd->auto_repeat) elm_transit_repeat_times_set(transit, -1); - elm_transit_effect_add(transit, _transit_cb, obj, _transit_del_cb); - elm_transit_progress_value_set(transit, pd->progress); - elm_transit_objects_final_state_keep_set(transit, EINA_TRUE); - pd->transit = transit; - if (pd->min_progress != 0.0 || pd->max_progress != 1.0) - _update_frame_duration(pd); - else - elm_transit_duration_set(transit, pd->frame_duration * (1/pd->speed)); - - return EINA_TRUE; - } - return EINA_FALSE; -} - -EOLIAN static void -_efl_ui_animation_view_efl_file_unload(Eo *obj EINA_UNUSED, Efl_Ui_Animation_View_Data *pd) -{ - pd->state = EFL_UI_ANIMATION_VIEW_STATE_NOT_READY; - pd->frame_cnt = 0; - pd->frame_duration = 0; - if (pd->transit) elm_transit_del(pd->transit); -} - -EOLIAN static Eina_Error -_efl_ui_animation_view_efl_file_load(Eo *obj, Efl_Ui_Animation_View_Data *pd) -{ - Eina_Error err; - Eina_Bool ret; - const char *file; - const char *key; - - if (efl_file_loaded_get(obj)) return 0; - - err = efl_file_load(efl_super(obj, MY_CLASS)); - if (err) return err; - - file = efl_file_get(obj); - key = efl_file_key_get(obj); - ret = efl_file_simple_load(pd->vg, file, key); - if (!ret) - { - efl_file_unload(obj); - return eina_error_get(); - } - - pd->progress = 0; - - _sizing_eval(obj, pd); - - if (!_ready_play(obj, pd)) return 1; - - if (pd->auto_play) - { - _transit_go_facade(obj, pd); - - if (!_visible_check(obj)) - { - elm_transit_paused_set(pd->transit, EINA_TRUE); - pd->state = EFL_UI_ANIMATION_VIEW_STATE_PAUSE; - pd->auto_play_pause = EINA_TRUE; - evas_object_smart_callback_call(obj, SIG_PLAY_PAUSE, NULL); - } - } - return 0; -} - -EOLIAN static void -_efl_ui_animation_view_efl_gfx_entity_position_set(Eo *obj, - Efl_Ui_Animation_View_Data *pd, - Eina_Position2D pos EINA_UNUSED) -{ - if (_evas_object_intercept_call(obj, EVAS_OBJECT_INTERCEPT_CB_MOVE, 0, pos.x, pos.y)) - return; - - efl_gfx_entity_position_set(efl_super(obj, MY_CLASS), pos); - - _auto_play(obj, pd, _visible_check(obj)); -} - -EOLIAN static void -_efl_ui_animation_view_efl_gfx_entity_size_set(Eo *obj, - Efl_Ui_Animation_View_Data *pd, - Eina_Size2D size) -{ - if (_evas_object_intercept_call(obj, EVAS_OBJECT_INTERCEPT_CB_RESIZE, 0, size.w, size.h)) - return; - - efl_gfx_entity_size_set(efl_super(obj, MY_CLASS), size); - - _sizing_eval(obj, pd); - - _auto_play(obj, pd, _visible_check(obj)); -} - -EOLIAN static void -_efl_ui_animation_view_efl_gfx_entity_visible_set(Eo *obj, - Efl_Ui_Animation_View_Data *pd, - Eina_Bool vis) -{ - if (_evas_object_intercept_call(obj, EVAS_OBJECT_INTERCEPT_CB_VISIBLE, 0, vis)) - return; - - efl_gfx_entity_visible_set(efl_super(obj, MY_CLASS), vis); - - _auto_play(obj, pd, _visible_check(obj)); -} - -EOLIAN static void -_efl_ui_animation_view_efl_gfx_view_view_size_set(Eo *obj EINA_UNUSED, - Efl_Ui_Animation_View_Data *pd, - Eina_Size2D size) -{ - Eina_Rect viewbox; - viewbox.x = viewbox.y =0; - viewbox.w = size.w; - viewbox.h = size.h; - - efl_canvas_vg_object_viewbox_set(pd->vg, viewbox); -} - -EOLIAN Eina_Size2D -_efl_ui_animation_view_efl_gfx_view_view_size_get(const Eo *obj EINA_UNUSED, - Efl_Ui_Animation_View_Data *pd) -{ - Eina_Rect viewbox = efl_canvas_vg_object_viewbox_get(pd->vg); - - return EINA_SIZE2D(viewbox.w, viewbox.h); -} - -EOLIAN static void -_efl_ui_animation_view_auto_repeat_set(Eo *obj EINA_UNUSED, Efl_Ui_Animation_View_Data *pd, Eina_Bool auto_repeat) -{ - if (pd->auto_repeat == auto_repeat) return; - pd->auto_repeat = auto_repeat; - if (pd->transit) - { - if (auto_repeat) elm_transit_repeat_times_set(pd->transit, -1); - else elm_transit_repeat_times_set(pd->transit, 0); - } -} - -EOLIAN static Eina_Bool -_efl_ui_animation_view_auto_repeat_get(const Eo *obj EINA_UNUSED, Efl_Ui_Animation_View_Data *pd) -{ - return pd->auto_repeat; -} - -EOLIAN static void -_efl_ui_animation_view_auto_play_set(Eo *obj EINA_UNUSED, Efl_Ui_Animation_View_Data *pd, - Eina_Bool auto_play) -{ - pd->auto_play = auto_play; - if (!auto_play) pd->auto_play_pause = EINA_FALSE; -} - -EOLIAN static Eina_Bool -_efl_ui_animation_view_auto_play_get(const Eo *obj EINA_UNUSED, Efl_Ui_Animation_View_Data *pd) -{ - return pd->auto_play; -} - -EOLIAN static Eina_Bool -_efl_ui_animation_view_play(Eo *obj, Efl_Ui_Animation_View_Data *pd) -{ - if (pd->state == EFL_UI_ANIMATION_VIEW_STATE_PLAY) return EINA_FALSE; - - Eina_Bool rewind = EINA_FALSE; - if (pd->state == EFL_UI_ANIMATION_VIEW_STATE_PLAY_BACK) rewind = EINA_TRUE; - - pd->play_back = EINA_FALSE; - pd->auto_play_pause = EINA_FALSE; - - if (!efl_file_loaded_get(obj)) return EINA_FALSE; - if (!pd->transit && !_ready_play(obj, pd)) return EINA_FALSE; - - if (pd->state == EFL_UI_ANIMATION_VIEW_STATE_STOP) - _transit_go_facade(obj, pd); - else if (rewind) - elm_transit_progress_value_set(pd->transit, pd->progress); - - return EINA_TRUE; -} - -Eina_Bool _efl_ui_animation_view_play_sector(Eo *obj, Efl_Ui_Animation_View_Data *pd, const char *start, const char *end) -{ - int start_frame = 0; - int end_frame = evas_object_vg_animated_frame_count_get(pd->vg) - 1; - - if (start && end) - { - efl_gfx_frame_controller_sector_get(pd->vg, start, &start_frame, NULL); - efl_gfx_frame_controller_sector_get(pd->vg, end, &end_frame, NULL); - } - else - { - if (start) - { - efl_gfx_frame_controller_sector_get(pd->vg, start, &start_frame, &end_frame); - } - else if (end) - { - efl_gfx_frame_controller_sector_get(pd->vg, end, &end_frame, NULL); - } - } - - efl_ui_animation_view_min_frame_set(obj, start_frame); - if (start_frame < end_frame) - efl_ui_animation_view_max_frame_set(obj, end_frame); - - if (!efl_ui_animation_view_play(obj)) - return EINA_FALSE; - return EINA_TRUE; -} - -EOLIAN static Eina_Bool -_efl_ui_animation_view_stop(Eo *obj, Efl_Ui_Animation_View_Data *pd) -{ - if (!pd->transit) return EINA_FALSE; - - if ((pd->state == EFL_UI_ANIMATION_VIEW_STATE_NOT_READY) || - (pd->state == EFL_UI_ANIMATION_VIEW_STATE_STOP)) - return EINA_FALSE; - - evas_object_vg_animated_frame_set(pd->vg, 0); - pd->progress = 0; - pd->state = EFL_UI_ANIMATION_VIEW_STATE_STOP; - evas_object_smart_callback_call(obj, SIG_PLAY_STOP, NULL); - elm_transit_del(pd->transit); - - return EINA_TRUE; -} - -EOLIAN static Eina_Bool -_efl_ui_animation_view_pause(Eo *obj, Efl_Ui_Animation_View_Data *pd) -{ - if (!pd->transit) return EINA_FALSE; - - if ((pd->state == EFL_UI_ANIMATION_VIEW_STATE_PLAY) || - (pd->state == EFL_UI_ANIMATION_VIEW_STATE_PLAY_BACK)) - { - elm_transit_paused_set(pd->transit, EINA_TRUE); - pd->state = EFL_UI_ANIMATION_VIEW_STATE_PAUSE; - pd->auto_play_pause = EINA_FALSE; - evas_object_smart_callback_call(obj, SIG_PLAY_PAUSE, NULL); - return EINA_TRUE; - } - - return EINA_FALSE; -} - -EOLIAN static Eina_Bool -_efl_ui_animation_view_resume(Eo *obj, Efl_Ui_Animation_View_Data *pd) -{ - if (!pd->transit) return EINA_FALSE; - - if (pd->state == EFL_UI_ANIMATION_VIEW_STATE_PAUSE) - { - elm_transit_paused_set(pd->transit, EINA_FALSE); - if (pd->play_back) - pd->state = EFL_UI_ANIMATION_VIEW_STATE_PLAY_BACK; - else - pd->state = EFL_UI_ANIMATION_VIEW_STATE_PLAY; - pd->auto_play_pause = EINA_FALSE; - - evas_object_smart_callback_call(obj, SIG_PLAY_RESUME, NULL); - - return EINA_TRUE; - } - - return EINA_FALSE; -} - -EOLIAN static Eina_Bool -_efl_ui_animation_view_play_back(Eo *obj, Efl_Ui_Animation_View_Data *pd) -{ - if (pd->state == EFL_UI_ANIMATION_VIEW_STATE_PLAY_BACK) return EINA_FALSE; - - Eina_Bool rewind = EINA_FALSE; - if (pd->state == EFL_UI_ANIMATION_VIEW_STATE_PLAY) rewind = EINA_TRUE; - - pd->play_back = EINA_TRUE; - pd->auto_play_pause = EINA_FALSE; - - if (!efl_file_loaded_get(obj)) return EINA_FALSE; - if (!pd->transit && !_ready_play(obj, pd)) return EINA_FALSE; - - if (pd->state == EFL_UI_ANIMATION_VIEW_STATE_STOP) - { - if (pd->progress == 0) pd->progress = 1.0; - _transit_go_facade(obj, pd); - } - else if (rewind) - elm_transit_progress_value_set(pd->transit, 1 - pd->progress); - - return EINA_TRUE; -} - -EOLIAN static Eina_Bool -_efl_ui_animation_view_speed_set(Eo *obj EINA_UNUSED, Efl_Ui_Animation_View_Data *pd, double speed) -{ - if (speed <= 0) return EINA_FALSE; - pd->speed = speed; - - if (pd->transit) - elm_transit_duration_set(pd->transit, pd->frame_duration * (1/pd->speed)); - - return EINA_TRUE; -} - -EOLIAN static void -_efl_ui_animation_view_progress_set(Eo *obj EINA_UNUSED, Efl_Ui_Animation_View_Data *pd, double progress) -{ - if (progress < 0) progress = 0; - else if (progress > 1) progress = 1; - if (pd->progress == progress) return; - - pd->progress = progress; - - if (pd->frame_cnt > 0) - evas_object_vg_animated_frame_set(pd->vg, (int) ((pd->frame_cnt - 1) * progress)); - - if (pd->transit) - { - if (pd->play_back) - elm_transit_progress_value_set(pd->transit, 1 - progress); - else - elm_transit_progress_value_set(pd->transit, progress); - } -} - -EOLIAN static double -_efl_ui_animation_view_progress_get(const Eo *obj EINA_UNUSED, Efl_Ui_Animation_View_Data *pd) -{ - return pd->progress; -} - -EOLIAN static void -_efl_ui_animation_view_frame_set(Eo *obj EINA_UNUSED, Efl_Ui_Animation_View_Data *pd, int frame_num) -{ - efl_ui_animation_view_progress_set(obj, (double) frame_num / (double) (evas_object_vg_animated_frame_count_get(pd->vg) - 1)); -} - -EOLIAN static int -_efl_ui_animation_view_frame_get(const Eo *obj EINA_UNUSED, Efl_Ui_Animation_View_Data *pd) -{ - double progress = (pd->progress * (pd->max_progress - pd->min_progress)) + pd->min_progress; - return (int) ((double) (evas_object_vg_animated_frame_count_get(pd->vg) - 1) * progress); -} - -EOLIAN static double -_efl_ui_animation_view_speed_get(const Eo *obj EINA_UNUSED, Efl_Ui_Animation_View_Data *pd) -{ - return pd->speed; -} - -EOLIAN static double -_efl_ui_animation_view_duration_time_get(const Eo *obj EINA_UNUSED, Efl_Ui_Animation_View_Data *pd) -{ - return pd->frame_duration; -} - -EOLIAN static Eina_Size2D -_efl_ui_animation_view_default_view_size_get(const Eo *obj EINA_UNUSED, - Efl_Ui_Animation_View_Data *pd EINA_UNUSED) -{ - return efl_canvas_vg_object_default_size_get(pd->vg); -} - -EOLIAN static Efl_Ui_Animation_View_State -_efl_ui_animation_view_state_get(const Eo *obj EINA_UNUSED, Efl_Ui_Animation_View_Data *pd) -{ - return pd->state; -} - -EOLIAN static Eina_Bool -_efl_ui_animation_view_is_playing_back(Eo *obj EINA_UNUSED, Efl_Ui_Animation_View_Data *pd) -{ - return pd->play_back; -} - -EOLIAN static int -_efl_ui_animation_view_frame_count_get(const Eo *obj EINA_UNUSED, Efl_Ui_Animation_View_Data *pd) -{ - return efl_gfx_frame_controller_frame_count_get(pd->vg); -} - -EOLIAN static void -_efl_ui_animation_view_min_progress_set(Eo *obj EINA_UNUSED, Efl_Ui_Animation_View_Data *pd, double min_progress) -{ - if (min_progress < 0.0 || min_progress > 1.0 || min_progress > pd->max_progress) return; - - pd->min_progress = min_progress; - _update_frame_duration(pd); -} - -EOLIAN static double -_efl_ui_animation_view_min_progress_get(const Eo *obj EINA_UNUSED, Efl_Ui_Animation_View_Data *pd) -{ - return pd->min_progress; -} - -EOLIAN static void -_efl_ui_animation_view_max_progress_set(Eo *obj EINA_UNUSED, Efl_Ui_Animation_View_Data *pd, double max_progress) -{ - if (max_progress < 0.0 || max_progress > 1.0 || max_progress < pd->min_progress) return; - - pd->max_progress = max_progress; - _update_frame_duration(pd); -} - -EOLIAN static double -_efl_ui_animation_view_max_progress_get(const Eo *obj EINA_UNUSED, Efl_Ui_Animation_View_Data *pd) -{ - return pd->max_progress; -} - -EOLIAN static void -_efl_ui_animation_view_min_frame_set(Eo *obj EINA_UNUSED, Efl_Ui_Animation_View_Data *pd, int min_frame) -{ - int frame_count = evas_object_vg_animated_frame_count_get(pd->vg); - if (min_frame < 0) min_frame = 0; - else - { - int max_frame = (frame_count - 1) * pd->max_progress; - if (min_frame > max_frame) min_frame = max_frame; - } - - pd->min_progress = (double)min_frame / (double)(frame_count - 1); - _update_frame_duration(pd); -} - -EOLIAN static int -_efl_ui_animation_view_min_frame_get(const Eo *obj EINA_UNUSED, Efl_Ui_Animation_View_Data *pd) -{ - return pd->min_progress * (evas_object_vg_animated_frame_count_get(pd->vg) - 1); -} - -EOLIAN static void -_efl_ui_animation_view_max_frame_set(Eo *obj EINA_UNUSED, Efl_Ui_Animation_View_Data *pd, int max_frame) -{ - int frame_count = evas_object_vg_animated_frame_count_get(pd->vg); - if (max_frame > frame_count - 1) max_frame = frame_count - 1; - else - { - int min_frame = (frame_count - 1) * pd->min_progress; - if (min_frame > max_frame) max_frame = min_frame; - } - - pd->max_progress = (double)max_frame / (double)(frame_count - 1); - _update_frame_duration(pd); -} - -EOLIAN static int -_efl_ui_animation_view_max_frame_get(const Eo *obj EINA_UNUSED, Efl_Ui_Animation_View_Data *pd) -{ - return pd->max_progress * (evas_object_vg_animated_frame_count_get(pd->vg) - 1); -} - -EOLIAN static void -_efl_ui_animation_view_value_provider_override(Eo *obj EINA_UNUSED, Efl_Ui_Animation_View_Data *pd, Efl_Gfx_Vg_Value_Provider *value_provider) -{ - if (!value_provider) return; - - if (pd->vp_list) - { - const char *keypath1 = efl_gfx_vg_value_provider_keypath_get(value_provider); - if (!keypath1) - { - ERR("Couldn't override Value Provider(%p). Keypath is NULL.", value_provider); - return; - } - const Eina_List *l; - Efl_Gfx_Vg_Value_Provider *_vp; - EINA_LIST_FOREACH(pd->vp_list, l, _vp) - { - const char *keypath2 = efl_gfx_vg_value_provider_keypath_get(_vp); - if (!strcmp(keypath1, keypath2)) - { - pd->vp_list = eina_list_remove(pd->vp_list, _vp); - efl_unref(_vp); - break; - } - } - } - - efl_ref(value_provider); - pd->vp_list = eina_list_append(pd->vp_list, value_provider); - efl_key_data_set(pd->vg, "_vg_value_providers", pd->vp_list); -} - -EAPI Elm_Animation_View* -elm_animation_view_add(Evas_Object *parent) -{ - EINA_SAFETY_ON_NULL_RETURN_VAL(parent, NULL); - return elm_legacy_add(MY_CLASS, parent); -} - -EAPI Eina_Bool -elm_animation_view_file_set(Elm_Animation_View *obj, const char *file, const char *key) -{ - return efl_file_simple_load(obj, file, key); -} - -EAPI Elm_Animation_View_State -elm_animation_view_state_get(Elm_Animation_View *obj) -{ - return efl_ui_animation_view_state_get(obj); -} - -/* Internal EO APIs and hidden overrides */ - -#define EFL_UI_ANIMATION_VIEW_EXTRA_OPS \ - EFL_CANVAS_GROUP_ADD_DEL_OPS(efl_ui_animation_view) - -#include "efl_ui_animation_view_eo.legacy.c" -#include "efl_ui_animation_view.eo.c" diff --git a/src/lib/elementary/efl_ui_animation_view.eo b/src/lib/elementary/efl_ui_animation_view.eo deleted file mode 100644 index f06c9b1ce2..0000000000 --- a/src/lib/elementary/efl_ui_animation_view.eo +++ /dev/null @@ -1,313 +0,0 @@ - -enum @beta Efl.Ui.Animation_View_State -{ - [[State of animation view]] - not_ready, [[Animation is not ready to play. (Probably, it didn't file set yet or failed to read file.]] - play, [[Animation is playing. See @Efl.Ui.Animation_View.play.]] - play_back, [[Animation is playing back (rewinding). See @Efl.Ui.Animation_View.play_back.]] - pause, [[Animation has been paused. To continue animation call @Efl.Ui.Animation_View.resume. - See @Efl.Ui.Animation_View.pause.]] - stop [[Animation view successfully loaded a file then readied for playing. - Otherwise after finished animation or stopped forcibly by request. See @Efl.Ui.Animation_View.stop.]] -} - -class @beta Efl.Ui.Animation_View extends Efl.Ui.Widget implements Efl.Gfx.View, Efl.File -{ - [[Elementary Animation view class. - Animation view is designed to show and play animation of - vector graphics based content. It hides all @Efl.Canvas.Vg.Object details - but just open an API to read vector data from file. Also, it implements - details of animation control methods of Vector. - - Vector data could contain static or animatable vector elements including - animation information. Available vector data file formats are SVG, JSON and EET. - @Efl.Ui.Animation_View currently only supports the animation information contained in - JSON (known as Lottie file as well) and EET files. - ]] - event_c_prefix: efl_ui_animation_view; - methods { - @property auto_play { - [[Animation will be started automatically when it's possible. - - If @.auto_play is $true, animation will be started when it's readied. - The condition of $auto play is when animation view opened file successfully, - yet to play it plus when the object is visible. - If animation view is disabled, invisible, - it turns to pause state then resume animation when it's visible again. - - $true Enable auto play mode, disable otherwise. - - Warning: This auto play will be only affected to the next animation source. - So must be called before setting animation file. - ]] - set { - } - get { - } - values { - auto_play: bool(false); [[Auto play mode.]] - } - } - @property auto_repeat { - [[Turn on/off animation looping. - - If @.auto_repeat is $true, it repeats animation when animation frame is reached to - end. This auto repeat mode is valid to both play and play_back cases. - - $true Enable auto play mode, disable otherwise. - ]] - set { - } - get { - } - values { - auto_repeat: bool; [[Loop mode, Default is $false.]] - } - } - @property speed { - [[Control animation speed. - - Control animation speed by multiplying $speed value. If you want to play - animation double-time faster, you can give $speed 2. If you want to play - animation double-time slower, you can give $speed 0.5. - - Warning: speed must be greater than zero. - ]] - set { - return: bool; [[$true when it's successful. $false otherwise.]] - } - get { - } - values { - speed: double(1.0); [[Speed factor.]] - } - } - @property duration_time { - [[Get the duration of animation in seconds. - - This API returns total duration time of current animation in the seconds. - If current animation source isn't animatable, it returns zero. - ]] - get { - } - values { - frame_duration: double; [[duration time in the seconds]] - } - } - @property progress { - [[Set current progress position of animation view object. - - When you required to jump on a certain frame instantly, - you can change current position by using this API. - - Warning: The range of progress is 0 ~ 1. - ]] - set { - } - get { - } - values { - progress: double; [[Progress position. Value must be 0 ~ 1.]] - } - } - @property frame { - [[Number of current frame. - - Ranges from 0 to @.frame_count - 1. - ]] - set { - } - get { - } - values { - frame_num: int; [[Current frame number.]] - } - } - play { - [[Play animation one time instantly when it's available. - - If current keyframe is on a certain position by playing back, this will - play forward from there. - - Warning: Play request will be ignored if animation source is not set yet or - animation is paused state or it's already on playing. - ]] - - return: bool; [[$true when it's successful. $false otherwise.]] - } - play_sector { - [[Play animation of sector one time instantly when it's available. - - If end sector is NULL, only start sector is referenced. - If both the start and end sectors are valid, - Play is played and stoped at starting point of each sector. - - If start is null and end is valid, playback starts from 0 frame to the start frame of the end sector. - If both sectors start and end are invalid. Play from 0 frame to the last frame of animation view object. - - Note: This method use to @.min_frame, @.max_frame (@.min_progress, @.max_progress) internally. - So if you have changed the min or max frame(progress) it can be changed to the sector frame. - ]] - params { - @in start: string; [[ The name of start sector ]] - @in end: string; [[ The name of end sector ]] - } - return: bool; [[$true when it's successful. $false otherwise.]] - } - play_back { - [[Play back animation one time instantly when it's available. - - If current keyframe is on a certain position by playing, this will - play backward from there. - - Warning: Play back request will be ignored if animation source is not set yet or - animation is paused state or it's already on playing back. - ]] - - return: bool; [[$true when it's successful. $false otherwise.]] - } - pause { - [[Pause current animation instantly. - - Once animation is paused, animation view must get resume to play continue again. - - Warning: Animation must be on playing or playing back status. - ]] - - return: bool; [[$true when it's successful. $false otherwise.]] - } - resume { - [[Resume paused animation to continue animation. - - Warning: This resume must be called on animation paused status. - ]] - - return: bool; [[$true when it's successful. $false otherwise.]] - } - stop { - [[Stop playing animation. - - Stop animation instantly regardless of its status and reset to - show first frame of animation. Even though current animation is paused, - the animation status will be stopped. - ]] - - return: bool; [[$true when it's successful. $false otherwise.]] - } - @property default_view_size { - [[The default view size that specified from vector resource. - ]] - get { - } - values { - size: Eina.Size2D; - } - } - @property state { - [[Current animation view state. - See @Efl.Ui.Animation_View_State - ]] - get{ - } - values { - state: Efl.Ui.Animation_View_State; [[Current animation view state]] - } - } - is_playing_back { - [[Returns the status whether current animation is on playing forward or backward. - Note: If animation view is not on playing, it will return $false. - ]] - return: bool; [[$true, if animation on playing back, $false otherwise.]] - } - @property frame_count { - [[The index of end frame of the animation view, if it's animated. - Note : frame number starts with 0. - ]] - get { - } - values { - frame_count: int; [[The number of frames. 0, if it's not animated.]] - } - } - @property min_progress { - [[The start progress of the play. - ]] - set { - } - get { - } - values { - min_progress: double(0.0); [[The minimum progress. Value must be 0 ~ 1.]] - } - } - @property max_progress { - [[The last progress of the play. - ]] - set { - } - get { - } - values { - max_progress: double(1.0); [[The maximum progress. Value must be 0 ~ 1.]] - } - } - @property min_frame { - [[The start frame of the play. - ]] - set { - } - get { - } - values { - min_frame: int(0); [[The minimum frame for play. Value must be 0 ~ @.max_frame]] - } - } - @property max_frame { - [[The last frame of the play. - ]] - set { - } - get { - } - values { - max_frame: int; [[The maximum frame for play. Value must be @.min_frame ~ (@.frame_count - 1). - The default value is @.frame_count - 1. - ]] - } - } - value_provider_override{ - [[Override each value of the animation object. - Values can be properties of Efl.Gfx.Vg.Value_provider such as color and matrix information. - - Example: - Eo *vp = efl_add(EFL_GFX_VG_VALUE_PROVIDER_CLASS, NULL); - @Efl.Gfx.Vg.Value_Provider.keypath.set(vp, "SomeLayer:SomeObject:SomeContents"); - // Set vp property - @.value_provider_override(target_animation_view, vg); - See @Efl.Gfx.Vg.Value_Provider - ]] - params { - value_provider: Efl.Gfx.Vg.Value_Provider; [[ Override the values of the animation object. this should have keypath infomation. See @Efl.Gfx.Vg.Value_Provider ]] - } - } - } - implements { - Efl.Object.constructor; - Efl.Object.destructor; - Efl.File.load; - Efl.File.unload; - Efl.Gfx.Entity.visible { set; } - Efl.Gfx.Entity.position { set; } - Efl.Gfx.Entity.size { set; } - Efl.Gfx.View.view_size { set; get; } - } - events { - play,start: void; [[Called when animation is just started]] - play,repeat: void; [[Called when animation is just repeated]] - play,done: void; [[Called when animation is just finished]] - play,pause: void; [[Called when animation is just paused]] - play,resume: void; [[Called when animation is just resumed]] - play,stop: void; [[Called when animation is just stopped]] - play,update: void; [[Called when animation is just updated]] - } -} diff --git a/src/lib/elementary/efl_ui_animation_view_eo.legacy.c b/src/lib/elementary/efl_ui_animation_view_eo.legacy.c deleted file mode 100644 index 87ed3232d1..0000000000 --- a/src/lib/elementary/efl_ui_animation_view_eo.legacy.c +++ /dev/null @@ -1,162 +0,0 @@ - -EAPI void -elm_animation_view_auto_play_set(Efl_Ui_Animation_View *obj, Eina_Bool auto_play) -{ - efl_ui_animation_view_auto_play_set(obj, auto_play); -} - -EAPI Eina_Bool -elm_animation_view_auto_play_get(const Efl_Ui_Animation_View *obj) -{ - return efl_ui_animation_view_auto_play_get(obj); -} - -EAPI void -elm_animation_view_auto_repeat_set(Efl_Ui_Animation_View *obj, Eina_Bool auto_repeat) -{ - efl_ui_animation_view_auto_repeat_set(obj, auto_repeat); -} - -EAPI Eina_Bool -elm_animation_view_auto_repeat_get(const Efl_Ui_Animation_View *obj) -{ - return efl_ui_animation_view_auto_repeat_get(obj); -} - -EAPI Eina_Bool -elm_animation_view_speed_set(Efl_Ui_Animation_View *obj, double speed) -{ - return efl_ui_animation_view_speed_set(obj, speed); -} - -EAPI double -elm_animation_view_speed_get(const Efl_Ui_Animation_View *obj) -{ - return efl_ui_animation_view_speed_get(obj); -} - -EAPI double -elm_animation_view_duration_time_get(const Efl_Ui_Animation_View *obj) -{ - return efl_ui_animation_view_duration_time_get(obj); -} - -EAPI void -elm_animation_view_progress_set(Efl_Ui_Animation_View *obj, double progress) -{ - efl_ui_animation_view_progress_set(obj, progress); -} - -EAPI double -elm_animation_view_progress_get(const Efl_Ui_Animation_View *obj) -{ - return efl_ui_animation_view_progress_get(obj); -} - -EAPI void -elm_animation_view_frame_set(Efl_Ui_Animation_View *obj, int frame_num) -{ - efl_ui_animation_view_frame_set(obj, frame_num); -} - -EAPI int -elm_animation_view_frame_get(const Efl_Ui_Animation_View *obj) -{ - return efl_ui_animation_view_frame_get(obj); -} - -EAPI Eina_Bool -elm_animation_view_play(Efl_Ui_Animation_View *obj) -{ - return efl_ui_animation_view_play(obj); -} - -EAPI Eina_Bool -elm_animation_view_play_back(Efl_Ui_Animation_View *obj) -{ - return efl_ui_animation_view_play_back(obj); -} - -EAPI Eina_Bool -elm_animation_view_pause(Efl_Ui_Animation_View *obj) -{ - return efl_ui_animation_view_pause(obj); -} - -EAPI Eina_Bool -elm_animation_view_resume(Efl_Ui_Animation_View *obj) -{ - return efl_ui_animation_view_resume(obj); -} - -EAPI Eina_Bool -elm_animation_view_stop(Efl_Ui_Animation_View *obj) -{ - return efl_ui_animation_view_stop(obj); -} - -EAPI Eina_Size2D -elm_animation_view_default_size_get(const Efl_Ui_Animation_View *obj) -{ - return efl_ui_animation_view_default_view_size_get(obj); -} - -EAPI Eina_Bool -elm_animation_view_is_playing_back(Efl_Ui_Animation_View *obj) -{ - return efl_ui_animation_view_is_playing_back(obj); -} - -EAPI int -elm_animation_view_frame_count_get(const Efl_Ui_Animation_View *obj) -{ - return efl_ui_animation_view_frame_count_get(obj); -} - -EAPI void -elm_animation_view_min_progress_set(Efl_Ui_Animation_View *obj, double min_progress) -{ - efl_ui_animation_view_min_progress_set(obj, min_progress); -} - -EAPI double -elm_animation_view_min_progress_get(const Efl_Ui_Animation_View *obj) -{ - return efl_ui_animation_view_min_progress_get(obj); -} - -EAPI void -elm_animation_view_max_progress_set(Efl_Ui_Animation_View *obj, double max_progress) -{ - efl_ui_animation_view_max_progress_set(obj, max_progress); -} - -EAPI double -elm_animation_view_max_progress_get(const Efl_Ui_Animation_View *obj) -{ - return efl_ui_animation_view_max_progress_get(obj); -} - -EAPI void -elm_animation_view_min_frame_set(Efl_Ui_Animation_View *obj, int min_frame) -{ - efl_ui_animation_view_min_frame_set(obj, min_frame); -} - -EAPI int -elm_animation_view_min_frame_get(const Efl_Ui_Animation_View *obj) -{ - return efl_ui_animation_view_min_frame_get(obj); -} - -EAPI void -elm_animation_view_max_frame_set(Efl_Ui_Animation_View *obj, int max_frame) -{ - efl_ui_animation_view_max_frame_set(obj, max_frame); -} - -EAPI int -elm_animation_view_max_frame_get(const Efl_Ui_Animation_View *obj) -{ - return efl_ui_animation_view_max_frame_get(obj); -} diff --git a/src/lib/elementary/efl_ui_animation_view_private.h b/src/lib/elementary/efl_ui_animation_view_private.h deleted file mode 100644 index 9199dc75ac..0000000000 --- a/src/lib/elementary/efl_ui_animation_view_private.h +++ /dev/null @@ -1,42 +0,0 @@ -#ifndef EFL_UI_ANIMATION_VIEW_PRIVATE_H -#define EFL_UI_ANIMATION_VIEW_PRIVATE_H - -#include "Elementary.h" -#include "efl_ui_animation_view.eo.h" - -typedef struct _Efl_Ui_Animation_View_Data Efl_Ui_Animation_View_Data; - -struct _Efl_Ui_Animation_View_Data -{ - Eo* vg; //Evas_Object_Vg - Efl_Ui_Animation_View_State state; - Elm_Transit *transit; - Eina_Stringshare *file; - double speed; - double progress; - double frame_cnt; - int repeat_times; - double frame_duration; - double min_progress; - double max_progress; - Eina_List *vp_list; - - Eina_Bool play_back : 1; - Eina_Bool auto_play : 1; - Eina_Bool auto_play_pause: 1; - Eina_Bool auto_repeat : 1; -}; - -#define EFL_UI_ANIMATION_VIEW_DATA_GET(o, sd) \ - Efl_Ui_Animation_View_Data * sd = efl_data_scope_safe_get(o, EFL_UI_ANIMATION_VIEW_CLASS) - -#define EFL_UI_ANIMATION_VIEW_DATA_GET_OR_RETURN(o, ptr) \ - EFL_UI_ANIMATION_VIEW_DATA_GET(o, ptr); \ - if (EINA_UNLIKELY(!ptr)) \ - { \ - ERR("No widget data for object %p (%s)", \ - o, evas_object_type_get(o)); \ - return; \ - } - -#endif diff --git a/src/lib/elementary/efl_ui_bg.c b/src/lib/elementary/efl_ui_bg.c index 51b12158db..56ccdbd72f 100644 --- a/src/lib/elementary/efl_ui_bg.c +++ b/src/lib/elementary/efl_ui_bg.c @@ -187,7 +187,11 @@ elm_bg_load_size_set(Evas_Object *obj, int w, int h) EAPI Eina_Bool elm_bg_file_set(Eo *obj, const char *file, const char *group) { - return efl_file_simple_load((Eo *) obj, file, group); + EFL_UI_BG_DATA_GET_OR_RETURN_VAL(obj, sd, EINA_FALSE); + Eina_Bool ret = efl_file_simple_load((Eo *) obj, file, group); + if (ret) elm_image_preload_disabled_set(sd->img, EINA_TRUE); + + return ret; } EOLIAN static Eina_Error diff --git a/src/lib/elementary/efl_ui_bg_legacy_eo.h b/src/lib/elementary/efl_ui_bg_legacy_eo.h index ea3641dc2e..148db914b5 100644 --- a/src/lib/elementary/efl_ui_bg_legacy_eo.h +++ b/src/lib/elementary/efl_ui_bg_legacy_eo.h @@ -26,7 +26,7 @@ typedef Eo Efl_Ui_Bg_Legacy; */ #define EFL_UI_BG_LEGACY_CLASS efl_ui_bg_legacy_class_get() -EWAPI const Efl_Class *efl_ui_bg_legacy_class_get(void); +EWAPI const Efl_Class *efl_ui_bg_legacy_class_get(void) EINA_CONST; #endif /* EFL_BETA_API_SUPPORT */ #endif diff --git a/src/lib/elementary/efl_ui_button.c b/src/lib/elementary/efl_ui_button.c index 7c0a13e478..d91b874422 100644 --- a/src/lib/elementary/efl_ui_button.c +++ b/src/lib/elementary/efl_ui_button.c @@ -397,24 +397,6 @@ _efl_ui_button_legacy_efl_object_constructor(Eo *obj, void *_pd EINA_UNUSED) /* FIXME: replicated from elm_layout just because button's icon spot * is elm.swallow.content, not elm.swallow.icon. Fix that whenever we * can changed the theme API */ -static void -_icon_signal_emit(Evas_Object *obj) -{ - char buf[64]; - - if (!elm_widget_resize_object_get(obj)) return; - if (!edje_object_part_exists(obj, "elm.swallow.content")) return; - snprintf(buf, sizeof(buf), "elm,state,icon,%s", - elm_layout_content_get(obj, "icon") ? "visible" : "hidden"); - - elm_layout_signal_emit(obj, buf, "elm"); - edje_object_message_signal_process(elm_layout_edje_get(obj)); - efl_canvas_group_change(obj); -} - -/* FIXME: replicated from elm_layout just because button's icon spot - * is elm.swallow.content, not elm.swallow.icon. Fix that whenever we - * can changed the theme API */ EOLIAN static Eina_Error _efl_ui_button_legacy_efl_ui_widget_theme_apply(Eo *obj, void *_pd EINA_UNUSED) { @@ -422,7 +404,7 @@ _efl_ui_button_legacy_efl_ui_widget_theme_apply(Eo *obj, void *_pd EINA_UNUSED) int_ret = efl_ui_widget_theme_apply(efl_super(obj, EFL_UI_BUTTON_LEGACY_CLASS)); if (int_ret == EFL_UI_THEME_APPLY_ERROR_GENERIC) return int_ret; - _icon_signal_emit(obj); + if (efl_finalized_get(obj)) _elm_layout_legacy_icon_signal_emit(obj); return int_ret; } @@ -438,7 +420,7 @@ _efl_ui_button_legacy_efl_ui_widget_widget_sub_object_del(Eo *obj, void *_pd EIN int_ret = elm_widget_sub_object_del(efl_super(obj, EFL_UI_BUTTON_LEGACY_CLASS), sobj); if (!int_ret) return EINA_FALSE; - _icon_signal_emit(obj); + _elm_layout_legacy_icon_signal_emit(obj); return EINA_TRUE; } @@ -454,7 +436,7 @@ _efl_ui_button_legacy_content_set(Eo *obj, void *_pd EINA_UNUSED, const char *pa int_ret = efl_content_set(efl_part(efl_super(obj, EFL_UI_BUTTON_LEGACY_CLASS), part), content); if (!int_ret) return EINA_FALSE; - _icon_signal_emit(obj); + _elm_layout_legacy_icon_signal_emit(obj); return EINA_TRUE; } diff --git a/src/lib/elementary/efl_ui_button_legacy_eo.h b/src/lib/elementary/efl_ui_button_legacy_eo.h index 31630d64ef..d8c893016b 100644 --- a/src/lib/elementary/efl_ui_button_legacy_eo.h +++ b/src/lib/elementary/efl_ui_button_legacy_eo.h @@ -24,7 +24,7 @@ typedef Eo Efl_Ui_Button_Legacy; */ #define EFL_UI_BUTTON_LEGACY_CLASS efl_ui_button_legacy_class_get() -EWAPI const Efl_Class *efl_ui_button_legacy_class_get(void); +EWAPI const Efl_Class *efl_ui_button_legacy_class_get(void) EINA_CONST; #endif /* EFL_BETA_API_SUPPORT */ #endif diff --git a/src/lib/elementary/efl_ui_calendar_private.h b/src/lib/elementary/efl_ui_calendar_private.h index 3d80b89305..9ee17465e3 100644 --- a/src/lib/elementary/efl_ui_calendar_private.h +++ b/src/lib/elementary/efl_ui_calendar_private.h @@ -10,17 +10,6 @@ */ /** - * @addtogroup Widget - * @{ - * - * @section elm-calendar-class The Elementary Calendar Class - * - * Elementary, besides having the @ref Calendar widget, exposes its - * foundation -- the Elementary Calendar Class -- in order to create other - * widgets which are a calendar with some more logic on top. - */ - -/** * Base layout smart data extended with calendar instance data. */ typedef struct _Efl_Ui_Calendar_Data Efl_Ui_Calendar_Data; @@ -47,10 +36,6 @@ struct _Efl_Ui_Calendar_Data Eina_Bool weekdays_set : 1; }; -/** - * @} - */ - #define EFL_UI_CALENDAR_DATA_GET(o, sd) \ Efl_Ui_Calendar_Data * sd = efl_data_scope_get(o, EFL_UI_CALENDAR_CLASS) diff --git a/src/lib/elementary/efl_ui_check.c b/src/lib/elementary/efl_ui_check.c index 1ac817e29f..da51f880ce 100644 --- a/src/lib/elementary/efl_ui_check.c +++ b/src/lib/elementary/efl_ui_check.c @@ -453,26 +453,6 @@ _efl_ui_check_legacy_efl_object_constructor(Eo *obj, void *pd EINA_UNUSED) /* FIXME: replicated from elm_layout just because check's icon spot * is elm.swallow.content, not elm.swallow.icon. Fix that whenever we * can changed the theme API */ -static void -_icon_signal_emit(Evas_Object *obj) -{ - ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd); - char buf[64]; - - if (!elm_widget_resize_object_get(obj)) return; - if (!edje_object_part_exists(obj, "elm.swallow.content")) return; - snprintf(buf, sizeof(buf), "elm,state,icon,%s", - elm_layout_content_get(obj, "icon") ? "visible" : "hidden"); - - elm_layout_signal_emit(obj, buf, "elm"); - edje_object_message_signal_process(wd->resize_obj); - - efl_canvas_group_change(obj); -} - -/* FIXME: replicated from elm_layout just because check's icon spot - * is elm.swallow.content, not elm.swallow.icon. Fix that whenever we - * can changed the theme API */ EOLIAN static Eina_Error _efl_ui_check_legacy_efl_ui_widget_theme_apply(Eo *obj, void *_pd EINA_UNUSED) { @@ -481,7 +461,7 @@ _efl_ui_check_legacy_efl_ui_widget_theme_apply(Eo *obj, void *_pd EINA_UNUSED) int_ret = efl_ui_widget_theme_apply(efl_super(obj, EFL_UI_CHECK_LEGACY_CLASS)); if (int_ret == EFL_UI_THEME_APPLY_ERROR_GENERIC) return int_ret; - _icon_signal_emit(obj); + if (efl_finalized_get(obj)) _elm_layout_legacy_icon_signal_emit(obj); return int_ret; } @@ -497,7 +477,7 @@ _efl_ui_check_legacy_efl_ui_widget_widget_sub_object_del(Eo *obj, void *_pd EINA int_ret = elm_widget_sub_object_del(efl_super(obj, EFL_UI_CHECK_LEGACY_CLASS), sobj); if (!int_ret) return EINA_FALSE; - _icon_signal_emit(obj); + _elm_layout_legacy_icon_signal_emit(obj); return EINA_TRUE; } @@ -513,7 +493,7 @@ _efl_ui_check_legacy_content_set(Eo *obj, void *_pd EINA_UNUSED, const char *par int_ret = efl_content_set(efl_part(efl_super(obj, EFL_UI_CHECK_LEGACY_CLASS), part), content); if (!int_ret) return EINA_FALSE; - _icon_signal_emit(obj); + _elm_layout_legacy_icon_signal_emit(obj); return EINA_TRUE; } diff --git a/src/lib/elementary/efl_ui_check_legacy_eo.h b/src/lib/elementary/efl_ui_check_legacy_eo.h index a8fb7f50e6..2cc1a576ab 100644 --- a/src/lib/elementary/efl_ui_check_legacy_eo.h +++ b/src/lib/elementary/efl_ui_check_legacy_eo.h @@ -26,7 +26,7 @@ typedef Eo Efl_Ui_Check_Legacy; */ #define EFL_UI_CHECK_LEGACY_CLASS efl_ui_check_legacy_class_get() -EWAPI const Efl_Class *efl_ui_check_legacy_class_get(void); +EWAPI const Efl_Class *efl_ui_check_legacy_class_get(void) EINA_CONST; #endif /* EFL_BETA_API_SUPPORT */ #endif diff --git a/src/lib/elementary/efl_ui_clock.h b/src/lib/elementary/efl_ui_clock.h index c883db2eee..95849b1334 100644 --- a/src/lib/elementary/efl_ui_clock.h +++ b/src/lib/elementary/efl_ui_clock.h @@ -1,5 +1,5 @@ /** - * @defgroup efl_ui_clock + * @defgroup efl_ui_clock EFL Ui Clock Widget * @ingroup Elementary * * @image html clock_inheritance_tree.png @@ -115,11 +115,11 @@ * The whole widget is left aligned and its size grows horizontally depending * on the current format and each field's visible/disabled state. * - * This widget inherits from the @ref Layout one, so that all the + * This widget inherits from the @ref Elm_Layout one, so that all the * functions acting on it also work for Clock objects. * * This widget emits the following signals, besides the ones sent from - * @ref Layout: + * @ref Elm_Layout : * @li @b "changed" - whenever Clock field value is changed, this * signal is sent. * @li @b "language,changed" - whenever system locale changes, this diff --git a/src/lib/elementary/efl_ui_collection.c b/src/lib/elementary/efl_ui_collection.c index 53eb344d4e..2161181687 100644 --- a/src/lib/elementary/efl_ui_collection.c +++ b/src/lib/elementary/efl_ui_collection.c @@ -86,7 +86,7 @@ static void _fast_accessor_init(Fast_Accessor *accessor, Eina_List **items) { //this is the accessor for accessing the items - //we have to workarround here the problem that + //we have to workaround here the problem that //no accessor can be created for a not yet created list. accessor->items = items; } @@ -146,6 +146,8 @@ typedef struct { Fast_Accessor size_accessor; Efl_Gfx_Entity *sizer; unsigned int start_id, end_id; + Eina_Bool allow_manual_deselection : 1; + Eina_Bool api_selection_change : 1; } Efl_Ui_Collection_Data; static Eina_Bool register_item(Eo *obj, Efl_Ui_Collection_Data *pd, Efl_Ui_Item *item); @@ -238,7 +240,7 @@ _item_scroll_internal(Eo *obj EINA_UNUSED, ipos.x = ipos.x + vpos.x - view.x; ipos.y = ipos.y + vpos.y - view.y; - //FIXME scrollable needs some sort of align, the docs do not even garantee to completly move in the element + //FIXME scrollable needs some sort of align, the docs do not even garantee to completely move in the element efl_ui_scrollable_scroll(pd->smanager, ipos, anim); } @@ -360,6 +362,8 @@ _efl_ui_collection_efl_object_constructor(Eo *obj, Efl_Ui_Collection_Data *pd EI { Eo *o; + efl_ui_selectable_allow_manual_deselection_set(obj, EINA_TRUE); + pd->dir = EFL_UI_LAYOUT_ORIENTATION_VERTICAL; _fast_accessor_init(&pd->obj_accessor, &pd->items); @@ -566,7 +570,7 @@ _selection_changed(void *data, const Efl_Event *ev) Efl_Ui_Selection *fallback; //if this is the highest call in the tree of selection changes, safe the fallback and apply it later - //this way we ensure that we are not accidently adding fallback even if we just want to have a empty selection list + //this way we ensure that we are not accidentally adding fallback even if we just want to have a empty selection list fallback = pd->fallback; pd->fallback = NULL; @@ -576,7 +580,7 @@ _selection_changed(void *data, const Efl_Event *ev) { _single_selection_behaviour(obj, pd, ev->object); } - else if (pd->mode == EFL_UI_SELECT_MODE_MULTI && _elm_config->desktop_entry) + else if (pd->mode == EFL_UI_SELECT_MODE_MULTI && _elm_config->desktop_entry && !pd->api_selection_change) { const Evas_Modifier *mod = evas_key_modifier_get(evas_object_evas_get(ev->object)); if (!(efl_input_clickable_interaction_get(ev->object) @@ -1087,7 +1091,7 @@ _efl_ui_collection_efl_ui_focus_manager_move(Eo *obj, Efl_Ui_Collection_Data *pd } else { - _item_scroll_internal(obj, pd, new_obj, .0, EINA_TRUE); + _item_scroll_internal(obj, pd, efl_provider_find(new_obj, EFL_UI_ITEM_CLASS), .0, EINA_TRUE); } return new_obj; @@ -1108,13 +1112,17 @@ _selectable_range_apply(Eina_List *start, Eina_Bool flag) EOLIAN static void _efl_ui_collection_efl_ui_multi_selectable_all_select(Eo *obj EINA_UNUSED, Efl_Ui_Collection_Data *pd) { + pd->api_selection_change = EINA_TRUE; _selectable_range_apply(pd->items, EINA_TRUE); + pd->api_selection_change = EINA_FALSE; } EOLIAN static void _efl_ui_collection_efl_ui_multi_selectable_all_unselect(Eo *obj EINA_UNUSED, Efl_Ui_Collection_Data *pd) { + pd->api_selection_change = EINA_TRUE; _selectable_range_apply(pd->items, EINA_FALSE); + pd->api_selection_change = EINA_FALSE; } static void @@ -1176,6 +1184,19 @@ _efl_ui_collection_efl_ui_single_selectable_fallback_selection_get(const Eo *obj return pd->fallback; } +EOLIAN static void +_efl_ui_collection_efl_ui_single_selectable_allow_manual_deselection_set(Eo *obj EINA_UNUSED, Efl_Ui_Collection_Data *pd, Eina_Bool allow_manual_deselection) +{ + pd->allow_manual_deselection = !!allow_manual_deselection; +} + +EOLIAN static Eina_Bool +_efl_ui_collection_efl_ui_single_selectable_allow_manual_deselection_get(const Eo *obj EINA_UNUSED, Efl_Ui_Collection_Data *pd) +{ + return pd->allow_manual_deselection; +} + + #include "efl_ui_collection.eo.c" #define ITEM_IS_OUTSIDE_VISIBLE(id) id < collection_pd->start_id || id > collection_pd->end_id diff --git a/src/lib/elementary/efl_ui_collection.eo b/src/lib/elementary/efl_ui_collection.eo index 4a5a440002..d890b1656e 100644 --- a/src/lib/elementary/efl_ui_collection.eo +++ b/src/lib/elementary/efl_ui_collection.eo @@ -97,6 +97,7 @@ class Efl.Ui.Collection extends Efl.Ui.Layout_Base implements Efl.Ui.Multi_Selectable_Object_Range.range_select; Efl.Ui.Multi_Selectable_Object_Range.range_unselect; Efl.Ui.Single_Selectable.fallback_selection {get; set;} + Efl.Ui.Single_Selectable.allow_manual_deselection {get; set;} } } diff --git a/src/lib/elementary/efl_ui_collection_view.c b/src/lib/elementary/efl_ui_collection_view.c index 433f5d3511..7eb6fe42d1 100644 --- a/src/lib/elementary/efl_ui_collection_view.c +++ b/src/lib/elementary/efl_ui_collection_view.c @@ -1685,7 +1685,7 @@ _item_scroll_internal(Eo *obj EINA_UNUSED, ipos.x = ipos.x + vpos.x - view.x; ipos.y = ipos.y + vpos.y - view.y; - //FIXME scrollable needs some sort of align, the docs do not even garantee to completly move in the element + //FIXME scrollable needs some sort of align, the docs do not even garantee to completely move in the element efl_ui_scrollable_scroll(pd->scroller, ipos, anim); } diff --git a/src/lib/elementary/efl_ui_datepicker.c b/src/lib/elementary/efl_ui_datepicker.c index c52c43437f..78427ac21e 100644 --- a/src/lib/elementary/efl_ui_datepicker.c +++ b/src/lib/elementary/efl_ui_datepicker.c @@ -18,7 +18,7 @@ Efl_Time t = efl_datetime_manager_value_get(pd->dt_manager); \ pd->cur_date[DATEPICKER_YEAR] = t.tm_year + 1900; \ pd->cur_date[DATEPICKER_MONTH] = t.tm_mon + 1; \ - pd->cur_date[DATEPICKER_DAY] = t.tm_mday + 1; \ + pd->cur_date[DATEPICKER_DAY] = t.tm_mday; \ } while (0) #define DATE_SET() \ @@ -26,7 +26,7 @@ Efl_Time t = { 0 }; \ t.tm_year = pd->cur_date[DATEPICKER_YEAR] - 1900; \ t.tm_mon = pd->cur_date[DATEPICKER_MONTH] - 1; \ - t.tm_mday = pd->cur_date[DATEPICKER_DAY] - 1; \ + t.tm_mday = pd->cur_date[DATEPICKER_DAY]; \ t.tm_sec = 0; \ efl_datetime_manager_value_set(pd->dt_manager, t); \ } while (0) diff --git a/src/lib/elementary/efl_ui_dnd.c b/src/lib/elementary/efl_ui_dnd.c index df79eb9762..efa0669d99 100644 --- a/src/lib/elementary/efl_ui_dnd.c +++ b/src/lib/elementary/efl_ui_dnd.c @@ -12,838 +12,146 @@ #include <Elementary_Cursor.h> #include "elm_priv.h" -typedef struct _Efl_Ui_Dnd_Container_Data Efl_Ui_Dnd_Container_Data; -struct _Efl_Ui_Dnd_Container_Data -{ - unsigned int drag_delay_time; -}; - -extern int _wl_default_seat_id_get(Evas_Object *obj); -#ifdef HAVE_ELEMENTARY_WL2 -Ecore_Wl2_Window *_wl_window_get(const Evas_Object *obj); -#endif - -Eo* -_efl_ui_selection_manager_get(Eo *obj) -{ - if (!efl_isa(obj, EFL_UI_WIDGET_CLASS)) return NULL; - Eo *app = efl_app_main_get(); - Eo *sel_man = efl_key_data_get(app, "__selection_manager"); - if (!sel_man) - { - sel_man = efl_add(EFL_UI_SELECTION_MANAGER_CLASS, app); - efl_key_data_set(app, "__selection_manager", sel_man); - } - return sel_man; -} - -void -_efl_ui_dnd_shutdown(void) -{ - Eo *app = efl_app_main_get(); - Eo *sel_man = efl_key_data_get(app, "__selection_manager"); - - efl_del(sel_man); -} - -EOLIAN static void -_efl_ui_dnd_drag_start(Eo *obj, void *pd EINA_UNUSED, Efl_Ui_Selection_Format format, Eina_Slice data, - Efl_Ui_Selection_Action action, void *icon_func_data, Efl_Dnd_Drag_Icon_Create icon_func, Eina_Free_Cb icon_func_free_cb, - unsigned int seat) -{ - Eo *sel_man = _efl_ui_selection_manager_get(obj); - efl_ui_selection_manager_drag_start(sel_man, obj, format, data, action, - icon_func_data, icon_func, icon_func_free_cb, - seat); -} - -EOLIAN static void -_efl_ui_dnd_drag_cancel(Eo *obj, void *pd EINA_UNUSED, unsigned int seat) -{ - Eo *sel_man = _efl_ui_selection_manager_get(obj); - efl_ui_selection_manager_drag_cancel(sel_man, obj, seat); -} - -EOLIAN static void -_efl_ui_dnd_drag_action_set(Eo *obj, void *pd EINA_UNUSED, Efl_Ui_Selection_Action action, unsigned int seat) -{ - Eo *sel_man = _efl_ui_selection_manager_get(obj); - efl_ui_selection_manager_drag_action_set(sel_man, obj, action, seat); -} - - -EOLIAN static void -_efl_ui_dnd_drop_target_add(Eo *obj, void *pd EINA_UNUSED, Efl_Ui_Selection_Format format, unsigned int seat) -{ - Eo *sel_man = _efl_ui_selection_manager_get(obj); - efl_ui_selection_manager_drop_target_add(sel_man, obj, format, seat); -} - -EOLIAN static void -_efl_ui_dnd_drop_target_del(Eo *obj, void *pd EINA_UNUSED, Efl_Ui_Selection_Format format, unsigned int seat) -{ - Eo *sel_man = _efl_ui_selection_manager_get(obj); - efl_ui_selection_manager_drop_target_del(sel_man, obj, format, seat); -} - -EOLIAN static double -_efl_ui_dnd_container_drag_delay_time_get(const Eo *obj EINA_UNUSED, Efl_Ui_Dnd_Container_Data *pd) -{ - return pd->drag_delay_time; -} +typedef struct { + Ecore_Evas *ee; + Eina_Bool registered; +} Efl_Ui_Dnd_Data; -EOLIAN static void -_efl_ui_dnd_container_drag_delay_time_set(Eo *obj EINA_UNUSED, Efl_Ui_Dnd_Container_Data *pd, double drag_delay_time) -{ - pd->drag_delay_time = drag_delay_time; -} - -EOLIAN static void -_efl_ui_dnd_container_drag_item_add(Eo *obj, Efl_Ui_Dnd_Container_Data *pd, - void *data_func_data, Efl_Dnd_Drag_Data_Get data_func, Eina_Free_Cb data_func_free_cb, - void *item_func_data, Efl_Dnd_Item_Get item_func, Eina_Free_Cb item_func_free_cb, - void *icon_func_data, Efl_Dnd_Drag_Icon_Create icon_func, Eina_Free_Cb icon_func_free_cb, - void *icon_list_func_data, Efl_Dnd_Drag_Icon_List_Create icon_list_func, Eina_Free_Cb icon_list_func_free_cb, - unsigned int seat) -{ - double drag_delay_time = pd->drag_delay_time; - double anim_time = elm_config_drag_anim_duration_get(); - Eo *sel_man = _efl_ui_selection_manager_get(obj); - efl_ui_selection_manager_container_drag_item_add(sel_man, obj, drag_delay_time, anim_time, - data_func_data, data_func, data_func_free_cb, - item_func_data, item_func, item_func_free_cb, - icon_func_data, icon_func, icon_func_free_cb, - icon_list_func_data, icon_list_func, icon_list_func_free_cb, - seat); -} +typedef struct { + Eo *win; + Efl_Ui_Dnd *obj; +} Efl_Ui_Drag_Start; static void -_efl_ui_dnd_container_drag_item_del(Eo *obj, Efl_Ui_Dnd_Container_Data *pd EINA_UNUSED, unsigned int seat) -{ - Eo *sel_man = _efl_ui_selection_manager_get(obj); - efl_ui_selection_manager_container_drag_item_del(sel_man, obj, seat); -} -EOLIAN static void -_efl_ui_dnd_container_drop_item_add(Eo *obj, Efl_Ui_Dnd_Container_Data *pd EINA_UNUSED, - Efl_Ui_Selection_Format format, - void *item_func_data, Efl_Dnd_Item_Get item_func, Eina_Free_Cb item_func_free_cb, - unsigned int seat) -{ - Eo *sel_man = _efl_ui_selection_manager_get(obj); - efl_ui_selection_manager_container_drop_item_add(sel_man, obj, format, item_func_data, item_func, item_func_free_cb, seat); -} - -EOLIAN static void -_efl_ui_dnd_container_drop_item_del(Eo *obj, Efl_Ui_Dnd_Container_Data *pd EINA_UNUSED, unsigned int seat) -{ - Eo *sel_man = _efl_ui_selection_manager_get(obj); - efl_ui_selection_manager_container_drop_item_del(sel_man, obj, seat); -} - - -/////////// -typedef struct _Dnd_Icon_Create Dnd_Icon_Create; -typedef struct _Dnd_Drag_Pos Dnd_Drag_Pos; -typedef struct _Dnd_Drag_Accept Dnd_Drag_Accept; -typedef struct _Dnd_Drag_Done Dnd_Drag_Done; -typedef struct _Dnd_Drag_State Dnd_Drag_State; -typedef struct _Dnd_Drop Dnd_Drop; -typedef struct _Dnd_Cont_Drag_Pos Dnd_Cont_Drag_Pos; -typedef struct _Dnd_Cont_Drop Dnd_Cont_Drop; -typedef struct _Item_Container_Drag_Info Item_Container_Drag_Info; - -struct _Dnd_Icon_Create -{ - void *icon_data; - Elm_Drag_Icon_Create_Cb icon_cb; -}; - -struct _Dnd_Drag_Pos -{ - void *pos_data; - Elm_Drag_Pos pos_cb; -}; - -struct _Dnd_Drag_Accept -{ - void *accept_data; - Elm_Drag_Accept accept_cb; -}; - -struct _Dnd_Drag_Done -{ - void *done_data; - Elm_Drag_State done_cb; - - //for deleting - Dnd_Drag_Pos *pos; - Dnd_Drag_Accept *accept; -}; - -struct _Dnd_Drag_State -{ - void *state_data; - Elm_Drag_State state_cb; -}; - -struct _Dnd_Drop -{ - Efl_Object *obj; - Elm_Sel_Format format; - void *drop_data; - Elm_Drop_Cb drop_cb; - - //for deleting - Dnd_Drag_State *enter; - Dnd_Drag_State *leave; - Dnd_Drag_Pos *pos; -}; - -struct _Dnd_Cont_Drag_Pos -{ - void *pos_data; - Elm_Drag_Item_Container_Pos pos_cb; - Elm_Xy_Item_Get_Cb item_get_cb; -}; - -struct _Dnd_Cont_Drop -{ - Efl_Object *obj; - Elm_Sel_Format format; - void *drop_data; - Elm_Drop_Item_Container_Cb drop_cb; - Elm_Xy_Item_Get_Cb item_get_cb; - - //for deleting - Dnd_Drag_State *enter; - Dnd_Drag_State *leave; - Dnd_Cont_Drag_Pos *pos; -}; - -struct _Item_Container_Drag_Info -{ - Elm_Drag_User_Info user_info; - Elm_Object_Item *it; - Elm_Item_Container_Data_Get_Cb data_get_cb; - Elm_Xy_Item_Get_Cb item_get_cb; -}; - -static Efl_Object * -_dnd_icon_create_cb(void *data, Efl_Object *win, Efl_Object *drag_obj EINA_UNUSED, Eina_Position2D *pos_ret) -{ - Dnd_Icon_Create *ic = data; - Efl_Object *ret = ic->icon_cb(ic->icon_data, win, &pos_ret->x, &pos_ret->y); - - free(ic); - return ret; -} - -static void -_dnd_drag_pos_cb(void *data, const Efl_Event *event) -{ - Dnd_Drag_Pos *pos = data; - Efl_Dnd_Drag_Pos *ddata = event->info; - - if (pos->pos_cb) - pos->pos_cb(pos->pos_data, event->object, ddata->pos.x, ddata->pos.y, - (Elm_Xdnd_Action)ddata->action); -} - -static void -_dnd_drag_accept_cb(void *data, const Efl_Event *event) -{ - Dnd_Drag_Accept *accept = data; - - if (accept->accept_cb) - accept->accept_cb(accept->accept_data, event->object, *(Eina_Bool *)event->info); -} - -static void -_dnd_drag_done_cb(void *data, const Efl_Event *event) -{ - Dnd_Drag_Done *done = data; - - if (done->done_cb) - done->done_cb(done->done_data, event->object); - - efl_event_callback_del(event->object, EFL_UI_DND_EVENT_DRAG_POS, - _dnd_drag_pos_cb, done->pos); - efl_event_callback_del(event->object, EFL_UI_DND_EVENT_DRAG_ACCEPT, - _dnd_drag_accept_cb, done->accept); - efl_event_callback_del(event->object, EFL_UI_DND_EVENT_DRAG_DONE, - _dnd_drag_done_cb, done); - free(done->pos); - free(done->accept); - free(done); -} - -static void -_dnd_drag_enter_leave_cb(void *data, const Efl_Event *event) -{ - Dnd_Drag_State *state = data; - - if (state->state_cb) - state->state_cb(state->state_data, event->object); -} - -static void -_dnd_drop_cb(void *data, const Efl_Event *event) -{ - Dnd_Drop *drop = data; - Efl_Ui_Selection_Data *org_ddata = event->info; - Elm_Selection_Data ddata; - - ddata.x = org_ddata->pos.x; - ddata.y = org_ddata->pos.y; - ddata.format = (Elm_Sel_Format)org_ddata->format; - ddata.action = (Elm_Xdnd_Action)org_ddata->action; - ddata.data = calloc(1, org_ddata->content.len); - if (!ddata.data) return; - ddata.data = memcpy(ddata.data, org_ddata->content.mem, org_ddata->content.len); - ddata.len = org_ddata->content.len; - if (drop->drop_cb) - drop->drop_cb(drop->drop_data, event->object, &ddata); - free(ddata.data); -} - -EAPI Eina_Bool -elm_drag_start(Evas_Object *obj, Elm_Sel_Format format, const char *data, - Elm_Xdnd_Action action, - Elm_Drag_Icon_Create_Cb icon_create_cb, void *icon_create_data, - Elm_Drag_Pos drag_pos_cb, void *drag_pos_data, - Elm_Drag_Accept drag_accept_cb, void *drag_accept_data, - Elm_Drag_State drag_done_cb, void *drag_done_data) -{ - if (!data) return EINA_FALSE; - Eo *sel_man = _efl_ui_selection_manager_get(obj); - int seatid = 1; - Eina_Slice sl; - Dnd_Drag_Pos *pos = calloc(1, sizeof(Dnd_Drag_Pos)); - Dnd_Drag_Accept *accept = calloc(1, sizeof(Dnd_Drag_Accept)); - Dnd_Drag_Done *done = calloc(1, sizeof(Dnd_Drag_Done)); - Dnd_Icon_Create *ic = calloc(1, sizeof(Dnd_Icon_Create)); - if (!pos || !accept || !done || !ic) goto on_error; - - pos->pos_data = drag_pos_data; - pos->pos_cb = drag_pos_cb; - - accept->accept_data = drag_accept_data; - accept->accept_cb = drag_accept_cb; - - done->done_data = drag_done_data; - done->done_cb = drag_done_cb; - done->pos = pos; - done->accept = accept; - - efl_event_callback_add(obj, EFL_UI_DND_EVENT_DRAG_POS, _dnd_drag_pos_cb, pos); - efl_event_callback_add(obj, EFL_UI_DND_EVENT_DRAG_ACCEPT, _dnd_drag_accept_cb, accept); - efl_event_callback_add(obj, EFL_UI_DND_EVENT_DRAG_DONE, _dnd_drag_done_cb, done); - sl.mem = data; - sl.len = strlen(data); -#ifdef HAVE_ELEMENTARY_WL2 - if (_wl_window_get(obj)) seatid = _wl_default_seat_id_get(obj); -#endif - - ic->icon_data = icon_create_data; - ic->icon_cb = icon_create_cb; - efl_ui_selection_manager_drag_start(sel_man, obj, (Efl_Ui_Selection_Format)format, sl, - (Efl_Ui_Selection_Action)action, - ic, _dnd_icon_create_cb, NULL, seatid); - - return EINA_TRUE; - -on_error: - if (pos) free(pos); - if (accept) free(accept); - if (done) free(done); - if (ic) free(ic); - - return EINA_FALSE; -} - -EAPI Eina_Bool -elm_drag_action_set(Evas_Object *obj, Elm_Xdnd_Action action) +_ecore_evas_drag_terminated(Ecore_Evas *ee EINA_UNUSED, unsigned int seat, void *data, Eina_Bool accepted) { - Eo *sel_man = _efl_ui_selection_manager_get(obj); - int seatid = 1; - -#ifdef HAVE_ELEMENTARY_WL2 - if (_wl_window_get(obj)) seatid = _wl_default_seat_id_get(obj); -#endif - efl_ui_selection_manager_drag_action_set(sel_man, obj, (Efl_Ui_Selection_Action)action, seatid); - - return EINA_TRUE; + Efl_Ui_Drag_Start *start = data; + Efl_Ui_Drag_Finished_Event ev = {seat, accepted}; + efl_event_callback_call(start->obj, EFL_UI_DND_EVENT_DRAG_FINISHED, &ev); + efl_del(start->win); + free(start); } -EAPI Eina_Bool -elm_drag_cancel(Evas_Object *obj) +EOLIAN static Efl_Content* +_efl_ui_dnd_drag_start(Eo *obj, Efl_Ui_Dnd_Data *pd, Eina_Content *content, const char* action, unsigned int seat) { - Eo *sel_man = _efl_ui_selection_manager_get(obj); - int seatid = 1; + Eo *drag_win; + Efl_Ui_Drag_Start *start; + Efl_Ui_Drag_Started_Event ev = {seat}; + Ecore_Evas *drag_ee; + EINA_SAFETY_ON_NULL_RETURN_VAL(pd->ee, NULL); -#ifdef HAVE_ELEMENTARY_WL2 - if (_wl_window_get(obj)) seatid = _wl_default_seat_id_get(obj); -#endif - - efl_ui_selection_manager_drag_cancel(sel_man, obj, seatid); - - return EINA_TRUE; -} - -static void -_drop_obj_del_cb(void *data EINA_UNUSED, Evas *e EINA_UNUSED, Evas_Object *obj, void *event_info EINA_UNUSED) -{ - Eina_List *drop_list; - Dnd_Drop *drop; + start = calloc(1, sizeof(Efl_Ui_Drag_Start)); + start->obj = obj; + start->win = drag_win = elm_win_add(NULL, "Elm-Drag", ELM_WIN_DND); + elm_win_alpha_set(drag_win, EINA_TRUE); + elm_win_override_set(drag_win, EINA_TRUE); + elm_win_borderless_set(drag_win, EINA_TRUE); + drag_ee = ecore_evas_ecore_evas_get(evas_object_evas_get(drag_win)); - drop_list = efl_key_data_get(obj, "__drop_list"); - EINA_LIST_FREE(drop_list, drop) + if (!ecore_evas_drag_start(pd->ee, seat, content, drag_ee, action, _ecore_evas_drag_terminated, start)) { - efl_event_callback_del(drop->obj, EFL_UI_DND_EVENT_DRAG_ENTER, - _dnd_drag_enter_leave_cb, drop->enter); - efl_event_callback_del(drop->obj, EFL_UI_DND_EVENT_DRAG_LEAVE, - _dnd_drag_enter_leave_cb, drop->leave); - efl_event_callback_del(drop->obj, EFL_UI_DND_EVENT_DRAG_POS, - _dnd_drag_pos_cb, drop->pos); - efl_event_callback_del(drop->obj, EFL_UI_DND_EVENT_DRAG_DROP, - _dnd_drop_cb, drop); - free(drop->enter); - free(drop->leave); - free(drop->pos); - free(drop); + efl_del(drag_win); + free(start); + drag_win = NULL; } - efl_key_data_set(obj, "__drop_list", NULL); -} - -EAPI Eina_Bool -elm_drop_target_add(Evas_Object *obj, Elm_Sel_Format format, - Elm_Drag_State enter_cb, void *enter_data, - Elm_Drag_State leave_cb, void *leave_data, - Elm_Drag_Pos pos_cb, void *pos_data, - Elm_Drop_Cb drop_cb, void *drop_data) -{ - Eo *sel_man = _efl_ui_selection_manager_get(obj); - int seatid = 1; - Dnd_Drag_State *enter, *leave; - Dnd_Drag_Pos *pos; - Dnd_Drop *drop; - Eina_List *drop_list; - - enter = calloc(1, sizeof(Dnd_Drag_State)); - leave = calloc(1, sizeof(Dnd_Drag_State)); - pos = calloc(1, sizeof(Dnd_Drag_Pos)); - drop = calloc(1, sizeof(Dnd_Drop)); - if (!enter || !leave || !pos || !drop) goto on_error; -#ifdef HAVE_ELEMENTARY_WL2 - if (_wl_window_get(obj)) seatid = _wl_default_seat_id_get(obj); -#endif - enter->state_cb = enter_cb; - enter->state_data = enter_data; - leave->state_cb = leave_cb; - leave->state_data = leave_data; - pos->pos_cb = pos_cb; - pos->pos_data = pos_data; - drop->obj = obj; - drop->format = format; - drop->drop_cb = drop_cb; - drop->drop_data = drop_data; - drop->enter = enter; - drop->leave = leave; - drop->pos = pos; - - drop_list = efl_key_data_get(obj, "__drop_list"); - drop_list = eina_list_append(drop_list, drop); - efl_key_data_set(obj, "__drop_list", drop_list); - evas_object_event_callback_add(obj, EVAS_CALLBACK_DEL, - _drop_obj_del_cb, NULL); - efl_event_callback_add(obj, EFL_UI_DND_EVENT_DRAG_ENTER, - _dnd_drag_enter_leave_cb, enter); - efl_event_callback_add(obj, EFL_UI_DND_EVENT_DRAG_LEAVE, - _dnd_drag_enter_leave_cb, leave); - efl_event_callback_add(obj, EFL_UI_DND_EVENT_DRAG_POS, - _dnd_drag_pos_cb, pos); - efl_event_callback_add(obj, EFL_UI_DND_EVENT_DRAG_DROP, - _dnd_drop_cb, drop); - efl_ui_selection_manager_drop_target_add(sel_man, obj, (Efl_Ui_Selection_Format)format, seatid); - - return EINA_TRUE; - -on_error: - if (enter) free(enter); - if (leave) free(leave); - if (pos) free(pos); - if (drop) free(drop); - - return EINA_FALSE; -} - -EAPI Eina_Bool -elm_drop_target_del(Evas_Object *obj, Elm_Sel_Format format, - Elm_Drag_State enter_cb, void *enter_data, - Elm_Drag_State leave_cb, void *leave_data, - Elm_Drag_Pos pos_cb, void *pos_data, - Elm_Drop_Cb drop_cb, void *drop_data) -{ - Eo *sel_man = _efl_ui_selection_manager_get(obj); - int seatid = 1; - //Eina_List *l, *l2; - Eina_List *drop_list; - Dnd_Drop *drop; - -#ifdef HAVE_ELEMENTARY_WL2 - if (_wl_window_get(obj)) seatid = _wl_default_seat_id_get(obj); -#endif - - drop_list = efl_key_data_get(obj, "__drop_list"); - drop = eina_list_data_get(drop_list); - if (drop && - (drop->format == format) && - (drop->enter->state_cb == enter_cb) && - (drop->enter->state_data == enter_data) && - (drop->leave->state_cb == leave_cb) && - (drop->leave->state_data == leave_data) && - (drop->pos->pos_cb == pos_cb) && - (drop->pos->pos_data == pos_data) && - (drop->drop_cb == drop_cb) && - (drop->drop_data == drop_data)) + else { - drop_list = eina_list_remove(drop_list, drop); - efl_key_data_set(obj, "__drop_list", drop_list); - evas_object_event_callback_del(obj, EVAS_CALLBACK_DEL, _drop_obj_del_cb); - efl_event_callback_del(drop->obj, EFL_UI_DND_EVENT_DRAG_ENTER, - _dnd_drag_enter_leave_cb, drop->enter); - efl_event_callback_del(drop->obj, EFL_UI_DND_EVENT_DRAG_LEAVE, - _dnd_drag_enter_leave_cb, drop->leave); - efl_event_callback_del(drop->obj, EFL_UI_DND_EVENT_DRAG_POS, - _dnd_drag_pos_cb, drop->pos); - efl_event_callback_del(drop->obj, EFL_UI_DND_EVENT_DRAG_DROP, - _dnd_drop_cb, drop); - free(drop->enter); - free(drop->leave); - free(drop->pos); - free(drop); + evas_object_show(drag_win); + efl_event_callback_call(obj, EFL_UI_DND_EVENT_DRAG_STARTED, &ev); } - efl_ui_selection_manager_drop_target_del(sel_man, obj, (Efl_Ui_Selection_Format)format, seatid); - return EINA_TRUE; + return drag_win; } -static Efl_Object * -_dnd_item_func(void *data, Efl_Canvas_Object *item, Eina_Position2D pos, Eina_Position2D *pos_ret) +EOLIAN static void +_efl_ui_dnd_drag_cancel(Eo *obj EINA_UNUSED, Efl_Ui_Dnd_Data *pd, unsigned int seat) { - Elm_Xy_Item_Get_Cb item_get_cb = data; - Evas_Coord x, y; - Efl_Object *obj = NULL; - - x = y = 0; - if (item_get_cb) - obj = item_get_cb(item, pos.x, pos.y, &x, &y); - if (pos_ret) - { - pos_ret->x = x; - pos_ret->y = y; - } - - return obj; + ecore_evas_drag_cancel(pd->ee, seat); } -static void -_dnd_cont_drag_pos_cb(void *data, const Efl_Event *event) +EOLIAN static Eina_Future* +_efl_ui_dnd_drop_data_get(Eo *obj EINA_UNUSED, Efl_Ui_Dnd_Data *pd, unsigned int seat, Eina_Iterator *acceptable_types) { - Dnd_Cont_Drag_Pos *pos = data; - Efl_Dnd_Drag_Pos *ddata = event->info; - Evas_Coord xret = 0, yret = 0; - - if (pos->item_get_cb) - { - Evas_Coord x, y; - evas_object_geometry_get(event->object, &x, &y, NULL, NULL); - pos->item_get_cb(event->object, ddata->pos.x + x, ddata->pos.y + y, - &xret, &yret); - } - if (pos->pos_cb) - pos->pos_cb(pos->pos_data, event->object, ddata->item, ddata->pos.x, ddata->pos.y, - xret, yret, (Elm_Xdnd_Action)ddata->action); + return ecore_evas_selection_get(pd->ee, seat, ECORE_EVAS_SELECTION_BUFFER_DRAG_AND_DROP_BUFFER, acceptable_types); } -static void -_dnd_cont_drop_cb(void *data, const Efl_Event *event) +EOLIAN static Efl_Object * +_efl_ui_dnd_efl_object_constructor(Eo *obj, Efl_Ui_Dnd_Data *pd) { - Dnd_Cont_Drop *drop = data; - Efl_Ui_Selection_Data *org_ddata = event->info; - Elm_Selection_Data ddata; - Evas_Coord xret = 0, yret = 0; + if (!efl_constructor(efl_super(obj, EFL_UI_DND_MIXIN))) + return NULL; - ddata.x = org_ddata->pos.x; - ddata.y = org_ddata->pos.y; - ddata.format = (Elm_Sel_Format)org_ddata->format; - ddata.action = (Elm_Xdnd_Action)org_ddata->action; - ddata.data = calloc(1, org_ddata->content.len); - if (!ddata.data) return; - ddata.data = memcpy(ddata.data, org_ddata->content.mem, org_ddata->content.len); - ddata.len = org_ddata->content.len; + pd->ee = ecore_evas_ecore_evas_get(evas_object_evas_get(obj)); - if (drop->item_get_cb) - { - Evas_Coord x, y; - evas_object_geometry_get(event->object, &x, &y, NULL, NULL); - drop->item_get_cb(event->object, ddata.x + x, ddata.y + y, - &xret, &yret); - } - - if (drop->drop_cb) - drop->drop_cb(drop->drop_data, event->object, org_ddata->item, - &ddata, xret, yret); - free(ddata.data); + return obj; } -static void -_cont_drop_free_data(Evas_Object *obj) +EOLIAN static void +_efl_ui_dnd_efl_object_invalidate(Eo *obj, Efl_Ui_Dnd_Data *pd) { - Eina_List *cont_drop_list; - Dnd_Cont_Drop *drop; - - cont_drop_list = efl_key_data_get(obj, "__cont_drop_item"); - drop = eina_list_data_get(cont_drop_list); - if (drop) + if (pd->registered) { - efl_event_callback_del(drop->obj, EFL_UI_DND_EVENT_DRAG_ENTER, - _dnd_drag_enter_leave_cb, drop->enter); - efl_event_callback_del(drop->obj, EFL_UI_DND_EVENT_DRAG_LEAVE, - _dnd_drag_enter_leave_cb, drop->leave); - efl_event_callback_del(drop->obj, EFL_UI_DND_EVENT_DRAG_POS, - _dnd_cont_drag_pos_cb, drop->pos); - efl_event_callback_del(drop->obj, EFL_UI_DND_EVENT_DRAG_DROP, - _dnd_cont_drop_cb, drop); - free(drop->enter); - free(drop->leave); - free(drop->pos); - cont_drop_list = eina_list_remove(cont_drop_list, drop); - efl_key_data_set(obj, "__cont_drop_item", cont_drop_list); - free(drop); + _drop_event_unregister(obj); } -} + efl_invalidate(efl_super(obj, EFL_UI_DND_MIXIN)); -static void -_cont_drop_obj_del_cb(void *data EINA_UNUSED, Evas *e EINA_UNUSED, Evas_Object *obj, void *info EINA_UNUSED) -{ - _cont_drop_free_data(obj); } -EAPI Eina_Bool -elm_drop_item_container_add(Evas_Object *obj, - Elm_Sel_Format format, - Elm_Xy_Item_Get_Cb item_get_cb, - Elm_Drag_State enter_cb, void *enter_data, - Elm_Drag_State leave_cb, void *leave_data, - Elm_Drag_Item_Container_Pos pos_cb, void *pos_data, - Elm_Drop_Item_Container_Cb drop_cb, void *drop_data) -{ - Eo *sel_man = _efl_ui_selection_manager_get(obj); - int seatid = 1; - Dnd_Drag_State *enter = NULL, *leave = NULL; - Dnd_Cont_Drag_Pos *pos = NULL; - Dnd_Cont_Drop *drop = NULL; - Eina_List *cont_drop_list; - - enter = calloc(1, sizeof(Dnd_Drag_State)); - leave = calloc(1, sizeof(Dnd_Drag_State)); - pos = calloc(1, sizeof(Dnd_Cont_Drag_Pos)); - drop = calloc(1, sizeof(Dnd_Cont_Drop)); - if (!enter || !leave || !pos || !drop) goto on_error; -#ifdef HAVE_ELEMENTARY_WL2 - if (_wl_window_get(obj)) seatid = _wl_default_seat_id_get(obj); -#endif - - enter->state_cb = enter_cb; - enter->state_data = enter_data; - leave->state_cb = leave_cb; - leave->state_data = leave_data; - pos->pos_cb = pos_cb; - pos->pos_data = pos_data; - pos->item_get_cb = item_get_cb; - drop->obj = obj; - drop->format = format; - drop->drop_cb = drop_cb; - drop->drop_data = drop_data; - drop->enter = enter; - drop->leave = leave; - drop->pos = pos; +#define IS_DROP_EVENT(D) ( \ +(D == EFL_UI_DND_EVENT_DROP_POSITION_CHANGED) || \ +(D == EFL_UI_DND_EVENT_DROP_DROPPED) || \ +(D == EFL_UI_DND_EVENT_DROP_LEFT) || \ +(D == EFL_UI_DND_EVENT_DROP_ENTERED) \ +) - cont_drop_list = efl_key_data_get(obj, "__cont_drop_item"); - cont_drop_list = eina_list_append(cont_drop_list, drop); - efl_key_data_set(obj, "__cont_drop_item", cont_drop_list); - evas_object_event_callback_add(obj, EVAS_CALLBACK_DEL, - _cont_drop_obj_del_cb, NULL); - efl_event_callback_add(obj, EFL_UI_DND_EVENT_DRAG_ENTER, - _dnd_drag_enter_leave_cb, enter); - efl_event_callback_add(obj, EFL_UI_DND_EVENT_DRAG_LEAVE, - _dnd_drag_enter_leave_cb, leave); - efl_event_callback_add(obj, EFL_UI_DND_EVENT_DRAG_POS, - _dnd_cont_drag_pos_cb, pos); - efl_event_callback_add(obj, EFL_UI_DND_EVENT_DRAG_DROP, - _dnd_cont_drop_cb, drop); - efl_ui_selection_manager_container_drop_item_add(sel_man, obj, (Efl_Ui_Selection_Format)format, - item_get_cb, _dnd_item_func, NULL, - seatid); - - return EINA_TRUE; - -on_error: - if (enter) free(enter); - if (leave) free(leave); - if (pos) free(pos); - if (drop) free(drop); - - return EINA_FALSE; -} - -EAPI Eina_Bool -elm_drop_item_container_del(Evas_Object *obj) +EOLIAN static Efl_Object* +_efl_ui_dnd_efl_object_finalize(Eo *obj, Efl_Ui_Dnd_Data *pd) { - Eo *sel_man = _efl_ui_selection_manager_get(obj); - int seatid = 1; - -#ifdef HAVE_ELEMENTARY_WL2 - if (_wl_window_get(obj)) seatid = _wl_default_seat_id_get(obj); -#endif + if (pd->registered) + _drop_event_register(obj); - _cont_drop_free_data(obj); - evas_object_event_callback_del(obj, EVAS_CALLBACK_DEL, _cont_drop_obj_del_cb); - efl_ui_selection_manager_container_drop_item_del(sel_man, obj, seatid); - - return EINA_TRUE; + return efl_finalize(efl_super(obj, EFL_UI_DND_MIXIN)); } -static void -_cont_drag_data_func(void *data, Efl_Object *obj, Efl_Ui_Selection_Format *format, - Eina_Rw_Slice *drag_data, Efl_Ui_Selection_Action *action) -{ - Item_Container_Drag_Info *di; - - di = data; - if (!di) return; - di->data_get_cb(obj, di->it, &di->user_info); - if (format) *format = (Efl_Ui_Selection_Format)di->user_info.format; - if (drag_data) - { - if (di->user_info.data) - { - drag_data->mem = (void *)di->user_info.data; - drag_data->len = strlen(di->user_info.data); - } - } - if (action) *action = (Efl_Ui_Selection_Action)di->user_info.action; -} - -static Eina_List * -_cont_drag_icon_list_create(void *data, Efl_Object *obj EINA_UNUSED) -{ - Item_Container_Drag_Info *di; - - di = data; - return di->user_info.icons; -} -static Efl_Object * -_cont_drag_icon_create(void *data, Efl_Object *win, Efl_Object *drag_obj EINA_UNUSED, Eina_Position2D *pos_ret) +EOLIAN static Eina_Bool +_efl_ui_dnd_efl_object_event_callback_priority_add(Eo *obj, Efl_Ui_Dnd_Data *pd, + const Efl_Event_Description *desc, + Efl_Callback_Priority priority, + Efl_Event_Cb func, + const void *user_data) { - Item_Container_Drag_Info *di; - Elm_Object_Item *it = NULL; + if (IS_DROP_EVENT(desc) && !pd->registered) + { + pd->registered = EINA_TRUE; + if (efl_finalized_get(obj)) + _drop_event_register(obj); + } - di = data; - if (!di) return NULL; - if (!di->user_info.createicon) return NULL; - it = di->user_info.createicon(di->user_info.createdata, win, &pos_ret->x, &pos_ret->y); - di->it = it; - return it; + return efl_event_callback_priority_add(efl_super(obj, EFL_UI_DND_MIXIN), desc, priority, func, user_data); } -static Efl_Object * -_cont_drag_item_func(void *data, Efl_Canvas_Object *item, Eina_Position2D pos, Eina_Position2D *pos_ret) +EOLIAN static Eina_Bool +_efl_ui_dnd_efl_object_event_callback_array_priority_add(Eo *obj, Efl_Ui_Dnd_Data *pd, + const Efl_Callback_Array_Item *array, + Efl_Callback_Priority priority, + const void *user_data) { - Item_Container_Drag_Info *di = data; - Evas_Coord x, y; - Efl_Object *obj = NULL; - - x = y = 0; - if (di->item_get_cb) - obj = di->item_get_cb(item, pos.x, pos.y, &x, &y); - if (pos_ret) + for (int i = 0; array[i].desc; ++i) { - pos_ret->x = x; - pos_ret->y = y; + if (IS_DROP_EVENT(array[i].desc) && !pd->registered) + { + pd->registered = EINA_TRUE; + if (efl_finalized_get(obj)) + _drop_event_register(obj); + } } - di->it = obj; - - return obj; -} - -static void -_cont_drag_free_data(Evas_Object *obj) -{ - Eina_List *di_list; - Item_Container_Drag_Info *di; - - di_list = efl_key_data_get(obj, "__cont_drag_item"); - di = eina_list_data_get(di_list); - di_list = eina_list_remove(di_list, di); - efl_key_data_set(obj, "__cont_drag_item", di_list); - free(di); -} - -static void -_cont_drag_obj_del_cb(void *data EINA_UNUSED, Evas *e EINA_UNUSED, Evas_Object *obj, void *event EINA_UNUSED) -{ - _cont_drag_free_data(obj); -} - -EAPI Eina_Bool -elm_drag_item_container_add(Evas_Object *obj, double anim_tm, double tm_to_drag, - Elm_Xy_Item_Get_Cb item_get_cb, Elm_Item_Container_Data_Get_Cb data_get_cb) -{ - Eo *sel_man = _efl_ui_selection_manager_get(obj); - int seatid = 1; - Eina_List *di_list; - Item_Container_Drag_Info *di; - -#ifdef HAVE_ELEMENTARY_WL2 - if (_wl_window_get(obj)) seatid = _wl_default_seat_id_get(obj); -#endif - - di = calloc(1, sizeof(Item_Container_Drag_Info)); - if (!di) return EINA_FALSE; - di->data_get_cb = data_get_cb; - di->item_get_cb = item_get_cb; - di_list = efl_key_data_get(obj, "__cont_drag_item"); - di_list = eina_list_append(di_list, di); - efl_key_data_set(obj, "__cont_drag_item", di_list); - evas_object_event_callback_add(obj, EVAS_CALLBACK_DEL, _cont_drag_obj_del_cb, NULL); - efl_ui_selection_manager_container_drag_item_add(sel_man, obj, tm_to_drag, anim_tm, - di, _cont_drag_data_func, NULL, - di, _cont_drag_item_func, NULL, - di, _cont_drag_icon_create, NULL, - di, _cont_drag_icon_list_create, NULL, - seatid); - return EINA_TRUE; + return efl_event_callback_array_priority_add(efl_super(obj, EFL_UI_DND_MIXIN), array, priority, user_data); } -EAPI Eina_Bool -elm_drag_item_container_del(Evas_Object *obj) -{ - Eo *sel_man = _efl_ui_selection_manager_get(obj); - int seatid = 1; - -#ifdef HAVE_ELEMENTARY_WL2 - if (_wl_window_get(obj)) seatid = _wl_default_seat_id_get(obj); -#endif - - _cont_drag_free_data(obj); - evas_object_event_callback_del(obj, EVAS_CALLBACK_DEL, _cont_drag_obj_del_cb); - efl_ui_selection_manager_container_drag_item_del(sel_man, obj, seatid); - - return EINA_TRUE; -} +#define EFL_UI_DND_EXTRA_OPS \ + EFL_OBJECT_OP_FUNC(efl_event_callback_priority_add, _efl_ui_dnd_efl_object_event_callback_priority_add), \ + EFL_OBJECT_OP_FUNC(efl_event_callback_array_priority_add, _efl_ui_dnd_efl_object_event_callback_array_priority_add), \ #include "efl_ui_dnd.eo.c" -#include "efl_ui_dnd_container.eo.c" diff --git a/src/lib/elementary/efl_ui_dnd.eo b/src/lib/elementary/efl_ui_dnd.eo index 08f668856b..49ef148723 100644 --- a/src/lib/elementary/efl_ui_dnd.eo +++ b/src/lib/elementary/efl_ui_dnd.eo @@ -1,63 +1,93 @@ -import efl_ui_dnd_types; +import eina_types; -mixin @beta Efl.Ui.Dnd { - data: null; +struct @beta Efl.Ui.Drop_Event { + [[Information sent along with Drag & Drop events.]] + position : Eina.Position2D; [[The position where the drop event occurred, in window coordinates.]] + seat : uint; [[Which seat triggered the event.]] + available_types : accessor<string>; [[Types with automatic conversion available. Use one of them in the call to + @Efl.Ui.Dnd.drop_data_get. + + Types are IANA MIME types: + https://www.iana.org/assignments/media-types/media-types.xhtml + ]] +} + +struct @beta Efl.Ui.Drop_Dropped_Event { + [[Information sent along with Drop events.]] + dnd : Efl.Ui.Drop_Event; [[Common information.]] + action : string; [[Requested action to perform upon reception of this data.]] +} + +struct @beta Efl.Ui.Drag_Started_Event { + [[Information sent along with @Efl.Ui.Drag_Started_Event events.]] + seat : uint; [[Which seat triggered the event.]] +} + +struct @beta Efl.Ui.Drag_Finished_Event { + [[Information sent along with @Efl.Ui.Drag_Finished_Event events.]] + seat : uint; [[Which seat triggered the event.]] + accepted : bool; [[$true if the operation completed with a Drop, or $false if it was cancelled.]] +} + +mixin @beta Efl.Ui.Dnd requires Efl.Object { + [[This mixin provides the ability to interact with the system's Drag & Drop facilities. + + Applications starting a Drag & Drop operation operation are said to perform a "Drag" and use + the methods prefixed "drag_". + On the other hand, applications receiving dragged content are said to perform a "Drop" operation and use + the methods prefixed "drop_". + ]] methods { drag_start { - [[Start a drag and drop process at the drag side. - During dragging, there are three events emitted as belows: - - EFL_UI_DND_EVENT_DRAG_POS - - EFL_UI_DND_EVENT_DRAG_ACCEPT - - EFL_UI_DND_EVENT_DRAG_DONE + [[Starts a drag from this client. + + @[Efl.Ui.Dnd.drag,started] is emitted each time a successful drag is started. + @[Efl.Ui.Dnd.drag,finished] is emitted every time a drag is finished. ]] params { - @in format: Efl.Ui.Selection_Format; [[The data format]] - @in data: Eina.Slice; [[The drag data]] - @in action: Efl.Ui.Selection_Action; [[Action when data is transferred]] - @in icon_func: Efl.Dnd.Drag_Icon_Create; [[Function pointer to create icon]] - @in seat: uint; [[Specified seat for multiple seats case.]] - } - } - drag_action_set { - [[Set the action for the drag]] - params { - @in action: Efl.Ui.Selection_Action; [[Drag action]] - @in seat: uint; [[Specified seat for multiple seats case.]] + content : Eina.Content @by_ref; [[The content being dragged.]] + @in action: string; [[Requested action to perform by the receiver once content is transferred.]] + @in seat: uint; [[Seat starting the drag operation. When in doubt use 0.]] } + return : Efl.Content; [[An Efl.Ui element which you can use to render a visual representation + of the content being dragged (like a thumbnail, for example). + Use @Efl.Content.content.set on it to do so.]] } drag_cancel { - [[Cancel the on-going drag]] + [[Cancels an on-going drag operation.]] params { - @in seat: uint; [[Specified seat for multiple seats case.]] + @in seat: uint; [[Seat that started the drag operation. When in doubt use 0.]] } } - drop_target_add { - [[Make the current object as drop target. - There are four events emitted: - - EFL_UI_DND_EVENT_DRAG_ENTER - - EFL_UI_DND_EVENT_DRAG_LEAVE - - EFL_UI_DND_EVENT_DRAG_POS - - EFL_UI_DND_EVENT_DRAG_DROP.]] + drop_data_get { + [[Retrieves the dropped data.]] params { - @in format: Efl.Ui.Selection_Format; [[Accepted data format]] - @in seat: uint; [[Specified seat for multiple seats case.]] - } - } - drop_target_del { - [[Delete the dropable status from object]] - params { - @in format: Efl.Ui.Selection_Format; [[Accepted data format]] - @in seat: uint; [[Specified seat for multiple seats case.]] + @in seat: uint; [[Seat that started the drag operation. When in doubt use 0.]] + @in acceptable_types : iterator<string>; [[List of strings describing the type of content the application + can accept. Types are IANA MIME types: + https://www.iana.org/assignments/media-types/media-types.xhtml.]] } + return : future<Eina.Content> @move; [[This future is fulfilled when the content is received (asynchronously) + and ready to use. + The Eina.Content specifies the type of the data. + If no matching type was found it returns an error. + ]] } } events { - /* FIXME: This is not very future-proof. Better return a struct. */ - drag,accept: ptr(bool); [[accept drag data]] - drag,done: void; [[drag is done (mouse up)]] - drag,enter: void; [[called when the drag object enters this object]] - drag,leave: void; [[called when the drag object leaves this object]] - drag,pos: Efl.Dnd.Drag_Pos; [[called when the drag object changes drag position]] - drag,drop: Efl.Ui.Selection_Data; [[called when the drag object dropped on this object]] + drop,entered : Efl.Ui.Drop_Event; [[Dragged content entered the window. Its type can already be checked with + @.drop_data_get to react before it is dropped, for example.]] + drop,left : Efl.Ui.Drop_Event; [[Dragged content left the window.]] + drop,position,changed : Efl.Ui.Drop_Event; [[Dragged content moved over the window. Its type can already be + checked with @.drop_data_get to react before it is dropped, + for example.]] + drop,dropped : Efl.Ui.Drop_Dropped_Event; [[Dragged content was dropped over the window.]] + drag,started : Efl.Ui.Drag_Started_Event; [[A Drag operation started.]] + drag,finished : Efl.Ui.Drag_Finished_Event;[[A Drag operation finished.]] + } + implements { + Efl.Object.constructor; + Efl.Object.invalidate; + Efl.Object.finalize; } } diff --git a/src/lib/elementary/efl_ui_dnd_container.eo b/src/lib/elementary/efl_ui_dnd_container.eo deleted file mode 100644 index 0cc1f3f945..0000000000 --- a/src/lib/elementary/efl_ui_dnd_container.eo +++ /dev/null @@ -1,46 +0,0 @@ -import efl_ui_dnd_types; - -mixin @beta Efl.Ui.Dnd_Container { - methods { - @property drag_delay_time { - [[The time since mouse down happens to drag starts.]] - set { - } - get { - } - values { - time: double; [[The drag delay time]] - } - } - drag_item_add { - [[This registers a drag for items in a container. Many items can be - dragged at a time. During dragging, there are three events emitted: - EFL_DND_EVENT_DRAG_POS, EFL_DND_EVENT_DRAG_ACCEPT, EFL_DND_EVENT_DRAG_DONE.]] - params { - @in data_func: Efl.Dnd.Drag_Data_Get; [[Data and its format]] - @in item_func: Efl.Dnd.Item_Get; [[Item to determine drag start]] - @in icon_func: Efl.Dnd.Drag_Icon_Create; [[Icon used during drag]] - @in icon_list_func: Efl.Dnd.Drag_Icon_List_Create; [[Icons used for animations CHECKING ]] - @in seat: uint; [[Specified seat for multiple seats case.]] - } - } - drag_item_del { - [[Remove drag function of items in the container object.]] - params { - @in seat: uint; [[Specified seat for multiple seats case.]] - } - } - drop_item_add { - params { - @in format: Efl.Ui.Selection_Format; [[Accepted data formats]] - @in item_func: Efl.Dnd.Item_Get; [[Get item at specific position]] - @in seat: uint; [[Specified seat for multiple seats case.]] - } - } - drop_item_del { - params { - @in seat: uint; [[Specified seat for multiple seats case.]] - } - } - } -} diff --git a/src/lib/elementary/efl_ui_dnd_types.eot b/src/lib/elementary/efl_ui_dnd_types.eot deleted file mode 100644 index ace1c8de7b..0000000000 --- a/src/lib/elementary/efl_ui_dnd_types.eot +++ /dev/null @@ -1,60 +0,0 @@ -import efl_ui_selection_types; - -function @beta Efl.Dnd.Drag_Icon_Create { - [[Function pointer for creating icon at the drag side.]] - params { - @in win: Efl.Canvas.Object; [[The window to create the objects relative to]] - @in drag_obj: Efl.Canvas.Object; [[The drag object]] - @out off: Eina.Position2D; [[Offset from the icon position to the cursor]] - } - return: Efl.Canvas.Object; [[The drag icon object]] -}; - -function @beta Efl.Dnd.Drag_Data_Get { - [[Function pointer for getting data and format at the drag side.]] - params { - @in obj: Efl.Canvas.Object; [[The container object]] - @out format: Efl.Ui.Selection_Format; [[Data format]] - @out drag_data: Eina.Rw_Slice; [[Data]] - @out action: Efl.Ui.Selection_Action; [[The drag action]] - } -}; - -function @beta Efl.Dnd.Item_Get { - [[Function pointer to find out which item is under position (x, y)]] - params { - @in obj: Efl.Canvas.Object; [[The container object]] - @in pos: Eina.Position2D; [[The coordinates to get item]] - @out posret: Eina.Position2D; [[position relative to item (left (-1), middle (0), right (1)]] - } - return: Efl.Object; [[Object under x,y coordinates or NULL if not found]] -}; - -function @beta Efl.Dnd.Drag_Icon_List_Create { - [[Function pointer to create list of icons at the drag side. - These icons are used for animation on combining selection icons - to one icon.]] - params { - @in obj: Efl.Canvas.Object; [[The container object]] - } - return: list<Efl.Canvas.Object>; -}; - -struct @beta Efl.Dnd.Drag_Accept { - accepted: bool; -} - -struct @beta Efl.Dnd.Drag_Pos { - [[Dragging position information.]] - pos: Eina.Position2D; [[Evas Coordinate]] - action: Efl.Ui.Selection_Action; [[The drag action]] - format: Efl.Ui.Selection_Format; [[The drag format]] - item: Efl.Canvas.Object; [[The item object. It is only available for container object.]] -} - -struct @beta Efl.Dnd.Drag_Item_Container_Drop { - [[Drop information for a drag&drop operation.]] - item: Efl.Canvas.Object; [[The item object]] - data: Efl.Ui.Selection_Data; [[The selection data]] - pos: Eina.Position2D; [[Position relative to item (left (-1), middle (0), right (1)]] -} diff --git a/src/lib/elementary/efl_ui_exact_model.c b/src/lib/elementary/efl_ui_exact_model.c index b12cfba8bd..9c33709123 100644 --- a/src/lib/elementary/efl_ui_exact_model.c +++ b/src/lib/elementary/efl_ui_exact_model.c @@ -54,20 +54,6 @@ _efl_ui_exact_model_efl_object_constructor(Eo *obj, Efl_Ui_Exact_Model_Data *pd) return efl_constructor(efl_super(obj, EFL_UI_EXACT_MODEL_CLASS)); } -static unsigned int -_efl_ui_exact_model_list_find(unsigned int list_index, Eina_List *start, Eina_List **l) -{ - Eina_Binbuf *tbuf; - - EINA_LIST_FOREACH(start, *l, tbuf) - { - if (list_index == 0) break; - list_index--; - } - - return list_index; -} - static Eina_List * _efl_ui_exact_model_slot_compress(unsigned int index, Eina_List *compressed, unsigned int *buffer) { @@ -78,7 +64,7 @@ _efl_ui_exact_model_slot_compress(unsigned int index, Eina_List *compressed, uns Eina_List *l = NULL; unsigned int i; - _efl_ui_exact_model_list_find(list_index, compressed, &l); + l = eina_list_nth_list(compressed, list_index); tbuf = eina_binbuf_manage_new((unsigned char *) buffer, EFL_UI_EXACT_MODEL_CONTENT_LENGTH, EINA_TRUE); if (!tbuf) return compressed; @@ -136,16 +122,15 @@ _efl_ui_exact_model_slot_compress(unsigned int index, Eina_List *compressed, uns static unsigned int * _efl_ui_exact_model_buffer_expand(unsigned int list_index, unsigned int *buffer, Eina_List *list) { - unsigned int found; Eina_Binbuf *tmp; Eina_List *l = NULL; if (!buffer) buffer = malloc(EFL_UI_EXACT_MODEL_CONTENT_LENGTH); - found = _efl_ui_exact_model_list_find(list_index, list, &l); + l = eina_list_nth_list(list, list_index); // Check if the data is in the list - if (!found) + if (!l) { // Not found -> everything is assumed to be zero memset(buffer, 0, EFL_UI_EXACT_MODEL_CONTENT_LENGTH); @@ -219,7 +204,7 @@ _efl_ui_exact_model_slot_find(Efl_Ui_Exact_Model_Data *pd, unsigned int index, pd->parent->slot[found].start_offset = index / EFL_UI_EXACT_MODEL_CONTENT; } - // Increase usage of the returnd slot for now + // Increase usage of the returned slot for now pd->parent->slot[found].usage++; // Unpack the data if requested diff --git a/src/lib/elementary/efl_ui_flip.c b/src/lib/elementary/efl_ui_flip.c index 26f8d848bf..b40e9d769c 100644 --- a/src/lib/elementary/efl_ui_flip.c +++ b/src/lib/elementary/efl_ui_flip.c @@ -536,7 +536,7 @@ _state_update(Evas_Object *obj) if (mx < 1) mx = 1; // quick hack to keep curl line visible - if (mgrad == 0.0) // special horizontal case + if (EINA_DBL_EQ(mgrad, 0.0)) // special horizontal case mgrad = 0.001; // quick dirty hack for now // else { @@ -1962,13 +1962,13 @@ _efl_ui_flip_go_to(Eo *obj, Efl_Ui_Flip_Data *sd, Eina_Bool front, Efl_Ui_Flip_M { if (sd->next_state == front) return; - _internal_elm_flip_go_to(obj, sd, front, mode); + _internal_elm_flip_go_to(obj, sd, front, (Elm_Flip_Mode)mode); } EOLIAN static void _efl_ui_flip_go(Eo *obj, Efl_Ui_Flip_Data *sd, Efl_Ui_Flip_Mode mode) { - _internal_elm_flip_go_to(obj, sd, !sd->state, mode); + _internal_elm_flip_go_to(obj, sd, !sd->state, (Elm_Flip_Mode)mode); } static void @@ -2099,7 +2099,7 @@ _efl_ui_flip_interaction_direction_hitsize_set(Eo *obj, Efl_Ui_Flip_Data *sd, Ef else if (hitsize > 1.0) hitsize = 1.0; - if (sd->dir_hitsize[i] == hitsize) return; + if (EINA_DBL_EQ(sd->dir_hitsize[i], hitsize)) return; sd->dir_hitsize[i] = hitsize; if (hitsize >= 0.0) diff --git a/src/lib/elementary/efl_ui_flip_eo.legacy.c b/src/lib/elementary/efl_ui_flip_eo.legacy.c index 9968236d88..9e7795664c 100644 --- a/src/lib/elementary/efl_ui_flip_eo.legacy.c +++ b/src/lib/elementary/efl_ui_flip_eo.legacy.c @@ -2,13 +2,13 @@ EAPI void elm_flip_interaction_set(Elm_Flip *obj, Elm_Flip_Interaction mode) { - efl_ui_flip_interaction_set(obj, mode); + efl_ui_flip_interaction_set(obj, (Efl_Ui_Flip_Interaction)mode); } EAPI Elm_Flip_Interaction elm_flip_interaction_get(const Elm_Flip *obj) { - return efl_ui_flip_interaction_get(obj); + return (Elm_Flip_Interaction)efl_ui_flip_interaction_get(obj); } EAPI Eina_Bool @@ -20,11 +20,11 @@ elm_flip_front_visible_get(const Elm_Flip *obj) EAPI void elm_flip_go(Elm_Flip *obj, Elm_Flip_Mode mode) { - efl_ui_flip_go(obj, mode); + efl_ui_flip_go(obj, (Efl_Ui_Flip_Mode)mode); } EAPI void elm_flip_go_to(Elm_Flip *obj, Eina_Bool front, Elm_Flip_Mode mode) { - efl_ui_flip_go_to(obj, front, mode); + efl_ui_flip_go_to(obj, front, (Efl_Ui_Flip_Mode)mode); } diff --git a/src/lib/elementary/efl_ui_flip_legacy_eo.h b/src/lib/elementary/efl_ui_flip_legacy_eo.h index 8d578ddac5..a5b02aa7d4 100644 --- a/src/lib/elementary/efl_ui_flip_legacy_eo.h +++ b/src/lib/elementary/efl_ui_flip_legacy_eo.h @@ -20,7 +20,7 @@ typedef Eo Efl_Ui_Flip_Legacy; */ #define EFL_UI_FLIP_LEGACY_CLASS efl_ui_flip_legacy_class_get() -EWAPI const Efl_Class *efl_ui_flip_legacy_class_get(void); +EWAPI const Efl_Class *efl_ui_flip_legacy_class_get(void) EINA_CONST; #endif /* EFL_BETA_API_SUPPORT */ #endif diff --git a/src/lib/elementary/efl_ui_focus_layer.c b/src/lib/elementary/efl_ui_focus_layer.c index ccbe1d31e8..a183c7e8a3 100644 --- a/src/lib/elementary/efl_ui_focus_layer.c +++ b/src/lib/elementary/efl_ui_focus_layer.c @@ -147,7 +147,17 @@ _efl_ui_focus_layer_enable_set(Eo *obj, Efl_Ui_Focus_Layer_Data *pd, Eina_Bool v pd->old_focus = NULL; if (fallback && efl_ui_focus_manager_redirect_get(pd->registered_manager) == obj) - efl_ui_focus_manager_redirect_set(pd->registered_manager, NULL); + { + Efl_Ui_Focus_Manager *m = pd->registered_manager; + + while (efl_ui_focus_manager_redirect_get(m)) + { + Efl_Ui_Focus_Manager *old = m; + + m = efl_ui_focus_manager_redirect_get(m); + efl_ui_focus_manager_redirect_set(old, NULL); + } + } efl_ui_focus_manager_calc_unregister(pd->registered_manager, obj); pd->registered_manager = NULL; diff --git a/src/lib/elementary/efl_ui_focus_manager.c b/src/lib/elementary/efl_ui_focus_manager.c index 31afb9dc98..8f63f8e25c 100644 --- a/src/lib/elementary/efl_ui_focus_manager.c +++ b/src/lib/elementary/efl_ui_focus_manager.c @@ -8,10 +8,10 @@ EAPI void efl_ui_focus_relation_free(Efl_Ui_Focus_Relations *rel) { - eina_list_free(rel->right); - eina_list_free(rel->left); - eina_list_free(rel->top); - eina_list_free(rel->down); + eina_iterator_free(rel->right); + eina_iterator_free(rel->left); + eina_iterator_free(rel->top); + eina_iterator_free(rel->down); free(rel); } diff --git a/src/lib/elementary/efl_ui_focus_manager.eo b/src/lib/elementary/efl_ui_focus_manager.eo index 5bb11e7036..080edaaf7a 100644 --- a/src/lib/elementary/efl_ui_focus_manager.eo +++ b/src/lib/elementary/efl_ui_focus_manager.eo @@ -4,10 +4,10 @@ import eina_types; struct @beta @free(efl_ui_focus_relation_free) Efl.Ui.Focus.Relations { [[Structure holding the graph of relations between focusable objects. ]] - right : list<Efl.Ui.Focus.Object> @move; [[List of objects to the right.]] - left : list<Efl.Ui.Focus.Object> @move; [[List of objects to the left.]] - top : list<Efl.Ui.Focus.Object> @move; [[List of objects above.]] - down : list<Efl.Ui.Focus.Object> @move; [[List of objects below.]] + right : iterator<Efl.Ui.Focus.Object> @move; [[List of objects to the right.]] + left : iterator<Efl.Ui.Focus.Object> @move; [[List of objects to the left.]] + top : iterator<Efl.Ui.Focus.Object> @move; [[List of objects above.]] + down : iterator<Efl.Ui.Focus.Object> @move; [[List of objects below.]] next : Efl.Ui.Focus.Object; [[Next object.]] prev : Efl.Ui.Focus.Object; [[Previous object.]] parent : Efl.Ui.Focus.Object; [[Parent object.]] @@ -96,6 +96,15 @@ interface Efl.Ui.Focus.Manager { over the border objects.]] } } + @property border_elements_changed { + [[Return $true if the border elements have changed since the last invocation of @.border_elements.get]] + get { + + } + values { + changed : bool; [[$true if there was a change, $false if not]] + } + } @property viewport_elements { [[Elements that are at the border of the viewport diff --git a/src/lib/elementary/efl_ui_focus_manager_calc.c b/src/lib/elementary/efl_ui_focus_manager_calc.c index efb67fcabf..5b7589d95f 100644 --- a/src/lib/elementary/efl_ui_focus_manager_calc.c +++ b/src/lib/elementary/efl_ui_focus_manager_calc.c @@ -85,6 +85,7 @@ typedef struct { int freeze; Node *root; + Eina_Bool border_elements_changed; } Efl_Ui_Focus_Manager_Calc_Data; static Eina_Mempool *_node_mempool; @@ -111,11 +112,11 @@ _focus_manager_active_get(Eo *obj) { Eo *root, *manager, *comp_parent, *redirect; - if (efl_isa(obj, EFL_UI_FOCUS_MANAGER_WINDOW_ROOT_INTERFACE) || - (efl_composite_part_is(obj) && efl_isa(efl_parent_get(obj), EFL_UI_FOCUS_MANAGER_WINDOW_ROOT_INTERFACE))) + root = efl_ui_focus_manager_root_get(obj); + + if (efl_isa(root, EFL_UI_FOCUS_MANAGER_WINDOW_ROOT_INTERFACE)) return EINA_TRUE; - root = efl_ui_focus_manager_root_get(obj); manager = efl_ui_focus_object_focus_manager_get(root); if (!manager) return EINA_FALSE; @@ -159,20 +160,25 @@ _manager_in_chain_set(Eo *obj, Efl_Ui_Focus_Manager_Calc_Data *pd) efl_class_name_get(pd->root->focusable), root); } + static void border_onedirection_set(Node *node, Efl_Ui_Focus_Direction direction, Eina_List *list) { Node *partner; Eina_List *lnode; Border *border; + Efl_Ui_Focus_Direction complement; EINA_SAFETY_ON_FALSE_RETURN(DIRECTION_IS_2D(direction)); + complement = efl_ui_focus_util_direction_complement(direction); + //this is basically a nop. The complement of 2D will *always* be 2D + EINA_SAFETY_ON_FALSE_RETURN(DIRECTION_IS_2D(complement)); border = &DIRECTION_ACCESS(node, direction); EINA_LIST_FREE(border->one_direction, partner) { - Border *b = &DIRECTION_ACCESS(partner, efl_ui_focus_util_direction_complement(direction)); + Border *b = &DIRECTION_ACCESS(partner, complement); b->cleanup_nodes = eina_list_remove(b->cleanup_nodes, node); } @@ -180,7 +186,7 @@ border_onedirection_set(Node *node, Efl_Ui_Focus_Direction direction, Eina_List EINA_LIST_FOREACH(border->one_direction, lnode, partner) { - Border *comp_border = &DIRECTION_ACCESS(partner,efl_ui_focus_util_direction_complement(direction)); + Border *comp_border = &DIRECTION_ACCESS(partner, complement); comp_border->cleanup_nodes = eina_list_append(comp_border->cleanup_nodes, node); } @@ -191,14 +197,18 @@ border_onedirection_cleanup(Node *node, Efl_Ui_Focus_Direction direction) { Node *partner; Border *border; + Efl_Ui_Focus_Direction complement; EINA_SAFETY_ON_FALSE_RETURN(DIRECTION_IS_2D(direction)); + complement = efl_ui_focus_util_direction_complement(direction); + //this is basically a nop. The complement of 2D will *always* be 2D + EINA_SAFETY_ON_FALSE_RETURN(DIRECTION_IS_2D(complement)); border = &DIRECTION_ACCESS(node, direction); EINA_LIST_FREE(border->cleanup_nodes, partner) { - Border *b = &DIRECTION_ACCESS(partner, efl_ui_focus_util_direction_complement(direction)); + Border *b = &DIRECTION_ACCESS(partner, complement); b->one_direction = eina_list_remove(b->one_direction, node); } } @@ -247,7 +257,6 @@ node_item_free(Node *item) Eina_List *l; Eo *obj = item->manager; FOCUS_DATA(obj); - Eina_Bool dirty_added = EINA_FALSE; /*cleanup graph parts*/ @@ -264,7 +273,7 @@ node_item_free(Node *item) if (partner->type != NODE_TYPE_ONLY_LOGICAL) \ { \ dirty_add(obj, pd, partner); \ - dirty_added = EINA_TRUE; \ + pd->border_elements_changed = EINA_TRUE; \ } \ } @@ -278,7 +287,7 @@ node_item_free(Node *item) } //the unregistering of a item should ever result in atleast a coords_dirty call - if (dirty_added) + if (pd->border_elements_changed) efl_event_callback_call(obj, EFL_UI_FOCUS_MANAGER_EVENT_COORDS_DIRTY, NULL); /*cleanup manager householdings*/ @@ -402,6 +411,8 @@ dirty_flush_node(Efl_Ui_Focus_Manager *obj EINA_UNUSED, Efl_Ui_Focus_Manager_Cal { Efl_Ui_Focus_Direction direction = -1; Efl_Ui_Focus_Graph_Calc_Direction_Result *res = NULL; + Node *partner; + Eina_List *n; if (i == 0) { @@ -424,6 +435,9 @@ dirty_flush_node(Efl_Ui_Focus_Manager *obj EINA_UNUSED, Efl_Ui_Focus_Manager_Cal res = &result.bottom; } + EINA_LIST_FOREACH(res->relation, n, partner) + partner->unused = EINA_FALSE; + border_onedirection_set(node, direction, res->relation); } @@ -470,7 +484,9 @@ dirty_add(Eo *obj, Efl_Ui_Focus_Manager_Calc_Data *pd, Node *dirty) pd->dirty = eina_list_append(pd->dirty, dirty); dirty->on_list = EINA_TRUE; - efl_event_callback_call(obj, EFL_UI_FOCUS_MANAGER_EVENT_COORDS_DIRTY, NULL); + if (!pd->border_elements_changed) + efl_event_callback_call(obj, EFL_UI_FOCUS_MANAGER_EVENT_COORDS_DIRTY, NULL); + pd->border_elements_changed = EINA_TRUE; } @@ -776,10 +792,10 @@ _efl_ui_focus_manager_calc_update_children(Eo *obj EINA_UNUSED, Efl_Ui_Focus_Man } static inline Node* -_request_subchild_except(Node *n, Node *except) +_request_subchild_except(Node *n, Eo *except) { n = _request_subchild(n); - while (n == except) + while (n && n->focusable == except) { n = _next(n); } @@ -788,7 +804,7 @@ _request_subchild_except(Node *n, Node *except) } EOLIAN static void -_efl_ui_focus_manager_calc_unregister(Eo *obj EINA_UNUSED, Efl_Ui_Focus_Manager_Calc_Data *pd, Efl_Ui_Focus_Object *child) +_efl_ui_focus_manager_calc_unregister(Eo *obj, Efl_Ui_Focus_Manager_Calc_Data *pd, Efl_Ui_Focus_Object *child) { Node *node; @@ -800,7 +816,7 @@ _efl_ui_focus_manager_calc_unregister(Eo *obj EINA_UNUSED, Efl_Ui_Focus_Manager_ if (eina_list_last_data_get(pd->focus_stack) == node) { - if (!efl_invalidated_get(pd->root->focusable)) + if (!efl_invalidated_get(pd->root->focusable) && _focus_manager_active_get(obj)) { Node *n = NULL; @@ -810,7 +826,7 @@ _efl_ui_focus_manager_calc_unregister(Eo *obj EINA_UNUSED, Efl_Ui_Focus_Manager_ { n = eina_list_nth(pd->focus_stack, eina_list_count(pd->focus_stack) - 2); if (!n) - n = _request_subchild_except(pd->root, node); + n = _request_subchild_except(pd->root, node->focusable); if (n) efl_ui_focus_manager_focus_set(obj, n->focusable); @@ -869,7 +885,7 @@ _efl_ui_focus_manager_calc_efl_ui_focus_manager_redirect_set(Eo *obj, Efl_Ui_Foc } else { - n = _request_subchild(pd->root); + n = _request_subchild_except(pd->root, pd->redirect_entry); if (n) efl_ui_focus_manager_focus_set(obj, n->focusable); } @@ -919,6 +935,7 @@ _efl_ui_focus_manager_calc_efl_object_constructor(Eo *obj, Efl_Ui_Focus_Manager_ pd->node_hash = eina_hash_pointer_new(_free_node); pd->graph_ctx.offset_focusable = offsetof(Node, focusable); + pd->border_elements_changed = EINA_TRUE; return obj; } @@ -1105,9 +1122,18 @@ _elements_iterator_new(const Eo *obj, Efl_Ui_Focus_Manager_Calc_Data *pd) EOLIAN static Eina_Iterator* _efl_ui_focus_manager_calc_efl_ui_focus_manager_border_elements_get(const Eo *obj, Efl_Ui_Focus_Manager_Calc_Data *pd) { + pd->border_elements_changed = EINA_FALSE; return (Eina_Iterator*) _elements_iterator_new(obj, pd); } + +EOLIAN static Eina_Bool +_efl_ui_focus_manager_calc_efl_ui_focus_manager_border_elements_changed_get(const Eo *obj EINA_UNUSED, Efl_Ui_Focus_Manager_Calc_Data *pd) +{ + return pd->border_elements_changed; +} + + EOLIAN static Eina_Iterator* _efl_ui_focus_manager_calc_efl_ui_focus_manager_viewport_elements_get(const Eo *obj, Efl_Ui_Focus_Manager_Calc_Data *pd, Eina_Rect viewport) { @@ -1789,18 +1815,6 @@ _efl_ui_focus_manager_calc_efl_object_finalize(Eo *obj, Efl_Ui_Focus_Manager_Cal return result; } -static Eina_List* -_convert(Border b) -{ - Eina_List *n, *par = NULL; - Node *node; - - EINA_LIST_FOREACH(b.one_direction, n, node) - par = eina_list_append(par, node->focusable); - - return par; -} - EOLIAN static Efl_Ui_Focus_Object* _efl_ui_focus_manager_calc_efl_ui_focus_manager_manager_focus_get(const Eo *obj EINA_UNUSED, Efl_Ui_Focus_Manager_Calc_Data *pd) { @@ -1815,6 +1829,63 @@ _efl_ui_focus_manager_calc_efl_ui_focus_manager_manager_focus_get(const Eo *obj return upper->focusable; } +typedef struct _Eina_Iterator_Focusable Eina_Iterator_Focusable; +struct _Eina_Iterator_Focusable +{ + Eina_Iterator iterator; + + Eina_Iterator *redirect; +}; + +static Eina_Bool +_node_focusable_iterator_next(Eina_Iterator_Focusable *it, void **data) +{ + Node *node = NULL; + Eina_Bool r; + + if (!it->redirect) return EINA_FALSE; + + r = eina_iterator_next(it->redirect, (void **) &node); + if (r && data) *data = node->focusable; + + return r; +} + +static Eina_List * +_node_focusable_iterator_get_container(Eina_Iterator_Focusable *it) +{ + if (!it->redirect) return NULL; + + return eina_iterator_container_get(it->redirect); +} + +static void +_node_focusable_iterator_free(Eina_Iterator_Focusable *it) +{ + eina_iterator_free(it->redirect); + EINA_MAGIC_SET(&it->iterator, 0); + free(it); +} + +static Eina_Iterator * +_node_focusable_iterator_new(Eina_List *nodes) +{ + Eina_Iterator_Focusable *it; + + it = calloc(1, sizeof (Eina_Iterator_Focusable)); + if (!it) return NULL; + + EINA_MAGIC_SET(&it->iterator, EINA_MAGIC_ITERATOR); + it->redirect = eina_list_iterator_new(nodes); + + it->iterator.version = EINA_ITERATOR_VERSION; + it->iterator.next = FUNC_ITERATOR_NEXT(_node_focusable_iterator_next); + it->iterator.get_container = FUNC_ITERATOR_GET_CONTAINER(_node_focusable_iterator_get_container); + it->iterator.free = FUNC_ITERATOR_FREE(_node_focusable_iterator_free); + + return &it->iterator; +} + EOLIAN static Efl_Ui_Focus_Relations* _efl_ui_focus_manager_calc_efl_ui_focus_manager_fetch(Eo *obj, Efl_Ui_Focus_Manager_Calc_Data *pd, Efl_Ui_Focus_Object *child) { @@ -1834,12 +1905,14 @@ _efl_ui_focus_manager_calc_efl_ui_focus_manager_fetch(Eo *obj, Efl_Ui_Focus_Mana efl_ui_focus_object_setup_order(n->tree.parent->focusable); efl_ui_focus_object_setup_order(n->focusable); -#define DIR_CLONE(dir) _convert(DIRECTION_ACCESS(n,dir)); + // FIXME: the iterator must actually return the (Node*)->focusable object in it + // Just redirect to default eina list iterator but offset the returned pointer? +#define DIR_ITERATOR(dir) _node_focusable_iterator_new(DIRECTION_ACCESS(n,dir).one_direction); - res->right = DIR_CLONE(EFL_UI_FOCUS_DIRECTION_RIGHT); - res->left = DIR_CLONE(EFL_UI_FOCUS_DIRECTION_LEFT); - res->top = DIR_CLONE(EFL_UI_FOCUS_DIRECTION_UP); - res->down = DIR_CLONE(EFL_UI_FOCUS_DIRECTION_DOWN); + res->right = DIR_ITERATOR(EFL_UI_FOCUS_DIRECTION_RIGHT); + res->left = DIR_ITERATOR(EFL_UI_FOCUS_DIRECTION_LEFT); + res->top = DIR_ITERATOR(EFL_UI_FOCUS_DIRECTION_UP); + res->down = DIR_ITERATOR(EFL_UI_FOCUS_DIRECTION_DOWN); res->next = (tmp = _next(n)) ? tmp->focusable : NULL; res->prev = (tmp = _prev(n)) ? tmp->focusable : NULL; res->position_in_history = eina_list_data_idx(pd->focus_stack, n); @@ -1850,7 +1923,7 @@ _efl_ui_focus_manager_calc_efl_ui_focus_manager_fetch(Eo *obj, Efl_Ui_Focus_Mana if (T(n).parent) res->parent = T(n).parent->focusable; res->redirect = n->redirect_manager; -#undef DIR_CLONE +#undef DIR_ITERATOR return res; } @@ -1951,7 +2024,7 @@ _efl_ui_focus_manager_calc_efl_ui_focus_manager_pop_history_stack(Eo *obj EINA_U } else { - last = _request_subchild_except(pd->root, node_get(obj, pd, last_focusable)); + last = _request_subchild_except(pd->root, last_focusable); if (last) efl_ui_focus_manager_focus_set(obj, last->focusable); } @@ -2014,7 +2087,27 @@ _efl_ui_focus_manager_calc_efl_ui_focus_manager_dirty_logic_unfreeze(Eo *obj, Ef } } +static void +_efl_ui_focus_manager_calc_update_children_ownership_fallback(Efl_Ui_Focus_Object *parent, Eina_List *children) +{ + (void)parent; + eina_list_free(children); +} + +EOAPI EFL_FUNC_BODYV_FALLBACK(efl_ui_focus_manager_calc_update_children, Eina_Bool, 0, _efl_ui_focus_manager_calc_update_children_ownership_fallback(parent, children);, EFL_FUNC_CALL(parent, children), Efl_Ui_Focus_Object *parent, Eina_List *children); + +static void +_efl_ui_focus_manager_calc_update_order_ownership_fallback(Efl_Ui_Focus_Object *parent, Eina_List *children) +{ + (void)parent; + eina_list_free(children); +} + +EOAPI EFL_VOID_FUNC_BODYV_FALLBACK(efl_ui_focus_manager_calc_update_order, _efl_ui_focus_manager_calc_update_order_ownership_fallback(parent, children);, EFL_FUNC_CALL(parent, children), Efl_Ui_Focus_Object *parent, Eina_List *children); + #define EFL_UI_FOCUS_MANAGER_CALC_EXTRA_OPS \ - EFL_OBJECT_OP_FUNC(efl_dbg_info_get, _efl_ui_focus_manager_calc_efl_object_dbg_info_get) + EFL_OBJECT_OP_FUNC(efl_dbg_info_get, _efl_ui_focus_manager_calc_efl_object_dbg_info_get), \ + EFL_OBJECT_OP_FUNC(efl_ui_focus_manager_calc_update_children, _efl_ui_focus_manager_calc_update_children), \ + EFL_OBJECT_OP_FUNC(efl_ui_focus_manager_calc_update_order, _efl_ui_focus_manager_calc_update_order) #include "efl_ui_focus_manager_calc.eo.c" diff --git a/src/lib/elementary/efl_ui_focus_manager_calc.eo b/src/lib/elementary/efl_ui_focus_manager_calc.eo index cd9ad90fa5..d7f9124fe8 100644 --- a/src/lib/elementary/efl_ui_focus_manager_calc.eo +++ b/src/lib/elementary/efl_ui_focus_manager_calc.eo @@ -55,25 +55,6 @@ class @beta Efl.Ui.Focus.Manager_Calc extends Efl.Object implements Efl.Ui.Focus } return : bool; [[$true if successful, $false otherwise.]] } - update_children { - [[Sets the list of children to a different order.]] - params { - parent : Efl.Ui.Focus.Object; [[The parent to update.]] - children : list<Efl.Ui.Focus.Object> @move; [[The list of children with the new order.]] - } - return : bool; [[$true if successful, $false otherwise.]] - } - update_order { - [[Sets the list of children to a different order. - - Objects in the list which are not children of $parent are ignored. - Compare to @.update_children. - ]] - params { - parent : Efl.Ui.Focus.Object; [[The parent to update.]] - children : list<Efl.Ui.Focus.Object> @move; [[The list of objects with the new order.]] - } - } unregister { [[Unregister the given item from the focus graph.]] params { @@ -89,6 +70,7 @@ class @beta Efl.Ui.Focus.Manager_Calc extends Efl.Object implements Efl.Ui.Focus Efl.Ui.Focus.Manager.manager_focus {get; set;} Efl.Ui.Focus.Manager.redirect {set; get;} Efl.Ui.Focus.Manager.border_elements {get;} + Efl.Ui.Focus.Manager.border_elements_changed {get;} Efl.Ui.Focus.Manager.viewport_elements {get;} Efl.Ui.Focus.Manager.root {set; get;} Efl.Ui.Focus.Manager.request_subchild; diff --git a/src/lib/elementary/efl_ui_focus_manager_sub.c b/src/lib/elementary/efl_ui_focus_manager_sub.c index 7a2de74003..2d4a872d74 100644 --- a/src/lib/elementary/efl_ui_focus_manager_sub.c +++ b/src/lib/elementary/efl_ui_focus_manager_sub.c @@ -9,7 +9,6 @@ #define MY_DATA(o, p) Efl_Ui_Focus_Manager_Sub_Data *p = efl_data_scope_get(o, MY_CLASS); typedef struct { Efl_Ui_Focus_Manager *manager;//the manager where current_border is currently registered - Eina_Bool self_dirty; Eina_List *current_border; //the current set of widgets which is registered as borders } Efl_Ui_Focus_Manager_Sub_Data; @@ -94,7 +93,6 @@ _border_flush(Eo *obj, Efl_Ui_Focus_Manager_Sub_Data *pd) eina_list_free(pd->current_border); pd->current_border = selection; - pd->self_dirty = EINA_FALSE; } static void @@ -116,7 +114,7 @@ _parent_manager_pre_flush(void *data, const Efl_Event *ev EINA_UNUSED) { MY_DATA(data, pd); - if (!pd->self_dirty) return; //we are not interested + if (!efl_ui_focus_manager_border_elements_changed_get(data)) return; _border_flush(data, pd); } @@ -152,14 +150,6 @@ EFL_CALLBACKS_ARRAY_DEFINE(parent_manager, ); static void -_self_manager_dirty(void *data EINA_UNUSED, const Efl_Event *ev EINA_UNUSED) -{ - MY_DATA(data, pd); - - pd->self_dirty = EINA_TRUE; -} - -static void _logical_manager_change(void *data EINA_UNUSED, const Efl_Event *ev) { MY_DATA(data, pd); @@ -217,7 +207,6 @@ _manager_change(void *data, const Efl_Event *ev EINA_UNUSED) } EFL_CALLBACKS_ARRAY_DEFINE(self_manager, - {EFL_UI_FOCUS_MANAGER_EVENT_COORDS_DIRTY, _self_manager_dirty}, {EFL_UI_FOCUS_OBJECT_EVENT_FOCUS_PARENT_CHANGED, _logical_manager_change}, {EFL_UI_FOCUS_OBJECT_EVENT_FOCUS_MANAGER_CHANGED, _manager_change} ); @@ -228,8 +217,6 @@ _efl_ui_focus_manager_sub_efl_object_constructor(Eo *obj, Efl_Ui_Focus_Manager_S obj = efl_constructor(efl_super(obj, MY_CLASS)); efl_event_callback_array_add(obj, self_manager(), obj); - pd->self_dirty = EINA_TRUE; - return obj; } diff --git a/src/lib/elementary/efl_ui_focus_parent_provider_gen_eo.h b/src/lib/elementary/efl_ui_focus_parent_provider_gen_eo.h index 1200debba4..fdc5a98ab7 100644 --- a/src/lib/elementary/efl_ui_focus_parent_provider_gen_eo.h +++ b/src/lib/elementary/efl_ui_focus_parent_provider_gen_eo.h @@ -20,7 +20,7 @@ typedef Eo Efl_Ui_Focus_Parent_Provider_Gen; */ #define EFL_UI_FOCUS_PARENT_PROVIDER_GEN_CLASS efl_ui_focus_parent_provider_gen_class_get() -EWAPI const Efl_Class *efl_ui_focus_parent_provider_gen_class_get(void); +EWAPI const Efl_Class *efl_ui_focus_parent_provider_gen_class_get(void) EINA_CONST; /** * @brief Content item map property diff --git a/src/lib/elementary/efl_ui_format.c b/src/lib/elementary/efl_ui_format.c index c4dc85353d..c24111466c 100644 --- a/src/lib/elementary/efl_ui_format.c +++ b/src/lib/elementary/efl_ui_format.c @@ -336,15 +336,19 @@ _efl_ui_format_decimal_places_get(Eo *obj EINA_UNUSED, Efl_Ui_Format_Data *pd) EOLIAN static void _efl_ui_format_efl_object_destructor(Eo *obj, Efl_Ui_Format_Data *pd EINA_UNUSED) { - /* Legacy widgets keep their own formatting data and have their own destructors */ - if (!elm_widget_is_legacy(obj)) - { - /* Otherwise, free formatting data */ - efl_ui_format_func_set(obj, NULL, NULL, NULL); - efl_ui_format_values_set(obj, NULL); - efl_ui_format_string_set(obj, NULL, 0); - } - efl_destructor(efl_super(obj, EFL_UI_FORMAT_MIXIN)); + if (pd->format_func_free) + { + efl_ui_format_func_set(obj, NULL, NULL, NULL); + } + if (pd->format_values) + { + efl_ui_format_values_set(obj, NULL); + } + if (pd->format_string_type) + { + efl_ui_format_string_set(obj, NULL, 0); + } + efl_destructor(efl_super(obj, EFL_UI_FORMAT_MIXIN)); } #include "efl_ui_format.eo.c" diff --git a/src/lib/elementary/efl_ui_format.eo b/src/lib/elementary/efl_ui_format.eo index 3e2bd287bb..e711537492 100644 --- a/src/lib/elementary/efl_ui_format.eo +++ b/src/lib/elementary/efl_ui_format.eo @@ -1,5 +1,3 @@ -import eina_types; - function Efl.Ui.Format_Func { [[A function taking an @Eina.Value and producing its textual representation. diff --git a/src/lib/elementary/efl_ui_frame_legacy.h b/src/lib/elementary/efl_ui_frame_legacy.h index 8d225885ae..c6328ce935 100644 --- a/src/lib/elementary/efl_ui_frame_legacy.h +++ b/src/lib/elementary/efl_ui_frame_legacy.h @@ -6,7 +6,7 @@ typedef Eo Elm_Frame; * @param parent The parent object * @return The new object or NULL if it cannot be created * - * @ingroup Elm_Frame + * @ingroup Elm_Frame_Group */ EAPI Evas_Object *elm_frame_add(Evas_Object *parent); diff --git a/src/lib/elementary/efl_ui_frame_legacy_eo.h b/src/lib/elementary/efl_ui_frame_legacy_eo.h index ea4b164ba8..8f741e8911 100644 --- a/src/lib/elementary/efl_ui_frame_legacy_eo.h +++ b/src/lib/elementary/efl_ui_frame_legacy_eo.h @@ -25,7 +25,7 @@ typedef Eo Efl_Ui_Frame_Legacy; */ #define EFL_UI_FRAME_LEGACY_CLASS efl_ui_frame_legacy_class_get() -EWAPI const Efl_Class *efl_ui_frame_legacy_class_get(void); +EWAPI const Efl_Class *efl_ui_frame_legacy_class_get(void) EINA_CONST; #endif /* EFL_BETA_API_SUPPORT */ #endif diff --git a/src/lib/elementary/efl_ui_image.c b/src/lib/elementary/efl_ui_image.c index 213d55edd2..4156728027 100644 --- a/src/lib/elementary/efl_ui_image.c +++ b/src/lib/elementary/efl_ui_image.c @@ -103,7 +103,11 @@ _on_image_preloaded(void *data, if (sd->show) evas_object_show(obj); _prev_img_del(sd); err = evas_object_image_load_error_get(obj); - if (!err) evas_object_smart_callback_call(sd->self, SIG_LOAD_READY, NULL); + if (!err) + { + evas_object_smart_callback_call(sd->self, SIG_LOAD_READY, NULL); + if (sd->autoplay) efl_player_playing_set(sd->self, EINA_TRUE); + } else evas_object_smart_callback_call(sd->self, SIG_LOAD_ERROR, NULL); } @@ -133,7 +137,16 @@ _efl_ui_image_animate_cb(void *data) sd->cur_frame++; if ((sd->frame_count > 0) && (sd->cur_frame > sd->frame_count)) - sd->cur_frame = sd->cur_frame % sd->frame_count; + { + if (sd->playback_loop) + sd->cur_frame = sd->cur_frame % sd->frame_count; + else + { + sd->anim_timer = NULL; + sd->cur_frame = 0; + return EINA_FALSE; + } + } evas_object_image_animated_frame_set(sd->img, sd->cur_frame); @@ -168,6 +181,7 @@ _image_sizing_eval(Eo *obj, Efl_Ui_Image_Data *sd, Evas_Object *img) { Evas_Coord x = 0, y = 0, w = 1, h = 1; int ox, oy, ow, oh; + Eina_Bool img_no_resize = EINA_FALSE; evas_object_geometry_get(obj, &ox, &oy, &ow, &oh); if (efl_isa(img, EFL_CANVAS_LAYOUT_CLASS)) @@ -189,9 +203,7 @@ _image_sizing_eval(Eo *obj, Efl_Ui_Image_Data *sd, Evas_Object *img) //Exception Case if ((iw == 0) || (ih == 0) || (ow == 0) || (oh == 0)) { - evas_object_resize(img, 0, 0); - evas_object_resize(sd->hit_rect, 0, 0); - return; + img_no_resize = EINA_TRUE; } iw = ((double)iw) * sd->scale; @@ -230,12 +242,9 @@ _image_sizing_eval(Eo *obj, Efl_Ui_Image_Data *sd, Evas_Object *img) w = ((double)iw * h) / (double)ih; break; case EFL_GFX_IMAGE_SCALE_METHOD_EXPAND: - if (iw < ih) - { - w = ow; - h = ((double)ih * w) / (double)iw; - } - else + w = ow; + h = ((double)ih * w) / (double)iw; + if (h < oh) { h = oh; w = ((double)iw * h) / (double)ih; @@ -281,19 +290,22 @@ _image_sizing_eval(Eo *obj, Efl_Ui_Image_Data *sd, Evas_Object *img) evas_object_image_fill_set(img, offset_x, offset_y, w, h); - if (offset_x < 0) + if (ow - w < 0) { x = ox; w = ow; } - if (offset_y < 0) + if (oh - h < 0) { y = oy; h = oh; } } done: - evas_object_geometry_set(img, x, y, w, h); + if (img_no_resize) + evas_object_geometry_set(img, 0, 0, 0, 0); + else + evas_object_geometry_set(img, x, y, w, h); evas_object_geometry_set(sd->hit_rect, x, y, w, h); } @@ -436,7 +448,11 @@ _efl_ui_image_async_open_done(void *data, Ecore_Thread *thread) ok = !_efl_ui_image_smart_internal_file_set(sd->self, sd); } } - if (ok) evas_object_smart_callback_call(sd->self, SIG_LOAD_OPEN, NULL); + if (ok) + { + evas_object_smart_callback_call(sd->self, SIG_LOAD_OPEN, NULL); + if (sd->autoplay) efl_player_playing_set(sd->self, EINA_TRUE); + } else evas_object_smart_callback_call(sd->self, SIG_LOAD_ERROR, NULL); } } @@ -528,6 +544,7 @@ _efl_ui_image_edje_file_set(Evas_Object *obj) } else return _efl_ui_image_async_file_set(obj, sd); + if (sd->autoplay) efl_player_playing_set(sd->self, EINA_TRUE); /* FIXME: do i want to update icon on file change ? */ efl_canvas_group_change(obj); @@ -584,6 +601,7 @@ _efl_ui_image_efl_canvas_group_group_add(Eo *obj, Efl_Ui_Image_Data *priv) { evas_object_event_callback_add (priv->hit_rect, EVAS_CALLBACK_MOUSE_UP, _on_mouse_up, obj); + priv->playback_loop = EINA_TRUE; } else { @@ -919,7 +937,7 @@ _efl_ui_image_efl_file_load(Eo *obj, Efl_Ui_Image_Data *sd) _async_cancel(sd); /* stop preloading as it may hit to-be-freed memory */ - if (sd->img && sd->preload_status == EFL_UI_IMAGE_PRELOADING) + if ((sd->img) && (sd->preload_status == EFL_UI_IMAGE_PRELOADING) && (!sd->edje)) evas_object_image_preload(sd->img, EINA_TRUE); if (sd->remote.copier) _efl_ui_image_remote_copier_cancel(obj, sd); @@ -980,14 +998,6 @@ _efl_ui_image_efl_file_unload(Eo *obj, Efl_Ui_Image_Data *sd) _efl_ui_image_file_set_do(obj); efl_file_unload(sd->img); efl_file_unload(efl_super(obj, MY_CLASS)); - if (sd->preload_status == EFL_UI_IMAGE_PRELOAD_DISABLED) - _prev_img_del(sd); - else - { - evas_object_hide(sd->img); - sd->preload_status = EFL_UI_IMAGE_PRELOADING; - evas_object_image_preload(sd->img, EINA_FALSE); - } efl_canvas_group_change(obj); } @@ -1036,7 +1046,10 @@ _efl_ui_image_smart_internal_file_set(Eo *obj, Efl_Ui_Image_Data *sd) } if (sd->preload_status == EFL_UI_IMAGE_PRELOAD_DISABLED) - _prev_img_del(sd); + { + _prev_img_del(sd); + if (sd->autoplay) efl_player_playing_set(sd->self, EINA_TRUE); + } else { evas_object_hide(sd->img); @@ -1741,6 +1754,7 @@ _efl_ui_image_animated_set_internal(Eo *obj, Efl_Ui_Image_Data *sd, Eina_Bool an { edje_object_animation_set(sd->img, anim); sd->anim = anim; + efl_player_playback_loop_set(sd->img, sd->playback_loop); return EINA_TRUE; } sd->img = elm_image_object_get(obj); @@ -1809,6 +1823,42 @@ _efl_ui_image_efl_player_playing_get(const Eo *obj, Efl_Ui_Image_Data *sd) } EOLIAN static void +_efl_ui_image_efl_player_playback_loop_set(Eo *obj EINA_UNUSED, Efl_Ui_Image_Data *sd, Eina_Bool playback_loop) +{ + playback_loop = !!playback_loop; + sd->playback_loop = playback_loop; +} + +EOLIAN static Eina_Bool +_efl_ui_image_efl_player_playback_loop_get(const Eo *obj EINA_UNUSED, Efl_Ui_Image_Data *sd) +{ + return sd->playback_loop; +} + +EOLIAN static void +_efl_ui_image_efl_player_autoplay_set(Eo *obj, Efl_Ui_Image_Data *sd, Eina_Bool autoplay) +{ + autoplay = !!autoplay; + if (sd->autoplay == autoplay) return; + sd->autoplay = autoplay; + if (sd->img && (!sd->edje)) + { + /* filter cases where we aren't going to immediately start playing */ + if (!autoplay) return; + if ((sd->preload_status != EFL_UI_IMAGE_PRELOADED) && + (sd->preload_status != EFL_UI_IMAGE_PRELOAD_DISABLED)) + return; + } + efl_player_playing_set(obj, EINA_TRUE); +} + +EOLIAN static Eina_Bool +_efl_ui_image_efl_player_autoplay_get(const Eo *obj EINA_UNUSED, Efl_Ui_Image_Data *sd) +{ + return sd->autoplay; +} + +EOLIAN static void _efl_ui_image_efl_player_playback_speed_set(Eo *obj EINA_UNUSED, Efl_Ui_Image_Data *sd, double factor) { EINA_SAFETY_ON_TRUE_RETURN(factor < 0.0); @@ -1859,11 +1909,23 @@ _efl_ui_image_efl_player_playback_progress_get(const Eo *obj EINA_UNUSED, Efl_Ui { if (sd->edje) efl_player_playback_progress_get(sd->img); - else if ((sd->frame_count > 0) && (sd->frame_duration > 0.0)) - return (sd->cur_frame * sd->frame_duration) / sd->frame_count; + else if (sd->frame_count > 1) + return ((double)sd->cur_frame - 1.0) / ((double)sd->frame_count - 1.0); return 0.0; } +EOLIAN static void +_efl_ui_image_efl_player_playback_progress_set(Eo *obj EINA_UNUSED, Efl_Ui_Image_Data *sd, double progress) +{ + EINA_SAFETY_ON_TRUE_RETURN(progress > 1 || progress < 0); + if (sd->edje) + efl_player_playback_progress_set(sd->img, progress); + else if (sd->frame_count > 0) + sd->cur_frame = (lround(progress * (sd->frame_count - 1)) + 1); + else + sd->cur_frame = 1; +} + static Eina_Bool _efl_ui_image_animated_paused_set_internal(Eo *obj, Efl_Ui_Image_Data *sd, Eina_Bool paused) { @@ -2139,6 +2201,11 @@ _internal_efl_ui_image_icon_set(Evas_Object *obj, const char *name, Eina_Bool *f { ret = _icon_standard_set(obj, name); if (ret && fdo) *fdo = EINA_FALSE; + if (!ret) + { + ret = _icon_freedesktop_set(obj, name, _icon_size_min_get(obj)); + if (ret && fdo) *fdo = EINA_TRUE; + } } else { @@ -2375,6 +2442,20 @@ elm_image_file_set(Evas_Object *obj, const char *file, const char *group) Eina_Bool ret = EINA_FALSE; EFL_UI_IMAGE_CHECK(obj) EINA_FALSE; + + /* check if previous path is same with new one. + and return true if they are same */ + const char *cur_file_path = efl_file_get(obj); + if ((cur_file_path && file) && !strcmp(cur_file_path, file)) + { + const char *cur_group = efl_file_key_get(obj); + if (!(cur_group && group && strcmp(cur_group, group))) + { + if (efl_file_loaded_get(obj)) return EINA_TRUE; + if (_efl_ui_image_is_remote(file)) return EINA_TRUE; + } + } + ret = efl_file_simple_load(obj, file, group); efl_canvas_group_change(obj); return ret; @@ -2383,7 +2464,8 @@ elm_image_file_set(Evas_Object *obj, const char *file, const char *group) EAPI void elm_image_file_get(const Eo *obj, const char **file, const char **group) { - efl_file_simple_get((Eo *) obj, file, group); + EFL_UI_IMAGE_DATA_GET(obj, sd); + efl_file_simple_get(sd->img, file, group); } EAPI Eina_Bool @@ -2403,13 +2485,19 @@ elm_image_memfile_set(Evas_Object *obj, const void *img, size_t size, const char EFL_UI_IMAGE_CHECK(obj) EINA_FALSE; EFL_UI_IMAGE_DATA_GET(obj, sd); - _efl_ui_image_file_set_do(obj); + if (efl_file_loaded_get(obj)) + efl_file_unload(obj); + else + _efl_ui_image_file_set_do(obj); evas_object_image_memfile_set (sd->img, (void *)img, size, (char *)format, (char *)key); if (sd->preload_status == EFL_UI_IMAGE_PRELOAD_DISABLED) - _prev_img_del(sd); + { + _prev_img_del(sd); + if (sd->autoplay) efl_player_playing_set(sd->self, EINA_TRUE); + } else { sd->preload_status = EFL_UI_IMAGE_PRELOADING; @@ -2472,7 +2560,13 @@ elm_image_preload_disabled_set(Evas_Object *obj, Eina_Bool disable) EFL_UI_IMAGE_CHECK(obj); EFL_UI_IMAGE_DATA_GET(obj, sd); - if (sd->edje || !sd->img) return; + if (sd->edje) return; + if (!sd->img) + { + if (disable) sd->preload_status = EFL_UI_IMAGE_PRELOAD_DISABLED; + else sd->preload_status = EFL_UI_IMAGE_PRELOAD_ENABLED; + return; + } if (disable) { @@ -2511,6 +2605,9 @@ elm_image_orient_set(Evas_Object *obj, Elm_Image_Orient elm_orient) EINA_SAFETY_ON_FALSE_RETURN(elm_orient >= 0 && elm_orient < 8); sd->image_orient = elm_orient; efl_gfx_image_orientation_set(obj, efl_orient[elm_orient]); + + // to keep behavior compatibility, update inlined image orientation + if (sd->img) efl_gfx_image_orientation_set(sd->img, efl_orient[elm_orient]); } EAPI Elm_Image_Orient diff --git a/src/lib/elementary/efl_ui_image.eo b/src/lib/elementary/efl_ui_image.eo index 207a264e70..9ebb14982c 100644 --- a/src/lib/elementary/efl_ui_image.eo +++ b/src/lib/elementary/efl_ui_image.eo @@ -52,8 +52,6 @@ class Efl.Ui.Image extends Efl.Ui.Widget implements Efl.Input.Clickable, Efl.Ui. @Efl.File.load is called. Note: This function does not accept relative icon paths. - - See also @.icon.get. ]] set { return: bool; [[$true on success, $false on error]] @@ -103,8 +101,10 @@ class Efl.Ui.Image extends Efl.Ui.Widget implements Efl.Input.Clickable, Efl.Ui. Efl.Player.playing { get; set; } Efl.Player.paused { get; set; } Efl.Player.playback_position { get; set; } - Efl.Player.playback_progress { get; } + Efl.Player.playback_progress { get; set; } Efl.Player.playback_speed { get; set; } + Efl.Player.autoplay { set; get; } + Efl.Player.playback_loop { set; get; } Efl.Layout.Signal.signal_emit; Efl.Layout.Signal.message_send; Efl.Layout.Signal.signal_callback_add; diff --git a/src/lib/elementary/efl_ui_image_legacy_eo.h b/src/lib/elementary/efl_ui_image_legacy_eo.h index 204a09db05..2431a914b7 100644 --- a/src/lib/elementary/efl_ui_image_legacy_eo.h +++ b/src/lib/elementary/efl_ui_image_legacy_eo.h @@ -20,7 +20,7 @@ typedef Eo Efl_Ui_Image_Legacy; */ #define EFL_UI_IMAGE_LEGACY_CLASS efl_ui_image_legacy_class_get() -EWAPI const Efl_Class *efl_ui_image_legacy_class_get(void); +EWAPI const Efl_Class *efl_ui_image_legacy_class_get(void) EINA_CONST; #endif /* EFL_BETA_API_SUPPORT */ #endif diff --git a/src/lib/elementary/efl_ui_image_zoomable.c b/src/lib/elementary/efl_ui_image_zoomable.c index 19d2e0155b..fb05a56115 100644 --- a/src/lib/elementary/efl_ui_image_zoomable.c +++ b/src/lib/elementary/efl_ui_image_zoomable.c @@ -728,6 +728,7 @@ _main_img_preloaded_cb(void *data, ELM_WIDGET_DATA_GET_OR_RETURN(data, wd); evas_object_show(sd->img); sd->main_load_pending = 0; + if (sd->autoplay) efl_player_playing_set(obj, EINA_TRUE); g = _grid_create(obj); if (g) { @@ -1834,7 +1835,10 @@ _efl_ui_image_zoomable_efl_canvas_group_group_add(Eo *obj, Efl_Ui_Image_Zoomable efl_ui_scroll_manager_pan_set(priv->smanager, priv->pan_obj); if (elm_widget_is_legacy(obj)) - edje_object_part_swallow(edje, "elm.swallow.content", priv->pan_obj); + { + edje_object_part_swallow(edje, "elm.swallow.content", priv->pan_obj); + priv->playback_loop = EINA_TRUE; + } else edje_object_part_swallow(edje, "efl.content", priv->pan_obj); @@ -1972,32 +1976,6 @@ _efl_ui_image_zoomable_efl_layout_group_group_size_max_get(const Eo *obj EINA_UN return EINA_SIZE2D(0, 0); } -EOLIAN static Eina_Bool -_efl_ui_image_zoomable_efl_layout_signal_signal_callback_add(Eo *obj, Efl_Ui_Image_Zoomable_Data *pd EINA_UNUSED, - const char *emission, const char *source, - void *func_data, EflLayoutSignalCb func, Eina_Free_Cb func_free_cb) -{ - Eina_Bool ok; - ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd, EINA_FALSE); - - ok = efl_layout_signal_callback_add(wd->resize_obj, emission, source, func_data, func, func_free_cb); - - return ok; -} - -EOLIAN static Eina_Bool -_efl_ui_image_zoomable_efl_layout_signal_signal_callback_del(Eo *obj, Efl_Ui_Image_Zoomable_Data *pd EINA_UNUSED, - const char *emission, const char *source, - void *func_data, EflLayoutSignalCb func, Eina_Free_Cb func_free_cb) -{ - Eina_Bool ok; - ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd, EINA_FALSE); - - ok = efl_layout_signal_callback_del(wd->resize_obj, emission, source, func_data, func, func_free_cb); - - return ok; -} - static Eina_Error _img_proxy_set(Evas_Object *obj, Efl_Ui_Image_Zoomable_Data *sd, Eina_Bool resize) @@ -2102,6 +2080,38 @@ _internal_file_set(Eo *obj, Efl_Ui_Image_Zoomable_Data *sd, Evas_Load_Error *ret evas_object_image_file_set(sd->img, NULL, NULL); evas_object_image_load_scale_down_set(sd->img, 0); _photocam_image_file_set(sd->img, sd); + + //Check whether image size is bigger than maxium texture + evas_object_image_size_get(sd->img, &w, &h); + int maxw = 0, maxh = 0; + evas_image_max_size_get(evas_object_evas_get(sd->img), &maxw, &maxh); + + /* Image is too large than system support, + This case it won't be available, + Alternatively, reduce size by half and make it visible at least. + Btw, is this the best solution for this?... */ + if (maxw > 0 && maxh > 0) + { + int w2 = w; + int h2 = h; + + if (w2 > maxw || h2 > maxh) + { + //Scale down by half + int scale_down = 1; + + while (w2 > maxw || h2 > maxh) + { + w2 /= 2; + h2 /= 2; + scale_down *= 2; + } + + //This might not work at some format... + evas_object_image_load_scale_down_set(sd->img, scale_down); + } + } + err = evas_object_image_load_error_get(sd->img); if (err != EVAS_LOAD_ERROR_NONE) { @@ -2109,8 +2119,6 @@ _internal_file_set(Eo *obj, Efl_Ui_Image_Zoomable_Data *sd, Evas_Load_Error *ret if (ret) *ret = err; return err; } - evas_object_image_size_get(sd->img, &w, &h); - sd->do_region = evas_object_image_region_support_get(sd->img); sd->size.imw = w; sd->size.imh = h; @@ -2473,7 +2481,7 @@ _efl_ui_image_zoomable_efl_ui_zoom_zoom_level_set(Eo *obj, Efl_Ui_Image_Zoomable z = (double)sd->size.imw / pw; else z = (double)sd->size.imh / ph; - if (z != sd->zoom) + if (!EINA_DBL_EQ(z, sd->zoom)) zoom_changed = 1; sd->zoom = z; sd->size.nw = pw; @@ -2632,7 +2640,7 @@ _efl_ui_image_zoomable_efl_ui_zoom_zoom_mode_set(Eo *obj, Efl_Ui_Image_Zoomable_ { double tz; if (sd->mode == (Elm_Photocam_Zoom_Mode)mode) return; - sd->mode = mode; + sd->mode = (Elm_Photocam_Zoom_Mode)mode; tz = sd->zoom; sd->zoom = 0.0; @@ -2642,7 +2650,7 @@ _efl_ui_image_zoomable_efl_ui_zoom_zoom_mode_set(Eo *obj, Efl_Ui_Image_Zoomable_ EOLIAN static Efl_Ui_Zoom_Mode _efl_ui_image_zoomable_efl_ui_zoom_zoom_mode_get(const Eo *obj EINA_UNUSED, Efl_Ui_Image_Zoomable_Data *sd) { - return sd->mode; + return (Efl_Ui_Zoom_Mode)sd->mode; } EOLIAN static Eina_Size2D @@ -2927,6 +2935,11 @@ _internal_efl_ui_image_zoomable_icon_set(Evas_Object *obj, const char *name, Ein { ret = _icon_standard_set(obj, name, resize); if (ret && fdo) *fdo = EINA_FALSE; + if (!ret) + { + ret = _icon_freedesktop_set(obj, name, _icon_size_min_get(obj)); + if (ret && fdo) *fdo = EINA_TRUE; + } } else { @@ -3024,11 +3037,24 @@ _efl_ui_image_zoomable_animate_cb(void *data) EFL_UI_IMAGE_ZOOMABLE_DATA_GET(data, sd); _grid_clear_all(data); - if (!sd->anim) return ECORE_CALLBACK_CANCEL; + if (!sd->anim) + { + sd->anim_timer = NULL; + return ECORE_CALLBACK_CANCEL; + } sd->cur_frame++; if ((sd->frame_count > 0) && (sd->cur_frame > sd->frame_count)) - sd->cur_frame = sd->cur_frame % sd->frame_count; + { + if (sd->playback_loop) + sd->cur_frame = sd->cur_frame % sd->frame_count; + else + { + sd->anim_timer = NULL; + sd->cur_frame = 0; + return EINA_FALSE; + } + } evas_object_image_animated_frame_set(sd->img, sd->cur_frame); sd->frame_duration = evas_object_image_animated_frame_duration_get @@ -3040,7 +3066,7 @@ _efl_ui_image_zoomable_animate_cb(void *data) return ECORE_CALLBACK_RENEW; } -static Eina_Bool +static Eina_Bool _efl_ui_image_zoomable_animated_set_internal(Eo *obj EINA_UNUSED, Efl_Ui_Image_Zoomable_Data *sd, Eina_Bool anim) { anim = !!anim; @@ -3050,6 +3076,7 @@ _efl_ui_image_zoomable_animated_set_internal(Eo *obj EINA_UNUSED, Efl_Ui_Image_Z { sd->anim = anim; edje_object_animation_set(sd->edje, anim); + efl_player_playback_loop_set(sd->edje, sd->playback_loop); return EINA_TRUE; } @@ -3119,6 +3146,41 @@ _efl_ui_image_zoomable_efl_player_playing_get(const Eo *obj, Efl_Ui_Image_Zoomab return _efl_ui_image_zoomable_animated_get_internal(obj, sd); } +EOLIAN static void +_efl_ui_image_zoomable_efl_player_playback_loop_set(Eo *obj EINA_UNUSED, Efl_Ui_Image_Zoomable_Data *sd, Eina_Bool playback_loop) +{ + playback_loop = !!playback_loop; + sd->playback_loop = playback_loop; +} + +EOLIAN static Eina_Bool +_efl_ui_image_zoomable_efl_player_playback_loop_get(const Eo *obj EINA_UNUSED, Efl_Ui_Image_Zoomable_Data *sd) +{ + return sd->playback_loop; +} + +EOLIAN static void +_efl_ui_image_zoomable_efl_player_autoplay_set(Eo *obj, Efl_Ui_Image_Zoomable_Data *sd, Eina_Bool autoplay) +{ + autoplay = !!autoplay; + if (sd->autoplay == autoplay) return; + sd->autoplay = autoplay; + if (!sd->edje) + { + /* filter cases where we aren't going to immediately start playing */ + if (!autoplay) return; + if (sd->preload_num) + return; + } + efl_player_playing_set(obj, EINA_TRUE); +} + +EOLIAN static Eina_Bool +_efl_ui_image_zoomable_efl_player_autoplay_get(const Eo *obj EINA_UNUSED, Efl_Ui_Image_Zoomable_Data *sd) +{ + return sd->autoplay; +} + EOLIAN static Eina_Bool _efl_ui_image_zoomable_efl_player_paused_get(const Eo *obj EINA_UNUSED, Efl_Ui_Image_Zoomable_Data *sd) { @@ -3178,12 +3240,26 @@ _efl_ui_image_zoomable_efl_player_playback_progress_get(const Eo *obj EINA_UNUSE { if (sd->edje) efl_player_playback_progress_get(sd->edje); - else if ((sd->frame_count > 0) && (sd->frame_duration > 0.0)) - return (sd->cur_frame * sd->frame_duration) / sd->frame_count; + else if (sd->frame_count > 1) + return ((double)sd->cur_frame - 1.0) / ((double)sd->frame_count - 1.0); return 0.0; } EOLIAN static void +_efl_ui_image_zoomable_efl_player_playback_progress_set(Eo *obj EINA_UNUSED, Efl_Ui_Image_Zoomable_Data *sd, double progress) +{ + EINA_SAFETY_ON_TRUE_RETURN(progress > 1 || progress < 0); + if (sd->edje) + { + efl_player_playback_progress_set(sd->img, progress); + } + else if (sd->frame_count > 0) + sd->cur_frame = (lround(progress * (sd->frame_count - 1)) + 1); + else + sd->cur_frame = 1; +} + +EOLIAN static void _efl_ui_image_zoomable_class_constructor(Efl_Class *klass EINA_UNUSED) { PHOTO_FILE_LOAD_ERROR_GENERIC = eina_error_msg_static_register("Generic load error"); @@ -3349,13 +3425,13 @@ elm_photocam_zoom_get(const Evas_Object *obj) EAPI void elm_photocam_zoom_mode_set(Evas_Object *obj, Elm_Photocam_Zoom_Mode mode) { - efl_ui_zoom_mode_set(obj, mode); + efl_ui_zoom_mode_set(obj, (Efl_Ui_Zoom_Mode)mode); } EAPI Elm_Photocam_Zoom_Mode elm_photocam_zoom_mode_get(const Evas_Object *obj) { - return efl_ui_zoom_mode_get(obj); + return (Elm_Photocam_Zoom_Mode)efl_ui_zoom_mode_get(obj); } EAPI Evas_Load_Error diff --git a/src/lib/elementary/efl_ui_image_zoomable.eo b/src/lib/elementary/efl_ui_image_zoomable.eo index 5b097e1fab..20424a568d 100644 --- a/src/lib/elementary/efl_ui_image_zoomable.eo +++ b/src/lib/elementary/efl_ui_image_zoomable.eo @@ -50,8 +50,10 @@ class Efl.Ui.Image_Zoomable extends Efl.Ui.Image implements Efl.Ui.Zoom Efl.Player.playing { get; set; } Efl.Player.paused { get; set; } Efl.Player.playback_position { get; set; } - Efl.Player.playback_progress { get; } + Efl.Player.playback_progress { get; set; } Efl.Player.playback_speed { get; set; } + Efl.Player.autoplay { set; get; } + Efl.Player.playback_loop { set; get; } Efl.Ui.Zoom.zoom_animation { set; get; } Efl.Ui.Zoom.zoom_level { set; get; } Efl.Ui.Zoom.zoom_mode { set; get; } @@ -67,9 +69,6 @@ class Efl.Ui.Image_Zoomable extends Efl.Ui.Image implements Efl.Ui.Zoom Efl.Gfx.Image_Orientable.image_orientation { get; set; } Efl.Layout.Group.group_size_min { get; } Efl.Layout.Group.group_size_max { get; } - Efl.Layout.Signal.signal_callback_add; - Efl.Layout.Signal.signal_callback_del; - //Efl.Canvas.Layout_Group.group_data { get; } } events { press: void; [[Called when photocam got pressed]] diff --git a/src/lib/elementary/efl_ui_image_zoomable_legacy_eo.h b/src/lib/elementary/efl_ui_image_zoomable_legacy_eo.h index e18960f320..db71aead15 100644 --- a/src/lib/elementary/efl_ui_image_zoomable_legacy_eo.h +++ b/src/lib/elementary/efl_ui_image_zoomable_legacy_eo.h @@ -20,7 +20,7 @@ typedef Eo Efl_Ui_Image_Zoomable_Legacy; */ #define EFL_UI_IMAGE_ZOOMABLE_LEGACY_CLASS efl_ui_image_zoomable_legacy_class_get() -EWAPI const Efl_Class *efl_ui_image_zoomable_legacy_class_get(void); +EWAPI const Efl_Class *efl_ui_image_zoomable_legacy_class_get(void) EINA_CONST; #endif /* EFL_BETA_API_SUPPORT */ #endif diff --git a/src/lib/elementary/efl_ui_image_zoomable_private.h b/src/lib/elementary/efl_ui_image_zoomable_private.h index e892c1f63c..296c98d481 100644 --- a/src/lib/elementary/efl_ui_image_zoomable_private.h +++ b/src/lib/elementary/efl_ui_image_zoomable_private.h @@ -142,6 +142,8 @@ struct _Efl_Ui_Image_Zoomable_Data Eina_Bool paused : 1; Eina_Bool orientation_changed : 1; Eina_Bool anim : 1; + Eina_Bool autoplay : 1; + Eina_Bool playback_loop : 1; Eina_Bool freeze_want : 1; Eina_Bool show_item: 1; }; diff --git a/src/lib/elementary/efl_ui_internal_text_interactive.c b/src/lib/elementary/efl_ui_internal_text_interactive.c index a0bbba6469..d2220c451c 100644 --- a/src/lib/elementary/efl_ui_internal_text_interactive.c +++ b/src/lib/elementary/efl_ui_internal_text_interactive.c @@ -13,18 +13,22 @@ typedef struct _Efl_Ui_Internal_Text_Interactive_Data { - Efl_Text_Cursor *sel_start, *sel_end; - Efl_Text_Cursor *main_cursor; - Efl_Text_Cursor *preedit_start, *preedit_end; + Efl_Text_Cursor_Object *sel_start, *sel_end; + Eina_Bool watch_selection; + Efl_Text_Cursor_Object *main_cursor; + Efl_Text_Cursor_Object *preedit_start, *preedit_end; Ecore_Timer *pw_timer; Eina_List *seq; char *selection; + const char *file; + Elm_Text_Format format; Eina_Bool composing : 1; Eina_Bool selecting : 1; Eina_Bool have_selection : 1; Eina_Bool select_allow : 1; Eina_Bool editable : 1; Eina_Bool had_sel : 1; + Eina_Bool auto_save : 1; Eina_Bool prediction_allow : 1; Eina_Bool anchors_updated : 1; Eina_Bool auto_return_key : 1; @@ -33,7 +37,7 @@ typedef struct _Efl_Ui_Internal_Text_Interactive_Data Efl_Input_Text_Capitalize_Type autocapital_type; Efl_Input_Text_Panel_Language_Type input_panel_lang; Efl_Input_Text_Panel_Return_Key_Type input_panel_return_key_type; - Efl_Input_Text_Hints_Type input_hints; + Efl_Input_Text_Content_Type input_hints; Efl_Input_Text_Panel_Return_Key_State input_panel_return_key_state; #ifdef HAVE_ECORE_IMF @@ -44,38 +48,60 @@ typedef struct _Efl_Ui_Internal_Text_Interactive_Data } Efl_Ui_Internal_Text_Interactive_Data; static void _sel_range_del_emit(Evas_Object *obj, Efl_Ui_Internal_Text_Interactive_Data *en); -static void _sel_init(Efl_Text_Cursor *c, Evas_Object *o, Efl_Ui_Internal_Text_Interactive_Data *en); -static void _sel_enable(Efl_Text_Cursor *c EINA_UNUSED, Evas_Object *o EINA_UNUSED, Efl_Ui_Internal_Text_Interactive_Data *en); -static void _sel_extend(Efl_Text_Cursor *c, Evas_Object *o, Efl_Ui_Internal_Text_Interactive_Data *en); +static void _sel_init(Efl_Text_Cursor_Object *c, Efl_Ui_Internal_Text_Interactive_Data *en); +static void _sel_enable(Evas_Object *o,Efl_Ui_Internal_Text_Interactive_Data *en); +static void _sel_extend(Efl_Text_Cursor_Object *c, Evas_Object *o, Efl_Ui_Internal_Text_Interactive_Data *en); static void _sel_clear(Evas_Object *o EINA_UNUSED, Efl_Ui_Internal_Text_Interactive_Data *en); +static void _emit_sel_state( Eo *o, Efl_Ui_Internal_Text_Interactive_Data *en); static const char *_entry_selection_get(Efl_Ui_Internal_Text_Interactive *obj, Efl_Ui_Internal_Text_Interactive_Data *en); static void _entry_imf_cursor_info_set(Efl_Ui_Internal_Text_Interactive_Data *en); +static void _sel_watch_freeze(Efl_Ui_Internal_Text_Interactive_Data *en); +static void _sel_watch_thaw(Efl_Ui_Internal_Text_Interactive_Data *en); + static void _text_filter_format_prepend(Efl_Canvas_Textblock *obj, Efl_Ui_Internal_Text_Interactive_Data *en, - Efl_Text_Cursor *c, const char *text); + Efl_Text_Cursor_Object *c, const char *text); static Efl_Text_Change_Info * _text_filter_text_prepend(Efl_Canvas_Textblock *obj, Efl_Ui_Internal_Text_Interactive_Data *en, - Efl_Text_Cursor *c, + Efl_Text_Cursor_Object *c, const char *text, const char *fmtpre, const char *fmtpost, Eina_Bool clearsel, Eina_Bool changeinfo); static Efl_Text_Change_Info * _text_filter_markup_prepend_internal(Efl_Canvas_Textblock *obj, Efl_Ui_Internal_Text_Interactive_Data *en, - Efl_Text_Cursor *c, + Efl_Text_Cursor_Object *c, char *text, const char *fmtpre, const char *fmtpost, Eina_Bool clearsel, Eina_Bool changeinfo); static Efl_Text_Change_Info * _text_filter_markup_prepend(Efl_Canvas_Textblock *obj, Efl_Ui_Internal_Text_Interactive_Data *en, - Efl_Text_Cursor *c, + Efl_Text_Cursor_Object *c, const char *text, const char *fmtpre, const char *fmtpost, Eina_Bool clearsel, Eina_Bool changeinfo); +static void +_cur_pos_copy(Efl_Text_Cursor_Object *src, Efl_Text_Cursor_Object *dest) +{ + efl_text_cursor_object_position_set(dest, efl_text_cursor_object_position_get(src)); +} + +static void +_sel_watch_freeze(Efl_Ui_Internal_Text_Interactive_Data *en) +{ + en->watch_selection = EINA_FALSE; +} + +static void +_sel_watch_thaw(Efl_Ui_Internal_Text_Interactive_Data *en) +{ + en->watch_selection = EINA_TRUE; +} + #ifdef HAVE_ECORE_IMF static void _preedit_clear(Efl_Ui_Internal_Text_Interactive_Data *en) @@ -100,17 +126,17 @@ _preedit_del(Eo *obj EINA_UNUSED, Efl_Ui_Internal_Text_Interactive_Data *en) { if (!en || !en->have_preedit) return; if (!en->preedit_start || !en->preedit_end) return; - if (efl_text_cursor_equal(en->preedit_start, en->preedit_end)) return; + if (efl_text_cursor_object_equal(en->preedit_start, en->preedit_end)) return; /* delete the preedit characters */ - efl_text_cursor_range_delete(en->preedit_start, en->preedit_end); + efl_text_cursor_object_range_delete(en->preedit_start, en->preedit_end); } static Eina_Bool _entry_imf_retrieve_surrounding_cb(void *data, Ecore_IMF_Context *ctx EINA_UNUSED, char **text, int *cursor_pos) { Efl_Canvas_Textblock *obj = data; - Efl_Text_Cursor *cur = efl_text_interactive_main_cursor_get(obj); + Efl_Text_Cursor_Object *cur = efl_text_interactive_main_cursor_get(obj); const char *str; if (text) @@ -127,7 +153,7 @@ _entry_imf_retrieve_surrounding_cb(void *data, Ecore_IMF_Context *ctx EINA_UNUSE if (cursor_pos) { if (cur) - *cursor_pos = efl_text_cursor_position_get(cur); + *cursor_pos = efl_text_cursor_object_position_get(cur); else *cursor_pos = 0; } @@ -236,7 +262,7 @@ _entry_imf_event_commit_cb(void *data, Ecore_IMF_Context *ctx EINA_UNUSED, void static Efl_Text_Change_Info * _text_filter_markup_prepend_internal(Efl_Canvas_Textblock *obj, Efl_Ui_Internal_Text_Interactive_Data *en, - Efl_Text_Cursor *c, + Efl_Text_Cursor_Object *c, char *text, const char *fmtpre, const char *fmtpost, Eina_Bool clearsel, Eina_Bool changeinfo) @@ -263,7 +289,7 @@ _text_filter_markup_prepend_internal(Efl_Canvas_Textblock *obj, Efl_Ui_Internal_ if (changeinfo) { info = calloc(1, sizeof(*info)); - info->insert = EINA_TRUE; + info->type = EFL_TEXT_CHANGE_TYPE_INSERT; info->content = eina_stringshare_add(text); info->length = eina_unicode_utf8_get_len(info->content); @@ -272,14 +298,14 @@ _text_filter_markup_prepend_internal(Efl_Canvas_Textblock *obj, Efl_Ui_Internal_ { if (have_sel) { - info->merge = EINA_TRUE; + info->mergeable = EINA_TRUE; } info->position = - efl_text_cursor_position_get(efl_text_interactive_main_cursor_get(obj)); + efl_text_cursor_object_position_get(efl_text_interactive_main_cursor_get(obj)); } if (fmtpre) _text_filter_format_prepend(obj, en, efl_text_interactive_main_cursor_get(obj), fmtpre); //evas_object_textblock_text_markup_prepend(c, text); - efl_text_cursor_text_insert(c, text); + efl_text_cursor_object_text_insert(c, text); free(text); if (fmtpost) _text_filter_format_prepend(obj, en, efl_text_interactive_main_cursor_get(obj), fmtpost); return info; @@ -289,7 +315,7 @@ _text_filter_markup_prepend_internal(Efl_Canvas_Textblock *obj, Efl_Ui_Internal_ static Efl_Text_Change_Info * _text_filter_markup_prepend(Efl_Canvas_Textblock *obj, Efl_Ui_Internal_Text_Interactive_Data *en, - Efl_Text_Cursor *c, + Efl_Text_Cursor_Object *c, const char *text, const char *fmtpre, const char *fmtpost, Eina_Bool clearsel, Eina_Bool changeinfo) @@ -318,11 +344,14 @@ _text_filter_markup_prepend(Efl_Canvas_Textblock *obj, Efl_Ui_Internal_Text_Inte static Efl_Text_Change_Info * _text_filter_text_prepend(Efl_Canvas_Textblock *obj, Efl_Ui_Internal_Text_Interactive_Data *en, - Efl_Text_Cursor *c, + Efl_Text_Cursor_Object *c, const char *text, const char *fmtpre, const char *fmtpost, Eina_Bool clearsel, Eina_Bool changeinfo) { + char *markup_text; + Efl_Text_Change_Info *info = NULL; + EINA_SAFETY_ON_NULL_RETURN_VAL(text, NULL); if ((clearsel) && (en->have_selection)) @@ -330,24 +359,17 @@ _text_filter_text_prepend(Efl_Canvas_Textblock *obj, Efl_Ui_Internal_Text_Intera _sel_range_del_emit(obj, en); } - if (text) - { - char *markup_text; - Efl_Text_Change_Info *info = NULL; - - markup_text = evas_textblock_text_utf8_to_markup(NULL, text); - if (markup_text) - info = _text_filter_markup_prepend_internal(obj, en, c, markup_text, - fmtpre, fmtpost, - clearsel, changeinfo); - return info; - } - return NULL; + markup_text = evas_textblock_text_utf8_to_markup(NULL, text); + if (markup_text) + info = _text_filter_markup_prepend_internal(obj, en, c, markup_text, + fmtpre, fmtpost, + clearsel, changeinfo); + return info; } static void _text_filter_format_prepend(Efl_Canvas_Textblock *obj, Efl_Ui_Internal_Text_Interactive_Data *en, - Efl_Text_Cursor *c, const char *text) + Efl_Text_Cursor_Object *c, const char *text) { EINA_SAFETY_ON_NULL_RETURN(text); @@ -421,7 +443,7 @@ static void _entry_imf_event_preedit_changed_cb(void *data, Ecore_IMF_Context *ctx EINA_UNUSED, void *event_info EINA_UNUSED) { Efl_Canvas_Textblock *obj = data; - Efl_Text_Cursor *cur = efl_text_interactive_main_cursor_get(obj); + Efl_Text_Cursor_Object *cur = efl_text_interactive_main_cursor_get(obj); Efl_Ui_Internal_Text_Interactive_Data *en = efl_data_scope_get(obj, MY_CLASS); Efl_Text_Change_Info *info = NULL; int cursor_pos; @@ -460,7 +482,7 @@ _entry_imf_event_preedit_changed_cb(void *data, Ecore_IMF_Context *ctx EINA_UNUS /* delete preedit characters */ _preedit_del(obj, en); - preedit_start_pos = efl_text_cursor_position_get(cur); + preedit_start_pos = efl_text_cursor_object_position_get(cur); /* insert preedit character(s) */ if (strlen(preedit_string) > 0) @@ -523,24 +545,24 @@ _entry_imf_event_preedit_changed_cb(void *data, Ecore_IMF_Context *ctx EINA_UNUS /* set preedit start cursor */ if (!en->preedit_start) en->preedit_start = efl_canvas_textblock_cursor_create(obj); - efl_text_cursor_copy(cur, en->preedit_start); + _cur_pos_copy(cur, en->preedit_start); /* set preedit end cursor */ if (!en->preedit_end) en->preedit_end = efl_canvas_textblock_cursor_create(obj); - efl_text_cursor_copy(cur, en->preedit_end); + _cur_pos_copy(cur, en->preedit_end); - preedit_end_pos = efl_text_cursor_position_get(cur); + preedit_end_pos = efl_text_cursor_object_position_get(cur); for (i = 0; i < (preedit_end_pos - preedit_start_pos); i++) { - efl_text_cursor_move(en->preedit_start, EFL_TEXT_CURSOR_MOVE_TYPE_CHAR_PREV); + efl_text_cursor_object_move(en->preedit_start, EFL_TEXT_CURSOR_MOVE_TYPE_CHARACTER_PREVIOUS); } en->have_preedit = EINA_TRUE; /* set cursor position */ - efl_text_cursor_position_set(cur, preedit_start_pos + cursor_pos); + efl_text_cursor_object_position_set(cur, preedit_start_pos + cursor_pos); } if (info) @@ -566,35 +588,35 @@ static void _entry_imf_event_delete_surrounding_cb(void *data, Ecore_IMF_Context *ctx EINA_UNUSED, void *event_info) { Efl_Canvas_Textblock *obj = data; - Efl_Text_Cursor *cur = efl_text_interactive_main_cursor_get(obj); + Efl_Text_Cursor_Object *cur = efl_text_interactive_main_cursor_get(obj); Efl_Ui_Internal_Text_Interactive_Data *en = efl_data_scope_get(obj, MY_CLASS); Ecore_IMF_Event_Delete_Surrounding *ev = event_info; - Efl_Text_Cursor *del_start, *del_end; + Efl_Text_Cursor_Object *del_start, *del_end; Efl_Text_Change_Info info = { NULL, 0, 0, 0, 0 }; int cursor_pos; int start, end; char *tmp; - cursor_pos = efl_text_cursor_position_get(cur); + cursor_pos = efl_text_cursor_object_position_get(cur); del_start = efl_canvas_textblock_cursor_create(obj); - efl_text_cursor_position_set(del_start, cursor_pos + ev->offset); + efl_text_cursor_object_position_set(del_start, cursor_pos + ev->offset); del_end = efl_canvas_textblock_cursor_create(obj); - efl_text_cursor_position_set(del_end, cursor_pos + ev->offset + ev->n_chars); + efl_text_cursor_object_position_set(del_end, cursor_pos + ev->offset + ev->n_chars); - start = efl_text_cursor_position_get(del_start); - end = efl_text_cursor_position_get(del_end); + start = efl_text_cursor_object_position_get(del_start); + end = efl_text_cursor_object_position_get(del_end); if (start == end) goto end; - tmp = efl_text_cursor_range_text_get(del_start, del_end); + tmp = efl_text_cursor_object_range_text_get(del_start, del_end); - info.insert = EINA_FALSE; + info.type = EFL_TEXT_CHANGE_TYPE_REMOVE; info.position = start; info.length = end - start; info.content = tmp; - efl_text_cursor_range_delete(del_start, del_end); + efl_text_cursor_object_range_delete(del_start, del_end); efl_event_callback_call(obj, EFL_TEXT_INTERACTIVE_EVENT_CHANGED_USER, &info); free(tmp); @@ -610,21 +632,21 @@ static void _entry_imf_event_selection_set_cb(void *data, Ecore_IMF_Context *ctx EINA_UNUSED, void *event_info) { Efl_Canvas_Textblock *obj = data; - Efl_Text_Cursor *cur = efl_text_interactive_main_cursor_get(obj); + Efl_Text_Cursor_Object *cur = efl_text_interactive_main_cursor_get(obj); Efl_Ui_Internal_Text_Interactive_Data *en = efl_data_scope_get(obj, MY_CLASS); Ecore_IMF_Event_Selection *ev = event_info; if (ev->start == ev->end) { - efl_text_cursor_position_set(cur, ev->start); + efl_text_cursor_object_position_set(cur, ev->start); } else { _sel_clear(obj, en); - efl_text_cursor_position_set(cur, ev->start); - _sel_enable(cur, obj, en); - _sel_init(cur, obj, en); - efl_text_cursor_position_set(cur, ev->end); + efl_text_cursor_object_position_set(cur, ev->start); + _sel_enable(obj, en); + _sel_init(cur, en); + efl_text_cursor_object_position_set(cur, ev->end); _sel_extend(cur, obj, en); } } @@ -658,7 +680,7 @@ _entry_imf_cursor_location_set(Efl_Ui_Internal_Text_Interactive_Data *en) Eina_Rect rect; if (!en->imf_context) return; - rect = efl_text_cursor_geometry_get(en->main_cursor ,EFL_TEXT_CURSOR_TYPE_BEFORE); + rect = efl_text_cursor_object_cursor_geometry_get(en->main_cursor ,EFL_TEXT_CURSOR_TYPE_BEFORE); ecore_imf_context_cursor_location_set(en->imf_context, rect.x, rect.y, rect.w, rect.h); // FIXME: ecore_imf_context_bidi_direction_set(en->imf_context, (Ecore_IMF_BiDi_Direction)dir); #else @@ -676,13 +698,13 @@ _entry_imf_cursor_info_set(Efl_Ui_Internal_Text_Interactive_Data *en) if (en->have_selection) { - if (efl_text_cursor_compare(en->sel_start, en->sel_end) < 0) - cursor_pos = efl_text_cursor_position_get(en->sel_start); + if (efl_text_cursor_object_compare(en->sel_start, en->sel_end) < 0) + cursor_pos = efl_text_cursor_object_position_get(en->sel_start); else - cursor_pos = efl_text_cursor_position_get(en->sel_end); + cursor_pos = efl_text_cursor_object_position_get(en->sel_end); } else - cursor_pos = efl_text_cursor_position_get(en->main_cursor); + cursor_pos = efl_text_cursor_object_position_get(en->main_cursor); ecore_imf_context_cursor_position_set(en->imf_context, cursor_pos); @@ -736,24 +758,74 @@ static const char * _entry_selection_get(Efl_Ui_Internal_Text_Interactive *obj EINA_UNUSED, Efl_Ui_Internal_Text_Interactive_Data *en) { if ((!en->selection) && (en->have_selection)) - en->selection = efl_text_cursor_range_text_get(en->sel_start, en->sel_end); + en->selection = efl_text_cursor_object_range_text_get(en->sel_start, en->sel_end); return en->selection; } static void +_sel_reset(Eo *obj, Efl_Ui_Internal_Text_Interactive_Data *en){ + + if (!en->watch_selection) + return; + + if (!en->have_selection && efl_text_cursor_object_equal(en->sel_start, en->sel_end)) + return; + + if (en->have_selection) + { + if (efl_text_cursor_object_equal(en->sel_start, en->sel_end)) + { + _sel_clear(obj, en); + } + else + { + _entry_imf_cursor_info_set(en); + if (en->selection) + { + free(en->selection); + en->selection = NULL; + } + _emit_sel_state(obj, en); + } + } + else + { + if (!efl_text_cursor_object_equal(en->sel_start, en->sel_end)) + { + _sel_enable(obj, en); + _entry_imf_cursor_info_set(en); + if (en->selection) + { + free(en->selection); + en->selection = NULL; + } + _emit_sel_state(obj, en); + } + } +} + +static void _sel_cursor_changed(void *data EINA_UNUSED, const Efl_Event *event EINA_UNUSED) { -// Eo *obj = data; + Efl_Ui_Internal_Text_Interactive *obj = data; + Efl_Ui_Internal_Text_Interactive_Data *en = efl_data_scope_get(obj, MY_CLASS); + + if (!efl_text_interactive_selection_allowed_get(obj)) + return; + + _sel_reset(obj, en); } static void -_sel_init(Efl_Text_Cursor *c, Evas_Object *o EINA_UNUSED, Efl_Ui_Internal_Text_Interactive_Data *en) +_sel_init(Efl_Text_Cursor_Object *c, Efl_Ui_Internal_Text_Interactive_Data *en) { if (en->have_selection) return; - efl_text_cursor_copy(c, en->sel_start); - efl_text_cursor_copy(c, en->sel_end); + _sel_watch_freeze(en); + _cur_pos_copy(c, en->sel_start); + _cur_pos_copy(c, en->sel_end); + _sel_watch_thaw(en); en->have_selection = EINA_FALSE; if (en->selection) @@ -764,8 +836,7 @@ _sel_init(Efl_Text_Cursor *c, Evas_Object *o EINA_UNUSED, Efl_Ui_Internal_Text_I } static void -_sel_enable(Efl_Text_Cursor *c EINA_UNUSED, - Evas_Object *o EINA_UNUSED, Efl_Ui_Internal_Text_Interactive_Data *en) +_sel_enable(Eo *o, Efl_Ui_Internal_Text_Interactive_Data *en) { if (en->have_selection) return; en->have_selection = EINA_TRUE; @@ -783,28 +854,27 @@ _sel_enable(Efl_Text_Cursor *c EINA_UNUSED, static void _emit_sel_state( Eo *o, Efl_Ui_Internal_Text_Interactive_Data *en) { - if (!efl_text_cursor_compare(en->sel_start, en->sel_end)) + if (!efl_text_cursor_object_compare(en->sel_start, en->sel_end)) { - Eina_Bool b_value = EINA_FALSE; - efl_event_callback_call(o, EFL_TEXT_INTERACTIVE_EVENT_HAVE_SELECTION_CHANGED, &b_value); + _sel_clear(o, en); } else { - Efl_Text_Range range = {0}; - range.start = efl_text_cursor_position_get(en->sel_start); - range.end = efl_text_cursor_position_get(en->sel_end); + Eina_Range range = eina_range_from_to(efl_text_cursor_object_position_get(en->sel_start), + efl_text_cursor_object_position_get(en->sel_end)); efl_event_callback_call(o, EFL_TEXT_INTERACTIVE_EVENT_SELECTION_CHANGED, &range); } } static void -_sel_extend(Efl_Text_Cursor *c, Evas_Object *o, Efl_Ui_Internal_Text_Interactive_Data *en) +_sel_extend(Efl_Text_Cursor_Object *c, Evas_Object *o, Efl_Ui_Internal_Text_Interactive_Data *en) { - if (!en->sel_end) return; - _sel_enable(c, o, en); - if (efl_text_cursor_equal(c, en->sel_end)) return; + _sel_enable(o, en); + if (efl_text_cursor_object_equal(c, en->sel_end)) return; - efl_text_cursor_copy(c, en->sel_end); + _sel_watch_freeze(en); + _cur_pos_copy(c, en->sel_end); + _sel_watch_thaw(en); _entry_imf_cursor_info_set(en); @@ -830,7 +900,9 @@ _sel_clear(Evas_Object *o EINA_UNUSED, Efl_Ui_Internal_Text_Interactive_Data *en { en->have_selection = EINA_FALSE; Eina_Bool b_value = en->have_selection; - efl_text_cursor_copy(en->sel_start, en->sel_end); + _sel_watch_freeze(en); + _cur_pos_copy(en->sel_start, en->sel_end); + _sel_watch_thaw(en); efl_event_callback_call(o, EFL_TEXT_INTERACTIVE_EVENT_HAVE_SELECTION_CHANGED, &b_value); } } @@ -846,48 +918,51 @@ EOLIAN static Eina_Bool _efl_ui_internal_text_interactive_efl_text_interactive_have_selection_get( const Eo *obj EINA_UNUSED, Efl_Ui_Internal_Text_Interactive_Data *en) { - return !efl_text_cursor_equal(en->sel_start, en->sel_end); + if (!en->have_selection) return en->have_selection; + return !efl_text_cursor_object_equal(en->sel_start, en->sel_end); } EOLIAN static void _efl_ui_internal_text_interactive_efl_text_interactive_all_select( - Eo *obj, Efl_Ui_Internal_Text_Interactive_Data *en) + Eo *obj, Efl_Ui_Internal_Text_Interactive_Data *en EINA_UNUSED) { if (!efl_text_interactive_selection_allowed_get(obj)) return; - Efl_Text_Cursor *cur = efl_text_interactive_main_cursor_get(obj); - _entry_imf_context_reset(en); + Eo *c1 = efl_canvas_textblock_cursor_create(obj); + Eo *c2 = efl_canvas_textblock_cursor_create(obj); - efl_text_cursor_move(cur, EFL_TEXT_CURSOR_MOVE_TYPE_FIRST); - _entry_imf_context_reset(en); - _sel_init(cur, obj, en); - efl_text_cursor_move(cur, EFL_TEXT_CURSOR_MOVE_TYPE_LAST); - _sel_extend(cur, obj, en); + efl_text_cursor_object_move(c1, EFL_TEXT_CURSOR_MOVE_TYPE_FIRST); + efl_text_cursor_object_move(c2, EFL_TEXT_CURSOR_MOVE_TYPE_LAST); + + efl_text_interactive_selection_cursors_set(obj, c1, c2); + + efl_del(c1); + efl_del(c2); } static void -_range_del_emit(Evas_Object *obj, Efl_Text_Cursor *cur1, Efl_Text_Cursor *cur2) +_range_del_emit(Evas_Object *obj, Efl_Text_Cursor_Object *cur1, Efl_Text_Cursor_Object *cur2) { size_t start, end; char *tmp; Efl_Text_Change_Info info = { NULL, 0, 0, 0, 0 }; - start = efl_text_cursor_position_get(cur1); - end = efl_text_cursor_position_get(cur2); + start = efl_text_cursor_object_position_get(cur1); + end = efl_text_cursor_object_position_get(cur2); if (start == end) return; - info.insert = EINA_FALSE; + info.type = EFL_TEXT_CHANGE_TYPE_REMOVE; info.position = start; info.length = end - start; - tmp = efl_text_cursor_range_text_get(cur1, cur2); + tmp = efl_text_cursor_object_range_text_get(cur1, cur2); info.content = tmp; - efl_text_cursor_range_delete(cur1, cur2); + efl_text_cursor_object_range_delete(cur1, cur2); efl_event_callback_call(obj, EFL_TEXT_INTERACTIVE_EVENT_CHANGED_USER, &info); if (tmp) free(tmp); @@ -901,37 +976,37 @@ _sel_range_del_emit(Evas_Object *obj, Efl_Ui_Internal_Text_Interactive_Data *en) } static void -_delete_emit(Eo *obj, Efl_Text_Cursor *c, Efl_Ui_Internal_Text_Interactive_Data *en EINA_UNUSED, size_t pos, +_delete_emit(Eo *obj, Efl_Text_Cursor_Object *c, Efl_Ui_Internal_Text_Interactive_Data *en EINA_UNUSED, size_t pos, Eina_Bool backspace) { Eo * cur = efl_duplicate(c); if (backspace) { - if (!efl_text_cursor_move(cur, EFL_TEXT_CURSOR_MOVE_TYPE_CHAR_PREV)) + if (!efl_text_cursor_object_move(cur, EFL_TEXT_CURSOR_MOVE_TYPE_CHARACTER_PREVIOUS)) { return; } - efl_text_cursor_move(cur, EFL_TEXT_CURSOR_MOVE_TYPE_CHAR_NEXT); + efl_text_cursor_object_move(cur, EFL_TEXT_CURSOR_MOVE_TYPE_CHARACTER_NEXT); } else { - if (!efl_text_cursor_move(cur, EFL_TEXT_CURSOR_MOVE_TYPE_CHAR_NEXT)) + if (!efl_text_cursor_object_move(cur, EFL_TEXT_CURSOR_MOVE_TYPE_CHARACTER_NEXT)) { return; } - efl_text_cursor_move(cur, EFL_TEXT_CURSOR_MOVE_TYPE_CHAR_PREV); + efl_text_cursor_object_move(cur, EFL_TEXT_CURSOR_MOVE_TYPE_CHARACTER_PREVIOUS); } - efl_unref(cur); + efl_del(cur); cur = NULL; Efl_Text_Change_Info info = { NULL, 0, 0, 0, 0 }; char *tmp = NULL; - info.insert = EINA_FALSE; + info.type = EFL_TEXT_CHANGE_TYPE_REMOVE; if (backspace) { Evas_Textblock_Cursor *cc = evas_object_textblock_cursor_new(obj); - evas_textblock_cursor_copy(efl_text_cursor_handle_get(c), cc); + evas_textblock_cursor_copy(efl_text_cursor_object_handle_get(c), cc); Eina_Bool remove_cluster = evas_textblock_cursor_at_cluster_as_single_glyph(cc,EINA_FALSE); if (remove_cluster) { @@ -945,14 +1020,14 @@ _delete_emit(Eo *obj, Efl_Text_Cursor *c, Efl_Ui_Internal_Text_Interactive_Data info.position = evas_textblock_cursor_pos_get(cc); info.length = pos -info.position; - tmp = evas_textblock_cursor_range_text_get(efl_text_cursor_handle_get(c), cc, EVAS_TEXTBLOCK_TEXT_MARKUP); - evas_textblock_cursor_range_delete(efl_text_cursor_handle_get(c), cc); + tmp = evas_textblock_cursor_range_text_get(efl_text_cursor_object_handle_get(c), cc, EVAS_TEXTBLOCK_TEXT_MARKUP); + evas_textblock_cursor_range_delete(efl_text_cursor_object_handle_get(c), cc); evas_textblock_cursor_free(cc); } else { Evas_Textblock_Cursor *cc = evas_object_textblock_cursor_new(obj); - evas_textblock_cursor_copy(efl_text_cursor_handle_get(c), cc); + evas_textblock_cursor_copy(efl_text_cursor_object_handle_get(c), cc); Eina_Bool remove_cluster = evas_textblock_cursor_at_cluster_as_single_glyph(cc,EINA_TRUE); if (remove_cluster) @@ -967,12 +1042,12 @@ _delete_emit(Eo *obj, Efl_Text_Cursor *c, Efl_Ui_Internal_Text_Interactive_Data info.position = pos; info.length = evas_textblock_cursor_pos_get(cc) - info.position; - tmp = evas_textblock_cursor_range_text_get(efl_text_cursor_handle_get(c), cc, EVAS_TEXTBLOCK_TEXT_MARKUP); - evas_textblock_cursor_range_delete(efl_text_cursor_handle_get(c), cc); + tmp = evas_textblock_cursor_range_text_get(efl_text_cursor_object_handle_get(c), cc, EVAS_TEXTBLOCK_TEXT_MARKUP); + evas_textblock_cursor_range_delete(efl_text_cursor_object_handle_get(c), cc); evas_textblock_cursor_free(cc); } - info.insert = EINA_FALSE; + info.type = EFL_TEXT_CHANGE_TYPE_REMOVE; info.position = pos; info.length = 1; info.content = tmp; @@ -1012,28 +1087,29 @@ _compose_seq_reset(Efl_Ui_Internal_Text_Interactive_Data *en) * movement_forward: if the movement we are going to do is forward (towards the end of the textblock) */ static void -_key_down_sel_pre(Efl_Ui_Internal_Text_Interactive *obj, Efl_Text_Cursor *cur, Efl_Ui_Internal_Text_Interactive_Data *en, Eina_Bool shift, Eina_Bool movement_forward) +_key_down_sel_pre(Efl_Ui_Internal_Text_Interactive *obj, Efl_Text_Cursor_Object *cur, Efl_Ui_Internal_Text_Interactive_Data *en, Eina_Bool shift, Eina_Bool movement_forward) { if (en->select_allow) { if (shift) { - _sel_init(cur, obj, en); + _sel_init(cur, en); } else if (en->have_selection) { - Eina_Bool sel_forward = efl_text_cursor_compare(en->sel_start, en->sel_end); + Eina_Bool sel_forward = efl_text_cursor_object_compare(en->sel_start, en->sel_end); if ((sel_forward && movement_forward) || (!sel_forward && !movement_forward)) - efl_text_cursor_copy(en->sel_end, cur); + _cur_pos_copy(en->sel_end, cur); else - efl_text_cursor_copy(en->sel_start, cur); + _cur_pos_copy(en->sel_start, cur); + _sel_clear(obj, en); } } } static void -_key_down_sel_post(Efl_Ui_Internal_Text_Interactive *obj, Efl_Text_Cursor *cur, Efl_Ui_Internal_Text_Interactive_Data *en, Eina_Bool shift) +_key_down_sel_post(Efl_Ui_Internal_Text_Interactive *obj, Efl_Text_Cursor_Object *cur, Efl_Ui_Internal_Text_Interactive_Data *en, Eina_Bool shift) { if (en->select_allow) { @@ -1046,7 +1122,7 @@ static void _key_down_cb(void *data EINA_UNUSED, Evas *e EINA_UNUSED, Evas_Object *obj, void *event_info) { Evas_Event_Key_Down *ev = event_info; - Efl_Text_Cursor *cur; + Efl_Text_Cursor_Object *cur; Eina_Bool control, alt, shift; #if defined(__APPLE__) && defined(__MACH__) Eina_Bool super, altgr; @@ -1063,7 +1139,7 @@ _key_down_cb(void *data EINA_UNUSED, Evas *e EINA_UNUSED, Evas_Object *obj, void Efl_Ui_Internal_Text_Interactive_Data *en = efl_data_scope_get(obj, MY_CLASS); - /* FIXME: Maybe allow selctions to happen even when not editable. */ + /* FIXME: Maybe allow selections to happen even when not editable. */ if (!en->editable) return; #ifdef HAVE_ECORE_IMF @@ -1086,7 +1162,7 @@ _key_down_cb(void *data EINA_UNUSED, Evas *e EINA_UNUSED, Evas_Object *obj, void #endif cur = efl_text_interactive_main_cursor_get(obj); - old_cur_pos = efl_text_cursor_position_get(cur); + old_cur_pos = efl_text_cursor_object_position_get(cur); if (old_cur_pos < 0) return; control = evas_key_modifier_is_set(ev->modifiers, "Control"); @@ -1137,8 +1213,10 @@ _key_down_cb(void *data EINA_UNUSED, Evas *e EINA_UNUSED, Evas_Object *obj, void { _key_down_sel_pre(obj, cur, en, shift, EINA_FALSE); - efl_text_cursor_line_jump_by(cur, -1); - ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD; + if (efl_text_interactive_have_selection_get(obj)) + ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD; + if (efl_text_cursor_object_line_jump_by(cur, -1)) + ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD; _key_down_sel_post(obj, cur, en, shift); } @@ -1151,8 +1229,10 @@ _key_down_cb(void *data EINA_UNUSED, Evas *e EINA_UNUSED, Evas_Object *obj, void { _key_down_sel_pre(obj, cur, en, shift, EINA_TRUE); - efl_text_cursor_line_jump_by(cur, 1); - ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD; + if (efl_text_interactive_have_selection_get(obj)) + ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD; + if (efl_text_cursor_object_line_jump_by(cur, 1)) + ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD; _key_down_sel_post(obj, cur, en, shift); } @@ -1163,14 +1243,16 @@ _key_down_cb(void *data EINA_UNUSED, Evas *e EINA_UNUSED, Evas_Object *obj, void _compose_seq_reset(en); _key_down_sel_pre(obj, cur, en, shift, EINA_FALSE); - efl_text_cursor_move(cur,EFL_TEXT_CURSOR_MOVE_TYPE_CHAR_PREV); #if defined(__APPLE__) && defined(__MACH__) - if (altgr) efl_text_cursor_move(cur, EFL_TEXT_CURSOR_MOVE_TYPE_WORD_START); + if (altgr) efl_text_cursor_object_move(cur, EFL_TEXT_CURSOR_MOVE_TYPE_WORD_START); #else /* If control is pressed, go to the start of the word */ - if (control) efl_text_cursor_move(cur, EFL_TEXT_CURSOR_MOVE_TYPE_WORD_START); + if (control) efl_text_cursor_object_move(cur, EFL_TEXT_CURSOR_MOVE_TYPE_WORD_START); #endif - ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD; + if (efl_text_interactive_have_selection_get(obj)) + ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD; + if (efl_text_cursor_object_move(cur,EFL_TEXT_CURSOR_MOVE_TYPE_CLUSTER_PREVIOUS)) + ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD; _key_down_sel_post(obj, cur, en, shift); } @@ -1181,13 +1263,15 @@ _key_down_cb(void *data EINA_UNUSED, Evas *e EINA_UNUSED, Evas_Object *obj, void _key_down_sel_pre(obj, cur, en, shift, EINA_TRUE); #if defined(__APPLE__) && defined(__MACH__) - if (altgr) efl_text_cursor_move(cur, EFL_TEXT_CURSOR_MOVE_TYPE_WORD_END); + if (altgr) efl_text_cursor_object_move(cur, EFL_TEXT_CURSOR_MOVE_TYPE_WORD_END); #else /* If control is pressed, go to the end of the word */ - if (control) efl_text_cursor_move(cur, EFL_TEXT_CURSOR_MOVE_TYPE_WORD_END); + if (control) efl_text_cursor_object_move(cur, EFL_TEXT_CURSOR_MOVE_TYPE_WORD_END); #endif - efl_text_cursor_move(cur, EFL_TEXT_CURSOR_MOVE_TYPE_CHAR_NEXT); - ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD; + if (efl_text_interactive_have_selection_get(obj)) + ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD; + if (efl_text_cursor_object_move(cur, EFL_TEXT_CURSOR_MOVE_TYPE_CLUSTER_NEXT)) + ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD; _key_down_sel_post(obj, cur, en, shift); } @@ -1197,11 +1281,10 @@ _key_down_cb(void *data EINA_UNUSED, Evas *e EINA_UNUSED, Evas_Object *obj, void if (control && !en->have_selection) { // del to start of previous word - Efl_Text_Cursor *tc = efl_canvas_textblock_cursor_create(obj); - - efl_text_cursor_copy(tc, cur); - efl_text_cursor_move(cur, EFL_TEXT_CURSOR_MOVE_TYPE_CHAR_PREV); - efl_text_cursor_move(cur, EFL_TEXT_CURSOR_MOVE_TYPE_WORD_START); + Efl_Text_Cursor_Object *tc = efl_canvas_textblock_cursor_create(obj); + _cur_pos_copy(cur, tc); + efl_text_cursor_object_move(cur, EFL_TEXT_CURSOR_MOVE_TYPE_CHARACTER_PREVIOUS); + efl_text_cursor_object_move(cur, EFL_TEXT_CURSOR_MOVE_TYPE_WORD_START); _range_del_emit(obj, cur, tc); @@ -1232,11 +1315,11 @@ _key_down_cb(void *data EINA_UNUSED, Evas *e EINA_UNUSED, Evas_Object *obj, void if (control) { // del to end of next word - Efl_Text_Cursor *tc = efl_canvas_textblock_cursor_create(obj); + Efl_Text_Cursor_Object *tc = efl_canvas_textblock_cursor_create(obj); - efl_text_cursor_copy(tc, cur); - efl_text_cursor_move(cur, EFL_TEXT_CURSOR_MOVE_TYPE_WORD_END); - efl_text_cursor_move(cur, EFL_TEXT_CURSOR_MOVE_TYPE_CHAR_NEXT); + _cur_pos_copy(cur, tc); + efl_text_cursor_object_move(cur, EFL_TEXT_CURSOR_MOVE_TYPE_WORD_END); + efl_text_cursor_object_move(cur, EFL_TEXT_CURSOR_MOVE_TYPE_CHARACTER_NEXT); _range_del_emit(obj, cur, tc); @@ -1269,9 +1352,9 @@ _key_down_cb(void *data EINA_UNUSED, Evas *e EINA_UNUSED, Evas_Object *obj, void _key_down_sel_pre(obj, cur, en, shift, EINA_FALSE); if ((control) && (multiline)) - efl_text_cursor_move(cur, EFL_TEXT_CURSOR_MOVE_TYPE_FIRST); + efl_text_cursor_object_move(cur, EFL_TEXT_CURSOR_MOVE_TYPE_FIRST); else - efl_text_cursor_move(cur, EFL_TEXT_CURSOR_MOVE_TYPE_LINE_START); + efl_text_cursor_object_move(cur, EFL_TEXT_CURSOR_MOVE_TYPE_LINE_START); _key_down_sel_post(obj, cur, en, shift); ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD; @@ -1284,17 +1367,17 @@ _key_down_cb(void *data EINA_UNUSED, Evas *e EINA_UNUSED, Evas_Object *obj, void _key_down_sel_pre(obj, cur, en, shift, EINA_TRUE); if ((control) && (multiline)) - efl_text_cursor_move(cur, EFL_TEXT_CURSOR_MOVE_TYPE_LAST); + efl_text_cursor_object_move(cur, EFL_TEXT_CURSOR_MOVE_TYPE_LAST); else - efl_text_cursor_move(cur, EFL_TEXT_CURSOR_MOVE_TYPE_LINE_END); + efl_text_cursor_object_move(cur, EFL_TEXT_CURSOR_MOVE_TYPE_LINE_END); _key_down_sel_post(obj, cur, en, shift); ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD; } #if defined(__APPLE__) && defined(__MACH__) - else if ((super) && (!strcmp(ev->keyname, "a"))) + else if ((super) && (!strcmp(ev->key, "a"))) #else - else if ((control) && (!strcmp(ev->keyname, "a"))) + else if ((control) && (!strcmp(ev->key, "a"))) #endif { _compose_seq_reset(en); @@ -1310,9 +1393,9 @@ _key_down_cb(void *data EINA_UNUSED, Evas *e EINA_UNUSED, Evas_Object *obj, void } } #if defined(__APPLE__) && defined(__MACH__) - else if ((super) && (!strcmp(ev->keyname, "z"))) + else if ((super) && (!strcmp(ev->key, "z"))) #else - else if ((control) && (!strcmp(ev->keyname, "z"))) + else if ((control) && (!strcmp(ev->key, "z"))) #endif { _compose_seq_reset(en); @@ -1329,9 +1412,9 @@ _key_down_cb(void *data EINA_UNUSED, Evas *e EINA_UNUSED, Evas_Object *obj, void ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD; } #if defined(__APPLE__) && defined(__MACH__) - else if ((super) && (!shift) && (!strcmp(ev->keyname, "y"))) + else if ((super) && (!shift) && (!strcmp(ev->key, "y"))) #else - else if ((control) && (!shift) && (!strcmp(ev->keyname, "y"))) + else if ((control) && (!shift) && (!strcmp(ev->key, "y"))) #endif { _compose_seq_reset(en); @@ -1359,7 +1442,7 @@ _key_down_cb(void *data EINA_UNUSED, Evas *e EINA_UNUSED, Evas_Object *obj, void _compose_seq_reset(en); _key_down_sel_pre(obj, cur, en, shift, EINA_FALSE); - efl_text_cursor_line_jump_by(cur, -10); + efl_text_cursor_object_line_jump_by(cur, -10); _key_down_sel_post(obj, cur, en, shift); ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD; @@ -1370,7 +1453,7 @@ _key_down_cb(void *data EINA_UNUSED, Evas *e EINA_UNUSED, Evas_Object *obj, void _compose_seq_reset(en); _key_down_sel_pre(obj, cur, en, shift, EINA_TRUE); - efl_text_cursor_line_jump_by(cur, 10); + efl_text_cursor_object_line_jump_by(cur, 10); _key_down_sel_post(obj, cur, en, shift); ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD; @@ -1444,16 +1527,14 @@ _key_down_cb(void *data EINA_UNUSED, Evas *e EINA_UNUSED, Evas_Object *obj, void if (en->have_selection) { _sel_range_del_emit(obj, en); - info.merge = EINA_TRUE; + info.mergeable = EINA_TRUE; } - info.insert = EINA_TRUE; + info.type = EFL_TEXT_CHANGE_TYPE_INSERT; info.content = string; - info.position = efl_text_cursor_position_get(cur); + info.position = efl_text_cursor_object_position_get(cur); info.length = eina_unicode_utf8_get_len(string); - efl_event_freeze(obj); - efl_text_cursor_text_insert(cur, string); - efl_event_thaw(obj); + efl_text_cursor_object_text_insert(cur, string); changed_user = EINA_TRUE; ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD; @@ -1470,29 +1551,29 @@ end: } static void -_cursor_char_coord_set(Efl_Canvas_Textblock *obj, Efl_Text_Cursor *cur, Evas_Coord canvasx, Evas_Coord canvasy, Evas_Coord *_cx, Evas_Coord *_cy) +_cursor_cluster_coord_set(Efl_Canvas_Textblock *obj, Efl_Text_Cursor_Object *cur, Evas_Coord canvasx, Evas_Coord canvasy, Evas_Coord *_cx, Evas_Coord *_cy) { Evas_Coord cx, cy; Evas_Coord x, y, lh = 0, cly = 0; - Efl_Text_Cursor *line_cur; - Efl_Text_Cursor *tc; + Efl_Text_Cursor_Object *line_cur; + Efl_Text_Cursor_Object *tc; tc = efl_canvas_textblock_cursor_create(obj); - efl_text_cursor_copy(cur, tc); + _cur_pos_copy(cur, tc); evas_object_geometry_get(obj, &x, &y, NULL, NULL); cx = canvasx - x; cy = canvasy - y; line_cur = efl_canvas_textblock_cursor_create(obj); - efl_text_cursor_move(line_cur, EFL_TEXT_CURSOR_MOVE_TYPE_LAST); - evas_textblock_cursor_line_geometry_get(efl_text_cursor_handle_get(line_cur), NULL, &cly, NULL, &lh); + efl_text_cursor_object_move(line_cur, EFL_TEXT_CURSOR_MOVE_TYPE_LAST); + evas_textblock_cursor_line_geometry_get(efl_text_cursor_object_handle_get(line_cur), NULL, &cly, NULL, &lh); /* Consider a threshold of half the line height */ if (cy > (cly + lh) && cy < (cly + lh + lh / 2)) { cy = cly + lh - 1; // Make it inside Textblock } - efl_text_cursor_move(line_cur, EFL_TEXT_CURSOR_MOVE_TYPE_FIRST); - evas_textblock_cursor_line_geometry_get(efl_text_cursor_handle_get(line_cur), NULL, &cly, NULL, NULL); + efl_text_cursor_object_move(line_cur, EFL_TEXT_CURSOR_MOVE_TYPE_FIRST); + evas_textblock_cursor_line_geometry_get(efl_text_cursor_object_handle_get(line_cur), NULL, &cly, NULL, NULL); if (cy < cly && cy > (cly - lh / 2)) { @@ -1501,7 +1582,7 @@ _cursor_char_coord_set(Efl_Canvas_Textblock *obj, Efl_Text_Cursor *cur, Evas_Coo efl_del(line_cur); /* No need to check return value if not able to set the char coord Textblock * will take care */ - efl_text_cursor_char_coord_set(cur, EINA_POSITION2D(cx, cy)); + efl_text_cursor_object_cluster_coord_set(cur, EINA_POSITION2D(cx, cy)); if (_cx) *_cx = cx; if (_cy) *_cy = cy; } @@ -1512,8 +1593,8 @@ _mouse_down_cb(void *data EINA_UNUSED, Evas *e EINA_UNUSED, Evas_Object *obj EIN Evas_Coord cx, cy; Evas_Event_Mouse_Down *ev = event_info; Efl_Ui_Internal_Text_Interactive_Data *en = efl_data_scope_get(obj, MY_CLASS); - Efl_Text_Cursor *cur = efl_text_interactive_main_cursor_get(obj); - Efl_Text_Cursor *tc = NULL; + Efl_Text_Cursor_Object *cur = efl_text_interactive_main_cursor_get(obj); + Efl_Text_Cursor_Object *tc = NULL; Eina_Bool dosel = EINA_FALSE; Eina_Bool shift; @@ -1543,11 +1624,11 @@ _mouse_down_cb(void *data EINA_UNUSED, Evas *e EINA_UNUSED, Evas_Object *obj EIN if (shift) { tc = efl_canvas_textblock_cursor_create(obj); - efl_text_cursor_copy(cur, tc); - if (efl_text_cursor_compare(cur, en->sel_start) < 0) - efl_text_cursor_move(cur, EFL_TEXT_CURSOR_MOVE_TYPE_LINE_START); + _cur_pos_copy(cur, tc); + if (efl_text_cursor_object_compare(cur, en->sel_start) < 0) + efl_text_cursor_object_move(cur, EFL_TEXT_CURSOR_MOVE_TYPE_LINE_START); else - efl_text_cursor_move(cur, EFL_TEXT_CURSOR_MOVE_TYPE_LINE_END); + efl_text_cursor_object_move(cur, EFL_TEXT_CURSOR_MOVE_TYPE_LINE_END); _sel_extend(cur, obj, en); } else @@ -1556,10 +1637,10 @@ _mouse_down_cb(void *data EINA_UNUSED, Evas *e EINA_UNUSED, Evas_Object *obj EIN en->selecting = EINA_FALSE; _sel_clear(obj, en); tc = efl_canvas_textblock_cursor_create(obj); - efl_text_cursor_copy(cur, tc); - efl_text_cursor_move(cur, EFL_TEXT_CURSOR_MOVE_TYPE_LINE_START); - _sel_init(cur, obj, en); - efl_text_cursor_move(cur, EFL_TEXT_CURSOR_MOVE_TYPE_LINE_END); + _cur_pos_copy(cur, tc); + efl_text_cursor_object_move(cur, EFL_TEXT_CURSOR_MOVE_TYPE_LINE_START); + _sel_init(cur, en); + efl_text_cursor_object_move(cur, EFL_TEXT_CURSOR_MOVE_TYPE_LINE_END); _sel_extend(cur, obj, en); } goto end; @@ -1569,13 +1650,13 @@ _mouse_down_cb(void *data EINA_UNUSED, Evas *e EINA_UNUSED, Evas_Object *obj EIN if (shift) { tc = efl_canvas_textblock_cursor_create(obj); - efl_text_cursor_copy(cur, tc); - if (efl_text_cursor_compare(cur, en->sel_start) < 0) - efl_text_cursor_move(cur, EFL_TEXT_CURSOR_MOVE_TYPE_WORD_START); + _cur_pos_copy(cur, tc); + if (efl_text_cursor_object_compare(cur, en->sel_start) < 0) + efl_text_cursor_object_move(cur, EFL_TEXT_CURSOR_MOVE_TYPE_WORD_START); else { - efl_text_cursor_move(cur, EFL_TEXT_CURSOR_MOVE_TYPE_WORD_END); - efl_text_cursor_move(cur, EFL_TEXT_CURSOR_MOVE_TYPE_CHAR_NEXT); + efl_text_cursor_object_move(cur, EFL_TEXT_CURSOR_MOVE_TYPE_WORD_END); + efl_text_cursor_object_move(cur, EFL_TEXT_CURSOR_MOVE_TYPE_CHARACTER_NEXT); } _sel_extend(cur, obj, en); } @@ -1585,17 +1666,17 @@ _mouse_down_cb(void *data EINA_UNUSED, Evas *e EINA_UNUSED, Evas_Object *obj EIN en->selecting = EINA_FALSE; _sel_clear(obj, en); tc = efl_canvas_textblock_cursor_create(obj); - efl_text_cursor_copy(cur, tc); - efl_text_cursor_move(cur, EFL_TEXT_CURSOR_MOVE_TYPE_WORD_START); - _sel_init(cur, obj, en); - efl_text_cursor_move(cur, EFL_TEXT_CURSOR_MOVE_TYPE_WORD_END); - efl_text_cursor_move(cur, EFL_TEXT_CURSOR_MOVE_TYPE_CHAR_NEXT); + _cur_pos_copy(cur, tc); + efl_text_cursor_object_move(cur, EFL_TEXT_CURSOR_MOVE_TYPE_WORD_START); + _sel_init(cur, en); + efl_text_cursor_object_move(cur, EFL_TEXT_CURSOR_MOVE_TYPE_WORD_END); + efl_text_cursor_object_move(cur, EFL_TEXT_CURSOR_MOVE_TYPE_CHARACTER_NEXT); _sel_extend(cur, obj, en); } goto end; } } - _cursor_char_coord_set(obj, cur, ev->canvas.x, ev->canvas.y, &cx, &cy); + _cursor_cluster_coord_set(obj, cur, ev->canvas.x, ev->canvas.y, &cx, &cy); if (dosel) { @@ -1607,7 +1688,7 @@ _mouse_down_cb(void *data EINA_UNUSED, Evas *e EINA_UNUSED, Evas_Object *obj EIN { en->selecting = EINA_TRUE; _sel_clear(obj, en); - _sel_init(cur, obj, en); + _sel_init(cur, en); } } @@ -1620,7 +1701,7 @@ _mouse_up_cb(void *data EINA_UNUSED, Evas *e EINA_UNUSED, Evas_Object *obj, void { Evas_Coord cx, cy; Efl_Ui_Internal_Text_Interactive_Data *en = efl_data_scope_get(obj, MY_CLASS); - Efl_Text_Cursor *cur = efl_text_interactive_main_cursor_get(obj); + Efl_Text_Cursor_Object *cur = efl_text_interactive_main_cursor_get(obj); Evas_Event_Mouse_Up *ev = event_info; if ((!ev) || (ev->button != 1)) return; @@ -1640,11 +1721,11 @@ _mouse_up_cb(void *data EINA_UNUSED, Evas *e EINA_UNUSED, Evas_Object *obj, void } #endif - _cursor_char_coord_set(obj, cur, ev->canvas.x, ev->canvas.y, &cx, &cy); + _cursor_cluster_coord_set(obj, cur, ev->canvas.x, ev->canvas.y, &cx, &cy); if (en->select_allow) { - efl_text_cursor_copy(en->sel_end, cur); + _cur_pos_copy(en->sel_end, cur); } if (en->selecting) { @@ -1661,10 +1742,10 @@ _mouse_move_cb(void *data EINA_UNUSED, Evas *e EINA_UNUSED, Evas_Object *obj, vo { Evas_Coord cx, cy; Efl_Ui_Internal_Text_Interactive_Data *en = efl_data_scope_get(obj, MY_CLASS); - Efl_Text_Cursor *cur = efl_text_interactive_main_cursor_get(obj); + Efl_Text_Cursor_Object *cur = efl_text_interactive_main_cursor_get(obj); Evas_Event_Mouse_Move *ev = event_info; Evas_Coord x, y, w, h; - Efl_Text_Cursor *tc; + Efl_Text_Cursor_Object *tc; Eina_Bool multiline; multiline = efl_text_multiline_get(obj); @@ -1684,35 +1765,35 @@ _mouse_move_cb(void *data EINA_UNUSED, Evas *e EINA_UNUSED, Evas_Object *obj, vo if (en->selecting) { tc = efl_canvas_textblock_cursor_create(obj); - efl_text_cursor_copy(cur, tc); + _cur_pos_copy(cur, tc); evas_object_geometry_get(obj, &x, &y, &w, &h); cx = ev->cur.canvas.x - x; cy = ev->cur.canvas.y - y; if (multiline) { - efl_text_cursor_char_coord_set(cur, EINA_POSITION2D(cx, cy)); + efl_text_cursor_object_char_coord_set(cur, EINA_POSITION2D(cx, cy)); } else { Evas_Coord lx, ly, lw, lh; - efl_text_cursor_move(cur, EFL_TEXT_CURSOR_MOVE_TYPE_FIRST); - evas_textblock_cursor_line_geometry_get(efl_text_cursor_handle_get(cur), &lx, &ly, &lw, &lh); - efl_text_cursor_char_coord_set(cur, EINA_POSITION2D(cx, ly + (lh / 2))); + efl_text_cursor_object_move(cur, EFL_TEXT_CURSOR_MOVE_TYPE_FIRST); + evas_textblock_cursor_line_geometry_get(efl_text_cursor_object_handle_get(cur), &lx, &ly, &lw, &lh); + efl_text_cursor_object_char_coord_set(cur, EINA_POSITION2D(cx, ly + (lh / 2))); } if (en->select_allow) { _sel_extend(cur, obj, en); - if (!efl_text_cursor_equal(en->sel_start, en->sel_end)) - _sel_enable(cur, obj, en); + if (!efl_text_cursor_object_equal(en->sel_start, en->sel_end)) + _sel_enable(obj, en); } efl_del(tc); } } -EOLIAN static Efl_Text_Cursor * +EOLIAN static Efl_Text_Cursor_Object * _efl_ui_internal_text_interactive_efl_text_interactive_main_cursor_get(const Eo *obj EINA_UNUSED, Efl_Ui_Internal_Text_Interactive_Data *pd) { return pd->main_cursor; @@ -1724,9 +1805,18 @@ _efl_ui_internal_text_interactive_efl_object_constructor(Eo *obj, Efl_Ui_Interna obj = efl_constructor(efl_super(obj, MY_CLASS)); en->select_allow = EINA_TRUE; en->editable = EINA_TRUE; + en->watch_selection = EINA_TRUE; return obj; } +EOLIAN static void +_efl_ui_internal_text_interactive_efl_object_destructor(Eo *obj, Efl_Ui_Internal_Text_Interactive_Data *sd) +{ + eina_stringshare_del(sd->file); + sd->file = NULL; + efl_destructor(efl_super(obj, MY_CLASS)); +} + EOLIAN static Efl_Object * _efl_ui_internal_text_interactive_efl_object_finalize(Eo *obj, Efl_Ui_Internal_Text_Interactive_Data *en) { @@ -1741,7 +1831,9 @@ _efl_ui_internal_text_interactive_efl_object_finalize(Eo *obj, Efl_Ui_Internal_T en->sel_start = efl_canvas_textblock_cursor_create(obj); en->sel_end = efl_canvas_textblock_cursor_create(obj); - efl_event_callback_add(efl_text_interactive_main_cursor_get(obj), EFL_TEXT_CURSOR_EVENT_CHANGED, + efl_event_callback_add(en->sel_start, EFL_TEXT_CURSOR_OBJECT_EVENT_CHANGED, + _sel_cursor_changed, obj); + efl_event_callback_add(en->sel_end, EFL_TEXT_CURSOR_OBJECT_EVENT_CHANGED, _sel_cursor_changed, obj); #ifdef HAVE_ECORE_IMF @@ -1814,7 +1906,7 @@ _efl_ui_internal_text_interactive_efl_text_text_set(Eo *eo_obj, Efl_Ui_Internal_ const char *text) { efl_text_set(efl_super(eo_obj, MY_CLASS), text); - efl_text_cursor_move(o->main_cursor, EFL_TEXT_CURSOR_MOVE_TYPE_LAST); + efl_text_cursor_object_move(o->main_cursor, EFL_TEXT_CURSOR_MOVE_TYPE_LAST); } EOLIAN void @@ -1822,7 +1914,7 @@ _efl_ui_internal_text_interactive_efl_text_markup_markup_set(Eo *eo_obj, Efl_Ui_ const char *text) { efl_text_markup_set(efl_super(eo_obj, MY_CLASS), text); - efl_text_cursor_move(o->main_cursor, EFL_TEXT_CURSOR_MOVE_TYPE_LAST); + efl_text_cursor_object_move(o->main_cursor, EFL_TEXT_CURSOR_MOVE_TYPE_LAST); } EOLIAN static void @@ -1845,10 +1937,10 @@ _efl_ui_internal_text_interactive_efl_text_interactive_selection_allowed_get(con } EOLIAN static void -_efl_ui_internal_text_interactive_efl_text_interactive_selection_cursors_get(const Eo *obj EINA_UNUSED, Efl_Ui_Internal_Text_Interactive_Data *pd, Efl_Text_Cursor **start, Efl_Text_Cursor **end) +_efl_ui_internal_text_interactive_efl_text_interactive_selection_cursors_get(const Eo *obj EINA_UNUSED, Efl_Ui_Internal_Text_Interactive_Data *pd, Efl_Text_Cursor_Object **start, Efl_Text_Cursor_Object **end) { - if (efl_text_cursor_position_get(pd->sel_start) > - efl_text_cursor_position_get(pd->sel_end)) + if (efl_text_cursor_object_position_get(pd->sel_start) > + efl_text_cursor_object_position_get(pd->sel_end)) { if (start) *start = pd->sel_end; if (end) *end = pd->sel_start; @@ -1861,6 +1953,31 @@ _efl_ui_internal_text_interactive_efl_text_interactive_selection_cursors_get(con } EOLIAN static void +_efl_ui_internal_text_interactive_efl_text_interactive_selection_cursors_set(Eo *obj EINA_UNUSED, Efl_Ui_Internal_Text_Interactive_Data *en, Efl_Text_Cursor_Object *start, Efl_Text_Cursor_Object *end) +{ + if (!efl_text_interactive_selection_allowed_get(obj)) + return; + + int new_sel_start_pos = efl_text_cursor_object_position_get(start); + int new_sel_end_pos = efl_text_cursor_object_position_get(end); + + int current_sel_start_pos = efl_text_cursor_object_position_get(en->sel_start); + int current_sel_end_pos = efl_text_cursor_object_position_get(en->sel_end); + + Eina_Bool b_start_changed = (new_sel_start_pos == current_sel_start_pos); + Eina_Bool b_end_changed = (new_sel_end_pos == current_sel_end_pos); + + if (b_start_changed && b_end_changed) + return; + + _sel_watch_freeze(en); + efl_text_cursor_object_position_set(en->sel_start, new_sel_start_pos); + efl_text_cursor_object_position_set(en->sel_end, new_sel_end_pos); + _sel_watch_thaw(en); + _sel_reset(obj, en); +} + +EOLIAN static void _efl_ui_internal_text_interactive_efl_text_interactive_editable_set(Eo *obj EINA_UNUSED, Efl_Ui_Internal_Text_Interactive_Data *sd, Eina_Bool editable) { sd->editable = editable; @@ -1873,7 +1990,7 @@ _efl_ui_internal_text_interactive_efl_text_interactive_editable_get(const Eo *ob } EOLIAN static void -_efl_ui_internal_text_interactive_efl_input_text_input_panel_hide(Eo *obj EINA_UNUSED, Efl_Ui_Internal_Text_Interactive_Data *en) +_efl_ui_internal_text_interactive_efl_input_text_entity_input_panel_hide(Eo *obj EINA_UNUSED, Efl_Ui_Internal_Text_Interactive_Data *en) { #ifdef HAVE_ECORE_IMF if (en->imf_context) @@ -1885,7 +2002,7 @@ _efl_ui_internal_text_interactive_efl_input_text_input_panel_hide(Eo *obj EINA_U EOLIAN static void -_efl_ui_internal_text_interactive_efl_input_text_input_panel_language_set(Eo *obj EINA_UNUSED, Efl_Ui_Internal_Text_Interactive_Data *en, Efl_Input_Text_Panel_Language_Type lang) +_efl_ui_internal_text_interactive_efl_input_text_entity_input_panel_language_set(Eo *obj EINA_UNUSED, Efl_Ui_Internal_Text_Interactive_Data *en, Efl_Input_Text_Panel_Language_Type lang) { en->input_panel_lang = lang; #ifdef HAVE_ECORE_IMF @@ -1899,15 +2016,14 @@ _efl_ui_internal_text_interactive_efl_input_text_input_panel_language_set(Eo *ob EOLIAN static Efl_Input_Text_Panel_Language_Type -_efl_ui_internal_text_interactive_efl_input_text_input_panel_language_get(const Eo *obj, Efl_Ui_Internal_Text_Interactive_Data *en) +_efl_ui_internal_text_interactive_efl_input_text_entity_input_panel_language_get(const Eo *obj EINA_UNUSED, Efl_Ui_Internal_Text_Interactive_Data *en) { return en->input_panel_lang; - (void)obj; } EOLIAN static void -_efl_ui_internal_text_interactive_efl_input_text_input_panel_imdata_set(Eo *obj EINA_UNUSED, Efl_Ui_Internal_Text_Interactive_Data *en, Eina_Slice slice) +_efl_ui_internal_text_interactive_efl_input_text_entity_input_panel_imdata_set(Eo *obj EINA_UNUSED, Efl_Ui_Internal_Text_Interactive_Data *en, Eina_Slice slice) { #ifdef HAVE_ECORE_IMF if (en->imf_context) @@ -1921,7 +2037,7 @@ _efl_ui_internal_text_interactive_efl_input_text_input_panel_imdata_set(Eo *obj EOLIAN static Eina_Slice -_efl_ui_internal_text_interactive_efl_input_text_input_panel_imdata_get(const Eo *obj EINA_UNUSED, Efl_Ui_Internal_Text_Interactive_Data *en) +_efl_ui_internal_text_interactive_efl_input_text_entity_input_panel_imdata_get(const Eo *obj EINA_UNUSED, Efl_Ui_Internal_Text_Interactive_Data *en) { Eina_Slice slice = {0}; @@ -1942,7 +2058,7 @@ _efl_ui_internal_text_interactive_efl_input_text_input_panel_imdata_get(const Eo EOLIAN static void -_efl_ui_internal_text_interactive_efl_input_text_input_panel_return_key_type_set(Eo *obj EINA_UNUSED, Efl_Ui_Internal_Text_Interactive_Data *en, Efl_Input_Text_Panel_Return_Key_Type return_key_type) +_efl_ui_internal_text_interactive_efl_input_text_entity_input_panel_return_key_type_set(Eo *obj EINA_UNUSED, Efl_Ui_Internal_Text_Interactive_Data *en, Efl_Input_Text_Panel_Return_Key_Type return_key_type) { #ifdef HAVE_ECORE_IMF if (en->imf_context) @@ -1955,7 +2071,7 @@ _efl_ui_internal_text_interactive_efl_input_text_input_panel_return_key_type_set EOLIAN static Efl_Input_Text_Panel_Return_Key_Type -_efl_ui_internal_text_interactive_efl_input_text_input_panel_return_key_type_get(const Eo *obj EINA_UNUSED, Efl_Ui_Internal_Text_Interactive_Data *en) +_efl_ui_internal_text_interactive_efl_input_text_entity_input_panel_return_key_type_get(const Eo *obj EINA_UNUSED, Efl_Ui_Internal_Text_Interactive_Data *en) { #ifdef HAVE_ECORE_IMF if (en->imf_context) @@ -1968,7 +2084,7 @@ _efl_ui_internal_text_interactive_efl_input_text_input_panel_return_key_type_get } EOLIAN static void -_efl_ui_internal_text_interactive_efl_input_text_input_panel_return_key_state_set(Eo *obj, Efl_Ui_Internal_Text_Interactive_Data *en, Efl_Input_Text_Panel_Return_Key_State state) +_efl_ui_internal_text_interactive_efl_input_text_entity_input_panel_return_key_state_set(Eo *obj, Efl_Ui_Internal_Text_Interactive_Data *en, Efl_Input_Text_Panel_Return_Key_State state) { if (en->input_panel_return_key_state == state) return; @@ -2002,14 +2118,14 @@ _efl_ui_internal_text_interactive_efl_input_text_input_panel_return_key_state_se EOLIAN static Efl_Input_Text_Panel_Return_Key_State -_efl_ui_internal_text_interactive_efl_input_text_input_panel_return_key_state_get(const Eo *obj EINA_UNUSED, Efl_Ui_Internal_Text_Interactive_Data *en) +_efl_ui_internal_text_interactive_efl_input_text_entity_input_panel_return_key_state_get(const Eo *obj EINA_UNUSED, Efl_Ui_Internal_Text_Interactive_Data *en) { return en->input_panel_return_key_state; } EOLIAN static void -_efl_ui_internal_text_interactive_efl_input_text_input_panel_show_on_demand_set(Eo *obj EINA_UNUSED, Efl_Ui_Internal_Text_Interactive_Data *en, Eina_Bool ondemand) +_efl_ui_internal_text_interactive_efl_input_text_entity_input_panel_show_on_demand_set(Eo *obj EINA_UNUSED, Efl_Ui_Internal_Text_Interactive_Data *en, Eina_Bool ondemand) { #ifdef HAVE_ECORE_IMF if (en->imf_context) @@ -2021,7 +2137,7 @@ _efl_ui_internal_text_interactive_efl_input_text_input_panel_show_on_demand_set( } EOLIAN static void -_efl_ui_internal_text_interactive_efl_input_text_input_panel_layout_set(Eo *obj EINA_UNUSED, Efl_Ui_Internal_Text_Interactive_Data *sd, Efl_Input_Text_Panel_Layout_Type layout) +_efl_ui_internal_text_interactive_efl_input_text_entity_input_panel_layout_set(Eo *obj EINA_UNUSED, Efl_Ui_Internal_Text_Interactive_Data *sd, Efl_Input_Text_Panel_Layout_Type layout) { sd->input_panel_layout = layout; @@ -2031,19 +2147,19 @@ _efl_ui_internal_text_interactive_efl_input_text_input_panel_layout_set(Eo *obj #endif if (layout == EFL_INPUT_TEXT_PANEL_LAYOUT_TYPE_PASSWORD) - efl_input_text_input_hint_set(obj, ((sd->input_hints & ~EFL_INPUT_TEXT_HINTS_TYPE_AUTO_COMPLETE) | EFL_INPUT_TEXT_HINTS_TYPE_SENSITIVE_DATA)); + efl_input_text_input_content_type_set(obj, ((sd->input_hints & ~EFL_INPUT_TEXT_CONTENT_TYPE_AUTO_COMPLETE) | EFL_INPUT_TEXT_CONTENT_TYPE_SENSITIVE_DATA)); else if (layout == EFL_INPUT_TEXT_PANEL_LAYOUT_TYPE_TERMINAL) - efl_input_text_input_hint_set(obj, (sd->input_hints & ~EFL_INPUT_TEXT_HINTS_TYPE_AUTO_COMPLETE)); + efl_input_text_input_content_type_set(obj, (sd->input_hints & ~EFL_INPUT_TEXT_CONTENT_TYPE_AUTO_COMPLETE)); } EOLIAN static Efl_Input_Text_Panel_Layout_Type -_efl_ui_internal_text_interactive_efl_input_text_input_panel_layout_get(const Eo *obj EINA_UNUSED, Efl_Ui_Internal_Text_Interactive_Data *sd) +_efl_ui_internal_text_interactive_efl_input_text_entity_input_panel_layout_get(const Eo *obj EINA_UNUSED, Efl_Ui_Internal_Text_Interactive_Data *sd) { return sd->input_panel_layout; } EOLIAN static void -_efl_ui_internal_text_interactive_efl_input_text_input_panel_layout_variation_set(Eo *obj EINA_UNUSED, Efl_Ui_Internal_Text_Interactive_Data *sd, int variation) +_efl_ui_internal_text_interactive_efl_input_text_entity_input_panel_layout_variation_set(Eo *obj EINA_UNUSED, Efl_Ui_Internal_Text_Interactive_Data *sd, int variation) { sd->input_panel_layout_variation = variation; @@ -2053,16 +2169,20 @@ _efl_ui_internal_text_interactive_efl_input_text_input_panel_layout_variation_se #else (void)variation; #endif + + if (sd->input_panel_layout == EFL_INPUT_TEXT_PANEL_LAYOUT_TYPE_NORMAL && + variation == EFL_INPUT_TEXT_PANEL_LAYOUT_NORMAL_VARIATION_TYPE_PERSON_NAME) + efl_input_text_autocapitalization_set(obj, EFL_INPUT_TEXT_CAPITALIZE_TYPE_WORD); } EOLIAN static int -_efl_ui_internal_text_interactive_efl_input_text_input_panel_layout_variation_get(const Eo *obj EINA_UNUSED, Efl_Ui_Internal_Text_Interactive_Data *sd) +_efl_ui_internal_text_interactive_efl_input_text_entity_input_panel_layout_variation_get(const Eo *obj EINA_UNUSED, Efl_Ui_Internal_Text_Interactive_Data *sd) { return sd->input_panel_layout_variation; } EOLIAN static void -_efl_ui_internal_text_interactive_efl_input_text_input_panel_show(Eo *obj EINA_UNUSED, Efl_Ui_Internal_Text_Interactive_Data *en) +_efl_ui_internal_text_interactive_efl_input_text_entity_input_panel_show(Eo *obj EINA_UNUSED, Efl_Ui_Internal_Text_Interactive_Data *en) { #ifdef HAVE_ECORE_IMF if (en->imf_context) @@ -2073,7 +2193,7 @@ _efl_ui_internal_text_interactive_efl_input_text_input_panel_show(Eo *obj EINA_U } EOLIAN static void -_efl_ui_internal_text_interactive_efl_input_text_input_panel_autoshow_set(Eo *obj EINA_UNUSED, Efl_Ui_Internal_Text_Interactive_Data *en, Eina_Bool enabled) +_efl_ui_internal_text_interactive_efl_input_text_entity_input_panel_autoshow_set(Eo *obj EINA_UNUSED, Efl_Ui_Internal_Text_Interactive_Data *en, Eina_Bool enabled) { #ifdef HAVE_ECORE_IMF if (en->imf_context) @@ -2085,7 +2205,7 @@ _efl_ui_internal_text_interactive_efl_input_text_input_panel_autoshow_set(Eo *ob } EOLIAN static Eina_Bool -_efl_ui_internal_text_interactive_efl_input_text_input_panel_autoshow_get(const Eo *obj EINA_UNUSED, Efl_Ui_Internal_Text_Interactive_Data *en) +_efl_ui_internal_text_interactive_efl_input_text_entity_input_panel_autoshow_get(const Eo *obj EINA_UNUSED, Efl_Ui_Internal_Text_Interactive_Data *en) { #ifdef HAVE_ECORE_IMF if (en->imf_context) @@ -2097,7 +2217,7 @@ _efl_ui_internal_text_interactive_efl_input_text_input_panel_autoshow_get(const } EOLIAN static Eina_Bool -_efl_ui_internal_text_interactive_efl_input_text_input_panel_show_on_demand_get(const Eo *obj EINA_UNUSED, Efl_Ui_Internal_Text_Interactive_Data *en) +_efl_ui_internal_text_interactive_efl_input_text_entity_input_panel_show_on_demand_get(const Eo *obj EINA_UNUSED, Efl_Ui_Internal_Text_Interactive_Data *en) { #ifdef HAVE_ECORE_IMF if (en->imf_context) @@ -2113,7 +2233,7 @@ _efl_ui_internal_text_interactive_efl_input_text_input_panel_show_on_demand_get( EOLIAN static void -_efl_ui_internal_text_interactive_efl_input_text_predictable_set(Eo *obj EINA_UNUSED, Efl_Ui_Internal_Text_Interactive_Data *en, Eina_Bool prediction) +_efl_ui_internal_text_interactive_efl_input_text_entity_predictable_set(Eo *obj EINA_UNUSED, Efl_Ui_Internal_Text_Interactive_Data *en, Eina_Bool prediction) { en->prediction_allow = prediction; #ifdef HAVE_ECORE_IMF @@ -2127,15 +2247,14 @@ _efl_ui_internal_text_interactive_efl_input_text_predictable_set(Eo *obj EINA_UN EOLIAN static Eina_Bool -_efl_ui_internal_text_interactive_efl_input_text_predictable_get(const Eo *obj, Efl_Ui_Internal_Text_Interactive_Data *en) +_efl_ui_internal_text_interactive_efl_input_text_entity_predictable_get(const Eo *obj EINA_UNUSED, Efl_Ui_Internal_Text_Interactive_Data *en) { return en->prediction_allow; - (void)obj; } EOLIAN static void -_efl_ui_internal_text_interactive_efl_input_text_input_hint_set(Eo *obj, Efl_Ui_Internal_Text_Interactive_Data *en, Efl_Input_Text_Hints_Type input_hints) +_efl_ui_internal_text_interactive_efl_input_text_entity_input_content_type_set(Eo *obj, Efl_Ui_Internal_Text_Interactive_Data *en, Efl_Input_Text_Content_Type input_hints) { #ifdef HAVE_ECORE_IMF if (en->imf_context) @@ -2149,24 +2268,24 @@ _efl_ui_internal_text_interactive_efl_input_text_input_hint_set(Eo *obj, Efl_Ui_ } -EOLIAN static Efl_Input_Text_Hints_Type -_efl_ui_internal_text_interactive_efl_input_text_input_hint_get(const Eo *obj, Efl_Ui_Internal_Text_Interactive_Data *en) +EOLIAN static Efl_Input_Text_Content_Type +_efl_ui_internal_text_interactive_efl_input_text_entity_input_content_type_get(const Eo *obj, Efl_Ui_Internal_Text_Interactive_Data *en) { #ifdef HAVE_ECORE_IMF if (en->imf_context) - return (Efl_Input_Text_Hints_Type)ecore_imf_context_input_hint_get(en->imf_context); + return (Efl_Input_Text_Content_Type)ecore_imf_context_input_hint_get(en->imf_context); (void)obj; #else (void)obj; (void)en; #endif - return ELM_INPUT_HINT_NONE; + return EFL_INPUT_TEXT_CONTENT_TYPE_NONE; } EOLIAN static void -_efl_ui_internal_text_interactive_efl_input_text_autocapitalization_set(Eo *obj, Efl_Ui_Internal_Text_Interactive_Data *en, Efl_Input_Text_Capitalize_Type autocapital_type) +_efl_ui_internal_text_interactive_efl_input_text_entity_autocapitalization_set(Eo *obj, Efl_Ui_Internal_Text_Interactive_Data *en, Efl_Input_Text_Capitalize_Type autocapital_type) { #ifdef HAVE_ECORE_IMF if (efl_text_password_get(obj) == EINA_TRUE) @@ -2174,8 +2293,6 @@ _efl_ui_internal_text_interactive_efl_input_text_autocapitalization_set(Eo *obj, if (en->imf_context) ecore_imf_context_autocapital_type_set(en->imf_context, (Ecore_IMF_Autocapital_Type)autocapital_type); - - (void)obj; #else (void)obj; (void)en; @@ -2185,19 +2302,166 @@ _efl_ui_internal_text_interactive_efl_input_text_autocapitalization_set(Eo *obj, EOLIAN static Efl_Input_Text_Capitalize_Type -_efl_ui_internal_text_interactive_efl_input_text_autocapitalization_get(const Eo *obj, Efl_Ui_Internal_Text_Interactive_Data *en) +_efl_ui_internal_text_interactive_efl_input_text_entity_autocapitalization_get(const Eo *obj EINA_UNUSED, Efl_Ui_Internal_Text_Interactive_Data *en) { #ifdef HAVE_ECORE_IMF if (en->imf_context) return (Efl_Input_Text_Capitalize_Type)ecore_imf_context_autocapital_type_get(en->imf_context); return EFL_INPUT_TEXT_CAPITALIZE_TYPE_NONE; - (void)obj; #else - return EFL_INPUT_TEXT_CAPITALIZE_TYPE_NONE; - (void)obj; (void)en; + return EFL_INPUT_TEXT_CAPITALIZE_TYPE_NONE; #endif } + +static char * +_file_load(Eo *obj) +{ + Eina_File *f; + char *text = NULL; + void *tmp = NULL; + + f = eina_file_dup(efl_file_mmap_get(obj)); + + tmp = eina_file_map_all(f, EINA_FILE_SEQUENTIAL); + if (!tmp) goto on_error; + + text = malloc(eina_file_size_get(f) + 1); + if (!text) goto on_error; + + memcpy(text, tmp, eina_file_size_get(f)); + text[eina_file_size_get(f)] = 0; + + if (eina_file_map_faulted(f, tmp)) + { + ELM_SAFE_FREE(text, free); + } + + on_error: + if (tmp) eina_file_map_free(f, tmp); + eina_file_close(f); + + return text; +} + +static char * +_plain_load(Eo *obj) +{ + return _file_load(obj); +} + +static Eina_Error +_load_do(Evas_Object *obj) +{ + char *text; + Eina_Error err = 0; + + Efl_Ui_Internal_Text_Interactive_Data * sd = efl_data_scope_get(obj, MY_CLASS); + + if (!sd->file) + { + efl_text_set(obj, ""); + return 0; + } + + switch (sd->format) + { + /* Only available format */ + case ELM_TEXT_FORMAT_PLAIN_UTF8: + text = _plain_load(obj); + if (!text) + { + err = errno; + if (!err) err = ENOENT; + } + break; + + default: + text = NULL; + break; + } + + if (text) + { + efl_text_set(obj, text); + free(text); + return 0; + } + efl_text_set(obj, ""); + return err; +} + +static void +_text_save(const char *file, + const char *text) +{ + FILE *f; + + if (!text) + { + ecore_file_unlink(file); + return; + } + + f = fopen(file, "wb"); + if (!f) + { + ERR("Failed to open %s for writing", file); + return; + } + + if (fputs(text, f) == EOF) + ERR("Failed to write text to file %s", file); + fclose(f); +} + +static void +_save_do(Evas_Object *obj) +{ + Efl_Ui_Internal_Text_Interactive_Data * sd = efl_data_scope_get(obj, MY_CLASS); + + if (!sd->file) return; + switch (sd->format) + { + /* Only supported format */ + case ELM_TEXT_FORMAT_PLAIN_UTF8: + _text_save(sd->file, efl_text_get(obj)); + break; + + case ELM_TEXT_FORMAT_MARKUP_UTF8: + default: + break; + } +} + + +EOLIAN static Eina_Error +_efl_ui_internal_text_interactive_efl_file_file_set(Eo *obj, Efl_Ui_Internal_Text_Interactive_Data *sd, const char *file) +{ + eina_stringshare_replace(&sd->file, file); + return efl_file_set(efl_super(obj, MY_CLASS), file); +} + +EOLIAN static void +_efl_ui_internal_text_interactive_efl_file_unload(Eo *obj, Efl_Ui_Internal_Text_Interactive_Data *sd EINA_UNUSED) +{ + efl_file_unload(efl_super(obj, MY_CLASS)); + efl_text_set(obj, ""); +} + +EOLIAN static Eina_Error +_efl_ui_internal_text_interactive_efl_file_load(Eo *obj, Efl_Ui_Internal_Text_Interactive_Data *sd) +{ + Eina_Error err; + + if (efl_file_loaded_get(obj)) return 0; + err = efl_file_load(efl_super(obj, MY_CLASS)); + if (err) return err; + if (sd->auto_save) _save_do(obj); + return _load_do(obj); +} + + #include "efl_ui_internal_text_interactive.eo.c" #include "efl_text_interactive.eo.c" diff --git a/src/lib/elementary/efl_ui_internal_text_interactive.eo b/src/lib/elementary/efl_ui_internal_text_interactive.eo index 44e871cb9b..7a9174822e 100644 --- a/src/lib/elementary/efl_ui_internal_text_interactive.eo +++ b/src/lib/elementary/efl_ui_internal_text_interactive.eo @@ -1,4 +1,4 @@ -class @beta Efl.Ui.Internal.Text.Interactive extends Efl.Canvas.Textblock implements Efl.Text_Interactive, Efl.Input_Text +class @beta Efl.Ui.Internal.Text.Interactive extends Efl.Canvas.Textblock implements Efl.Text_Interactive, Efl.Input_Text.Entity, Efl.File { [[An internal object in charge of the interactive aspect of the text widget. @@ -6,28 +6,33 @@ class @beta Efl.Ui.Internal.Text.Interactive extends Efl.Canvas.Textblock implem ]] implements { Efl.Object.constructor; + Efl.Object.destructor; Efl.Object.finalize; Efl.Text_Interactive.main_cursor { get; } Efl.Text_Interactive.selection_allowed { get; set; } - Efl.Text_Interactive.selection_cursors { get; } + Efl.Text_Interactive.selection_cursors { get; set; } Efl.Text_Interactive.editable { get; set; } Efl.Text_Interactive.all_unselect; Efl.Text_Interactive.all_select; Efl.Text_Interactive.have_selection {get; } Efl.Text.text { set; } Efl.Text_Markup.markup { set; } - Efl.Input_Text.input_panel_show_on_demand { get; set; } - Efl.Input_Text.input_panel_language { get; set; } - Efl.Input_Text.input_panel_layout_variation { get; set; } - Efl.Input_Text.autocapitalization { get; set; } - Efl.Input_Text.input_panel_return_key_state { get; set; } - Efl.Input_Text.predictable { get; set; } - Efl.Input_Text.input_hint { get; set; } - Efl.Input_Text.input_panel_layout { get; set; } - Efl.Input_Text.input_panel_return_key_type { get; set; } - Efl.Input_Text.input_panel_autoshow { get; set; } - Efl.Input_Text.input_panel_show; - Efl.Input_Text.input_panel_hide; - Efl.Input_Text.input_panel_imdata { get; set; } + Efl.Input_Text.Entity.input_panel_show_on_demand { get; set; } + Efl.Input_Text.Entity.input_panel_language { get; set; } + Efl.Input_Text.Entity.input_panel_layout_variation { get; set; } + Efl.Input_Text.Entity.autocapitalization { get; set; } + Efl.Input_Text.Entity.input_panel_return_key_state { get; set; } + Efl.Input_Text.Entity.predictable { get; set; } + Efl.Input_Text.Entity.input_content_type { get; set; } + Efl.Input_Text.Entity.input_panel_layout { get; set; } + Efl.Input_Text.Entity.input_panel_return_key_type { get; set; } + Efl.Input_Text.Entity.input_panel_autoshow { get; set; } + Efl.Input_Text.Entity.input_panel_show; + Efl.Input_Text.Entity.input_panel_hide; + Efl.Input_Text.Entity.input_panel_imdata { get; set; } + //FIXME Efl.File should be implemented later at Efl.Ui.TextBox level + Efl.File.file { set; } + Efl.File.load; + Efl.File.unload; } } diff --git a/src/lib/elementary/efl_ui_internal_text_scroller.c b/src/lib/elementary/efl_ui_internal_text_scroller.c index 3387759e38..7f10c2989a 100644 --- a/src/lib/elementary/efl_ui_internal_text_scroller.c +++ b/src/lib/elementary/efl_ui_internal_text_scroller.c @@ -63,7 +63,6 @@ _efl_ui_internal_text_scroller_efl_object_constructor(Eo *obj, Efl_Ui_Internal_Text_Scroller_Data *sd EINA_UNUSED) { obj = efl_constructor(efl_super(obj, MY_CLASS)); - //EFL_UI_SCROLLER_DATA_GET_OR_RETURN(obj, psd, NULL); efl_ui_scrollbar_bar_mode_set(obj, EFL_UI_SCROLLBAR_MODE_OFF, EFL_UI_SCROLLBAR_MODE_OFF); @@ -138,7 +137,6 @@ _efl_ui_internal_text_scroller_efl_object_finalize(Eo *obj, efl_ui_scrollbar_bar_mode_set(obj, EFL_UI_SCROLLBAR_MODE_OFF, EFL_UI_SCROLLBAR_MODE_OFF); efl_content_set(obj, sd->text_table); - return obj; } @@ -170,16 +168,15 @@ _efl_ui_internal_text_scroller_scroller_mode_set(Eo *obj, Efl_Ui_Internal_Text_Scroller_Data *sd, Efl_Ui_Text_Scroller_Mode mode) { - EFL_UI_SCROLLER_DATA_GET_OR_RETURN(obj, psd); sd->mode = mode; if (mode == EFL_UI_TEXT_SCROLLER_MODE_MULTILINE) { - efl_ui_scrollbar_bar_mode_set(psd->smanager, + efl_ui_scrollbar_bar_mode_set(obj, EFL_UI_SCROLLBAR_MODE_AUTO, EFL_UI_SCROLLBAR_MODE_AUTO); } else // default (single-line) { - efl_ui_scrollbar_bar_mode_set(psd->smanager, + efl_ui_scrollbar_bar_mode_set(obj, EFL_UI_SCROLLBAR_MODE_OFF, EFL_UI_SCROLLBAR_MODE_OFF); } } diff --git a/src/lib/elementary/efl_ui_item.c b/src/lib/elementary/efl_ui_item.c index 85b50ee758..2504f410e0 100644 --- a/src/lib/elementary/efl_ui_item.c +++ b/src/lib/elementary/efl_ui_item.c @@ -96,7 +96,10 @@ _item_unpressed(void *data, const Efl_Event *ev EINA_UNUSED) m = _fetch_state(pd->container); if (pd->selected) - efl_ui_selectable_selected_set(obj, EINA_FALSE); + { + if (efl_ui_selectable_allow_manual_deselection_get(pd->container)) + efl_ui_selectable_selected_set(obj, EINA_FALSE); + } else if (m != EFL_UI_SELECT_MODE_NONE) efl_ui_selectable_selected_set(obj, EINA_TRUE); } diff --git a/src/lib/elementary/efl_ui_layout.c b/src/lib/elementary/efl_ui_layout.c index 9ab1ab3a4a..ae757b1bb4 100644 --- a/src/lib/elementary/efl_ui_layout.c +++ b/src/lib/elementary/efl_ui_layout.c @@ -179,11 +179,13 @@ _sizing_eval(Evas_Object *obj, Efl_Ui_Layout_Data *sd, Elm_Layout_Data *ld) if (sd->calc_subobjs && !evas_smart_objects_calculating_get(evas_object_evas_get(obj))) { - Eina_List *l; Eo *subobj; /* user has manually triggered a smart calc and wants subobjs to also calc */ - EINA_LIST_FOREACH(wd->subobjs, l, subobj) - efl_canvas_group_calculate(subobj); + for (unsigned int i = 0; i < eina_array_count(wd->children); ++i) + { + subobj = eina_array_data_get(wd->children, i); + efl_canvas_group_calculate(subobj); + } } elm_coords_finger_size_adjust(sd->finger_size_multiplier_x, &rest_w, sd->finger_size_multiplier_y, &rest_h); @@ -551,12 +553,30 @@ _efl_ui_layout_theme_internal(Eo *obj, Efl_Ui_Layout_Data *sd, Elm_Widget_Smart_ return ret; } +static void +_deferred_signals_emit(Efl_Ui_Layout_Data *pd) +{ + do + { + Deferred_Version_Signal *dvs = eina_inarray_pop(pd->deferred_signals); + + if (pd->version < dvs->version_threshold) + efl_layout_signal_emit(pd->obj, dvs->old_sig, "efl"); + else + efl_layout_signal_emit(pd->obj, dvs->new_sig, "efl"); + eina_stringshare_del(dvs->old_sig); + eina_stringshare_del(dvs->new_sig); + } while (eina_inarray_count(pd->deferred_signals)); + ELM_SAFE_FREE(pd->deferred_signals, eina_inarray_free); +} + EOLIAN static Eina_Error _efl_ui_layout_base_efl_ui_widget_theme_apply(Eo *obj, Efl_Ui_Layout_Data *sd) { Eina_Error theme_apply_ret, theme_apply_internal_ret; Elm_Widget_Smart_Data *wd = NULL; char buf[64]; + Eina_Bool legacy; static unsigned int version = 0; sd->needs_theme_apply = EINA_FALSE; @@ -572,9 +592,10 @@ _efl_ui_layout_base_efl_ui_widget_theme_apply(Eo *obj, Efl_Ui_Layout_Data *sd) (theme_apply_internal_ret == EFL_UI_THEME_APPLY_ERROR_DEFAULT)) return EFL_UI_THEME_APPLY_ERROR_DEFAULT; + legacy = elm_widget_is_legacy(obj); /* unset existing size hints to force accurate recalc */ efl_gfx_hint_size_restricted_min_set(obj, EINA_SIZE2D(0, 0)); - if (elm_widget_is_legacy(obj)) + if (legacy) efl_gfx_hint_size_min_set(obj, EINA_SIZE2D(0, 0)); else { @@ -603,20 +624,9 @@ _efl_ui_layout_base_efl_ui_widget_theme_apply(Eo *obj, Efl_Ui_Layout_Data *sd) } } if (sd->deferred_signals) - { - do - { - Deferred_Version_Signal *dvs = eina_inarray_pop(sd->deferred_signals); + _deferred_signals_emit(sd); + if (legacy) return EFL_UI_THEME_APPLY_ERROR_NONE; - if (sd->version < dvs->version_threshold) - efl_layout_signal_emit(sd->obj, dvs->old_sig, "efl"); - else - efl_layout_signal_emit(sd->obj, dvs->new_sig, "efl"); - eina_stringshare_del(dvs->old_sig); - eina_stringshare_del(dvs->new_sig); - } while (eina_inarray_count(sd->deferred_signals)); - ELM_SAFE_FREE(sd->deferred_signals, eina_inarray_free); - } if (!version) { snprintf(buf, sizeof(buf), "%d%d", EFL_VERSION_MAJOR, EFL_VERSION_MINOR + (EFL_VERSION_MICRO == 99 ? 1 : 0)); @@ -921,8 +931,6 @@ _efl_ui_layout_base_efl_canvas_group_group_del(Eo *obj, Efl_Ui_Layout_Data *sd) Efl_Ui_Layout_Sub_Object_Data *sub_d; Efl_Ui_Layout_Sub_Object_Cursor *pc; Edje_Signal_Data *esd; - Evas_Object *child; - Eina_List *l; Efl_Model *model; ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd); @@ -977,28 +985,21 @@ _efl_ui_layout_base_efl_canvas_group_group_del(Eo *obj, Efl_Ui_Layout_Data *sd) /* let's make our Edje object the *last* to be processed, since it * may (smart) parent other sub objects here */ - EINA_LIST_FOREACH(wd->subobjs, l, child) - { - if (child == wd->resize_obj) - { - wd->subobjs = - eina_list_demote_list(wd->subobjs, l); - break; - } - } + { + unsigned int resize_id = 0; + if (eina_array_find(wd->children, wd->resize_obj, &resize_id)) + { + //exchange with last + eina_array_data_set(wd->children, resize_id, eina_array_data_get(wd->children, eina_array_count(wd->children) - 1)); + eina_array_data_set(wd->children, eina_array_count(wd->children) - 1, wd->resize_obj); + } + } sd->destructed_is = EINA_TRUE; efl_canvas_group_del(efl_super(obj, MY_CLASS)); } -EOLIAN static void -_efl_ui_layout_efl_canvas_group_group_calculate(Eo *obj, void *_pd EINA_UNUSED) -{ - efl_canvas_group_need_recalculate_set(obj, EINA_FALSE); - _sizing_eval(obj, efl_data_scope_get(obj, MY_CLASS), NULL); -} - /* rewrite or extend this one on your derived class as to suit your * needs */ EOLIAN static void @@ -1462,9 +1463,10 @@ _efl_ui_layout_text_generic_set(Eo *obj, Efl_Ui_Layout_Data *sd, const char *par { if ((sub_d->type == TEXT) && (!strcmp(part, sub_d->part))) { - if (!text) + if ((!text) || (text[0] == 0)) { - _text_signal_emit(sd, sub_d, EINA_FALSE); + if ((!strcmp(part, "elm.text") || !strcmp(part, "efl.text"))) + _text_signal_emit(sd, sub_d, EINA_FALSE); eina_stringshare_del(sub_d->part); free(sub_d); edje_object_part_text_escaped_set @@ -1478,7 +1480,7 @@ _efl_ui_layout_text_generic_set(Eo *obj, Efl_Ui_Layout_Data *sd, const char *par } } - if (!text) return EINA_TRUE; + if ((!text) || (text[0] == 0)) return EINA_TRUE; if (elm_widget_is_legacy(obj)) { @@ -1504,7 +1506,8 @@ _efl_ui_layout_text_generic_set(Eo *obj, Efl_Ui_Layout_Data *sd, const char *par sd->subs = eina_list_append(sd->subs, sub_d); } - _text_signal_emit(sd, sub_d, EINA_TRUE); + if ((!strcmp(part, "elm.text") || !strcmp(part, "efl.text"))) + _text_signal_emit(sd, sub_d, EINA_TRUE); efl_canvas_group_change(obj); @@ -1918,6 +1921,16 @@ _efl_ui_layout_base_efl_layout_group_part_exist_get(const Eo *obj, Efl_Ui_Layout } EOLIAN static void +_efl_ui_layout_base_efl_canvas_group_group_change(Eo *obj, Efl_Ui_Layout_Data *sd) +{ + if (sd->frozen) + /* cleared in thaw */ + sd->frozen_changed = EINA_TRUE; + else + efl_canvas_group_change(efl_super(obj, MY_CLASS)); +} + +EOLIAN static void _elm_layout_efl_canvas_group_change(Eo *obj, Elm_Layout_Data *ld) { Efl_Ui_Layout_Data *sd; @@ -1983,7 +1996,9 @@ _efl_ui_layout_base_efl_layout_calc_calc_thaw(Eo *obj, Efl_Ui_Layout_Data *sd) if (!ret) { sd->frozen = EINA_FALSE; - efl_canvas_group_change(obj); + if (sd->frozen_changed) + efl_canvas_group_change(obj); + sd->frozen_changed = EINA_FALSE; } return ret; @@ -2018,10 +2033,13 @@ _efl_ui_layout_base_efl_layout_calc_calc_parts_extends(Eo *obj EINA_UNUSED, Efl_ } EOLIAN void -_efl_ui_layout_base_efl_layout_calc_calc_force(Eo *obj EINA_UNUSED, Efl_Ui_Layout_Data *sd EINA_UNUSED) +_efl_ui_layout_base_efl_layout_calc_calc_force(Eo *obj EINA_UNUSED, Efl_Ui_Layout_Data *sd) { + Eina_Bool prev_frozen = sd->frozen; ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd); + sd->frozen = EINA_FALSE; efl_layout_calc_force(wd->resize_obj); + sd->frozen = prev_frozen; } static Eina_Bool @@ -2730,6 +2748,8 @@ _efl_ui_layout_base_efl_object_finalize(Eo *obj, Efl_Ui_Layout_Data *pd) /* handle case where subclass does not call into layout */ pd->needs_theme_apply = EINA_FALSE; } + else if (pd->deferred_signals) + _deferred_signals_emit(pd); efl_canvas_group_change(obj); Elm_Layout_Data *ld = efl_data_scope_safe_get(obj, ELM_LAYOUT_MIXIN); @@ -2840,7 +2860,7 @@ _efl_ui_layout_base_efl_part_part_get(const Eo *obj, Efl_Ui_Layout_Data *sd EINA { case EFL_CANVAS_LAYOUT_PART_TYPE_BOX: case EFL_CANVAS_LAYOUT_PART_TYPE_TABLE: - return _efl_ui_layout_pack_proxy_get((Eo *) obj, type, part); + return _efl_ui_layout_pack_proxy_get((Eo *) obj, (Edje_Part_Type)type, part); case EFL_CANVAS_LAYOUT_PART_TYPE_TEXT: case EFL_CANVAS_LAYOUT_PART_TYPE_TEXTBLOCK: return ELM_PART_IMPLEMENT(EFL_UI_LAYOUT_PART_TEXT_CLASS, obj, part); @@ -3272,6 +3292,26 @@ _elm_layout_signal_callback_add_legacy(Eo *obj, Eo *edje, Eina_List **p_edje_sig _edje_signal_callback, esd); } +/* replicated from elm_layout just because legacy widget's icon spot + * is elm.swallow.content, not elm.swallow.icon. + */ +void +_elm_layout_legacy_icon_signal_emit(Evas_Object *obj) +{ + char buf[63]; + Eo *edje; + + edje = elm_layout_edje_get(obj); + if (!edje) return; + if (!edje_object_part_exists(obj, "elm.swallow.content")) return; + snprintf(buf, sizeof(buf), "elm,state,icon,%s", + elm_layout_content_get(obj, "icon") ? "visible" : "hidden"); + + elm_layout_signal_emit(obj, buf, "elm"); + edje_object_message_signal_process(edje); + efl_canvas_group_change(obj); +} + EAPI void elm_layout_signal_callback_add(Eo *obj, const char *emission, const char *source, Edje_Signal_Cb func, void *data) { diff --git a/src/lib/elementary/efl_ui_layout.eo b/src/lib/elementary/efl_ui_layout.eo index f8ff7a9e39..ab4d67c1e3 100644 --- a/src/lib/elementary/efl_ui_layout.eo +++ b/src/lib/elementary/efl_ui_layout.eo @@ -1,5 +1,3 @@ -import efl_ui; - class Efl.Ui.Layout extends Efl.Ui.Layout_Base implements Efl.File { [[EFL layout widget class. @@ -21,6 +19,5 @@ class Efl.Ui.Layout extends Efl.Ui.Layout_Base implements Efl.File Efl.File.load; Efl.File.unload; Efl.Object.constructor; - Efl.Canvas.Group.group_calculate; } } diff --git a/src/lib/elementary/efl_ui_layout_base.eo b/src/lib/elementary/efl_ui_layout_base.eo index 8cd206c310..6cd8425276 100644 --- a/src/lib/elementary/efl_ui_layout_base.eo +++ b/src/lib/elementary/efl_ui_layout_base.eo @@ -1,5 +1,3 @@ -import efl_ui; - abstract Efl.Ui.Layout_Base extends Efl.Ui.Widget implements Efl.Container, Efl.Ui.Factory_Bind, Efl.Layout.Calc, Efl.Layout.Signal, @@ -110,6 +108,7 @@ abstract Efl.Ui.Layout_Base extends Efl.Ui.Widget implements Efl.Container, Efl.Object.finalize; Efl.Object.invalidate; Efl.Canvas.Group.group_calculate; + Efl.Canvas.Group.group_change; Efl.Layout.Calc.calc_freeze; Efl.Layout.Calc.calc_thaw; Efl.Layout.Calc.calc_auto_update_hints { get; set; } diff --git a/src/lib/elementary/efl_ui_layout_legacy_eo.h b/src/lib/elementary/efl_ui_layout_legacy_eo.h index 687bd590c5..82ffd9e676 100644 --- a/src/lib/elementary/efl_ui_layout_legacy_eo.h +++ b/src/lib/elementary/efl_ui_layout_legacy_eo.h @@ -21,8 +21,8 @@ typedef Eo Efl_Ui_Layout_Legacy; #define EFL_UI_LAYOUT_LEGACY_CLASS efl_ui_layout_legacy_class_get() #define ELM_LAYOUT_MIXIN elm_layout_mixin_get() -EWAPI const Efl_Class *efl_ui_layout_legacy_class_get(void); -EWAPI const Efl_Class *elm_layout_mixin_get(void); +EWAPI const Efl_Class *efl_ui_layout_legacy_class_get(void) EINA_CONST; +EWAPI const Efl_Class *elm_layout_mixin_get(void) EINA_CONST; #endif /* EFL_BETA_API_SUPPORT */ #endif diff --git a/src/lib/elementary/efl_ui_multi_selectable_index_range.eo b/src/lib/elementary/efl_ui_multi_selectable_index_range.eo index fd683fbd06..1a538beca3 100644 --- a/src/lib/elementary/efl_ui_multi_selectable_index_range.eo +++ b/src/lib/elementary/efl_ui_multi_selectable_index_range.eo @@ -1,5 +1,3 @@ -import efl_ui; - interface Efl.Ui.Multi_Selectable_Index_Range extends Efl.Ui.Multi_Selectable { [[Interface for getting access to a range of selected items through their indices. diff --git a/src/lib/elementary/efl_ui_multi_selectable_object_range.eo b/src/lib/elementary/efl_ui_multi_selectable_object_range.eo index 1f7db5e67a..deae601834 100644 --- a/src/lib/elementary/efl_ui_multi_selectable_object_range.eo +++ b/src/lib/elementary/efl_ui_multi_selectable_object_range.eo @@ -1,5 +1,3 @@ -import efl_ui; - interface Efl.Ui.Multi_Selectable_Object_Range extends Efl.Ui.Multi_Selectable { [[Interface for getting access to a range of selected items. diff --git a/src/lib/elementary/efl_ui_pager.c b/src/lib/elementary/efl_ui_pager.c index 8ac5a429cc..33ab9bf9bd 100644 --- a/src/lib/elementary/efl_ui_pager.c +++ b/src/lib/elementary/efl_ui_pager.c @@ -18,7 +18,7 @@ _efl_ui_pager_efl_object_constructor(Eo *obj, Efl_Ui_Pager_Data *sd EINA_UNUSED) obj = efl_constructor(efl_super(obj, MY_CLASS)); - scroller = efl_new(EFL_UI_SPOTLIGHT_MANAGER_SCROLL_CLASS); + scroller = efl_new(EFL_UI_SPOTLIGHT_SCROLL_MANAGER_CLASS); efl_ui_spotlight_manager_set(obj, scroller); return obj; diff --git a/src/lib/elementary/efl_ui_pager.eo b/src/lib/elementary/efl_ui_pager.eo index 08840922e8..1f9a7a06e0 100644 --- a/src/lib/elementary/efl_ui_pager.eo +++ b/src/lib/elementary/efl_ui_pager.eo @@ -1,8 +1,10 @@ -class @beta Efl.Ui.Pager extends Efl.Ui.Spotlight.Container +class Efl.Ui.Pager extends Efl.Ui.Spotlight.Container { [[A spotlight with predefined @Efl.Ui.Spotlight.Container.spotlight_manager The container will slide in the content sideways, the old content will slide out. + + @since 1.24 ]] implements { Efl.Object.constructor; diff --git a/src/lib/elementary/efl_ui_panel.c b/src/lib/elementary/efl_ui_panel.c index c173224a5f..212ce3de5d 100644 --- a/src/lib/elementary/efl_ui_panel.c +++ b/src/lib/elementary/efl_ui_panel.c @@ -886,9 +886,6 @@ _efl_ui_panel_efl_object_constructor(Eo *obj, Efl_Ui_Panel_Data *_pd) EOLIAN static void _efl_ui_panel_efl_object_destructor(Eo *obj, Efl_Ui_Panel_Data *sd) { - Evas_Object *child; - Eina_List *l; - ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd); sd->delete_me = EINA_TRUE; @@ -897,15 +894,15 @@ _efl_ui_panel_efl_object_destructor(Eo *obj, Efl_Ui_Panel_Data *sd) /* let's make our panel object the *last* to be processed, since it * may (smart) parent other sub objects here */ - EINA_LIST_FOREACH(wd->subobjs, l, child) - { - if (child == sd->bx) - { - wd->subobjs = - eina_list_demote_list(wd->subobjs, l); - break; - } - } + { + unsigned int resize_id = 0; + if (eina_array_find(wd->children, wd->resize_obj, &resize_id)) + { + //exchange with last + eina_array_data_set(wd->children, resize_id, eina_array_data_get(wd->children, eina_array_count(wd->children) - 1)); + eina_array_data_set(wd->children, eina_array_count(wd->children) - 1, wd->resize_obj); + } + } efl_destructor(efl_super(obj, MY_CLASS)); } diff --git a/src/lib/elementary/efl_ui_panel_private.h b/src/lib/elementary/efl_ui_panel_private.h index f1c3b93ae5..0e844181a1 100644 --- a/src/lib/elementary/efl_ui_panel_private.h +++ b/src/lib/elementary/efl_ui_panel_private.h @@ -12,17 +12,6 @@ */ /** - * @addtogroup Widget - * @{ - * - * @section elm-panel-class The Elementary Panel Class - * - * Elementary, besides having the @ref Panel widget, exposes its - * foundation -- the Elementary Panel Class -- in order to create other - * widgets which are a panel with some more logic on top. - */ - -/** * Base layout smart data extended with panel instance data. */ typedef struct _Efl_Ui_Panel_Data Efl_Ui_Panel_Data; @@ -50,10 +39,6 @@ struct _Efl_Ui_Panel_Data Eina_Bool callback_added: 1; }; -/** - * @} - */ - #define EFL_UI_PANEL_DATA_GET(o, sd) \ Efl_Ui_Panel_Data * sd = efl_data_scope_get(o, EFL_UI_PANEL_CLASS) diff --git a/src/lib/elementary/efl_ui_panes.c b/src/lib/elementary/efl_ui_panes.c index 3047fb3052..1b2c765ee1 100644 --- a/src/lib/elementary/efl_ui_panes.c +++ b/src/lib/elementary/efl_ui_panes.c @@ -181,7 +181,7 @@ _on_pressed(void *data, const char *emission EINA_UNUSED, const char *source EINA_UNUSED) { - efl_event_callback_legacy_call(data, ELM_PANES_EVENT_PRESS, NULL); + evas_object_smart_callback_call(data, "press", NULL); efl_input_clickable_press(data, 1); } @@ -192,7 +192,7 @@ _on_unpressed(void *data, const char *source EINA_UNUSED) { EFL_UI_PANES_DATA_GET(data, sd); - efl_event_callback_legacy_call(data, ELM_PANES_EVENT_UNPRESS, NULL); + evas_object_smart_callback_call(data, "unpress", NULL); efl_input_clickable_unpress(data, 1); if (sd->double_clicked) { diff --git a/src/lib/elementary/efl_ui_panes.eo b/src/lib/elementary/efl_ui_panes.eo index 00d13530df..6c6402c356 100644 --- a/src/lib/elementary/efl_ui_panes.eo +++ b/src/lib/elementary/efl_ui_panes.eo @@ -53,8 +53,4 @@ class @beta Efl.Ui.Panes extends Efl.Ui.Layout_Base implements Efl.Ui.Layout_Ori Default is $vertical.]] } Efl.Part.part_get; } - events { - press: void; [[Called when panes got pressed]] - unpress: void; [[Called when panes are no longer pressed]] - } } diff --git a/src/lib/elementary/efl_ui_panes_legacy_eo.h b/src/lib/elementary/efl_ui_panes_legacy_eo.h index 692578c8ca..b4a63f4ca3 100644 --- a/src/lib/elementary/efl_ui_panes_legacy_eo.h +++ b/src/lib/elementary/efl_ui_panes_legacy_eo.h @@ -20,7 +20,7 @@ typedef Eo Efl_Ui_Panes_Legacy; */ #define EFL_UI_PANES_LEGACY_CLASS efl_ui_panes_legacy_class_get() -EWAPI const Efl_Class *efl_ui_panes_legacy_class_get(void); +EWAPI const Efl_Class *efl_ui_panes_legacy_class_get(void) EINA_CONST; #endif /* EFL_BETA_API_SUPPORT */ #endif diff --git a/src/lib/elementary/efl_ui_position_manager_list.c b/src/lib/elementary/efl_ui_position_manager_list.c index 6424b4bf4d..dd90b12b2b 100644 --- a/src/lib/elementary/efl_ui_position_manager_list.c +++ b/src/lib/elementary/efl_ui_position_manager_list.c @@ -69,6 +69,7 @@ cache_require(Eo *obj EINA_UNUSED, Efl_Ui_Position_Manager_List_Data *pd) } pd->size_cache = calloc(pd->size + 1, sizeof(int)); + if (!pd->size_cache) return; pd->size_cache[0] = 0; pd->maximum_min_size = 0; diff --git a/src/lib/elementary/efl_ui_progressbar.c b/src/lib/elementary/efl_ui_progressbar.c index 61c6ece78b..bf0f14764a 100644 --- a/src/lib/elementary/efl_ui_progressbar.c +++ b/src/lib/elementary/efl_ui_progressbar.c @@ -4,7 +4,6 @@ #define EFL_ACCESS_OBJECT_PROTECTED #define ELM_LAYOUT_PROTECTED -#define EFL_ACCESS_VALUE_PROTECTED #define EFL_PART_PROTECTED #define EFL_UI_FORMAT_PROTECTED @@ -134,62 +133,13 @@ _val_set(Evas_Object *obj) } } -//TODO: efl_ui_slider also use this. -static const char * -_theme_group_modify_pos_get(const char *cur_group, const char *search, size_t len, Eina_Bool is_legacy) -{ - const char *pos = NULL; - const char *temp_str = NULL; - - if (is_legacy) - return cur_group; - - temp_str = cur_group + len - strlen(search); - if (temp_str >= cur_group) - { - if (!strcmp(temp_str, search)) - pos = temp_str; - } - - return pos; -} - -static char * -_efl_ui_progressbar_theme_group_get(Evas_Object *obj, Efl_Ui_Progressbar_Data *sd) +static void +_sync_widget_theme_klass(Eo *obj, Efl_Ui_Progressbar_Data *pd) { - const char *pos = NULL; - const char *cur_group = elm_widget_theme_element_get(obj); - Eina_Strbuf *new_group = eina_strbuf_new(); - Eina_Bool is_legacy = elm_widget_is_legacy(obj); - size_t len = 0; - - if (cur_group) - { - len = strlen(cur_group); - pos = _theme_group_modify_pos_get(cur_group, "horizontal", len, is_legacy); - if (!pos) - pos = _theme_group_modify_pos_get(cur_group, "vertical", len, is_legacy); - - - // TODO: change separator when it is decided. - // can skip when prev_group == cur_group - if (!pos) - { - eina_strbuf_append(new_group, cur_group); - eina_strbuf_append(new_group, "/"); - } - else - { - eina_strbuf_append_length(new_group, cur_group, pos - cur_group); - } - } - - if (_is_horizontal(sd->dir)) - eina_strbuf_append(new_group, "horizontal"); + if (efl_ui_layout_orientation_is_horizontal(pd->dir, EINA_TRUE)) + elm_widget_theme_element_set(obj, "horizontal"); else - eina_strbuf_append(new_group, "vertical"); - - return eina_strbuf_release(new_group); + elm_widget_theme_element_set(obj, "vertical"); } EOLIAN static Eina_Error @@ -197,7 +147,7 @@ _efl_ui_progressbar_efl_ui_widget_theme_apply(Eo *obj, Efl_Ui_Progressbar_Data * { Eina_Error int_ret = EFL_UI_THEME_APPLY_ERROR_GENERIC; ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd, EFL_UI_THEME_APPLY_ERROR_GENERIC); - char *group; + const char *statuspart[] = { "efl.text.status", @@ -208,13 +158,7 @@ _efl_ui_progressbar_efl_ui_widget_theme_apply(Eo *obj, Efl_Ui_Progressbar_Data * "efl.cur.progressbar", "elm.cur.progressbar", }; - - group = _efl_ui_progressbar_theme_group_get(obj, sd); - if (group) - { - elm_widget_theme_element_set(obj, group); - free(group); - } + _sync_widget_theme_klass(obj, sd); int_ret = efl_ui_widget_theme_apply(efl_super(obj, MY_CLASS)); if (int_ret == EFL_UI_THEME_APPLY_ERROR_GENERIC) return int_ret; @@ -284,6 +228,11 @@ _efl_ui_progressbar_efl_ui_widget_theme_apply(Eo *obj, Efl_Ui_Progressbar_Data * edje_object_message_signal_process(wd->resize_obj); + if (elm_widget_is_legacy(obj)) + elm_layout_content_set(obj, "elm.swallow.bar", sd->spacer); + else + elm_layout_content_set(obj, "efl.bar", sd->spacer); + return int_ret; } @@ -330,10 +279,7 @@ EOLIAN static void _efl_ui_progressbar_efl_canvas_group_group_add(Eo *obj, Efl_Ui_Progressbar_Data *priv) { ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd); - char *group; - if (!elm_widget_theme_klass_get(obj)) - elm_widget_theme_klass_set(obj, "progressbar"); efl_canvas_group_add(efl_super(obj, MY_CLASS)); efl_ui_layout_finger_size_multiplier_set(obj, 0, 0); @@ -341,14 +287,6 @@ _efl_ui_progressbar_efl_canvas_group_group_add(Eo *obj, Efl_Ui_Progressbar_Data priv->dir = EFL_UI_LAYOUT_ORIENTATION_HORIZONTAL; priv->val = MIN_RATIO_LVL; priv->val_max = 1.0; - group = _efl_ui_progressbar_theme_group_get(obj, priv); - - if (elm_widget_theme_object_set(obj, wd->resize_obj, - elm_widget_theme_klass_get(obj), - group, - elm_widget_theme_style_get(obj)) == EFL_UI_THEME_APPLY_ERROR_GENERIC) - - free(group); efl_ui_format_string_set(obj, "%.0f%%", EFL_UI_FORMAT_STRING_TYPE_SIMPLE); @@ -356,11 +294,6 @@ _efl_ui_progressbar_efl_canvas_group_group_add(Eo *obj, Efl_Ui_Progressbar_Data evas_object_color_set(priv->spacer, 0, 0, 0, 0); evas_object_pass_events_set(priv->spacer, EINA_TRUE); - if (elm_widget_is_legacy(obj)) - elm_layout_content_set(obj, "elm.swallow.bar", priv->spacer); - else - elm_layout_content_set(obj, "efl.bar", priv->spacer); - _units_set(obj); _val_set(obj); @@ -398,6 +331,9 @@ _efl_ui_progressbar_efl_canvas_group_group_del(Eo *obj, Efl_Ui_Progressbar_Data EOLIAN static Eo * _efl_ui_progressbar_efl_object_constructor(Eo *obj, Efl_Ui_Progressbar_Data *_pd EINA_UNUSED) { + if (!elm_widget_theme_klass_get(obj)) + elm_widget_theme_klass_set(obj, "progressbar"); + obj = efl_constructor(efl_super(obj, MY_CLASS)); evas_object_smart_callbacks_descriptions_set(obj, _smart_callbacks); efl_access_object_role_set(obj, EFL_ACCESS_ROLE_PROGRESS_BAR); @@ -407,23 +343,6 @@ _efl_ui_progressbar_efl_object_constructor(Eo *obj, Efl_Ui_Progressbar_Data *_pd } EOLIAN static void -_efl_ui_progressbar_pulse_mode_set(Eo *obj EINA_UNUSED, Efl_Ui_Progressbar_Data *sd, Eina_Bool pulse) -{ - pulse = !!pulse; - if (sd->pulse == pulse) return; - - sd->pulse = pulse; - - efl_ui_widget_theme_apply(obj); -} - -EOLIAN static Eina_Bool -_efl_ui_progressbar_pulse_mode_get(const Eo *obj EINA_UNUSED, Efl_Ui_Progressbar_Data *sd) -{ - return sd->pulse; -} - -EOLIAN static void _efl_ui_progressbar_efl_ui_layout_orientable_orientation_set(Eo *obj, Efl_Ui_Progressbar_Data *sd, Efl_Ui_Layout_Orientation dir) { if (sd->dir == dir) return; @@ -514,6 +433,18 @@ _progress_part_min_max_set(Eo *obj, Efl_Ui_Progressbar_Data *sd, const char *par } static void +_internal_theme_mode_pulse_set(Eo *obj, Efl_Ui_Progressbar_Data *sd, Eina_Bool pulse) +{ + if (elm_widget_is_legacy(obj)) + return; + if (sd->pulse == pulse) + return; + sd->pulse = pulse; + efl_ui_widget_theme_apply(obj); +} + + +static void _progressbar_part_value_set(Eo *obj, Efl_Ui_Progressbar_Data *sd, const char *part_name, double val) { Efl_Ui_Progress_Status *ps; @@ -527,6 +458,8 @@ _progressbar_part_value_set(Eo *obj, Efl_Ui_Progressbar_Data *sd, const char *pa }; Eina_Bool is_cur_progressbar = !strcmp(part_name, curprogresspart[elm_widget_is_legacy(obj)]); + _internal_theme_mode_pulse_set(obj, sd, EINA_FALSE); + if ((!is_cur_progressbar) || sd->has_cur_progressbar_part) efl_ui_range_limits_get(efl_part(obj, part_name), &min, &max); @@ -564,9 +497,9 @@ _progressbar_part_value_set(Eo *obj, Efl_Ui_Progressbar_Data *sd, const char *pa else { efl_event_callback_call(obj, EFL_UI_RANGE_EVENT_CHANGED, NULL); - if (sd->val == min) + if (EINA_DBL_EQ(sd->val, min)) efl_event_callback_call(obj, EFL_UI_RANGE_EVENT_MIN_REACHED, NULL); - if (sd->val == max) + if (EINA_DBL_EQ(sd->val, max)) efl_event_callback_call(obj, EFL_UI_RANGE_EVENT_MAX_REACHED, NULL); } } @@ -618,32 +551,34 @@ _efl_ui_progressbar_efl_ui_range_display_range_value_get(const Eo *obj, Efl_Ui_P return efl_ui_range_value_get(efl_part(obj, "efl.cur.progressbar")); } +static void +_apply_pulse_state(Eo *obj, Efl_Ui_Progressbar_Data *sd) +{ + Eina_Bool legacy = elm_widget_is_legacy(obj); + const char *emitter = legacy ? "elm" : "efl"; + const char *signal = legacy ? "elm,state,pulse," : "efl,state,pulse,"; + char signal_buffer[strlen(signal) + strlen("start") + 1]; + + snprintf(signal_buffer, sizeof(signal_buffer), "%s%s", signal, sd->pulse_state ? "start" : "stop"); + elm_layout_signal_emit(obj, signal_buffer, emitter); +} + EOLIAN static void -_efl_ui_progressbar_pulse_set(Eo *obj, Efl_Ui_Progressbar_Data *sd, Eina_Bool state) +_efl_ui_progressbar_infinite_mode_set(Eo *obj, Efl_Ui_Progressbar_Data *sd, Eina_Bool state) { state = !!state; - if ((!sd->pulse) || (sd->pulse_state == state)) return; + + if (sd->pulse_state == state) + return; sd->pulse_state = state; - if (elm_widget_is_legacy(obj)) - { - if (sd->pulse_state) - elm_layout_signal_emit(obj, "elm,state,pulse,start", "elm"); - else - elm_layout_signal_emit(obj, "elm,state,pulse,stop", "elm"); - } - else - { - if (sd->pulse_state) - elm_layout_signal_emit(obj, "efl,state,pulse,start", "efl"); - else - elm_layout_signal_emit(obj, "efl,state,pulse,stop", "efl"); - } + _internal_theme_mode_pulse_set(obj, sd, EINA_TRUE); + _apply_pulse_state(obj, sd); } EOLIAN static Eina_Bool -_efl_ui_progressbar_pulse_get(const Eo *obj EINA_UNUSED, Efl_Ui_Progressbar_Data *sd) +_efl_ui_progressbar_infinite_mode_get(const Eo *obj EINA_UNUSED, Efl_Ui_Progressbar_Data *sd) { return (sd->pulse_state && sd->pulse); } @@ -682,10 +617,17 @@ _efl_ui_progressbar_efl_part_part_get(const Eo *obj, Efl_Ui_Progressbar_Data *sd EINA_SAFETY_ON_NULL_RETURN_VAL(part, NULL); ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd, NULL); - // Progress bars are dragable types - if (edje_object_part_drag_dir_get(wd->resize_obj, part) != (Edje_Drag_Dir)EFL_UI_DRAG_DIR_NONE) - return ELM_PART_IMPLEMENT(EFL_UI_PROGRESSBAR_PART_CLASS, obj, part); - + if (elm_widget_is_legacy(obj)) + { + // Progress bars are dragable types + if (edje_object_part_drag_dir_get(wd->resize_obj, part) != (Edje_Drag_Dir)EFL_UI_DRAG_DIR_NONE) + return ELM_PART_IMPLEMENT(EFL_UI_PROGRESSBAR_PART_CLASS, obj, part); + } + else + { + if (eina_streq(part, "efl.cur.progressbar")) + return ELM_PART_IMPLEMENT(EFL_UI_PROGRESSBAR_PART_CLASS, obj, part); + } return efl_part_get(efl_super(obj, MY_CLASS), part); } @@ -708,12 +650,6 @@ _efl_ui_progressbar_part_efl_ui_range_display_range_value_get(const Eo *obj, voi } EOLIAN static void -_efl_ui_progressbar_efl_access_value_value_and_text_get(const Eo *obj EINA_UNUSED, Efl_Ui_Progressbar_Data *_pd, double *value, const char **text EINA_UNUSED) -{ - if (value) *value = _pd->val; -} - -EOLIAN static void _efl_ui_progressbar_part_efl_ui_range_display_range_limits_set(Eo *obj, void *_pd EINA_UNUSED, double min, double max) { Elm_Part_Data *pd = efl_data_scope_get(obj, EFL_UI_WIDGET_PART_CLASS); @@ -811,23 +747,6 @@ _efl_ui_progressbar_legacy_efl_object_constructor(Eo *obj, void *pd EINA_UNUSED) /* FIXME: replicated from elm_layout just because progressbar's icon spot * is elm.swallow.content, not elm.swallow.icon. Fix that whenever we * can changed the theme API */ -static void -_icon_signal_emit(Evas_Object *obj) -{ - char buf[64]; - - if (!elm_widget_resize_object_get(obj)) return; - snprintf(buf, sizeof(buf), "elm,state,icon,%s", - elm_layout_content_get(obj, "icon") ? "visible" : "hidden"); - - elm_layout_signal_emit(obj, buf, "elm"); - edje_object_message_signal_process(elm_layout_edje_get(obj)); - efl_canvas_group_change(obj); -} - -/* FIXME: replicated from elm_layout just because progressbar's icon spot - * is elm.swallow.content, not elm.swallow.icon. Fix that whenever we - * can changed the theme API */ EOLIAN static Eina_Error _efl_ui_progressbar_legacy_efl_ui_widget_theme_apply(Eo *obj, void *_pd EINA_UNUSED) { @@ -835,7 +754,7 @@ _efl_ui_progressbar_legacy_efl_ui_widget_theme_apply(Eo *obj, void *_pd EINA_UNU int_ret = efl_ui_widget_theme_apply(efl_super(obj, EFL_UI_PROGRESSBAR_LEGACY_CLASS)); if (int_ret == EFL_UI_THEME_APPLY_ERROR_GENERIC) return int_ret; - _icon_signal_emit(obj); + if (efl_finalized_get(obj)) _elm_layout_legacy_icon_signal_emit(obj); return int_ret; } @@ -851,7 +770,7 @@ _efl_ui_progressbar_legacy_efl_ui_widget_widget_sub_object_del(Eo *obj, void *_p int_ret = elm_widget_sub_object_del(efl_super(obj, EFL_UI_PROGRESSBAR_LEGACY_CLASS), sobj); if (!int_ret) return EINA_FALSE; - _icon_signal_emit(obj); + _elm_layout_legacy_icon_signal_emit(obj); return EINA_TRUE; } @@ -867,7 +786,7 @@ _efl_ui_progressbar_legacy_content_set(Eo *obj, void *_pd EINA_UNUSED, const cha int_ret = efl_content_set(efl_part(efl_super(obj, EFL_UI_PROGRESSBAR_LEGACY_CLASS), part), content); if (!int_ret) return EINA_FALSE; - _icon_signal_emit(obj); + _elm_layout_legacy_icon_signal_emit(obj); return EINA_TRUE; } @@ -899,25 +818,40 @@ elm_progressbar_add(Evas_Object *parent) EAPI void elm_progressbar_pulse_set(Evas_Object *obj, Eina_Bool pulse) { - efl_ui_progressbar_pulse_mode_set(obj, pulse); + EFL_UI_PROGRESSBAR_DATA_GET_OR_RETURN(obj, sd); + pulse = !!pulse; + if (sd->pulse == pulse) return; + + sd->pulse = pulse; + + efl_ui_widget_theme_apply(obj); } EAPI Eina_Bool elm_progressbar_pulse_get(const Evas_Object *obj) { - return efl_ui_progressbar_pulse_mode_get(obj); + EFL_UI_PROGRESSBAR_DATA_GET_OR_RETURN(obj, sd, EINA_FALSE); + return sd->pulse; } EAPI void elm_progressbar_pulse(Evas_Object *obj, Eina_Bool state) { - efl_ui_progressbar_pulse_set(obj, state); + EFL_UI_PROGRESSBAR_DATA_GET_OR_RETURN(obj, sd); + + state = !!state; + if ((!sd->pulse) || (sd->pulse_state == state)) return; + + sd->pulse_state = state; + + _apply_pulse_state(obj, sd); } EAPI Eina_Bool elm_progressbar_is_pulsing_get(const Evas_Object *obj) { - return efl_ui_progressbar_pulse_get(obj); + EFL_UI_PROGRESSBAR_DATA_GET_OR_RETURN(obj, sd, EINA_FALSE); + return (sd->pulse_state && sd->pulse); } EAPI void diff --git a/src/lib/elementary/efl_ui_progressbar.eo b/src/lib/elementary/efl_ui_progressbar.eo index e2994a266f..abd4d9b49b 100644 --- a/src/lib/elementary/efl_ui_progressbar.eo +++ b/src/lib/elementary/efl_ui_progressbar.eo @@ -1,49 +1,44 @@ class @beta Efl.Ui.Progressbar extends Efl.Ui.Layout_Base implements Efl.Ui.Range_Display, Efl.Ui.Format, - Efl.Ui.Layout_Orientable, Efl.Access.Value, + Efl.Ui.Layout_Orientable, Efl.Text, Efl.Content, Efl.Text_Markup { - [[Elementary progressbar class]] - methods { - @property pulse_mode { - [[Control whether a given progress bar widget is at "pulsing mode" or not. + [[Progress bar widget. - By default progress bars display values from low to - high boundaries. There are situations however in which the - progress of a given task is unknown. In these cases, - you can set a progress bar widget to a "pulsing state" to give - the user an idea that some computation is being done - without showing the precise progress rate. In the default theme, it will - animate the bar with content, switching constantly between filling it and back - to non-filled in a loop. To start and stop this pulsing - animation you need to explicitly call @.pulse.set(). - ]] + It shows a graphical indication of the current progress of some lengthy operation, + typically as a bar that gradually fills or a pointer that moves from one side of the + bar to the other. The bar can be horizontal or vertical, controlled with @Efl.Ui.Layout_Orientable. - set { - } - get { - } - values { - pulse: bool; [[$true to put $obj in pulsing mode, $false to put it back to its default one]] - } - } - @property pulse { - [[Start/stop a given progress bar "pulsing" animation, if its under that mode. + The minimum and maximum values (or starting and ending values), along with the current + value can be set using the @Efl.Ui.Range_Display interface. - Note: This call won't do anything if $obj is not under "pulsing mode". See @.pulse_mode. + @.infinite_mode can be set when the progress state is unknown. + An optional textual label can be shown to indicate the exact numerical value of the progress. + + @since 1.24 + ]] + methods { + @property infinite_mode { + [[When this mode is enabled the progress bar indicates that there is an operation + going on, but does not give information about its progress. + This is typically shown as a "pulsing" animation or an endless spinning bar, + depending on the theme. ]] set { } get { } values { - state: bool; [[$true, to start the pulsing animation, $false to stop it]] + state: bool; [[$true if the progress bar should animate infinitely.]] } } @property show_progress_label { - [[Whether a textual progress label is shown alongside the progressbar to give an exact - numerical indication of the current progress. + [[Whether a textual progress label is shown alongside the progress bar to give an exact + numerical indication of the current progress. Control the conversion of the numerical + value to a text string using @Efl.Ui.Format. Not to be confused with the widget label set through @Efl.Text.text. + + The exact location and appearance of the progress label depend on the theme. ]] values { show: bool; [[$true to show the progress label.]] @@ -58,7 +53,6 @@ class @beta Efl.Ui.Progressbar extends Efl.Ui.Layout_Base implements Efl.Ui.Rang Efl.Ui.Layout_Orientable.orientation { get; set; } Efl.Ui.Format.apply_formatted_value; Efl.Part.part_get; - Efl.Access.Value.value_and_text { get; } Efl.Text.text { get; set; } Efl.Text_Markup.markup { get; set; } Efl.Content.content { get; set; } diff --git a/src/lib/elementary/efl_ui_progressbar_legacy_eo.h b/src/lib/elementary/efl_ui_progressbar_legacy_eo.h index 00807e3fc4..8606e2deaa 100644 --- a/src/lib/elementary/efl_ui_progressbar_legacy_eo.h +++ b/src/lib/elementary/efl_ui_progressbar_legacy_eo.h @@ -20,7 +20,7 @@ typedef Eo Efl_Ui_Progressbar_Legacy; */ #define EFL_UI_PROGRESSBAR_LEGACY_CLASS efl_ui_progressbar_legacy_class_get() -EWAPI const Efl_Class *efl_ui_progressbar_legacy_class_get(void); +EWAPI const Efl_Class *efl_ui_progressbar_legacy_class_get(void) EINA_CONST; #endif /* EFL_BETA_API_SUPPORT */ #endif diff --git a/src/lib/elementary/efl_ui_progressbar_private.h b/src/lib/elementary/efl_ui_progressbar_private.h index 48b999b532..7d75ca38b2 100644 --- a/src/lib/elementary/efl_ui_progressbar_private.h +++ b/src/lib/elementary/efl_ui_progressbar_private.h @@ -32,7 +32,7 @@ struct _Efl_Ui_Progressbar_Data Evas_Coord size; /**< Width or height of progressbar */ double val; /**< Value of progressbar */ - + double val_min; double val_max; diff --git a/src/lib/elementary/efl_ui_radio.c b/src/lib/elementary/efl_ui_radio.c index e631cb81f3..e78168318c 100644 --- a/src/lib/elementary/efl_ui_radio.c +++ b/src/lib/elementary/efl_ui_radio.c @@ -336,25 +336,6 @@ _efl_ui_radio_legacy_efl_object_constructor(Eo *obj, void *_pd EINA_UNUSED) return obj; } -/* FIXME: replicated from elm_layout just because radio's icon spot - * is elm.swallow.content, not elm.swallow.icon. Fix that whenever we - * can changed the theme API */ -static void -_icon_signal_emit(Evas_Object *obj) -{ - char buf[63]; - Eo *edje; - - edje = elm_widget_resize_object_get(obj); - if (!edje) return; - snprintf(buf, sizeof(buf), "elm,state,icon,%s", - elm_layout_content_get(obj, "icon") ? "visible" : "hidden"); - - elm_layout_signal_emit(obj, buf, "elm"); - edje_object_message_signal_process(edje); - efl_canvas_group_change(obj); -} - EOLIAN static Eina_Error _efl_ui_radio_legacy_efl_ui_widget_theme_apply(Eo *obj, void *_pd EINA_UNUSED) { @@ -365,7 +346,7 @@ _efl_ui_radio_legacy_efl_ui_widget_theme_apply(Eo *obj, void *_pd EINA_UNUSED) /* FIXME: replicated from elm_layout just because radio's icon * spot is elm.swallow.content, not elm.swallow.icon. Fix that * whenever we can changed the theme API */ - _icon_signal_emit(obj); + if (efl_finalized_get(obj)) _elm_layout_legacy_icon_signal_emit(obj); return int_ret; } @@ -381,7 +362,7 @@ _efl_ui_radio_legacy_efl_ui_widget_widget_sub_object_del(Eo *obj, void *_pd EINA int_ret = elm_widget_sub_object_del(efl_super(obj, EFL_UI_RADIO_LEGACY_CLASS), sobj); if (!int_ret) return EINA_FALSE; - _icon_signal_emit(obj); + _elm_layout_legacy_icon_signal_emit(obj); return EINA_TRUE; } @@ -397,7 +378,7 @@ _efl_ui_radio_legacy_content_set(Eo *obj, void *_pd EINA_UNUSED, const char *par int_ret = efl_content_set(efl_part(efl_super(obj, EFL_UI_RADIO_LEGACY_CLASS), part), content); if (!int_ret) return EINA_FALSE; - _icon_signal_emit(obj); + _elm_layout_legacy_icon_signal_emit(obj); return EINA_TRUE; } diff --git a/src/lib/elementary/efl_ui_radio_group_impl.c b/src/lib/elementary/efl_ui_radio_group_impl.c index 6a14f37115..ff1e085b8d 100644 --- a/src/lib/elementary/efl_ui_radio_group_impl.c +++ b/src/lib/elementary/efl_ui_radio_group_impl.c @@ -16,6 +16,18 @@ typedef struct { Eina_Bool in_value_change; } Efl_Ui_Radio_Group_Impl_Data; +EOLIAN static void +_efl_ui_radio_group_impl_efl_ui_single_selectable_allow_manual_deselection_set(Eo *obj EINA_UNUSED, Efl_Ui_Radio_Group_Impl_Data *pd EINA_UNUSED, Eina_Bool allow_manual_deselection EINA_UNUSED) +{ + if (allow_manual_deselection == EINA_FALSE) + ERR("This is right now not supported."); +} + +EOLIAN static Eina_Bool +_efl_ui_radio_group_impl_efl_ui_single_selectable_allow_manual_deselection_get(const Eo *obj EINA_UNUSED, Efl_Ui_Radio_Group_Impl_Data *pd EINA_UNUSED) +{ + return EINA_FALSE; +} EOLIAN static void _efl_ui_radio_group_impl_efl_ui_single_selectable_fallback_selection_set(Eo *obj EINA_UNUSED, Efl_Ui_Radio_Group_Impl_Data *pd, Efl_Ui_Selectable *fallback) diff --git a/src/lib/elementary/efl_ui_radio_group_impl.eo b/src/lib/elementary/efl_ui_radio_group_impl.eo index 7e4fefe01b..6bc4379d39 100644 --- a/src/lib/elementary/efl_ui_radio_group_impl.eo +++ b/src/lib/elementary/efl_ui_radio_group_impl.eo @@ -12,5 +12,6 @@ class Efl.Ui.Radio_Group_Impl extends Efl.Object implements Efl.Ui.Radio_Group Efl.Ui.Radio_Group.unregister; Efl.Ui.Single_Selectable.last_selected {get;} Efl.Ui.Single_Selectable.fallback_selection {set; get;} + Efl.Ui.Single_Selectable.allow_manual_deselection {set; get;} } } diff --git a/src/lib/elementary/efl_ui_radio_legacy_eo.h b/src/lib/elementary/efl_ui_radio_legacy_eo.h index 6e0cb00f12..6f37924eb6 100644 --- a/src/lib/elementary/efl_ui_radio_legacy_eo.h +++ b/src/lib/elementary/efl_ui_radio_legacy_eo.h @@ -20,7 +20,7 @@ typedef Eo Efl_Ui_Radio_Legacy; */ #define EFL_UI_RADIO_LEGACY_CLASS efl_ui_radio_legacy_class_get() -EWAPI const Efl_Class *efl_ui_radio_legacy_class_get(void); +EWAPI const Efl_Class *efl_ui_radio_legacy_class_get(void) EINA_CONST; #endif /* EFL_BETA_API_SUPPORT */ #endif diff --git a/src/lib/elementary/efl_ui_scroll_manager.c b/src/lib/elementary/efl_ui_scroll_manager.c index 3d332e94fb..57edf11d65 100644 --- a/src/lib/elementary/efl_ui_scroll_manager.c +++ b/src/lib/elementary/efl_ui_scroll_manager.c @@ -1628,7 +1628,7 @@ _efl_ui_scroll_manager_post_event_move_on_hold_eval(Efl_Ui_Scroll_Manager_Data * _elm_config->thumbscroll_hold_threshold; } - if ((vx != 0.0) || (vy != 0.0)) _scroll_manager_on_hold_animator_add(sd, vx*sx, vy*sy); + if (EINA_DBL_NONZERO(vx) || EINA_DBL_NONZERO(vy)) _scroll_manager_on_hold_animator_add(sd, vx*sx, vy*sy); else _scroll_manager_on_hold_animator_del(sd); } @@ -2188,6 +2188,13 @@ _efl_ui_scrollbar_v_visibility_adjust(Eo *obj) } EOLIAN static void +_efl_ui_scroll_manager_efl_ui_scrollbar_bar_visibility_get(const Eo *obj EINA_UNUSED, Efl_Ui_Scroll_Manager_Data *sd, Eina_Bool *hbar, Eina_Bool *vbar) +{ + if (hbar) *hbar = sd->hbar_visible; + if (vbar) *vbar = sd->vbar_visible; +} + +EOLIAN static void _efl_ui_scroll_manager_efl_ui_scrollbar_bar_visibility_update(Eo *obj, Efl_Ui_Scroll_Manager_Data *sd EINA_UNUSED) { _efl_ui_scrollbar_h_visibility_adjust(obj); diff --git a/src/lib/elementary/efl_ui_scroll_manager.eo b/src/lib/elementary/efl_ui_scroll_manager.eo index 957a4f4d4d..9dcd9f8a88 100644 --- a/src/lib/elementary/efl_ui_scroll_manager.eo +++ b/src/lib/elementary/efl_ui_scroll_manager.eo @@ -39,6 +39,7 @@ class @beta Efl.Ui.Scroll.Manager extends Efl.Object implements Efl.Ui.Scrollbar.bar_mode { get; set; } Efl.Ui.Scrollbar.bar_size { get; } Efl.Ui.Scrollbar.bar_position { get; set; } + Efl.Ui.Scrollbar.bar_visibility { get; } Efl.Ui.Scrollbar.bar_visibility_update; Efl.Ui.Scrollable.scroll; } diff --git a/src/lib/elementary/efl_ui_scroll_util.c b/src/lib/elementary/efl_ui_scroll_util.c index 673cac2eae..47d50165cd 100644 --- a/src/lib/elementary/efl_ui_scroll_util.c +++ b/src/lib/elementary/efl_ui_scroll_util.c @@ -14,9 +14,72 @@ typedef struct { int freeze_want; Eina_Bool scroll_count : 1; Eina_Bool need_scroll : 1; + Eina_Bool show_up : 1; + Eina_Bool show_down : 1; + Eina_Bool show_left: 1; + Eina_Bool show_right : 1; } Scroll_Connector_Context; static void +_scroll_connector_bar_direction_show_update(Scroll_Connector_Context *ctx) +{ + ELM_WIDGET_DATA_GET_OR_RETURN(ctx->obj, wd); + Eina_Bool hbar_visible = EINA_FALSE, vbar_visible = EINA_FALSE; + Eina_Bool show_up = EINA_FALSE, show_down = EINA_FALSE, show_left = EINA_FALSE, show_right = EINA_FALSE; + double vx = 0.0, vy = 0.0; + + edje_object_part_drag_value_get + (wd->resize_obj, "efl.draggable.vertical_bar", NULL, &vy); + + edje_object_part_drag_value_get + (wd->resize_obj, "efl.draggable.horizontal_bar", &vx, NULL); + + efl_ui_scrollbar_bar_visibility_get(ctx->smanager, &hbar_visible, &vbar_visible); + if (hbar_visible) + { + if (vx < 1.0) show_right = EINA_TRUE; + if (vx > 0.0) show_left = EINA_TRUE; + } + if (vbar_visible) + { + if (vy < 1.0) show_down = EINA_TRUE; + if (vy > 0.0) show_up = EINA_TRUE; + } + if (show_right != ctx->show_right) + { + if (show_right) + efl_layout_signal_emit(wd->resize_obj, "efl,action,show,right", "efl"); + else + efl_layout_signal_emit(wd->resize_obj, "efl,action,hide,right", "efl"); + ctx->show_right = show_right; + } + if (show_left != ctx->show_left) + { + if (show_left) + efl_layout_signal_emit(wd->resize_obj, "efl,action,show,left", "efl"); + else + efl_layout_signal_emit(wd->resize_obj, "efl,action,hide,left", "efl"); + ctx->show_left = show_left; + } + if (show_up != ctx->show_up) + { + if (show_up) + efl_layout_signal_emit(wd->resize_obj, "efl,action,show,up", "efl"); + else + efl_layout_signal_emit(wd->resize_obj, "efl,action,hide,up", "efl"); + ctx->show_up = show_up; + } + if (show_down != ctx->show_down) + { + if (show_down) + efl_layout_signal_emit(wd->resize_obj, "efl,action,show,down", "efl"); + else + efl_layout_signal_emit(wd->resize_obj, "efl,action,hide,down", "efl"); + ctx->show_down = show_down; + } +} + +static void _scroll_connector_bar_read_and_update(Scroll_Connector_Context *ctx) { ELM_WIDGET_DATA_GET_OR_RETURN(ctx->obj, wd); @@ -29,6 +92,7 @@ _scroll_connector_bar_read_and_update(Scroll_Connector_Context *ctx) (wd->resize_obj, "efl.draggable.horizontal_bar", &vx, NULL); efl_ui_scrollbar_bar_position_set(ctx->smanager, vx, vy); + _scroll_connector_bar_direction_show_update(ctx); } static void @@ -38,8 +102,23 @@ _scroll_connector_reload_cb(void *data, const char *source EINA_UNUSED) { Scroll_Connector_Context *ctx = data; + ELM_WIDGET_DATA_GET_OR_RETURN(ctx->obj, wd); + Eina_Bool hbar_visible = EINA_FALSE, vbar_visible = EINA_FALSE; + + efl_ui_scrollbar_bar_visibility_get(ctx->smanager, &hbar_visible, &vbar_visible); + + if (hbar_visible) + efl_layout_signal_emit(wd->resize_obj, "efl,horizontal_bar,visible,on", "efl"); + else + efl_layout_signal_emit(wd->resize_obj, "efl,horizontal_bar,visible,off", "efl"); + + if (vbar_visible) + efl_layout_signal_emit(wd->resize_obj, "efl,vertical_bar,visible,on", "efl"); + else + efl_layout_signal_emit(wd->resize_obj, "efl,vertical_bar,visible,off", "efl"); efl_ui_scrollbar_bar_visibility_update(ctx->smanager); + _scroll_connector_bar_direction_show_update(ctx); } @@ -230,6 +309,7 @@ _scroll_connector_bar_show_cb(void *data, const Efl_Event *event) efl_layout_signal_emit(wd->resize_obj, "efl,horizontal_bar,visible,on", "efl"); else if (type == EFL_UI_LAYOUT_ORIENTATION_VERTICAL) efl_layout_signal_emit(wd->resize_obj, "efl,vertical_bar,visible,on", "efl"); + _scroll_connector_bar_direction_show_update(ctx); } static void @@ -243,6 +323,7 @@ _scroll_connector_bar_hide_cb(void *data, const Efl_Event *event) efl_layout_signal_emit(wd->resize_obj, "efl,horizontal_bar,visible,off", "efl"); else if (type == EFL_UI_LAYOUT_ORIENTATION_VERTICAL) efl_layout_signal_emit(wd->resize_obj, "efl,vertical_bar,visible,off", "efl"); + _scroll_connector_bar_direction_show_update(ctx); } void diff --git a/src/lib/elementary/efl_ui_select_model.c b/src/lib/elementary/efl_ui_select_model.c index 6852b50b40..683b6b2206 100644 --- a/src/lib/elementary/efl_ui_select_model.c +++ b/src/lib/elementary/efl_ui_select_model.c @@ -2,7 +2,7 @@ # include <config.h> #endif -// Note: we do not rely on reflection here to implement select as it require to asynchronously acces +// Note: we do not rely on reflection here to implement select as it require to asynchronously access // children. Could be done differently by implementing the children select in the parent instead of // in the children. For later optimization. @@ -24,18 +24,23 @@ struct _Efl_Ui_Select_Model_Data Efl_Ui_Select_Model *last_model; Efl_Ui_Select_Mode selection; - - Eina_Bool none : 1; }; static void +_efl_ui_select_model_apply_last_model(Eo *obj, Efl_Ui_Select_Model_Data *pd, Eo *last_model) +{ + efl_replace(&pd->last_model, last_model); + efl_model_properties_changed(obj, "child.selected"); +} + +static void _efl_ui_select_model_child_removed(void *data, const Efl_Event *event) { Efl_Ui_Select_Model_Data *pd = data; Efl_Model_Children_Event *ev = event->info; if (ev->child == pd->last_model) - efl_replace(&pd->last_model, NULL); + _efl_ui_select_model_apply_last_model(event->object, pd, NULL); } static Eo* @@ -49,7 +54,6 @@ _efl_ui_select_model_efl_object_constructor(Eo *obj, efl_boolean_model_boolean_add(obj, "selected", EINA_FALSE); efl_event_callback_add(obj, EFL_MODEL_EVENT_CHILD_REMOVED, _efl_ui_select_model_child_removed, pd); - pd->none = EINA_TRUE; parent = efl_parent_get(obj); if (efl_isa(parent, EFL_UI_SELECT_MODEL_CLASS)) @@ -64,7 +68,6 @@ _efl_ui_select_model_efl_object_invalidate(Eo *obj, { efl_replace(&pd->fallback_model, NULL); efl_replace(&pd->last_model, NULL); - pd->none = EINA_TRUE; efl_invalidate(efl_super(obj, EFL_UI_SELECT_MODEL_CLASS)); } @@ -75,7 +78,7 @@ _efl_ui_select_model_fallback(Efl_Ui_Select_Model_Data *pd) Eina_Value selected; if (!pd->parent) return; - if (!pd->parent->none) return; + if (!pd->parent->last_model) return; if (!pd->parent->fallback_model) return; // I think it only make sense to trigger the fallback on single mode if (pd->parent->selection != EFL_UI_SELECT_MODE_SINGLE) return; @@ -129,8 +132,7 @@ _commit_change(Eo *child, void *data EINA_UNUSED, const Eina_Value v) if (selflag) { // select case - pd->none = EINA_FALSE; - efl_replace(&pd->last_model, child); + _efl_ui_select_model_apply_last_model(parent, pd, child); efl_event_callback_call(child, EFL_UI_SELECT_MODEL_EVENT_SELECTED, child); } else @@ -139,8 +141,7 @@ _commit_change(Eo *child, void *data EINA_UNUSED, const Eina_Value v) // There should only be one model which represent the same data at all in memory if (pd->last_model == child) // direct comparison of pointer is ok { - efl_replace(&pd->last_model, NULL); - pd->none = EINA_TRUE; + _efl_ui_select_model_apply_last_model(parent, pd, NULL); // Just in case we need to refill the fallback _efl_ui_select_model_fallback(pd); @@ -401,13 +402,12 @@ _efl_ui_select_model_efl_model_property_set(Eo *obj, { if (pd->parent->last_model == obj && !newflag) { - efl_replace(&pd->last_model, NULL); - pd->parent->none = EINA_TRUE; + _efl_ui_select_model_apply_last_model(efl_parent_get(obj), pd->parent, NULL); _efl_ui_select_model_fallback(pd); } } - else + else if (pd->parent->last_model) { Eo *parent; unsigned long selected = 0; @@ -431,6 +431,10 @@ _efl_ui_select_model_efl_model_property_set(Eo *obj, .error = _untangle_error, .free = _untangle_free); } + else + { + _efl_ui_select_model_apply_last_model(efl_parent_get(obj), pd->parent, obj); + } } return efl_future_then(efl_ref(obj), chain, @@ -450,10 +454,10 @@ _efl_ui_select_model_efl_model_property_get(const Eo *obj, Efl_Ui_Select_Model_D // Last selected child if (eina_streq("child.selected", property)) { - if (pd->none) - return eina_value_error_new(EFL_MODEL_ERROR_INCORRECT_VALUE); - else if (pd->last_model) + if (pd->last_model) return eina_value_ulong_new(efl_composite_model_index_get(pd->last_model)); + else if (pd->fallback_model) + return eina_value_ulong_new(efl_composite_model_index_get(pd->fallback_model)); else // Nothing selected yet, try again later return eina_value_error_new(EAGAIN); } @@ -539,7 +543,7 @@ _efl_ui_select_model_efl_ui_multi_selectable_all_select(Eo *obj, unsigned int count, i; // Not the fastest way to implement it, but will reuse more code and be easier as a v1. - // It also make it not very async which could be noticable. + // It also make it not very async which could be noticeable. count = efl_model_children_count_get(obj); for (i = 0; i < count; i++) @@ -569,7 +573,7 @@ _efl_ui_select_model_efl_ui_multi_selectable_index_range_ndx_range_select(Eo *ob unsigned long count, i; // Not the fastest way to implement it, but will reuse more code and be easier as a v1. - // It also make it not very async which could be noticable. + // It also make it not very async which could be noticeable. count = MIN(efl_model_children_count_get(obj), b + 1); for (i = a; i < count; i++) @@ -653,7 +657,7 @@ _efl_ui_select_model_efl_ui_single_selectable_fallback_selection_set(Eo *obj, efl_replace(&pd->fallback_model, fallback); - if (!pd->none) return ; + if (!pd->last_model) return ; // When we provide a fallback, we should use it! index = efl_model_property_get(fallback, EFL_COMPOSITE_MODEL_CHILD_INDEX); diff --git a/src/lib/elementary/efl_ui_selection.c b/src/lib/elementary/efl_ui_selection.c index 675eb0cf99..d67d1f3fef 100644 --- a/src/lib/elementary/efl_ui_selection.c +++ b/src/lib/elementary/efl_ui_selection.c @@ -9,278 +9,115 @@ #define MY_CLASS EFL_UI_SELECTION_MIXIN #define MY_CLASS_NAME "Efl.Ui.Selection" -#ifdef HAVE_ELEMENTARY_WL2 -Ecore_Wl2_Window *_wl_window_get(const Evas_Object *obj); -#endif +typedef struct { + Ecore_Evas *ee; + Eina_Bool registered : 1; +} Efl_Ui_Selection_Data; -EOLIAN static void -_efl_ui_selection_selection_get(Eo *obj, void *pd EINA_UNUSED, Efl_Ui_Selection_Type type, Efl_Ui_Selection_Format format, - void *data_func_data, Efl_Ui_Selection_Data_Ready data_func, Eina_Free_Cb data_func_free_cb, unsigned int seat) +static inline Ecore_Evas_Selection_Buffer +_ee_buffer_get(Efl_Ui_Cnp_Buffer buffer) { - Eo *sel_man = _efl_ui_selection_manager_get(obj); - efl_ui_selection_manager_selection_get(sel_man, obj, type, format, - data_func_data, data_func, - data_func_free_cb, seat); + if (buffer == EFL_UI_CNP_BUFFER_SELECTION) + return ECORE_EVAS_SELECTION_BUFFER_SELECTION_BUFFER; + else + return ECORE_EVAS_SELECTION_BUFFER_COPY_AND_PASTE_BUFFER; } -EOLIAN static Eina_Future * -_efl_ui_selection_selection_set(Eo *obj, void *pd EINA_UNUSED, Efl_Ui_Selection_Type type, Efl_Ui_Selection_Format format, Eina_Slice data, unsigned int seat) +EOLIAN static Eina_Future* +_efl_ui_selection_selection_get(Eo *obj EINA_UNUSED, Efl_Ui_Selection_Data *pd, Efl_Ui_Cnp_Buffer buffer, unsigned int seat, Eina_Iterator *acceptable_types) { - Eo *sel_man = _efl_ui_selection_manager_get(obj); - return efl_ui_selection_manager_selection_set(sel_man, obj, type, format, data, seat); + return ecore_evas_selection_get(pd->ee, seat, _ee_buffer_get(buffer), acceptable_types); } EOLIAN static void -_efl_ui_selection_selection_clear(Eo *obj, void *pd EINA_UNUSED, Efl_Ui_Selection_Type type, unsigned int seat) +_efl_ui_selection_selection_set(Eo *obj, Efl_Ui_Selection_Data *pd, Efl_Ui_Cnp_Buffer buffer, Eina_Content *content, unsigned int seat) { - Eo *sel_man = _efl_ui_selection_manager_get(obj); - efl_ui_selection_manager_selection_clear(sel_man, obj, type, seat); + _register_selection_changed(obj); + ecore_evas_selection_set(pd->ee, seat, _ee_buffer_get(buffer), content); } -EOLIAN static Eina_Bool -_efl_ui_selection_has_owner(Eo *obj, void *pd EINA_UNUSED, Efl_Ui_Selection_Type type, unsigned int seat) +EOLIAN static void +_efl_ui_selection_selection_clear(Eo *obj EINA_UNUSED, Efl_Ui_Selection_Data *pd, Efl_Ui_Cnp_Buffer buffer, unsigned int seat) { - Eo *sel_man = _efl_ui_selection_manager_get(obj); - return efl_ui_selection_manager_selection_has_owner(sel_man, obj, type, seat); + ecore_evas_selection_set(pd->ee, seat, _ee_buffer_get(buffer), NULL); } +EOLIAN static Eina_Bool +_efl_ui_selection_has_selection(Eo *obj EINA_UNUSED, Efl_Ui_Selection_Data *pd, Efl_Ui_Cnp_Buffer buffer, unsigned int seat) +{ + return ecore_evas_selection_exists(pd->ee, seat, _ee_buffer_get(buffer)); +} -////////// Support legacy APIs - -//TODO: Clear this list (when sel_man is deleted) -Eina_List *lost_cb_list = NULL; - -#ifdef HAVE_ELEMENTARY_WL2 -static Ecore_Evas * -_wl_is_wl(const Evas_Object *obj) +EOLIAN static Efl_Object* +_efl_ui_selection_efl_object_constructor(Eo *obj, Efl_Ui_Selection_Data *pd) { - Ecore_Evas *ee; - Evas *evas; - const char *engine_name; + if (!efl_constructor(efl_super(obj, EFL_UI_SELECTION_MIXIN))) + return NULL; - if (!(evas = evas_object_evas_get(obj))) - return NULL; - if (!(ee = ecore_evas_ecore_evas_get(evas))) - return NULL; + pd->ee = ecore_evas_ecore_evas_get(evas_object_evas_get(obj)); - engine_name = ecore_evas_engine_name_get(ee); - if (!strcmp(engine_name, ELM_BUFFER)) - { - ee = ecore_evas_buffer_ecore_evas_parent_get(ee); - if (!ee) return NULL; - engine_name = ecore_evas_engine_name_get(ee); - } - if (!strncmp(engine_name, "wayland", sizeof("wayland") - 1)) - return ee; - return NULL; + return obj; } -int -_wl_default_seat_id_get(Evas_Object *obj) +EOLIAN static void +_efl_ui_selection_efl_object_invalidate(Eo *obj, Efl_Ui_Selection_Data *pd) { - Ecore_Wl2_Window *win = _wl_window_get(obj); - Eo *seat, *parent2, *ewin; - Eina_Bool is_wl = EINA_FALSE; - - if (obj) + if (pd->registered) { - if (_wl_is_wl(obj)) is_wl = EINA_TRUE; - if (efl_isa(obj, EFL_UI_WIDGET_CLASS)) - { - Eo *top = elm_widget_top_get(obj); - if (efl_isa(top, EFL_UI_WIN_INLINED_CLASS)) - { - parent2 = efl_ui_win_inlined_parent_get(top); - if (parent2) obj = elm_widget_top_get(parent2) ?: parent2; - } - /* fake win means canvas seat id will not match protocol seat id */ - ewin = elm_win_get(obj); - if (elm_win_type_get(ewin) == ELM_WIN_FAKE) obj = NULL; - } - } - - if (!obj) - { - if (is_wl) - { - Ecore_Wl2_Input *input; - Eina_Iterator *it; - - it = ecore_wl2_display_inputs_get(ecore_wl2_window_display_get(win)); - EINA_ITERATOR_FOREACH(it, input) break; - eina_iterator_free(it); - if (input) - return ecore_wl2_input_seat_id_get(input); - } + _selection_changed_event_unregister(obj); } - - seat = evas_default_device_get(evas_object_evas_get(obj), EFL_INPUT_DEVICE_TYPE_SEAT); - EINA_SAFETY_ON_NULL_RETURN_VAL(seat, 1); - return evas_device_seat_id_get(seat); + efl_invalidate(efl_super(obj, EFL_UI_SELECTION_MIXIN)); } -#endif -typedef struct _Cnp_Data_Cb_Wrapper Cnp_Data_Cb_Wrapper; -struct _Cnp_Data_Cb_Wrapper +EOLIAN static Eina_Bool +_efl_ui_selection_efl_object_event_callback_priority_add(Eo *obj, Efl_Ui_Selection_Data *pd, + const Efl_Event_Description *desc, + Efl_Callback_Priority priority, + Efl_Event_Cb func, + const void *user_data) { - void *udata; - Elm_Drop_Cb datacb; -}; + if (desc == EFL_UI_SELECTION_EVENT_WM_SELECTION_CHANGED && !pd->registered) + { -static void -_selection_data_ready_cb(void *data, Efl_Object *obj, Efl_Ui_Selection_Data *seldata) -{ - Cnp_Data_Cb_Wrapper *wdata = data; - if (!wdata) return; - Elm_Selection_Data ddata; + pd->registered = EINA_TRUE; + if (efl_finalized_get(obj)) + _selection_changed_event_register(obj); + } - ddata.data = calloc(1, seldata->content.len + 1); - if (!ddata.data) return; - ddata.data = memcpy(ddata.data, seldata->content.mem, seldata->content.len); - ddata.len = seldata->content.len; - ddata.x = seldata->pos.x; - ddata.y = seldata->pos.y; - ddata.format = (Elm_Sel_Format)seldata->format; - ddata.action = (Elm_Xdnd_Action)seldata->action; - wdata->datacb(wdata->udata, obj, &ddata); - free(ddata.data); + return efl_event_callback_priority_add(efl_super(obj, EFL_UI_SELECTION_MIXIN), desc, priority, func, user_data); } -typedef struct _Sel_Lost_Data Sel_Lost_Data; -struct _Sel_Lost_Data -{ - const Evas_Object *obj; - Elm_Sel_Type type; - void *udata; - Elm_Selection_Loss_Cb loss_cb; -}; - -static Eina_Value -_selection_lost_cb(void *data, const Eina_Value value) +EOLIAN static Eina_Bool +_efl_ui_selection_efl_object_event_callback_array_priority_add(Eo *obj, Efl_Ui_Selection_Data *pd, + const Efl_Callback_Array_Item *array, + Efl_Callback_Priority priority, + const void *user_data) { - Eina_List *l, *l2; - Sel_Lost_Data *ldata, *ldata2; - - ldata = data; - EINA_LIST_FOREACH_SAFE(lost_cb_list, l, l2, ldata2) + for (int i = 0; array[i].desc; ++i) { - if ((ldata->obj == ldata2->obj) && - (ldata->type == ldata2->type)) + if (array[i].desc == EFL_UI_SELECTION_EVENT_WM_SELECTION_CHANGED && !pd->registered) { - ldata2->loss_cb(ldata2->udata, ldata2->type); - lost_cb_list = eina_list_remove(lost_cb_list, ldata2); + pd->registered = EINA_TRUE; + if (efl_finalized_get(obj)) + _selection_changed_event_register(obj); } } - free(ldata); - - return value; + return efl_event_callback_array_priority_add(efl_super(obj, EFL_UI_SELECTION_MIXIN), array, priority, user_data); } -EAPI Eina_Bool -elm_cnp_selection_get(const Evas_Object *obj, Elm_Sel_Type type, - Elm_Sel_Format format, Elm_Drop_Cb datacb, void *udata) -{ - int seatid = 1; - Eo *sel_man = _efl_ui_selection_manager_get((Evas_Object *)obj); - Cnp_Data_Cb_Wrapper *wdata = calloc(1, sizeof(Cnp_Data_Cb_Wrapper)); - - if (!wdata) return EINA_FALSE; -#ifdef HAVE_ELEMENTARY_WL2 - if (_wl_window_get(obj)) seatid = _wl_default_seat_id_get((Evas_Object *)obj); -#endif - wdata->udata = udata; - wdata->datacb = datacb; - efl_ui_selection_manager_selection_get(sel_man, (Evas_Object *)obj, (Efl_Ui_Selection_Type)type, - (Efl_Ui_Selection_Format)format, - wdata, _selection_data_ready_cb, NULL, seatid); - return EINA_TRUE; -} - -EAPI Eina_Bool -elm_cnp_selection_set(Evas_Object *obj, Elm_Sel_Type type, - Elm_Sel_Format format, const void *selbuf, size_t buflen) +EOLIAN static Efl_Object* +_efl_ui_selection_efl_object_finalize(Eo *obj, Efl_Ui_Selection_Data *pd) { - int seatid = 1; - Eina_Future *f; - Sel_Lost_Data *ldata; - Eo *sel_man = _efl_ui_selection_manager_get(obj); - Eina_Slice data; + if (pd->registered) + _selection_changed_event_register(obj); - ldata = calloc(1, sizeof(Sel_Lost_Data)); - if (!ldata) return EINA_FALSE; - data.mem = selbuf; - data.len = buflen; -#ifdef HAVE_ELEMENTARY_WL2 - if (_wl_window_get(obj)) seatid = _wl_default_seat_id_get(obj); -#endif - f = efl_ui_selection_manager_selection_set(sel_man, obj, (Efl_Ui_Selection_Type)type, - (Efl_Ui_Selection_Format)format, data, seatid); - - ldata->obj = obj; - ldata->type = type; - eina_future_then_easy(f, _selection_lost_cb, NULL, NULL, EINA_VALUE_TYPE_UINT, ldata); - - return EINA_TRUE; + return efl_finalize(efl_super(obj, MY_CLASS)); } -EAPI Eina_Bool -elm_object_cnp_selection_clear(Evas_Object *obj, Elm_Sel_Type type) -{ - int seatid = 1; - Eo *sel_man = _efl_ui_selection_manager_get((Evas_Object *)obj); - -#ifdef HAVE_ELEMENTARY_WL2 - if (_wl_window_get(obj)) seatid = _wl_default_seat_id_get(obj); -#endif - efl_ui_selection_manager_selection_clear(sel_man, obj, (Efl_Ui_Selection_Type)type, seatid); - - return EINA_TRUE; -} -EAPI void -elm_cnp_selection_loss_callback_set(Evas_Object *obj, Elm_Sel_Type type, - Elm_Selection_Loss_Cb func, const void *data) -{ - Sel_Lost_Data *ldata = calloc(1, sizeof(Sel_Lost_Data)); -#if HAVE_ELEMENTARY_COCOA - // Currently, we have no way to track changes in Cocoa pasteboard. - // Therefore, don't track this... - return; -#endif - if (!ldata) return; - ldata->obj = obj; - ldata->type = type; - ldata->udata = (void *)data; - ldata->loss_cb = func; - lost_cb_list = eina_list_append(lost_cb_list, ldata); -} - -EAPI Eina_Bool -elm_selection_selection_has_owner(Evas_Object *obj) -{ - int seatid = 1; - Eo *sel_man = _efl_ui_selection_manager_get((Evas_Object *)obj); - -#ifdef HAVE_ELEMENTARY_WL2 - if (_wl_window_get(obj)) seatid = _wl_default_seat_id_get(obj); -#endif - - return efl_ui_selection_manager_selection_has_owner(sel_man, obj, - EFL_UI_SELECTION_TYPE_CLIPBOARD, seatid); -} - -EAPI Eina_Bool -elm_cnp_clipboard_selection_has_owner(Evas_Object *obj) -{ - int seatid = 1; - Eo *sel_man = _efl_ui_selection_manager_get((Evas_Object *)obj); - -#ifdef HAVE_ELEMENTARY_WL2 - if (_wl_window_get(obj)) seatid = _wl_default_seat_id_get(obj); -#endif - return efl_ui_selection_manager_selection_has_owner(sel_man, obj, - EFL_UI_SELECTION_TYPE_CLIPBOARD, seatid); -} +#define EFL_UI_SELECTION_EXTRA_OPS \ + EFL_OBJECT_OP_FUNC(efl_event_callback_priority_add, _efl_ui_selection_efl_object_event_callback_priority_add), \ + EFL_OBJECT_OP_FUNC(efl_event_callback_array_priority_add, _efl_ui_selection_efl_object_event_callback_array_priority_add), \ #include "efl_ui_selection.eo.c" diff --git a/src/lib/elementary/efl_ui_selection.eo b/src/lib/elementary/efl_ui_selection.eo index 20e42261d0..7e0814d348 100644 --- a/src/lib/elementary/efl_ui_selection.eo +++ b/src/lib/elementary/efl_ui_selection.eo @@ -1,45 +1,85 @@ -import efl_ui_selection_types; - -mixin @beta Efl.Ui.Selection { - [[Efl Ui Selection class]] - data: null; - methods { - selection_set { - [[Set the selection data to the object]] - params { - @in type: Efl.Ui.Selection_Type; [[Selection Type]] - @in format: Efl.Ui.Selection_Format; [[Selection Format]] - @in data: Eina.Slice; [[Selection data]] - @in seat: uint;[[Specified seat for multiple seats case.]] - } - return: future<void>; [[Future for tracking when the selection is lost]] +import eina_types; + +enum @beta Efl.Ui.Cnp_Buffer { + [[System buffer to use in Copy & Paste operations.]] + selection = 0, [[Buffer typically used when the user selects (highlights) some text without explicitly + requesting to copy it.]] + copy_and_paste = 1, [[Buffer used when the user requests that the current selection is copied (using + Ctrl+C, for example).]] +} + +struct @beta Efl.Ui.Wm_Selection_Changed { + [[Information sent along the @[Efl.Ui.Selection.wm_selection,changed] event.]] + buffer : Efl.Ui.Cnp_Buffer; [[The system buffer that has changed.]] + caused_by : Efl.Ui.Selection; [[The EFL widget that triggered the change. $NULL if it is not an EFL widget.]] + seat : uint; [[The seat that triggered the change.]] +} + +mixin @beta Efl.Ui.Selection requires Efl.Object { + [[This mixin provides the ability to interact with the system's Copy & Paste facilities. + ]] + methods { + selection_set { + [[Sets the current selection. + + This sends the selected data to the system's specified buffer, making it available to other + applications for "pasting" it. + + This is typically used when the user requests a "copy" operation. + ]] + params { + buffer : Efl.Ui.Cnp_Buffer; [[System buffer to use.]] + content : Eina.Content @by_ref; [[Data to copy.]] + seat : uint; [[Seat the data comes from. Use 0 when in doubt.]] } - selection_get { - [[Get the data from the object that has selection]] - params { - @in type: Efl.Ui.Selection_Type; [[Selection Type]] - @in format: Efl.Ui.Selection_Format; [[Selection Format]] - @in data_func: Efl.Ui.Selection_Data_Ready; [[Data ready function pointer]] - @in seat: uint;[[Specified seat for multiple seats case.]] - } + } + selection_clear { + [[Clears the current selection. + + No data will be available to other applications to paste (until something else is selected). + ]] + params { + buffer : Efl.Ui.Cnp_Buffer; [[System buffer to clear.]] + seat : uint; [[Seat to clear. Use 0 when in doubt.]] } - selection_clear { - [[Clear the selection data from the object]] - params { - @in type: Efl.Ui.Selection_Type; [[Selection Type]] - @in seat: uint; [[Specified seat for multiple seats case.]] - } + } + selection_get { + [[Retrieves the data currently held in the specified buffer. + + This is typically used when the user requests a "paste" operation. + + This method is time consuming (since data can potentially be provided by another application), therefore, + it is recommended to verify the existence of a selection using @.has_selection before calling it. + ]] + params { + buffer : Efl.Ui.Cnp_Buffer; [[System buffer to use.]] + seat : uint; [[Seat where the data should be pasted. Use 0 when in doubt.]] + acceptable_types : iterator<string>; [[List of accepted IANA MIME types: + https://www.iana.org/assignments/media-types/media-types.xhtml + If automatic conversion cannot be provided to any of the accepted + types, an error will be returned. + ]] } - has_owner { - [[Determine whether the selection data has owner]] - params { - @in type: Efl.Ui.Selection_Type; [[Selection type]] - @in seat: uint; [[Specified seat for multiple seats case.]] - } - return: bool; [[EINA_TRUE if there is object owns selection, otherwise EINA_FALSE]] + return : future<Eina.Content> @move; [[A future that will be resolved to the requested content, or to an + error if type conversion is not available or the requested buffer + is empty.]] + } + has_selection { + [[Checks if the specified system buffer has content.]] + params { + buffer : Efl.Ui.Cnp_Buffer; [[System buffer to query.]] + seat : uint; [[Seat to query. Use 0 when in doubt.]] } - } - events { - wm_selection,changed: Efl.Ui.Selection_Changed; [[Called when display server's selection has changed]] - } + return : bool; [[$true if there is data available in the requested buffer.]] + } + } + implements { + Efl.Object.constructor; + Efl.Object.invalidate; + Efl.Object.finalize; + } + events { + wm_selection,changed : Efl.Ui.Wm_Selection_Changed; [[Event emitted when the content of one of the system's + buffers changes.]] + } } diff --git a/src/lib/elementary/efl_ui_selection_manager.c b/src/lib/elementary/efl_ui_selection_manager.c deleted file mode 100644 index 3a5db9713c..0000000000 --- a/src/lib/elementary/efl_ui_selection_manager.c +++ /dev/null @@ -1,5678 +0,0 @@ -#ifdef HAVE_CONFIG_H -# include "elementary_config.h" -#endif - -#include <Elementary.h> -#include "elm_priv.h" - -#ifdef _WIN32 -# include <evil_private.h> /* mmap */ -#else -# include <sys/mman.h> -#endif - -#include "efl_ui_selection_manager_private.h" - -#define MY_CLASS EFL_UI_SELECTION_MANAGER_CLASS - -//#define DEBUGON 1 -#ifdef DEBUGON -# define sel_debug(fmt, args...) fprintf(stderr, __FILE__":%s:%d : " fmt "\n", __FUNCTION__, __LINE__, ##args) -#else -# define sel_debug(x...) do { } while (0) -#endif - -static void _anim_data_free(Sel_Manager_Drag_Container *dc); -static void _cont_obj_mouse_move_cb(void *data, Evas *e, Evas_Object *obj, void *event_info); -static void _cont_obj_mouse_up_cb(void *data, Evas *e, Evas_Object *obj, void *event_info); -static void _item_container_del_internal(Sel_Manager_Drag_Container *dc, Eina_Bool full); - -void efl_ui_selection_manager_drop_target_del(Eo *obj, Efl_Object *target_obj, Efl_Ui_Selection_Format format, unsigned int seat); -void efl_ui_selection_manager_selection_clear(Eo *obj, Efl_Object *owner, Efl_Ui_Selection_Type type, unsigned int seat); -void efl_ui_selection_manager_drag_start(Eo *obj, Efl_Object *drag_obj, Efl_Ui_Selection_Format format, Eina_Slice data, Efl_Ui_Selection_Action action, void *icon_func_data, Efl_Dnd_Drag_Icon_Create icon_func, Eina_Free_Cb icon_func_free_cb, unsigned int seat); - -static Eina_List *managers; - -#ifdef HAVE_ELEMENTARY_X -static void _set_selection_list(Sel_Manager_Selection *sel_list, Sel_Manager_Seat_Selection *seat_sel); -static Ecore_X_Atom _x11_dnd_action_rev_map(Efl_Ui_Selection_Action action); -static Ecore_X_Window _x11_xwin_get(const Evas_Object *obj); -#endif - -#ifdef HAVE_ELEMENTARY_WL2 -Ecore_Wl2_Window *_wl_window_get(const Evas_Object *obj); -static Ecore_Wl2_Input *_wl_seat_get(Ecore_Wl2_Window *win, Evas_Object *obj, unsigned int seat_id); -#endif - -#ifdef HAVE_ELEMENTARY_WIN32 -static void _set_selection_list(Sel_Manager_Selection *sel_list, Sel_Manager_Seat_Selection *seat_sel); -#endif - -EAPI int ELM_CNP_EVENT_SELECTION_CHANGED = -1; - -static Sel_Manager_Seat_Selection * -_sel_manager_seat_selection_get(Efl_Ui_Selection_Manager_Data *pd, unsigned int seat) -{ - Eina_List *l = NULL; - Sel_Manager_Seat_Selection *seat_sel = NULL; - - EINA_LIST_FOREACH(pd->seat_list, l, seat_sel) - { - if (seat_sel->seat == seat) - break; - } - if (!seat_sel) - ERR("Could not find request seat"); - - return seat_sel; -} - -static inline void -_owner_change_check(Efl_Ui_Selection_Manager *manager, Efl_Object *owner, - Sel_Manager_Seat_Selection *seat_sel, - Sel_Manager_Selection *sel, - Efl_Ui_Selection_Type type, Eina_Bool same_win) -{ - if (!same_win) - { - Eina_List *l, *l_next; - Eo *man; - - EINA_LIST_FOREACH_SAFE(managers, l, l_next, man) - { - if (man != manager) - { - Eina_List *l2, *l2_next, *l3, *l3_next; - Sel_Manager_Selection_Lost *sel_lost; - Sel_Manager_Seat_Selection *seat_sel2; - Efl_Ui_Selection_Manager_Data *pd = efl_data_scope_get(man, MY_CLASS); - - if (!pd) continue; - EINA_LIST_FOREACH_SAFE(pd->seat_list, l3, l3_next, seat_sel2) - { - EINA_LIST_FOREACH_SAFE(seat_sel2->sel_lost_list, l2, l2_next, sel_lost) - { - if ((sel_lost->request) && - (sel_lost->type == type)) - { - eina_promise_resolve(sel_lost->promise, eina_value_uint_init(sel_lost->type)); - } - } - seat_sel2->xwin = 0; -#if defined(HAVE_ELEMENTARY_X) || defined(HAVE_ELEMENTARY_WIN32) - if (seat_sel2->sel_list) - { - int i; - - for (i = 0; - i < (EFL_UI_SELECTION_TYPE_CLIPBOARD + 1) - ; i++) - { -#ifdef HAVE_ELEMENTARY_X - seat_sel2->sel_list[i].xwin = 0; -#elif defined (HAVE_ELEMENTARY_WIN32) - seat_sel2->sel_list[i].win = NULL; -#endif - seat_sel2->sel_list[i].active = EINA_FALSE; - } - } -#endif -#if defined(HAVE_ELEMENTARY_WL2) || defined(HAVE_ELEMENTARY_COCOA) - if (seat_sel2->sel) - { - seat_sel2->sel->win = 0; - seat_sel2->sel->active = EINA_FALSE; - } -#endif - } - } - } - } - if ((sel->owner != NULL) && - (sel->owner != owner) && same_win) - { - Eina_List *l, *l_next; - Sel_Manager_Selection_Lost *sel_lost; - EINA_LIST_FOREACH_SAFE(seat_sel->sel_lost_list, l, l_next, sel_lost) - { - if ((sel_lost->request == sel->owner) && - (sel_lost->type == type)) - { - eina_promise_resolve(sel_lost->promise, eina_value_uint_init(sel_lost->type)); - } - } - } -} - -static Sel_Manager_Seat_Selection * -_sel_manager_seat_selection_init(Efl_Ui_Selection_Manager_Data *pd, unsigned int seat) -{ - Sel_Manager_Seat_Selection *seat_sel = NULL; - Eina_List *l = NULL; - - EINA_LIST_FOREACH(pd->seat_list, l, seat_sel) - { - if(seat_sel->seat == seat) - break; - } - if (!seat_sel) - { - seat_sel = calloc(1, sizeof(Sel_Manager_Seat_Selection)); - if (!seat_sel) - { - ERR("Failed to allocate seat"); - return NULL; - } - seat_sel->saved_types = calloc(1, sizeof(Saved_Type)); - seat_sel->seat = seat; - seat_sel->pd = pd; - pd->seat_list = eina_list_append(pd->seat_list, seat_sel); - } -#ifdef HAVE_ELEMENTARY_X - if (!seat_sel->sel_list) - { - seat_sel->sel_list = calloc(1, (EFL_UI_SELECTION_TYPE_CLIPBOARD + 1) * sizeof(Sel_Manager_Selection)); - if (!seat_sel->sel_list) - { - ERR("failed to allocate selection list"); - return NULL; - } - _set_selection_list(seat_sel->sel_list, seat_sel); - } -#endif -#ifdef HAVE_ELEMENTARY_WL2 - if (!seat_sel->sel) - { - Sel_Manager_Selection *sel = calloc(1, sizeof(Sel_Manager_Selection)); - if (!sel) - { - ERR("failed to allocate selection"); - return NULL; - } - sel->seat_sel = seat_sel; - seat_sel->sel = sel; - } -#endif -#ifdef HAVE_ELEMENTARY_COCOA - if (!seat_sel->sel) - { - Sel_Manager_Selection *sel = calloc(1, sizeof(Sel_Manager_Selection)); - if (!sel) - { - ERR("failed to allocate selection"); - return NULL; - } - sel->seat_sel = seat_sel; - seat_sel->sel = sel; - } -#endif -#ifdef HAVE_ELEMENTARY_WIN32 - if (!seat_sel->sel_list) - { - seat_sel->sel_list = calloc(1, (EFL_UI_SELECTION_TYPE_CLIPBOARD + 1) * sizeof(Sel_Manager_Selection)); - if (!seat_sel->sel_list) - { - ERR("failed to allocate selection list"); - return NULL; - } - _set_selection_list(seat_sel->sel_list, seat_sel); - } -#endif - - return seat_sel; -} - -static void -_sel_manager_promise_cancel(Eo *obj EINA_UNUSED, void *data, const Eina_Future *dead_future EINA_UNUSED) -{ - Sel_Manager_Selection_Lost *sel_lost = data; - sel_lost->seat_sel->sel_lost_list = eina_list_remove(sel_lost->seat_sel->sel_lost_list, sel_lost); - free(sel_lost); -} - -static inline Eina_Future * -_update_sel_lost_list(Efl_Object *obj, Efl_Ui_Selection_Type type, - Sel_Manager_Seat_Selection *seat_sel) -{ - Eina_Promise *p; - Sel_Manager_Selection_Lost *sel_lost; - - sel_lost = calloc(1, sizeof(Sel_Manager_Selection_Lost)); - if (!sel_lost) - return NULL; - sel_lost->request = obj; - sel_lost->type = type; - sel_lost->seat_sel = seat_sel; - seat_sel->sel_lost_list = eina_list_append(seat_sel->sel_lost_list, sel_lost); - - p = efl_loop_promise_new(obj); - if (!p) return NULL; - sel_lost->promise = p; - - return efl_future_then(obj, eina_future_new(p), - .data = sel_lost, - .free = _sel_manager_promise_cancel); -} - -/* TODO: this should not be an actual tempfile, but rather encode the object - * as http://dataurl.net/ if it's an image or similar. Evas should support - * decoding it as memfile. */ -static Tmp_Info * -_tempfile_new(int size) -{ -#ifdef HAVE_MMAP - Tmp_Info *info; - const char *tmppath = NULL; - mode_t cur_umask; - int len; - - info = calloc(1, sizeof(Tmp_Info)); - if (!info) return NULL; -#if defined(HAVE_GETUID) && defined(HAVE_GETEUID) - if (getuid() == geteuid()) -#endif - tmppath = getenv("TMP"); - if (!tmppath) tmppath = P_tmpdir; - len = snprintf(NULL, 0, "%s/%sXXXXXX", tmppath, "elmcnpitem-"); - if (len < 0) goto on_error; - len++; - info->filename = malloc(len); - if (!info->filename) goto on_error; - snprintf(info->filename,len,"%s/%sXXXXXX", tmppath, "elmcnpitem-"); - cur_umask = umask(S_IRWXO | S_IRWXG); - info->fd = mkstemp(info->filename); - umask(cur_umask); - if (info->fd < 0) goto on_error; -# ifdef __linux__ - { - char *tmp; - /* And before someone says anything see POSIX 1003.1-2008 page 400 */ - long pid; - - pid = (long)getpid(); - /* Use pid instead of /proc/self: That way if can be passed around */ - len = snprintf(NULL,0,"/proc/%li/fd/%i", pid, info->fd); - len++; - tmp = malloc(len); - if (tmp) - { - snprintf(tmp,len, "/proc/%li/fd/%i", pid, info->fd); - unlink(info->filename); - free(info->filename); - info->filename = tmp; - } - } -# endif - sel_debug("filename is %s\n", info->filename); - if (size < 1) goto on_error; - /* Map it in */ - if (ftruncate(info->fd, size)) - { - perror("ftruncate"); - goto on_error; - } - eina_mmap_safety_enabled_set(EINA_TRUE); - info->map = mmap(NULL, size, PROT_READ|PROT_WRITE, MAP_SHARED, info->fd, 0); - if (info->map == MAP_FAILED) - { - perror("mmap"); - goto on_error; - } - return info; - - on_error: - if (info->fd >= 0) close(info->fd); - info->fd = -1; - /* Set map to NULL and return */ - info->map = NULL; - info->len = 0; - free(info->filename); - free(info); - return NULL; -#else - (void) size; - return NULL; -#endif -} - -static int -_tmpinfo_free(Tmp_Info *info) -{ - if (!info) return 0; - free(info->filename); - free(info); - return 0; -} - -static inline void -_drop_target_cbs_del(Efl_Ui_Selection_Manager_Data *pd, Sel_Manager_Dropable *dropable, Efl_Object *obj) -{ - if (dropable) - { - Drop_Format *df; - while (dropable->format_list) - { - df = EINA_INLIST_CONTAINER_GET(dropable->format_list, Drop_Format); - efl_ui_selection_manager_drop_target_del(pd->sel_man, obj, - df->format, dropable->seat); - // If drop_target_del() happened to delete dropabale, then - // re-fetch it each loop to make sure it didn't - dropable = efl_key_data_get(obj, "__elm_dropable"); - if (!dropable) break; - } - } -} - -static void -_all_drop_targets_cbs_del(void *data, Evas *e EINA_UNUSED, Evas_Object *obj, void *info EINA_UNUSED) -{ - Efl_Ui_Selection_Manager_Data *pd = data; - Sel_Manager_Dropable *dropable = NULL; - - if (!pd) return; - dropable = efl_key_data_get(obj, "__elm_dropable"); - _drop_target_cbs_del(pd, dropable, obj); -} - -static void -_dropable_coords_adjust(Sel_Manager_Dropable *dropable, Eina_Position2D *pos) -{ - Ecore_Evas *ee; - Evas *evas = evas_object_evas_get(dropable->obj); - int ex = 0, ey = 0, ew = 0, eh = 0; - Evas_Object *win; - - ee = ecore_evas_ecore_evas_get(evas); - ecore_evas_geometry_get(ee, &ex, &ey, &ew, &eh); - pos->x = pos->x - ex; - pos->y = pos->y - ey; - - /* For Wayland, frame coords have to be subtracted. */ - Evas_Coord fx, fy; - evas_output_framespace_get(evas, &fx, &fy, NULL, NULL); - if (fx || fy) sel_debug("evas frame fx %d fy %d\n", fx, fy); - pos->x = pos->x - fx; - pos->y = pos->y - fy; - - if (elm_widget_is(dropable->obj)) - { - win = elm_widget_top_get(dropable->obj); - if (win && efl_isa(win, EFL_UI_WIN_CLASS)) - { - Evas_Coord x2, y2; - int rot = elm_win_rotation_get(win); - switch (rot) - { - case 90: - x2 = ew - pos->y; - y2 = pos->x; - break; - case 180: - x2 = ew - pos->x; - y2 = eh - pos->y; - break; - case 270: - x2 = pos->y; - y2 = eh - pos->x; - break; - default: - x2 = pos->x; - y2 = pos->y; - break; - } - sel_debug("rotation %d, w %d, h %d - x:%d->%d, y:%d->%d\n", - rot, ew, eh, pos->x, x2, pos->y, y2); - pos->x = x2; - pos->y = y2; - } - } -} - -static Eina_Bool -_drag_cancel_animate(void *data, double pos) -{ /* Animation to "move back" drag-window */ - Sel_Manager_Seat_Selection *seat_sel = data; - sel_debug("in, pos: %f", pos); - if (pos >= 0.99) - { -#ifdef HAVE_ELEMENTARY_X - Ecore_X_Window xdragwin = _x11_xwin_get(seat_sel->drag_win); - ecore_x_window_ignore_set(xdragwin, 0); -#endif - sel_debug("Delete drag_win"); - evas_object_del(seat_sel->drag_win); - seat_sel->drag_win = NULL; - return ECORE_CALLBACK_CANCEL; - } - else - { - int x, y; - x = seat_sel->drag_win_end.x - (pos * (seat_sel->drag_win_end.x - seat_sel->drag_win_start.x)); - y = seat_sel->drag_win_end.y - (pos * (seat_sel->drag_win_end.y - seat_sel->drag_win_start.y)); - evas_object_move(seat_sel->drag_win, x, y); - } - - return ECORE_CALLBACK_RENEW; -} - -static Efl_Ui_Selection_Format -_dnd_types_to_format(Efl_Ui_Selection_Manager_Data *pd, const char **types, int ntypes) -{ - Efl_Ui_Selection_Format ret_type = 0; - int i; - for (i = 0; i < ntypes; i++) - { - Sel_Manager_Atom *atom = eina_hash_find(pd->type_hash, types[i]); - if (atom) ret_type |= atom->format; - } - return ret_type; -} - -static Eina_List * -_dropable_list_geom_find(Efl_Ui_Selection_Manager_Data *pd, Evas *evas, Evas_Coord px, Evas_Coord py) -{ - Eina_List *itr, *top_objects_list = NULL, *dropable_list = NULL; - Evas_Object *top_obj; - Sel_Manager_Dropable *dropable = NULL; - - if (!pd->drop_list) return NULL; - - /* We retrieve the (non-smart) objects pointed by (px, py) */ - top_objects_list = evas_tree_objects_at_xy_get(evas, NULL, px, py); - /* We walk on this list from the last because if the list contains more than one - * element, all but the last will repeat events. The last one can repeat events - * or not. Anyway, this last one is the first that has to be taken into account - * for the determination of the drop target. - */ - EINA_LIST_REVERSE_FOREACH(top_objects_list, itr, top_obj) - { - Evas_Object *object = top_obj; - /* We search for the dropable data into the object. If not found, we search into its parent. - * For example, if a button is a drop target, the first object will be an (internal) image. - * The drop target is attached to the button, i.e to image's parent. That's why we need to - * walk on the parents until NULL. - * If we find this dropable data, we found our drop target. - */ - while (object) - { - dropable = efl_key_data_get(object, "__elm_dropable"); - if (dropable) - { - Eina_Bool exist = EINA_FALSE; - Eina_List *l; - Sel_Manager_Dropable *d = NULL; - EINA_LIST_FOREACH(dropable_list, l, d) - { - if (d == dropable) - { - exist = EINA_TRUE; - break; - } - } - if (!exist) - dropable_list = eina_list_append(dropable_list, dropable); - object = evas_object_smart_parent_get(object); - if (dropable) - sel_debug("Drop target %p of type %s found\n", - dropable->obj, efl_class_name_get(efl_class_get(dropable->obj))); - } - else - object = evas_object_smart_parent_get(object); - } - } - eina_list_free(top_objects_list); - return dropable_list; -} - -#ifdef HAVE_ELEMENTARY_X -static Ecore_X_Window -_x11_xwin_get(const Efl_Object *obj) -{ - if (!obj) return 0; - - Ecore_X_Window xwin = 0; - //get top - const Evas_Object *top = obj; - const Evas_Object *parent = obj; - while(parent) - { - top = parent; - parent = efl_parent_get(parent); - } - if (efl_isa(top, EFL_UI_WIN_CLASS)) - { - xwin = elm_win_xwindow_get(top); - } - if (!xwin) - { - Ecore_Evas *ee; - Evas *evas = evas_object_evas_get(obj); - if (!evas) return 0; - ee = ecore_evas_ecore_evas_get(evas); - if (!ee) return 0; - - while(!xwin) - { - const char *engine_name = ecore_evas_engine_name_get(ee); - if (!strcmp(engine_name, ELM_BUFFER)) - { - ee = ecore_evas_buffer_ecore_evas_parent_get(ee); - if (!ee) return 0; - xwin = _elm_ee_xwin_get(ee); - } - else - { - xwin = _elm_ee_xwin_get(ee); - if (!xwin) return 0; - } - } - } - - return xwin; -} - -static Eina_Bool -_x11_is_uri_type_data(Sel_Manager_Selection *sel EINA_UNUSED, Ecore_X_Event_Selection_Notify *notify) -{ - Ecore_X_Selection_Data *data; - char *p; - - data = notify->data; - sel_debug("data->format is %d %p %p", data->format, notify, data); - if (data->content == ECORE_X_SELECTION_CONTENT_FILES) return EINA_TRUE; - p = (char *)data->data; - if (!p) return EINA_TRUE; - sel_debug("Got %s", p); - if (strncmp(p, "file:/", 6)) - { - if (*p != '/') return EINA_FALSE; - } - return EINA_TRUE; -} - -static Sel_Manager_Seat_Selection * -_x11_sel_manager_seat_selection_init(Efl_Ui_Selection_Manager_Data *pd, unsigned int seat) -{ - Sel_Manager_Seat_Selection *seat_sel = NULL; - Eina_List *l = NULL; - - EINA_LIST_FOREACH(pd->seat_list, l, seat_sel) - { - if(seat_sel->seat == seat) - break; - } - if (!seat_sel) - { - seat_sel = calloc(1, sizeof(Sel_Manager_Seat_Selection)); - if (!seat_sel) - { - ERR("Failed to allocate seat"); - return NULL; - } - seat_sel->saved_types = calloc(1, sizeof(Saved_Type)); - seat_sel->seat = seat; - seat_sel->pd = pd; - pd->seat_list = eina_list_append(pd->seat_list, seat_sel); - } - if (!seat_sel->sel_list) - { - //TODO: reduce memory (may be just need one common sel_list) - seat_sel->sel_list = calloc(1, (EFL_UI_SELECTION_TYPE_CLIPBOARD + 1) * sizeof(Sel_Manager_Selection)); - if (!seat_sel->sel_list) - { - ERR("failed to allocate selection list"); - return NULL; - } - _set_selection_list(seat_sel->sel_list, seat_sel); - } - - return seat_sel; -} - -static Eina_Bool -_x11_data_preparer_text(Sel_Manager_Seat_Selection *seat_sel EINA_UNUSED, - Ecore_X_Event_Selection_Notify *notify, - Efl_Ui_Selection_Data *ddata, Tmp_Info **tmp_info EINA_UNUSED) -{ - sel_debug("text data preparer"); - Ecore_X_Selection_Data *data = notify->data; - ddata->format = EFL_UI_SELECTION_FORMAT_TEXT; - ddata->content.mem = eina_memdup(data->data, data->length, EINA_TRUE); - ddata->content.len = data->length; - return EINA_TRUE; -} - -static Eina_Bool -_x11_data_preparer_markup(Sel_Manager_Seat_Selection *seat_sel EINA_UNUSED, - Ecore_X_Event_Selection_Notify *notify, - Efl_Ui_Selection_Data *ddata, Tmp_Info **tmp_info EINA_UNUSED) -{ - sel_debug("markup data preparer"); - Ecore_X_Selection_Data *data = notify->data; - ddata->format = EFL_UI_SELECTION_FORMAT_MARKUP; - ddata->content.mem = eina_memdup(data->data, data->length, EINA_TRUE); - ddata->content.len = data->length; - return EINA_TRUE; -} - -/** - * So someone is pasting an image into my entry or widget... - */ -static Eina_Bool -_x11_data_preparer_uri(Sel_Manager_Seat_Selection *seat_sel, Ecore_X_Event_Selection_Notify *notify, - Efl_Ui_Selection_Data *ddata, Tmp_Info **tmp_info EINA_UNUSED) -{ - sel_debug("uri data preparer"); - Ecore_X_Selection_Data *data; - Ecore_X_Selection_Data_Files *files; - char *p, *stripstr = NULL; - - data = notify->data; - sel_debug("data->format is %d %p %p\n", data->format, notify, data); - if (data->content == ECORE_X_SELECTION_CONTENT_FILES) - { - Efreet_Uri *uri; - Eina_Strbuf *strbuf; - int i; - - sel_debug("got a files list\n"); - files = notify->data; - /* - if (files->num_files > 1) - { - // Don't handle many items <- this makes mr bigglesworth sad :( - sel_debug("more then one file: Bailing\n"); - return EINA_FALSE; - } - stripstr = p = strdup(files->files[0]); - */ - - strbuf = eina_strbuf_new(); - if (!strbuf) - return EINA_FALSE; - - for (i = 0; i < files->num_files ; i++) - { - uri = efreet_uri_decode(files->files[i]); - if (uri) - { - eina_strbuf_append(strbuf, uri->path); - efreet_uri_free(uri); - } - else - { - eina_strbuf_append(strbuf, files->files[i]); - } - if (i < (files->num_files - 1)) - eina_strbuf_append(strbuf, "\n"); - } - stripstr = eina_strbuf_string_steal(strbuf); - eina_strbuf_free(strbuf); - } - else - { - Efreet_Uri *uri; - - p = (char *)eina_memdup((unsigned char *)data->data, data->length, EINA_TRUE); - if (!p) return EINA_FALSE; - uri = efreet_uri_decode(p); - if (!uri) - { - /* Is there any reason why we care of URI without scheme? */ - if (p[0] == '/') stripstr = p; - else free(p); - } - else - { - free(p); - stripstr = strdup(uri->path); - efreet_uri_free(uri); - } - } - - if (!stripstr) - { - sel_debug("Couldn't find a file\n"); - return EINA_FALSE; - } - free(seat_sel->saved_types->imgfile); -#if 0 // this seems to be broken - we should be handling uri lists as text - if (seat_sel->saved_types->textreq) - { - seat_sel->saved_types->textreq = 0; - seat_sel->saved_types->imgfile = stripstr; - } - else -#endif - { - ddata->format = EFL_UI_SELECTION_FORMAT_TEXT; - ddata->content.mem = stripstr; - ddata->content.len = strlen(stripstr); - seat_sel->saved_types->imgfile = NULL; - } - return EINA_TRUE; -} - -/** - * Just received an vcard, either through cut and paste, or dnd. - */ -static Eina_Bool -_x11_data_preparer_vcard(Sel_Manager_Seat_Selection *seat_sel EINA_UNUSED, - Ecore_X_Event_Selection_Notify *notify, - Efl_Ui_Selection_Data *ddata, Tmp_Info **tmp_info EINA_UNUSED) -{ - sel_debug("vcard receive\n"); - Ecore_X_Selection_Data *data = notify->data; - ddata->format = EFL_UI_SELECTION_FORMAT_VCARD; - ddata->content.mem = eina_memdup(data->data, data->length, EINA_TRUE); - ddata->content.len = data->length; - return EINA_TRUE; -} - -static Eina_Bool -_x11_data_preparer_image(Sel_Manager_Seat_Selection *seat_sel EINA_UNUSED, - Ecore_X_Event_Selection_Notify *notify, - Efl_Ui_Selection_Data *ddata, Tmp_Info **tmp_info) -{ - Ecore_X_Selection_Data *data = notify->data; - sel_debug("got a image file!\n"); - sel_debug("Size if %d\n", data->length); - - ddata->format = EFL_UI_SELECTION_FORMAT_IMAGE; - data = notify->data; - - Tmp_Info *tmp = _tempfile_new(data->length); - if (!tmp) return EINA_FALSE; - memcpy(tmp->map, data->data, data->length); - munmap(tmp->map, data->length); - ddata->content.mem = strdup(tmp->filename); - ddata->content.len = strlen(tmp->filename); - *tmp_info = tmp; - return EINA_TRUE; -} - -static Eina_Bool -_x11_win_filter(Eo *manager EINA_UNUSED, Ecore_X_Window xwin) -{ - Eo *win; - const Eina_List *l; - - EINA_LIST_FOREACH(_elm_win_list, l, win) - { - if (elm_win_window_id_get(win) == xwin) return EINA_FALSE; - } - return EINA_TRUE; -} - -/* - * Callback to handle a targets response on a selection request: - * So pick the format we'd like; and then request it. - */ -static Eina_Bool -_x11_notify_handler_targets(Efl_Ui_Selection_Manager_Data *pd, Sel_Manager_Selection *sel, Ecore_X_Event_Selection_Notify *notify) -{ - sel_debug("notify handler targets"); - Ecore_X_Selection_Data_Targets *targets; - Ecore_X_Atom *atom_list; - int i, j; - - targets = notify->data; - atom_list = (Ecore_X_Atom *)(targets->data.data); - for (j = (SELECTION_ATOM_LISTING_ATOMS + 1); j < SELECTION_N_ATOMS; j++) - { - sel_debug("\t%s %d", pd->atom_list[j].name, pd->atom_list[j].x_atom); - if (!(pd->atom_list[j].format & sel->request_format)) continue; - for (i = 0; i < targets->data.length; i++) - { - if ((pd->atom_list[j].x_atom == atom_list[i]) && (pd->atom_list[j].x_data_preparer)) - { - if (j == SELECTION_ATOM_TEXT_URILIST) - { - if (!_x11_is_uri_type_data(sel, notify)) continue; - } - sel_debug("Atom %s matches", pd->atom_list[j].name); - goto done; - } - } - } - sel_debug("Couldn't find anything that matches"); - return ECORE_CALLBACK_PASS_ON; -done: - sel_debug("Sending request for %s, xwin=%#llx", - pd->atom_list[j].name, (unsigned long long)sel->xwin); - sel->request(sel->xwin, pd->atom_list[j].name); - return ECORE_CALLBACK_PASS_ON; -} - -static Eina_Bool -_x11_fixes_selection_notify(void *data, int t EINA_UNUSED, void *event) -{ - Efl_Ui_Selection_Manager_Data *pd = data; - Efl_Ui_Selection_Changed e; - Elm_Cnp_Event_Selection_Changed *_e; - Ecore_X_Event_Fixes_Selection_Notify *ev = event; - Sel_Manager_Seat_Selection *seat_sel; - Efl_Ui_Selection_Type type; - Sel_Manager_Selection *sel; - - if (_x11_win_filter(pd->sel_man, ev->win)) return ECORE_CALLBACK_PASS_ON; - - switch (ev->selection) - { - case ECORE_X_SELECTION_CLIPBOARD: - type = EFL_UI_SELECTION_TYPE_CLIPBOARD; - break; - case ECORE_X_SELECTION_PRIMARY: - type = EFL_UI_SELECTION_TYPE_PRIMARY; - break; - default: return ECORE_CALLBACK_RENEW; - } - seat_sel = _x11_sel_manager_seat_selection_init(pd, 1); - if (!seat_sel) return ECORE_CALLBACK_RENEW; - sel = seat_sel->sel_list + type; - if (sel->active && (sel->xwin != ev->owner)) - efl_ui_selection_manager_selection_clear(pd->sel_man, sel->owner, type, seat_sel->seat); - e.type = type; - e.seat = 1; /* under x11 this is always the default seat */ - e.exist = !!ev->owner; - - _e = calloc(1, sizeof(Elm_Cnp_Event_Selection_Changed)); - EINA_SAFETY_ON_NULL_RETURN_VAL(_e, ECORE_CALLBACK_RENEW); - _e->type = type; - _e->seat_id = 1; - _e->exists = e.exist; - - ecore_event_add(ELM_CNP_EVENT_SELECTION_CHANGED, _e, NULL, NULL); - efl_event_callback_call(sel->owner, EFL_UI_SELECTION_EVENT_WM_SELECTION_CHANGED, &e); - - return ECORE_CALLBACK_RENEW; -} - -/* - * Response to a selection notify: - * - So we have asked for the selection list. - * - If it's the targets list, parse it, and fire of what we want, - * else it's the data we want. - */ -//NB: x11 does not have seat, use 1 as default -static Eina_Bool -_efl_sel_manager_x11_selection_notify(void *udata, int type EINA_UNUSED, void *event) -{ - Efl_Ui_Selection_Manager_Data *pd = udata; - Ecore_X_Event_Selection_Notify *ev = event; - Sel_Manager_Selection *sel; - Sel_Manager_Seat_Selection *seat_sel = NULL; - int i; - - if (_x11_win_filter(pd->sel_man, ev->win)) return ECORE_CALLBACK_PASS_ON; - - seat_sel = _sel_manager_seat_selection_get(pd, 1); - if (!seat_sel) - return EINA_FALSE; - - sel_debug("selection notify callback: %d", ev->selection); - switch (ev->selection) - { - case ECORE_X_SELECTION_PRIMARY: - sel = seat_sel->sel_list + EFL_UI_SELECTION_TYPE_PRIMARY; - break; - case ECORE_X_SELECTION_SECONDARY: - sel = seat_sel->sel_list + EFL_UI_SELECTION_TYPE_SECONDARY; - break; - case ECORE_X_SELECTION_XDND: - sel = seat_sel->sel_list + EFL_UI_SELECTION_TYPE_DND; - break; - case ECORE_X_SELECTION_CLIPBOARD: - sel = seat_sel->sel_list + EFL_UI_SELECTION_TYPE_CLIPBOARD; - break; - default: - return ECORE_CALLBACK_PASS_ON; - } - sel_debug("Target is %s", ev->target); - if (!sel->asked) return ECORE_CALLBACK_PASS_ON; - sel->asked--; - - if (ev->selection != ECORE_X_SELECTION_XDND && - (!strcmp(ev->target, "TARGETS") || !strcmp(ev->target, "ATOMS"))) - { - _x11_notify_handler_targets(pd, sel, ev); - return ECORE_CALLBACK_PASS_ON; - } - for (i = 0; i < SELECTION_N_ATOMS; i++) - { - if (!strcmp(ev->target, pd->atom_list[i].name)) - { - if (pd->atom_list[i].x_data_preparer) - { - Efl_Ui_Selection_Data ddata = { 0 }; - Tmp_Info *tmp_info = NULL; - Eina_Bool success; - sel_debug("Found something: %s", pd->atom_list[i].name); - - success = pd->atom_list[i].x_data_preparer(seat_sel, ev, &ddata, &tmp_info); - sel_debug("ddata: %s (%zd)", (const char *)ddata.content.mem, ddata.content.len); - if ((pd->atom_list[i].format == EFL_UI_SELECTION_FORMAT_IMAGE) && - (seat_sel->saved_types->imgfile)) - break; - if (ev->selection == ECORE_X_SELECTION_XDND) - { - if (success) - { - Sel_Manager_Dropable *dropable; - Eina_List *l; - sel_debug("drag & drop\n"); - EINA_LIST_FOREACH(pd->drop_list, l, dropable) - { - if (dropable->obj == sel->request_obj) break; - dropable = NULL; - } - if (dropable) - { - Drop_Format *df; - Eina_Inlist *itr; - - ddata.action = sel->action; - if (!dropable->is_container) - { - sel_debug("normal dnd, not container"); - ddata.pos = seat_sel->saved_types->pos; - } - else - { - sel_debug("Drop on container"); - Eina_Position2D pos, posret = {0, 0}; - evas_object_geometry_get(dropable->obj, &pos.x, &pos.y, NULL, NULL); - //get item - pos = EINA_POSITION2D(seat_sel->saved_types->pos.x + pos.x, - seat_sel->saved_types->pos.y + pos.y); - Efl_Object *it = NULL; - if (dropable->item_func) - it = dropable->item_func(dropable->item_func_data, - dropable->obj, pos, &posret); - ddata.pos = posret; - ddata.item = it; - } - EINA_INLIST_FOREACH_SAFE(dropable->format_list, itr, df) - { - if (df->format & dropable->last.format) - { - sel_debug("calling Drop event on: %p", dropable->obj); - efl_event_callback_call(dropable->obj, EFL_UI_DND_EVENT_DRAG_DROP, &ddata); - } - } - } - else - { - sel_debug("dnd: has NO dropable"); - } - } - /* We have to finish DnD, no matter what */ - ecore_x_dnd_send_finished(); - } - else if (sel->data_func && success) - { - ddata.pos.x = ddata.pos.y = 0; - sel->data_func(sel->data_func_data, sel->request_obj, &ddata); - } - free((void *)ddata.content.mem); - if (tmp_info) _tmpinfo_free(tmp_info); - } - else sel_debug("Ignored: No handler!"); - break; - } - } - return ECORE_CALLBACK_PASS_ON; -} - -static Eina_Bool -_x11_selection_clear(void *data, int type EINA_UNUSED, void *event) -{ - Efl_Ui_Selection_Manager_Data *pd = data; - Ecore_X_Event_Selection_Clear *ev = event; - Sel_Manager_Selection *sel; - Sel_Manager_Seat_Selection *seat_sel = NULL; - Eina_List *l, *l_next; - Sel_Manager_Selection_Lost *sel_lost; - unsigned int i; - - if (_x11_win_filter(pd->sel_man, ev->win)) return ECORE_CALLBACK_PASS_ON; - - seat_sel = _sel_manager_seat_selection_get(pd, 1); - if (!seat_sel) - return EINA_FALSE; - - for (i = EFL_UI_SELECTION_TYPE_PRIMARY; i <= EFL_UI_SELECTION_TYPE_CLIPBOARD; i++) - { - if (seat_sel->sel_list[i].ecore_sel == ev->selection) break; - } - sel_debug("selection %d clear", i); - /* Not me... Don't care */ - if (i > EFL_UI_SELECTION_TYPE_CLIPBOARD) return ECORE_CALLBACK_PASS_ON; - - sel = seat_sel->sel_list + i; - - EINA_LIST_FOREACH_SAFE(seat_sel->sel_lost_list, l, l_next, sel_lost) - { - if ((sel_lost->request == sel->owner) && - (sel_lost->type == i)) - { - sel_debug("resolve the promise: %p", sel_lost->promise); - eina_promise_resolve(sel_lost->promise, eina_value_uint_init(sel_lost->type)); - } - } - sel->active = EINA_FALSE; - sel->owner = NULL; - - return ECORE_CALLBACK_PASS_ON; -} - -static Eina_Bool -_x11_general_converter(char *target EINA_UNUSED, void *data, int size EINA_UNUSED, void **data_ret, int *size_ret, Ecore_X_Atom *ttype EINA_UNUSED, int *typesize EINA_UNUSED) -{ - sel_debug("general converter"); - Sel_Manager_Selection *sel = *(Sel_Manager_Selection **)data; - if (sel->format == EFL_UI_SELECTION_FORMAT_NONE) - { - if (data_ret) - { - *data_ret = malloc(sel->data.len * sizeof(char) + 1); - if (!*data_ret) return EINA_FALSE; - memcpy(*data_ret, sel->data.mem, sel->data.len); - ((char**)(data_ret))[0][sel->data.len] = 0; - } - if (size_ret) *size_ret = sel->data.len; - } - else - { - if (sel->data.mem) - { - if (data_ret) - *data_ret = eina_memdup(sel->data.mem, sel->data.len, 1); - if (size_ret) *size_ret = sel->data.len; - } - else - { - if (data_ret) *data_ret = NULL; - if (size_ret) *size_ret = 0; - } - } - return EINA_TRUE; -} - -static Eina_Bool -_x11_targets_converter(char *target EINA_UNUSED, void *data, int size EINA_UNUSED, void **data_ret, int *size_ret, Ecore_X_Atom *ttype, int *typesize) -{ - int i, count; - Ecore_X_Atom *aret; - Sel_Manager_Selection *sel; - Efl_Ui_Selection_Format seltype; - - sel_debug("target converter"); - if (!data_ret) return EINA_FALSE; - - sel = *(Sel_Manager_Selection **)data; - seltype = sel->format; - Sel_Manager_Seat_Selection *seat_sel = sel->seat_sel; - Efl_Ui_Selection_Manager_Data *pd = seat_sel->pd; - - for (i = SELECTION_ATOM_LISTING_ATOMS + 1, count = 0; i < SELECTION_N_ATOMS ; i++) - { - if (seltype & pd->atom_list[i].format) count++; - } - aret = malloc(sizeof(Ecore_X_Atom) * count); - if (!aret) return EINA_FALSE; - for (i = SELECTION_ATOM_LISTING_ATOMS + 1, count = 0; i < SELECTION_N_ATOMS ; i++) - { - if (seltype & pd->atom_list[i].format) - aret[count ++] = pd->atom_list[i].x_atom; - } - - *data_ret = aret; - if (typesize) *typesize = 32 /* urk */; - if (ttype) *ttype = ECORE_X_ATOM_ATOM; - if (size_ret) *size_ret = count; - return EINA_TRUE; -} - -static Eina_Bool -_x11_image_converter(char *target EINA_UNUSED, void *data EINA_UNUSED, int size EINA_UNUSED, void **data_ret EINA_UNUSED, int *size_ret EINA_UNUSED, Ecore_X_Atom *ttype EINA_UNUSED, int *typesize EINA_UNUSED) -{ - sel_debug("Image converter called"); - return EINA_TRUE; -} - -static Eina_Bool -_x11_vcard_send(char *target EINA_UNUSED, void *data EINA_UNUSED, int size EINA_UNUSED, void **data_ret, int *size_ret, Ecore_X_Atom *ttype EINA_UNUSED, int *typesize EINA_UNUSED) -{ - Sel_Manager_Selection *sel; - - sel_debug("Vcard send called"); - sel = *(Sel_Manager_Selection **)data; - if (data_ret) - { - char *s; - - s = malloc(sel->data.len + 1); - if (!s) return EINA_FALSE; - memcpy(s, sel->data.mem, sel->data.len); - s[sel->data.len] = 0; - *data_ret = s; - } - - if (size_ret) *size_ret = sel->data.len; - return EINA_TRUE; -} - -static Eina_Bool -_x11_text_converter(char *target, void *data, int size EINA_UNUSED, void **data_ret, int *size_ret, Ecore_X_Atom *ttype, int *typesize) -{ - Sel_Manager_Selection *sel; - - sel = *(Sel_Manager_Selection **)data; - if (!sel) return EINA_FALSE; - - sel_debug("text converter"); - if (sel->format == EFL_UI_SELECTION_FORMAT_NONE) - { - sel_debug("none"); - if (data_ret) - { - *data_ret = malloc(sel->data.len * sizeof(char) + 1); - if (!*data_ret) return EINA_FALSE; - memcpy(*data_ret, data, sel->data.len); - ((char**)(data_ret))[0][sel->data.len] = 0; - } - if (size_ret) *size_ret = sel->data.len; - return EINA_TRUE; - } - - if (!sel->active) return EINA_TRUE; - - if ((sel->format & EFL_UI_SELECTION_FORMAT_MARKUP) || - (sel->format & EFL_UI_SELECTION_FORMAT_HTML)) - { - char *tmp = malloc(sel->data.len + 1); - if (tmp) - { - strncpy(tmp, sel->data.mem, sel->data.len); - tmp[sel->data.len] = 0; - *data_ret = _elm_util_mkup_to_text(tmp); - if (size_ret && *data_ret) *size_ret = strlen(*data_ret); - free(tmp); - sel_debug("markup or html: %s", (const char *)*data_ret); - } - else return EINA_FALSE; - } - else if (sel->format & EFL_UI_SELECTION_FORMAT_TEXT) - { - ecore_x_selection_converter_text(target, sel->data.mem, - sel->data.len, - data_ret, size_ret, - ttype, typesize); - sel_debug("text"); - } - else if (sel->format & EFL_UI_SELECTION_FORMAT_IMAGE) - { - efl_file_simple_get(sel->request_obj, (const char **)data_ret, NULL); - if (!*data_ret) *data_ret = strdup("No file"); - else *data_ret = strdup(*data_ret); - - if (!*data_ret) - { - ERR("Failed to allocate memory!"); - *size_ret = 0; - return EINA_FALSE; - } - - *size_ret = strlen(*data_ret); - } - return EINA_TRUE; -} - -static Eina_Future * -_x11_efl_sel_manager_selection_set(Efl_Ui_Selection_Manager_Data *pd, Efl_Object *owner, - Efl_Ui_Selection_Type type, Efl_Ui_Selection_Format format, Eina_Slice data, - Ecore_X_Window xwin, unsigned int seat) -{ - Sel_Manager_Seat_Selection *seat_sel; - Sel_Manager_Selection *sel; - Eina_Bool same_win = EINA_FALSE; - - seat_sel = _x11_sel_manager_seat_selection_init(pd, seat); - seat_sel->active_type = type; - sel = seat_sel->sel_list + type; - //support 1 app with multiple window, 1 selection manager - if (seat_sel->xwin == xwin) - same_win = EINA_TRUE; - _owner_change_check(pd->sel_man, owner, seat_sel, sel, type, same_win); - seat_sel->xwin = xwin; - - sel->owner = owner; - free(sel->data.mem); - sel->xwin = xwin; - sel->data = eina_slice_dup(data); - sel->active = EINA_TRUE; - sel->format = format; - - sel->set(xwin, &sel, sizeof(Sel_Manager_Selection *)); - sel_debug("data: %p (%zu)", &sel, sizeof(Sel_Manager_Selection *)); - - return _update_sel_lost_list(owner, type, seat_sel); -} - -static void -_x11_efl_sel_manager_selection_get(const Efl_Object *request, Efl_Ui_Selection_Manager_Data *pd, - Efl_Ui_Selection_Type type, Efl_Ui_Selection_Format format, - void *data_func_data, Efl_Ui_Selection_Data_Ready data_func, Eina_Free_Cb data_func_free_cb, - Ecore_X_Window xwin, unsigned int seat) -{ - Sel_Manager_Seat_Selection *seat_sel; - Sel_Manager_Selection *sel;; - - sel_debug("request: %p, seat: %u, type: %d, format: %d", request, seat, type, format); - seat_sel = _sel_manager_seat_selection_init(pd, seat); - sel = seat_sel->sel_list + type; - sel->request_obj = (Efl_Object *)request; - sel->data_func_data = data_func_data; - sel->data_func = data_func; - sel->data_func_free_cb = data_func_free_cb; - sel->request_format = format; - sel->xwin = xwin; - - if (sel->active) - { - if (sel->data.mem && - ((format == sel->format) || (xwin == 0))) - { - sel_debug("use local data"); - Efl_Ui_Selection_Data seldata; - - seldata.content.mem = sel->data.mem; - seldata.content.len = sel->data.len; - seldata.pos.x = seldata.pos.y = 0; - seldata.format = sel->format; - sel->data_func(sel->data_func_data, sel->request_obj, &seldata); - return; - } - } - - sel->asked = 2; - sel->request(xwin, ECORE_X_SELECTION_TARGET_TARGETS); -} - -static void -_x11_win_rotation_changed_cb(void *data, const Efl_Event *event) -{ - Evas_Object *win = data; - int rot = elm_win_rotation_get(event->object); - elm_win_rotation_set(win, rot); -} - -static Eina_Bool -_x11_drag_mouse_up(void *data, int etype EINA_UNUSED, void *event) -{ - Sel_Manager_Seat_Selection *seat_sel = data; - Efl_Ui_Selection_Manager_Data *pd = seat_sel->pd; - Ecore_X_Window xwin = seat_sel->xwin; - Ecore_Event_Mouse_Button *ev = event; - - if ((ev->buttons == 1) && - (ev->event_window == xwin)) - { - Eina_Bool have_drop_list = EINA_FALSE; - Eina_List *l; - Sel_Manager_Dropable *dropable; - - ecore_x_pointer_ungrab(); - ELM_SAFE_FREE(seat_sel->mouse_up_handler, ecore_event_handler_del); - ELM_SAFE_FREE(seat_sel->dnd_status_handler, ecore_event_handler_del); - ecore_x_dnd_self_drop(); - - sel_debug("mouse up, xwin=%#llx\n", (unsigned long long)xwin); - - EINA_LIST_FOREACH(pd->drop_list, l, dropable) - { - if (xwin == _x11_xwin_get(dropable->obj)) - { - have_drop_list = EINA_TRUE; - break; - } - } - if (!have_drop_list) ecore_x_dnd_aware_set(xwin, EINA_FALSE); - efl_event_callback_call(seat_sel->drag_obj, EFL_UI_DND_EVENT_DRAG_DONE, NULL); - if (seat_sel->drag_win) - { - if (seat_sel->drag_obj) - { - if (elm_widget_is(seat_sel->drag_obj)) - { - Evas_Object *win = elm_widget_top_get(seat_sel->drag_obj); - if (win && efl_isa(win, EFL_UI_WIN_CLASS)) - efl_event_callback_del(win, EFL_UI_WIN_EVENT_WIN_ROTATION_CHANGED, - _x11_win_rotation_changed_cb, seat_sel->drag_win); - } - } - - if (!seat_sel->accept) - { /* Commit animation when drag cancelled */ - /* Record final position of dragwin, then do animation */ - ecore_evas_animator_timeline_add(seat_sel->drag_win, 0.3, - _drag_cancel_animate, seat_sel); - } - else - { /* No animation drop was committed */ - Ecore_X_Window xdragwin = _x11_xwin_get(seat_sel->drag_win); - ecore_x_window_ignore_set(xdragwin, 0); - evas_object_del(seat_sel->drag_win); - seat_sel->drag_win = NULL; - sel_debug("deleted drag_win"); - } - } - - seat_sel->drag_obj = NULL; - seat_sel->accept = EINA_FALSE; - } - return EINA_TRUE; -} - -static void -_x11_drag_move(void *data, Ecore_X_Xdnd_Position *pos) -{ - Sel_Manager_Seat_Selection *seat_sel = data; - Efl_Dnd_Drag_Pos dp; - - evas_object_move(seat_sel->drag_win, - pos->position.x - seat_sel->drag_pos.x, - pos->position.y - seat_sel->drag_pos.y); - seat_sel->drag_win_end.x = pos->position.x - seat_sel->drag_pos.x; - seat_sel->drag_win_end.y = pos->position.y - seat_sel->drag_pos.y; - sel_debug("dragevas: %p -> %p\n", - seat_sel->drag_obj, - evas_object_evas_get(seat_sel->drag_obj)); - dp.pos.x = pos->position.x; - dp.pos.y = pos->position.y; - dp.action = seat_sel->drag_action; - //for drag side - efl_event_callback_call(seat_sel->drag_obj, EFL_UI_DND_EVENT_DRAG_POS, &dp); -} - -static void -_x11_drag_target_del(void *data, Evas *e EINA_UNUSED, Evas_Object *obj, void *info EINA_UNUSED) -{ - Sel_Manager_Seat_Selection *seat_sel = data; - Sel_Manager_Selection *sel = &seat_sel->sel_list[seat_sel->active_type]; - - if (seat_sel->drag_obj == obj) - { - sel->request_obj = NULL; - seat_sel->drag_obj = NULL; - } -} - -static Eina_Bool -_x11_dnd_status(void *data, int etype EINA_UNUSED, void *ev) -{ - Sel_Manager_Seat_Selection *seat_sel = data; - Ecore_X_Event_Xdnd_Status *status = ev; - - seat_sel->accept = EINA_FALSE; - - /* Only thing we care about: will accept */ - if ((status) && (status->will_accept)) - { - sel_debug("Will accept\n"); - seat_sel->accept = EINA_TRUE; - } - /* Won't accept */ - else - { - sel_debug("Won't accept accept\n"); - } - efl_event_callback_call(seat_sel->drag_obj, EFL_UI_DND_EVENT_DRAG_ACCEPT, &seat_sel->accept); - - return EINA_TRUE; -} - -static void -_x11_efl_sel_manager_drag_start(Eo *obj EINA_UNUSED, Efl_Ui_Selection_Manager_Data *pd, - Efl_Object *drag_obj, Efl_Ui_Selection_Format format, - Eina_Slice data, Efl_Ui_Selection_Action action, - void *icon_func_data, Efl_Dnd_Drag_Icon_Create icon_func, - Eina_Free_Cb icon_func_free_cb EINA_UNUSED, - Ecore_X_Window xwin, unsigned int seat) -{ - Ecore_X_Window xdragwin; - Sel_Manager_Seat_Selection *seat_sel; - Sel_Manager_Selection *sel; - Ecore_Evas *ee; - int x, y, x2 = 0, y2 = 0, x3, y3; - Evas_Object *icon = NULL; - int w = 0, h = 0; - int ex, ey, ew, eh; - Ecore_X_Atom actx; - int i; - int xr, yr, rot; - - seat_sel = _x11_sel_manager_seat_selection_init(pd, seat); - if (!seat_sel) return; - seat_sel->active_type = EFL_UI_SELECTION_TYPE_DND; - - sel = &seat_sel->sel_list[seat_sel->active_type]; - ecore_x_dnd_types_set(xwin, NULL, 0); - for (i = SELECTION_ATOM_LISTING_ATOMS + 1; i < SELECTION_N_ATOMS; i++) - { - if (format == EFL_UI_SELECTION_FORMAT_TARGETS || (pd->atom_list[i].format & format)) - { - ecore_x_dnd_type_set(xwin, pd->atom_list[i].name, EINA_TRUE); - sel_debug("set dnd type: %s\n", pd->atom_list[i].name); - } - } - - sel->active = EINA_TRUE; - sel->request_obj = drag_obj; - sel->format = format; - if (sel->data.mem) free(sel->data.mem); - sel->data = eina_slice_dup(data); - sel->action = action; - seat_sel->drag_obj = drag_obj; - seat_sel->drag_action = action; - seat_sel->xwin = xwin; - - evas_object_event_callback_add(drag_obj, EVAS_CALLBACK_DEL, - _x11_drag_target_del, seat_sel); - /* TODO BUG: should increase dnd-awareness, in case it's drop target as well. See _x11_drag_mouse_up() */ - ecore_x_dnd_aware_set(xwin, EINA_TRUE); - ecore_x_dnd_callback_pos_update_set(_x11_drag_move, seat_sel); - ecore_x_dnd_self_begin(xwin, (unsigned char *)sel, sizeof(Sel_Manager_Selection)); - actx = _x11_dnd_action_rev_map(seat_sel->drag_action); - ecore_x_dnd_source_action_set(actx); - ecore_x_pointer_grab(xwin); - seat_sel->mouse_up_handler = ecore_event_handler_add(ECORE_EVENT_MOUSE_BUTTON_UP, - _x11_drag_mouse_up, seat_sel); - seat_sel->dnd_status_handler = ecore_event_handler_add(ECORE_X_EVENT_XDND_STATUS, - _x11_dnd_status, seat_sel); - seat_sel->drag_win = elm_win_add(NULL, "Elm-Drag", ELM_WIN_DND); - elm_win_alpha_set(seat_sel->drag_win, EINA_TRUE); - elm_win_override_set(seat_sel->drag_win, EINA_TRUE); - xdragwin = _x11_xwin_get(seat_sel->drag_win); - ecore_x_window_ignore_set(xdragwin, 1); - - /* dragwin has to be rotated as the main window is */ - if (elm_widget_is(drag_obj)) - { - Evas_Object *win = elm_widget_top_get(drag_obj); - if (win && efl_isa(win, EFL_UI_WIN_CLASS)) - { - elm_win_rotation_set(seat_sel->drag_win, elm_win_rotation_get(win)); - efl_event_callback_add(win, EFL_UI_WIN_EVENT_WIN_ROTATION_CHANGED, - _x11_win_rotation_changed_cb, seat_sel->drag_win); - } - } - - if (icon_func) - { - Eina_Position2D off; - - icon = icon_func(icon_func_data, seat_sel->drag_win, drag_obj, &off); - if (icon) - { - x2 = off.x; - y2 = off.y; - evas_object_geometry_get(icon, NULL, NULL, &w, &h); - } - } - else - { - icon = elm_icon_add(seat_sel->drag_win); - evas_object_size_hint_weight_set(icon, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); - // need to resize - } - elm_win_resize_object_add(seat_sel->drag_win, icon); - - /* Position subwindow appropriately */ - ee = ecore_evas_ecore_evas_get(evas_object_evas_get(drag_obj)); - ecore_evas_geometry_get(ee, &ex, &ey, &ew, &eh); - evas_object_resize(seat_sel->drag_win, w, h); - - evas_object_show(icon); - evas_object_show(seat_sel->drag_win); - evas_pointer_canvas_xy_get(evas_object_evas_get(drag_obj), &x3, &y3); - - rot = ecore_evas_rotation_get(ee); - switch (rot) - { - case 90: - xr = y3; - yr = ew - x3; - seat_sel->drag_pos.x = y3 - y2; - seat_sel->drag_pos.y = x3 - x2; - break; - case 180: - xr = ew - x3; - yr = eh - y3; - seat_sel->drag_pos.x = x3 - x2; - seat_sel->drag_pos.y = y3 - y2; - break; - case 270: - xr = eh - y3; - yr = x3; - seat_sel->drag_pos.x = y3 - y2; - seat_sel->drag_pos.y = x3 - x2; - break; - default: - xr = x3; - yr = y3; - seat_sel->drag_pos.x = x3 - x2; - seat_sel->drag_pos.y = y3 - y2; - break; - } - x = ex + xr - seat_sel->drag_pos.x; - y = ey + yr - seat_sel->drag_pos.y; - evas_object_move(seat_sel->drag_win, x, y); - seat_sel->drag_win_start = EINA_POSITION2D(x, y); - seat_sel->drag_win_end = EINA_POSITION2D(x, y); -} - -static void -_x11_dnd_dropable_handle(Efl_Ui_Selection_Manager_Data *pd, Sel_Manager_Dropable *dropable, Eina_Position2D pos, Efl_Ui_Selection_Action action) -{ - Sel_Manager_Dropable *d, *last_dropable = NULL; - Eina_List *l; - Eina_Inlist *itr; - - EINA_LIST_FOREACH(pd->drop_list, l, d) - { - if (d->last.in) - { - last_dropable = d; - break; - } - } - if (last_dropable) - { - if (last_dropable == dropable) // same - { - Evas_Coord ox, oy; - Drop_Format *df; - - sel_debug("same obj dropable %p\n", dropable->obj); - evas_object_geometry_get(dropable->obj, &ox, &oy, NULL, NULL); - Efl_Dnd_Drag_Pos pos_data; - if (!dropable->is_container) - { - pos_data.pos = EINA_POSITION2D(pos.x - ox, pos.y - oy); - pos_data.item = NULL; - } - else - { - Eina_Position2D posret = {0, 0}; - Efl_Object *it = NULL; - - if (dropable->item_func) - it = dropable->item_func(dropable->item_func_data, dropable->obj, - pos, &posret); - pos_data.pos = posret; - pos_data.item = it; - } - pos_data.format = dropable->last.format; - pos_data.action = action; - EINA_INLIST_FOREACH_SAFE(dropable->format_list, itr, df) - { - if (df->format & dropable->last.format) - efl_event_callback_call(dropable->obj, EFL_UI_DND_EVENT_DRAG_POS, &pos_data); - } - } - else - { - if (dropable) // leave last obj and enter new one - { - sel_debug("leave %p\n", last_dropable->obj); - sel_debug("enter %p\n", dropable->obj); - last_dropable->last.in = EINA_FALSE; - last_dropable->last.type = NULL; - dropable->last.in = EINA_TRUE; - - Drop_Format *df; - EINA_INLIST_FOREACH_SAFE(dropable->format_list, itr, df) - { - if (df->format &dropable->last.format) - efl_event_callback_call(dropable->obj, EFL_UI_DND_EVENT_DRAG_ENTER, NULL); - } - EINA_INLIST_FOREACH_SAFE(last_dropable->format_list, itr, df) - { - if (df->format & last_dropable->last.format) - efl_event_callback_call(last_dropable->obj, EFL_UI_DND_EVENT_DRAG_LEAVE, NULL); - } - } - else // leave last obj - { - sel_debug("leave %p\n", last_dropable->obj); - last_dropable->last.in = EINA_FALSE; - last_dropable->last.type = NULL; - - Drop_Format *df; - EINA_INLIST_FOREACH_SAFE(last_dropable->format_list, itr, df) - { - if (df->format & last_dropable->last.format) - efl_event_callback_call(last_dropable->obj, EFL_UI_DND_EVENT_DRAG_LEAVE, NULL); - } - } - } - } - else - { - if (dropable) // enter new obj - { - Evas_Coord ox, oy; - - sel_debug("enter %p\n", dropable->obj); - evas_object_geometry_get(dropable->obj, &ox, &oy, NULL, NULL); - dropable->last.in = EINA_TRUE; - - Drop_Format *df; - Efl_Dnd_Drag_Pos pos_data; - if (!dropable->is_container) - { - pos_data.pos = EINA_POSITION2D(pos.x - ox, pos.y - oy); - pos_data.item = NULL; - } - else - { - Eina_Position2D posret = {0, 0}; - Efl_Object *it = NULL; - if (dropable->item_func) - it = dropable->item_func(dropable->item_func_data, dropable->obj, - pos, &posret); - pos_data.pos = posret; - pos_data.item = it; - } - pos_data.format = dropable->last.format; - pos_data.action = action; - EINA_INLIST_FOREACH_SAFE(dropable->format_list, itr, df) - { - if (df->format & dropable->last.format) - { - efl_event_callback_call(dropable->obj, EFL_UI_DND_EVENT_DRAG_ENTER, NULL); - efl_event_callback_call(dropable->obj, EFL_UI_DND_EVENT_DRAG_POS, &pos_data); - } - } - } - else - { - sel_debug("both dropable & last_dropable are null\n"); - } - } -} - -static Sel_Manager_Dropable * -_x11_dropable_find(Efl_Ui_Selection_Manager_Data *pd, Ecore_X_Window win) -{ - Eina_List *l; - Sel_Manager_Dropable *dropable; - - if (!pd->drop_list) return NULL; - EINA_LIST_FOREACH(pd->drop_list, l, dropable) - { - if (_x11_xwin_get(dropable->obj) == win) return dropable; - } - return NULL; -} - -static Evas * -_x11_evas_get_from_xwin(Efl_Ui_Selection_Manager_Data *pd, Ecore_X_Window win) -{ - /* Find the Evas connected to the window */ - Sel_Manager_Dropable *dropable = _x11_dropable_find(pd, win); - return dropable ? evas_object_evas_get(dropable->obj) : NULL; -} - -static Efl_Ui_Selection_Action -_x11_dnd_action_map(Ecore_X_Atom action) -{ - Efl_Ui_Selection_Action act = EFL_UI_SELECTION_ACTION_UNKNOWN; - - if (action == ECORE_X_ATOM_XDND_ACTION_COPY) - act = EFL_UI_SELECTION_ACTION_COPY; - else if (action == ECORE_X_ATOM_XDND_ACTION_MOVE) - act = EFL_UI_SELECTION_ACTION_MOVE; - else if (action == ECORE_X_ATOM_XDND_ACTION_PRIVATE) - act = EFL_UI_SELECTION_ACTION_PRIVATE; - else if (action == ECORE_X_ATOM_XDND_ACTION_ASK) - act = EFL_UI_SELECTION_ACTION_ASK; - else if (action == ECORE_X_ATOM_XDND_ACTION_LIST) - act = EFL_UI_SELECTION_ACTION_LIST; - else if (action == ECORE_X_ATOM_XDND_ACTION_LINK) - act = EFL_UI_SELECTION_ACTION_LINK; - else if (action == ECORE_X_ATOM_XDND_ACTION_DESCRIPTION) - act = EFL_UI_SELECTION_ACTION_DESCRIPTION; - return act; -} - -static Ecore_X_Atom -_x11_dnd_action_rev_map(Efl_Ui_Selection_Action action) -{ - Ecore_X_Atom act = ECORE_X_ATOM_XDND_ACTION_MOVE; - - if (action == EFL_UI_SELECTION_ACTION_COPY) - act = ECORE_X_ATOM_XDND_ACTION_COPY; - else if (action == EFL_UI_SELECTION_ACTION_MOVE) - act = ECORE_X_ATOM_XDND_ACTION_MOVE; - else if (action == EFL_UI_SELECTION_ACTION_PRIVATE) - act = ECORE_X_ATOM_XDND_ACTION_PRIVATE; - else if (action == EFL_UI_SELECTION_ACTION_ASK) - act = ECORE_X_ATOM_XDND_ACTION_ASK; - else if (action == EFL_UI_SELECTION_ACTION_LIST) - act = ECORE_X_ATOM_XDND_ACTION_LIST; - else if (action == EFL_UI_SELECTION_ACTION_LINK) - act = ECORE_X_ATOM_XDND_ACTION_LINK; - else if (action == EFL_UI_SELECTION_ACTION_DESCRIPTION) - act = ECORE_X_ATOM_XDND_ACTION_DESCRIPTION; - return act; -} - -static Eina_Bool -_x11_dnd_enter(void *data, int etype EINA_UNUSED, void *ev) -{ - Sel_Manager_Seat_Selection *seat_sel = data; - Efl_Ui_Selection_Manager_Data *pd = seat_sel->pd; - Ecore_X_Event_Xdnd_Enter *enter = ev; - Sel_Manager_Dropable *dropable; - int i; - - sel_debug("In"); - if (!enter) return EINA_TRUE; - dropable = _x11_dropable_find(pd, enter->win); - if (dropable) - { - sel_debug("Enter %x\n", enter->win); - } - /* Skip it */ - sel_debug("enter types=%p (%d)\n", enter->types, enter->num_types); - if ((!enter->num_types) || (!enter->types)) return EINA_TRUE; - - sel_debug("Types\n"); - seat_sel->saved_types->ntypes = enter->num_types; - free(seat_sel->saved_types->types); - seat_sel->saved_types->types = malloc(sizeof(char *) * enter->num_types); - if (!seat_sel->saved_types->types) return EINA_FALSE; - - for (i = 0; i < enter->num_types; i++) - { - seat_sel->saved_types->types[i] = eina_stringshare_add(enter->types[i]); - sel_debug("Type is %s %p %p\n", enter->types[i], - seat_sel->saved_types->types[i], pd->text_uri); - if (seat_sel->saved_types->types[i] == pd->text_uri) - { - /* Request it, so we know what it is */ - sel_debug("Sending uri request\n"); - seat_sel->saved_types->textreq = 1; - ELM_SAFE_FREE(seat_sel->saved_types->imgfile, free); - ecore_x_selection_xdnd_request(enter->win, pd->text_uri); - } - } - - /* FIXME: Find an object and make it current */ - return EINA_TRUE; -} - -static Eina_Bool -_x11_dnd_position(void *data, int etype EINA_UNUSED, void *ev) -{ - Sel_Manager_Seat_Selection *seat_sel = data; - Efl_Ui_Selection_Manager_Data *pd = seat_sel->pd; - Ecore_X_Event_Xdnd_Position *xpos = ev; - Ecore_X_Rectangle rect = { 0, 0, 0, 0 }; - Sel_Manager_Dropable *dropable; - Efl_Ui_Selection_Action act; - - sel_debug("In"); - /* Need to send a status back */ - /* FIXME: Should check I can drop here */ - /* FIXME: Should highlight widget */ - dropable = _x11_dropable_find(pd, xpos->win); - if (dropable) - { - Evas_Coord ox = 0, oy = 0; - Eina_Position2D pos; - - act = _x11_dnd_action_map(xpos->action); - pos.x = xpos->position.x; - pos.y = xpos->position.y; - _dropable_coords_adjust(dropable, &pos); - Evas *evas = _x11_evas_get_from_xwin(pd, xpos->win); - Eina_List *dropable_list = evas ? _dropable_list_geom_find(pd, evas, pos.x, pos.y) : NULL; - /* check if there is dropable (obj) can accept this drop */ - if (dropable_list) - { - Efl_Ui_Selection_Format saved_format = _dnd_types_to_format(pd, seat_sel->saved_types->types, seat_sel->saved_types->ntypes); - Eina_List *l; - Eina_Bool found = EINA_FALSE; - - EINA_LIST_FOREACH(dropable_list, l, dropable) - { - Drop_Format *df; - Eina_Inlist *itr; - EINA_INLIST_FOREACH_SAFE(dropable->format_list, itr, df) - { - Efl_Ui_Selection_Format common_fmt = saved_format & df->format; - if (common_fmt) - { - //We found a target that can accept this type of data - int i, min_index = SELECTION_N_ATOMS; - //We have to find the first atom that corresponds to one - //of the supported data types. - for (i = 0; i < seat_sel->saved_types->ntypes; i++) - { - Sel_Manager_Atom *atom = eina_hash_find(pd->type_hash, seat_sel->saved_types->types[i]); - if (atom && (atom->format & common_fmt)) - { - int atom_idx = (atom - pd->atom_list); - if (min_index > atom_idx) min_index = atom_idx; - } - } - if (min_index != SELECTION_N_ATOMS) - { - sel_debug("Found atom %s\n", pd->atom_list[min_index].name); - found = EINA_TRUE; - dropable->last.type = pd->atom_list[min_index].name; - dropable->last.format = common_fmt; - break; - } - } - } - if (found) break; - } - if (found) - { - Sel_Manager_Dropable *d = NULL; - Eina_Rectangle inter_rect = {0, 0, 0, 0}; - int idx = 0; - EINA_LIST_FOREACH(dropable_list, l, d) - { - if (idx == 0) - { - evas_object_geometry_get(d->obj, &inter_rect.x, &inter_rect.y, - &inter_rect.w, &inter_rect.h); - } - else - { - Eina_Rectangle cur_rect; - evas_object_geometry_get(d->obj, &cur_rect.x, &cur_rect.y, - &cur_rect.w, &cur_rect.h); - if (!eina_rectangle_intersection(&inter_rect, &cur_rect)) continue; - } - idx++; - } - rect.x = inter_rect.x; - rect.y = inter_rect.y; - rect.width = inter_rect.w; - rect.height = inter_rect.h; - ecore_x_dnd_send_status(EINA_TRUE, EINA_FALSE, rect, xpos->action); - sel_debug("dnd position %i %i %p\n", pos.x - ox, pos.y - oy, dropable); - pos.x = pos.x - ox; - pos.y = pos.y - oy; - _x11_dnd_dropable_handle(pd, dropable, pos, act); - // CCCCCCC: call dnd exit on last obj if obj != last - // CCCCCCC: call drop position on obj - } - else - { - //if not: send false status - ecore_x_dnd_send_status(EINA_FALSE, EINA_FALSE, rect, xpos->action); - sel_debug("dnd position (%d, %d) not in obj\n", pos.x, pos.y); - _x11_dnd_dropable_handle(pd, NULL, EINA_POSITION2D(0, 0), act); - // CCCCCCC: call dnd exit on last obj - } - eina_list_free(dropable_list); - } - else - { - ecore_x_dnd_send_status(EINA_FALSE, EINA_FALSE, rect, xpos->action); - sel_debug("dnd position (%d, %d) has no drop\n", pos.x, pos.y); - _x11_dnd_dropable_handle(pd, NULL, EINA_POSITION2D(0, 0), act); - } - } - else - { - ecore_x_dnd_send_status(EINA_FALSE, EINA_FALSE, rect, xpos->action); - } - return EINA_TRUE; -} - -static Eina_Bool -_x11_dnd_leave(void *data, int etype EINA_UNUSED, void *ev) -{ - Sel_Manager_Seat_Selection *seat_sel = data; - Eina_Position2D pos = {0, 0}; -#ifdef DEBUGON - sel_debug("Leave %x\n", ((Ecore_X_Event_Xdnd_Leave *)ev)->win); -#else - (void)ev; -#endif - _x11_dnd_dropable_handle(seat_sel->pd, NULL, pos, EFL_UI_SELECTION_ACTION_UNKNOWN); - // CCCCCCC: call dnd exit on last obj if there was one - // leave->win leave->source - return EINA_TRUE; -} - -static Eina_Bool -_x11_dnd_drop(void *data, int etype EINA_UNUSED, void *ev) -{ - sel_debug("In"); - Sel_Manager_Seat_Selection *seat_sel = data; - Efl_Ui_Selection_Manager_Data *pd = seat_sel->pd; - Ecore_X_Event_Xdnd_Drop *drop; - Sel_Manager_Dropable *dropable = NULL; - Evas_Coord x = 0, y = 0; - Efl_Ui_Selection_Action act = EFL_UI_SELECTION_ACTION_UNKNOWN; - Eina_List *l; - Sel_Manager_Selection *sel; - - drop = ev; - sel_debug("drop_list %p (%d)\n", pd->drop_list, eina_list_count(pd->drop_list)); - if (!(dropable = _x11_dropable_find(pd, drop->win))) return EINA_TRUE; - - /* Calculate real (widget relative) position */ - // - window position - // - widget position - seat_sel->saved_types->pos = EINA_POSITION2D(drop->position.x, drop->position.y); - _dropable_coords_adjust(dropable, &seat_sel->saved_types->pos); - - sel_debug("Drop position is %d,%d\n", seat_sel->saved_types->pos.x, seat_sel->saved_types->pos.y); - - EINA_LIST_FOREACH(pd->drop_list, l, dropable) - { - if (dropable->last.in) - { - evas_object_geometry_get(dropable->obj, &x, &y, NULL, NULL); - seat_sel->saved_types->pos.x -= x; - seat_sel->saved_types->pos.y -= y; - goto found; - } - } - - sel_debug("Didn't find a target\n"); - return EINA_TRUE; - -found: - sel_debug("0x%x\n", drop->win); - - act = _x11_dnd_action_map(drop->action); - - dropable->last.in = EINA_FALSE; - sel_debug("Last type: %s - Last format: %X\n", dropable->last.type, dropable->last.format); -#if 0 // this seems to be broken and causes dnd to stop working e.g. to/from - // rage even though iut used to work fine. - Efl_Ui_Selection_Data ddata; - Eina_Inlist *itr; - if ((!strcmp(dropable->last.type, pd->text_uri))) - { - sel_debug("We found a URI... (%scached) %s\n", - seat_sel->saved_types->imgfile ? "" : "not ", - seat_sel->saved_types->imgfile); - if (seat_sel->saved_types->imgfile) - { - Drop_Format *df; - - if (!dropable->is_container) - { - ddata.pos = seat_sel->saved_types->pos; - ddata.item = NULL; - } - else - { - //for container - Efl_Object *it = NULL; - Evas_Coord x0 = 0, y0 = 0; - Eina_Position2D pos, posret = {0, 0}; - - evas_object_geometry_get(dropable->obj, &x0, &y0, NULL, NULL); - pos = EINA_POSITION2D(seat_sel->saved_types->pos.x + x0, - seat_sel->saved_types->pos.y + y0); - if (dropable->item_func) - it = dropable->item_func(dropable->item_func_data, dropable->obj, - pos, &posret); - ddata.pos = posret; - ddata.item = it; - } - ddata.action = act; - - EINA_INLIST_FOREACH_SAFE(dropable->format_list, itr, df) - { - if (df->format & EFL_UI_SELECTION_FORMAT_IMAGE) - { - sel_debug("Doing image insert (%s)\n", seat_sel->saved_types->imgfile); - ddata.format = EFL_UI_SELECTION_FORMAT_IMAGE; - ddata.content.mem = (char *)seat_sel->saved_types->imgfile; - ddata.content.len = strlen(ddata.content.mem); - if (df->format & dropable->last.format) - efl_event_callback_call(dropable->obj, EFL_UI_DND_EVENT_DRAG_DROP, &ddata); - } - else - { - sel_debug("Item doesn't support images... passing\n"); - } - } - ecore_x_dnd_send_finished(); - ELM_SAFE_FREE(seat_sel->saved_types->imgfile, free); - return EINA_TRUE; - } - else if (seat_sel->saved_types->textreq) - { - /* Already asked: Pretend we asked now, and paste immediately when - * it comes in */ - seat_sel->saved_types->textreq = 0; - ecore_x_dnd_send_finished(); - return EINA_TRUE; - } - } -#endif - sel = seat_sel->sel_list + EFL_UI_SELECTION_TYPE_DND; - sel_debug("doing a request then: %s\n", dropable->last.type); - sel->xwin = drop->win; - sel->request_obj = dropable->obj; - sel->request_format = dropable->last.format; - sel->active = EINA_TRUE; - sel->action = act; - sel->asked++; - ecore_x_selection_xdnd_request(drop->win, dropable->last.type); - - return EINA_TRUE; -} - -static Eina_Bool -_x11_sel_manager_drop_target_add(Efl_Ui_Selection_Manager_Data *pd, Efl_Object *target_obj, - Efl_Ui_Selection_Format format, Ecore_X_Window xwin, - unsigned int seat) -{ - Sel_Manager_Dropable *dropable = NULL; - Eina_List *l; - Eina_Bool have_drop_list = EINA_FALSE; - Sel_Manager_Seat_Selection *seat_sel = NULL; - - /* Is this the first? */ - EINA_LIST_FOREACH(pd->drop_list, l, dropable) - { - if (xwin == _x11_xwin_get(dropable->obj)) - { - have_drop_list = EINA_TRUE; - break; - } - } - dropable = NULL; // In case of error, we don't want to free it - - - Drop_Format *df = calloc(1, sizeof(Drop_Format)); - if (!df) return EINA_FALSE; - df->format = format; - - dropable = efl_key_data_get(target_obj, "__elm_dropable"); - if (!dropable) - { - /* Create new drop */ - dropable = calloc(1, sizeof(Sel_Manager_Dropable)); - if (!dropable) goto error; - dropable->last.in = EINA_FALSE; - pd->drop_list = eina_list_append(pd->drop_list, dropable); - if (!pd->drop_list) goto error; - dropable->obj = target_obj; - efl_key_data_set(target_obj, "__elm_dropable", dropable); - } - dropable->format_list = eina_inlist_append(dropable->format_list, EINA_INLIST_GET(df)); - dropable->seat = seat; - - evas_object_event_callback_add(target_obj, EVAS_CALLBACK_DEL, - _all_drop_targets_cbs_del, pd); - if (!have_drop_list) ecore_x_dnd_aware_set(xwin, EINA_TRUE); - - seat_sel = _x11_sel_manager_seat_selection_init(pd, seat); - - if (seat_sel->enter_handler) return EINA_TRUE; - sel_debug("Adding drop target calls xwin=%#llx", (unsigned long long)xwin); - seat_sel->enter_handler = ecore_event_handler_add(ECORE_X_EVENT_XDND_ENTER, - _x11_dnd_enter, seat_sel); - seat_sel->leave_handler = ecore_event_handler_add(ECORE_X_EVENT_XDND_LEAVE, - _x11_dnd_leave, seat_sel); - seat_sel->pos_handler = ecore_event_handler_add(ECORE_X_EVENT_XDND_POSITION, - _x11_dnd_position, seat_sel); - seat_sel->drop_handler = ecore_event_handler_add(ECORE_X_EVENT_XDND_DROP, - _x11_dnd_drop, seat_sel); - return EINA_TRUE; -error: - free(df); - free(dropable); - return EINA_FALSE; -} - -#endif - -//Wayland -#ifdef HAVE_ELEMENTARY_WL2 -static Sel_Manager_Seat_Selection * -_wl_sel_manager_seat_selection_init(Efl_Ui_Selection_Manager_Data *pd, unsigned int seat) -{ - Sel_Manager_Seat_Selection *seat_sel = NULL; - Eina_List *l = NULL; - - EINA_LIST_FOREACH(pd->seat_list, l, seat_sel) - { - if(seat_sel->seat == seat) - break; - } - if (!seat_sel) - { - seat_sel = calloc(1, sizeof(Sel_Manager_Seat_Selection)); - if (!seat_sel) - { - ERR("Failed to allocate seat"); - return NULL; - } - seat_sel->saved_types = calloc(1, sizeof(Saved_Type)); - seat_sel->seat = seat; - seat_sel->pd = pd; - pd->seat_list = eina_list_append(pd->seat_list, seat_sel); - } - if (!seat_sel->sel) - { - Sel_Manager_Selection *sel = calloc(1, sizeof(Sel_Manager_Selection)); - if (!sel) - { - ERR("failed to allocate selection"); - return NULL; - } - sel->seat_sel = seat_sel; - seat_sel->sel = sel; - } - - return seat_sel; -} - -static void -_wl_drag_source_del(void *data, Evas *evas EINA_UNUSED, Evas_Object *obj, void *event EINA_UNUSED) -{ - Sel_Manager_Seat_Selection *seat_sel = data; - if (seat_sel->drag_obj == obj) - seat_sel->drag_obj = NULL; -} - -static void -_wl_efl_sel_manager_drag_start(Eo *obj EINA_UNUSED, Efl_Ui_Selection_Manager_Data *pd, Efl_Object *drag_obj, - Efl_Ui_Selection_Format format, Eina_Slice data, - Efl_Ui_Selection_Action action, void *icon_func_data, - Efl_Dnd_Drag_Icon_Create icon_func, Eina_Free_Cb icon_func_free_cb EINA_UNUSED, - Ecore_Wl2_Window *win, unsigned int seat) -{ - Ecore_Evas *ee; - Evas_Object *icon = NULL; - int x, y, x2 = 0, y2 = 0, x3, y3, w = 0, h = 0; - const char *types[SELECTION_N_ATOMS + 1]; - int i, nb_types = 0; - Ecore_Wl2_Window *parent = NULL; - Sel_Manager_Seat_Selection *seat_sel; - Sel_Manager_Selection *sel; - - sel_debug("In"); - seat_sel = _wl_sel_manager_seat_selection_init(pd, seat); - if (!seat_sel) return; - seat_sel->active_type = EFL_UI_SELECTION_TYPE_DND; - sel = seat_sel->sel; - - sel_debug("checking drag_win: %p", seat_sel->drag_win); - /* if we already have a drag, get out */ - if (seat_sel->drag_win) return; - - for (i = SELECTION_ATOM_LISTING_ATOMS + 1; i < SELECTION_N_ATOMS; i++) - { - if (format == EFL_UI_SELECTION_FORMAT_TARGETS || (pd->atom_list[i].format & format)) - { - types[nb_types++] = pd->atom_list[i].name; - sel_debug("set dnd type: %s\n", pd->atom_list[i].name); - } - } - types[nb_types] = NULL; - - ecore_wl2_dnd_drag_types_set(_wl_seat_get(win, drag_obj, seat), types); - - /* set the drag data used when a drop occurs */ - free(sel->data.mem); - sel->data.len = 0; - sel->data = eina_slice_dup(data); - - /* setup callback to notify if this object gets deleted */ - evas_object_event_callback_add(drag_obj, EVAS_CALLBACK_DEL, - _wl_drag_source_del, sel); - - seat_sel->drag_obj = drag_obj; - seat_sel->drag_action = action; - - seat_sel->drag_win = elm_win_add(NULL, "Elm-Drag", ELM_WIN_DND); - elm_win_alpha_set(seat_sel->drag_win, EINA_TRUE); - elm_win_borderless_set(seat_sel->drag_win, EINA_TRUE); - elm_win_override_set(seat_sel->drag_win, EINA_TRUE); - - win = elm_win_wl_window_get(seat_sel->drag_win); - - if (icon_func) - { - Eina_Position2D off; - - icon = icon_func(icon_func_data, seat_sel->drag_win, drag_obj, &off); - if (icon) - { - x2 = off.x; - y2 = off.y; - evas_object_geometry_get(icon, NULL, NULL, &w, &h); - } - } - else - { - icon = elm_icon_add(seat_sel->drag_win); - evas_object_size_hint_weight_set(icon, EVAS_HINT_EXPAND, - EVAS_HINT_EXPAND); - } - - elm_win_resize_object_add(seat_sel->drag_win, icon); - evas_object_show(icon); - - /* Position subwindow appropriately */ - ee = ecore_evas_ecore_evas_get(evas_object_evas_get(drag_obj)); - ecore_evas_geometry_get(ee, &x, &y, NULL, NULL); - x += x2; - y += y2; - seat_sel->drag_win_start.x = seat_sel->drag_win_end.x = x; - seat_sel->drag_win_start.y = seat_sel->drag_win_end.y = y; - - evas_object_geometry_set(seat_sel->drag_win, x, y, w, h); - evas_object_show(seat_sel->drag_win); - - evas_pointer_canvas_xy_get(evas_object_evas_get(drag_obj), &x3, &y3); - seat_sel->drag_pos.x = x3 - x2; - seat_sel->drag_pos.y = y3 - y2; - - if (elm_widget_is(drag_obj)) - { - Evas_Object *top; - - top = elm_widget_top_get(drag_obj); - if (!top) top = elm_widget_top_get(elm_widget_parent_widget_get(drag_obj)); - if (top && (efl_isa(top, EFL_UI_WIN_CLASS))) - parent = elm_win_wl_window_get(top); - } - if (!parent) - { - Evas *evas; - - if (!(evas = evas_object_evas_get(drag_obj))) - return; - if (!(ee = ecore_evas_ecore_evas_get(evas))) - return; - - parent = ecore_evas_wayland2_window_get(ee); - } - - sel->drag_serial = ecore_wl2_dnd_drag_start(_wl_seat_get(win, drag_obj, seat), parent, win); -} - -static Eina_Bool -_wl_is_uri_type_data(const char *data, int len) -{ - char *p; - if (len < 6) return EINA_FALSE; - - p = (char *)data; - if (!p) return EINA_FALSE; - if (strncmp(p, "file:/", 6)) - { - if (*p != '/') return EINA_FALSE; - } - return EINA_TRUE; -} - -static Efl_Ui_Selection_Action -_wl_to_elm(Ecore_Wl2_Drag_Action action) -{ - #define CONV(wl, elm) if (action == wl) return elm; - CONV(ECORE_WL2_DRAG_ACTION_COPY, EFL_UI_SELECTION_ACTION_COPY); - CONV(ECORE_WL2_DRAG_ACTION_MOVE, EFL_UI_SELECTION_ACTION_MOVE); - CONV(ECORE_WL2_DRAG_ACTION_ASK, EFL_UI_SELECTION_ACTION_ASK); - #undef CONV - return EFL_UI_SELECTION_ACTION_UNKNOWN; -} - -static Eina_Bool -_wl_targets_converter(char *target, Sel_Manager_Selection *sel, void *data EINA_UNUSED, int size EINA_UNUSED, void **data_ret, int *size_ret) -{ - sel_debug("in\n"); - if (!data_ret) return EINA_FALSE; - - const char *sep = "\n"; - char *aret; - int len = 0; - int i = 0; - Sel_Manager_Seat_Selection *seat_sel = sel->seat_sel; - Efl_Ui_Selection_Manager_Data *pd = seat_sel->pd; - Efl_Ui_Selection_Format format = EFL_UI_SELECTION_FORMAT_NONE; - Eina_Bool is_uri = EINA_FALSE; - - if (sel->format) - { - format = sel->format; - is_uri = _wl_is_uri_type_data(sel->data.mem, sel->data.len); - } - else - { - Sel_Manager_Atom *atom = eina_hash_find(pd->type_hash, target); - if (atom) - format = atom->format; - } - for (i = 0; i < SELECTION_N_ATOMS; i++) - { - if (format & pd->atom_list[i].format) - { - if ((is_uri) || - ((!is_uri) && strcmp(pd->atom_list[i].name, "text/uri-list"))) - len += strlen(pd->atom_list[i].name) + strlen(sep); - } - } - len++; //terminating null byte - aret = calloc(1, len * sizeof(char)); - if (!aret) return EINA_FALSE; - for (i = 0; i < SELECTION_N_ATOMS; i++) - { - if (format & pd->atom_list[i].format) - { - if ((is_uri) || - ((!is_uri) && strcmp(pd->atom_list[i].name, "text/uri-list"))) - { - aret = strcat(aret, pd->atom_list[i].name); - aret = strcat(aret, sep); - } - } - } - *data_ret = aret; - if (size_ret) *size_ret = len; - - return EINA_TRUE; -} - -static Eina_Bool -_wl_general_converter(char *target, Sel_Manager_Selection *sel, void *data, int size, void **data_ret, int *size_ret) -{ - Efl_Ui_Selection_Format format = EFL_UI_SELECTION_FORMAT_NONE; - Sel_Manager_Atom *atom = NULL; - Sel_Manager_Seat_Selection *seat_sel = sel->seat_sel; - Efl_Ui_Selection_Manager_Data *pd = seat_sel->pd; - - sel_debug("in\n"); - - atom = eina_hash_find(pd->type_hash, target); - if (atom) - format = atom->format; - if (format == EFL_UI_SELECTION_FORMAT_NONE) - { - if (data_ret) - { - *data_ret = malloc(size * sizeof(char) + 1); - if (!*data_ret) return EINA_FALSE; - memcpy(*data_ret, data, size); - ((char**)(data_ret))[0][size] = 0; - } - if (size_ret) *size_ret = size; - } - else - { - if ((data) && (size > 0)) - { - char *tmp = malloc(size); - if (tmp) - { - memcpy(tmp, data, size); - if (data_ret) *data_ret = tmp; - if (size_ret) *size_ret = size; - if (!data_ret) free(tmp); - } - } - else - { - if (data_ret) *data_ret = NULL; - if (size_ret) *size_ret = 0; - } - } - - return EINA_TRUE; -} - -static Eina_Bool -_wl_text_converter(char *target, Sel_Manager_Selection *sel, void *data, int size, void **data_ret, int *size_ret) -{ - Efl_Ui_Selection_Format format = EFL_UI_SELECTION_FORMAT_NONE; - Sel_Manager_Atom *atom = NULL; - Sel_Manager_Seat_Selection *seat_sel = sel->seat_sel; - Efl_Ui_Selection_Manager_Data *pd = seat_sel->pd; - - sel_debug("in\n"); - - atom = eina_hash_find(pd->type_hash, target); - if (atom) - format = atom->format; - if (format == EFL_UI_SELECTION_FORMAT_NONE) - { - if (data_ret) - { - *data_ret = malloc(size * sizeof(char) + 1); - if (!*data_ret) return EINA_FALSE; - memcpy(*data_ret, data, size); - ((char**)(data_ret))[0][size] = 0; - if (size_ret) *size_ret = size; - return EINA_TRUE; - } - } - else if ((format & EFL_UI_SELECTION_FORMAT_MARKUP) || - (format & EFL_UI_SELECTION_FORMAT_HTML)) - { - char *tmp = malloc(size + 1); - if (tmp) - { - strncpy(tmp, data, size); - tmp[size] = 0; - *data_ret = _elm_util_mkup_to_text(tmp); - if (size_ret && *data_ret) *size_ret = strlen(*data_ret); - free(tmp); - } - else return EINA_FALSE; - } - else if (format & EFL_UI_SELECTION_FORMAT_TEXT) - { - char *tmp = malloc(size + 1); - if (tmp) - { - strncpy(tmp, data, size); - tmp[size] = 0; - *data_ret = tmp; - if (size_ret && *data_ret) *size_ret = strlen(*data_ret); - } - else return EINA_FALSE; - } - else if (format & EFL_UI_SELECTION_FORMAT_IMAGE) - { - sel_debug("Image %s\n", evas_object_type_get(sel->request_obj)); - efl_file_simple_get(sel->request_obj, (const char **)data_ret, NULL); - if (!*data_ret) *data_ret = strdup("No file"); - else *data_ret = strdup(*data_ret); - - if (!*data_ret) - { - ERR("Failed to allocate memory!"); - *size_ret = 0; - return EINA_FALSE; - } - - if (size_ret) *size_ret = strlen(*data_ret); - } - return EINA_TRUE; -} - -static void -_wl_sel_obj_del(void *data, Evas *e EINA_UNUSED, Evas_Object *obj, void *event_info EINA_UNUSED) -{ - Sel_Manager_Selection *sel = data; - if (sel->owner == obj) - { - sel->owner = NULL; - } - //if (dragwidget == obj) dragwidget = NULL; -} - -static Eina_Future * -_wl_efl_sel_manager_selection_set(Efl_Ui_Selection_Manager_Data *pd, - Efl_Object *owner, Efl_Ui_Selection_Type type, - Efl_Ui_Selection_Format format, - Eina_Slice data, - Ecore_Wl2_Window *win, - unsigned int seat) -{ - Sel_Manager_Seat_Selection *seat_sel; - Sel_Manager_Selection *sel; - int i = 0, count = 0; - Eina_Bool is_uri = EINA_FALSE; - const char **types; - - if ((!data.mem) && (format != EFL_UI_SELECTION_FORMAT_IMAGE)) - { - efl_ui_selection_manager_selection_clear(pd->sel_man, owner, type, seat); - return NULL; - } - - if (data.len <= 0) - return NULL; - - seat_sel = _wl_sel_manager_seat_selection_init(pd, seat); - seat_sel->active_type = type; - sel = seat_sel->sel; - - if (sel->owner != owner) - { - Eina_List *l, *l_next; - Sel_Manager_Selection_Lost *sel_lost; - - EINA_LIST_FOREACH_SAFE(seat_sel->sel_lost_list, l, l_next, sel_lost) - { - if ((sel_lost->request == sel->owner) && - (sel_lost->type == type)) - { - eina_promise_resolve(sel_lost->promise, eina_value_uint_init(sel_lost->type)); - } - } - } - - if (sel->owner) - evas_object_event_callback_del_full(sel->owner, EVAS_CALLBACK_DEL, - _wl_sel_obj_del, sel); - sel->active = EINA_TRUE; - sel->owner = owner; - sel->win = win; - /* sel->set(win, &selection, sizeof(Elm_Sel_Type)); */ - sel->format = format; - - evas_object_event_callback_add - (sel->owner, EVAS_CALLBACK_DEL, _wl_sel_obj_del, &sel); - - sel->data = eina_slice_dup(data); - if (!sel->data.mem) - { - efl_ui_selection_manager_selection_clear(pd->sel_man, owner, type, seat_sel->seat); - return NULL; - } - - is_uri = _wl_is_uri_type_data(sel->data.mem, sel->data.len); - types = malloc(sizeof(char *)); - if (!types) return NULL; - for (i = 0, count = 1; i < SELECTION_N_ATOMS; i++) - { - if (format & pd->atom_list[i].format) - { - if ((is_uri) || - ((!is_uri) && strcmp(pd->atom_list[i].name, "text/uri-list"))) - { - const char **t = NULL; - - types[count - 1] = pd->atom_list[i].name; - count++; - t = realloc(types, sizeof(char *) * count); - if (!t) - { - free(types); - return NULL; - } - types = t; - } - } - } - types[count - 1] = 0; - - sel->selection_serial = ecore_wl2_dnd_selection_set(_wl_seat_get(win, owner, seat_sel->seat), types); - DBG("serial: %d", sel->selection_serial); - - free(types); - //return _local_elm_cnp_selection_set(obj, selection, format, buf, buflen); - - return _update_sel_lost_list(owner, type, seat_sel); -} - -static void -_wl_selection_changed_free(void *data, void *ev) -{ - ecore_wl2_display_disconnect(data); - - free(ev); -} - -static Eina_Bool -_wl_selection_changed(void *data, int type EINA_UNUSED, void *event) -{ - Efl_Ui_Selection_Manager_Data *pd = data; - Elm_Cnp_Event_Selection_Changed *_e; - Sel_Manager_Seat_Selection *seat_sel; - Sel_Manager_Selection *sel; - Efl_Ui_Selection_Changed e; - Ecore_Wl2_Event_Seat_Selection *ev = event; - Ecore_Wl2_Input *seat; - - seat_sel = _wl_sel_manager_seat_selection_init(pd, ev->seat); - sel_debug("seat: %d", ev->seat); - if (!seat_sel) return ECORE_CALLBACK_RENEW; - sel = seat_sel->sel; - - seat = ecore_wl2_display_input_find(ev->display, ev->seat); - EINA_SAFETY_ON_NULL_RETURN_VAL(seat, ECORE_CALLBACK_RENEW); - e.type = EFL_UI_SELECTION_TYPE_CLIPBOARD; - e.seat = ev->seat; - /* connect again to add ref */ - e.display = ecore_wl2_display_connect(ecore_wl2_display_name_get(ev->display)); - e.exist = !!ecore_wl2_dnd_selection_get(seat); - - _e = calloc(1, sizeof(Elm_Cnp_Event_Selection_Changed)); - EINA_SAFETY_ON_NULL_RETURN_VAL(_e, ECORE_CALLBACK_RENEW); - _e->type = e.type; - _e->seat_id = e.seat; - _e->display = e.display; - _e->exists = e.exist; - - ecore_event_add(ELM_CNP_EVENT_SELECTION_CHANGED, _e, _wl_selection_changed_free, ev->display); - efl_event_callback_call(sel->request_obj, EFL_UI_SELECTION_EVENT_WM_SELECTION_CHANGED, &e); - - return ECORE_CALLBACK_RENEW; -} - -static Eina_Bool -_wl_selection_send(void *data, int type EINA_UNUSED, void *event) -{ - Efl_Ui_Selection_Manager_Data *pd = data; - char *buf; - int ret, len_remained; - int len_written = 0; - Ecore_Wl2_Event_Data_Source_Send *ev; - int seat; - Sel_Manager_Seat_Selection *seat_sel; - Sel_Manager_Selection *sel; - void *data_ret = NULL; - int len_ret = 0; - int i = 0; - - ev = event; - seat = ev->seat; - sel_debug("seat: %d, type: %d", seat, type); - seat_sel = _wl_sel_manager_seat_selection_init(pd, seat); - if (!seat_sel) return ECORE_CALLBACK_RENEW; - sel = seat_sel->sel; - - if ((ev->serial != sel->selection_serial) && - (ev->serial != sel->drag_serial)) - return ECORE_CALLBACK_RENEW; - - for (i = 0; i < SELECTION_N_ATOMS; i++) - { - if (!strcmp(pd->atom_list[i].name, ev->type)) - { - sel_debug("Found a type: %s\n", pd->atom_list[i].name); - Sel_Manager_Dropable *drop; - drop = efl_key_data_get(sel->request_obj, "__elm_dropable"); - if (drop) - drop->last.type = pd->atom_list[i].name; - if (pd->atom_list[i].wl_converter) - { - pd->atom_list[i].wl_converter(ev->type, sel, sel->data.mem, - sel->data.len, &data_ret, &len_ret); - } - else - { - data_ret = eina_memdup(sel->data.mem, sel->data.len, 0); - len_ret = sel->data.len; - } - break; - } - } - - len_remained = len_ret; - buf = data_ret; - - while (len_written < len_ret) - { - ret = write(ev->fd, buf, len_remained); - if (ret == -1) break; - buf += ret; - len_written += ret; - len_remained -= ret; - } - free(data_ret); - - close(ev->fd); - ecore_wl2_display_flush(ev->display); - return ECORE_CALLBACK_PASS_ON; -} - -static Eina_Bool -_wl_dnd_end(void *data, int type EINA_UNUSED, void *event) -{ - sel_debug("In"); - Efl_Ui_Selection_Manager_Data *pd = data; - Ecore_Wl2_Event_Data_Source_End *ev; - Sel_Manager_Seat_Selection *seat_sel; - Sel_Manager_Selection *sel; - - ev = event; - seat_sel = _wl_sel_manager_seat_selection_init(pd, ev->seat); - sel = seat_sel->sel; - if (ev->serial != sel->drag_serial) - return ECORE_CALLBACK_RENEW; - - if (seat_sel->active_type != EFL_UI_SELECTION_TYPE_DND) - return ECORE_CALLBACK_RENEW; - - efl_event_callback_call(seat_sel->drag_obj, EFL_UI_DND_EVENT_DRAG_DONE, NULL); - if (seat_sel->drag_win) - { - if (!seat_sel->accept) - { - /* Commit animation when drag cancelled */ - /* Record final position of dragwin, then do animation */ - ecore_evas_animator_timeline_add(seat_sel->drag_win, 0.3, _drag_cancel_animate, seat_sel); - } - else - { - /* No animation drop was committed */ - evas_object_del(seat_sel->drag_win); - seat_sel->drag_win = NULL; - } - } - - seat_sel->accept = EINA_FALSE; - - ecore_wl2_display_flush(ev->display); - return ECORE_CALLBACK_PASS_ON; -} - -static Ecore_Wl2_Input * -_wl_seat_get(Ecore_Wl2_Window *win, Evas_Object *obj, unsigned int seat_id) -{ - Eo *seat, *parent2, *ewin; - Ecore_Wl2_Input *input = NULL; - - input = ecore_wl2_display_input_find(ecore_wl2_window_display_get(win), seat_id); - if (input) return input; - - if (obj) - { - // FIXME (there might be a better solution): - // In case of inwin, we want to use the main wl2 window for cnp, but obj - // obj belongs to the buffer canvas, so the default seat for obj does not - // match the window win. - Eo *top = elm_widget_top_get(obj); - if (efl_isa(top, EFL_UI_WIN_INLINED_CLASS)) - { - parent2 = efl_ui_win_inlined_parent_get(top); - if (parent2) obj = elm_widget_top_get(parent2) ?: parent2; - } - /* fake win means canvas seat id will not match protocol seat id */ - ewin = elm_win_get(obj); - if (elm_win_type_get(ewin) == ELM_WIN_FAKE) obj = NULL; - } - - if (!obj) - { - Eina_Iterator *it; - it = ecore_wl2_display_inputs_get(ecore_wl2_window_display_get(win)); - EINA_ITERATOR_FOREACH(it, input) break; - eina_iterator_free(it); - return input; - } - - seat = evas_default_device_get(evas_object_evas_get(obj), EFL_INPUT_DEVICE_TYPE_SEAT); - EINA_SAFETY_ON_NULL_RETURN_VAL(seat, NULL); - return ecore_wl2_display_input_find(ecore_wl2_window_display_get(win), - evas_device_seat_id_get(seat)); -} - -Ecore_Wl2_Window * -_wl_window_get(const Evas_Object *obj) -{ - Evas_Object *top; - Ecore_Wl2_Window *win = NULL; - - if (elm_widget_is(obj)) - { - top = elm_widget_top_get(obj); - if (!top) top = elm_widget_top_get(elm_widget_parent_widget_get(obj)); - if (top && (efl_isa(top, EFL_UI_WIN_CLASS))) - win = elm_win_wl_window_get(top); - } - if (!win) - { - Ecore_Evas *ee; - Evas *evas; - const char *engine_name; - - if (!(evas = evas_object_evas_get(obj))) - return NULL; - if (!(ee = ecore_evas_ecore_evas_get(evas))) - return NULL; - - engine_name = ecore_evas_engine_name_get(ee); - if (!strcmp(engine_name, ELM_BUFFER)) - { - ee = ecore_evas_buffer_ecore_evas_parent_get(ee); - if (!ee) return NULL; - engine_name = ecore_evas_engine_name_get(ee); - } - if (!strncmp(engine_name, "wayland", sizeof("wayland") - 1)) - { - /* In case the engine is not a buffer, we want to check once. */ - win = ecore_evas_wayland2_window_get(ee); - if (!win) return NULL; - } - } - - return win; -} - -static void -_wl_selection_receive_timeout(void *data, Evas *e EINA_UNUSED, Evas_Object *obj, void *event_info EINA_UNUSED) -{ - Sel_Manager_Selection *sel = data; - - if (sel->request_obj != obj) return; - - ecore_event_handler_del(sel->offer_handler); -} - -static Eina_Bool -_wl_selection_receive(void *data, int type EINA_UNUSED, void *event) -{ - Ecore_Wl2_Event_Offer_Data_Ready *ev = event; - Sel_Manager_Selection *sel = data; - - if (sel->sel_offer != ev->offer) return ECORE_CALLBACK_PASS_ON; - - if (sel->data_func) - { - Efl_Ui_Selection_Data sel_data; - - sel_data.pos.x = sel_data.pos.y = 0; - if (((sel->format & EFL_UI_SELECTION_FORMAT_MARKUP) || - (sel->format & EFL_UI_SELECTION_FORMAT_HTML)) && - (sel->want_format == EFL_UI_SELECTION_FORMAT_TEXT)) - { - char *tmp = malloc(ev->len + 1); - sel_data.format = sel->format; - sel_data.content.mem = NULL; - sel_data.content.len = 0; - if (tmp) - { - sel_data.format = sel->want_format; - strncpy(tmp, ev->data, ev->len); - tmp[ev->len] = 0; - sel_data.content.mem = _elm_util_mkup_to_text(tmp); - if (sel_data.content.mem) - sel_data.content.len = strlen(sel_data.content.mem); - free(tmp); - } - } - else - { - sel_data.format = sel->format; - sel_data.content.mem = ev->data; - sel_data.content.len = ev->len; - } - sel_data.action = _wl_to_elm(ecore_wl2_offer_action_get(sel->sel_offer)); - sel->data_func(sel->data_func_data, - sel->request_obj, - &sel_data); - } - else - { - char *stripstr, *mkupstr; - - stripstr = malloc(ev->len + 1); - if (!stripstr) return ECORE_CALLBACK_CANCEL; - strncpy(stripstr, (char *)ev->data, ev->len); - stripstr[ev->len] = '\0'; - mkupstr = _elm_util_text_to_mkup((const char *)stripstr); - /* TODO BUG: should never NEVER assume it's an elm_entry! */ - _elm_entry_entry_paste(sel->request_obj, mkupstr); - free(stripstr); - free(mkupstr); - } - - evas_object_event_callback_del_full(sel->request_obj, - EVAS_CALLBACK_DEL, - _wl_selection_receive_timeout, sel); - - ecore_event_handler_del(sel->offer_handler); - return ECORE_CALLBACK_CANCEL; -} - -static Eina_Bool -_wl_efl_sel_manager_selection_get(const Efl_Object *request, Efl_Ui_Selection_Manager_Data *pd, - Efl_Ui_Selection_Type type, Efl_Ui_Selection_Format format, - void *data_func_data, Efl_Ui_Selection_Data_Ready data_func, Eina_Free_Cb data_func_free_cb, - Ecore_Wl2_Window *win, unsigned int seat) -{ - sel_debug("In, format: %d", format); - Sel_Manager_Seat_Selection *seat_sel; - Sel_Manager_Selection *sel; - Ecore_Wl2_Input *input; - Ecore_Wl2_Offer *offer; - int i = 0; - - if (type == EFL_UI_SELECTION_TYPE_DND) return EINA_FALSE; - - //if (sel->active) - //return _local_elm_cnp_selection_get(obj, selection, format, datacb, udata); - seat_sel = _sel_manager_seat_selection_init(pd, seat); - sel = seat_sel->sel; - sel->request_obj = (Efl_Object *)request; - sel->data_func_data = data_func_data; - sel->data_func = data_func; - sel->data_func_free_cb = data_func_free_cb; - - input = _wl_seat_get(win, (Efl_Object *)request, seat_sel->seat); - offer = ecore_wl2_dnd_selection_get(input); - - //there can be no selection available - if (!offer) return EINA_FALSE; - - for (i = 0; sm_wl_convertion[i].translates; i++) - { - int j = 0; -// if (!(format & sm_wl_convertion[i].format)) continue; - - for (j = 0; sm_wl_convertion[i].translates[j]; j++) - { - if (!ecore_wl2_offer_supports_mime(offer, sm_wl_convertion[i].translates[j])) continue; - - //we have found matching mimetypes - sel->sel_offer = offer; - sel->format = sm_wl_convertion[i].format; - sel->want_format = format; - - sel_debug("request type: %s", (char *)sm_wl_convertion[i].translates[j]); - evas_object_event_callback_add(sel->request_obj, EVAS_CALLBACK_DEL, - _wl_selection_receive_timeout, sel); - sel->offer_handler = ecore_event_handler_add(ECORE_WL2_EVENT_OFFER_DATA_READY, - _wl_selection_receive, sel); - - ecore_wl2_offer_receive(offer, (char*)sm_wl_convertion[i].translates[j]); - ecore_wl2_display_flush(ecore_wl2_input_display_get(input)); - return EINA_TRUE; - } - } - - sel_debug("no type match"); - return EINA_FALSE; -} - -static void -_wl_sel_obj_del2(void *data, Evas *e EINA_UNUSED, Evas_Object *obj, void *event_info EINA_UNUSED) -{ - Sel_Manager_Selection *sel = data; - if (sel->request_obj == obj) sel->request_obj = NULL; -} - -static Sel_Manager_Dropable * -_wl_dropable_find(Efl_Ui_Selection_Manager_Data *pd, Ecore_Wl2_Window *win) -{ - Eina_List *l; - Sel_Manager_Dropable *dropable; - - if (!pd->drop_list) return NULL; - - if (!win) return NULL; - - EINA_LIST_FOREACH(pd->drop_list, l, dropable) - if (_wl_window_get(dropable->obj) == win) - return dropable; - - return NULL; -} - -static Evas * -_wl_evas_get_from_win(Efl_Ui_Selection_Manager_Data *pd, Ecore_Wl2_Window *win) -{ - Sel_Manager_Dropable *dropable = _wl_dropable_find(pd, win); - return dropable ? evas_object_evas_get(dropable->obj) : NULL; -} - -static Eina_Bool -_wl_drops_accept(Sel_Manager_Seat_Selection *seat_sel, const char *type) -{ - Efl_Ui_Selection_Manager_Data *pd; - Sel_Manager_Selection *sel; - Eina_List *l; - Sel_Manager_Dropable *drop; - Eina_Bool will_accept = EINA_FALSE; - - if (!type) return EINA_FALSE; - - pd = seat_sel->pd; - sel = seat_sel->sel; - EINA_LIST_FOREACH(pd->drop_list, l, drop) - { - Drop_Format *df; - EINA_INLIST_FOREACH(drop->format_list, df) - { - for (int i = 0; sm_wl_convertion[i].translates ; ++i) - { - if (!(sm_wl_convertion[i].format & df->format)) continue; - - for (int j = 0; sm_wl_convertion[i].translates[j]; ++j) - { - if (!strncmp(type, sm_wl_convertion[i].translates[j], strlen(sm_wl_convertion[i].translates[j]))) - { - sel->request_obj = drop->obj; - return EINA_TRUE; - } - } - } - } - } - - return will_accept; -} - -static void -_wl_selection_parser(void *_data, int size, char ***ret_data, int *ret_count) -{ - char **files = NULL; - int num_files = 0; - char *data = NULL; - - data = malloc(size); - if (data && (size > 0)) - { - int i, is; - char *tmp; - char **t2; - - memcpy(data, _data, size); - if (data[size - 1]) - { - char *t; - - /* Isn't nul terminated */ - size++; - t = realloc(data, size); - if (!t) goto done; - data = t; - data[size - 1] = 0; - } - - tmp = malloc(size); - if (!tmp) goto done; - i = 0; - is = 0; - while ((is < size) && (data[is])) - { - if ((i == 0) && (data[is] == '#')) - for (; ((data[is]) && (data[is] != '\n')); is++) ; - else - { - if ((data[is] != '\r') && (data[is] != '\n')) - tmp[i++] = data[is++]; - else - { - while ((data[is] == '\r') || (data[is] == '\n')) - is++; - tmp[i] = 0; - num_files++; - t2 = realloc(files, num_files * sizeof(char *)); - if (t2) - { - files = t2; - files[num_files - 1] = strdup(tmp); - } - else - { - num_files--; - goto freetmp; - } - tmp[0] = 0; - i = 0; - } - } - } - if (i > 0) - { - tmp[i] = 0; - num_files++; - t2 = realloc(files, num_files * sizeof(char *)); - if (t2) - { - files = t2; - files[num_files - 1] = strdup(tmp); - } - else - { - num_files--; - goto freetmp; - } - } -freetmp: - free(tmp); - } -done: - free(data); - if (ret_data) *ret_data = files; - else - { - int i; - - for (i = 0; i < num_files; i++) free(files[i]); - free(files); - } - if (ret_count) *ret_count = num_files; -} - -static Eina_Bool -_wl_data_preparer_markup(Sel_Manager_Selection *sel, Efl_Ui_Selection_Data *ddata, Ecore_Wl2_Event_Offer_Data_Ready *ev, Tmp_Info **tmp_info EINA_UNUSED) -{ - sel_debug("In\n"); - - ddata->format = EFL_UI_SELECTION_FORMAT_MARKUP; - ddata->content.mem = eina_memdup((unsigned char *)ev->data, ev->len, EINA_TRUE); - ddata->content.len = ev->len; - ddata->action = sel->action; - - return EINA_TRUE; -} - -static Eina_Bool -_wl_data_preparer_uri(Sel_Manager_Selection *sel, Efl_Ui_Selection_Data *ddata, Ecore_Wl2_Event_Offer_Data_Ready *ev, Tmp_Info **tmp_info EINA_UNUSED) -{ - Sel_Manager_Seat_Selection *seat_sel; - char *p, *stripstr = NULL; - char *data = ev->data; - Sel_Manager_Dropable *drop; - const char *type = NULL; - - sel_debug("In\n"); - - seat_sel = sel->seat_sel; - drop = efl_key_data_get(sel->request_obj, "__elm_dropable"); - if (drop) type = drop->last.type; - - if ((type) && (!strcmp(type, "text/uri-list"))) - { - int num_files = 0; - char **files = NULL; - Efreet_Uri *uri; - Eina_Strbuf *strbuf; - int i; - - strbuf = eina_strbuf_new(); - if (!strbuf) return EINA_FALSE; - - _wl_selection_parser(ev->data, ev->len, &files, &num_files); - sel_debug("got a files list\n"); - - for (i = 0; i < num_files; i++) - { - uri = efreet_uri_decode(files[i]); - if (uri) - { - eina_strbuf_append(strbuf, uri->path); - efreet_uri_free(uri); - } - else - { - eina_strbuf_append(strbuf, files[i]); - } - if (i < (num_files - 1)) - eina_strbuf_append(strbuf, "\n"); - free(files[i]); - } - free(files); - stripstr = eina_strbuf_string_steal(strbuf); - eina_strbuf_free(strbuf); - } - else - { - Efreet_Uri *uri; - - p = (char *)eina_memdup((unsigned char *)data, ev->len, EINA_TRUE); - if (!p) return EINA_FALSE; - uri = efreet_uri_decode(p); - if (!uri) - { - /* Is there any reason why we care of URI without scheme? */ - if (p[0] == '/') stripstr = p; - else free(p); - } - else - { - free(p); - stripstr = strdup(uri->path); - efreet_uri_free(uri); - } - } - - if (!stripstr) - { - sel_debug("Couldn't find a file\n"); - return EINA_FALSE; - } - free(seat_sel->saved_types->imgfile); - - ddata->content.mem = stripstr; - ddata->content.len = strlen(stripstr); - ddata->action = sel->action; - ddata->format = sel->request_format; - - return EINA_TRUE; -} - -static Eina_Bool -_wl_data_preparer_vcard(Sel_Manager_Selection *sel, Efl_Ui_Selection_Data *ddata, Ecore_Wl2_Event_Offer_Data_Ready *ev, Tmp_Info **tmp_info EINA_UNUSED) -{ - sel_debug("In\n"); - - ddata->format = EFL_UI_SELECTION_FORMAT_VCARD; - ddata->content.mem = eina_memdup((unsigned char *)ev->data, ev->len, EINA_TRUE); - ddata->content.len = ev->len; - ddata->action = sel->action; - - return EINA_TRUE; -} - -static Eina_Bool -_wl_data_preparer_image(Sel_Manager_Selection *sel, Efl_Ui_Selection_Data *ddata, Ecore_Wl2_Event_Offer_Data_Ready *ev, Tmp_Info **tmp_info) -{ - sel_debug("In\n"); - Tmp_Info *tmp; - int len = 0; - - tmp = _tempfile_new(ev->len); - if (!tmp) - return EINA_FALSE; - memcpy(tmp->map, ev->data, ev->len); - munmap(tmp->map, ev->len); - - len = strlen(tmp->filename); - ddata->format = EFL_UI_SELECTION_FORMAT_IMAGE; - ddata->content.mem = eina_memdup((unsigned char*)tmp->filename, len, EINA_TRUE); - ddata->content.len = len; - ddata->action = sel->action; - *tmp_info = tmp; - - return EINA_TRUE; -} - -static Eina_Bool -_wl_data_preparer_text(Sel_Manager_Selection *sel, Efl_Ui_Selection_Data *ddata, Ecore_Wl2_Event_Offer_Data_Ready *ev, Tmp_Info **tmp_info EINA_UNUSED) -{ - sel_debug("In\n"); - - ddata->format = EFL_UI_SELECTION_FORMAT_TEXT; - ddata->content.mem = eina_memdup((unsigned char *)ev->data, ev->len, EINA_TRUE); - ddata->content.len = ev->len; - ddata->action = sel->action; - - return EINA_TRUE; -} - - -static void -_wl_dropable_handle(Sel_Manager_Seat_Selection *seat_sel, Sel_Manager_Dropable *dropable, Evas_Coord x, Evas_Coord y) -{ - Sel_Manager_Dropable *d, *last_dropable = NULL; - Efl_Ui_Selection_Manager_Data *pd = seat_sel->pd; - Sel_Manager_Selection *sel; - Eina_Inlist *itr; - Eina_List *l; - Eina_Position2D pos; - - EINA_LIST_FOREACH(pd->drop_list, l, d) - { - if (d->last.in) - { - last_dropable = d; - break; - } - } - - sel = seat_sel->sel; - pos = EINA_POSITION2D(x, y); - /* If we are on the same object, just update the position */ - if ((dropable) && (last_dropable == dropable)) - { - Evas_Coord ox, oy; - Efl_Dnd_Drag_Pos pos_data; - Drop_Format *df; - - evas_object_geometry_get(dropable->obj, &ox, &oy, NULL, NULL); - if (!dropable->is_container) - { - pos_data.pos = EINA_POSITION2D(x - ox, y - oy); - pos_data.item = NULL; - } - else - { - Efl_Object *it = NULL; - - if (dropable->item_func) - it = dropable->item_func(dropable->item_func_data, dropable->obj, - pos, &pos_data.pos); - pos_data.item = it; - } - pos_data.format = dropable->last.format; - pos_data.action = sel->action; - EINA_INLIST_FOREACH_SAFE(dropable->format_list, itr, df) - { - if (df->format & dropable->last.format) - efl_event_callback_call(dropable->obj, EFL_UI_DND_EVENT_DRAG_POS, &pos_data); - } - - return; - } - /* We leave the last dropable */ - if (last_dropable) - { - Drop_Format *df; - sel_debug("leave %p\n", last_dropable->obj); - last_dropable->last.in = EINA_FALSE; - - EINA_INLIST_FOREACH_SAFE(last_dropable->format_list, itr, df) - { - if (df->format & last_dropable->last.format) - efl_event_callback_call(last_dropable->obj, EFL_UI_DND_EVENT_DRAG_LEAVE, NULL); - } - } - /* We enter the new dropable */ - if (dropable) - { - sel_debug("enter %p\n", dropable->obj); - Evas_Coord ox, oy; - Efl_Dnd_Drag_Pos pos_data; - Drop_Format *df; - - dropable->last.in = EINA_TRUE; - evas_object_geometry_get(dropable->obj, &ox, &oy, NULL, NULL); - if (!dropable->is_container) - { - pos_data.pos = EINA_POSITION2D(x - ox, y - oy); - pos_data.item = NULL; - } - else - { - Efl_Object *it = NULL; - - if (dropable->item_func) - it = dropable->item_func(dropable->item_func_data, dropable->obj, - pos, &pos_data.pos); - pos_data.item = it; - } - pos_data.format = dropable->last.format; - pos_data.action = sel->action; - - EINA_INLIST_FOREACH_SAFE(dropable->format_list, itr, df) - { - if (df->format & dropable->last.format) - { - efl_event_callback_call(dropable->obj, EFL_UI_DND_EVENT_DRAG_ENTER, NULL); - efl_event_callback_call(dropable->obj, EFL_UI_DND_EVENT_DRAG_POS, &pos_data); - } - } - } -} - -static void -_wl_dropable_all_clean(Sel_Manager_Seat_Selection *seat_sel, Ecore_Wl2_Window *win) -{ - Eina_List *l; - Sel_Manager_Dropable *dropable; - - if (!win) return; - - EINA_LIST_FOREACH(seat_sel->pd->drop_list, l, dropable) - { - if (_wl_window_get(dropable->obj) == win) - { - dropable->last.pos.x = 0; - dropable->last.pos.y = 0; - dropable->last.in = EINA_FALSE; - } - } -} - -static void -_wl_dropable_data_handle(Sel_Manager_Selection *sel, Ecore_Wl2_Event_Offer_Data_Ready *ev) -{ - Sel_Manager_Seat_Selection *seat_sel; - Efl_Ui_Selection_Manager_Data *pd; - Sel_Manager_Dropable *drop; - Ecore_Wl2_Window *win; - - sel_debug("In\n"); - seat_sel = sel->seat_sel; - pd = seat_sel->pd; - drop = efl_key_data_get(sel->request_obj, "__elm_dropable"); - if (drop) - { - Sel_Manager_Atom *atom = NULL; - - atom = eina_hash_find(pd->type_hash, drop->last.type); - if (atom && atom->wl_data_preparer) - { - Efl_Ui_Selection_Data ddata; - Tmp_Info *tmp_info = NULL; - Eina_Bool success; - - sel_debug("Call notify for: %s\n", atom->name); - success = atom->wl_data_preparer(sel, &ddata, ev, &tmp_info); - if (success) - { - Sel_Manager_Dropable *dropable; - Eina_List *l; - - EINA_LIST_FOREACH(pd->drop_list, l, dropable) - { - if (dropable->obj == sel->request_obj) break; - dropable = NULL; - } - if (dropable) - { - Drop_Format *df; - Eina_Inlist *itr; - - if (!dropable->is_container) - { - ddata.pos.x = seat_sel->saved_types->pos.x; - ddata.pos.y = seat_sel->saved_types->pos.y; - } - else - { - //for container - Efl_Object *it = NULL; - Evas_Coord x0 = 0, y0 = 0; - Eina_Position2D pos, posret = {}; - - evas_object_geometry_get(dropable->obj, &x0, &y0, NULL, NULL); - pos = EINA_POSITION2D(seat_sel->saved_types->pos.x + x0, - seat_sel->saved_types->pos.y + y0); - if (dropable->item_func) - it = dropable->item_func(dropable->item_func_data, dropable->obj, - pos, &posret); - ddata.pos = posret; - ddata.item = it; - } - ddata.action = seat_sel->drag_action; - - EINA_INLIST_FOREACH_SAFE(dropable->format_list, itr, df) - { - if (df->format & dropable->last.format) - efl_event_callback_call(dropable->obj, EFL_UI_DND_EVENT_DRAG_DROP, &ddata); - } - } - } - win = _wl_window_get(sel->request_obj); - ecore_wl2_dnd_drag_end(_wl_seat_get(win, NULL, seat_sel->seat)); - if (tmp_info) _tmpinfo_free(tmp_info); - return; - } - } - - win = _wl_window_get(sel->request_obj); - ecore_wl2_dnd_drag_end(_wl_seat_get(win, NULL, seat_sel->seat)); - seat_sel->saved_types->textreq = 0; -} - -static Eina_Bool -_wl_dnd_enter(void *data, int type EINA_UNUSED, void *event) -{ - Ecore_Wl2_Event_Dnd_Enter *ev; - Eina_Array *known, *available; - Sel_Manager_Seat_Selection *seat_sel = data; - unsigned int i = 0; - - ev = event; - - available = ecore_wl2_offer_mimes_get(ev->offer); - - free(seat_sel->saved_types->types); - - seat_sel->saved_types->ntypes = eina_array_count(available); - seat_sel->saved_types->types = malloc(sizeof(char *) * seat_sel->saved_types->ntypes); - if (!seat_sel->saved_types->types) return EINA_FALSE; - - known = eina_array_new(5); - - for (i = 0; i < eina_array_count(available); i++) - { - seat_sel->saved_types->types[i] = - eina_stringshare_add(eina_array_data_get(available, i)); - if (seat_sel->saved_types->types[i] == seat_sel->pd->text_uri) - { - seat_sel->saved_types->textreq = 1; - ELM_SAFE_FREE(seat_sel->saved_types->imgfile, free); - } - } - - seat_sel->accept = EINA_FALSE; - for (i = 0; i < eina_array_count(available); i++) - { - if (_wl_drops_accept(seat_sel, eina_array_data_get(available, i))) - { - eina_array_push(known, strdup(eina_array_data_get(available, i))); - } - } - - ecore_wl2_offer_mimes_set(ev->offer, known); - - return ECORE_CALLBACK_PASS_ON; -} - -static Eina_Bool -_wl_dnd_leave(void *data, int type EINA_UNUSED, void *event) -{ - Ecore_Wl2_Event_Dnd_Leave *ev; - Sel_Manager_Seat_Selection *seat_sel = data; - Sel_Manager_Dropable *drop; - sel_debug("In\n"); - - ev = event; - if ((drop = _wl_dropable_find(seat_sel->pd, ev->win))) - { - _wl_dropable_handle(seat_sel, NULL, 0, 0); - _wl_dropable_all_clean(seat_sel, ev->win); - } - - return ECORE_CALLBACK_PASS_ON; -} - -static Eina_Bool -_wl_dnd_position(void *data, int type EINA_UNUSED, void *event) -{ - Ecore_Wl2_Event_Dnd_Motion *ev; - Sel_Manager_Seat_Selection *seat_sel = data; - Efl_Ui_Selection_Manager_Data *pd = seat_sel->pd; - Sel_Manager_Dropable *drop; - Eina_Bool will_accept = EINA_FALSE; - - ev = event; - - sel_debug("mouse pos %i %i\n", ev->x, ev->y); - seat_sel->drag_win_end.x = ev->x - seat_sel->drag_pos.x; - seat_sel->drag_win_end.y = ev->y - seat_sel->drag_pos.y; - - drop = _wl_dropable_find(pd, ev->win); - - if (drop) - { - Eina_Position2D pos = EINA_POSITION2D(ev->x, ev->y); - Evas *evas = NULL; - Eina_List *dropable_list = NULL; - - _dropable_coords_adjust(drop, &pos); - evas = _wl_evas_get_from_win(pd, ev->win); - if (evas) - dropable_list = _dropable_list_geom_find(pd, evas, pos.x, pos.y); - - /* check if there is dropable (obj) can accept this drop */ - if (dropable_list) - { - Efl_Ui_Selection_Format saved_format; - Eina_List *l; - Eina_Bool found = EINA_FALSE; - Sel_Manager_Dropable *dropable = NULL; - - saved_format = - _dnd_types_to_format(pd, seat_sel->saved_types->types, seat_sel->saved_types->ntypes); - - EINA_LIST_FOREACH(dropable_list, l, dropable) - { - Drop_Format *df; - Eina_Inlist *itr; - - EINA_INLIST_FOREACH_SAFE(dropable->format_list, itr, df) - { - Efl_Ui_Selection_Format common_fmt = saved_format & df->format; - - if (common_fmt) - { - /* We found a target that can accept this type of data */ - int i, min_index = SELECTION_N_ATOMS; - - /* We have to find the first atom that corresponds to one - * of the supported data types. */ - for (i = 0; i < seat_sel->saved_types->ntypes; i++) - { - Sel_Manager_Atom *atom; - - atom = eina_hash_find(pd->type_hash, - seat_sel->saved_types->types[i]); - - if (atom && (atom->format & common_fmt)) - { - int atom_idx = (atom - pd->atom_list); - - if (min_index > atom_idx) - min_index = atom_idx; - } - } - if (min_index != SELECTION_N_ATOMS) - { - sel_debug("Found atom %s\n", pd->atom_list[min_index].name); - found = EINA_TRUE; - dropable->last.type = pd->atom_list[min_index].name; - dropable->last.format = common_fmt; - break; - } - } - } - if (found) break; - } - if (found) - { - Sel_Manager_Selection *sel = seat_sel->sel; - Evas_Coord ox = 0, oy = 0; - - evas_object_geometry_get(dropable->obj, &ox, &oy, NULL, NULL); - - sel_debug("Candidate %p (%s)\n", - dropable->obj, efl_class_name_get(efl_class_get(dropable->obj))); - _wl_dropable_handle(seat_sel, dropable, pos.x - ox, pos.y - oy); - sel->request_obj = dropable->obj; - will_accept = EINA_TRUE; - } - else - { - //if not: send false status - sel_debug("dnd position (%d, %d) not in obj\n", pos.x, pos.y); - _wl_dropable_handle(seat_sel, NULL, 0, 0); - // CCCCCCC: call dnd exit on last obj - } - eina_list_free(dropable_list); - } - } - - seat_sel->accept = will_accept; - efl_event_callback_call(seat_sel->drag_obj, EFL_UI_DND_EVENT_DRAG_ACCEPT, &seat_sel->accept); - - return ECORE_CALLBACK_PASS_ON; -} - -static Eina_Bool -_wl_dnd_receive(void *data, int type EINA_UNUSED, void *event) -{ - Ecore_Wl2_Event_Offer_Data_Ready *ev; - Sel_Manager_Seat_Selection *seat_sel = data; - Sel_Manager_Selection *sel; - Ecore_Wl2_Offer *offer; - sel_debug("In\n"); - - ev = event; - sel = seat_sel->sel; - offer = sel->dnd_offer; - - if (offer != ev->offer) return ECORE_CALLBACK_PASS_ON; - - if (sel->request_obj) - { - Ecore_Wl2_Drag_Action action; - - action = ecore_wl2_offer_action_get(ev->offer); - if (action == ECORE_WL2_DRAG_ACTION_ASK) - ecore_wl2_offer_actions_set(ev->offer, ECORE_WL2_DRAG_ACTION_COPY, ECORE_WL2_DRAG_ACTION_COPY); - action = ecore_wl2_offer_action_get(ev->offer); - sel->action = _wl_to_elm(action); - - _wl_dropable_data_handle(sel, ev); - evas_object_event_callback_del_full(sel->request_obj, - EVAS_CALLBACK_DEL, - _wl_sel_obj_del2, sel); - sel->request_obj = NULL; - } - - ecore_wl2_offer_finish(ev->offer); - - return ECORE_CALLBACK_CANCEL; -} - -static Eina_Bool -_wl_dnd_drop(void *data, int type EINA_UNUSED, void *event) -{ - Ecore_Wl2_Event_Dnd_Drop *ev; - Sel_Manager_Seat_Selection *seat_sel = data; - Efl_Ui_Selection_Manager_Data *pd; - Sel_Manager_Selection *sel; - Sel_Manager_Dropable *drop; - Eina_List *l; - - sel_debug("In\n"); - ev = event; - seat_sel->saved_types->pos = EINA_POSITION2D(ev->x, ev->y); - pd = seat_sel->pd; - sel = seat_sel->sel; - sel->dnd_offer = ev->offer; - - EINA_LIST_FOREACH(pd->drop_list, l, drop) - { - if (drop->last.in) - { - sel_debug("Request data of type %s; drop: %p\n", drop->last.type, drop); - sel->request_obj = drop->obj; - sel->request_format = drop->last.format; - evas_object_event_callback_add(sel->request_obj, - EVAS_CALLBACK_DEL, _wl_sel_obj_del2, - sel); - ecore_wl2_offer_receive(ev->offer, (char*)drop->last.type); - ecore_event_handler_add(ECORE_WL2_EVENT_OFFER_DATA_READY, _wl_dnd_receive, seat_sel); - - return ECORE_CALLBACK_PASS_ON; - } - } - - ecore_wl2_dnd_drag_end(_wl_seat_get(ev->win, NULL, seat_sel->seat)); - return ECORE_CALLBACK_PASS_ON; -} - -static Eina_Bool -_wl_sel_manager_drop_target_add(Efl_Ui_Selection_Manager_Data *pd, Efl_Object *target_obj, - Efl_Ui_Selection_Format format, unsigned int seat) -{ - Sel_Manager_Dropable *dropable = NULL; - Sel_Manager_Seat_Selection *seat_sel = NULL; - Drop_Format *df; - - df = calloc(1, sizeof(Drop_Format)); - if (!df) return EINA_FALSE; - df->format = format; - dropable = efl_key_data_get(target_obj, "__elm_dropable"); - if (!dropable) - { - //Create new drop - dropable = calloc(1, sizeof(Sel_Manager_Dropable)); - if (!dropable) - { - free(df); - return EINA_FALSE; - } - pd->drop_list = eina_list_append(pd->drop_list, dropable); - if (!pd->drop_list) - { - free(dropable); - free(df); - return EINA_FALSE; - } - dropable->obj = target_obj; - efl_key_data_set(target_obj, "__elm_dropable", dropable); - } - - dropable->format_list = eina_inlist_append(dropable->format_list, EINA_INLIST_GET(df)); - dropable->seat = seat; - seat_sel = _wl_sel_manager_seat_selection_init(pd, seat); - - evas_object_event_callback_add(target_obj, EVAS_CALLBACK_DEL, - _all_drop_targets_cbs_del, pd); - - if (!seat_sel->enter_handler) - { - seat_sel->enter_handler = - ecore_event_handler_add(ECORE_WL2_EVENT_DND_ENTER, - _wl_dnd_enter, seat_sel); - seat_sel->leave_handler = - ecore_event_handler_add(ECORE_WL2_EVENT_DND_LEAVE, - _wl_dnd_leave, seat_sel); - seat_sel->pos_handler = - ecore_event_handler_add(ECORE_WL2_EVENT_DND_MOTION, - _wl_dnd_position, seat_sel); - seat_sel->drop_handler = - ecore_event_handler_add(ECORE_WL2_EVENT_DND_DROP, - _wl_dnd_drop, seat_sel); - } - - return EINA_TRUE; -} -#endif - -#ifdef HAVE_ELEMENTARY_COCOA -static Sel_Manager_Seat_Selection * -_cocoa_sel_manager_seat_selection_init(Efl_Ui_Selection_Manager_Data *pd, unsigned int seat) -{ - Sel_Manager_Seat_Selection *seat_sel = NULL; - Eina_List *l = NULL; - - EINA_LIST_FOREACH(pd->seat_list, l, seat_sel) - { - if(seat_sel->seat == seat) - break; - } - if (!seat_sel) - { - seat_sel = calloc(1, sizeof(Sel_Manager_Seat_Selection)); - if (!seat_sel) - { - ERR("Failed to allocate seat"); - return NULL; - } - seat_sel->saved_types = calloc(1, sizeof(Saved_Type)); - seat_sel->seat = seat; - seat_sel->pd = pd; - pd->seat_list = eina_list_append(pd->seat_list, seat_sel); - } - if (!seat_sel->sel) - { - Sel_Manager_Selection *sel = calloc(1, sizeof(Sel_Manager_Selection)); - if (!sel) - { - ERR("failed to allocate selection"); - return NULL; - } - sel->seat_sel = seat_sel; - seat_sel->sel = sel; - } - - return seat_sel; -} - -static Ecore_Cocoa_Window * -_cocoa_window_get(const Evas_Object *obj) -{ - Ecore_Cocoa_Window *win = NULL; - Evas_Object *_win; - - _win = elm_win_get(obj); - if (_win) - { - win = elm_win_cocoa_window_get(_win); - } - - if (!win) - { - CRI("WIN has not been retrieved!!!"); - } - - return win; -} - -static Ecore_Cocoa_Cnp_Type -_sel_format_to_ecore_cocoa_cnp_type(Efl_Ui_Selection_Format fmt) -{ - Ecore_Cocoa_Cnp_Type type = 0; - - if ((fmt & EFL_UI_SELECTION_FORMAT_TEXT) || - (fmt & EFL_UI_SELECTION_FORMAT_VCARD)) - type |= ECORE_COCOA_CNP_TYPE_STRING; - if (fmt & EFL_UI_SELECTION_FORMAT_HTML) - type |= ECORE_COCOA_CNP_TYPE_HTML; - if (fmt & EFL_UI_SELECTION_FORMAT_IMAGE) - type |= ECORE_COCOA_CNP_TYPE_IMAGE; - - return type; -} - -static void -_cocoa_sel_obj_del_req_cb(void *data, - Evas *e EINA_UNUSED, - Evas_Object *obj, - void *ev_info EINA_UNUSED) -{ - Sel_Manager_Selection *sel = data; - if (sel->request_obj == obj) sel->request_obj = NULL; -} - -static void -_cocoa_sel_obj_del_cb(void *data, - Evas *e EINA_UNUSED, - Evas_Object *obj, - void *ev_info EINA_UNUSED) -{ - Sel_Manager_Selection *sel = data; - if (sel->owner == obj) - { - sel->owner = NULL; - } - //if (dragwidget == obj) dragwidget = NULL; -} - -static void -_job_pb_cb(void *data) -{ - Sel_Manager_Selection *sel = data; - Efl_Ui_Selection_Data ddata; - Ecore_Cocoa_Cnp_Type type, get_type; - void *pbdata; - int pbdata_len; - - if (sel->data_func) - { - ddata.pos.x = 0; - ddata.pos.y = 0; - - /* Pass to cocoa clipboard */ - type = _sel_format_to_ecore_cocoa_cnp_type(sel->request_format); - pbdata = ecore_cocoa_clipboard_get(&pbdata_len, type, &get_type); - - ddata.format = EFL_UI_SELECTION_FORMAT_NONE; - if (get_type & ECORE_COCOA_CNP_TYPE_STRING) - ddata.format |= EFL_UI_SELECTION_FORMAT_TEXT; - if (get_type & ECORE_COCOA_CNP_TYPE_IMAGE) - ddata.format |= EFL_UI_SELECTION_FORMAT_IMAGE; - if (get_type & ECORE_COCOA_CNP_TYPE_HTML) - ddata.format |= EFL_UI_SELECTION_FORMAT_HTML; - - ddata.content.mem = pbdata; - ddata.content.len = pbdata_len; - ddata.action = EFL_UI_SELECTION_ACTION_UNKNOWN; - sel->data_func(sel->data_func_data, sel->request_obj, &ddata); - free(pbdata); - } -} - -static Eina_Future * -_cocoa_efl_sel_manager_selection_set(Efl_Ui_Selection_Manager_Data *pd, - Evas_Object *owner, - Efl_Ui_Selection_Type type, - Efl_Ui_Selection_Format format, - Eina_Slice data, - Ecore_Cocoa_Window *win, - unsigned int seat) -{ - Sel_Manager_Seat_Selection *seat_sel; - Sel_Manager_Selection *sel; - Ecore_Cocoa_Cnp_Type ecore_type; - Eina_List *l, *l_next; - Sel_Manager_Selection_Lost *sel_lost; - - seat_sel = _cocoa_sel_manager_seat_selection_init(pd, seat); - seat_sel->active_type = type; - sel = seat_sel->sel; - - if ((!data.mem) && (format != EFL_UI_SELECTION_FORMAT_IMAGE)) - { - efl_ui_selection_manager_selection_clear(pd->sel_man, owner, type, seat); - return NULL; - } - if (data.len <= 0) return NULL; - - EINA_LIST_FOREACH_SAFE(seat_sel->sel_lost_list, l, l_next, sel_lost) - { - if ((sel_lost->request == sel->owner) && - (sel_lost->type == type)) - { - eina_promise_resolve(sel_lost->promise, eina_value_uint_init(sel_lost->type)); - } - } - if (sel->owner) - evas_object_event_callback_del_full(sel->owner, EVAS_CALLBACK_DEL, - _cocoa_sel_obj_del_cb, sel); - - sel->owner = owner; - sel->win = win; - sel->format = format; - - evas_object_event_callback_add(sel->owner, EVAS_CALLBACK_DEL, - _cocoa_sel_obj_del_cb, sel); - ELM_SAFE_FREE(sel->data.mem, free); - - if (format == EFL_UI_SELECTION_FORMAT_MARKUP) - { - //FIXME this code assumes that sel->data.mem has a \0 at the end - sel->data.mem = evas_textblock_text_markup_to_utf8(NULL, data.mem); - sel->data.len = strlen(sel->data.mem); - //set the new text - format = EFL_UI_SELECTION_FORMAT_TEXT; - } - else - { - sel->data = eina_slice_dup(data); - } - - if (sel->data.mem) - { - ecore_type = _sel_format_to_ecore_cocoa_cnp_type(format); - ecore_cocoa_clipboard_set(sel->data.mem, sel->data.len, ecore_type); - } - else - { - CRI("Failed to allocate memory!"); - efl_ui_selection_manager_selection_clear(pd->sel_man, owner, type, seat_sel->seat); - return NULL; - } - - return _update_sel_lost_list(owner, type, seat_sel); -} - -static void -_cocoa_efl_sel_manager_selection_get(const Efl_Object *request, - Efl_Ui_Selection_Manager_Data *pd, - Efl_Ui_Selection_Type type EINA_UNUSED, - Efl_Ui_Selection_Format format, - void *data_func_data, Efl_Ui_Selection_Data_Ready data_func, Eina_Free_Cb data_func_free_cb, - Ecore_Cocoa_Window *win, unsigned int seat) -{ - Sel_Manager_Seat_Selection *seat_sel; - Sel_Manager_Selection *sel; - - seat_sel = _sel_manager_seat_selection_init(pd, seat); - sel = seat_sel->sel; - sel->request_format = format; - sel->request_obj = (Efl_Object *)request; - sel->data_func_data = data_func_data; - sel->data_func = data_func; - sel->data_func_free_cb = data_func_free_cb; - if (sel->request_obj) - evas_object_event_callback_del_full(sel->request_obj, EVAS_CALLBACK_DEL, - _cocoa_sel_obj_del_req_cb, sel); - - sel->win = win; - ecore_job_add(_job_pb_cb, sel); - - evas_object_event_callback_add(sel->request_obj, EVAS_CALLBACK_DEL, - _cocoa_sel_obj_del_req_cb, sel); -} - -#endif - -// win32 specific stuff -//////////////////////////////////////////////////////////////////////////// -#ifdef HAVE_ELEMENTARY_WIN32 -static Sel_Manager_Seat_Selection * -_win32_sel_manager_seat_selection_init(Efl_Ui_Selection_Manager_Data *pd, unsigned int seat) -{ - Sel_Manager_Seat_Selection *seat_sel = NULL; - Eina_List *l = NULL; - - EINA_LIST_FOREACH(pd->seat_list, l, seat_sel) - { - if(seat_sel->seat == seat) - break; - } - if (!seat_sel) - { - seat_sel = calloc(1, sizeof(Sel_Manager_Seat_Selection)); - if (!seat_sel) - { - ERR("Failed to allocate seat"); - return NULL; - } - seat_sel->saved_types = calloc(1, sizeof(Saved_Type)); - seat_sel->seat = seat; - seat_sel->pd = pd; - pd->seat_list = eina_list_append(pd->seat_list, seat_sel); - } - if (!seat_sel->sel_list) - { - seat_sel->sel_list = calloc(1, (EFL_UI_SELECTION_TYPE_CLIPBOARD + 1) * sizeof(Sel_Manager_Selection)); - if (!seat_sel->sel_list) - { - ERR("failed to allocate selection list"); - return NULL; - } - _set_selection_list(seat_sel->sel_list, seat_sel); - } - - return seat_sel; -} - -static char * -_win32_text_n_to_rn(char *intext) -{ - size_t size = 0, newlines = 0; - char *outtext = NULL, *p, *o; - - if (!intext) return NULL; - for (p = intext; *p; p++) - { - if (*p == '\n') newlines++; - size++; - } - outtext = malloc(size + newlines + 1); - if (!outtext) return intext; - for (p = intext, o = outtext; *p; p++, o++) - { - if (*p == '\n') - { - o++; - *p = '\r'; - } - *o = *p; - } - *o = '\0'; - free(intext); - return outtext; -} - -static void -_win32_sel_obj_del(void *data, Evas *e EINA_UNUSED, Evas_Object *obj, void *event_info EINA_UNUSED) -{ - Sel_Manager_Selection *sel = data; - if (sel->owner == obj) sel->owner = NULL; -} - -static void -_win32_sel_obj_del2(void *data, Evas *e EINA_UNUSED, Evas_Object *obj, void *event_info EINA_UNUSED) -{ - Sel_Manager_Selection *sel = data; - if (sel->request_obj == obj) sel->request_obj = NULL; -} - -static Ecore_Win32_Window * -_win32_window_get(const Evas_Object *obj) -{ - Evas_Object *top; - Ecore_Win32_Window *win = NULL; - - if (elm_widget_is(obj)) - { - top = elm_widget_top_get(obj); - if (!top) - { - Evas_Object *par; - par = elm_widget_parent_widget_get(obj); - if (par) top = elm_widget_top_get(par); - } - if (top && (efl_isa(top, EFL_UI_WIN_CLASS))) - win = elm_win_win32_window_get(top); - } - - if (!win) - { - Ecore_Evas *ee; - Evas *evas; - const char *engine_name; - - evas = evas_object_evas_get(obj); - if (!evas) return NULL; - - ee = ecore_evas_ecore_evas_get(evas); - if (!ee) return NULL; - - engine_name = ecore_evas_engine_name_get(ee); - if (!strcmp(engine_name, ELM_BUFFER)) - { - ee = ecore_evas_buffer_ecore_evas_parent_get(ee); - if (!ee) return NULL; - win = ecore_evas_win32_window_get(ee); - } - else - { - if ((strcmp(engine_name, ELM_SOFTWARE_WIN32) == 0) || - (strcmp(engine_name, ELM_SOFTWARE_DDRAW) == 0)) - return ecore_evas_win32_window_get(ee); - } - } - - return win; -} - -static Eina_Future * -_win32_efl_sel_manager_selection_set(Efl_Ui_Selection_Manager_Data *pd, - Evas_Object *owner, - Efl_Ui_Selection_Type type, - Efl_Ui_Selection_Format format, - Eina_Slice data, - Ecore_Win32_Window *win, - unsigned int seat) -{ - Sel_Manager_Seat_Selection *seat_sel; - Sel_Manager_Selection *sel; - - if (type != EFL_UI_SELECTION_TYPE_CLIPBOARD) - return NULL; - - if ((!data.mem) && (format != EFL_UI_SELECTION_FORMAT_IMAGE)) - { - efl_ui_selection_manager_selection_clear(pd->sel_man, owner, type, seat); - return NULL; - } - - seat_sel = _win32_sel_manager_seat_selection_init(pd, seat); - seat_sel->active_type = type; - sel = seat_sel->sel_list + type; - if (sel->owner != owner) - { - Eina_List *l, *l_next; - Sel_Manager_Selection_Lost *sel_lost; - - EINA_LIST_FOREACH_SAFE(seat_sel->sel_lost_list, l, l_next, sel_lost) - { - if ((sel_lost->request == sel->owner) && - (sel_lost->type == type)) - { - eina_promise_resolve(sel_lost->promise, eina_value_uint_init(sel_lost->type)); - } - } - - } - if (sel->owner) - evas_object_event_callback_del_full(sel->owner, EVAS_CALLBACK_DEL, - _win32_sel_obj_del, sel); - sel->active = EINA_TRUE; - sel->owner = owner; - sel->win = win; - if (sel->set) sel->set(win, sel->data.mem, sel->data.len); - sel->format = format; - - evas_object_event_callback_add - (sel->owner, EVAS_CALLBACK_DEL, _win32_sel_obj_del, sel); - - ELM_SAFE_FREE(sel->data.mem, free); - sel->data = eina_slice_dup(data); - if (!sel->data.mem) - { - efl_ui_selection_manager_selection_clear(pd->sel_man, owner, type, seat_sel->seat); - return NULL; - } - - return _update_sel_lost_list(owner, type, seat_sel); -} - -static void -_win32_efl_sel_manager_selection_clear(Efl_Ui_Selection_Manager_Data *pd, - Evas_Object *owner, - Efl_Ui_Selection_Type type, - Sel_Manager_Seat_Selection *seat_sel) -{ - Sel_Manager_Selection *sel; - Ecore_Win32_Window *win; - - if (type != EFL_UI_SELECTION_TYPE_CLIPBOARD) - return; - - sel = seat_sel->sel_list + type; - - /* No longer this selection: Consider it gone! */ - if ((!sel->active) || (sel->owner != owner)) - return; - - if (sel->owner) - evas_object_event_callback_del_full(sel->owner, EVAS_CALLBACK_DEL, - _win32_sel_obj_del, sel); - if (sel->request_obj) - evas_object_event_callback_del_full(sel->request_obj, EVAS_CALLBACK_DEL, - _win32_sel_obj_del2, sel); - sel->owner = NULL; - sel->request_obj = NULL; - sel->active = EINA_FALSE; - ELM_SAFE_FREE(sel->data.mem, free); - /* sel->clear(win); */ -} - -static Eina_Bool -_win32_efl_sel_manager_selection_get(const Efl_Object *request, - Efl_Ui_Selection_Manager_Data *pd, - Efl_Ui_Selection_Type type, Efl_Ui_Selection_Format format, - void *data_func_data, Efl_Ui_Selection_Data_Ready data_func, - Eina_Free_Cb data_func_free_cb, - Ecore_Win32_Window *win, unsigned int seat) -{ - Sel_Manager_Seat_Selection *seat_sel; - Sel_Manager_Selection *sel; - void *data; - int size; - - if (type != EFL_UI_SELECTION_TYPE_CLIPBOARD) - return EINA_FALSE; - - seat_sel = _sel_manager_seat_selection_init(pd, seat); - sel = seat_sel->sel_list + type; - - if (sel->request_obj) - evas_object_event_callback_del_full(sel->request_obj, EVAS_CALLBACK_DEL, - _win32_sel_obj_del2, sel); - sel->request_format = format; - sel->request_obj = (Evas_Object *)request; - sel->win = win; - sel->data_func_data = data_func_data; - sel->data_func = data_func; - sel->data_func_free_cb = data_func_free_cb; - sel->get(win, &data, &size); - - if (!data || (size <= 0)) - goto cb_add; - - if ((sel->format & EFL_UI_SELECTION_FORMAT_MARKUP) || - (sel->format & EFL_UI_SELECTION_FORMAT_HTML)) - { - char *str; - - str = (char *)malloc(size + 1); - if (str) - { - memcpy(str, data, size); - str[size] = '\0'; - data = _win32_text_n_to_rn(_elm_util_mkup_to_text(str)); - free(str); - if (data) - size = strlen(data); - else - size = 0; - } - else - { - free(data); - data = NULL; - } - } - - if (sel->data_func && data && (size > 0)) - { - Efl_Ui_Selection_Data sdata; - - sdata.pos.x = sdata.pos.y = 0; - sdata.format = EFL_UI_SELECTION_FORMAT_TEXT; - sdata.content.mem = data; - sdata.content.len = size; - sdata.action = sel->action; - sel->data_func(sel->data_func_data, sel->request_obj, &sdata); - } - - if (data) - free(data); - - cb_add: - evas_object_event_callback_add - (sel->request_obj, EVAS_CALLBACK_DEL, _win32_sel_obj_del2, sel); - - return EINA_TRUE; -} - -#endif /* HAVE_ELEMENTARY_WIN32 */ - - -static int -_drop_item_container_cmp(const void *d1, const void *d2) -{ - const Item_Container_Drop_Info *di = d1; - return (((uintptr_t)di->obj) - ((uintptr_t)d2)); -} - -static Eina_Bool -_drop_item_container_del(Efl_Ui_Selection_Manager_Data *pd, Efl_Object *cont, Eina_Bool full) -{ - Item_Container_Drop_Info *di; - - di = eina_list_search_unsorted(pd->drop_cont_list, - _drop_item_container_cmp, cont); - if (di) - { - _all_drop_targets_cbs_del(pd, NULL, cont, NULL); - di->item_func_data = NULL; - di->item_func = NULL; - - if (full) - { - pd->drop_cont_list = eina_list_remove(pd->drop_cont_list, di); - free(di); - } - return EINA_TRUE; - } - - return EINA_FALSE; -} - -static inline Eina_List * -_anim_icons_make(Sel_Manager_Drag_Container *dc) -{ - Eina_List *list = NULL, *icon_list = NULL; - Evas_Object *obj; - - if (dc->icon_list_func) - { - DBG("calling icon_list_func"); - icon_list = dc->icon_list_func(dc->icon_list_func_data, dc->cont); - } - EINA_LIST_FREE(icon_list, obj) - { - DBG("one obj in icon_list"); - Anim_Icon *ai = calloc(1, sizeof(Anim_Icon)); - if (!ai) - { - ERR("Failed to allocate for icon!"); - continue; - } - - evas_object_geometry_get(obj, &ai->start.x, &ai->start.y, &ai->start.w, &ai->start.h); - evas_object_show(obj); - ai->obj = obj; - list = eina_list_append(list, ai); - } - DBG("made icon list"); - - return list; -} - -static void -_cont_obj_drag_done_cb(void *data, const Efl_Event *ev EINA_UNUSED) -{ - Sel_Manager_Drag_Container *dc = data; - elm_widget_scroll_freeze_pop(dc->cont); -} - -static Eina_Bool -_cont_obj_drag_start(void *data) -{ - DBG("going to start draging"); - Sel_Manager_Drag_Container *dc = data; - - dc->timer = NULL; - efl_event_callback_add(dc->cont, EFL_UI_DND_EVENT_DRAG_DONE, _cont_obj_drag_done_cb, dc); - elm_widget_scroll_freeze_push(dc->cont); - efl_ui_selection_manager_drag_start(dc->pd->sel_man, dc->cont, dc->format, - eina_rw_slice_slice_get(dc->data), dc->action, - dc->icon_func_data, dc->icon_func, dc->icon_func_free_cb, - dc->seat); - - return ECORE_CALLBACK_CANCEL; -} - -static Eina_Bool -_drag_anim_play(void *data, double pos) -{ - Sel_Manager_Drag_Container *dc = data; - - if (dc->animator) - { - Eina_List *l; - Anim_Icon *ai; - Evas_Coord xm, ym; - - if (pos > 0.99) - { - dc->animator = NULL; - EINA_LIST_FOREACH(dc->icons, l, ai) - evas_object_hide(ai->obj); - - _cont_obj_drag_start(dc); - return ECORE_CALLBACK_CANCEL; - } - - evas_pointer_canvas_xy_get(dc->e, &xm, &ym); - EINA_LIST_FOREACH(dc->icons, l, ai) - { - int x, y, w, h; - w = ai->start.w - ((dc->final_icon.w - ai->start.w) * pos); - h = ai->start.h - ((dc->final_icon.h - ai->start.h) * pos); - x = ai->start.x - (pos * (ai->start.x + (w / 2) - xm)); - y = ai->start.y - (pos * (ai->start.y + (h / 2) - ym)); - evas_object_geometry_set(ai->obj, x, y, w, h); - } - - return ECORE_CALLBACK_RENEW; - } - - return ECORE_CALLBACK_CANCEL; -} - -static inline void -_drag_anim_start(Sel_Manager_Drag_Container *dc) -{ - - dc->timer = NULL; - if (dc->icon_func) - { - Eina_Position2D pos_ret; - Evas_Object *temp_win = elm_win_add(NULL, "Temp", ELM_WIN_DND); - Evas_Object *final_icon = dc->icon_func(dc->icon_func_data, temp_win, dc->cont, &pos_ret); - evas_object_geometry_get(final_icon, NULL, NULL, &dc->final_icon.w, &dc->final_icon.h); - evas_object_del(final_icon); - evas_object_del(temp_win); - } - dc->animator = ecore_evas_animator_timeline_add(dc->e, dc->anim_duration, _drag_anim_play, dc); -} - -static Eina_Bool -_cont_obj_anim_start(void *data) -{ - sel_debug("In"); - Sel_Manager_Drag_Container *dc = data; - Efl_Object *it = NULL; - Eina_Position2D posret; //does not use - - if (dc->item_get_func) - it = dc->item_get_func(dc->item_get_func_data, dc->cont, dc->down, &posret); - dc->timer = NULL; - dc->format = EFL_UI_SELECTION_FORMAT_TARGETS; //default - dc->data.len = 0; - dc->action = EFL_UI_SELECTION_ACTION_COPY; //default - dc->icons = NULL; - - //failed to get mouse-down item, abort drag - if (!it) - return ECORE_CALLBACK_CANCEL; - - if (dc->drag_data_func) - { - dc->drag_data_func(dc->drag_data_func_data, dc->cont, - &dc->format, &dc->data, &dc->action); - if (EINA_DBL_EQ(dc->anim_duration, 0.0)) - { - _cont_obj_drag_start(dc); - } - else - { - dc->icons = _anim_icons_make(dc); - if (dc->icons) - { - _drag_anim_start(dc); - } - else - { - // even if we don't manage the icons animation, we have - // to wait until it is finished before beginning drag. - dc->timer = ecore_timer_add(dc->anim_duration, - _cont_obj_drag_start, dc); - } - } - } - - return ECORE_CALLBACK_CANCEL; -} - -static void -_abort_drag(Evas_Object *obj EINA_UNUSED, Sel_Manager_Drag_Container *dc) -{ - evas_object_event_callback_del_full(dc->cont, EVAS_CALLBACK_MOUSE_MOVE, - _cont_obj_mouse_move_cb, dc); - evas_object_event_callback_del_full(dc->cont, EVAS_CALLBACK_MOUSE_UP, - _cont_obj_mouse_up_cb, dc); - _item_container_del_internal(dc, EINA_FALSE); - - ELM_SAFE_FREE(dc->timer, ecore_timer_del); - _anim_data_free(dc); -} - -static void -_cont_obj_mouse_move_cb(void *data, Evas *e EINA_UNUSED, Evas_Object *obj, void *event_info) -{ - Sel_Manager_Drag_Container *dc = data; - Evas_Event_Mouse_Move *ev = event_info; - - if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD) - { - _abort_drag(obj, dc); - } - if (dc && - (evas_device_class_get(ev->dev) == EVAS_DEVICE_CLASS_TOUCH)) - { - int dx, dy; - int fs = elm_config_finger_size_get(); - - dx = ev->cur.canvas.x - dc->down.x; - dy = ev->cur.canvas.y - dc->down.y; - if ((dx * dx + dy * dy) > (fs * fs)) - { - sel_debug("mouse moved too much - have to cancel DnD"); - _abort_drag(obj, dc); - } - } -} - -static void -_anim_data_free(Sel_Manager_Drag_Container *dc) -{ - if (dc) - { - ELM_SAFE_FREE(dc->animator, ecore_animator_del); - Anim_Icon *ai; - - EINA_LIST_FREE(dc->icons, ai) - { - evas_object_del(ai->obj); - free(ai); - } - dc->icons = NULL; - } -} - -static void -_cont_obj_mouse_up_cb(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info) -{ - Sel_Manager_Drag_Container *dc = data; - - if (((Evas_Event_Mouse_Up *)event_info)->button != 1) - return; - - evas_object_event_callback_del_full(dc->cont, EVAS_CALLBACK_MOUSE_MOVE, - _cont_obj_mouse_move_cb, dc); - evas_object_event_callback_del_full(dc->cont, EVAS_CALLBACK_MOUSE_UP, - _cont_obj_mouse_up_cb, dc); - ELM_SAFE_FREE(dc->timer, ecore_timer_del); - - _anim_data_free(dc); -} - -static void -_cont_obj_mouse_down_cb(void *data, Evas *e, Evas_Object *obj EINA_UNUSED, void *event_info) -{ - Sel_Manager_Drag_Container *dc = data; - Evas_Event_Mouse_Down *ev = event_info; - if (ev->button != 1) - return; - - dc->e = e; - dc->down.x = ev->canvas.x; - dc->down.y = ev->canvas.y; - - evas_object_event_callback_add(dc->cont, EVAS_CALLBACK_MOUSE_UP, - _cont_obj_mouse_up_cb, dc); - ecore_timer_del(dc->timer); - if (dc->time_to_drag) - { - dc->timer = ecore_timer_add(dc->time_to_drag, _cont_obj_anim_start, dc); - evas_object_event_callback_add(dc->cont, EVAS_CALLBACK_MOUSE_MOVE, - _cont_obj_mouse_move_cb, dc); - } - else - { - _cont_obj_anim_start(dc); - } -} - -static void -_item_container_del_internal(Sel_Manager_Drag_Container *dc, Eina_Bool full) -{ - if (dc) - { - ELM_SAFE_FREE(dc->timer, ecore_timer_del); - if (dc->animator) - _anim_data_free(dc); - evas_object_event_callback_del_full(dc->cont, EVAS_CALLBACK_MOUSE_DOWN, - _cont_obj_mouse_down_cb, dc); - if (full) - { - dc->item_get_func = NULL; - dc->item_get_func_data = NULL; - free(dc); - } - } -} - -static int -_drag_item_container_cmp(const void *d1, const void *d2) -{ - const Sel_Manager_Drag_Container *dc = d1; - return (((uintptr_t)dc->cont) - ((uintptr_t)d2)); -} -//exposed APIs -EOLIAN static Eina_Future * -_efl_ui_selection_manager_selection_set(Eo *obj EINA_UNUSED, Efl_Ui_Selection_Manager_Data *pd, - Efl_Object *owner, Efl_Ui_Selection_Type type, - Efl_Ui_Selection_Format format, - Eina_Slice data, unsigned int seat) -{ - Eina_Future *p = NULL; - - sel_debug("owner: %p, seat: %d, type: %d, format: %d", owner, seat, type, format); - if (type > EFL_UI_SELECTION_TYPE_CLIPBOARD) - { - ERR("Not supported format: %d", type); - return NULL; - } - -#ifdef HAVE_ELEMENTARY_X - Ecore_X_Window xwin = _x11_xwin_get(owner); - if (xwin) - p = _x11_efl_sel_manager_selection_set(pd, owner, type, format, data, xwin, seat); -#endif -#ifdef HAVE_ELEMENTARY_WL2 - Ecore_Wl2_Window *win = _wl_window_get(owner); - if (win) - p = _wl_efl_sel_manager_selection_set(pd, owner, type, format, data, win, seat); -#endif -#ifdef HAVE_ELEMENTARY_COCOA - Ecore_Cocoa_Window *win = _cocoa_window_get(owner); - if (win) - p = _cocoa_efl_sel_manager_selection_set(pd, owner, type, format, data, win, seat); -#endif -#ifdef HAVE_ELEMENTARY_WIN32 - Ecore_Win32_Window *win = _win32_window_get(owner); - if (win) - p = _win32_efl_sel_manager_selection_set(pd, owner, type, format, data, win, seat); -#endif - - return p; -} - -//TODO: add support for local -EOLIAN static void -_efl_ui_selection_manager_selection_get(Eo *obj EINA_UNUSED, Efl_Ui_Selection_Manager_Data *pd, - const Efl_Object *request, Efl_Ui_Selection_Type type, - Efl_Ui_Selection_Format format, - void *data_func_data, Efl_Ui_Selection_Data_Ready data_func, - Eina_Free_Cb data_func_free_cb, unsigned int seat) -{ - sel_debug("request: %p, seat: %d, type: %d, format: %d", request, seat, type, format); -#ifdef HAVE_ELEMENTARY_X - Ecore_X_Window xwin = _x11_xwin_get(request); - if (xwin) - _x11_efl_sel_manager_selection_get(request, pd, type, format, data_func_data, - data_func, data_func_free_cb, xwin, seat); -#endif -#ifdef HAVE_ELEMENTARY_WL2 - Ecore_Wl2_Window *win = _wl_window_get(request); - if (win) - _wl_efl_sel_manager_selection_get(request, pd, type, format, data_func_data, - data_func, data_func_free_cb, win, seat); -#endif -#ifdef HAVE_ELEMENTARY_COCOA - Ecore_Cocoa_Window *win = _cocoa_window_get(request); - if (win) - _cocoa_efl_sel_manager_selection_get(request, pd, type, format, data_func_data, - data_func, data_func_free_cb, win, seat); -#endif -#ifdef HAVE_ELEMENTARY_WIN32 - Ecore_Win32_Window *win = _win32_window_get(request); - if (win) - _win32_efl_sel_manager_selection_get(request, pd, type, format, data_func_data, - data_func, data_func_free_cb, win, seat); -#endif -} - -EOLIAN static void -_efl_ui_selection_manager_selection_clear(Eo *obj, Efl_Ui_Selection_Manager_Data *pd, - Efl_Object *owner, Efl_Ui_Selection_Type type, unsigned int seat) -{ - Eina_Bool local = EINA_FALSE; - Sel_Manager_Seat_Selection *seat_sel; - Sel_Manager_Selection *sel = NULL; - - sel_debug("owner: %p, seat: %d, type: %d", owner, seat, type); - seat_sel = _sel_manager_seat_selection_init(pd, seat); -#ifdef HAVE_ELEMENTARY_X - Ecore_X_Window xwin = _x11_xwin_get(obj); - if (xwin) - { - sel = seat_sel->sel_list + type; - } -#endif -#ifdef HAVE_ELEMENTARY_WL2 - Ecore_Wl2_Window *win = _wl_window_get(obj); - if (win) - { - sel = seat_sel->sel; - } -#endif -#ifdef HAVE_ELEMENTARY_COCOA - Ecore_Cocoa_Window *win = _cocoa_window_get(obj); - if (win) - { - sel = seat_sel->sel; - } -#endif -#ifdef HAVE_ELEMENTARY_WIN32 - Ecore_Win32_Window *win = _win32_window_get(obj); - { - sel = seat_sel->sel_list + type; - } -#endif - if (!sel) return; - if ((!sel->active) && (sel->owner != owner)) - { - return; - } - sel->active = EINA_FALSE; -#ifdef HAVE_ELEMENTARY_X - if (xwin) - { - seat_sel->sel_list[type].data.len = 0; - if (seat_sel->sel_list[type].data.mem) - { - free(seat_sel->sel_list[type].data.mem); - seat_sel->sel_list[type].data.mem = NULL; - } - if (sel->xwin != 0) local = EINA_TRUE; - if (!local) seat_sel->sel_list[type].clear(); - else - { - Eina_List *l, *l_next; - Sel_Manager_Selection_Lost *sel_lost; - - EINA_LIST_FOREACH_SAFE(seat_sel->sel_lost_list, l, l_next, sel_lost) - { - if ((sel_lost->request == sel->owner) && - (sel_lost->type == type)) - { - eina_promise_resolve(sel_lost->promise, eina_value_uint_init(sel_lost->type)); - } - } - seat_sel->sel_list[type].owner = NULL; - } - } -#endif -#ifdef HAVE_ELEMENTARY_WL2 - if (win) - { - sel->selection_serial = ecore_wl2_dnd_selection_clear(_wl_seat_get(_wl_window_get(owner), owner, seat)); - } -#endif -#ifdef HAVE_ELEMENTARY_COCOA - if (win) - { - if (sel->owner) - evas_object_event_callback_del_full(sel->owner, EVAS_CALLBACK_DEL, - _cocoa_sel_obj_del_cb, sel); - if (sel->request_obj) - evas_object_event_callback_del_full(sel->request_obj, EVAS_CALLBACK_DEL, - _cocoa_sel_obj_del_req_cb, sel); - sel->owner = NULL; - sel->request_obj = NULL; - ELM_SAFE_FREE(sel->data.mem, free); - sel->data.len = 0; - - ecore_cocoa_clipboard_clear(); - } -#endif -#ifdef HAVE_ELEMENTARY_WIN32 - if (win) - { - _win32_efl_sel_manager_selection_clear(pd, owner, type, seat_sel); - } -#endif -} - -EOLIAN static Eina_Bool -_efl_ui_selection_manager_selection_has_owner(Eo *obj EINA_UNUSED, Efl_Ui_Selection_Manager_Data *pd EINA_UNUSED, - Efl_Object *request, Efl_Ui_Selection_Type type, - unsigned int seat) -{ -#ifdef HAVE_ELEMENTARY_X - (void)seat; - if (_x11_xwin_get(request)) - { - Ecore_X_Atom xtype; - switch (type) - { - case EFL_UI_SELECTION_TYPE_PRIMARY: - xtype = ECORE_X_ATOM_SELECTION_PRIMARY; - break; - case EFL_UI_SELECTION_TYPE_SECONDARY: - xtype = ECORE_X_ATOM_SELECTION_SECONDARY; - break; - case EFL_UI_SELECTION_TYPE_DND: - xtype = ECORE_X_ATOM_SELECTION_XDND; - break; - default: - xtype = ECORE_X_ATOM_SELECTION_CLIPBOARD; - } - return !!ecore_x_selection_owner_get(xtype); - } -#endif -#ifdef HAVE_ELEMENTARY_WL2 - Ecore_Wl2_Window *win; - - win = _wl_window_get(request); - if (win) - return !!ecore_wl2_dnd_selection_get(_wl_seat_get(win, request, seat)); -#endif -#ifdef HAVE_ELEMENTARY_COCOA - // FIXME: need to check if there is clipboard data. Paste always enabled. - return EINA_TRUE; -#endif - return EINA_FALSE; -} - -EOLIAN static void -_efl_ui_selection_manager_drag_start(Eo *obj, Efl_Ui_Selection_Manager_Data *pd, - Efl_Object *drag_obj, Efl_Ui_Selection_Format format, - Eina_Slice data, Efl_Ui_Selection_Action action, - void *icon_func_data, Efl_Dnd_Drag_Icon_Create icon_func, - Eina_Free_Cb icon_func_free_cb, unsigned int seat) -{ -#ifdef HAVE_ELEMENTARY_X - Ecore_X_Window xwin = _x11_xwin_get(drag_obj); - if (xwin) - _x11_efl_sel_manager_drag_start(obj, pd, drag_obj, format, data, action, - icon_func_data, icon_func, icon_func_free_cb, - xwin, seat); -#endif -#ifdef HAVE_ELEMENTARY_WL2 - Ecore_Wl2_Window *win = _wl_window_get(drag_obj); - if (win) - _wl_efl_sel_manager_drag_start(obj, pd, drag_obj, format, data, action, - icon_func_data, icon_func, icon_func_free_cb, - win, seat); -#endif -#ifdef HAVE_ELEMENTARY_WIN32 -#endif -#ifdef HAVE_ELEMENTARY_COCOA -#endif -} - -EOLIAN static void -_efl_ui_selection_manager_drag_cancel(Eo *obj EINA_UNUSED, Efl_Ui_Selection_Manager_Data *pd, - Efl_Object *drag_obj, unsigned int seat) -{ - Sel_Manager_Seat_Selection *seat_sel = _sel_manager_seat_selection_init(pd, seat); - -#ifdef HAVE_ELEMENTARY_X - Ecore_X_Window xwin = _x11_xwin_get(drag_obj); - if (xwin) - { - ecore_x_pointer_ungrab(); - ELM_SAFE_FREE(seat_sel->mouse_up_handler, ecore_event_handler_del); - ELM_SAFE_FREE(seat_sel->dnd_status_handler, ecore_event_handler_del); - ecore_x_dnd_abort(xwin); - if (seat_sel->drag_obj) - { - if (elm_widget_is(seat_sel->drag_obj)) - { - Evas_Object *win = elm_widget_top_get(seat_sel->drag_obj); - if (win && efl_isa(win, EFL_UI_WIN_CLASS)) - efl_event_callback_del(win, EFL_UI_WIN_EVENT_WIN_ROTATION_CHANGED, - _x11_win_rotation_changed_cb, seat_sel->drag_win); - } - } - seat_sel->drag_obj = NULL; - } -#endif -#ifdef HAVE_ELEMENTARY_WL2 - Ecore_Wl2_Window *win; - - win = _wl_window_get(drag_obj); - if (win) - ecore_wl2_dnd_drag_end(_wl_seat_get(win, drag_obj, seat)); -#endif - - ELM_SAFE_FREE(seat_sel->drag_win, evas_object_del); -} - -EOLIAN static void -_efl_ui_selection_manager_drag_action_set(Eo *obj EINA_UNUSED, Efl_Ui_Selection_Manager_Data *pd, - Efl_Object *drag_obj, Efl_Ui_Selection_Action action, - unsigned int seat) -{ - Sel_Manager_Seat_Selection *seat_sel = _sel_manager_seat_selection_init(pd, seat); - if (seat_sel->drag_action == action) return; - seat_sel->drag_action = action; -#ifdef HAVE_ELEMENTARY_X - Ecore_X_Atom actx; - Ecore_X_Window xwin = _x11_xwin_get(drag_obj); - if (xwin) - { - actx = _x11_dnd_action_rev_map(action); - ecore_x_dnd_source_action_set(actx); - } -#endif -} - -//drop side -EOLIAN static Eina_Bool -_efl_ui_selection_manager_drop_target_add(Eo *obj EINA_UNUSED, Efl_Ui_Selection_Manager_Data *pd, - Efl_Object *target_obj, Efl_Ui_Selection_Format format, - unsigned int seat) -{ - Eina_Bool ret = EINA_FALSE; -#ifdef HAVE_ELEMENTARY_X - Ecore_X_Window xwin = _x11_xwin_get(target_obj); - if (xwin) - ret = _x11_sel_manager_drop_target_add(pd, target_obj, format, xwin, seat); -#endif -#ifdef HAVE_ELEMENTARY_WL2 - Ecore_Wl2_Window *win = _wl_window_get(target_obj); - if (win) - ret = _wl_sel_manager_drop_target_add(pd, target_obj, format, seat); -#endif - return ret; -} - -EOLIAN static void -_efl_ui_selection_manager_drop_target_del(Eo *obj EINA_UNUSED, Efl_Ui_Selection_Manager_Data *pd, - Efl_Object *target_obj, Efl_Ui_Selection_Format format, - unsigned int seat) -{ - Sel_Manager_Dropable *dropable = NULL; - Sel_Manager_Seat_Selection *seat_sel; - Eina_Bool remove_handler = EINA_FALSE; - - dropable = efl_key_data_get(target_obj, "__elm_dropable"); - if (dropable) - { - Eina_Inlist *itr; - Drop_Format *df; - EINA_INLIST_FOREACH_SAFE(dropable->format_list, itr, df) - { - if (df->format == format) - { - dropable->format_list = eina_inlist_remove(dropable->format_list, - EINA_INLIST_GET(df)); - free(df); - } - } - if (!dropable->format_list) - { - pd->drop_list = eina_list_remove(pd->drop_list, dropable); - efl_key_data_set(target_obj, "__elm_dropable", NULL); - free(dropable); - evas_object_event_callback_del(target_obj, EVAS_CALLBACK_DEL, - _all_drop_targets_cbs_del); - } - } - -#ifdef HAVE_ELEMENTARY_X - if (pd->drop_list) - { - Eina_List *l; - Ecore_X_Window xwin; - Eina_Bool have_drop_list = EINA_FALSE; - - xwin = _x11_xwin_get(target_obj); - EINA_LIST_FOREACH(pd->drop_list, l, dropable) - { - if (xwin == _x11_xwin_get(dropable->obj)) - { - have_drop_list = EINA_TRUE; - break; - } - } - if (!have_drop_list) - { - ecore_x_dnd_aware_set(xwin, EINA_FALSE); - remove_handler = EINA_TRUE; - } - } - else remove_handler = EINA_TRUE; -#endif - if (remove_handler) - { - seat_sel = _sel_manager_seat_selection_init(pd, seat); - ELM_SAFE_FREE(seat_sel->pos_handler, ecore_event_handler_del); - ELM_SAFE_FREE(seat_sel->drop_handler, ecore_event_handler_del); - ELM_SAFE_FREE(seat_sel->enter_handler, ecore_event_handler_del); - ELM_SAFE_FREE(seat_sel->leave_handler, ecore_event_handler_del); - } -} - -EOLIAN static void -_efl_ui_selection_manager_container_drop_item_add(Eo *obj, Efl_Ui_Selection_Manager_Data *pd, - Efl_Object *cont, Efl_Ui_Selection_Format format, - void *item_func_data, Efl_Dnd_Item_Get item_func, - Eina_Free_Cb item_func_free_cb EINA_UNUSED, - unsigned int seat) -{ - Item_Container_Drop_Info *di; - Sel_Manager_Dropable *dropable = NULL; - - if (_drop_item_container_del(pd, cont, EINA_FALSE)) - { - di = eina_list_search_unsorted(pd->drop_cont_list, _drop_item_container_cmp, obj); - if (!di) return; - } - else - { - di = calloc(1, sizeof(Item_Container_Drop_Info)); - if (!di) return; - - di->obj = obj; - pd->drop_cont_list = eina_list_append(pd->drop_cont_list, di); - } - di->item_func = item_func; - di->item_func_data = item_func_data; - - dropable = efl_key_data_get(cont, "__elm_dropable"); - if (!dropable) - { - dropable = calloc(1, sizeof(Sel_Manager_Dropable)); - if (!dropable) return; - dropable->last.in = EINA_FALSE; - pd->drop_list = eina_list_append(pd->drop_list, dropable); - if (!pd->drop_list) return; - dropable->obj = cont; - efl_key_data_set(cont, "__elm_dropable", dropable); - } - dropable->is_container = EINA_TRUE; - dropable->item_func = item_func; - dropable->item_func_data = item_func_data; - _efl_ui_selection_manager_drop_target_add(obj, pd, cont, format, seat); -} - -EOLIAN static void -_efl_ui_selection_manager_container_drop_item_del(Eo *obj EINA_UNUSED, Efl_Ui_Selection_Manager_Data *pd, - Efl_Object *cont, unsigned int seat EINA_UNUSED) -{ - _drop_item_container_del(pd, cont, EINA_TRUE); -} - -EOLIAN static void -_efl_ui_selection_manager_container_drag_item_add(Eo *obj EINA_UNUSED, Efl_Ui_Selection_Manager_Data *pd, - Efl_Object *cont, double time_to_drag, double anim_duration, - void *data_func_data, Efl_Dnd_Drag_Data_Get data_func, Eina_Free_Cb data_func_free_cb, - void *item_get_func_data, Efl_Dnd_Item_Get item_get_func, Eina_Free_Cb item_get_func_free_cb, - void *icon_func_data, Efl_Dnd_Drag_Icon_Create icon_func, Eina_Free_Cb icon_func_free_cb, - void *icon_list_func_data, Efl_Dnd_Drag_Icon_List_Create icon_list_func, Eina_Free_Cb icon_list_func_free_cb, - unsigned int seat) -{ - //TODO: remove previous drag one - Sel_Manager_Drag_Container *dc = calloc(1, sizeof(Sel_Manager_Drag_Container)); - if (!dc) - { - ERR("Failed to allocate memory"); - return; - } - dc->cont = cont; - dc->time_to_drag = time_to_drag; - dc->anim_duration = anim_duration; - dc->drag_data_func_data = data_func_data; - dc->drag_data_func = data_func; - dc->drag_data_func_free_cb = data_func_free_cb; - dc->item_get_func_data = item_get_func_data; - dc->item_get_func = item_get_func; - dc->item_get_func_free_cb = item_get_func_free_cb; - dc->icon_func_data = icon_func_data; - dc->icon_func = icon_func; - dc->icon_func_free_cb = icon_func_free_cb; - dc->icon_list_func_data = icon_list_func_data; - dc->icon_list_func = icon_list_func; - dc->icon_list_func_free_cb = icon_list_func_free_cb; - dc->seat = seat; - dc->pd = pd; - - _sel_manager_seat_selection_init(pd, seat); - - pd->drag_cont_list = eina_list_append(pd->drag_cont_list, dc); - - evas_object_event_callback_add(cont, EVAS_CALLBACK_MOUSE_DOWN, - _cont_obj_mouse_down_cb, dc); -} - -EOLIAN static void -_efl_ui_selection_manager_container_drag_item_del(Eo *obj EINA_UNUSED, Efl_Ui_Selection_Manager_Data *pd, - Efl_Object *cont, unsigned int seat EINA_UNUSED) -{ - Sel_Manager_Drag_Container *dc = eina_list_search_unsorted(pd->drag_cont_list, - _drag_item_container_cmp, cont); - if (dc) - _item_container_del_internal(dc, EINA_TRUE); -} - -static Eo * -_efl_ui_selection_manager_efl_object_constructor(Eo *obj, Efl_Ui_Selection_Manager_Data *pd) -{ -#if defined(HAVE_ELEMENTARY_X) || defined(HAVE_ELEMENTARY_WL2) - const char *ev = getenv("ELM_DISPLAY"); -#endif - -#ifdef HAVE_ELEMENTARY_X - Eina_Bool init_x = EINA_FALSE; - Eina_Bool have_display = !!getenv("DISPLAY"); - - if (ev) /* If ELM_DISPLAY is specified */ - { - if (!strcmp(ev, "x11")) /* and it is X11 */ - { - if (!have_display) /* if there is no $DISPLAY */ - { - ERR("$ELM_DISPLAY is set to x11 but $DISPLAY is not set"); - init_x = EINA_FALSE; - } - else /* if there is */ - init_x = EINA_TRUE; - } - else /* not X11 */ - init_x = EINA_FALSE; - } - else /* ELM_DISPLAY not specified */ - { - if (have_display) /* If there is a $DISPLAY */ - init_x = EINA_TRUE; - else /* No $DISPLAY */ - init_x = EINA_FALSE; - } - if (init_x) - { - if (!ecore_x_init(NULL)) - { - ERR("Could not initialize Ecore_X"); - return NULL; - } - } -#endif -#ifdef HAVE_ELEMENTARY_WL2 - Eina_Bool init_wl = EINA_FALSE; - Eina_Bool have_wl_display = !!getenv("WAYLAND_DISPLAY"); - - if (ev) /* If ELM_DISPLAY is specified */ - { - if (!strcmp(ev, "wl")) /* and it is WL */ - { - /* always try to connect to wl when it is enforced */ - init_wl = EINA_TRUE; - } - else /* not wl */ - init_wl = EINA_FALSE; - } - else /* ELM_DISPLAY not specified */ - { - /* If there is a $WAYLAND_DISPLAY */ - if ((have_wl_display) && (!getenv("DISPLAY"))) - init_wl = EINA_TRUE; - else /* No $WAYLAND_DISPLAY */ - init_wl = EINA_FALSE; - } - if (init_wl) - { - if (!ecore_wl2_init()) - { - ERR("Could not initialize Ecore_Wl2"); - return NULL; - } - _elm_wl_display = ecore_wl2_display_connect(NULL); - if (!_elm_wl_display) - { - ERR("Could not connect to Wayland Display"); - ecore_wl2_shutdown(); - return NULL; - } - } -#endif - - obj = efl_constructor(efl_super(obj, MY_CLASS)); - - pd->sel_man = obj; - pd->atom_list = calloc(1, SELECTION_N_ATOMS * sizeof(Sel_Manager_Atom)); - if (!pd->atom_list) - { - ERR("failed to allocate atom_list"); - return NULL; - } - pd->atom_list[SELECTION_ATOM_TARGETS].name = "TARGETS"; - pd->atom_list[SELECTION_ATOM_TARGETS].format = EFL_UI_SELECTION_FORMAT_TARGETS; -#ifdef HAVE_ELEMENTARY_X - pd->atom_list[SELECTION_ATOM_TARGETS].x_converter = _x11_targets_converter; -#endif -#ifdef HAVE_ELEMENTARY_WL2 - pd->atom_list[SELECTION_ATOM_TARGETS].wl_converter = _wl_targets_converter; -#endif - pd->atom_list[SELECTION_ATOM_ATOM].name = "ATOM"; // for opera browser - pd->atom_list[SELECTION_ATOM_ATOM].format = EFL_UI_SELECTION_FORMAT_TARGETS; -#ifdef HAVE_ELEMENTARY_X - pd->atom_list[SELECTION_ATOM_ATOM].x_converter = _x11_targets_converter; -#endif -#ifdef HAVE_ELEMENTARY_WL2 - pd->atom_list[SELECTION_ATOM_ATOM].wl_converter = _wl_targets_converter; -#endif - - pd->atom_list[SELECTION_ATOM_ELM].name = "application/x-elementary-markup"; - pd->atom_list[SELECTION_ATOM_ELM].format = EFL_UI_SELECTION_FORMAT_MARKUP; -#ifdef HAVE_ELEMENTARY_X - pd->atom_list[SELECTION_ATOM_ELM].x_converter = _x11_general_converter; - pd->atom_list[SELECTION_ATOM_ELM].x_data_preparer = _x11_data_preparer_markup; -#endif -#ifdef HAVE_ELEMENTARY_WL2 - pd->atom_list[SELECTION_ATOM_ELM].wl_converter = _wl_general_converter; - pd->atom_list[SELECTION_ATOM_ELM].wl_data_preparer = _wl_data_preparer_markup; -#endif - - pd->atom_list[SELECTION_ATOM_TEXT_URILIST].name = "text/uri-list"; - pd->atom_list[SELECTION_ATOM_TEXT_URILIST].format = EFL_UI_SELECTION_FORMAT_TEXT; -#ifdef HAVE_ELEMENTARY_X - pd->atom_list[SELECTION_ATOM_TEXT_URILIST].x_converter = _x11_general_converter; - pd->atom_list[SELECTION_ATOM_TEXT_URILIST].x_data_preparer = _x11_data_preparer_uri; -#endif -#ifdef HAVE_ELEMENTARY_WL2 - pd->atom_list[SELECTION_ATOM_TEXT_URILIST].wl_converter = _wl_general_converter; - pd->atom_list[SELECTION_ATOM_TEXT_URILIST].wl_data_preparer = _wl_data_preparer_uri; -#endif - - pd->atom_list[SELECTION_ATOM_TEXT_X_VCARD].name = "text/x-vcard"; - pd->atom_list[SELECTION_ATOM_TEXT_X_VCARD].format = EFL_UI_SELECTION_FORMAT_VCARD; -#ifdef HAVE_ELEMENTARY_X - pd->atom_list[SELECTION_ATOM_TEXT_X_VCARD].x_converter = _x11_vcard_send; - pd->atom_list[SELECTION_ATOM_TEXT_X_VCARD].x_data_preparer = _x11_data_preparer_vcard; -#endif -#ifdef HAVE_ELEMENTARY_WL2 - pd->atom_list[SELECTION_ATOM_TEXT_X_VCARD].wl_data_preparer = _wl_data_preparer_vcard; -#endif - - pd->atom_list[SELECTION_ATOM_IMAGE_PNG].name = "image/png"; - pd->atom_list[SELECTION_ATOM_IMAGE_PNG].format = EFL_UI_SELECTION_FORMAT_IMAGE; -#ifdef HAVE_ELEMENTARY_X - pd->atom_list[SELECTION_ATOM_IMAGE_PNG].x_converter = _x11_image_converter; - pd->atom_list[SELECTION_ATOM_IMAGE_PNG].x_data_preparer = _x11_data_preparer_image; -#endif -#ifdef HAVE_ELEMENTARY_WL2 - pd->atom_list[SELECTION_ATOM_IMAGE_PNG].wl_data_preparer = _wl_data_preparer_image; -#endif - - pd->atom_list[SELECTION_ATOM_IMAGE_JPEG].name = "image/jpeg"; - pd->atom_list[SELECTION_ATOM_IMAGE_JPEG].format = EFL_UI_SELECTION_FORMAT_IMAGE; -#ifdef HAVE_ELEMENTARY_X - pd->atom_list[SELECTION_ATOM_IMAGE_JPEG].x_converter = _x11_image_converter; - pd->atom_list[SELECTION_ATOM_IMAGE_JPEG].x_data_preparer = _x11_data_preparer_image; -#endif -#ifdef HAVE_ELEMENTARY_WL2 - pd->atom_list[SELECTION_ATOM_IMAGE_JPEG].wl_data_preparer = _wl_data_preparer_image; -#endif - - pd->atom_list[SELECTION_ATOM_IMAGE_BMP].name = "image/x-ms-bmp"; - pd->atom_list[SELECTION_ATOM_IMAGE_BMP].format = EFL_UI_SELECTION_FORMAT_IMAGE; -#ifdef HAVE_ELEMENTARY_X - pd->atom_list[SELECTION_ATOM_IMAGE_BMP].x_converter = _x11_image_converter; - pd->atom_list[SELECTION_ATOM_IMAGE_BMP].x_data_preparer = _x11_data_preparer_image; -#endif -#ifdef HAVE_ELEMENTARY_WL2 - pd->atom_list[SELECTION_ATOM_IMAGE_BMP].wl_data_preparer = _wl_data_preparer_image; -#endif - - pd->atom_list[SELECTION_ATOM_IMAGE_GIF].name = "image/gif"; - pd->atom_list[SELECTION_ATOM_IMAGE_GIF].format = EFL_UI_SELECTION_FORMAT_IMAGE; -#ifdef HAVE_ELEMENTARY_X - pd->atom_list[SELECTION_ATOM_IMAGE_GIF].x_converter = _x11_image_converter; - pd->atom_list[SELECTION_ATOM_IMAGE_GIF].x_data_preparer = _x11_data_preparer_image; -#endif -#ifdef HAVE_ELEMENTARY_WL2 - pd->atom_list[SELECTION_ATOM_IMAGE_GIF].wl_data_preparer = _wl_data_preparer_image; -#endif - - pd->atom_list[SELECTION_ATOM_IMAGE_TIFF].name = "image/tiff"; - pd->atom_list[SELECTION_ATOM_IMAGE_TIFF].format = EFL_UI_SELECTION_FORMAT_IMAGE; -#ifdef HAVE_ELEMENTARY_X - pd->atom_list[SELECTION_ATOM_IMAGE_TIFF].x_converter = _x11_image_converter; - pd->atom_list[SELECTION_ATOM_IMAGE_TIFF].x_data_preparer = _x11_data_preparer_image; -#endif -#ifdef HAVE_ELEMENTARY_WL2 - pd->atom_list[SELECTION_ATOM_IMAGE_TIFF].wl_data_preparer = _wl_data_preparer_image; -#endif - - pd->atom_list[SELECTION_ATOM_IMAGE_SVG].name = "image/svg+xml"; - pd->atom_list[SELECTION_ATOM_IMAGE_SVG].format = EFL_UI_SELECTION_FORMAT_IMAGE; -#ifdef HAVE_ELEMENTARY_X - pd->atom_list[SELECTION_ATOM_IMAGE_SVG].x_converter = _x11_image_converter; - pd->atom_list[SELECTION_ATOM_IMAGE_SVG].x_data_preparer = _x11_data_preparer_image; -#endif -#ifdef HAVE_ELEMENTARY_WL2 - pd->atom_list[SELECTION_ATOM_IMAGE_SVG].wl_data_preparer = _wl_data_preparer_image; -#endif - - pd->atom_list[SELECTION_ATOM_IMAGE_XPM].name = "image/x-xpixmap"; - pd->atom_list[SELECTION_ATOM_IMAGE_XPM].format = EFL_UI_SELECTION_FORMAT_IMAGE; -#ifdef HAVE_ELEMENTARY_X - pd->atom_list[SELECTION_ATOM_IMAGE_XPM].x_converter = _x11_image_converter; - pd->atom_list[SELECTION_ATOM_IMAGE_XPM].x_data_preparer = _x11_data_preparer_image; -#endif -#ifdef HAVE_ELEMENTARY_WL2 - pd->atom_list[SELECTION_ATOM_IMAGE_XPM].wl_data_preparer = _wl_data_preparer_image; -#endif - - pd->atom_list[SELECTION_ATOM_IMAGE_TGA].name = "image/x-tga"; - pd->atom_list[SELECTION_ATOM_IMAGE_TGA].format = EFL_UI_SELECTION_FORMAT_IMAGE; -#ifdef HAVE_ELEMENTARY_X - pd->atom_list[SELECTION_ATOM_IMAGE_TGA].x_converter = _x11_image_converter; - pd->atom_list[SELECTION_ATOM_IMAGE_TGA].x_data_preparer = _x11_data_preparer_image; -#endif -#ifdef HAVE_ELEMENTARY_WL2 - pd->atom_list[SELECTION_ATOM_IMAGE_TGA].wl_data_preparer = _wl_data_preparer_image; -#endif - - pd->atom_list[SELECTION_ATOM_IMAGE_PPM].name = "image/x-portable-pixmap"; - pd->atom_list[SELECTION_ATOM_IMAGE_PPM].format = EFL_UI_SELECTION_FORMAT_IMAGE; -#ifdef HAVE_ELEMENTARY_X - pd->atom_list[SELECTION_ATOM_IMAGE_PPM].x_converter = _x11_image_converter; - pd->atom_list[SELECTION_ATOM_IMAGE_PPM].x_data_preparer = _x11_data_preparer_image; -#endif -#ifdef HAVE_ELEMENTARY_WL2 - pd->atom_list[SELECTION_ATOM_IMAGE_PPM].wl_data_preparer = _wl_data_preparer_image; -#endif - - pd->atom_list[SELECTION_ATOM_UTF8STRING].name = "UTF8_STRING"; - pd->atom_list[SELECTION_ATOM_UTF8STRING].format = EFL_UI_SELECTION_FORMAT_TEXT | EFL_UI_SELECTION_FORMAT_MARKUP | EFL_UI_SELECTION_FORMAT_HTML; -#ifdef HAVE_ELEMENTARY_X - pd->atom_list[SELECTION_ATOM_UTF8STRING].x_converter = _x11_text_converter; - pd->atom_list[SELECTION_ATOM_UTF8STRING].x_data_preparer = _x11_data_preparer_text; -#endif -#ifdef HAVE_ELEMENTARY_WL2 - pd->atom_list[SELECTION_ATOM_UTF8STRING].wl_converter = _wl_text_converter; - pd->atom_list[SELECTION_ATOM_UTF8STRING].wl_data_preparer = _wl_data_preparer_text, -#endif - - pd->atom_list[SELECTION_ATOM_STRING].name = "STRING"; - pd->atom_list[SELECTION_ATOM_STRING].format = EFL_UI_SELECTION_FORMAT_TEXT | EFL_UI_SELECTION_FORMAT_MARKUP | EFL_UI_SELECTION_FORMAT_HTML; -#ifdef HAVE_ELEMENTARY_X - pd->atom_list[SELECTION_ATOM_STRING].x_converter = _x11_text_converter; - pd->atom_list[SELECTION_ATOM_STRING].x_data_preparer = _x11_data_preparer_text; -#endif -#ifdef HAVE_ELEMENTARY_WL2 - pd->atom_list[SELECTION_ATOM_STRING].wl_converter = _wl_text_converter; - pd->atom_list[SELECTION_ATOM_STRING].wl_data_preparer = _wl_data_preparer_text; -#endif - - pd->atom_list[SELECTION_ATOM_COMPOUND_TEXT].name = "COMPOUND_TEXT"; - pd->atom_list[SELECTION_ATOM_COMPOUND_TEXT].format = EFL_UI_SELECTION_FORMAT_TEXT | EFL_UI_SELECTION_FORMAT_MARKUP | EFL_UI_SELECTION_FORMAT_HTML; -#ifdef HAVE_ELEMENTARY_X - pd->atom_list[SELECTION_ATOM_COMPOUND_TEXT].x_converter = _x11_text_converter; - pd->atom_list[SELECTION_ATOM_COMPOUND_TEXT].x_data_preparer = _x11_data_preparer_text; -#endif -#ifdef HAVE_ELEMENTARY_WL2 - pd->atom_list[SELECTION_ATOM_COMPOUND_TEXT].wl_converter = _wl_text_converter; - pd->atom_list[SELECTION_ATOM_COMPOUND_TEXT].wl_data_preparer = _wl_data_preparer_text; -#endif - - pd->atom_list[SELECTION_ATOM_TEXT].name = "TEXT"; - pd->atom_list[SELECTION_ATOM_TEXT].format = EFL_UI_SELECTION_FORMAT_TEXT | EFL_UI_SELECTION_FORMAT_MARKUP | EFL_UI_SELECTION_FORMAT_HTML; -#ifdef HAVE_ELEMENTARY_X - pd->atom_list[SELECTION_ATOM_TEXT].x_converter = _x11_text_converter; - pd->atom_list[SELECTION_ATOM_TEXT].x_data_preparer = _x11_data_preparer_text; -#endif -#ifdef HAVE_ELEMENTARY_WL2 - pd->atom_list[SELECTION_ATOM_TEXT].wl_converter = _wl_text_converter; - pd->atom_list[SELECTION_ATOM_TEXT].wl_data_preparer = _wl_data_preparer_text; -#endif - - pd->atom_list[SELECTION_ATOM_TEXT_PLAIN_UTF8].name = "text/plain;charset=utf-8"; - pd->atom_list[SELECTION_ATOM_TEXT_PLAIN_UTF8].format = EFL_UI_SELECTION_FORMAT_TEXT; -#ifdef HAVE_ELEMENTARY_X - pd->atom_list[SELECTION_ATOM_TEXT_PLAIN_UTF8].x_converter = _x11_text_converter; - pd->atom_list[SELECTION_ATOM_TEXT_PLAIN_UTF8].x_data_preparer = _x11_data_preparer_text; -#endif -#ifdef HAVE_ELEMENTARY_WL2 - pd->atom_list[SELECTION_ATOM_TEXT_PLAIN_UTF8].wl_converter = _wl_text_converter; - pd->atom_list[SELECTION_ATOM_TEXT_PLAIN_UTF8].wl_data_preparer = _wl_data_preparer_text; -#endif - - pd->atom_list[SELECTION_ATOM_TEXT_PLAIN].name = "text/plain"; - pd->atom_list[SELECTION_ATOM_TEXT_PLAIN].format = EFL_UI_SELECTION_FORMAT_TEXT; -#ifdef HAVE_ELEMENTARY_X - pd->atom_list[SELECTION_ATOM_TEXT_PLAIN].x_converter = _x11_text_converter; - pd->atom_list[SELECTION_ATOM_TEXT_PLAIN].x_data_preparer = _x11_data_preparer_text; -#endif -#ifdef HAVE_ELEMENTARY_WL2 - pd->atom_list[SELECTION_ATOM_TEXT_PLAIN].wl_converter = _wl_text_converter; - pd->atom_list[SELECTION_ATOM_TEXT_PLAIN].wl_data_preparer = _wl_data_preparer_text; -#endif - - - int i; -#ifdef HAVE_ELEMENTARY_X - if (ecore_x_display_get()) - { - for (i = 0; i < SELECTION_N_ATOMS; i++) - { - pd->atom_list[i].x_atom = ecore_x_atom_get(pd->atom_list[i].name); - ecore_x_selection_converter_atom_add - (pd->atom_list[i].x_atom, pd->atom_list[i].x_converter); - } - pd->notify_handler = ecore_event_handler_add(ECORE_X_EVENT_SELECTION_NOTIFY, - _efl_sel_manager_x11_selection_notify, pd); - pd->clear_handler = ecore_event_handler_add(ECORE_X_EVENT_SELECTION_CLEAR, - _x11_selection_clear, pd); - if (ECORE_X_EVENT_FIXES_SELECTION_NOTIFY) // If XFIXES is not available ECORE_X_EVENT_FIXES_SELECTION_NOTIFY would be NULL - pd->fix_handler = ecore_event_handler_add(ECORE_X_EVENT_FIXES_SELECTION_NOTIFY, - _x11_fixes_selection_notify, pd); - } -#endif - - pd->type_hash = eina_hash_string_small_new(NULL); - for (i = 0; i < SELECTION_N_ATOMS; i++) - { - eina_hash_add(pd->type_hash, pd->atom_list[i].name, &pd->atom_list[i]); - } - pd->text_uri = eina_stringshare_add("text/uri-list"); - -#ifdef HAVE_ELEMENTARY_WL2 - if (_elm_wl_display) - { - pd->send_handler = ecore_event_handler_add(ECORE_WL2_EVENT_DATA_SOURCE_SEND, - _wl_selection_send, pd); - pd->changed_handler = ecore_event_handler_add(ECORE_WL2_EVENT_SEAT_SELECTION, - _wl_selection_changed, pd); - pd->end_handler = ecore_event_handler_add(ECORE_WL2_EVENT_DATA_SOURCE_END, - _wl_dnd_end, pd); - } -#endif - managers = eina_list_append(managers, obj); - return obj; -} - -static void -_efl_ui_selection_manager_efl_object_destructor(Eo *obj, Efl_Ui_Selection_Manager_Data *pd) -{ - Sel_Manager_Seat_Selection *seat_sel; - Eina_List *l; - Sel_Manager_Dropable *dropable; - - managers = eina_list_remove(managers, obj); - EINA_LIST_FOREACH(pd->drop_list, l, dropable) - { - _drop_target_cbs_del(pd, dropable, dropable->obj); - } -#ifdef HAVE_ELEMENTARY_X - ecore_event_handler_del(pd->notify_handler); - ecore_event_handler_del(pd->clear_handler); -#endif -#ifdef HAVE_ELEMENTARY_WL2 - ecore_event_handler_del(pd->send_handler); - ecore_event_handler_del(pd->changed_handler); - ecore_event_handler_del(pd->end_handler); -#endif - free(pd->atom_list); - EINA_LIST_FREE(pd->seat_list, seat_sel) - { - ecore_event_handler_del(seat_sel->pos_handler); - ecore_event_handler_del(seat_sel->drop_handler); - ecore_event_handler_del(seat_sel->enter_handler); - ecore_event_handler_del(seat_sel->leave_handler); -#ifdef HAVE_ELEMENTARY_X - free(seat_sel->sel_list); -#endif -#ifdef HAVE_ELEMENTARY_WL2 - free(seat_sel->sel); -#endif -#ifdef HAVE_ELEMENTARY_COCOA - free(seat_sel->sel); -#endif -#ifdef HAVE_ELEMENTARY_WIN32 - free(seat_sel->sel_list); -#endif - free(seat_sel->saved_types->types); - free(seat_sel->saved_types->imgfile); - free(seat_sel->saved_types); - } - eina_hash_free(pd->type_hash); - eina_stringshare_del(pd->text_uri); - - efl_destructor(efl_super(obj, MY_CLASS)); -#if defined(HAVE_ELEMENTARY_X) || defined(HAVE_ELEMENTARY_WL2) || defined(HAVE_ELEMENTARY_WIN32) - const char *ev = getenv("ELM_DISPLAY"); -#endif - -#ifdef HAVE_ELEMENTARY_X - Eina_Bool init_x = EINA_FALSE; - Eina_Bool have_display = !!getenv("DISPLAY"); - - if (ev) /* If ELM_DISPLAY is specified */ - { - if (!strcmp(ev, "x11")) /* and it is X11 */ - { - if (!have_display) /* if there is no $DISPLAY */ - { - ERR("$ELM_DISPLAY is set to x11 but $DISPLAY is not set"); - init_x = EINA_FALSE; - } - else /* if there is */ - init_x = EINA_TRUE; - } - else /* not X11 */ - init_x = EINA_FALSE; - } - else /* ELM_DISPLAY not specified */ - { - if (have_display) /* If there is a $DISPLAY */ - init_x = EINA_TRUE; - else /* No $DISPLAY */ - init_x = EINA_FALSE; - } - if (init_x) - { - if (ecore_x_display_get()) - ecore_x_shutdown(); - } -#endif -#ifdef HAVE_ELEMENTARY_WL2 - Eina_Bool init_wl = EINA_FALSE; - Eina_Bool have_wl_display = !!getenv("WAYLAND_DISPLAY"); - - if (ev) /* If ELM_DISPLAY is specified */ - { - if (!strcmp(ev, "wl")) /* and it is WL */ - { - /* always try to connect to wl when it is enforced */ - init_wl = EINA_TRUE; - } - else /* not wl */ - init_wl = EINA_FALSE; - } - else /* ELM_DISPLAY not specified */ - { - /* If there is a $WAYLAND_DISPLAY */ - if ((have_wl_display) && (!getenv("DISPLAY"))) - init_wl = EINA_TRUE; - else /* No $WAYLAND_DISPLAY */ - init_wl = EINA_FALSE; - } - if (init_wl) - { - if (!managers) ecore_wl2_display_disconnect(_elm_wl_display); - ecore_wl2_shutdown(); - } -#endif -} - -#ifdef HAVE_ELEMENTARY_X -static void -_set_selection_list(Sel_Manager_Selection *sel_list, Sel_Manager_Seat_Selection *seat_sel) -{ - sel_list[EFL_UI_SELECTION_TYPE_PRIMARY].debug = "Primary"; - sel_list[EFL_UI_SELECTION_TYPE_PRIMARY].ecore_sel = ECORE_X_SELECTION_PRIMARY; - sel_list[EFL_UI_SELECTION_TYPE_PRIMARY].set = ecore_x_selection_primary_set; - sel_list[EFL_UI_SELECTION_TYPE_PRIMARY].clear = ecore_x_selection_primary_clear; - sel_list[EFL_UI_SELECTION_TYPE_PRIMARY].request = ecore_x_selection_primary_request; - sel_list[EFL_UI_SELECTION_TYPE_PRIMARY].seat_sel = seat_sel; - - sel_list[EFL_UI_SELECTION_TYPE_SECONDARY].debug = "Secondary"; - sel_list[EFL_UI_SELECTION_TYPE_SECONDARY].ecore_sel = ECORE_X_SELECTION_SECONDARY; - sel_list[EFL_UI_SELECTION_TYPE_SECONDARY].set = ecore_x_selection_secondary_set; - sel_list[EFL_UI_SELECTION_TYPE_SECONDARY].clear = ecore_x_selection_secondary_clear; - sel_list[EFL_UI_SELECTION_TYPE_SECONDARY].request = ecore_x_selection_secondary_request; - sel_list[EFL_UI_SELECTION_TYPE_SECONDARY].seat_sel = seat_sel; - - sel_list[EFL_UI_SELECTION_TYPE_DND].debug = "DnD"; - sel_list[EFL_UI_SELECTION_TYPE_DND].ecore_sel = ECORE_X_SELECTION_PRIMARY; - sel_list[EFL_UI_SELECTION_TYPE_DND].request = ecore_x_selection_xdnd_request; - sel_list[EFL_UI_SELECTION_TYPE_DND].seat_sel = seat_sel; - - sel_list[EFL_UI_SELECTION_TYPE_CLIPBOARD].debug = "Clipboard"; - sel_list[EFL_UI_SELECTION_TYPE_CLIPBOARD].ecore_sel = ECORE_X_SELECTION_CLIPBOARD; - sel_list[EFL_UI_SELECTION_TYPE_CLIPBOARD].set = ecore_x_selection_clipboard_set; - sel_list[EFL_UI_SELECTION_TYPE_CLIPBOARD].clear = ecore_x_selection_clipboard_clear; - sel_list[EFL_UI_SELECTION_TYPE_CLIPBOARD].request = ecore_x_selection_clipboard_request; - sel_list[EFL_UI_SELECTION_TYPE_CLIPBOARD].seat_sel = seat_sel; -} -#endif -#ifdef HAVE_ELEMENTARY_WIN32 -static void -_set_selection_list(Sel_Manager_Selection *sel_list, Sel_Manager_Seat_Selection *seat_sel) -{ - sel_list[EFL_UI_SELECTION_TYPE_PRIMARY].debug = "Primary"; - sel_list[EFL_UI_SELECTION_TYPE_PRIMARY].ecore_sel = ECORE_WIN32_SELECTION_PRIMARY; - sel_list[EFL_UI_SELECTION_TYPE_PRIMARY].set = ecore_win32_clipboard_set; - sel_list[EFL_UI_SELECTION_TYPE_PRIMARY].clear = ecore_win32_clipboard_clear; - sel_list[EFL_UI_SELECTION_TYPE_PRIMARY].get = ecore_win32_clipboard_get; - sel_list[EFL_UI_SELECTION_TYPE_PRIMARY].seat_sel = seat_sel; - - sel_list[EFL_UI_SELECTION_TYPE_SECONDARY].debug = "Secondary"; - sel_list[EFL_UI_SELECTION_TYPE_SECONDARY].ecore_sel = ECORE_WIN32_SELECTION_OTHER; - sel_list[EFL_UI_SELECTION_TYPE_SECONDARY].seat_sel = seat_sel; - - sel_list[EFL_UI_SELECTION_TYPE_DND].debug = "DnD"; - sel_list[EFL_UI_SELECTION_TYPE_DND].ecore_sel = ECORE_WIN32_SELECTION_OTHER; - sel_list[EFL_UI_SELECTION_TYPE_DND].seat_sel = seat_sel; - - sel_list[EFL_UI_SELECTION_TYPE_CLIPBOARD].debug = "Clipboard"; - sel_list[EFL_UI_SELECTION_TYPE_CLIPBOARD].ecore_sel = ECORE_WIN32_SELECTION_CLIPBOARD; - sel_list[EFL_UI_SELECTION_TYPE_CLIPBOARD].set = ecore_win32_clipboard_set; - sel_list[EFL_UI_SELECTION_TYPE_CLIPBOARD].clear = ecore_win32_clipboard_clear; - sel_list[EFL_UI_SELECTION_TYPE_CLIPBOARD].seat_sel = seat_sel; -} -#endif - -#include "efl_ui_selection_manager.eo.c" diff --git a/src/lib/elementary/efl_ui_selection_manager.eo b/src/lib/elementary/efl_ui_selection_manager.eo deleted file mode 100644 index e7df9cce77..0000000000 --- a/src/lib/elementary/efl_ui_selection_manager.eo +++ /dev/null @@ -1,139 +0,0 @@ -import efl_ui_dnd_types; - -class @beta Efl.Ui.Selection_Manager extends Efl.Object { - methods { - selection_set @beta { - [[Set selection]] - params { - @in owner: Efl.Object; [[Seleciton owner]] - @in type: Efl.Ui.Selection_Type; [[Selection type]] - @in format: Efl.Ui.Selection_Format; [[Selection format]] - @in data: Eina.Slice; [[Selection data]] - @in seat: uint @optional;[[Specified seat for multiple seats case.]] - } - return: future<void>; [[Future for tracking when the selection is lost]] - } - selection_get @beta { - [[Get selection]] - params { - @in request: const(Efl.Object); [[Seleciton owner]] - @in type: Efl.Ui.Selection_Type; [[Selection type]] - @in format: Efl.Ui.Selection_Format; [[Selection Format]] - @in data_func: Efl.Ui.Selection_Data_Ready; [[Data ready function pointer]] - @in seat: uint @optional;[[Specified seat for multiple seats case.]] - } - } - selection_clear @beta { - params { - @in owner: Efl.Object; [[Seleciton owner]] - @in type: Efl.Ui.Selection_Type; [[Selection type]] - @in seat: uint @optional; [[Specified seat for multiple seats case.]] - } - } - selection_has_owner @beta { - [[Check if the request object has selection or not]] - params { - @in request: Efl.Object; [[Request object]] - @in type: Efl.Ui.Selection_Type; [[Selection type]] - @in seat: uint @optional; [[Specified seat for multiple seats case.]] - } - return: bool; [[EINA_TRUE if the request object has selection, otherwise, EINA_FALSE]] - } - drag_start @beta { - [[This starts a drag and drop process at the drag side. - During dragging, there are three events emitted as belows: - - EFL_UI_DND_EVENT_DRAG_POS - - EFL_UI_DND_EVENT_DRAG_ACCEPT - - EFL_UI_DND_EVENT_DRAG_DONE - ]] - params { - @in drag_obj: Efl.Object; [[Drag object]] - @in format: Efl.Ui.Selection_Format; [[Data format]] - @in data: Eina.Slice; [[Data to transfer]] - @in action: Efl.Ui.Selection_Action; [[Action when data is transferred]] - @in icon_func: Efl.Dnd.Drag_Icon_Create; [[Function pointer to create icon]] - @in seat: uint; [[Specified seat for multiple seats case.]] - } - } - drag_action_set @beta { - [[This sets the action for the drag]] - params { - @in drag_obj: Efl.Object; [[Drag object]] - @in action: Efl.Ui.Selection_Action; [[Drag action]] - @in seat: uint; [[Specified seat for multiple seats case.]] - } - } - drag_cancel @beta { - [[This cancels the on-going drag]] - params { - @in drag_obj: Efl.Object; [[Drag object]] - @in seat: uint; [[Specified seat for multiple seats case.]] - } - } - container_drag_item_add @beta { - [[This registers a drag for items in a container. Many items can be - dragged at a time. During dragging, there are three events emitted: - - EFL_UI_DND_EVENT_DRAG_POS - - EFL_UI_DND_EVENT_DRAG_ACCEPT - - EFL_UI_DND_EVENT_DRAG_DONE.]] - params { - @in cont: Efl.Object; [[Container object]] - @in time_to_drag: double; [[Time since mouse down happens to drag starts]] - @in anim_duration: double; [[animation duration]] - @in data_func: Efl.Dnd.Drag_Data_Get; [[Data and its format]] - @in item_func: Efl.Dnd.Item_Get; [[Item to determine drag start]] - @in icon_func: Efl.Dnd.Drag_Icon_Create; [[Icon used during drag]] - @in icon_list_func: Efl.Dnd.Drag_Icon_List_Create; [[Icons used for animations]] - @in seat: uint; [[Specified seat for multiple seats case]] - } - } - container_drag_item_del @beta { - [[Remove drag function of items in the container object.]] - params { - @in cont: Efl.Object; [[Container object]] - @in seat: uint; [[Specified seat for multiple seats case]] - } - } - drop_target_add @beta { - [[Add a dropable target. There are four events emitted: - - EFL_UI_DND_DROP_DRAG_ENTER - - EFL_UI_DND_DROP_DRAG_LEAVE - - EFL_UI_DND_DROP_DRAG_POS - - EFL_UI_DND_DROP_DRAG_DROP.]] - params { - @in target_obj: Efl.Object; [[Drop target]] - @in format: Efl.Ui.Selection_Format; [[Accepted data format]] - @in seat: uint; [[Specified seat for multiple seats case.]] - } - return: bool; [[$true on success, $false otherwise]] - } - drop_target_del @beta { - [[Remove a dropable target]] - params { - @in target_obj: Efl.Object; [[Drop target]] - @in format: Efl.Ui.Selection_Format; [[Accepted data format]] - @in seat: uint; [[Specified seat for multiple seats case.]] - } - } - container_drop_item_add @beta { - [[Add dropable target for a container in which items can drop to it]] - params { - @in cont: Efl.Object; [[Container object]] - @in format: Efl.Ui.Selection_Format; [[Accepted data formats]] - @in item_func: Efl.Dnd.Item_Get; [[Get item at specific position]] - @in seat: uint; [[Specified seat for multiple seats case.]] - } - } - container_drop_item_del @beta { - [[Remove dropable target for the container]] - params { - @in cont: Efl.Object; [[Container object]] - @in seat: uint; [[Specified seat for multiple seats case.]] - } - } - } - implements { - Efl.Object.constructor; - Efl.Object.destructor; - } -} diff --git a/src/lib/elementary/efl_ui_selection_types.eot b/src/lib/elementary/efl_ui_selection_types.eot deleted file mode 100644 index cbe5e0dc7b..0000000000 --- a/src/lib/elementary/efl_ui_selection_types.eot +++ /dev/null @@ -1,60 +0,0 @@ -enum @beta Efl.Ui.Selection_Type -{ - [[Selection type]] - primary, [[Primary text selection (highlighted or selected text)]] - secondary, [[Used when primary selection is in use]] - dnd, [[Drag and Drop]] - clipboard [[Clipboard selection (ctrl+C)]] -} - -enum @beta Efl.Ui.Selection_Format -{ - [[Selection format]] - targets = -1, [[For matching every possible atom]] - none = 0x0, [[Content is from outside of EFL]] - text = 0x01, [[Plain unformatted text: Used for things that don't want rich markup]] - markup = 0x2, [[Edje textblock markup, including inline images]] - image = 0x4, [[Images]] - vcard = 0x08, [[Vcards]] - html = 0x10 [[Raw HTML-like data (eg. webkit)]] -} - -enum @beta Efl.Ui.Selection_Action -{ - [[Defines the kind of action associated with the drop data]] - unknown, [[Action type is unknown]] - copy, [[Copy the data]] - move, [[Move the data]] - private, [[Private action type]] - ask, [[Ask the user what to do]] - list, [[List the data]] - link, [[Link the data]] - description [[Describe the data]] -} - -struct @beta Efl.Ui.Selection_Data -{ - [[Structure holding the info about selected data]] - pos: Eina.Position2D; [[Coordinates of the drop (DND operations only)]] - format: Efl.Ui.Selection_Format; [[Format of the selection]] - content: Eina.Slice; [[Selection data]] - action: Efl.Ui.Selection_Action; [[Action to perform with the data]] - item: Efl.Object; [[Item under the drag position. It is only available for container]] -} - -function @beta Efl.Ui.Selection_Data_Ready { - [[Function pointer for getting selection]] - params { - @in obj: Efl.Object; [[Object which requested for the selection]] - @in seldata: ptr(Efl.Ui.Selection_Data); [[Selection data]] - } -}; - -struct @beta Efl.Ui.Selection_Changed -{ - [[Selection-changed specific information.]] // TODO: This needs to be filled in. - type: Efl.Ui.Selection_Type; [[Selection type]] - seat: int; [[The seat on which the selection changed, or NULL for "default"]] - display: void_ptr; [[The display connection object, NULL under X11]] - exist: bool; [[EINA_TRUE if the selection has an owner]] -} diff --git a/src/lib/elementary/efl_ui_separator.c b/src/lib/elementary/efl_ui_separator.c new file mode 100644 index 0000000000..887cfb3c40 --- /dev/null +++ b/src/lib/elementary/efl_ui_separator.c @@ -0,0 +1,46 @@ +#ifdef HAVE_CONFIG_H +# include "elementary_config.h" +#endif + +#include <Efl_Ui.h> +#include "elm_priv.h" + +typedef struct { + Efl_Ui_Layout_Orientation dir; +} Efl_Ui_Separator_Data; + +#define MY_CLASS EFL_UI_SEPARATOR_CLASS + + +EOLIAN static Efl_Object* +_efl_ui_separator_efl_object_constructor(Eo *obj, Efl_Ui_Separator_Data *pd EINA_UNUSED) +{ + if (!elm_widget_theme_klass_get(obj)) + elm_widget_theme_klass_set(obj, "separator"); + return efl_constructor(efl_super(obj, MY_CLASS)); +} + +EOLIAN static void +_efl_ui_separator_efl_ui_layout_orientable_orientation_set(Eo *obj EINA_UNUSED, Efl_Ui_Separator_Data *pd, Efl_Ui_Layout_Orientation dir) +{ + pd->dir = dir; +} + +EOLIAN static Efl_Ui_Layout_Orientation +_efl_ui_separator_efl_ui_layout_orientable_orientation_get(const Eo *ob EINA_UNUSED, Efl_Ui_Separator_Data *pd) +{ + return pd->dir; +} + +EOLIAN static Eina_Error +_efl_ui_separator_efl_ui_widget_theme_apply(Eo *obj, Efl_Ui_Separator_Data *pd) +{ + if (efl_ui_layout_orientation_is_horizontal(pd->dir, EINA_TRUE)) + elm_widget_theme_element_set(obj, "horizontal"); + else + elm_widget_theme_element_set(obj, "vertical"); + return efl_ui_widget_theme_apply(efl_super(obj, MY_CLASS)); +} + + +#include "efl_ui_separator.eo.c" diff --git a/src/lib/elementary/efl_ui_separator.eo b/src/lib/elementary/efl_ui_separator.eo new file mode 100644 index 0000000000..9dd0ef4491 --- /dev/null +++ b/src/lib/elementary/efl_ui_separator.eo @@ -0,0 +1,20 @@ +class Efl.Ui.Separator extends Efl.Ui.Item implements Efl.Ui.Layout_Orientable +{ + [[Vertical or horizontal separator line. + + Use it to separate groups of buttons in a toolbar, for example, or items on a list. + The length of the line adapts to the size of the container, and its width is + controlled by the theme. + + @since 1.24 + ]] + + implements { + Efl.Object.constructor; + Efl.Ui.Widget.theme_apply; + Efl.Ui.Layout_Orientable.orientation { get; set; } + } + constructors { + Efl.Ui.Layout_Orientable.orientation; + } +} diff --git a/src/lib/elementary/efl_ui_single_selectable.eo b/src/lib/elementary/efl_ui_single_selectable.eo index 1044082cc6..6e65c0a0ac 100644 --- a/src/lib/elementary/efl_ui_single_selectable.eo +++ b/src/lib/elementary/efl_ui_single_selectable.eo @@ -30,6 +30,12 @@ interface Efl.Ui.Single_Selectable { fallback : Efl.Ui.Selectable; } } + @property allow_manual_deselection { + [[This controlls if a selected item can be deselected due to clicking]] + values { + allow_manual_deselection : bool; [[$true if clicking while selected results in a state change to unselected]] + } + } } events { selection_changed : void; [[Emitted when there is a change in the selection state. This event will collect all diff --git a/src/lib/elementary/efl_ui_slider.c b/src/lib/elementary/efl_ui_slider.c index 920dcfada2..041316de68 100644 --- a/src/lib/elementary/efl_ui_slider.c +++ b/src/lib/elementary/efl_ui_slider.c @@ -4,7 +4,6 @@ #define EFL_ACCESS_OBJECT_PROTECTED #define EFL_ACCESS_WIDGET_ACTION_PROTECTED -#define EFL_ACCESS_VALUE_PROTECTED #define ELM_LAYOUT_PROTECTED #include <Elementary.h> @@ -37,7 +36,7 @@ _delay_change(void *data) efl_event_callback_call(data, EFL_UI_RANGE_EVENT_STEADY, NULL); if (_elm_config->atspi_mode) - efl_access_value_changed_signal_emit(data); + efl_access_object_event_emit(data, EFL_UI_RANGE_EVENT_CHANGED, NULL); return ECORE_CALLBACK_CANCEL; } @@ -68,15 +67,15 @@ _emit_events(Eo *obj, Efl_Ui_Slider_Data *sd) { efl_event_callback_call(obj, EFL_UI_RANGE_EVENT_CHANGED, NULL); - if (sd->val == sd->val_min) + if (EINA_DBL_EQ(sd->val, sd->val_min)) efl_event_callback_call(obj, EFL_UI_RANGE_EVENT_MIN_REACHED, NULL); - if (sd->val == sd->val_max) + if (EINA_DBL_EQ(sd->val, sd->val_max)) efl_event_callback_call(obj, EFL_UI_RANGE_EVENT_MAX_REACHED, NULL); // emit accessibility event also if value was changed by API if (_elm_config->atspi_mode) - efl_access_value_changed_signal_emit(obj); + efl_access_object_event_emit(obj, EFL_UI_RANGE_EVENT_CHANGED, NULL); } static void @@ -134,7 +133,7 @@ _drag_value_fetch(Evas_Object *obj) static void _adjust_to_step(Efl_Ui_Slider *obj, Efl_Ui_Slider_Data *pd) { - if (pd->step) + if (EINA_DBL_NONZERO(pd->step)) { double relative_step = pd->step/(pd->val_max - pd->val_min); double new_value = (round(pd->val/relative_step))*relative_step; @@ -778,7 +777,7 @@ _efl_ui_slider_efl_ui_range_interactive_range_step_set(Eo *obj EINA_UNUSED, Efl_ return; } - if (sd->step == step) return; + if (EINA_DBL_EQ(sd->step, step)) return; sd->step = step; } @@ -795,45 +794,6 @@ _efl_ui_slider_efl_ui_focus_object_on_focus_update(Eo *obj, Efl_Ui_Slider_Data * // A11Y Accessibility -EOLIAN static void -_efl_ui_slider_efl_access_value_value_and_text_get(const Eo *obj EINA_UNUSED, Efl_Ui_Slider_Data *sd, double *value, const char **text) -{ - if (value) *value = sd->val; - if (text) *text = NULL; -} - -EOLIAN static Eina_Bool -_efl_ui_slider_efl_access_value_value_and_text_set(Eo *obj, Efl_Ui_Slider_Data *sd, double value, const char *text EINA_UNUSED) -{ - if (value < sd->val_min) value = sd->val_min; - if (value > sd->val_max) value = sd->val_max; - - efl_event_callback_call(obj, EFL_UI_SLIDER_EVENT_SLIDER_DRAG_START, NULL); - - if (fabs(value - sd->val) > DBL_EPSILON) - { - _user_value_update(obj, value); - } - - efl_event_callback_call(obj, EFL_UI_SLIDER_EVENT_SLIDER_DRAG_STOP, NULL); - - return EINA_TRUE; -} - -EOLIAN static void -_efl_ui_slider_efl_access_value_range_get(const Eo *obj EINA_UNUSED, Efl_Ui_Slider_Data *sd, double *lower, double *upper, const char **descr) -{ - if (lower) *lower = sd->val_min; - if (upper) *upper = sd->val_max; - if (descr) *descr = NULL; -} - -EOLIAN static double -_efl_ui_slider_efl_access_value_increment_get(const Eo *obj EINA_UNUSED, Efl_Ui_Slider_Data *sd) -{ - return sd->step; -} - EOLIAN const Efl_Access_Action_Data * _efl_ui_slider_efl_access_widget_action_elm_actions_get(const Eo *obj EINA_UNUSED, Efl_Ui_Slider_Data *pd EINA_UNUSED) { diff --git a/src/lib/elementary/efl_ui_slider.eo b/src/lib/elementary/efl_ui_slider.eo index 992a1308fd..7a7d6bd614 100644 --- a/src/lib/elementary/efl_ui_slider.eo +++ b/src/lib/elementary/efl_ui_slider.eo @@ -1,5 +1,4 @@ class Efl.Ui.Slider extends Efl.Ui.Layout_Base implements Efl.Ui.Range_Interactive, Efl.Ui.Layout_Orientable, - Efl.Access.Value, Efl.Access.Widget.Action { [[Elementary slider class @@ -23,9 +22,6 @@ class Efl.Ui.Slider extends Efl.Ui.Layout_Base implements Efl.Ui.Range_Interacti Efl.Ui.Range_Display.range_limits {get; set; } Efl.Ui.Range_Interactive.range_step { get; set; } Efl.Ui.Layout_Orientable.orientation { get; set; } - Efl.Access.Value.value_and_text { get; set; } - Efl.Access.Value.range { get; } - Efl.Access.Value.increment { get; } Efl.Access.Widget.Action.elm_actions { get; } } events { diff --git a/src/lib/elementary/efl_ui_slider_interval.c b/src/lib/elementary/efl_ui_slider_interval.c index e5fe1f5243..1c1070faa9 100644 --- a/src/lib/elementary/efl_ui_slider_interval.c +++ b/src/lib/elementary/efl_ui_slider_interval.c @@ -4,7 +4,6 @@ #define EFL_ACCESS_OBJECT_PROTECTED #define EFL_ACCESS_WIDGET_ACTION_PROTECTED -#define EFL_ACCESS_VALUE_PROTECTED #include <Elementary.h> #include "elm_priv.h" @@ -34,7 +33,7 @@ _delay_change(void *data) efl_event_callback_call(data, EFL_UI_RANGE_EVENT_STEADY, NULL); if (_elm_config->atspi_mode) - efl_access_value_changed_signal_emit(data); + efl_access_object_event_emit(data, EFL_UI_RANGE_EVENT_CHANGED, NULL); return ECORE_CALLBACK_CANCEL; } @@ -49,9 +48,9 @@ static void _emit_events(Eo *obj, Efl_Ui_Slider_Interval_Data *sd) { efl_event_callback_call(obj, EFL_UI_RANGE_EVENT_CHANGED, NULL); - if (sd->val == sd->val_min) + if (EINA_DBL_EQ(sd->val, sd->val_min)) efl_event_callback_call(obj, EFL_UI_RANGE_EVENT_MIN_REACHED, NULL); - if (sd->val == sd->val_max) + if (EINA_DBL_EQ(sd->val, sd->val_max)) efl_event_callback_call(obj, EFL_UI_RANGE_EVENT_MAX_REACHED, NULL); } @@ -89,7 +88,7 @@ _val_set(Evas_Object *obj) // emit accessibility event also if value was changed by API if (_elm_config->atspi_mode) - efl_access_value_changed_signal_emit(obj); + efl_access_object_event_emit(obj, EFL_UI_RANGE_EVENT_CHANGED, NULL); evas_object_smart_changed(obj); } @@ -851,7 +850,7 @@ _efl_ui_slider_interval_efl_ui_range_interactive_range_step_set(Eo *obj EINA_UNU return; } - if (sd->step == step) return; + if (EINA_DBL_EQ(sd->step, step)) return; sd->step = step; } @@ -871,44 +870,6 @@ _efl_ui_slider_interval_efl_ui_layout_orientable_orientation_get(const Eo *obj E } // A11Y Accessibility -EOLIAN static void -_efl_ui_slider_interval_efl_access_value_value_and_text_get(const Eo *obj EINA_UNUSED, Efl_Ui_Slider_Interval_Data *sd, double *value, const char **text) -{ - if (value) *value = sd->val; - if (text) *text = NULL; -} - -EOLIAN static Eina_Bool -_efl_ui_slider_interval_efl_access_value_value_and_text_set(Eo *obj, Efl_Ui_Slider_Interval_Data *sd, double value, const char *text EINA_UNUSED) -{ - double oldval = sd->val; - - if (value < sd->val_min) value = sd->val_min; - if (value > sd->val_max) value = sd->val_max; - - efl_event_callback_call(obj, EFL_UI_SLIDER_INTERVAL_EVENT_SLIDER_DRAG_START, NULL); - sd->val = value; - _val_set(obj); - sd->val = oldval; - _slider_update(obj, EINA_TRUE); - efl_event_callback_call(obj, EFL_UI_SLIDER_INTERVAL_EVENT_SLIDER_DRAG_STOP, NULL); - - return EINA_TRUE; -} - -EOLIAN static void -_efl_ui_slider_interval_efl_access_value_range_get(const Eo *obj EINA_UNUSED, Efl_Ui_Slider_Interval_Data *sd, double *lower, double *upper, const char **descr) -{ - if (lower) *lower = sd->val_min; - if (upper) *upper = sd->val_max; - if (descr) *descr = NULL; -} - -EOLIAN static double -_efl_ui_slider_interval_efl_access_value_increment_get(const Eo *obj EINA_UNUSED, Efl_Ui_Slider_Interval_Data *sd) -{ - return sd->step; -} EOLIAN const Efl_Access_Action_Data * _efl_ui_slider_interval_efl_access_widget_action_elm_actions_get(const Eo *obj EINA_UNUSED, Efl_Ui_Slider_Interval_Data *pd EINA_UNUSED) diff --git a/src/lib/elementary/efl_ui_slider_interval.eo b/src/lib/elementary/efl_ui_slider_interval.eo index d62726f2ee..4eab8cea5f 100644 --- a/src/lib/elementary/efl_ui_slider_interval.eo +++ b/src/lib/elementary/efl_ui_slider_interval.eo @@ -1,5 +1,5 @@ class @beta Efl.Ui.Slider_Interval extends Efl.Ui.Layout_Base implements Efl.Ui.Range_Interactive, - Efl.Ui.Layout_Orientable, Efl.Access.Value, Efl.Access.Widget.Action + Efl.Ui.Layout_Orientable, Efl.Access.Widget.Action { [[An interval slider. @@ -29,9 +29,6 @@ class @beta Efl.Ui.Slider_Interval extends Efl.Ui.Layout_Base implements Efl.Ui. Efl.Ui.Range_Display.range_limits {get; set; } Efl.Ui.Range_Interactive.range_step { get; set; } Efl.Ui.Layout_Orientable.orientation { get; set; } - Efl.Access.Value.value_and_text { get; set; } - Efl.Access.Value.range { get; } - Efl.Access.Value.increment { get; } Efl.Access.Widget.Action.elm_actions { get; } } events { diff --git a/src/lib/elementary/efl_ui_spin.c b/src/lib/elementary/efl_ui_spin.c index 0cf72890b0..cbd1c95d66 100644 --- a/src/lib/elementary/efl_ui_spin.c +++ b/src/lib/elementary/efl_ui_spin.c @@ -3,7 +3,6 @@ #endif #define EFL_ACCESS_OBJECT_PROTECTED -#define EFL_ACCESS_VALUE_PROTECTED #define EFL_ACCESS_WIDGET_ACTION_PROTECTED #define EFL_UI_FORMAT_PROTECTED diff --git a/src/lib/elementary/efl_ui_spin.eo b/src/lib/elementary/efl_ui_spin.eo index cb5c2cc898..2dac6ec69a 100644 --- a/src/lib/elementary/efl_ui_spin.eo +++ b/src/lib/elementary/efl_ui_spin.eo @@ -1,5 +1,5 @@ class Efl.Ui.Spin extends Efl.Ui.Layout_Base implements Efl.Ui.Range_Display, -Efl.Ui.Format, Efl.Access.Value, Efl.Access.Widget.Action +Efl.Ui.Format, Efl.Access.Widget.Action { [[A Spin. diff --git a/src/lib/elementary/efl_ui_spin_button.c b/src/lib/elementary/efl_ui_spin_button.c index 9be21373a1..b44a93f30b 100644 --- a/src/lib/elementary/efl_ui_spin_button.c +++ b/src/lib/elementary/efl_ui_spin_button.c @@ -3,7 +3,6 @@ #endif #define EFL_ACCESS_OBJECT_PROTECTED -#define EFL_ACCESS_VALUE_PROTECTED #define EFL_ACCESS_WIDGET_ACTION_PROTECTED #define EFL_UI_FOCUS_COMPOSITION_PROTECTED #define EFL_UI_FORMAT_PROTECTED @@ -24,7 +23,7 @@ //when a item is pressed but not released, this time passes by //until another step is added or removed from the current value. //given in seconds -#define REPEAT_INTERVAL 0.85 +#define REPEAT_INTERVAL 0.2 static const char PART_NAME_ENTRY[] = "entry"; static const char PART_NAME_DEC_BUTTON[] = "dec_button"; @@ -405,10 +404,11 @@ static void _spin_value(Efl_Ui_Spin *obj, Eina_Bool inc) { Efl_Ui_Spin_Button_Data *pd = efl_data_scope_get(obj, EFL_UI_SPIN_BUTTON_CLASS); + double val = efl_ui_range_value_get(obj); + double step = inc ? pd->step : -pd->step; - int absolut_value = efl_ui_range_value_get(obj) + (inc ? pd->step : -pd->step); - - _value_set(obj, absolut_value); + /* clamp to step before setting new value */ + _value_set(obj, round((val + step) / step) * step); } static void @@ -757,44 +757,6 @@ _efl_ui_spin_button_efl_access_widget_action_elm_actions_get(const Eo *obj EINA_ // A11Y Accessibility -EOLIAN static void -_efl_ui_spin_button_efl_access_value_value_and_text_get(const Eo *obj EINA_UNUSED, Efl_Ui_Spin_Button_Data *sd EINA_UNUSED, double *value, const char **text) -{ - Efl_Ui_Spin_Data *pd = efl_data_scope_get(obj, EFL_UI_SPIN_CLASS); - - if (value) *value = pd->val; - if (text) *text = NULL; -} - -EOLIAN static Eina_Bool -_efl_ui_spin_button_efl_access_value_value_and_text_set(Eo *obj, Efl_Ui_Spin_Button_Data *sd EINA_UNUSED, double value, const char *text EINA_UNUSED) -{ - Efl_Ui_Spin_Data *pd = efl_data_scope_get(obj, EFL_UI_SPIN_CLASS); - - if (pd->val_min > value) return EINA_FALSE; - if (pd->val_max < value) return EINA_FALSE; - - efl_ui_range_value_set(obj, value); - - return EINA_TRUE; -} - -EOLIAN static void -_efl_ui_spin_button_efl_access_value_range_get(const Eo *obj EINA_UNUSED, Efl_Ui_Spin_Button_Data *sd EINA_UNUSED, double *lower, double *upper, const char **descr) -{ - Efl_Ui_Spin_Data *pd = efl_data_scope_get(obj, EFL_UI_SPIN_CLASS); - - if (lower) *lower = pd->val_min; - if (upper) *upper = pd->val_max; - if (descr) *descr = NULL; -} - -EOLIAN static double -_efl_ui_spin_button_efl_access_value_increment_get(const Eo *obj EINA_UNUSED, Efl_Ui_Spin_Button_Data *pd) -{ - return pd->step; -} - EOLIAN static const char* _efl_ui_spin_button_efl_access_object_i18n_name_get(const Eo *obj, Efl_Ui_Spin_Button_Data *sd EINA_UNUSED) { diff --git a/src/lib/elementary/efl_ui_spin_button.eo b/src/lib/elementary/efl_ui_spin_button.eo index f5e4a11c9c..5f41f48391 100644 --- a/src/lib/elementary/efl_ui_spin_button.eo +++ b/src/lib/elementary/efl_ui_spin_button.eo @@ -71,9 +71,6 @@ class Efl.Ui.Spin_Button extends Efl.Ui.Spin Efl.Ui.Range_Display.range_value { set; } Efl.Ui.Layout_Orientable.orientation { get; set; } Efl.Access.Object.i18n_name { get; } - Efl.Access.Value.value_and_text { get; set; } - Efl.Access.Value.range { get; } - Efl.Access.Value.increment { get; } Efl.Access.Widget.Action.elm_actions { get; } Efl.Ui.Format.apply_formatted_value; Efl.Ui.Range_Interactive.range_step { get; set; } diff --git a/src/lib/elementary/efl_ui_spotlight_manager_stack.c b/src/lib/elementary/efl_ui_spotlight_animation_manager.c index d7d6d94c62..cdf9846684 100644 --- a/src/lib/elementary/efl_ui_spotlight_manager_stack.c +++ b/src/lib/elementary/efl_ui_spotlight_animation_manager.c @@ -8,23 +8,25 @@ typedef struct { Efl_Ui_Spotlight_Container * container; - Efl_Canvas_Animation_Player *alpha_anim; + Efl_Canvas_Animation *jump_anim[2], *push_anim[2], *pop_anim[2]; Efl_Gfx_Entity *content[2]; + Efl_Gfx_Entity *clipper; int ids[2]; //only used when in animation Eina_Size2D page_size; Eina_Bool animation; -} Efl_Ui_Spotlight_Manager_Stack_Data; +} Efl_Ui_Spotlight_Animation_Manager_Data; -#define MY_CLASS EFL_UI_SPOTLIGHT_MANAGER_STACK_CLASS +#define MY_CLASS EFL_UI_SPOTLIGHT_ANIMATION_MANAGER_CLASS static void -_geom_sync(Eo *obj EINA_UNUSED, Efl_Ui_Spotlight_Manager_Stack_Data *pd) +_geom_sync(Eo *obj EINA_UNUSED, Efl_Ui_Spotlight_Animation_Manager_Data *pd) { Eina_Rect group_pos = efl_gfx_entity_geometry_get(pd->container); Eina_Rect goal = EINA_RECT_EMPTY(); goal.size = pd->page_size; goal.y = (group_pos.y + group_pos.h/2)-pd->page_size.h/2; goal.x = (group_pos.x + group_pos.w/2)-pd->page_size.w/2; + efl_gfx_entity_geometry_set(pd->clipper, group_pos); for (int i = 0; i < 2; ++i) { if (pd->content[i]) @@ -35,7 +37,7 @@ _geom_sync(Eo *obj EINA_UNUSED, Efl_Ui_Spotlight_Manager_Stack_Data *pd) static void _running_cb(void *data, const Efl_Event *ev EINA_UNUSED) { - Efl_Ui_Spotlight_Manager_Stack_Data *pd = efl_data_scope_safe_get(data, MY_CLASS); + Efl_Ui_Spotlight_Animation_Manager_Data *pd = efl_data_scope_safe_get(data, MY_CLASS); double absolut_position; EINA_SAFETY_ON_NULL_RETURN(pd); @@ -56,19 +58,21 @@ _hide_object_cb(void *data, const Efl_Event *ev) } EOLIAN static void -_efl_ui_spotlight_manager_stack_efl_ui_spotlight_manager_bind(Eo *obj, Efl_Ui_Spotlight_Manager_Stack_Data *pd, Efl_Ui_Spotlight_Container *spotlight) +_efl_ui_spotlight_animation_manager_efl_ui_spotlight_manager_bind(Eo *obj, Efl_Ui_Spotlight_Animation_Manager_Data *pd, Efl_Ui_Spotlight_Container *spotlight) { if (spotlight) { pd->container = spotlight; - pd->alpha_anim = efl_add(EFL_CANVAS_ANIMATION_ALPHA_CLASS, obj); - efl_animation_alpha_set(pd->alpha_anim, 0.0, 1.0); - efl_animation_duration_set(pd->alpha_anim, 0.5); - efl_animation_final_state_keep_set(pd->alpha_anim, EINA_TRUE); + pd->clipper = efl_add(EFL_CANVAS_RECTANGLE_CLASS, + evas_object_evas_get(pd->container)); + evas_object_static_clip_set(pd->clipper, EINA_TRUE); + efl_canvas_group_member_add(spotlight, pd->clipper); for (int i = 0; i < efl_content_count(spotlight) ; ++i) { Efl_Gfx_Entity *elem = efl_pack_content_get(spotlight, i); + efl_key_data_set(elem, "_elm_leaveme", spotlight); + efl_canvas_object_clipper_set(elem, pd->clipper); efl_canvas_group_member_add(pd->container, elem); efl_gfx_entity_visible_set(elem, EINA_FALSE); } @@ -82,7 +86,7 @@ _efl_ui_spotlight_manager_stack_efl_ui_spotlight_manager_bind(Eo *obj, Efl_Ui_Sp } static void -_update_ids(Eo *obj, Efl_Ui_Spotlight_Manager_Stack_Data *pd, int avoid_index) +_update_ids(Eo *obj, Efl_Ui_Spotlight_Animation_Manager_Data *pd, int avoid_index) { for (int i = 0; i < 2; ++i) { @@ -94,16 +98,20 @@ _update_ids(Eo *obj, Efl_Ui_Spotlight_Manager_Stack_Data *pd, int avoid_index) } EOLIAN static void -_efl_ui_spotlight_manager_stack_efl_ui_spotlight_manager_content_add(Eo *obj EINA_UNUSED, Efl_Ui_Spotlight_Manager_Stack_Data *pd, Efl_Gfx_Entity *subobj, int index EINA_UNUSED) +_efl_ui_spotlight_animation_manager_efl_ui_spotlight_manager_content_add(Eo *obj EINA_UNUSED, Efl_Ui_Spotlight_Animation_Manager_Data *pd, Efl_Gfx_Entity *subobj, int index EINA_UNUSED) { + efl_key_data_set(subobj, "_elm_leaveme", pd->container); + efl_canvas_object_clipper_set(subobj, pd->clipper); efl_canvas_group_member_add(pd->container, subobj); efl_gfx_entity_visible_set(subobj, EINA_FALSE); _update_ids(obj, pd, -1); } EOLIAN static void -_efl_ui_spotlight_manager_stack_efl_ui_spotlight_manager_content_del(Eo *obj EINA_UNUSED, Efl_Ui_Spotlight_Manager_Stack_Data *pd, Efl_Gfx_Entity *subobj, int index) +_efl_ui_spotlight_animation_manager_efl_ui_spotlight_manager_content_del(Eo *obj EINA_UNUSED, Efl_Ui_Spotlight_Animation_Manager_Data *pd, Efl_Gfx_Entity *subobj, int index) { + efl_key_data_set(subobj, "_elm_leaveme", NULL); + efl_canvas_object_clipper_set(subobj, NULL); efl_canvas_group_member_remove(pd->container, subobj); for (int i = 0; i < 2; ++i) { @@ -123,27 +131,41 @@ is_valid(Eo *obj, int index) } EOLIAN static void -_efl_ui_spotlight_manager_stack_efl_ui_spotlight_manager_switch_to(Eo *obj, Efl_Ui_Spotlight_Manager_Stack_Data *pd, int from, int to) +_efl_ui_spotlight_animation_manager_efl_ui_spotlight_manager_switch_to(Eo *obj, Efl_Ui_Spotlight_Animation_Manager_Data *pd, + int from, int to, + Efl_Ui_Spotlight_Manager_Switch_Reason reason EINA_UNUSED) { + if (efl_pack_content_get(pd->container, to) == pd->content[1]) return; + if (is_valid(pd->container, to) && is_valid(pd->container, from)) { int tmp[2] = {from, to}; for (int i = 0; i < 2; ++i) { + Efl_Canvas_Animation *animation = NULL; pd->ids[i] = tmp[i]; pd->content[i] = efl_pack_content_get(pd->container, pd->ids[i]); + //when pushing, animate the *pushed in* content with the push animation + if (reason == EFL_UI_SPOTLIGHT_MANAGER_SWITCH_REASON_PUSH) + animation = pd->push_anim[i]; + //when popping, animate the *popped in* content with the pop animation + else if (reason == EFL_UI_SPOTLIGHT_MANAGER_SWITCH_REASON_POP) + animation = pd->pop_anim[i]; + if (!animation) + animation = pd->jump_anim[i]; if (pd->animation) - efl_canvas_object_animation_start(pd->content[i], pd->alpha_anim, -1.0+2.0*i, 0.0); + efl_canvas_object_animation_start(pd->content[i], animation, -1.0+2.0*i, 0.0); efl_gfx_entity_visible_set(pd->content[i], EINA_TRUE); } if (pd->animation) { efl_event_callback_add(pd->content[0], EFL_CANVAS_OBJECT_ANIMATION_EVENT_ANIMATION_CHANGED, _hide_object_cb, obj); efl_event_callback_add(pd->content[0], EFL_CANVAS_OBJECT_ANIMATION_EVENT_ANIMATION_PROGRESS_UPDATED, _running_cb, obj); + efl_gfx_stack_above(pd->content[1], pd->content[0]); //Stack the "to content" above the "from content" } } else @@ -162,17 +184,19 @@ _efl_ui_spotlight_manager_stack_efl_ui_spotlight_manager_switch_to(Eo *obj, Efl_ } EOLIAN static void -_efl_ui_spotlight_manager_stack_efl_ui_spotlight_manager_size_set(Eo *obj, Efl_Ui_Spotlight_Manager_Stack_Data *pd, Eina_Size2D size) +_efl_ui_spotlight_animation_manager_efl_ui_spotlight_manager_size_set(Eo *obj, Efl_Ui_Spotlight_Animation_Manager_Data *pd, Eina_Size2D size) { pd->page_size = size; _geom_sync(obj, pd); } EOLIAN static void -_efl_ui_spotlight_manager_stack_efl_object_invalidate(Eo *obj, Efl_Ui_Spotlight_Manager_Stack_Data *pd EINA_UNUSED) +_efl_ui_spotlight_animation_manager_efl_object_invalidate(Eo *obj, Efl_Ui_Spotlight_Animation_Manager_Data *pd) { efl_invalidate(efl_super(obj, MY_CLASS)); + efl_del(pd->clipper); + for (int i = 0; i < efl_content_count(pd->container); ++i) { Efl_Gfx_Stack *elem = efl_pack_content_get(pd->container, i); @@ -180,11 +204,13 @@ _efl_ui_spotlight_manager_stack_efl_object_invalidate(Eo *obj, Efl_Ui_Spotlight_ { efl_gfx_mapping_color_set(elem, d, 255, 255, 255, 255); } + + efl_canvas_object_clipper_set(elem, NULL); } } EOLIAN static void -_efl_ui_spotlight_manager_stack_efl_ui_spotlight_manager_animated_transition_set(Eo *obj EINA_UNUSED, Efl_Ui_Spotlight_Manager_Stack_Data *pd, Eina_Bool animation) +_efl_ui_spotlight_animation_manager_efl_ui_spotlight_manager_animated_transition_set(Eo *obj EINA_UNUSED, Efl_Ui_Spotlight_Animation_Manager_Data *pd, Eina_Bool animation) { for (int i = 0; i < 2; ++i) { @@ -195,10 +221,48 @@ _efl_ui_spotlight_manager_stack_efl_ui_spotlight_manager_animated_transition_set } EOLIAN static Eina_Bool -_efl_ui_spotlight_manager_stack_efl_ui_spotlight_manager_animated_transition_get(const Eo *obj EINA_UNUSED, Efl_Ui_Spotlight_Manager_Stack_Data *pd) +_efl_ui_spotlight_animation_manager_efl_ui_spotlight_manager_animated_transition_get(const Eo *obj EINA_UNUSED, Efl_Ui_Spotlight_Animation_Manager_Data *pd) { return pd->animation; } +EOLIAN static void +_efl_ui_spotlight_animation_manager_push_setup_set(Eo *obj EINA_UNUSED, Efl_Ui_Spotlight_Animation_Manager_Data *pd, Efl_Canvas_Animation *in, Efl_Canvas_Animation *out) +{ + EINA_SAFETY_ON_NULL_RETURN(out); + EINA_SAFETY_ON_NULL_RETURN(in); + + efl_replace(&pd->push_anim[0], out); + efl_replace(&pd->push_anim[1], in); +} + +EOLIAN static void +_efl_ui_spotlight_animation_manager_pop_setup_set(Eo *obj EINA_UNUSED, Efl_Ui_Spotlight_Animation_Manager_Data *pd, Efl_Canvas_Animation *in, Efl_Canvas_Animation *out) +{ + EINA_SAFETY_ON_NULL_RETURN(out); + EINA_SAFETY_ON_NULL_RETURN(in); + + efl_replace(&pd->pop_anim[0], out); + efl_replace(&pd->pop_anim[1], in); +} + +EOLIAN static void +_efl_ui_spotlight_animation_manager_jump_setup_set(Eo *obj EINA_UNUSED, Efl_Ui_Spotlight_Animation_Manager_Data *pd, Efl_Canvas_Animation *in, Efl_Canvas_Animation *out) +{ + EINA_SAFETY_ON_NULL_RETURN(out); + EINA_SAFETY_ON_NULL_RETURN(in); + + efl_replace(&pd->jump_anim[0], out); + efl_replace(&pd->jump_anim[1], in); +} + +EOLIAN static Efl_Object* +_efl_ui_spotlight_animation_manager_efl_object_finalize(Eo *obj, Efl_Ui_Spotlight_Animation_Manager_Data *pd) +{ + EINA_SAFETY_ON_NULL_RETURN_VAL(pd->jump_anim[0], NULL); + EINA_SAFETY_ON_NULL_RETURN_VAL(pd->jump_anim[1], NULL); + + return efl_finalize(efl_super(obj, MY_CLASS)); +} -#include "efl_ui_spotlight_manager_stack.eo.c" +#include "efl_ui_spotlight_animation_manager.eo.c" diff --git a/src/lib/elementary/efl_ui_spotlight_animation_manager.eo b/src/lib/elementary/efl_ui_spotlight_animation_manager.eo new file mode 100644 index 0000000000..014141b28d --- /dev/null +++ b/src/lib/elementary/efl_ui_spotlight_animation_manager.eo @@ -0,0 +1,75 @@ +class @beta Efl.Ui.Spotlight.Animation_Manager extends Efl.Ui.Spotlight.Manager +{ + [[A spotlight manager that uses animation objects to react to different @Efl.Ui.Spotlight.Manager.switch_to + situations. + + Animations are played forward when they are on the $to argument and they are played backward when they are on the + $from argument. + + Pop animations are always played backwards, Push animations are always played forward. + The reason for this is reusability: you can use the same animation in all situations and this covers the + inverted effect that "moving in" and "moving out" has. + For example, when you have an alpha channel animation, the Pop animation can be the same as the Jump-In and Out + animation, and both will look like fading out. + ]] + c_prefix: efl_ui_spotlight_manager_animation; + methods { + @property push_setup { + [[Animation that is used to animate the $to argument of a @Efl.Ui.Spotlight.Manager.switch_to request when + the passed $reason is @Efl.Ui.Spotlight.Manager_Switch_Reason.push. + + If these animations are $null, then the $in and $out animation of @.jump_setup will be used instead. + ]] + values { + in : Efl.Canvas.Animation; [[The animation to play, the implementation will take an additional reference]] + out : Efl.Canvas.Animation; [[The animation to play, the implementation will take an additional reference. + Can be the same as $in.]] + } + set {} + } + + @property pop_setup { + [[Animation that is used to animate the $from argument of a @Efl.Ui.Spotlight.Manager.switch_to request when + the passed $reason is @Efl.Ui.Spotlight.Manager_Switch_Reason.pop. + + Note: These animations are always played backwards, see the class documentation for the reasoning. + + If these animations are $null, then the $in and $out animation of @.jump_setup will be used instead. + ]] + values { + in : Efl.Canvas.Animation; [[The animation to play, the implementation will take an additional reference]] + out : Efl.Canvas.Animation; [[The animation to play, the implementation will take an additional reference. + Can be the same as $in.]] + } + set {} + } + + @property jump_setup { + [[Sets the animation objects you want to play on a jump in or jump out. + + When a @Efl.Ui.Spotlight.Manager.switch_to request is issued, two arguments are getting animated. + The $from object, and the $to object. The $from object will play the $out animation whereas the $to object + will play the $in animation. + + The $out animation will always be played backwards. See the class documentation for the reasoning. + ]] + values { + in : Efl.Canvas.Animation; [[The animation to play, the implementation will take an additional reference]] + out : Efl.Canvas.Animation; [[The animation to play, the implementation will take an additional reference. + Can be the same as $in.]] + } + set { + } + } + } + implements { + Efl.Ui.Spotlight.Manager.bind; + Efl.Ui.Spotlight.Manager.content_add; + Efl.Ui.Spotlight.Manager.content_del; + Efl.Ui.Spotlight.Manager.switch_to; + Efl.Ui.Spotlight.Manager.size {set;} + Efl.Ui.Spotlight.Manager.animated_transition {set; get;} + Efl.Object.finalize; + Efl.Object.invalidate; + } +} diff --git a/src/lib/elementary/efl_ui_spotlight_container.c b/src/lib/elementary/efl_ui_spotlight_container.c index a5f3c9e390..131f228562 100644 --- a/src/lib/elementary/efl_ui_spotlight_container.c +++ b/src/lib/elementary/efl_ui_spotlight_container.c @@ -4,7 +4,7 @@ #include <Efl_Ui.h> #include "elm_priv.h" -#include "efl_ui_spotlight_manager_plain.eo.h" +#include "efl_ui_spotlight_plain_manager.eo.h" typedef struct _Efl_Ui_Spotlight_Container_Data { @@ -144,7 +144,7 @@ _transition_event_emission(Eo *obj EINA_UNUSED, Efl_Ui_Spotlight_Container_Data pd->show_request.to = -1; _transition_end(obj, pd); } - if (pd->position == pd->show_request.to) + if (EINA_DBL_EQ(pd->position, pd->show_request.to)) { //successfully there _transition_end(obj, pd); @@ -236,7 +236,7 @@ _efl_ui_spotlight_container_efl_object_finalize(Eo *obj, Efl_Ui_Spotlight_Contai //set a view manager in case nothing is here if (!manager) { - efl_ui_spotlight_manager_set(obj, efl_new(EFL_UI_SPOTLIGHT_MANAGER_PLAIN_CLASS)); + efl_ui_spotlight_manager_set(obj, efl_new(EFL_UI_SPOTLIGHT_PLAIN_MANAGER_CLASS)); } else { @@ -437,10 +437,8 @@ _efl_ui_spotlight_container_efl_pack_linear_pack_index_get(Eo *obj EINA_UNUSED, return eina_list_data_idx(pd->content_list, (void *)subobj); } -EOLIAN static void -_efl_ui_spotlight_container_active_element_set(Eo *obj EINA_UNUSED, - Efl_Ui_Spotlight_Container_Data *pd, - Efl_Ui_Widget *new_page) +static void +_active_element_set(Eo *obj, Efl_Ui_Spotlight_Container_Data *pd, Efl_Ui_Widget *new_page, Efl_Ui_Spotlight_Manager_Switch_Reason reason) { int before = -1; int index; @@ -463,7 +461,16 @@ _efl_ui_spotlight_container_active_element_set(Eo *obj EINA_UNUSED, } pd->curr.page = new_page; - efl_ui_spotlight_manager_switch_to(pd->transition, before, index); + efl_ui_spotlight_manager_switch_to(pd->transition, before, index, reason); + +} + +EOLIAN static void +_efl_ui_spotlight_container_active_element_set(Eo *obj EINA_UNUSED, + Efl_Ui_Spotlight_Container_Data *pd, + Efl_Ui_Widget *new_page) +{ + _active_element_set(obj, pd, new_page, EFL_UI_SPOTLIGHT_MANAGER_SWITCH_REASON_JUMP); } EOLIAN static Efl_Ui_Widget* @@ -648,7 +655,7 @@ EOLIAN static void _efl_ui_spotlight_container_spotlight_manager_set(Eo *obj, Efl_Ui_Spotlight_Container_Data *pd, Efl_Ui_Spotlight_Manager *transition) { if (!transition) - pd->transition = efl_add(EFL_UI_SPOTLIGHT_MANAGER_PLAIN_CLASS, obj); + pd->transition = efl_add(EFL_UI_SPOTLIGHT_PLAIN_MANAGER_CLASS, obj); else EINA_SAFETY_ON_FALSE_RETURN(efl_isa(transition, EFL_UI_SPOTLIGHT_MANAGER_CLASS)); @@ -670,7 +677,7 @@ _efl_ui_spotlight_container_spotlight_manager_set(Eo *obj, Efl_Ui_Spotlight_Cont _animated_transition_manager_eval(obj, pd); efl_ui_spotlight_manager_animated_transition_set(pd->transition, efl_finalized_get(obj)); efl_ui_spotlight_manager_bind(pd->transition, obj); - efl_ui_spotlight_manager_size_set(pd->transition, pd->page_spec.sz); + _emit_page_size(obj, pd); efl_event_callback_add(pd->transition, EFL_UI_SPOTLIGHT_MANAGER_EVENT_POS_UPDATE, _pos_updated, obj); } @@ -679,7 +686,7 @@ _efl_ui_spotlight_container_spotlight_manager_set(Eo *obj, Efl_Ui_Spotlight_Cont EOLIAN static Efl_Ui_Spotlight_Manager* _efl_ui_spotlight_container_spotlight_manager_get(const Eo *obj EINA_UNUSED, Efl_Ui_Spotlight_Container_Data *pd) { - if (efl_isa(pd->transition, EFL_UI_SPOTLIGHT_MANAGER_PLAIN_CLASS)) + if (efl_isa(pd->transition, EFL_UI_SPOTLIGHT_PLAIN_MANAGER_CLASS)) return NULL; else return pd->transition; @@ -700,7 +707,7 @@ _efl_ui_spotlight_container_indicator_set(Eo *obj, Efl_Ui_Spotlight_Container_Da //the api indicates that the caller passes ownership to this function, so we need to unref here efl_unref(pd->indicator); efl_ui_spotlight_indicator_bind(pd->indicator, obj); - if (pd->position != -1) + if (!EINA_DBL_EQ(pd->position, -1)) efl_ui_spotlight_indicator_position_update(pd->indicator, pd->position); } } @@ -724,8 +731,7 @@ _efl_ui_spotlight_container_push(Eo *obj, Efl_Ui_Spotlight_Container_Data *pd EI if (!efl_pack_end(obj, view)) return; } - - efl_ui_spotlight_active_element_set(obj, view); + _active_element_set(obj, pd, view, EFL_UI_SPOTLIGHT_MANAGER_SWITCH_REASON_PUSH); } static Eina_Value @@ -780,7 +786,7 @@ _efl_ui_spotlight_container_pop(Eo *obj, Efl_Ui_Spotlight_Container_Data *pd, Ei if (del) transition_done = eina_future_then(transition_done, _delete_obj, NULL); - efl_ui_spotlight_active_element_set(obj, efl_pack_content_get(obj, new_index)); + _active_element_set(obj, pd, efl_pack_content_get(obj, new_index), EFL_UI_SPOTLIGHT_MANAGER_SWITCH_REASON_POP); return transition_done; } diff --git a/src/lib/elementary/efl_ui_spotlight_container.eo b/src/lib/elementary/efl_ui_spotlight_container.eo index 857f2655e1..fc05047e9d 100644 --- a/src/lib/elementary/efl_ui_spotlight_container.eo +++ b/src/lib/elementary/efl_ui_spotlight_container.eo @@ -4,7 +4,7 @@ struct @beta Efl.Ui.Spotlight.Transition_Event { to : int; [[The index to where the transition is headed, -1 if not known.]] } -class @beta Efl.Ui.Spotlight.Container extends Efl.Ui.Widget implements Efl.Pack_Linear +class Efl.Ui.Spotlight.Container extends Efl.Ui.Widget implements Efl.Pack_Linear { [[The Spotlight widget is a container for other sub-widgets, where only one sub-widget is active at any given time. @@ -25,10 +25,12 @@ class @beta Efl.Ui.Spotlight.Container extends Efl.Ui.Widget implements Efl.Pack This class can be used to create other widgets like Pagers, Tabbed pagers or Stacks, where each sub-widget represents a "page" full of other widgets. All these cases can be implemented with a different @.spotlight_manager and use the same @Efl.Ui.Spotlight.Container. + + @since 1.24 ]] c_prefix: efl_ui_spotlight; methods { - @property spotlight_manager { + @property spotlight_manager @beta { [[This object defines how sub-widgets are rendered and animated. If it is not set, only the active sub-widget is shown and transitions are instantaneous (not animated). ]] @@ -42,7 +44,7 @@ class @beta Efl.Ui.Spotlight.Container extends Efl.Ui.Widget implements Efl.Pack spotlight_manager : Efl.Ui.Spotlight.Manager @move; [[The Spotlight Manager object or $NULL.]] } } - @property indicator { + @property indicator @beta { [[An indicator object to use, which will display the current state of the spotlight (number of sub-widgets and active one). When this object is set, it is immediately updated to reflect the current state of the widget. @@ -124,8 +126,8 @@ class @beta Efl.Ui.Spotlight.Container extends Efl.Ui.Widget implements Efl.Pack } } events { - transition,start : Efl.Ui.Spotlight.Transition_Event; [[A transition animation has started.]] - transition,end : Efl.Ui.Spotlight.Transition_Event; [[A transition animation has ended.]] + transition,start @beta : Efl.Ui.Spotlight.Transition_Event; [[A transition animation has started.]] + transition,end @beta : Efl.Ui.Spotlight.Transition_Event; [[A transition animation has ended.]] } implements { Efl.Object.constructor; diff --git a/src/lib/elementary/efl_ui_spotlight_fade_manager.c b/src/lib/elementary/efl_ui_spotlight_fade_manager.c new file mode 100644 index 0000000000..cb2fa5f0a4 --- /dev/null +++ b/src/lib/elementary/efl_ui_spotlight_fade_manager.c @@ -0,0 +1,30 @@ +#ifdef HAVE_CONFIG_H +# include "elementary_config.h" +#endif + +#include <Efl_Ui.h> +#include "elm_priv.h" + +typedef struct { + +} Efl_Ui_Spotlight_Fade_Manager_Data; + +EOLIAN static Efl_Object* +_efl_ui_spotlight_fade_manager_efl_object_constructor(Eo *obj, Efl_Ui_Spotlight_Fade_Manager_Data *pd EINA_UNUSED) +{ + Efl_Canvas_Animation *animation; + + obj = efl_constructor(efl_super(obj, EFL_UI_SPOTLIGHT_FADE_MANAGER_CLASS)); + + animation = efl_add(EFL_CANVAS_ALPHA_ANIMATION_CLASS, obj); + efl_animation_alpha_set(animation, 0.0, 1.0); + efl_animation_duration_set(animation, 0.5); + + efl_ui_spotlight_manager_animation_jump_setup_set(obj, animation, animation); + efl_unref(animation); + + return obj; +} + + +#include "efl_ui_spotlight_fade_manager.eo.c" diff --git a/src/lib/elementary/efl_ui_spotlight_fade_manager.eo b/src/lib/elementary/efl_ui_spotlight_fade_manager.eo new file mode 100644 index 0000000000..6d0524fe0e --- /dev/null +++ b/src/lib/elementary/efl_ui_spotlight_fade_manager.eo @@ -0,0 +1,7 @@ +class @beta Efl.Ui.Spotlight.Fade_Manager extends Efl.Ui.Spotlight.Animation_Manager +{ + c_prefix: efl_ui_spotlight_manager_fade; + implements { + Efl.Object.constructor; + } +} diff --git a/src/lib/elementary/efl_ui_spotlight_indicator_icon.c b/src/lib/elementary/efl_ui_spotlight_icon_indicator.c index 4ac177580d..a4aa12ce25 100644 --- a/src/lib/elementary/efl_ui_spotlight_indicator_icon.c +++ b/src/lib/elementary/efl_ui_spotlight_icon_indicator.c @@ -13,7 +13,7 @@ typedef struct { Efl_Canvas_Layout *layout; double last_position; Eina_Size2D min, max; -} Efl_Ui_Spotlight_Indicator_Icon_Data; +} Efl_Ui_Spotlight_Icon_Indicator_Data; static void _flush_state(Eo *item, double val) @@ -24,7 +24,7 @@ _flush_state(Eo *item, double val) } static void -_add_item(Eo *obj EINA_UNUSED, Efl_Ui_Spotlight_Indicator_Icon_Data *pd) +_add_item(Eo *obj EINA_UNUSED, Efl_Ui_Spotlight_Icon_Indicator_Data *pd) { Efl_Canvas_Layout *item; @@ -40,7 +40,7 @@ _add_item(Eo *obj EINA_UNUSED, Efl_Ui_Spotlight_Indicator_Icon_Data *pd) } static void -_flush_position(Eo *obj EINA_UNUSED, Efl_Ui_Spotlight_Indicator_Icon_Data *pd) +_flush_position(Eo *obj EINA_UNUSED, Efl_Ui_Spotlight_Icon_Indicator_Data *pd) { int next = -1, closer; double closer_val; @@ -91,13 +91,13 @@ EFL_CALLBACKS_ARRAY_DEFINE(spotlight_resized, ) EOLIAN static void -_efl_ui_spotlight_indicator_icon_efl_ui_spotlight_indicator_bind(Eo *obj, Efl_Ui_Spotlight_Indicator_Icon_Data *pd, Efl_Ui_Spotlight_Container *spotlight) +_efl_ui_spotlight_icon_indicator_efl_ui_spotlight_indicator_bind(Eo *obj, Efl_Ui_Spotlight_Icon_Indicator_Data *pd, Efl_Ui_Spotlight_Container *spotlight) { if (spotlight) { pd->container = spotlight; - efl_event_callback_array_add(pd->container, spotlight_resized(), pd->layout); pd->layout = efl_add(EFL_CANVAS_LAYOUT_CLASS, pd->container); + efl_event_callback_array_add(pd->container, spotlight_resized(), pd->layout); if (elm_widget_theme_object_set(pd->container, pd->layout, "spotlight", @@ -122,7 +122,7 @@ _efl_ui_spotlight_indicator_icon_efl_ui_spotlight_indicator_bind(Eo *obj, Efl_Ui } EOLIAN static void -_efl_ui_spotlight_indicator_icon_efl_ui_spotlight_indicator_content_add(Eo *obj, Efl_Ui_Spotlight_Indicator_Icon_Data *pd, Efl_Gfx_Entity *subobj EINA_UNUSED, int index EINA_UNUSED) +_efl_ui_spotlight_icon_indicator_efl_ui_spotlight_indicator_content_add(Eo *obj, Efl_Ui_Spotlight_Icon_Indicator_Data *pd, Efl_Gfx_Entity *subobj EINA_UNUSED, int index EINA_UNUSED) { _add_item(obj, pd); _flush_position(obj, pd); @@ -130,29 +130,29 @@ _efl_ui_spotlight_indicator_icon_efl_ui_spotlight_indicator_content_add(Eo *obj, } EOLIAN static void -_efl_ui_spotlight_indicator_icon_efl_ui_spotlight_indicator_content_del(Eo *obj, Efl_Ui_Spotlight_Indicator_Icon_Data *pd, Efl_Gfx_Entity *subobj EINA_UNUSED, int index EINA_UNUSED) +_efl_ui_spotlight_icon_indicator_efl_ui_spotlight_indicator_content_del(Eo *obj, Efl_Ui_Spotlight_Icon_Indicator_Data *pd, Efl_Gfx_Entity *subobj EINA_UNUSED, int index EINA_UNUSED) { efl_del(efl_pack_content_get(pd->indicator, 0)); _flush_position(obj, pd); } EOLIAN static void -_efl_ui_spotlight_indicator_icon_efl_ui_spotlight_indicator_position_update(Eo *obj EINA_UNUSED, Efl_Ui_Spotlight_Indicator_Icon_Data *pd, double position) +_efl_ui_spotlight_icon_indicator_efl_ui_spotlight_indicator_position_update(Eo *obj EINA_UNUSED, Efl_Ui_Spotlight_Icon_Indicator_Data *pd, double position) { pd->last_position = position; _flush_position(obj, pd); } EOLIAN static void -_efl_ui_spotlight_indicator_icon_efl_object_destructor(Eo *obj EINA_UNUSED, Efl_Ui_Spotlight_Indicator_Icon_Data *pd) +_efl_ui_spotlight_icon_indicator_efl_object_destructor(Eo *obj EINA_UNUSED, Efl_Ui_Spotlight_Icon_Indicator_Data *pd) { if (pd->layout) efl_del(pd->layout); if (pd->indicator) efl_del(pd->indicator); - efl_destructor(efl_super(obj, EFL_UI_SPOTLIGHT_INDICATOR_ICON_CLASS)); + efl_destructor(efl_super(obj, EFL_UI_SPOTLIGHT_ICON_INDICATOR_CLASS)); } -#include "efl_ui_spotlight_indicator_icon.eo.c" +#include "efl_ui_spotlight_icon_indicator.eo.c" diff --git a/src/lib/elementary/efl_ui_spotlight_indicator_icon.eo b/src/lib/elementary/efl_ui_spotlight_icon_indicator.eo index de1d689d74..63ef0554fd 100644 --- a/src/lib/elementary/efl_ui_spotlight_indicator_icon.eo +++ b/src/lib/elementary/efl_ui_spotlight_icon_indicator.eo @@ -1,4 +1,5 @@ -class @beta Efl.Ui.Spotlight.Indicator_Icon extends Efl.Ui.Spotlight.Indicator { +class @beta Efl.Ui.Spotlight.Icon_Indicator extends Efl.Ui.Spotlight.Indicator { + c_prefix: efl_ui_spotlight_indicator_icon; implements { Efl.Ui.Spotlight.Indicator.bind; Efl.Ui.Spotlight.Indicator.content_del; diff --git a/src/lib/elementary/efl_ui_spotlight_manager.eo b/src/lib/elementary/efl_ui_spotlight_manager.eo index 6de4898a94..00e338443d 100644 --- a/src/lib/elementary/efl_ui_spotlight_manager.eo +++ b/src/lib/elementary/efl_ui_spotlight_manager.eo @@ -1,3 +1,10 @@ +enum @beta Efl.Ui.Spotlight.Manager_Switch_Reason { + [[Indicator for the reason of a @Efl.Ui.Spotlight.Manager.switch_to call]] + jump, [[The Reason for this switch is a casual jump caused by @Efl.Ui.Spotlight.Container.active_element]] + push, [[The Reason for this switch is a casual jump caused by @Efl.Ui.Spotlight.Container.push]] + pop [[The Reason for this switch is a casual jump caused by @Efl.Ui.Spotlight.Container.pop]] +} + abstract @beta Efl.Ui.Spotlight.Manager extends Efl.Object { [[Manager object used by @Efl.Ui.Spotlight.Container to handle rendering and animation of its sub-widgets, and user interaction. @@ -41,6 +48,7 @@ abstract @beta Efl.Ui.Spotlight.Manager extends Efl.Object { params { from : int; [[Index of the starting sub-widget in the container's list. Might be -1 if unknown.]] to : int; [[Index of the target sub-widget in the container's list.]] + reason : Efl.Ui.Spotlight.Manager_Switch_Reason; [[The reason for this switch to call]] } } @property size @pure_virtual { diff --git a/src/lib/elementary/efl_ui_spotlight_manager_stack.eo b/src/lib/elementary/efl_ui_spotlight_manager_stack.eo deleted file mode 100644 index 2275eb8ff0..0000000000 --- a/src/lib/elementary/efl_ui_spotlight_manager_stack.eo +++ /dev/null @@ -1,12 +0,0 @@ -class @beta Efl.Ui.Spotlight.Manager_Stack extends Efl.Ui.Spotlight.Manager -{ - implements { - Efl.Ui.Spotlight.Manager.bind; - Efl.Ui.Spotlight.Manager.content_add; - Efl.Ui.Spotlight.Manager.content_del; - Efl.Ui.Spotlight.Manager.switch_to; - Efl.Ui.Spotlight.Manager.size {set;} - Efl.Ui.Spotlight.Manager.animated_transition {set; get;} - Efl.Object.invalidate; - } -} diff --git a/src/lib/elementary/efl_ui_spotlight_manager_plain.c b/src/lib/elementary/efl_ui_spotlight_plain_manager.c index d9c52ab3db..e6cc6a065e 100644 --- a/src/lib/elementary/efl_ui_spotlight_manager_plain.c +++ b/src/lib/elementary/efl_ui_spotlight_plain_manager.c @@ -4,30 +4,31 @@ #include <Efl_Ui.h> #include "elm_priv.h" -#include "efl_ui_spotlight_manager_plain.eo.h" +#include "efl_ui_spotlight_plain_manager.eo.h" typedef struct { Efl_Ui_Spotlight_Container * container; Eina_Size2D page_size; Efl_Ui_Widget *current_content; + Efl_Gfx_Entity *clipper; Eina_Bool animation; double last_pos; -} Efl_Ui_Spotlight_Manager_Plain_Data; +} Efl_Ui_Spotlight_Plain_Manager_Data; -#define MY_CLASS EFL_UI_SPOTLIGHT_MANAGER_PLAIN_CLASS +#define MY_CLASS EFL_UI_SPOTLIGHT_PLAIN_MANAGER_CLASS static void -_emit_position(Eo *obj EINA_UNUSED, Efl_Ui_Spotlight_Manager_Plain_Data *pd) +_emit_position(Eo *obj EINA_UNUSED, Efl_Ui_Spotlight_Plain_Manager_Data *pd) { double absolut_position = efl_pack_index_get(pd->container, pd->current_content); - if (pd->last_pos != absolut_position) + if (!EINA_DBL_EQ(pd->last_pos, absolut_position)) efl_event_callback_call(obj, EFL_UI_SPOTLIGHT_MANAGER_EVENT_POS_UPDATE, &absolut_position); pd->last_pos = absolut_position; } static void -_geom_sync(Eo *obj EINA_UNUSED, Efl_Ui_Spotlight_Manager_Plain_Data *pd) +_geom_sync(Eo *obj EINA_UNUSED, Efl_Ui_Spotlight_Plain_Manager_Data *pd) { Efl_Gfx_Entity *entity = pd->current_content; Eina_Rect group_pos = efl_gfx_entity_geometry_get(pd->container); @@ -36,11 +37,12 @@ _geom_sync(Eo *obj EINA_UNUSED, Efl_Ui_Spotlight_Manager_Plain_Data *pd) goal.size = pd->page_size; goal.y = (group_pos.y + group_pos.h/2)-pd->page_size.h/2; goal.x = (group_pos.x + group_pos.w/2)-pd->page_size.w/2; + efl_gfx_entity_geometry_set(pd->clipper, goal); efl_gfx_entity_geometry_set(entity, goal); } EOLIAN static void -_efl_ui_spotlight_manager_plain_efl_ui_spotlight_manager_bind(Eo *obj, Efl_Ui_Spotlight_Manager_Plain_Data *pd, Efl_Ui_Spotlight_Container *spotlight) +_efl_ui_spotlight_plain_manager_efl_ui_spotlight_manager_bind(Eo *obj, Efl_Ui_Spotlight_Plain_Manager_Data *pd, Efl_Ui_Spotlight_Container *spotlight) { if (spotlight) { @@ -48,8 +50,15 @@ _efl_ui_spotlight_manager_plain_efl_ui_spotlight_manager_bind(Eo *obj, Efl_Ui_Sp pd->container = spotlight; + pd->clipper = efl_add(EFL_CANVAS_RECTANGLE_CLASS, + evas_object_evas_get(spotlight)); + evas_object_static_clip_set(pd->clipper, EINA_TRUE); + efl_canvas_group_member_add(spotlight, pd->clipper); + for (int i = 0; i < efl_content_count(spotlight) ; ++i) { Efl_Gfx_Entity *elem = efl_pack_content_get(spotlight, i); + efl_key_data_set(elem, "_elm_leaveme", spotlight); + efl_canvas_object_clipper_set(elem, pd->clipper); efl_canvas_group_member_add(pd->container, elem); efl_gfx_entity_visible_set(elem, EINA_FALSE); } @@ -65,7 +74,7 @@ _efl_ui_spotlight_manager_plain_efl_ui_spotlight_manager_bind(Eo *obj, Efl_Ui_Sp } static void -_content_changed(Eo *obj, Efl_Ui_Spotlight_Manager_Plain_Data *pd) +_content_changed(Eo *obj, Efl_Ui_Spotlight_Plain_Manager_Data *pd) { if (efl_ui_spotlight_active_element_get(pd->container) != pd->current_content) { @@ -79,23 +88,27 @@ _content_changed(Eo *obj, Efl_Ui_Spotlight_Manager_Plain_Data *pd) } EOLIAN static void -_efl_ui_spotlight_manager_plain_efl_ui_spotlight_manager_content_add(Eo *obj, Efl_Ui_Spotlight_Manager_Plain_Data *pd, Efl_Gfx_Entity *subobj, int index EINA_UNUSED) +_efl_ui_spotlight_plain_manager_efl_ui_spotlight_manager_content_add(Eo *obj, Efl_Ui_Spotlight_Plain_Manager_Data *pd, Efl_Gfx_Entity *subobj, int index EINA_UNUSED) { + efl_key_data_set(subobj, "_elm_leaveme", pd->container); + efl_canvas_object_clipper_set(subobj, pd->clipper); efl_canvas_group_member_add(pd->container, subobj); efl_gfx_entity_visible_set(subobj, EINA_FALSE); _content_changed(obj, pd); } EOLIAN static void -_efl_ui_spotlight_manager_plain_efl_ui_spotlight_manager_content_del(Eo *obj, Efl_Ui_Spotlight_Manager_Plain_Data *pd, Efl_Gfx_Entity *subobj, int index EINA_UNUSED) +_efl_ui_spotlight_plain_manager_efl_ui_spotlight_manager_content_del(Eo *obj, Efl_Ui_Spotlight_Plain_Manager_Data *pd, Efl_Gfx_Entity *subobj, int index EINA_UNUSED) { + efl_key_data_set(subobj, "_elm_leaveme", NULL); + efl_canvas_object_clipper_set(subobj, NULL); efl_canvas_group_member_remove(pd->container, subobj); if (pd->current_content == subobj) pd->current_content = NULL; _content_changed(obj, pd); } EOLIAN static void -_efl_ui_spotlight_manager_plain_efl_ui_spotlight_manager_switch_to(Eo *obj, Efl_Ui_Spotlight_Manager_Plain_Data *pd, int from EINA_UNUSED, int to) +_efl_ui_spotlight_plain_manager_efl_ui_spotlight_manager_switch_to(Eo *obj, Efl_Ui_Spotlight_Plain_Manager_Data *pd, int from EINA_UNUSED, int to, Efl_Ui_Spotlight_Manager_Switch_Reason reason EINA_UNUSED) { Efl_Gfx_Entity *to_obj, *from_obj; to_obj = efl_pack_content_get(pd->container, to); @@ -117,14 +130,14 @@ _efl_ui_spotlight_manager_plain_efl_ui_spotlight_manager_switch_to(Eo *obj, Efl_ } EOLIAN static void -_efl_ui_spotlight_manager_plain_efl_ui_spotlight_manager_size_set(Eo *obj, Efl_Ui_Spotlight_Manager_Plain_Data *pd, Eina_Size2D size) +_efl_ui_spotlight_plain_manager_efl_ui_spotlight_manager_size_set(Eo *obj, Efl_Ui_Spotlight_Plain_Manager_Data *pd, Eina_Size2D size) { pd->page_size = size; _geom_sync(obj, pd); } EOLIAN static void -_efl_ui_spotlight_manager_plain_efl_object_destructor(Eo *obj, Efl_Ui_Spotlight_Manager_Plain_Data *pd EINA_UNUSED) +_efl_ui_spotlight_plain_manager_efl_object_destructor(Eo *obj, Efl_Ui_Spotlight_Plain_Manager_Data *pd EINA_UNUSED) { efl_destructor(efl_super(obj, MY_CLASS)); @@ -136,16 +149,28 @@ _efl_ui_spotlight_manager_plain_efl_object_destructor(Eo *obj, Efl_Ui_Spotlight_ } EOLIAN static void -_efl_ui_spotlight_manager_plain_efl_ui_spotlight_manager_animated_transition_set(Eo *obj EINA_UNUSED, Efl_Ui_Spotlight_Manager_Plain_Data *pd, Eina_Bool animation) +_efl_ui_spotlight_plain_manager_efl_ui_spotlight_manager_animated_transition_set(Eo *obj EINA_UNUSED, Efl_Ui_Spotlight_Plain_Manager_Data *pd, Eina_Bool animation) { pd->animation = animation; } EOLIAN static Eina_Bool -_efl_ui_spotlight_manager_plain_efl_ui_spotlight_manager_animated_transition_get(const Eo *obj EINA_UNUSED, Efl_Ui_Spotlight_Manager_Plain_Data *pd) +_efl_ui_spotlight_plain_manager_efl_ui_spotlight_manager_animated_transition_get(const Eo *obj EINA_UNUSED, Efl_Ui_Spotlight_Plain_Manager_Data *pd) { return pd->animation; } +EOLIAN static void +_efl_ui_spotlight_plain_manager_efl_object_invalidate(Eo *obj, Efl_Ui_Spotlight_Plain_Manager_Data *pd) +{ + efl_del(pd->clipper); + + for (int i = 0; i < efl_content_count(pd->container); ++i) + { + efl_canvas_object_clipper_set(efl_pack_content_get(pd->container, i), NULL); + } + + efl_invalidate(efl_super(obj, MY_CLASS)); +} -#include "efl_ui_spotlight_manager_plain.eo.c" +#include "efl_ui_spotlight_plain_manager.eo.c" diff --git a/src/lib/elementary/efl_ui_spotlight_manager_plain.eo b/src/lib/elementary/efl_ui_spotlight_plain_manager.eo index fd4f5d9664..95464305ec 100644 --- a/src/lib/elementary/efl_ui_spotlight_manager_plain.eo +++ b/src/lib/elementary/efl_ui_spotlight_plain_manager.eo @@ -1,5 +1,6 @@ -class @beta Efl.Ui.Spotlight.Manager_Plain extends Efl.Ui.Spotlight.Manager +class @beta Efl.Ui.Spotlight.Plain_Manager extends Efl.Ui.Spotlight.Manager { + c_prefix: efl_ui_spotlight_manager_plain; implements { Efl.Ui.Spotlight.Manager.bind; Efl.Ui.Spotlight.Manager.content_add; @@ -8,5 +9,6 @@ class @beta Efl.Ui.Spotlight.Manager_Plain extends Efl.Ui.Spotlight.Manager Efl.Ui.Spotlight.Manager.size {set;} Efl.Ui.Spotlight.Manager.animated_transition {set; get;} Efl.Object.destructor; + Efl.Object.invalidate; } } diff --git a/src/lib/elementary/efl_ui_spotlight_manager_scroll.c b/src/lib/elementary/efl_ui_spotlight_scroll_manager.c index 1b5d974176..f6eb1323e6 100644 --- a/src/lib/elementary/efl_ui_spotlight_manager_scroll.c +++ b/src/lib/elementary/efl_ui_spotlight_scroll_manager.c @@ -21,12 +21,13 @@ typedef struct { Eina_Bool active; int from; Eina_Position2D mouse_start; + double start_time; } mouse_move; Eina_Bool animation; Eina_Bool scroll_block; -} Efl_Ui_Spotlight_Manager_Scroll_Data; +} Efl_Ui_Spotlight_Scroll_Manager_Data; -#define MY_CLASS EFL_UI_SPOTLIGHT_MANAGER_SCROLL_CLASS +#define MY_CLASS EFL_UI_SPOTLIGHT_SCROLL_MANAGER_CLASS static void _page_set_animation(void *data, const Efl_Event *event); @@ -37,7 +38,7 @@ _propagate_progress(Eo *obj, double pos) } static void -_apply_box_properties(Eo *obj, Efl_Ui_Spotlight_Manager_Scroll_Data *pd) +_apply_box_properties(Eo *obj, Efl_Ui_Spotlight_Scroll_Manager_Data *pd) { Eina_Rect geometry = EINA_RECT_EMPTY(); Eina_Rect group_pos = efl_gfx_entity_geometry_get(pd->container); @@ -84,7 +85,7 @@ _mouse_down_cb(void *data, { Efl_Input_Pointer *ev = event->info; Eo *obj = data; - Efl_Ui_Spotlight_Manager_Scroll_Data *pd = efl_data_scope_get(obj, MY_CLASS); + Efl_Ui_Spotlight_Scroll_Manager_Data *pd = efl_data_scope_get(obj, MY_CLASS); if (efl_input_pointer_button_get(ev) != 1) return; if (efl_input_event_flags_get(ev) & EFL_INPUT_FLAGS_PROCESSED) return; @@ -98,6 +99,7 @@ _mouse_down_cb(void *data, pd->mouse_move.active = EINA_TRUE; pd->mouse_move.from = efl_pack_index_get(pd->container, efl_ui_spotlight_active_element_get(pd->container)); pd->mouse_move.mouse_start = efl_input_pointer_position_get(ev); + pd->mouse_move.start_time = ecore_time_get(); pd->transition.from = pd->mouse_move.from; pd->transition.to = pd->transition.from + 1; @@ -110,7 +112,7 @@ _mouse_move_cb(void *data, { Efl_Input_Pointer *ev = event->info; Eo *obj = data; - Efl_Ui_Spotlight_Manager_Scroll_Data *pd = efl_data_scope_get(obj, MY_CLASS); + Efl_Ui_Spotlight_Scroll_Manager_Data *pd = efl_data_scope_get(obj, MY_CLASS); Eina_Position2D pos; int pos_y_diff; @@ -125,12 +127,15 @@ _mouse_move_cb(void *data, if (!efl_input_processed_get(ev)) efl_input_processed_set(ev, EINA_TRUE); - pd->transition.active = EINA_TRUE; - pd->transition.progress = (double)pos_y_diff / (double)pd->page_size.w; - - _propagate_progress(data, pd->transition.from + pd->transition.progress); - - _apply_box_properties(obj, pd); + if (pd->transition.active || + EINA_POSITION2D_DISTANCE(pd->mouse_move.mouse_start, efl_input_pointer_position_get(ev)) > elm_config_finger_size_get() || + ecore_time_get() - pd->mouse_move.start_time > 0.1) + { + pd->transition.active = EINA_TRUE; + pd->transition.progress = (double)pos_y_diff / (double)pd->page_size.w; + _propagate_progress(data, pd->transition.from + pd->transition.progress); + _apply_box_properties(obj, pd); + } } static void @@ -139,7 +144,7 @@ _mouse_up_cb(void *data, { Efl_Input_Pointer *ev = event->info; Eo *obj = data; - Efl_Ui_Spotlight_Manager_Scroll_Data *pd = efl_data_scope_get(obj, MY_CLASS); + Efl_Ui_Spotlight_Scroll_Manager_Data *pd = efl_data_scope_get(obj, MY_CLASS); if (efl_input_event_flags_get(ev) & EFL_INPUT_FLAGS_PROCESSED) return; if (!pd->mouse_move.active) return; @@ -150,6 +155,10 @@ _mouse_up_cb(void *data, Efl_Ui_Widget *new_content = efl_pack_content_get(pd->container, MIN(MAX(result, 0), efl_content_count(pd->container) - 1)); efl_ui_spotlight_active_element_set(pd->container, new_content); + + //Set input processed not to cause clicked event to content button. + if (EINA_POSITION2D_DISTANCE(pd->mouse_move.mouse_start, efl_input_pointer_position_get(ev)) > elm_config_finger_size_get()) + efl_input_processed_set(ev, EINA_TRUE); } EFL_CALLBACKS_ARRAY_DEFINE(mouse_listeners, @@ -159,7 +168,7 @@ EFL_CALLBACKS_ARRAY_DEFINE(mouse_listeners, ); EOLIAN static void -_efl_ui_spotlight_manager_scroll_efl_ui_spotlight_manager_bind(Eo *obj, Efl_Ui_Spotlight_Manager_Scroll_Data *pd, Efl_Ui_Spotlight_Container *spotlight) +_efl_ui_spotlight_scroll_manager_efl_ui_spotlight_manager_bind(Eo *obj, Efl_Ui_Spotlight_Scroll_Manager_Data *pd, Efl_Ui_Spotlight_Container *spotlight) { if (spotlight) { @@ -185,6 +194,7 @@ _efl_ui_spotlight_manager_scroll_efl_ui_spotlight_manager_bind(Eo *obj, Efl_Ui_S for (int i = 0; i < efl_content_count(spotlight) ; ++i) { Efl_Gfx_Entity *elem = efl_pack_content_get(spotlight, i); + efl_key_data_set(elem, "_elm_leaveme", spotlight); efl_canvas_object_clipper_set(elem, pd->backclip); efl_canvas_group_member_add(pd->container, elem); efl_gfx_entity_visible_set(elem, EINA_TRUE); @@ -195,8 +205,9 @@ _efl_ui_spotlight_manager_scroll_efl_ui_spotlight_manager_bind(Eo *obj, Efl_Ui_S } EOLIAN static void -_efl_ui_spotlight_manager_scroll_efl_ui_spotlight_manager_content_add(Eo *obj EINA_UNUSED, Efl_Ui_Spotlight_Manager_Scroll_Data *pd, Efl_Gfx_Entity *subobj, int index EINA_UNUSED) +_efl_ui_spotlight_scroll_manager_efl_ui_spotlight_manager_content_add(Eo *obj EINA_UNUSED, Efl_Ui_Spotlight_Scroll_Manager_Data *pd, Efl_Gfx_Entity *subobj, int index EINA_UNUSED) { + efl_key_data_set(subobj, "_elm_leaveme", pd->container); efl_gfx_entity_visible_set(subobj, EINA_TRUE); efl_canvas_object_clipper_set(subobj, pd->backclip); efl_canvas_group_member_add(pd->container, subobj); @@ -207,8 +218,9 @@ _efl_ui_spotlight_manager_scroll_efl_ui_spotlight_manager_content_add(Eo *obj EI EOLIAN static void -_efl_ui_spotlight_manager_scroll_efl_ui_spotlight_manager_content_del(Eo *obj EINA_UNUSED, Efl_Ui_Spotlight_Manager_Scroll_Data *pd, Efl_Gfx_Entity *subobj, int index EINA_UNUSED) +_efl_ui_spotlight_scroll_manager_efl_ui_spotlight_manager_content_del(Eo *obj EINA_UNUSED, Efl_Ui_Spotlight_Scroll_Manager_Data *pd, Efl_Gfx_Entity *subobj, int index EINA_UNUSED) { + efl_key_data_set(subobj, "_elm_leaveme", NULL); efl_canvas_object_clipper_set(subobj, NULL); efl_canvas_group_member_remove(pd->container, subobj); @@ -219,7 +231,7 @@ _efl_ui_spotlight_manager_scroll_efl_ui_spotlight_manager_content_del(Eo *obj EI static void _page_set_animation(void *data, const Efl_Event *event EINA_UNUSED) { - Efl_Ui_Spotlight_Manager_Scroll_Data *pd = efl_data_scope_get(data, MY_CLASS); + Efl_Ui_Spotlight_Scroll_Manager_Data *pd = efl_data_scope_get(data, MY_CLASS); double p = (ecore_loop_time_get() - pd->transition.start_time) / pd->transition.max_time; if (p >= 1.0) p = 1.0; @@ -238,7 +250,7 @@ _page_set_animation(void *data, const Efl_Event *event EINA_UNUSED) } static void -_animation_request_switch(Eo *obj, Efl_Ui_Spotlight_Manager_Scroll_Data *pd, int from, int to) +_animation_request_switch(Eo *obj, Efl_Ui_Spotlight_Scroll_Manager_Data *pd, int from, int to) { //if there is already a transition ongoing, which is no mouse transition, but goes to the same position, then do nothing if (pd->transition.active && !pd->mouse_move.active && pd->transition.to == to) @@ -273,7 +285,7 @@ _animation_request_switch(Eo *obj, Efl_Ui_Spotlight_Manager_Scroll_Data *pd, int } EOLIAN static void -_efl_ui_spotlight_manager_scroll_efl_ui_spotlight_manager_switch_to(Eo *obj, Efl_Ui_Spotlight_Manager_Scroll_Data *pd, int from, int to) +_efl_ui_spotlight_scroll_manager_efl_ui_spotlight_manager_switch_to(Eo *obj, Efl_Ui_Spotlight_Scroll_Manager_Data *pd, int from, int to, Efl_Ui_Spotlight_Manager_Switch_Reason reason EINA_UNUSED) { if (pd->animation) { @@ -289,7 +301,7 @@ _efl_ui_spotlight_manager_scroll_efl_ui_spotlight_manager_switch_to(Eo *obj, Efl } EOLIAN static void -_efl_ui_spotlight_manager_scroll_efl_ui_spotlight_manager_size_set(Eo *obj EINA_UNUSED, Efl_Ui_Spotlight_Manager_Scroll_Data *pd, Eina_Size2D size) +_efl_ui_spotlight_scroll_manager_efl_ui_spotlight_manager_size_set(Eo *obj EINA_UNUSED, Efl_Ui_Spotlight_Scroll_Manager_Data *pd, Eina_Size2D size) { pd->page_size = size; if (!pd->transition.active) @@ -297,7 +309,7 @@ _efl_ui_spotlight_manager_scroll_efl_ui_spotlight_manager_size_set(Eo *obj EINA_ } EOLIAN static void -_efl_ui_spotlight_manager_scroll_efl_ui_spotlight_manager_animated_transition_set(Eo *obj EINA_UNUSED, Efl_Ui_Spotlight_Manager_Scroll_Data *pd, Eina_Bool animation) +_efl_ui_spotlight_scroll_manager_efl_ui_spotlight_manager_animated_transition_set(Eo *obj EINA_UNUSED, Efl_Ui_Spotlight_Scroll_Manager_Data *pd, Eina_Bool animation) { pd->animation = animation; if (pd->transition.active && !animation) @@ -309,14 +321,14 @@ _efl_ui_spotlight_manager_scroll_efl_ui_spotlight_manager_animated_transition_se } EOLIAN static Eina_Bool -_efl_ui_spotlight_manager_scroll_efl_ui_spotlight_manager_animated_transition_get(const Eo *obj EINA_UNUSED, Efl_Ui_Spotlight_Manager_Scroll_Data *pd) +_efl_ui_spotlight_scroll_manager_efl_ui_spotlight_manager_animated_transition_get(const Eo *obj EINA_UNUSED, Efl_Ui_Spotlight_Scroll_Manager_Data *pd) { return pd->animation; } EOLIAN static void -_efl_ui_spotlight_manager_scroll_efl_object_invalidate(Eo *obj, Efl_Ui_Spotlight_Manager_Scroll_Data *pd EINA_UNUSED) +_efl_ui_spotlight_scroll_manager_efl_object_invalidate(Eo *obj, Efl_Ui_Spotlight_Scroll_Manager_Data *pd EINA_UNUSED) { efl_del(pd->event); efl_del(pd->backclip); @@ -331,7 +343,7 @@ _efl_ui_spotlight_manager_scroll_efl_object_invalidate(Eo *obj, Efl_Ui_Spotlight } EOLIAN static void -_efl_ui_spotlight_manager_scroll_scroll_block_set(Eo *obj EINA_UNUSED, Efl_Ui_Spotlight_Manager_Scroll_Data *pd, Eina_Bool scroll_block) +_efl_ui_spotlight_scroll_manager_scroll_block_set(Eo *obj EINA_UNUSED, Efl_Ui_Spotlight_Scroll_Manager_Data *pd, Eina_Bool scroll_block) { if (pd->scroll_block == scroll_block) return; @@ -346,9 +358,9 @@ _efl_ui_spotlight_manager_scroll_scroll_block_set(Eo *obj EINA_UNUSED, Efl_Ui_Sp } EOLIAN static Eina_Bool -_efl_ui_spotlight_manager_scroll_scroll_block_get(const Eo *obj EINA_UNUSED, Efl_Ui_Spotlight_Manager_Scroll_Data *pd) +_efl_ui_spotlight_scroll_manager_scroll_block_get(const Eo *obj EINA_UNUSED, Efl_Ui_Spotlight_Scroll_Manager_Data *pd) { return pd->scroll_block; } -#include "efl_ui_spotlight_manager_scroll.eo.c" +#include "efl_ui_spotlight_scroll_manager.eo.c" diff --git a/src/lib/elementary/efl_ui_spotlight_manager_scroll.eo b/src/lib/elementary/efl_ui_spotlight_scroll_manager.eo index c9a8e7ad34..b7101035cd 100644 --- a/src/lib/elementary/efl_ui_spotlight_manager_scroll.eo +++ b/src/lib/elementary/efl_ui_spotlight_scroll_manager.eo @@ -1,5 +1,6 @@ -class @beta Efl.Ui.Spotlight.Manager_Scroll extends Efl.Ui.Spotlight.Manager +class @beta Efl.Ui.Spotlight.Scroll_Manager extends Efl.Ui.Spotlight.Manager { + c_prefix: efl_ui_spotlight_manager_scroll; methods { @property scroll_block { [[User scrolling forbidden. diff --git a/src/lib/elementary/efl_ui_spotlight_util.c b/src/lib/elementary/efl_ui_spotlight_util.c index c49ebd4d8c..c7c68da4e0 100644 --- a/src/lib/elementary/efl_ui_spotlight_util.c +++ b/src/lib/elementary/efl_ui_spotlight_util.c @@ -12,7 +12,7 @@ typedef struct { EOLIAN static Efl_Ui_Spotlight_Container* _efl_ui_spotlight_util_stack_gen(Efl_Ui_Widget *parent) { - Efl_Ui_Spotlight_Manager *manager = efl_new(EFL_UI_SPOTLIGHT_MANAGER_STACK_CLASS); + Efl_Ui_Spotlight_Manager *manager = efl_new(EFL_UI_SPOTLIGHT_FADE_MANAGER_CLASS); return efl_add(EFL_UI_SPOTLIGHT_CONTAINER_CLASS, parent, efl_ui_spotlight_manager_set(efl_added, manager)); } diff --git a/src/lib/elementary/efl_ui_stack.c b/src/lib/elementary/efl_ui_stack.c index e1769b7603..7c9f72f95a 100644 --- a/src/lib/elementary/efl_ui_stack.c +++ b/src/lib/elementary/efl_ui_stack.c @@ -18,7 +18,7 @@ _efl_ui_stack_efl_object_constructor(Eo *obj, Efl_Ui_Stack_Data *sd EINA_UNUSED) obj = efl_constructor(efl_super(obj, MY_CLASS)); - stack = efl_new(EFL_UI_SPOTLIGHT_MANAGER_STACK_CLASS); + stack = efl_new(EFL_UI_SPOTLIGHT_FADE_MANAGER_CLASS); efl_ui_spotlight_manager_set(obj, stack); return obj; diff --git a/src/lib/elementary/efl_ui_stack.eo b/src/lib/elementary/efl_ui_stack.eo index bdaaeed9a2..c60dffc37e 100644 --- a/src/lib/elementary/efl_ui_stack.eo +++ b/src/lib/elementary/efl_ui_stack.eo @@ -1,8 +1,9 @@ -class @beta Efl.Ui.Stack extends Efl.Ui.Spotlight.Container +class Efl.Ui.Stack extends Efl.Ui.Spotlight.Container { [[A spotlight with predefined @Efl.Ui.Spotlight.Container.spotlight_manager The container will alpha-blend the new content over the old content. + @since 1.24 ]] implements { Efl.Object.constructor; diff --git a/src/lib/elementary/efl_ui_tab_bar.c b/src/lib/elementary/efl_ui_tab_bar.c index 34e37299e2..da5ca2c43d 100644 --- a/src/lib/elementary/efl_ui_tab_bar.c +++ b/src/lib/elementary/efl_ui_tab_bar.c @@ -26,6 +26,19 @@ _efl_ui_tab_bar_efl_ui_single_selectable_fallback_selection_set(Eo *obj EINA_UNU efl_ui_selectable_selected_set(pd->fallback_selection, EINA_TRUE); } +EOLIAN static void +_efl_ui_tab_bar_efl_ui_single_selectable_allow_manual_deselection_set(Eo *obj EINA_UNUSED, Efl_Ui_Tab_Bar_Data *pd, Eina_Bool allow_manual_deselection) +{ + pd->allow_manual_deselection = !!allow_manual_deselection; +} + +EOLIAN static Eina_Bool +_efl_ui_tab_bar_efl_ui_single_selectable_allow_manual_deselection_get(const Eo *obj EINA_UNUSED, Efl_Ui_Tab_Bar_Data *pd) +{ + return pd->allow_manual_deselection; +} + + EOLIAN static Efl_Ui_Selectable* _efl_ui_tab_bar_efl_ui_single_selectable_fallback_selection_get(const Eo *obj EINA_UNUSED, Efl_Ui_Tab_Bar_Data *pd) { diff --git a/src/lib/elementary/efl_ui_tab_bar.eo b/src/lib/elementary/efl_ui_tab_bar.eo index cf06e0de47..c077cf0a57 100644 --- a/src/lib/elementary/efl_ui_tab_bar.eo +++ b/src/lib/elementary/efl_ui_tab_bar.eo @@ -15,6 +15,7 @@ class @beta Efl.Ui.Tab_Bar extends Efl.Ui.Layout_Base Efl.Object.destructor; Efl.Ui.Single_Selectable.last_selected {get;} Efl.Ui.Single_Selectable.fallback_selection {get; set;} + Efl.Ui.Single_Selectable.allow_manual_deselection {get; set;} Efl.Pack.pack; Efl.Pack.pack_clear; Efl.Pack.unpack_all; diff --git a/src/lib/elementary/efl_ui_tab_bar_private.h b/src/lib/elementary/efl_ui_tab_bar_private.h index 87763a9e87..02775c36a7 100644 --- a/src/lib/elementary/efl_ui_tab_bar_private.h +++ b/src/lib/elementary/efl_ui_tab_bar_private.h @@ -8,6 +8,7 @@ struct _Efl_Ui_Tab_Bar_Data Efl_Ui_Box *bx; Efl_Ui_Item *selected, *fallback_selection; Eina_Bool in_value_change; + Eina_Bool allow_manual_deselection : 1; }; #define EFL_UI_TAB_BAR_DATA_GET(o, sd) \ diff --git a/src/lib/elementary/efl_ui_tab_pager.c b/src/lib/elementary/efl_ui_tab_pager.c index 73e7d22c48..82b4ac4c83 100644 --- a/src/lib/elementary/efl_ui_tab_pager.c +++ b/src/lib/elementary/efl_ui_tab_pager.c @@ -12,24 +12,25 @@ #define MY_CLASS EFL_UI_TAB_PAGER_CLASS static void -_select(Eo *obj EINA_UNUSED, Efl_Ui_Tab_Page *page) +_efl_ui_tab_pager_spotlight_manager_set(Eo *obj EINA_UNUSED, Efl_Ui_Tab_Pager_Data *pd, Efl_Ui_Spotlight_Manager *manager) { - Efl_Ui_Tab_Bar_Default_Item *item = efl_ui_tab_page_tab_bar_item_get(page); - - if (!efl_ui_selectable_selected_get(item)) - efl_ui_selectable_selected_set(item, EINA_TRUE); + efl_ui_spotlight_manager_set(pd->spotlight, manager); } + static void _tab_select_cb(void *data, const Efl_Event *event) { Efl_Ui_Tab_Bar_Default_Item *selected; Efl_Ui_Tab_Page *page; + Efl_Ui_Tab_Pager_Data *pd; + pd = efl_data_scope_get(data, MY_CLASS); + EINA_SAFETY_ON_NULL_RETURN(pd); selected = efl_ui_selectable_last_selected_get(event->object); page = efl_parent_get(selected); - if (efl_ui_spotlight_active_element_get(data)) - efl_ui_spotlight_active_element_set(data, page); + if (efl_ui_spotlight_active_element_get(pd->spotlight)) + efl_ui_spotlight_active_element_set(pd->spotlight, page); } EOLIAN static Efl_Canvas_Object * @@ -39,13 +40,6 @@ _efl_ui_tab_pager_tab_bar_get(const Eo *obj EINA_UNUSED, Efl_Ui_Tab_Pager_Data * } EOLIAN static void -_efl_ui_tab_pager_efl_ui_spotlight_container_active_element_set(Eo *obj, Efl_Ui_Tab_Pager_Data *sd EINA_UNUSED, Efl_Ui_Widget *element) -{ - efl_ui_spotlight_active_element_set(efl_super(obj, MY_CLASS), element); - _select(obj, element); -} - -EOLIAN static void _efl_ui_tab_pager_efl_object_destructor(Eo *obj, Efl_Ui_Tab_Pager_Data *sd) { if (sd->tab_bar != NULL) @@ -66,10 +60,26 @@ _efl_ui_tab_pager_efl_object_constructor(Eo *obj, Efl_Ui_Tab_Pager_Data *sd) sd->tab_bar = efl_add(EFL_UI_TAB_BAR_CLASS, obj); efl_event_callback_add(sd->tab_bar, EFL_UI_EVENT_ITEM_SELECTED, _tab_select_cb, obj); + efl_event_callback_forwarder_del(sd->tab_bar, EFL_UI_SELECTABLE_EVENT_SELECTION_CHANGED, obj); + + sd->spotlight = efl_add(EFL_UI_SPOTLIGHT_CONTAINER_CLASS, obj); return obj; } +EOLIAN static Eina_Error +_efl_ui_tab_pager_efl_ui_widget_theme_apply(Eo *obj, Efl_Ui_Tab_Pager_Data *pd) +{ + Eina_Error err; + + err = efl_ui_widget_theme_apply(efl_super(obj, MY_CLASS)); + + efl_content_set(efl_part(obj, "efl.tab_root"), pd->tab_bar); + efl_content_set(efl_part(obj, "efl.page_root"), pd->spotlight); + + return err; +} + EOLIAN static Efl_Object* _efl_ui_tab_pager_efl_object_finalize(Eo *obj, Efl_Ui_Tab_Pager_Data *pd) { @@ -80,91 +90,157 @@ _efl_ui_tab_pager_efl_object_finalize(Eo *obj, Efl_Ui_Tab_Pager_Data *pd) return obj; } +EOLIAN static int +_efl_ui_tab_pager_efl_container_content_count(Eo *obj EINA_UNUSED, Efl_Ui_Tab_Pager_Data *pd) +{ + return efl_content_count(pd->spotlight); +} + +EOLIAN static Eina_Iterator* +_efl_ui_tab_pager_efl_container_content_iterate(Eo *obj EINA_UNUSED, Efl_Ui_Tab_Pager_Data *pd) +{ + return efl_content_iterate(pd->spotlight); +} + +EOLIAN static Eina_Bool +_efl_ui_tab_pager_efl_pack_pack(Eo *obj EINA_UNUSED, Efl_Ui_Tab_Pager_Data *pd, Efl_Gfx_Entity *subobj) +{ + return efl_pack(pd->spotlight, subobj); +} + +EOLIAN static Efl_Gfx_Entity* +_efl_ui_tab_pager_efl_pack_linear_pack_content_get(Eo *obj EINA_UNUSED, Efl_Ui_Tab_Pager_Data *pd, int index) +{ + return efl_pack_content_get(pd->spotlight, index); +} + +EOLIAN static int +_efl_ui_tab_pager_efl_pack_linear_pack_index_get(Eo *obj EINA_UNUSED, Efl_Ui_Tab_Pager_Data *pd, const Efl_Gfx_Entity *subobj) +{ + return efl_pack_index_get(pd->spotlight, subobj); +} + EOLIAN static Eina_Bool -_efl_ui_tab_pager_efl_pack_pack_clear(Eo *obj, Efl_Ui_Tab_Pager_Data *sd) +_efl_ui_tab_pager_efl_pack_pack_clear(Eo *obj EINA_UNUSED, Efl_Ui_Tab_Pager_Data *sd) { if (!efl_pack_clear(sd->tab_bar)) return EINA_FALSE; - return efl_pack_clear(efl_super(obj, MY_CLASS)); + return efl_pack_clear(sd->spotlight); } EOLIAN static Eina_Bool -_efl_ui_tab_pager_efl_pack_unpack_all(Eo *obj, Efl_Ui_Tab_Pager_Data *sd) +_efl_ui_tab_pager_efl_pack_unpack_all(Eo *obj EINA_UNUSED, Efl_Ui_Tab_Pager_Data *sd) { if (!efl_pack_unpack_all(sd->tab_bar)) return EINA_FALSE; - return efl_pack_unpack_all(efl_super(obj, MY_CLASS)); + return efl_pack_unpack_all(sd->spotlight); } #define ITEM(s) efl_ui_tab_page_tab_bar_item_get(s) EOLIAN static Eina_Bool -_efl_ui_tab_pager_efl_pack_unpack(Eo *obj, Efl_Ui_Tab_Pager_Data *sd, Efl_Gfx_Entity *subobj) +_efl_ui_tab_pager_efl_pack_unpack(Eo *obj EINA_UNUSED, Efl_Ui_Tab_Pager_Data *sd, Efl_Gfx_Entity *subobj) { if (!efl_pack_unpack(sd->tab_bar, ITEM(subobj))) return EINA_FALSE; - return efl_pack_unpack(efl_super(obj, MY_CLASS), subobj); + return efl_pack_unpack(sd->spotlight, subobj); } EOLIAN static Eina_Bool -_efl_ui_tab_pager_efl_pack_linear_pack_begin(Eo *obj, +_efl_ui_tab_pager_efl_pack_linear_pack_begin(Eo *obj EINA_UNUSED, Efl_Ui_Tab_Pager_Data *sd, Efl_Gfx_Entity *subobj) { if (!efl_pack_begin(sd->tab_bar, ITEM(subobj))) return EINA_FALSE; - return efl_pack_begin(efl_super(obj, MY_CLASS), subobj); + return efl_pack_begin(sd->spotlight, subobj); } EOLIAN static Eina_Bool -_efl_ui_tab_pager_efl_pack_linear_pack_end(Eo *obj, +_efl_ui_tab_pager_efl_pack_linear_pack_end(Eo *obj EINA_UNUSED, Efl_Ui_Tab_Pager_Data *sd, Efl_Gfx_Entity *subobj) { if (!efl_pack_end(sd->tab_bar, ITEM(subobj))) return EINA_FALSE; - return efl_pack_end(efl_super(obj, MY_CLASS), subobj); + return efl_pack_end(sd->spotlight, subobj); } EOLIAN static Eina_Bool -_efl_ui_tab_pager_efl_pack_linear_pack_before(Eo *obj, +_efl_ui_tab_pager_efl_pack_linear_pack_before(Eo *obj EINA_UNUSED, Efl_Ui_Tab_Pager_Data *sd, Efl_Gfx_Entity *subobj, const Efl_Gfx_Entity *existing) { if (!efl_pack_before(sd->tab_bar, ITEM(subobj), ITEM(existing))) return EINA_FALSE; - return efl_pack_before(efl_super(obj, MY_CLASS), subobj, existing); + return efl_pack_before(sd->spotlight, subobj, existing); } EOLIAN static Eina_Bool -_efl_ui_tab_pager_efl_pack_linear_pack_after(Eo *obj, +_efl_ui_tab_pager_efl_pack_linear_pack_after(Eo *obj EINA_UNUSED, Efl_Ui_Tab_Pager_Data *sd, Efl_Gfx_Entity *subobj, const Efl_Gfx_Entity *existing) { if (!efl_pack_after(sd->tab_bar, ITEM(subobj), ITEM(existing))) return EINA_FALSE; - return efl_pack_after(efl_super(obj, MY_CLASS), subobj, existing); + return efl_pack_after(sd->spotlight, subobj, existing); } EOLIAN static Eina_Bool -_efl_ui_tab_pager_efl_pack_linear_pack_at(Eo *obj, +_efl_ui_tab_pager_efl_pack_linear_pack_at(Eo *obj EINA_UNUSED, Efl_Ui_Tab_Pager_Data *sd, Efl_Gfx_Entity *subobj, int index) { if (!efl_pack_at(sd->tab_bar, ITEM(subobj), index)) return EINA_FALSE; - return efl_pack_at(efl_super(obj, MY_CLASS), subobj, index); + return efl_pack_at(sd->spotlight, subobj, index); } EOLIAN static Efl_Gfx_Entity * -_efl_ui_tab_pager_efl_pack_linear_pack_unpack_at(Eo *obj, Efl_Ui_Tab_Pager_Data *sd, int index) +_efl_ui_tab_pager_efl_pack_linear_pack_unpack_at(Eo *obj EINA_UNUSED, Efl_Ui_Tab_Pager_Data *sd, int index) { if (!efl_pack_unpack_at(sd->tab_bar, index)) return NULL; - return efl_pack_unpack_at(efl_super(obj, MY_CLASS), index); + return efl_pack_unpack_at(sd->spotlight, index); +} + +EOLIAN static Efl_Ui_Selectable* +_efl_ui_tab_pager_efl_ui_single_selectable_last_selected_get(const Eo *obj EINA_UNUSED, Efl_Ui_Tab_Pager_Data *pd) +{ + Efl_Ui_Tab_Bar_Default_Item *item = efl_ui_selectable_last_selected_get(pd->tab_bar); + + return efl_parent_get(item); +} + +EOLIAN static void +_efl_ui_tab_pager_efl_ui_single_selectable_fallback_selection_set(Eo *obj EINA_UNUSED, Efl_Ui_Tab_Pager_Data *pd, Efl_Ui_Selectable *fallback) +{ + efl_ui_selectable_fallback_selection_set(pd->tab_bar, efl_ui_tab_page_tab_bar_item_get(fallback)); +} + +EOLIAN static Efl_Ui_Selectable* +_efl_ui_tab_pager_efl_ui_single_selectable_fallback_selection_get(const Eo *obj EINA_UNUSED, Efl_Ui_Tab_Pager_Data *pd) +{ + Efl_Ui_Tab_Bar_Default_Item *item = efl_ui_selectable_fallback_selection_get(pd->tab_bar); + + return efl_parent_get(item); +} + +EOLIAN static void +_efl_ui_tab_pager_efl_ui_single_selectable_allow_manual_deselection_set(Eo *obj EINA_UNUSED, Efl_Ui_Tab_Pager_Data *pd, Eina_Bool allow_manual_deselection) +{ + efl_ui_selectable_allow_manual_deselection_set(pd->tab_bar, allow_manual_deselection); } + +EOLIAN static Eina_Bool +_efl_ui_tab_pager_efl_ui_single_selectable_allow_manual_deselection_get(const Eo *obj EINA_UNUSED, Efl_Ui_Tab_Pager_Data *pd) +{ + return efl_ui_selectable_allow_manual_deselection_get(pd->tab_bar); +} + + #include "efl_ui_tab_pager.eo.c" diff --git a/src/lib/elementary/efl_ui_tab_pager.eo b/src/lib/elementary/efl_ui_tab_pager.eo index 9f4bb42d4f..8bf1a51fe3 100644 --- a/src/lib/elementary/efl_ui_tab_pager.eo +++ b/src/lib/elementary/efl_ui_tab_pager.eo @@ -1,9 +1,12 @@ -class @beta Efl.Ui.Tab_Pager extends Efl.Ui.Spotlight.Container +class @beta Efl.Ui.Tab_Pager extends Efl.Ui.Layout_Base + implements Efl.Pack_Linear, Efl.Ui.Single_Selectable { [[Container for @Efl.Ui.Tab_Page This container consists out of a Efl.Ui.Tab_Bar and a place to display the content of the pages. The items that are generated out of the pages will be displayed in the tab bar of this pager. + + The object has an internal @Efl.Ui.Spotlight.Container which displays the content of a item. ]] methods { @property tab_bar { @@ -15,20 +18,37 @@ class @beta Efl.Ui.Tab_Pager extends Efl.Ui.Spotlight.Container tab_bar: Efl.Ui.Tab_Bar; [[Tab bar for the items of the @Efl.Ui.Tab_Page]] } } + @property spotlight_manager { + [[Spotlight manager of the internal spotlight container]] + set { + + } + values { + manager : Efl.Ui.Spotlight.Manager @move; [[The @Efl.Ui.Spotlight.Manager to pass to the internal @Efl.Ui.Spotlight.Container]] + } + } } implements { Efl.Object.constructor; Efl.Object.destructor; Efl.Object.finalize; + Efl.Container.content_count; + Efl.Container.content_iterate; Efl.Pack.pack_clear; Efl.Pack.unpack_all; Efl.Pack.unpack; + Efl.Pack.pack; Efl.Pack_Linear.pack_begin; Efl.Pack_Linear.pack_end; Efl.Pack_Linear.pack_before; Efl.Pack_Linear.pack_after; Efl.Pack_Linear.pack_at; + Efl.Pack_Linear.pack_content_get; + Efl.Pack_Linear.pack_index_get; Efl.Pack_Linear.pack_unpack_at; - Efl.Ui.Spotlight.Container.active_element { set; } + Efl.Ui.Single_Selectable.last_selected {get;} + Efl.Ui.Single_Selectable.fallback_selection {set; get;} + Efl.Ui.Single_Selectable.allow_manual_deselection {set; get;} + Efl.Ui.Widget.theme_apply; } } diff --git a/src/lib/elementary/efl_ui_tab_pager_private.h b/src/lib/elementary/efl_ui_tab_pager_private.h index 1da72fe5ec..9ac7163286 100644 --- a/src/lib/elementary/efl_ui_tab_pager_private.h +++ b/src/lib/elementary/efl_ui_tab_pager_private.h @@ -6,6 +6,7 @@ typedef struct _Efl_Ui_Tab_Pager_Data Efl_Ui_Tab_Pager_Data; struct _Efl_Ui_Tab_Pager_Data { Eo *tab_bar; + Eo *spotlight; }; diff --git a/src/lib/elementary/efl_ui_table.c b/src/lib/elementary/efl_ui_table.c index 861b78ab3a..12b8342c1e 100644 --- a/src/lib/elementary/efl_ui_table.c +++ b/src/lib/elementary/efl_ui_table.c @@ -640,28 +640,6 @@ _efl_ui_table_item_iterator_free(Table_Item_Iterator *it) free(it); } -static inline Eina_Iterator * -_efl_ui_table_item_iterator_create(Eo *obj, Eina_Inlist *list) -{ - Table_Item_Iterator *it; - - it = calloc(1, sizeof(*it)); - if (!it) return NULL; - - EINA_MAGIC_SET(&it->iterator, EINA_MAGIC_ITERATOR); - - it->object = obj; - it->cur = list; - - it->iterator.version = EINA_ITERATOR_VERSION; - it->iterator.next = FUNC_ITERATOR_NEXT(_efl_ui_table_item_iterator_next); - it->iterator.get_container = FUNC_ITERATOR_GET_CONTAINER( - _efl_ui_table_item_iterator_get_container); - it->iterator.free = FUNC_ITERATOR_FREE(_efl_ui_table_item_iterator_free); - - return &it->iterator; -} - EOLIAN static Eina_Iterator * _efl_ui_table_efl_container_content_iterate(Eo *obj, Efl_Ui_Table_Data *pd) { diff --git a/src/lib/elementary/efl_ui_tags.c b/src/lib/elementary/efl_ui_tags.c index 95c5ce59d7..5cc37badda 100644 --- a/src/lib/elementary/efl_ui_tags.c +++ b/src/lib/elementary/efl_ui_tags.c @@ -757,7 +757,7 @@ _view_init(Evas_Object *obj, Efl_Ui_Tags_Data *sd) sd->entry = efl_add(EFL_UI_TEXTBOX_CLASS, sd->box, efl_text_multiline_set(efl_added, EINA_FALSE), efl_text_set(efl_added, ""), - efl_ui_textbox_cnp_mode_set(efl_added, EFL_UI_SELECTION_FORMAT_MARKUP), + efl_ui_textbox_cnp_dnd_mode_set(efl_added, EFL_UI_TEXTBOX_CNP_CONTENT_MARKUP), efl_input_text_input_panel_autoshow_set(efl_added, EINA_FALSE), efl_text_interactive_editable_set(efl_added, EINA_TRUE), efl_composite_attach(obj, efl_added)); diff --git a/src/lib/elementary/efl_ui_text_part.eo b/src/lib/elementary/efl_ui_text_part.eo deleted file mode 100644 index f5d8c0e97e..0000000000 --- a/src/lib/elementary/efl_ui_text_part.eo +++ /dev/null @@ -1,8 +0,0 @@ -class @beta Efl.Ui.Text_Part extends Efl.Ui.Layout_Part_Text -{ - [[Efl UI Text internal part class]] - data: null; - implements { - Efl.Text.text { set; get; } - } -} diff --git a/src/lib/elementary/efl_ui_textbox.c b/src/lib/elementary/efl_ui_textbox.c index e96842dba7..165ef1f0e4 100644 --- a/src/lib/elementary/efl_ui_textbox.c +++ b/src/lib/elementary/efl_ui_textbox.c @@ -15,27 +15,23 @@ #include "elm_entry_common.h" #include "elm_widget_entry.h" -#include "elm_hoversel_eo.h" -#include "efl_ui_text_part.eo.h" +#include "efl_ui_textbox_part.eo.h" #include "elm_part_helper.h" #include "efl_canvas_textblock_internal.h" typedef struct _Efl_Ui_Textbox_Data Efl_Ui_Textbox_Data; typedef struct _Efl_Ui_Text_Rectangle Efl_Ui_Text_Rectangle; typedef struct _Anchor Anchor; -typedef struct _Selection_Loss_Data Selection_Loss_Data; /** * Base widget smart data extended with entry instance data. */ struct _Efl_Ui_Textbox_Data { - Evas_Object *hit_rect, *entry_edje, *scr_edje; + Evas_Object *hit_rect, *entry_edje; - Evas_Object *hoversel; - Evas_Object *mgf_bg; - Evas_Object *mgf_clip; - Evas_Object *mgf_proxy; + Eo *popup; + Eo *popup_list; Eo *text_obj; Eo *text_guide_obj; Eo *text_table; @@ -46,37 +42,24 @@ struct _Efl_Ui_Textbox_Data Eo *cursor_bidi; Evas_Object *start_handler; Evas_Object *end_handler; - Ecore_Job *deferred_decoration_job; - Ecore_Timer *delay_write; + Eina_Future *deferred_decoration_job; /* for deferred appending */ - Ecore_Idler *append_text_idler; - char *append_text_left; int append_text_position; int append_text_len; /* Only for clipboard */ - const char *cut_sel; const char *text; - const char *file; - Elm_Text_Format format; Evas_Coord ent_w, ent_h; Evas_Coord downx, downy; Evas_Coord ox, oy; Eina_List *anchors; int gen; Eina_List *sel; - Eina_List *items; /** context menu item list */ Efl_Canvas_Textblock_Factory *item_factory; Efl_Canvas_Textblock_Factory *item_fallback_factory; - Eina_List *markup_filters; - Ecore_Job *hov_deljob; Mod_Api *api; // module api if supplied int cursor_pos; Elm_Scroller_Policy policy_h, policy_v; - Elm_Wrap_Type line_wrap; - Efl_Text_Cursor *sel_handler_cursor; - void *input_panel_imdata; - int input_panel_imdata_len; - int validators; + Efl_Text_Cursor_Object *sel_handler_cursor; struct { Evas_Object *hover_parent; /**< hover parent object. entry is a hover parent object by default */ @@ -85,7 +68,7 @@ struct _Efl_Ui_Textbox_Data const char *hover_style; /**< style of a hover object */ } anchor_hover; - Efl_Ui_Selection_Format cnp_mode; + const char *cnp_mime_type; Elm_Sel_Format drop_format; struct { @@ -97,12 +80,8 @@ struct _Efl_Ui_Textbox_Data Eina_Size2D scroll; Eina_Size2D layout; } last; - struct - { - Eina_Future *primary; - Eina_Future *clipboard; - } sel_future; - Eina_Bool sel_handler_enabled : 1; + Efl_Ui_Textbox_Cnp_Content content; + Eina_Bool sel_handles_enabled : 1; Eina_Bool start_handler_down : 1; Eina_Bool start_handler_shown : 1; Eina_Bool end_handler_down : 1; @@ -112,7 +91,6 @@ struct _Efl_Ui_Textbox_Data Eina_Bool deferred_decoration_anchor : 1; Eina_Bool context_menu_enabled : 1; Eina_Bool long_pressed : 1; - Eina_Bool auto_save : 1; Eina_Bool has_text : 1; Eina_Bool use_down : 1; Eina_Bool sel_mode : 1; @@ -121,6 +99,7 @@ struct _Efl_Ui_Textbox_Data Eina_Bool text_changed : 1; Eina_Bool calc_force : 1; Eina_Bool cursor_update : 1; + Eina_Bool color_is_set : 1; }; struct _Anchor @@ -142,7 +121,7 @@ struct _Anchor if (EINA_UNLIKELY(!ptr)) \ { \ ERR("No widget data for object %p (%s)", \ - o, evas_object_type_get(o)); \ + o, efl_class_name_get(o)); \ return; \ } @@ -151,7 +130,7 @@ struct _Anchor if (EINA_UNLIKELY(!ptr)) \ { \ ERR("No widget data for object %p (%s)", \ - o, evas_object_type_get(o)); \ + o, efl_class_name_get(o)); \ return val; \ } @@ -164,12 +143,6 @@ struct _Efl_Ui_Text_Rectangle Evas_Object *obj_bg, *obj_fg, *obj; }; -struct _Selection_Loss_Data -{ - Eo *obj; - Efl_Ui_Selection_Type stype; -}; - #define MY_CLASS EFL_UI_TEXTBOX_CLASS #define MY_CLASS_PFX efl_ui_textbox #define MY_CLASS_NAME "Efl.Ui.Textbox" @@ -214,7 +187,7 @@ static void _efl_ui_textbox_cursor_changed_cb(void *data, const Efl_Event *event static void _text_size_changed_cb(void *data, const Efl_Event *event EINA_UNUSED); static void _scroller_size_changed_cb(void *data, const Efl_Event *event EINA_UNUSED); static void _text_position_changed_cb(void *data, const Efl_Event *event EINA_UNUSED); -static void _efl_ui_textbox_move_cb(void *data, Evas *e, Evas_Object *obj, void *event_info); +static void _efl_ui_textbox_move_cb(void *data, const Efl_Event *event EINA_UNUSED); static const char* _efl_ui_textbox_selection_get(const Eo *obj, Efl_Ui_Textbox_Data *sd); static void _edje_signal_emit(Efl_Ui_Textbox_Data *obj, const char *sig, const char *src); static void _decoration_defer_all(Eo *obj); @@ -225,126 +198,20 @@ static void _anchors_free(Efl_Ui_Textbox_Data *sd); static void _selection_defer(Eo *obj, Efl_Ui_Textbox_Data *sd); static Eina_Position2D _decoration_calc_offset(Efl_Ui_Textbox_Data *sd); static void _update_text_theme(Eo *obj, Efl_Ui_Textbox_Data *sd); - -static char * -_file_load(Eo *obj) -{ - Eina_File *f; - char *text = NULL; - void *tmp = NULL; - - f = eina_file_dup(efl_file_mmap_get(obj)); - - tmp = eina_file_map_all(f, EINA_FILE_SEQUENTIAL); - if (!tmp) goto on_error; - - text = malloc(eina_file_size_get(f) + 1); - if (!text) goto on_error; - - memcpy(text, tmp, eina_file_size_get(f)); - text[eina_file_size_get(f)] = 0; - - if (eina_file_map_faulted(f, tmp)) - { - ELM_SAFE_FREE(text, free); - } - - on_error: - if (tmp) eina_file_map_free(f, tmp); - eina_file_close(f); - - return text; -} - -static char * -_plain_load(Eo *obj) -{ - return _file_load(obj); -} - -static Eina_Error -_load_do(Evas_Object *obj) -{ - char *text; - Eina_Error err = 0; - - EFL_UI_TEXT_DATA_GET(obj, sd); - - if (!sd->file) - { - elm_object_text_set(obj, ""); - return 0; - } - - switch (sd->format) - { - /* Only available format */ - case ELM_TEXT_FORMAT_PLAIN_UTF8: - text = _plain_load(obj); - if (!text) - { - err = errno; - if (!err) err = ENOENT; - } - break; - - default: - text = NULL; - break; - } - - if (text) - { - efl_text_set(obj, text); - free(text); - return 0; - } - efl_text_set(obj, ""); - return err; -} - -static void -_text_save(const char *file, - const char *text) -{ - FILE *f; - - if (!text) - { - ecore_file_unlink(file); - return; - } - - f = fopen(file, "wb"); - if (!f) - { - ERR("Failed to open %s for writing", file); - return; - } - - if (fputs(text, f) == EOF) - ERR("Failed to write text to file %s", file); - fclose(f); -} - -static void -_save_do(Evas_Object *obj) -{ - EFL_UI_TEXT_DATA_GET(obj, sd); - - if (!sd->file) return; - switch (sd->format) - { - /* Only supported format */ - case ELM_TEXT_FORMAT_PLAIN_UTF8: - _text_save(sd->file, efl_text_get(obj)); - break; - - case ELM_TEXT_FORMAT_MARKUP_UTF8: - default: - break; - } -} +static void _efl_ui_textbox_selection_paste_type(Eo *obj, Efl_Ui_Textbox_Data *sd, Efl_Ui_Cnp_Buffer type); + +static Eina_Bool _key_action_copy(Evas_Object *obj, const char *params); +static Eina_Bool _key_action_paste(Evas_Object *obj, const char *params); +static Eina_Bool _key_action_cut(Evas_Object *obj, const char *params); +static Eina_Bool _key_action_menu(Evas_Object *obj, const char *params); + +static const Elm_Action key_actions[] = { + {"copy", _key_action_copy}, + {"paste", _key_action_paste}, + {"cut", _key_action_cut}, + {"menu", _key_action_menu}, + {NULL, NULL} +}; static void _efl_ui_textbox_guide_update(Evas_Object *obj, @@ -353,44 +220,20 @@ _efl_ui_textbox_guide_update(Evas_Object *obj, EFL_UI_TEXT_DATA_GET(obj, sd); if ((has_text) && (!sd->has_text)) - edje_object_signal_emit(sd->entry_edje, "efl,guide,disabled", "efl"); + efl_layout_signal_emit(sd->entry_edje, "efl,guide,disabled", "efl"); else if ((!has_text) && (sd->has_text)) - edje_object_signal_emit(sd->entry_edje, "efl,guide,enabled", "efl"); + efl_layout_signal_emit(sd->entry_edje, "efl,guide,enabled", "efl"); sd->has_text = has_text; } static void -_filter_free(Elm_Entry_Markup_Filter *tf) -{ - if (tf->func == elm_entry_filter_limit_size) - { - Elm_Entry_Filter_Limit_Size *lim = tf->data; - - free(lim); - } - else if (tf->func == elm_entry_filter_accept_set) - { - Elm_Entry_Filter_Accept_Set *as = tf->data; - - if (as) - { - eina_stringshare_del(as->accepted); - eina_stringshare_del(as->rejected); - - free(as); - } - } - free(tf); -} - -static void _mirrored_set(Evas_Object *obj, Eina_Bool rtl) { EFL_UI_TEXT_DATA_GET(obj, sd); - edje_object_mirrored_set(sd->entry_edje, rtl); + efl_ui_mirrored_set(sd->entry_edje, rtl); if (sd->anchor_hover.hover) efl_ui_mirrored_set(sd->anchor_hover.hover, rtl); @@ -405,12 +248,12 @@ _hide_selection_handler(Evas_Object *obj) if (sd->start_handler_shown) { - edje_object_signal_emit(sd->start_handler, "efl,handler,hide", "efl"); + efl_layout_signal_emit(sd->start_handler, "efl,handler,hide", "efl"); sd->start_handler_shown = EINA_FALSE; } if (sd->end_handler_shown) { - edje_object_signal_emit(sd->end_handler, "efl,handler,hide", "efl"); + efl_layout_signal_emit(sd->end_handler, "efl,handler,hide", "efl"); sd->end_handler_shown = EINA_FALSE; } } @@ -431,21 +274,19 @@ _viewport_region_get(Evas_Object *obj) rect = efl_gfx_entity_geometry_get(sd->text_obj); } - parent = elm_widget_parent_get(obj); + parent = efl_ui_widget_parent_get(obj); while (parent) { - if (efl_isa(parent, ELM_INTERFACE_SCROLLABLE_MIXIN)) + if (efl_isa(parent, EFL_UI_SCROLLABLE_INTERFACE)) { - Eina_Rectangle r; - EINA_RECTANGLE_SET(&r, 0, 0, 0, 0); - evas_object_geometry_get(parent, &r.x, &r.y, &r.w, &r.h); - if (!eina_rectangle_intersection(&rect.rect, &r)) + Eina_Rect r = efl_gfx_entity_geometry_get(parent); + if (!eina_rectangle_intersection(&rect.rect, &r.rect)) { rect = EINA_RECT_EMPTY(); break; } } - parent = elm_widget_parent_get(parent); + parent = efl_ui_widget_parent_get(parent); } return rect; @@ -465,13 +306,13 @@ _update_selection_handler(Eo *obj) return; } - if (sd->sel_handler_enabled) + if (sd->sel_handles_enabled) { Eina_Rect rect; Eina_Position2D off; Evas_Coord hx, hy; Eina_Bool hidden = EINA_FALSE; - Efl_Text_Cursor *sel_start, *sel_end; + Efl_Text_Cursor_Object *sel_start, *sel_end; Eina_Rect rc_tmp; efl_text_interactive_selection_cursors_get(obj, &sel_start, &sel_end); @@ -481,7 +322,7 @@ _update_selection_handler(Eo *obj) //evas_object_geometry_get(sd->entry_edje, &ent_x, &ent_y, NULL, NULL); - rc_tmp = efl_text_cursor_geometry_get(sel_start, EFL_TEXT_CURSOR_TYPE_BEFORE); + rc_tmp = efl_text_cursor_object_cursor_geometry_get(sel_start, EFL_TEXT_CURSOR_TYPE_BEFORE); sx = rc_tmp.x; sy = rc_tmp.y; sh = rc_tmp.h; @@ -489,7 +330,7 @@ _update_selection_handler(Eo *obj) off = _decoration_calc_offset(sd); hx = off.x + sx; hy = off.y + sy + sh; - evas_object_move(sd->start_handler, hx, hy); + efl_gfx_entity_position_set(sd->start_handler, EINA_POSITION2D(hx, hy)); rect = _viewport_region_get(obj); @@ -500,26 +341,26 @@ _update_selection_handler(Eo *obj) } if (!sd->start_handler_shown && !hidden) { - edje_object_signal_emit(sd->start_handler, + efl_layout_signal_emit(sd->start_handler, "efl,handler,show", "efl"); sd->start_handler_shown = EINA_TRUE; } else if (sd->start_handler_shown && hidden) { - edje_object_signal_emit(sd->start_handler, + efl_layout_signal_emit(sd->start_handler, "efl,handler,hide", "efl"); sd->start_handler_shown = EINA_FALSE; } hidden = EINA_FALSE; - rc_tmp = efl_text_cursor_geometry_get(sel_end, EFL_TEXT_CURSOR_TYPE_BEFORE); + rc_tmp = efl_text_cursor_object_cursor_geometry_get(sel_end, EFL_TEXT_CURSOR_TYPE_BEFORE); ex = rc_tmp.x; ey = rc_tmp.y; eh = rc_tmp.h; hx = off.x + ex; hy = off.y + ey + eh; - evas_object_move(sd->end_handler, hx, hy); + efl_gfx_entity_position_set(sd->end_handler, EINA_POSITION2D(hx, hy)); if (!eina_rectangle_xcoord_inside(&rect.rect, hx) || !eina_rectangle_ycoord_inside(&rect.rect, hy)) @@ -528,13 +369,13 @@ _update_selection_handler(Eo *obj) } if (!sd->end_handler_shown && !hidden) { - edje_object_signal_emit(sd->end_handler, + efl_layout_signal_emit(sd->end_handler, "efl,handler,show", "efl"); sd->end_handler_shown = EINA_TRUE; } else if (sd->end_handler_shown && hidden) { - edje_object_signal_emit(sd->end_handler, + efl_layout_signal_emit(sd->end_handler, "efl,handler,hide", "efl"); sd->end_handler_shown = EINA_FALSE; } @@ -543,117 +384,167 @@ _update_selection_handler(Eo *obj) { if (sd->start_handler_shown) { - edje_object_signal_emit(sd->start_handler, + efl_layout_signal_emit(sd->start_handler, "efl,handler,hide", "efl"); sd->start_handler_shown = EINA_FALSE; } if (sd->end_handler_shown) { - edje_object_signal_emit(sd->end_handler, + efl_layout_signal_emit(sd->end_handler, "efl,handler,hide", "efl"); sd->end_handler_shown = EINA_FALSE; } } } -static void -_selection_data_cb(void *data EINA_UNUSED, Eo *obj, - Efl_Ui_Selection_Data *sel_data) +static Eina_Value +_selection_data_cb(Efl_Ui_Textbox *obj, void *data EINA_UNUSED, const Eina_Value value) { - Efl_Text_Cursor *cur, *start, *end; + Eina_Content *content; + Eina_Slice slice; + Efl_Text_Cursor_Object *cur, *start, *end; Efl_Text_Change_Info info = { NULL, 0, 0, 0, 0 }; - char *buf = eina_slice_strdup(sel_data->content); - size_t len = sel_data->content.len; + if (eina_value_type_get(&value) != EINA_VALUE_TYPE_CONTENT) + return EINA_VALUE_EMPTY; + content = eina_value_to_content(&value); + slice = eina_content_data_get(content); efl_text_interactive_selection_cursors_get(obj, &start, &end); - if (!efl_text_cursor_equal(start, end)) + if (!efl_text_cursor_object_equal(start, end)) { - efl_text_cursor_range_delete(start, end); + efl_text_cursor_object_range_delete(start, end); efl_text_interactive_all_unselect(obj); } cur = efl_text_interactive_main_cursor_get(obj); - info.insert = EINA_TRUE; - info.position = efl_text_cursor_position_get(cur); - info.length = len; - info.content = buf; - if (sel_data->format == EFL_UI_SELECTION_FORMAT_MARKUP) + info.type = EFL_TEXT_CHANGE_TYPE_INSERT; + info.position = efl_text_cursor_object_position_get(cur); + info.length = slice.len; + info.content = slice.mem; + if (eina_streq(eina_content_type_get(content), "application/x-elementary-markup")) { - efl_text_cursor_markup_insert(cur, buf); + efl_text_cursor_object_markup_insert(cur, slice.mem); + } + else if (!strncmp(eina_content_type_get(content), "image/", strlen("image/"))) + { + Eina_Strbuf *result = eina_strbuf_new(); + eina_strbuf_append_printf(result, "<item absize=240x180 href="); + eina_strbuf_append_slice(result, slice); + eina_strbuf_append_printf(result, "></item>"); + efl_text_cursor_object_markup_insert(cur, eina_strbuf_string_get(result)); + eina_strbuf_free(result); } else // TEXT { - efl_text_cursor_text_insert(cur, buf); + efl_text_cursor_object_text_insert(cur, slice.mem); } efl_event_callback_call(obj, EFL_TEXT_INTERACTIVE_EVENT_CHANGED_USER, &info); - free(buf); + + return EINA_VALUE_EMPTY; } -static void -_dnd_enter_cb(void *data EINA_UNUSED, - Evas_Object *obj) +static Eina_Array* +_figure_out_types(Eo *obj EINA_UNUSED, Efl_Ui_Textbox_Data *sd) { - elm_object_focus_set(obj, EINA_TRUE); + Eina_Array *types = eina_array_new(10); + + if (sd->content & EFL_UI_TEXTBOX_CNP_CONTENT_MARKUP) + eina_array_push(types, "application/x-elementary-markup"); + if (sd->content & EFL_UI_TEXTBOX_CNP_CONTENT_IMAGE) + { + eina_array_push(types, "image/png"); + eina_array_push(types, "image/jpeg"); + eina_array_push(types, "image/x-ms-bmp"); + eina_array_push(types, "image/gif"); + eina_array_push(types, "image/tiff"); + eina_array_push(types, "image/svg+xml"); + eina_array_push(types, "image/x-xpixmap"); + eina_array_push(types, "image/x-tga"); + eina_array_push(types, "image/x-portable-pixmap"); + } + if (sd->content & EFL_UI_TEXTBOX_CNP_CONTENT_TEXT) + eina_array_push(types, "text/plain;charset=utf-8"); + return types; +} + +static Eina_Bool +_accepting_drops(Eo *obj, Efl_Ui_Textbox_Data *sd, Eina_Accessor *mime_types) +{ + int i = 0; + const char *mime_type; + + if (efl_ui_widget_disabled_get(obj)) return EINA_FALSE; + + EINA_ACCESSOR_FOREACH(mime_types, i, mime_type) + { + if (sd->content & EFL_UI_TEXTBOX_CNP_CONTENT_TEXT && + eina_streq(mime_type, "text/plain;charset=utf-8")) + return EINA_TRUE; + + if (sd->content & EFL_UI_TEXTBOX_CNP_CONTENT_IMAGE && + strncmp(mime_type, "image/", strlen("image/"))) + return EINA_TRUE; + + if (sd->content & EFL_UI_TEXTBOX_CNP_CONTENT_MARKUP && + eina_streq(mime_type, "application/x-elementary-markup")) + return EINA_TRUE; + } + return EINA_FALSE; } static void -_dnd_leave_cb(void *data EINA_UNUSED, - Evas_Object *obj) +_dnd_enter_cb(void *data EINA_UNUSED, + const Efl_Event *ev) { - if (_elm_config->desktop_entry) - elm_object_focus_set(obj, EINA_FALSE); + Efl_Ui_Drop_Event *dnd_enter = ev->info; + EFL_UI_TEXT_DATA_GET(ev->object, sd); + if (_accepting_drops(ev->object, sd, dnd_enter->available_types)) + efl_ui_focus_util_focus(ev->object); } static void -_dnd_pos_cb(void *data EINA_UNUSED, - Evas_Object *obj, - Evas_Coord x, - Evas_Coord y, - Elm_Xdnd_Action action EINA_UNUSED) +_dnd_pos_cb(void *data EINA_UNUSED, const Efl_Event *ev) { - int pos; - Evas_Coord ox, oy, ex, ey; + Efl_Ui_Drop_Event *dnd_pos = ev->info; + Eina_Position2D po, pe, pos; + EFL_UI_TEXT_DATA_GET(ev->object, sd); + int cursor_pos; - EFL_UI_TEXT_DATA_GET(obj, sd); + if (!_accepting_drops(ev->object, sd, dnd_pos->available_types)) + return; - evas_object_geometry_get(obj, &ox, &oy, NULL, NULL); - evas_object_geometry_get(sd->entry_edje, &ex, &ey, NULL, NULL); - x = x + ox - ex; - y = y + oy - ey; + po = efl_gfx_entity_position_get(ev->object); + pe = efl_gfx_entity_position_get(sd->entry_edje); + pos.x = dnd_pos->position.x + po.x - pe.x; + pos.y = dnd_pos->position.y + po.x - pe.y; edje_object_part_text_cursor_coord_set - (sd->entry_edje, "efl.text", EDJE_CURSOR_USER, x, y); - pos = edje_object_part_text_cursor_pos_get + (sd->entry_edje, "efl.text", EDJE_CURSOR_USER, pos.x, pos.y); + cursor_pos = edje_object_part_text_cursor_pos_get (sd->entry_edje, "efl.text", EDJE_CURSOR_USER); edje_object_part_text_cursor_pos_set(sd->entry_edje, "efl.text", - EDJE_CURSOR_MAIN, pos); + EDJE_CURSOR_MAIN, cursor_pos); } -static Eina_Bool -_dnd_drop_cb(void *data EINA_UNUSED, - Evas_Object *obj, - Elm_Selection_Data *drop) +static void +_dnd_drop_cb(void *data EINA_UNUSED, const Efl_Event *ev) { - Eina_Bool rv; - - EFL_UI_TEXT_DATA_GET(obj, sd); + Efl_Ui_Drop_Event *drop = ev->info; - rv = edje_object_part_text_cursor_coord_set - (sd->entry_edje, "efl.text", EDJE_CURSOR_MAIN, drop->x, drop->y); + Eina_Array *types; - if (!rv) WRN("Warning: Failed to position cursor: paste anyway"); + EFL_UI_TEXT_DATA_GET(ev->object, sd); + types = _figure_out_types(ev->object, sd); - //rv = _selection_data_cb(NULL, obj, drop); + if (_accepting_drops(ev->object, sd, drop->available_types)) + { + Eina_Future *future; - return rv; -} + future = efl_ui_dnd_drop_data_get(ev->object, evas_device_seat_id_get(evas_default_device_get(evas_object_evas_get(ev->object), EVAS_DEVICE_CLASS_SEAT)), eina_array_iterator_new(types)); + efl_future_then(ev->object, future, _selection_data_cb); + } -static Elm_Sel_Format -_get_drop_format(Evas_Object *obj) -{ - if (efl_text_interactive_editable_get(obj) && (efl_text_multiline_get(obj)) && (!efl_text_password_get(obj)) && (!efl_ui_widget_disabled_get(obj))) - return EFL_UI_SELECTION_FORMAT_MARKUP | EFL_UI_SELECTION_FORMAT_IMAGE; - return EFL_UI_SELECTION_FORMAT_MARKUP; + eina_array_free(types); } /* we can't reuse layout's here, because it's on entry_edje only */ @@ -662,31 +553,18 @@ _efl_ui_textbox_efl_ui_widget_disabled_set(Eo *obj, Efl_Ui_Textbox_Data *sd, Ein { const char *emission; - efl_ui_widget_disabled_set(efl_super(obj, MY_CLASS), disabled); + if (efl_ui_widget_disabled_get(obj) == disabled) + return; - elm_drop_target_del(obj, sd->drop_format, - _dnd_enter_cb, NULL, - _dnd_leave_cb, NULL, - _dnd_pos_cb, NULL, - _dnd_drop_cb, NULL); + efl_ui_widget_disabled_set(efl_super(obj, MY_CLASS), disabled); emission = efl_ui_widget_disabled_get(obj) ? "efl,state,disabled" : "efl,state,enabled"; - edje_object_signal_emit(sd->entry_edje, emission, "efl"); + efl_layout_signal_emit(sd->entry_edje, emission, "efl"); if (sd->scroll) { - edje_object_signal_emit(sd->scr_edje, emission, "efl"); - elm_interface_scrollable_freeze_set(obj, efl_ui_widget_disabled_get(obj)); + efl_ui_scrollable_scroll_freeze_set(obj, efl_ui_widget_disabled_get(obj)); } - if (!efl_ui_widget_disabled_get(obj)) - { - sd->drop_format = _get_drop_format(obj); - elm_drop_target_add(obj, sd->drop_format, - _dnd_enter_cb, NULL, - _dnd_leave_cb, NULL, - _dnd_pos_cb, NULL, - _dnd_drop_cb, NULL); - } _update_text_theme(obj, sd); } @@ -699,17 +577,17 @@ _efl_ui_textbox_efl_ui_widget_theme_apply(Eo *obj, Efl_Ui_Textbox_Data *sd) ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd, EINA_FALSE); - // Note: We are skipping elm_layout here! This is by design. - // This assumes the following inheritance: my_class -> layout -> widget ... - theme_apply = efl_ui_widget_theme_apply(efl_cast(obj, EFL_UI_WIDGET_CLASS)); + theme_apply = efl_ui_widget_theme_apply(efl_super(obj,MY_CLASS)); if (theme_apply == EFL_UI_THEME_APPLY_ERROR_GENERIC) return EFL_UI_THEME_APPLY_ERROR_GENERIC; + _update_text_theme(obj, sd); + efl_event_freeze(obj); edje_object_mirrored_set (wd->resize_obj, efl_ui_mirrored_get(obj)); - edje_object_scale_set + efl_gfx_entity_scale_set (wd->resize_obj, efl_gfx_entity_scale_get(obj) * elm_config_scale_get()); @@ -721,19 +599,17 @@ _efl_ui_textbox_efl_ui_widget_theme_apply(Eo *obj, Efl_Ui_Textbox_Data *sd) // elm_entry_cursor_pos_set -> cursor,changed -> widget_show_region_set // -> smart_objects_calculate will call all smart calculate functions, // and one of them can delete elm_entry. - evas_object_ref(obj); + efl_ref(obj); if (efl_ui_focus_object_focus_get(obj)) { - edje_object_signal_emit(sd->entry_edje, "efl,action,focus", "efl"); - if (sd->scroll) - edje_object_signal_emit(sd->scr_edje, "efl,action,focus", "efl"); + efl_layout_signal_emit(sd->entry_edje, "efl,action,focus", "efl"); } - edje_object_message_signal_process(sd->entry_edje); + efl_layout_signal_process(sd->entry_edje, EINA_FALSE); - Evas_Object* clip = evas_object_clip_get(sd->entry_edje); - evas_object_clip_set(sd->hit_rect, clip); + Evas_Object* clip = efl_canvas_object_clipper_get(sd->entry_edje); + efl_canvas_object_clipper_set(sd->hit_rect, clip); if (sd->start_handler) { @@ -747,7 +623,17 @@ _efl_ui_textbox_efl_ui_widget_theme_apply(Eo *obj, Efl_Ui_Textbox_Data *sd) efl_event_callback_call(obj, EFL_UI_LAYOUT_EVENT_THEME_CHANGED, NULL); - evas_object_unref(obj); + efl_unref(obj); + + if (efl_content_get(efl_part(sd->entry_edje, "efl.text")) == NULL && !sd->scroller) + { + efl_pack_table(sd->text_table, sd->text_obj, 0, 0, 1, 1); + efl_pack_table(sd->text_table, sd->text_guide_obj, 0, 0, 1, 1); + efl_content_set(efl_part(sd->entry_edje, "efl.text"), sd->text_table); + } + + if (!sd->cursor && !sd->cursor_bidi) + _create_text_cursors(obj, sd); return theme_apply; } @@ -757,21 +643,17 @@ _cursor_geometry_recalc(Evas_Object *obj) { EFL_UI_TEXT_DATA_GET(obj, sd); - Evas_Coord x, y, w, h; - Evas_Coord x2, y2, w2, h2; Evas_Coord cx, cy, cw, ch; Eina_Rect rc; if (!efl_text_interactive_editable_get(obj)) return; cx = cy = cw = ch = 0; - x2 = y2 = w2 = h2 = 0; - x = y = w = h = 0; - Efl_Text_Cursor *main_cur = + Efl_Text_Cursor_Object *main_cur = efl_text_interactive_main_cursor_get(obj); - rc = efl_text_cursor_geometry_get(main_cur, EFL_TEXT_CURSOR_TYPE_BEFORE); + rc = efl_text_cursor_object_cursor_geometry_get(main_cur, EFL_TEXT_CURSOR_TYPE_BEFORE); cx = rc.x; cy = rc.y; cw = rc.w; @@ -781,10 +663,6 @@ _cursor_geometry_recalc(Evas_Object *obj) if (cw < 1) cw = 1; if (ch < 1) ch = 1; edje_object_size_min_restricted_calc(sd->cursor, &cw, NULL, cw, 0); - evas_object_geometry_get(sd->entry_edje, &x, &y, &w, &h); - evas_object_geometry_get( - sd->text_obj, - &x2, &y2, &w2, &h2); efl_ui_scrollable_scroll(sd->scroller, EINA_RECT(cx, cy, cw, ch), EINA_FALSE); @@ -816,24 +694,10 @@ _efl_ui_textbox_efl_canvas_group_group_calculate(Eo *obj, Efl_Ui_Textbox_Data *s if (sd->scroll) { - if (!efl_text_multiline_get(obj)) - { - efl_ui_internal_text_scroller_mode_set(sd->scroller, - EFL_UI_TEXT_SCROLLER_MODE_SINGLELINE); - } - else - { - efl_ui_internal_text_scroller_mode_set(sd->scroller, - EFL_UI_TEXT_SCROLLER_MODE_MULTILINE); - - } - efl_canvas_group_calculate(sd->scroller); min = efl_gfx_hint_size_min_get(sd->scroller); if (!efl_text_multiline_get(obj)) { - efl_ui_internal_text_scroller_mode_set(sd->scroller, - EFL_UI_TEXT_SCROLLER_MODE_SINGLELINE); edje_object_size_min_calc(wd->resize_obj, &edmin.w, &edmin.h); min.w = edmin.w; min.h = edmin.h; @@ -865,24 +729,19 @@ _efl_ui_textbox_efl_canvas_group_group_calculate(Eo *obj, Efl_Ui_Textbox_Data *s EOLIAN static Eina_Bool _efl_ui_textbox_efl_ui_focus_object_on_focus_update(Eo *obj, Efl_Ui_Textbox_Data *sd) { - Evas_Object *top; - Eina_Bool top_is_win = EINA_FALSE; + Efl_Object *top; if (!efl_text_interactive_editable_get(obj)) return EINA_FALSE; - top = elm_widget_top_get(obj); - if (top && efl_isa(top, EFL_UI_WIN_CLASS)) - top_is_win = EINA_TRUE; + top = efl_provider_find(obj, EFL_UI_WIN_CLASS); if (efl_ui_focus_object_focus_get(obj)) { - evas_object_focus_set(sd->text_obj, EINA_TRUE); + efl_canvas_object_key_focus_set(sd->text_obj, EINA_TRUE); _edje_signal_emit(sd, "efl,action,focus", "efl"); - if (sd->scroll) - edje_object_signal_emit(sd->scr_edje, "efl,action,focus", "efl"); - if (top && top_is_win && efl_input_text_input_panel_autoshow_get(obj) && !efl_input_text_input_panel_show_on_demand_get(obj)) + if (efl_input_text_input_panel_autoshow_get(obj) && !efl_input_text_input_panel_show_on_demand_get(obj)) elm_win_keyboard_mode_set(top, ELM_WIN_KEYBOARD_ON); if (_elm_config->atspi_mode) efl_access_state_changed_signal_emit(obj, EFL_ACCESS_STATE_TYPE_FOCUSED, EINA_TRUE); @@ -892,27 +751,24 @@ _efl_ui_textbox_efl_ui_focus_object_on_focus_update(Eo *obj, Efl_Ui_Textbox_Data Eo *sw = sd->text_obj; _edje_signal_emit(sd, "efl,action,unfocus", "efl"); - if (sd->scroll) - edje_object_signal_emit(sd->scr_edje, "efl,action,unfocus", "efl"); - evas_object_focus_set(sw, EINA_FALSE); + efl_canvas_object_key_focus_set(sw, EINA_FALSE); - if (top && top_is_win && efl_input_text_input_panel_autoshow_get(obj)) + if (efl_input_text_input_panel_autoshow_get(obj)) elm_win_keyboard_mode_set(top, ELM_WIN_KEYBOARD_OFF); if (_elm_config->atspi_mode) efl_access_state_changed_signal_emit(obj, EFL_ACCESS_STATE_TYPE_FOCUSED, EINA_FALSE); if (_elm_config->selection_clear_enable) { - if ((efl_text_interactive_have_selection_get(obj)) && (!sd->hoversel)) + if ((efl_text_interactive_have_selection_get(obj)) && (!sd->popup)) { sd->sel_mode = EINA_FALSE; - elm_widget_scroll_hold_pop(obj); + efl_ui_widget_scroll_hold_pop(obj); edje_object_part_text_select_allow_set(sd->entry_edje, "efl.text", EINA_FALSE); - edje_object_signal_emit(sd->entry_edje, "efl,state,select,off", "efl"); + efl_layout_signal_emit(sd->entry_edje, "efl,state,select,off", "efl"); edje_object_part_text_select_none(sd->entry_edje, "efl.text"); } } - edje_object_signal_emit(sd->scr_edje, "validation,default", "efl"); } return EINA_TRUE; @@ -921,23 +777,24 @@ _efl_ui_textbox_efl_ui_focus_object_on_focus_update(Eo *obj, Efl_Ui_Textbox_Data EOLIAN static Eina_Rect _efl_ui_textbox_efl_ui_widget_interest_region_get(const Eo *obj EINA_UNUSED, Efl_Ui_Textbox_Data *sd) { - Evas_Coord edje_x, edje_y, elm_x, elm_y; + Eina_Rect edje, elm; Eina_Rect r = {}; - r = efl_text_cursor_geometry_get( + r = efl_text_cursor_object_cursor_geometry_get( efl_text_interactive_main_cursor_get(obj), EFL_TEXT_CURSOR_TYPE_BEFORE); if (!efl_text_multiline_get(obj)) { - evas_object_geometry_get(sd->entry_edje, NULL, NULL, NULL, &r.h); + Eina_Rect rr = efl_gfx_entity_geometry_get(sd->entry_edje); + r.h = rr.h; r.y = 0; } - evas_object_geometry_get(sd->entry_edje, &edje_x, &edje_y, NULL, NULL); - evas_object_geometry_get(obj, &elm_x, &elm_y, NULL, NULL); + edje = efl_gfx_entity_geometry_get(sd->entry_edje); + elm = efl_gfx_entity_geometry_get(obj); - r.x += edje_x - elm_x; - r.y += edje_y - elm_y; + r.x += edje.x - elm.x; + r.y += edje.y - elm.y; if (r.w < 1) r.w = 1; if (r.h < 1) r.h = 1; @@ -945,19 +802,21 @@ _efl_ui_textbox_efl_ui_widget_interest_region_get(const Eo *obj EINA_UNUSED, Efl } static void -_hoversel_position(Evas_Object *obj) +_popup_position(Evas_Object *obj) { - Evas_Coord cx, cy, cw, ch, x, y, mw, mh, w, h; + Eina_Rect r; + Evas_Coord cx, cy, cw, ch; + Eina_Size2D m; EFL_UI_TEXT_DATA_GET(obj, sd); cx = cy = 0; cw = ch = 1; - evas_object_geometry_get(sd->entry_edje, &x, &y, &w, &h); + r = efl_gfx_entity_geometry_get(sd->entry_edje); if (sd->use_down) { - cx = sd->downx - x; - cy = sd->downy - y; + cx = sd->downx - r.x; + cy = sd->downy - r.y; cw = 1; ch = 1; } @@ -965,207 +824,105 @@ _hoversel_position(Evas_Object *obj) edje_object_part_text_cursor_geometry_get (sd->entry_edje, "efl.text", &cx, &cy, &cw, &ch); - evas_object_size_hint_min_get(sd->hoversel, &mw, &mh); - if (cx + mw > w) - cx = w - mw; - if (cy + mh > h) - cy = h - mh; - evas_object_geometry_set(sd->hoversel, x + cx, y + cy, mw, mh); -} - -static void -_hover_del_job(void *data) -{ - EFL_UI_TEXT_DATA_GET(data, sd); - - ELM_SAFE_FREE(sd->hoversel, evas_object_del); - sd->hov_deljob = NULL; + m = efl_gfx_hint_size_restricted_min_get(sd->popup); + if (cx + m.w > r.w) + cx = r.w - m.w; + if (cy + m.h > r.h) + cy = r.h - m.h; + efl_gfx_entity_geometry_set(sd->popup, EINA_RECT(r.x + cx, r.y + cy, m.w, m.h)); } static void -_hover_dismissed_cb(void *data, const Efl_Event *event EINA_UNUSED) +_selection_lost_cb(void *data EINA_UNUSED, const Efl_Event *ev) { - EFL_UI_TEXT_DATA_GET(data, sd); + Efl_Ui_Wm_Selection_Changed *changed = ev->info; + EFL_UI_TEXT_DATA_GET(ev->object, sd); - sd->use_down = 0; - if (sd->hoversel) evas_object_hide(sd->hoversel); - if (sd->sel_mode) + if (changed->buffer == EFL_UI_CNP_BUFFER_SELECTION && changed->caused_by != ev->object) { - if (!_elm_config->desktop_entry) - { - if (!efl_text_password_get(data)) - edje_object_part_text_select_allow_set - (sd->entry_edje, "efl.text", EINA_TRUE); - } + efl_text_interactive_all_unselect(ev->object); + _selection_defer(ev->object, sd); } - elm_widget_scroll_freeze_pop(data); - ecore_job_del(sd->hov_deljob); - sd->hov_deljob = ecore_job_add(_hover_del_job, data); } static void -_hover_selected_cb(void *data, - Evas_Object *obj EINA_UNUSED, - void *event_info EINA_UNUSED) +_selection_store(Efl_Ui_Cnp_Buffer buffer, + Evas_Object *obj) { - EFL_UI_TEXT_DATA_GET(data, sd); + char *sel; + Efl_Text_Cursor_Object *start, *end; + Eina_Content *content; - if (!efl_text_interactive_selection_allowed_get(obj)) return; + efl_text_interactive_selection_cursors_get(obj, &start, &end); + sel = efl_text_cursor_object_range_markup_get(start, end); - sd->sel_mode = EINA_TRUE; - edje_object_part_text_select_none(sd->entry_edje, "efl.text"); + if ((!sel) || (!sel[0])) return; /* avoid deleting our own selection */ - if (!_elm_config->desktop_entry) - { - if (!efl_text_password_get(data)) - edje_object_part_text_select_allow_set - (sd->entry_edje, "efl.text", EINA_TRUE); - } - edje_object_signal_emit(sd->entry_edje, "efl,state,select,on", "efl"); + content = eina_content_new((Eina_Slice)EINA_SLICE_STR_FULL(sel), "application/x-elementary-markup"); - if (!_elm_config->desktop_entry) - elm_widget_scroll_hold_push(data); + efl_ui_selection_set(obj, buffer, content, evas_device_seat_id_get(evas_default_device_get(evas_object_evas_get(obj), EVAS_DEVICE_CLASS_SEAT))); + + free(sel); } static void -_hoversel_item_paste_cb(void *data, - Evas_Object *obj EINA_UNUSED, - void *event_info EINA_UNUSED) +_popup_dismiss( Efl_Ui_Textbox_Data *sd) { - efl_ui_textbox_selection_paste(data); -} - -static Eina_Value -_selection_lost_cb(void *data, const Eina_Value value) -{ - Selection_Loss_Data *sdata = data; - EFL_UI_TEXT_DATA_GET(sdata->obj, sd); - - efl_text_interactive_all_unselect(sdata->obj); - _selection_defer(sdata->obj, sd); - switch (sdata->stype) - { - case EFL_UI_SELECTION_TYPE_CLIPBOARD: - sd->sel_future.clipboard = NULL; - break; - case EFL_UI_SELECTION_TYPE_PRIMARY: - default: - sd->sel_future.primary = NULL; - break; - } - - return value; + efl_del(sd->popup_list); + efl_del(sd->popup); + sd->popup = NULL; + sd->popup_list = NULL; } static void -_selection_store(Efl_Ui_Selection_Type seltype, - Evas_Object *obj) +_backwall_clicked(void *data, const Efl_Event *ev EINA_UNUSED) { - char *sel; - Efl_Text_Cursor *start, *end; - Efl_Ui_Selection_Format selformat = EFL_UI_SELECTION_FORMAT_MARKUP; - Eina_Slice slice; - Selection_Loss_Data *ldata; - Eina_Future *f; - - EFL_UI_TEXT_DATA_GET(obj, sd); - - efl_text_interactive_selection_cursors_get(obj, &start, &end); - sel = efl_text_cursor_range_markup_get(start, end); - - if ((!sel) || (!sel[0])) return; /* avoid deleting our own selection */ - - slice.len = strlen(sel); - slice.mem = sel; - - switch (seltype) - { - case EFL_UI_SELECTION_TYPE_CLIPBOARD: - if (sd->sel_future.clipboard) - { - eina_future_cancel(sd->sel_future.clipboard); - } - - f = sd->sel_future.clipboard = efl_ui_selection_set(obj, seltype, - selformat, slice, 1); - break; - - case EFL_UI_SELECTION_TYPE_PRIMARY: - default: - if (sd->sel_future.primary) - { - eina_future_cancel(sd->sel_future.primary); - } - - f = sd->sel_future.primary = efl_ui_selection_set(obj, seltype, - selformat, slice, 1); - break; - } - - ldata = calloc(1, sizeof(Selection_Loss_Data)); - if (!ldata) goto end; - - ldata->obj = obj; - eina_future_then_easy(f, _selection_lost_cb, NULL, NULL, EINA_VALUE_TYPE_UINT, ldata); - - //if (seltype == EFL_UI_SELECTION_TYPE_CLIPBOARD) - // eina_stringshare_replace(&sd->cut_sel, sel); - -end: - free(sel); + EFL_UI_TEXT_DATA_GET(data, sd); + _popup_dismiss(sd); } static void -_hoversel_item_cut_cb(void *data, - Evas_Object *obj EINA_UNUSED, - void *event_info EINA_UNUSED) +_popup_item_cut_cb(void *data, const Efl_Event *ev EINA_UNUSED) { + EFL_UI_TEXT_DATA_GET(data, sd); efl_ui_textbox_selection_cut(data); + _popup_dismiss(sd); } static void -_hoversel_item_copy_cb(void *data, - Evas_Object *obj EINA_UNUSED, - void *event_info EINA_UNUSED) +_popup_item_copy_cb(void *data, const Efl_Event *ev EINA_UNUSED) { + EFL_UI_TEXT_DATA_GET(data, sd); efl_ui_textbox_selection_copy(data); + _popup_dismiss(sd); } static void -_hover_cancel_cb(void *data, - Evas_Object *obj EINA_UNUSED, - void *event_info EINA_UNUSED) +_popup_item_cancel_cb(void *data, const Efl_Event *ev EINA_UNUSED) { EFL_UI_TEXT_DATA_GET(data, sd); - sd->sel_mode = EINA_FALSE; - if (!_elm_config->desktop_entry) - edje_object_part_text_select_allow_set - (sd->entry_edje, "efl.text", EINA_FALSE); - edje_object_signal_emit(sd->entry_edje, "efl,state,select,off", "efl"); + if (!efl_text_interactive_selection_allowed_get(data)) return; + if (!_elm_config->desktop_entry) - elm_widget_scroll_hold_pop(data); - edje_object_part_text_select_none(sd->entry_edje, "efl.text"); + efl_ui_widget_scroll_hold_pop(data); + + sd->sel_mode = EINA_FALSE; + efl_text_interactive_all_unselect(data); + _popup_dismiss(sd); } static void -_hover_item_clicked_cb(void *data, - Evas_Object *obj EINA_UNUSED, - void *event_info EINA_UNUSED) +_popup_item_paste_cb(void *data, const Efl_Event *ev EINA_UNUSED) { - Elm_Entry_Context_Menu_Item *it = data; - if (!it) return; - - if (it->func) it->func(it->data, it->obj, it); + EFL_UI_TEXT_DATA_GET(data, sd); + efl_ui_textbox_selection_paste(data); + _popup_dismiss(sd); } static void _menu_call(Evas_Object *obj) { - Evas_Object *top; - const Eina_List *l; - const Elm_Entry_Context_Menu_Item *it; - EFL_UI_TEXT_DATA_GET(obj, sd); if (sd->anchor_hover.hover) return; @@ -1178,102 +935,116 @@ _menu_call(Evas_Object *obj) } else if (sd->context_menu_enabled) { - const char *context_menu_orientation; Eina_Bool ownersel; - ownersel = elm_selection_selection_has_owner(obj); - if (!sd->items) - { - /* prevent stupid blank hoversel */ - if (efl_text_interactive_have_selection_get(obj) && efl_text_password_get(obj)) return; - if (_elm_config->desktop_entry && (!efl_text_interactive_have_selection_get(obj)) && ((!efl_text_interactive_editable_get(obj)) || (!ownersel))) - return; - } - if (sd->hoversel) evas_object_del(sd->hoversel); - else elm_widget_scroll_freeze_push(obj); - - sd->hoversel = elm_hoversel_add(obj); - context_menu_orientation = edje_object_data_get - (sd->entry_edje, "context_menu_orientation"); + ownersel = elm_cnp_clipboard_selection_has_owner(obj); + /* prevent stupid blank hoversel */ + if (efl_text_interactive_have_selection_get(obj) && efl_text_password_get(obj)) return; + if (_elm_config->desktop_entry && (!efl_text_interactive_have_selection_get(obj)) && ((!efl_text_interactive_editable_get(obj)) || (!ownersel))) + return; + if (sd->popup) _popup_dismiss(sd); + else efl_ui_widget_scroll_freeze_push(obj); - if ((context_menu_orientation) && - (!strcmp(context_menu_orientation, "horizontal"))) - elm_hoversel_horizontal_set(sd->hoversel, EINA_TRUE); + sd->popup = efl_add(EFL_UI_POPUP_CLASS, obj); - elm_object_style_set(sd->hoversel, "entry"); - elm_widget_sub_object_add(obj, sd->hoversel); - elm_object_text_set(sd->hoversel, "Text"); - top = elm_widget_top_get(obj); + sd->popup_list = efl_add(EFL_UI_LIST_CLASS, sd->popup); + efl_content_set(sd->popup, sd->popup_list); + efl_gfx_hint_align_set(sd->popup_list, 1.0, 1.0); + efl_gfx_hint_weight_set(sd->popup_list, 1.0, 1.0); - if (top) elm_hoversel_hover_parent_set(sd->hoversel, top); + efl_ui_widget_sub_object_add(obj, sd->popup); + efl_ui_popup_anchor_set(sd->popup, obj); + efl_event_callback_add(sd->popup, EFL_UI_POPUP_EVENT_BACKWALL_CLICKED, _backwall_clicked, obj); - efl_event_callback_add - (sd->hoversel, ELM_HOVERSEL_EVENT_DISMISSED, _hover_dismissed_cb, obj); if (efl_text_interactive_have_selection_get(obj)) { if (!efl_text_password_get(obj)) { if (efl_text_interactive_editable_get(obj)) - elm_hoversel_item_add - (sd->hoversel, E_("Cut"), NULL, ELM_ICON_NONE, - _hoversel_item_cut_cb, obj); - elm_hoversel_item_add - (sd->hoversel, E_("Copy"), NULL, ELM_ICON_NONE, - _hoversel_item_copy_cb, obj); - if (efl_text_interactive_editable_get(obj) && ownersel) - elm_hoversel_item_add - (sd->hoversel, E_("Paste"), NULL, ELM_ICON_NONE, - _hoversel_item_paste_cb, obj); - elm_hoversel_item_add - (sd->hoversel, E_("Cancel"), NULL, ELM_ICON_NONE, - _hover_cancel_cb, obj); + { + Eo *il = NULL; + il = efl_add(EFL_UI_LIST_DEFAULT_ITEM_CLASS, sd->popup_list); + efl_text_set(il, E_("Cut")); + efl_gfx_hint_align_set(il, 1.0, 1.0); + efl_gfx_hint_weight_set(sd->popup_list, 1.0, 1.0); + efl_pack_end(sd->popup_list, il); + efl_event_callback_add(il, EFL_UI_EVENT_SELECTED_CHANGED, _popup_item_cut_cb, obj); + + il = efl_add(EFL_UI_LIST_DEFAULT_ITEM_CLASS, sd->popup_list); + efl_text_set(il, E_("Copy")); + efl_gfx_hint_align_set(il, 1.0, 1.0); + efl_gfx_hint_weight_set(sd->popup_list, 1.0, 1.0); + efl_pack_end(sd->popup_list, il); + efl_event_callback_add(il, EFL_UI_EVENT_SELECTED_CHANGED, _popup_item_copy_cb, obj); + + il = efl_add(EFL_UI_LIST_DEFAULT_ITEM_CLASS, sd->popup_list); + efl_text_set(il, E_("Paste")); + efl_gfx_hint_align_set(il, 1.0, 1.0); + efl_gfx_hint_weight_set(sd->popup_list, 1.0, 1.0); + efl_pack_end(sd->popup_list, il); + efl_event_callback_add(il, EFL_UI_EVENT_SELECTED_CHANGED, _popup_item_paste_cb, obj); + + il = efl_add(EFL_UI_LIST_DEFAULT_ITEM_CLASS, sd->popup_list); + efl_text_set(il, E_("Cancel")); + efl_gfx_hint_align_set(il, 1.0, 1.0); + efl_gfx_hint_weight_set(sd->popup_list, 1.0, 1.0); + efl_pack_end(sd->popup_list, il); + efl_event_callback_add(il, EFL_UI_EVENT_SELECTED_CHANGED, _popup_item_cancel_cb, obj); + } } } else { if (!sd->sel_mode) { - if (efl_text_interactive_selection_allowed_get(obj) && !_elm_config->desktop_entry) - { - if (!efl_text_password_get(obj)) - elm_hoversel_item_add - (sd->hoversel, E_("Select"), NULL, ELM_ICON_NONE, - _hover_selected_cb, obj); - } if (ownersel) { if (efl_text_interactive_editable_get(obj)) - elm_hoversel_item_add - (sd->hoversel, E_("Paste"), NULL, ELM_ICON_NONE, - _hoversel_item_paste_cb, obj); + { + Eo *il = NULL; + il = efl_add(EFL_UI_LIST_DEFAULT_ITEM_CLASS, sd->popup_list); + efl_text_set(il, E_("Paste")); + efl_gfx_hint_align_set(il, 1.0, 1.0); + efl_gfx_hint_weight_set(sd->popup_list, 1.0, 1.0); + efl_pack_end(sd->popup_list, il); + efl_event_callback_add(il, EFL_UI_EVENT_SELECTED_CHANGED, _popup_item_paste_cb, obj); + } } } else - elm_hoversel_item_add - (sd->hoversel, E_("Cancel"), NULL, ELM_ICON_NONE, - _hover_cancel_cb, obj); - } - - EINA_LIST_FOREACH(sd->items, l, it) - { - elm_hoversel_item_add(sd->hoversel, it->label, it->icon_file, - it->icon_type, _hover_item_clicked_cb, it); + { + Eo *il = NULL; + il = efl_add(EFL_UI_LIST_DEFAULT_ITEM_CLASS, sd->popup_list); + efl_text_set(il, E_("Cancel")); + efl_gfx_hint_align_set(il, 1.0, 1.0); + efl_gfx_hint_weight_set(sd->popup_list, 1.0, 1.0); + efl_pack_end(sd->popup_list, il); + efl_event_callback_add(il, EFL_UI_EVENT_SELECTED_CHANGED, _popup_item_cancel_cb, obj); + } } - if (sd->hoversel) + if (sd->popup) { - _hoversel_position(obj); - evas_object_show(sd->hoversel); - elm_hoversel_hover_begin(sd->hoversel); + _popup_position(obj); } + } +} - if (!_elm_config->desktop_entry) +static Eina_Bool +_is_pointer_inside_viewport(Eo *textbox,Efl_Ui_Textbox_Data *sd) +{ + if (sd->scroller) + { + Eo *top = efl_provider_find(textbox, EFL_UI_WIN_CLASS); + Eina_Position2D pos = {0}; + if (efl_canvas_scene_pointer_position_get(top, NULL, &pos)) { - edje_object_part_text_select_allow_set - (sd->entry_edje, "efl.text", EINA_FALSE); - edje_object_part_text_select_abort(sd->entry_edje, "efl.text"); + Eina_Rect rc = efl_ui_scrollable_viewport_geometry_get(sd->scroller); + if (!eina_rectangle_coords_inside(&rc.rect, pos.x, pos.y)) + return EINA_FALSE; } } + return EINA_TRUE; } static void @@ -1281,6 +1052,9 @@ _long_press_cb(void *data, const Efl_Event *ev EINA_UNUSED) { EFL_UI_TEXT_DATA_GET(data, sd); + if (!_is_pointer_inside_viewport(data, sd)) + return; + /* Context menu will not appear if context menu disabled is set * as false on a long press callback */ if (!_elm_config->context_menu_disabled && @@ -1290,74 +1064,57 @@ _long_press_cb(void *data, const Efl_Event *ev EINA_UNUSED) sd->long_pressed = EINA_TRUE; } -static void -_key_down_cb(void *data, - Evas *evas EINA_UNUSED, - Evas_Object *obj EINA_UNUSED, - void *event_info) + +static Eina_Bool +_key_action_copy(Evas_Object *obj, const char *params EINA_UNUSED) { - Evas_Event_Key_Down *ev = event_info; - Eina_Bool on_hold = EINA_FALSE; + efl_ui_textbox_selection_copy(obj); + return EINA_TRUE; +} - /* First check if context menu disabled is false or not, and - * then check for key id */ - if ((!_elm_config->context_menu_disabled) && !strcmp(ev->key, "Menu")) - { - _menu_call(data); - on_hold = EINA_TRUE; - } - else - { -#if defined(__APPLE__) && defined(__MACH__) - Eina_Bool control = evas_key_modifier_is_set(ev->modifiers, "Super"); -#else - Eina_Bool control = evas_key_modifier_is_set(ev->modifiers, "Control"); -#endif +static Eina_Bool +_key_action_cut(Evas_Object *obj, const char *params EINA_UNUSED) +{ + efl_ui_textbox_selection_cut(obj); + return EINA_TRUE; +} - /* Ctrl operations */ - if (control) - { - if (!strncmp(ev->key, "c", 1)) - { - efl_ui_textbox_selection_copy(data); - on_hold = EINA_TRUE; - } - else if (!strncmp(ev->key, "x", 1)) - { - efl_ui_textbox_selection_cut(data); - on_hold = EINA_TRUE; - } - else if (!strncmp(ev->key, "v", 1)) - { - efl_ui_textbox_selection_paste(data); - on_hold = EINA_TRUE; - } - } - } +static Eina_Bool +_key_action_paste(Evas_Object *obj, const char *params EINA_UNUSED) +{ + efl_ui_textbox_selection_paste(obj); + return EINA_TRUE; +} - if (on_hold) ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD; +static Eina_Bool +_key_action_menu(Evas_Object *obj, const char *params EINA_UNUSED) +{ + Eina_Bool b_ret = EINA_FALSE; + if (!_elm_config->context_menu_disabled) + { + _menu_call(obj); + b_ret = EINA_TRUE; + } + return b_ret; } static void -_mouse_down_cb(void *data, - Evas *evas EINA_UNUSED, - Evas_Object *obj EINA_UNUSED, - void *event_info) +_mouse_down_cb(void *data, const Efl_Event *event) { - Evas_Event_Mouse_Down *ev = event_info; - + Efl_Input_Pointer_Data *ev; + ev = efl_data_scope_get(event->info, EFL_INPUT_POINTER_CLASS); EFL_UI_TEXT_DATA_GET(data, sd); if (efl_ui_widget_disabled_get(data)) return; if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD) return; - sd->downx = ev->canvas.x; - sd->downy = ev->canvas.y; + sd->downx = ev->cur.x; + sd->downy = ev->cur.y; sd->long_pressed = EINA_FALSE; if (ev->button == 2) { - efl_ui_textbox_selection_paste(data); + _efl_ui_textbox_selection_paste_type(data, sd, EFL_UI_CNP_BUFFER_SELECTION); } /* If right button is pressed and context menu disabled is true, @@ -1366,6 +1123,8 @@ _mouse_down_cb(void *data, { if (_elm_config->desktop_entry) { + if (!_is_pointer_inside_viewport(data, sd)) + return; sd->use_down = 1; _menu_call(data); } @@ -1373,14 +1132,11 @@ _mouse_down_cb(void *data, } static void -_mouse_up_cb(void *data, - Evas *evas EINA_UNUSED, - Evas_Object *obj EINA_UNUSED, - void *event_info) +_mouse_up_cb(void *data, const Efl_Event *event) { - Evas_Event_Mouse_Up *ev = event_info; - Eina_Bool top_is_win = EINA_FALSE; - Evas_Object *top; + Efl_Input_Pointer_Data *ev; + ev = efl_data_scope_get(event->info, EFL_INPUT_POINTER_CLASS); + Efl_Object *top; EFL_UI_TEXT_DATA_GET(data, sd); @@ -1401,15 +1157,9 @@ _mouse_up_cb(void *data, } else { - top = elm_widget_top_get(data); - if (top) - { - if (efl_isa(top, EFL_UI_WIN_CLASS)) - top_is_win = EINA_TRUE; - - if (top_is_win && efl_input_text_input_panel_autoshow_get(data) && efl_input_text_input_panel_show_on_demand_get(data)) - elm_win_keyboard_mode_set(top, ELM_WIN_KEYBOARD_ON); - } + top = efl_provider_find(data, EFL_UI_WIN_CLASS); + if (efl_input_text_input_panel_autoshow_get(data) && efl_input_text_input_panel_show_on_demand_get(data)) + elm_win_keyboard_mode_set(top, ELM_WIN_KEYBOARD_ON); } } /* Since context menu disabled flag was checked at mouse right key down, @@ -1423,28 +1173,26 @@ _mouse_up_cb(void *data, } static void -_mouse_move_cb(void *data, - Evas *evas EINA_UNUSED, - Evas_Object *obj EINA_UNUSED, - void *event_info) +_mouse_move_cb(void *data, const Efl_Event *event) { - Evas_Event_Mouse_Move *ev = event_info; + Efl_Input_Pointer_Data *ev; + ev = efl_data_scope_get(event->info, EFL_INPUT_POINTER_CLASS); Evas_Coord dx, dy; EFL_UI_TEXT_DATA_GET(data, sd); if (efl_ui_widget_disabled_get(data)) return; - if (ev->buttons == 1) + if (ev->pressed_buttons == 1) { if (sd->long_pressed) { - Evas_Coord x, y; + Eina_Rect r; Eina_Bool rv; - evas_object_geometry_get(sd->entry_edje, &x, &y, NULL, NULL); + r = efl_gfx_entity_geometry_get(sd->entry_edje); rv = edje_object_part_text_cursor_coord_set (sd->entry_edje, "efl.text", EDJE_CURSOR_USER, - ev->cur.canvas.x - x, ev->cur.canvas.y - y); + ev->cur.x - r.x, ev->cur.y - r.y); if (rv) { edje_object_part_text_cursor_copy @@ -1463,9 +1211,9 @@ _mouse_move_cb(void *data, } } - dx = sd->downx - ev->cur.canvas.x; + dx = sd->downx - ev->cur.x; dx *= dx; - dy = sd->downy - ev->cur.canvas.y; + dy = sd->downy - ev->cur.y; dy *= dy; if ((dx + dy) > ((_elm_config->finger_size / 2) * (_elm_config->finger_size / 2))) @@ -1496,46 +1244,6 @@ _item_get(void *data, const char *item) return o; } -EOLIAN static void -_efl_ui_textbox_efl_layout_signal_signal_emit(Eo *obj EINA_UNUSED, Efl_Ui_Textbox_Data *sd, const char *emission, const char *source) -{ - /* always pass to both edje objs */ - efl_layout_signal_emit(sd->entry_edje, emission, source); - - // FIXME: This should not be here! - efl_layout_signal_process(sd->entry_edje, EINA_TRUE); - - if (sd->scr_edje) - { - efl_layout_signal_emit(sd->scr_edje, emission, source); - efl_layout_signal_process(sd->scr_edje, EINA_TRUE); // FIXME - } -} - -static Eina_Bool -_efl_ui_textbox_efl_layout_signal_signal_callback_add(Eo *obj EINA_UNUSED, Efl_Ui_Textbox_Data *pd, const char *emission, const char *source, void *func_data, EflLayoutSignalCb func, Eina_Free_Cb func_free_cb) -{ - Eina_Bool ok; - - ok = efl_layout_signal_callback_add(pd->entry_edje, emission, source, func_data, func, func_free_cb); - if (pd->scr_edje) - ok = efl_layout_signal_callback_add(pd->scr_edje, emission, source, func_data, func, func_free_cb); - - return ok; -} - -static Eina_Bool -_efl_ui_textbox_efl_layout_signal_signal_callback_del(Eo *obj EINA_UNUSED, Efl_Ui_Textbox_Data *pd, const char *emission, const char *source, void *func_data, EflLayoutSignalCb func, Eina_Free_Cb func_free_cb) -{ - Eina_Bool ok; - - ok = efl_layout_signal_callback_del(pd->entry_edje, emission, source, func_data, func, func_free_cb); - if (pd->scr_edje) - ok = efl_layout_signal_callback_del(pd->scr_edje, emission, source, func_data, func, func_free_cb); - - return ok; -} - static void _selection_handlers_offset_calc(Evas_Object *obj, Evas_Object *handler) { @@ -1547,7 +1255,7 @@ _selection_handlers_offset_calc(Evas_Object *obj, Evas_Object *handler) EFL_UI_TEXT_DATA_GET(obj, sd); pos = efl_gfx_entity_position_get(sd->text_obj); - rc = efl_text_cursor_geometry_get( + rc = efl_text_cursor_object_cursor_geometry_get( efl_text_interactive_main_cursor_get(obj), EFL_TEXT_CURSOR_TYPE_BEFORE); cx = rc.x; cy = rc.y; @@ -1571,16 +1279,13 @@ _selection_handlers_offset_calc(Evas_Object *obj, Evas_Object *handler) } static void -_start_handler_mouse_down_cb(void *data, - Evas *e EINA_UNUSED, - Evas_Object *obj EINA_UNUSED, - void *event_info EINA_UNUSED) +_start_handler_mouse_down_cb(void *data, const Efl_Event *event EINA_UNUSED) { EFL_UI_TEXT_DATA_GET(data, sd); int start_pos, end_pos, pos; - Efl_Text_Cursor *sel_start, *sel_end; - Efl_Text_Cursor *main_cur; + Efl_Text_Cursor_Object *sel_start, *sel_end; + Efl_Text_Cursor_Object *main_cur; Eo *text_obj = sd->text_obj; @@ -1590,8 +1295,8 @@ _start_handler_mouse_down_cb(void *data, efl_text_interactive_selection_cursors_get(text_obj, &sel_start, &sel_end); main_cur = efl_text_interactive_main_cursor_get(text_obj); - start_pos = efl_text_cursor_position_get(sel_start); - end_pos = efl_text_cursor_position_get(sel_end); + start_pos = efl_text_cursor_object_position_get(sel_start); + end_pos = efl_text_cursor_object_position_get(sel_end); if (start_pos <= end_pos) { @@ -1603,15 +1308,12 @@ _start_handler_mouse_down_cb(void *data, pos = end_pos; sd->sel_handler_cursor = sel_end; } - efl_text_cursor_position_set(main_cur, pos); + efl_text_cursor_object_position_set(main_cur, pos); _selection_handlers_offset_calc(data, sd->start_handler); } static void -_start_handler_mouse_up_cb(void *data, - Evas *e EINA_UNUSED, - Evas_Object *obj EINA_UNUSED, - void *event_info EINA_UNUSED) +_start_handler_mouse_up_cb(void *data, const Efl_Event *event EINA_UNUSED) { EFL_UI_TEXT_DATA_GET(data, sd); @@ -1624,29 +1326,27 @@ _start_handler_mouse_up_cb(void *data, } static void -_start_handler_mouse_move_cb(void *data, - Evas *e EINA_UNUSED, - Evas_Object *obj EINA_UNUSED, - void *event_info) +_start_handler_mouse_move_cb(void *data, const Efl_Event *event) { EFL_UI_TEXT_DATA_GET(data, sd); if (!sd->start_handler_down) return; - Evas_Event_Mouse_Move *ev = event_info; - Evas_Coord ex, ey; + Efl_Input_Pointer_Data *ev; + ev = efl_data_scope_get(event->info, EFL_INPUT_POINTER_CLASS); + Eina_Rect re; Evas_Coord cx, cy; int pos; - evas_object_geometry_get(sd->entry_edje, &ex, &ey, NULL, NULL); - cx = ev->cur.canvas.x - sd->ox - ex; - cy = ev->cur.canvas.y - sd->oy - ey; + re = efl_gfx_entity_geometry_get(sd->entry_edje); + cx = ev->cur.x - sd->ox - re.x; + cy = ev->cur.y - sd->oy - re.y; if (cx <= 0) cx = 1; - efl_text_cursor_char_coord_set(sd->sel_handler_cursor, EINA_POSITION2D(cx, cy)); - pos = efl_text_cursor_position_get(sd->sel_handler_cursor); + efl_text_cursor_object_char_coord_set(sd->sel_handler_cursor, EINA_POSITION2D(cx, cy)); + pos = efl_text_cursor_object_position_get(sd->sel_handler_cursor); /* Set the main cursor. */ - efl_text_cursor_position_set( + efl_text_cursor_object_position_set( efl_text_interactive_main_cursor_get(sd->text_obj), pos); efl_input_clickable_longpress_abort(data, 1); @@ -1654,15 +1354,12 @@ _start_handler_mouse_move_cb(void *data, } static void -_end_handler_mouse_down_cb(void *data, - Evas *e EINA_UNUSED, - Evas_Object *obj EINA_UNUSED, - void *event_info EINA_UNUSED) +_end_handler_mouse_down_cb(void *data, const Efl_Event *event EINA_UNUSED) { EFL_UI_TEXT_DATA_GET(data, sd); - Efl_Text_Cursor *sel_start, *sel_end; - Efl_Text_Cursor *main_cur; + Efl_Text_Cursor_Object *sel_start, *sel_end; + Efl_Text_Cursor_Object *main_cur; int pos, start_pos, end_pos; sd->end_handler_down = EINA_TRUE; @@ -1672,8 +1369,8 @@ _end_handler_mouse_down_cb(void *data, efl_text_interactive_selection_cursors_get(text_obj, &sel_start, &sel_end); main_cur = efl_text_interactive_main_cursor_get(text_obj); - start_pos = efl_text_cursor_position_get(sel_start); - end_pos = efl_text_cursor_position_get(sel_end); + start_pos = efl_text_cursor_object_position_get(sel_start); + end_pos = efl_text_cursor_object_position_get(sel_end); if (start_pos < end_pos) { @@ -1686,15 +1383,12 @@ _end_handler_mouse_down_cb(void *data, sd->sel_handler_cursor = sel_start; } - efl_text_cursor_position_set(main_cur, pos); + efl_text_cursor_object_position_set(main_cur, pos); _selection_handlers_offset_calc(data, sd->end_handler); } static void -_end_handler_mouse_up_cb(void *data, - Evas *e EINA_UNUSED, - Evas_Object *obj EINA_UNUSED, - void *event_info EINA_UNUSED) +_end_handler_mouse_up_cb(void *data, const Efl_Event *event EINA_UNUSED) { EFL_UI_TEXT_DATA_GET(data, sd); @@ -1707,28 +1401,26 @@ _end_handler_mouse_up_cb(void *data, } static void -_end_handler_mouse_move_cb(void *data, - Evas *e EINA_UNUSED, - Evas_Object *obj EINA_UNUSED, - void *event_info) +_end_handler_mouse_move_cb(void *data, const Efl_Event *event) { EFL_UI_TEXT_DATA_GET(data, sd); + Efl_Input_Pointer_Data *ev; + ev = efl_data_scope_get(event->info, EFL_INPUT_POINTER_CLASS); if (!sd->end_handler_down) return; - Evas_Event_Mouse_Move *ev = event_info; - Evas_Coord ex, ey; + Eina_Rect re; Evas_Coord cx, cy; int pos; - evas_object_geometry_get(sd->entry_edje, &ex, &ey, NULL, NULL); - cx = ev->cur.canvas.x - sd->ox - ex; - cy = ev->cur.canvas.y - sd->oy - ey; + re = efl_gfx_entity_geometry_get(sd->entry_edje); + cx = ev->cur.x - sd->ox - re.x; + cy = ev->cur.y - sd->oy - re.y; if (cx <= 0) cx = 1; - efl_text_cursor_char_coord_set(sd->sel_handler_cursor, EINA_POSITION2D(cx, cy)); - pos = efl_text_cursor_position_get(sd->sel_handler_cursor); + efl_text_cursor_object_char_coord_set(sd->sel_handler_cursor, EINA_POSITION2D(cx, cy)); + pos = efl_text_cursor_object_position_get(sd->sel_handler_cursor); /* Set the main cursor. */ - efl_text_cursor_position_set(efl_text_interactive_main_cursor_get(data), pos); + efl_text_cursor_object_position_set(efl_text_interactive_main_cursor_get(data), pos); efl_input_clickable_longpress_abort(data, 1); sd->long_pressed = EINA_FALSE; } @@ -1739,46 +1431,40 @@ _create_selection_handlers(Evas_Object *obj, Efl_Ui_Textbox_Data *sd) Evas_Object *handle; handle = _decoration_create(obj, sd, PART_NAME_HANDLER_START, EINA_TRUE); - evas_object_pass_events_set(handle, EINA_FALSE); + efl_canvas_object_pass_events_set(handle, EINA_FALSE); sd->start_handler = handle; - evas_object_event_callback_add(handle, EVAS_CALLBACK_MOUSE_DOWN, + efl_event_callback_add(handle, EFL_EVENT_POINTER_DOWN, _start_handler_mouse_down_cb, obj); - evas_object_event_callback_add(handle, EVAS_CALLBACK_MOUSE_MOVE, + efl_event_callback_add(handle, EFL_EVENT_POINTER_MOVE, _start_handler_mouse_move_cb, obj); - evas_object_event_callback_add(handle, EVAS_CALLBACK_MOUSE_UP, + efl_event_callback_add(handle, EFL_EVENT_POINTER_UP, _start_handler_mouse_up_cb, obj); - evas_object_show(handle); + efl_gfx_entity_visible_set(handle, EINA_TRUE); handle = _decoration_create(obj, sd, PART_NAME_HANDLER_END, EINA_TRUE); - evas_object_pass_events_set(handle, EINA_FALSE); + efl_canvas_object_pass_events_set(handle, EINA_FALSE); sd->end_handler = handle; - evas_object_event_callback_add(handle, EVAS_CALLBACK_MOUSE_DOWN, + efl_event_callback_add(handle, EFL_EVENT_POINTER_DOWN, _end_handler_mouse_down_cb, obj); - evas_object_event_callback_add(handle, EVAS_CALLBACK_MOUSE_MOVE, + efl_event_callback_add(handle, EFL_EVENT_POINTER_MOVE, _end_handler_mouse_move_cb, obj); - evas_object_event_callback_add(handle, EVAS_CALLBACK_MOUSE_UP, + efl_event_callback_add(handle, EFL_EVENT_POINTER_UP, _end_handler_mouse_up_cb, obj); - evas_object_show(handle); + efl_gfx_entity_visible_set(handle, EINA_TRUE); } EOLIAN static void _efl_ui_textbox_efl_gfx_entity_position_set(Eo *obj, Efl_Ui_Textbox_Data *sd, Eina_Position2D pos) { - if (_evas_object_intercept_call(obj, EVAS_OBJECT_INTERCEPT_CB_MOVE, 0, pos.x, pos.y)) - return; - efl_gfx_entity_position_set(efl_super(obj, MY_CLASS), pos); efl_gfx_entity_position_set(sd->hit_rect, pos); - if (sd->hoversel) _hoversel_position(obj); + if (sd->popup) _popup_position(obj); } EOLIAN static void _efl_ui_textbox_efl_gfx_entity_size_set(Eo *obj, Efl_Ui_Textbox_Data *sd, Eina_Size2D sz) { - if (_evas_object_intercept_call(obj, EVAS_OBJECT_INTERCEPT_CB_RESIZE, 0, sz.w, sz.h)) - return; - efl_gfx_entity_size_set(sd->hit_rect, sz); _update_selection_handler(obj); @@ -1788,9 +1474,6 @@ _efl_ui_textbox_efl_gfx_entity_size_set(Eo *obj, Efl_Ui_Textbox_Data *sd, Eina_S EOLIAN static void _efl_ui_textbox_efl_gfx_entity_visible_set(Eo *obj, Efl_Ui_Textbox_Data *sd EINA_UNUSED, Eina_Bool vis) { - if (_evas_object_intercept_call(obj, EVAS_OBJECT_INTERCEPT_CB_VISIBLE, 0, vis)) - return; - efl_gfx_entity_visible_set(efl_super(obj, MY_CLASS), vis); if (vis) _update_selection_handler(obj); } @@ -1801,7 +1484,7 @@ _efl_ui_textbox_efl_canvas_group_group_member_add(Eo *obj, Efl_Ui_Textbox_Data * efl_canvas_group_member_add(efl_super(obj, MY_CLASS), member); if (sd->hit_rect) - evas_object_raise(sd->hit_rect); + efl_gfx_stack_raise_to_top(sd->hit_rect); } static void @@ -1912,35 +1595,52 @@ _update_text_theme(Eo *obj, Efl_Ui_Textbox_Data *sd) // Main Text // font_set - font_name = edje_object_data_get(wd->resize_obj, "font.name"); - font_size = edje_object_data_get(wd->resize_obj, "font.size"); - font_size_n = font_size ? atoi(font_size) : 0; - efl_text_font_family_set(sd->text_obj, font_name); - efl_text_font_size_set(sd->text_obj, font_size_n); + if (!efl_text_font_family_get(sd->text_obj)) + { + font_name = efl_layout_group_data_get(wd->resize_obj, "font.name"); + efl_text_font_family_set(sd->text_obj, font_name); + } + if (!efl_text_font_size_get(sd->text_obj)) + { + font_size = efl_layout_group_data_get(wd->resize_obj, "font.size"); + font_size_n = font_size ? atoi(font_size) : 0; + efl_text_font_size_set(sd->text_obj, font_size_n); + } // color - if (disabled) - colorcode = edje_object_data_get(wd->resize_obj, "style.color_disabled"); - if (!colorcode) - colorcode = edje_object_data_get(wd->resize_obj, "style.color"); - if (colorcode && _format_color_parse(colorcode, strlen(colorcode), &r, &g, &b, &a)) - { - efl_text_color_set(sd->text_obj, r, g, b, a); + if (!sd->color_is_set) + { + // If user set color by him self, we will not change it back even if + // control become disabled. + if (disabled) + colorcode = efl_layout_group_data_get(wd->resize_obj, "style.color_disabled"); + if (!colorcode) + colorcode = efl_layout_group_data_get(wd->resize_obj, "style.color"); + if (colorcode && _format_color_parse(colorcode, strlen(colorcode), &r, &g, &b, &a)) + { + efl_text_color_set(sd->text_obj, r, g, b, a); + } } // Guide Text - font_name = edje_object_data_get(wd->resize_obj, "guide.font.name"); - font_size = edje_object_data_get(wd->resize_obj, "guide.font.size"); - font_size_n = font_size ? atoi(font_size) : 0; - efl_text_font_family_set(sd->text_guide_obj, font_name); - efl_text_font_size_set(sd->text_guide_obj, font_size_n); + if (!efl_text_font_family_get(sd->text_guide_obj)) + { + font_name = efl_layout_group_data_get(wd->resize_obj, "guide.font.name"); + efl_text_font_family_set(sd->text_guide_obj, font_name); + } + if (!efl_text_font_size_get(sd->text_guide_obj)) + { + font_size = efl_layout_group_data_get(wd->resize_obj, "guide.font.size"); + font_size_n = font_size ? atoi(font_size) : 0; + efl_text_font_size_set(sd->text_guide_obj, font_size_n); + } colorcode = NULL; // color if (disabled) - colorcode = edje_object_data_get(wd->resize_obj, "guide.style.color_disabled"); + colorcode = efl_layout_group_data_get(wd->resize_obj, "guide.style.color_disabled"); if (!colorcode) - colorcode = edje_object_data_get(wd->resize_obj, "guide.style.color"); + colorcode = efl_layout_group_data_get(wd->resize_obj, "guide.style.color"); if (colorcode && _format_color_parse(colorcode, strlen(colorcode), &r, &g, &b, &a)) { efl_text_color_set(sd->text_guide_obj, r, g, b, a); @@ -1952,10 +1652,18 @@ _efl_ui_textbox_efl_object_constructor(Eo *obj, Efl_Ui_Textbox_Data *sd) { Eo *text_obj; + sd->content = EFL_UI_TEXTBOX_CNP_CONTENT_MARKUP; + ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd, NULL); if (!elm_widget_theme_klass_get(obj)) elm_widget_theme_klass_set(obj, "text"); + + efl_event_callback_add(obj, EFL_UI_SELECTION_EVENT_WM_SELECTION_CHANGED, _selection_lost_cb, NULL); + efl_event_callback_add(obj, EFL_UI_DND_EVENT_DROP_ENTERED, _dnd_enter_cb, NULL); + efl_event_callback_add(obj, EFL_UI_DND_EVENT_DROP_POSITION_CHANGED, _dnd_pos_cb, NULL); + efl_event_callback_add(obj, EFL_UI_DND_EVENT_DROP_DROPPED, _dnd_drop_cb, NULL); + obj = efl_constructor(efl_super(obj, MY_CLASS)); efl_event_callback_add(obj, EFL_INPUT_EVENT_LONGPRESSED, _long_press_cb, obj); @@ -1972,15 +1680,11 @@ _efl_ui_textbox_efl_object_constructor(Eo *obj, Efl_Ui_Textbox_Data *sd) efl_composite_attach(obj, text_obj); sd->entry_edje = wd->resize_obj; - sd->cnp_mode = EFL_UI_SELECTION_FORMAT_TEXT; - sd->line_wrap = ELM_WRAP_WORD; sd->context_menu_enabled = EINA_TRUE; - sd->auto_save = EINA_TRUE; efl_text_interactive_editable_set(obj, EINA_TRUE); efl_text_interactive_selection_allowed_set(obj, EINA_TRUE); - sd->drop_format = EFL_UI_SELECTION_FORMAT_MARKUP | EFL_UI_SELECTION_FORMAT_IMAGE; sd->last.scroll = EINA_SIZE2D(0, 0); - sd->sel_handler_enabled = EINA_FALSE; + sd->sel_handles_enabled = EINA_FALSE; return obj; } @@ -1991,40 +1695,15 @@ _efl_ui_textbox_efl_object_finalize(Eo *obj, { obj = efl_finalize(efl_super(obj, MY_CLASS)); - ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd, NULL); - - elm_drop_target_add(obj, sd->drop_format, - _dnd_enter_cb, NULL, - _dnd_leave_cb, NULL, - _dnd_pos_cb, NULL, - _dnd_drop_cb, NULL); - - if (elm_widget_theme_object_set(obj, wd->resize_obj, - elm_widget_theme_klass_get(obj), - elm_widget_theme_element_get(obj), - elm_widget_theme_style_get(obj)) == EFL_UI_THEME_APPLY_ERROR_GENERIC) - CRI("Failed to set layout!"); - efl_access_object_role_set(obj, EFL_ACCESS_ROLE_ENTRY); - //TODO: complete the usage of the text theme - _update_text_theme(obj, sd); - //efl_text_font_set(sd->text_obj, "Sans", 12); - - efl_pack_table(sd->text_table, sd->text_obj, 0, 0, 1, 1); - efl_pack_table(sd->text_table, sd->text_guide_obj, 0, 0, 1, 1); - - //edje_object_part_swallow(sd->entry_edje, "efl.text", sd->text_obj); - //edje_object_part_swallow(sd->entry_edje, "efl.text_guide", sd->text_guide_obj); - edje_object_part_swallow(sd->entry_edje, "efl.text", sd->text_table); - _update_guide_text(obj, sd); sd->item_fallback_factory = efl_add(EFL_UI_TEXT_FACTORY_FALLBACK_CLASS, obj); - evas_object_size_hint_weight_set + efl_gfx_hint_weight_set (sd->entry_edje, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); - evas_object_size_hint_align_set + efl_gfx_hint_align_set (sd->entry_edje, EVAS_HINT_FILL, EVAS_HINT_FILL); efl_event_callback_add(sd->text_obj, EFL_TEXT_INTERACTIVE_EVENT_CHANGED_USER, _efl_ui_textbox_changed_user_cb, obj); @@ -2034,21 +1713,19 @@ _efl_ui_textbox_efl_object_finalize(Eo *obj, _efl_ui_textbox_selection_start_clear_cb, obj); efl_event_callback_add(sd->text_obj, EFL_TEXT_INTERACTIVE_EVENT_SELECTION_CHANGED, _efl_ui_textbox_selection_changed_cb, obj); - efl_event_callback_add(efl_text_interactive_main_cursor_get(sd->text_obj), EFL_TEXT_CURSOR_EVENT_CHANGED, + efl_event_callback_add(efl_text_interactive_main_cursor_get(sd->text_obj), EFL_TEXT_CURSOR_OBJECT_EVENT_CHANGED, _efl_ui_textbox_cursor_changed_cb, obj); efl_event_callback_add(sd->text_obj, EFL_GFX_ENTITY_EVENT_POSITION_CHANGED, _text_position_changed_cb, obj); - evas_object_event_callback_add(sd->entry_edje, EVAS_CALLBACK_MOVE, + efl_event_callback_add(sd->entry_edje, EFL_GFX_ENTITY_EVENT_POSITION_CHANGED, _efl_ui_textbox_move_cb, obj); - evas_object_event_callback_add - (sd->entry_edje, EVAS_CALLBACK_KEY_DOWN, _key_down_cb, obj); - evas_object_event_callback_add - (sd->entry_edje, EVAS_CALLBACK_MOUSE_DOWN, _mouse_down_cb, obj); - evas_object_event_callback_add - (sd->entry_edje, EVAS_CALLBACK_MOUSE_UP, _mouse_up_cb, obj); - evas_object_event_callback_add - (sd->entry_edje, EVAS_CALLBACK_MOUSE_MOVE, _mouse_move_cb, obj); + efl_event_callback_add + (sd->entry_edje, EFL_EVENT_POINTER_DOWN, _mouse_down_cb, obj); + efl_event_callback_add + (sd->entry_edje, EFL_EVENT_POINTER_UP, _mouse_up_cb, obj); + efl_event_callback_add + (sd->entry_edje, EFL_EVENT_POINTER_MOVE, _mouse_move_cb, obj); efl_ui_action_connector_bind_clickable_to_object(sd->entry_edje, obj); efl_event_callback_add(obj, EFL_GFX_ENTITY_EVENT_SIZE_CHANGED, @@ -2059,11 +1736,7 @@ _efl_ui_textbox_efl_object_finalize(Eo *obj, efl_input_text_input_panel_layout_set(obj, EFL_INPUT_TEXT_PANEL_LAYOUT_TYPE_NORMAL); efl_input_text_input_panel_autoshow_set(obj, EINA_TRUE); efl_input_text_predictable_set(obj, EINA_TRUE); - efl_input_text_input_hint_set(obj, EFL_INPUT_TEXT_HINTS_TYPE_AUTO_COMPLETE); - - _mirrored_set(obj, efl_ui_mirrored_get(obj)); - - _create_text_cursors(obj, sd); + efl_input_text_input_content_type_set(obj, EFL_INPUT_TEXT_CONTENT_TYPE_AUTO_COMPLETE); sd->calc_force = EINA_TRUE; @@ -2074,72 +1747,53 @@ _efl_ui_textbox_efl_object_finalize(Eo *obj, EOLIAN static void _efl_ui_textbox_efl_object_destructor(Eo *obj, Efl_Ui_Textbox_Data *sd) { - Elm_Entry_Context_Menu_Item *it; - Elm_Entry_Markup_Filter *tf; - - if (sd->delay_write) - { - ELM_SAFE_FREE(sd->delay_write, ecore_timer_del); - if (sd->auto_save) _save_do(obj); - } - efl_event_freeze(obj); - eina_stringshare_del(sd->file); - - ecore_job_del(sd->hov_deljob); + _popup_dismiss(sd); if ((sd->api) && (sd->api->obj_unhook)) sd->api->obj_unhook(obj); // module - unhook - evas_object_del(sd->mgf_proxy); - evas_object_del(sd->mgf_bg); - evas_object_del(sd->mgf_clip); - entries = eina_list_remove(entries, obj); - eina_stringshare_del(sd->cut_sel); eina_stringshare_del(sd->text); - ecore_job_del(sd->deferred_decoration_job); - if (sd->append_text_idler) - { - ecore_idler_del(sd->append_text_idler); - ELM_SAFE_FREE(sd->append_text_left, free); - sd->append_text_idler = NULL; - } - EINA_LIST_FREE(sd->items, it) - { - eina_stringshare_del(it->label); - eina_stringshare_del(it->icon_file); - eina_stringshare_del(it->icon_group); - free(it); - } - EINA_LIST_FREE(sd->markup_filters, tf) - { - _filter_free(tf); - } - ELM_SAFE_FREE(sd->delay_write, ecore_timer_del); - free(sd->input_panel_imdata); eina_stringshare_del(sd->anchor_hover.hover_style); efl_event_thaw(obj); if (sd->start_handler) { - evas_object_del(sd->start_handler); - evas_object_del(sd->end_handler); + efl_del(sd->start_handler); + efl_del(sd->end_handler); } _anchors_free(sd); _clear_text_selection(sd); - ecore_job_del(sd->deferred_decoration_job); - sd->deferred_decoration_job = NULL; - if (sd->item_factory) efl_unref(sd->item_factory); efl_destructor(efl_super(obj, MY_CLASS)); } EOLIAN static void +_efl_ui_textbox_efl_text_format_multiline_set(Eo *obj, Efl_Ui_Textbox_Data *sd, Eina_Bool enabled) +{ + enabled = !!enabled; + if (efl_text_multiline_get(obj) == enabled) return; + efl_text_multiline_set(sd->text_obj, enabled); + + if (sd->scroller) + { + if (enabled) + { + efl_ui_internal_text_scroller_mode_set(sd->scroller, EFL_UI_TEXT_SCROLLER_MODE_MULTILINE); + } + else + { + efl_ui_internal_text_scroller_mode_set(sd->scroller, EFL_UI_TEXT_SCROLLER_MODE_SINGLELINE); + } + } +} + +EOLIAN static void _efl_ui_textbox_efl_text_format_password_set(Eo *obj, Efl_Ui_Textbox_Data *sd, Eina_Bool password) { password = !!password; @@ -2149,34 +1803,26 @@ _efl_ui_textbox_efl_text_format_password_set(Eo *obj, Efl_Ui_Textbox_Data *sd, E efl_text_replacement_char_set(obj, ENTRY_PASSWORD_MASK_CHARACTER_UTF8); efl_text_password_set(sd->text_obj, password); - elm_drop_target_del(obj, sd->drop_format, - _dnd_enter_cb, NULL, - _dnd_leave_cb, NULL, - _dnd_pos_cb, NULL, - _dnd_drop_cb, NULL); if (password) { efl_text_multiline_set(obj, EINA_FALSE); - sd->line_wrap = ELM_WRAP_NONE; - efl_input_text_input_hint_set(obj, ((efl_input_text_input_hint_get(obj) & ~EFL_INPUT_TEXT_HINTS_TYPE_AUTO_COMPLETE) | EFL_INPUT_TEXT_HINTS_TYPE_SENSITIVE_DATA)); + efl_input_text_input_content_type_set(obj, ((efl_input_text_input_content_type_get(obj) & ~EFL_INPUT_TEXT_CONTENT_TYPE_AUTO_COMPLETE) | EFL_INPUT_TEXT_CONTENT_TYPE_SENSITIVE_DATA)); efl_access_object_role_set(obj, EFL_ACCESS_ROLE_PASSWORD_TEXT); } else { efl_text_multiline_set(obj, EINA_TRUE); - sd->drop_format = _get_drop_format(obj); - elm_drop_target_add(obj, sd->drop_format, - _dnd_enter_cb, NULL, - _dnd_leave_cb, NULL, - _dnd_pos_cb, NULL, - _dnd_drop_cb, NULL); - efl_input_text_input_hint_set(obj, ((efl_input_text_input_hint_get(obj) | EFL_INPUT_TEXT_HINTS_TYPE_AUTO_COMPLETE) & ~EFL_INPUT_TEXT_HINTS_TYPE_SENSITIVE_DATA)); + efl_input_text_input_content_type_set(obj, ((efl_input_text_input_content_type_get(obj) | EFL_INPUT_TEXT_CONTENT_TYPE_AUTO_COMPLETE) & ~EFL_INPUT_TEXT_CONTENT_TYPE_SENSITIVE_DATA)); efl_access_object_role_set(obj, EFL_ACCESS_ROLE_ENTRY); } - - efl_ui_widget_theme_apply(obj); } +EOLIAN static void +_efl_ui_textbox_efl_text_style_text_color_set(Eo *obj EINA_UNUSED, Efl_Ui_Textbox_Data *pd, unsigned char r, unsigned char g, unsigned char b, unsigned char a) +{ + pd->color_is_set = EINA_TRUE; + efl_text_color_set(pd->text_obj, r, g, b, a); +} static void _efl_ui_textbox_calc_force(Eo *obj, Efl_Ui_Textbox_Data *sd) { @@ -2188,47 +1834,41 @@ _efl_ui_textbox_calc_force(Eo *obj, Efl_Ui_Textbox_Data *sd) static const char* _efl_ui_textbox_selection_get(const Eo *obj, Efl_Ui_Textbox_Data *sd EINA_UNUSED) { - Efl_Text_Cursor *start_obj, *end_obj; + Efl_Text_Cursor_Object *start_obj, *end_obj; if ((efl_text_password_get(obj))) return NULL; efl_text_interactive_selection_cursors_get(obj, &start_obj, &end_obj); - return efl_text_cursor_range_text_get(start_obj, end_obj); + return efl_text_cursor_object_range_text_get(start_obj, end_obj); } EOLIAN static void -_efl_ui_textbox_selection_handler_enabled_set(Eo *obj EINA_UNUSED, Efl_Ui_Textbox_Data *sd, Eina_Bool enabled) +_efl_ui_textbox_selection_handles_enabled_set(Eo *obj EINA_UNUSED, Efl_Ui_Textbox_Data *sd, Eina_Bool enabled) { - if (sd->sel_handler_enabled == enabled) return; - sd->sel_handler_enabled = enabled; + if (sd->sel_handles_enabled == enabled) return; + sd->sel_handles_enabled = enabled; } EOLIAN static Eina_Bool -_efl_ui_textbox_selection_handler_enabled_get(const Eo *obj EINA_UNUSED, Efl_Ui_Textbox_Data *sd) +_efl_ui_textbox_selection_handles_enabled_get(const Eo *obj EINA_UNUSED, Efl_Ui_Textbox_Data *sd) { - return sd->sel_handler_enabled; + return sd->sel_handles_enabled; } static void _efl_ui_textbox_entry_insert(Eo *obj, Efl_Ui_Textbox_Data *sd, const char *entry) { - Efl_Text_Cursor *cur_obj = efl_text_interactive_main_cursor_get(obj); - efl_text_cursor_text_insert(cur_obj, entry); + Efl_Text_Cursor_Object *cur_obj = efl_text_interactive_main_cursor_get(obj); + efl_text_cursor_object_text_insert(cur_obj, entry); sd->text_changed = EINA_TRUE; efl_canvas_group_change(obj); } -EOLIAN static void -_efl_ui_textbox_cursor_add(Eo *obj, Efl_Ui_Textbox_Data *pd, Efl_Text_Cursor *cursor) -{ - efl_text_cursor_text_object_set(cursor, pd->text_obj, obj); -} - -EOLIAN static Efl_Text_Cursor * +EOLIAN static Efl_Text_Cursor_Object * _efl_ui_textbox_cursor_create(Eo *obj, Efl_Ui_Textbox_Data *pd) { - Eo* cursor = efl_add(EFL_TEXT_CURSOR_CLASS, pd->text_obj); - efl_text_cursor_text_object_set(cursor, pd->text_obj, obj); + Eo* cursor = efl_text_cursor_object_create(pd->text_obj);; + efl_text_cursor_object_text_object_set(cursor, pd->text_obj, obj); return cursor; } @@ -2239,52 +1879,51 @@ _efl_ui_textbox_efl_text_interactive_editable_set(Eo *obj, Efl_Ui_Textbox_Data * efl_text_interactive_editable_set(efl_super(obj, MY_CLASS), editable); - efl_ui_widget_theme_apply(obj); efl_ui_widget_focus_allow_set(obj, editable); - elm_drop_target_del(obj, sd->drop_format, - _dnd_enter_cb, NULL, - _dnd_leave_cb, NULL, - _dnd_pos_cb, NULL, - _dnd_drop_cb, NULL); if (editable) { - sd->drop_format = _get_drop_format(obj); - elm_drop_target_add(obj, sd->drop_format, - _dnd_enter_cb, NULL, - _dnd_leave_cb, NULL, - _dnd_pos_cb, NULL, - _dnd_drop_cb, NULL); if (sd->cursor) { - evas_object_show(sd->cursor); - evas_object_show(sd->cursor_bidi); + efl_gfx_entity_visible_set(sd->cursor, EINA_TRUE); + efl_gfx_entity_visible_set(sd->cursor_bidi, EINA_TRUE); } } if (!editable && sd->cursor) { - evas_object_hide(sd->cursor); - evas_object_hide(sd->cursor_bidi); + efl_gfx_entity_visible_set(sd->cursor, EINA_FALSE); + efl_gfx_entity_visible_set(sd->cursor_bidi, EINA_FALSE); } } static void _efl_ui_textbox_select_region_set(Eo *obj, Efl_Ui_Textbox_Data *sd EINA_UNUSED, int start, int end) { - Efl_Text_Cursor *sel_start, *sel_end; + Efl_Text_Cursor_Object *sel_start, *sel_end; if (efl_text_password_get(obj)) return; efl_text_interactive_selection_cursors_get(obj, &sel_start, &sel_end); - efl_text_cursor_position_set(sel_start, start); - efl_text_cursor_position_set(sel_end, end); + efl_text_cursor_object_position_set(sel_start, start); + efl_text_cursor_object_position_set(sel_end, end); +} + +static void +_efl_ui_textbox_select_region_get(Eo *obj, int *start, int *end) +{ + Efl_Text_Cursor_Object *sel_start, *sel_end; + + efl_text_interactive_selection_cursors_get(obj, &sel_start, &sel_end); + + if(start) *start = efl_text_cursor_object_position_get(sel_start); + if(end) *end = efl_text_cursor_object_position_get(sel_end); } EOLIAN static void _efl_ui_textbox_selection_cut(Eo *obj, Efl_Ui_Textbox_Data *sd) { - Efl_Text_Cursor *start, *end; + Efl_Text_Cursor_Object *start, *end; Efl_Text_Change_Info info = { NULL, 0, 0, 0, 0 }; char *tmp; int end_pos, start_pos; @@ -2294,24 +1933,24 @@ _efl_ui_textbox_selection_cut(Eo *obj, Efl_Ui_Textbox_Data *sd) if (!_elm_config->desktop_entry) edje_object_part_text_select_allow_set (sd->entry_edje, "efl.text", EINA_FALSE); - edje_object_signal_emit(sd->entry_edje, "efl,state,select,off", "efl"); + efl_layout_signal_emit(sd->entry_edje, "efl,state,select,off", "efl"); if (!_elm_config->desktop_entry) - elm_widget_scroll_hold_pop(obj); + efl_ui_widget_scroll_hold_pop(obj); /*In password mode, cut will remove text only*/ if (!efl_text_password_get(obj)) - _selection_store(EFL_UI_SELECTION_TYPE_CLIPBOARD, obj); + _selection_store(EFL_UI_CNP_BUFFER_COPY_AND_PASTE, obj); efl_text_interactive_selection_cursors_get(obj, &start, &end); - start_pos = efl_text_cursor_position_get(start); - end_pos = efl_text_cursor_position_get(end); - tmp = efl_text_cursor_range_text_get(start, end); - info.insert = EINA_FALSE; + start_pos = efl_text_cursor_object_position_get(start); + end_pos = efl_text_cursor_object_position_get(end); + tmp = efl_text_cursor_object_range_text_get(start, end); + info.type = EFL_TEXT_CHANGE_TYPE_REMOVE; info.position = start_pos; info.length = end_pos - start_pos; info.content = tmp; - efl_text_cursor_range_delete(start, end); + efl_text_cursor_object_range_delete(start, end); efl_event_callback_call(obj, EFL_TEXT_INTERACTIVE_EVENT_CHANGED_USER, &info); free(tmp); tmp = NULL; @@ -2330,22 +1969,30 @@ _efl_ui_textbox_selection_copy(Eo *obj, Efl_Ui_Textbox_Data *sd) { edje_object_part_text_select_allow_set (sd->entry_edje, "efl.text", EINA_FALSE); - edje_object_signal_emit(sd->entry_edje, "efl,state,select,off", "efl"); - elm_widget_scroll_hold_pop(obj); + efl_layout_signal_emit(sd->entry_edje, "efl,state,select,off", "efl"); + efl_ui_widget_scroll_hold_pop(obj); } - _selection_store(EFL_UI_SELECTION_TYPE_CLIPBOARD, obj); + _selection_store(EFL_UI_CNP_BUFFER_COPY_AND_PASTE, obj); efl_event_callback_call(obj, EFL_UI_TEXTBOX_EVENT_SELECTION_COPY, NULL); } - -EOLIAN static void -_efl_ui_textbox_selection_paste(Eo *obj, Efl_Ui_Textbox_Data *sd EINA_UNUSED) +static void +_efl_ui_textbox_selection_paste_type(Eo *obj, Efl_Ui_Textbox_Data *sd, Efl_Ui_Cnp_Buffer type) { - Efl_Ui_Selection_Format formats = EFL_UI_SELECTION_FORMAT_TEXT | EFL_UI_SELECTION_FORMAT_MARKUP; + Eina_Future *future; + Eina_Array *types = _figure_out_types(obj, sd); - efl_ui_selection_get(obj, EFL_UI_SELECTION_TYPE_CLIPBOARD, formats, - NULL, _selection_data_cb, NULL, 1); + future = efl_ui_selection_get(obj, type, evas_device_seat_id_get(evas_default_device_get(evas_object_evas_get(obj), EVAS_DEVICE_CLASS_SEAT)), eina_array_iterator_new(types)); + + efl_future_then(obj, future, _selection_data_cb); efl_event_callback_call(obj, EFL_UI_TEXTBOX_EVENT_SELECTION_PASTE, NULL); + eina_array_free(types); +} + +EOLIAN static void +_efl_ui_textbox_selection_paste(Eo *obj, Efl_Ui_Textbox_Data *sd) +{ + _efl_ui_textbox_selection_paste_type(obj, sd, EFL_UI_CNP_BUFFER_COPY_AND_PASTE); } EOLIAN static void @@ -2361,90 +2008,38 @@ _efl_ui_textbox_context_menu_enabled_get(const Eo *obj EINA_UNUSED, Efl_Ui_Textb return sd->context_menu_enabled; } -EOLIAN static Eina_Error -_efl_ui_textbox_efl_file_file_set(Eo *obj, Efl_Ui_Textbox_Data *sd, const char *file) -{ - eina_stringshare_replace(&sd->file, file); - return efl_file_set(efl_super(obj, MY_CLASS), file); -} - -EOLIAN static void -_efl_ui_textbox_efl_file_unload(Eo *obj, Efl_Ui_Textbox_Data *sd) -{ - efl_file_unload(efl_super(obj, MY_CLASS)); - ELM_SAFE_FREE(sd->delay_write, ecore_timer_del); - elm_object_text_set(obj, ""); -} - -EOLIAN static Eina_Error -_efl_ui_textbox_efl_file_load(Eo *obj, Efl_Ui_Textbox_Data *sd) -{ - Eina_Error err; - - if (efl_file_loaded_get(obj)) return 0; - err = efl_file_load(efl_super(obj, MY_CLASS)); - if (err) return err; - ELM_SAFE_FREE(sd->delay_write, ecore_timer_del); - if (sd->auto_save) _save_do(obj); - return _load_do(obj); -} - EOLIAN static void -_efl_ui_textbox_cnp_mode_set(Eo *obj, Efl_Ui_Textbox_Data *sd, Efl_Ui_Selection_Format cnp_mode) +_efl_ui_textbox_cnp_dnd_mode_set(Eo *obj EINA_UNUSED, Efl_Ui_Textbox_Data *sd, Efl_Ui_Textbox_Cnp_Content content) { - Elm_Sel_Format dnd_format = EFL_UI_SELECTION_FORMAT_MARKUP; - - if (cnp_mode != EFL_UI_SELECTION_FORMAT_TARGETS) - { - if (cnp_mode & EFL_UI_SELECTION_FORMAT_VCARD) - ERR("VCARD format not supported for copy & paste!"); - else if (cnp_mode & EFL_UI_SELECTION_FORMAT_HTML) - ERR("HTML format not supported for copy & paste!"); - cnp_mode &= ~EFL_UI_SELECTION_FORMAT_VCARD; - cnp_mode &= ~EFL_UI_SELECTION_FORMAT_HTML; - } - - if (sd->cnp_mode == cnp_mode) return; - sd->cnp_mode = cnp_mode; - if (sd->cnp_mode == EFL_UI_SELECTION_FORMAT_TEXT) - dnd_format = EFL_UI_SELECTION_FORMAT_TEXT; - else if (cnp_mode == EFL_UI_SELECTION_FORMAT_IMAGE) - dnd_format |= EFL_UI_SELECTION_FORMAT_IMAGE; - - elm_drop_target_del(obj, sd->drop_format, - _dnd_enter_cb, NULL, - _dnd_leave_cb, NULL, - _dnd_pos_cb, NULL, - _dnd_drop_cb, NULL); - sd->drop_format = dnd_format; - elm_drop_target_add(obj, sd->drop_format, - _dnd_enter_cb, NULL, - _dnd_leave_cb, NULL, - _dnd_pos_cb, NULL, - _dnd_drop_cb, NULL); + sd->content = content; } -EOLIAN static Efl_Ui_Selection_Format -_efl_ui_textbox_cnp_mode_get(const Eo *obj EINA_UNUSED, Efl_Ui_Textbox_Data *sd) +EOLIAN static Efl_Ui_Textbox_Cnp_Content +_efl_ui_textbox_cnp_dnd_mode_get(const Eo *obj EINA_UNUSED, Efl_Ui_Textbox_Data *sd) { - return sd->cnp_mode; + return sd->content; } EOLIAN static void -_efl_ui_textbox_scrollable_set(Eo *obj EINA_UNUSED, Efl_Ui_Textbox_Data *sd, Eina_Bool scroll) +_efl_ui_textbox_scrollable_set(Eo *obj, Efl_Ui_Textbox_Data *sd, Eina_Bool scroll) { if (sd->scroll == scroll) return; sd->scroll = scroll; if (scroll) { - edje_object_part_swallow(sd->entry_edje, "efl.text", NULL); + efl_content_set(efl_part(sd->entry_edje, "efl.text"), NULL); sd->scroller = efl_add(EFL_UI_INTERNAL_TEXT_SCROLLER_CLASS, obj, efl_ui_internal_text_scroller_initialize(efl_added, sd->text_obj, sd->text_table)); - efl_ui_scrollbar_bar_mode_set(sd->scroller, EFL_UI_SCROLLBAR_MODE_AUTO, EFL_UI_SCROLLBAR_MODE_AUTO); - edje_object_part_swallow(sd->entry_edje, "efl.text", sd->scroller); - evas_object_clip_set(sd->cursor, + + if (efl_text_multiline_get(obj)) + efl_ui_internal_text_scroller_mode_set(sd->scroller, EFL_UI_TEXT_SCROLLER_MODE_MULTILINE); + else + efl_ui_internal_text_scroller_mode_set(sd->scroller, EFL_UI_TEXT_SCROLLER_MODE_SINGLELINE); + + efl_content_set(efl_part(sd->entry_edje, "efl.text"), sd->scroller); + efl_canvas_object_clipper_set(sd->cursor, efl_ui_internal_text_scroller_viewport_clip_get(sd->scroller)); efl_event_callback_add(sd->scroller, EFL_GFX_ENTITY_EVENT_SIZE_CHANGED, _scroller_size_changed_cb, obj); @@ -2455,7 +2050,7 @@ _efl_ui_textbox_scrollable_set(Eo *obj EINA_UNUSED, Efl_Ui_Textbox_Data *sd, Ein * instead of efl_content_set(sd->scroller, NULL) */ efl_content_unset(sd->scroller); - edje_object_part_swallow(sd->entry_edje, "efl.text", sd->text_table); + efl_content_set(efl_part(sd->entry_edje, "efl.text"), sd->text_table); efl_del(sd->scroller); sd->scroller = NULL; } @@ -2475,8 +2070,8 @@ _efl_ui_textbox_efl_ui_widget_on_access_activate(Eo *obj, Efl_Ui_Textbox_Data *_ EFL_UI_TEXT_DATA_GET(obj, sd); - if (!elm_widget_disabled_get(obj) && - !evas_object_freeze_events_get(obj)) + if (!efl_ui_widget_disabled_get(obj) && + !(efl_event_freeze_count_get(obj) > 0)) { efl_event_callback_call(obj, EFL_INPUT_EVENT_CLICKED, NULL); if (efl_text_interactive_editable_get(obj) && efl_input_text_input_panel_autoshow_get(obj)) @@ -2516,11 +2111,13 @@ _efl_ui_textbox_efl_access_text_character_count_get(const Eo *obj, Efl_Ui_Textbo return eina_unicode_utf8_get_len(txt); } -EOLIAN static char* -_efl_ui_textbox_efl_access_text_string_get(const Eo *obj EINA_UNUSED, Efl_Ui_Textbox_Data *pd, Efl_Access_Text_Granularity granularity, int *start_offset, int *end_offset) +EOLIAN static void +_efl_ui_textbox_efl_access_text_string_get(const Eo *obj EINA_UNUSED, Efl_Ui_Textbox_Data *pd, Efl_Access_Text_Granularity granularity, int *start_offset, int *end_offset, char **ret EFL_TRANSFER_OWNERSHIP) { Evas_Textblock_Cursor *cur = NULL, *cur2 = NULL; - char *ret = NULL; + + EINA_SAFETY_ON_NULL_RETURN(ret); + *ret = NULL; cur = evas_object_textblock_cursor_new(pd->text_obj); cur2 = evas_object_textblock_cursor_new(pd->text_obj); @@ -2575,26 +2172,26 @@ _efl_ui_textbox_efl_access_text_string_get(const Eo *obj EINA_UNUSED, Efl_Ui_Tex if (end_offset) *end_offset = evas_textblock_cursor_pos_get(cur2); - ret = evas_textblock_cursor_range_text_get(cur, cur2, EVAS_TEXTBLOCK_TEXT_PLAIN); + *ret = evas_textblock_cursor_range_text_get(cur, cur2, EVAS_TEXTBLOCK_TEXT_PLAIN); evas_textblock_cursor_free(cur); evas_textblock_cursor_free(cur2); - if (ret && efl_text_password_get(obj)) + if (*ret && efl_text_password_get(obj)) { int i = 0; - while (ret[i] != '\0') - ret[i++] = ENTRY_PASSWORD_MASK_CHARACTER; + while (*ret[i] != '\0') + *ret[i++] = ENTRY_PASSWORD_MASK_CHARACTER; } - return ret; + return; fail: if (start_offset) *start_offset = -1; if (end_offset) *end_offset = -1; if (cur) evas_textblock_cursor_free(cur); if (cur2) evas_textblock_cursor_free(cur2); - return NULL; + *ret = NULL; } EOLIAN static char* @@ -2637,13 +2234,13 @@ fail: EOLIAN static int _efl_ui_textbox_efl_access_text_caret_offset_get(const Eo *obj, Efl_Ui_Textbox_Data *_pd EINA_UNUSED) { - return efl_text_cursor_position_get(efl_text_interactive_main_cursor_get(obj)); + return efl_text_cursor_object_position_get(efl_text_interactive_main_cursor_get(obj)); } EOLIAN static Eina_Bool _efl_ui_textbox_efl_access_text_caret_offset_set(Eo *obj, Efl_Ui_Textbox_Data *_pd EINA_UNUSED, int offset) { - efl_text_cursor_position_set(efl_text_interactive_main_cursor_get(obj), offset); + efl_text_cursor_object_position_set(efl_text_interactive_main_cursor_get(obj), offset); return EINA_TRUE; } @@ -2658,7 +2255,7 @@ _efl_ui_textbox_efl_access_text_access_selection_get(const Eo *obj, Efl_Ui_Textb { if (selection_number != 0) return; - elm_obj_entry_select_region_get(obj, start_offset, end_offset); + _efl_ui_textbox_select_region_get((Eo *)obj, start_offset, end_offset); } EOLIAN static Eina_Bool @@ -2827,7 +2424,7 @@ _textblock_node_format_to_atspi_text_attr(Efl_Text_Attribute_Handle *annotation) EOLIAN static Eina_Bool _efl_ui_textbox_efl_access_text_attribute_get(const Eo *obj, Efl_Ui_Textbox_Data *_pd EINA_UNUSED, const char *attr_name EINA_UNUSED, int *start_offset, int *end_offset, char **value) { - Efl_Text_Cursor *cur1, *cur2; + Efl_Text_Cursor_Object *cur1, *cur2; Efl_Access_Text_Attribute *attr; Eina_Iterator *annotations; Efl_Text_Attribute_Handle *an; @@ -2843,8 +2440,8 @@ _efl_ui_textbox_efl_access_text_attribute_get(const Eo *obj, Efl_Ui_Textbox_Data return EINA_FALSE; } - efl_text_cursor_position_set(cur1, *start_offset); - efl_text_cursor_position_set(cur2, *end_offset); + efl_text_cursor_object_position_set(cur1, *start_offset); + efl_text_cursor_object_position_set(cur2, *end_offset); annotations = efl_text_formatter_range_attributes_get(cur1, cur2); @@ -2870,44 +2467,45 @@ _efl_ui_textbox_efl_access_text_attribute_get(const Eo *obj, Efl_Ui_Textbox_Data return EINA_FALSE; } -EOLIAN static Eina_List* -_efl_ui_textbox_efl_access_text_text_attributes_get(const Eo *obj, Efl_Ui_Textbox_Data *pd EINA_UNUSED, int *start_offset, int *end_offset) +EOLIAN static void +_efl_ui_textbox_efl_access_text_text_attributes_get(const Eo *obj, Efl_Ui_Textbox_Data *pd EINA_UNUSED, int *start_offset, int *end_offset, Eina_List **ret EFL_TRANSFER_OWNERSHIP) { - Efl_Text_Cursor *cur1, *cur2; - Eina_List *ret = NULL; + Efl_Text_Cursor_Object *cur1, *cur2; Efl_Access_Text_Attribute *attr; Eina_Iterator *annotations; Efl_Text_Attribute_Handle *an; Eo *mobj = (Eo *)obj; + + EINA_SAFETY_ON_NULL_RETURN(ret); + *ret = NULL; + cur1 = efl_ui_textbox_cursor_create(mobj); - if (!cur1) return NULL; + if (!cur1) return; cur2 = efl_ui_textbox_cursor_create(mobj); if (!cur2) { efl_del(cur1); - return NULL; + return; } - efl_text_cursor_position_set(cur1, *start_offset); - efl_text_cursor_position_set(cur2, *end_offset); + efl_text_cursor_object_position_set(cur1, *start_offset); + efl_text_cursor_object_position_set(cur2, *end_offset); annotations = efl_text_formatter_range_attributes_get(cur1, cur2); efl_del(cur1); efl_del(cur2); - if (!annotations) return NULL; + if (!annotations) return; EINA_ITERATOR_FOREACH(annotations, an) { attr = _textblock_node_format_to_atspi_text_attr(an); if (!attr) continue; - ret = eina_list_append(ret, attr); + *ret = eina_list_append(*ret, attr); } eina_iterator_free(annotations); - - return ret; } EOLIAN static Eina_List* @@ -2915,7 +2513,7 @@ _efl_ui_textbox_efl_access_text_default_attributes_get(const Eo *obj, Efl_Ui_Tex { Eina_List *ret = NULL; Efl_Access_Text_Attribute *attr; - Efl_Text_Cursor *start, *end; + Efl_Text_Cursor_Object *start, *end; Eina_Iterator *annotations; Efl_Text_Attribute_Handle *an; @@ -2924,8 +2522,8 @@ _efl_ui_textbox_efl_access_text_default_attributes_get(const Eo *obj, Efl_Ui_Tex start = efl_ui_textbox_cursor_create(mobj); end = efl_ui_textbox_cursor_create(mobj); - efl_text_cursor_move(start, EFL_TEXT_CURSOR_MOVE_TYPE_FIRST); - efl_text_cursor_move(end, EFL_TEXT_CURSOR_MOVE_TYPE_LAST); + efl_text_cursor_object_move(start, EFL_TEXT_CURSOR_MOVE_TYPE_FIRST); + efl_text_cursor_object_move(end, EFL_TEXT_CURSOR_MOVE_TYPE_LAST); annotations = efl_text_formatter_range_attributes_get(start, end); @@ -2950,8 +2548,8 @@ _efl_ui_textbox_efl_access_editable_text_text_content_set(Eo *obj, Efl_Ui_Textbo EOLIAN static Eina_Bool _efl_ui_textbox_efl_access_editable_text_insert(Eo *obj, Efl_Ui_Textbox_Data *pd, const char *string, int position) { - Efl_Text_Cursor *cur_obj = efl_text_interactive_main_cursor_get(obj); - efl_text_cursor_position_set(cur_obj, position); + Efl_Text_Cursor_Object *cur_obj = efl_text_interactive_main_cursor_get(obj); + efl_text_cursor_object_position_set(cur_obj, position); _efl_ui_textbox_entry_insert(obj, pd, string); return EINA_TRUE; @@ -3000,8 +2598,8 @@ _efl_ui_textbox_efl_access_editable_text_delete(Eo *obj, Efl_Ui_Textbox_Data *pd EOLIAN static Eina_Bool _efl_ui_textbox_efl_access_editable_text_paste(Eo *obj, Efl_Ui_Textbox_Data *_pd EINA_UNUSED, int position) { - Efl_Text_Cursor *cur_obj = efl_text_interactive_main_cursor_get(obj); - efl_text_cursor_position_set(cur_obj, position); + Efl_Text_Cursor_Object *cur_obj = efl_text_interactive_main_cursor_get(obj); + efl_text_cursor_object_position_set(cur_obj, position); efl_ui_textbox_selection_paste(obj); return EINA_TRUE; } @@ -3039,9 +2637,9 @@ _efl_ui_textbox_efl_access_object_i18n_name_get(const Eo *obj, Efl_Ui_Textbox_Da static void _edje_signal_emit(Efl_Ui_Textbox_Data *sd, const char *sig, const char *src) { - edje_object_signal_emit(sd->entry_edje, sig, src); - edje_object_signal_emit(sd->cursor, sig, src); - edje_object_signal_emit(sd->cursor_bidi, sig, src); + efl_layout_signal_emit(sd->entry_edje, sig, src); + efl_layout_signal_emit(sd->cursor, sig, src); + efl_layout_signal_emit(sd->cursor_bidi, sig, src); } static inline Eo * @@ -3053,17 +2651,17 @@ _decoration_create(Eo *obj, Efl_Ui_Textbox_Data *sd, ret = efl_add(EFL_CANVAS_LAYOUT_CLASS, obj); elm_widget_element_update(obj, ret, group_name); - evas_object_smart_member_add(ret, sd->entry_edje); + efl_canvas_group_member_add(sd->entry_edje, ret); if (above) { - evas_object_stack_above(ret, sd->text_table); + efl_gfx_stack_above(ret, sd->text_table); } else { - evas_object_stack_below(ret, NULL); + efl_gfx_stack_below(ret, NULL); } - evas_object_clip_set(ret, clip); - evas_object_pass_events_set(ret, EINA_TRUE); + efl_canvas_object_clipper_set(ret, clip); + efl_canvas_object_pass_events_set(ret, EINA_TRUE); return ret; } @@ -3075,8 +2673,8 @@ _create_text_cursors(Eo *obj, Efl_Ui_Textbox_Data *sd) if (!efl_text_interactive_editable_get(obj)) { - evas_object_hide(sd->cursor); - evas_object_hide(sd->cursor_bidi); + efl_gfx_entity_visible_set(sd->cursor, EINA_FALSE); + efl_gfx_entity_visible_set(sd->cursor_bidi, EINA_FALSE); } } @@ -3113,8 +2711,8 @@ _update_text_cursors(Eo *obj) xx = yy = ww = hh = -1; off =_decoration_calc_offset(sd); - rc_tmp1 = efl_text_cursor_geometry_get(efl_text_interactive_main_cursor_get(text_obj), EFL_TEXT_CURSOR_TYPE_BEFORE); - bidi_cursor = efl_text_cursor_lower_cursor_geometry_get(efl_text_interactive_main_cursor_get(text_obj), &rc_tmp2); + rc_tmp1 = efl_text_cursor_object_cursor_geometry_get(efl_text_interactive_main_cursor_get(text_obj), EFL_TEXT_CURSOR_TYPE_BEFORE); + bidi_cursor = efl_text_cursor_object_lower_cursor_geometry_get(efl_text_interactive_main_cursor_get(text_obj), &rc_tmp2); xx = rc_tmp1.x; yy = rc_tmp1.y; ww = rc_tmp1.w; @@ -3124,21 +2722,21 @@ _update_text_cursors(Eo *obj) if (hh < 1) hh = 1; if (sd->cursor) { - evas_object_geometry_set(sd->cursor, off.x + xx, off.y + yy, ww, hh); + efl_gfx_entity_geometry_set(sd->cursor, EINA_RECT(off.x + xx, off.y + yy, ww, hh)); } if (sd->cursor_bidi) { if (bidi_cursor) { - evas_object_geometry_set(sd->cursor_bidi, - off.x + rc_tmp2.x, off.y + rc_tmp2.y + (hh / 2), - ww, hh / 2); - evas_object_resize(sd->cursor, ww, hh / 2); - evas_object_show(sd->cursor_bidi); + efl_gfx_entity_geometry_set(sd->cursor_bidi, + EINA_RECT(off.x + rc_tmp2.x, off.y + rc_tmp2.y + (hh / 2), + ww, hh / 2)); + efl_gfx_entity_size_set(sd->cursor, EINA_SIZE2D(ww, hh / 2)); + efl_gfx_entity_visible_set(sd->cursor_bidi, EINA_TRUE); } else { - evas_object_hide(sd->cursor_bidi); + efl_gfx_entity_visible_set(sd->cursor_bidi, EINA_FALSE); } } if (sd->cursor_update) @@ -3164,7 +2762,7 @@ static void _update_text_selection(Eo *obj, Eo *text_obj) { Eina_Position2D off; - Efl_Text_Cursor *sel_start, *sel_end; + Efl_Text_Cursor_Object *sel_start, *sel_end; Eina_List *l; Eina_Iterator *range; @@ -3180,7 +2778,7 @@ _update_text_selection(Eo *obj, Eo *text_obj) efl_text_interactive_selection_cursors_get(text_obj, &sel_start, &sel_end); - range = efl_text_cursor_range_geometry_get(sel_start, sel_end); + range = efl_text_cursor_object_range_geometry_get(sel_start, sel_end); l = sd->sel; EINA_ITERATOR_FOREACH(range, r) @@ -3192,7 +2790,7 @@ _update_text_selection(Eo *obj, Eo *text_obj) sd->sel = eina_list_append(sd->sel, rect); rect->obj_bg = _decoration_create(obj, sd, PART_NAME_SELECTION, EINA_FALSE); - evas_object_show(rect->obj_bg); + efl_gfx_entity_visible_set(rect->obj_bg, EINA_TRUE); } else { @@ -3202,8 +2800,8 @@ _update_text_selection(Eo *obj, Eo *text_obj) if (rect->obj_bg) { - evas_object_geometry_set(rect->obj_bg, off.x + r->x, off.y + r->y, - r->w, r->h); + efl_gfx_entity_geometry_set(rect->obj_bg, EINA_RECT(off.x + r->x, off.y + r->y, + r->w, r->h)); } } eina_iterator_free(range); @@ -3330,7 +2928,7 @@ _anchors_update(Eo *obj, Efl_Ui_Textbox_Data *sd) Evas_Object *smart, *clip; Eina_Iterator *it; Eina_Position2D off; - Efl_Text_Cursor *start, *end; + Efl_Text_Cursor_Object *start, *end; Efl_Text_Attribute_Handle *an; Eina_List *i, *ii; Anchor *anc; @@ -3344,15 +2942,15 @@ _anchors_update(Eo *obj, Efl_Ui_Textbox_Data *sd) end = efl_canvas_textblock_cursor_create(sd->text_obj); /* Retrieve all annotations in the text. */ - efl_text_cursor_move(start, EFL_TEXT_CURSOR_MOVE_TYPE_FIRST); - efl_text_cursor_move(end, EFL_TEXT_CURSOR_MOVE_TYPE_LAST); + efl_text_cursor_object_move(start, EFL_TEXT_CURSOR_MOVE_TYPE_FIRST); + efl_text_cursor_object_move(end, EFL_TEXT_CURSOR_MOVE_TYPE_LAST); it = efl_text_formatter_range_attributes_get(start, end); efl_del(start); efl_del(end); - smart = evas_object_smart_parent_get(obj); - clip = evas_object_clip_get(sd->text_obj); + smart = efl_canvas_object_render_parent_get(obj); + clip = efl_canvas_object_clipper_get(sd->text_obj); off = _decoration_calc_offset(sd); EINA_ITERATOR_FOREACH(it, an) @@ -3405,7 +3003,7 @@ _anchors_update(Eo *obj, Efl_Ui_Textbox_Data *sd) end = efl_ui_textbox_cursor_create(obj); efl_text_formatter_attribute_cursors_get(anc->annotation, start, end); - range = efl_text_cursor_range_geometry_get(start, end); + range = efl_text_cursor_object_range_geometry_get(start, end); count = eina_list_count(eina_iterator_container_get(range)); // Add additional rectangles if needed @@ -3419,12 +3017,12 @@ _anchors_update(Eo *obj, Efl_Ui_Textbox_Data *sd) ob = _decoration_create(obj, sd, PART_NAME_ANCHOR, EINA_TRUE); rect->obj_fg = ob; // hit-rectangle - ob = evas_object_rectangle_add(obj); - evas_object_color_set(ob, 0, 0, 0, 0); - evas_object_smart_member_add(ob, smart); - evas_object_stack_above(ob, obj); - evas_object_clip_set(ob, clip); - evas_object_repeat_events_set(ob, EINA_TRUE); + ob = efl_add(EFL_CANVAS_RECTANGLE_CLASS, obj); + efl_gfx_color_set(ob, 0, 0, 0, 0); + efl_canvas_group_member_add(smart, ob); + efl_gfx_stack_above(ob, obj); + efl_canvas_object_clipper_set(ob, clip); + efl_canvas_object_repeat_events_set(ob, EINA_TRUE); rect->obj = ob; //FIXME: add event handlers } @@ -3450,24 +3048,24 @@ _anchors_update(Eo *obj, Efl_Ui_Textbox_Data *sd) rect = eina_list_data_get(l); if (rect->obj_bg) { - evas_object_geometry_set(rect->obj_bg, - off.x + r->x, off.y + r->y, - r->w, r->h); - evas_object_show(rect->obj_bg); + efl_gfx_entity_geometry_set(rect->obj_bg, + EINA_RECT(off.x + r->x, off.y + r->y, + r->w, r->h)); + efl_gfx_entity_visible_set(rect->obj_bg, EINA_TRUE); } if (rect->obj_fg) { - evas_object_geometry_set(rect->obj_fg, - off.x + r->x, off.y + r->y, - r->w, r->h); - evas_object_show(rect->obj_fg); + efl_gfx_entity_geometry_set(rect->obj_fg, + EINA_RECT(off.x + r->x, off.y + r->y, + r->w, r->h)); + efl_gfx_entity_visible_set(rect->obj_fg, EINA_TRUE); } if (rect->obj) { - evas_object_geometry_set(rect->obj, - off.x + r->x, off.y + r->y, - r->w, r->h); - evas_object_show(rect->obj); + efl_gfx_entity_geometry_set(rect->obj, + EINA_RECT(off.x + r->x, off.y + r->y, + r->w, r->h)); + efl_gfx_entity_visible_set(rect->obj, EINA_TRUE); } l = eina_list_next(l); @@ -3511,23 +3109,24 @@ _update_decorations(Eo *obj) efl_event_thaw(sd->text_obj); } -static void -_deferred_decoration_job(void *data) +static Eina_Value +_deferred_decoration_job(Eo *o, void *data EINA_UNUSED, const Eina_Value value EINA_UNUSED) { - EFL_UI_TEXT_DATA_GET(data, sd); - _update_decorations(data); + EFL_UI_TEXT_DATA_GET(o, sd); + _update_decorations(o); sd->deferred_decoration_job = NULL; + + return EINA_VALUE_EMPTY; } static void _decoration_defer(Eo *obj) { EFL_UI_TEXT_DATA_GET(obj, sd); - if (!sd->deferred_decoration_job) - { - sd->deferred_decoration_job = - ecore_job_add(_deferred_decoration_job, obj); - } + if (sd->deferred_decoration_job) return; + + Eina_Future *f = efl_loop_job(efl_main_loop_get()); + sd->deferred_decoration_job = efl_future_then(obj, f, _deferred_decoration_job); } static void @@ -3635,13 +3234,12 @@ _efl_ui_textbox_selection_changed_cb(void *data, const Efl_Event *event EINA_UNU Eo *obj = data; EFL_UI_TEXT_DATA_GET(obj, sd); _edje_signal_emit(sd, "selection,changed", "efl.text"); - _selection_store(EFL_UI_SELECTION_TYPE_PRIMARY, obj); + _selection_store(EFL_UI_CNP_BUFFER_SELECTION, obj); _selection_defer(obj, sd); } static void -_efl_ui_textbox_move_cb(void *data, Evas *e EINA_UNUSED, - Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED) +_efl_ui_textbox_move_cb(void *data, const Efl_Event *event EINA_UNUSED) { _decoration_defer_all(data); } @@ -3660,20 +3258,162 @@ _efl_ui_textbox_item_factory_get(const Eo *obj EINA_UNUSED, Efl_Ui_Textbox_Data return pd->item_factory; } -/* Efl.Part begin */ +/*Efl.Ui.Scrollable*/ +EOLIAN static Eina_Size2D +_efl_ui_textbox_efl_ui_scrollable_content_size_get(const Eo *obj EINA_UNUSED, Efl_Ui_Textbox_Data *sd) +{ + EINA_SAFETY_ON_NULL_RETURN_VAL(sd->scroller, EINA_SIZE2D(0, 0)); + return efl_ui_scrollable_content_size_get(sd->scroller); +} + +EOLIAN static Eina_Rect +_efl_ui_textbox_efl_ui_scrollable_viewport_geometry_get(const Eo *obj EINA_UNUSED, + Efl_Ui_Textbox_Data *sd) +{ + EINA_SAFETY_ON_NULL_RETURN_VAL(sd->scroller, EINA_RECT_EMPTY()); + return efl_ui_scrollable_viewport_geometry_get(sd->scroller); +} + +EOLIAN static void +_efl_ui_textbox_efl_ui_scrollable_match_content_set(Eo *obj EINA_UNUSED, Efl_Ui_Textbox_Data *sd, Eina_Bool w, Eina_Bool h) +{ + EINA_SAFETY_ON_NULL_RETURN(sd->scroller); + return efl_ui_scrollable_match_content_set(sd->scroller, !!w, !!h); +} -#define STRCMP(X, Y) strncmp((X), (Y), strlen(X)) +EOLIAN static void +_efl_ui_textbox_efl_ui_scrollable_step_size_set(Eo *obj EINA_UNUSED, Efl_Ui_Textbox_Data *sd, Eina_Position2D step) +{ + EINA_SAFETY_ON_NULL_RETURN(sd->scroller); + efl_ui_scrollable_step_size_set(sd->scroller, step); +} + +EOLIAN static Eina_Position2D +_efl_ui_textbox_efl_ui_scrollable_step_size_get(const Eo *obj EINA_UNUSED, Efl_Ui_Textbox_Data *sd) +{ + EINA_SAFETY_ON_NULL_RETURN_VAL(sd->scroller, EINA_POSITION2D(0, 0)); + return efl_ui_scrollable_step_size_get(sd->scroller); +} + +EOLIAN static Eina_Position2D +_efl_ui_textbox_efl_ui_scrollable_content_pos_get(const Eo *obj EINA_UNUSED, Efl_Ui_Textbox_Data *sd) +{ + EINA_SAFETY_ON_NULL_RETURN_VAL(sd->scroller, EINA_POSITION2D(0, 0)); + return efl_ui_scrollable_content_pos_get(sd->scroller); +} + +EOLIAN static void +_efl_ui_textbox_efl_ui_scrollable_content_pos_set(Eo *obj EINA_UNUSED, Efl_Ui_Textbox_Data *sd, Eina_Position2D pos) +{ + EINA_SAFETY_ON_NULL_RETURN(sd->scroller); + efl_ui_scrollable_content_pos_set(sd->scroller, pos); +} + +EOLIAN static Eina_Bool +_efl_ui_textbox_efl_ui_scrollable_scroll_hold_get(const Eo *obj EINA_UNUSED, Efl_Ui_Textbox_Data *sd) +{ + EINA_SAFETY_ON_NULL_RETURN_VAL(sd->scroller, EINA_FALSE); + return efl_ui_scrollable_scroll_hold_get(sd->scroller); +} + +EOLIAN static void +_efl_ui_textbox_efl_ui_scrollable_scroll_hold_set(Eo *obj EINA_UNUSED, Efl_Ui_Textbox_Data *sd, Eina_Bool hold) +{ + EINA_SAFETY_ON_NULL_RETURN(sd->scroller); + efl_ui_scrollable_scroll_hold_set(sd->scroller, !!hold); +} + +EOLIAN static Eina_Bool +_efl_ui_textbox_efl_ui_scrollable_scroll_freeze_get(const Eo *obj EINA_UNUSED, Efl_Ui_Textbox_Data *sd) +{ + EINA_SAFETY_ON_NULL_RETURN_VAL(sd->scroller, EINA_FALSE); + return efl_ui_scrollable_scroll_freeze_get(sd->scroller); +} + +EOLIAN static void +_efl_ui_textbox_efl_ui_scrollable_scroll_freeze_set(Eo *obj EINA_UNUSED, Efl_Ui_Textbox_Data *sd, Eina_Bool freeze) +{ + EINA_SAFETY_ON_NULL_RETURN(sd->scroller); + efl_ui_scrollable_scroll_freeze_set(sd->scroller, !!freeze); +} + +EOLIAN static void +_efl_ui_textbox_efl_ui_scrollable_bounce_enabled_set(Eo *obj EINA_UNUSED, Efl_Ui_Textbox_Data *sd, Eina_Bool horiz, Eina_Bool vert) +{ + EINA_SAFETY_ON_NULL_RETURN(sd->scroller); + efl_ui_scrollable_bounce_enabled_set(sd->scroller, !!horiz, !!vert); +} + +EOLIAN static void +_efl_ui_textbox_efl_ui_scrollable_bounce_enabled_get(const Eo *obj EINA_UNUSED, Efl_Ui_Textbox_Data *sd, Eina_Bool *horiz, Eina_Bool *vert) +{ + EINA_SAFETY_ON_NULL_RETURN(sd->scroller); + efl_ui_scrollable_bounce_enabled_get(sd->scroller, horiz, vert); +} + +EOLIAN static void +_efl_ui_textbox_efl_ui_scrollable_scroll(Eo *obj EINA_UNUSED, Efl_Ui_Textbox_Data *sd, Eina_Rect rect, Eina_Bool animation) +{ + EINA_SAFETY_ON_NULL_RETURN(sd->scroller); + efl_ui_scrollable_scroll(sd->scroller, rect, animation); +} + +EOLIAN static void +_efl_ui_textbox_efl_ui_scrollable_gravity_get(const Eo *obj EINA_UNUSED, Efl_Ui_Textbox_Data *sd, double *x, double *y) +{ + EINA_SAFETY_ON_NULL_RETURN(sd->scroller); + efl_ui_scrollable_gravity_get(sd->scroller, x, y); +} + +EOLIAN static void +_efl_ui_textbox_efl_ui_scrollable_gravity_set(Eo *obj EINA_UNUSED, Efl_Ui_Textbox_Data *sd, double x, double y) +{ + EINA_SAFETY_ON_NULL_RETURN(sd->scroller); + efl_ui_scrollable_gravity_set(sd->scroller, x, y); +} + +EOLIAN static void +_efl_ui_textbox_efl_ui_scrollable_movement_block_set(Eo *obj EINA_UNUSED, Efl_Ui_Textbox_Data *sd, Efl_Ui_Layout_Orientation block) +{ + EINA_SAFETY_ON_NULL_RETURN(sd->scroller); + efl_ui_scrollable_movement_block_set(sd->scroller, block); +} + +EOLIAN static Efl_Ui_Layout_Orientation +_efl_ui_textbox_efl_ui_scrollable_movement_block_get(const Eo *obj EINA_UNUSED, Efl_Ui_Textbox_Data *sd) +{ + EINA_SAFETY_ON_NULL_RETURN_VAL(sd->scroller, EFL_UI_LAYOUT_ORIENTATION_DEFAULT); + return efl_ui_scrollable_movement_block_get(sd->scroller); +} + +EOLIAN static void +_efl_ui_textbox_efl_ui_scrollable_looping_set(Eo *obj EINA_UNUSED, Efl_Ui_Textbox_Data *sd, Eina_Bool loop_h, Eina_Bool loop_v) +{ + EINA_SAFETY_ON_NULL_RETURN(sd->scroller); + efl_ui_scrollable_looping_set(sd->scroller, !!loop_h, !!loop_v); +} + +EOLIAN static void +_efl_ui_textbox_efl_ui_scrollable_looping_get(const Eo *obj EINA_UNUSED, Efl_Ui_Textbox_Data *sd, Eina_Bool *loop_h, Eina_Bool *loop_v) +{ + EINA_SAFETY_ON_NULL_RETURN(sd->scroller); + efl_ui_scrollable_looping_get(sd->scroller, loop_h, loop_v); +} + +/* Efl.Part begin */ static Eina_Bool _efl_ui_textbox_text_set(Eo *obj EINA_UNUSED, Efl_Ui_Textbox_Data *pd, const char *part, const char *text) { - if (!STRCMP("efl.text_guide", part)) + if (!part) return EINA_FALSE; + + if (!strcmp("efl.text_guide", part)) { efl_text_set(pd->text_guide_obj, text); return EINA_TRUE; } - else if (!STRCMP("efl.text", part)) + else if (!strcmp("efl.text", part)) { efl_text_set(pd->text_obj, text); return EINA_TRUE; @@ -3686,11 +3426,13 @@ static const char * _efl_ui_textbox_text_get(Eo *obj EINA_UNUSED, Efl_Ui_Textbox_Data *pd, const char *part) { - if (!STRCMP("efl.text_guide", part)) + if (!part) return NULL; + + if (!strcmp("efl.text_guide", part)) { return efl_text_get(pd->text_guide_obj); } - else if (!STRCMP("efl.text", part)) + else if (!strcmp("efl.text", part)) { return efl_text_get(pd->text_obj); } @@ -3698,48 +3440,24 @@ _efl_ui_textbox_text_get(Eo *obj EINA_UNUSED, Efl_Ui_Textbox_Data *pd, return NULL; } -#undef STRCMP - static Eina_Bool -_part_is_efl_ui_text_part(const Eo *obj EINA_UNUSED, const char *part) +_part_is_efl_ui_textbox_part(const Eo *obj EINA_UNUSED, const char *part) { - //Use Efl.Ui.Widget's "background" and "shadow" parts - if (eina_streq(part, "background") || eina_streq(part, "shadow")) - return EINA_FALSE; + if (eina_streq(part, "efl.text_guide") || eina_streq(part, "efl.text")) + return EINA_TRUE; - return EINA_TRUE; + return EINA_FALSE; } -//FIXME -//ELM_PART_OVERRIDE_PARTIAL(efl_ui_text, EFL_UI_TEXTBOX, Efl_Ui_Textbox_Data, _part_is_efl_ui_text_part) -EOLIAN static Efl_Object * -_efl_ui_textbox_efl_part_part_get(const Eo *obj, Efl_Ui_Textbox_Data *priv EINA_UNUSED, const char *part) -{ - EINA_SAFETY_ON_NULL_RETURN_VAL(part, NULL); - if (_part_is_efl_ui_text_part(obj, part)) return ELM_PART_IMPLEMENT(EFL_UI_TEXT_PART_CLASS, obj, part); - return efl_part_get(efl_super(obj, EFL_UI_TEXTBOX_CLASS), part); -} +/* Standard widget overrides */ -//FIXME -//ELM_PART_OVERRIDE_TEXT_SET(efl_ui_text, EFL_UI_TEXTBOX, Efl_Ui_Textbox_Data) -EOLIAN static void -_efl_ui_text_part_efl_text_text_set(Eo *obj, void *_pd EINA_UNUSED, const char *text) -{ - Elm_Part_Data *pd = efl_data_scope_get(obj, efl_ui_widget_part_class_get()); - Efl_Ui_Textbox_Data *sd = efl_data_scope_get(pd->obj, EFL_UI_TEXTBOX_CLASS); - _efl_ui_textbox_text_set(pd->obj, sd, pd->part, text); -} +ELM_WIDGET_KEY_DOWN_DEFAULT_IMPLEMENT(efl_ui_textbox, Efl_Ui_Textbox_Data) -//FIXME -//ELM_PART_OVERRIDE_TEXT_GET(efl_ui_text, EFL_UI_TEXTBOX, Efl_Ui_Textbox_Data) -EOLIAN static const char * -_efl_ui_text_part_efl_text_text_get(const Eo *obj, void *_pd EINA_UNUSED) -{ - Elm_Part_Data *pd = efl_data_scope_get(obj, efl_ui_widget_part_class_get()); - Efl_Ui_Textbox_Data *sd = efl_data_scope_get(pd->obj, EFL_UI_TEXTBOX_CLASS); - return _efl_ui_textbox_text_get(pd->obj, sd, pd->part); -} -#include "efl_ui_text_part.eo.c" +ELM_PART_OVERRIDE_PARTIAL(efl_ui_textbox, EFL_UI_TEXTBOX, Efl_Ui_Textbox_Data, _part_is_efl_ui_textbox_part) +ELM_PART_OVERRIDE_TEXT_SET(efl_ui_textbox, EFL_UI_TEXTBOX, Efl_Ui_Textbox_Data) +ELM_PART_OVERRIDE_TEXT_GET(efl_ui_textbox, EFL_UI_TEXTBOX, Efl_Ui_Textbox_Data) + +#include "efl_ui_textbox_part.eo.c" /* Efl.Part end */ diff --git a/src/lib/elementary/efl_ui_textbox.eo b/src/lib/elementary/efl_ui_textbox.eo index 9104d436b2..1c63b602a1 100644 --- a/src/lib/elementary/efl_ui_textbox.eo +++ b/src/lib/elementary/efl_ui_textbox.eo @@ -1,62 +1,79 @@ -class @beta Efl.Ui.Textbox extends Efl.Ui.Layout_Base implements Efl.Input.Clickable, - Efl.Access.Text, Efl.Access.Editable.Text, Efl.File, Efl.Input_Text +enum @beta Efl.Ui.Textbox_Cnp_Content { + [[What kind of content can be pasted into this widget using Copy & Paste or Drag & Drop functionality. + + Multiple options can be OR-ed together. + ]] + Nothing = 0, [[Nothing can be pasted or dropped into this widget.]] + Text = 1, [[Plain text can be pasted or dropped into this widget.]] + Markup = 3, [[Markup text can be pasted or dropped into this widget + (This includes Plain text).]] + Image = 4, [[Images can be pasted or dropped into this widget.]] +} + +class Efl.Ui.Textbox extends Efl.Ui.Layout_Base implements Efl.Input.Clickable, + Efl.Access.Text, Efl.Access.Editable.Text, Efl.Ui.Scrollable composites - Efl.Text_Interactive, Efl.Text_Markup + Efl.Text_Interactive, Efl.Text_Markup, Efl.Input_Text.Entity { [[A flexible text widget which can be static (as a label) or editable by the user (as a text entry). It provides all sorts of editing facilities like automatic scrollbars, virtual keyboard, clipboard, configurable - context menus or autocapitalization, for example.]] + context menus or auto-capitalization, for example. + @since 1.24]] methods { @property scrollable { [[Enable or disable scrolling in the widget. When scrolling is enabled scrollbars will appear if the text does - not fit the widget size.]] + not fit the widget size. + + Direct control of the scroll through the @Efl.Ui.Scrollable interface + is only possible when this property is enabled. + ]] set {} get {} values { - scroll: bool; [[$true to enable scrolling. Default is $false.]] + scroll: bool(false); [[$true to enable scrolling.]] } } @property context_menu_enabled { - [[This enables or disables the entry's contextual (longpress) menu.]] + [[This enables or disables the widget's contextual menu, typically + accessible through a long-press or a right-button click. + ]] set { } get { } values { - enabled: bool; [[If $true, the menu is enabled.]] + enabled: bool; [[$true to enable the contextual menu.]] } } - @property cnp_mode { - /* FIXME: Efl.Ui.Selection_Format does not allow markup without images! */ - [[Control pasting of text and images for the widget. - - Normally the entry allows both text and images to be pasted. + @property cnp_dnd_mode @beta { + [[Controls the type of content which can be pasted into the widget. - Note: This only changes the behaviour of text. + By default, both text and images are allowed.. ]] set { } get { } values { - format: Efl.Ui.Selection_Format; [[Format for copy & paste.]] + allowed_formats : Efl.Ui.Textbox_Cnp_Content; [[Allowed content types.]] } } - @property selection_handler_enabled { - [[This enables or disables the entry's selection handlers.]] + @property selection_handles_enabled { + [[This enables or disables the visual handles around selected text, + to allow simpler modification on touch screens.]] set { } get { } values { - enabled: bool; [[If $true, the selection handlers are enabled.]] + enabled: bool; [[$true to enable the selection handles.]] } } - @property item_factory { + @property item_factory @beta { [[The factory that provides item in the text e.g. "emoticon/happy" or "href=file://image.jpg" etc. ]] @@ -64,25 +81,18 @@ class @beta Efl.Ui.Textbox extends Efl.Ui.Layout_Base implements Efl.Input.Click item_factory: Efl.Canvas.Textblock_Factory; [[Factory to create items]] } } - cursor_add { - [[Add cursor that will manipulate and iterate content of the text object. - It is typically more convenient to obtain a cursor directly from the text object using @.cursor_create.]] - params { - cursor: Efl.Text.Cursor; [[Text cursor.]] - } - } cursor_create { [[Creates and returns a new cursor for the text.]] - return: Efl.Text.Cursor @move; [[Text cursor.]] + return: Efl.Text_Cursor.Object @move; [[Text cursor.]] } selection_copy { - [[This executes a "copy" action on the selected text in the entry.]] + [[This executes a "copy" action on the selected text in the widget.]] } selection_paste { - [[This executes a "paste" action in the entry.]] + [[This executes a "paste" action in the widget.]] } selection_cut { - [[This executes a "cut" action on the selected text in the entry.]] + [[This executes a "cut" action on the selected text in the widget.]] } } implements { @@ -94,18 +104,15 @@ class @beta Efl.Ui.Textbox extends Efl.Ui.Layout_Base implements Efl.Input.Click Efl.Gfx.Entity.size { set; } Efl.Canvas.Group.group_member_add; Efl.Canvas.Group.group_calculate; - Efl.Layout.Signal.signal_callback_add; - Efl.Layout.Signal.signal_callback_del; - Efl.Layout.Signal.signal_emit; Efl.Ui.Widget.on_access_activate; Efl.Ui.Widget.theme_apply; + Efl.Ui.Widget.widget_input_event_handler; Efl.Ui.Focus.Object.on_focus_update; Efl.Ui.Widget.interest_region { get; } Efl.Ui.Widget.disabled {set;} Efl.Text_Format.password {set;} - //Efl.Ui.Widget.widget_sub_object_del; - //Elm.Interface_Scrollable.policy { set; } - //Elm.Interface_Scrollable.bounce_allow { set; } + Efl.Text_Format.multiline {set;} + Efl.Text_Style.text_color { set; } Efl.Access.Object.state_set { get; } Efl.Access.Object.i18n_name { get; } Efl.Access.Text.access_text { get; } @@ -130,11 +137,20 @@ class @beta Efl.Ui.Textbox extends Efl.Ui.Layout_Base implements Efl.Input.Click Efl.Access.Editable.Text.cut; Efl.Access.Editable.Text.delete; Efl.Access.Editable.Text.paste; - Efl.File.file { set; } - Efl.File.load; - Efl.File.unload; Efl.Text_Interactive.editable { set; } Efl.Part.part_get; + Efl.Ui.Scrollable.content_pos { set; get; } + Efl.Ui.Scrollable.content_size{ get; } + Efl.Ui.Scrollable.viewport_geometry{ get; } + Efl.Ui.Scrollable.bounce_enabled { set; get; } + Efl.Ui.Scrollable.scroll_freeze { get; set; } + Efl.Ui.Scrollable.scroll_hold { get; set; } + Efl.Ui.Scrollable.looping { get; set; } + Efl.Ui.Scrollable.movement_block { get; set; } + Efl.Ui.Scrollable.gravity { get; set; } + Efl.Ui.Scrollable.match_content { set; } + Efl.Ui.Scrollable.step_size { set; get; } + Efl.Ui.Scrollable.scroll; } events { selection,paste: void; [[Called when selection is pasted.]] diff --git a/src/lib/elementary/efl_ui_textbox_part.eo b/src/lib/elementary/efl_ui_textbox_part.eo new file mode 100644 index 0000000000..e05e89e525 --- /dev/null +++ b/src/lib/elementary/efl_ui_textbox_part.eo @@ -0,0 +1,8 @@ +class @beta Efl.Ui.Textbox_Part extends Efl.Ui.Layout_Part_Text +{ + [[Efl UI Textbox internal part class]] + data: null; + implements { + Efl.Text.text { set; get; } + } +} diff --git a/src/lib/elementary/efl_ui_textpath.c b/src/lib/elementary/efl_ui_textpath.c index a3bac40522..6638de5456 100644 --- a/src/lib/elementary/efl_ui_textpath.c +++ b/src/lib/elementary/efl_ui_textpath.c @@ -15,6 +15,8 @@ #define MY_CLASS EFL_UI_TEXTPATH_CLASS #define MY_CLASS_NAME "Efl.Ui.Textpath" +#define LEGACY_TEXT_PART_NAME "elm.text" +#define EFL_UI_TEXT_PART_NAME "efl.text" #define SLICE_DEFAULT_NO 99 typedef struct _Efl_Ui_Textpath_Point Efl_Ui_Textpath_Point; @@ -54,6 +56,7 @@ struct _Efl_Ui_Textpath_Data { Evas_Object *text_obj; char *text; + Eina_Strbuf *user_style; Efl_Gfx_Path *path; struct { double x, y; @@ -66,10 +69,10 @@ struct _Efl_Ui_Textpath_Data Eina_Inlist *segments; int total_length; - Ecore_Job *draw_text_job; #ifdef EFL_UI_TEXTPATH_LINE_DEBUG Eina_List *lines; #endif + Eina_Bool need_redraw : 1; Eina_Bool circular : 1; //TODO: Remove this flag when elm_textpath_circle_set() is removed. }; @@ -82,12 +85,6 @@ _rad_to_deg(double rad) return 180 * rad / M_PI; } -static inline double -_deg_to_rad(double angle) -{ - return angle / 180 * M_PI; -} - static void _segment_draw(Efl_Ui_Textpath_Data *pd, int slice_no, double dt, double dist, int w1, int cmp, Evas_Map *map, Eina_Bezier bezier, @@ -97,7 +94,6 @@ _segment_draw(Efl_Ui_Textpath_Data *pd, int slice_no, double dt, double dist, double u0, u1, v0, v1; double t; double px, py, px2, py2; - double rad; Eina_Rect r; Eina_Vector2 vec, nvec, vec0, vec1, vec2, vec3; Eina_Matrix2 mat; @@ -107,9 +103,7 @@ _segment_draw(Efl_Ui_Textpath_Data *pd, int slice_no, double dt, double dist, #endif r = efl_gfx_entity_geometry_get(pd->text_obj); - - rad = _deg_to_rad(90); - eina_matrix2_values_set(&mat, cos(rad), -sin(rad), sin(rad), cos(rad)); + eina_matrix2_values_set(&mat, 0.0, -1.0, 1.0, 0.0); eina_bezier_values_get(&bezier, NULL, NULL, NULL, NULL, NULL, NULL, &px2, &py2); t = 0; @@ -270,7 +264,7 @@ static void _text_on_line_draw(Efl_Ui_Textpath_Data *pd, int w1, int w2, int cmp, Evas_Map *map, Efl_Ui_Textpath_Line line) { double x1, x2, y1, y2; - double line_len, len, sina, cosa; + double line_len_2, line_len, len, sina, cosa; Eina_Rect r; x1 = line.start.x; @@ -278,15 +272,17 @@ _text_on_line_draw(Efl_Ui_Textpath_Data *pd, int w1, int w2, int cmp, Evas_Map * x2 = line.end.x; y2 = line.end.y; - line_len = sqrt((x2 - x1)*(x2 - x1) + (y2 - y1)*(y2 - y1)); + line_len_2 = (x2 - x1)*(x2 - x1) + (y2 - y1)*(y2 - y1); len = w2 - w1; - if (line_len > len) + if (line_len_2 > (len * len)) { + line_len = sqrt(line_len_2); x2 = x1 + len * (x2 - x1) / line_len; y2 = y1 + len * (y2 - y1) / line_len; + line_len_2 = (x2 - x1)*(x2 - x1) + (y2 - y1)*(y2 - y1); } - len = sqrt((x2 - x1)*(x2 - x1) + (y2 - y1)*(y2 - y1)); + len = sqrt(line_len_2); sina = (y2 - y1) / len; cosa = (x2 - x1) / len; @@ -329,9 +325,8 @@ _map_point_calc(Efl_Ui_Textpath_Data *pd) } static void -_text_draw(void *data) +_text_draw(Efl_Ui_Textpath_Data *pd) { - Efl_Ui_Textpath_Data *pd = data; Efl_Ui_Textpath_Segment *seg; Evas_Map *map; int w1, w2; @@ -399,7 +394,13 @@ _text_draw(void *data) evas_object_map_set(pd->text_obj, map); evas_map_free(map); - pd->draw_text_job = NULL; + pd->need_redraw = EINA_FALSE; +} + +static void +_render_pre_cb(void *data, Evas *e EINA_UNUSED, void *ev EINA_UNUSED) +{ + _text_draw(data); } static void @@ -523,18 +524,44 @@ _path_data_get(Eo *obj, Efl_Ui_Textpath_Data *pd) static void _sizing_eval(Efl_Ui_Textpath_Data *pd) { - ecore_job_del(pd->draw_text_job); - pd->draw_text_job = ecore_job_add(_text_draw, pd); + pd->need_redraw = EINA_TRUE; } static void -_textpath_ellipsis_set(Efl_Ui_Textpath_Data *pd, Eina_Bool enabled) +_textpath_ellipsis_set(Eo *obj, Efl_Ui_Textpath_Data *pd, Eina_Bool enabled) { - edje_object_part_text_style_user_pop(pd->text_obj, "efl.text"); + char *text_part; + if (elm_widget_is_legacy(obj)) + text_part = LEGACY_TEXT_PART_NAME; + else + text_part = EFL_UI_TEXT_PART_NAME; + + edje_object_part_text_style_user_pop(pd->text_obj, text_part); if (enabled) - edje_object_part_text_style_user_push(pd->text_obj, "efl.text", - "DEFAULT='ellipsis=1.0'"); + { + if (pd->user_style) + { + eina_strbuf_replace_first(pd->user_style, "DEFAULT='", "DEFAULT='ellipsis=1.0 "); + edje_object_part_text_style_user_push(pd->text_obj, text_part, + eina_strbuf_string_get(pd->user_style)); + } + else + { + edje_object_part_text_style_user_push(pd->text_obj, text_part, + "DEFAULT='ellipsis=1.0 '"); + return; + } + } + else + { + if (pd->user_style) + { + eina_strbuf_replace_first(pd->user_style, "DEFAULT='ellipsis=1.0 ", "DEFAULT='"); + edje_object_part_text_style_user_push(pd->text_obj, text_part, + eina_strbuf_string_get(pd->user_style)); + } + } } static void @@ -562,7 +589,7 @@ _ellipsis_set(Efl_Ui_Textpath_Data *pd, Eo *obj) } } efl_gfx_entity_size_set(pd->text_obj, EINA_SIZE2D(w, h)); - _textpath_ellipsis_set(pd, is_ellipsis); + _textpath_ellipsis_set(obj, pd, is_ellipsis); } static void @@ -615,7 +642,7 @@ _path_start_angle_adjust(Eo *obj, Efl_Ui_Textpath_Data *pd) eina_vector2_normalize(&first, &first); eina_vector2_normalize(&last, &last); rad = acos(eina_vector2_dot_product(&first, &last)); - if (rad == 0) return; + if (EINA_DBL_EQ(rad, 0)) return; offset_angle = _rad_to_deg(rad); if (r.w > pd->total_length / 2) @@ -698,22 +725,26 @@ _efl_ui_textpath_efl_object_constructor(Eo *obj, Efl_Ui_Textpath_Data *pd) pd->slice_no = SLICE_DEFAULT_NO; pd->direction = EFL_UI_TEXTPATH_DIRECTION_CW; + evas_event_callback_add(evas_object_evas_get(obj), EVAS_CALLBACK_RENDER_PRE, _render_pre_cb, pd); + return obj; } EOLIAN static void _efl_ui_textpath_efl_object_destructor(Eo *obj, Efl_Ui_Textpath_Data *pd) { + evas_event_callback_del_full(evas_object_evas_get(obj), EVAS_CALLBACK_RENDER_PRE, _render_pre_cb, pd); + Efl_Ui_Textpath_Segment *seg; if (pd->text) free(pd->text); if (pd->text_obj) evas_object_del(pd->text_obj); + if (pd->user_style) eina_strbuf_free(pd->user_style); EINA_INLIST_FREE(pd->segments, seg) { pd->segments = eina_inlist_remove(pd->segments, EINA_INLIST_GET(seg)); free(seg); } - ecore_job_del(pd->draw_text_job); #ifdef EFL_UI_TEXTPATH_LINE_DEBUG Evas_Object *line; @@ -844,8 +875,8 @@ _efl_ui_textpath_circular_set(Eo *obj, Efl_Ui_Textpath_Data *pd, double radius, Eina_Size2D text_size; double sweep_length, x, y; - if (pd->circle.radius == radius && - pd->circle.start_angle == start_angle && + if (EINA_DBL_EQ(pd->circle.radius, radius) && + EINA_DBL_EQ(pd->circle.start_angle, start_angle) && pd->direction == direction && _map_point_calc(pd) > 0) return; @@ -977,9 +1008,9 @@ elm_textpath_circle_set(Eo *obj, double x, double y, double radius, double start EFL_UI_TEXTPATH_DATA_GET(obj, pd); if (!pd) return; - if (pd->circle.x == x && pd->circle.y == y && - pd->circle.radius == radius && - pd->circle.start_angle == start_angle && + if (EINA_DBL_EQ(pd->circle.x, x) && EINA_DBL_EQ(pd->circle.y, y) && + EINA_DBL_EQ(pd->circle.radius, radius) && + EINA_DBL_EQ(pd->circle.start_angle, start_angle) && pd->direction == direction && _map_point_calc(pd) > 0) return; @@ -1009,5 +1040,37 @@ elm_textpath_circle_set(Eo *obj, double x, double y, double radius, double start efl_gfx_hint_size_restricted_min_set(obj, EINA_SIZE2D(x * 2, y * 2)); } +EAPI void +elm_textpath_text_user_style_set(Eo *obj, const char *style) +{ + EFL_UI_TEXTPATH_DATA_GET(obj, pd); + if (!pd) return; + + char *text_part; + if (elm_widget_is_legacy(obj)) + text_part = LEGACY_TEXT_PART_NAME; + else + text_part = EFL_UI_TEXT_PART_NAME; + + if (pd->user_style) + { + edje_object_part_text_style_user_pop(pd->text_obj, text_part); + eina_strbuf_free(pd->user_style); + pd->user_style = NULL; + } + + if (style) + { + pd->user_style = eina_strbuf_new(); + eina_strbuf_append(pd->user_style, style); + + edje_object_part_text_style_user_pop(pd->text_obj, text_part); + edje_object_part_text_style_user_push(pd->text_obj, text_part, eina_strbuf_string_get(pd->user_style)); + } + + _ellipsis_set(pd, obj); + _sizing_eval(pd); +} + #include "efl_ui_textpath_legacy_eo.c" diff --git a/src/lib/elementary/efl_ui_textpath_legacy_eo.h b/src/lib/elementary/efl_ui_textpath_legacy_eo.h index 9a721634b1..88962c270c 100644 --- a/src/lib/elementary/efl_ui_textpath_legacy_eo.h +++ b/src/lib/elementary/efl_ui_textpath_legacy_eo.h @@ -20,7 +20,7 @@ typedef Eo Efl_Ui_Textpath_Legacy; */ #define EFL_UI_TEXTPATH_LEGACY_CLASS efl_ui_textpath_legacy_class_get() -EWAPI const Efl_Class *efl_ui_textpath_legacy_class_get(void); +EWAPI const Efl_Class *efl_ui_textpath_legacy_class_get(void) EINA_CONST; #endif /* EFL_BETA_API_SUPPORT */ #endif diff --git a/src/lib/elementary/efl_ui_timepicker.c b/src/lib/elementary/efl_ui_timepicker.c index 335e26230e..9dfcd89b14 100644 --- a/src/lib/elementary/efl_ui_timepicker.c +++ b/src/lib/elementary/efl_ui_timepicker.c @@ -71,6 +71,10 @@ _field_value_update(Eo *obj) efl_ui_range_value_set(pd->hour, pd->cur_time[TIMEPICKER_HOUR]); } } + else + { + efl_ui_range_value_set(pd->hour, pd->cur_time[TIMEPICKER_HOUR]); + } efl_ui_range_value_set(pd->min, pd->cur_time[TIMEPICKER_MIN]); @@ -86,14 +90,14 @@ _field_changed_cb(void *data, const Efl_Event *ev) if (ev->object == pd->hour) { pd->cur_time[TIMEPICKER_HOUR] = efl_ui_range_value_get(pd->hour); - if (!pd->is_24hour && !strcmp(efl_text_get(pd->ampm), "PM")) + if (!pd->is_24hour && eina_streq(efl_text_get(pd->ampm), "PM")) pd->cur_time[TIMEPICKER_HOUR] += 12; } else if (ev->object == pd->min) pd->cur_time[TIMEPICKER_MIN] = efl_ui_range_value_get(pd->min); else { - if (!strcmp(efl_text_get(pd->ampm), "PM")) + if (eina_streq(efl_text_get(pd->ampm), "PM")) { efl_text_set(pd->ampm, "AM"); pd->cur_time[TIMEPICKER_HOUR] -= 12; @@ -112,12 +116,6 @@ _field_changed_cb(void *data, const Efl_Event *ev) static void _fields_init(Eo *obj) { - const char *fmt; - char ch; - int i; - int field = 0; - char buf[FMT_LEN_MAX]; - Efl_Ui_Timepicker_Data *pd = efl_data_scope_get(obj, MY_CLASS); //Field create. @@ -147,6 +145,25 @@ _fields_init(Eo *obj) _field_value_update(obj); +} + + +EOLIAN static Eina_Error +_efl_ui_timepicker_efl_ui_widget_theme_apply(Eo *obj, Efl_Ui_Timepicker_Data *pd) +{ + const char *fmt; + char ch; + int i; + char buf[FMT_LEN_MAX]; + int field = 0; + Eina_Error ret = EFL_UI_THEME_APPLY_ERROR_NONE; + + ret = efl_ui_widget_theme_apply(efl_super(obj, MY_CLASS)); + + if (ret != EFL_UI_THEME_APPLY_ERROR_NONE) + goto end; + + fmt = efl_datetime_manager_format_get(pd->dt_manager); if (!fmt) { @@ -171,7 +188,8 @@ _fields_init(Eo *obj) else { //TODO: monitoring locale change and update field location. - if (field == 0) + //FIXME: disabled this code, as it caused issues, see T8546 + /*if (field == 0) { elm_object_signal_emit(obj, "efl,colon_field1,visible,on", "efl"); elm_object_signal_emit(obj, "efl,colon_field0,visible,off", "efl"); @@ -182,8 +200,11 @@ _fields_init(Eo *obj) elm_object_signal_emit(obj, "efl,colon_field1,visible,off", "efl"); } - elm_layout_signal_emit(obj, "efl,ampm,visible,on", "efl"); - edje_object_message_signal_process(elm_layout_edje_get(obj)); + if (pd->is_24hour) + elm_layout_signal_emit(obj, "efl,ampm,visible,off", "efl"); + else + elm_layout_signal_emit(obj, "efl,ampm,visible,on", "efl"); + edje_object_message_signal_process(elm_layout_edje_get(obj));*/ efl_content_set(efl_part(obj, buf), pd->ampm); } @@ -193,8 +214,12 @@ _fields_init(Eo *obj) } fmt++; } +end: + return ret; } + + EOLIAN static Eo * _efl_ui_timepicker_efl_object_constructor(Eo *obj, Efl_Ui_Timepicker_Data *pd EINA_UNUSED) { @@ -204,12 +229,6 @@ _efl_ui_timepicker_efl_object_constructor(Eo *obj, Efl_Ui_Timepicker_Data *pd EI elm_widget_theme_klass_set(obj, "timepicker"); obj = efl_constructor(efl_super(obj, MY_CLASS)); - if (elm_widget_theme_object_set(obj, wd->resize_obj, - elm_widget_theme_klass_get(obj), - elm_widget_theme_element_get(obj), - elm_widget_theme_style_get(obj)) == EFL_UI_THEME_APPLY_ERROR_GENERIC) - CRI("Failed to set layout!"); - _fields_init(obj); elm_widget_can_focus_set(obj, EINA_TRUE); @@ -250,10 +269,17 @@ _efl_ui_timepicker_is_24hour_set(Eo *obj, Efl_Ui_Timepicker_Data *pd, Eina_Bool if (pd->is_24hour == is_24hour) return; pd->is_24hour = is_24hour; - if (pd->is_24hour == EINA_TRUE) - elm_layout_signal_emit(obj, "efl,ampm,visible,off", "efl"); + if (!pd->is_24hour) + { + efl_ui_widget_disabled_set(pd->ampm, EINA_FALSE); + efl_ui_range_limits_set(pd->hour, 1, 12); + } else - elm_layout_signal_emit(obj, "efl,ampm,visible,on", "efl"); + { + efl_ui_widget_disabled_set(pd->ampm, EINA_TRUE); + efl_ui_range_limits_set(pd->hour, 0, 23); + } + _field_value_update(obj); } diff --git a/src/lib/elementary/efl_ui_timepicker.eo b/src/lib/elementary/efl_ui_timepicker.eo index d7aa8fcc23..9ced109efb 100644 --- a/src/lib/elementary/efl_ui_timepicker.eo +++ b/src/lib/elementary/efl_ui_timepicker.eo @@ -40,6 +40,7 @@ class Efl.Ui.Timepicker extends Efl.Ui.Layout_Base implements { Efl.Object.constructor; Efl.Object.destructor; + Efl.Ui.Widget.theme_apply; } events { time,changed: void; [[Called when time is changed]] diff --git a/src/lib/elementary/efl_ui_vg_animation.c b/src/lib/elementary/efl_ui_vg_animation.c new file mode 100644 index 0000000000..7801d54654 --- /dev/null +++ b/src/lib/elementary/efl_ui_vg_animation.c @@ -0,0 +1,1592 @@ +#ifdef HAVE_CONFIG_H +# include "elementary_config.h" +#endif + +#define EFL_ACCESS_OBJECT_PROTECTED +#define EFL_PART_PROTECTED + +#include <Elementary.h> + +#include "elm_priv.h" +#include "efl_ui_vg_animation_private.h" +#include "efl_ui_vg_animation_part.eo.h" +#include "elm_part_helper.h" + +#define MY_CLASS EFL_UI_VG_ANIMATION_CLASS + +#define MY_CLASS_NAME "Efl_Ui_Vg_Animation" + +#define GROW_SIZE 50 +#define QUEUE_SIZE 350 +#define T_SEGMENT_N 30 +#define C_SEGMENT_N 30 + + +static const char SIG_FOCUSED[] = "focused"; +static const char SIG_UNFOCUSED[] = "unfocused"; +static const char SIG_PLAY_START[] = "play,start"; +static const char SIG_PLAY_REPEAT[] = "play,repeat"; +static const char SIG_PLAY_DONE[] = "play,done"; +static const char SIG_PLAY_PAUSE[] = "play,pause"; +static const char SIG_PLAY_RESUME[] = "play,resume"; +static const char SIG_PLAY_STOP[] = "play,stop"; +static const char SIG_PLAY_UPDATE[] = "play,update"; + +/* smart callbacks coming from Efl_Ui_Vg_Animation objects: */ +static const Evas_Smart_Cb_Description _smart_callbacks[] = { + {SIG_FOCUSED, ""}, + {SIG_UNFOCUSED, ""}, + {SIG_WIDGET_LANG_CHANGED, ""}, /**< handled by elm_widget */ + {SIG_PLAY_START, ""}, + {SIG_PLAY_REPEAT, ""}, + {SIG_PLAY_DONE, ""}, + {SIG_PLAY_PAUSE, ""}, + {SIG_PLAY_RESUME, ""}, + {SIG_PLAY_STOP, ""}, + {NULL, NULL} +}; + +typedef struct +{ + Eina_Stringshare *part; + Eo *obj; + Eo *proxy; + const Efl_VG *node; +} Efl_Ui_Vg_Animation_Sub_Obj_Data; + +typedef struct +{ + float x1, x2; + float y; +} Efl_Ui_Vg_Animation_Span_Data; + +typedef struct +{ + float x, y; +} Efl_Ui_Vg_Animation_Point; + +static Eo * +_proxy_create(Eo *source) +{ + Eo *proxy = efl_add(EFL_CANVAS_PROXY_CLASS, source); + if (!proxy) return NULL; + + efl_gfx_fill_auto_set(proxy, EINA_TRUE); + efl_canvas_proxy_source_clip_set(proxy, EINA_FALSE); + efl_canvas_proxy_source_set(proxy, source); + + efl_gfx_entity_visible_set(proxy, EINA_FALSE); + efl_gfx_entity_visible_set(source, EINA_FALSE); + + return proxy; +} + +static void +_proxy_map_disable(Efl_Ui_Vg_Animation_Data *pd) +{ + Eina_List *l; + Efl_Ui_Vg_Animation_Sub_Obj_Data *sub_d; + + EINA_LIST_FOREACH(pd->subs, l, sub_d) + { + if (!sub_d->proxy) continue; + if (efl_gfx_mapping_has(sub_d->proxy)) + efl_gfx_mapping_reset(sub_d->proxy); + + //TODO: remove this call + evas_object_map_enable_set(sub_d->proxy, EINA_FALSE); + } +} + +static Efl_VG * +_node_get(Efl_VG *node, const char *part) +{ + if (!node) return NULL; + + if (!efl_isa(node, EFL_CANVAS_VG_CONTAINER_CLASS)) return NULL; + + char *name = efl_key_data_get(node, "_lot_node_name"); + + //Find the target recursiveldy + if (!name || strcmp(name, part)) + { + Eina_Iterator *itr = efl_canvas_vg_container_children_get(node); + Efl_VG *child; + Efl_VG *ret; + + EINA_ITERATOR_FOREACH(itr, child) + { + if (efl_isa(child, EFL_CANVAS_VG_CONTAINER_CLASS)) + { + ret = _node_get(child, part); + if (ret) return ret; + } + } + return NULL; + } + + //Find Shape + Eina_Iterator *itr = efl_canvas_vg_container_children_get(node); + Efl_VG *child; + const Efl_Gfx_Path_Command_Type *cmd; + + EINA_ITERATOR_FOREACH(itr, child) + { + //Filter out unacceptable types + if (!efl_isa(child, EFL_CANVAS_VG_SHAPE_CLASS)) continue; + if (efl_gfx_shape_stroke_width_get(child) > 0) continue; + efl_gfx_path_get(child, &cmd, NULL); + if (!cmd) continue; + return child; + } + return NULL; +} + +static Eina_Bool +_part_draw(Efl_Ui_Vg_Animation_Sub_Obj_Data *sub_d, Eina_Position2D offset, Eina_Size2D tsize) +{ + const Efl_Gfx_Path_Command_Type *cmd, *tcmd; + const double *points; + int alpha, inarray_idx, inarray_size, i, pt_idx = 0, pt_cnt = 0; + double x, y; + Eina_Bezier bezier; + float t, min_y = 99999999, max_y = -1; + float inv_segment = (1 / (float) C_SEGMENT_N); + float u_segment, v_segment, x1_segment, x2_segment; + double begin_x = 0, begin_y = 0, end_x = 0, end_y = 0; + double ctrl[4]; + Eina_Inarray *inarray; + Efl_Ui_Vg_Animation_Point *pt, *pt2; + Eo *target = sub_d->proxy; + Eina_Bool fast_path = EINA_TRUE; + + efl_gfx_path_get(sub_d->node, &cmd, &points); + if (!cmd) return EINA_FALSE; + + efl_gfx_entity_visible_set(target, EINA_TRUE); +// efl_gfx_path_bounds_get(sub_d->node, &tbound); + efl_gfx_color_get(sub_d->node, NULL, NULL, NULL, &alpha); + efl_gfx_entity_size_set(target, tsize); + + //TODO: Optimize it, scalable or not? + efl_gfx_entity_size_set(sub_d->obj, tsize); + + //Fast Path? Shape outlines by consisted of straight lines. + tcmd = cmd; + if (*tcmd != EFL_GFX_PATH_COMMAND_TYPE_MOVE_TO) fast_path = EINA_FALSE; + else + { + ++tcmd; + while (*tcmd == EFL_GFX_PATH_COMMAND_TYPE_LINE_TO) + { + ++tcmd; + if (++pt_cnt > 4) + { + fast_path = EINA_FALSE; + break; + } + } + + if ((pt_cnt != 4) || + (((*tcmd) != EFL_GFX_PATH_COMMAND_TYPE_END) && ((*tcmd) != EFL_GFX_PATH_COMMAND_TYPE_CLOSE))) + fast_path = EINA_FALSE; + } + + pt_idx = 0; + + //Fast Path: Rectangle Mapping + if (fast_path) + { + efl_gfx_mapping_point_count_set(target, pt_cnt); + + //Point + efl_gfx_mapping_coord_absolute_set(target, 1, points[0] + offset.x, points[1] + offset.y, 0); + efl_gfx_mapping_coord_absolute_set(target, 2, points[2] + offset.x, points[3] + offset.y, 0); + efl_gfx_mapping_coord_absolute_set(target, 3, points[4] + offset.x, points[5] + offset.y, 0); + efl_gfx_mapping_coord_absolute_set(target, 0, points[6] + offset.x, points[7] + offset.y, 0); + + //Color + efl_gfx_mapping_color_set(target, 0, alpha, alpha, alpha, alpha); + efl_gfx_mapping_color_set(target, 1, alpha, alpha, alpha, alpha); + efl_gfx_mapping_color_set(target, 2, alpha, alpha, alpha, alpha); + efl_gfx_mapping_color_set(target, 3, alpha, alpha, alpha, alpha); + + //UV + efl_gfx_mapping_uv_set(target, 0, 0, 0); + efl_gfx_mapping_uv_set(target, 1, tsize.w, 0); + efl_gfx_mapping_uv_set(target, 2, tsize.w, tsize.h); + efl_gfx_mapping_uv_set(target, 3, 0, tsize.h); + + return EINA_TRUE; + } + + //Case 2. Arbitrary Geometry mapping + inarray = eina_inarray_new(sizeof(Efl_Ui_Vg_Animation_Point), GROW_SIZE); + if (!inarray) return EINA_FALSE; + eina_inarray_resize(inarray, QUEUE_SIZE); + inarray_size = QUEUE_SIZE; + inarray_idx = 0; + + //end 0, move 1, line 2, cubic 3, close 4 + while (*cmd != EFL_GFX_PATH_COMMAND_TYPE_END) + { + if (*cmd == EFL_GFX_PATH_COMMAND_TYPE_MOVE_TO) + { + begin_x = points[pt_idx++] + offset.x; + begin_y = points[pt_idx++] + offset.y; + if (begin_y < min_y) min_y = begin_y; + if (begin_y > max_y) max_y = begin_y; + ++cmd; + continue; + } + else if (*cmd == EFL_GFX_PATH_COMMAND_TYPE_CUBIC_TO) + { + + ctrl[0] = points[pt_idx++] + offset.x; + ctrl[1] = points[pt_idx++] + offset.y; + ctrl[2] = points[pt_idx++] + offset.x; + ctrl[3] = points[pt_idx++] + offset.y; + end_x = points[pt_idx++] + offset.x; + end_y = points[pt_idx++] + offset.y; + + eina_bezier_values_set(&bezier, + begin_x, begin_y, + ctrl[0], ctrl[1], ctrl[2], ctrl[3], + end_x, end_y); + + for (i = 0; i < C_SEGMENT_N; ++i) + { + if (inarray_idx >= inarray_size) + { + inarray_size += GROW_SIZE; + eina_inarray_grow(inarray, inarray_size); + } + + t = inv_segment * (float) i; + eina_bezier_point_at(&bezier, t, &x, &y); + pt = eina_inarray_nth(inarray, inarray_idx); + pt->x = x; + pt->y = y; + + if (y < min_y) min_y = y; + if (y > max_y) max_y = y; + + ++inarray_idx; + } + } + else if (*cmd == EFL_GFX_PATH_COMMAND_TYPE_LINE_TO) + { + end_x = points[pt_idx++] + offset.x; + end_y = points[pt_idx++] + offset.y; + + for (i = 0; i < C_SEGMENT_N; ++i) + { + if (inarray_idx >= inarray_size) + { + inarray_size += GROW_SIZE; + eina_inarray_grow(inarray, inarray_size); + } + + t = inv_segment * (float) i; + pt = eina_inarray_nth(inarray, inarray_idx); + pt->x = begin_x + ((double) (end_x - begin_x)) * t; + pt->y = begin_y + ((double) (end_y - begin_y)) * t; + ++inarray_idx; + } + } + + begin_x = end_x; + begin_y = end_y; + + if (end_y < min_y) min_y = end_y; + if (end_y > max_y) max_y = end_y; + + ++cmd; + } + + if (inarray_idx >= inarray_size) + { + inarray_size += 1; + eina_inarray_grow(inarray, inarray_size); + } + pt = eina_inarray_nth(inarray, inarray_idx); + pt2 = eina_inarray_nth(inarray, 0); + pt->x = pt2->x; + pt->y = pt2->y; + + float y_segment = (max_y - min_y) * inv_segment; + Efl_Ui_Vg_Animation_Span_Data spans[T_SEGMENT_N + 1]; + float min_x, max_x; + float a, b; + + y = min_y; + + for (int i = 0; i <= T_SEGMENT_N; ++i) + { + min_x = 999999; + max_x = -1; + + for (int j = 0; j < inarray_idx; ++j) + { + pt = eina_inarray_nth(inarray, j); + pt2 = pt + 1; + + //Horizontal Line + if ((fabs(y - pt->y) < 0.5) && + (fabs(pt->y - pt2->y) < 0.5)) + { + if (pt->x < min_x) min_x = pt->x; + if (pt->x > max_x) max_x = pt->x; + if (pt2->x < min_x) min_x = pt2->x; + if (pt2->x > max_x) max_x = pt2->x; + continue; + } + + //Out of Y range + if (((y < pt->y) && (y < pt2->y)) || + ((y > pt->y) && (y > pt2->y))) + continue; + + //Vertical Line + if (fabs(pt2->x - pt2->x) < 0.5) + x = pt->x; + //Diagonal Line + else + { + a = (pt2->y - pt->y) / (pt2->x - pt->x); + b = pt->y - (a * pt->x); + x = (y - b) / a; + } + + if (x < min_x) min_x = x; + if (x > max_x) max_x = x; + } + spans[i].x1 = min_x; + spans[i].x2 = max_x; + spans[i].y = y; + y += y_segment; +#if 0 + static Eo *lines[T_SEGMENT_N + 1]; + if (!lines[i]) lines[i] = evas_object_line_add(evas_object_evas_get(target)); + evas_object_color_set(lines[i], 255, 255, 255, 255); + evas_object_resize(lines[i], 1000, 1000); + evas_object_line_xy_set(lines[i], spans[i].x1, spans[i].y, spans[i].x2, spans[i].y); + evas_object_show(lines[i]); +#endif + } + + u_segment = ((float) tsize.w) / ((float) T_SEGMENT_N); + v_segment = ((float) tsize.h) / ((float) T_SEGMENT_N); + + Evas_Map *map = evas_map_new(T_SEGMENT_N * T_SEGMENT_N * 4); + pt_idx = 0; +// efl_gfx_mapping_point_count_set(target, (4 * T_SEGMENT_N * T_SEGMENT_N)); + + for (int i = 0; i < T_SEGMENT_N; ++i) + { + x1_segment = (spans[i].x2 - spans[i].x1) / ((float) T_SEGMENT_N); + x2_segment = (spans[i + 1].x2 - spans[i + 1].x1) / ((float) T_SEGMENT_N); + + for (int j = 0; j < T_SEGMENT_N; ++j) + { +#if 0 + //Point + efl_gfx_mapping_coord_absolute_set(target, pt_idx + 0, spans[i].x1 + ((float) j) * x1_segment, spans[i].y, 0); + efl_gfx_mapping_coord_absolute_set(target, pt_idx + 1, spans[i].x1 + ((float) j + 1) * x1_segment, spans[i].y, 0); + efl_gfx_mapping_coord_absolute_set(target, pt_idx + 2, spans[i + 1].x1 + ((float) j + 1) * x2_segment, spans[i + 1].y, 0); + efl_gfx_mapping_coord_absolute_set(target, pt_idx + 3, spans[i + 1].x1 + ((float) j) * x2_segment, spans[i + 1].y, 0); + + //UV + efl_gfx_mapping_uv_set(target, pt_idx + 0, ((float) j) * u_segment, ((float) i) * v_segment); + efl_gfx_mapping_uv_set(target, pt_idx + 1, ((float) j + 1) * u_segment, ((float) i) * v_segment); + efl_gfx_mapping_uv_set(target, pt_idx + 2, ((float) j + 1) * u_segment, ((float) i + 1) * v_segment); + efl_gfx_mapping_uv_set(target, pt_idx + 3, ((float) j) * u_segment, ((float) i + 1) * v_segment); + + //Color + efl_gfx_mapping_color_set(target, pt_idx + 0, alpha, alpha, alpha, alpha); + efl_gfx_mapping_color_set(target, pt_idx + 1, alpha, alpha, alpha, alpha); + efl_gfx_mapping_color_set(target, pt_idx + 2, alpha, alpha, alpha, alpha); + efl_gfx_mapping_color_set(target, pt_idx + 3, alpha, alpha, alpha, alpha); +#endif + evas_map_point_coord_set(map, pt_idx + 0, spans[i].x1 + ((float) j) * x1_segment, spans[i].y, 0); + evas_map_point_coord_set(map, pt_idx + 1, spans[i].x1 + ((float) j + 1) * x1_segment, spans[i].y, 0); + evas_map_point_coord_set(map, pt_idx + 2, spans[i + 1].x1 + ((float) j + 1) * x2_segment, spans[i + 1].y, 0); + evas_map_point_coord_set(map, pt_idx + 3, spans[i + 1].x1 + ((float) j) * x2_segment, spans[i + 1].y, 0); + + evas_map_point_image_uv_set(map, pt_idx + 0, ((float) j) * u_segment, ((float) i) * v_segment); + evas_map_point_image_uv_set(map, pt_idx + 1, ((float) j + 1) * u_segment, ((float) i) * v_segment); + evas_map_point_image_uv_set(map, pt_idx + 2, ((float) j + 1) * u_segment, ((float) i + 1) * v_segment); + evas_map_point_image_uv_set(map, pt_idx + 3, ((float) j) * u_segment, ((float) i + 1) * v_segment); + + evas_map_point_color_set(map, pt_idx + 0, alpha, alpha, alpha, alpha); + evas_map_point_color_set(map, pt_idx + 1, alpha, alpha, alpha, alpha); + evas_map_point_color_set(map, pt_idx + 2, alpha, alpha, alpha, alpha); + evas_map_point_color_set(map, pt_idx + 3, alpha, alpha, alpha, alpha); + + pt_idx += 4; + } + } + evas_object_map_enable_set(target, EINA_TRUE); + evas_object_map_set(target, map); + + evas_map_free(map); + eina_inarray_free(inarray); + + return EINA_TRUE; +} + +static void +_update_part_contents(Eo *obj, Efl_Ui_Vg_Animation_Data *pd) +{ + if (!pd->subs) return; + + //TODO: Update to current frame's node tree immediately. + + Efl_VG *root = evas_object_vg_root_node_get(pd->vg); + if (!root) return; + + Eina_List *l; + Eina_Position2D pos = efl_gfx_entity_position_get(pd->vg); + Efl_Ui_Vg_Animation_Sub_Obj_Data *sub_d; + Eina_Size2D tsize = efl_gfx_entity_size_get(obj); + + EINA_LIST_FOREACH(pd->subs, l, sub_d) + { + if (!sub_d->node) + sub_d->node = _node_get(root, sub_d->part); + + if (sub_d->node) + _part_draw(sub_d, pos, tsize); + else + ERR("part(%s) is invalid in Efl_Ui_Vg_Animation(%p)", sub_d->part, obj); + } +} + +static void +_frame_set_facade(Eo *obj, Efl_Ui_Vg_Animation_Data *pd, int frame) +{ + int pframe = evas_object_vg_animated_frame_get(pd->vg); + evas_object_vg_animated_frame_set(pd->vg, frame); + if (pframe != frame) _update_part_contents(obj, pd); +} + +static void +_eo_unparent_helper(Eo *child, Eo *parent) +{ + if (efl_parent_get(child) == parent) + efl_parent_set(child, evas_object_evas_get(parent)); +} + +static void +_on_sub_object_size_hint_change(void *data, + Evas *e EINA_UNUSED, + Evas_Object *obj EINA_UNUSED, + void *event_info EINA_UNUSED) +{ + if (!efl_alive_get(data)) return; + ELM_WIDGET_DATA_GET_OR_RETURN(data, wd); + efl_canvas_group_change(data); + //TODO: Update part contents +} + +static void +_sizing_eval(Eo *obj, void *data) +{ + Efl_Ui_Vg_Animation_Data *pd = data; + if (!efl_file_loaded_get(obj)) return; + + double hw,hh; + efl_gfx_hint_weight_get(obj, &hw, &hh); + + Eina_Size2D size = efl_canvas_vg_object_default_size_get(pd->vg); + + Eina_Size2D min = {-1, -1}; + if (EINA_DBL_EQ(hw, 0)) min.w = size.w; + if (EINA_DBL_EQ(hh, 0)) min.h = size.h; + + efl_gfx_hint_size_min_set(obj, min); +} + +static void +_size_hint_event_cb(void *data, const Efl_Event *event) +{ + _sizing_eval(event->object, data); +} + +static void +_transit_go_facade(Eo* obj, Efl_Ui_Vg_Animation_Data *pd) +{ + Eina_Bool playing = EINA_TRUE; + pd->repeat_times = 0; + if (pd->playing_reverse) + pd->state = EFL_UI_VG_ANIMATION_STATE_PLAYING_BACKWARDS; + else + pd->state = EFL_UI_VG_ANIMATION_STATE_PLAYING; + if (elm_widget_is_legacy(obj)) + evas_object_smart_callback_call(obj, SIG_PLAY_START, NULL); + else + efl_event_callback_call(obj, EFL_PLAYER_EVENT_PLAYING_CHANGED, &playing); + if (pd->transit) elm_transit_go(pd->transit);} + +static Eina_Bool +_visible_check(Eo *obj) +{ + if (!efl_gfx_entity_visible_get(obj)) return EINA_FALSE; + + //TODO: Check Smart parents visibilities? + + Eina_Size2D size = efl_gfx_entity_size_get(obj); + if (size.w == 0 || size.h == 0) return EINA_FALSE; + + Evas_Coord output_w, output_h; + evas_output_size_get(evas_object_evas_get(obj), &output_w, &output_h); + + Eina_Position2D pos = efl_gfx_entity_position_get(obj); + + //Outside viewport + if ((pos.x + size.w < 0) || (pos.x > output_w) || + (pos.y + size.h < 0) || (pos.y > output_h)) + return EINA_FALSE; + + //Inside viewport + return EINA_TRUE; +} + +static void +_autoplay(Eo *obj, Efl_Ui_Vg_Animation_Data *pd, Eina_Bool vis) +{ + if (!pd->autoplay || !pd->transit) return; + + //Resume Animation + if (vis) + { + if (pd->state == EFL_UI_VG_ANIMATION_STATE_PAUSED && pd->autoplay_pause) + { + Eina_Bool paused = EINA_FALSE; + elm_transit_paused_set(pd->transit, EINA_FALSE); + if (pd->playing_reverse) + pd->state = EFL_UI_VG_ANIMATION_STATE_PLAYING_BACKWARDS; + else + pd->state = EFL_UI_VG_ANIMATION_STATE_PLAYING; + pd->autoplay_pause = EINA_FALSE; + if (elm_widget_is_legacy(obj)) + evas_object_smart_callback_call(obj, SIG_PLAY_RESUME, NULL); + else + efl_event_callback_call(obj, EFL_PLAYER_EVENT_PAUSED_CHANGED, &paused); + } + } + //Pause Animation + else + { + Eina_Bool paused = EINA_TRUE; + if ((pd->state == EFL_UI_VG_ANIMATION_STATE_PLAYING) || + (pd->state == EFL_UI_VG_ANIMATION_STATE_PLAYING_BACKWARDS)) + { + elm_transit_paused_set(pd->transit, EINA_TRUE); + pd->state = EFL_UI_VG_ANIMATION_STATE_PAUSED; + pd->autoplay_pause = EINA_TRUE; + if (elm_widget_is_legacy(obj)) + evas_object_smart_callback_call(obj, SIG_PLAY_PAUSE, NULL); + else + efl_event_callback_call(obj, EFL_PLAYER_EVENT_PAUSED_CHANGED, &paused); + } + } +} + +static void +_transit_del_cb(Elm_Transit_Effect *effect, Elm_Transit *transit) +{ + Eo *obj = (Eo *) effect; + EFL_UI_VG_ANIMATION_DATA_GET(obj, pd); + if (!pd) return; + + if ((pd->state == EFL_UI_VG_ANIMATION_STATE_PLAYING && EINA_DBL_EQ(pd->progress, 1)) || + (pd->state == EFL_UI_VG_ANIMATION_STATE_PLAYING_BACKWARDS && EINA_DBL_EQ(pd->progress, 0))) + { + if (elm_widget_is_legacy(obj)) + evas_object_smart_callback_call(obj, SIG_PLAY_DONE, NULL); + else + efl_event_callback_call(obj, EFL_PLAYER_EVENT_PLAYBACK_FINISHED, NULL); + } + + if (pd->transit != transit) return; + + Efl_Ui_Vg_Animation_State prev_state = pd->state; + pd->state = EFL_UI_VG_ANIMATION_STATE_STOPPED; + pd->transit = NULL; + pd->autoplay_pause = EINA_FALSE; + + if (prev_state != EFL_UI_VG_ANIMATION_STATE_STOPPED) + { + Eina_Bool playing = EINA_FALSE; + if (elm_widget_is_legacy(obj)) + evas_object_smart_callback_call(obj, SIG_PLAY_STOP, NULL); + else + efl_event_callback_call(obj, EFL_PLAYER_EVENT_PLAYING_CHANGED, &playing); + pd->progress = 0; + } +} + +static void +_transit_cb(Elm_Transit_Effect *effect, Elm_Transit *transit, double progress) +{ + Eo *obj = (Eo *) effect; + EFL_UI_VG_ANIMATION_DATA_GET(obj, pd); + + if (!pd || !pd->vg) + { + ERR("Vector Object is removed in wrong way!, Efl_Ui_Vg_Animation = %p", obj); + elm_transit_del(transit); + return; + } + if (pd->playback_direction_changed) + { + elm_transit_progress_value_set(pd->transit, 1 - progress); + progress = 1 - progress ; + + if (pd->playback_speed <= 0) pd->playing_reverse = EINA_TRUE; + else pd->playing_reverse = EINA_FALSE; + + pd->playback_direction_changed = EINA_FALSE; + } + + if (pd->playing_reverse) + { + pd->state = EFL_UI_VG_ANIMATION_STATE_PLAYING_BACKWARDS; + progress = 1 - progress; + } + else pd->state = EFL_UI_VG_ANIMATION_STATE_PLAYING; + + pd->progress = progress; + int minframe = (pd->frame_cnt - 1) * pd->min_progress; + int maxframe = (pd->frame_cnt - 1) * pd->max_progress; + + int update_frame = (int)((maxframe - minframe) * progress) + minframe; + int current_frame = evas_object_vg_animated_frame_get(pd->vg); + + if (EINA_DBL_EQ(pd->playback_speed, 0)) + update_frame = current_frame; + + _frame_set_facade(obj, pd, update_frame); + + if (pd->loop) + { + int repeat_times = elm_transit_current_repeat_times_get(pd->transit); + if (pd->repeat_times != repeat_times) + { + if (elm_widget_is_legacy(obj)) + evas_object_smart_callback_call(obj, SIG_PLAY_REPEAT, NULL); + else + efl_event_callback_call(obj, EFL_PLAYER_EVENT_PLAYBACK_REPEATED, &repeat_times); + pd->repeat_times = repeat_times; + } + } + + //transit_cb is always called with a progress value 0 ~ 1. + //SIG_PLAY_UPDATE callback is called only when there is a real change. + if (update_frame == current_frame) return; + if (elm_widget_is_legacy(obj)) + evas_object_smart_callback_call(obj, SIG_PLAY_UPDATE, NULL); + else + { + double position = pd->frame_duration * pd->progress; + efl_event_callback_call(obj, EFL_PLAYER_EVENT_PLAYBACK_POSITION_CHANGED, &position); + efl_event_callback_call(obj, EFL_PLAYER_EVENT_PLAYBACK_PROGRESS_CHANGED, &pd->progress); + } +} + +EOLIAN static void +_efl_ui_vg_animation_efl_canvas_group_group_add(Eo *obj, Efl_Ui_Vg_Animation_Data *priv) +{ + efl_canvas_group_add(efl_super(obj, MY_CLASS)); + elm_widget_sub_object_parent_add(obj); + + // Create vg to render vector animation + Eo *vg = evas_object_vg_add(evas_object_evas_get(obj)); + elm_widget_resize_object_set(obj, vg); + efl_event_callback_add(obj, EFL_GFX_ENTITY_EVENT_HINTS_CHANGED, _size_hint_event_cb, priv); + + priv->vg = vg; + priv->playback_speed = 1; + priv->frame_duration = 0; + priv->min_progress = 0.0; + priv->max_progress = 1.0; +} + +EOLIAN static void +_efl_ui_vg_animation_efl_canvas_group_group_del(Eo *obj, Efl_Ui_Vg_Animation_Data *pd EINA_UNUSED) +{ + if (pd->transit) + { + Elm_Transit *transit = pd->transit; + pd->transit = NULL; //Skip perform transit_del_cb() + elm_transit_del(transit); + } + pd->state = EFL_UI_VG_ANIMATION_STATE_NOT_READY; + + efl_canvas_group_del(efl_super(obj, MY_CLASS)); +} + +EOLIAN static void +_efl_ui_vg_animation_efl_object_destructor(Eo *obj, + Efl_Ui_Vg_Animation_Data *pd EINA_UNUSED) +{ + Efl_Gfx_Vg_Value_Provider *vp; + EINA_LIST_FREE(pd->vp_list, vp) + efl_unref(vp); + eina_list_free(pd->vp_list); + + efl_destructor(efl_super(obj, MY_CLASS)); +} + +EOLIAN static Eo * +_efl_ui_vg_animation_efl_object_constructor(Eo *obj, + Efl_Ui_Vg_Animation_Data *pd EINA_UNUSED) +{ + obj = efl_constructor(efl_super(obj, MY_CLASS)); + evas_object_smart_callbacks_descriptions_set(obj, _smart_callbacks); + + return obj; +} + +static void +_update_frame_duration(Efl_Ui_Vg_Animation_Data *pd) +{ + int frame_count = evas_object_vg_animated_frame_count_get(pd->vg); + int min_frame = (frame_count - 1) * pd->min_progress; + int max_frame = (frame_count - 1) * pd->max_progress; + double frame_rate = round((double)frame_count / evas_object_vg_animated_frame_duration_get(pd->vg, 0, 0)); + double speed = pd->playback_speed < 0 ? pd->playback_speed * -1 : pd->playback_speed; + + pd->frame_duration = (double)(max_frame - min_frame) / frame_rate; + if (pd->transit) + elm_transit_duration_set(pd->transit, EINA_DBL_NONZERO(speed) ? pd->frame_duration * (1 / speed) : 0); +} + +static Eina_Bool +_ready_play(Eo *obj, Efl_Ui_Vg_Animation_Data *pd) +{ + pd->autoplay_pause = EINA_FALSE; + pd->state = EFL_UI_VG_ANIMATION_STATE_STOPPED; + + if (pd->transit) elm_transit_del(pd->transit); + + pd->frame_cnt = (double) evas_object_vg_animated_frame_count_get(pd->vg); + pd->frame_duration = evas_object_vg_animated_frame_duration_get(pd->vg, 0, 0); + _frame_set_facade(obj, pd, 0); + + if (pd->frame_duration > 0) + { + double speed = pd->playback_speed < 0 ? pd->playback_speed * -1 : pd->playback_speed; + Elm_Transit *transit = elm_transit_add(); + elm_transit_object_add(transit, obj); + if (pd->loop) elm_transit_repeat_times_set(transit, -1); + elm_transit_effect_add(transit, _transit_cb, obj, _transit_del_cb); + elm_transit_progress_value_set(transit, pd->progress); + elm_transit_objects_final_state_keep_set(transit, EINA_TRUE); + elm_transit_event_enabled_set(transit, EINA_TRUE); + pd->transit = transit; + if (EINA_DBL_NONZERO(pd->min_progress) || !EINA_DBL_EQ(pd->max_progress, 1.0)) + _update_frame_duration(pd); + else + elm_transit_duration_set(transit, EINA_DBL_NONZERO(speed) ? pd->frame_duration * (1 / speed) : 0); + + return EINA_TRUE; + } + return EINA_FALSE; +} + +EOLIAN static void +_efl_ui_vg_animation_efl_file_unload(Eo *obj EINA_UNUSED, Efl_Ui_Vg_Animation_Data *pd) +{ + pd->state = EFL_UI_VG_ANIMATION_STATE_NOT_READY; + pd->frame_cnt = 0; + pd->frame_duration = 0; + if (pd->transit) elm_transit_del(pd->transit); + + //Remove all part exising contents + Efl_Ui_Vg_Animation_Sub_Obj_Data *sub_d; + Eo *content; + Eina_List *l, *ll; + + EINA_LIST_FOREACH_SAFE(pd->subs, l, ll, sub_d) + { + content = sub_d->obj; + + /* sub_d will die in _widget_sub_object_del */ + if (!_elm_widget_sub_object_redirect_to_top(obj, content)) + { + ERR("could not remove sub object %p from %p", content, obj); + continue; + } + _eo_unparent_helper(content, obj); + } +} + +EOLIAN static Eina_Error +_efl_ui_vg_animation_efl_file_load(Eo *obj, Efl_Ui_Vg_Animation_Data *pd) +{ + Eina_Error err; + Eina_Bool ret; + const char *file; + const char *key; + + if (efl_file_loaded_get(obj)) return 0; + + err = efl_file_load(efl_super(obj, MY_CLASS)); + if (err) return err; + + file = efl_file_get(obj); + key = efl_file_key_get(obj); + ret = efl_file_simple_load(pd->vg, file, key); + if (!ret) + { + efl_file_unload(obj); + return eina_error_get(); + } + + pd->progress = 0; + + _sizing_eval(obj, pd); + + if (!_ready_play(obj, pd)) return 1; + + if (pd->autoplay) + { + _transit_go_facade(obj, pd); + + if (!_visible_check(obj)) + { + Eina_Bool paused = EINA_TRUE; + elm_transit_paused_set(pd->transit, EINA_TRUE); + pd->state = EFL_UI_VG_ANIMATION_STATE_PAUSED; + pd->autoplay_pause = EINA_TRUE; + if (elm_widget_is_legacy(obj)) + evas_object_smart_callback_call(obj, SIG_PLAY_PAUSE, NULL); + else + efl_event_callback_call(obj, EFL_PLAYER_EVENT_PAUSED_CHANGED, &paused); + } + } + return 0; +} + +EOLIAN static void +_efl_ui_vg_animation_efl_gfx_entity_position_set(Eo *obj, + Efl_Ui_Vg_Animation_Data *pd, + Eina_Position2D pos EINA_UNUSED) +{ + if (_evas_object_intercept_call(obj, EVAS_OBJECT_INTERCEPT_CB_MOVE, 0, pos.x, pos.y)) + return; + + efl_gfx_entity_position_set(efl_super(obj, MY_CLASS), pos); + + Eina_Bool vis = _visible_check(obj); + if (!vis) _proxy_map_disable(pd); + _autoplay(obj, pd, vis); +} + +EOLIAN static void +_efl_ui_vg_animation_efl_gfx_entity_size_set(Eo *obj, + Efl_Ui_Vg_Animation_Data *pd, + Eina_Size2D size) +{ + if (_evas_object_intercept_call(obj, EVAS_OBJECT_INTERCEPT_CB_RESIZE, 0, size.w, size.h)) + return; + + efl_gfx_entity_size_set(efl_super(obj, MY_CLASS), size); + + _sizing_eval(obj, pd); + + _autoplay(obj, pd, _visible_check(obj)); +} + +EOLIAN static void +_efl_ui_vg_animation_efl_gfx_entity_visible_set(Eo *obj, + Efl_Ui_Vg_Animation_Data *pd, + Eina_Bool vis) +{ + if (_evas_object_intercept_call(obj, EVAS_OBJECT_INTERCEPT_CB_VISIBLE, 0, vis)) + return; + + efl_gfx_entity_visible_set(efl_super(obj, MY_CLASS), vis); + + vis = _visible_check(obj); + if (!vis) _proxy_map_disable(pd); + _autoplay(obj, pd, vis); +} + +EOLIAN static void +_efl_ui_vg_animation_efl_gfx_view_view_size_set(Eo *obj EINA_UNUSED, + Efl_Ui_Vg_Animation_Data *pd, + Eina_Size2D size) +{ + Eina_Rect viewbox; + viewbox.x = viewbox.y =0; + viewbox.w = size.w; + viewbox.h = size.h; + + efl_canvas_vg_object_viewbox_set(pd->vg, viewbox); +} + +EOLIAN Eina_Size2D +_efl_ui_vg_animation_efl_gfx_view_view_size_get(const Eo *obj EINA_UNUSED, + Efl_Ui_Vg_Animation_Data *pd) +{ + Eina_Rect viewbox = efl_canvas_vg_object_viewbox_get(pd->vg); + + return EINA_SIZE2D(viewbox.w, viewbox.h); +} + +EOLIAN static void +_efl_ui_vg_animation_efl_player_playback_loop_set(Eo *obj EINA_UNUSED, Efl_Ui_Vg_Animation_Data *pd, Eina_Bool loop) +{ + if (pd->loop == loop) return; + pd->loop = loop; + if (pd->transit) + { + if (loop) elm_transit_repeat_times_set(pd->transit, -1); + else elm_transit_repeat_times_set(pd->transit, 0); + } +} + +EOLIAN static Eina_Bool +_efl_ui_vg_animation_efl_player_playback_loop_get(const Eo *obj EINA_UNUSED, Efl_Ui_Vg_Animation_Data *pd) +{ + return pd->loop; +} + +EOLIAN static void +_efl_ui_vg_animation_efl_player_autoplay_set(Eo *obj EINA_UNUSED, Efl_Ui_Vg_Animation_Data *pd, + Eina_Bool autoplay) +{ + pd->autoplay = autoplay; + if (!autoplay) pd->autoplay_pause = EINA_FALSE; +} + +EOLIAN static Eina_Bool +_efl_ui_vg_animation_efl_player_autoplay_get(const Eo *obj EINA_UNUSED, Efl_Ui_Vg_Animation_Data *pd) +{ + return pd->autoplay; +} + +Eina_Bool _efl_ui_vg_animation_playing_sector(Eo *obj, Efl_Ui_Vg_Animation_Data *pd, const char *start, const char *end) +{ + int start_frame = 0; + int end_frame = evas_object_vg_animated_frame_count_get(pd->vg) - 1; + + if (start && end) + { + efl_gfx_frame_controller_sector_get(pd->vg, start, &start_frame, NULL); + efl_gfx_frame_controller_sector_get(pd->vg, end, &end_frame, NULL); + } + else + { + if (start) + { + efl_gfx_frame_controller_sector_get(pd->vg, start, &start_frame, &end_frame); + } + else if (end) + { + efl_gfx_frame_controller_sector_get(pd->vg, end, &end_frame, NULL); + } + } + + efl_ui_vg_animation_min_frame_set(obj, start_frame); + if (start_frame < end_frame) + efl_ui_vg_animation_max_frame_set(obj, end_frame); + + if (!efl_player_playing_set(obj, EINA_TRUE)) + return EINA_FALSE; + return EINA_TRUE; +} + +Eina_Bool +_playing_stop(Eo* obj, Efl_Ui_Vg_Animation_Data *pd) +{ + Eina_Bool playing = EINA_FALSE; + if (!pd->transit) return EINA_FALSE; + + if ((pd->state == EFL_UI_VG_ANIMATION_STATE_NOT_READY) || + (pd->state == EFL_UI_VG_ANIMATION_STATE_STOPPED)) + return EINA_FALSE; + + _frame_set_facade(obj, pd, 0); + + pd->progress = 0; + pd->state = EFL_UI_VG_ANIMATION_STATE_STOPPED; + if (elm_widget_is_legacy(obj)) + evas_object_smart_callback_call(obj, SIG_PLAY_STOP, NULL); + else + efl_event_callback_call(obj, EFL_PLAYER_EVENT_PLAYING_CHANGED, &playing); + + elm_transit_del(pd->transit); + return EINA_TRUE; +} + +EOLIAN static void +_efl_ui_vg_animation_frame_set(Eo *obj EINA_UNUSED, Efl_Ui_Vg_Animation_Data *pd, int frame_num) +{ + efl_player_playback_progress_set(obj, (double) frame_num / (double) (evas_object_vg_animated_frame_count_get(pd->vg) - 1)); +} + +EOLIAN static int +_efl_ui_vg_animation_frame_get(const Eo *obj EINA_UNUSED, Efl_Ui_Vg_Animation_Data *pd) +{ + double progress = (pd->progress * (pd->max_progress - pd->min_progress)) + pd->min_progress; + return (int) ((double) (evas_object_vg_animated_frame_count_get(pd->vg) - 1) * progress); +} + +EOLIAN static Eina_Size2D +_efl_ui_vg_animation_default_view_size_get(const Eo *obj EINA_UNUSED, + Efl_Ui_Vg_Animation_Data *pd EINA_UNUSED) +{ + return efl_canvas_vg_object_default_size_get(pd->vg); +} + +EOLIAN static Efl_Ui_Vg_Animation_State +_efl_ui_vg_animation_state_get(const Eo *obj EINA_UNUSED, Efl_Ui_Vg_Animation_Data *pd) +{ + return pd->state; +} + +EOLIAN static int +_efl_ui_vg_animation_frame_count_get(const Eo *obj EINA_UNUSED, Efl_Ui_Vg_Animation_Data *pd) +{ + return efl_gfx_frame_controller_frame_count_get(pd->vg); +} + +EOLIAN static void +_efl_ui_vg_animation_min_progress_set(Eo *obj EINA_UNUSED, Efl_Ui_Vg_Animation_Data *pd, double min_progress) +{ + if (min_progress < 0.0 || min_progress > 1.0 || min_progress > pd->max_progress) return; + + pd->min_progress = min_progress; + _update_frame_duration(pd); +} + +EOLIAN static double +_efl_ui_vg_animation_min_progress_get(const Eo *obj EINA_UNUSED, Efl_Ui_Vg_Animation_Data *pd) +{ + return pd->min_progress; +} + +EOLIAN static void +_efl_ui_vg_animation_max_progress_set(Eo *obj EINA_UNUSED, Efl_Ui_Vg_Animation_Data *pd, double max_progress) +{ + if (max_progress < 0.0 || max_progress > 1.0 || max_progress < pd->min_progress) return; + + pd->max_progress = max_progress; + _update_frame_duration(pd); +} + +EOLIAN static double +_efl_ui_vg_animation_max_progress_get(const Eo *obj EINA_UNUSED, Efl_Ui_Vg_Animation_Data *pd) +{ + return pd->max_progress; +} + +EOLIAN static void +_efl_ui_vg_animation_min_frame_set(Eo *obj EINA_UNUSED, Efl_Ui_Vg_Animation_Data *pd, int min_frame) +{ + int frame_count = evas_object_vg_animated_frame_count_get(pd->vg); + if (min_frame < 0) min_frame = 0; + else + { + int max_frame = (frame_count - 1) * pd->max_progress; + if (min_frame > max_frame) min_frame = max_frame; + } + + pd->min_progress = (double)min_frame / (double)(frame_count - 1); + _update_frame_duration(pd); +} + +EOLIAN static int +_efl_ui_vg_animation_min_frame_get(const Eo *obj EINA_UNUSED, Efl_Ui_Vg_Animation_Data *pd) +{ + return pd->min_progress * (evas_object_vg_animated_frame_count_get(pd->vg) - 1); +} + +EOLIAN static void +_efl_ui_vg_animation_max_frame_set(Eo *obj EINA_UNUSED, Efl_Ui_Vg_Animation_Data *pd, int max_frame) +{ + int frame_count = evas_object_vg_animated_frame_count_get(pd->vg); + if (max_frame > frame_count - 1) max_frame = frame_count - 1; + else + { + int min_frame = (frame_count - 1) * pd->min_progress; + if (min_frame > max_frame) max_frame = min_frame; + } + + pd->max_progress = (double)max_frame / (double)(frame_count - 1); + _update_frame_duration(pd); +} + +EOLIAN static int +_efl_ui_vg_animation_max_frame_get(const Eo *obj EINA_UNUSED, Efl_Ui_Vg_Animation_Data *pd) +{ + return pd->max_progress * (evas_object_vg_animated_frame_count_get(pd->vg) - 1); +} + +EOLIAN static Efl_Object * +_efl_ui_vg_animation_efl_part_part_get(const Eo* obj, Efl_Ui_Vg_Animation_Data *pd EINA_UNUSED, const char *part) +{ + return ELM_PART_IMPLEMENT(EFL_UI_VG_ANIMATION_PART_CLASS, obj, part); +} + +EOLIAN static Eina_Bool +_efl_ui_vg_animation_efl_ui_widget_widget_sub_object_add(Eo *obj, Efl_Ui_Vg_Animation_Data *pd EINA_UNUSED, Evas_Object *sobj) +{ + Eina_Bool int_ret = EINA_FALSE; + + if (evas_object_data_get(sobj, "elm-parent") == obj) return EINA_TRUE; + + int_ret = elm_widget_sub_object_add(efl_super(obj, MY_CLASS), sobj); + if (!int_ret) return EINA_FALSE; + + evas_object_event_callback_add + (sobj, EVAS_CALLBACK_CHANGED_SIZE_HINTS, + _on_sub_object_size_hint_change, obj); + + return EINA_TRUE; +} + +EOLIAN static Eina_Bool +_efl_ui_vg_animation_efl_ui_widget_widget_sub_object_del(Eo *obj, Efl_Ui_Vg_Animation_Data *pd, Evas_Object *sobj) +{ + Eina_List *l; + Efl_Ui_Vg_Animation_Sub_Obj_Data *sub_d; + Eina_Bool int_ret = EINA_FALSE; + + ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd, EINA_FALSE); + + evas_object_event_callback_del_full + (sobj, EVAS_CALLBACK_CHANGED_SIZE_HINTS, + _on_sub_object_size_hint_change, obj); + + int_ret = elm_widget_sub_object_del(efl_super(obj, MY_CLASS), sobj); + if (!int_ret) return EINA_FALSE; +// if (pd->destructed_is) return EINA_TRUE; + + EINA_LIST_FOREACH(pd->subs, l, sub_d) + { + if (sub_d->obj != sobj) continue; + pd->subs = eina_list_remove_list(pd->subs, l); + if (sub_d->proxy) efl_del(sub_d->proxy); + eina_stringshare_del(sub_d->part); + free(sub_d); + break; + } + + // No need to resize object during destruction + if (wd->resize_obj && efl_alive_get(obj)) + efl_canvas_group_change(obj); + + return EINA_TRUE; +} + +EOLIAN static void +_efl_ui_vg_animation_value_provider_override(Eo *obj EINA_UNUSED, Efl_Ui_Vg_Animation_Data *pd, Efl_Gfx_Vg_Value_Provider *value_provider) +{ + if (!value_provider) return; + + if (pd->vp_list) + { + const char *keypath1 = efl_gfx_vg_value_provider_keypath_get(value_provider); + if (!keypath1) + { + ERR("Couldn't override Value Provider(%p). Keypath is NULL.", value_provider); + return; + } + const Eina_List *l; + Efl_Gfx_Vg_Value_Provider *_vp; + EINA_LIST_FOREACH(pd->vp_list, l, _vp) + { + const char *keypath2 = efl_gfx_vg_value_provider_keypath_get(_vp); + if (!strcmp(keypath1, keypath2)) + { + pd->vp_list = eina_list_remove(pd->vp_list, _vp); + efl_unref(_vp); + break; + } + } + } + + efl_ref(value_provider); + pd->vp_list = eina_list_append(pd->vp_list, value_provider); + efl_key_data_set(pd->vg, "_vg_value_providers", pd->vp_list); +} + +EOLIAN static Eina_Bool +_efl_ui_vg_animation_efl_player_playing_set(Eo *obj, Efl_Ui_Vg_Animation_Data *pd, Eina_Bool playing) +{ + if (playing) + { + if ((pd->state == EFL_UI_VG_ANIMATION_STATE_PLAYING && pd->playback_speed > 0) + || (pd->state == EFL_UI_VG_ANIMATION_STATE_PLAYING_BACKWARDS && pd->playback_speed <= 0)) + return EINA_FALSE; + + Eina_Bool rewind = EINA_FALSE; + if ((pd->state == EFL_UI_VG_ANIMATION_STATE_PLAYING && pd->playback_speed <= 0) + || (pd->state == EFL_UI_VG_ANIMATION_STATE_PLAYING_BACKWARDS && pd->playback_speed > 0)) + rewind = EINA_TRUE; + + if (pd->playback_speed <= 0) + pd->playing_reverse = EINA_TRUE; + else + pd->playing_reverse = EINA_FALSE; + pd->autoplay_pause = EINA_FALSE; + + + if (!efl_file_loaded_get(obj)) return EINA_FALSE; + if (!pd->transit && !_ready_play(obj, pd)) return EINA_FALSE; + + + if (pd->state == EFL_UI_VG_ANIMATION_STATE_STOPPED) + { + if (pd->playing_reverse && EINA_DBL_EQ(pd->progress, 0)) pd->progress = 1.0; + _transit_go_facade(obj, pd); + } + else if (rewind) + { + elm_transit_progress_value_set(pd->transit, pd->playing_reverse ? 1 - pd->progress : pd->progress); + pd->playback_direction_changed = EINA_FALSE; + } + } + else + { + return _playing_stop(obj, pd); + } + return EINA_TRUE; +} + +EOLIAN static Eina_Bool +_efl_ui_vg_animation_efl_player_playing_get(const Eo *obj EINA_UNUSED, Efl_Ui_Vg_Animation_Data *pd) +{ + if (pd->state == EFL_UI_VG_ANIMATION_STATE_PLAYING) + return EINA_TRUE; + return EINA_FALSE; +} + +EOLIAN static Eina_Bool +_efl_ui_vg_animation_efl_player_paused_set(Eo *obj EINA_UNUSED, Efl_Ui_Vg_Animation_Data *pd, Eina_Bool paused) +{ + paused = !!paused; + if (paused) + { + if ((pd->state == EFL_UI_VG_ANIMATION_STATE_PLAYING) || + (pd->state == EFL_UI_VG_ANIMATION_STATE_PLAYING_BACKWARDS)) + { + elm_transit_paused_set(pd->transit, paused); + pd->state = EFL_UI_VG_ANIMATION_STATE_PAUSED; + pd->autoplay_pause = EINA_FALSE; + if (elm_widget_is_legacy(obj)) + evas_object_smart_callback_call(obj, SIG_PLAY_PAUSE, NULL); + else + efl_event_callback_call(obj, EFL_PLAYER_EVENT_PAUSED_CHANGED, &paused); + } + } + else + { + if (pd->transit && pd->state == EFL_UI_VG_ANIMATION_STATE_PAUSED) + { + elm_transit_paused_set(pd->transit, paused); + if (pd->playing_reverse) + pd->state = EFL_UI_VG_ANIMATION_STATE_PLAYING_BACKWARDS; + else + pd->state = EFL_UI_VG_ANIMATION_STATE_PLAYING; + pd->autoplay_pause = EINA_FALSE; + if (elm_widget_is_legacy(obj)) + evas_object_smart_callback_call(obj, SIG_PLAY_RESUME, NULL); + else + efl_event_callback_call(obj, EFL_PLAYER_EVENT_PAUSED_CHANGED, &paused); + } + } + return EINA_TRUE; +} + +EOLIAN static Eina_Bool +_efl_ui_vg_animation_efl_player_paused_get(const Eo *obj EINA_UNUSED, Efl_Ui_Vg_Animation_Data *pd) +{ + if (pd->state == EFL_UI_VG_ANIMATION_STATE_PAUSED) + return EINA_TRUE; + return EINA_FALSE; +} + +EOLIAN static void +_efl_ui_vg_animation_efl_player_playback_position_set(Eo *obj, Efl_Ui_Vg_Animation_Data *pd, double sec) +{ + EINA_SAFETY_ON_TRUE_RETURN(sec < 0); + EINA_SAFETY_ON_TRUE_RETURN(sec > pd->frame_duration); + + efl_player_playback_progress_set(obj, EINA_DBL_NONZERO(pd->frame_duration) ? sec / pd->frame_duration : 0); +} + +EOLIAN static double +_efl_ui_vg_animation_efl_player_playback_position_get(const Eo *obj EINA_UNUSED, Efl_Ui_Vg_Animation_Data *pd) +{ + return pd->frame_duration * pd->progress; +} + +EOLIAN static double +_efl_ui_vg_animation_efl_player_playback_progress_get(const Eo *obj EINA_UNUSED, Efl_Ui_Vg_Animation_Data *pd) +{ + return pd->progress; +} + +EOLIAN static void +_efl_ui_vg_animation_efl_player_playback_progress_set(Eo *obj EINA_UNUSED, Efl_Ui_Vg_Animation_Data *pd, double progress) +{ + if (progress < 0) progress = 0; + else if (progress > 1) progress = 1; + if (EINA_DBL_EQ(pd->progress, progress)) return; + + pd->progress = progress; + + if (pd->frame_cnt > 0) + evas_object_vg_animated_frame_set(pd->vg, (int) ((pd->frame_cnt - 1) * progress)); + + if (pd->transit) + { + if (pd->playing_reverse) + elm_transit_progress_value_set(pd->transit, 1 - progress); + else + elm_transit_progress_value_set(pd->transit, progress); + } +} + +EOLIAN static void +_efl_ui_vg_animation_efl_player_playback_speed_set(Eo *obj EINA_UNUSED, Efl_Ui_Vg_Animation_Data *pd, double speed) +{ + Eina_Bool rewind = EINA_FALSE; + + if ((pd->playback_speed > 0 && speed < 0) || (pd->playback_speed < 0 && speed > 0)) + rewind = EINA_TRUE; + + // pd->playback_direction_changed is used only during playback. + if (pd->state == EFL_UI_VG_ANIMATION_STATE_PLAYING && rewind) + { + pd->state = EFL_UI_VG_ANIMATION_STATE_PLAYING_BACKWARDS; + pd->playback_direction_changed = EINA_TRUE; + } + else if (pd->state == EFL_UI_VG_ANIMATION_STATE_PLAYING_BACKWARDS && rewind) + { + pd->state = EFL_UI_VG_ANIMATION_STATE_PLAYING; + pd->playback_direction_changed = EINA_TRUE; + } + + pd->playback_speed = speed; + speed = speed < 0 ? speed * -1 : speed; + if (pd->transit) + elm_transit_duration_set(pd->transit, EINA_DBL_NONZERO(pd->playback_speed) ? pd->frame_duration * (1 / speed) : 0); +} + +EOLIAN static double +_efl_ui_vg_animation_efl_player_playback_speed_get(const Eo *obj EINA_UNUSED, Efl_Ui_Vg_Animation_Data *pd) +{ + return pd->playback_speed; +} + +EOLIAN static double +_efl_ui_vg_animation_efl_playable_length_get(const Eo *obj EINA_UNUSED, Efl_Ui_Vg_Animation_Data *pd) +{ + return pd->frame_duration; +} + +EOLIAN static Eina_Bool +_efl_ui_vg_animation_efl_playable_playable_get(const Eo *obj, Efl_Ui_Vg_Animation_Data *pd EINA_UNUSED) +{ + if (!efl_file_loaded_get(obj)) return EINA_FALSE; + return EINA_TRUE; +} + +EOLIAN static Eina_Bool +_efl_ui_vg_animation_efl_playable_seekable_get(const Eo *obj, Efl_Ui_Vg_Animation_Data *pd EINA_UNUSED) +{ + if (!efl_file_loaded_get(obj)) return EINA_FALSE; + return EINA_TRUE; +} + +#define MY_CLASS_NAME_LEGACY "elm_animation_view" + +static void +_efl_ui_vg_animation_legacy_class_constructor(Efl_Class *klass) +{ + evas_smart_legacy_type_register(MY_CLASS_NAME_LEGACY, klass); +} + +EOLIAN static Eo * +_efl_ui_vg_animation_legacy_efl_object_constructor(Eo *obj, void *pd EINA_UNUSED) +{ + obj = efl_constructor(efl_super(obj, EFL_UI_VG_ANIMATION_LEGACY_CLASS)); + efl_canvas_object_type_set(obj, MY_CLASS_NAME_LEGACY); + return obj; +} + +EAPI Elm_Animation_View* +elm_animation_view_add(Evas_Object *parent) +{ + EINA_SAFETY_ON_NULL_RETURN_VAL(parent, NULL); + return elm_legacy_add(EFL_UI_VG_ANIMATION_LEGACY_CLASS, parent); +} + +EAPI Eina_Bool +elm_animation_view_file_set(Elm_Animation_View *obj, const char *file, const char *key) +{ + return efl_file_simple_load(obj, file, key); +} + +EAPI Elm_Animation_View_State +elm_animation_view_state_get(Elm_Animation_View *obj) +{ + Elm_Animation_View_State state = ELM_ANIMATION_VIEW_STATE_NOT_READY; + + switch (efl_ui_vg_animation_state_get(obj)) + { + case EFL_UI_VG_ANIMATION_STATE_PLAYING: + state = ELM_ANIMATION_VIEW_STATE_PLAY; + break; + case EFL_UI_VG_ANIMATION_STATE_PLAYING_BACKWARDS: + state = ELM_ANIMATION_VIEW_STATE_PLAY_BACK; + break; + case EFL_UI_VG_ANIMATION_STATE_PAUSED: + state = ELM_ANIMATION_VIEW_STATE_PAUSE; + break; + case EFL_UI_VG_ANIMATION_STATE_STOPPED: + state = ELM_ANIMATION_VIEW_STATE_STOP; + break; + case EFL_UI_VG_ANIMATION_STATE_NOT_READY: + default: + break; + } + return state; +} + +static Eina_Bool +_efl_ui_vg_animation_content_set(Eo *obj, Efl_Ui_Vg_Animation_Data *pd, const char *part, Efl_Gfx_Entity *content) +{ + Efl_Ui_Vg_Animation_Sub_Obj_Data *sub_d; + Eina_List *l; + + if (!efl_file_loaded_get(obj)) return EINA_FALSE; + + EINA_LIST_FOREACH(pd->subs, l, sub_d) + { + if (!strcmp(part, sub_d->part)) + { + if (content == sub_d->obj) goto end; + if (efl_alive_get(sub_d->obj)) + { + if (sub_d->proxy) efl_del(sub_d->proxy); + _eo_unparent_helper(sub_d->obj, obj); + efl_del(sub_d->obj); + } + break; + } + else if (content == sub_d->obj) + { + pd->subs = eina_list_remove_list(pd->subs, l); + eina_stringshare_del(sub_d->part); + if (sub_d->proxy) efl_del(sub_d->proxy); + free(sub_d); + _elm_widget_sub_object_redirect_to_top(obj, content); + break; + } + } + + if (content) + { + if (!elm_widget_sub_object_add(obj, content)) return EINA_FALSE; + + sub_d = ELM_NEW(Efl_Ui_Vg_Animation_Sub_Obj_Data); + if (!sub_d) + { + ERR("failed to allocate memory!"); + _elm_widget_sub_object_redirect_to_top(obj, content); + return EINA_FALSE; + } + sub_d->part = eina_stringshare_add(part); + sub_d->obj = content; + sub_d->proxy = _proxy_create(sub_d->obj); + pd->subs = eina_list_append(pd->subs, sub_d); + efl_parent_set(content, obj); + } + + efl_canvas_group_change(obj); + + _update_part_contents(obj, pd); + +end: + return EINA_TRUE; +} + +static Efl_Gfx_Entity * +_efl_ui_vg_animation_content_get(const Eo *obj EINA_UNUSED, Efl_Ui_Vg_Animation_Data *pd, const char *part) +{ + const Eina_List *l; + Efl_Ui_Vg_Animation_Sub_Obj_Data *sub_d; + + EINA_LIST_FOREACH(pd->subs, l, sub_d) + { + if (strcmp(part, sub_d->part)) continue; + return sub_d->obj; + } + + return NULL; +} + +static Efl_Gfx_Entity * +_efl_ui_vg_animation_content_unset(Eo *obj, Efl_Ui_Vg_Animation_Data *pd, const char *part) +{ + Efl_Ui_Vg_Animation_Sub_Obj_Data *sub_d; + Eina_List *l; + Eo *content; + + ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd, NULL); + + EINA_LIST_FOREACH(pd->subs, l, sub_d) + { + if (!strcmp(part, sub_d->part)) + { + if (!sub_d->obj) + { + ERR("Sub Object Data doens't have valid object, Something wrong...."); + return NULL; + } + + content = sub_d->obj; + + /* sub_d will die in _widget_sub_object_del */ + if (!_elm_widget_sub_object_redirect_to_top(obj, content)) + { + ERR("could not remove sub object %p from %p", content, obj); + return NULL; + } + _eo_unparent_helper(content, obj); + + return content; + } + } + + return NULL; +} + +#undef GROW_SIZE +#undef QUEUE_SIZE +#undef T_SEGMENT_N +#undef C_SEGMENT_N + + +/* Efl.Part begin */ +ELM_PART_OVERRIDE_CONTENT_SET(efl_ui_vg_animation, EFL_UI_VG_ANIMATION, Efl_Ui_Vg_Animation_Data) +ELM_PART_OVERRIDE_CONTENT_GET(efl_ui_vg_animation, EFL_UI_VG_ANIMATION, Efl_Ui_Vg_Animation_Data) +ELM_PART_OVERRIDE_CONTENT_UNSET(efl_ui_vg_animation, EFL_UI_VG_ANIMATION, Efl_Ui_Vg_Animation_Data) +#include "efl_ui_vg_animation_part.eo.c" +/* Efl.Part end */ + +/* Internal EO APIs and hidden overrides */ + +#define EFL_UI_VG_ANIMATION_EXTRA_OPS \ + EFL_CANVAS_GROUP_ADD_DEL_OPS(efl_ui_vg_animation) + +#include "efl_ui_vg_animation_eo.legacy.c" +#include "efl_ui_vg_animation.eo.c" diff --git a/src/lib/elementary/efl_ui_vg_animation.eo b/src/lib/elementary/efl_ui_vg_animation.eo new file mode 100644 index 0000000000..ca0adbb201 --- /dev/null +++ b/src/lib/elementary/efl_ui_vg_animation.eo @@ -0,0 +1,179 @@ + +enum Efl.Ui.Vg_Animation_State +{ + [[State of vg_animation + + @since 1.24 + ]] + not_ready, [[Animation is not ready to play. (Probably, it didn't file set yet or failed to read file.]] + playing, [[Animation is playing.]] + playing_backwards, [[Animation is playing backwards (rewinding).]] + paused, [[Animation has been paused.]] + stopped [[Vg Animation successfully loaded a file then readied for playing. + Otherwise after finished animation or stopped forcibly by request.]] +} + +class Efl.Ui.Vg_Animation extends Efl.Ui.Widget implements Efl.Gfx.View, Efl.File, Efl.Player, Efl.Playable, Efl.Part +{ + [[Elementary Vector Graphcis Animation class. + Vg Animation is designed to show and play animation of + vector graphics based content. It hides all @Efl.Canvas.Vg.Object details + but just open an API to read vector data from file. Also, it implements + details of animation control methods of Vector. + + Vector data could contain static or animatable vector elements including + animation information. Available vector data file formats are SVG, JSON and EET. + @Efl.Ui.Vg_Animation currently only supports the animation information contained in + JSON (known as Lottie file as well) and EET files. + + @since 1.24 + ]] + event_c_prefix: efl_ui_vg_animation; + methods { + @property frame { + [[Number of current frame. + + Ranges from 0 to @.frame_count - 1. + ]] + set { + } + get { + } + values { + frame_num: int; [[Current frame number.]] + } + } + @property default_view_size { + [[The default view size that specified from vector resource. + ]] + get { + } + values { + size: Eina.Size2D; + } + } + @property state { + [[Current vg animation state. + See @Efl.Ui.Vg_Animation_State + ]] + get{ + } + values { + state: Efl.Ui.Vg_Animation_State; [[Current vg animation state]] + } + } + @property frame_count { + [[The index of end frame of the vg animation, if it's animated. + Note : frame number starts with 0. + ]] + get { + } + values { + frame_count: int; [[The number of frames. 0, if it's not animated.]] + } + } + @property min_progress { + [[The start progress of the play. + ]] + set { + } + get { + } + values { + min_progress: double(0.0); [[The minimum progress. Value must be 0 ~ 1.]] + } + } + @property max_progress { + [[The last progress of the play. + ]] + set { + } + get { + } + values { + max_progress: double(1.0); [[The maximum progress. Value must be 0 ~ 1.]] + } + } + @property min_frame { + [[The start frame of the play. + ]] + set { + } + get { + } + values { + min_frame: int(0); [[The minimum frame for play. Value must be 0 ~ @.max_frame]] + } + } + @property max_frame { + [[The last frame of the play. + ]] + set { + } + get { + } + values { + max_frame: int; [[The maximum frame for play. Value must be @.min_frame ~ (@.frame_count - 1). + The default value is @.frame_count - 1. + ]] + } + } + playing_sector @beta { + [[Play animation of sector one time instantly when it's available. + + If end sector is NULL, only start sector is referenced. + If both the start and end sectors are valid, + Play is played and stoped at starting point of each sector. + + If start is null and end is valid, playback starts from 0 frame to the start frame of the end sector. + If both sectors start and end are invalid. Play from 0 frame to the last frame of vg animation object. + + Note: This method use to @.min_frame, @.max_frame (@.min_progress, @.max_progress) internally. + So if you have changed the min or max frame(progress) it can be changed to the sector frame. + ]] + params { + @in start: string; [[ The name of start sector ]] + @in end: string; [[ The name of end sector ]] + } + return: bool; [[$true when it's successful. $false otherwise.]] + } + value_provider_override @beta { + [[Override each value of the animation object. + Values can be properties of Efl.Gfx.Vg.Value_provider such as color and matrix information. + + Example: + Eo *vp = efl_add(EFL_GFX_VG_VALUE_PROVIDER_CLASS, NULL); + @Efl.Gfx.Vg.Value_Provider.keypath.set(vp, "SomeLayer:SomeObject:SomeContents"); + // Set vp property + @.value_provider_override(target_vg_animation, vg); + See @Efl.Gfx.Vg.Value_Provider + ]] + params { + value_provider: Efl.Gfx.Vg.Value_Provider; [[ Override the values of the animation object. this should have keypath infomation. See @Efl.Gfx.Vg.Value_Provider ]] + } + } + } + implements { + Efl.Object.constructor; + Efl.Object.destructor; + Efl.File.load; + Efl.File.unload; + Efl.Gfx.Entity.visible { set; } + Efl.Gfx.Entity.position { set; } + Efl.Gfx.Entity.size { set; } + Efl.Gfx.View.view_size { set; get; } + Efl.Part.part_get; + Efl.Ui.Widget.widget_sub_object_add; + Efl.Ui.Widget.widget_sub_object_del; + Efl.Player.playing { set; get; } + Efl.Player.paused { set; get; } + Efl.Player.playback_position { set; get; } + Efl.Player.playback_progress { get; set; } + Efl.Player.playback_speed { set; get; } + Efl.Playable.length { get; } + Efl.Playable.playable { get; } + Efl.Playable.seekable { get; } + Efl.Player.autoplay { set; get; } + Efl.Player.playback_loop { set; get; } + } +} diff --git a/src/lib/elementary/efl_ui_animation_view.h b/src/lib/elementary/efl_ui_vg_animation.h index 9241791bf4..1caaf29757 100644 --- a/src/lib/elementary/efl_ui_animation_view.h +++ b/src/lib/elementary/efl_ui_vg_animation.h @@ -26,7 +26,7 @@ * @ingroup Elm_Animation_View */ #ifndef EFL_NOLEGACY_API_SUPPORT -#include "efl_ui_animation_view_legacy.h" +#include "efl_ui_vg_animation_legacy.h" #endif /** * @} diff --git a/src/lib/elementary/efl_ui_vg_animation_eo.legacy.c b/src/lib/elementary/efl_ui_vg_animation_eo.legacy.c new file mode 100644 index 0000000000..40b0b8fe81 --- /dev/null +++ b/src/lib/elementary/efl_ui_vg_animation_eo.legacy.c @@ -0,0 +1,200 @@ + +EAPI void +elm_animation_view_auto_play_set(Efl_Ui_Vg_Animation *obj, Eina_Bool auto_play) +{ + efl_player_autoplay_set(obj, auto_play); +} + +EAPI Eina_Bool +elm_animation_view_auto_play_get(const Efl_Ui_Vg_Animation *obj) +{ + return efl_player_autoplay_get(obj); +} + +EAPI void +elm_animation_view_auto_repeat_set(Efl_Ui_Vg_Animation *obj, Eina_Bool autorepeat) +{ + efl_player_playback_loop_set(obj, autorepeat); +} + +EAPI Eina_Bool +elm_animation_view_auto_repeat_get(const Efl_Ui_Vg_Animation *obj) +{ + return efl_player_playback_loop_get(obj); +} + +EAPI Eina_Bool +elm_animation_view_speed_set(Efl_Ui_Vg_Animation *obj, double speed) +{ + if (!obj) return EINA_FALSE; + efl_player_playback_speed_set(obj, speed); + return EINA_TRUE; +} + +EAPI double +elm_animation_view_speed_get(const Efl_Ui_Vg_Animation *obj) +{ + return efl_player_playback_speed_get(obj); +} + +EAPI double +elm_animation_view_duration_time_get(const Efl_Ui_Vg_Animation *obj) +{ + return efl_playable_length_get(obj); +} + +EAPI void +elm_animation_view_progress_set(Efl_Ui_Vg_Animation *obj, double progress) +{ + efl_player_playback_progress_set(obj, progress); +} + +EAPI double +elm_animation_view_progress_get(const Efl_Ui_Vg_Animation *obj) +{ + return efl_player_playback_progress_get(obj); +} + +EAPI void +elm_animation_view_frame_set(Efl_Ui_Vg_Animation *obj, int frame_num) +{ + efl_ui_vg_animation_frame_set(obj, frame_num); +} + +EAPI int +elm_animation_view_frame_get(const Efl_Ui_Vg_Animation *obj) +{ + return efl_ui_vg_animation_frame_get(obj); +} + +EAPI Eina_Bool +elm_animation_view_play(Efl_Ui_Vg_Animation *obj) +{ + double speed = efl_player_playback_speed_get(obj); + efl_player_playback_speed_set(obj, speed < 0 ? speed * -1 : speed); + return efl_player_playing_set(obj, EINA_TRUE); +} + +EAPI Eina_Bool +elm_animation_view_play_back(Efl_Ui_Vg_Animation *obj) +{ + double speed = efl_player_playback_speed_get(obj); + efl_player_playback_speed_set(obj, speed > 0 ? speed * -1 : speed); + return efl_player_playing_set(obj, EINA_TRUE); +} + +EAPI Eina_Bool +elm_animation_view_pause(Efl_Ui_Vg_Animation *obj) +{ + return efl_player_paused_set(obj, EINA_TRUE); +} + +EAPI Eina_Bool +elm_animation_view_resume(Efl_Ui_Vg_Animation *obj) +{ + return efl_player_paused_set(obj, EINA_FALSE); +} + +EAPI Eina_Bool +elm_animation_view_stop(Efl_Ui_Vg_Animation *obj) +{ + return efl_player_playing_set(obj, EINA_FALSE); +} + +EAPI Eina_Size2D +elm_animation_view_default_size_get(const Efl_Ui_Vg_Animation *obj) +{ + return efl_ui_vg_animation_default_view_size_get(obj); +} + +EAPI Eina_Bool +elm_animation_view_is_playing_back(Efl_Ui_Vg_Animation *obj) +{ + return (efl_ui_vg_animation_state_get(obj) == EFL_UI_VG_ANIMATION_STATE_PLAYING_BACKWARDS); +} + +EAPI int +elm_animation_view_frame_count_get(const Efl_Ui_Vg_Animation *obj) +{ + return efl_ui_vg_animation_frame_count_get(obj); +} + +EAPI void +elm_animation_view_min_progress_set(Efl_Ui_Vg_Animation *obj, double min_progress) +{ + efl_ui_vg_animation_min_progress_set(obj, min_progress); +} + +EAPI double +elm_animation_view_min_progress_get(const Efl_Ui_Vg_Animation *obj) +{ + return efl_ui_vg_animation_min_progress_get(obj); +} + +EAPI void +elm_animation_view_max_progress_set(Efl_Ui_Vg_Animation *obj, double max_progress) +{ + efl_ui_vg_animation_max_progress_set(obj, max_progress); +} + +EAPI double +elm_animation_view_max_progress_get(const Efl_Ui_Vg_Animation *obj) +{ + return efl_ui_vg_animation_max_progress_get(obj); +} + +EAPI void +elm_animation_view_min_frame_set(Efl_Ui_Vg_Animation *obj, int min_frame) +{ + efl_ui_vg_animation_min_frame_set(obj, min_frame); +} + +EAPI int +elm_animation_view_min_frame_get(const Efl_Ui_Vg_Animation *obj) +{ + return efl_ui_vg_animation_min_frame_get(obj); +} + +EAPI void +elm_animation_view_max_frame_set(Efl_Ui_Vg_Animation *obj, int max_frame) +{ + efl_ui_vg_animation_max_frame_set(obj, max_frame); +} + +EAPI int +elm_animation_view_max_frame_get(const Efl_Ui_Vg_Animation *obj) +{ + return efl_ui_vg_animation_max_frame_get(obj); +} + +static Eina_Bool +_efl_ui_vg_animation_legacy_class_initializer(Efl_Class *klass) +{ + const Efl_Object_Ops *opsp = NULL; + + const Efl_Object_Property_Reflection_Ops *ropsp = NULL; + +#ifndef EFL_UI_VG_ANIMATION_LEGACY_EXTRA_OPS +#define EFL_UI_VG_ANIMATION_LEGACY_EXTRA_OPS +#endif + + EFL_OPS_DEFINE(ops, + EFL_OBJECT_OP_FUNC(efl_constructor, _efl_ui_vg_animation_legacy_efl_object_constructor), + EFL_UI_VG_ANIMATION_LEGACY_EXTRA_OPS + ); + opsp = &ops; + + return efl_class_functions_set(klass, opsp, ropsp); +} + +static const Efl_Class_Description _efl_ui_vg_animation_legacy_class_desc = { + EO_VERSION, + "Efl.Ui.VG_Animation_Legacy", + EFL_CLASS_TYPE_REGULAR, + 0, + _efl_ui_vg_animation_legacy_class_initializer, + _efl_ui_vg_animation_legacy_class_constructor, + NULL +}; + +EFL_DEFINE_CLASS(efl_ui_vg_animation_legacy_class_get, &_efl_ui_vg_animation_legacy_class_desc, EFL_UI_VG_ANIMATION_CLASS, EFL_UI_LEGACY_INTERFACE, NULL); diff --git a/src/lib/elementary/efl_ui_animation_view_eo.legacy.h b/src/lib/elementary/efl_ui_vg_animation_eo.legacy.h index 78dd2f1d5d..1545aeae43 100644 --- a/src/lib/elementary/efl_ui_animation_view_eo.legacy.h +++ b/src/lib/elementary/efl_ui_vg_animation_eo.legacy.h @@ -514,4 +514,14 @@ EAPI void elm_animation_view_max_frame_set(Elm_Animation_View *obj, int max_fram */ EAPI int elm_animation_view_max_frame_get(const Elm_Animation_View *obj); +#ifdef EFL_BETA_API_SUPPORT +/** Elementary vg_animation class + * + * @ingroup Efl_Ui_VG_Animation_Legacy + */ +#define EFL_UI_VG_ANIMATION_LEGACY_CLASS efl_ui_vg_animation_legacy_class_get() + +EWAPI const Efl_Class *efl_ui_vg_animation_legacy_class_get(void) EINA_CONST; +#endif /* EFL_BETA_API_SUPPORT */ + #endif diff --git a/src/lib/elementary/efl_ui_animation_view_legacy.h b/src/lib/elementary/efl_ui_vg_animation_legacy.h index 95054168c5..a25e8b5976 100644 --- a/src/lib/elementary/efl_ui_animation_view_legacy.h +++ b/src/lib/elementary/efl_ui_vg_animation_legacy.h @@ -1,5 +1,5 @@ -#include "efl_ui_animation_view_eo.legacy.h" +#include "efl_ui_vg_animation_eo.legacy.h" /** * Add a new animation view widget to the parent's canvas diff --git a/src/lib/elementary/efl_ui_vg_animation_part.eo b/src/lib/elementary/efl_ui_vg_animation_part.eo new file mode 100644 index 0000000000..9927fad90d --- /dev/null +++ b/src/lib/elementary/efl_ui_vg_animation_part.eo @@ -0,0 +1,9 @@ +class @beta Efl.Ui.Vg_Animation_Part extends Efl.Ui.Widget_Part implements Efl.Content +{ + [[Efl UI Vg_Animation internal part class]] + data: null; + implements { + Efl.Content.content { set; get; } + Efl.Content.content_unset; + } +} diff --git a/src/lib/elementary/efl_ui_vg_animation_private.h b/src/lib/elementary/efl_ui_vg_animation_private.h new file mode 100644 index 0000000000..ace4c4a369 --- /dev/null +++ b/src/lib/elementary/efl_ui_vg_animation_private.h @@ -0,0 +1,44 @@ +#ifndef EFL_UI_VG_ANIMATION_PRIVATE_H +#define EFL_UI_VG_ANIMATION_PRIVATE_H + +#include "Elementary.h" +#include "efl_ui_vg_animation.eo.h" + +typedef struct _Efl_Ui_Vg_Animation_Data Efl_Ui_Vg_Animation_Data; + +struct _Efl_Ui_Vg_Animation_Data +{ + Eo* vg; //Evas_Object_Vg + Efl_Ui_Vg_Animation_State state; + Elm_Transit *transit; + Eina_Stringshare *file; + double playback_speed; + double progress; + double frame_cnt; + int repeat_times; + double frame_duration; + double min_progress; + double max_progress; + Eina_List *subs; + Eina_List *vp_list; + + Eina_Bool playing_reverse : 1; + Eina_Bool autoplay : 1; + Eina_Bool autoplay_pause: 1; + Eina_Bool loop : 1; + Eina_Bool playback_direction_changed : 1; +}; + +#define EFL_UI_VG_ANIMATION_DATA_GET(o, sd) \ + Efl_Ui_Vg_Animation_Data * sd = efl_data_scope_safe_get(o, EFL_UI_VG_ANIMATION_CLASS) + +#define EFL_UI_VG_ANIMATION_DATA_GET_OR_RETURN(o, ptr) \ + EFL_UI_VG_ANIMATION_DATA_GET(o, ptr); \ + if (EINA_UNLIKELY(!ptr)) \ + { \ + ERR("No widget data for object %p (%s)", \ + o, evas_object_type_get(o)); \ + return; \ + } + +#endif diff --git a/src/lib/elementary/efl_ui_video.h b/src/lib/elementary/efl_ui_video.h index c4cfc55815..0db9b57cba 100644 --- a/src/lib/elementary/efl_ui_video.h +++ b/src/lib/elementary/efl_ui_video.h @@ -26,16 +26,16 @@ * linked Efl_Ui_Video so it will use the video decoder, if available. It also * activates the "remember" function on the linked Efl_Ui_Video object. * - * Both widgets inherit from the @ref Layout one, so that all the + * Both widgets inherit from the @ref Elm_Layout one, so that all the * functions acting on it also work for video objects. * * This widget emits the following signals, besides the ones sent from - * @ref Layout: + * @ref Elm_Layout : * @li @c "focused" : When the video has received focus. (since 1.8) * @li @c "unfocused" : When the video has lost focus. (since 1.8) * * The player widget emits the following signals, besides the ones - * sent from @ref Layout: + * sent from @ref Elm_Layout : * - @c "forward,clicked" - the user clicked the forward button. * - @c "info,clicked" - the user clicked the info button. * - @c "next,clicked" - the user clicked the next button. diff --git a/src/lib/elementary/efl_ui_video_legacy_eo.h b/src/lib/elementary/efl_ui_video_legacy_eo.h index f6d5382e38..2e2a6250eb 100644 --- a/src/lib/elementary/efl_ui_video_legacy_eo.h +++ b/src/lib/elementary/efl_ui_video_legacy_eo.h @@ -20,7 +20,7 @@ typedef Eo Efl_Ui_Video_Legacy; */ #define EFL_UI_VIDEO_LEGACY_CLASS efl_ui_video_legacy_class_get() -EWAPI const Efl_Class *efl_ui_video_legacy_class_get(void); +EWAPI const Efl_Class *efl_ui_video_legacy_class_get(void) EINA_CONST; #endif /* EFL_BETA_API_SUPPORT */ #endif diff --git a/src/lib/elementary/efl_ui_widget.c b/src/lib/elementary/efl_ui_widget.c index 768d934fae..553de7c3aa 100644 --- a/src/lib/elementary/efl_ui_widget.c +++ b/src/lib/elementary/efl_ui_widget.c @@ -186,8 +186,6 @@ _on_sub_obj_del(void *data, const Efl_Event *event); static void _propagate_event(void *data, const Efl_Event *eo_event); static void _elm_widget_shadow_update(Efl_Ui_Widget *obj); -EFL_CALLBACKS_ARRAY_DEFINE(elm_widget_subitems_callbacks, - { EFL_EVENT_DEL, _on_sub_obj_del }); EFL_CALLBACKS_ARRAY_DEFINE(efl_subitems_callbacks, { EFL_EVENT_DEL, _on_sub_obj_del }); EFL_CALLBACKS_ARRAY_DEFINE(focus_callbacks, @@ -198,27 +196,13 @@ EFL_CALLBACKS_ARRAY_DEFINE(focus_callbacks, static inline void _callbacks_add(Eo *widget, void *data) { - if (_elm_widget_is(widget)) - { - efl_event_callback_array_add(widget, elm_widget_subitems_callbacks(), data); - } - else - { - efl_event_callback_array_add(widget, efl_subitems_callbacks(), data); - } + efl_event_callback_array_add(widget, efl_subitems_callbacks(), data); } static inline void _callbacks_del(Eo *widget, void *data) { - if (_elm_widget_is(widget)) - { - efl_event_callback_array_del(widget, elm_widget_subitems_callbacks(), data); - } - else - { - efl_event_callback_array_del(widget, efl_subitems_callbacks(), data); - } + efl_event_callback_array_del(widget, efl_subitems_callbacks(), data); } void @@ -525,13 +509,13 @@ _full_eval(Eo *obj, Elm_Widget_Smart_Data *pd) { //emit signal and focus eval old and new ELM_WIDGET_DATA_GET(old_parent, old_pd); - _full_eval(old_parent, old_pd); + if (old_pd) _full_eval(old_parent, old_pd); } if (efl_isa(pd->logical.parent, EFL_UI_WIDGET_CLASS)) { ELM_WIDGET_DATA_GET(pd->logical.parent, new_pd); - _full_eval(pd->logical.parent, new_pd); + if (new_pd) _full_eval(pd->logical.parent, new_pd); } } @@ -562,8 +546,7 @@ void _elm_widget_full_eval(Eo *obj) { ELM_WIDGET_DATA_GET(obj, pd); - - _full_eval(obj, pd); + if (pd) _full_eval(obj, pd); } /** @@ -652,6 +635,7 @@ _obj_mouse_down(void *data, Evas_Object *top; ELM_WIDGET_DATA_GET(data, sd); + if (!sd) return; Evas_Event_Mouse_Down *ev = event_info; if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD) return; @@ -667,6 +651,7 @@ _obj_mouse_move(void *data, void *event_info) { ELM_WIDGET_DATA_GET(data, sd); + if (!sd) return; Evas_Event_Mouse_Move *ev = event_info; if (!sd->still_in) return; @@ -688,6 +673,7 @@ _obj_mouse_up(void *data, void *event_info) { ELM_WIDGET_DATA_GET(data, sd); + if (!sd) return; Evas_Event_Mouse_Up *ev = event_info; if (sd->still_in && (ev->flags == EVAS_BUTTON_NONE) && @@ -705,6 +691,7 @@ _obj_mouse_in(void *data, void *event_info EINA_UNUSED) { ELM_WIDGET_DATA_GET(data, sd); + if (!sd) return; if (sd->focus_move_policy == ELM_FOCUS_MOVE_POLICY_IN && !efl_invalidated_get(data)) elm_widget_focus_mouse_up_handle(evas_object_widget_parent_find(obj)); @@ -731,6 +718,14 @@ _efl_ui_widget_efl_canvas_group_group_add(Eo *obj, Elm_Widget_Smart_Data *priv) _obj_mouse_in, obj); } +static Eina_Bool +_keep(void *data, void *gdata) +{ + if (data == gdata) + return EINA_FALSE; + return EINA_TRUE; +} + EOLIAN static void _efl_ui_widget_efl_canvas_group_group_del(Eo *obj, Elm_Widget_Smart_Data *sd) { @@ -744,20 +739,18 @@ _efl_ui_widget_efl_canvas_group_group_del(Eo *obj, Elm_Widget_Smart_Data *sd) _callbacks_del(sd->hover_obj, obj); sd->hover_obj = NULL; } - - while (sd->subobjs) + while(eina_array_count(sd->children)) { - sobj = eina_list_data_get(sd->subobjs); + sobj = eina_array_data_get(sd->children, 0); - /* let the objects clean-up themselves and get rid of this list */ if (!elm_widget_sub_object_del(obj, sobj)) { ERR("failed to remove sub object %p from %p\n", sobj, obj); - sd->subobjs = eina_list_remove_list - (sd->subobjs, sd->subobjs); + eina_array_remove(sd->children, _keep, sobj); } // FIXME: is that a legacy or a new object ? evas_object_del(sobj); + EINA_SAFETY_ON_TRUE_RETURN(eina_array_count(sd->children) && sobj == eina_array_data_get(sd->children, 0)); } sd->tooltips = eina_list_free(sd->tooltips); /* should be empty anyway */ sd->cursors = eina_list_free(sd->cursors); /* should be empty anyway */ @@ -848,14 +841,14 @@ _efl_ui_widget_efl_gfx_entity_size_set(Eo *obj EINA_UNUSED, Elm_Widget_Smart_Dat void _elm_widget_full_eval_children(Eo *obj, Elm_Widget_Smart_Data *sd) { - Eina_List *l; Eo *child; _full_eval(obj, sd); - EINA_LIST_FOREACH(sd->subobjs , l, child) + for (unsigned int i = 0; i < eina_array_count(sd->children); ++i) { Elm_Widget_Smart_Data *sd_child; + child = eina_array_data_get(sd->children, i); if (!efl_isa(child, EFL_UI_WIDGET_CLASS)) continue; @@ -951,12 +944,13 @@ EOLIAN static void _efl_ui_widget_efl_canvas_object_is_frame_object_set(Eo *obj, Elm_Widget_Smart_Data *pd, Eina_Bool frame) { Evas_Object *o; - Eina_List *li; frame = !!frame; efl_canvas_object_is_frame_object_set(efl_super(obj, MY_CLASS), frame); - EINA_LIST_FOREACH(pd->subobjs, li, o) + for (unsigned int i = 0; i < eina_array_count(pd->children); ++i) { + o = eina_array_data_get(pd->children, i); + if (evas_object_data_get(o, "_elm_leaveme")) continue; efl_canvas_object_is_frame_object_set(o, frame); } @@ -1094,7 +1088,7 @@ _propagate_event_legacy(Eo *parent, const Efl_Event *event, Eo *obj, Elm_Event_C ((*event_flags) & EVAS_EVENT_FLAG_ON_HOLD)) { if (prev_flags != *event_flags) - efl_input_event_flags_set(event->info, *event_flags); + efl_input_event_flags_set(event->info, (Efl_Input_Flags)*event_flags); return EINA_TRUE; } @@ -1182,13 +1176,14 @@ EAPI Eina_Bool elm_widget_access(Evas_Object *obj, Eina_Bool is_access) { - const Eina_List *l; Evas_Object *child; Eina_Bool ret = EINA_TRUE; API_ENTRY return EINA_FALSE; - EINA_LIST_FOREACH(sd->subobjs, l, child) + for (unsigned int i = 0; i < eina_array_count(sd->children); ++i) { + child = eina_array_data_get(sd->children, i); + if (elm_widget_is(child)) ret &= elm_widget_access(child, is_access); } @@ -1224,10 +1219,12 @@ elm_widget_theme(Evas_Object *obj) Eina_Bool err_generic = EINA_FALSE; API_ENTRY return EFL_UI_THEME_APPLY_ERROR_GENERIC; - - EINA_LIST_FOREACH(sd->subobjs, l, child) - if (_elm_widget_is(child)) - _elm_widget_theme_helper(elm_widget_theme(child), &err_default, &err_generic); + for (unsigned int i = 0; i < eina_array_count(sd->children); ++i) + { + child = eina_array_data_get(sd->children, i); + if (_elm_widget_is(child)) + _elm_widget_theme_helper(elm_widget_theme(child), &err_default, &err_generic); + } if (sd->hover_obj) _elm_widget_theme_helper(elm_widget_theme(sd->hover_obj), &err_default, &err_generic); @@ -1275,8 +1272,9 @@ elm_widget_theme_specific(Evas_Object *obj, } } if (!force) return; - EINA_LIST_FOREACH(sd->subobjs, l, child) + for (unsigned int i = 0; i < eina_array_count(sd->children); ++i) { + child = eina_array_data_get(sd->children, i); if (elm_widget_is(child)) elm_widget_theme_specific(child, th, force); } @@ -1434,7 +1432,7 @@ _efl_ui_widget_widget_parent_set(Eo *obj, Elm_Widget_Smart_Data *pd, Efl_Ui_Widg if (parent) { ELM_WIDGET_DATA_GET_OR_RETURN(parent, ppd); - EINA_SAFETY_ON_FALSE_RETURN(eina_list_data_find(ppd->subobjs, obj)); + EINA_SAFETY_ON_FALSE_RETURN(eina_array_find(ppd->children, obj, NULL)); if (ppd->parent_obj == parent) { CRI("ATTEMPTING TO SET CHILD OF PARENT AS PARENT OF ITS OWN PARENT. THIS IS A BUG."); @@ -1468,7 +1466,7 @@ _efl_ui_widget_widget_parent_set(Eo *obj, Elm_Widget_Smart_Data *pd, Efl_Ui_Widg if (!pd->on_create) { - if ((scale != prev_scale) || (th != prev_th) || + if (!EINA_DBL_EQ(scale, prev_scale) || (th != prev_th) || (pmirrored != mirrored)) elm_widget_theme(obj); } @@ -1500,7 +1498,8 @@ _efl_ui_widget_widget_parent_set(Eo *obj, Elm_Widget_Smart_Data *pd, Efl_Ui_Widg static void _widget_add_sub(Eo *obj, Elm_Widget_Smart_Data *sd, Evas_Object *sobj) { - sd->subobjs = eina_list_append(sd->subobjs, sobj); + if (!sd->children) sd->children = eina_array_new(1); + eina_array_push(sd->children, sobj); evas_object_data_set(sobj, "elm-parent", obj); _callbacks_add(sobj, obj); } @@ -1508,7 +1507,7 @@ _widget_add_sub(Eo *obj, Elm_Widget_Smart_Data *sd, Evas_Object *sobj) static void _widget_del_sub(Eo *obj, Elm_Widget_Smart_Data *sd, Evas_Object *sobj) { - sd->subobjs = eina_list_remove(sd->subobjs, sobj); + eina_array_remove(sd->children, _keep, sobj); evas_object_data_del(sobj, "elm-parent"); _callbacks_del(sobj, obj); } @@ -1517,12 +1516,14 @@ EOLIAN static Eina_Bool _efl_ui_widget_widget_sub_object_add(Eo *obj, Elm_Widget_Smart_Data *sd, Evas_Object *sobj) { Efl_Ui_Widget *parent; + Eina_Bool is_widget; EINA_SAFETY_ON_FALSE_RETURN_VAL(efl_isa(sobj, EFL_GFX_ENTITY_INTERFACE), EINA_FALSE); EINA_SAFETY_ON_TRUE_RETURN_VAL(obj == sobj, EINA_FALSE); + is_widget = elm_widget_is(sobj); //first make sure that we unregister the sobj from the parent - if (elm_widget_is(sobj)) + if (is_widget) parent = efl_ui_widget_parent_get(sobj); else parent = evas_object_data_get(sobj, "elm-parent"); @@ -1545,7 +1546,7 @@ _efl_ui_widget_widget_sub_object_add(Eo *obj, Elm_Widget_Smart_Data *sd, Evas_Ob //and if it is a widget, please set the correct parent on the widget itself //the parent set method will take care of the property syncing etc. - if (elm_widget_is(sobj)) + if (is_widget) efl_ui_widget_parent_set(sobj, obj); return EINA_TRUE; @@ -1554,13 +1555,17 @@ _efl_ui_widget_widget_sub_object_add(Eo *obj, Elm_Widget_Smart_Data *sd, Evas_Ob EOLIAN static Eina_Bool _efl_ui_widget_widget_sub_object_del(Eo *obj, Elm_Widget_Smart_Data *sd, Evas_Object *sobj) { - Evas_Object *sobj_parent; + Evas_Object *sobj_parent = NULL; + Eina_Bool is_widget; if (!sobj) return EINA_FALSE; EINA_SAFETY_ON_TRUE_RETURN_VAL(obj == sobj, EINA_FALSE); - sobj_parent = evas_object_data_del(sobj, "elm-parent"); + is_widget = _elm_widget_is(sobj); + + if (!is_widget) sobj_parent = evas_object_data_del(sobj, "elm-parent"); + if (sobj_parent && sobj_parent != obj) { static int abort_on_warn = -1; @@ -1580,8 +1585,10 @@ _efl_ui_widget_widget_sub_object_del(Eo *obj, Elm_Widget_Smart_Data *sd, Evas_Ob return EINA_FALSE; } - if (_elm_widget_is(sobj)) + if (is_widget) { + if (efl_ui_widget_parent_get(sobj) != obj) + return EINA_FALSE; if (_is_focused(sobj)) { elm_widget_tree_unfocusable_set(sobj, EINA_TRUE); @@ -1713,6 +1720,51 @@ _tree_unfocusable_counter_get(Eo *widget) } /** + * Evalulate tree number. + * + * This is here to support properties which are propagating through the widget tree. If this property is set to true, + * every widget in the subtree, will also be automatically true. + * When one of the widgets in the subtree then seperatly will be set to true, the unsetting on the original widget will not unset the flag automatically in this tree. + * + * The basic idea here is: + * - The numeric number beeing bigger than 0, means that the property is true + * - The difference between the number of the parent, and the number of the object, represents the boolean flag + * (0 means that the flag is equal to the one of the parent, 1 means that if the parent is false, this child is true). + */ +static int +_calculate_tree_number(int self_counter, int parent_counter, Eina_Bool flag) +{ + int distance = self_counter - parent_counter; + + if (flag) + self_counter ++; + else + self_counter --; + + distance = self_counter - parent_counter; + + if ((distance < 0) || (distance > 1)) + { + distance = MAX(MIN(flag, 1), 0); + self_counter = parent_counter + distance; + } + + return self_counter; +} + +static void +_propagate_bool_property(Elm_Widget_Smart_Data *pd, Eina_Bool flag, void (*property_setting)(Eo *obj, Eina_Bool flag)) +{ + Efl_Ui_Widget *subs; + for (unsigned int i = 0; i < eina_array_count(pd->children); ++i) + { + subs = eina_array_data_get(pd->children, i); + if (efl_isa(subs, EFL_UI_WIDGET_CLASS)) + property_setting(subs, flag); + } +} + +/** * @internal * * This API makes the widget object and its children to be unfocusable. @@ -1730,33 +1782,21 @@ _tree_unfocusable_counter_get(Eo *widget) EAPI void elm_widget_tree_unfocusable_set(Eo *obj, Eina_Bool tree_unfocusable) { - Efl_Ui_Widget *subs; - Eina_List *n; Elm_Widget_Smart_Data *pd = efl_data_scope_safe_get(obj, MY_CLASS); EINA_SAFETY_ON_NULL_RETURN(pd); - int distance, parent_counter = (pd->parent_obj ? _tree_unfocusable_counter_get(pd->parent_obj) : 0); + int old_tree_unfocusable; - if (tree_unfocusable) - pd->tree_unfocusable ++; - else - pd->tree_unfocusable --; + old_tree_unfocusable = pd->tree_unfocusable; - distance = pd->tree_unfocusable - parent_counter; + pd->tree_unfocusable = _calculate_tree_number(pd->tree_unfocusable, + (pd->parent_obj ? _tree_unfocusable_counter_get(pd->parent_obj) : 0), + tree_unfocusable); - if ((distance < 0) || (distance > 1)) + if (old_tree_unfocusable != pd->tree_unfocusable) { - distance = MAX(MIN(tree_unfocusable, 1), 0); - pd->tree_unfocusable = parent_counter + distance; + _full_eval(obj, pd); + _propagate_bool_property(pd, tree_unfocusable, elm_widget_tree_unfocusable_set); } - - EINA_LIST_FOREACH(pd->subobjs, n, subs) - { - if (efl_isa(subs, EFL_UI_WIDGET_CLASS)) - elm_widget_tree_unfocusable_set(subs, elm_widget_tree_unfocusable_get(obj)); - } - - //focus state eval on all children - _elm_widget_full_eval_children(obj, pd); } /** @@ -1794,13 +1834,13 @@ EAPI Eina_List* elm_widget_can_focus_child_list_get(const Eo *obj) { Elm_Widget_Smart_Data *sd = efl_data_scope_safe_get(obj, MY_CLASS); - const Eina_List *l; Eina_List *child_list = NULL; Evas_Object *child; if (!sd) return NULL; - EINA_LIST_FOREACH(sd->subobjs, l, child) + for (unsigned int i = 0; i < eina_array_count(sd->children); ++i) { + child = eina_array_data_get(sd->children, i); if (!_elm_widget_is(child)) continue; if ((elm_widget_can_focus_get(child)) && (evas_object_visible_get(child)) && @@ -2065,13 +2105,13 @@ void _elm_widget_top_win_focused_set(Evas_Object *obj, Eina_Bool top_win_focused) { - const Eina_List *l; Evas_Object *child; API_ENTRY return; if (sd->top_win_focused == top_win_focused) return; - EINA_LIST_FOREACH(sd->subobjs, l, child) + for (unsigned int i = 0; i < eina_array_count(sd->children); ++i) { + child = eina_array_data_get(sd->children, i); if (elm_widget_is(child)) _elm_widget_top_win_focused_set(child, top_win_focused); } @@ -2091,31 +2131,17 @@ _elm_widget_top_win_focused_get(const Evas_Object *obj) EOLIAN static void _efl_ui_widget_disabled_set(Eo *obj EINA_UNUSED, Elm_Widget_Smart_Data *pd, Eina_Bool disabled) { - Efl_Ui_Widget *subs; - Eina_List *n; - int distance, parent_counter = (pd->parent_obj ? _disabled_counter_get(pd->parent_obj) : 0); - - if (disabled) - pd->disabled ++; - else - pd->disabled --; + int old_state; - distance = pd->disabled - parent_counter; - - if ((distance < 0) || (distance > 1)) - { - distance = MAX(MIN(disabled, 1), 0); - pd->disabled = parent_counter + distance; - } + old_state = pd->disabled; - EINA_LIST_FOREACH(pd->subobjs, n, subs) + pd->disabled = _calculate_tree_number(pd->disabled, (pd->parent_obj ? _disabled_counter_get(pd->parent_obj) : 0), disabled); + if (old_state != pd->disabled) { - if (efl_isa(subs, EFL_UI_WIDGET_CLASS)) - efl_ui_widget_disabled_set(subs, efl_ui_widget_disabled_get(obj)); + if (efl_finalized_get(obj)) + _full_eval(obj, pd); + _propagate_bool_property(pd, disabled, efl_ui_widget_disabled_set); } - - if (efl_finalized_get(obj)) - _elm_widget_full_eval_children(obj, pd); } EOLIAN static Eina_Bool @@ -2166,10 +2192,10 @@ _efl_ui_widget_scroll_hold_push(Eo *obj, Elm_Widget_Smart_Data *sd) else { Evas_Object *child; - Eina_List *l; - EINA_LIST_FOREACH(sd->subobjs, l, child) + for (unsigned int i = 0; i < eina_array_count(sd->children); ++i) { + child = eina_array_data_get(sd->children, i); if (elm_widget_is(child) && _elm_scrollable_is(child)) { if (elm_widget_is_legacy(child)) @@ -2200,10 +2226,10 @@ _efl_ui_widget_scroll_hold_pop(Eo *obj, Elm_Widget_Smart_Data *sd) else { Evas_Object *child; - Eina_List *l; - EINA_LIST_FOREACH(sd->subobjs, l, child) + for (unsigned int i = 0; i < eina_array_count(sd->children); ++i) { + child = eina_array_data_get(sd->children, i); if (elm_widget_is(child) && _elm_scrollable_is(child)) { if (elm_widget_is_legacy(child)) @@ -2243,10 +2269,10 @@ _efl_ui_widget_scroll_freeze_push(Eo *obj, Elm_Widget_Smart_Data *sd) else { Evas_Object *child; - Eina_List *l; - EINA_LIST_FOREACH(sd->subobjs, l, child) + for (unsigned int i = 0; i < eina_array_count(sd->children); ++i) { + child = eina_array_data_get(sd->children, i); if (elm_widget_is(child) && _elm_scrollable_is(child)) { if (elm_widget_is_legacy(child)) @@ -2277,10 +2303,11 @@ _efl_ui_widget_scroll_freeze_pop(Eo *obj, Elm_Widget_Smart_Data *sd) else { Evas_Object *child; - Eina_List *l; - EINA_LIST_FOREACH(sd->subobjs, l, child) + for (unsigned int i = 0; i < eina_array_count(sd->children); ++i) { + child = eina_array_data_get(sd->children, i); + if (elm_widget_is(child) && _elm_scrollable_is(child)) { if (elm_widget_is_legacy(child)) @@ -2308,7 +2335,7 @@ EOLIAN static void _efl_ui_widget_efl_gfx_entity_scale_set(Eo *obj, Elm_Widget_Smart_Data *sd, double scale) { if (scale < 0.0) scale = 0.0; - if (sd->scale != scale) + if (!EINA_DBL_EQ(sd->scale, scale)) { sd->scale = scale; elm_widget_theme(obj); @@ -2319,9 +2346,9 @@ EOLIAN static double _efl_ui_widget_efl_gfx_entity_scale_get(const Eo *obj EINA_UNUSED, Elm_Widget_Smart_Data *sd) { // FIXME: save walking up the tree by storing/caching parent scale - if (sd->scale == 0.0) + if (EINA_DBL_EQ(sd->scale, 0.0)) { - if (sd->parent_obj && elm_widget_is(sd->parent_obj)) + if (sd->parent_obj) { return efl_gfx_entity_scale_get(sd->parent_obj); } @@ -2514,13 +2541,14 @@ elm_widget_part_translatable_text_get(const Eo *obj, const char *part, const cha EOLIAN static void _efl_ui_widget_efl_ui_l10n_translation_update(Eo *obj EINA_UNUSED, Elm_Widget_Smart_Data *sd) { - const Eina_List *l; Evas_Object *child; - EINA_LIST_FOREACH(sd->subobjs, l, child) + for (unsigned int i = 0; i < eina_array_count(sd->children); ++i) { + child = eina_array_data_get(sd->children, i); if (elm_widget_is(child)) efl_ui_l10n_translation_update(child); + } if (sd->hover_obj) efl_ui_l10n_translation_update(sd->hover_obj); @@ -2585,7 +2613,7 @@ elm_widget_theme_get(const Evas_Object *obj) if (!sd->theme) { - if (sd->parent_obj && elm_widget_is(sd->parent_obj)) + if (sd->parent_obj) return elm_widget_theme_get(sd->parent_obj); else return NULL; } @@ -2776,7 +2804,7 @@ _efl_ui_widget_efl_object_dbg_info_get(Eo *eo_obj, Elm_Widget_Smart_Data *_pd EI #define ADD_PTR_LIST(name) \ Efl_Dbg_Info* name = EFL_DBG_INFO_LIST_APPEND(focus, ""#name""); \ - _convert(name, eina_list_iterator_new(rel->name)); + _convert(name, rel->name); ADD_PTR_LIST(top) ADD_PTR_LIST(down) @@ -2787,7 +2815,7 @@ _efl_ui_widget_efl_object_dbg_info_get(Eo *eo_obj, Elm_Widget_Smart_Data *_pd EI } - //if thats a focus manager, give useful information like the border elements + //if that's a focus manager, give useful information like the border elements if (efl_isa(eo_obj, EFL_UI_FOCUS_MANAGER_INTERFACE)) { Efl_Dbg_Info *border; @@ -2880,15 +2908,16 @@ elm_widget_type_check(const Evas_Object *obj, EAPI Evas_Object * elm_widget_name_find(const Eo *obj, const char *name, int recurse) { - Eina_List *l; Evas_Object *child; const char *s; INTERNAL_ENTRY NULL; if (!name) return NULL; if (!_elm_widget_is(obj)) return NULL; - EINA_LIST_FOREACH(sd->subobjs, l, child) + + for (unsigned int i = 0; i < eina_array_count(sd->children); ++i) { + child = eina_array_data_get(sd->children, i); s = evas_object_name_get(child); if ((s) && (!strcmp(s, name))) return child; if ((recurse != 0) && @@ -3113,7 +3142,6 @@ elm_widget_display_mode_set(Evas_Object *obj, Evas_Display_Mode dispmode) { Evas_Display_Mode prev_dispmode; Evas_Object *child; - Eina_List *l; API_ENTRY return; prev_dispmode = evas_object_size_hint_display_mode_get(obj); @@ -3123,8 +3151,9 @@ elm_widget_display_mode_set(Evas_Object *obj, Evas_Display_Mode dispmode) evas_object_size_hint_display_mode_set(obj, dispmode); - EINA_LIST_FOREACH (sd->subobjs, l, child) + for (unsigned int i = 0; i < eina_array_count(sd->children); ++i) { + child = eina_array_data_get(sd->children, i); if (elm_widget_is(child)) elm_widget_display_mode_set(child, dispmode); } @@ -3142,7 +3171,7 @@ elm_widget_display_mode_set(Evas_Object *obj, Evas_Display_Mode dispmode) EOLIAN static Efl_Ui_Focus_Move_Policy _efl_ui_widget_focus_move_policy_get(const Eo *obj EINA_UNUSED, Elm_Widget_Smart_Data *sd) { - return sd->focus_move_policy; + return (Efl_Ui_Focus_Move_Policy)sd->focus_move_policy; } /** @@ -3158,7 +3187,7 @@ EOLIAN static void _efl_ui_widget_focus_move_policy_set(Eo *obj EINA_UNUSED, Elm_Widget_Smart_Data *sd, Efl_Ui_Focus_Move_Policy policy) { if (sd->focus_move_policy == (Elm_Focus_Move_Policy)policy) return; - sd->focus_move_policy = policy; + sd->focus_move_policy = (Elm_Focus_Move_Policy)policy; } /** @@ -3192,7 +3221,8 @@ _efl_ui_widget_focus_move_policy_automatic_set(Eo *obj, Elm_Widget_Smart_Data *s if (automatic) { - efl_ui_widget_focus_move_policy_set(obj, elm_config_focus_move_policy_get()); + efl_ui_widget_focus_move_policy_set + (obj, (Efl_Ui_Focus_Move_Policy)elm_config_focus_move_policy_get()); } } } @@ -4698,8 +4728,11 @@ _sub_obj_tree_dump(const Evas_Object *obj, DBG("+ %s(%p)\n", elm_widget_type_get(obj), obj); - EINA_LIST_FOREACH(sd->subobjs, l, obj) + for (unsigned int i = 0; i < eina_array_count(sd->children); ++i) + { + obj = eina_array_data_get(sd->children, i); _sub_obj_tree_dump(obj, lvl + 1); + } } else DBG("+ %s(%p)\n", evas_object_type_get(obj), obj); @@ -4750,8 +4783,12 @@ _sub_obj_tree_dot_dump(const Evas_Object *obj, Eina_List *l; Evas_Object *o; - EINA_LIST_FOREACH(sd->subobjs, l, o) - _sub_obj_tree_dot_dump(o, output); + + for (unsigned int i = 0; i < eina_array_count(sd->children); ++i) + { + o = eina_array_data_get(sd->children, i); + _sub_obj_tree_dot_dump(o, output); + } } #endif @@ -4804,7 +4841,8 @@ _efl_ui_widget_efl_object_constructor(Eo *obj, Elm_Widget_Smart_Data *sd EINA_UN else { ELM_WIDGET_DATA_GET(parent, parent_sd); - sd->shared_win_data = parent_sd->shared_win_data; + if (parent_sd) + sd->shared_win_data = parent_sd->shared_win_data; } } else @@ -4858,6 +4896,11 @@ _efl_ui_widget_efl_object_destructor(Eo *obj, Elm_Widget_Smart_Data *sd) efl_weak_unref(&sd->logical.parent); sd->logical.parent = NULL; } + if (sd->children) + { + eina_array_free(sd->children); + sd->children = NULL; + } sd->on_destroy = EINA_TRUE; efl_destructor(efl_super(obj, EFL_UI_WIDGET_CLASS)); @@ -4946,12 +4989,14 @@ _efl_ui_widget_efl_access_object_i18n_name_get(const Eo *obj, Elm_Widget_Smart_D EOLIAN static Eina_List* _efl_ui_widget_efl_access_object_access_children_get(const Eo *obj EINA_UNUSED, Elm_Widget_Smart_Data *pd) { - Eina_List *l, *accs = NULL; + Eina_List *accs = NULL; Evas_Object *widget; Efl_Access_Type type; - EINA_LIST_FOREACH(pd->subobjs, l, widget) + for (unsigned int i = 0; i < eina_array_count(pd->children); ++i) { + widget = eina_array_data_get(pd->children, i); + if (!elm_object_widget_check(widget)) continue; if (!efl_isa(widget, EFL_ACCESS_OBJECT_MIXIN)) continue; type = efl_access_object_access_type_get(widget); @@ -5161,6 +5206,7 @@ elm_widget_on_show_region_hook_set(Eo *obj, void *data, Elm_Widget_On_Show_Regio { ELM_WIDGET_DATA_GET(obj, sd); + if (!sd) return; if ((sd->on_show_region_data == data) && (sd->on_show_region == func)) return; @@ -5210,7 +5256,7 @@ elm_widget_show_region_set(Eo *obj, Eina_Rect sr, Eina_Bool forceshow) do { parent_obj = sd->parent_obj; - if ((!parent_obj) || (!_elm_widget_is(parent_obj))) break; + if ((!parent_obj)) break; sd = efl_data_scope_get(parent_obj, MY_CLASS); if (!sd) break; @@ -5617,7 +5663,7 @@ _efl_ui_widget_part_efl_object_destructor(Eo *obj, Elm_Part_Data *pd) } static Efl_Canvas_Layout_Part_Type -_efl_ui_widget_part_efl_canvas_layout_part_type_get(const Eo *obj EINA_UNUSED, Elm_Part_Data *pd) +_efl_ui_widget_part_efl_canvas_layout_part_type_provider_part_type_get(const Eo *obj EINA_UNUSED, Elm_Part_Data *pd) { Elm_Widget_Smart_Data *sd = efl_data_scope_safe_get(pd->obj, MY_CLASS); EINA_SAFETY_ON_NULL_RETURN_VAL(sd, EFL_CANVAS_LAYOUT_PART_TYPE_NONE); @@ -5645,10 +5691,6 @@ _efl_ui_widget_part_efl_ui_property_bind_property_bind(Eo *obj, Elm_Part_Data *p return _efl_ui_property_bind(widget, obj, pd, ppd->part, key, property); } -#define EFL_UI_WIDGET_PART_EXTRA_OPS \ - EFL_OBJECT_OP_FUNC(efl_canvas_layout_part_type_get, _efl_ui_widget_part_efl_canvas_layout_part_type_get), \ - EFL_OBJECT_OP_FUNC(efl_gfx_entity_geometry_get, _efl_ui_widget_part_efl_gfx_entity_geometry_get) - #include "efl_ui_widget_part.eo.c" /* Efl.Part end */ @@ -5854,6 +5896,7 @@ _efl_ui_model_property_bind_changed(void *data, const Efl_Event *event) const char *prop; unsigned int i; + if (!pd) return; EINA_ARRAY_ITER_NEXT(evt->changed_properties, i, prop, it) { Efl_Ui_Property_Bound *lookup; @@ -5872,6 +5915,7 @@ _efl_ui_view_property_bind_changed(void *data, const Efl_Event *event) Eina_Stringshare *prop; unsigned int i; + if (!pd) return; EINA_ARRAY_ITER_NEXT(evt->changed_properties, i, prop, it) { Efl_Ui_Property_Bound *lookup; @@ -5905,6 +5949,7 @@ _efl_ui_widget_model_provider_model_change(void *data, const Efl_Event *event) { ELM_WIDGET_DATA_GET(data, pd); + if (!pd) return; efl_replace(&pd->properties.model, efl_ui_view_model_get(pd->properties.provider)); _efl_ui_widget_model_update(data, pd); @@ -5917,6 +5962,7 @@ _efl_ui_widget_model_provider_invalidate(void *data, const Efl_Event *event EINA { ELM_WIDGET_DATA_GET(data, pd); + if (!pd) return; efl_event_callback_array_del(pd->properties.provider, efl_ui_widget_model_provider_callbacks(), data); diff --git a/src/lib/elementary/efl_ui_widget_common.c b/src/lib/elementary/efl_ui_widget_common.c index c83fd07c92..97313e2037 100644 --- a/src/lib/elementary/efl_ui_widget_common.c +++ b/src/lib/elementary/efl_ui_widget_common.c @@ -61,13 +61,14 @@ static Efl_Ui_Widget* _next_widget(Efl_Gfx_Entity* o) { Efl_Ui_Widget *parent; - Eina_List *rel; parent = _fetch_parent_widget(o); ELM_WIDGET_DATA_GET_OR_RETURN(parent, pd, NULL); - rel = eina_list_data_find_list(pd->subobjs, o); - - return eina_list_data_get(eina_list_next(rel)); + unsigned int id; + if (eina_array_find(pd->children, o, &id) && id + 1 < eina_array_count(pd->children)) + return eina_array_data_get(pd->children, id + 1); + else + return NULL; } static Eina_Bool @@ -90,9 +91,9 @@ _widget_next(Widget_Iterator *it, void **data) } //If there is a child, go there - if (pd && pd->subobjs) + if (pd && eina_array_count(pd->children)) { - it->current = eina_list_data_get(pd->subobjs); + it->current = eina_array_data_get(pd->children, 0); goto deliver; } diff --git a/src/lib/elementary/efl_ui_widget_image.h b/src/lib/elementary/efl_ui_widget_image.h index de625b28b4..e3d7264509 100644 --- a/src/lib/elementary/efl_ui_widget_image.h +++ b/src/lib/elementary/efl_ui_widget_image.h @@ -97,6 +97,8 @@ struct _Efl_Ui_Image_Data Eina_Bool edit : 1; Eina_Bool edje : 1; Eina_Bool anim : 1; + Eina_Bool autoplay : 1; + Eina_Bool playback_loop : 1; Eina_Bool paused : 1; Eina_Bool async_enable : 1; Eina_Bool scale_up : 1; diff --git a/src/lib/elementary/efl_ui_widget_part.eo b/src/lib/elementary/efl_ui_widget_part.eo index 75dbfceb53..5329f7c6c0 100644 --- a/src/lib/elementary/efl_ui_widget_part.eo +++ b/src/lib/elementary/efl_ui_widget_part.eo @@ -1,4 +1,4 @@ -class Efl.Ui.Widget_Part extends Efl.Object implements Efl.Ui.Property_Bind +class Efl.Ui.Widget_Part extends Efl.Object implements Efl.Ui.Property_Bind, Efl.Gfx.Entity, Efl.Canvas.Layout_Part_Type_Provider { [[This is the base class for all "Part" handles in Efl.Ui widgets. @@ -12,5 +12,11 @@ class Efl.Ui.Widget_Part extends Efl.Object implements Efl.Ui.Property_Bind implements { Efl.Object.destructor; Efl.Ui.Property_Bind.property_bind; + @empty Efl.Gfx.Entity.visible { get; set; } + Efl.Gfx.Entity.geometry { get; set @empty ; } + @empty Efl.Gfx.Entity.position { get; set; } + @empty Efl.Gfx.Entity.size { get; set; } + @empty Efl.Gfx.Entity.scale { set; get; } + Efl.Canvas.Layout_Part_Type_Provider.part_type { get; } } } diff --git a/src/lib/elementary/efl_ui_widget_scrollable_content.eo b/src/lib/elementary/efl_ui_widget_scrollable_content.eo index 90bed2176d..82de9eae00 100644 --- a/src/lib/elementary/efl_ui_widget_scrollable_content.eo +++ b/src/lib/elementary/efl_ui_widget_scrollable_content.eo @@ -1,7 +1,7 @@ import eina_types; parse efl_text_format; -mixin @beta Efl.Ui.Widget_Scrollable_Content requires Efl.Object +mixin Efl.Ui.Widget_Scrollable_Content requires Efl.Object { [[Mixin helper to add scrollable content to widgets. diff --git a/src/lib/elementary/efl_ui_win.c b/src/lib/elementary/efl_ui_win.c index e6fb0191b4..4ce4c0e809 100644 --- a/src/lib/elementary/efl_ui_win.c +++ b/src/lib/elementary/efl_ui_win.c @@ -40,6 +40,8 @@ #define FRAME_OBJ_THEME_MIN_VERSION 119 +extern void ecore_evas_dnd_mark_motion_used(Ecore_Evas *ee, unsigned int seat); + Ecore_Evas *_wayland_shm_new(const char *disp_name, Ecore_Window parent, int x, int y, int w, int h, Eina_Bool frame); Ecore_Evas *_wayland_egl_new(const char *disp_name, Ecore_Window parent, int x, int y, int w, int h, Eina_Bool frame, const int *opt); @@ -59,7 +61,7 @@ static int _paused_windows = 0; while (0) #define ELM_WIN_DATA_GET(o, sd) \ - Efl_Ui_Win_Data * sd = efl_data_scope_get(o, MY_CLASS) + Efl_Ui_Win_Data *sd = efl_data_scope_get(o, MY_CLASS) #define ELM_WIN_DATA_GET_OR_RETURN(o, ptr, ...) \ ELM_WIN_DATA_GET(o, ptr); \ @@ -210,8 +212,12 @@ struct _Efl_Ui_Win_Data int norender; int modal_count; int response; + int ignore_frame_resize; Eina_Bool req_wh : 1; Eina_Bool req_xy : 1; + Eina_Array *selection_changed; + Eina_Array *planned_changes; + Eina_Inarray *drop_target; struct { short pointer_move; @@ -381,6 +387,8 @@ static void _elm_win_frame_style_update(Efl_Ui_Win_Data *sd, Eina_Bool force_emi static inline void _elm_win_need_frame_adjust(Efl_Ui_Win_Data *sd, const char *engine); static void _elm_win_resize_objects_eval(Evas_Object *obj, Eina_Bool force_resize); static void _elm_win_frame_obj_update(Efl_Ui_Win_Data *sd, Eina_Bool force); +static void _ee_backbone_init(Efl_Ui_Win *obj, Efl_Ui_Win_Data *pd); +static void _ee_backbone_shutdown(Efl_Ui_Win *obj, Efl_Ui_Win_Data *pd); static inline Efl_Ui_Win_Type _elm_win_type_to_efl_ui_win_type(Elm_Win_Type type) @@ -466,6 +474,69 @@ _elm_win_first_frame_do(void *data, Evas *e EINA_UNUSED, void *event_info EINA_U evas_event_callback_del_full(e, EVAS_CALLBACK_RENDER_POST, _elm_win_first_frame_do, data); } +Ecore_X_Window +_elm_ee_xwin_get(const Ecore_Evas *ee) +{ +#ifdef HAVE_ELEMENTARY_X + const char *engine_name; + if (!ee) return 0; + + engine_name = ecore_evas_engine_name_get(ee); + if (EINA_UNLIKELY(!engine_name)) return 0; + + if (!strcmp(engine_name, ELM_SOFTWARE_X11)) + { + return ecore_evas_software_x11_window_get(ee); + } + else if (!strcmp(engine_name, ELM_OPENGL_X11)) + { + return ecore_evas_gl_x11_window_get(ee); + } +#else + (void)ee; +#endif + return 0; +} + +#ifdef HAVE_ELEMENTARY_X +static void +_internal_elm_win_xwindow_get(Efl_Ui_Win_Data *sd) +{ + Ecore_X_Window pwin = sd->x.xwin; + sd->x.xwin = _elm_ee_xwin_get(sd->ee); + if (sd->x.xwin != pwin) + { + char buf[128]; + + snprintf(buf, sizeof(buf), "%x", sd->x.xwin); + eina_stringshare_del(sd->stack_id); + sd->stack_id = eina_stringshare_add(buf); + } +} +#endif + +Ecore_Wl2_Window * +_elm_ee_wlwin_get(const Ecore_Evas *ee) +{ +#ifdef HAVE_ELEMENTARY_WL2 + const char *engine_name; + + if (!ee) return NULL; + + engine_name = ecore_evas_engine_name_get(ee); + if (EINA_UNLIKELY(!engine_name)) return NULL; + + if ((!strcmp(engine_name, ELM_WAYLAND_SHM)) || + (!strcmp(engine_name, ELM_WAYLAND_EGL))) + { + return ecore_evas_wayland2_window_get(ee); + } +#else + (void)ee; +#endif + return NULL; +} + static void _win_noblank_eval(void) { @@ -481,6 +552,7 @@ _win_noblank_eval(void) if (sd->x.xwin) { + _internal_elm_win_xwindow_get(sd); if ((sd->noblank) && (!sd->minimized) && (!sd->withdrawn) && evas_object_visible_get(obj)) noblanks++; @@ -525,6 +597,7 @@ _elm_win_apply_alpha(Eo *obj EINA_UNUSED, Efl_Ui_Win_Data *sd) #ifdef HAVE_ELEMENTARY_X if (sd->x.xwin) { + _internal_elm_win_xwindow_get(sd); enabled |= (sd->csd.need && !sd->fullscreen); if (!ecore_x_screen_is_composited(0)) { @@ -937,13 +1010,13 @@ _elm_win_obj_intercept_lower(void *data, Evas_Object *obj EINA_UNUSED) static void _elm_win_obj_intercept_stack_above(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, Evas_Object *above EINA_UNUSED) { - INF("TODO: %s", __FUNCTION__); + INF("TODO: %s", __func__); } static void _elm_win_obj_intercept_stack_below(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, Evas_Object *below EINA_UNUSED) { - INF("TODO: %s", __FUNCTION__); + INF("TODO: %s", __func__); } static void @@ -1082,7 +1155,10 @@ _elm_win_pre_render(Ecore_Evas *ee) if (sd->pointer.obj) evas_object_show(sd->pointer.obj); #ifdef ELEMENTARY_X if (sd->type == ELM_WIN_TOOLTIP) - ecore_x_window_shape_input_rectangle_set(sd->x.xwin, 0, 0, 0, 0); + { + _internal_elm_win_xwindow_get(sd); + ecore_x_window_shape_input_rectangle_set(sd->x.xwin, 0, 0, 0, 0); + } #endif sd->first_draw = EINA_TRUE; /* set this to handle ecore-evas engine code which incorrectly @@ -1558,16 +1634,25 @@ _elm_win_frame_geometry_adjust(Efl_Ui_Win_Data *sd) { int fw, fh, ox, oy, ow, oh; evas_object_geometry_get(sd->frame_obj, NULL, NULL, &fw, &fh); + sd->ignore_frame_resize++; + evas_object_resize(sd->frame_obj, 1000, 1000); if (elm_widget_is_legacy(sd->obj)) edje_object_part_geometry_get(sd->frame_obj, "elm.spacer.opaque", &ox, &oy, &ow, &oh); else edje_object_part_geometry_get(sd->frame_obj, "efl.spacer.opaque", &ox, &oy, &ow, &oh); + evas_object_resize(sd->frame_obj, fw, fh); + sd->ignore_frame_resize--; + fw = 1000; fh = 1000; l = ox; t = oy; r = fw - ow - l; b = fh - oh - t; + if (l < 0) l = 0; + if (r < 0) r = 0; + if (t < 0) t = 0; + if (b < 0) b = 0; } ecore_evas_shadow_geometry_set(sd->ee, l, r, t, b); } @@ -1590,24 +1675,31 @@ _elm_win_frame_obj_update(Efl_Ui_Win_Data *sd, Eina_Bool force) int ox, oy, ow, oh; int cx, cy, cw, ch; int w, h; + int l, r, t, b; if (!sd->frame_obj) return; if (!sd->csd.need) return; _elm_win_frame_geometry_adjust(sd); + ecore_evas_shadow_geometry_get(sd->ee, &l, &r, &t, &b); + sd->ignore_frame_resize++; evas_object_geometry_get(sd->frame_obj, &ox, &oy, &ow, &oh); + evas_object_resize(sd->frame_obj, 1000, 1000); if (elm_widget_is_legacy(sd->obj)) edje_object_part_geometry_get(sd->frame_obj, "elm.spacer.content", &cx, &cy, &cw, &ch); else edje_object_part_geometry_get(sd->frame_obj, "efl.spacer.content", &cx, &cy, &cw, &ch); - - if (!_elm_win_framespace_set(sd, cx, cy, ow - cw, oh - ch) && (!force)) return; + evas_object_resize(sd->frame_obj, ow, oh); + sd->ignore_frame_resize--; + if (!_elm_win_framespace_set(sd, cx, cy, 1000 - cw, 1000 - ch) && (!force)) return; _elm_win_frame_geometry_adjust(sd); if (!sd->first_draw) return; evas_object_geometry_get(sd->obj, NULL, NULL, &w, &h); if (w && h) - TRAP(sd, resize, w, h); + { + TRAP(sd, resize, w, h); + } } static int @@ -1889,7 +1981,7 @@ _key_action_move(Evas_Object *obj, const char *params) // The handling for legacy is different due to elm_object_next set if (elm_widget_is_legacy(obj)) - elm_object_focus_next(obj, focus_dir); + elm_object_focus_next(obj, (Elm_Focus_Direction)focus_dir); else { Efl_Ui_Widget *o; @@ -3092,6 +3184,9 @@ _efl_ui_win_efl_canvas_group_group_del(Eo *obj, Efl_Ui_Win_Data *sd) eina_array_free(sd->profile.available); sd->profile.available = NULL; + eina_array_free(sd->planned_changes); + sd->planned_changes = NULL; + free(sd->wm_rot.rots); sd->wm_rot.rots = NULL; @@ -3208,7 +3303,7 @@ _efl_ui_win_efl_gfx_entity_size_set(Eo *obj, Efl_Ui_Win_Data *sd, Eina_Size2D sz evas_object_image_size_set(sd->img_obj, sz.w, sz.h); } - _elm_win_frame_geometry_adjust(sd); + _elm_win_frame_obj_update(sd, 1); if (!sd->response) { sd->req_wh = EINA_TRUE; @@ -3253,69 +3348,6 @@ _elm_win_delete_request(Ecore_Evas *ee) evas_object_unref(obj); } -Ecore_X_Window -_elm_ee_xwin_get(const Ecore_Evas *ee) -{ -#ifdef HAVE_ELEMENTARY_X - const char *engine_name; - if (!ee) return 0; - - engine_name = ecore_evas_engine_name_get(ee); - if (EINA_UNLIKELY(!engine_name)) return 0; - - if (!strcmp(engine_name, ELM_SOFTWARE_X11)) - { - return ecore_evas_software_x11_window_get(ee); - } - else if (!strcmp(engine_name, ELM_OPENGL_X11)) - { - return ecore_evas_gl_x11_window_get(ee); - } -#else - (void)ee; -#endif - return 0; -} - -#ifdef HAVE_ELEMENTARY_X -static void -_internal_elm_win_xwindow_get(Efl_Ui_Win_Data *sd) -{ - Ecore_X_Window pwin = sd->x.xwin; - sd->x.xwin = _elm_ee_xwin_get(sd->ee); - if (sd->x.xwin != pwin) - { - char buf[128]; - - snprintf(buf, sizeof(buf), "%x", sd->x.xwin); - eina_stringshare_del(sd->stack_id); - sd->stack_id = eina_stringshare_add(buf); - } -} -#endif - -Ecore_Wl2_Window * -_elm_ee_wlwin_get(const Ecore_Evas *ee) -{ -#ifdef HAVE_ELEMENTARY_WL2 - const char *engine_name; - - if (!ee) return NULL; - - engine_name = ecore_evas_engine_name_get(ee); - if (EINA_UNLIKELY(!engine_name)) return NULL; - - if ((!strcmp(engine_name, ELM_WAYLAND_SHM)) || - (!strcmp(engine_name, ELM_WAYLAND_EGL))) - { - return ecore_evas_wayland2_window_get(ee); - } -#else - (void)ee; -#endif - return NULL; -} - #ifdef HAVE_ELEMENTARY_WL2 static void _elm_win_wlwindow_get(Efl_Ui_Win_Data *sd) @@ -3476,6 +3508,7 @@ _elm_win_xwin_update(Efl_Ui_Win_Data *sd) _internal_elm_win_xwindow_get(sd); if (!sd->x.xwin) return; /* nothing more to do */ + _internal_elm_win_xwindow_get(sd); if (sd->stack_master_id) { @@ -3494,7 +3527,11 @@ _elm_win_xwin_update(Efl_Ui_Win_Data *sd) if (sd->parent) { ELM_WIN_DATA_GET(sd->parent, sdp); - if (sdp) ecore_x_icccm_transient_for_set(sd->x.xwin, sdp->x.xwin); + if (sdp) + { + _internal_elm_win_xwindow_get(sdp); + ecore_x_icccm_transient_for_set(sd->x.xwin, sdp->x.xwin); + } } } @@ -3708,12 +3745,12 @@ _elm_win_resize_objects_eval(Evas_Object *obj, Eina_Bool force_resize) maxh = sd->max_h; // Compatibility hack (for E) - if (sd->single_edje_content && !wx && !wy) + if (sd->single_edje_content && EINA_DBL_EQ(wx, 0) && EINA_DBL_EQ(wy, 0)) wx = wy = 1; - if (!wx) maxw = minw; + if (EINA_DBL_EQ(wx, 0)) maxw = minw; if (maxw < 1) maxw = 32767; - if (!wy) maxh = minh; + if (EINA_DBL_EQ(wy, 0)) maxh = minh; if (maxh < 1) maxh = 32767; if (maxw < minw) maxw = minw; if (maxh < minh) maxh = minh; @@ -3733,10 +3770,10 @@ _elm_win_resize_objects_eval(Evas_Object *obj, Eina_Bool force_resize) int fw, fh; evas_output_framespace_get(sd->evas, NULL, NULL, &fw, &fh); - minw += fw; - minh += fh; - maxw += fw; - maxh += fh; +// minw += fw; +// minh += fh; +// maxw += fw; +// maxh += fh; } sd->tmp_updating_hints = 1; @@ -3881,6 +3918,7 @@ _elm_win_client_message(void *data, Ecore_X_Event_Client_Message *e = event; if (e->format != 32) return ECORE_CALLBACK_PASS_ON; + _internal_elm_win_xwindow_get(sd); if (e->message_type == ECORE_X_ATOM_E_COMP_FLUSH) { if ((unsigned int)e->data.l[0] == sd->x.xwin) @@ -3983,6 +4021,7 @@ _elm_win_property_change(void *data, if (e->atom == ECORE_X_ATOM_E_ILLUME_INDICATOR_STATE) { + _internal_elm_win_xwindow_get(sd); if (e->win == sd->x.xwin) { sd->legacy.indmode = (Elm_Win_Indicator_Mode)ecore_x_e_illume_indicator_state_get(e->win); @@ -4215,6 +4254,7 @@ _elm_win_frame_obj_resize(void *data, if (!(sd = data)) return; if (!sd->legacy.edje) return; + if (sd->ignore_frame_resize > 0) return; _elm_win_frame_obj_update(sd, 0); } @@ -4303,6 +4343,7 @@ _win_move_start(Efl_Ui_Win_Data *sd) { int x, y; + _internal_elm_win_xwindow_get(sd); sd->resizing = EINA_TRUE; ecore_x_pointer_ungrab(); ecore_x_pointer_root_xy_get(&x, &y); @@ -4356,6 +4397,7 @@ _win_move_resize_start(Efl_Ui_Win_Data *sd, Efl_Ui_Win_Move_Resize_Mode mode) if (sd->x.xwin) { int x, y; + _internal_elm_win_xwindow_get(sd); ecore_x_pointer_ungrab(); ecore_x_pointer_root_xy_get(&x, &y); ecore_x_netwm_moveresize_request_send(sd->x.xwin, x, y, ri->x_dir, 1); @@ -4761,7 +4803,9 @@ _elm_win_frame_add(Efl_Ui_Win_Data *sd, const char *element, const char *style) _elm_win_frame_geometry_adjust(sd); ecore_evas_geometry_get(sd->ee, NULL, NULL, &w, &h); if ((w > 1) && (h > 1)) - ecore_evas_resize(sd->ee, w, h); + { + ecore_evas_resize(sd->ee, w, h); + } } static void @@ -4948,7 +4992,8 @@ _elm_x_io_err(void *data EINA_UNUSED) EINA_LIST_FOREACH(_elm_win_list, l, obj) evas_object_smart_callback_call(obj, "ioerr", NULL); - elm_exit(); + fprintf(stderr, "X I/O Error - fatal. Exiting\n"); + exit(101); } #endif @@ -5117,46 +5162,43 @@ static void _gesture_manager_config_load(Eo *obj) { Eina_Value val; - Efl_Canvas_Gesture_Manager *gm = efl_provider_find(obj, EFL_CANVAS_GESTURE_MANAGER_CLASS); + Eo *gm = efl_provider_find(obj, EFL_CONFIG_INTERFACE); eina_value_setup(&val, EINA_VALUE_TYPE_DOUBLE); eina_value_set(&val, _elm_config->glayer_long_tap_start_timeout); - efl_gesture_manager_config_set(gm, "glayer_long_tap_start_timeout", &val); + efl_config_set(gm, "glayer_long_tap_start_timeout", &val); eina_value_set(&val, _elm_config->glayer_double_tap_timeout); - efl_gesture_manager_config_set(gm, "glayer_double_tap_timeout", &val); - - eina_value_set(&val, _elm_config->thumbscroll_friction); - efl_gesture_manager_config_set(gm, "thumbscroll_friction", &val); + efl_config_set(gm, "glayer_double_tap_timeout", &val); - eina_value_set(&val, _elm_config->thumbscroll_momentum_threshold); - efl_gesture_manager_config_set(gm, "thumbscroll_momentum_threshold", &val); + elm_config_scroll_thumbscroll_friction_set(_elm_config->thumbscroll_friction); + elm_config_scroll_thumbscroll_momentum_threshold_set(_elm_config->thumbscroll_momentum_threshold); eina_value_set(&val, _elm_config->glayer_line_min_length); - efl_gesture_manager_config_set(gm, "glayer_line_min_length", &val); + efl_config_set(gm, "glayer_line_min_length", &val); eina_value_set(&val, _elm_config->glayer_line_distance_tolerance); - efl_gesture_manager_config_set(gm, "glayer_line_distance_tolerance", &val); + efl_config_set(gm, "glayer_line_distance_tolerance", &val); eina_value_set(&val, _elm_config->glayer_line_angular_tolerance); - efl_gesture_manager_config_set(gm, "glayer_line_angular_tolerance", &val); + efl_config_set(gm, "glayer_line_angular_tolerance", &val); eina_value_set(&val, _elm_config->glayer_zoom_finger_factor); - efl_gesture_manager_config_set(gm, "glayer_zoom_finger_factor", &val); + efl_config_set(gm, "glayer_zoom_finger_factor", &val); eina_value_set(&val, _elm_config->glayer_zoom_distance_tolerance); - efl_gesture_manager_config_set(gm, "glayer_zoom_distance_tolerance", &val); + efl_config_set(gm, "glayer_zoom_distance_tolerance", &val); eina_value_setup(&val, EINA_VALUE_TYPE_UINT); eina_value_set(&val, _elm_config->glayer_flick_time_limit_ms); - efl_gesture_manager_config_set(gm, "glayer_flick_time_limit_ms", &val); + efl_config_set(gm, "glayer_flick_time_limit_ms", &val); eina_value_setup(&val, EINA_VALUE_TYPE_UCHAR); eina_value_set(&val, _elm_config->glayer_continues_enable); - efl_gesture_manager_config_set(gm, "glayer_continues_enable", &val); + efl_config_set(gm, "glayer_continues_enable", &val); eina_value_set(&val, _elm_config->glayer_zoom_finger_enable); - efl_gesture_manager_config_set(gm, "glayer_zoom_finger_enable", &val); + efl_config_set(gm, "glayer_zoom_finger_enable", &val); } static Eo * @@ -5567,7 +5609,7 @@ _elm_win_finalize_internal(Eo *obj, Efl_Ui_Win_Data *sd, const char *name, Efl_U else if ((engine) && (!strncmp(engine, "shot:", 5))) _shot_init(sd); - sd->kbdmode = ELM_WIN_KEYBOARD_UNKNOWN; + sd->kbdmode = EFL_UI_WIN_KEYBOARD_MODE_UNKNOWN; sd->legacy.indmode = ELM_WIN_INDICATOR_UNKNOWN; sd->indimode = EFL_UI_WIN_INDICATOR_MODE_OFF; @@ -5902,6 +5944,7 @@ _efl_ui_win_efl_object_finalize(Eo *obj, Efl_Ui_Win_Data *sd) efl_file_mmap_get(efl_super(efl_part(obj, "background"), EFL_UI_WIN_PART_CLASS))) efl_file_load(efl_part(obj, "background")); } + _ee_backbone_init(obj, sd); return obj; } @@ -5937,6 +5980,8 @@ _efl_ui_win_efl_object_destructor(Eo *obj, Efl_Ui_Win_Data *pd EINA_UNUSED) if (pd->finalize_future) eina_future_cancel(pd->finalize_future); + _ee_backbone_shutdown(obj, pd); + efl_destructor(efl_super(obj, MY_CLASS)); efl_unref(pd->provider); @@ -5953,6 +5998,7 @@ _efl_ui_win_efl_object_constructor(Eo *obj, Efl_Ui_Win_Data *pd) pd->provider = efl_add_ref(EFL_UI_FOCUS_PARENT_PROVIDER_STANDARD_CLASS, NULL); pd->profile.available = eina_array_new(4); pd->max_w = pd->max_h = -1; + pd->planned_changes = eina_array_new(10); // For bindings: if no parent, allow simple unref if (!efl_parent_get(obj)) @@ -6224,6 +6270,7 @@ _efl_ui_win_center(Eo *obj, Efl_Ui_Win_Data *sd, Eina_Bool h, Eina_Bool v) static Ecore_X_Atom state = 0; static Ecore_X_Atom centered = 0; + _internal_elm_win_xwindow_get(sd); if (!centered) centered = ecore_x_atom_get ("__E_ATOM_WINDOW_STATE_CENTERED"); if (!state) state = ecore_x_atom_get @@ -6908,8 +6955,11 @@ _efl_ui_win_keyboard_mode_set(Eo *obj EINA_UNUSED, Efl_Ui_Win_Data *sd, Efl_Ui_W sd->kbdmode = mode; #ifdef HAVE_ELEMENTARY_X if (sd->x.xwin) - ecore_x_e_virtual_keyboard_state_set - (sd->x.xwin, (Ecore_X_Virtual_Keyboard_State)sd->kbdmode); + { + _internal_elm_win_xwindow_get(sd); + ecore_x_e_virtual_keyboard_state_set + (sd->x.xwin, (Ecore_X_Virtual_Keyboard_State)sd->kbdmode); + } #endif } @@ -7131,7 +7181,8 @@ _efl_ui_win_stack_master_id_set(Eo *obj EINA_UNUSED, Efl_Ui_Win_Data *sd, const if (sd->shown) return; eina_stringshare_replace(&(sd->stack_master_id), id); #ifdef HAVE_ELEMENTARY_X - if (sd->x.xwin) _elm_win_xwin_update(sd); + if (sd->x.xwin) + _elm_win_xwin_update(sd); else #endif { @@ -7214,6 +7265,7 @@ _efl_ui_win_stack_pop_to(Eo *obj EINA_UNUSED, Efl_Ui_Win_Data *sd) int i, num = 0; Eina_Bool del = EINA_FALSE; + _internal_elm_win_xwindow_get(sd); ecore_x_grab(); _x_transients_for_list (ecore_x_window_root_get(sd->x.xwin), @@ -7269,6 +7321,7 @@ elm_win_floating_mode_set(Evas_Object *obj, Eina_Bool floating) _internal_elm_win_xwindow_get(sd); if (sd->x.xwin) { + _internal_elm_win_xwindow_get(sd); if (sd->floating) ecore_x_e_illume_window_state_set (sd->x.xwin, ECORE_X_ILLUME_WINDOW_STATE_FLOATING); @@ -7544,29 +7597,28 @@ _elm_win_bg_set(Efl_Ui_Win_Data *sd, Eo *bg) /* Legacy theme compatibility */ static Eina_Bool -_elm_win_bg_must_swallow(Efl_Ui_Win_Data *sd) +_elm_win_bg_must_swallow(Efl_Ui_Win_Data *sd, Eo **bg) { if (EINA_UNLIKELY(!sd->legacy.bg_must_swallow_init)) { /* Overkill: check which theme version the standard elm_bg uses */ Elm_Widget_Smart_Data *wd; const char *version; - Eo *bg; int v; sd->legacy.bg_must_swallow = 1; sd->legacy.bg_must_swallow_init = 1; if (sd->legacy.ctor) - bg = elm_bg_add(sd->obj); + *bg = elm_bg_add(sd->obj); else { // Note: This code path is probably not necessary (custom legacy // theme but efl_add'ed window -- all efl_add'ed widgets would // use default theme) - bg = efl_add(EFL_UI_BG_CLASS, sd->obj); + *bg = efl_add(EFL_UI_BG_CLASS, sd->obj); } - wd = efl_data_scope_get(bg, EFL_UI_WIDGET_CLASS); + wd = efl_data_scope_get(*bg, EFL_UI_WIDGET_CLASS); if (wd) { version = edje_object_data_get(wd->resize_obj, "version"); @@ -7574,7 +7626,6 @@ _elm_win_bg_must_swallow(Efl_Ui_Win_Data *sd) if (v >= FRAME_OBJ_THEME_MIN_VERSION) sd->legacy.bg_must_swallow = 0; } - evas_object_del(bg); } return sd->legacy.bg_must_swallow; @@ -7585,29 +7636,33 @@ _elm_win_standard_init(Eo *obj) { /* Support for elm_util_win_standard_add() and Efl.Ui.Win.Standard */ Efl_Ui_Win_Data *sd = efl_data_scope_get(obj, MY_CLASS); + Eo *bg = NULL; ELM_SAFE_DEL(sd->bg); sd->csd.need_bg_standard = 1; - if (!_elm_win_bg_must_swallow(sd)) + if (!_elm_win_bg_must_swallow(sd, &bg)) { sd->csd.need_bg_solid = EINA_TRUE; + evas_object_del(bg); } else { - Eo *bg; - /* Legacy theme compatibility */ DBG("Detected legacy theme used for elm_bg. Swallowing object."); sd->csd.need_bg_solid = EINA_FALSE; - if (sd->legacy.ctor) - bg = elm_bg_add(obj); - else + + if (!bg) { - // Note: This code path is probably not necessary (custom legacy - // theme but efl_add'ed window -- all efl_add'ed widgets would - // use default theme) - bg = efl_add(EFL_UI_BG_CLASS, obj); + if (sd->legacy.ctor) + bg = elm_bg_add(obj); + else + { + // Note: This code path is probably not necessary (custom legacy + // theme but efl_add'ed window -- all efl_add'ed widgets would + // use default theme) + bg = efl_add(EFL_UI_BG_CLASS, obj); + } } _elm_win_bg_set(sd, bg); } @@ -7884,6 +7939,7 @@ elm_win_xwindow_get(const Evas_Object *obj) if (!sd) return 0; #ifdef HAVE_ELEMENTARY_X + _internal_elm_win_xwindow_get(sd); if (sd->x.xwin) return sd->x.xwin; if (sd->parent) return elm_win_xwindow_get(sd->parent); #endif @@ -8007,6 +8063,7 @@ elm_win_quickpanel_set(Evas_Object *obj, Eina_Bool quickpanel) _internal_elm_win_xwindow_get(sd); if (sd->x.xwin) { + _internal_elm_win_xwindow_get(sd); ecore_x_e_illume_quickpanel_set(sd->x.xwin, quickpanel); if (quickpanel) { @@ -8033,7 +8090,10 @@ elm_win_quickpanel_get(const Evas_Object *obj) #ifdef HAVE_ELEMENTARY_X _internal_elm_win_xwindow_get(sd); if (sd->x.xwin) - return ecore_x_e_illume_quickpanel_get(sd->x.xwin); + { + _internal_elm_win_xwindow_get(sd); + return ecore_x_e_illume_quickpanel_get(sd->x.xwin); + } #else (void)sd; #endif @@ -8050,7 +8110,10 @@ elm_win_quickpanel_priority_major_set(Evas_Object *obj, int priority) #ifdef HAVE_ELEMENTARY_X _internal_elm_win_xwindow_get(sd); if (sd->x.xwin) - ecore_x_e_illume_quickpanel_priority_major_set(sd->x.xwin, priority); + { + _internal_elm_win_xwindow_get(sd); + ecore_x_e_illume_quickpanel_priority_major_set(sd->x.xwin, priority); + } #else (void)sd; (void)priority; @@ -8066,7 +8129,10 @@ elm_win_quickpanel_priority_major_get(const Evas_Object *obj) #ifdef HAVE_ELEMENTARY_X _internal_elm_win_xwindow_get(sd); if (sd->x.xwin) - return ecore_x_e_illume_quickpanel_priority_major_get(sd->x.xwin); + { + _internal_elm_win_xwindow_get(sd); + return ecore_x_e_illume_quickpanel_priority_major_get(sd->x.xwin); + } #else (void)sd; #endif @@ -8083,7 +8149,10 @@ elm_win_quickpanel_priority_minor_set(Evas_Object *obj, int priority) #ifdef HAVE_ELEMENTARY_X _internal_elm_win_xwindow_get(sd); if (sd->x.xwin) - ecore_x_e_illume_quickpanel_priority_minor_set(sd->x.xwin, priority); + { + _internal_elm_win_xwindow_get(sd); + ecore_x_e_illume_quickpanel_priority_minor_set(sd->x.xwin, priority); + } #else (void)sd; (void)priority; @@ -8099,7 +8168,10 @@ elm_win_quickpanel_priority_minor_get(const Evas_Object *obj) #ifdef HAVE_ELEMENTARY_X _internal_elm_win_xwindow_get(sd); if (sd->x.xwin) - return ecore_x_e_illume_quickpanel_priority_minor_get(sd->x.xwin); + { + _internal_elm_win_xwindow_get(sd); + return ecore_x_e_illume_quickpanel_priority_minor_get(sd->x.xwin); + } #else (void)sd; #endif @@ -8116,7 +8188,10 @@ elm_win_quickpanel_zone_set(Evas_Object *obj, int zone) #ifdef HAVE_ELEMENTARY_X _internal_elm_win_xwindow_get(sd); if (sd->x.xwin) - ecore_x_e_illume_quickpanel_zone_set(sd->x.xwin, zone); + { + _internal_elm_win_xwindow_get(sd); + ecore_x_e_illume_quickpanel_zone_set(sd->x.xwin, zone); + } #else (void)sd; (void)zone; @@ -8132,7 +8207,10 @@ elm_win_quickpanel_zone_get(const Evas_Object *obj) #ifdef HAVE_ELEMENTARY_X _internal_elm_win_xwindow_get(sd); if (sd->x.xwin) - return ecore_x_e_illume_quickpanel_zone_get(sd->x.xwin); + { + _internal_elm_win_xwindow_get(sd); + return ecore_x_e_illume_quickpanel_zone_get(sd->x.xwin); + } #else (void)sd; #endif @@ -8160,6 +8238,7 @@ elm_win_indicator_mode_set(Evas_Object *obj, Elm_Win_Indicator_Mode mode) #ifdef HAVE_ELEMENTARY_X if (sd->x.xwin) { + _internal_elm_win_xwindow_get(sd); if (sd->legacy.indmode == ELM_WIN_INDICATOR_SHOW) ecore_x_e_illume_indicator_state_set (sd->x.xwin, ECORE_X_ILLUME_INDICATOR_STATE_ON); @@ -8205,6 +8284,7 @@ elm_win_indicator_opacity_set(Evas_Object *obj, Elm_Win_Indicator_Opacity_Mode m _internal_elm_win_xwindow_get(sd); if (sd->x.xwin) { + _internal_elm_win_xwindow_get(sd); if (sd->legacy.ind_o_mode == ELM_WIN_INDICATOR_OPAQUE) ecore_x_e_illume_indicator_opacity_set (sd->x.xwin, ECORE_X_ILLUME_INDICATOR_OPAQUE); @@ -8244,7 +8324,10 @@ elm_win_keyboard_win_set(Evas_Object *obj, Eina_Bool is_keyboard) #ifdef HAVE_ELEMENTARY_X _internal_elm_win_xwindow_get(sd); if (sd->x.xwin) - ecore_x_e_virtual_keyboard_set(sd->x.xwin, is_keyboard); + { + _internal_elm_win_xwindow_get(sd); + ecore_x_e_virtual_keyboard_set(sd->x.xwin, is_keyboard); + } #else (void)sd; (void)is_keyboard; @@ -8259,7 +8342,11 @@ elm_win_keyboard_win_get(const Evas_Object *obj) #ifdef HAVE_ELEMENTARY_X _internal_elm_win_xwindow_get(sd); - if (sd->x.xwin) return ecore_x_e_virtual_keyboard_get(sd->x.xwin); + if (sd->x.xwin) + { + _internal_elm_win_xwindow_get(sd); + return ecore_x_e_virtual_keyboard_get(sd->x.xwin); + } #else (void)sd; #endif @@ -8275,7 +8362,10 @@ elm_win_conformant_set(Evas_Object *obj, Eina_Bool conformant) #ifdef HAVE_ELEMENTARY_X _internal_elm_win_xwindow_get(sd); if (sd->x.xwin) - ecore_x_e_illume_conformant_set(sd->x.xwin, conformant); + { + _internal_elm_win_xwindow_get(sd); + ecore_x_e_illume_conformant_set(sd->x.xwin, conformant); + } #else (void)sd; (void)conformant; @@ -8291,7 +8381,10 @@ elm_win_conformant_get(const Evas_Object *obj) #ifdef HAVE_ELEMENTARY_X _internal_elm_win_xwindow_get(sd); if (sd->x.xwin) - return ecore_x_e_illume_conformant_get(sd->x.xwin); + { + _internal_elm_win_xwindow_get(sd); + return ecore_x_e_illume_conformant_get(sd->x.xwin); + } #else (void)sd; #endif @@ -8594,6 +8687,7 @@ elm_win_illume_command_send(Evas_Object *obj, Elm_Illume_Command command, void * _internal_elm_win_xwindow_get(sd); if (sd->x.xwin) { + _internal_elm_win_xwindow_get(sd); switch (command) { case ELM_ILLUME_COMMAND_FOCUS_BACK: @@ -8703,7 +8797,11 @@ _elm_win_window_id_get(Efl_Ui_Win_Data *sd) #endif #ifdef HAVE_ELEMENTARY_X _internal_elm_win_xwindow_get(sd); - if (sd->x.xwin) return (Ecore_Window)sd->x.xwin; + if (sd->x.xwin) + { + _internal_elm_win_xwindow_get(sd); + return (Ecore_Window)sd->x.xwin; + } if (sd->parent) { Ecore_Window xwin = elm_win_xwindow_get(sd->parent); @@ -8772,6 +8870,7 @@ elm_win_main_menu_get(Evas_Object *obj) #ifdef HAVE_ELEMENTARY_X if (use_dbus && _elm_dbus_menu_register(sd->main_menu)) { + _internal_elm_win_xwindow_get(sd); _elm_dbus_menu_app_menu_register(sd->x.xwin, sd->main_menu, _dbus_menu_set, obj); } @@ -8954,6 +9053,7 @@ elm_win_keygrab_set(Elm_Win *obj, const char *key, _internal_elm_win_xwindow_get(sd); if (sd->x.xwin) { + _internal_elm_win_xwindow_get(sd); Ecore_X_Win_Keygrab_Mode x_grab_mode; switch (grab_mode) { @@ -8994,7 +9094,10 @@ elm_win_keygrab_unset(Elm_Win *obj, const char *key, EINA_SAFETY_ON_NULL_RETURN_VAL(sd, EINA_FALSE); _internal_elm_win_xwindow_get(sd); if (sd->x.xwin) - ret = ecore_x_window_keygrab_unset(sd->x.xwin, key, 0, 0); + { + _internal_elm_win_xwindow_get(sd); + ret = ecore_x_window_keygrab_unset(sd->x.xwin, key, 0, 0); + } #else (void)obj; (void)key; @@ -9060,47 +9163,322 @@ elm_win_available_profiles_set(Elm_Win *obj, const char **profiles, unsigned int EAPI void elm_win_fake_canvas_set(Evas_Object *obj EINA_UNUSED, Ecore_Evas *oee EINA_UNUSED) { - ERR("Calling deprecrated function '%s'", __FUNCTION__); + ERR("Calling deprecrated function '%s'", __func__); } EAPI void elm_win_name_set(Evas_Object *obj, const char *name) { - ERR("Calling deprecrated function '%s'", __FUNCTION__); + ERR("Calling deprecrated function '%s'", __func__); efl_ui_win_name_set(obj, name); } EAPI void elm_win_type_set(Evas_Object *obj, Elm_Win_Type type) { - ERR("Calling deprecrated function '%s'", __FUNCTION__); + ERR("Calling deprecrated function '%s'", __func__); efl_ui_win_type_set(obj, _elm_win_type_to_efl_ui_win_type(type)); } EAPI void elm_win_teamwork_uri_preload(Efl_Ui_Win *obj EINA_UNUSED, const char *uri EINA_UNUSED) { - ERR("Calling deprecrated function '%s'", __FUNCTION__); + ERR("Calling deprecrated function '%s'", __func__); } EAPI void elm_win_teamwork_uri_show(Efl_Ui_Win *obj EINA_UNUSED, const char *uri EINA_UNUSED) { - ERR("Calling deprecrated function '%s'", __FUNCTION__); + ERR("Calling deprecrated function '%s'", __func__); } EAPI void elm_win_teamwork_uri_hide(Efl_Ui_Win *obj EINA_UNUSED) { - ERR("Calling deprecrated function '%s'", __FUNCTION__); + ERR("Calling deprecrated function '%s'", __func__); } EAPI void elm_win_teamwork_uri_open(Efl_Ui_Win *obj EINA_UNUSED, const char *uri EINA_UNUSED) { - ERR("Calling deprecrated function '%s'", __FUNCTION__); + ERR("Calling deprecrated function '%s'", __func__); +} + +/* What here follows is code that implements the glue between ecore evas and efl_ui* side */ +typedef struct { + Eo *obj; + Eina_Bool currently_inside; +} Ui_Dnd_Target; + +static inline Efl_Ui_Cnp_Buffer +_ui_buffer_get(Ecore_Evas_Selection_Buffer buffer) +{ + if (buffer == ECORE_EVAS_SELECTION_BUFFER_SELECTION_BUFFER) + return EFL_UI_CNP_BUFFER_SELECTION; + else if (buffer == ECORE_EVAS_SELECTION_BUFFER_COPY_AND_PASTE_BUFFER) + return EFL_UI_CNP_BUFFER_COPY_AND_PASTE; + + return -1; +} + +void +_register_selection_changed(Efl_Ui_Selection *selection) +{ + ELM_WIN_DATA_GET(efl_provider_find(selection, EFL_UI_WIN_CLASS), pd); + + eina_array_push(pd->planned_changes, selection); +} + +static Eina_Bool +_remove_object(void *data, void *gdata) +{ + if (data == gdata) + return EINA_FALSE; + return EINA_TRUE; +} + +static void +_selection_changed_cb(Ecore_Evas *ee, unsigned int seat, Ecore_Evas_Selection_Buffer selection) +{ + Efl_Ui_Win_Data *pd = _elm_win_associate_get(ee); + Efl_Ui_Wm_Selection_Changed changed = { + .seat = seat, + .buffer = _ui_buffer_get(selection), + .caused_by = eina_array_count(pd->planned_changes) > 0 ? eina_array_data_get(pd->planned_changes, 0) : NULL, + }; + + for (unsigned int i = 0; i < eina_array_count(pd->selection_changed); ++i) + { + Eo *obj = eina_array_data_get(pd->selection_changed, i); + + efl_event_callback_call(obj, EFL_UI_SELECTION_EVENT_WM_SELECTION_CHANGED, &changed); + } + + if (changed.caused_by) + eina_array_remove(pd->planned_changes, _remove_object, changed.caused_by); +} + +static void +_motion_cb(Ecore_Evas *ee, unsigned int seat, Eina_Position2D p) +{ + Efl_Ui_Win_Data *pd = _elm_win_associate_get(ee); + for (unsigned int i = 0; i < eina_inarray_count(pd->drop_target); ++i) + { + Ui_Dnd_Target *target = eina_inarray_nth(pd->drop_target, i); + Eina_Rect rect = efl_gfx_entity_geometry_get(target->obj); + Eina_Bool inside = eina_rectangle_coords_inside(&rect.rect, p.x, p.y); + Efl_Ui_Drop_Event ev = {p, seat, ecore_evas_drop_available_types_get(ee, seat)}; + + if (target->currently_inside && !inside) + { + target->currently_inside = EINA_FALSE; + efl_event_callback_call(target->obj, EFL_UI_DND_EVENT_DROP_LEFT, &ev); + ecore_evas_dnd_mark_motion_used(ee, seat); + } + else if (!target->currently_inside && inside) + { + target->currently_inside = EINA_TRUE; + efl_event_callback_call(target->obj, EFL_UI_DND_EVENT_DROP_ENTERED, &ev); + ecore_evas_dnd_mark_motion_used(ee, seat); + } + else if (target->currently_inside && inside) + { + efl_event_callback_call(target->obj, EFL_UI_DND_EVENT_DROP_POSITION_CHANGED, &ev); + ecore_evas_dnd_mark_motion_used(ee, seat); + } + eina_accessor_free(ev.available_types); + } +} + +static void +_enter_state_change_cb(Ecore_Evas *ee, unsigned int seat EINA_UNUSED, Eina_Position2D p, Eina_Bool move_inside) +{ + Efl_Ui_Win_Data *pd = _elm_win_associate_get(ee); + for (unsigned int i = 0; i < eina_inarray_count(pd->drop_target); ++i) + { + Ui_Dnd_Target *target = eina_inarray_nth(pd->drop_target, i); + Eina_Rect rect = efl_gfx_entity_geometry_get(target->obj); + Eina_Bool inside = eina_rectangle_coords_inside(&rect.rect, p.x, p.y); + Efl_Ui_Drop_Event ev = {p, seat, ecore_evas_drop_available_types_get(ee, seat)}; + + if (inside && move_inside) + { + target->currently_inside = EINA_TRUE; + efl_event_callback_call(target->obj, EFL_UI_DND_EVENT_DROP_ENTERED, &ev); + } + else if (!move_inside && !target->currently_inside) + { + target->currently_inside = EINA_FALSE; + efl_event_callback_call(target->obj, EFL_UI_DND_EVENT_DROP_LEFT, &ev); + } + } } +static void +_drop_cb(Ecore_Evas *ee, unsigned int seat EINA_UNUSED, Eina_Position2D p, const char *action) +{ + Eina_List *itr, *top_objects_list = NULL; + Efl_Ui_Win_Data *pd = _elm_win_associate_get(ee); + Eina_Array *tmp = eina_array_new(10); + Eo *top_obj; + + for (unsigned int i = 0; i < eina_inarray_count(pd->drop_target); ++i) + { + Ui_Dnd_Target *target = eina_inarray_nth(pd->drop_target, i); + Eina_Rect rect = efl_gfx_entity_geometry_get(target->obj); + Eina_Bool inside = eina_rectangle_coords_inside(&rect.rect, p.x, p.y); + + if (inside) + { + EINA_SAFETY_ON_FALSE_GOTO(target->currently_inside, end); + eina_array_push(tmp, target->obj); + } + } + + /* We retrieve the (non-smart) objects pointed by (px, py) */ + top_objects_list = evas_tree_objects_at_xy_get(ecore_evas_get(ee), NULL, p.x, p.y); + /* We walk on this list from the last because if the list contains more than one + * element, all but the last will repeat events. The last one can repeat events + * or not. Anyway, this last one is the first that has to be taken into account + * for the determination of the drop target. + */ + EINA_LIST_REVERSE_FOREACH(top_objects_list, itr, top_obj) + { + Evas_Object *object = top_obj; + /* We search for the dropable data into the object. If not found, we search into its parent. + * For example, if a button is a drop target, the first object will be an (internal) image. + * The drop target is attached to the button, i.e to image's parent. That's why we need to + * walk on the parents until NULL. + * If we find this dropable data, we found our drop target. + */ + while (object) + { + unsigned int out_idx; + if (!eina_array_find(tmp, object, &out_idx)) + { + object = evas_object_smart_parent_get(object); + } + else + { + Efl_Ui_Drop_Dropped_Event ev = {{p, seat, ecore_evas_drop_available_types_get(ee, seat)}, action}; + efl_event_callback_call(object, EFL_UI_DND_EVENT_DROP_DROPPED, &ev); + goto end; + } + } + } +end: + eina_list_free(top_objects_list); + eina_array_free(tmp); +} + +static void +_ee_backbone_init(Efl_Ui_Win *obj EINA_UNUSED, Efl_Ui_Win_Data *pd) +{ + pd->selection_changed = eina_array_new(1); + pd->drop_target = eina_inarray_new(sizeof(Ui_Dnd_Target), 1); + + ecore_evas_callback_selection_changed_set(pd->ee, _selection_changed_cb); + ecore_evas_callback_drop_drop_set(pd->ee, _drop_cb); + ecore_evas_callback_drop_motion_set(pd->ee, _motion_cb); + ecore_evas_callback_drop_state_changed_set(pd->ee, _enter_state_change_cb); +} + +static void +_ee_backbone_shutdown(Efl_Ui_Win *obj EINA_UNUSED, Efl_Ui_Win_Data *pd) +{ + ecore_evas_callback_selection_changed_set(pd->ee, NULL); + ecore_evas_callback_drop_drop_set(pd->ee, NULL); + ecore_evas_callback_drop_motion_set(pd->ee, NULL); + ecore_evas_callback_drop_state_changed_set(pd->ee, NULL); + + eina_array_free(pd->selection_changed); + pd->selection_changed = NULL; + eina_inarray_free(pd->drop_target); + pd->drop_target = NULL; + +} + +static Eina_Bool +_remove(void *data, void *gdata) +{ + if (data == gdata) + return EINA_FALSE; + return EINA_TRUE; +} + +Efl_Ui_Win* +efl_ui_win_get(Evas_Object *obj) +{ + Efl_Ui_Win *win = efl_provider_find(obj, MY_CLASS); + if (!win) + { + Evas *e = evas_object_evas_get(obj); + Ecore_Evas *ee = ecore_evas_ecore_evas_get(e); + + win = ecore_evas_data_get(ee, "elm_win"); + } + EINA_SAFETY_ON_NULL_RETURN_VAL(win, NULL); + return win; +} + +static Efl_Ui_Win_Data* +_fetch_win_data_from_arbitary_obj(Efl_Canvas_Object *obj) +{ + Efl_Ui_Win *win = efl_ui_win_get(obj); + EINA_SAFETY_ON_NULL_RETURN_VAL(win, NULL); + Efl_Ui_Win_Data *pd = efl_data_scope_safe_get(win, MY_CLASS); + EINA_SAFETY_ON_NULL_RETURN_VAL(pd, NULL); + return pd; +} + +void +_drop_event_register(Eo *obj) +{ + Ui_Dnd_Target target = {obj, EINA_FALSE}; + Efl_Ui_Win_Data *pd = _fetch_win_data_from_arbitary_obj(obj); + if (!pd) return; + + eina_inarray_push(pd->drop_target, &target); +} + +void +_drop_event_unregister(Eo *obj) +{ + int idx = -1; + + Efl_Ui_Win_Data *pd = _fetch_win_data_from_arbitary_obj(obj); + if (!pd) return; + + for (unsigned int i = 0; i < eina_inarray_count(pd->drop_target); ++i) + { + Ui_Dnd_Target *target = eina_inarray_nth(pd->drop_target, i); + if (target->obj == obj) + { + //FIXME emit drop + target->currently_inside = EINA_FALSE; + idx = i; + } + } + if (idx != -1) + eina_inarray_remove_at(pd->drop_target, idx); +} + +void +_selection_changed_event_register(Eo *obj) +{ + Efl_Ui_Win_Data *pd = _fetch_win_data_from_arbitary_obj(obj); + if (!pd) return; + + eina_array_push(pd->selection_changed, obj); +} +void +_selection_changed_event_unregister(Eo *obj) +{ + Efl_Ui_Win_Data *pd = _fetch_win_data_from_arbitary_obj(obj); + if (!pd) return; + + eina_array_remove(pd->selection_changed, _remove, obj); +} /* Internal EO APIs and hidden overrides */ ELM_WIDGET_KEY_DOWN_DEFAULT_IMPLEMENT(efl_ui_win, Efl_Ui_Win_Data) @@ -9172,14 +9550,19 @@ elm_win_add(Evas_Object *parent, const char *name, Elm_Win_Type type) switch ((int) type) { - case ELM_WIN_INLINED_IMAGE: klass = EFL_UI_WIN_INLINED_LEGACY_CLASS; break; - case ELM_WIN_SOCKET_IMAGE: klass = EFL_UI_WIN_SOCKET_LEGACY_CLASS; break; - default: break; + case ELM_WIN_INLINED_IMAGE: + klass = EFL_UI_WIN_INLINED_LEGACY_CLASS; + break; + case ELM_WIN_SOCKET_IMAGE: + klass = EFL_UI_WIN_SOCKET_LEGACY_CLASS; + break; + default: + break; } return elm_legacy_add(klass, parent, efl_ui_win_name_set(efl_added, name), - efl_ui_win_type_set(efl_added, type)); + efl_ui_win_type_set(efl_added, (Efl_Ui_Win_Type)type)); } @@ -9226,13 +9609,13 @@ elm_win_util_dialog_add(Evas_Object *parent, const char *name, const char *title EAPI void elm_win_keyboard_mode_set(Evas_Object *obj, Elm_Win_Keyboard_Mode mode) { - efl_ui_win_keyboard_mode_set(obj, mode); + efl_ui_win_keyboard_mode_set(obj, (Efl_Ui_Win_Keyboard_Mode)mode); } EAPI Elm_Win_Keyboard_Mode elm_win_keyboard_mode_get(const Evas_Object *obj) { - return efl_ui_win_keyboard_mode_get(obj); + return (Elm_Win_Keyboard_Mode)efl_ui_win_keyboard_mode_get(obj); } EAPI void @@ -9429,7 +9812,7 @@ elm_win_center(Evas_Object *obj, Eina_Bool h, Eina_Bool v) EAPI Eina_Bool elm_win_move_resize_start(Evas_Object *obj, Elm_Win_Move_Resize_Mode mode) { - return efl_ui_win_move_resize_start(obj, mode); + return efl_ui_win_move_resize_start(obj, (Efl_Ui_Win_Move_Resize_Mode)mode); } EAPI void diff --git a/src/lib/elementary/efl_ui_win.eo b/src/lib/elementary/efl_ui_win.eo index 602acf506b..54686b0bae 100644 --- a/src/lib/elementary/efl_ui_win.eo +++ b/src/lib/elementary/efl_ui_win.eo @@ -835,9 +835,9 @@ class Efl.Ui.Win extends Efl.Ui.Widget implements Efl.Canvas.Scene, Efl.Access.W Efl.Part.part_get; } constructors { - .win_name @optional; + .win_name; .win_type @optional; - .accel_preference @optional; + .accel_preference; } events { delete,request: void; [[Called when the window receives a delete request]] diff --git a/src/lib/elementary/efl_ui_win_inlined_legacy_eo.h b/src/lib/elementary/efl_ui_win_inlined_legacy_eo.h index acacc7be02..4f706d0cbc 100644 --- a/src/lib/elementary/efl_ui_win_inlined_legacy_eo.h +++ b/src/lib/elementary/efl_ui_win_inlined_legacy_eo.h @@ -20,7 +20,7 @@ typedef Eo Efl_Ui_Win_Inlined_Legacy; */ #define EFL_UI_WIN_INLINED_LEGACY_CLASS efl_ui_win_inlined_legacy_class_get() -EWAPI const Efl_Class *efl_ui_win_inlined_legacy_class_get(void); +EWAPI const Efl_Class *efl_ui_win_inlined_legacy_class_get(void) EINA_CONST; #endif /* EFL_BETA_API_SUPPORT */ #endif diff --git a/src/lib/elementary/efl_ui_win_legacy_eo.h b/src/lib/elementary/efl_ui_win_legacy_eo.h index 70563cd14f..9d0ffb0303 100644 --- a/src/lib/elementary/efl_ui_win_legacy_eo.h +++ b/src/lib/elementary/efl_ui_win_legacy_eo.h @@ -20,7 +20,7 @@ typedef Eo Efl_Ui_Win_Legacy; */ #define EFL_UI_WIN_LEGACY_CLASS efl_ui_win_legacy_class_get() -EWAPI const Efl_Class *efl_ui_win_legacy_class_get(void); +EWAPI const Efl_Class *efl_ui_win_legacy_class_get(void) EINA_CONST; #endif /* EFL_BETA_API_SUPPORT */ #endif diff --git a/src/lib/elementary/efl_ui_win_socket_legacy_eo.h b/src/lib/elementary/efl_ui_win_socket_legacy_eo.h index b89a58aad1..5ed538f715 100644 --- a/src/lib/elementary/efl_ui_win_socket_legacy_eo.h +++ b/src/lib/elementary/efl_ui_win_socket_legacy_eo.h @@ -20,7 +20,7 @@ typedef Eo Efl_Ui_Win_Socket_Legacy; */ #define EFL_UI_WIN_SOCKET_LEGACY_CLASS efl_ui_win_socket_legacy_class_get() -EWAPI const Efl_Class *efl_ui_win_socket_legacy_class_get(void); +EWAPI const Efl_Class *efl_ui_win_socket_legacy_class_get(void) EINA_CONST; #endif /* EFL_BETA_API_SUPPORT */ #endif diff --git a/src/lib/elementary/elc_combobox.c b/src/lib/elementary/elc_combobox.c index 200745a97b..49a91c0012 100644 --- a/src/lib/elementary/elc_combobox.c +++ b/src/lib/elementary/elc_combobox.c @@ -209,10 +209,8 @@ _table_resize(void *data) else win_y_offset = obj_y; if (current_height < win_y_offset) - evas_object_size_hint_min_set(sd->spacer, obj_w * elm_config_scale_get(), - current_height + (2 * elm_config_scale_get())); - else evas_object_size_hint_min_set(sd->spacer, obj_w * elm_config_scale_get(), - win_y_offset * elm_config_scale_get()); + evas_object_size_hint_min_set(sd->spacer, obj_w, current_height); + else evas_object_size_hint_min_set(sd->spacer, obj_w, win_y_offset); } } diff --git a/src/lib/elementary/elc_ctxpopup.c b/src/lib/elementary/elc_ctxpopup.c index c99ccaeeed..fcf88e3b9d 100644 --- a/src/lib/elementary/elc_ctxpopup.c +++ b/src/lib/elementary/elc_ctxpopup.c @@ -681,7 +681,7 @@ _elm_ctxpopup_efl_ui_widget_theme_apply(Eo *obj, Elm_Ctxpopup_Data *sd) if (sd->list) { - if (!strncmp(elm_object_style_get(obj), "default", strlen("default"))) + if (eina_str_has_prefix(elm_object_style_get(obj),"default")) elm_object_style_set(sd->list, "ctxpopup"); else elm_object_style_set(sd->list, elm_object_style_get(obj)); @@ -1480,7 +1480,7 @@ _elm_ctxpopup_item_init(Eo *eo_item, if (!sd->list) { sd->list = elm_list_add(obj); - if (!strncmp(elm_object_style_get(obj), "default", strlen("default"))) + if (eina_str_has_prefix(elm_object_style_get(obj),"default")) elm_object_style_set(sd->list, "ctxpopup"); else elm_object_style_set(sd->list, elm_object_style_get(obj)); elm_list_mode_set(sd->list, ELM_LIST_EXPAND); diff --git a/src/lib/elementary/elc_ctxpopup.h b/src/lib/elementary/elc_ctxpopup.h index 6663f7e863..7008d58f6c 100644 --- a/src/lib/elementary/elc_ctxpopup.h +++ b/src/lib/elementary/elc_ctxpopup.h @@ -1,5 +1,5 @@ /** - * @defgroup Elm_Ctxpopup Ctxpopup + * @defgroup Elm_Ctxpopup_Group Ctxpopup * @ingroup Elementary * * @image html ctxpopup_inheritance_tree.png @@ -22,7 +22,7 @@ * functions acting on it also work for context popup objects (since 1.8). * * This widget emits the following signals, besides the ones sent from - * @ref Layout: + * @ref Elm_Layout : * - @c "dismissed" - This is called when 1. the outside of ctxpopup was clicked * or 2. its parent area is changed or 3. the language is changed and also when * 4. the parent object is resized due to the window rotation. Then ctxpopup is @@ -60,9 +60,13 @@ * @li @ref elm_object_item_focus_get * * @ref tutorial_ctxpopup shows the usage of a good deal of the API. - * @{ + * */ +/** + * @addtogroup Elm_Ctxpopup_Group + * @{ + */ #ifndef EFL_NOLEGACY_API_SUPPORT #include "elc_ctxpopup_legacy.h" #endif diff --git a/src/lib/elementary/elc_ctxpopup_legacy.h b/src/lib/elementary/elc_ctxpopup_legacy.h index d3181ed2cf..6c475515c9 100644 --- a/src/lib/elementary/elc_ctxpopup_legacy.h +++ b/src/lib/elementary/elc_ctxpopup_legacy.h @@ -4,7 +4,7 @@ * @param parent Parent object * @return New object or @c NULL, if it cannot be created * - * @ingroup Elm_Ctxpopup + * @ingroup Elm_Ctxpopup_Group */ EAPI Evas_Object *elm_ctxpopup_add(Evas_Object *parent); diff --git a/src/lib/elementary/elc_fileselector.c b/src/lib/elementary/elc_fileselector.c index 39f1a7cd3d..a74bb3fe27 100644 --- a/src/lib/elementary/elc_fileselector.c +++ b/src/lib/elementary/elc_fileselector.c @@ -17,7 +17,7 @@ #include "elm_priv.h" #include "eo_internal.h" #include <Elementary.h> -#include "Eio_Eo.h" +#include "Eio.h" #include "elm_fileselector_button_eo.h" #include "elm_fileselector_entry_eo.h" #include "elm_interface_fileselector.h" @@ -880,7 +880,7 @@ _listing_request_cleanup(Listing_Request *lreq) } static void -_process_model(Elm_Fileselector_Data *sd, Efl_Model *child) +_process_model(Elm_Fileselector_Data *sd, Efl_Model *child, Elm_Object_Item *fallback_parent_item) { Elm_Fileselector_Item_Data *it_data; Elm_Object_Item *item, *it_parent; @@ -927,6 +927,8 @@ _process_model(Elm_Fileselector_Data *sd, Efl_Model *child) it_data->is_dir = dir; it_parent = efl_key_data_get(parent, ".item.data"); + if (!it_parent) + it_parent = fallback_parent_item; if (dir) { @@ -981,7 +983,9 @@ _process_children_cb(Eo *model EINA_UNUSED, void *data, const Eina_Value v) if (!lreq->valid) goto end; EINA_VALUE_ARRAY_FOREACH(&v, len, i, child) - _process_model(lreq->sd, child); + { + _process_model(lreq->sd, child, lreq->parent_it); + } lreq->item_total = len; @@ -1004,6 +1008,29 @@ _process_children_error(Eo *model EINA_UNUSED, void *data, Eina_Error error) } static void +_count_changed_cb(void *data, const Efl_Event *ev EINA_UNUSED) +{ + Listing_Request *lreq = data; + Eina_Future *future; + + efl_event_callback_del(lreq->model, EFL_MODEL_EVENT_CHILDREN_COUNT_CHANGED, _count_changed_cb, lreq); + + if (efl_model_children_count_get(lreq->model)) + { + future = efl_model_children_slice_get(lreq->model, 0, efl_model_children_count_get(lreq->model)); + future = efl_future_then(lreq->obj, future); + efl_future_then(lreq->model, future, + .success = _process_children_cb, + .error = _process_children_error, + .data = lreq); + } + else + { + _process_last(lreq); + } +} + +static void _populate(Evas_Object *obj, Efl_Model *model, Elm_Object_Item *parent_it, @@ -1087,7 +1114,10 @@ _populate(Evas_Object *obj, } else { - _process_last(lreq); + if (parent_it) + efl_event_callback_add(lreq->model, EFL_MODEL_EVENT_CHILDREN_COUNT_CHANGED, _count_changed_cb, lreq); + else + _process_last(lreq); } } @@ -1624,7 +1654,7 @@ _resource_created_then(Eo *model EINA_UNUSED, void *data, const Eina_Value v) ELM_FILESELECTOR_DATA_GET(fs, sd); EINA_VALUE_ARRAY_FOREACH(&v, len, i, child) - _process_model(sd, child); + _process_model(sd, child, NULL); //this function will always just work for the root model of the fileselector return v; } @@ -2406,6 +2436,11 @@ _properties_ready(void *data, const Efl_Event *ev) Eina_Bool is_dir = EINA_FALSE; value = efl_model_property_get(ev->object, "is_dir"); + if (!eina_value_type_get(value)) + { + ERR("Empty type for 'is_dir'"); + return; + } if (eina_value_type_get(value) != EINA_VALUE_TYPE_BOOL) { ERR("Unexpected type for 'is_dir': '%s' with value '%s'.", eina_value_type_get(value)->name, eina_value_to_string(value)); @@ -2471,6 +2506,11 @@ _elm_fileselector_selected_set_internal(Evas_Object *obj, const char *path) efl_event_callback_add(pd->target, EFL_MODEL_EVENT_PROPERTIES_CHANGED, _properties_ready, obj); value = efl_model_property_get(pd->target, "is_dir"); + if (!eina_value_type_get(value)) + { + ERR("Empty type for 'is_dir'"); + goto clean_up; + } if (eina_value_type_get(value) == EINA_VALUE_TYPE_ERROR) { Eina_Error err = 0; @@ -2507,6 +2547,11 @@ _elm_fileselector_elm_interface_fileselector_selected_model_set(Eo *obj, Elm_Fil efl_event_callback_add(pd->target, EFL_MODEL_EVENT_PROPERTIES_CHANGED, _properties_ready, obj); value = efl_model_property_get(pd->target, "is_dir"); + if (!eina_value_type_get(value)) + { + ERR("Empty type for 'is_dir'"); + goto clean_up; + } if (eina_value_type_get(value) == EINA_VALUE_TYPE_ERROR) { Eina_Error err = 0; diff --git a/src/lib/elementary/elc_fileselector.h b/src/lib/elementary/elc_fileselector.h index 32b8b566a0..9a936b3ec1 100644 --- a/src/lib/elementary/elc_fileselector.h +++ b/src/lib/elementary/elc_fileselector.h @@ -38,7 +38,7 @@ * functions acting on it also work for file selector objects. * * This widget emits the following signals, besides the ones sent from - * @ref Layout: + * @ref Elm_Layout : * - @c "activated" - the user activated a file. This can happen by * double-clicking or pressing Enter key. (@p event_info is a * pointer to the activated file path) diff --git a/src/lib/elementary/elc_fileselector_button.c b/src/lib/elementary/elc_fileselector_button.c index 5e10e83063..e05fc4e181 100644 --- a/src/lib/elementary/elc_fileselector_button.c +++ b/src/lib/elementary/elc_fileselector_button.c @@ -5,7 +5,7 @@ #define EFL_ACCESS_OBJECT_PROTECTED #include <Elementary.h> -#include "Eio_Eo.h" +#include "Eio.h" #include "elm_priv.h" #include "elm_fileselector_button_eo.h" #include "elm_fileselector_entry_eo.h" diff --git a/src/lib/elementary/elc_fileselector_entry.c b/src/lib/elementary/elc_fileselector_entry.c index 52d901ba9b..f67990aadb 100644 --- a/src/lib/elementary/elc_fileselector_entry.c +++ b/src/lib/elementary/elc_fileselector_entry.c @@ -7,7 +7,7 @@ #define EFL_PART_PROTECTED #include <Elementary.h> -#include "Eio_Eo.h" +#include "Eio.h" #include "elm_priv.h" #include "elm_fileselector_button_eo.h" #include "elm_fileselector_entry_eo.h" @@ -444,13 +444,13 @@ _elm_fileselector_entry_efl_ui_view_model_get(const Eo *obj, Elm_Fileselector_En free(sd->path); sd->path = elm_entry_markup_to_utf8(elm_object_text_get(sd->entry)); - if (!strcmp(sd->path, efl_io_model_path_get(bmodel))) + if (eina_streq(sd->path, efl_io_model_path_get(bmodel))) return bmodel; ret = efl_add_ref(efl_class_get(bmodel), (Eo*) obj, efl_io_model_path_set(efl_added, sd->path), efl_loop_model_volatile_make(efl_added)); - eina_freeq_ptr_add(postponed_fq, ret, EINA_FREE_CB(efl_unref), sizeof (void*)); + eina_freeq_ptr_add(postponed_fq, ret, EINA_FREE_CB(efl_unref), 0); return ret; } diff --git a/src/lib/elementary/elc_fileselector_entry.h b/src/lib/elementary/elc_fileselector_entry.h index fe0dfde7e5..0085be89d7 100644 --- a/src/lib/elementary/elc_fileselector_entry.h +++ b/src/lib/elementary/elc_fileselector_entry.h @@ -20,7 +20,7 @@ * is closed and the selected file's path string is exposed both as * a smart event and as the new text on the entry. * - * This widget inherits from the @ref Layout one, so that all the + * This widget inherits from the @ref Elm_Layout one, so that all the * functions acting on it also work for file selector entry objects (since 1.8). * * This widget encapsulates operations on its internal file diff --git a/src/lib/elementary/elc_hoversel.c b/src/lib/elementary/elc_hoversel.c index 2f742f2051..6a9708c407 100644 --- a/src/lib/elementary/elc_hoversel.c +++ b/src/lib/elementary/elc_hoversel.c @@ -478,7 +478,7 @@ _activate(Evas_Object *obj) sd->expanded = EINA_TRUE; - sd->hover = elm_hover_add(sd->hover_parent); + efl_wref_add(elm_hover_add(sd->hover_parent), &sd->hover); efl_event_callback_add(sd->hover, EFL_EVENT_KEY_DOWN, _hover_key_down, obj); elm_widget_sub_object_add(obj, sd->hover); @@ -523,6 +523,8 @@ _activate(Evas_Object *obj) if (_elm_config->access_mode) _access_widget_item_register(sd); efl_event_callback_legacy_call(obj, ELM_HOVERSEL_EVENT_EXPANDED, NULL); + efl_canvas_group_calculate(sd->hover); + _sizing_eval(obj); evas_object_show(sd->hover); } @@ -667,7 +669,6 @@ _elm_hoversel_efl_canvas_group_group_del(Eo *obj, Elm_Hoversel_Data *sd) { Elm_Object_Item *eo_item; - evas_object_event_callback_del(sd->hover, EVAS_CALLBACK_DEL, _auto_update); EINA_LIST_FREE(sd->items, eo_item) { ELM_HOVERSEL_ITEM_DATA_GET(eo_item, it); @@ -720,8 +721,11 @@ _elm_hoversel_efl_object_constructor(Eo *obj, Elm_Hoversel_Data *_pd EINA_UNUSED } EOLIAN static void -_elm_hoversel_efl_object_destructor(Eo *obj, Elm_Hoversel_Data *_pd EINA_UNUSED) +_elm_hoversel_efl_object_destructor(Eo *obj, Elm_Hoversel_Data *_pd) { + if (_pd->resize_job) + ELM_SAFE_FREE(_pd->resize_job, ecore_job_del); + elm_obj_hoversel_clear(obj); efl_destructor(efl_super(obj, MY_CLASS)); } @@ -820,7 +824,6 @@ _elm_hoversel_clear(Eo *obj EINA_UNUSED, Elm_Hoversel_Data *sd) { Elm_Object_Item *it; - evas_object_event_callback_del(sd->hover, EVAS_CALLBACK_DEL, _auto_update); EINA_LIST_FREE(sd->items, it) { efl_del(it); diff --git a/src/lib/elementary/elc_multibuttonentry.h b/src/lib/elementary/elc_multibuttonentry.h index e17c1c946f..491433b924 100644 --- a/src/lib/elementary/elc_multibuttonentry.h +++ b/src/lib/elementary/elc_multibuttonentry.h @@ -5,7 +5,7 @@ * @image html multibuttonentry_inheritance_tree.png * @image latex multibuttonentry_inheritance_tree.eps * - * A multi-button entry is a widget letting an user enter text and + * A multi-button entry is a widget letting a user enter text and * each chunk of text managed as a set of buttons. Each text button is * inserted by pressing the "return" key. If there is no space in the * current row, a new button is added to the next row. When a text @@ -17,11 +17,11 @@ * emails/messages to a group of addresses, each of which is an item * that can be clicked for further actions. * - * This widget inherits from the @ref Layout one, so that all the + * This widget inherits from the @ref Elm_Layout one, so that all the * functions acting on it also work for multi-button entry objects (since 1.8). * * This widget emits the following signals, besides the ones sent from - * @ref Layout: + * @ref Elm_Layout : * - @c "item,selected" - this is called when an item is selected by * api, user interaction, and etc. this is also called when a * user press back space while cursor is on the first field of diff --git a/src/lib/elementary/elc_naviframe.c b/src/lib/elementary/elc_naviframe.c index 10368cb014..e68d5803b2 100644 --- a/src/lib/elementary/elc_naviframe.c +++ b/src/lib/elementary/elc_naviframe.c @@ -1088,6 +1088,13 @@ _on_item_push_finished(void *data, ELM_NAVIFRAME_DATA_GET(WIDGET(it), sd); + /* If pushed item becomes top item, then do not hide pushed item view. + * If top item is deleted in "transition,finished" smart callback by user + * before this function is called, then pushed item becomes top item. + */ + if (EO_OBJ(it) == elm_naviframe_top_item_get(WIDGET(it))) + return; + evas_object_hide(VIEW(it)); elm_object_signal_emit(VIEW(it), "elm,state,invisible", "elm"); @@ -1733,9 +1740,7 @@ _elm_naviframe_item_pop(Eo *obj, Elm_Naviframe_Data *sd) if (!it->pop_cb(it->pop_data, eo_item)) { efl_unref(eo_item); - if (it->delete_me) - efl_del(eo_item); - else + if (!it->delete_me) { /* To avoid multiple item pops, the auto pushed button deletes its clicked callback once it is called. diff --git a/src/lib/elementary/elc_naviframe.h b/src/lib/elementary/elc_naviframe.h index 71f213de85..02b1bced23 100644 --- a/src/lib/elementary/elc_naviframe.h +++ b/src/lib/elementary/elc_naviframe.h @@ -1,5 +1,5 @@ /** - * @defgroup Elm_Naviframe Naviframe + * @defgroup Elm_Naviframe_Group Naviframe * @ingroup Elementary * * @image html naviframe_inheritance_tree.png @@ -55,7 +55,7 @@ * * * This widget emits the following signals, besides the ones sent from - * @ref Layout: + * @ref Elm_Layout : * @li @c "transition,finished" - When the transition is finished in * changing the item * @li @c "title,transition,finished" - When the title area's transition @@ -85,7 +85,7 @@ */ /** - * @addtogroup Elm_Naviframe + * @addtogroup Elm_Naviframe_Group * @{ */ diff --git a/src/lib/elementary/elc_naviframe_common.h b/src/lib/elementary/elc_naviframe_common.h index 453587e048..23174ffd9f 100644 --- a/src/lib/elementary/elc_naviframe_common.h +++ b/src/lib/elementary/elc_naviframe_common.h @@ -17,7 +17,7 @@ typedef Eina_Bool (*Elm_Naviframe_Item_Pop_Cb)(void *data, Elm_Object_Item *it); * @param parent Parent object * @return New object or @c NULL, if it cannot be created * - * @ingroup Elm_Naviframe + * @ingroup Elm_Naviframe_Group */ EAPI Evas_Object *elm_naviframe_add(Evas_Object *parent); diff --git a/src/lib/elementary/elc_naviframe_legacy.h b/src/lib/elementary/elc_naviframe_legacy.h index 38f06ca186..31c9f216e2 100644 --- a/src/lib/elementary/elc_naviframe_legacy.h +++ b/src/lib/elementary/elc_naviframe_legacy.h @@ -4,7 +4,7 @@ * @param[in] obj The object. * @param[in] style The current item style name. @c null would be default * - * @ingroup Elm_Naviframe_Item + * @ingroup Elm_Naviframe_Item_Group */ EAPI void elm_naviframe_item_style_set(Elm_Object_Item *obj, const char *style); @@ -15,7 +15,7 @@ EAPI void elm_naviframe_item_style_set(Elm_Object_Item *obj, const char *style); * * @return The current item style name. @c null would be default * - * @ingroup Elm_Naviframe_Item + * @ingroup Elm_Naviframe_Item_Group */ EAPI const char *elm_naviframe_item_style_get(const Elm_Object_Item *obj); diff --git a/src/lib/elementary/elc_popup.h b/src/lib/elementary/elc_popup.h index 5671369ab8..25b5a08eb4 100644 --- a/src/lib/elementary/elc_popup.h +++ b/src/lib/elementary/elc_popup.h @@ -1,5 +1,5 @@ /** - * @defgroup Elm_Popup Popup + * @defgroup Elm_Popup_Group Popup * @ingroup Elementary * * @image html popup_inheritance_tree.png @@ -68,11 +68,11 @@ * evas_object_show on popup should be called after setting all the contents * and buttons of popup. * - * This widget inherits from the @ref Layout one, so that all the + * This widget inherits from the @ref Elm_Layout one, so that all the * functions acting on it also work for popup objects (since 1.8). * * This widget emits the following signals, besides the ones sent from - * @ref Layout: + * @ref Elm_Layout : * @li @c "timeout" - whenever popup is closed as a result of timeout. * @li @c "block,clicked" - whenever user taps on Blocked Event area. * @li @c "focused" - When the popup has received focus. (since 1.8) diff --git a/src/lib/elementary/elc_popup_legacy.h b/src/lib/elementary/elc_popup_legacy.h index 3312928593..dded76eefa 100644 --- a/src/lib/elementary/elc_popup_legacy.h +++ b/src/lib/elementary/elc_popup_legacy.h @@ -4,8 +4,8 @@ * @param parent The parent object * @return The new object or NULL if it cannot be created * - * @ingroup Elm_Popup + * @ingroup Elm_Popup_Group */ EAPI Evas_Object *elm_popup_add(Evas_Object *parent) EINA_ARG_NONNULL(1); -#include "elm_popup_eo.legacy.h"
\ No newline at end of file +#include "elm_popup_eo.legacy.h" diff --git a/src/lib/elementary/elementary_config.h b/src/lib/elementary/elementary_config.h index 6074510b0d..16127cc934 100644 --- a/src/lib/elementary/elementary_config.h +++ b/src/lib/elementary/elementary_config.h @@ -7,6 +7,10 @@ * @brief Definition of special values for user configuration. */ +/** + * @def ELM_CONFIG_ICON_THEME_ELEMENTARY + * Name to use in elm_config_icon_theme_set() to use Elementary's own icon set. + */ #define ELM_CONFIG_ICON_THEME_ELEMENTARY "_Elementary_Icon_Theme" #if defined(EFL_BUILD) || defined(ELM_INTERNAL_API_ARGESFSDFEFC) diff --git a/src/lib/elementary/elm_access.c b/src/lib/elementary/elm_access.c index 9b33f4de40..fc7c0ab262 100644 --- a/src/lib/elementary/elm_access.c +++ b/src/lib/elementary/elm_access.c @@ -520,6 +520,7 @@ _access_highlight_next_get(Evas_Object *obj, Elm_Focus_Direction dir) if (ho) { Elm_Access_Info *info = _elm_access_info_get(ho); + EINA_SAFETY_ON_NULL_RETURN_VAL(info, ret); if (type == ELM_ACCESS_ACTION_HIGHLIGHT_NEXT && info->next) target = info->next; else if (type == ELM_ACCESS_ACTION_HIGHLIGHT_PREV && info->prev) @@ -701,7 +702,8 @@ _elm_access_highlight_cycle(Evas_Object *obj, Elm_Focus_Direction dir) else { efl_ui_focus_util_focus(obj); - efl_ui_focus_manager_move(elm_widget_top_get(obj), dir); + efl_ui_focus_manager_move(elm_widget_top_get(obj), + (Efl_Ui_Focus_Direction)dir); } } diff --git a/src/lib/elementary/elm_access_eo.h b/src/lib/elementary/elm_access_eo.h index 75921b80f5..3828b5a31e 100644 --- a/src/lib/elementary/elm_access_eo.h +++ b/src/lib/elementary/elm_access_eo.h @@ -19,6 +19,6 @@ typedef Eo Elm_Access; */ #define ELM_ACCESS_CLASS elm_access_class_get() -EWAPI const Efl_Class *elm_access_class_get(void); +EWAPI const Efl_Class *elm_access_class_get(void) EINA_CONST; #endif diff --git a/src/lib/elementary/elm_actionslider.h b/src/lib/elementary/elm_actionslider.h index 55abc02138..f8129fc369 100644 --- a/src/lib/elementary/elm_actionslider.h +++ b/src/lib/elementary/elm_actionslider.h @@ -25,11 +25,11 @@ * * @note By default all positions are set as enabled. * - * This widget inherits from the @ref Layout one, so that all the + * This widget inherits from the @ref Elm_Layout one, so that all the * functions acting on it also work for actionslider objects. * * This widget emits the following signals, besides the ones sent from - * @ref Layout: + * @ref Elm_Layout : * @li @c "selected" - when user selects an enabled position (the * label is passed as event info). * @li @c "pos_changed" - when the indicator reaches any of the diff --git a/src/lib/elementary/elm_actionslider_eo.h b/src/lib/elementary/elm_actionslider_eo.h index 9a6b55d484..99ab3805fc 100644 --- a/src/lib/elementary/elm_actionslider_eo.h +++ b/src/lib/elementary/elm_actionslider_eo.h @@ -38,7 +38,7 @@ typedef enum */ #define ELM_ACTIONSLIDER_CLASS elm_actionslider_class_get() -EWAPI const Efl_Class *elm_actionslider_class_get(void); +EWAPI const Efl_Class *elm_actionslider_class_get(void) EINA_CONST; /** * @brief Actionslider position indicator diff --git a/src/lib/elementary/elm_atspi_app_object_eo.h b/src/lib/elementary/elm_atspi_app_object_eo.h index 0dff0ba000..1558c5b747 100644 --- a/src/lib/elementary/elm_atspi_app_object_eo.h +++ b/src/lib/elementary/elm_atspi_app_object_eo.h @@ -19,6 +19,6 @@ typedef Eo Elm_Atspi_App_Object; */ #define ELM_ATSPI_APP_OBJECT_CLASS elm_atspi_app_object_class_get() -EWAPI const Efl_Class *elm_atspi_app_object_class_get(void); +EWAPI const Efl_Class *elm_atspi_app_object_class_get(void) EINA_CONST; #endif diff --git a/src/lib/elementary/elm_atspi_bridge.c b/src/lib/elementary/elm_atspi_bridge.c index 6ec5fd7729..868a72ccf2 100644 --- a/src/lib/elementary/elm_atspi_bridge.c +++ b/src/lib/elementary/elm_atspi_bridge.c @@ -57,6 +57,10 @@ if (!(obj) || !efl_isa(obj, class)) \ return _dbus_invalid_ref_error_new(msg); +#define ELM_ATSPI_ON_NULL_RETURN_DBUS_ERROR(obj, msg) \ + if (!obj) \ + return _dbus_invalid_ref_error_new(msg); + typedef struct Key_Event_Info { Ecore_Event_Key event; int type; @@ -118,6 +122,7 @@ static int _init_count = 0; static void _state_changed_signal_send(void *data, const Efl_Event *event); static void _bounds_changed_signal_send(void *data, const Efl_Event *event); static void _property_changed_signal_send(void *data, const Efl_Event *event); +static void _value_property_changed_signal_send(void *data, const Efl_Event *event); static void _children_changed_signal_send(void *data, const Efl_Event *event); static void _window_signal_send(void *data, const Efl_Event *event); static void _visible_data_changed_signal_send(void *data, const Efl_Event *event); @@ -168,7 +173,8 @@ static const Elm_Atspi_Bridge_Event_Handler event_handlers[] = { { EFL_ACCESS_TEXT_EVENT_ACCESS_TEXT_CARET_MOVED, _text_caret_moved_send }, { EFL_ACCESS_TEXT_EVENT_ACCESS_TEXT_INSERTED, _text_text_inserted_send }, { EFL_ACCESS_TEXT_EVENT_ACCESS_TEXT_REMOVED, _text_text_removed_send }, - { EFL_ACCESS_TEXT_EVENT_ACCESS_TEXT_SELECTION_CHANGED, _text_selection_changed_send } + { EFL_ACCESS_TEXT_EVENT_ACCESS_TEXT_SELECTION_CHANGED, _text_selection_changed_send }, + { EFL_UI_RANGE_EVENT_CHANGED, _value_property_changed_signal_send } }; enum _Atspi_Object_Child_Event_Type @@ -1297,25 +1303,76 @@ _text_string_at_offset_get(const Eldbus_Service_Interface *iface, const Eldbus_M const char *obj_path = eldbus_message_path_get(msg); char *str; Efl_Access_Text_Granularity gran; - int start, end; + int start = 0, end = 0; Eldbus_Message *ret; Eo *bridge = eldbus_service_object_data_get(iface, ELM_ATSPI_BRIDGE_CLASS_NAME); Eo *obj = _bridge_object_from_path(bridge, obj_path); - ELM_ATSPI_OBJ_CHECK_OR_RETURN_DBUS_ERROR(obj, EFL_ACCESS_TEXT_INTERFACE, msg); + ELM_ATSPI_ON_NULL_RETURN_DBUS_ERROR(obj, msg); if (!eldbus_message_arguments_get(msg, "iu", &start, &gran)) return eldbus_message_error_new(msg, "org.freedesktop.DBus.Error.InvalidArgs", "Offset and granularity expected."); - ret = eldbus_message_method_return_new(msg); - EINA_SAFETY_ON_NULL_RETURN_VAL(ret, NULL); + if (efl_isa(obj, EFL_TEXT_INTERACTIVE_INTERFACE)) + { + Efl_Text_Cursor_Object *sel1 = efl_ui_textbox_cursor_create(obj); + Efl_Text_Cursor_Object *sel2 = efl_ui_textbox_cursor_create(obj); + efl_text_cursor_object_position_set(sel1, start); + efl_text_cursor_object_position_set(sel2, start); + + switch(gran) + { + case EFL_ACCESS_TEXT_GRANULARITY_CHAR: + efl_text_cursor_object_move(sel2, EFL_TEXT_CURSOR_MOVE_TYPE_CHARACTER_NEXT); + break; + + case EFL_ACCESS_TEXT_GRANULARITY_WORD: + efl_text_cursor_object_move(sel1, EFL_TEXT_CURSOR_MOVE_TYPE_WORD_START); + efl_text_cursor_object_move(sel2, EFL_TEXT_CURSOR_MOVE_TYPE_WORD_END); + break; + + case EFL_ACCESS_TEXT_GRANULARITY_LINE: + efl_text_cursor_object_move(sel1, EFL_TEXT_CURSOR_MOVE_TYPE_LINE_START); + efl_text_cursor_object_move(sel2, EFL_TEXT_CURSOR_MOVE_TYPE_LINE_END); + break; + + case EFL_ACCESS_TEXT_GRANULARITY_PARAGRAPH: + efl_text_cursor_object_move(sel1, EFL_TEXT_CURSOR_MOVE_TYPE_PARAGRAPH_START); + efl_text_cursor_object_move(sel2, EFL_TEXT_CURSOR_MOVE_TYPE_PARAGRAPH_END); + break; + + case EFL_ACCESS_TEXT_GRANULARITY_SENTENCE: /* this one is not supported by efl */ + default: + efl_del(sel1); + efl_del(sel2); + return eldbus_message_error_new(msg, "org.freedesktop.DBus.Error.InvalidArgs", "Granularity not suported."); + } + + str = efl_text_cursor_object_range_text_get(sel1, sel2); + start = efl_text_cursor_object_position_get(sel1); + end = efl_text_cursor_object_position_get(sel2); + + efl_del(sel1); + efl_del(sel2); + } + else if (efl_isa(obj, EFL_ACCESS_TEXT_INTERFACE)) + { + efl_access_text_string_get(obj, gran, &start, &end, &str); + } + else + { + return _dbus_invalid_ref_error_new(msg); + } - str = efl_access_text_string_get(obj, gran, &start, &end); str = str ? str : strdup(""); + ret = eldbus_message_method_return_new(msg); + EINA_SAFETY_ON_NULL_GOTO(ret, cleanup); + eldbus_message_arguments_append(ret, "sii", str, start, end); - free(str); +cleanup: + free(str); return ret; } @@ -1328,20 +1385,39 @@ _text_text_get(const Eldbus_Service_Interface *iface, const Eldbus_Message *msg) Eo *obj = _bridge_object_from_path(bridge, obj_path); int start, end; - ELM_ATSPI_OBJ_CHECK_OR_RETURN_DBUS_ERROR(obj, EFL_ACCESS_TEXT_INTERFACE, msg); + ELM_ATSPI_ON_NULL_RETURN_DBUS_ERROR(obj, msg); if (!eldbus_message_arguments_get(msg, "ii", &start, &end)) - return eldbus_message_error_new(msg, "org.freedesktop.DBus.Error.InvalidArgs", "Offset and granularity expected."); + return eldbus_message_error_new(msg, "org.freedesktop.DBus.Error.InvalidArgs", "Start and end offset expected."); - Eldbus_Message *ret = eldbus_message_method_return_new(msg); - EINA_SAFETY_ON_NULL_RETURN_VAL(ret, NULL); + if (efl_isa(obj, EFL_TEXT_INTERACTIVE_INTERFACE)) + { + Efl_Text_Cursor_Object *sel1 = efl_ui_textbox_cursor_create(obj); + Efl_Text_Cursor_Object *sel2 = efl_ui_textbox_cursor_create(obj); + efl_text_cursor_object_position_set(sel1, start); + efl_text_cursor_object_position_set(sel2, end); + str = efl_text_cursor_object_range_text_get(sel1, sel2); + efl_del(sel1); + efl_del(sel2); + } + else if (efl_isa(obj, EFL_ACCESS_TEXT_INTERFACE)) + { + str = efl_access_text_get(obj, start, end); + } + else + { + return _dbus_invalid_ref_error_new(msg); + } - str = efl_access_text_get(obj, start, end); str = str ? str : strdup(""); + Eldbus_Message *ret = eldbus_message_method_return_new(msg); + EINA_SAFETY_ON_NULL_GOTO(ret, cleanup); + eldbus_message_arguments_append(ret, "s", str); - free(str); +cleanup: + free(str); return ret; } @@ -1355,16 +1431,29 @@ _text_caret_offset_set(const Eldbus_Service_Interface *iface, const Eldbus_Messa Eldbus_Message *ret; Eina_Bool res; - ELM_ATSPI_OBJ_CHECK_OR_RETURN_DBUS_ERROR(obj, EFL_ACCESS_TEXT_INTERFACE, msg); + ELM_ATSPI_ON_NULL_RETURN_DBUS_ERROR(obj, msg); if (!eldbus_message_arguments_get(msg, "i", &offset)) return eldbus_message_error_new(msg, "org.freedesktop.DBus.Error.InvalidArgs", "Offset expected."); + if (efl_isa(obj, EFL_TEXT_INTERACTIVE_INTERFACE)) + { + Efl_Text_Cursor_Object *cur = efl_text_interactive_main_cursor_get(obj); + efl_text_cursor_object_position_set(cur, offset); + res = EINA_TRUE; + } + else if (efl_isa(obj, EFL_ACCESS_TEXT_INTERFACE)) + { + res = efl_access_text_caret_offset_set(obj, offset); + } + else + { + return _dbus_invalid_ref_error_new(msg); + } + ret = eldbus_message_method_return_new(msg); EINA_SAFETY_ON_NULL_RETURN_VAL(ret, NULL); - res = efl_access_text_caret_offset_set(obj, offset); - eldbus_message_arguments_append(ret, "b", res); return ret; @@ -1380,17 +1469,49 @@ _text_character_at_offset_get(const Eldbus_Service_Interface *iface, const Eldbu Eldbus_Message *ret; Eina_Unicode res; - ELM_ATSPI_OBJ_CHECK_OR_RETURN_DBUS_ERROR(obj, EFL_ACCESS_TEXT_INTERFACE, msg); + ELM_ATSPI_ON_NULL_RETURN_DBUS_ERROR(obj, msg); if (!eldbus_message_arguments_get(msg, "i", &offset)) return eldbus_message_error_new(msg, "org.freedesktop.DBus.Error.InvalidArgs", "Offset expected."); + if (efl_isa(obj, EFL_TEXT_INTERACTIVE_INTERFACE)) + { + Efl_Text_Cursor_Object *cur = efl_ui_textbox_cursor_create(obj); + efl_text_cursor_object_position_set(cur, offset); + res = efl_text_cursor_object_content_get(cur); + efl_del(cur); + } + else if (efl_isa(obj, EFL_ACCESS_TEXT_INTERFACE)) + { + res = efl_access_text_character_get(obj, offset); + } + else + { + return _dbus_invalid_ref_error_new(msg); + } + ret = eldbus_message_method_return_new(msg); EINA_SAFETY_ON_NULL_RETURN_VAL(ret, NULL); + eldbus_message_arguments_append(ret, "i", res); - res = efl_access_text_character_get(obj, offset); + return ret; +} - eldbus_message_arguments_append(ret, "i", res); +static Efl_Access_Text_Attribute* +_text_attribute_value_get_text_attribute(Efl_Text_Attribute_Handle *annotation) +{ + Efl_Access_Text_Attribute *ret; + const char *txt; + + txt = efl_text_formatter_attribute_get(annotation); + if (!txt) return NULL; + + ret = calloc(1, sizeof(Efl_Access_Text_Attribute)); + if (!ret) return NULL; + + ret->value = eina_stringshare_add(txt); + int size = strlen(txt); + ret->name = eina_stringshare_add_length(txt, size); return ret; } @@ -1402,22 +1523,63 @@ _text_attribute_value_get(const Eldbus_Service_Interface *iface, const Eldbus_Me char *value = NULL; Eo *bridge = eldbus_service_object_data_get(iface, ELM_ATSPI_BRIDGE_CLASS_NAME); Eo *obj = _bridge_object_from_path(bridge, obj_path); - int start, end; + int start = 0, end = 0; Eldbus_Message *ret; - Eina_Bool res; + Eina_Bool res = EINA_FALSE; + Eina_Iterator *annotations; + Efl_Access_Text_Attribute *attr; + Efl_Text_Attribute_Handle *an; - ELM_ATSPI_OBJ_CHECK_OR_RETURN_DBUS_ERROR(obj, EFL_ACCESS_TEXT_INTERFACE, msg); + ELM_ATSPI_ON_NULL_RETURN_DBUS_ERROR(obj, msg); if (!eldbus_message_arguments_get(msg, "is", &start, &name)) return eldbus_message_error_new(msg, "org.freedesktop.DBus.Error.InvalidArgs", "Offset and attribute name expected."); - ret = eldbus_message_method_return_new(msg); - EINA_SAFETY_ON_NULL_RETURN_VAL(ret, NULL); + if (efl_isa(obj, EFL_TEXT_INTERACTIVE_INTERFACE)) + { + Efl_Text_Cursor_Object *sel1 = efl_ui_textbox_cursor_create(obj); + Efl_Text_Cursor_Object *sel2 = efl_ui_textbox_cursor_create(obj); + end = start+1; + efl_text_cursor_object_position_set(sel1, start); + efl_text_cursor_object_position_set(sel2, end); + annotations = efl_text_formatter_range_attributes_get(sel1, sel2); + + if (annotations) + { + EINA_ITERATOR_FOREACH(annotations, an) + { + attr = _text_attribute_value_get_text_attribute(an); + if (!attr) continue; + if (!strcmp(attr->name, name)) + { + value = attr->value ? eina_strdup(attr->value) : NULL; + res = EINA_TRUE; + } + elm_atspi_text_text_attribute_free(attr); + if (res) + break; + } + eina_iterator_free(annotations); + } + + efl_del(sel1); + efl_del(sel2); + } + else if (efl_isa(obj, EFL_ACCESS_TEXT_INTERFACE)) + { + res = efl_access_text_attribute_get(obj, name, &start, &end, &value); + } + else + { + return _dbus_invalid_ref_error_new(msg); + } - res = efl_access_text_attribute_get(obj, name, &start, &end, &value); + ret = eldbus_message_method_return_new(msg); + EINA_SAFETY_ON_NULL_GOTO(ret, cleanup); eldbus_message_arguments_append(ret, "siib", value ? value : "", start, end, res); - if (value) free(value); +cleanup: + free(value); return ret; } @@ -1427,13 +1589,12 @@ _text_attributes_get(const Eldbus_Service_Interface *iface, const Eldbus_Message const char *obj_path = eldbus_message_path_get(msg); Eo *bridge = eldbus_service_object_data_get(iface, ELM_ATSPI_BRIDGE_CLASS_NAME); Eo *obj = _bridge_object_from_path(bridge, obj_path); - int start, end; + int start = 0, end = 0; Eldbus_Message *ret; Eldbus_Message_Iter *iter, *iter_array; - Eina_List *attrs; Efl_Access_Text_Attribute *attr; - ELM_ATSPI_OBJ_CHECK_OR_RETURN_DBUS_ERROR(obj, EFL_ACCESS_TEXT_INTERFACE, msg); + ELM_ATSPI_ON_NULL_RETURN_DBUS_ERROR(obj, msg); if (!eldbus_message_arguments_get(msg, "i", &start)) return eldbus_message_error_new(msg, "org.freedesktop.DBus.Error.InvalidArgs", "Offset expected."); @@ -1445,13 +1606,48 @@ _text_attributes_get(const Eldbus_Service_Interface *iface, const Eldbus_Message iter_array = eldbus_message_iter_container_new(iter, 'a', "{ss}"); EINA_SAFETY_ON_NULL_GOTO(iter_array, fail); - attrs = efl_access_text_attributes_get(obj, &start, &end); + if (efl_isa(obj, EFL_TEXT_INTERACTIVE_INTERFACE)) + { + Eina_Iterator *annotations; + Efl_Text_Attribute_Handle *an; + Efl_Text_Cursor_Object *sel1 = efl_ui_textbox_cursor_create(obj); + Efl_Text_Cursor_Object *sel2 = efl_ui_textbox_cursor_create(obj); - EINA_LIST_FREE(attrs, attr) - { - eldbus_message_iter_arguments_append(iter_array, "ss", attr->name, attr->value); - elm_atspi_text_text_attribute_free(attr); - } + end = start+1; + efl_text_cursor_object_position_set(sel1, start); + efl_text_cursor_object_position_set(sel2, end); + annotations = efl_text_formatter_range_attributes_get(sel1, sel2); + + efl_del(sel1); + efl_del(sel2); + + if (annotations) + { + EINA_ITERATOR_FOREACH(annotations, an) + { + attr = _text_attribute_value_get_text_attribute(an); + if (!attr) continue; + eldbus_message_iter_arguments_append(iter_array, "ss", attr->name, attr->value); + elm_atspi_text_text_attribute_free(attr); + } + eina_iterator_free(annotations); + } + } + else if (efl_isa(obj, EFL_ACCESS_TEXT_INTERFACE)) + { + Eina_List *attrs = NULL; + efl_access_text_attributes_get(obj, &start, &end, &attrs); + EINA_LIST_FREE(attrs, attr) + { + eldbus_message_iter_arguments_append(iter_array, "ss", attr->name, attr->value); + elm_atspi_text_text_attribute_free(attr); + } + } + else + { + eldbus_message_iter_container_close(iter, iter_array); + goto fail; + } eldbus_message_iter_container_close(iter, iter_array); eldbus_message_iter_arguments_append(iter, "ii", start, end); @@ -1471,10 +1667,10 @@ _text_default_attributes_get(const Eldbus_Service_Interface *iface, const Eldbus Eo *obj = _bridge_object_from_path(bridge, obj_path); Eldbus_Message *ret; Eldbus_Message_Iter *iter, *iter_array; - Eina_List *attrs; + Eina_List *attrs = NULL; Efl_Access_Text_Attribute *attr; - ELM_ATSPI_OBJ_CHECK_OR_RETURN_DBUS_ERROR(obj, EFL_ACCESS_TEXT_INTERFACE, msg); + ELM_ATSPI_ON_NULL_RETURN_DBUS_ERROR(obj, msg); ret = eldbus_message_method_return_new(msg); EINA_SAFETY_ON_NULL_RETURN_VAL(ret, NULL); @@ -1483,7 +1679,38 @@ _text_default_attributes_get(const Eldbus_Service_Interface *iface, const Eldbus iter_array = eldbus_message_iter_container_new(iter, 'a', "{ss}"); EINA_SAFETY_ON_NULL_GOTO(iter_array, fail); - attrs = efl_access_text_default_attributes_get(obj); + if (efl_isa(obj, EFL_TEXT_INTERACTIVE_INTERFACE)) + { + Eina_Iterator *annotations; + Efl_Text_Attribute_Handle *an; + Efl_Text_Cursor_Object *sel1 = efl_ui_textbox_cursor_create(obj); + Efl_Text_Cursor_Object *sel2 = efl_ui_textbox_cursor_create(obj); + + efl_text_cursor_object_move(sel1, EFL_TEXT_CURSOR_MOVE_TYPE_FIRST); + efl_text_cursor_object_move(sel2, EFL_TEXT_CURSOR_MOVE_TYPE_LAST); + annotations = efl_text_formatter_range_attributes_get(sel1, sel2); + + EINA_ITERATOR_FOREACH(annotations, an) + { + Efl_Access_Text_Attribute *attr = _text_attribute_value_get_text_attribute(an); + if (!attr) continue; + attrs = eina_list_append(attrs, attr); + } + eina_iterator_free(annotations); + + efl_del(sel1); + efl_del(sel2); + } + else if (efl_isa(obj, EFL_ACCESS_TEXT_INTERFACE)) + { + attrs = efl_access_text_default_attributes_get(obj); + } + else + { + eldbus_message_unref(ret); + eldbus_message_iter_container_close(iter, iter_array); + return _dbus_invalid_ref_error_new(msg); + } EINA_LIST_FREE(attrs, attr) { @@ -1500,6 +1727,59 @@ fail: return NULL; } +static Eina_Rect +_text_interactive_get_pos(Eo *obj, Eina_Rect rect, Eina_Bool screen_coords) +{ + Eina_Position2D scroller_shift = efl_ui_scrollable_content_pos_get(obj); + Eina_Rect viewport = efl_ui_scrollable_viewport_geometry_get(obj); + Eina_Rect r_obj = efl_access_component_extents_get(obj, EINA_TRUE); + + /* In widget coords */ + rect.x -= scroller_shift.x; + rect.y -= scroller_shift.y; + rect.x += viewport.x; + rect.y += viewport.y; + + + /* Is it still visible? */ + if (rect.x < viewport.x) + { + rect.w += rect.x - viewport.x; + rect.x = viewport.x; + } + + if (rect.y < viewport.y) + { + rect.h += rect.y - viewport.y; + rect.y = viewport.y; + } + + rect.w = viewport.w < (rect.x + rect.w) ? viewport.w - rect.x : rect.w; + rect.h = viewport.h < (rect.y + rect.h) ? viewport.h - rect.y : rect.h; + + /* If not visible set to 0 both sides */ + if (rect.w <= 0 || rect.h <= 0) + { + rect.w = 0; + rect.h = 0; + } + + /* Transform to screen coords */ + rect.x += r_obj.x; + rect.y += r_obj.y; + + /* Transform to window coords */ + if (!screen_coords) + { + Eo *win = elm_object_top_widget_get(obj); + Eina_Rect r_win = efl_access_component_extents_get(win, EINA_TRUE); + rect.x -= r_win.x; + rect.y -= r_win.y; + } + + return rect; +} + static Eldbus_Message * _text_character_extents_get(const Eldbus_Service_Interface *iface, const Eldbus_Message *msg) { @@ -1512,23 +1792,36 @@ _text_character_extents_get(const Eldbus_Service_Interface *iface, const Eldbus_ Eina_Bool screen_coords, res; Eldbus_Message *ret; - ELM_ATSPI_OBJ_CHECK_OR_RETURN_DBUS_ERROR(obj, EFL_ACCESS_TEXT_INTERFACE, msg); + ELM_ATSPI_ON_NULL_RETURN_DBUS_ERROR(obj, msg); if (!eldbus_message_arguments_get(msg, "iu", &offset, &type)) return eldbus_message_error_new(msg, "org.freedesktop.DBus.Error.InvalidArgs", "Offset and coordinates type expected."); - ret = eldbus_message_method_return_new(msg); - EINA_SAFETY_ON_NULL_RETURN_VAL(ret, NULL); - screen_coords = type == ATSPI_COORD_TYPE_SCREEN ? EINA_TRUE : EINA_FALSE; - res = efl_access_text_character_extents_get(obj, offset, screen_coords, &rect); - - if (!res) + if (efl_isa(obj, EFL_TEXT_INTERACTIVE_INTERFACE)) { - eldbus_message_unref(ret); - return eldbus_message_error_new(msg, "org.freedesktop.DBus.Error.Failed", "Unable to get character extents."); + Efl_Text_Cursor_Object *cur = efl_ui_textbox_cursor_create(obj); + efl_text_cursor_object_position_set(cur, offset); + rect = efl_text_cursor_object_cursor_geometry_get(cur, EFL_TEXT_CURSOR_TYPE_UNDER); + efl_del(cur); + rect = _text_interactive_get_pos(obj, rect, screen_coords); + res = rect.w != 0 ? EINA_TRUE : EINA_FALSE; + } + else if (efl_isa(obj, EFL_ACCESS_TEXT_INTERFACE)) + { + res = efl_access_text_character_extents_get(obj, offset, screen_coords, &rect); + } + else + { + return _dbus_invalid_ref_error_new(msg); } + + if (!res) + return eldbus_message_error_new(msg, "org.freedesktop.DBus.Error.Failed", "Unable to get character extents."); + + ret = eldbus_message_method_return_new(msg); + EINA_SAFETY_ON_NULL_RETURN_VAL(ret, NULL); eldbus_message_arguments_append(ret, "iiii", rect.x, rect.y, rect.w, rect.h); return ret; @@ -1545,19 +1838,45 @@ _text_offset_at_point_get(const Eldbus_Service_Interface *iface, const Eldbus_Me Eina_Bool screen_coords; Eldbus_Message *ret; - ELM_ATSPI_OBJ_CHECK_OR_RETURN_DBUS_ERROR(obj, EFL_ACCESS_TEXT_INTERFACE, msg); + ELM_ATSPI_ON_NULL_RETURN_DBUS_ERROR(obj, msg); if (!eldbus_message_arguments_get(msg, "iiu", &x, &y, &type)) return eldbus_message_error_new(msg, "org.freedesktop.DBus.Error.InvalidArgs", "Offset and coordinates type expected."); - ret = eldbus_message_method_return_new(msg); - EINA_SAFETY_ON_NULL_RETURN_VAL(ret, NULL); - - x = y = -1; screen_coords = type == ATSPI_COORD_TYPE_SCREEN ? EINA_TRUE : EINA_FALSE; - offset = efl_access_text_offset_at_point_get(obj, screen_coords, x, y); + if (efl_isa(obj, EFL_TEXT_INTERACTIVE_INTERFACE)) + { + if (screen_coords) + { + Eina_Rect rect = efl_access_component_extents_get(obj, screen_coords); + x -= rect.x; + y -= rect.y; + } + else + { + Eo *win = elm_object_top_widget_get(obj); + Eina_Rect r_win = efl_access_component_extents_get(win, EINA_TRUE); + Eina_Rect r_obj = efl_access_component_extents_get(obj, EINA_TRUE); + x -= r_obj.x - r_win.x; + y -= r_obj.y - r_win.y; + } + Efl_Text_Cursor_Object *cur = efl_ui_textbox_cursor_create(obj); + efl_text_cursor_object_char_coord_set(cur, EINA_POSITION2D(x,y)); + offset = efl_text_cursor_object_position_get(cur); + efl_del(cur); + } + else if (efl_isa(obj, EFL_ACCESS_TEXT_INTERFACE)) + { + offset = efl_access_text_offset_at_point_get(obj, screen_coords, x, y); + } + else + { + return _dbus_invalid_ref_error_new(msg); + } + ret = eldbus_message_method_return_new(msg); + EINA_SAFETY_ON_NULL_RETURN_VAL(ret, NULL); eldbus_message_arguments_append(ret, "i", offset); return ret; @@ -1590,19 +1909,35 @@ _text_selection_get(const Eldbus_Service_Interface *iface, const Eldbus_Message const char *obj_path = eldbus_message_path_get(msg); Eo *bridge = eldbus_service_object_data_get(iface, ELM_ATSPI_BRIDGE_CLASS_NAME); Eo *obj = _bridge_object_from_path(bridge, obj_path); - int sel_num, start, end; + int sel_num, start = 0, end = 0; Eldbus_Message *ret; - ELM_ATSPI_OBJ_CHECK_OR_RETURN_DBUS_ERROR(obj, EFL_ACCESS_TEXT_INTERFACE, msg); + ELM_ATSPI_ON_NULL_RETURN_DBUS_ERROR(obj, msg); if (!eldbus_message_arguments_get(msg, "i", &sel_num)) return eldbus_message_error_new(msg, "org.freedesktop.DBus.Error.InvalidArgs", "Selection number expected."); + if (efl_isa(obj, EFL_TEXT_INTERACTIVE_INTERFACE)) + { + if (sel_num == 0) + { + Efl_Text_Cursor_Object *sel1, *sel2; + efl_text_interactive_selection_cursors_get(obj, &sel1, &sel2); + start = efl_text_cursor_object_position_get(sel1); + end = efl_text_cursor_object_position_get(sel2); + } + } + else if (efl_isa(obj, EFL_ACCESS_TEXT_INTERFACE)) + { + efl_access_text_access_selection_get(obj, sel_num, &start, &end); + } + else + { + return _dbus_invalid_ref_error_new(msg); + } + ret = eldbus_message_method_return_new(msg); EINA_SAFETY_ON_NULL_RETURN_VAL(ret, NULL); - - efl_access_text_access_selection_get(obj, sel_num, &start, &end); - eldbus_message_arguments_append(ret, "ii", start, end); return ret; @@ -1618,16 +1953,30 @@ _text_selection_add(const Eldbus_Service_Interface *iface, const Eldbus_Message Eina_Bool res; Eldbus_Message *ret; - ELM_ATSPI_OBJ_CHECK_OR_RETURN_DBUS_ERROR(obj, EFL_ACCESS_TEXT_INTERFACE, msg); + ELM_ATSPI_ON_NULL_RETURN_DBUS_ERROR(obj, msg); if (!eldbus_message_arguments_get(msg, "ii", &start, &end)) return eldbus_message_error_new(msg, "org.freedesktop.DBus.Error.InvalidArgs", "Start and end text offset expected."); + if (efl_isa(obj, EFL_TEXT_INTERACTIVE_INTERFACE)) + { + Efl_Text_Cursor_Object *sel1, *sel2; + efl_text_interactive_selection_cursors_get(obj, &sel1, &sel2); + efl_text_cursor_object_position_set(sel1, start); + efl_text_cursor_object_position_set(sel2, end); + res = EINA_TRUE; + } + else if (efl_isa(obj, EFL_ACCESS_TEXT_INTERFACE)) + { + res = efl_access_text_selection_add(obj, start, end); + } + else + { + return _dbus_invalid_ref_error_new(msg); + } + ret = eldbus_message_method_return_new(msg); EINA_SAFETY_ON_NULL_RETURN_VAL(ret, NULL); - - res = efl_access_text_selection_add(obj, start, end); - eldbus_message_arguments_append(ret, "b", res); return ret; @@ -1640,19 +1989,35 @@ _text_selection_remove(const Eldbus_Service_Interface *iface, const Eldbus_Messa Eo *bridge = eldbus_service_object_data_get(iface, ELM_ATSPI_BRIDGE_CLASS_NAME); Eo *obj = _bridge_object_from_path(bridge, obj_path); int sel_num; - Eina_Bool res; + Eina_Bool res = EINA_FALSE; Eldbus_Message *ret; - ELM_ATSPI_OBJ_CHECK_OR_RETURN_DBUS_ERROR(obj, EFL_ACCESS_TEXT_INTERFACE, msg); + ELM_ATSPI_ON_NULL_RETURN_DBUS_ERROR(obj, msg); if (!eldbus_message_arguments_get(msg, "i", &sel_num)) return eldbus_message_error_new(msg, "org.freedesktop.DBus.Error.InvalidArgs", "Selection number expected."); + if (efl_isa(obj, EFL_TEXT_INTERACTIVE_INTERFACE)) + { + if (sel_num == 0) + { + Efl_Text_Cursor_Object *sel1, *sel2; + efl_text_interactive_selection_cursors_get(obj, &sel1, &sel2); + efl_text_cursor_object_range_delete(sel1, sel2); + res = EINA_TRUE; + } + } + else if (efl_isa(obj, EFL_ACCESS_TEXT_INTERFACE)) + { + res = efl_access_text_selection_remove(obj, sel_num); + } + else + { + return _dbus_invalid_ref_error_new(msg); + } + ret = eldbus_message_method_return_new(msg); EINA_SAFETY_ON_NULL_RETURN_VAL(ret, NULL); - - res = efl_access_text_selection_remove(obj, sel_num); - eldbus_message_arguments_append(ret, "b", res); return ret; @@ -1665,19 +2030,36 @@ _text_selection_set(const Eldbus_Service_Interface *iface, const Eldbus_Message Eo *bridge = eldbus_service_object_data_get(iface, ELM_ATSPI_BRIDGE_CLASS_NAME); Eo *obj = _bridge_object_from_path(bridge, obj_path); int sel_num, start, end; - Eina_Bool res; + Eina_Bool res = EINA_FALSE; Eldbus_Message *ret; - ELM_ATSPI_OBJ_CHECK_OR_RETURN_DBUS_ERROR(obj, EFL_ACCESS_TEXT_INTERFACE, msg); + ELM_ATSPI_ON_NULL_RETURN_DBUS_ERROR(obj, msg); if (!eldbus_message_arguments_get(msg, "iii", &sel_num, &start, &end)) return eldbus_message_error_new(msg, "org.freedesktop.DBus.Error.InvalidArgs", "Selection number expected."); + if (efl_isa(obj, EFL_TEXT_INTERACTIVE_INTERFACE)) + { + if (sel_num == 0) + { + Efl_Text_Cursor_Object *sel1, *sel2; + efl_text_interactive_selection_cursors_get(obj, &sel1, &sel2); + efl_text_cursor_object_position_set(sel1, start); + efl_text_cursor_object_position_set(sel2, end); + res = EINA_TRUE; + } + } + else if (efl_isa(obj, EFL_ACCESS_TEXT_INTERFACE)) + { + res = efl_access_text_access_selection_set(obj, sel_num, start, end); + } + else + { + return _dbus_invalid_ref_error_new(msg); + } + ret = eldbus_message_method_return_new(msg); EINA_SAFETY_ON_NULL_RETURN_VAL(ret, NULL); - - res = efl_access_text_access_selection_set(obj, sel_num, start, end); - eldbus_message_arguments_append(ret, "b", res); return ret; @@ -1695,22 +2077,63 @@ _text_range_extents_get(const Eldbus_Service_Interface *iface, const Eldbus_Mess AtspiCoordType type; Eldbus_Message *ret; - ELM_ATSPI_OBJ_CHECK_OR_RETURN_DBUS_ERROR(obj, EFL_ACCESS_TEXT_INTERFACE, msg); + ELM_ATSPI_ON_NULL_RETURN_DBUS_ERROR(obj, msg); if (!eldbus_message_arguments_get(msg, "iiu", &start, &end, &type)) return eldbus_message_error_new(msg, "org.freedesktop.DBus.Error.InvalidArgs", "Selection number expected."); - ret = eldbus_message_method_return_new(msg); - EINA_SAFETY_ON_NULL_RETURN_VAL(ret, NULL); - screen_coords = type == ATSPI_COORD_TYPE_SCREEN ? EINA_TRUE : EINA_FALSE; - res = efl_access_text_range_extents_get(obj, screen_coords, start, end, &rect); + + if (efl_isa(obj, EFL_TEXT_INTERACTIVE_INTERFACE)) + { + Eina_Rectangle *r; + Efl_Text_Cursor_Object *sel1 = efl_ui_textbox_cursor_create(obj); + Efl_Text_Cursor_Object *sel2 = efl_ui_textbox_cursor_create(obj); + efl_text_cursor_object_position_set(sel1, start); + efl_text_cursor_object_position_set(sel2, end); + Eina_Iterator *range = efl_text_cursor_object_range_precise_geometry_get(sel1, sel2); + + /* This rect represent coordinates x1, y1, x2, y2 (not x,y,w,h). + * In this way we bypass corner cases + * (like range is empty or first rectangle is empty). */ + rect = EINA_RECT(1000000, 1000000, 0, 0); + + EINA_ITERATOR_FOREACH(range, r) + { + rect.x = r->x < rect.x ? r->x : rect.x; + rect.y = r->y < rect.y ? r->y : rect.y; + rect.w = r->x+r->w > rect.w ? r->x+r->w : rect.w; + rect.h = r->y+r->h > rect.h ? r->y+r->h : rect.h; + } + eina_iterator_free(range); + + efl_del(sel1); + efl_del(sel2); + + /* Let's change coordinates to x,y,w,h */ + rect.w -= rect.x; + rect.h -= rect.y; + + rect = _text_interactive_get_pos(obj, rect, screen_coords); + + res = rect.w != 0 ? EINA_TRUE : EINA_FALSE; + } + else if (efl_isa(obj, EFL_ACCESS_TEXT_INTERFACE)) + { + res = efl_access_text_range_extents_get(obj, screen_coords, start, end, &rect); + } + else + { + return _dbus_invalid_ref_error_new(msg); + } + if (!res) { - eldbus_message_unref(ret); return eldbus_message_error_new(msg, "org.freedesktop.DBus.Error.Failed", "Can't get range extents."); } + ret = eldbus_message_method_return_new(msg); + EINA_SAFETY_ON_NULL_RETURN_VAL(ret, NULL); eldbus_message_arguments_append(ret, "iiii", rect.x, rect.y, rect.w, rect.h); return ret; @@ -1783,7 +2206,7 @@ _text_run_attributes_get(const Eldbus_Service_Interface *iface, const Eldbus_Mes const char *obj_path = eldbus_message_path_get(msg); Eo *bridge = eldbus_service_object_data_get(iface, ELM_ATSPI_BRIDGE_CLASS_NAME); Eo *obj = _bridge_object_from_path(bridge, obj_path); - int start, end; + int start = 0, end = 0; Eldbus_Message *ret; Eldbus_Message_Iter *iter, *iter_array; Eina_List *attrs, *defaults; @@ -1802,7 +2225,7 @@ _text_run_attributes_get(const Eldbus_Service_Interface *iface, const Eldbus_Mes iter_array = eldbus_message_iter_container_new(iter, 'a', "{ss}"); EINA_SAFETY_ON_NULL_GOTO(iter_array, fail); - attrs = efl_access_text_attributes_get(obj, &start, &end); + efl_access_text_attributes_get(obj, &start, &end, &attrs); if (incl_def) { @@ -2162,7 +2585,12 @@ _value_properties_set(const Eldbus_Service_Interface *interface, const char *pro Eo *bridge = eldbus_service_object_data_get(interface, ELM_ATSPI_BRIDGE_CLASS_NAME); Eo *obj = _bridge_object_from_path(bridge, obj_path); - ELM_ATSPI_OBJ_CHECK_OR_RETURN_DBUS_ERROR(obj, EFL_ACCESS_VALUE_INTERFACE, request_msg); + if (elm_widget_is_legacy(obj)) { + ELM_ATSPI_OBJ_CHECK_OR_RETURN_DBUS_ERROR(obj, EFL_ACCESS_VALUE_INTERFACE, request_msg); + } + else if(efl_isa(obj, EFL_UI_RANGE_DISPLAY_INTERFACE)) { + ELM_ATSPI_OBJ_CHECK_OR_RETURN_DBUS_ERROR(obj, EFL_UI_RANGE_DISPLAY_INTERFACE, request_msg); + } if (!eldbus_message_iter_arguments_get(iter, "d", &value)) { @@ -2171,7 +2599,13 @@ _value_properties_set(const Eldbus_Service_Interface *interface, const char *pro if (!strcmp(property, "CurrentValue")) { - ret = efl_access_value_and_text_set(obj, value, NULL); + if (elm_widget_is_legacy(obj)) + ret = efl_access_value_and_text_set(obj, value, NULL); + else if(efl_isa(obj, EFL_UI_RANGE_DISPLAY_INTERFACE)) { + efl_ui_range_value_set(obj, value); + ret = EINA_DBL_EQ(efl_ui_range_value_get(obj), value); + } + else ret = EINA_FALSE; Eldbus_Message *answer = eldbus_message_method_return_new(request_msg); eldbus_message_arguments_append(answer, "b", ret); return answer; @@ -2190,29 +2624,32 @@ _value_properties_get(const Eldbus_Service_Interface *interface, const char *pro Eo *bridge = eldbus_service_object_data_get(interface, ELM_ATSPI_BRIDGE_CLASS_NAME); Eo *obj = _bridge_object_from_path(bridge, obj_path); - ELM_ATSPI_PROPERTY_OBJ_CHECK_OR_RETURN_DBUS_ERROR(obj, EFL_ACCESS_VALUE_INTERFACE, request_msg, error); + ELM_ATSPI_PROPERTY_OBJ_CHECK_OR_RETURN_DBUS_ERROR(obj, EFL_UI_RANGE_DISPLAY_INTERFACE, request_msg, error); if (!strcmp(property, "CurrentValue")) { - efl_access_value_and_text_get(obj, &value, NULL); + value = efl_ui_range_value_get(obj); eldbus_message_iter_basic_append(iter, 'd', value); return EINA_TRUE; } if (!strcmp(property, "MinimumValue")) { - efl_access_value_range_get(obj, &value, NULL, NULL); + efl_ui_range_limits_get(obj, &value, NULL); eldbus_message_iter_basic_append(iter, 'd', value); return EINA_TRUE; } if (!strcmp(property, "MaximumValue")) { - efl_access_value_range_get(obj, NULL, &value, NULL); + efl_ui_range_limits_get(obj, NULL, &value); eldbus_message_iter_basic_append(iter, 'd', value); return EINA_TRUE; } if (!strcmp(property, "MinimumIncrement")) { - value = efl_access_value_increment_get(obj); + if(efl_isa(obj, EFL_UI_RANGE_INTERACTIVE_INTERFACE)) { + value = efl_ui_range_step_get(obj); + } + else { value = 0; } eldbus_message_iter_basic_append(iter, 'd', value); return EINA_TRUE; } @@ -2256,23 +2693,55 @@ _text_properties_get(const Eldbus_Service_Interface *interface, const char *prop const char *obj_path = eldbus_message_path_get(request_msg); Eo *bridge = eldbus_service_object_data_get(interface, ELM_ATSPI_BRIDGE_CLASS_NAME); Eo *obj = _bridge_object_from_path(bridge, obj_path); - int val; + int result; + Eina_Bool checkCarretOffset = EINA_FALSE; + Eina_Bool checkCharacterCount = EINA_FALSE; - ELM_ATSPI_PROPERTY_OBJ_CHECK_OR_RETURN_DBUS_ERROR(obj, EFL_ACCESS_TEXT_INTERFACE, request_msg, error); + if (!obj) + { + *(error) = _dbus_invalid_ref_error_new(request_msg); + return EINA_FALSE; + } if (!strcmp(property, "CharacterCount")) + checkCharacterCount = EINA_TRUE; + else if (!strcmp(property, "CaretOffset")) + checkCarretOffset = EINA_TRUE; + else + return EINA_FALSE; + + if (efl_isa(obj, EFL_TEXT_INTERACTIVE_INTERFACE)) { - val = efl_access_text_character_count_get(obj); - eldbus_message_iter_basic_append(iter, 'i', val); - return EINA_TRUE; + if (checkCharacterCount) + { + Efl_Text_Cursor_Object *cur = efl_ui_textbox_cursor_create(obj); + efl_text_cursor_object_move(cur, EFL_TEXT_CURSOR_MOVE_TYPE_LAST); + result = efl_text_cursor_object_position_get(cur); + efl_del(cur); + } + + if (checkCarretOffset) + { + Efl_Text_Cursor_Object *main_cur = efl_text_interactive_main_cursor_get(obj); + result = efl_text_cursor_object_position_get(main_cur); + } } - if (!strcmp(property, "CaretOffset")) + else if (efl_isa(obj, EFL_ACCESS_TEXT_INTERFACE)) { - val = efl_access_text_caret_offset_get(obj); - eldbus_message_iter_basic_append(iter, 'i', val); - return EINA_TRUE; + if (checkCharacterCount) + result = efl_access_text_character_count_get(obj); + + if (checkCarretOffset) + result = efl_access_text_caret_offset_get(obj); } - return EINA_FALSE; + else + { + *(error) = _dbus_invalid_ref_error_new(request_msg); + return EINA_FALSE; + } + + eldbus_message_iter_basic_append(iter, 'i', result); + return EINA_TRUE; } static Eldbus_Message* @@ -2508,7 +2977,10 @@ _collection_iter_match_rule_get(Eldbus_Message_Iter *iter, struct collection_mat else if (!strcmp(ifc_name, "image")) class = EFL_ACCESS_SELECTION_INTERFACE; else if (!strcmp(ifc_name, "value")) - class = EFL_ACCESS_VALUE_INTERFACE; + { + class = EFL_ACCESS_VALUE_INTERFACE; + rule->ifaces = eina_list_append(rule->ifaces, EFL_UI_RANGE_DISPLAY_INTERFACE); //alternative interface + } if (class) rule->ifaces = eina_list_append(rule->ifaces, class); @@ -3185,6 +3657,8 @@ _iter_interfaces_append(Eldbus_Message_Iter *iter, const Eo *obj) eldbus_message_iter_basic_append(iter_array, 's', ATSPI_DBUS_INTERFACE_TEXT); if (efl_isa(obj, EFL_ACCESS_VALUE_INTERFACE)) eldbus_message_iter_basic_append(iter_array, 's', ATSPI_DBUS_INTERFACE_VALUE); + if (efl_isa(obj, EFL_UI_RANGE_DISPLAY_INTERFACE)) + eldbus_message_iter_basic_append(iter_array, 's', ATSPI_DBUS_INTERFACE_VALUE); eldbus_message_iter_container_close(iter, iter_array); } @@ -3748,7 +4222,7 @@ _set_broadcast_flag(const char *event, Eo *bridge) if (!strcmp(tokens[0], "Object")) { - if (!tokens[1] || *tokens[1] == '\0') return; // do not handle "Object:*" + if (!tokens[1] || *tokens[1] == '\0') goto end; // do not handle "Object:*" else if (!strcmp(tokens[1], "StateChanged")) { if (!tokens[2] || *tokens[2] == '\0') @@ -3823,6 +4297,7 @@ _set_broadcast_flag(const char *event, Eo *bridge) STATE_TYPE_SET(pd->window_signal_broadcast_mask, ATSPI_WINDOW_EVENT_RESTORE); } +end: free(tokens[0]); free(tokens); } @@ -3970,6 +4445,15 @@ _property_changed_signal_send(void *data, const Efl_Event *event) } static void +_value_property_changed_signal_send(void *data, const Efl_Event *event) +{ + ELM_ATSPI_BRIDGE_DATA_GET_OR_RETURN(data, pd); + + _bridge_signal_send(data, event->object, ATSPI_DBUS_INTERFACE_EVENT_OBJECT, + &_event_obj_signals[ATSPI_OBJECT_EVENT_PROPERTY_CHANGED], "accessible-value", 0, 0, NULL); +} + +static void _visible_data_changed_signal_send(void *data, const Efl_Event *event) { ELM_ATSPI_BRIDGE_DATA_GET_OR_RETURN(data, pd); diff --git a/src/lib/elementary/elm_atspi_bridge_eo.h b/src/lib/elementary/elm_atspi_bridge_eo.h index 180544d25c..76cd68c690 100644 --- a/src/lib/elementary/elm_atspi_bridge_eo.h +++ b/src/lib/elementary/elm_atspi_bridge_eo.h @@ -19,7 +19,7 @@ typedef Eo Elm_Atspi_Bridge; */ #define ELM_ATSPI_BRIDGE_CLASS elm_atspi_bridge_class_get() -EWAPI const Efl_Class *elm_atspi_bridge_class_get(void); +EWAPI const Efl_Class *elm_atspi_bridge_class_get(void) EINA_CONST; /** * @brief Indicate if connection with AT-SPI2 bus has been established. diff --git a/src/lib/elementary/elm_bg.h b/src/lib/elementary/elm_bg.h index 030f83e53a..f6e1c0669b 100644 --- a/src/lib/elementary/elm_bg.h +++ b/src/lib/elementary/elm_bg.h @@ -17,7 +17,7 @@ * properties useful to a background, like setting it to tiled, * centered, scaled or stretched. * - * This widget inherits from the @ref Layout one, so that all the + * This widget inherits from the @ref Elm_Layout one, so that all the * functions acting on it also work for background objects. * * Default content parts of the bg widget that you can use for are: diff --git a/src/lib/elementary/elm_bg_legacy.h b/src/lib/elementary/elm_bg_legacy.h index 54f6b6aaf1..abbd0b3d2a 100644 --- a/src/lib/elementary/elm_bg_legacy.h +++ b/src/lib/elementary/elm_bg_legacy.h @@ -133,7 +133,7 @@ EAPI void elm_bg_option_set(Evas_Object *obj, Elm_Bg_Option option); /** * @brief Gets the mode of display of a given background widget's image * - * @return The background option Elm.Bg.Option Default is #Elm_Bg_SCALE. + * @return The background option Elm.Bg.Option Default is #ELM_BG_OPTION_SCALE. * * @see elm_bg_option_set() * diff --git a/src/lib/elementary/elm_box.c b/src/lib/elementary/elm_box.c index 73a73092c1..ff0c32a3c5 100644 --- a/src/lib/elementary/elm_box.c +++ b/src/lib/elementary/elm_box.c @@ -337,9 +337,6 @@ _elm_box_efl_canvas_group_group_add(Eo *obj, Elm_Box_Data *_pd EINA_UNUSED) EOLIAN static void _elm_box_efl_canvas_group_group_del(Eo *obj, Elm_Box_Data *sd) { - Eina_List *l; - Evas_Object *child; - sd->delete_me = EINA_TRUE; ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd); @@ -349,15 +346,15 @@ _elm_box_efl_canvas_group_group_del(Eo *obj, Elm_Box_Data *sd) /* let's make our box object the *last* to be processed, since it * may (smart) parent other sub objects here */ - EINA_LIST_FOREACH (wd->subobjs, l, child) - { - if (child == wd->resize_obj) - { - wd->subobjs = - eina_list_demote_list(wd->subobjs, l); - break; - } - } + { + unsigned int resize_id = 0; + if (eina_array_find(wd->children, wd->resize_obj, &resize_id)) + { + //exchange with last + eina_array_data_set(wd->children, resize_id, eina_array_data_get(wd->children, eina_array_count(wd->children) - 1)); + eina_array_data_set(wd->children, eina_array_count(wd->children) - 1, wd->resize_obj); + } + } efl_canvas_group_del(efl_super(obj, MY_CLASS)); } diff --git a/src/lib/elementary/elm_box.h b/src/lib/elementary/elm_box.h index c15eb01d21..24ab2e8017 100644 --- a/src/lib/elementary/elm_box.h +++ b/src/lib/elementary/elm_box.h @@ -1,5 +1,5 @@ /** - * @defgroup Elm_Box Box + * @defgroup Elm_Box_Group Box * @ingroup Elementary * * @image html box_inheritance_tree.png diff --git a/src/lib/elementary/elm_box_common.h b/src/lib/elementary/elm_box_common.h index f16b72ce98..7eeb53b144 100644 --- a/src/lib/elementary/elm_box_common.h +++ b/src/lib/elementary/elm_box_common.h @@ -1,5 +1,5 @@ /** - * @addtogroup Elm_Box + * @addtogroup Elm_Box_Group * * @{ */ diff --git a/src/lib/elementary/elm_box_eo.h b/src/lib/elementary/elm_box_eo.h index fb82524082..64c1174e35 100644 --- a/src/lib/elementary/elm_box_eo.h +++ b/src/lib/elementary/elm_box_eo.h @@ -15,11 +15,11 @@ typedef Eo Elm_Box; #endif /** Elementary box class * - * @ingroup Elm_Box + * @ingroup Elm_Box_Group */ #define ELM_BOX_CLASS elm_box_class_get() -EWAPI const Efl_Class *elm_box_class_get(void); +EWAPI const Efl_Class *elm_box_class_get(void) EINA_CONST; /** * @brief Set the box to arrange its children homogeneously @@ -32,7 +32,7 @@ EWAPI const Efl_Class *elm_box_class_get(void); * @param[in] obj The object. * @param[in] homogeneous The homogeneous flag * - * @ingroup Elm_Box + * @ingroup Elm_Box_Group */ EOAPI void elm_obj_box_homogeneous_set(Eo *obj, Eina_Bool homogeneous); @@ -44,7 +44,7 @@ EOAPI void elm_obj_box_homogeneous_set(Eo *obj, Eina_Bool homogeneous); * * @return The homogeneous flag * - * @ingroup Elm_Box + * @ingroup Elm_Box_Group */ EOAPI Eina_Bool elm_obj_box_homogeneous_get(const Eo *obj); @@ -59,7 +59,7 @@ EOAPI Eina_Bool elm_obj_box_homogeneous_get(const Eo *obj); * @param[in] horizontal The horizontal alignment of elements * @param[in] vertical The vertical alignment of elements * - * @ingroup Elm_Box + * @ingroup Elm_Box_Group */ EOAPI void elm_obj_box_align_set(Eo *obj, double horizontal, double vertical); @@ -72,7 +72,7 @@ EOAPI void elm_obj_box_align_set(Eo *obj, double horizontal, double vertical); * @param[out] horizontal The horizontal alignment of elements * @param[out] vertical The vertical alignment of elements * - * @ingroup Elm_Box + * @ingroup Elm_Box_Group */ EOAPI void elm_obj_box_align_get(const Eo *obj, double *horizontal, double *vertical); @@ -88,7 +88,7 @@ EOAPI void elm_obj_box_align_get(const Eo *obj, double *horizontal, double *vert * @param[in] obj The object. * @param[in] horizontal The horizontal flag * - * @ingroup Elm_Box + * @ingroup Elm_Box_Group */ EOAPI void elm_obj_box_horizontal_set(Eo *obj, Eina_Bool horizontal); @@ -100,7 +100,7 @@ EOAPI void elm_obj_box_horizontal_set(Eo *obj, Eina_Bool horizontal); * * @return The horizontal flag * - * @ingroup Elm_Box + * @ingroup Elm_Box_Group */ EOAPI Eina_Bool elm_obj_box_horizontal_get(const Eo *obj); @@ -116,7 +116,7 @@ EOAPI Eina_Bool elm_obj_box_horizontal_get(const Eo *obj); * @param[in] horizontal The horizontal space between elements * @param[in] vertical The vertical space between elements * - * @ingroup Elm_Box + * @ingroup Elm_Box_Group */ EOAPI void elm_obj_box_padding_set(Eo *obj, int horizontal, int vertical); @@ -129,7 +129,7 @@ EOAPI void elm_obj_box_padding_set(Eo *obj, int horizontal, int vertical); * @param[out] horizontal The horizontal space between elements * @param[out] vertical The vertical space between elements * - * @ingroup Elm_Box + * @ingroup Elm_Box_Group */ EOAPI void elm_obj_box_padding_get(const Eo *obj, int *horizontal, int *vertical); @@ -145,7 +145,7 @@ EOAPI void elm_obj_box_padding_get(const Eo *obj, int *horizontal, int *vertical * * @return List of children * - * @ingroup Elm_Box + * @ingroup Elm_Box_Group */ EOAPI Eina_List *elm_obj_box_children_get(const Eo *obj) EINA_WARN_UNUSED_RESULT; @@ -164,7 +164,7 @@ EOAPI Eina_List *elm_obj_box_children_get(const Eo *obj) EINA_WARN_UNUSED_RESULT * @param[in] obj The object. * @param[in] subobj The object to add to the box * - * @ingroup Elm_Box + * @ingroup Elm_Box_Group */ EOAPI void elm_obj_box_pack_end(Eo *obj, Efl_Canvas_Object *subobj); @@ -180,7 +180,7 @@ EOAPI void elm_obj_box_pack_end(Eo *obj, Efl_Canvas_Object *subobj); * See also @ref elm_obj_box_clear, @ref elm_obj_box_unpack. * @param[in] obj The object. * - * @ingroup Elm_Box + * @ingroup Elm_Box_Group */ EOAPI void elm_obj_box_unpack_all(Eo *obj); @@ -195,7 +195,7 @@ EOAPI void elm_obj_box_unpack_all(Eo *obj); * @param[in] obj The object. * @param[in] subobj The object to unpack * - * @ingroup Elm_Box + * @ingroup Elm_Box_Group */ EOAPI void elm_obj_box_unpack(Eo *obj, Efl_Canvas_Object *subobj); @@ -215,7 +215,7 @@ EOAPI void elm_obj_box_unpack(Eo *obj, Efl_Canvas_Object *subobj); * @param[in] subobj The object to add to the box * @param[in] after The object after which to add it * - * @ingroup Elm_Box + * @ingroup Elm_Box_Group */ EOAPI void elm_obj_box_pack_after(Eo *obj, Efl_Canvas_Object *subobj, Efl_Canvas_Object *after); @@ -234,7 +234,7 @@ EOAPI void elm_obj_box_pack_after(Eo *obj, Efl_Canvas_Object *subobj, Efl_Canvas * @param[in] obj The object. * @param[in] subobj The object to add to the box * - * @ingroup Elm_Box + * @ingroup Elm_Box_Group */ EOAPI void elm_obj_box_pack_start(Eo *obj, Efl_Canvas_Object *subobj); @@ -247,7 +247,7 @@ EOAPI void elm_obj_box_pack_start(Eo *obj, Efl_Canvas_Object *subobj); * position of a just added item you must force recalculate before doing so. * @param[in] obj The object. * - * @ingroup Elm_Box + * @ingroup Elm_Box_Group */ EOAPI void elm_obj_box_recalculate(Eo *obj); @@ -267,7 +267,7 @@ EOAPI void elm_obj_box_recalculate(Eo *obj); * @param[in] subobj The object to add to the box * @param[in] before The object before which to add it * - * @ingroup Elm_Box + * @ingroup Elm_Box_Group */ EOAPI void elm_obj_box_pack_before(Eo *obj, Efl_Canvas_Object *subobj, Efl_Canvas_Object *before); @@ -280,7 +280,7 @@ EOAPI void elm_obj_box_pack_before(Eo *obj, Efl_Canvas_Object *subobj, Efl_Canva * See also @ref elm_obj_box_unpack, @ref elm_obj_box_unpack_all. * @param[in] obj The object. * - * @ingroup Elm_Box + * @ingroup Elm_Box_Group */ EOAPI void elm_obj_box_clear(Eo *obj); @@ -289,7 +289,7 @@ EWAPI extern const Efl_Event_Description _ELM_BOX_EVENT_CHILD_ADDED; /** Called when child was added * @return Efl_Object * * - * @ingroup Elm_Box + * @ingroup Elm_Box_Group */ #define ELM_BOX_EVENT_CHILD_ADDED (&(_ELM_BOX_EVENT_CHILD_ADDED)) @@ -298,7 +298,7 @@ EWAPI extern const Efl_Event_Description _ELM_BOX_EVENT_CHILD_REMOVED; /** Called when child was removed * @return Efl_Object * * - * @ingroup Elm_Box + * @ingroup Elm_Box_Group */ #define ELM_BOX_EVENT_CHILD_REMOVED (&(_ELM_BOX_EVENT_CHILD_REMOVED)) diff --git a/src/lib/elementary/elm_box_legacy.h b/src/lib/elementary/elm_box_legacy.h index 1afb296efd..ad8aaa91d0 100644 --- a/src/lib/elementary/elm_box_legacy.h +++ b/src/lib/elementary/elm_box_legacy.h @@ -6,7 +6,7 @@ * @param parent The parent object * @return The new object or NULL if it cannot be created * - * @ingroup Elm_Box + * @ingroup Elm_Box_Group */ EAPI Evas_Object *elm_box_add(Evas_Object *parent); @@ -43,5 +43,7 @@ EAPI Evas_Object *elm_box_add(Evas_Object *parent); * @param[in] cb The callback function used for layout * @param[in] data Data that will be passed to layout function * @param[in] free_data Function called to free @c data + * + * @ingroup Elm_Box_Group */ EAPI void elm_box_layout_set(Evas_Object *obj, Evas_Object_Box_Layout cb, const void *data, Ecore_Cb free_data); diff --git a/src/lib/elementary/elm_bubble.h b/src/lib/elementary/elm_bubble.h index 328540d9bb..522ee8a438 100644 --- a/src/lib/elementary/elm_bubble.h +++ b/src/lib/elementary/elm_bubble.h @@ -32,11 +32,11 @@ * @li "bottom_left" * @li "bottom_right" * - * This widget inherits from the @ref Layout one, so that all the + * This widget inherits from the @ref Elm_Layout one, so that all the * functions acting on it also work for bubble objects. * * This widget emits the following signals, besides the ones sent from - * @ref Layout: + * @ref Elm_Layout : * @li @c "clicked" - This is called when a user has clicked the bubble. * @li @c "focused" - When the bubble has received focus. (since 1.8) * @li @c "unfocused" - When the bubble has lost focus. (since 1.8) diff --git a/src/lib/elementary/elm_bubble_eo.h b/src/lib/elementary/elm_bubble_eo.h index e94541d2c3..693bb98e60 100644 --- a/src/lib/elementary/elm_bubble_eo.h +++ b/src/lib/elementary/elm_bubble_eo.h @@ -40,7 +40,7 @@ typedef enum */ #define ELM_BUBBLE_CLASS elm_bubble_class_get() -EWAPI const Efl_Class *elm_bubble_class_get(void); +EWAPI const Efl_Class *elm_bubble_class_get(void) EINA_CONST; /** * @brief The corner of the bubble diff --git a/src/lib/elementary/elm_calendar.c b/src/lib/elementary/elm_calendar.c index e6de3373c6..c58fc1cc15 100644 --- a/src/lib/elementary/elm_calendar.c +++ b/src/lib/elementary/elm_calendar.c @@ -22,6 +22,8 @@ #define ELM_CALENDAR_BUTTON_RIGHT "elm,calendar,button,right" #define ELM_CALENDAR_BUTTON_YEAR_LEFT "elm,calendar,button_year,left" #define ELM_CALENDAR_BUTTON_YEAR_RIGHT "elm,calendar,button_year,right" +#define ELM_CALENDAR_CH_WEEKEND "elm,calendar,ch_%d,weekend" +#define ELM_CALENDAR_CH_WEEKDAY "elm,calendar,ch_%d,weekday" #define ELM_CALENDAR_CH_TEXT_PART_STR "elm.ch_%d.text" #define ELM_CALENDAR_CIT_TEXT_PART_STR "elm.cit_%d.text" @@ -674,6 +676,7 @@ static void _set_headers(Evas_Object *obj) { static char part[64]; + static char emission[64]; int i; struct tm *t; time_t temp = 259200; // the first sunday since epoch @@ -710,7 +713,15 @@ _set_headers(Evas_Object *obj) for (i = 0; i < ELM_DAY_LAST; i++) { _part_name_snprintf(part, sizeof(part), obj, ELM_CALENDAR_CH_TEXT_PART_STR, i); - elm_layout_text_set(obj, part, sd->weekdays[(i + sd->first_week_day) % ELM_DAY_LAST]); + int weekday_index = (i + sd->first_week_day) % ELM_DAY_LAST; + elm_layout_text_set(obj, part, sd->weekdays[weekday_index]); + // Signaling the theme about which days are weekdays and which weekend + if (weekday_index == ELM_DAY_SATURDAY || weekday_index == ELM_DAY_SUNDAY) + _part_name_snprintf(emission, sizeof(emission), obj, ELM_CALENDAR_CH_WEEKEND, i); + else + _part_name_snprintf(emission, sizeof(emission), obj, ELM_CALENDAR_CH_WEEKDAY, i); + + elm_layout_signal_emit(obj, emission, "elm"); } sd->filling = EINA_FALSE; @@ -960,8 +971,11 @@ _spin_value(void *data) if (_update_data(data, sd->month_btn_clicked, sd->spin_speed)) evas_object_smart_changed(data); - sd->interval = sd->interval / 1.05; - ecore_timer_interval_set(sd->spin_timer, sd->interval); + if (sd->spin_timer) + { + sd->interval = sd->interval / 1.05; + ecore_timer_interval_set(sd->spin_timer, sd->interval); + } return ECORE_CALLBACK_RENEW; } diff --git a/src/lib/elementary/elm_calendar_eo.h b/src/lib/elementary/elm_calendar_eo.h index 09a97eb868..a9cdaab195 100644 --- a/src/lib/elementary/elm_calendar_eo.h +++ b/src/lib/elementary/elm_calendar_eo.h @@ -128,7 +128,7 @@ typedef struct _Elm_Calendar_Mark Elm_Calendar_Mark; */ #define ELM_CALENDAR_CLASS elm_calendar_class_get() -EWAPI const Efl_Class *elm_calendar_class_get(void); +EWAPI const Efl_Class *elm_calendar_class_get(void) EINA_CONST; /** * @brief The first day of week to use on calendar widgets'. @@ -189,7 +189,7 @@ EOAPI void elm_obj_calendar_selectable_set(Eo *obj, Elm_Calendar_Selectable sele EOAPI Elm_Calendar_Selectable elm_obj_calendar_selectable_get(const Eo *obj); /** - * @brief The interval on time updates for an user mouse button hold on + * @brief The interval on time updates for a user mouse button hold on * calendar widgets' month/year selection. * * This interval value is decreased while the user holds the mouse pointer @@ -213,7 +213,7 @@ EOAPI Elm_Calendar_Selectable elm_obj_calendar_selectable_get(const Eo *obj); EOAPI void elm_obj_calendar_interval_set(Eo *obj, double interval); /** - * @brief The interval on time updates for an user mouse button hold on + * @brief The interval on time updates for a user mouse button hold on * calendar widgets' month/year selection. * * This interval value is decreased while the user holds the mouse pointer diff --git a/src/lib/elementary/elm_calendar_eo.legacy.h b/src/lib/elementary/elm_calendar_eo.legacy.h index d014445642..e2f903cb66 100644 --- a/src/lib/elementary/elm_calendar_eo.legacy.h +++ b/src/lib/elementary/elm_calendar_eo.legacy.h @@ -176,7 +176,7 @@ EAPI void elm_calendar_selectable_set(Elm_Calendar *obj, Elm_Calendar_Selectable EAPI Elm_Calendar_Selectable elm_calendar_selectable_get(const Elm_Calendar *obj); /** - * @brief The interval on time updates for an user mouse button hold on + * @brief The interval on time updates for a user mouse button hold on * calendar widgets' month/year selection. * * This interval value is decreased while the user holds the mouse pointer @@ -200,7 +200,7 @@ EAPI Elm_Calendar_Selectable elm_calendar_selectable_get(const Elm_Calendar *obj EAPI void elm_calendar_interval_set(Elm_Calendar *obj, double interval); /** - * @brief The interval on time updates for an user mouse button hold on + * @brief The interval on time updates for a user mouse button hold on * calendar widgets' month/year selection. * * This interval value is decreased while the user holds the mouse pointer diff --git a/src/lib/elementary/elm_calendar_item_eo.h b/src/lib/elementary/elm_calendar_item_eo.h index 39f5c435bf..6e33610bd3 100644 --- a/src/lib/elementary/elm_calendar_item_eo.h +++ b/src/lib/elementary/elm_calendar_item_eo.h @@ -19,7 +19,7 @@ typedef Eo Elm_Calendar_Item; */ #define ELM_CALENDAR_ITEM_CLASS elm_calendar_item_class_get() -EWAPI const Efl_Class *elm_calendar_item_class_get(void); +EWAPI const Efl_Class *elm_calendar_item_class_get(void) EINA_CONST; /** * @brief Day number property diff --git a/src/lib/elementary/elm_clock.h b/src/lib/elementary/elm_clock.h index 8d6bff54e7..f3d4b10252 100644 --- a/src/lib/elementary/elm_clock.h +++ b/src/lib/elementary/elm_clock.h @@ -33,11 +33,11 @@ * am/pm indicator may be optionally shown, too, when it will * switch to 12h. * - * This widget inherits from the @ref Layout one, so that all the + * This widget inherits from the @ref Elm_Layout one, so that all the * functions acting on it also work for clock objects. * * This widget emits the following signals, besides the ones sent from - * @ref Layout: + * @ref Elm_Layout : * - @c "changed" - the clock's user changed the time * - @c "focused" - When the clock ehas received focus. (since 1.8) * - @c "unfocused" - When the clock has lost focus. (since 1.8) diff --git a/src/lib/elementary/elm_clock_eo.h b/src/lib/elementary/elm_clock_eo.h index 0236dd26c4..829c161559 100644 --- a/src/lib/elementary/elm_clock_eo.h +++ b/src/lib/elementary/elm_clock_eo.h @@ -56,7 +56,7 @@ typedef enum */ #define ELM_CLOCK_CLASS elm_clock_class_get() -EWAPI const Efl_Class *elm_clock_class_get(void); +EWAPI const Efl_Class *elm_clock_class_get(void) EINA_CONST; /** * @brief If the given clock widget must show hours in military or am/pm mode diff --git a/src/lib/elementary/elm_cnp.c b/src/lib/elementary/elm_cnp.c new file mode 100644 index 0000000000..eb820766f0 --- /dev/null +++ b/src/lib/elementary/elm_cnp.c @@ -0,0 +1,302 @@ +#ifdef HAVE_CONFIG_H +# include "elementary_config.h" +#endif + +#include <Elementary.h> +#include <Ecore_Evas.h> + +#include "elm_priv.h" +#include "elm_entry_eo.h" + +static inline Ecore_Evas_Selection_Buffer +_elm_sel_type_to_ee_type(Elm_Sel_Type type) +{ + if (type == ELM_SEL_TYPE_PRIMARY) + return ECORE_EVAS_SELECTION_BUFFER_SELECTION_BUFFER; + if (type == ELM_SEL_TYPE_XDND) + return ECORE_EVAS_SELECTION_BUFFER_DRAG_AND_DROP_BUFFER; + if (type == ELM_SEL_TYPE_CLIPBOARD) + return ECORE_EVAS_SELECTION_BUFFER_COPY_AND_PASTE_BUFFER; + return ECORE_EVAS_SELECTION_BUFFER_LAST; +} + +static inline Eina_Array* +_elm_sel_format_to_mime_type(Elm_Sel_Format format) +{ + Eina_Array *ret = eina_array_new(10); + if (format & ELM_SEL_FORMAT_TEXT) + eina_array_push(ret, "text/plain;charset=utf-8"); + if (format & ELM_SEL_FORMAT_MARKUP) + eina_array_push(ret, "application/x-elementary-markup"); + if (format & ELM_SEL_FORMAT_IMAGE) + { + eina_array_push(ret, "image/png"); + eina_array_push(ret, "image/jpeg"); + eina_array_push(ret, "image/x-ms-bmp"); + eina_array_push(ret, "image/gif"); + eina_array_push(ret, "image/tiff"); + eina_array_push(ret, "image/svg+xml"); + eina_array_push(ret, "image/x-xpixmap"); + eina_array_push(ret, "image/x-tga"); + eina_array_push(ret, "image/x-portable-pixmap"); + } + if (format & ELM_SEL_FORMAT_VCARD) + eina_array_push(ret, "text/vcard"); + if (format & ELM_SEL_FORMAT_HTML) + eina_array_push(ret, "application/xhtml+xml"); + + if (eina_array_count(ret) == 0) + ERR("Specified mime type is not available"); + + return ret; +} + +typedef struct { + const unsigned char image_sequence[16]; + const size_t image_sequence_len; + const char *mimetype; +} Mimetype_Content_Matcher; + +static const Mimetype_Content_Matcher matchers[] = { + {{0x89, 0x50, 0x4E, 0x47, 0x0D, 0x0A, 0x1A, 0x0A}, 8, "image/png"}, + {{0xFF, 0xD8}, 2, "image/jpeg"}, + {{0x42, 0x4D}, 2, "image/x-ms-bmp"}, + {{0x47, 0x49, 0x46, 0x38, 0x37, 0x61}, 6, "image/gif"}, + {{0x47, 0x49, 0x46, 0x38, 0x39, 0x61}, 6, "image/gif"}, + {{0x49, 0x49, 0x2A, 00}, 4, "image/tiff"}, + {{0x49, 0x4D, 0x00, 0x2A}, 4, "image/tiff"}, + {{0},0, NULL} +}; + +static inline Eina_Array* +_elm_sel_from_content_to_mime_type(const void *buf, size_t buflen) +{ + Eina_Array *ret = eina_array_new(10); + + for (int i = 0; matchers[i].mimetype && eina_array_count(ret) == 0; ++i) + { + if (matchers[i].image_sequence_len >= buflen) continue; + for (size_t j = 0; j < matchers[i].image_sequence_len; ++j) + { + if (((const unsigned char*)buf)[j] == matchers[i].image_sequence[j]) + { + eina_array_push(ret, matchers[i].mimetype); + break; + } + } + } + + if (eina_array_count(ret) != 1) + ERR("Specified mime type is not available"); + + return ret; +} + +static inline Elm_Sel_Format +_mime_type_to_elm_sel_format(const char *mime_type) +{ + if (eina_streq(mime_type, "text/vcard")) + return ELM_SEL_FORMAT_VCARD; + else if (eina_streq(mime_type, "application/x-elementary-markup")) + return ELM_SEL_FORMAT_MARKUP; + else if (eina_streq(mime_type, "application/xhtml+xml")) + return ELM_SEL_FORMAT_HTML; + else if (!strncmp(mime_type, "text/", strlen("text/"))) + return ELM_SEL_FORMAT_TEXT; + else if (!strncmp(mime_type, "image/", strlen("image/"))) + return ELM_SEL_FORMAT_IMAGE; + + return ELM_SEL_FORMAT_NONE; +} + +static int +_default_seat(const Eo *obj) +{ + return evas_device_seat_id_get(evas_default_device_get(evas_object_evas_get(obj), EVAS_DEVICE_CLASS_SEAT)); +} + +EAPI Eina_Bool +elm_cnp_selection_set(Evas_Object *obj, Elm_Sel_Type selection, + Elm_Sel_Format format, + const void *buf, size_t buflen) +{ + Eina_Content *content; + Ecore_Evas *ee; + const char *mime_type; + Eina_Slice data; + Eina_Array *tmp; + unsigned char *mem_buf = NULL; + + if (format == ELM_SEL_FORMAT_TEXT && ((char*)buf)[buflen - 1] != '\0') + { + mem_buf = eina_memdup((unsigned char *)buf, buflen, EINA_TRUE); + data.mem = mem_buf; + data.len = buflen + 1; + } + else + { + data.mem = buf; + data.len = buflen; + } + + ee = ecore_evas_ecore_evas_get(evas_object_evas_get(obj)); + + if (format == ELM_SEL_FORMAT_IMAGE) + { + tmp = _elm_sel_from_content_to_mime_type(buf, buflen); + } + else + { + tmp = _elm_sel_format_to_mime_type(format); + } + + + if (eina_array_count(tmp) != 1) + { + ERR("You cannot specify more than one format when setting selection"); + } + mime_type = eina_array_data_get(tmp, 0); + eina_array_free(tmp); + content = eina_content_new(data, mime_type); + _register_selection_changed(obj); + + if (mem_buf != NULL) + free(mem_buf); + + return ecore_evas_selection_set(ee, _default_seat(obj), _elm_sel_type_to_ee_type(selection), content); +} + +EAPI Eina_Bool +elm_object_cnp_selection_clear(Evas_Object *obj, + Elm_Sel_Type selection) +{ + Ecore_Evas *ee; + + ee = ecore_evas_ecore_evas_get(evas_object_evas_get(obj)); + return ecore_evas_selection_set(ee, _default_seat(obj), _elm_sel_type_to_ee_type(selection), NULL); +} + +EAPI Eina_Bool +elm_cnp_clipboard_selection_has_owner(Evas_Object *obj) +{ + Ecore_Evas *ee; + + ee = ecore_evas_ecore_evas_get(evas_object_evas_get(obj)); + return ecore_evas_selection_exists(ee, _default_seat(obj), ECORE_EVAS_SELECTION_BUFFER_COPY_AND_PASTE_BUFFER); + +} + +typedef struct _Sel_Lost_Data Sel_Lost_Data; +struct _Sel_Lost_Data +{ + const Evas_Object *obj; + Elm_Sel_Type type; + void *udata; + Elm_Selection_Loss_Cb loss_cb; +}; + +static void +_selection_changed_cb(void *data, const Efl_Event *ev) +{ + Sel_Lost_Data *ldata = data; + Efl_Ui_Wm_Selection_Changed *changed = ev->info; + + if (changed->buffer == EFL_UI_CNP_BUFFER_SELECTION && ldata->type != ELM_SEL_TYPE_PRIMARY) + return; + + if (changed->buffer == EFL_UI_CNP_BUFFER_COPY_AND_PASTE && ldata->type != ELM_SEL_TYPE_CLIPBOARD) + return; + + if (ldata->obj == changed->caused_by) + return; + + ldata->loss_cb(ldata->udata, ldata->type); + efl_event_callback_del(ev->object, ev->desc, _selection_changed_cb, data); + free(data); +} + +EAPI void +elm_cnp_selection_loss_callback_set(Evas_Object *obj, Elm_Sel_Type type, Elm_Selection_Loss_Cb func, const void *data) +{ + Sel_Lost_Data *ldata = calloc(1, sizeof(Sel_Lost_Data)); + + if (!ldata) return; + ldata->obj = obj; + ldata->type = type; + ldata->udata = (void *)data; + ldata->loss_cb = func; + efl_event_callback_add(obj, EFL_UI_SELECTION_EVENT_WM_SELECTION_CHANGED, _selection_changed_cb, ldata); +} + +typedef struct { + Elm_Drop_Cb data_cb; + void *data; + Elm_Sel_Format format; +} Callback_Storage; + +static Eina_Value +_callback_storage_deliver(Eo *obj, void *data, const Eina_Value value) +{ + Callback_Storage *cb_storage = data; + Eina_Content *content = eina_value_to_content(&value); + Elm_Sel_Format format = _mime_type_to_elm_sel_format(eina_content_type_get(content)); + Eina_Slice cdata; + + cdata = eina_content_data_get(content); + Elm_Selection_Data d = { 0 }; + d.data = eina_memdup((unsigned char*)cdata.bytes, cdata.len, EINA_FALSE); + d.len = cdata.len; + d.format = _mime_type_to_elm_sel_format(eina_content_type_get(content)); + + if (cb_storage->data_cb) + { + cb_storage->data_cb(cb_storage->data, obj, &d); + } + else + { + EINA_SAFETY_ON_FALSE_GOTO(format == ELM_SEL_FORMAT_TEXT || format == ELM_SEL_FORMAT_MARKUP || format == ELM_SEL_FORMAT_HTML, end); + + _elm_entry_entry_paste(obj, (const char *) d.data); + } + +end: + free(d.data); + + return EINA_VALUE_EMPTY; +} + +static Eina_Value +_callback_storage_error(Eo *obj EINA_UNUSED, void *data EINA_UNUSED, Eina_Error error) +{ + ERR("Content cound not be received because of %s.", eina_error_msg_get(error)); + return EINA_VALUE_EMPTY; +} + +static void +_callback_storage_free(Eo *obj EINA_UNUSED, void *data, const Eina_Future *dead_future EINA_UNUSED) +{ + free(data); +} + +EAPI Eina_Bool +elm_cnp_selection_get(const Evas_Object *obj, Elm_Sel_Type selection, + Elm_Sel_Format format, + Elm_Drop_Cb data_cb, void *udata) +{ + Ecore_Evas *ee; + Eina_Array *mime_types; + Eina_Future *future; + Callback_Storage *storage; + + ee = ecore_evas_ecore_evas_get(evas_object_evas_get(obj)); + mime_types = _elm_sel_format_to_mime_type(format); + future = ecore_evas_selection_get(ee, _default_seat(obj), _elm_sel_type_to_ee_type(selection), eina_array_iterator_new(mime_types)); + storage = calloc(1,sizeof(Callback_Storage)); + storage->data_cb = data_cb; + storage->data = udata; + storage->format = format; + + efl_future_then(obj, future, _callback_storage_deliver, _callback_storage_error, _callback_storage_free, EINA_VALUE_TYPE_CONTENT, storage); + + return EINA_TRUE; +} diff --git a/src/lib/elementary/elm_cnp.h b/src/lib/elementary/elm_cnp.h index 5feda3acc0..06346e40a5 100644 --- a/src/lib/elementary/elm_cnp.h +++ b/src/lib/elementary/elm_cnp.h @@ -43,8 +43,6 @@ * @{ */ -# include <efl_ui_selection_types.eot.h> - /** * Event notifying that the selection has changed * @see Elm_Cnp_Event_Selection_Changed diff --git a/src/lib/elementary/elm_code_diff_widget.h b/src/lib/elementary/elm_code_diff_widget.h index 7a6f2d6412..4387f9dbb2 100644 --- a/src/lib/elementary/elm_code_diff_widget.h +++ b/src/lib/elementary/elm_code_diff_widget.h @@ -12,7 +12,7 @@ extern "C" { /** * @brief UI Loading functions. - * @defgroup Init Creating a diff widget to render an Elm Code backend + * @defgroup Elm_Code_Diff_Init Creating a diff widget to render an Elm Code backend * when it's referencing a diff file * * @{ diff --git a/src/lib/elementary/elm_code_line.h b/src/lib/elementary/elm_code_line.h index 8e832ff5ed..5f42174041 100644 --- a/src/lib/elementary/elm_code_line.h +++ b/src/lib/elementary/elm_code_line.h @@ -40,7 +40,7 @@ EAPI void elm_code_line_free(Elm_Code_Line *line); /** * @brief Line manipulation functions. - * @defgroup Content + * @defgroup Elm_Code_Line_Content Elementary Code Line * @{ * * Functions for changing the content of lines in an Elm_Code_File @@ -87,7 +87,7 @@ EAPI void elm_code_line_merge_down(Elm_Code_Line *line); * @} * * @brief Line markup functions. - * @defgroup Highlighting + * @defgroup Highlighting Elementary Code Highlighting * * @{ * diff --git a/src/lib/elementary/elm_code_parse.h b/src/lib/elementary/elm_code_parse.h index 4b53e0f2c9..ec86cc53b3 100644 --- a/src/lib/elementary/elm_code_parse.h +++ b/src/lib/elementary/elm_code_parse.h @@ -12,13 +12,13 @@ extern "C" { typedef struct _Elm_Code_Parser Elm_Code_Parser; -extern EAPI Elm_Code_Parser *ELM_CODE_PARSER_STANDARD_SYNTAX; /**< A provided parser to provide syntax highlighting */ -extern EAPI Elm_Code_Parser *ELM_CODE_PARSER_STANDARD_DIFF; /**< A provided parser that will mark up diff text */ -extern EAPI Elm_Code_Parser *ELM_CODE_PARSER_STANDARD_TODO; /**< A provided parser that will highlight TODO and FIXME lines */ +EAPI extern Elm_Code_Parser *ELM_CODE_PARSER_STANDARD_SYNTAX; /**< A provided parser to provide syntax highlighting */ +EAPI extern Elm_Code_Parser *ELM_CODE_PARSER_STANDARD_DIFF; /**< A provided parser that will mark up diff text */ +EAPI extern Elm_Code_Parser *ELM_CODE_PARSER_STANDARD_TODO; /**< A provided parser that will highlight TODO and FIXME lines */ /** * @brief Parser helper functions. - * @defgroup Parser Hooking in and launching parsers + * @defgroup Parser Hooking in and launching parsers * * @{ * diff --git a/src/lib/elementary/elm_code_syntax.c b/src/lib/elementary/elm_code_syntax.c index 856543146b..dbdf7d32f7 100644 --- a/src/lib/elementary/elm_code_syntax.c +++ b/src/lib/elementary/elm_code_syntax.c @@ -134,6 +134,28 @@ static Elm_Code_Syntax _elm_code_syntax_md = {} }; +static Elm_Code_Syntax _elm_code_syntax_csharp = +{ + "{}()[]:;%^/*+&|~!=<->,.", + ".", + "#", + "//", + "/*", + "*/", + _elm_code_syntax_scope_change_braces, + { "abstract","as","base","bool","break","byte","case","catch","char","checked", \ + "class","const","continue","decimal","default","delegate","do","double","else","enum", \ + "event","explicit","extern","false","finally","fixed","float","for","foreach","goto", \ + "if","implicit","in","int","interface","internal","is","lock","long","namespace", \ + "new","null","object","operator","out","override","params","private","protected","public", \ + "readonly","ref","return","sbyte","sealed","short","sizeof","stackalloc","static","string", \ + "struct","switch","this","throw","true","try","typeof","uint","ulong","unchecked","unsafe", \ + "ushort","using","var","virtual","void","volatile","while","add","alias","async","await", \ + "dynamic","get","global","nameof","partial","remove","set","value","when","where","yield", \ + "ascending","by","descending","equals","from", "group","in","into","join","let","on", \ + "orderby","select","where","unmanaged","var", NULL } +}; + EAPI Elm_Code_Syntax * elm_code_syntax_for_mime_get(const char *mime) { @@ -151,6 +173,8 @@ elm_code_syntax_for_mime_get(const char *mime) return &_elm_code_syntax_md; if (!strcmp("text/x-go", mime)) return &_elm_code_syntax_go; + if (!strcmp("text/x-csharp", mime)) + return &_elm_code_syntax_csharp; return NULL; } diff --git a/src/lib/elementary/elm_code_text.c b/src/lib/elementary/elm_code_text.c index d27081a251..56fc1a07c5 100644 --- a/src/lib/elementary/elm_code_text.c +++ b/src/lib/elementary/elm_code_text.c @@ -19,6 +19,9 @@ elm_code_line_text_get(Elm_Code_Line *line, unsigned int *length) if (length) *length = line->length; + if (!line->length) + return ""; + if (line->modified) return line->modified; return line->content; diff --git a/src/lib/elementary/elm_code_text.h b/src/lib/elementary/elm_code_text.h index 97d67653fb..b79d30f3a5 100644 --- a/src/lib/elementary/elm_code_text.h +++ b/src/lib/elementary/elm_code_text.h @@ -14,7 +14,7 @@ extern "C" { /** * @brief Line text handling functions. - * @defgroup Text access and manipulation within lines + * @defgroup Elm_Code_Text access and manipulation within lines * * @{ * diff --git a/src/lib/elementary/elm_code_widget.c b/src/lib/elementary/elm_code_widget.c index d18f6126a2..59298a0462 100644 --- a/src/lib/elementary/elm_code_widget.c +++ b/src/lib/elementary/elm_code_widget.c @@ -245,7 +245,7 @@ _elm_code_widget_fill_line_gutter(Elm_Code_Widget *widget, Evas_Textgrid_Cell *c cursor_line = elm_code_file_line_get(line->file, pd->cursor_line); if (_elm_code_widget_line_in_scope(line, cursor_line)) cells[gutter-1].bg = ELM_CODE_WIDGET_COLOR_GUTTER_SCOPE_BG; - else + else if (pd->show_line_numbers) cells[gutter-1].bg = ELM_CODE_WIDGET_COLOR_GUTTER_BG; } else @@ -311,6 +311,7 @@ _elm_code_widget_fill_whitespace(Elm_Code_Widget *widget, Eina_Unicode character static void _elm_code_widget_cursor_update(Elm_Code_Widget *widget, Elm_Code_Widget_Data *pd) { + Evas_Coord ox, oy, ow, oh; Evas_Coord cx = 0, cy = 0, cw = 0, ch = 0; elm_code_widget_geometry_for_position_get(widget, pd->cursor_line, pd->cursor_col, &cx, &cy, &cw, &ch); @@ -324,8 +325,17 @@ _elm_code_widget_cursor_update(Elm_Code_Widget *widget, Elm_Code_Widget_Data *pd elm_layout_signal_emit(pd->cursor_rect, "elm,action,focus", "elm"); } - evas_object_geometry_set(pd->cursor_rect, cx, cy, cw/8, ch); - evas_object_show(pd->cursor_rect); + evas_object_smart_calculate(pd->scroller); + evas_object_smart_calculate(pd->gridbox); + evas_object_geometry_get(widget, &ox, &oy, &ow, &oh); + + if ((cx < ox) || (cx > (ox + ow)) || (cy < oy) || (cy > (oy + oh - ch))) + evas_object_hide(pd->cursor_rect); + else + { + evas_object_geometry_set(pd->cursor_rect, cx, cy, cw/8, ch); + evas_object_show(pd->cursor_rect); + } } static void @@ -404,7 +414,6 @@ _elm_code_widget_fill_line(Elm_Code_Widget *widget, Elm_Code_Widget_Data *pd, El w = elm_code_widget_columns_get(widget); grid = eina_list_nth(pd->grids, line->number - 1); cells = evas_object_textgrid_cellrow_get(grid, 0); - length = elm_code_widget_line_text_column_width_get(widget, line); chrpos = 0; chr = (char *)elm_code_line_text_get(line, NULL); @@ -693,13 +702,27 @@ _elm_code_widget_cursor_move(Elm_Code_Widget *widget, Elm_Code_Widget_Data *pd, { Elm_Code *code; Elm_Code_Line *line_obj; - unsigned int oldrow, position, length; const char *text; + unsigned int oldrow, position, length, first_row, last_row; + int cw = 0, ch = 0; oldrow = pd->cursor_line; + pd->cursor_col = col; pd->cursor_line = line; + if (line > elm_code_file_lines_get(pd->code->file)) + return; + + if ((line > eina_list_count(pd->grids)) && (!pd->selection)) + { + if (_elm_code_widget_viewport_get(widget, pd, &first_row, &last_row)) + { + _elm_code_widget_cell_size_get(widget, &cw, &ch); + _elm_code_widget_scroll_by(widget, 0, ch * (line - last_row)); + } + } + code = pd->code; line_obj = elm_code_file_line_get(code->file, line); position = elm_code_widget_line_text_position_for_column_get(widget, line_obj, col); @@ -719,7 +742,6 @@ _elm_code_widget_cursor_move(Elm_Code_Widget *widget, Elm_Code_Widget_Data *pd, elm_layout_signal_emit(pd->cursor_rect, "elm,action,show,cursor", "elm"); } - EOLIAN static Eina_Bool _elm_code_widget_position_at_coordinates_get(Eo *obj, Elm_Code_Widget_Data *pd, Evas_Coord x, Evas_Coord y, @@ -800,7 +822,6 @@ _elm_code_widget_geometry_for_position_get(Elm_Code_Widget *widget, Elm_Code_Wid gutter = efl_ui_code_widget_text_left_gutter_width_get(widget); grid = eina_list_nth(pd->grids, row - 1); - evas_object_smart_calculate(pd->gridbox); evas_object_geometry_get(grid, x, y, NULL, NULL); if (x) @@ -1109,7 +1130,7 @@ _elm_code_widget_mouse_down_cb(void *data, Evas *e EINA_UNUSED, Evas_Object *obj _popup_menu_show(widget, event->canvas.x, event->canvas.y); return; } - else if (event->button == 2) + else if (event->button == 2) { _mouse_selection_paste_at_position(widget, row, col); return; @@ -1177,7 +1198,6 @@ _elm_code_widget_mouse_move_cb(void *data, Evas *e EINA_UNUSED, Evas_Object *obj _elm_code_widget_selection_type_set(widget, ELM_CODE_WIDGET_SELECTION_MOUSE); _elm_code_widget_selection_in_progress_set(widget, EINA_TRUE); - elm_code_widget_selection_end(widget, row, col); } @@ -1505,6 +1525,18 @@ _elm_code_widget_tab_at_cursor_insert(Elm_Code_Widget *widget) } } +static void +_elm_code_widget_scroll_newline(Elm_Code_Widget *widget) +{ + Elm_Code_Widget_Data *pd; + Evas_Coord x, y, w, h; + + pd = efl_data_scope_get(widget, ELM_CODE_WIDGET_CLASS); + + elm_scroller_region_get(pd->scroller, &x, &y, &w, &h); + elm_scroller_region_show(pd->scroller, 0, y, w, h); +} + void _elm_code_widget_newline(Elm_Code_Widget *widget) { @@ -1554,6 +1586,8 @@ _elm_code_widget_newline(Elm_Code_Widget *widget) _elm_code_widget_undo_change_add(widget, change); _elm_code_widget_change_free(change); free(text); + + _elm_code_widget_scroll_newline(widget); } static void @@ -1777,17 +1811,6 @@ _elm_code_widget_key_down_cb(void *data, Evas *evas EINA_UNUSED, _elm_code_widget_selection_type_set(widget, ELM_CODE_WIDGET_SELECTION_KEYBOARD); _elm_code_widget_selection_in_progress_set(widget, EINA_TRUE); - - if (pd->selection && pd->selection->start_line == pd->selection->end_line) - { - if ((pd->selection->end_col == pd->selection->start_col && !backwards) || - (pd->selection->end_col > pd->selection->start_col)) - elm_code_widget_cursor_position_set(widget, pd->selection->end_line, pd->selection->end_col+1); - } - else if (pd->selection && pd->selection->end_line > pd->selection->start_line) - { - elm_code_widget_cursor_position_set(widget, pd->selection->end_line, pd->selection->end_col+1); - } } else elm_code_widget_selection_clear(widget); @@ -1819,6 +1842,20 @@ _elm_code_widget_key_down_cb(void *data, Evas *evas EINA_UNUSED, elm_code_widget_selection_end(widget, pd->cursor_line, pd->cursor_col - (adjust?1:0)); _elm_code_widget_selection_in_progress_set(widget, EINA_FALSE); + + if (pd->selection) + { + if (pd->selection->end_line < pd->selection->start_line) + { + elm_code_widget_cursor_position_set(widget, pd->selection->end_line, pd->selection->end_col); + } + else if ((pd->selection->end_col == pd->selection->start_col && !backwards) || + (pd->selection->end_col > pd->selection->start_col) || + (pd->selection->end_line > pd->selection->start_line)) + { + elm_code_widget_cursor_position_set(widget, pd->selection->end_line, pd->selection->end_col+1); + } + } } } @@ -2008,20 +2045,19 @@ _elm_code_widget_ensure_n_grid_rows(Elm_Code_Widget *widget, int rows) evas_object_textgrid_font_set(grid, pd->font_name, pd->font_size * elm_config_scale_get()); } - - elm_box_recalculate(pd->gridbox); } static void _elm_code_widget_resize(Elm_Code_Widget *widget, Elm_Code_Line *newline) { + Eina_List *item, *lines; + Elm_Code_Widget_Data *pd; Elm_Code_Line *line; - Eina_List *item; Evas_Object *grid; Evas_Coord ww, wh, old_width, old_height; - int w, h, cw = 0, ch = 0, gutter; - unsigned int line_width; - Elm_Code_Widget_Data *pd; + int w = 0, h, cw = 0, ch = 0, gutter; + unsigned int i, n, line_width, first_row = 1, last_row = 256; + Eina_Bool viewport = EINA_FALSE; pd = efl_data_scope_get(widget, ELM_CODE_WIDGET_CLASS); gutter = efl_ui_code_widget_text_left_gutter_width_get(widget); @@ -2036,18 +2072,34 @@ _elm_code_widget_resize(Elm_Code_Widget *widget, Elm_Code_Line *newline) old_width = ww; old_height = wh; - w = 0; - h = elm_code_file_lines_get(pd->code->file); - EINA_LIST_FOREACH(pd->code->file->lines, item, line) + n = h = elm_code_file_lines_get(pd->code->file); + + if (_elm_code_widget_viewport_get(widget, pd, &first_row, &last_row)) + viewport = EINA_TRUE; + + /* Grow by one page at a time where possible. */ + n = (last_row + (last_row - first_row)) < n ? + last_row + (last_row - first_row) : n; + + /* Calculate the maximum width of our lines. */ + + lines = eina_list_nth_list(pd->code->file->lines, first_row - 1); + for (i = 0; i < n; i++) { + line = eina_list_data_get(lines); + if (!line) break; line_width = elm_code_widget_line_text_column_width_get(widget, line); + if ((int) line_width + gutter + 1 > w) w = (int) line_width + gutter + 1; + + lines = eina_list_next(lines); } - _elm_code_widget_ensure_n_grid_rows(widget, h); + _elm_code_widget_ensure_n_grid_rows(widget, n); _elm_code_widget_cell_size_get(widget, &cw, &ch); + if (w*cw > ww) ww = w*cw; if (h*ch > wh) @@ -2064,23 +2116,22 @@ _elm_code_widget_resize(Elm_Code_Widget *widget, Elm_Code_Line *newline) evas_object_size_hint_min_set(grid, ww, ch); } - if (!newline) - { - unsigned int first_row, last_row; - - if (!_elm_code_widget_viewport_get(widget, pd, &first_row, &last_row)) - return ; - - _elm_code_widget_fill_range(widget, pd, first_row, last_row, NULL); + /* Here we expand our scroller when there are less grids than lines of text. */ + elm_box_unpack(pd->gridbox, pd->expander); + evas_object_size_hint_min_set(pd->expander, ww, (h * ch) - (eina_list_count(pd->grids) * ch)); + elm_box_pack_end(pd->gridbox, pd->expander); + if (!newline && viewport) + { + /* Where possible render additional lines to the viewport. */ + _elm_code_widget_fill_range(widget, pd, first_row, last_row + 64, NULL); return; } - if (pd->gravity_x == 1.0 || pd->gravity_y == 1.0) + if (EINA_DBL_EQ(pd->gravity_x, 1.0) || EINA_DBL_EQ(pd->gravity_y, 1.0)) _elm_code_widget_scroll_by(widget, - (pd->gravity_x == 1.0 && ww > old_width) ? ww - old_width : 0, - (pd->gravity_y == 1.0 && wh > old_height) ? wh - old_height : 0); - elm_box_recalculate(pd->gridbox); + (EINA_DBL_EQ(pd->gravity_x, 1.0) && ww > old_width) ? ww - old_width : 0, + (EINA_DBL_EQ(pd->gravity_y, 1.0) && wh > old_height) ? wh - old_height : 0); } EOAPI void @@ -2421,6 +2472,9 @@ _elm_code_widget_efl_canvas_group_group_add(Eo *obj, Elm_Code_Widget_Data *pd) elm_object_content_set(scroller, gridrows); pd->gridbox = gridrows; + pd->expander = evas_object_rectangle_add(evas_object_evas_get(scroller)); + elm_box_pack_end(pd->gridbox, pd->expander); + _elm_code_widget_efl_ui_widget_theme_apply(obj, pd); evas_object_event_callback_add(obj, EVAS_CALLBACK_RESIZE, _elm_code_widget_resize_cb, obj); diff --git a/src/lib/elementary/elm_code_widget_legacy_eo.h b/src/lib/elementary/elm_code_widget_legacy_eo.h index 4d2b5ffb26..eb1a9b6bae 100644 --- a/src/lib/elementary/elm_code_widget_legacy_eo.h +++ b/src/lib/elementary/elm_code_widget_legacy_eo.h @@ -19,6 +19,6 @@ typedef Eo Elm_Code_Widget_Legacy; */ #define ELM_CODE_WIDGET_LEGACY_CLASS elm_code_widget_legacy_class_get() -EWAPI const Efl_Class *elm_code_widget_legacy_class_get(void); +EWAPI const Efl_Class *elm_code_widget_legacy_class_get(void) EINA_CONST; #endif diff --git a/src/lib/elementary/elm_code_widget_private.h b/src/lib/elementary/elm_code_widget_private.h index 3398ad370f..d64e5d67c7 100644 --- a/src/lib/elementary/elm_code_widget_private.h +++ b/src/lib/elementary/elm_code_widget_private.h @@ -24,6 +24,7 @@ typedef struct Eina_List *grids; unsigned int col_count; Evas_Object *scroller, *gridbox, *background; + Evas_Object *expander; const char *font_name; Evas_Font_Size font_size; diff --git a/src/lib/elementary/elm_color_class.h b/src/lib/elementary/elm_color_class.h index 97a503148d..8d97f2bce8 100644 --- a/src/lib/elementary/elm_color_class.h +++ b/src/lib/elementary/elm_color_class.h @@ -3,7 +3,6 @@ /** * @defgroup Elm_Color_Class_Group Color Class Editor - * @ingroup Elm_Color_Class_Group * @brief This group provides a UI for editing color classes in applications. * * @{ diff --git a/src/lib/elementary/elm_color_item_eo.h b/src/lib/elementary/elm_color_item_eo.h index 6fa8f14786..1c2f0ba06b 100644 --- a/src/lib/elementary/elm_color_item_eo.h +++ b/src/lib/elementary/elm_color_item_eo.h @@ -19,7 +19,7 @@ typedef Eo Elm_Color_Item; */ #define ELM_COLOR_ITEM_CLASS elm_color_item_class_get() -EWAPI const Efl_Class *elm_color_item_class_get(void); +EWAPI const Efl_Class *elm_color_item_class_get(void) EINA_CONST; /** * @brief Set Palette item's color. diff --git a/src/lib/elementary/elm_colorselector.c b/src/lib/elementary/elm_colorselector.c index 67d8d59715..5a53c69692 100644 --- a/src/lib/elementary/elm_colorselector.c +++ b/src/lib/elementary/elm_colorselector.c @@ -398,10 +398,10 @@ _rgb_to_hsl(Elm_Colorselector_Data *sd) g2 = (v - g) / vm; b2 = (v - b) / vm; - if (r == v) sd->h = (g == m ? 5.0 + b2 : 1.0 - g2); - else if (g == v) - sd->h = (b == m ? 1.0 + r2 : 3.0 - b2); - else sd->h = (r == m ? 3.0 + g2 : 5.0 - r2); + if (EINA_DBL_EQ(r, v)) sd->h = (EINA_DBL_EQ(g, m) ? 5.0 + b2 : 1.0 - g2); + else if (EINA_DBL_EQ(g, v)) + sd->h = (EINA_DBL_EQ(b, m) ? 1.0 + r2 : 3.0 - b2); + else sd->h = (EINA_DBL_EQ(r, m) ? 3.0 + g2 : 5.0 - r2); sd->h *= 60.0; } @@ -418,16 +418,16 @@ _hsl_to_rgb(Elm_Colorselector_Data *sd) _s = sd->s; _l = sd->l; - if (_s == 0.0) r = g = b = _l; + if (EINA_DBL_EQ(_s, 0.0)) r = g = b = _l; else { - if (_h == 360.0) _h = 0.0; + if (EINA_DBL_EQ(_h, 360.0)) _h = 0.0; _h /= 60.0; v = (_l <= 0.5) ? (_l * (1.0 + _s)) : (_l + _s - (_l * _s)); p = _l + _l - v; - if (v) sv = (v - p) / v; + if (EINA_DBL_NONZERO(v)) sv = (v - p) / v; else sv = 0; i = (int)_h; @@ -489,7 +489,7 @@ _hsl_to_rgb(Elm_Colorselector_Data *sd) f = (b * 255.0) - i; b = (f <= 0.5) ? i : (i + 1); - if (sd->r == r && sd->g == g && sd->b == b) return EINA_FALSE; + if (EINA_DBL_EQ(sd->r, r) && EINA_DBL_EQ(sd->g, g) && EINA_DBL_EQ(sd->b, b)) return EINA_FALSE; sd->r = r; sd->g = g; diff --git a/src/lib/elementary/elm_colorselector_eo.h b/src/lib/elementary/elm_colorselector_eo.h index 84fe60a94a..88d7243fae 100644 --- a/src/lib/elementary/elm_colorselector_eo.h +++ b/src/lib/elementary/elm_colorselector_eo.h @@ -37,7 +37,7 @@ typedef enum */ #define ELM_COLORSELECTOR_CLASS elm_colorselector_class_get() -EWAPI const Efl_Class *elm_colorselector_class_get(void); +EWAPI const Efl_Class *elm_colorselector_class_get(void) EINA_CONST; /** * @brief Set color to colorselector. diff --git a/src/lib/elementary/elm_config.c b/src/lib/elementary/elm_config.c index 476eb15c4d..79e0f9a998 100644 --- a/src/lib/elementary/elm_config.c +++ b/src/lib/elementary/elm_config.c @@ -42,10 +42,6 @@ static Eio_Monitor *_eio_profile_monitor = NULL; Eina_Hash *_elm_key_bindings = NULL; -#ifdef HAVE_ELEMENTARY_WL2 -Ecore_Wl2_Display *_elm_wl_display = NULL; -#endif - const char *_elm_engines[] = { "software_x11", "fb", @@ -1730,7 +1726,7 @@ _config_system_load(void) { Eina_Tmpstr* tmp; ERR("System loading config failed! Check your setup! Falling back to compile time defaults"); - EINA_SAFETY_ON_FALSE_RETURN_VAL(eina_file_mkstemp("/tmp/elementary_configXXXXXX", &tmp), NULL); + EINA_SAFETY_ON_FALSE_RETURN_VAL(eina_file_mkstemp("elementary_configXXXXXX", &tmp), NULL); ef = eet_open(tmp, EET_FILE_MODE_WRITE); EINA_SAFETY_ON_FALSE_RETURN_VAL(eet_data_undump(ef, "config", embedded_config, strlen(embedded_config)-1, EINA_FALSE), NULL); eet_close(ef); @@ -2047,12 +2043,13 @@ _config_flush_get(void) evas_font_reinit(); _elm_config_font_overlay_apply(); _elm_config_color_overlay_apply(); - if (pre_scale != _elm_config->scale) + if (!EINA_DBL_EQ(pre_scale, _elm_config->scale)) _elm_rescale(); _elm_old_clouseau_reload(); _elm_config_key_binding_hash(); _elm_win_access(_elm_config->access_mode); ecore_event_add(ELM_EVENT_CONFIG_ALL_CHANGED, NULL, NULL, NULL); + efl_event_callback_call(_efl_config_obj, EFL_CONFIG_EVENT_CONFIG_CHANGED, NULL); } static const char * @@ -2297,6 +2294,23 @@ _elm_key_bindings_update(Elm_Config *cfg, Elm_Config *syscfg EINA_UNUSED) } static void +_elm_key_bindings_copy_missing_bindings_of_widget(Elm_Config *cfg, Elm_Config *syscfg, const char *widget_name) +{ + Elm_Config_Bindings_Widget *wd; + Eina_List *n, *nnext; + + EINA_LIST_FOREACH_SAFE(syscfg->bindings, n, nnext, wd) + { + if (eina_streq(widget_name, wd->name)) + { + syscfg->bindings = eina_list_remove_list(syscfg->bindings, n); + cfg->bindings = eina_list_append(cfg->bindings, wd); + printf("Upgraded keybindings for %s!\n", wd->name); + } + } +} + +static void _elm_key_bindings_copy_missing_bindings(Elm_Config *cfg, Elm_Config *syscfg) { Eina_Hash *safed_bindings = eina_hash_string_superfast_new(NULL); @@ -2449,13 +2463,27 @@ _config_update(void) _elm_config->win_no_border = EINA_FALSE; IFCFGEND - IFCFG(0x0022) + IFCFG(0x0016) _elm_key_bindings_copy_missing_bindings(_elm_config, tcfg); /* after this function call, the tcfg is partly invalidated, reload! */ _config_free(tcfg); tcfg = _config_system_load(); IFCFGEND + + IFCFG(0x0017) + _elm_key_bindings_copy_missing_bindings_of_widget(_elm_config, tcfg, "Efl.Ui.Textbox"); + /* after this function call, the tcfg is partly invalidated, reload! */ + _config_free(tcfg); + tcfg = _config_system_load(); + IFCFGEND + + IFCFG(0x0018) + if (!_elm_config->priv.thumbscroll_momentum_distance_max) + COPYVAL(thumbscroll_momentum_distance_max); + if (!_elm_config->priv.thumbscroll_momentum_friction) + COPYVAL(thumbscroll_momentum_friction); + IFCFGEND /** * Fix user config for current ELM_CONFIG_EPOCH here. **/ @@ -2965,7 +2993,7 @@ elm_config_scale_set(double scale) { _elm_config->priv.scale = EINA_TRUE; if (scale < 0.0) return; - if (_elm_config->scale == scale) return; + if (EINA_DBL_EQ(_elm_config->scale, scale)) return; _elm_config->scale = scale; _elm_rescale(); } @@ -3017,7 +3045,7 @@ elm_config_password_show_last_timeout_set(double password_show_last_timeout) { _elm_config->priv.password_show_last_timeout = EINA_TRUE; if (password_show_last_timeout < 0.0) return; - if (_elm_config->password_show_last_timeout == password_show_last_timeout) return; + if (EINA_DBL_EQ(_elm_config->password_show_last_timeout, password_show_last_timeout)) return; _elm_config->password_show_last_timeout = password_show_last_timeout; edje_password_show_last_timeout_set(_elm_config->password_show_last_timeout); } @@ -3489,7 +3517,6 @@ _efl_ui_widget_config_reload(Efl_Ui_Widget *obj) Elm_Focus_Move_Policy focus_move_policy = elm_config_focus_move_policy_get(); ELM_WIDGET_DATA_GET_OR_RETURN(obj, sd); Efl_Ui_Widget *w; - Eina_List *n; //reload focus move policy if (efl_ui_widget_focus_move_policy_automatic_get(obj) && @@ -3498,8 +3525,9 @@ _efl_ui_widget_config_reload(Efl_Ui_Widget *obj) sd->focus_move_policy = focus_move_policy; } - EINA_LIST_FOREACH(sd->subobjs, n, w) + for (unsigned int i = 0; i < eina_array_count(sd->children); ++i) { + w = eina_array_data_get(sd->children, i); if (efl_isa(w, EFL_UI_WIDGET_CLASS)) _efl_ui_widget_config_reload(w); } @@ -4286,12 +4314,6 @@ _elm_config_sub_shutdown(void) { ecore_event_type_flush(ELM_EVENT_CONFIG_ALL_CHANGED); -#ifdef HAVE_ELEMENTARY_COCOA - ecore_cocoa_shutdown(); -#endif -#ifdef HAVE_ELEMENTARY_WIN32 - ecore_win32_shutdown(); -#endif ELM_SAFE_FREE(_eio_config_monitor, eio_monitor_del); ELM_SAFE_FREE(_eio_profile_monitor, eio_monitor_del); ELM_SAFE_FREE(_config_change_delay_timer, ecore_timer_del); @@ -4382,12 +4404,6 @@ _elm_config_file_monitor_cb(void *data EINA_UNUSED, void _elm_config_sub_init(void) { -#ifdef HAVE_ELEMENTARY_COCOA - ecore_cocoa_init(); -#endif -#ifdef HAVE_ELEMENTARY_WIN32 - ecore_win32_init(); -#endif char buf[PATH_MAX]; int ok = 0; @@ -4428,6 +4444,7 @@ _elm_config_reload(void) unsigned char ppassword_show_last; double ppassword_show_last_timeout; int pweek_start, pweekend_start, pweekend_len, pyear_min, pyear_max; + Eina_List *pfont_overlays; #define STO(x) if (_elm_config->x) p##x = eina_stringshare_add(_elm_config->x) STO(theme); @@ -4446,6 +4463,7 @@ _elm_config_reload(void) STO(weekend_len); STO(year_min); STO(year_max); + STO(font_overlays); #undef STO is_mirrored = _elm_config->is_mirrored; @@ -4462,12 +4480,13 @@ _elm_config_reload(void) _elm_config_font_overlay_apply(); _elm_config_color_overlay_apply(); #define CMP(x) (p##x != _elm_config->x) +#define DBL_CMP(x) !EINA_DBL_EQ(p##x, _elm_config->x) if ( - CMP(scale) + DBL_CMP(scale) || CMP(finger_size) || CMP(icon_size) || CMP(password_show_last) - || CMP(password_show_last_timeout) + || DBL_CMP(password_show_last_timeout) || CMP(week_start) || CMP(weekend_start) || CMP(weekend_len) @@ -4479,12 +4498,15 @@ _elm_config_reload(void) || CMP(theme) || CMP(modules) || CMP(icon_theme) + || CMP(font_overlays) ) _elm_rescale(); +#undef DBL_CMP #undef CMP _elm_old_clouseau_reload(); _elm_config_key_binding_hash(); ecore_event_add(ELM_EVENT_CONFIG_ALL_CHANGED, NULL, NULL, NULL); + efl_event_callback_call(_efl_config_obj, EFL_CONFIG_EVENT_CONFIG_CHANGED, NULL); if (ptheme) eina_stringshare_del(ptheme); if (pmodules) eina_stringshare_del(pmodules); if (picon_theme) eina_stringshare_del(picon_theme); @@ -4662,7 +4684,7 @@ elm_config_transition_duration_factor_set(double factor) { _elm_config->priv.transition_duration_factor = EINA_TRUE; if (factor < 0.0) return; - if (_elm_config->transition_duration_factor == factor) return; + if (EINA_DBL_EQ(_elm_config->transition_duration_factor, factor)) return; _elm_config->transition_duration_factor = factor; edje_transition_duration_factor_set(_elm_config->transition_duration_factor); } @@ -4912,12 +4934,14 @@ _efl_config_global_efl_config_config_set(Eo *obj EINA_UNUSED, void *_pd EINA_UNU return EINA_FALSE; \ } \ elm_config_ ## opt ## _set(v); \ + efl_event_callback_call(_efl_config_obj, EFL_CONFIG_EVENT_CONFIG_CHANGED, (void*)name); \ return EINA_TRUE; \ } \ } while (0) #define CONFIG_SETB(opt) CONFIG_SET(opt, Eina_Bool, UCHAR, int) #define CONFIG_SETI(opt) CONFIG_SET(opt, int, INT, int) +#define CONFIG_SETU(opt) CONFIG_SET(opt, unsigned int, UINT, int) #define CONFIG_SETD(opt) CONFIG_SET(opt, double, DOUBLE, int) #define CONFIG_SETS(opt) CONFIG_SET(opt, const char *, STRING, cstring) @@ -4948,6 +4972,7 @@ _efl_config_global_efl_config_config_set(Eo *obj EINA_UNUSED, void *_pd EINA_UNU return EINA_FALSE; \ } \ elm_config_ ## opt ## _set(v); \ + efl_event_callback_call(_efl_config_obj, EFL_CONFIG_EVENT_CONFIG_CHANGED, (void*)name); \ return EINA_TRUE; \ } \ } while (0) @@ -5015,8 +5040,7 @@ _efl_config_global_efl_config_config_set(Eo *obj EINA_UNUSED, void *_pd EINA_UNU CONFIG_SETB(first_item_focus_on_first_focusin); CONFIG_SETB(mirrored); CONFIG_SETB(clouseau_enabled); - CONFIG_SETD(glayer_long_tap_start_timeout); - CONFIG_SETD(glayer_double_tap_timeout); + //color_overlay const char *color_class, //elm_config.h:EAPI void elm_config_color_overlay_unset(const char *color_class); CONFIG_SETB(magnifier_enable); @@ -5030,6 +5054,65 @@ _efl_config_global_efl_config_config_set(Eo *obj EINA_UNUSED, void *_pd EINA_UNU CONFIG_SETB(offline); CONFIG_SETI(powersave); + CONFIG_SETD(glayer_long_tap_start_timeout); + CONFIG_SETD(glayer_double_tap_timeout); + +#undef CONFIG_SET +#define CONFIG_SET(opt, primityp, valtyp, alttyp) do { \ + if (!strcmp(name, #opt)) \ + { \ + primityp v = 0; \ + alttyp alt = 0; \ + const Eina_Value_Type *typ = EINA_VALUE_TYPE_ ## valtyp; \ + if (eina_value_type_get(val) == typ) \ + { \ + if (!eina_value_get(val, &v)) return EINA_FALSE; \ + } \ + else if (_eina_value_to_ ## alttyp(val, &alt)) \ + { \ + v = alt; \ + } \ + else \ + { \ + ERR("Invalid value type for config '%s' (got %s wanted %s)", \ + name, eina_value_type_name_get(eina_value_type_get(val)), \ + eina_value_type_name_get(EINA_VALUE_TYPE_ ## valtyp)); \ + return EINA_FALSE; \ + } \ + _elm_config->opt = v; \ + _elm_config->priv.opt = EINA_TRUE; \ + efl_event_callback_call(_efl_config_obj, EFL_CONFIG_EVENT_CONFIG_CHANGED, (void*)name); \ + return EINA_TRUE; \ + } \ + } while (0) + + + CONFIG_SETB(glayer_zoom_finger_enable); + CONFIG_SETD(glayer_zoom_finger_factor); + CONFIG_SETD(glayer_zoom_wheel_factor); + CONFIG_SETD(glayer_zoom_distance_tolerance); + CONFIG_SETD(glayer_rotate_finger_enable); + CONFIG_SETD(glayer_rotate_angular_tolerance); + CONFIG_SETD(glayer_line_min_length); + CONFIG_SETD(glayer_line_distance_tolerance); + CONFIG_SETD(glayer_line_angular_tolerance); + CONFIG_SETU(glayer_flick_time_limit_ms); + CONFIG_SETD(glayer_long_tap_start_timeout); + CONFIG_SETD(glayer_double_tap_timeout); + CONFIG_SETI(glayer_tap_finger_size); + CONFIG_SETB(glayer_continues_enable); + + CONFIG_SETI(thumbscroll_momentum_distance_max); + CONFIG_SETD(thumbscroll_momentum_friction); + CONFIG_SETD(thumbscroll_momentum_animation_duration_min_limit); + CONFIG_SETD(thumbscroll_momentum_animation_duration_max_limit); + CONFIG_SETD(thumbscroll_momentum_threshold); + CONFIG_SETD(thumbscroll_bounce_friction); + CONFIG_SETD(thumbscroll_acceleration_threshold); + CONFIG_SETD(thumbscroll_acceleration_time_limit); + CONFIG_SETD(thumbscroll_acceleration_weight); + + const size_t len = sizeof("audio_mute") - 1; if (!strncmp(name, "audio_mute", len)) { @@ -5049,6 +5132,7 @@ _efl_config_global_efl_config_config_set(Eo *obj EINA_UNUSED, void *_pd EINA_UNU } elm_config_audio_mute_set(chan, !!v); #ifdef ENABLE_MULTISENSE + efl_event_callback_call(_efl_config_obj, EFL_CONFIG_EVENT_CONFIG_CHANGED, (void*)name); return EINA_TRUE; #else return EINA_FALSE; @@ -5080,6 +5164,7 @@ _efl_config_global_efl_config_config_get(const Eo *obj EINA_UNUSED, void *_pd EI #define CONFIG_GETB(opt) CONFIG_GET(opt, Eina_Bool, UCHAR) #define CONFIG_GETI(opt) CONFIG_GET(opt, int, INT) +#define CONFIG_GETU(opt) CONFIG_GET(opt, unsigned int, UINT) #define CONFIG_GETD(opt) CONFIG_GET(opt, double, DOUBLE) #define CONFIG_GETS(opt) CONFIG_GET(opt, const char *, STRING) @@ -5158,8 +5243,7 @@ _efl_config_global_efl_config_config_get(const Eo *obj EINA_UNUSED, void *_pd EI CONFIG_GETB(first_item_focus_on_first_focusin); CONFIG_GETB(mirrored); CONFIG_GETB(clouseau_enabled); - CONFIG_GETD(glayer_long_tap_start_timeout); - CONFIG_GETD(glayer_double_tap_timeout); + //color_overlay //color_overlay_unset CONFIG_GETB(magnifier_enable); @@ -5174,6 +5258,42 @@ _efl_config_global_efl_config_config_get(const Eo *obj EINA_UNUSED, void *_pd EI CONFIG_GETI(powersave); CONFIG_GETD(drag_anim_duration); + CONFIG_GETD(glayer_long_tap_start_timeout); + CONFIG_GETD(glayer_double_tap_timeout); +#undef CONFIG_GET +#define CONFIG_GET(opt, primityp, valtyp) do { \ + if (!strcmp(name, #opt)) \ + { \ + val = eina_value_new(EINA_VALUE_TYPE_ ## valtyp); \ + eina_value_set(val, _elm_config->opt); \ + return val; \ + } \ + } while (0) + CONFIG_GETB(glayer_zoom_finger_enable); + CONFIG_GETD(glayer_zoom_finger_factor); + CONFIG_GETD(glayer_zoom_wheel_factor); + CONFIG_GETD(glayer_zoom_distance_tolerance); + CONFIG_GETD(glayer_rotate_finger_enable); + CONFIG_GETD(glayer_rotate_angular_tolerance); + CONFIG_GETD(glayer_line_min_length); + CONFIG_GETD(glayer_line_distance_tolerance); + CONFIG_GETD(glayer_line_angular_tolerance); + CONFIG_GETU(glayer_flick_time_limit_ms); + CONFIG_GETD(glayer_long_tap_start_timeout); + CONFIG_GETD(glayer_double_tap_timeout); + CONFIG_GETI(glayer_tap_finger_size); + CONFIG_GETB(glayer_continues_enable); + + CONFIG_GETI(thumbscroll_momentum_distance_max); + CONFIG_GETD(thumbscroll_momentum_friction); + CONFIG_GETD(thumbscroll_momentum_animation_duration_min_limit); + CONFIG_GETD(thumbscroll_momentum_animation_duration_max_limit); + CONFIG_GETD(thumbscroll_momentum_threshold); + CONFIG_GETD(thumbscroll_bounce_friction); + CONFIG_GETD(thumbscroll_acceleration_threshold); + CONFIG_GETD(thumbscroll_acceleration_time_limit); + CONFIG_GETD(thumbscroll_acceleration_weight); + const size_t len = sizeof("audio_mute") - 1; if (!strncmp(name, "audio_mute", len)) { diff --git a/src/lib/elementary/elm_config.h b/src/lib/elementary/elm_config.h index 48f8778d75..429e6aa01f 100644 --- a/src/lib/elementary/elm_config.h +++ b/src/lib/elementary/elm_config.h @@ -3,7 +3,7 @@ * @ingroup Elementary * * Elementary configuration is formed by a set options bounded to a - * given @ref Profile profile, like @ref Theme theme, @ref Fingers + * given @ref Elm_Profile, like @ref Elm_Theme, @ref Elm_Fingers * "finger size", etc. These are functions with which one synchronizes * changes made to those values to the configuration storing files, de * facto. You most probably don't want to use the functions in this @@ -142,7 +142,7 @@ EAPI void elm_config_profile_list_free(Eina_List *l); /** * Return if a profile of the given name exists - * + * * @return EINA_TRUE if the profile exists, or EINA_FALSE if not * @param profile The profile's name * @ingroup Elm_Profile @@ -170,7 +170,7 @@ EAPI void elm_config_profile_set(const char *profile); * This will take the current in-memory config and write it out to the named * profile specified by @p profile. This will not change profile for the * application or make other processes switch profile. - * + * * @param profile The profile's name * @ingroup Elm_Profile * @@ -304,7 +304,7 @@ EAPI void elm_config_scroll_page_scroll_friction_set(double friction); * * @return @c EINA_TRUE if context menu is disabled, otherwise @c EINA_FALSE. * - * @ingroup Elm_Entry + * @ingroup Elm_Entry_Group * @since 1.17 */ EAPI Eina_Bool elm_config_context_menu_disabled_get(void); @@ -315,7 +315,7 @@ EAPI Eina_Bool elm_config_context_menu_disabled_get(void); * @param disabled disable context menu if @c EINA_TRUE, enable otherwise * * @see elm_config_context_menu_disabled_get() - * @ingroup Elm_Entry + * @ingroup Elm_Entry_Group * @since 1.17 */ EAPI void elm_config_context_menu_disabled_set(Eina_Bool disabled); @@ -554,7 +554,7 @@ EAPI void elm_config_scroll_thumbscroll_sensitivity_friction_set(double * Get the smooth start mode for scrolling with your finger * * @return smooth scroll flag - * + * * @see elm_config_scroll_thumbscroll_smooth_start_set() * * @since 1.16 @@ -568,9 +568,9 @@ EAPI Eina_Bool elm_config_scroll_thumbscroll_smooth_start_get(void); * This enabled finger scrolling to scroll from the currunt point rather than * jumping and playing catch-up to make start of scrolling look smoother once * the finger or mouse goes past the threshold. - * + * * @param enable The enabled state of the smooth scroller - * + * * @see elm_config_scroll_thumbscroll_smooth_start_get() * * @since 1.16 @@ -582,7 +582,7 @@ EAPI void elm_config_scroll_thumbscroll_smooth_start_set(Eina_Bool enabl * Get the value of this option * * @return State of this option - * + * * @see elm_config_scroll_animation_disabled_set() * * @since 1.18 @@ -595,21 +595,21 @@ EAPI Eina_Bool elm_config_scroll_animation_disabled_get(void); * * This option disables timed animations during scrolling and forces scroll actions * to be performed immediately. - * + * * @param disable The state of this option - * + * * @see elm_config_scroll_animation_disabled_get() * * @since 1.18 * @ingroup Elm_Scrolling */ -EAPI void elm_config_scroll_animation_disabled_set(Eina_Bool enable); +EAPI void elm_config_scroll_animation_disabled_set(Eina_Bool disable); /** * Get the value of this option * * @return State of this option - * + * * @see elm_config_scroll_accel_factor_set() * * @since 1.18 @@ -623,12 +623,12 @@ EAPI double elm_config_scroll_accel_factor_get(void); * Using a mouse wheel or touchpad to scroll will result in events * being processed. If events occur quickly, the scroll amount will * be multiplied by this value to accelerate the scrolling. - * + * * @param factor The value of this option from 0.0 to 10.0 * * @see elm_config_scroll_accel_factor_get() * @note Set 0.0 to disable acceleration - * + * * @since 1.18 * @ingroup Elm_Scrolling */ @@ -652,11 +652,11 @@ EAPI double elm_config_scroll_thumbscroll_smooth_amount_get(void); * Scrolling with your finger can be smoothed out and the amount to smooth * is determined by this parameter. 0.0 means to not smooth at all and * 1.0 is to smooth as much as possible. - * + * * @param amount the amount to smooth from 0.0 to 1.0 with 0.0 being none * * @see elm_config_thumbscroll_acceleration_threshold_set() - * + * * @since 1.16 * @ingroup Elm_Scrolling */ @@ -680,11 +680,11 @@ EAPI double elm_config_scroll_thumbscroll_smooth_time_window_get(void); * Scrolling with your finger can be smoothed out and the window of time * to look at is determined by this config. The value is in seconds and * is from 0.0 to 1.0 - * + * * @param amount the time window in seconds (between 0.0 and 1.0) * * @see elm_config_scroll_thumbscroll_smooth_time_window_get() - * + * * @since 1.16 * @ingroup Elm_Scrolling */ @@ -763,7 +763,7 @@ EAPI double elm_config_scroll_thumbscroll_momentum_animation_duration_min_ /** * Set the min limit for the momentum animation duration(unit:second) * - * @param the thumb scroll momentum animation duration min limit + * @param min the thumb scroll momentum animation duration min limit * * @see elm_config_scroll_thumbscroll_acceleration_weight_set() * @ingroup Elm_Scrolling @@ -782,7 +782,7 @@ EAPI double elm_config_scroll_thumbscroll_momentum_animation_duration_max_ /** * Set the max limit for the momentum animation duration(unit:second) * - * @param the thumb scroll momentum animation duration max limit + * @param max the thumb scroll momentum animation duration max limit * * @see elm_config_scroll_thumbscroll_momentum_animation_duration_max_limit_get() * @ingroup Elm_Scrolling @@ -931,7 +931,6 @@ EAPI void elm_config_focus_autoscroll_mode_set(Elm_Focus_Autoscroll_Mode /** * Sets the slider's indicator visible mode. * - * @param obj The slider object. * @param mode Elm_Slider_Indicator_Visible_Mode. * viewport. * @@ -943,7 +942,6 @@ EAPI void elm_config_slider_indicator_visible_mode_set(Elm_Slider_Indicator_Visi /** * Get the slider's indicator visible mode. * - * @param obj The slider object. * @return @c ELM_SLIDER_INDICATOR_VISIBLE_MODE_DEFAULT if not set anything by the user. * @c ELM_SLIDER_INDICATOR_VISIBLE_MODE_ALWAYS, ELM_SLIDER_INDICATOR_VISIBLE_MODE_ON_FOCUS, * ELM_SLIDER_INDICATOR_VISIBLE_MODE_NONE if any of the above is set by user. @@ -1097,7 +1095,7 @@ EAPI void elm_config_scale_set(double scale); * Get the icon theme the user has set. * * This gets the global icon theme currently set or the default value - * ELM_CONFIG_ICON_THEME_ELEMENTARY. + * #ELM_CONFIG_ICON_THEME_ELEMENTARY. * * @return the icon theme to use * @ingroup Elm_Icon @@ -1110,9 +1108,9 @@ EAPI const char *elm_config_icon_theme_get(void); * * This method will set the icon theme for all elm_icon_standard_set calls. * Valid parameters are the name of an installed freedesktop.org icon theme - * or ELM_CONFIG_ICON_THEME_ELEMENTARY for the built in theme. + * or #ELM_CONFIG_ICON_THEME_ELEMENTARY for the built in theme. * - * @param the name of a freedesktop.org icon theme or ELM_CONFIG_ICON_THEME_ELEMENTARY + * @param theme the name of a freedesktop.org icon theme or #ELM_CONFIG_ICON_THEME_ELEMENTARY * @ingroup Elm_Icon * @since 1.18 */ @@ -1929,7 +1927,7 @@ EAPI const char *elm_config_indicator_service_get(int rotation); * Get the duration for occurring long tap event of gesture layer. * * @return Timeout for long tap event of gesture layer. - * @ingroup Elm_Gesture_Layer + * @ingroup Elm_Gesture_Layer_Group * @since 1.8 */ EAPI double elm_config_glayer_long_tap_start_timeout_get(void); @@ -1938,7 +1936,7 @@ EAPI double elm_config_glayer_long_tap_start_timeout_get(void); * Set the duration for occurring long tap event of gesture layer. * * @param long_tap_timeout Timeout for long tap event of gesture layer. - * @ingroup Elm_Gesture_Layer + * @ingroup Elm_Gesture_Layer_Group * @since 1.8 */ EAPI void elm_config_glayer_long_tap_start_timeout_set(double long_tap_timeout); @@ -1947,7 +1945,7 @@ EAPI void elm_config_glayer_long_tap_start_timeout_set(double long_tap_timeout * Get the duration for occurring double tap event of gesture layer. * * @return Timeout for double tap event of gesture layer. - * @ingroup Elm_Gesture_Layer + * @ingroup Elm_Gesture_Layer_Group * @since 1.8 */ EAPI double elm_config_glayer_double_tap_timeout_get(void); @@ -1956,7 +1954,7 @@ EAPI double elm_config_glayer_double_tap_timeout_get(void); * Set the duration for occurring double tap event of gesture layer. * * @param double_tap_timeout Timeout for double tap event of gesture layer. - * @ingroup Elm_Gesture_Layer + * @ingroup Elm_Gesture_Layer_Group * @since 1.8 */ EAPI void elm_config_glayer_double_tap_timeout_set(double double_tap_timeout); @@ -2370,104 +2368,6 @@ EAPI double elm_config_drag_anim_duration_get(void); */ EAPI void elm_config_drag_anim_duration_set(double set); -/* new efl.config interface helpers in C */ - -/* FIXME these depend on stuff from Efl.h but this is included before that */ -#ifdef EFL_BETA_API_SUPPORT - -static inline Eina_Bool -efl_config_bool_set(Efl_Config *obj, const char * name, Eina_Bool val) -{ - Eina_Value *v = eina_value_new(EINA_VALUE_TYPE_UCHAR); - Eina_Bool b; - eina_value_set(v, val); - b = efl_config_set(obj, name, v); - eina_value_free(v); - return b; -} - -static inline Eina_Bool -efl_config_bool_get(const Efl_Config *obj, const char * name) -{ - Eina_Value *v = efl_config_get(obj, name); - Eina_Bool b = 0; - if (eina_value_type_get(v) == EINA_VALUE_TYPE_UCHAR) - eina_value_get(v, &b); - eina_value_free(v); - return b; -} - -static inline Eina_Bool -efl_config_int_set(Efl_Config *obj, const char * name, int val) -{ - Eina_Value *v = eina_value_new(EINA_VALUE_TYPE_INT); - Eina_Bool b; - eina_value_set(v, val); - b = efl_config_set(obj, name, v); - eina_value_free(v); - return b; -} - -static inline int -efl_config_int_get(const Efl_Config *obj, const char * name) -{ - Eina_Value *v = efl_config_get(obj, name); - int b = 0; - if (eina_value_type_get(v) == EINA_VALUE_TYPE_INT) - eina_value_get(v, &b); - eina_value_free(v); - return b; -} - -static inline Eina_Bool -efl_config_double_set(Efl_Config *obj, const char * name, double val) -{ - Eina_Value *v = eina_value_new(EINA_VALUE_TYPE_DOUBLE); - Eina_Bool b; - eina_value_set(v, val); - b = efl_config_set(obj, name, v); - eina_value_free(v); - return b; -} - -static inline double -efl_config_double_get(const Efl_Config *obj, const char * name) -{ - Eina_Value *v = efl_config_get(obj, name); - double b = 0; - if (eina_value_type_get(v) == EINA_VALUE_TYPE_DOUBLE) - eina_value_get(v, &b); - eina_value_free(v); - return b; -} - -static inline Eina_Bool -efl_config_string_set(Efl_Config *obj, const char *name, const char *val) -{ - Eina_Value *v = eina_value_new(EINA_VALUE_TYPE_STRING); - Eina_Bool b; - eina_value_set(v, val); - b = efl_config_set(obj, name, v); - eina_value_free(v); - return b; -} - -static inline Eina_Stringshare * -efl_config_string_get(const Efl_Config *obj, const char *name) -{ - Eina_Value *v = efl_config_get(obj, name); - Eina_Stringshare *s = 0; - if (eina_value_type_get(v) == EINA_VALUE_TYPE_STRING) - { - const char *b = 0; - eina_value_get(v, &b); - s = eina_stringshare_add(b); - } - eina_value_free(v); - return s; -} - -#endif /** * @} diff --git a/src/lib/elementary/elm_conformant_eo.h b/src/lib/elementary/elm_conformant_eo.h index e3f449f4e4..7860da1862 100644 --- a/src/lib/elementary/elm_conformant_eo.h +++ b/src/lib/elementary/elm_conformant_eo.h @@ -19,7 +19,7 @@ typedef Eo Elm_Conformant; */ #define ELM_CONFORMANT_CLASS elm_conformant_class_get() -EWAPI const Efl_Class *elm_conformant_class_get(void); +EWAPI const Efl_Class *elm_conformant_class_get(void) EINA_CONST; EWAPI extern const Efl_Event_Description _ELM_CONFORMANT_EVENT_VIRTUALKEYPAD_STATE_ON; diff --git a/src/lib/elementary/elm_ctxpopup_eo.h b/src/lib/elementary/elm_ctxpopup_eo.h index 78e8ad0a11..44a78d88b1 100644 --- a/src/lib/elementary/elm_ctxpopup_eo.h +++ b/src/lib/elementary/elm_ctxpopup_eo.h @@ -13,7 +13,7 @@ typedef Eo Elm_Ctxpopup; /** Direction in which to show the popup. * - * @ingroup Elm_Ctxpopup + * @ingroup Elm_Ctxpopup_Group */ typedef enum { @@ -33,11 +33,11 @@ typedef enum #endif /** Elementary context popup class * - * @ingroup Elm_Ctxpopup + * @ingroup Elm_Ctxpopup_Group */ #define ELM_CTXPOPUP_CLASS elm_ctxpopup_class_get() -EWAPI const Efl_Class *elm_ctxpopup_class_get(void); +EWAPI const Efl_Class *elm_ctxpopup_class_get(void) EINA_CONST; /** * @brief Get the selected item in the widget. @@ -46,7 +46,7 @@ EWAPI const Efl_Class *elm_ctxpopup_class_get(void); * * @return The selected item or @c null. * - * @ingroup Elm_Ctxpopup + * @ingroup Elm_Ctxpopup_Group */ EOAPI Elm_Widget_Item *elm_obj_ctxpopup_selected_item_get(const Eo *obj); @@ -57,7 +57,7 @@ EOAPI Elm_Widget_Item *elm_obj_ctxpopup_selected_item_get(const Eo *obj); * * @return The first item or @c null. * - * @ingroup Elm_Ctxpopup + * @ingroup Elm_Ctxpopup_Group */ EOAPI Elm_Widget_Item *elm_obj_ctxpopup_first_item_get(const Eo *obj); @@ -68,7 +68,7 @@ EOAPI Elm_Widget_Item *elm_obj_ctxpopup_first_item_get(const Eo *obj); * * @return The last item or @c null. * - * @ingroup Elm_Ctxpopup + * @ingroup Elm_Ctxpopup_Group */ EOAPI Elm_Widget_Item *elm_obj_ctxpopup_last_item_get(const Eo *obj); @@ -79,7 +79,7 @@ EOAPI Elm_Widget_Item *elm_obj_ctxpopup_last_item_get(const Eo *obj); * * @return const list to widget items * - * @ingroup Elm_Ctxpopup + * @ingroup Elm_Ctxpopup_Group */ EOAPI const Eina_List *elm_obj_ctxpopup_items_get(const Eo *obj); @@ -89,7 +89,7 @@ EOAPI const Eina_List *elm_obj_ctxpopup_items_get(const Eo *obj); * @param[in] obj The object. * @param[in] horizontal @c true for horizontal mode, @c false for vertical. * - * @ingroup Elm_Ctxpopup + * @ingroup Elm_Ctxpopup_Group */ EOAPI void elm_obj_ctxpopup_horizontal_set(Eo *obj, Eina_Bool horizontal); @@ -102,7 +102,7 @@ EOAPI void elm_obj_ctxpopup_horizontal_set(Eo *obj, Eina_Bool horizontal); * * @return @c true for horizontal mode, @c false for vertical. * - * @ingroup Elm_Ctxpopup + * @ingroup Elm_Ctxpopup_Group */ EOAPI Eina_Bool elm_obj_ctxpopup_horizontal_get(const Eo *obj); @@ -124,7 +124,7 @@ EOAPI Eina_Bool elm_obj_ctxpopup_horizontal_get(const Eo *obj); * * @since 1.9 * - * @ingroup Elm_Ctxpopup + * @ingroup Elm_Ctxpopup_Group */ EOAPI void elm_obj_ctxpopup_auto_hide_disabled_set(Eo *obj, Eina_Bool disabled); @@ -139,7 +139,7 @@ EOAPI void elm_obj_ctxpopup_auto_hide_disabled_set(Eo *obj, Eina_Bool disabled); * * @since 1.9 * - * @ingroup Elm_Ctxpopup + * @ingroup Elm_Ctxpopup_Group */ EOAPI Eina_Bool elm_obj_ctxpopup_auto_hide_disabled_get(const Eo *obj); @@ -156,7 +156,7 @@ EOAPI Eina_Bool elm_obj_ctxpopup_auto_hide_disabled_get(const Eo *obj); * @param[in] obj The object. * @param[in] parent The parent to use. * - * @ingroup Elm_Ctxpopup + * @ingroup Elm_Ctxpopup_Group */ EOAPI void elm_obj_ctxpopup_hover_parent_set(Eo *obj, Efl_Canvas_Object *parent); @@ -169,7 +169,7 @@ EOAPI void elm_obj_ctxpopup_hover_parent_set(Eo *obj, Efl_Canvas_Object *parent) * * @return The parent to use. * - * @ingroup Elm_Ctxpopup + * @ingroup Elm_Ctxpopup_Group */ EOAPI Efl_Canvas_Object *elm_obj_ctxpopup_hover_parent_get(const Eo *obj); @@ -188,7 +188,7 @@ EOAPI Efl_Canvas_Object *elm_obj_ctxpopup_hover_parent_get(const Eo *obj); * @param[in] third 3th priority of direction * @param[in] fourth 4th priority of direction * - * @ingroup Elm_Ctxpopup + * @ingroup Elm_Ctxpopup_Group */ EOAPI void elm_obj_ctxpopup_direction_priority_set(Eo *obj, Elm_Ctxpopup_Direction first, Elm_Ctxpopup_Direction second, Elm_Ctxpopup_Direction third, Elm_Ctxpopup_Direction fourth); @@ -203,7 +203,7 @@ EOAPI void elm_obj_ctxpopup_direction_priority_set(Eo *obj, Elm_Ctxpopup_Directi * @param[out] third 3th priority of direction * @param[out] fourth 4th priority of direction * - * @ingroup Elm_Ctxpopup + * @ingroup Elm_Ctxpopup_Group */ EOAPI void elm_obj_ctxpopup_direction_priority_get(const Eo *obj, Elm_Ctxpopup_Direction *first, Elm_Ctxpopup_Direction *second, Elm_Ctxpopup_Direction *third, Elm_Ctxpopup_Direction *fourth); @@ -216,7 +216,7 @@ EOAPI void elm_obj_ctxpopup_direction_priority_get(const Eo *obj, Elm_Ctxpopup_D * * @return Direction * - * @ingroup Elm_Ctxpopup + * @ingroup Elm_Ctxpopup_Group */ EOAPI Elm_Ctxpopup_Direction elm_obj_ctxpopup_direction_get(const Eo *obj); @@ -228,13 +228,13 @@ EOAPI Elm_Ctxpopup_Direction elm_obj_ctxpopup_direction_get(const Eo *obj); * be emitted. * @param[in] obj The object. * - * @ingroup Elm_Ctxpopup + * @ingroup Elm_Ctxpopup_Group */ EOAPI void elm_obj_ctxpopup_dismiss(Eo *obj); /** Clear all items in the given ctxpopup object. * - * @ingroup Elm_Ctxpopup + * @ingroup Elm_Ctxpopup_Group */ EOAPI void elm_obj_ctxpopup_clear(Eo *obj); @@ -254,7 +254,7 @@ EOAPI void elm_obj_ctxpopup_clear(Eo *obj); * * @since 1.21 * - * @ingroup Elm_Ctxpopup + * @ingroup Elm_Ctxpopup_Group */ EOAPI Elm_Widget_Item *elm_obj_ctxpopup_item_insert_before(Eo *obj, Elm_Widget_Item *before, const char *label, Efl_Canvas_Object *icon, Evas_Smart_Cb func, const void *data); @@ -274,7 +274,7 @@ EOAPI Elm_Widget_Item *elm_obj_ctxpopup_item_insert_before(Eo *obj, Elm_Widget_I * * @since 1.21 * - * @ingroup Elm_Ctxpopup + * @ingroup Elm_Ctxpopup_Group */ EOAPI Elm_Widget_Item *elm_obj_ctxpopup_item_insert_after(Eo *obj, Elm_Widget_Item *after, const char *label, Efl_Canvas_Object *icon, Evas_Smart_Cb func, const void *data); @@ -294,7 +294,7 @@ EOAPI Elm_Widget_Item *elm_obj_ctxpopup_item_insert_after(Eo *obj, Elm_Widget_It * * @return A handle to the item added or @c null, on errors. * - * @ingroup Elm_Ctxpopup + * @ingroup Elm_Ctxpopup_Group */ EOAPI Elm_Widget_Item *elm_obj_ctxpopup_item_append(Eo *obj, const char *label, Efl_Canvas_Object *icon, Evas_Smart_Cb func, const void *data); @@ -316,7 +316,7 @@ EOAPI Elm_Widget_Item *elm_obj_ctxpopup_item_append(Eo *obj, const char *label, * * @since 1.11 * - * @ingroup Elm_Ctxpopup + * @ingroup Elm_Ctxpopup_Group */ EOAPI Elm_Widget_Item *elm_obj_ctxpopup_item_prepend(Eo *obj, const char *label, Efl_Canvas_Object *icon, Evas_Smart_Cb func, const void *data); @@ -324,7 +324,7 @@ EWAPI extern const Efl_Event_Description _ELM_CTXPOPUP_EVENT_DISMISSED; /** Called when context popup was dismissed * - * @ingroup Elm_Ctxpopup + * @ingroup Elm_Ctxpopup_Group */ #define ELM_CTXPOPUP_EVENT_DISMISSED (&(_ELM_CTXPOPUP_EVENT_DISMISSED)) @@ -333,7 +333,7 @@ EWAPI extern const Efl_Event_Description _ELM_CTXPOPUP_EVENT_GEOMETRY_UPDATE; /** Called when context popup geometry was updated * @return const Eina_Rect * * - * @ingroup Elm_Ctxpopup + * @ingroup Elm_Ctxpopup_Group */ #define ELM_CTXPOPUP_EVENT_GEOMETRY_UPDATE (&(_ELM_CTXPOPUP_EVENT_GEOMETRY_UPDATE)) diff --git a/src/lib/elementary/elm_ctxpopup_eo.legacy.h b/src/lib/elementary/elm_ctxpopup_eo.legacy.h index 74422ac22e..1754b76dd2 100644 --- a/src/lib/elementary/elm_ctxpopup_eo.legacy.h +++ b/src/lib/elementary/elm_ctxpopup_eo.legacy.h @@ -13,7 +13,7 @@ typedef Eo Elm_Ctxpopup; /** Direction in which to show the popup. * - * @ingroup Elm_Ctxpopup + * @ingroup Elm_Ctxpopup_Group */ typedef enum { diff --git a/src/lib/elementary/elm_ctxpopup_item_eo.h b/src/lib/elementary/elm_ctxpopup_item_eo.h index 1e8d30d650..aeb5141fa7 100644 --- a/src/lib/elementary/elm_ctxpopup_item_eo.h +++ b/src/lib/elementary/elm_ctxpopup_item_eo.h @@ -13,13 +13,21 @@ typedef Eo Elm_Ctxpopup_Item; #endif -/** Elementary context popup item class +/** + * Elementary context popup item class + * + * @defgroup Elm_Ctxpopup_Item_Group + * @ingroup Elm_Ctxpopup_Group + */ + +/** + * @brief Get the context popup item class * - * @ingroup Elm_Ctxpopup_Item + * @ingroup Elm_Ctxpopup_Item_Group */ #define ELM_CTXPOPUP_ITEM_CLASS elm_ctxpopup_item_class_get() -EWAPI const Efl_Class *elm_ctxpopup_item_class_get(void); +EWAPI const Efl_Class *elm_ctxpopup_item_class_get(void) EINA_CONST; /** * @brief Get the item before this one in the widget's list of items. @@ -31,7 +39,7 @@ EWAPI const Efl_Class *elm_ctxpopup_item_class_get(void); * @return The item before the object in its parent's list. If there is no * previous item or in case of error, @c null is returned. * - * @ingroup Elm_Ctxpopup_Item + * @ingroup Elm_Ctxpopup_Item_Group */ EOAPI Elm_Widget_Item *elm_obj_ctxpopup_item_prev_get(const Eo *obj); @@ -45,7 +53,7 @@ EOAPI Elm_Widget_Item *elm_obj_ctxpopup_item_prev_get(const Eo *obj); * @return The item after the object in its parent's list. If there is no next * item or in case of error, @c null is returned. * - * @ingroup Elm_Ctxpopup_Item + * @ingroup Elm_Ctxpopup_Item_Group */ EOAPI Elm_Widget_Item *elm_obj_ctxpopup_item_next_get(const Eo *obj); @@ -66,7 +74,7 @@ EOAPI Elm_Widget_Item *elm_obj_ctxpopup_item_next_get(const Eo *obj); * @param[in] obj The object. * @param[in] selected The selection state. * - * @ingroup Elm_Ctxpopup_Item + * @ingroup Elm_Ctxpopup_Item_Group */ EOAPI void elm_obj_ctxpopup_item_selected_set(Eo *obj, Eina_Bool selected); @@ -79,7 +87,7 @@ EOAPI void elm_obj_ctxpopup_item_selected_set(Eo *obj, Eina_Bool selected); * * @return The selection state. * - * @ingroup Elm_Ctxpopup_Item + * @ingroup Elm_Ctxpopup_Item_Group */ EOAPI Eina_Bool elm_obj_ctxpopup_item_selected_get(const Eo *obj); @@ -90,7 +98,7 @@ EOAPI Eina_Bool elm_obj_ctxpopup_item_selected_get(const Eo *obj); * @param[in] func Smart callback function * @param[in] data Data pointer * - * @ingroup Elm_Ctxpopup_Item + * @ingroup Elm_Ctxpopup_Item_Group */ EOAPI void elm_obj_ctxpopup_item_init(Eo *obj, Evas_Smart_Cb func, const void *data); diff --git a/src/lib/elementary/elm_datetime.h b/src/lib/elementary/elm_datetime.h index 73855925e1..e88a896b76 100644 --- a/src/lib/elementary/elm_datetime.h +++ b/src/lib/elementary/elm_datetime.h @@ -174,11 +174,11 @@ * * <b>export ELM_MODULES="datetime_input_ctxpopup>datetime/api"</b> * - * This widget inherits from the @ref Layout one, so that all the + * This widget inherits from the @ref Elm_Layout one, so that all the * functions acting on it also work for datetime objects. * * This widget emits the following signals, besides the ones sent from - * @ref Layout: + * @ref Elm_Layout : * @li @b "changed" - whenever Datetime field value is changed, this * signal is sent. * @li @b "language,changed" - whenever system locale changes, this @@ -274,7 +274,7 @@ EAPI const char *elm_datetime_format_get(const Evas_Object *obj); * * There is no provision to set the limits of AM/PM field. * - * @param[in] fieldtype Type of the field. #ELM_DATETIME_YEAR etc. + * @param[in] type Type of the field. #ELM_DATETIME_YEAR etc. * @param[in] min Reference to field's minimum value. * @param[in] max Reference to field's maximum value. * diff --git a/src/lib/elementary/elm_dayselector.h b/src/lib/elementary/elm_dayselector.h index b96967d194..b6de2b599b 100644 --- a/src/lib/elementary/elm_dayselector.h +++ b/src/lib/elementary/elm_dayselector.h @@ -54,11 +54,11 @@ * the elm_object_part_content_set/get APIs thus providing a way to handle * the different check styles for individual days. * - * This widget inherits from the @ref Layout one, so that all the + * This widget inherits from the @ref Elm_Layout one, so that all the * functions acting on it also work for dayselector objects. * * This widget emits the following signals, besides the ones sent from - * @ref Layout: + * @ref Elm_Layout : * @li @c "dayselector,changed" - when the user changes the state of a day. * @li @c "language,changed" - the program's language changed * diff --git a/src/lib/elementary/elm_dayselector_eo.h b/src/lib/elementary/elm_dayselector_eo.h index 02e3d6fd10..23d5f368e5 100644 --- a/src/lib/elementary/elm_dayselector_eo.h +++ b/src/lib/elementary/elm_dayselector_eo.h @@ -41,7 +41,7 @@ typedef enum */ #define ELM_DAYSELECTOR_CLASS elm_dayselector_class_get() -EWAPI const Efl_Class *elm_dayselector_class_get(void); +EWAPI const Efl_Class *elm_dayselector_class_get(void) EINA_CONST; /** * @brief Set the starting day of Dayselector. diff --git a/src/lib/elementary/elm_dayselector_item_eo.h b/src/lib/elementary/elm_dayselector_item_eo.h index 192c5b41a4..6cc03613f8 100644 --- a/src/lib/elementary/elm_dayselector_item_eo.h +++ b/src/lib/elementary/elm_dayselector_item_eo.h @@ -19,6 +19,6 @@ typedef Eo Elm_Dayselector_Item; */ #define ELM_DAYSELECTOR_ITEM_CLASS elm_dayselector_item_class_get() -EWAPI const Efl_Class *elm_dayselector_item_class_get(void); +EWAPI const Efl_Class *elm_dayselector_item_class_get(void) EINA_CONST; #endif diff --git a/src/lib/elementary/elm_dbus_menu.c b/src/lib/elementary/elm_dbus_menu.c index 7d1d950986..96f863079a 100644 --- a/src/lib/elementary/elm_dbus_menu.c +++ b/src/lib/elementary/elm_dbus_menu.c @@ -213,7 +213,6 @@ _property_exists(Elm_Menu_Item_Data *item, return EINA_FALSE; } - ERR("Invalid code path"); return EINA_FALSE; } diff --git a/src/lib/elementary/elm_deprecated.h b/src/lib/elementary/elm_deprecated.h index a8dd8e2ed7..f9955f2ec4 100644 --- a/src/lib/elementary/elm_deprecated.h +++ b/src/lib/elementary/elm_deprecated.h @@ -68,7 +68,7 @@ EINA_DEPRECATED EAPI Eina_Bool elm_scrolled_entry_autosave_get(const Evas_Obj * * @deprecated * - * @ingroup Elm_Entry + * @ingroup Elm_Entry_Group */ EINA_DEPRECATED EAPI void elm_scrolled_entry_cnp_textonly_set(Evas_Object *obj, Eina_Bool textonly); @@ -81,7 +81,7 @@ EINA_DEPRECATED EAPI void elm_scrolled_entry_cnp_textonly_set(Evas_Objec * * @deprecated * - * @ingroup Elm_Entry + * @ingroup Elm_Entry_Group */ EINA_DEPRECATED EAPI Eina_Bool elm_scrolled_entry_cnp_textonly_get(Evas_Object *obj); @@ -309,7 +309,7 @@ EINA_DEPRECATED EAPI void elm_map_markers_list_show(Eina_List * * elm_map_marker_class_get_cb_set() should be used. * * This content is what will be inside the bubble that will be displayed - * when an user clicks over the marker. + * when a user clicks over the marker. * * This returns the actual Evas object used to be placed inside * the bubble. This may be @c NULL, as it may @@ -680,7 +680,7 @@ EINA_DEPRECATED EAPI void elm_genlist_scroller_policy_get(const Evas_Ob * * @deprecated Use elm_scroller_policy_set() instead. * - * @ingroup Elm_Entry + * @ingroup Elm_Entry_Group */ EINA_DEPRECATED EAPI void elm_entry_scrollbar_policy_set(Evas_Object *obj, Elm_Scroller_Policy h, Elm_Scroller_Policy v); @@ -696,7 +696,7 @@ EINA_DEPRECATED EAPI void elm_entry_scrollbar_policy_set(Evas_Object *obj, Elm_S * * @deprecated Use elm_scroller_bounce_set() instead. * - * @ingroup Elm_Entry + * @ingroup Elm_Entry_Group */ EINA_DEPRECATED EAPI void elm_entry_bounce_set(Evas_Object *obj, Eina_Bool h_bounce, Eina_Bool v_bounce); @@ -709,7 +709,7 @@ EINA_DEPRECATED EAPI void elm_entry_bounce_set(Evas_Object *obj, Eina_Bool h_bou * * @deprecated Use elm_scroller_bounce_get() instead. * - * @ingroup Elm_Entry + * @ingroup Elm_Entry_Group */ EINA_DEPRECATED EAPI void elm_entry_bounce_get(const Evas_Object *obj, Eina_Bool *h_bounce, Eina_Bool *v_bounce); diff --git a/src/lib/elementary/elm_diskselector.h b/src/lib/elementary/elm_diskselector.h index a6b40fb984..b2791a99c4 100644 --- a/src/lib/elementary/elm_diskselector.h +++ b/src/lib/elementary/elm_diskselector.h @@ -15,7 +15,7 @@ * It can act like a circular list with round mode and labels can be * reduced for a defined length for side items. * - * This widget implements the @b @ref elm-scrollable-interface + * This widget implements the @ref elm-scrollable-interface * interface, so that all (non-deprecated) functions for the base @ref * Scroller widget also work for diskselectors. * @@ -26,7 +26,7 @@ * major release). * * This widget emits the following signals, besides the ones sent from - * @ref Layout: + * @ref Elm_Layout : * @li @c "selected" - when item is selected, i.e. scroller stops. * @li @c "clicked" - This is called when a user clicks an item (since 1.8) * @li @c "scroll,anim,start" - scrolling animation has started diff --git a/src/lib/elementary/elm_diskselector_eo.h b/src/lib/elementary/elm_diskselector_eo.h index 1c95bc125c..1b8195d4a6 100644 --- a/src/lib/elementary/elm_diskselector_eo.h +++ b/src/lib/elementary/elm_diskselector_eo.h @@ -19,7 +19,7 @@ typedef Eo Elm_Diskselector; */ #define ELM_DISKSELECTOR_CLASS elm_diskselector_class_get() -EWAPI const Efl_Class *elm_diskselector_class_get(void); +EWAPI const Efl_Class *elm_diskselector_class_get(void) EINA_CONST; /** * @brief Set the side labels max length. diff --git a/src/lib/elementary/elm_diskselector_item_eo.h b/src/lib/elementary/elm_diskselector_item_eo.h index d322b4630a..f59515e3d2 100644 --- a/src/lib/elementary/elm_diskselector_item_eo.h +++ b/src/lib/elementary/elm_diskselector_item_eo.h @@ -19,7 +19,7 @@ typedef Eo Elm_Diskselector_Item; */ #define ELM_DISKSELECTOR_ITEM_CLASS elm_diskselector_item_class_get() -EWAPI const Efl_Class *elm_diskselector_item_class_get(void); +EWAPI const Efl_Class *elm_diskselector_item_class_get(void) EINA_CONST; /** * @brief Get the item before @c item in diskselector. diff --git a/src/lib/elementary/elm_dnd.c b/src/lib/elementary/elm_dnd.c new file mode 100644 index 0000000000..d0c309a84e --- /dev/null +++ b/src/lib/elementary/elm_dnd.c @@ -0,0 +1,827 @@ +#ifdef HAVE_CONFIG_H +# include "elementary_config.h" +#endif + + +#include <Elementary.h> +#include "elm_priv.h" + +int ELM_CNP_EVENT_SELECTION_CHANGED; + +typedef struct { + void *enter_data, *leave_data, *pos_data, *drop_data; + Elm_Drag_State enter_cb; + Elm_Drag_State leave_cb; + Elm_Drag_Pos pos_cb; + Elm_Drop_Cb drop_cb; + Eina_Array *mime_types; + Elm_Sel_Format format; + Elm_Xdnd_Action action; +} Elm_Drop_Target; + +static int +_default_seat(const Eo *obj) +{ + return evas_device_seat_id_get(evas_default_device_get(evas_object_evas_get(obj), EVAS_DEVICE_CLASS_SEAT)); +} + +static const char* +_action_to_string(Elm_Xdnd_Action action) +{ + if (action == ELM_XDND_ACTION_COPY) return "copy"; + if (action == ELM_XDND_ACTION_MOVE) return "move"; + if (action == ELM_XDND_ACTION_PRIVATE) return "private"; + if (action == ELM_XDND_ACTION_ASK) return "ask"; + if (action == ELM_XDND_ACTION_LIST) return "list"; + if (action == ELM_XDND_ACTION_LINK) return "link"; + if (action == ELM_XDND_ACTION_DESCRIPTION) return "description"; + return "unknown"; +} + +static Elm_Xdnd_Action +_string_to_action(const char* action) +{ + if (eina_streq(action, "copy")) return ELM_XDND_ACTION_COPY; + else if (eina_streq(action, "move")) return ELM_XDND_ACTION_MOVE; + else if (eina_streq(action, "private")) return ELM_XDND_ACTION_PRIVATE; + else if (eina_streq(action, "ask")) return ELM_XDND_ACTION_ASK; + else if (eina_streq(action, "list")) return ELM_XDND_ACTION_LIST; + else if (eina_streq(action, "link")) return ELM_XDND_ACTION_LINK; + else if (eina_streq(action, "description")) return ELM_XDND_ACTION_DESCRIPTION; + return ELM_XDND_ACTION_UNKNOWN; +} + +static void +_enter_cb(void *data, const Efl_Event *ev) +{ + Elm_Drop_Target *target = data; + + if (target->enter_cb) + target->enter_cb(target->enter_data, ev->object); +} + +static void +_leave_cb(void *data, const Efl_Event *ev) +{ + Elm_Drop_Target *target = data; + + if (target->leave_cb) + target->leave_cb(target->leave_data, ev->object); +} + +static void +_pos_cb(void *data, const Efl_Event *ev) +{ + Elm_Drop_Target *target = data; + Efl_Ui_Drop_Event *event = ev->info; + + if (target->pos_cb) + target->pos_cb(target->pos_data, ev->object, event->position.x, event->position.y, target->action); //FIXME action +} + +static Eina_Value +_deliver_content(Eo *obj, void *data, const Eina_Value value) +{ + Elm_Drop_Target *target = data; + Elm_Selection_Data sel_data; + Eina_Content *content = eina_value_to_content(&value); + + sel_data.data = (void*)eina_content_data_get(content).mem; + sel_data.len = eina_content_data_get(content).len; + sel_data.action = target->action; + sel_data.format = target->format; + + if (target->drop_cb) + target->drop_cb(target->drop_data, obj, &sel_data); + + return EINA_VALUE_EMPTY; +} + +static void +_drop_cb(void *data, const Efl_Event *ev) +{ + Efl_Ui_Drop_Dropped_Event *event = ev->info; + Elm_Drop_Target *target = data; + target->action = _string_to_action(event->action); + efl_future_then(ev->object, efl_ui_dnd_drop_data_get(elm_widget_is(ev->object) ? ev->object : efl_ui_win_get(ev->object), _default_seat(ev->object), eina_array_iterator_new(target->mime_types)), + .success = _deliver_content, + .data = target + ); +} + +static void +_inv_cb(void *data, const Efl_Event *ev) +{ + Elm_Drop_Target *target = data; + elm_drop_target_del(ev->object, target->format, target->enter_cb, target->enter_data, target->leave_cb, + target->leave_data, target->pos_cb, target->pos_data, target->drop_cb, target->drop_data); +} + +EFL_CALLBACKS_ARRAY_DEFINE(drop_target_cb, + {EFL_UI_DND_EVENT_DROP_ENTERED, _enter_cb}, + {EFL_UI_DND_EVENT_DROP_LEFT, _leave_cb}, + {EFL_UI_DND_EVENT_DROP_POSITION_CHANGED, _pos_cb}, + {EFL_UI_DND_EVENT_DROP_DROPPED, _drop_cb}, + {EFL_EVENT_INVALIDATE, _inv_cb} +) + +static Eina_Hash *target_register = NULL; + +static Eina_Array* +_format_to_mime_array(Elm_Sel_Format format) +{ + Eina_Array *ret = eina_array_new(10); + + if (format & ELM_SEL_FORMAT_TEXT) + { + eina_array_push(ret, "text/plain"); + eina_array_push(ret, "text/plain;charset=utf-8"); + eina_array_push(ret, "text/uri-list"); + } + if (format & ELM_SEL_FORMAT_MARKUP) + eina_array_push(ret, "application/x-elementary-markup"); + if (format & ELM_SEL_FORMAT_IMAGE) + { + eina_array_push(ret, "image/png"); + eina_array_push(ret, "image/jpeg"); + eina_array_push(ret, "image/x-ms-bmp"); + eina_array_push(ret, "image/gif"); + eina_array_push(ret, "image/tiff"); + eina_array_push(ret, "image/svg+xml"); + eina_array_push(ret, "image/x-xpixmap"); + eina_array_push(ret, "image/x-tga"); + eina_array_push(ret, "image/x-portable-pixmap"); + } + if (format & ELM_SEL_FORMAT_VCARD) + eina_array_push(ret, "text/vcard"); + if (format & ELM_SEL_FORMAT_HTML) + eina_array_push(ret, "text/html"); + + return ret; +} + +EAPI Eina_Bool +elm_drop_target_add(Evas_Object *obj, Elm_Sel_Format format, + Elm_Drag_State enter_cb, void *enter_data, + Elm_Drag_State leave_cb, void *leave_data, + Elm_Drag_Pos pos_cb, void *pos_data, + Elm_Drop_Cb drop_cb, void *drop_data) +{ + EINA_SAFETY_ON_NULL_RETURN_VAL(obj, EINA_FALSE); + + Elm_Drop_Target *target = calloc(1, sizeof(Elm_Drop_Target)); + target->enter_cb = enter_cb; + target->enter_data = enter_data; + target->leave_cb = leave_cb; + target->leave_data = leave_data; + target->pos_cb = pos_cb; + target->pos_data = pos_data; + target->drop_cb = drop_cb; + target->drop_data = drop_data; + target->mime_types = _format_to_mime_array(format); + target->format = format; + + efl_event_callback_array_add(obj, drop_target_cb(), target); + if (!efl_isa(obj, EFL_UI_WIDGET_CLASS)) + _drop_event_register(obj); //this is ensuring that we are also supporting none widgets + if (!target_register) + target_register = eina_hash_pointer_new(NULL); + eina_hash_list_append(target_register, &obj, target); + + return EINA_TRUE; +} + +EAPI Eina_Bool +elm_drop_target_del(Evas_Object *obj, Elm_Sel_Format format, + Elm_Drag_State enter_cb, void *enter_data, + Elm_Drag_State leave_cb, void *leave_data, + Elm_Drag_Pos pos_cb, void *pos_data, + Elm_Drop_Cb drop_cb, void *drop_data) +{ + Elm_Drop_Target *target; + Eina_List *n, *found = NULL; + + EINA_SAFETY_ON_NULL_RETURN_VAL(obj, EINA_FALSE); + + if (!target_register) + return EINA_TRUE; + Eina_List *targets = eina_hash_find(target_register, &obj); + + if (!targets) + return EINA_TRUE; + + EINA_LIST_FOREACH(targets, n, target) + { + if (target->enter_cb == enter_cb && target->enter_data == enter_data && + target->leave_cb == leave_cb && target->leave_data == leave_data && + target->pos_cb == pos_cb && target->pos_data == pos_data && + target->drop_cb == drop_cb && target->drop_data == drop_data && + target->format == format) + { + + found = n; + break; + } + } + if (found) + { + efl_event_callback_array_del(obj, drop_target_cb(), eina_list_data_get(found)); + eina_hash_list_remove(target_register, &obj, target); + eina_array_free(target->mime_types); + _drop_event_unregister(obj); //this is ensuring that we are also supporting none widgets + free(target); + } + + return EINA_TRUE; +} + +struct _Item_Container_Drag_Info +{ /* Info kept for containers to support drag */ + Evas_Object *obj; + Ecore_Timer *tm; /* When this expires, start drag */ + double anim_tm; /* Time period to set tm */ + double tm_to_drag; /* Time period to set tm */ + Elm_Xy_Item_Get_Cb itemgetcb; + Elm_Item_Container_Data_Get_Cb data_get; + + Evas_Coord x_down; /* Mouse down x cord when drag starts */ + Evas_Coord y_down; /* Mouse down y cord when drag starts */ + + /* Some extra information needed to impl default anim */ + Evas *e; + Eina_List *icons; /* List of icons to animate (Anim_Icon) */ + int final_icon_w; /* We need the w and h of the final icon for the animation */ + int final_icon_h; + Ecore_Animator *ea; + + Elm_Drag_User_Info user_info; +}; +typedef struct _Item_Container_Drag_Info Item_Container_Drag_Info; + +struct _Anim_Icon +{ + int start_x; + int start_y; + int start_w; + int start_h; + Evas_Object *o; +}; +typedef struct _Anim_Icon Anim_Icon; +static Eina_List *cont_drag_tg = NULL; /* List of Item_Container_Drag_Info */ + +static Eina_Bool elm_drag_item_container_del_internal(Evas_Object *obj, Eina_Bool full); +static void _cont_obj_mouse_move(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info); +static void _cont_obj_mouse_up(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info); +static void _cont_obj_mouse_down(void *data, Evas *e, Evas_Object *obj EINA_UNUSED, void *event_info); + +static void +_cont_drag_done_cb(void *data, Evas_Object *obj EINA_UNUSED) +{ + Item_Container_Drag_Info *st = data; + elm_widget_scroll_freeze_pop(st->obj); + if (st->user_info.dragdone) + st->user_info.dragdone(st->user_info.donecbdata, NULL, EINA_FALSE); /*FIXME*/ +} + +static Eina_Bool +_cont_obj_drag_start(void *data) +{ /* Start a drag-action when timer expires */ + Item_Container_Drag_Info *st = data; + st->tm = NULL; + Elm_Drag_User_Info *info = &st->user_info; + if (info->dragstart) info->dragstart(info->startcbdata, st->obj); + elm_widget_scroll_freeze_push(st->obj); + evas_object_event_callback_del_full + (st->obj, EVAS_CALLBACK_MOUSE_MOVE, _cont_obj_mouse_move, st); + elm_drag_start( /* Commit the start only if data_get successful */ + st->obj, info->format, + info->data, info->action, + info->createicon, info->createdata, + info->dragpos, info->dragdata, + info->acceptcb, info->acceptdata, + _cont_drag_done_cb, st); + ELM_SAFE_FREE(info->data, free); + + return ECORE_CALLBACK_CANCEL; +} + +static inline Eina_List * +_anim_icons_make(Eina_List *icons) +{ /* Make local copies of all icons, add them to list */ + Eina_List *list = NULL, *itr; + Evas_Object *o; + + EINA_LIST_FOREACH(icons, itr, o) + { /* Now add icons to animation window */ + Anim_Icon *st = calloc(1, sizeof(*st)); + + if (!st) + { + ERR("Failed to allocate memory for icon!"); + continue; + } + + evas_object_geometry_get(o, &st->start_x, &st->start_y, &st->start_w, &st->start_h); + evas_object_show(o); + st->o = o; + list = eina_list_append(list, st); + } + + return list; +} + +static Eina_Bool +_drag_anim_play(void *data, double pos) +{ /* Impl of the animation of icons, called on frame time */ + Item_Container_Drag_Info *st = data; + Eina_List *l; + Anim_Icon *sti; + + if (st->ea) + { + if (pos > 0.99) + { + st->ea = NULL; /* Avoid deleting on mouse up */ + EINA_LIST_FOREACH(st->icons, l, sti) + evas_object_hide(sti->o); + + _cont_obj_drag_start(st); /* Start dragging */ + return ECORE_CALLBACK_CANCEL; + } + + Evas_Coord xm, ym; + evas_pointer_canvas_xy_get(st->e, &xm, &ym); + EINA_LIST_FOREACH(st->icons, l, sti) + { + int x, y, h, w; + w = sti->start_w + ((st->final_icon_w - sti->start_w) * pos); + h = sti->start_h + ((st->final_icon_h - sti->start_h) * pos); + x = sti->start_x - (pos * ((sti->start_x + (w/2) - xm))); + y = sti->start_y - (pos * ((sti->start_y + (h/2) - ym))); + evas_object_move(sti->o, x, y); + evas_object_resize(sti->o, w, h); + } + + return ECORE_CALLBACK_RENEW; + } + + return ECORE_CALLBACK_CANCEL; +} + +static inline Eina_Bool +_drag_anim_start(void *data) +{ /* Start default animation */ + Item_Container_Drag_Info *st = data; + + st->tm = NULL; + /* Now we need to build an (Anim_Icon *) list */ + st->icons = _anim_icons_make(st->user_info.icons); + if (st->user_info.createicon) + { + Evas_Object *temp_win = elm_win_add(NULL, "Temp", ELM_WIN_DND); + Evas_Object *final_icon = st->user_info.createicon(st->user_info.createdata, temp_win, NULL, NULL); + evas_object_geometry_get(final_icon, NULL, NULL, &st->final_icon_w, &st->final_icon_h); + evas_object_del(final_icon); + evas_object_del(temp_win); + } + st->ea = ecore_animator_timeline_add(st->anim_tm, _drag_anim_play, st); + + return EINA_FALSE; +} + +static Eina_Bool +_cont_obj_anim_start(void *data) +{ /* Start a drag-action when timer expires */ + Item_Container_Drag_Info *st = data; + int xposret, yposret; /* Unused */ + Elm_Object_Item *it = (st->itemgetcb) ? + (st->itemgetcb(st->obj, st->x_down, st->y_down, &xposret, &yposret)) + : NULL; + + st->tm = NULL; + st->user_info.format = ELM_SEL_FORMAT_TARGETS; /* Default */ + st->icons = NULL; + st->user_info.data = NULL; + st->user_info.action = ELM_XDND_ACTION_COPY; /* Default */ + + if (!it) /* Failed to get mouse-down item, abort drag */ + return ECORE_CALLBACK_CANCEL; + + if (st->data_get) + { /* collect info then start animation or start dragging */ + if (st->data_get( /* Collect drag info */ + st->obj, /* The container object */ + it, /* Drag started on this item */ + &st->user_info)) + { + if (st->user_info.icons) + _drag_anim_start(st); + else + { + if (EINA_DBL_NONZERO(st->anim_tm)) + { + // even if we don't manage the icons animation, we have + // to wait until it is finished before beginning drag. + st->tm = ecore_timer_add(st->anim_tm, _cont_obj_drag_start, st); + } + else + _cont_obj_drag_start(st); /* Start dragging, no anim */ + } + } + } + + return ECORE_CALLBACK_CANCEL; +} + +static int +_drag_item_container_cmp(const void *d1, + const void *d2) +{ + const Item_Container_Drag_Info *st = d1; + return (((uintptr_t) (st->obj)) - ((uintptr_t) d2)); +} + +void +_anim_st_free(Item_Container_Drag_Info *st) +{ /* Stops and free mem of ongoing animation */ + if (st) + { + ELM_SAFE_FREE(st->ea, ecore_animator_del); + Anim_Icon *sti; + + EINA_LIST_FREE(st->icons, sti) + { + evas_object_del(sti->o); + free(sti); + } + + st->icons = NULL; + } +} + +static void +_cont_obj_mouse_up(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info) +{ /* Cancel any drag waiting to start on timeout */ + Item_Container_Drag_Info *st = data; + + if (((Evas_Event_Mouse_Up *)event_info)->button != 1) + return; /* We only process left-click at the moment */ + + evas_object_event_callback_del_full + (st->obj, EVAS_CALLBACK_MOUSE_MOVE, _cont_obj_mouse_move, st); + evas_object_event_callback_del_full + (st->obj, EVAS_CALLBACK_MOUSE_UP, _cont_obj_mouse_up, st); + + ELM_SAFE_FREE(st->tm, ecore_timer_del); + + _anim_st_free(st); +} + +static void +_cont_obj_mouse_move(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info) +{ /* Cancel any drag waiting to start on timeout */ + if (((Evas_Event_Mouse_Move *)event_info)->event_flags & EVAS_EVENT_FLAG_ON_HOLD) + { + Item_Container_Drag_Info *st = data; + + evas_object_event_callback_del_full + (st->obj, EVAS_CALLBACK_MOUSE_MOVE, _cont_obj_mouse_move, st); + evas_object_event_callback_del_full + (st->obj, EVAS_CALLBACK_MOUSE_UP, _cont_obj_mouse_up, st); + elm_drag_item_container_del_internal(obj, EINA_FALSE); + + ELM_SAFE_FREE(st->tm, ecore_timer_del); + + _anim_st_free(st); + } +} + +static Eina_Bool +elm_drag_item_container_del_internal(Evas_Object *obj, Eina_Bool full) +{ + Item_Container_Drag_Info *st = + eina_list_search_unsorted(cont_drag_tg, _drag_item_container_cmp, obj); + + if (st) + { + ELM_SAFE_FREE(st->tm, ecore_timer_del); /* Cancel drag-start timer */ + + if (st->ea) /* Cancel ongoing default animation */ + _anim_st_free(st); + + if (full) + { + st->itemgetcb = NULL; + st->data_get = NULL; + evas_object_event_callback_del_full + (obj, EVAS_CALLBACK_MOUSE_DOWN, _cont_obj_mouse_down, st); + + cont_drag_tg = eina_list_remove(cont_drag_tg, st); + ELM_SAFE_FREE(st->user_info.data, free); + free(st); + } + + return EINA_TRUE; + } + return EINA_FALSE; +} + +static void +_cont_obj_mouse_down(void *data, Evas *e, Evas_Object *obj EINA_UNUSED, void *event_info) +{ /* Launch a timer to start dragging */ + Evas_Event_Mouse_Down *ev = event_info; + if (ev->button != 1) + return; /* We only process left-click at the moment */ + + Item_Container_Drag_Info *st = data; + evas_object_event_callback_add(st->obj, EVAS_CALLBACK_MOUSE_MOVE, + _cont_obj_mouse_move, st); + + evas_object_event_callback_add(st->obj, EVAS_CALLBACK_MOUSE_UP, + _cont_obj_mouse_up, st); + + ecore_timer_del(st->tm); + + st->e = e; + st->x_down = ev->canvas.x; + st->y_down = ev->canvas.y; + st->tm = ecore_timer_add(st->tm_to_drag, _cont_obj_anim_start, st); +} +EAPI Eina_Bool +elm_drag_item_container_del(Evas_Object *obj) +{ + return elm_drag_item_container_del_internal(obj, EINA_TRUE); +} + +EAPI Eina_Bool +elm_drag_item_container_add(Evas_Object *obj, + double anim_tm, + double tm_to_drag, + Elm_Xy_Item_Get_Cb itemgetcb, + Elm_Item_Container_Data_Get_Cb data_get) +{ + Item_Container_Drag_Info *st; + + if (elm_drag_item_container_del_internal(obj, EINA_FALSE)) + { /* Updating info of existing obj */ + st = eina_list_search_unsorted(cont_drag_tg, _drag_item_container_cmp, obj); + if (!st) return EINA_FALSE; + } + else + { + st = calloc(1, sizeof(*st)); + if (!st) return EINA_FALSE; + + st->obj = obj; + cont_drag_tg = eina_list_append(cont_drag_tg, st); + + /* Register for mouse callback for container to start/abort drag */ + evas_object_event_callback_add(obj, EVAS_CALLBACK_MOUSE_DOWN, + _cont_obj_mouse_down, st); + } + + st->tm = NULL; + st->anim_tm = anim_tm; + st->tm_to_drag = tm_to_drag; + st->itemgetcb = itemgetcb; + st->data_get = data_get; + return EINA_TRUE; +} + +static Eina_List *cont_drop_tg = NULL; /* List of Item_Container_Drop_Info */ + +struct _Item_Container_Drop_Info +{ /* Info kept for containers to support drop */ + Evas_Object *obj; + Elm_Xy_Item_Get_Cb itemgetcb; + Elm_Drop_Item_Container_Cb dropcb; + Elm_Drag_Item_Container_Pos poscb; +}; +typedef struct _Item_Container_Drop_Info Item_Container_Drop_Info; + + +typedef struct +{ + Evas_Object *obj; + /* FIXME: Cache window */ + Eina_Inlist *cbs_list; /* List of Dropable_Cbs * */ + struct { + Evas_Coord x, y; + Eina_Bool in : 1; + const char *type; + Elm_Sel_Format format; + } last; +} Dropable; + +static int +_drop_item_container_cmp(const void *d1, + const void *d2) +{ + const Item_Container_Drop_Info *st = d1; + return (((uintptr_t) (st->obj)) - ((uintptr_t) d2)); +} + +static void +_elm_item_container_pos_cb(void *data, Evas_Object *obj, Evas_Coord x, Evas_Coord y, Elm_Xdnd_Action action) +{ /* obj is the container pointer */ + Elm_Object_Item *it = NULL; + int xposret = 0; + int yposret = 0; + + Item_Container_Drop_Info *st = + eina_list_search_unsorted(cont_drop_tg, _drop_item_container_cmp, obj); + + if (st && st->poscb) + { /* Call container drop func with specific item pointer */ + int xo = 0; + int yo = 0; + + evas_object_geometry_get(obj, &xo, &yo, NULL, NULL); + if (st->itemgetcb) + it = st->itemgetcb(obj, x+xo, y+yo, &xposret, &yposret); + + st->poscb(data, obj, it, x, y, xposret, yposret, action); + } +} + +static Eina_Bool +_elm_item_container_drop_cb(void *data, Evas_Object *obj , Elm_Selection_Data *ev) +{ /* obj is the container pointer */ + Elm_Object_Item *it = NULL; + int xposret = 0; + int yposret = 0; + + Item_Container_Drop_Info *st = + eina_list_search_unsorted(cont_drop_tg, _drop_item_container_cmp, obj); + + if (st && st->dropcb) + { /* Call container drop func with specific item pointer */ + int xo = 0; + int yo = 0; + + evas_object_geometry_get(obj, &xo, &yo, NULL, NULL); + if (st->itemgetcb) + it = st->itemgetcb(obj, ev->x+xo, ev->y+yo, &xposret, &yposret); + + return st->dropcb(data, obj, it, ev, xposret, yposret); + } + + return EINA_FALSE; +} + +static Eina_Bool +elm_drop_item_container_del_internal(Evas_Object *obj, Eina_Bool full) +{ + Item_Container_Drop_Info *st = + eina_list_search_unsorted(cont_drop_tg, _drop_item_container_cmp, obj); + + if (st) + { + // temp until st is stored inside data of obj. + //FIXME delete this drop container + st->itemgetcb= NULL; + st->poscb = NULL; + st->dropcb = NULL; + + if (full) + { + cont_drop_tg = eina_list_remove(cont_drop_tg, st); + free(st); + } + + return EINA_TRUE; + } + + return EINA_FALSE; +} + +EAPI Eina_Bool +elm_drop_item_container_add(Evas_Object *obj, + Elm_Sel_Format format, + Elm_Xy_Item_Get_Cb itemgetcb, + Elm_Drag_State entercb, void *enterdata, + Elm_Drag_State leavecb, void *leavedata, + Elm_Drag_Item_Container_Pos poscb, void *posdata, + Elm_Drop_Item_Container_Cb dropcb, void *dropdata) +{ + Item_Container_Drop_Info *st; + + if (elm_drop_item_container_del_internal(obj, EINA_FALSE)) + { /* Updating info of existing obj */ + st = eina_list_search_unsorted(cont_drop_tg, _drop_item_container_cmp, obj); + if (!st) return EINA_FALSE; + } + else + { + st = calloc(1, sizeof(*st)); + if (!st) return EINA_FALSE; + + st->obj = obj; + cont_drop_tg = eina_list_append(cont_drop_tg, st); + } + + st->itemgetcb = itemgetcb; + st->poscb = poscb; + st->dropcb = dropcb; + elm_drop_target_add(obj, format, + entercb, enterdata, + leavecb, leavedata, + _elm_item_container_pos_cb, posdata, + _elm_item_container_drop_cb, dropdata); + return EINA_TRUE; +} + + +EAPI Eina_Bool +elm_drop_item_container_del(Evas_Object *obj) +{ + return elm_drop_item_container_del_internal(obj, EINA_TRUE); +} + +typedef struct { + void *dragdata, *acceptdata, *donecbdata; + Elm_Drag_Pos dragposcb; + Elm_Drag_Accept acceptcb; + Elm_Drag_State dragdonecb; +} Elm_Drag_Data; + +static void +_drag_finished_cb(void *data, const Efl_Event *ev) +{ + Elm_Drag_Data *dd = data; + Eina_Bool *accepted = ev->info; + + if (dd->acceptcb) + dd->acceptcb(dd->acceptdata, ev->object, *accepted); + + if (dd->dragdonecb) + dd->dragdonecb(dd->donecbdata, ev->object); + + efl_event_callback_del(ev->object, EFL_UI_DND_EVENT_DRAG_FINISHED, _drag_finished_cb, dd); + free(dd); +} + +EAPI Eina_Bool +elm_drag_start(Evas_Object *obj, Elm_Sel_Format format, + const char *data, Elm_Xdnd_Action action, + Elm_Drag_Icon_Create_Cb createicon, + void *createdata, + Elm_Drag_Pos dragpos, void *dragdata, + Elm_Drag_Accept acceptcb, void *acceptdata, + Elm_Drag_State dragdone, void *donecbdata) +{ + Eina_Array *mime_types; + Eina_Content *content; + Efl_Content *ui; + int x, y, w, h; + Efl_Ui_Widget *widget; + Elm_Drag_Data *dd; + const char *str_action; + + EINA_SAFETY_ON_NULL_RETURN_VAL(obj, EINA_FALSE); + + //it should return EINA_TRUE to keep backward compatibility + if (!data) + return EINA_TRUE; + + str_action = _action_to_string(action); + dd = calloc(1, sizeof(Elm_Drag_Data)); + dd->dragposcb = dragpos; + dd->dragdata = dragdata; + dd->acceptcb = acceptcb; + dd->acceptdata = acceptdata; + dd->dragdonecb = dragdone; + dd->donecbdata = donecbdata; + mime_types = _format_to_mime_array(format); + if (eina_array_count(mime_types) != 1) + { + WRN("You passed more than one format, this is not going to work well"); + } + content = eina_content_new((Eina_Slice) EINA_SLICE_STR_FULL(data), eina_array_data_get(mime_types, 0)); + ui = efl_ui_dnd_drag_start(obj, content, str_action, _default_seat(obj)); + widget = createicon(createdata, ui, &x, &y); + evas_object_geometry_get(widget, NULL, NULL, &w, &h); + evas_object_show(widget); + efl_content_set(ui, widget); + efl_gfx_entity_size_set(ui, EINA_SIZE2D(w, h)); + eina_array_free(mime_types); + + efl_event_callback_add(obj, EFL_UI_DND_EVENT_DRAG_FINISHED, _drag_finished_cb, dd); + + return EINA_TRUE; +} + +EAPI Eina_Bool +elm_drag_cancel(Evas_Object *obj) +{ + efl_ui_dnd_drag_cancel(obj, _default_seat(obj)); + + return EINA_TRUE; +} + +EAPI Eina_Bool +elm_drag_action_set(Evas_Object *obj EINA_UNUSED, Elm_Xdnd_Action action EINA_UNUSED) +{ + ERR("This operation is not supported anymore."); + return EINA_FALSE; +} diff --git a/src/lib/elementary/elm_entry.c b/src/lib/elementary/elm_entry.c index 826e2e0c91..6a82bff2e1 100644 --- a/src/lib/elementary/elm_entry.c +++ b/src/lib/elementary/elm_entry.c @@ -1628,7 +1628,7 @@ _selection_store(Elm_Sel_Type seltype, if ((!sel) || (!sel[0])) return; /* avoid deleting our own selection */ elm_cnp_selection_set - (obj, seltype, ELM_SEL_FORMAT_MARKUP, sel, strlen(sel)); + (obj, seltype, ELM_SEL_FORMAT_MARKUP, sel, strlen(sel) + 1); elm_cnp_selection_loss_callback_set(obj, seltype, _selection_clear, obj); if (seltype == ELM_SEL_TYPE_CLIPBOARD) eina_stringshare_replace(&sd->cut_sel, sel); @@ -1731,7 +1731,7 @@ _menu_call(Evas_Object *obj) const char *context_menu_orientation; Eina_Bool ownersel; - ownersel = elm_selection_selection_has_owner(obj); + ownersel = elm_cnp_clipboard_selection_has_owner(obj); if (!sd->items) { /* prevent stupid blank hoversel */ @@ -2263,17 +2263,19 @@ _entry_changed_user_signal_cb(void *data, Efl_Access_Text_Change_Info atspi_info; if (edje_info && edje_info->insert) { - atspi_info.content = edje_info->change.insert.content; + atspi_info.content = elm_entry_markup_to_utf8(edje_info->change.insert.content); atspi_info.pos = edje_info->change.insert.pos; atspi_info.len = edje_info->change.insert.plain_length; - efl_access_object_event_emit( data, EFL_ACCESS_TEXT_EVENT_ACCESS_TEXT_INSERTED, &atspi_info); + efl_access_object_event_emit(data, EFL_ACCESS_TEXT_EVENT_ACCESS_TEXT_INSERTED, &atspi_info); + free((void *)atspi_info.content); } else if (edje_info && !edje_info->insert) { - atspi_info.content = edje_info->change.del.content; + atspi_info.content = elm_entry_markup_to_utf8(edje_info->change.del.content); atspi_info.pos = MIN(edje_info->change.del.start, edje_info->change.del.end); atspi_info.len = MAX(edje_info->change.del.start, edje_info->change.del.end) - atspi_info.pos; - efl_access_object_event_emit( data, EFL_ACCESS_TEXT_EVENT_ACCESS_TEXT_REMOVED, &atspi_info); + efl_access_object_event_emit(data, EFL_ACCESS_TEXT_EVENT_ACCESS_TEXT_REMOVED, &atspi_info); + free((void *)atspi_info.content); } } } @@ -2339,9 +2341,7 @@ _entry_selection_start_signal_cb(void *data, if (entry != data) elm_entry_select_none(entry); } - Eina_Bool b_value = EINA_TRUE; - efl_event_callback_legacy_call - (data, EFL_TEXT_INTERACTIVE_EVENT_HAVE_SELECTION_CHANGED, &b_value); + evas_object_smart_callback_call(data, "selection,start", NULL); elm_object_focus_set(data, EINA_TRUE); } @@ -2384,10 +2384,8 @@ _entry_selection_changed_signal_cb(void *data, if (!sd) return; sd->have_selection = EINA_TRUE; - Efl_Text_Range range = {0}; //FIXME how to get selection range in legacy !? - range.start = 0; - range.end = 0; + Eina_Range range = EINA_RANGE_EMPTY(); efl_event_callback_legacy_call (data, EFL_TEXT_INTERACTIVE_EVENT_SELECTION_CHANGED, &range); // XXX: still try primary selection even if on wl in case it's @@ -2411,9 +2409,7 @@ _entry_selection_cleared_signal_cb(void *data, if (!sd->have_selection) return; sd->have_selection = EINA_FALSE; - Eina_Bool b_value = sd->have_selection; - efl_event_callback_legacy_call - (data, EFL_TEXT_INTERACTIVE_EVENT_HAVE_SELECTION_CHANGED, &b_value); + evas_object_smart_callback_call(data, "selection,cleared", NULL); // XXX: still try primary selection even if on wl in case it's // supported // if (!_entry_win_is_wl(data)) @@ -4450,9 +4446,7 @@ _elm_entry_select_none(Eo *obj EINA_UNUSED, Elm_Entry_Data *sd) } if (sd->have_selection) { - Eina_Bool b_value = sd->have_selection; - efl_event_callback_legacy_call - (obj, EFL_TEXT_INTERACTIVE_EVENT_HAVE_SELECTION_CHANGED, &b_value); + evas_object_smart_callback_call(obj, "selection,cleared", NULL); } sd->have_selection = EINA_FALSE; @@ -5691,12 +5685,14 @@ _elm_entry_efl_access_text_character_count_get(const Eo *obj, Elm_Entry_Data *_p return ret; } -EOLIAN static char* -_elm_entry_efl_access_text_string_get(const Eo *obj, Elm_Entry_Data *_pd EINA_UNUSED, Efl_Access_Text_Granularity granularity, int *start_offset, int *end_offset) +EOLIAN static void +_elm_entry_efl_access_text_string_get(const Eo *obj, Elm_Entry_Data *_pd EINA_UNUSED, Efl_Access_Text_Granularity granularity, int *start_offset, int *end_offset, char **ret EFL_TRANSFER_OWNERSHIP) { Evas_Textblock_Cursor *cur = NULL, *cur2 = NULL; Evas_Object *tblk; - char *ret = NULL; + + EINA_SAFETY_ON_NULL_RETURN(ret); + *ret = NULL; tblk = elm_entry_textblock_get(obj); if (!tblk) goto fail; @@ -5754,26 +5750,26 @@ _elm_entry_efl_access_text_string_get(const Eo *obj, Elm_Entry_Data *_pd EINA_UN if (end_offset) *end_offset = evas_textblock_cursor_pos_get(cur2); - ret = evas_textblock_cursor_range_text_get(cur, cur2, EVAS_TEXTBLOCK_TEXT_PLAIN); + *ret = evas_textblock_cursor_range_text_get(cur, cur2, EVAS_TEXTBLOCK_TEXT_PLAIN); evas_textblock_cursor_free(cur); evas_textblock_cursor_free(cur2); - if (ret && _pd->password) + if (*ret && _pd->password) { int i = 0; - while (ret[i] != '\0') - ret[i++] = ENTRY_PASSWORD_MASK_CHARACTER; + while (*ret[i] != '\0') + *ret[i++] = ENTRY_PASSWORD_MASK_CHARACTER; } - return ret; + return; fail: if (start_offset) *start_offset = -1; if (end_offset) *end_offset = -1; if (cur) evas_textblock_cursor_free(cur); if (cur2) evas_textblock_cursor_free(cur2); - return NULL; + *ret = NULL; } EOLIAN static char* @@ -6067,26 +6063,29 @@ _elm_entry_efl_access_text_attribute_get(const Eo *obj, Elm_Entry_Data *_pd EINA return EINA_FALSE; } -EOLIAN static Eina_List* -_elm_entry_efl_access_text_text_attributes_get(const Eo *obj, Elm_Entry_Data *_pd EINA_UNUSED, int *start_offset, int *end_offset) +EOLIAN static void +_elm_entry_efl_access_text_text_attributes_get(const Eo *obj, Elm_Entry_Data *_pd EINA_UNUSED, int *start_offset, int *end_offset, Eina_List **ret EFL_TRANSFER_OWNERSHIP) { Evas_Object *txtblk; Evas_Textblock_Cursor *cur1, *cur2; - Eina_List *formats, *ret = NULL, *l; + Eina_List *formats, *l; Evas_Object_Textblock_Node_Format *format; Efl_Access_Text_Attribute *attr; + EINA_SAFETY_ON_NULL_RETURN(ret); + *ret = NULL; + txtblk = elm_entry_textblock_get(obj); - if (!txtblk) return NULL; + if (!txtblk) return; cur1 = evas_object_textblock_cursor_new(txtblk); - if (!cur1) return NULL; + if (!cur1) return; cur2 = evas_object_textblock_cursor_new(txtblk); if (!cur2) { evas_textblock_cursor_free(cur1); - return NULL; + return; } evas_textblock_cursor_pos_set(cur1, *start_offset); @@ -6097,16 +6096,14 @@ _elm_entry_efl_access_text_text_attributes_get(const Eo *obj, Elm_Entry_Data *_p evas_textblock_cursor_free(cur1); evas_textblock_cursor_free(cur2); - if (!formats) return NULL; + if (!formats) return; EINA_LIST_FOREACH(formats, l , format) { attr = _textblock_node_format_to_atspi_text_attr(format); if (!attr) continue; - ret = eina_list_append(ret, attr); + *ret = eina_list_append(*ret, attr); } - - return ret; } EOLIAN static Eina_List* diff --git a/src/lib/elementary/elm_entry.h b/src/lib/elementary/elm_entry.h index ba41964082..e4ce22b3d8 100644 --- a/src/lib/elementary/elm_entry.h +++ b/src/lib/elementary/elm_entry.h @@ -1,5 +1,5 @@ /** - * @defgroup Elm_Entry Entry + * @defgroup Elm_Entry_Group Entry * @ingroup Elementary * * @image html entry_inheritance_tree.png @@ -30,7 +30,7 @@ * This widget inherits from the @ref Elm_Layout one, so that all the * functions acting on it also work for entry objects (since 1.8). * - * This widget implements the @b @ref elm-scrollable-interface + * This widget implements the @ref elm-scrollable-interface * interface, so that all (non-deprecated) functions for the base * @ref Elm_Scroller widget also work for entries (since 1.8). * diff --git a/src/lib/elementary/elm_entry_common.h b/src/lib/elementary/elm_entry_common.h index 4e807a3b32..6178cecb85 100644 --- a/src/lib/elementary/elm_entry_common.h +++ b/src/lib/elementary/elm_entry_common.h @@ -2,7 +2,7 @@ #define ELM_ENTRY_COMMON_H_ /** - * @addtogroup Elm_Entry + * @addtogroup Elm_Entry_Group * * @{ */ diff --git a/src/lib/elementary/elm_entry_eo.c b/src/lib/elementary/elm_entry_eo.c index 2cdebe49ba..b993fd5fd7 100644 --- a/src/lib/elementary/elm_entry_eo.c +++ b/src/lib/elementary/elm_entry_eo.c @@ -904,13 +904,13 @@ const char *_elm_entry_efl_access_object_i18n_name_get(const Eo *obj, Elm_Entry_ char *_elm_entry_efl_access_text_access_text_get(const Eo *obj, Elm_Entry_Data *pd, int start_offset, int end_offset); -char *_elm_entry_efl_access_text_string_get(const Eo *obj, Elm_Entry_Data *pd, Efl_Access_Text_Granularity granularity, int *start_offset, int *end_offset); +void _elm_entry_efl_access_text_string_get(const Eo *obj, Elm_Entry_Data *pd, Efl_Access_Text_Granularity granularity, int *start_offset, int *end_offset, char **ret EFL_TRANSFER_OWNERSHIP); Eina_Bool _elm_entry_efl_access_text_attribute_get(const Eo *obj, Elm_Entry_Data *pd, const char *name, int *start_offset, int *end_offset, char **value); -Eina_List *_elm_entry_efl_access_text_text_attributes_get(const Eo *obj, Elm_Entry_Data *pd, int *start_offset, int *end_offset); +void _elm_entry_efl_access_text_text_attributes_get(const Eo *obj, Elm_Entry_Data *pd, int *start_offset, int *end_offset, Eina_List **attributes); Eina_List *_elm_entry_efl_access_text_default_attributes_get(const Eo *obj, Elm_Entry_Data *pd); diff --git a/src/lib/elementary/elm_entry_eo.h b/src/lib/elementary/elm_entry_eo.h index f762563fa7..43960893ba 100644 --- a/src/lib/elementary/elm_entry_eo.h +++ b/src/lib/elementary/elm_entry_eo.h @@ -15,11 +15,11 @@ typedef Eo Elm_Entry; #endif /** Elementary entry class * - * @ingroup Elm_Entry + * @ingroup Elm_Entry_Group */ #define ELM_ENTRY_CLASS elm_entry_class_get() -EWAPI const Efl_Class *elm_entry_class_get(void); +EWAPI const Efl_Class *elm_entry_class_get(void) EINA_CONST; /** * @brief Enable or disable scrolling in entry @@ -29,7 +29,7 @@ EWAPI const Efl_Class *elm_entry_class_get(void); * @param[in] obj The object. * @param[in] scroll @c true if it is to be scrollable, @c false otherwise. * - * @ingroup Elm_Entry + * @ingroup Elm_Entry_Group */ EOAPI void elm_obj_entry_scrollable_set(Eo *obj, Eina_Bool scroll); @@ -43,12 +43,12 @@ EOAPI void elm_obj_entry_scrollable_set(Eo *obj, Eina_Bool scroll); * * @return @c true if it is to be scrollable, @c false otherwise. * - * @ingroup Elm_Entry + * @ingroup Elm_Entry_Group */ EOAPI Eina_Bool elm_obj_entry_scrollable_get(const Eo *obj); /** - * @brief Set the attribute to show the input panel in case of only an user's + * @brief Set the attribute to show the input panel in case of only a user's * explicit Mouse Up event. It doesn't request to show the input panel even * though it has focus. * @@ -58,12 +58,12 @@ EOAPI Eina_Bool elm_obj_entry_scrollable_get(const Eo *obj); * * @since 1.9 * - * @ingroup Elm_Entry + * @ingroup Elm_Entry_Group */ EOAPI void elm_obj_entry_input_panel_show_on_demand_set(Eo *obj, Eina_Bool ondemand); /** - * @brief Get the attribute to show the input panel in case of only an user's + * @brief Get the attribute to show the input panel in case of only a user's * explicit Mouse Up event. * * @param[in] obj The object. @@ -73,7 +73,7 @@ EOAPI void elm_obj_entry_input_panel_show_on_demand_set(Eo *obj, Eina_Bool ondem * * @since 1.9 * - * @ingroup Elm_Entry + * @ingroup Elm_Entry_Group */ EOAPI Eina_Bool elm_obj_entry_input_panel_show_on_demand_get(const Eo *obj); @@ -83,7 +83,7 @@ EOAPI Eina_Bool elm_obj_entry_input_panel_show_on_demand_get(const Eo *obj); * @param[in] obj The object. * @param[in] disabled If @c true, the menu is disabled. * - * @ingroup Elm_Entry + * @ingroup Elm_Entry_Group */ EOAPI void elm_obj_entry_context_menu_disabled_set(Eo *obj, Eina_Bool disabled); @@ -95,7 +95,7 @@ EOAPI void elm_obj_entry_context_menu_disabled_set(Eo *obj, Eina_Bool disabled); * * @return If @c true, the menu is disabled. * - * @ingroup Elm_Entry + * @ingroup Elm_Entry_Group */ EOAPI Eina_Bool elm_obj_entry_context_menu_disabled_get(const Eo *obj); @@ -113,7 +113,7 @@ EOAPI Eina_Bool elm_obj_entry_context_menu_disabled_get(const Eo *obj); * @param[in] cnp_mode One of #Elm_Cnp_Mode: #ELM_CNP_MODE_MARKUP, * #ELM_CNP_MODE_NO_IMAGE, #ELM_CNP_MODE_PLAINTEXT. * - * @ingroup Elm_Entry + * @ingroup Elm_Entry_Group */ EOAPI void elm_obj_entry_cnp_mode_set(Eo *obj, Elm_Cnp_Mode cnp_mode); @@ -128,7 +128,7 @@ EOAPI void elm_obj_entry_cnp_mode_set(Eo *obj, Elm_Cnp_Mode cnp_mode); * @return One of #Elm_Cnp_Mode: #ELM_CNP_MODE_MARKUP, #ELM_CNP_MODE_NO_IMAGE, * #ELM_CNP_MODE_PLAINTEXT. * - * @ingroup Elm_Entry + * @ingroup Elm_Entry_Group */ EOAPI Elm_Cnp_Mode elm_obj_entry_cnp_mode_get(const Eo *obj); @@ -148,7 +148,7 @@ EOAPI Elm_Cnp_Mode elm_obj_entry_cnp_mode_get(const Eo *obj); * @param[in] obj The object. * @param[in] format The file format * - * @ingroup Elm_Entry + * @ingroup Elm_Entry_Group */ EOAPI void elm_obj_entry_file_text_format_set(Eo *obj, Elm_Text_Format format); @@ -160,7 +160,7 @@ EOAPI void elm_obj_entry_file_text_format_set(Eo *obj, Elm_Text_Format format); * @param[in] obj The object. * @param[in] lang Language to be set to the input panel. * - * @ingroup Elm_Entry + * @ingroup Elm_Entry_Group */ EOAPI void elm_obj_entry_input_panel_language_set(Eo *obj, Elm_Input_Panel_Lang lang); @@ -171,7 +171,7 @@ EOAPI void elm_obj_entry_input_panel_language_set(Eo *obj, Elm_Input_Panel_Lang * * @return Language to be set to the input panel. * - * @ingroup Elm_Entry + * @ingroup Elm_Entry_Group */ EOAPI Elm_Input_Panel_Lang elm_obj_entry_input_panel_language_get(const Eo *obj); @@ -181,7 +181,7 @@ EOAPI Elm_Input_Panel_Lang elm_obj_entry_input_panel_language_get(const Eo *obj) * @param[in] obj The object. * @param[in] disabled If @c true, the selection handlers are disabled. * - * @ingroup Elm_Entry + * @ingroup Elm_Entry_Group */ EOAPI void elm_obj_entry_selection_handler_disabled_set(Eo *obj, Eina_Bool disabled); @@ -192,7 +192,7 @@ EOAPI void elm_obj_entry_selection_handler_disabled_set(Eo *obj, Eina_Bool disab * * @return If @c true, the selection handlers are disabled. * - * @ingroup Elm_Entry + * @ingroup Elm_Entry_Group */ EOAPI Eina_Bool elm_obj_entry_selection_handler_disabled_get(const Eo *obj); @@ -204,7 +204,7 @@ EOAPI Eina_Bool elm_obj_entry_selection_handler_disabled_get(const Eo *obj); * * @since 1.8 * - * @ingroup Elm_Entry + * @ingroup Elm_Entry_Group */ EOAPI void elm_obj_entry_input_panel_layout_variation_set(Eo *obj, int variation); @@ -217,7 +217,7 @@ EOAPI void elm_obj_entry_input_panel_layout_variation_set(Eo *obj, int variation * * @since 1.8 * - * @ingroup Elm_Entry + * @ingroup Elm_Entry_Group */ EOAPI int elm_obj_entry_input_panel_layout_variation_get(const Eo *obj); @@ -227,7 +227,7 @@ EOAPI int elm_obj_entry_input_panel_layout_variation_get(const Eo *obj); * @param[in] obj The object. * @param[in] autocapital_type The type of autocapitalization. * - * @ingroup Elm_Entry + * @ingroup Elm_Entry_Group */ EOAPI void elm_obj_entry_autocapital_type_set(Eo *obj, Elm_Autocapital_Type autocapital_type); @@ -238,7 +238,7 @@ EOAPI void elm_obj_entry_autocapital_type_set(Eo *obj, Elm_Autocapital_Type auto * * @return The type of autocapitalization. * - * @ingroup Elm_Entry + * @ingroup Elm_Entry_Group */ EOAPI Elm_Autocapital_Type elm_obj_entry_autocapital_type_get(const Eo *obj); @@ -258,7 +258,7 @@ EOAPI Elm_Autocapital_Type elm_obj_entry_autocapital_type_get(const Eo *obj); * @param[in] editable If @c true, user input will be inserted in the entry, if * not, the entry is read-only and no user input is allowed. * - * @ingroup Elm_Entry + * @ingroup Elm_Entry_Group */ EOAPI void elm_obj_entry_editable_set(Eo *obj, Eina_Bool editable); @@ -270,7 +270,7 @@ EOAPI void elm_obj_entry_editable_set(Eo *obj, Eina_Bool editable); * @return If @c true, user input will be inserted in the entry, if not, the * entry is read-only and no user input is allowed. * - * @ingroup Elm_Entry + * @ingroup Elm_Entry_Group */ EOAPI Eina_Bool elm_obj_entry_editable_get(const Eo *obj); @@ -285,7 +285,7 @@ EOAPI Eina_Bool elm_obj_entry_editable_get(const Eo *obj); * @param[in] obj The object. * @param[in] style The style to use for the underlying hover. * - * @ingroup Elm_Entry + * @ingroup Elm_Entry_Group */ EOAPI void elm_obj_entry_anchor_hover_style_set(Eo *obj, const char *style); @@ -296,7 +296,7 @@ EOAPI void elm_obj_entry_anchor_hover_style_set(Eo *obj, const char *style); * * @return The style to use for the underlying hover. * - * @ingroup Elm_Entry + * @ingroup Elm_Entry_Group */ EOAPI const char *elm_obj_entry_anchor_hover_style_get(const Eo *obj); @@ -315,7 +315,7 @@ EOAPI const char *elm_obj_entry_anchor_hover_style_get(const Eo *obj); * @param[in] single_line If @c true, the text in the entry will be on a single * line. * - * @ingroup Elm_Entry + * @ingroup Elm_Entry_Group */ EOAPI void elm_obj_entry_single_line_set(Eo *obj, Eina_Bool single_line); @@ -326,7 +326,7 @@ EOAPI void elm_obj_entry_single_line_set(Eo *obj, Eina_Bool single_line); * * @return If @c true, the text in the entry will be on a single line. * - * @ingroup Elm_Entry + * @ingroup Elm_Entry_Group */ EOAPI Eina_Bool elm_obj_entry_single_line_get(const Eo *obj); @@ -339,7 +339,7 @@ EOAPI Eina_Bool elm_obj_entry_single_line_get(const Eo *obj); * @param[in] obj The object. * @param[in] password If @c true, password mode is enabled. * - * @ingroup Elm_Entry + * @ingroup Elm_Entry_Group */ EOAPI void elm_obj_entry_password_set(Eo *obj, Eina_Bool password); @@ -350,7 +350,7 @@ EOAPI void elm_obj_entry_password_set(Eo *obj, Eina_Bool password); * * @return If @c true, password mode is enabled. * - * @ingroup Elm_Entry + * @ingroup Elm_Entry_Group */ EOAPI Eina_Bool elm_obj_entry_password_get(const Eo *obj); @@ -361,7 +361,7 @@ EOAPI Eina_Bool elm_obj_entry_password_get(const Eo *obj); * @param[in] disabled The state to put in in: @c true for disabled, @c false * for enabled. * - * @ingroup Elm_Entry + * @ingroup Elm_Entry_Group */ EOAPI void elm_obj_entry_input_panel_return_key_disabled_set(Eo *obj, Eina_Bool disabled); @@ -373,7 +373,7 @@ EOAPI void elm_obj_entry_input_panel_return_key_disabled_set(Eo *obj, Eina_Bool * * @return The state to put in in: @c true for disabled, @c false for enabled. * - * @ingroup Elm_Entry + * @ingroup Elm_Entry_Group */ EOAPI Eina_Bool elm_obj_entry_input_panel_return_key_disabled_get(const Eo *obj); @@ -383,7 +383,7 @@ EOAPI Eina_Bool elm_obj_entry_input_panel_return_key_disabled_get(const Eo *obj) * @param[in] obj The object. * @param[in] auto_save Autosave the loaded file or not. * - * @ingroup Elm_Entry + * @ingroup Elm_Entry_Group */ EOAPI void elm_obj_entry_autosave_set(Eo *obj, Eina_Bool auto_save); @@ -394,7 +394,7 @@ EOAPI void elm_obj_entry_autosave_set(Eo *obj, Eina_Bool auto_save); * * @return Autosave the loaded file or not. * - * @ingroup Elm_Entry + * @ingroup Elm_Entry_Group */ EOAPI Eina_Bool elm_obj_entry_autosave_get(const Eo *obj); @@ -407,7 +407,7 @@ EOAPI Eina_Bool elm_obj_entry_autosave_get(const Eo *obj); * @param[in] obj The object. * @param[in] parent The object to use as parent for the hover. * - * @ingroup Elm_Entry + * @ingroup Elm_Entry_Group */ EOAPI void elm_obj_entry_anchor_hover_parent_set(Eo *obj, Efl_Canvas_Object *parent); @@ -421,7 +421,7 @@ EOAPI void elm_obj_entry_anchor_hover_parent_set(Eo *obj, Efl_Canvas_Object *par * * @return The object to use as parent for the hover. * - * @ingroup Elm_Entry + * @ingroup Elm_Entry_Group */ EOAPI Efl_Canvas_Object *elm_obj_entry_anchor_hover_parent_get(const Eo *obj); @@ -432,7 +432,7 @@ EOAPI Efl_Canvas_Object *elm_obj_entry_anchor_hover_parent_get(const Eo *obj); * @param[in] prediction Whether the entry should allow to use the text * prediction. * - * @ingroup Elm_Entry + * @ingroup Elm_Entry_Group */ EOAPI void elm_obj_entry_prediction_allow_set(Eo *obj, Eina_Bool prediction); @@ -443,7 +443,7 @@ EOAPI void elm_obj_entry_prediction_allow_set(Eo *obj, Eina_Bool prediction); * * @return Whether the entry should allow to use the text prediction. * - * @ingroup Elm_Entry + * @ingroup Elm_Entry_Group */ EOAPI Eina_Bool elm_obj_entry_prediction_allow_get(const Eo *obj); @@ -454,7 +454,7 @@ EOAPI Eina_Bool elm_obj_entry_prediction_allow_get(const Eo *obj); * @param[in] obj The object. * @param[in] hints Input hint. * - * @ingroup Elm_Entry + * @ingroup Elm_Entry_Group */ EOAPI void elm_obj_entry_input_hint_set(Eo *obj, Elm_Input_Hints hints); @@ -465,7 +465,7 @@ EOAPI void elm_obj_entry_input_hint_set(Eo *obj, Elm_Input_Hints hints); * * @return Input hint. * - * @ingroup Elm_Entry + * @ingroup Elm_Entry_Group */ EOAPI Elm_Input_Hints elm_obj_entry_input_hint_get(const Eo *obj); @@ -475,7 +475,7 @@ EOAPI Elm_Input_Hints elm_obj_entry_input_hint_get(const Eo *obj); * @param[in] obj The object. * @param[in] layout Layout type. * - * @ingroup Elm_Entry + * @ingroup Elm_Entry_Group */ EOAPI void elm_obj_entry_input_panel_layout_set(Eo *obj, Elm_Input_Panel_Layout layout); @@ -486,7 +486,7 @@ EOAPI void elm_obj_entry_input_panel_layout_set(Eo *obj, Elm_Input_Panel_Layout * * @return Layout type. * - * @ingroup Elm_Entry + * @ingroup Elm_Entry_Group */ EOAPI Elm_Input_Panel_Layout elm_obj_entry_input_panel_layout_get(const Eo *obj); @@ -502,7 +502,7 @@ EOAPI Elm_Input_Panel_Layout elm_obj_entry_input_panel_layout_get(const Eo *obj) * @param[in] obj The object. * @param[in] return_key_type The type of "return" key on the input panel. * - * @ingroup Elm_Entry + * @ingroup Elm_Entry_Group */ EOAPI void elm_obj_entry_input_panel_return_key_type_set(Eo *obj, Elm_Input_Panel_Return_Key_Type return_key_type); @@ -513,7 +513,7 @@ EOAPI void elm_obj_entry_input_panel_return_key_type_set(Eo *obj, Elm_Input_Pane * * @return The type of "return" key on the input panel. * - * @ingroup Elm_Entry + * @ingroup Elm_Entry_Group */ EOAPI Elm_Input_Panel_Return_Key_Type elm_obj_entry_input_panel_return_key_type_get(const Eo *obj); @@ -524,7 +524,7 @@ EOAPI Elm_Input_Panel_Return_Key_Type elm_obj_entry_input_panel_return_key_type_ * @param[in] enabled If @c true, the input panel is appeared when entry is * clicked or has a focus. * - * @ingroup Elm_Entry + * @ingroup Elm_Entry_Group */ EOAPI void elm_obj_entry_input_panel_enabled_set(Eo *obj, Eina_Bool enabled); @@ -536,7 +536,7 @@ EOAPI void elm_obj_entry_input_panel_enabled_set(Eo *obj, Eina_Bool enabled); * @return If @c true, the input panel is appeared when entry is clicked or has * a focus. * - * @ingroup Elm_Entry + * @ingroup Elm_Entry_Group */ EOAPI Eina_Bool elm_obj_entry_input_panel_enabled_get(const Eo *obj); @@ -554,7 +554,7 @@ EOAPI Eina_Bool elm_obj_entry_input_panel_enabled_get(const Eo *obj); * @param[in] obj The object. * @param[in] wrap The wrap mode to use. See Elm_Wrap_Type for details on them. * - * @ingroup Elm_Entry + * @ingroup Elm_Entry_Group */ EOAPI void elm_obj_entry_line_wrap_set(Eo *obj, Elm_Wrap_Type wrap); @@ -565,7 +565,7 @@ EOAPI void elm_obj_entry_line_wrap_set(Eo *obj, Elm_Wrap_Type wrap); * * @return The wrap mode to use. See Elm_Wrap_Type for details on them. * - * @ingroup Elm_Entry + * @ingroup Elm_Entry_Group */ EOAPI Elm_Wrap_Type elm_obj_entry_line_wrap_get(const Eo *obj); @@ -578,7 +578,7 @@ EOAPI Elm_Wrap_Type elm_obj_entry_line_wrap_get(const Eo *obj); * @param[in] obj The object. * @param[in] pos The position of the cursor. * - * @ingroup Elm_Entry + * @ingroup Elm_Entry_Group */ EOAPI void elm_obj_entry_cursor_pos_set(Eo *obj, int pos); @@ -589,7 +589,7 @@ EOAPI void elm_obj_entry_cursor_pos_set(Eo *obj, int pos); * * @return The position of the cursor. * - * @ingroup Elm_Entry + * @ingroup Elm_Entry_Group */ EOAPI int elm_obj_entry_cursor_pos_get(const Eo *obj); @@ -601,13 +601,13 @@ EOAPI int elm_obj_entry_cursor_pos_get(const Eo *obj); * @param[in] setting @c true if the object should be displayed, @c false if * not. * - * @ingroup Elm_Entry + * @ingroup Elm_Entry_Group */ EOAPI void elm_obj_entry_icon_visible_set(Eo *obj, Eina_Bool setting); /** This moves the cursor to the end of the current line. * - * @ingroup Elm_Entry + * @ingroup Elm_Entry_Group */ EOAPI void elm_obj_entry_cursor_line_end_set(Eo *obj); @@ -620,7 +620,7 @@ EOAPI void elm_obj_entry_cursor_line_end_set(Eo *obj); * * @since 1.9 * - * @ingroup Elm_Entry + * @ingroup Elm_Entry_Group */ EOAPI void elm_obj_entry_select_region_set(Eo *obj, int start, int end); @@ -633,7 +633,7 @@ EOAPI void elm_obj_entry_select_region_set(Eo *obj, int start, int end); * * @since 1.18 * - * @ingroup Elm_Entry + * @ingroup Elm_Entry_Group */ EOAPI void elm_obj_entry_select_region_get(const Eo *obj, int *start, int *end); @@ -649,7 +649,7 @@ EOAPI void elm_obj_entry_select_region_get(const Eo *obj, int *start, int *end); * @param[in] enabled If @c enabled is @c true, the return key is automatically * disabled when the entry has no text. * - * @ingroup Elm_Entry + * @ingroup Elm_Entry_Group */ EOAPI void elm_obj_entry_input_panel_return_key_autoenabled_set(Eo *obj, Eina_Bool enabled); @@ -660,25 +660,25 @@ EOAPI void elm_obj_entry_input_panel_return_key_autoenabled_set(Eo *obj, Eina_Bo * @param[in] obj The object. * @param[in] setting @c true if the object should be displayed, false if not. * - * @ingroup Elm_Entry + * @ingroup Elm_Entry_Group */ EOAPI void elm_obj_entry_end_visible_set(Eo *obj, Eina_Bool setting); /** This moves the cursor to the beginning of the entry. * - * @ingroup Elm_Entry + * @ingroup Elm_Entry_Group */ EOAPI void elm_obj_entry_cursor_begin_set(Eo *obj); /** This moves the cursor to the beginning of the current line. * - * @ingroup Elm_Entry + * @ingroup Elm_Entry_Group */ EOAPI void elm_obj_entry_cursor_line_begin_set(Eo *obj); /** This moves the cursor to the end of the entry. * - * @ingroup Elm_Entry + * @ingroup Elm_Entry_Group */ EOAPI void elm_obj_entry_cursor_end_set(Eo *obj); @@ -709,7 +709,7 @@ EOAPI void elm_obj_entry_cursor_end_set(Eo *obj); * * @return Textblock object * - * @ingroup Elm_Entry + * @ingroup Elm_Entry_Group */ EOAPI Efl_Canvas_Object *elm_obj_entry_textblock_get(const Eo *obj); @@ -727,7 +727,7 @@ EOAPI Efl_Canvas_Object *elm_obj_entry_textblock_get(const Eo *obj); * * @return @c true on success, @c false otherwise * - * @ingroup Elm_Entry + * @ingroup Elm_Entry_Group */ EOAPI Eina_Bool elm_obj_entry_textblock_cursor_geometry_get(const Eo *obj, int *x, int *y, int *w, int *h); @@ -743,7 +743,7 @@ EOAPI Eina_Bool elm_obj_entry_textblock_cursor_geometry_get(const Eo *obj, int * * * @return Input method context * - * @ingroup Elm_Entry + * @ingroup Elm_Entry_Group */ EOAPI void *elm_obj_entry_imf_context_get(const Eo *obj); @@ -759,7 +759,7 @@ EOAPI void *elm_obj_entry_imf_context_get(const Eo *obj); * * @return @c true if format node exists, @c false otherwise * - * @ingroup Elm_Entry + * @ingroup Elm_Entry_Group */ EOAPI Eina_Bool elm_obj_entry_cursor_is_format_get(const Eo *obj); @@ -775,7 +775,7 @@ EOAPI Eina_Bool elm_obj_entry_cursor_is_format_get(const Eo *obj); * * @return Character * - * @ingroup Elm_Entry + * @ingroup Elm_Entry_Group */ EOAPI char *elm_obj_entry_textblock_cursor_content_get(const Eo *obj) EINA_WARN_UNUSED_RESULT; @@ -794,7 +794,7 @@ EOAPI char *elm_obj_entry_textblock_cursor_content_get(const Eo *obj) EINA_WARN_ * * @return Selected string * - * @ingroup Elm_Entry + * @ingroup Elm_Entry_Group */ EOAPI const char *elm_obj_entry_selection_get(const Eo *obj); @@ -805,7 +805,7 @@ EOAPI const char *elm_obj_entry_selection_get(const Eo *obj); * * @return @c true if position has a visible format, @c false otherwise * - * @ingroup Elm_Entry + * @ingroup Elm_Entry_Group */ EOAPI Eina_Bool elm_obj_entry_cursor_is_visible_format_get(const Eo *obj); @@ -817,7 +817,7 @@ EOAPI Eina_Bool elm_obj_entry_cursor_is_visible_format_get(const Eo *obj); * * @since 1.18 * - * @ingroup Elm_Entry + * @ingroup Elm_Entry_Group */ EOAPI void elm_obj_entry_select_allow_set(Eo *obj, Eina_Bool allow); @@ -830,7 +830,7 @@ EOAPI void elm_obj_entry_select_allow_set(Eo *obj, Eina_Bool allow); * * @since 1.18 * - * @ingroup Elm_Entry + * @ingroup Elm_Entry_Group */ EOAPI Eina_Bool elm_obj_entry_select_allow_get(const Eo *obj); @@ -841,7 +841,7 @@ EOAPI Eina_Bool elm_obj_entry_select_allow_get(const Eo *obj); * * @return @c true on success, @c false otherwise * - * @ingroup Elm_Entry + * @ingroup Elm_Entry_Group */ EOAPI Eina_Bool elm_obj_entry_cursor_prev(Eo *obj); @@ -849,7 +849,7 @@ EOAPI Eina_Bool elm_obj_entry_cursor_prev(Eo *obj); * * @since 1.7 * - * @ingroup Elm_Entry + * @ingroup Elm_Entry_Group */ EOAPI void elm_obj_entry_text_style_user_pop(Eo *obj); @@ -862,7 +862,7 @@ EOAPI void elm_obj_entry_text_style_user_pop(Eo *obj); * @param[in] func The function called to provide the item object. * @param[in] data The data passed to @c func. * - * @ingroup Elm_Entry + * @ingroup Elm_Entry_Group */ EOAPI void elm_obj_entry_item_provider_prepend(Eo *obj, Elm_Entry_Item_Provider_Cb func, void *data); @@ -876,7 +876,7 @@ EOAPI void elm_obj_entry_item_provider_prepend(Eo *obj, Elm_Entry_Item_Provider_ * @c false). * @param[in] obj The object. * - * @ingroup Elm_Entry + * @ingroup Elm_Entry_Group */ EOAPI void elm_obj_entry_input_panel_show(Eo *obj); @@ -888,7 +888,7 @@ EOAPI void elm_obj_entry_input_panel_show(Eo *obj); * Context to clear the preedit state. * @param[in] obj The object. * - * @ingroup Elm_Entry + * @ingroup Elm_Entry_Group */ EOAPI void elm_obj_entry_imf_context_reset(Eo *obj); @@ -900,14 +900,14 @@ EOAPI void elm_obj_entry_imf_context_reset(Eo *obj); * popup, returning the entry to its normal state. * @param[in] obj The object. * - * @ingroup Elm_Entry + * @ingroup Elm_Entry_Group */ EOAPI void elm_obj_entry_anchor_hover_end(Eo *obj); /** This begins a selection within the entry as though the user were holding * down the mouse button to make a selection. * - * @ingroup Elm_Entry + * @ingroup Elm_Entry_Group */ EOAPI void elm_obj_entry_cursor_selection_begin(Eo *obj); @@ -918,20 +918,20 @@ EOAPI void elm_obj_entry_cursor_selection_begin(Eo *obj); * * @return @c true on success, @c false otherwise * - * @ingroup Elm_Entry + * @ingroup Elm_Entry_Group */ EOAPI Eina_Bool elm_obj_entry_cursor_down(Eo *obj); /** This function writes any changes made to the file set with @ref * elm_entry_file_set. * - * @ingroup Elm_Entry + * @ingroup Elm_Entry_Group */ EOAPI void elm_obj_entry_file_save(Eo *obj); /** This executes a "copy" action on the selected text in the entry. * - * @ingroup Elm_Entry + * @ingroup Elm_Entry_Group */ EOAPI void elm_obj_entry_selection_copy(Eo *obj); @@ -947,7 +947,7 @@ EOAPI void elm_obj_entry_selection_copy(Eo *obj); * * @since 1.7 * - * @ingroup Elm_Entry + * @ingroup Elm_Entry_Group */ EOAPI void elm_obj_entry_text_style_user_push(Eo *obj, const char *style); @@ -961,7 +961,7 @@ EOAPI void elm_obj_entry_text_style_user_push(Eo *obj, const char *style); * @param[in] func The function called to provide the item object. * @param[in] data The data passed to @c func. * - * @ingroup Elm_Entry + * @ingroup Elm_Entry_Group */ EOAPI void elm_obj_entry_item_provider_remove(Eo *obj, Elm_Entry_Item_Provider_Cb func, void *data); @@ -976,7 +976,7 @@ EOAPI void elm_obj_entry_item_provider_remove(Eo *obj, Elm_Entry_Item_Provider_C * * @since 1.7 * - * @ingroup Elm_Entry + * @ingroup Elm_Entry_Group */ EOAPI const char *elm_obj_entry_text_style_user_peek(const Eo *obj); @@ -987,7 +987,7 @@ EOAPI const char *elm_obj_entry_text_style_user_peek(const Eo *obj); * See also @ref elm_obj_entry_context_menu_item_add. * @param[in] obj The object. * - * @ingroup Elm_Entry + * @ingroup Elm_Entry_Group */ EOAPI void elm_obj_entry_context_menu_clear(Eo *obj); @@ -998,7 +998,7 @@ EOAPI void elm_obj_entry_context_menu_clear(Eo *obj); * * @return @c true on success, @c false otherwise * - * @ingroup Elm_Entry + * @ingroup Elm_Entry_Group */ EOAPI Eina_Bool elm_obj_entry_cursor_up(Eo *obj); @@ -1020,7 +1020,7 @@ EOAPI Eina_Bool elm_obj_entry_cursor_up(Eo *obj); * @param[in] obj The object. * @param[in] entry The text to insert. * - * @ingroup Elm_Entry + * @ingroup Elm_Entry_Group */ EOAPI void elm_obj_entry_insert(Eo *obj, const char *entry); @@ -1035,7 +1035,7 @@ EOAPI void elm_obj_entry_insert(Eo *obj, const char *entry); * @param[in] data The specific data to be set to the input panel. * @param[in] len The length of data, in bytes, to send to the input panel. * - * @ingroup Elm_Entry + * @ingroup Elm_Entry_Group */ EOAPI void elm_obj_entry_input_panel_imdata_set(Eo *obj, const void *data, int len); @@ -1046,13 +1046,13 @@ EOAPI void elm_obj_entry_input_panel_imdata_set(Eo *obj, const void *data, int l * @param[out] data The specific data to be got from the input panel. * @param[out] len The length of data. * - * @ingroup Elm_Entry + * @ingroup Elm_Entry_Group */ EOAPI void elm_obj_entry_input_panel_imdata_get(const Eo *obj, void *data, int *len); /** This executes a "paste" action in the entry. * - * @ingroup Elm_Entry + * @ingroup Elm_Entry_Group */ EOAPI void elm_obj_entry_selection_paste(Eo *obj); @@ -1063,13 +1063,13 @@ EOAPI void elm_obj_entry_selection_paste(Eo *obj); * * @return @c true on success, @c false otherwise * - * @ingroup Elm_Entry + * @ingroup Elm_Entry_Group */ EOAPI Eina_Bool elm_obj_entry_cursor_next(Eo *obj); /** This drops any existing text selection within the entry. * - * @ingroup Elm_Entry + * @ingroup Elm_Entry_Group */ EOAPI void elm_obj_entry_select_none(Eo *obj); @@ -1082,26 +1082,26 @@ EOAPI void elm_obj_entry_select_none(Eo *obj); * @c false) * @param[in] obj The object. * - * @ingroup Elm_Entry + * @ingroup Elm_Entry_Group */ EOAPI void elm_obj_entry_input_panel_hide(Eo *obj); /** This selects all text within the entry. * - * @ingroup Elm_Entry + * @ingroup Elm_Entry_Group */ EOAPI void elm_obj_entry_select_all(Eo *obj); /** This ends a selection within the entry as though the user had just released * the mouse button while making a selection. * - * @ingroup Elm_Entry + * @ingroup Elm_Entry_Group */ EOAPI void elm_obj_entry_cursor_selection_end(Eo *obj); /** This executes a "cut" action on the selected text in the entry. * - * @ingroup Elm_Entry + * @ingroup Elm_Entry_Group */ EOAPI void elm_obj_entry_selection_cut(Eo *obj); @@ -1116,7 +1116,7 @@ EOAPI void elm_obj_entry_selection_cut(Eo *obj); * * @return @c true if empty, @c false otherwise * - * @ingroup Elm_Entry + * @ingroup Elm_Entry_Group */ EOAPI Eina_Bool elm_obj_entry_is_empty(const Eo *obj); @@ -1130,7 +1130,7 @@ EOAPI Eina_Bool elm_obj_entry_is_empty(const Eo *obj); * @param[in] func The filter function to remove. * @param[in] data The user data passed when adding the function. * - * @ingroup Elm_Entry + * @ingroup Elm_Entry_Group */ EOAPI void elm_obj_entry_markup_filter_remove(Eo *obj, Elm_Entry_Filter_Cb func, void *data); @@ -1150,7 +1150,7 @@ EOAPI void elm_obj_entry_markup_filter_remove(Eo *obj, Elm_Entry_Filter_Cb func, * @param[in] func The function called to provide the item object. * @param[in] data The data passed to @c func. * - * @ingroup Elm_Entry + * @ingroup Elm_Entry_Group */ EOAPI void elm_obj_entry_item_provider_append(Eo *obj, Elm_Entry_Item_Provider_Cb func, void *data); @@ -1169,7 +1169,7 @@ EOAPI void elm_obj_entry_item_provider_append(Eo *obj, Elm_Entry_Item_Provider_C * @param[in] func The function to use as text filter. * @param[in] data User data to pass to @c func. * - * @ingroup Elm_Entry + * @ingroup Elm_Entry_Group */ EOAPI void elm_obj_entry_markup_filter_append(Eo *obj, Elm_Entry_Filter_Cb func, void *data); @@ -1186,7 +1186,7 @@ EOAPI void elm_obj_entry_markup_filter_append(Eo *obj, Elm_Entry_Filter_Cb func, * @param[in] obj The object. * @param[in] str The text to be appended. * - * @ingroup Elm_Entry + * @ingroup Elm_Entry_Group */ EOAPI void elm_obj_entry_append(Eo *obj, const char *str); @@ -1209,7 +1209,7 @@ EOAPI void elm_obj_entry_append(Eo *obj, const char *str); * @param[in] func The callback to execute when the item is clicked. * @param[in] data The data to associate with the item for related functions. * - * @ingroup Elm_Entry + * @ingroup Elm_Entry_Group */ EOAPI void elm_obj_entry_context_menu_item_add(Eo *obj, const char *label, const char *icon_file, Elm_Icon_Type icon_type, Evas_Smart_Cb func, const void *data); @@ -1222,7 +1222,7 @@ EOAPI void elm_obj_entry_context_menu_item_add(Eo *obj, const char *label, const * @param[in] func The function to use as text filter. * @param[in] data User data to pass to @c func. * - * @ingroup Elm_Entry + * @ingroup Elm_Entry_Group */ EOAPI void elm_obj_entry_markup_filter_prepend(Eo *obj, Elm_Entry_Filter_Cb func, void *data); @@ -1235,7 +1235,7 @@ EOAPI void elm_obj_entry_markup_filter_prepend(Eo *obj, Elm_Entry_Filter_Cb func * * @since 1.20 * - * @ingroup Elm_Entry + * @ingroup Elm_Entry_Group */ EOAPI void elm_obj_entry_prediction_hint_set(Eo *obj, const char *prediction_hint); @@ -1250,7 +1250,7 @@ EOAPI void elm_obj_entry_prediction_hint_set(Eo *obj, const char *prediction_hin * * @since 1.21 * - * @ingroup Elm_Entry + * @ingroup Elm_Entry_Group */ EOAPI Eina_Bool elm_obj_entry_prediction_hint_hash_set(Eo *obj, const char *key, const char *value); @@ -1264,7 +1264,7 @@ EOAPI Eina_Bool elm_obj_entry_prediction_hint_hash_set(Eo *obj, const char *key, * * @since 1.21 * - * @ingroup Elm_Entry + * @ingroup Elm_Entry_Group */ EOAPI Eina_Bool elm_obj_entry_prediction_hint_hash_del(Eo *obj, const char *key); @@ -1272,7 +1272,7 @@ EWAPI extern const Efl_Event_Description _ELM_ENTRY_EVENT_ACTIVATED; /** Called when entry got activated * - * @ingroup Elm_Entry + * @ingroup Elm_Entry_Group */ #define ELM_ENTRY_EVENT_ACTIVATED (&(_ELM_ENTRY_EVENT_ACTIVATED)) @@ -1280,7 +1280,7 @@ EWAPI extern const Efl_Event_Description _ELM_ENTRY_EVENT_CHANGED; /** Called when entry changed * - * @ingroup Elm_Entry + * @ingroup Elm_Entry_Group */ #define ELM_ENTRY_EVENT_CHANGED (&(_ELM_ENTRY_EVENT_CHANGED)) @@ -1289,7 +1289,7 @@ EWAPI extern const Efl_Event_Description _ELM_ENTRY_EVENT_CHANGED_USER; /** Called when the object changed due to user interaction * @return Elm_Entry_Change_Info * - * @ingroup Elm_Entry + * @ingroup Elm_Entry_Group */ #define ELM_ENTRY_EVENT_CHANGED_USER (&(_ELM_ENTRY_EVENT_CHANGED_USER)) @@ -1298,7 +1298,7 @@ EWAPI extern const Efl_Event_Description _ELM_ENTRY_EVENT_VALIDATE; /** Called when validating * @return Elm_Validate_Content * - * @ingroup Elm_Entry + * @ingroup Elm_Entry_Group */ #define ELM_ENTRY_EVENT_VALIDATE (&(_ELM_ENTRY_EVENT_VALIDATE)) @@ -1306,7 +1306,7 @@ EWAPI extern const Efl_Event_Description _ELM_ENTRY_EVENT_CONTEXT_OPEN; /** Called when context menu was opened * - * @ingroup Elm_Entry + * @ingroup Elm_Entry_Group */ #define ELM_ENTRY_EVENT_CONTEXT_OPEN (&(_ELM_ENTRY_EVENT_CONTEXT_OPEN)) @@ -1315,7 +1315,7 @@ EWAPI extern const Efl_Event_Description _ELM_ENTRY_EVENT_ANCHOR_CLICKED; /** Called when anchor was clicked * @return Elm_Entry_Anchor_Info * - * @ingroup Elm_Entry + * @ingroup Elm_Entry_Group */ #define ELM_ENTRY_EVENT_ANCHOR_CLICKED (&(_ELM_ENTRY_EVENT_ANCHOR_CLICKED)) @@ -1323,7 +1323,7 @@ EWAPI extern const Efl_Event_Description _ELM_ENTRY_EVENT_REJECTED; /** Called when entry was rejected * - * @ingroup Elm_Entry + * @ingroup Elm_Entry_Group */ #define ELM_ENTRY_EVENT_REJECTED (&(_ELM_ENTRY_EVENT_REJECTED)) @@ -1331,7 +1331,7 @@ EWAPI extern const Efl_Event_Description _ELM_ENTRY_EVENT_MAXLENGTH_REACHED; /** Called when maximum entry length has been reached * - * @ingroup Elm_Entry + * @ingroup Elm_Entry_Group */ #define ELM_ENTRY_EVENT_MAXLENGTH_REACHED (&(_ELM_ENTRY_EVENT_MAXLENGTH_REACHED)) @@ -1339,7 +1339,7 @@ EWAPI extern const Efl_Event_Description _ELM_ENTRY_EVENT_PREEDIT_CHANGED; /** Called when entry preedit changed * - * @ingroup Elm_Entry + * @ingroup Elm_Entry_Group */ #define ELM_ENTRY_EVENT_PREEDIT_CHANGED (&(_ELM_ENTRY_EVENT_PREEDIT_CHANGED)) @@ -1347,7 +1347,7 @@ EWAPI extern const Efl_Event_Description _ELM_ENTRY_EVENT_PRESS; /** Called when entry pressed * - * @ingroup Elm_Entry + * @ingroup Elm_Entry_Group */ #define ELM_ENTRY_EVENT_PRESS (&(_ELM_ENTRY_EVENT_PRESS)) @@ -1355,7 +1355,7 @@ EWAPI extern const Efl_Event_Description _ELM_ENTRY_EVENT_REDO_REQUEST; /** Called when redo was requested * - * @ingroup Elm_Entry + * @ingroup Elm_Entry_Group */ #define ELM_ENTRY_EVENT_REDO_REQUEST (&(_ELM_ENTRY_EVENT_REDO_REQUEST)) @@ -1363,7 +1363,7 @@ EWAPI extern const Efl_Event_Description _ELM_ENTRY_EVENT_UNDO_REQUEST; /** Called when undo was requested * - * @ingroup Elm_Entry + * @ingroup Elm_Entry_Group */ #define ELM_ENTRY_EVENT_UNDO_REQUEST (&(_ELM_ENTRY_EVENT_UNDO_REQUEST)) @@ -1371,7 +1371,7 @@ EWAPI extern const Efl_Event_Description _ELM_ENTRY_EVENT_TEXT_SET_DONE; /** Called when text set finished * - * @ingroup Elm_Entry + * @ingroup Elm_Entry_Group */ #define ELM_ENTRY_EVENT_TEXT_SET_DONE (&(_ELM_ENTRY_EVENT_TEXT_SET_DONE)) @@ -1379,7 +1379,7 @@ EWAPI extern const Efl_Event_Description _ELM_ENTRY_EVENT_ABORTED; /** Called when entry was aborted * - * @ingroup Elm_Entry + * @ingroup Elm_Entry_Group */ #define ELM_ENTRY_EVENT_ABORTED (&(_ELM_ENTRY_EVENT_ABORTED)) @@ -1388,7 +1388,7 @@ EWAPI extern const Efl_Event_Description _ELM_ENTRY_EVENT_ANCHOR_DOWN; /** Called on anchor down * @return Elm_Entry_Anchor_Info * - * @ingroup Elm_Entry + * @ingroup Elm_Entry_Group */ #define ELM_ENTRY_EVENT_ANCHOR_DOWN (&(_ELM_ENTRY_EVENT_ANCHOR_DOWN)) @@ -1397,7 +1397,7 @@ EWAPI extern const Efl_Event_Description _ELM_ENTRY_EVENT_ANCHOR_HOVER_OPENED; /** Called when hover opened * @return Elm_Entry_Anchor_Hover_Info * - * @ingroup Elm_Entry + * @ingroup Elm_Entry_Group */ #define ELM_ENTRY_EVENT_ANCHOR_HOVER_OPENED (&(_ELM_ENTRY_EVENT_ANCHOR_HOVER_OPENED)) @@ -1406,7 +1406,7 @@ EWAPI extern const Efl_Event_Description _ELM_ENTRY_EVENT_ANCHOR_IN; /** Called on anchor in * @return Elm_Entry_Anchor_Info * - * @ingroup Elm_Entry + * @ingroup Elm_Entry_Group */ #define ELM_ENTRY_EVENT_ANCHOR_IN (&(_ELM_ENTRY_EVENT_ANCHOR_IN)) @@ -1415,7 +1415,7 @@ EWAPI extern const Efl_Event_Description _ELM_ENTRY_EVENT_ANCHOR_OUT; /** Called on anchor out * @return Elm_Entry_Anchor_Info * - * @ingroup Elm_Entry + * @ingroup Elm_Entry_Group */ #define ELM_ENTRY_EVENT_ANCHOR_OUT (&(_ELM_ENTRY_EVENT_ANCHOR_OUT)) @@ -1424,7 +1424,7 @@ EWAPI extern const Efl_Event_Description _ELM_ENTRY_EVENT_ANCHOR_UP; /** called on anchor up * @return Elm_Entry_Anchor_Info * - * @ingroup Elm_Entry + * @ingroup Elm_Entry_Group */ #define ELM_ENTRY_EVENT_ANCHOR_UP (&(_ELM_ENTRY_EVENT_ANCHOR_UP)) @@ -1432,7 +1432,7 @@ EWAPI extern const Efl_Event_Description _ELM_ENTRY_EVENT_CURSOR_CHANGED; /** Called on cursor changed * - * @ingroup Elm_Entry + * @ingroup Elm_Entry_Group */ #define ELM_ENTRY_EVENT_CURSOR_CHANGED (&(_ELM_ENTRY_EVENT_CURSOR_CHANGED)) @@ -1440,7 +1440,7 @@ EWAPI extern const Efl_Event_Description _ELM_ENTRY_EVENT_CURSOR_CHANGED_MANUAL; /** Called on manual cursor change * - * @ingroup Elm_Entry + * @ingroup Elm_Entry_Group */ #define ELM_ENTRY_EVENT_CURSOR_CHANGED_MANUAL (&(_ELM_ENTRY_EVENT_CURSOR_CHANGED_MANUAL)) diff --git a/src/lib/elementary/elm_entry_eo.legacy.h b/src/lib/elementary/elm_entry_eo.legacy.h index 6fe06089be..a08522a328 100644 --- a/src/lib/elementary/elm_entry_eo.legacy.h +++ b/src/lib/elementary/elm_entry_eo.legacy.h @@ -41,7 +41,7 @@ EAPI void elm_entry_scrollable_set(Elm_Entry *obj, Eina_Bool scroll); EAPI Eina_Bool elm_entry_scrollable_get(const Elm_Entry *obj); /** - * @brief Set the attribute to show the input panel in case of only an user's + * @brief Set the attribute to show the input panel in case of only a user's * explicit Mouse Up event. It doesn't request to show the input panel even * though it has focus. * @@ -56,7 +56,7 @@ EAPI Eina_Bool elm_entry_scrollable_get(const Elm_Entry *obj); EAPI void elm_entry_input_panel_show_on_demand_set(Elm_Entry *obj, Eina_Bool ondemand); /** - * @brief Get the attribute to show the input panel in case of only an user's + * @brief Get the attribute to show the input panel in case of only a user's * explicit Mouse Up event. * * @param[in] obj The object. diff --git a/src/lib/elementary/elm_entry_legacy.h b/src/lib/elementary/elm_entry_legacy.h index 06b3f76eb7..9d87e54e54 100644 --- a/src/lib/elementary/elm_entry_legacy.h +++ b/src/lib/elementary/elm_entry_legacy.h @@ -12,7 +12,7 @@ * @param parent The parent object * @return The new object or NULL if it cannot be created * - * @ingroup Elm_Entry + * @ingroup Elm_Entry_Group */ EAPI Evas_Object *elm_entry_add(Evas_Object *parent); @@ -24,7 +24,7 @@ EAPI Evas_Object *elm_entry_add(Evas_Object *parent); * * @note Using this function bypasses text filters * - * @ingroup Elm_Entry + * @ingroup Elm_Entry_Group */ EAPI void elm_entry_entry_set(Evas_Object *obj, const char *entry); @@ -35,7 +35,7 @@ EAPI void elm_entry_entry_set(Evas_Object *obj, const char *entry) * @param obj The entry object * @return The currently displayed text or NULL on failure * - * @ingroup Elm_Entry + * @ingroup Elm_Entry_Group */ EAPI const char *elm_entry_entry_get(const Evas_Object *obj); @@ -51,7 +51,7 @@ EAPI const char *elm_entry_entry_get(const Evas_Object *obj); * * @return @c EINA_TRUE on success, @c EINA_FALSE otherwise * - * @ingroup Elm_Entry + * @ingroup Elm_Entry_Group * * @param[in] obj The entry object * @param[in] file The path to the file to load and save @@ -66,7 +66,7 @@ EAPI Eina_Bool elm_entry_file_set(Evas_Object *obj, const char *file, E * This function can be used to retrieve any file set on the entry for * edition, along with the format used to load and save it. * - * @ingroup Elm_Entry + * @ingroup Elm_Entry_Group * * @param[in] obj The entry object * @param[out] file The path to the file to load and save @@ -82,6 +82,6 @@ EAPI void elm_entry_file_get(const Evas_Object *obj, const char ** * @ref elm_entry_textblock_get for more information. * @param[in] obj The object. * - * @ingroup Elm_Entry + * @ingroup Elm_Entry_Group */ EAPI void elm_entry_calc_force(Evas_Object *obj); diff --git a/src/lib/elementary/elm_factory.c b/src/lib/elementary/elm_factory.c index 7bbeccfb2e..56e7bd4f06 100644 --- a/src/lib/elementary/elm_factory.c +++ b/src/lib/elementary/elm_factory.c @@ -117,7 +117,7 @@ _eval(Evas_Object *obj) evas_output_viewport_get(evas_object_evas_get(obj), &cvx, &cvy, &cvw, &cvh); if ((cvw < 1) || (cvh < 1)) return; - // need some fuzz value thats beyond the current viewport + // need some fuzz value that's beyond the current viewport // for now just make it the viewport * 3 in size (so 1 vp in each direction) /* cvx -= cvw; diff --git a/src/lib/elementary/elm_fileselector_button_eo.h b/src/lib/elementary/elm_fileselector_button_eo.h index d130945e40..b551e25318 100644 --- a/src/lib/elementary/elm_fileselector_button_eo.h +++ b/src/lib/elementary/elm_fileselector_button_eo.h @@ -19,7 +19,7 @@ typedef Eo Elm_Fileselector_Button; */ #define ELM_FILESELECTOR_BUTTON_CLASS elm_fileselector_button_class_get() -EWAPI const Efl_Class *elm_fileselector_button_class_get(void); +EWAPI const Efl_Class *elm_fileselector_button_class_get(void) EINA_CONST; EWAPI extern const Efl_Event_Description _ELM_FILESELECTOR_BUTTON_EVENT_FILE_CHOSEN; diff --git a/src/lib/elementary/elm_fileselector_entry_eo.h b/src/lib/elementary/elm_fileselector_entry_eo.h index b343a7e212..8ee352d387 100644 --- a/src/lib/elementary/elm_fileselector_entry_eo.h +++ b/src/lib/elementary/elm_fileselector_entry_eo.h @@ -19,7 +19,7 @@ typedef Eo Elm_Fileselector_Entry; */ #define ELM_FILESELECTOR_ENTRY_CLASS elm_fileselector_entry_class_get() -EWAPI const Efl_Class *elm_fileselector_entry_class_get(void); +EWAPI const Efl_Class *elm_fileselector_entry_class_get(void) EINA_CONST; EWAPI extern const Efl_Event_Description _ELM_FILESELECTOR_ENTRY_EVENT_CHANGED; diff --git a/src/lib/elementary/elm_fileselector_eo.h b/src/lib/elementary/elm_fileselector_eo.h index 74ce3f1984..719c53dcb8 100644 --- a/src/lib/elementary/elm_fileselector_eo.h +++ b/src/lib/elementary/elm_fileselector_eo.h @@ -19,7 +19,7 @@ typedef Eo Elm_Fileselector; */ #define ELM_FILESELECTOR_CLASS elm_fileselector_class_get() -EWAPI const Efl_Class *elm_fileselector_class_get(void); +EWAPI const Efl_Class *elm_fileselector_class_get(void) EINA_CONST; /** * @brief Enable/disable the "ok" and "cancel" buttons on a given file selector diff --git a/src/lib/elementary/elm_flipselector.c b/src/lib/elementary/elm_flipselector.c index d7c5741221..51481a9ad0 100644 --- a/src/lib/elementary/elm_flipselector.c +++ b/src/lib/elementary/elm_flipselector.c @@ -476,7 +476,7 @@ _items_add(Evas_Object *obj) EOLIAN static void _elm_flipselector_efl_ui_range_display_range_limits_set(Eo *obj, Elm_Flipselector_Data *sd, double min, double max) { - if ((sd->val_min == min) && (sd->val_max == max)) return; + if (EINA_DBL_EQ(sd->val_min, min) && EINA_DBL_EQ(sd->val_max, max)) return; sd->val_min = min; sd->val_max = max; @@ -494,9 +494,9 @@ _elm_flipselector_efl_ui_range_display_range_limits_get(const Eo *obj EINA_UNUSE EOLIAN static void _elm_flipselector_efl_ui_range_interactive_range_step_set(Eo *obj EINA_UNUSED, Elm_Flipselector_Data *sd, double step) { - if (sd->step == step) return; + if (EINA_DBL_EQ(sd->step, step)) return; - if (step == 0.0) step = 1.0; + if (EINA_DBL_EQ(step, 0.0)) step = 1.0; else if (step < 0.0) step *= -1; sd->step = step; @@ -512,7 +512,7 @@ _elm_flipselector_efl_ui_range_interactive_range_step_get(const Eo *obj EINA_UNU EOLIAN static double _elm_flipselector_efl_ui_range_display_range_value_get(const Eo *obj EINA_UNUSED, Elm_Flipselector_Data *sd) { - if (sd->val_min == 0 && sd->val_max == 0) + if (EINA_DBL_EQ(sd->val_min, 0) && EINA_DBL_EQ(sd->val_max, 0)) { WRN("This API can be used only if you set min and max and flipselector values are numericals"); return 0; diff --git a/src/lib/elementary/elm_flipselector.h b/src/lib/elementary/elm_flipselector.h index 40e8d07e7c..dc36f2fc05 100644 --- a/src/lib/elementary/elm_flipselector.h +++ b/src/lib/elementary/elm_flipselector.h @@ -16,11 +16,11 @@ * so that it helps the user to reach an item which is distant from * the current selection. * - * This widget inherits from the @ref Layout one, so that all the + * This widget inherits from the @ref Elm_Layout one, so that all the * functions acting on it also work for flip selector objects. * * This widget emits the following signals, besides the ones sent from - * @ref Layout: + * @ref Elm_Layout : * - @c "selected" - when the widget's selected text item is changed. The @c * event_info parameter is the item that was selected. * - @c "overflowed" - when the widget's current selection is changed diff --git a/src/lib/elementary/elm_flipselector_eo.h b/src/lib/elementary/elm_flipselector_eo.h index 59b3c483e3..ce996b494c 100644 --- a/src/lib/elementary/elm_flipselector_eo.h +++ b/src/lib/elementary/elm_flipselector_eo.h @@ -19,7 +19,7 @@ typedef Eo Elm_Flipselector; */ #define ELM_FLIPSELECTOR_CLASS elm_flipselector_class_get() -EWAPI const Efl_Class *elm_flipselector_class_get(void); +EWAPI const Efl_Class *elm_flipselector_class_get(void) EINA_CONST; /** * @brief Get the internal list of items in a given flip selector widget. @@ -108,7 +108,7 @@ EOAPI Elm_Widget_Item *elm_obj_flipselector_selected_item_get(const Eo *obj); EOAPI void elm_obj_flipselector_first_interval_set(Eo *obj, double interval); /** - * @brief Get the interval on time updates for an user mouse button hold on a + * @brief Get the interval on time updates for a user mouse button hold on a * flip selector widget. * * See also @ref elm_obj_flipselector_first_interval_set for more details. diff --git a/src/lib/elementary/elm_flipselector_eo.legacy.h b/src/lib/elementary/elm_flipselector_eo.legacy.h index 707d7a3d5e..321a7447ed 100644 --- a/src/lib/elementary/elm_flipselector_eo.legacy.h +++ b/src/lib/elementary/elm_flipselector_eo.legacy.h @@ -101,7 +101,7 @@ EAPI Elm_Widget_Item *elm_flipselector_selected_item_get(const Elm_Flipselector EAPI void elm_flipselector_first_interval_set(Elm_Flipselector *obj, double interval); /** - * @brief Get the interval on time updates for an user mouse button hold on a + * @brief Get the interval on time updates for a user mouse button hold on a * flip selector widget. * * See also @ref elm_flipselector_first_interval_set for more details. diff --git a/src/lib/elementary/elm_flipselector_item_eo.h b/src/lib/elementary/elm_flipselector_item_eo.h index ad156fe753..2a4059d069 100644 --- a/src/lib/elementary/elm_flipselector_item_eo.h +++ b/src/lib/elementary/elm_flipselector_item_eo.h @@ -19,7 +19,7 @@ typedef Eo Elm_Flipselector_Item; */ #define ELM_FLIPSELECTOR_ITEM_CLASS elm_flipselector_item_class_get() -EWAPI const Efl_Class *elm_flipselector_item_class_get(void); +EWAPI const Efl_Class *elm_flipselector_item_class_get(void) EINA_CONST; /** * @brief Set whether a given flip selector widget's item should be the diff --git a/src/lib/elementary/elm_focus_item.h b/src/lib/elementary/elm_focus_item.h index 71c068a12c..aff1dfbfdf 100644 --- a/src/lib/elementary/elm_focus_item.h +++ b/src/lib/elementary/elm_focus_item.h @@ -9,8 +9,8 @@ * The focused item can be unfocused with function * elm_object_item_focus_set(). * - * see @elm_object_item_focus_set() - * see @elm_object_item_focus_get() + * @see elm_object_item_focus_set() + * @see elm_object_item_focus_get() * * @ingroup Elm_Focus * @since 1.10 diff --git a/src/lib/elementary/elm_focus_legacy.c b/src/lib/elementary/elm_focus_legacy.c index c43fe6d8de..30f8c09e2c 100644 --- a/src/lib/elementary/elm_focus_legacy.c +++ b/src/lib/elementary/elm_focus_legacy.c @@ -51,12 +51,18 @@ _flush_manager(Efl_Ui_Widget *obj, Elm_Widget_Smart_Data *pd) manager = efl_ui_focus_object_focus_manager_get(obj); if (manager) { - Eina_List *order; + Eina_List *order = NULL; if (pd->legacy_focus.custom_chain) order = eina_list_clone(pd->legacy_focus.custom_chain); else - order = eina_list_clone(pd->subobjs); + { + for (unsigned int i = 0; i < eina_array_count(pd->children); ++i) + { + Eo *sobj = eina_array_data_get(pd->children, i); + order = eina_list_append(order, sobj); + } + } efl_ui_focus_manager_calc_update_order(manager, obj, order); } @@ -115,7 +121,7 @@ elm_object_focus_next_object_set(Evas_Object *obj, #define MAP(direction, field) if ((Efl_Ui_Focus_Direction)dir == EFL_UI_FOCUS_DIRECTION_ ##direction) pd->legacy_focus.field = next; MAPPING() #undef MAP - dir = efl_ui_focus_util_direction_complement(dir); + dir = (Elm_Focus_Direction)efl_ui_focus_util_direction_complement((Efl_Ui_Focus_Direction)dir); #define MAP(direction, field) if ((Efl_Ui_Focus_Direction)dir == EFL_UI_FOCUS_DIRECTION_ ##direction) next_pd->legacy_focus.field = obj; MAPPING() #undef MAP @@ -241,7 +247,7 @@ elm_object_focus_next(Evas_Object *obj, if (!legacy_target) { Eina_Array *old_chain = _focus_parent_chain_gen(logical); - Eina_Array *new_chain = _focus_parent_chain_gen(efl_ui_focus_manager_request_move(top, dir, NULL, EINA_FALSE)); + Eina_Array *new_chain = _focus_parent_chain_gen(efl_ui_focus_manager_request_move(top, (Efl_Ui_Focus_Direction)dir, NULL, EINA_FALSE)); //first pop off all elements that are the same while (eina_array_count(new_chain) > 0 && eina_array_count(old_chain) > 0 && @@ -280,7 +286,7 @@ elm_object_focus_next(Evas_Object *obj, } if (!legacy_focus_move) - o = efl_ui_focus_manager_move(top, dir); + o = efl_ui_focus_manager_move(top, (Efl_Ui_Focus_Direction)dir); if (!o) { if ((Efl_Ui_Focus_Direction)dir == EFL_UI_FOCUS_DIRECTION_NEXT || (Efl_Ui_Focus_Direction)dir == EFL_UI_FOCUS_DIRECTION_PREVIOUS) @@ -288,7 +294,7 @@ elm_object_focus_next(Evas_Object *obj, Efl_Ui_Focus_Object *root; root = efl_ui_focus_manager_root_get(top); - efl_ui_focus_manager_setup_on_first_touch(top, dir, root); + efl_ui_focus_manager_setup_on_first_touch(top, (Efl_Ui_Focus_Direction)dir, root); } } } @@ -304,7 +310,7 @@ elm_object_focus_next_object_get(const Evas_Object *obj, MAPPING() #undef MAP - return efl_ui_focus_manager_request_move(efl_ui_focus_util_active_manager(top), dir, NULL, EINA_FALSE); + return efl_ui_focus_manager_request_move(efl_ui_focus_util_active_manager(top), (Efl_Ui_Focus_Direction)dir, NULL, EINA_FALSE); } EAPI Elm_Object_Item * diff --git a/src/lib/elementary/elm_frame.h b/src/lib/elementary/elm_frame.h index 3ae891cb98..a5c3c921c0 100644 --- a/src/lib/elementary/elm_frame.h +++ b/src/lib/elementary/elm_frame.h @@ -1,5 +1,5 @@ /** - * @defgroup Elm_Frame Frame + * @defgroup Elm_Frame_Group Frame * @ingroup Elementary * * @image html frame_inheritance_tree.png @@ -22,11 +22,11 @@ * * Of all this styles only default shows the title. * - * This widget inherits from the @ref Layout one, so that all the + * This widget inherits from the @ref Elm_Layout one, so that all the * functions acting on it also work for frame objects. * * This widget emits the following signals, besides the ones sent from - * @ref Layout: + * @ref Elm_Layout : * - @c "clicked" - The user has clicked the frame's label * - @c "language,changed" - the program's language changed (since 1.9) * diff --git a/src/lib/elementary/elm_general.eot b/src/lib/elementary/elm_general.eot index 1d6bf4024c..4a8a928936 100644 --- a/src/lib/elementary/elm_general.eot +++ b/src/lib/elementary/elm_general.eot @@ -3,158 +3,3 @@ */ /* Legacy-only function pointer types, for the legacy EO classes (genlist, etc...) */ -type @beta Evas_Smart_Cb: __undefined_type; [[Evas smart callback type]] - -/* FIXME: Move to Efl.Ui namespace after Efl.Ui.List gets merged! */ -enum @beta @extern Elm.Object.Select_Mode -{ - [[Possible values for the #ELM_OBJECT_SELECT_MODE policy. - - @since 1.7 - ]] - default = 0, [[default select mode. Once an item is selected, it would stay - highlighted and not going to call selected callback again - even it was clicked. Items can get focus.]] - always, [[always select mode. Item selected callbacks will be called every - time for click events, even after the item was already selected. - Items can get focus.]] - none, [[no select mode. Items will never be highlighted and selected but - the size will be adjusted by the finger size configuration. Items - can't get focus.]] - display_only, [[no select mode with no finger size rule. Items will never - be highlighted and selected and ignore the finger size. So - the item size can be reduced below than the finger size - configuration. Items can't get focus.]] - max [[canary value: any value greater or equal to ELM_OBJECT_SELECT_MODE_MAX - is forbidden.]] -} - -enum @beta @extern Elm.Icon.Type -{ - [[Elementary icon types]] - legacy: elm_icon; - none, [[Icon has no type set]] - file, [[Icon is of type file]] - standard [[Icon is of type standard]] -} - -/* FIXME: shouldn't exist, they are unusable by the bindings */ -struct @beta @extern Elm.Entry_Anchor_Info; [[The info sent in the callback for the "anchor,clicked" signals emitted - by entries.]] -struct @beta @extern Elm.Entry_Anchor_Hover_Info; [[The info sent in the callback for "anchor,hover" signals emitted - by the Anchor_Hover widget]] - -enum @beta @extern Elm.Input.Panel.Layout -{ - [[Input panel (virtual keyboard) layout types. - Type of input panel (virtual keyboard) to use - this is a hint and may not provide exactly what is desired. - ]] - normal, [[Default layout.]] - number, [[Number layout.]] - email, [[Email layout.]] - url, [[URL layout.]] - phonenumber, [[Phone Number layout.]] - ip, [[IP layout.]] - month, [[Month layout.]] - numberonly, [[Number Only layout.]] - invalid, [[Never use this.]] - hex, [[Hexadecimal layout.]] - terminal, [[Command-line terminal layout including esc, alt, ctrl key, so on (no auto-correct, no auto-capitalization).]] - password, [[Like normal, but no auto-correct, no auto-capitalization etc.]] - datetime, [[Date and time layout - - @since 1.8]] - emoticon, [[Emoticon layout - - @since 1.10]] - voice [[Voice layout, but if the IME does not support voice layout, then normal layout will be shown. - - @since 1.19]] -} - -enum @beta @extern Elm.Input.Panel.Lang -{ - [[Input panel (virtual keyboard) language modes. - ]] - automatic, [[Automatic]] - alphabet [[Alphabet]] -} - -enum @beta @extern Elm.Autocapital.Type -{ - [[Autocapitalization Types. - Choose method of auto-capitalization. - ]] - none, [[No auto-capitalization when typing.]] - word, [[Autocapitalize each word typed.]] - sentence, [[Autocapitalize the start of each sentence.]] - allcharacter [[Autocapitalize all letters.]] -} - -enum @beta @extern Elm.Input.Panel.Return_Key.Type -{ - [["Return" Key types on the input panel (virtual keyboard). - ]] - default, [[Default.]] - done, [[Done.]] - go, [[Go.]] - join, [[Join.]] - login, [[Login.]] - next, [[Next.]] - search, [[Search string or magnifier icon.]] - send, [[Send.]] - signin [[Sign-in - - @since 1.8]] -} - -enum @beta @extern Elm.Input.Hints -{ - [[Enumeration that defines the types of Input Hints. - - @since 1.12 - ]] - legacy: elm_input_hint; - none = 0, [[No active hints - - @since 1.12]] - auto_complete = 1 << 0, [[Suggest word auto completion - - @since 1.12]] - sensitive_data = 1 << 1, [[Typed text should not be stored. - - @since 1.12]] - autofill_credit_card_expiration_date = 0x100, [[ Autofill hint for a credit card expiration date - - @since 1.21]] - autofill_credit_card_expiration_day = 0x200, [[Autofill hint for a credit card expiration day - - @since 1.21]] - autofill_credit_card_expiration_month = 0x300, [[ Autofill hint for a credit card expiration month - - @since 1.21]] - autofill_credit_card_expiration_year = 0x400, [[ Autofill hint for a credit card expiration year - - @since 1.21]] - autofill_credit_card_number = 0x500, [[ Autofill hint for a credit card number - - @since 1.21]] - autofill_email_address = 0x600, [[ Autofill hint for an email address - - @since 1.21]] - autofill_name = 0x700, [[ Autofill hint for a user's real name - - @since 1.21]] - autofill_phone = 0x800, [[ Autofill hint for a phone number - - @since 1.21]] - autofill_postal_address = 0x900, [[ Autofill hint for a postal address - - @since 1.21]] - autofill_postal_code = 0xA00, [[ Autofill hint for a postal code - - @since 1.21]] - autofill_id = 0xB00 [[ Autofill hint for a user's ID - - @since 1.21]] -} diff --git a/src/lib/elementary/elm_general.h b/src/lib/elementary/elm_general.h index 8bc0ba695a..b0708e11c3 100644 --- a/src/lib/elementary/elm_general.h +++ b/src/lib/elementary/elm_general.h @@ -23,7 +23,7 @@ // Legacy types #include "elm_general.eot.h" -/** Possible values for the #ELM_OBJECT_SELECT_MODE policy. +/** Possible values for the selection policy of some widgets. * * @since 1.7 * @@ -282,7 +282,7 @@ typedef enum * regardless of config settings */ } Elm_Policy_Throttle; -/** Possible values for the #ELM_OBJECT_MULTI_SELECT_MODE policy. +/** Possible values for the multi-selection policy of some widgets. * * @since 1.8 * @@ -291,7 +291,7 @@ typedef enum typedef enum { ELM_OBJECT_MULTI_SELECT_MODE_DEFAULT = 0, /**< default multiple select mode */ - ELM_OBJECT_MULTI_SELECT_MODE_WITH_CONTROL, /**< disallow mutiple selection + ELM_OBJECT_MULTI_SELECT_MODE_WITH_CONTROL, /**< disallow multiple selection * when clicked without control * key pressed */ ELM_OBJECT_MULTI_SELECT_MODE_MAX /**< canary value: any value greater or equal @@ -342,7 +342,7 @@ typedef enum /** Defines if the item is of any special type (has subitems or it's the index * of a group), or is just a simple item. * - * @ingroup Elm_Genlist_Item + * @ingroup Elm_Genlist_Item_Group */ typedef enum { @@ -359,7 +359,7 @@ typedef enum /** Defines the type of the item part Used while updating item's parts It can * be used at updating multi fields. * - * @ingroup Elm_Genlist_Item + * @ingroup Elm_Genlist_Item_Group */ typedef enum { @@ -371,7 +371,7 @@ typedef enum /** Defines where to position the item in the genlist. * - * @ingroup Elm_Genlist_Item + * @ingroup Elm_Genlist_Item_Group */ typedef enum { @@ -389,7 +389,7 @@ typedef enum /** Defines where to position the item in the genlist. * - * @ingroup Elm_Gengrid_Item + * @ingroup Elm_Gengrid_Item_Group */ typedef enum { @@ -407,7 +407,7 @@ typedef enum /** Defines the type of the item part Used while updating item's parts. It can * be used at updating multi fields. * - * @ingroup Elm_Gengrid_Item + * @ingroup Elm_Gengrid_Item_Group */ typedef enum { @@ -522,7 +522,7 @@ EAPI extern int ELM_EVENT_PROCESS_FOREGROUND; typedef Eina_Bool (*Elm_Event_Cb)(void *data, Evas_Object *obj, Evas_Object *src, Evas_Callback_Type type, void *event_info); /**< Function prototype definition for callbacks on input events happening on Elementary widgets. @a data will receive the user data pointer passed to elm_object_event_callback_add(). @a src will be a pointer to the widget on which the input event took place. @a type will get the type of this event and @a event_info, the struct with details on this event. */ -extern EAPI double _elm_startup_time; +EAPI extern double _elm_startup_time; #ifndef ELM_LIB_QUICKLAUNCH #define ELM_MAIN() int main(int argc, char **argv) { int ret__; _elm_startup_time = ecore_time_unix_get(); elm_init(argc, argv); ret__ = elm_main(argc, argv); elm_shutdown(); return ret__; } /**< macro to be used after the elm_main() function */ diff --git a/src/lib/elementary/elm_gengrid.c b/src/lib/elementary/elm_gengrid.c index 36206fd375..132b7aa14f 100644 --- a/src/lib/elementary/elm_gengrid.c +++ b/src/lib/elementary/elm_gengrid.c @@ -165,8 +165,10 @@ _item_cache_free(Item_Cache *itc) /* does not exist if cache item has just been reused */ if (itc->base_view) { + Evas_Object *view = itc->base_view; efl_wref_del(itc->base_view, &itc->base_view); - efl_del(itc->base_view); + efl_del(view); + itc->base_view = NULL; } eina_stringshare_del(itc->item_style); EINA_LIST_FREE(itc->contents, c) @@ -785,7 +787,7 @@ _item_mouse_move_cb(void *data, if ((it->dragging) && (it->down)) { ELM_SAFE_FREE(it->long_timer, ecore_timer_del); - efl_event_callback_legacy_call(WIDGET(it), EFL_UI_EVENT_DRAG, eo_it); + evas_object_smart_callback_call(WIDGET(it), "drag", eo_it); return; } @@ -834,17 +836,17 @@ _item_mouse_move_cb(void *data, if ((adx > minw) || (ady > minh)) { - const Efl_Event_Description *left_drag, *right_drag; + const char *left_drag, *right_drag; if (!efl_ui_mirrored_get(WIDGET(it))) { - left_drag = EFL_UI_EVENT_DRAG_START_LEFT; - right_drag = EFL_UI_EVENT_DRAG_START_RIGHT; + left_drag = "drag,start,left"; + right_drag = "drag,start,right"; } else { - left_drag = EFL_UI_EVENT_DRAG_START_RIGHT; - right_drag = EFL_UI_EVENT_DRAG_START_LEFT; + right_drag = "drag,start,left"; + left_drag = "drag,start,right"; } it->dragging = 1; @@ -858,25 +860,23 @@ _item_mouse_move_cb(void *data, if (dy < 0) { if (ady > adx) - efl_event_callback_legacy_call - (WIDGET(it), EFL_UI_EVENT_DRAG_START_UP, eo_it); + evas_object_smart_callback_call(WIDGET(it), "drag,start,up", eo_it); else { if (dx < 0) - efl_event_callback_legacy_call(WIDGET(it), left_drag, eo_it); + evas_object_smart_callback_call(WIDGET(it), left_drag, eo_it); } } else { if (ady > adx) - efl_event_callback_legacy_call - (WIDGET(it), EFL_UI_EVENT_DRAG_START_DOWN, eo_it); + evas_object_smart_callback_call(WIDGET(it), "drag,start,down", eo_it); else { if (dx < 0) - efl_event_callback_legacy_call(WIDGET(it), left_drag, eo_it); + evas_object_smart_callback_call(WIDGET(it), left_drag, eo_it); else - efl_event_callback_legacy_call(WIDGET(it), right_drag, eo_it); + evas_object_smart_callback_call(WIDGET(it), right_drag, eo_it); } } } @@ -1263,12 +1263,16 @@ _elm_gengrid_item_unrealize(Elm_Gen_Item *it, ELM_SAFE_FREE(it->states, elm_widget_stringlist_free); elm_wdg_item_track_cancel(EO_OBJ(it)); + if (!calc) + { + efl_event_callback_legacy_call(WIDGET(it), ELM_GENGRID_EVENT_UNREALIZED, EO_OBJ(it)); + if (it->base->func.unrealized) it->base->func.unrealized(EO_OBJ(it)); + } + it->unrealize_cb(it); it->realized = EINA_FALSE; it->want_unrealize = EINA_FALSE; - if (!calc) - efl_event_callback_legacy_call(WIDGET(it), ELM_GENGRID_EVENT_UNREALIZED, EO_OBJ(it)); { ELM_GENGRID_DATA_GET_FROM_ITEM(it, sd); @@ -1320,8 +1324,8 @@ _item_mouse_up_cb(void *data, if (it->dragging) { it->dragging = EINA_FALSE; - efl_event_callback_legacy_call - (WIDGET(it), EFL_UI_EVENT_DRAG_STOP, eo_it); + evas_object_smart_callback_call + (WIDGET(it), "drag,stop", eo_it); dragged = EINA_TRUE; } @@ -1495,7 +1499,10 @@ _item_unrealize_cb(Elm_Gen_Item *it) Evas_Object *c; if (!_item_cache_add(it, _content_cache_add(it, &cache))) { - ELM_SAFE_FREE(VIEW(it), evas_object_del); + Evas_Object *view = VIEW(it); + efl_wref_del(VIEW(it), &VIEW(it)); + ELM_SAFE_FREE(view, evas_object_del); + VIEW(it) = NULL; ELM_SAFE_FREE(it->spacer, evas_object_del); EINA_LIST_FREE(cache, c) evas_object_del(c); @@ -1971,6 +1978,7 @@ _item_place(Elm_Gen_Item *it, _elm_gengrid_item_index_update(it); efl_event_callback_legacy_call (WIDGET(it), ELM_GENGRID_EVENT_REALIZED, EO_OBJ(it)); + if (it->base->func.realized) it->base->func.realized(EO_OBJ(it)); _flush_focus_on_realization(WIDGET(it), it); } if (it->parent) @@ -2177,6 +2185,7 @@ _group_item_place(Elm_Gengrid_Pan_Data *psd) _elm_gengrid_item_index_update(it); efl_event_callback_legacy_call (WIDGET(it), ELM_GENGRID_EVENT_REALIZED, EO_OBJ(it)); + if (it->base->func.realized) it->base->func.realized(EO_OBJ(it)); _flush_focus_on_realization(WIDGET(it), it); } evas_object_geometry_set(VIEW(it), GG_IT(it)->gx, GG_IT(it)->gy, @@ -2840,6 +2849,7 @@ _item_move_cb(void *data, double pos) double frame = pos; Evas_Coord xx1, yy1, xx2, yy2; double dx, dy; + Eina_Bool ret = EINA_TRUE; switch (sd->reorder.tween_mode) { @@ -2901,10 +2911,11 @@ _item_move_cb(void *data, double pos) efl_event_callback_legacy_call (sd->obj, ELM_GENGRID_EVENT_MOVED, EO_OBJ(sd->reorder.it1)); sd->reorder.running = EINA_FALSE; + ret = EINA_FALSE; } _elm_widget_focus_highlight_start(sd->obj); - return EINA_TRUE; + return ret; } static void @@ -3449,7 +3460,11 @@ _key_action_select(Evas_Object *obj, const char *params) it->highlight_cb(it); it->sel_cb(it); } - else it->unsel_cb(it); + else + { + it->unhighlight_cb(it); + it->unsel_cb(it); + } } else { @@ -3989,7 +4004,7 @@ _item_select(Elm_Gen_Item *it) efl_access_state_changed_signal_emit(eo_it, EFL_ACCESS_STATE_TYPE_SELECTED, EINA_TRUE); } - efl_ref(eo_it); + efl_unref(eo_it); sd->walking--; if ((sd->clear_me) && (!sd->walking)) _internal_elm_gengrid_clear(WIDGET(it), EINA_TRUE); @@ -4045,7 +4060,7 @@ _elm_gengrid_item_new(Elm_Gengrid_Data *sd, GG_IT(it) = ELM_NEW(Elm_Gen_Item_Type); GG_IT(it)->wsd = sd; - /* for non homogenous items */ + /* for non homogeneous items */ it->item->w = sd->item_width; it->item->h = sd->item_height; @@ -4163,7 +4178,7 @@ _elm_gengrid_efl_canvas_group_group_add(Eo *obj, Elm_Gengrid_Data *priv) elm_interface_scrollable_extern_pan_set(obj, priv->pan_obj); - /* for non homogenous mode */ + /* for non homogeneous mode */ priv->custom_size_mode = EINA_FALSE; priv->custom_size_sum = NULL; priv->custom_tot_sum = NULL; @@ -4181,6 +4196,8 @@ _elm_gengrid_efl_canvas_group_group_del(Eo *obj, Elm_Gengrid_Data *sd) _item_cache_zero(sd); ecore_job_del(sd->calc_job); + eina_hash_free(sd->content_item_map); + efl_canvas_group_del(efl_super(obj, MY_CLASS)); } @@ -4453,7 +4470,7 @@ _elm_gengrid_align_set(Eo *obj EINA_UNUSED, Elm_Gengrid_Data *sd, double align_x align_y = 0.0; sd->align_y = align_y; - if ((old_h != sd->align_x) || (old_y != sd->align_y)) + if (!EINA_DBL_EQ(old_h, sd->align_x) || !EINA_DBL_EQ(old_y, sd->align_y)) evas_object_smart_calculate(sd->pan_obj); } diff --git a/src/lib/elementary/elm_gengrid.h b/src/lib/elementary/elm_gengrid.h index 9485b7781e..c45854e7ab 100644 --- a/src/lib/elementary/elm_gengrid.h +++ b/src/lib/elementary/elm_gengrid.h @@ -1,5 +1,5 @@ /** - * @defgroup Elm_Gengrid Gengrid (Generic grid) + * @defgroup Elm_Gengrid_Group Gengrid (Generic grid) * @ingroup Elementary * * @image html gengrid_inheritance_tree.png @@ -16,10 +16,10 @@ * view) or via the keyboard, navigating through item with the * arrow keys. * - * This widget inherits from the @ref Layout one, so that all the + * This widget inherits from the @ref Elm_Layout one, so that all the * functions acting on it also work for gengrid objects. * - * This widget implements the @b @ref elm-scrollable-interface + * This widget implements the @ref elm-scrollable-interface * interface, so that all (non-deprecated) functions for the base @ref * Scroller widget also work for gengrids. * @@ -162,7 +162,7 @@ * @section Gengrid_Smart_Events Gengrid smart events * * This widget emits the following signals, besides the ones sent from - * @ref Layout: + * @ref Elm_Layout : * - @c "activated" - The user has double-clicked or pressed * (enter|return|spacebar) on an item. The @p event_info parameter * is the gengrid item that was activated. @@ -271,7 +271,7 @@ */ /** - * @addtogroup Elm_Gengrid + * @addtogroup Elm_Gengrid_Group * @{ */ diff --git a/src/lib/elementary/elm_gengrid_common.h b/src/lib/elementary/elm_gengrid_common.h index cd08c037c6..1ce05dcae3 100644 --- a/src/lib/elementary/elm_gengrid_common.h +++ b/src/lib/elementary/elm_gengrid_common.h @@ -35,7 +35,7 @@ typedef Elm_Gen_Item_Del_Cb Elm_Gengrid_Item_Del_Cb; * @see elm_gengrid_item_class_free() * @see elm_gengrid_item_append() * - * @ingroup Elm_Gengrid + * @ingroup Elm_Gengrid_Group */ EAPI Elm_Gengrid_Item_Class *elm_gengrid_item_class_new(void); @@ -52,7 +52,7 @@ EAPI Elm_Gengrid_Item_Class *elm_gengrid_item_class_new(void); * @see elm_gengrid_item_class_ref() * @see elm_gengrid_item_class_unref() * - * @ingroup Elm_Gengrid + * @ingroup Elm_Gengrid_Group */ EAPI void elm_gengrid_item_class_free(Elm_Gengrid_Item_Class *itc); @@ -65,7 +65,7 @@ EAPI void elm_gengrid_item_class_free(Elm_Gengrid_Item_Class *itc); * * @see elm_gengrid_item_class_unref() * - * @ingroup Elm_Gengrid + * @ingroup Elm_Gengrid_Group */ EAPI void elm_gengrid_item_class_ref(Elm_Gengrid_Item_Class *itc); @@ -80,7 +80,7 @@ EAPI void elm_gengrid_item_class_ref(Elm_Gengrid_Item_Class *itc); * @see elm_gengrid_item_class_ref() * @see elm_gengrid_item_class_free() * - * @ingroup Elm_Gengrid + * @ingroup Elm_Gengrid_Group */ EAPI void elm_gengrid_item_class_unref(Elm_Gengrid_Item_Class *itc); @@ -99,7 +99,7 @@ EAPI void elm_gengrid_item_class_unref(Elm_Gengrid_Item_Class *itc); * In order to set a content or something else as a tooltip, look at * elm_gengrid_item_tooltip_content_cb_set(). * - * @ingroup Elm_Gengrid + * @ingroup Elm_Gengrid_Group */ EAPI void elm_gengrid_item_tooltip_text_set(Elm_Object_Item *it, const char *text); @@ -167,7 +167,7 @@ EAPI void elm_gengrid_item_tooltip_unset(Elm_Object_Ite * * @see elm_gengrid_item_tooltip_style_get() * - * @ingroup Elm_Gengrid + * @ingroup Elm_Gengrid_Group */ EAPI void elm_gengrid_item_tooltip_style_set(Elm_Object_Item *it, const char *style); @@ -181,7 +181,7 @@ EAPI void elm_gengrid_item_tooltip_style_set(Elm_Object * * @see elm_gengrid_item_tooltip_style_set() for more details * - * @ingroup Elm_Gengrid + * @ingroup Elm_Gengrid_Group */ EAPI const char *elm_gengrid_item_tooltip_style_get(const Elm_Object_Item *it); @@ -243,7 +243,7 @@ EAPI void elm_gengrid_item_cursor_set(Elm_Object_Item * * @see elm_gengrid_item_cursor_set() for more details * @see elm_gengrid_item_cursor_unset() * - * @ingroup Elm_Gengrid + * @ingroup Elm_Gengrid_Group */ EAPI const char *elm_gengrid_item_cursor_get(const Elm_Object_Item *it); @@ -260,7 +260,7 @@ EAPI const char *elm_gengrid_item_cursor_get(const Elm_Object_ * @see elm_object_cursor_unset() * @see elm_gengrid_item_cursor_set() for more details * - * @ingroup Elm_Gengrid + * @ingroup Elm_Gengrid_Group */ EAPI void elm_gengrid_item_cursor_unset(Elm_Object_Item *it); @@ -285,7 +285,7 @@ EAPI void elm_gengrid_item_cursor_unset(Elm_Object_Item * @see elm_gengrid_item_cursor_engine_only_set() * @see elm_gengrid_item_cursor_style_get() * - * @ingroup Elm_Gengrid + * @ingroup Elm_Gengrid_Group */ EAPI void elm_gengrid_item_cursor_style_set(Elm_Object_Item *it, const char *style); @@ -299,7 +299,7 @@ EAPI void elm_gengrid_item_cursor_style_set(Elm_Object_ * * @see elm_gengrid_item_cursor_style_set() for more details * - * @ingroup Elm_Gengrid + * @ingroup Elm_Gengrid_Group */ EAPI const char *elm_gengrid_item_cursor_style_get(const Elm_Object_Item *it); @@ -319,7 +319,7 @@ EAPI const char *elm_gengrid_item_cursor_style_get(const Elm_O * @note By default, cursors will only be looked for between those * provided by the rendering engine. * - * @ingroup Elm_Gengrid + * @ingroup Elm_Gengrid_Group */ EAPI void elm_gengrid_item_cursor_engine_only_set(Elm_Object_Item *it, Eina_Bool engine_only); @@ -335,7 +335,7 @@ EAPI void elm_gengrid_item_cursor_engine_only_set(Elm_O * * @see elm_gengrid_item_cursor_engine_only_set(), for more details * - * @ingroup Elm_Gengrid + * @ingroup Elm_Gengrid_Group */ EAPI Eina_Bool elm_gengrid_item_cursor_engine_only_get(const Elm_Object_Item *it); @@ -351,7 +351,7 @@ EAPI Eina_Bool elm_gengrid_item_cursor_engine_only_get(const * gengrid. For example, @c (0, 1) would stand for first row, * second column. * - * @ingroup Elm_Gengrid + * @ingroup Elm_Gengrid_Group */ EAPI void elm_gengrid_item_pos_get(const Elm_Object_Item *it, unsigned int *x, unsigned int *y); @@ -379,7 +379,7 @@ EAPI void elm_gengrid_item_pos_get(const Elm_Object_Ite * * @see elm_gengrid_item_select_mode_get() * - * @ingroup Elm_Gengrid + * @ingroup Elm_Gengrid_Group */ EAPI void elm_gengrid_item_select_mode_set(Elm_Object_Item *it, Elm_Object_Select_Mode mode); @@ -392,7 +392,7 @@ EAPI void elm_gengrid_item_select_mode_set(Elm_Object_I * * @see elm_gengrid_item_select_mode_set() * - * @ingroup Elm_Gengrid + * @ingroup Elm_Gengrid_Group */ EAPI Elm_Object_Select_Mode elm_gengrid_item_select_mode_get(const Elm_Object_Item *it); diff --git a/src/lib/elementary/elm_gengrid_eo.h b/src/lib/elementary/elm_gengrid_eo.h index 340a273cd8..040feaa069 100644 --- a/src/lib/elementary/elm_gengrid_eo.h +++ b/src/lib/elementary/elm_gengrid_eo.h @@ -13,7 +13,7 @@ typedef Eo Elm_Gengrid; /** Gengrid reorder modes * - * @ingroup Elm_Gengrid + * @ingroup Elm_Gengrid_Group */ typedef enum { @@ -25,11 +25,11 @@ typedef enum #endif /** Elementary gengrid class * - * @ingroup Elm_Gengrid + * @ingroup Elm_Gengrid_Group */ #define ELM_GENGRID_CLASS elm_gengrid_class_get() -EWAPI const Efl_Class *elm_gengrid_class_get(void); +EWAPI const Efl_Class *elm_gengrid_class_get(void) EINA_CONST; /** * @brief Set the items grid's alignment within a given gengrid widget. @@ -46,7 +46,7 @@ EWAPI const Efl_Class *elm_gengrid_class_get(void); * @param[in] align_x Alignment in the horizontal axis (0 <= align_x <= 1). * @param[in] align_y Alignment in the vertical axis (0 <= align_y <= 1). * - * @ingroup Elm_Gengrid + * @ingroup Elm_Gengrid_Group */ EOAPI void elm_obj_gengrid_align_set(Eo *obj, double align_x, double align_y); @@ -60,7 +60,7 @@ EOAPI void elm_obj_gengrid_align_set(Eo *obj, double align_x, double align_y); * @param[out] align_x Alignment in the horizontal axis (0 <= align_x <= 1). * @param[out] align_y Alignment in the vertical axis (0 <= align_y <= 1). * - * @ingroup Elm_Gengrid + * @ingroup Elm_Gengrid_Group */ EOAPI void elm_obj_gengrid_align_get(const Eo *obj, double *align_x, double *align_y); @@ -75,7 +75,7 @@ EOAPI void elm_obj_gengrid_align_get(const Eo *obj, double *align_x, double *ali * @param[in] obj The object. * @param[in] fill @c true if the grid is filled, @c false otherwise * - * @ingroup Elm_Gengrid + * @ingroup Elm_Gengrid_Group */ EOAPI void elm_obj_gengrid_filled_set(Eo *obj, Eina_Bool fill); @@ -89,7 +89,7 @@ EOAPI void elm_obj_gengrid_filled_set(Eo *obj, Eina_Bool fill); * * @return @c true if the grid is filled, @c false otherwise * - * @ingroup Elm_Gengrid + * @ingroup Elm_Gengrid_Group */ EOAPI Eina_Bool elm_obj_gengrid_filled_get(const Eo *obj); @@ -107,7 +107,7 @@ EOAPI Eina_Bool elm_obj_gengrid_filled_get(const Eo *obj); * @param[in] obj The object. * @param[in] multi @c true if multislect is enabled, @c false otherwise * - * @ingroup Elm_Gengrid + * @ingroup Elm_Gengrid_Group */ EOAPI void elm_obj_gengrid_multi_select_set(Eo *obj, Eina_Bool multi); @@ -119,7 +119,7 @@ EOAPI void elm_obj_gengrid_multi_select_set(Eo *obj, Eina_Bool multi); * * @return @c true if multislect is enabled, @c false otherwise * - * @ingroup Elm_Gengrid + * @ingroup Elm_Gengrid_Group */ EOAPI Eina_Bool elm_obj_gengrid_multi_select_get(const Eo *obj); @@ -135,7 +135,7 @@ EOAPI Eina_Bool elm_obj_gengrid_multi_select_get(const Eo *obj); * @param[in] w The group items' width. * @param[in] h The group items' height. * - * @ingroup Elm_Gengrid + * @ingroup Elm_Gengrid_Group */ EOAPI void elm_obj_gengrid_group_item_size_set(Eo *obj, int w, int h); @@ -149,7 +149,7 @@ EOAPI void elm_obj_gengrid_group_item_size_set(Eo *obj, int w, int h); * @param[out] w The group items' width. * @param[out] h The group items' height. * - * @ingroup Elm_Gengrid + * @ingroup Elm_Gengrid_Group */ EOAPI void elm_obj_gengrid_group_item_size_get(const Eo *obj, int *w, int *h); @@ -168,7 +168,7 @@ EOAPI void elm_obj_gengrid_group_item_size_get(const Eo *obj, int *w, int *h); * @param[in] obj The object. * @param[in] mode The select mode. * - * @ingroup Elm_Gengrid + * @ingroup Elm_Gengrid_Group */ EOAPI void elm_obj_gengrid_select_mode_set(Eo *obj, Elm_Object_Select_Mode mode); @@ -179,7 +179,7 @@ EOAPI void elm_obj_gengrid_select_mode_set(Eo *obj, Elm_Object_Select_Mode mode) * * @return The select mode. * - * @ingroup Elm_Gengrid + * @ingroup Elm_Gengrid_Group */ EOAPI Elm_Object_Select_Mode elm_obj_gengrid_select_mode_get(const Eo *obj); @@ -199,7 +199,7 @@ EOAPI Elm_Object_Select_Mode elm_obj_gengrid_select_mode_get(const Eo *obj); * @param[in] reorder_mode Use @c true to turn reordering on, @c false to turn * it off. * - * @ingroup Elm_Gengrid + * @ingroup Elm_Gengrid_Group */ EOAPI void elm_obj_gengrid_reorder_mode_set(Eo *obj, Eina_Bool reorder_mode); @@ -211,7 +211,7 @@ EOAPI void elm_obj_gengrid_reorder_mode_set(Eo *obj, Eina_Bool reorder_mode); * * @return Use @c true to turn reordering on, @c false to turn it off. * - * @ingroup Elm_Gengrid + * @ingroup Elm_Gengrid_Group */ EOAPI Eina_Bool elm_obj_gengrid_reorder_mode_get(const Eo *obj); @@ -222,7 +222,7 @@ EOAPI Eina_Bool elm_obj_gengrid_reorder_mode_get(const Eo *obj); * @param[in] obj The object. * @param[in] highlight @c true if item will be highlighted, @c false otherwise * - * @ingroup Elm_Gengrid + * @ingroup Elm_Gengrid_Group */ EOAPI void elm_obj_gengrid_highlight_mode_set(Eo *obj, Eina_Bool highlight); @@ -234,7 +234,7 @@ EOAPI void elm_obj_gengrid_highlight_mode_set(Eo *obj, Eina_Bool highlight); * * @return @c true if item will be highlighted, @c false otherwise * - * @ingroup Elm_Gengrid + * @ingroup Elm_Gengrid_Group */ EOAPI Eina_Bool elm_obj_gengrid_highlight_mode_get(const Eo *obj); @@ -246,7 +246,7 @@ EOAPI Eina_Bool elm_obj_gengrid_highlight_mode_get(const Eo *obj); * * @since 1.11 * - * @ingroup Elm_Gengrid + * @ingroup Elm_Gengrid_Group */ EOAPI void elm_obj_gengrid_reorder_type_set(Eo *obj, Elm_Gengrid_Reorder_Type type); @@ -262,7 +262,7 @@ EOAPI void elm_obj_gengrid_reorder_type_set(Eo *obj, Elm_Gengrid_Reorder_Type ty * @param[in] w The items' width. * @param[in] h The items' height. * - * @ingroup Elm_Gengrid + * @ingroup Elm_Gengrid_Group */ EOAPI void elm_obj_gengrid_item_size_set(Eo *obj, int w, int h); @@ -276,7 +276,7 @@ EOAPI void elm_obj_gengrid_item_size_set(Eo *obj, int w, int h); * @param[out] w The items' width. * @param[out] h The items' height. * - * @ingroup Elm_Gengrid + * @ingroup Elm_Gengrid_Group */ EOAPI void elm_obj_gengrid_item_size_get(const Eo *obj, int *w, int *h); @@ -294,7 +294,7 @@ EOAPI void elm_obj_gengrid_item_size_get(const Eo *obj, int *w, int *h); * * @since 1.8 * - * @ingroup Elm_Gengrid + * @ingroup Elm_Gengrid_Group */ EOAPI void elm_obj_gengrid_multi_select_mode_set(Eo *obj, Elm_Object_Multi_Select_Mode mode); @@ -309,7 +309,7 @@ EOAPI void elm_obj_gengrid_multi_select_mode_set(Eo *obj, Elm_Object_Multi_Selec * * @since 1.8 * - * @ingroup Elm_Gengrid + * @ingroup Elm_Gengrid_Group */ EOAPI Elm_Object_Multi_Select_Mode elm_obj_gengrid_multi_select_mode_get(const Eo *obj); @@ -330,7 +330,7 @@ EOAPI Elm_Object_Multi_Select_Mode elm_obj_gengrid_multi_select_mode_get(const E * @param[in] horizontal @c true to make the gengrid expand horizontally, * @c false to expand vertically. * - * @ingroup Elm_Gengrid + * @ingroup Elm_Gengrid_Group */ EOAPI void elm_obj_gengrid_horizontal_set(Eo *obj, Eina_Bool horizontal); @@ -343,7 +343,7 @@ EOAPI void elm_obj_gengrid_horizontal_set(Eo *obj, Eina_Bool horizontal); * @return @c true to make the gengrid expand horizontally, @c false to expand * vertically. * - * @ingroup Elm_Gengrid + * @ingroup Elm_Gengrid_Group */ EOAPI Eina_Bool elm_obj_gengrid_horizontal_get(const Eo *obj); @@ -360,7 +360,7 @@ EOAPI Eina_Bool elm_obj_gengrid_horizontal_get(const Eo *obj); * @return The selected item's handle or @c null if none is selected at the * moment (and on errors). * - * @ingroup Elm_Gengrid + * @ingroup Elm_Gengrid_Group */ EOAPI Elm_Widget_Item *elm_obj_gengrid_selected_item_get(const Eo *obj); @@ -376,7 +376,7 @@ EOAPI Elm_Widget_Item *elm_obj_gengrid_selected_item_get(const Eo *obj); * * @return The list of realized items or @c null if none are realized. * - * @ingroup Elm_Gengrid + * @ingroup Elm_Gengrid_Group */ EOAPI Eina_List *elm_obj_gengrid_realized_items_get(const Eo *obj) EINA_WARN_UNUSED_RESULT; @@ -390,7 +390,7 @@ EOAPI Eina_List *elm_obj_gengrid_realized_items_get(const Eo *obj) EINA_WARN_UNU * @return The first item's handle or @c null, if there are no items in @c obj * (and on errors) * - * @ingroup Elm_Gengrid + * @ingroup Elm_Gengrid_Group */ EOAPI Elm_Widget_Item *elm_obj_gengrid_first_item_get(const Eo *obj); @@ -407,7 +407,7 @@ EOAPI Elm_Widget_Item *elm_obj_gengrid_first_item_get(const Eo *obj); * @return The list of selected items or @c null, if none is selected at the * moment (and on errors). * - * @ingroup Elm_Gengrid + * @ingroup Elm_Gengrid_Group */ EOAPI const Eina_List *elm_obj_gengrid_selected_items_get(const Eo *obj); @@ -421,7 +421,7 @@ EOAPI const Eina_List *elm_obj_gengrid_selected_items_get(const Eo *obj); * @return The last item's handle or @c null if there are no items in @c obj * (and on errors). * - * @ingroup Elm_Gengrid + * @ingroup Elm_Gengrid_Group */ EOAPI Elm_Widget_Item *elm_obj_gengrid_last_item_get(const Eo *obj); @@ -439,7 +439,7 @@ EOAPI Elm_Widget_Item *elm_obj_gengrid_last_item_get(const Eo *obj); * * @return A handle to the item added or @c null on errors. * - * @ingroup Elm_Gengrid + * @ingroup Elm_Gengrid_Group */ EOAPI Elm_Widget_Item *elm_obj_gengrid_item_insert_before(Eo *obj, const Elm_Gengrid_Item_Class *itc, const void *data, Elm_Widget_Item *relative, Evas_Smart_Cb func, const void *func_data); @@ -453,7 +453,7 @@ EOAPI Elm_Widget_Item *elm_obj_gengrid_item_insert_before(Eo *obj, const Elm_Gen * To update just one item, use @ref elm_gengrid_item_update. * @param[in] obj The object. * - * @ingroup Elm_Gengrid + * @ingroup Elm_Gengrid_Group */ EOAPI void elm_obj_gengrid_realized_items_update(Eo *obj); @@ -471,7 +471,7 @@ EOAPI void elm_obj_gengrid_realized_items_update(Eo *obj); * * @return A handle to the item added or @c null on error. * - * @ingroup Elm_Gengrid + * @ingroup Elm_Gengrid_Group */ EOAPI Elm_Widget_Item *elm_obj_gengrid_item_insert_after(Eo *obj, const Elm_Gengrid_Item_Class *itc, const void *data, Elm_Widget_Item *relative, Evas_Smart_Cb func, const void *func_data); @@ -484,7 +484,7 @@ EOAPI Elm_Widget_Item *elm_obj_gengrid_item_insert_after(Eo *obj, const Elm_Geng * * @return Items in list * - * @ingroup Elm_Gengrid + * @ingroup Elm_Gengrid_Group */ EOAPI unsigned int elm_obj_gengrid_items_count(const Eo *obj); @@ -512,7 +512,7 @@ EOAPI unsigned int elm_obj_gengrid_items_count(const Eo *obj); * * @return The item at the coordinates or @c null if none. * - * @ingroup Elm_Gengrid + * @ingroup Elm_Gengrid_Group */ EOAPI Elm_Widget_Item *elm_obj_gengrid_at_xy_item_get(const Eo *obj, int x, int y, int *xposret, int *yposret); @@ -529,7 +529,7 @@ EOAPI Elm_Widget_Item *elm_obj_gengrid_at_xy_item_get(const Eo *obj, int x, int * * @return A handle to the item added or @c null on errors. * - * @ingroup Elm_Gengrid + * @ingroup Elm_Gengrid_Group */ EOAPI Elm_Widget_Item *elm_obj_gengrid_item_append(Eo *obj, const Elm_Gengrid_Item_Class *itc, const void *data, Evas_Smart_Cb func, const void *func_data); @@ -546,7 +546,7 @@ EOAPI Elm_Widget_Item *elm_obj_gengrid_item_append(Eo *obj, const Elm_Gengrid_It * * @return A handle to the item added or @c null on errors. * - * @ingroup Elm_Gengrid + * @ingroup Elm_Gengrid_Group */ EOAPI Elm_Widget_Item *elm_obj_gengrid_item_prepend(Eo *obj, const Elm_Gengrid_Item_Class *itc, const void *data, Evas_Smart_Cb func, const void *func_data); @@ -558,7 +558,7 @@ EOAPI Elm_Widget_Item *elm_obj_gengrid_item_prepend(Eo *obj, const Elm_Gengrid_I * See @ref elm_gengrid_item_del to remove just one item. * @param[in] obj The object. * - * @ingroup Elm_Gengrid + * @ingroup Elm_Gengrid_Group */ EOAPI void elm_obj_gengrid_clear(Eo *obj); @@ -580,7 +580,7 @@ EOAPI void elm_obj_gengrid_clear(Eo *obj); * * @return A handle to the item added or @c null on errors. * - * @ingroup Elm_Gengrid + * @ingroup Elm_Gengrid_Group */ EOAPI Elm_Widget_Item *elm_obj_gengrid_item_sorted_insert(Eo *obj, const Elm_Gengrid_Item_Class *itc, const void *data, Eina_Compare_Cb comp, Evas_Smart_Cb func, const void *func_data); @@ -607,7 +607,7 @@ EOAPI Elm_Widget_Item *elm_obj_gengrid_item_sorted_insert(Eo *obj, const Elm_Gen * * @since 1.11 * - * @ingroup Elm_Gengrid + * @ingroup Elm_Gengrid_Group */ EOAPI Elm_Widget_Item *elm_obj_gengrid_search_by_text_item_get(Eo *obj, Elm_Widget_Item *item_to_search_from, const char *part_name, const char *pattern, Elm_Glob_Match_Flags flags); @@ -619,7 +619,7 @@ EOAPI Elm_Widget_Item *elm_obj_gengrid_search_by_text_item_get(Eo *obj, Elm_Widg * * @since 1.10 * - * @ingroup Elm_Gengrid + * @ingroup Elm_Gengrid_Group */ EOAPI void elm_obj_gengrid_reorder_mode_start(Eo *obj, Ecore_Pos_Map tween_mode); @@ -627,7 +627,7 @@ EOAPI void elm_obj_gengrid_reorder_mode_start(Eo *obj, Ecore_Pos_Map tween_mode) * * @since 1.10 * - * @ingroup Elm_Gengrid + * @ingroup Elm_Gengrid_Group */ EOAPI void elm_obj_gengrid_reorder_mode_stop(Eo *obj); @@ -636,7 +636,7 @@ EWAPI extern const Efl_Event_Description _ELM_GENGRID_EVENT_REALIZED; /** Called when gengrid realized * @return Efl_Object * * - * @ingroup Elm_Gengrid + * @ingroup Elm_Gengrid_Group */ #define ELM_GENGRID_EVENT_REALIZED (&(_ELM_GENGRID_EVENT_REALIZED)) @@ -645,7 +645,7 @@ EWAPI extern const Efl_Event_Description _ELM_GENGRID_EVENT_UNREALIZED; /** Called when gengrid unrealized * @return Efl_Object * * - * @ingroup Elm_Gengrid + * @ingroup Elm_Gengrid_Group */ #define ELM_GENGRID_EVENT_UNREALIZED (&(_ELM_GENGRID_EVENT_UNREALIZED)) @@ -654,7 +654,7 @@ EWAPI extern const Efl_Event_Description _ELM_GENGRID_EVENT_INDEX_UPDATE; /** Called on gengrid index update * @return Efl_Object * * - * @ingroup Elm_Gengrid + * @ingroup Elm_Gengrid_Group */ #define ELM_GENGRID_EVENT_INDEX_UPDATE (&(_ELM_GENGRID_EVENT_INDEX_UPDATE)) @@ -662,7 +662,7 @@ EWAPI extern const Efl_Event_Description _ELM_GENGRID_EVENT_SCROLL_PAGE_CHANGED; /** Called when scroll page changed * - * @ingroup Elm_Gengrid + * @ingroup Elm_Gengrid_Group */ #define ELM_GENGRID_EVENT_SCROLL_PAGE_CHANGED (&(_ELM_GENGRID_EVENT_SCROLL_PAGE_CHANGED)) @@ -670,7 +670,7 @@ EWAPI extern const Efl_Event_Description _ELM_GENGRID_EVENT_EDGE_BOTTOM; /** Called when bottom edge is reached * - * @ingroup Elm_Gengrid + * @ingroup Elm_Gengrid_Group */ #define ELM_GENGRID_EVENT_EDGE_BOTTOM (&(_ELM_GENGRID_EVENT_EDGE_BOTTOM)) @@ -678,7 +678,7 @@ EWAPI extern const Efl_Event_Description _ELM_GENGRID_EVENT_EDGE_TOP; /** Called when top edge is reached * - * @ingroup Elm_Gengrid + * @ingroup Elm_Gengrid_Group */ #define ELM_GENGRID_EVENT_EDGE_TOP (&(_ELM_GENGRID_EVENT_EDGE_TOP)) @@ -686,7 +686,7 @@ EWAPI extern const Efl_Event_Description _ELM_GENGRID_EVENT_EDGE_RIGHT; /** Called when right edge is reached * - * @ingroup Elm_Gengrid + * @ingroup Elm_Gengrid_Group */ #define ELM_GENGRID_EVENT_EDGE_RIGHT (&(_ELM_GENGRID_EVENT_EDGE_RIGHT)) @@ -694,7 +694,7 @@ EWAPI extern const Efl_Event_Description _ELM_GENGRID_EVENT_EDGE_LEFT; /** Called when left edge is reached * - * @ingroup Elm_Gengrid + * @ingroup Elm_Gengrid_Group */ #define ELM_GENGRID_EVENT_EDGE_LEFT (&(_ELM_GENGRID_EVENT_EDGE_LEFT)) @@ -703,7 +703,7 @@ EWAPI extern const Efl_Event_Description _ELM_GENGRID_EVENT_ITEM_FOCUSED; /** Called when item got focus * @return Efl_Object * * - * @ingroup Elm_Gengrid + * @ingroup Elm_Gengrid_Group */ #define ELM_GENGRID_EVENT_ITEM_FOCUSED (&(_ELM_GENGRID_EVENT_ITEM_FOCUSED)) @@ -712,7 +712,7 @@ EWAPI extern const Efl_Event_Description _ELM_GENGRID_EVENT_ITEM_UNFOCUSED; /** Called when item no longer has focus * @return Efl_Object * * - * @ingroup Elm_Gengrid + * @ingroup Elm_Gengrid_Group */ #define ELM_GENGRID_EVENT_ITEM_UNFOCUSED (&(_ELM_GENGRID_EVENT_ITEM_UNFOCUSED)) @@ -721,7 +721,7 @@ EWAPI extern const Efl_Event_Description _ELM_GENGRID_EVENT_ITEM_REORDER_ANIM_ST /** Called when item reorder animation started * @return Efl_Object * * - * @ingroup Elm_Gengrid + * @ingroup Elm_Gengrid_Group */ #define ELM_GENGRID_EVENT_ITEM_REORDER_ANIM_START (&(_ELM_GENGRID_EVENT_ITEM_REORDER_ANIM_START)) @@ -730,7 +730,7 @@ EWAPI extern const Efl_Event_Description _ELM_GENGRID_EVENT_ITEM_REORDER_ANIM_ST /** Called when item reorder animation stopped * @return Efl_Object * * - * @ingroup Elm_Gengrid + * @ingroup Elm_Gengrid_Group */ #define ELM_GENGRID_EVENT_ITEM_REORDER_ANIM_STOP (&(_ELM_GENGRID_EVENT_ITEM_REORDER_ANIM_STOP)) @@ -739,7 +739,7 @@ EWAPI extern const Efl_Event_Description _ELM_GENGRID_EVENT_ACTIVATED; /** Called when gengrid got activated * @return Efl_Object * * - * @ingroup Elm_Gengrid + * @ingroup Elm_Gengrid_Group */ #define ELM_GENGRID_EVENT_ACTIVATED (&(_ELM_GENGRID_EVENT_ACTIVATED)) @@ -748,7 +748,7 @@ EWAPI extern const Efl_Event_Description _ELM_GENGRID_EVENT_HIGHLIGHTED; /** Called when gengrid is highlighted * @return Efl_Object * * - * @ingroup Elm_Gengrid + * @ingroup Elm_Gengrid_Group */ #define ELM_GENGRID_EVENT_HIGHLIGHTED (&(_ELM_GENGRID_EVENT_HIGHLIGHTED)) @@ -757,7 +757,7 @@ EWAPI extern const Efl_Event_Description _ELM_GENGRID_EVENT_UNHIGHLIGHTED; /** Called when gengrid is no longer highlighted * @return Efl_Object * * - * @ingroup Elm_Gengrid + * @ingroup Elm_Gengrid_Group */ #define ELM_GENGRID_EVENT_UNHIGHLIGHTED (&(_ELM_GENGRID_EVENT_UNHIGHLIGHTED)) @@ -766,7 +766,7 @@ EWAPI extern const Efl_Event_Description _ELM_GENGRID_EVENT_RELEASED; /** Called when gengrid is released * @return Efl_Object * * - * @ingroup Elm_Gengrid + * @ingroup Elm_Gengrid_Group */ #define ELM_GENGRID_EVENT_RELEASED (&(_ELM_GENGRID_EVENT_RELEASED)) @@ -775,7 +775,7 @@ EWAPI extern const Efl_Event_Description _ELM_GENGRID_EVENT_MOVED; /** Called when gengrid item moved * @return Efl_Object * * - * @ingroup Elm_Gengrid + * @ingroup Elm_Gengrid_Group */ #define ELM_GENGRID_EVENT_MOVED (&(_ELM_GENGRID_EVENT_MOVED)) diff --git a/src/lib/elementary/elm_gengrid_eo.legacy.h b/src/lib/elementary/elm_gengrid_eo.legacy.h index b454ac0653..e069502d68 100644 --- a/src/lib/elementary/elm_gengrid_eo.legacy.h +++ b/src/lib/elementary/elm_gengrid_eo.legacy.h @@ -13,7 +13,7 @@ typedef Eo Elm_Gengrid; /** Gengrid reorder modes * - * @ingroup Elm_Gengrid + * @ingroup Elm_Gengrid_Group */ typedef enum { diff --git a/src/lib/elementary/elm_gengrid_item_eo.h b/src/lib/elementary/elm_gengrid_item_eo.h index b11d264b81..d386de11af 100644 --- a/src/lib/elementary/elm_gengrid_item_eo.h +++ b/src/lib/elementary/elm_gengrid_item_eo.h @@ -13,13 +13,21 @@ typedef Eo Elm_Gengrid_Item; #endif -/** Elementary gengrid item class +/** + * Elementary gengrid item class + * + * @defgroup Elm_Gengrid_Item_Group Gengrid Item + * @ingroup Elm_Gengrid_Group + */ + +/** + * @brief Get gengrid item class * - * @ingroup Elm_Gengrid_Item + * @ingroup Elm_Gengrid_Item_Group */ #define ELM_GENGRID_ITEM_CLASS elm_gengrid_item_class_get() -EWAPI const Efl_Class *elm_gengrid_item_class_get(void); +EWAPI const Efl_Class *elm_gengrid_item_class_get(void) EINA_CONST; /** * @brief Get the previous item in a gengrid widget's internal list of items, @@ -31,7 +39,7 @@ EWAPI const Efl_Class *elm_gengrid_item_class_get(void); * * @return The item before @c item, or @c NULL if there's none (and on errors) * - * @ingroup Elm_Gengrid_Item + * @ingroup Elm_Gengrid_Item_Group */ EOAPI Elm_Widget_Item *elm_obj_gengrid_item_prev_get(const Eo *obj); @@ -45,7 +53,7 @@ EOAPI Elm_Widget_Item *elm_obj_gengrid_item_prev_get(const Eo *obj); * * @return The item after @c item, or @c NULL if there's none (and on errors) * - * @ingroup Elm_Gengrid_Item + * @ingroup Elm_Gengrid_Item_Group */ EOAPI Elm_Widget_Item *elm_obj_gengrid_item_next_get(const Eo *obj); @@ -63,7 +71,7 @@ EOAPI Elm_Widget_Item *elm_obj_gengrid_item_next_get(const Eo *obj); * @param[in] selected The selected state ($true selected, @c false not * selected) * - * @ingroup Elm_Gengrid_Item + * @ingroup Elm_Gengrid_Item_Group */ EOAPI void elm_obj_gengrid_item_selected_set(Eo *obj, Eina_Bool selected); @@ -81,7 +89,7 @@ EOAPI void elm_obj_gengrid_item_selected_set(Eo *obj, Eina_Bool selected); * * @return The selected state ($true selected, @c false not selected) * - * @ingroup Elm_Gengrid_Item + * @ingroup Elm_Gengrid_Item_Group */ EOAPI Eina_Bool elm_obj_gengrid_item_selected_get(const Eo *obj); @@ -95,7 +103,7 @@ EOAPI Eina_Bool elm_obj_gengrid_item_selected_get(const Eo *obj); * * @return Gengrid Item class for the given item * - * @ingroup Elm_Gengrid_Item + * @ingroup Elm_Gengrid_Item_Group */ EOAPI const Elm_Gengrid_Item_Class *elm_obj_gengrid_item_class_get(const Eo *obj); @@ -106,7 +114,7 @@ EOAPI const Elm_Gengrid_Item_Class *elm_obj_gengrid_item_class_get(const Eo *obj * * @return The position inside the list of item. * - * @ingroup Elm_Gengrid_Item + * @ingroup Elm_Gengrid_Item_Group */ EOAPI int elm_obj_gengrid_item_index_get(const Eo *obj); @@ -121,7 +129,7 @@ EOAPI int elm_obj_gengrid_item_index_get(const Eo *obj); * @param[out] x Pointer to variable to store the item's <b>row number</b>. * @param[out] y Pointer to variable to store the item's <b>column number</b>. * - * @ingroup Elm_Gengrid_Item + * @ingroup Elm_Gengrid_Item_Group */ EOAPI void elm_obj_gengrid_item_pos_get(const Eo *obj, unsigned int *x, unsigned int *y); @@ -147,7 +155,7 @@ EOAPI void elm_obj_gengrid_item_pos_get(const Eo *obj, unsigned int *x, unsigned * @param[in] obj The object. * @param[in] mode The selected mode * - * @ingroup Elm_Gengrid_Item + * @ingroup Elm_Gengrid_Item_Group */ EOAPI void elm_obj_gengrid_item_select_mode_set(Eo *obj, Elm_Object_Select_Mode mode); @@ -174,7 +182,7 @@ EOAPI void elm_obj_gengrid_item_select_mode_set(Eo *obj, Elm_Object_Select_Mode * * @return The selected mode * - * @ingroup Elm_Gengrid_Item + * @ingroup Elm_Gengrid_Item_Group */ EOAPI Elm_Object_Select_Mode elm_obj_gengrid_item_select_mode_get(const Eo *obj); @@ -196,7 +204,7 @@ EOAPI Elm_Object_Select_Mode elm_obj_gengrid_item_select_mode_get(const Eo *obj) * * @since 1.19 * - * @ingroup Elm_Gengrid_Item + * @ingroup Elm_Gengrid_Item_Group */ EOAPI void elm_obj_gengrid_item_custom_size_set(Eo *obj, int w, int h); @@ -215,7 +223,7 @@ EOAPI void elm_obj_gengrid_item_custom_size_set(Eo *obj, int w, int h); * * @since 1.19 * - * @ingroup Elm_Gengrid_Item + * @ingroup Elm_Gengrid_Item_Group */ EOAPI void elm_obj_gengrid_item_custom_size_get(const Eo *obj, int *w, int *h); @@ -229,7 +237,7 @@ EOAPI void elm_obj_gengrid_item_custom_size_get(const Eo *obj, int *w, int *h); * @param[in] obj The object. * @param[in] type Where to position the item in the viewport. * - * @ingroup Elm_Gengrid_Item + * @ingroup Elm_Gengrid_Item_Group */ EOAPI void elm_obj_gengrid_item_show(Eo *obj, Elm_Gengrid_Item_Scrollto_Type type); @@ -244,7 +252,7 @@ EOAPI void elm_obj_gengrid_item_show(Eo *obj, Elm_Gengrid_Item_Scrollto_Type typ * @param[in] obj The object. * @param[in] type Where to position the item in the viewport. * - * @ingroup Elm_Gengrid_Item + * @ingroup Elm_Gengrid_Item_Group */ EOAPI void elm_obj_gengrid_item_bring_in(Eo *obj, Elm_Gengrid_Item_Scrollto_Type type); @@ -256,7 +264,7 @@ EOAPI void elm_obj_gengrid_item_bring_in(Eo *obj, Elm_Gengrid_Item_Scrollto_Type * changed and you want the changes to be reflected. * @param[in] obj The object. * - * @ingroup Elm_Gengrid_Item + * @ingroup Elm_Gengrid_Item_Group */ EOAPI void elm_obj_gengrid_item_update(Eo *obj); @@ -277,7 +285,7 @@ EOAPI void elm_obj_gengrid_item_update(Eo *obj); * * @since 1.15 * - * @ingroup Elm_Gengrid_Item + * @ingroup Elm_Gengrid_Item_Group */ EOAPI void elm_obj_gengrid_item_fields_update(Eo *obj, const char *parts, Elm_Gengrid_Item_Field_Type itf); @@ -292,7 +300,7 @@ EOAPI void elm_obj_gengrid_item_fields_update(Eo *obj, const char *parts, Elm_Ge * @param[in] itc The gengrid item class describing the function pointers and * the item style. * - * @ingroup Elm_Gengrid_Item + * @ingroup Elm_Gengrid_Item_Group */ EOAPI void elm_obj_gengrid_item_class_update(Eo *obj, const Elm_Gengrid_Item_Class *itc); @@ -308,7 +316,7 @@ EOAPI void elm_obj_gengrid_item_class_update(Eo *obj, const Elm_Gengrid_Item_Cla * * @since 1.18 * - * @ingroup Elm_Gengrid_Item + * @ingroup Elm_Gengrid_Item_Group */ EOAPI void elm_obj_gengrid_item_all_contents_unset(Eo *obj, Eina_List **l); diff --git a/src/lib/elementary/elm_gengrid_item_eo.legacy.h b/src/lib/elementary/elm_gengrid_item_eo.legacy.h index 01f1a634db..e8c6eea0a6 100644 --- a/src/lib/elementary/elm_gengrid_item_eo.legacy.h +++ b/src/lib/elementary/elm_gengrid_item_eo.legacy.h @@ -15,6 +15,11 @@ typedef Eo Elm_Gengrid_Item; #endif /** + * @defgroup Elm_Gengrid_Item_Group Gengrid Item + * @ingroup Elm_Gengrid_Group + */ + +/** * @brief Get the previous item in a gengrid widget's internal list of items, * given a handle to one of those items. * diff --git a/src/lib/elementary/elm_gengrid_legacy.h b/src/lib/elementary/elm_gengrid_legacy.h index 720563b896..492537e8e3 100644 --- a/src/lib/elementary/elm_gengrid_legacy.h +++ b/src/lib/elementary/elm_gengrid_legacy.h @@ -14,7 +14,7 @@ * @see elm_object_item_del() * @see elm_gengrid_clear() * - * @ingroup Elm_Gengrid + * @ingroup Elm_Gengrid_Group */ EAPI Evas_Object *elm_gengrid_add(Evas_Object *parent); @@ -28,7 +28,7 @@ EAPI Evas_Object *elm_gengrid_add(Evas_Object *parent); * @return The item stored in @p obj at position @p nth or @c NULL, if there's * no item with that index (and on errors) * - * @ingroup Genilst + * @ingroup Elm_Gengrid_Group * @since 1.8 */ EAPI Elm_Object_Item *elm_gengrid_nth_item_get(const Evas_Object *obj, unsigned int nth); @@ -80,7 +80,7 @@ EINA_DEPRECATED EAPI void elm_gengrid_page_show(const E * * @see elm_gengrid_scroller_policy_get() * - * @ingroup Elm_Gengrid + * @ingroup Elm_Gengrid_Group */ EINA_DEPRECATED EAPI void elm_gengrid_scroller_policy_set(Evas_Object *obj, Elm_Scroller_Policy policy_h, Elm_Scroller_Policy policy_v); @@ -97,7 +97,7 @@ EINA_DEPRECATED EAPI void elm_gengrid_scroller_policy_set(Evas_Object * * * @see elm_gengrid_scroller_policy_set() * - * @ingroup Elm_Gengrid + * @ingroup Elm_Gengrid_Group */ EINA_DEPRECATED EAPI void elm_gengrid_scroller_policy_get(const Evas_Object *obj, Elm_Scroller_Policy *policy_h, Elm_Scroller_Policy *policy_v); @@ -121,7 +121,7 @@ EINA_DEPRECATED EAPI void elm_gengrid_scroller_policy_get(const Evas_Ob * * @see elm_scroller_bounce_set() * - * @ingroup Elm_Gengrid + * @ingroup Elm_Gengrid_Group */ EINA_DEPRECATED EAPI void elm_gengrid_bounce_set(Evas_Object *obj, Eina_Bool h_bounce, Eina_Bool v_bounce); @@ -139,7 +139,7 @@ EINA_DEPRECATED EAPI void elm_gengrid_bounce_set(Evas_Object *obj, Eina * * @see elm_scroller_bounce_get() * - * @ingroup Elm_Gengrid + * @ingroup Elm_Gengrid_Group */ EINA_DEPRECATED EAPI void elm_gengrid_bounce_get(const Evas_Object *obj, Eina_Bool *h_bounce, Eina_Bool *v_bounce); @@ -218,7 +218,7 @@ EINA_DEPRECATED EAPI void elm_gengrid_page_bring_in(const Evas_Object * * @param[in] h_pagesize Page size horizontal * @param[in] v_pagesize Page size vertical * - * @ingroup Elm_Gengrid + * @ingroup Elm_Gengrid_Group */ EAPI void elm_gengrid_page_size_set(Evas_Object *obj, int h_pagesize, int v_pagesize); @@ -230,7 +230,7 @@ EAPI void elm_gengrid_page_size_set(Evas_Object *obj, int h_pagesize, int v_page * @param[in] h_pagerel Page relation horizontal * @param[in] v_pagerel Page relation vertical * - * @ingroup Elm_Gengrid + * @ingroup Elm_Gengrid_Group */ EAPI void elm_gengrid_page_relative_set(Evas_Object *obj, double h_pagerel, double v_pagerel); @@ -242,7 +242,7 @@ EAPI void elm_gengrid_page_relative_set(Evas_Object *obj, double h_pagerel, doub * @param[out] h_pagerel Page relation horizontal * @param[out] v_pagerel Page relation vertical * - * @ingroup Elm_Gengrid + * @ingroup Elm_Gengrid_Group */ EAPI void elm_gengrid_page_relative_get(const Evas_Object *obj, double *h_pagerel, double *v_pagerel); @@ -258,7 +258,7 @@ EAPI void elm_gengrid_page_relative_get(const Evas_Object *obj, double *h_pagere * @param[in] disabled Use @c true to disable mouse wheel or @c false to enable * it. * - * @ingroup Elm_Gengrid + * @ingroup Elm_Gengrid_Group */ EAPI void elm_gengrid_wheel_disabled_set(Evas_Object *obj, Eina_Bool disabled); @@ -271,7 +271,7 @@ EAPI void elm_gengrid_wheel_disabled_set(Evas_Object *obj, Eina_Bool disabled); * * @return Use @c true to disable mouse wheel or @c false to enable it. * - * @ingroup Elm_Gengrid + * @ingroup Elm_Gengrid_Group */ EAPI Eina_Bool elm_gengrid_wheel_disabled_get(const Evas_Object *obj); diff --git a/src/lib/elementary/elm_gengrid_pan_eo.h b/src/lib/elementary/elm_gengrid_pan_eo.h index 277f40676d..39778b645b 100644 --- a/src/lib/elementary/elm_gengrid_pan_eo.h +++ b/src/lib/elementary/elm_gengrid_pan_eo.h @@ -19,6 +19,6 @@ typedef Eo Elm_Gengrid_Pan; */ #define ELM_GENGRID_PAN_CLASS elm_gengrid_pan_class_get() -EWAPI const Efl_Class *elm_gengrid_pan_class_get(void); +EWAPI const Efl_Class *elm_gengrid_pan_class_get(void) EINA_CONST; #endif diff --git a/src/lib/elementary/elm_genlist.c b/src/lib/elementary/elm_genlist.c index b84e830545..342d26e0d3 100644 --- a/src/lib/elementary/elm_genlist.c +++ b/src/lib/elementary/elm_genlist.c @@ -372,7 +372,6 @@ static void _widget_calculate_recursive(Eo *obj) { Elm_Widget_Smart_Data *pd = NULL; - Eina_List *l; Evas_Object *child; if (!efl_isa(obj, EFL_UI_WIDGET_CLASS)) return; @@ -388,8 +387,11 @@ _widget_calculate_recursive(Eo *obj) return; } - EINA_LIST_FOREACH(pd->subobjs, l, child) - _widget_calculate_recursive(child); + for (unsigned int i = 0; i < eina_array_count(pd->children); ++i) + { + child = eina_array_data_get(pd->children, i); + _widget_calculate_recursive(child); + } efl_canvas_group_calculate(obj); } @@ -713,9 +715,13 @@ _elm_genlist_item_unrealize(Elm_Gen_Item *it, elm_wdg_item_track_cancel(EO_OBJ(it)); - _item_unrealize(it); if (!calc) - efl_event_callback_legacy_call(WIDGET(it), ELM_GENLIST_EVENT_UNREALIZED, EO_OBJ(it)); + { + efl_event_callback_legacy_call(WIDGET(it), ELM_GENLIST_EVENT_UNREALIZED, EO_OBJ(it)); + if (it->base->func.unrealized) it->base->func.unrealized(EO_OBJ(it)); + } + + _item_unrealize(it); evas_event_thaw(e); evas_event_thaw_eval(e); @@ -1552,8 +1558,10 @@ _item_cache_free(Item_Cache *itc) /* does not exist if cache item has just been reused */ if (itc->base_view) { + Evas_Object *view = itc->base_view; efl_wref_del(itc->base_view, &itc->base_view); - efl_del(itc->base_view); + efl_del(view); + itc->base_view = NULL; } itc->item_class = NULL; EINA_LIST_FREE(itc->contents, c) @@ -1661,7 +1669,8 @@ _item_cache_add(Elm_Gen_Item *it, Eina_List *contents) efl_wref_del(it->base->view, &it->base->view); VIEW(it) = NULL; evas_object_hide(itc->base_view); - evas_object_move(itc->base_view, -9999, -9999); +// lower eocalloverhead - no need to do this +// evas_object_move(itc->base_view, -9999, -9999); _item_cache_clean(sd); @@ -2049,6 +2058,7 @@ _item_realize(Elm_Gen_Item *it, const int index, Eina_Bool calc) } efl_event_callback_legacy_call(WIDGET(it), ELM_GENLIST_EVENT_REALIZED, EO_OBJ(it)); + if (it->base->func.realized) it->base->func.realized(EO_OBJ(it)); } //Send a signal so that an item changes its style according to its expand depth @@ -4096,31 +4106,31 @@ _item_mouse_move_cb(void *data, if (dy < 0) { if (ady > adx) - efl_event_callback_legacy_call - (WIDGET(it), EFL_UI_EVENT_DRAG_START_UP, eo_it); + evas_object_smart_callback_call + (WIDGET(it), "drag,start,up", eo_it); else { if (dx < 0) - efl_event_callback_legacy_call - (WIDGET(it), EFL_UI_EVENT_DRAG_START_LEFT, eo_it); + evas_object_smart_callback_call + (WIDGET(it), "drag,start,left", eo_it); else - efl_event_callback_legacy_call - (WIDGET(it), EFL_UI_EVENT_DRAG_START_RIGHT, eo_it); + evas_object_smart_callback_call + (WIDGET(it), "drag,start,right", eo_it); } } else { if (ady > adx) - efl_event_callback_legacy_call - (WIDGET(it), EFL_UI_EVENT_DRAG_START_DOWN, eo_it); + evas_object_smart_callback_call + (WIDGET(it), "drag,start,down", eo_it); else { if (dx < 0) - efl_event_callback_legacy_call - (WIDGET(it), EFL_UI_EVENT_DRAG_START_LEFT, eo_it); + evas_object_smart_callback_call + (WIDGET(it), "drag,start,left", eo_it); else - efl_event_callback_legacy_call - (WIDGET(it), EFL_UI_EVENT_DRAG_START_RIGHT, eo_it); + evas_object_smart_callback_call + (WIDGET(it), "drag,start,right", eo_it); } } } @@ -4316,8 +4326,8 @@ _item_multi_down_cb(void *data, if (it->dragging) { it->dragging = EINA_FALSE; - efl_event_callback_legacy_call - (WIDGET(it), EFL_UI_EVENT_DRAG_STOP, EO_OBJ(it)); + evas_object_smart_callback_call + (WIDGET(it), "drag,stop", EO_OBJ(it)); } ELM_SAFE_FREE(it->item->swipe_timer, ecore_timer_del); if (sd->on_hold) @@ -5112,8 +5122,8 @@ _item_mouse_up_cb(void *data, if (it->dragging) { it->dragging = EINA_FALSE; - efl_event_callback_legacy_call - (WIDGET(it), EFL_UI_EVENT_DRAG_STOP, EO_OBJ(it)); + evas_object_smart_callback_call + (WIDGET(it), "drag,stop", EO_OBJ(it)); dragged = 1; } ELM_SAFE_FREE(it->item->swipe_timer, ecore_timer_del); @@ -5383,7 +5393,10 @@ _item_unrealize(Elm_Gen_Item *it) if (!_item_cache_add(it, _content_cache_add(it, &cache))) { - ELM_SAFE_FREE(VIEW(it), efl_del); + Evas_Object *view = VIEW(it); + efl_wref_del(VIEW(it), &VIEW(it)); + ELM_SAFE_FREE(view, efl_del); + VIEW(it) = NULL; it->callbacks = EINA_FALSE; ELM_SAFE_FREE(it->spacer, evas_object_del); EINA_LIST_FREE(cache, c) @@ -5912,6 +5925,7 @@ _elm_genlist_efl_canvas_group_group_del(Eo *obj, Elm_Genlist_Data *sd) eina_stringshare_replace(&sd->decorate_it_type, NULL); + eina_hash_free(sd->content_item_map); _elm_genlist_tree_effect_stop(sd); } @@ -7396,6 +7410,7 @@ _elm_genlist_item_all_contents_unset(Eo *eo_item EINA_UNUSED, Elm_Gen_Item *it, Evas_Object *content; ELM_GENLIST_ITEM_CHECK_OR_RETURN(it); + ELM_GENLIST_DATA_GET_FROM_ITEM(it, sd); EINA_LIST_FREE(it->contents, content) { @@ -7403,6 +7418,7 @@ _elm_genlist_item_all_contents_unset(Eo *eo_item EINA_UNUSED, Elm_Gen_Item *it, edje_object_part_unswallow(VIEW(it), content); evas_object_hide(content); if (l) *l = eina_list_append(*l, content); + eina_hash_del_by_key(sd->content_item_map, &content); } } diff --git a/src/lib/elementary/elm_genlist.h b/src/lib/elementary/elm_genlist.h index e060a685e7..0a42f84e67 100644 --- a/src/lib/elementary/elm_genlist.h +++ b/src/lib/elementary/elm_genlist.h @@ -1,5 +1,5 @@ /** - * @defgroup Elm_Genlist Genlist (Generic list) + * @defgroup Elm_Genlist_Group Genlist (Generic list) * @ingroup Elementary * * @image html genlist_inheritance_tree.png @@ -19,10 +19,10 @@ * trying to be both expansive, powerful and efficient. First we will begin * an overview on the theory behind genlist. * - * This widget inherits from the @ref Layout one, so that all the + * This widget inherits from the @ref Elm_Layout one, so that all the * functions acting on it also work for genlist objects. * - * This widget implements the @b @ref elm-scrollable-interface + * This widget implements the @ref elm-scrollable-interface * interface, so that all (non-deprecated) functions for the base @ref * Scroller widget also work for genlists. * @@ -250,7 +250,7 @@ * @section Genlist_Smart_Events Genlist smart events * * This widget emits the following signals, besides the ones sent from - * @ref Layout: + * @ref Elm_Layout : * - @c "activated" - The user has double-clicked or pressed * (enter|return|spacebar) on an item. The @p event_info parameter is the * item that was activated. @@ -393,7 +393,7 @@ */ /** - * @addtogroup Elm_Genlist + * @addtogroup Elm_Genlist_Group * @{ */ diff --git a/src/lib/elementary/elm_genlist_common.h b/src/lib/elementary/elm_genlist_common.h index 0b56d0e60c..3ab889fdca 100644 --- a/src/lib/elementary/elm_genlist_common.h +++ b/src/lib/elementary/elm_genlist_common.h @@ -44,7 +44,7 @@ typedef Elm_Gen_Item_Reusable_Content_Get_Cb Elm_Genlist_Reusable_Content_Get_Cb * @see elm_genlist_item_class_free() * @see elm_genlist_item_append() * - * @ingroup Elm_Genlist + * @ingroup Elm_Genlist_Group */ EAPI Elm_Genlist_Item_Class *elm_genlist_item_class_new(void); @@ -61,7 +61,7 @@ EAPI Elm_Genlist_Item_Class *elm_genlist_item_class_new(void); * @see elm_genlist_item_class_ref() * @see elm_genlist_item_class_unref() * - * @ingroup Elm_Genlist + * @ingroup Elm_Genlist_Group */ EAPI void elm_genlist_item_class_free(Elm_Genlist_Item_Class *itc); @@ -74,7 +74,7 @@ EAPI void elm_genlist_item_class_free(Elm_Genlist_Item_Class *itc); * * @see elm_genlist_item_class_unref() * - * @ingroup Elm_Genlist + * @ingroup Elm_Genlist_Group */ EAPI void elm_genlist_item_class_ref(Elm_Genlist_Item_Class *itc); @@ -89,7 +89,7 @@ EAPI void elm_genlist_item_class_ref(Elm_Genlist_Item_Class *itc); * @see elm_genlist_item_class_ref() * @see elm_genlist_item_class_free() * - * @ingroup Elm_Genlist + * @ingroup Elm_Genlist_Group */ EAPI void elm_genlist_item_class_unref(Elm_Genlist_Item_Class *itc); @@ -108,7 +108,7 @@ EAPI void elm_genlist_item_class_unref(Elm_Genlist_Item_Class *itc); * In order to set a content or something else as a tooltip, look at * elm_genlist_item_tooltip_content_cb_set(). * - * @ingroup Elm_Genlist + * @ingroup Elm_Genlist_Group */ EAPI void elm_genlist_item_tooltip_text_set(Elm_Object_Item *it, const char *text); @@ -136,7 +136,7 @@ EAPI void elm_genlist_item_tooltip_text_set(Elm_Object_ * In order to set just a text as a tooltip, look at * elm_genlist_item_tooltip_text_set(). * - * @ingroup Elm_Genlist + * @ingroup Elm_Genlist_Group */ EAPI void elm_genlist_item_tooltip_content_cb_set(Elm_Object_Item *it, Elm_Tooltip_Item_Content_Cb func, const void *data, Evas_Smart_Cb del_cb); @@ -153,7 +153,7 @@ EAPI void elm_genlist_item_tooltip_content_cb_set(Elm_O * * @see elm_genlist_item_tooltip_content_cb_set() * - * @ingroup Elm_Genlist + * @ingroup Elm_Genlist_Group */ EAPI void elm_genlist_item_tooltip_unset(Elm_Object_Item *it); @@ -176,7 +176,7 @@ EAPI void elm_genlist_item_tooltip_unset(Elm_Object_Ite * * @see elm_genlist_item_tooltip_style_get() * - * @ingroup Elm_Genlist + * @ingroup Elm_Genlist_Group */ EAPI void elm_genlist_item_tooltip_style_set(Elm_Object_Item *it, const char *style); @@ -190,7 +190,7 @@ EAPI void elm_genlist_item_tooltip_style_set(Elm_Object * * @see elm_genlist_item_tooltip_style_set() for more details * - * @ingroup Elm_Genlist + * @ingroup Elm_Genlist_Group */ EAPI const char *elm_genlist_item_tooltip_style_get(const Elm_Object_Item *it); @@ -236,7 +236,7 @@ EAPI Eina_Bool elm_genlist_item_tooltip_window_mode_get(cons * @see elm_genlist_item_cursor_get() * @see elm_genlist_item_cursor_unset() * - * @ingroup Elm_Genlist + * @ingroup Elm_Genlist_Group */ EAPI void elm_genlist_item_cursor_set(Elm_Object_Item *it, const char *cursor); @@ -252,7 +252,7 @@ EAPI void elm_genlist_item_cursor_set(Elm_Object_Item * * @see elm_genlist_item_cursor_set() for more details * @see elm_genlist_item_cursor_unset() * - * @ingroup Elm_Genlist + * @ingroup Elm_Genlist_Group */ EAPI const char *elm_genlist_item_cursor_get(const Elm_Object_Item *it); @@ -269,7 +269,7 @@ EAPI const char *elm_genlist_item_cursor_get(const Elm_Object_ * @see elm_object_cursor_unset() * @see elm_genlist_item_cursor_set() for more details * - * @ingroup Elm_Genlist + * @ingroup Elm_Genlist_Group */ EAPI void elm_genlist_item_cursor_unset(Elm_Object_Item *it); @@ -294,7 +294,7 @@ EAPI void elm_genlist_item_cursor_unset(Elm_Object_Item * @see elm_genlist_item_cursor_engine_only_set() * @see elm_genlist_item_cursor_style_get() * - * @ingroup Elm_Genlist + * @ingroup Elm_Genlist_Group */ EAPI void elm_genlist_item_cursor_style_set(Elm_Object_Item *it, const char *style); @@ -308,7 +308,7 @@ EAPI void elm_genlist_item_cursor_style_set(Elm_Object_ * * @see elm_genlist_item_cursor_style_set() for more details * - * @ingroup Elm_Genlist + * @ingroup Elm_Genlist_Group */ EAPI const char *elm_genlist_item_cursor_style_get(const Elm_Object_Item *it); @@ -328,7 +328,7 @@ EAPI const char *elm_genlist_item_cursor_style_get(const Elm_O * @note By default, cursors will only be looked for between those * provided by the rendering engine. * - * @ingroup Elm_Genlist + * @ingroup Elm_Genlist_Group */ EAPI void elm_genlist_item_cursor_engine_only_set(Elm_Object_Item *it, Eina_Bool engine_only); @@ -344,7 +344,7 @@ EAPI void elm_genlist_item_cursor_engine_only_set(Elm_O * * @see elm_genlist_item_cursor_engine_only_set(), for more details * - * @ingroup Elm_Genlist + * @ingroup Elm_Genlist_Group */ EAPI Eina_Bool elm_genlist_item_cursor_engine_only_get(const Elm_Object_Item *it); diff --git a/src/lib/elementary/elm_genlist_eo.h b/src/lib/elementary/elm_genlist_eo.h index f132027980..a66cfc89da 100644 --- a/src/lib/elementary/elm_genlist_eo.h +++ b/src/lib/elementary/elm_genlist_eo.h @@ -15,11 +15,11 @@ typedef Eo Elm_Genlist; #endif /** Elementary genlist class * - * @ingroup Elm_Genlist + * @ingroup Elm_Genlist_Group */ #define ELM_GENLIST_CLASS elm_genlist_class_get() -EWAPI const Efl_Class *elm_genlist_class_get(void); +EWAPI const Efl_Class *elm_genlist_class_get(void) EINA_CONST; /** * @brief Enable/disable homogeneous mode. @@ -38,7 +38,7 @@ EWAPI const Efl_Class *elm_genlist_class_get(void); * @param[in] homogeneous Assume the items within the genlist are of the same * height and width. Default is @c false. * - * @ingroup Elm_Genlist + * @ingroup Elm_Genlist_Group */ EOAPI void elm_obj_genlist_homogeneous_set(Eo *obj, Eina_Bool homogeneous); @@ -50,7 +50,7 @@ EOAPI void elm_obj_genlist_homogeneous_set(Eo *obj, Eina_Bool homogeneous); * @return Assume the items within the genlist are of the same height and * width. Default is @c false. * - * @ingroup Elm_Genlist + * @ingroup Elm_Genlist_Group */ EOAPI Eina_Bool elm_obj_genlist_homogeneous_get(const Eo *obj); @@ -68,7 +68,7 @@ EOAPI Eina_Bool elm_obj_genlist_homogeneous_get(const Eo *obj); * @param[in] obj The object. * @param[in] mode The select mode. * - * @ingroup Elm_Genlist + * @ingroup Elm_Genlist_Group */ EOAPI void elm_obj_genlist_select_mode_set(Eo *obj, Elm_Object_Select_Mode mode); @@ -79,7 +79,7 @@ EOAPI void elm_obj_genlist_select_mode_set(Eo *obj, Elm_Object_Select_Mode mode) * * @return The select mode. * - * @ingroup Elm_Genlist + * @ingroup Elm_Genlist_Group */ EOAPI Elm_Object_Select_Mode elm_obj_genlist_select_mode_get(const Eo *obj); @@ -95,7 +95,7 @@ EOAPI Elm_Object_Select_Mode elm_obj_genlist_select_mode_get(const Eo *obj); * @param[in] obj The object. * @param[in] enabled The tree effect status. * - * @ingroup Elm_Genlist + * @ingroup Elm_Genlist_Group */ EOAPI void elm_obj_genlist_focus_on_selection_set(Eo *obj, Eina_Bool enabled); @@ -106,7 +106,7 @@ EOAPI void elm_obj_genlist_focus_on_selection_set(Eo *obj, Eina_Bool enabled); * * @return The tree effect status. * - * @ingroup Elm_Genlist + * @ingroup Elm_Genlist_Group */ EOAPI Eina_Bool elm_obj_genlist_focus_on_selection_get(const Eo *obj); @@ -124,7 +124,7 @@ EOAPI Eina_Bool elm_obj_genlist_focus_on_selection_get(const Eo *obj); * @param[in] obj The object. * @param[in] timeout Timeout in seconds. Default is elm config value (1.0). * - * @ingroup Elm_Genlist + * @ingroup Elm_Genlist_Group */ EOAPI void elm_obj_genlist_longpress_timeout_set(Eo *obj, double timeout); @@ -135,7 +135,7 @@ EOAPI void elm_obj_genlist_longpress_timeout_set(Eo *obj, double timeout); * * @return Timeout in seconds. Default is elm config value (1.0). * - * @ingroup Elm_Genlist + * @ingroup Elm_Genlist_Group */ EOAPI double elm_obj_genlist_longpress_timeout_get(const Eo *obj); @@ -149,7 +149,7 @@ EOAPI double elm_obj_genlist_longpress_timeout_get(const Eo *obj); * @param[in] obj The object. * @param[in] multi Multi-select enable/disable. Default is disabled. * - * @ingroup Elm_Genlist + * @ingroup Elm_Genlist_Group */ EOAPI void elm_obj_genlist_multi_select_set(Eo *obj, Eina_Bool multi); @@ -160,7 +160,7 @@ EOAPI void elm_obj_genlist_multi_select_set(Eo *obj, Eina_Bool multi); * * @return Multi-select enable/disable. Default is disabled. * - * @ingroup Elm_Genlist + * @ingroup Elm_Genlist_Group */ EOAPI Eina_Bool elm_obj_genlist_multi_select_get(const Eo *obj); @@ -174,7 +174,7 @@ EOAPI Eina_Bool elm_obj_genlist_multi_select_get(const Eo *obj); * @param[in] obj The object. * @param[in] reorder_mode The reorder mode. * - * @ingroup Elm_Genlist + * @ingroup Elm_Genlist_Group */ EOAPI void elm_obj_genlist_reorder_mode_set(Eo *obj, Eina_Bool reorder_mode); @@ -185,7 +185,7 @@ EOAPI void elm_obj_genlist_reorder_mode_set(Eo *obj, Eina_Bool reorder_mode); * * @return The reorder mode. * - * @ingroup Elm_Genlist + * @ingroup Elm_Genlist_Group */ EOAPI Eina_Bool elm_obj_genlist_reorder_mode_get(const Eo *obj); @@ -197,7 +197,7 @@ EOAPI Eina_Bool elm_obj_genlist_reorder_mode_get(const Eo *obj); * @param[in] obj The object. * @param[in] decorated The decorate mode status. * - * @ingroup Elm_Genlist + * @ingroup Elm_Genlist_Group */ EOAPI void elm_obj_genlist_decorate_mode_set(Eo *obj, Eina_Bool decorated); @@ -208,7 +208,7 @@ EOAPI void elm_obj_genlist_decorate_mode_set(Eo *obj, Eina_Bool decorated); * * @return The decorate mode status. * - * @ingroup Elm_Genlist + * @ingroup Elm_Genlist_Group */ EOAPI Eina_Bool elm_obj_genlist_decorate_mode_get(const Eo *obj); @@ -226,7 +226,7 @@ EOAPI Eina_Bool elm_obj_genlist_decorate_mode_get(const Eo *obj); * * @since 1.8 * - * @ingroup Elm_Genlist + * @ingroup Elm_Genlist_Group */ EOAPI void elm_obj_genlist_multi_select_mode_set(Eo *obj, Elm_Object_Multi_Select_Mode mode); @@ -239,7 +239,7 @@ EOAPI void elm_obj_genlist_multi_select_mode_set(Eo *obj, Elm_Object_Multi_Selec * * @since 1.8 * - * @ingroup Elm_Genlist + * @ingroup Elm_Genlist_Group */ EOAPI Elm_Object_Multi_Select_Mode elm_obj_genlist_multi_select_mode_get(const Eo *obj); @@ -262,7 +262,7 @@ EOAPI Elm_Object_Multi_Select_Mode elm_obj_genlist_multi_select_mode_get(const E * @param[in] count Maximum number of items within an item block. Default is * 32. * - * @ingroup Elm_Genlist + * @ingroup Elm_Genlist_Group */ EOAPI void elm_obj_genlist_block_count_set(Eo *obj, int count); @@ -273,7 +273,7 @@ EOAPI void elm_obj_genlist_block_count_set(Eo *obj, int count); * * @return Maximum number of items within an item block. Default is 32. * - * @ingroup Elm_Genlist + * @ingroup Elm_Genlist_Group */ EOAPI int elm_obj_genlist_block_count_get(const Eo *obj); @@ -283,7 +283,7 @@ EOAPI int elm_obj_genlist_block_count_get(const Eo *obj); * @param[in] obj The object. * @param[in] enabled The tree effect status. * - * @ingroup Elm_Genlist + * @ingroup Elm_Genlist_Group */ EOAPI void elm_obj_genlist_tree_effect_enabled_set(Eo *obj, Eina_Bool enabled); @@ -294,7 +294,7 @@ EOAPI void elm_obj_genlist_tree_effect_enabled_set(Eo *obj, Eina_Bool enabled); * * @return The tree effect status. * - * @ingroup Elm_Genlist + * @ingroup Elm_Genlist_Group */ EOAPI Eina_Bool elm_obj_genlist_tree_effect_enabled_get(const Eo *obj); @@ -311,7 +311,7 @@ EOAPI Eina_Bool elm_obj_genlist_tree_effect_enabled_get(const Eo *obj); * @param[in] highlight @c true to enable highlighting or @c false to disable * it. * - * @ingroup Elm_Genlist + * @ingroup Elm_Genlist_Group */ EOAPI void elm_obj_genlist_highlight_mode_set(Eo *obj, Eina_Bool highlight); @@ -323,7 +323,7 @@ EOAPI void elm_obj_genlist_highlight_mode_set(Eo *obj, Eina_Bool highlight); * * @return @c true to enable highlighting or @c false to disable it. * - * @ingroup Elm_Genlist + * @ingroup Elm_Genlist_Group */ EOAPI Eina_Bool elm_obj_genlist_highlight_mode_get(const Eo *obj); @@ -355,7 +355,7 @@ EOAPI Eina_Bool elm_obj_genlist_highlight_mode_get(const Eo *obj); * @param[in] mode The mode to use (one of @ref ELM_LIST_SCROLL or * @ref ELM_LIST_LIMIT). * - * @ingroup Elm_Genlist + * @ingroup Elm_Genlist_Group */ EOAPI void elm_obj_genlist_mode_set(Eo *obj, Elm_List_Mode mode); @@ -367,7 +367,7 @@ EOAPI void elm_obj_genlist_mode_set(Eo *obj, Elm_List_Mode mode); * @return The mode to use (one of @ref ELM_LIST_SCROLL or * @ref ELM_LIST_LIMIT). * - * @ingroup Elm_Genlist + * @ingroup Elm_Genlist_Group */ EOAPI Elm_List_Mode elm_obj_genlist_mode_get(const Eo *obj); @@ -382,7 +382,7 @@ EOAPI Elm_List_Mode elm_obj_genlist_mode_get(const Eo *obj); * @return The active item for that current mode. Or @c null if no item is * activated with any mode. * - * @ingroup Elm_Genlist + * @ingroup Elm_Genlist_Group */ EOAPI Elm_Widget_Item *elm_obj_genlist_decorated_item_get(const Eo *obj); @@ -400,7 +400,7 @@ EOAPI Elm_Widget_Item *elm_obj_genlist_decorated_item_get(const Eo *obj); * * @return The selected item, or @c null if none is selected. * - * @ingroup Elm_Genlist + * @ingroup Elm_Genlist_Group */ EOAPI Elm_Widget_Item *elm_obj_genlist_selected_item_get(const Eo *obj); @@ -415,7 +415,7 @@ EOAPI Elm_Widget_Item *elm_obj_genlist_selected_item_get(const Eo *obj); * * @return The first item or @c null. * - * @ingroup Elm_Genlist + * @ingroup Elm_Genlist_Group */ EOAPI Elm_Widget_Item *elm_obj_genlist_first_item_get(const Eo *obj); @@ -431,7 +431,7 @@ EOAPI Elm_Widget_Item *elm_obj_genlist_first_item_get(const Eo *obj); * * @return List of realized items * - * @ingroup Elm_Genlist + * @ingroup Elm_Genlist_Group */ EOAPI Eina_List *elm_obj_genlist_realized_items_get(const Eo *obj) EINA_WARN_UNUSED_RESULT; @@ -452,7 +452,7 @@ EOAPI Eina_List *elm_obj_genlist_realized_items_get(const Eo *obj) EINA_WARN_UNU * * @return List of selected items * - * @ingroup Elm_Genlist + * @ingroup Elm_Genlist_Group */ EOAPI const Eina_List *elm_obj_genlist_selected_items_get(const Eo *obj); @@ -467,7 +467,7 @@ EOAPI const Eina_List *elm_obj_genlist_selected_items_get(const Eo *obj); * * @return Last item in list * - * @ingroup Elm_Genlist + * @ingroup Elm_Genlist_Group */ EOAPI Elm_Widget_Item *elm_obj_genlist_last_item_get(const Eo *obj); @@ -488,7 +488,7 @@ EOAPI Elm_Widget_Item *elm_obj_genlist_last_item_get(const Eo *obj); * * @return Handle to inserted item * - * @ingroup Elm_Genlist + * @ingroup Elm_Genlist_Group */ EOAPI Elm_Widget_Item *elm_obj_genlist_item_insert_before(Eo *obj, const Elm_Genlist_Item_Class *itc, const void *data, Elm_Widget_Item *parent, Elm_Widget_Item *before_it, Elm_Genlist_Item_Type type, Evas_Smart_Cb func, const void *func_data); @@ -502,7 +502,7 @@ EOAPI Elm_Widget_Item *elm_obj_genlist_item_insert_before(Eo *obj, const Elm_Gen * To update just one item, use @ref elm_genlist_item_update. * @param[in] obj The object. * - * @ingroup Elm_Genlist + * @ingroup Elm_Genlist_Group */ EOAPI void elm_obj_genlist_realized_items_update(Eo *obj); @@ -523,7 +523,7 @@ EOAPI void elm_obj_genlist_realized_items_update(Eo *obj); * * @return Handle to inserted item * - * @ingroup Elm_Genlist + * @ingroup Elm_Genlist_Group */ EOAPI Elm_Widget_Item *elm_obj_genlist_item_insert_after(Eo *obj, const Elm_Genlist_Item_Class *itc, const void *data, Elm_Widget_Item *parent, Elm_Widget_Item *after_it, Elm_Genlist_Item_Type type, Evas_Smart_Cb func, const void *func_data); @@ -546,7 +546,7 @@ EOAPI Elm_Widget_Item *elm_obj_genlist_item_insert_after(Eo *obj, const Elm_Genl * * @return Item at position * - * @ingroup Elm_Genlist + * @ingroup Elm_Genlist_Group */ EOAPI Elm_Widget_Item *elm_obj_genlist_at_xy_item_get(const Eo *obj, int x, int y, int *posret); @@ -562,7 +562,7 @@ EOAPI Elm_Widget_Item *elm_obj_genlist_at_xy_item_get(const Eo *obj, int x, int * @param[in] obj The object. * @param[in] key Filter key * - * @ingroup Elm_Genlist + * @ingroup Elm_Genlist_Group */ EOAPI void elm_obj_genlist_filter_set(Eo *obj, void *key); @@ -576,7 +576,7 @@ EOAPI void elm_obj_genlist_filter_set(Eo *obj, void *key); * * @return Iterator on genlist * - * @ingroup Elm_Genlist + * @ingroup Elm_Genlist_Group */ EOAPI Eina_Iterator *elm_obj_genlist_filter_iterator_new(Eo *obj); @@ -593,7 +593,7 @@ EOAPI Eina_Iterator *elm_obj_genlist_filter_iterator_new(Eo *obj); * * @since 1.18 * - * @ingroup Elm_Genlist + * @ingroup Elm_Genlist_Group */ EOAPI unsigned int elm_obj_genlist_filtered_items_count(const Eo *obj); @@ -606,7 +606,7 @@ EOAPI unsigned int elm_obj_genlist_filtered_items_count(const Eo *obj); * * @return Item in list * - * @ingroup Elm_Genlist + * @ingroup Elm_Genlist_Group */ EOAPI unsigned int elm_obj_genlist_items_count(const Eo *obj); @@ -626,7 +626,7 @@ EOAPI unsigned int elm_obj_genlist_items_count(const Eo *obj); * * @return Handle to prepended item * - * @ingroup Elm_Genlist + * @ingroup Elm_Genlist_Group */ EOAPI Elm_Widget_Item *elm_obj_genlist_item_prepend(Eo *obj, const Elm_Genlist_Item_Class *itc, const void *data, Elm_Widget_Item *parent, Elm_Genlist_Item_Type type, Evas_Smart_Cb func, const void *func_data); @@ -636,7 +636,7 @@ EOAPI Elm_Widget_Item *elm_obj_genlist_item_prepend(Eo *obj, const Elm_Genlist_I * This removes (and deletes) all items in @c obj, leaving it empty. * @param[in] obj The object. * - * @ingroup Elm_Genlist + * @ingroup Elm_Genlist_Group */ EOAPI void elm_obj_genlist_clear(Eo *obj); @@ -656,7 +656,7 @@ EOAPI void elm_obj_genlist_clear(Eo *obj); * * @return Handle to appended item * - * @ingroup Elm_Genlist + * @ingroup Elm_Genlist_Group */ EOAPI Elm_Widget_Item *elm_obj_genlist_item_append(Eo *obj, const Elm_Genlist_Item_Class *itc, const void *data, Elm_Widget_Item *parent, Elm_Genlist_Item_Type type, Evas_Smart_Cb func, const void *func_data); @@ -678,7 +678,7 @@ EOAPI Elm_Widget_Item *elm_obj_genlist_item_append(Eo *obj, const Elm_Genlist_It * * @return Handle to inserted item * - * @ingroup Elm_Genlist + * @ingroup Elm_Genlist_Group */ EOAPI Elm_Widget_Item *elm_obj_genlist_item_sorted_insert(Eo *obj, const Elm_Genlist_Item_Class *itc, const void *data, Elm_Widget_Item *parent, Elm_Genlist_Item_Type type, Eina_Compare_Cb comp, Evas_Smart_Cb func, const void *func_data); @@ -704,7 +704,7 @@ EOAPI Elm_Widget_Item *elm_obj_genlist_item_sorted_insert(Eo *obj, const Elm_Gen * * @since 1.11 * - * @ingroup Elm_Genlist + * @ingroup Elm_Genlist_Group */ EOAPI Elm_Widget_Item *elm_obj_genlist_search_by_text_item_get(Eo *obj, Elm_Widget_Item *item_to_search_from, const char *part_name, const char *pattern, Elm_Glob_Match_Flags flags); @@ -713,7 +713,7 @@ EWAPI extern const Efl_Event_Description _ELM_GENLIST_EVENT_ITEM_FOCUSED; /** Called when genlist item got focus * @return Efl_Object * * - * @ingroup Elm_Genlist + * @ingroup Elm_Genlist_Group */ #define ELM_GENLIST_EVENT_ITEM_FOCUSED (&(_ELM_GENLIST_EVENT_ITEM_FOCUSED)) @@ -722,7 +722,7 @@ EWAPI extern const Efl_Event_Description _ELM_GENLIST_EVENT_ITEM_UNFOCUSED; /** Called when genlist item lost focus * @return Efl_Object * * - * @ingroup Elm_Genlist + * @ingroup Elm_Genlist_Group */ #define ELM_GENLIST_EVENT_ITEM_UNFOCUSED (&(_ELM_GENLIST_EVENT_ITEM_UNFOCUSED)) @@ -730,7 +730,7 @@ EWAPI extern const Efl_Event_Description _ELM_GENLIST_EVENT_VBAR_DRAG; /** Called when vertical bar is dragged * - * @ingroup Elm_Genlist + * @ingroup Elm_Genlist_Group */ #define ELM_GENLIST_EVENT_VBAR_DRAG (&(_ELM_GENLIST_EVENT_VBAR_DRAG)) @@ -738,7 +738,7 @@ EWAPI extern const Efl_Event_Description _ELM_GENLIST_EVENT_VBAR_PRESS; /** Called when vertical bar is pressed * - * @ingroup Elm_Genlist + * @ingroup Elm_Genlist_Group */ #define ELM_GENLIST_EVENT_VBAR_PRESS (&(_ELM_GENLIST_EVENT_VBAR_PRESS)) @@ -746,7 +746,7 @@ EWAPI extern const Efl_Event_Description _ELM_GENLIST_EVENT_VBAR_UNPRESS; /** Called when vertical bar is no longer pressed * - * @ingroup Elm_Genlist + * @ingroup Elm_Genlist_Group */ #define ELM_GENLIST_EVENT_VBAR_UNPRESS (&(_ELM_GENLIST_EVENT_VBAR_UNPRESS)) @@ -754,7 +754,7 @@ EWAPI extern const Efl_Event_Description _ELM_GENLIST_EVENT_HBAR_DRAG; /** Called when horizontal bar is dragged * - * @ingroup Elm_Genlist + * @ingroup Elm_Genlist_Group */ #define ELM_GENLIST_EVENT_HBAR_DRAG (&(_ELM_GENLIST_EVENT_HBAR_DRAG)) @@ -762,7 +762,7 @@ EWAPI extern const Efl_Event_Description _ELM_GENLIST_EVENT_HBAR_PRESS; /** Called when horizontal bar is pressed * - * @ingroup Elm_Genlist + * @ingroup Elm_Genlist_Group */ #define ELM_GENLIST_EVENT_HBAR_PRESS (&(_ELM_GENLIST_EVENT_HBAR_PRESS)) @@ -770,7 +770,7 @@ EWAPI extern const Efl_Event_Description _ELM_GENLIST_EVENT_HBAR_UNPRESS; /** Called when horizontal bar is no longer pressed * - * @ingroup Elm_Genlist + * @ingroup Elm_Genlist_Group */ #define ELM_GENLIST_EVENT_HBAR_UNPRESS (&(_ELM_GENLIST_EVENT_HBAR_UNPRESS)) @@ -778,7 +778,7 @@ EWAPI extern const Efl_Event_Description _ELM_GENLIST_EVENT_EDGE_TOP; /** Called when top edge is reached * - * @ingroup Elm_Genlist + * @ingroup Elm_Genlist_Group */ #define ELM_GENLIST_EVENT_EDGE_TOP (&(_ELM_GENLIST_EVENT_EDGE_TOP)) @@ -786,7 +786,7 @@ EWAPI extern const Efl_Event_Description _ELM_GENLIST_EVENT_EDGE_BOTTOM; /** Called when bottom edge is reached * - * @ingroup Elm_Genlist + * @ingroup Elm_Genlist_Group */ #define ELM_GENLIST_EVENT_EDGE_BOTTOM (&(_ELM_GENLIST_EVENT_EDGE_BOTTOM)) @@ -794,7 +794,7 @@ EWAPI extern const Efl_Event_Description _ELM_GENLIST_EVENT_EDGE_LEFT; /** Called when left edge is reached * - * @ingroup Elm_Genlist + * @ingroup Elm_Genlist_Group */ #define ELM_GENLIST_EVENT_EDGE_LEFT (&(_ELM_GENLIST_EVENT_EDGE_LEFT)) @@ -802,7 +802,7 @@ EWAPI extern const Efl_Event_Description _ELM_GENLIST_EVENT_EDGE_RIGHT; /** Called when right edge is reached * - * @ingroup Elm_Genlist + * @ingroup Elm_Genlist_Group */ #define ELM_GENLIST_EVENT_EDGE_RIGHT (&(_ELM_GENLIST_EVENT_EDGE_RIGHT)) @@ -811,7 +811,7 @@ EWAPI extern const Efl_Event_Description _ELM_GENLIST_EVENT_MOVED; /** Called when genlist item moved * @return Efl_Object * * - * @ingroup Elm_Genlist + * @ingroup Elm_Genlist_Group */ #define ELM_GENLIST_EVENT_MOVED (&(_ELM_GENLIST_EVENT_MOVED)) @@ -820,7 +820,7 @@ EWAPI extern const Efl_Event_Description _ELM_GENLIST_EVENT_MOVED_BEFORE; /** Called when genlist item moved before * @return Efl_Object * * - * @ingroup Elm_Genlist + * @ingroup Elm_Genlist_Group */ #define ELM_GENLIST_EVENT_MOVED_BEFORE (&(_ELM_GENLIST_EVENT_MOVED_BEFORE)) @@ -829,7 +829,7 @@ EWAPI extern const Efl_Event_Description _ELM_GENLIST_EVENT_MOVED_AFTER; /** Called when genlist item moved after * @return Efl_Object * * - * @ingroup Elm_Genlist + * @ingroup Elm_Genlist_Group */ #define ELM_GENLIST_EVENT_MOVED_AFTER (&(_ELM_GENLIST_EVENT_MOVED_AFTER)) @@ -838,7 +838,7 @@ EWAPI extern const Efl_Event_Description _ELM_GENLIST_EVENT_SWIPE; /** Called when swipe is detected * @return Efl_Object * * - * @ingroup Elm_Genlist + * @ingroup Elm_Genlist_Group */ #define ELM_GENLIST_EVENT_SWIPE (&(_ELM_GENLIST_EVENT_SWIPE)) @@ -847,7 +847,7 @@ EWAPI extern const Efl_Event_Description _ELM_GENLIST_EVENT_MULTI_PINCH_IN; /** Called when multitouch pinch in detected * @return Efl_Object * * - * @ingroup Elm_Genlist + * @ingroup Elm_Genlist_Group */ #define ELM_GENLIST_EVENT_MULTI_PINCH_IN (&(_ELM_GENLIST_EVENT_MULTI_PINCH_IN)) @@ -856,7 +856,7 @@ EWAPI extern const Efl_Event_Description _ELM_GENLIST_EVENT_MULTI_PINCH_OUT; /** Called when multitouch pinch out detected * @return Efl_Object * * - * @ingroup Elm_Genlist + * @ingroup Elm_Genlist_Group */ #define ELM_GENLIST_EVENT_MULTI_PINCH_OUT (&(_ELM_GENLIST_EVENT_MULTI_PINCH_OUT)) @@ -865,7 +865,7 @@ EWAPI extern const Efl_Event_Description _ELM_GENLIST_EVENT_MULTI_SWIPE_DOWN; /** Called when multitouch swipe down detected * @return Efl_Object * * - * @ingroup Elm_Genlist + * @ingroup Elm_Genlist_Group */ #define ELM_GENLIST_EVENT_MULTI_SWIPE_DOWN (&(_ELM_GENLIST_EVENT_MULTI_SWIPE_DOWN)) @@ -874,7 +874,7 @@ EWAPI extern const Efl_Event_Description _ELM_GENLIST_EVENT_MULTI_SWIPE_UP; /** Called when multitouch swipe up detected * @return Efl_Object * * - * @ingroup Elm_Genlist + * @ingroup Elm_Genlist_Group */ #define ELM_GENLIST_EVENT_MULTI_SWIPE_UP (&(_ELM_GENLIST_EVENT_MULTI_SWIPE_UP)) @@ -883,7 +883,7 @@ EWAPI extern const Efl_Event_Description _ELM_GENLIST_EVENT_MULTI_SWIPE_RIGHT; /** Called when multitouch swipe right detected * @return Efl_Object * * - * @ingroup Elm_Genlist + * @ingroup Elm_Genlist_Group */ #define ELM_GENLIST_EVENT_MULTI_SWIPE_RIGHT (&(_ELM_GENLIST_EVENT_MULTI_SWIPE_RIGHT)) @@ -892,7 +892,7 @@ EWAPI extern const Efl_Event_Description _ELM_GENLIST_EVENT_MULTI_SWIPE_LEFT; /** Called when multitouch swipe left detected * @return Efl_Object * * - * @ingroup Elm_Genlist + * @ingroup Elm_Genlist_Group */ #define ELM_GENLIST_EVENT_MULTI_SWIPE_LEFT (&(_ELM_GENLIST_EVENT_MULTI_SWIPE_LEFT)) @@ -901,7 +901,7 @@ EWAPI extern const Efl_Event_Description _ELM_GENLIST_EVENT_RELEASED; /** Called when genlist is released * @return Efl_Object * * - * @ingroup Elm_Genlist + * @ingroup Elm_Genlist_Group */ #define ELM_GENLIST_EVENT_RELEASED (&(_ELM_GENLIST_EVENT_RELEASED)) @@ -910,7 +910,7 @@ EWAPI extern const Efl_Event_Description _ELM_GENLIST_EVENT_ACTIVATED; /** called when genlist is activated * @return Efl_Object * * - * @ingroup Elm_Genlist + * @ingroup Elm_Genlist_Group */ #define ELM_GENLIST_EVENT_ACTIVATED (&(_ELM_GENLIST_EVENT_ACTIVATED)) @@ -919,7 +919,7 @@ EWAPI extern const Efl_Event_Description _ELM_GENLIST_EVENT_HIGHLIGHTED; /** Called when genlist is highlighted * @return Efl_Object * * - * @ingroup Elm_Genlist + * @ingroup Elm_Genlist_Group */ #define ELM_GENLIST_EVENT_HIGHLIGHTED (&(_ELM_GENLIST_EVENT_HIGHLIGHTED)) @@ -928,7 +928,7 @@ EWAPI extern const Efl_Event_Description _ELM_GENLIST_EVENT_UNHIGHLIGHTED; /** Called when genlist is no longer highlighted * @return Efl_Object * * - * @ingroup Elm_Genlist + * @ingroup Elm_Genlist_Group */ #define ELM_GENLIST_EVENT_UNHIGHLIGHTED (&(_ELM_GENLIST_EVENT_UNHIGHLIGHTED)) @@ -937,7 +937,7 @@ EWAPI extern const Efl_Event_Description _ELM_GENLIST_EVENT_REALIZED; /** Called when genlist is realized * @return Efl_Object * * - * @ingroup Elm_Genlist + * @ingroup Elm_Genlist_Group */ #define ELM_GENLIST_EVENT_REALIZED (&(_ELM_GENLIST_EVENT_REALIZED)) @@ -946,7 +946,7 @@ EWAPI extern const Efl_Event_Description _ELM_GENLIST_EVENT_UNREALIZED; /** Called when genlist is unrealized * @return Efl_Object * * - * @ingroup Elm_Genlist + * @ingroup Elm_Genlist_Group */ #define ELM_GENLIST_EVENT_UNREALIZED (&(_ELM_GENLIST_EVENT_UNREALIZED)) @@ -955,7 +955,7 @@ EWAPI extern const Efl_Event_Description _ELM_GENLIST_EVENT_CONTRACT_REQUEST; /** Called when contract is requested * @return Efl_Object * * - * @ingroup Elm_Genlist + * @ingroup Elm_Genlist_Group */ #define ELM_GENLIST_EVENT_CONTRACT_REQUEST (&(_ELM_GENLIST_EVENT_CONTRACT_REQUEST)) @@ -964,7 +964,7 @@ EWAPI extern const Efl_Event_Description _ELM_GENLIST_EVENT_EXPAND_REQUEST; /** Called when expand is requested * @return Efl_Object * * - * @ingroup Elm_Genlist + * @ingroup Elm_Genlist_Group */ #define ELM_GENLIST_EVENT_EXPAND_REQUEST (&(_ELM_GENLIST_EVENT_EXPAND_REQUEST)) @@ -973,7 +973,7 @@ EWAPI extern const Efl_Event_Description _ELM_GENLIST_EVENT_CONTRACTED; /** called when genlist is contracted * @return Efl_Object * * - * @ingroup Elm_Genlist + * @ingroup Elm_Genlist_Group */ #define ELM_GENLIST_EVENT_CONTRACTED (&(_ELM_GENLIST_EVENT_CONTRACTED)) @@ -982,7 +982,7 @@ EWAPI extern const Efl_Event_Description _ELM_GENLIST_EVENT_EXPANDED; /** Called when genlist is expanded * @return Efl_Object * * - * @ingroup Elm_Genlist + * @ingroup Elm_Genlist_Group */ #define ELM_GENLIST_EVENT_EXPANDED (&(_ELM_GENLIST_EVENT_EXPANDED)) @@ -991,7 +991,7 @@ EWAPI extern const Efl_Event_Description _ELM_GENLIST_EVENT_INDEX_UPDATE; /** Called when genlist index updated * @return Efl_Object * * - * @ingroup Elm_Genlist + * @ingroup Elm_Genlist_Group */ #define ELM_GENLIST_EVENT_INDEX_UPDATE (&(_ELM_GENLIST_EVENT_INDEX_UPDATE)) @@ -999,7 +999,7 @@ EWAPI extern const Efl_Event_Description _ELM_GENLIST_EVENT_TREE_EFFECT_FINISHED /** Called when genlist tree effect finished * - * @ingroup Elm_Genlist + * @ingroup Elm_Genlist_Group */ #define ELM_GENLIST_EVENT_TREE_EFFECT_FINISHED (&(_ELM_GENLIST_EVENT_TREE_EFFECT_FINISHED)) @@ -1007,7 +1007,7 @@ EWAPI extern const Efl_Event_Description _ELM_GENLIST_EVENT_FILTER_DONE; /** Called when genlist filter is done * - * @ingroup Elm_Genlist + * @ingroup Elm_Genlist_Group */ #define ELM_GENLIST_EVENT_FILTER_DONE (&(_ELM_GENLIST_EVENT_FILTER_DONE)) diff --git a/src/lib/elementary/elm_genlist_item_eo.h b/src/lib/elementary/elm_genlist_item_eo.h index ef73deb4d2..372248923d 100644 --- a/src/lib/elementary/elm_genlist_item_eo.h +++ b/src/lib/elementary/elm_genlist_item_eo.h @@ -13,13 +13,21 @@ typedef Eo Elm_Genlist_Item; #endif -/** Elementary genlist item class +/** + * Elementary genlist item class + * + * @defgroup Elm_Genlist_Item_Group Genlist Item + * @ingroup Elm_Genlist_Group + */ + +/** + * @brief Get genlist item class * - * @ingroup Elm_Genlist_Item + * @ingroup Elm_Genlist_Item_Group */ #define ELM_GENLIST_ITEM_CLASS elm_genlist_item_class_get() -EWAPI const Efl_Class *elm_genlist_item_class_get(void); +EWAPI const Efl_Class *elm_genlist_item_class_get(void) EINA_CONST; /** * @brief Get the previous item in a genlist widget's internal list of items, @@ -40,7 +48,7 @@ EWAPI const Efl_Class *elm_genlist_item_class_get(void); * * @return The item before @c item, or @c null if there's none (and on errors). * - * @ingroup Elm_Genlist_Item + * @ingroup Elm_Genlist_Item_Group */ EOAPI Elm_Widget_Item *elm_obj_genlist_item_prev_get(const Eo *obj); @@ -63,7 +71,7 @@ EOAPI Elm_Widget_Item *elm_obj_genlist_item_prev_get(const Eo *obj); * * @return The item after @c item, or @c null if there's none (and on errors). * - * @ingroup Elm_Genlist_Item + * @ingroup Elm_Genlist_Item_Group */ EOAPI Elm_Widget_Item *elm_obj_genlist_item_next_get(const Eo *obj); @@ -77,7 +85,7 @@ EOAPI Elm_Widget_Item *elm_obj_genlist_item_next_get(const Eo *obj); * * @return The parent of the item or @c null if it has no parent. * - * @ingroup Elm_Genlist_Item + * @ingroup Elm_Genlist_Item_Group */ EOAPI Elm_Widget_Item *elm_obj_genlist_item_parent_item_get(const Eo *obj); @@ -93,7 +101,7 @@ EOAPI Elm_Widget_Item *elm_obj_genlist_item_parent_item_get(const Eo *obj); * * @since 1.9 * - * @ingroup Elm_Genlist_Item + * @ingroup Elm_Genlist_Item_Group */ EOAPI const Eina_List *elm_obj_genlist_item_subitems_get(const Eo *obj); @@ -108,7 +116,7 @@ EOAPI const Eina_List *elm_obj_genlist_item_subitems_get(const Eo *obj); * @param[in] selected The selected state ($true selected, @c false not * selected). * - * @ingroup Elm_Genlist_Item + * @ingroup Elm_Genlist_Item_Group */ EOAPI void elm_obj_genlist_item_selected_set(Eo *obj, Eina_Bool selected); @@ -119,7 +127,7 @@ EOAPI void elm_obj_genlist_item_selected_set(Eo *obj, Eina_Bool selected); * * @return The selected state ($true selected, @c false not selected). * - * @ingroup Elm_Genlist_Item + * @ingroup Elm_Genlist_Item_Group */ EOAPI Eina_Bool elm_obj_genlist_item_selected_get(const Eo *obj); @@ -141,7 +149,7 @@ EOAPI Eina_Bool elm_obj_genlist_item_selected_get(const Eo *obj); * @param[in] expanded The expanded state ($true expanded, @c false not * expanded). * - * @ingroup Elm_Genlist_Item + * @ingroup Elm_Genlist_Item_Group */ EOAPI void elm_obj_genlist_item_expanded_set(Eo *obj, Eina_Bool expanded); @@ -154,7 +162,7 @@ EOAPI void elm_obj_genlist_item_expanded_set(Eo *obj, Eina_Bool expanded); * * @return The expanded state ($true expanded, @c false not expanded). * - * @ingroup Elm_Genlist_Item + * @ingroup Elm_Genlist_Item_Group */ EOAPI Eina_Bool elm_obj_genlist_item_expanded_get(const Eo *obj); @@ -165,7 +173,7 @@ EOAPI Eina_Bool elm_obj_genlist_item_expanded_get(const Eo *obj); * * @return The depth of expanded item. * - * @ingroup Elm_Genlist_Item + * @ingroup Elm_Genlist_Item_Group */ EOAPI int elm_obj_genlist_item_expanded_depth_get(const Eo *obj); @@ -179,7 +187,7 @@ EOAPI int elm_obj_genlist_item_expanded_depth_get(const Eo *obj); * * @return Genlist Item class for the given item. * - * @ingroup Elm_Genlist_Item + * @ingroup Elm_Genlist_Item_Group */ EOAPI const Elm_Genlist_Item_Class *elm_obj_genlist_item_class_get(const Eo *obj); @@ -192,7 +200,7 @@ EOAPI const Elm_Genlist_Item_Class *elm_obj_genlist_item_class_get(const Eo *obj * * @return The position inside the list of item. * - * @ingroup Elm_Genlist_Item + * @ingroup Elm_Genlist_Item_Group */ EOAPI int elm_obj_genlist_item_index_get(const Eo *obj); @@ -205,7 +213,7 @@ EOAPI int elm_obj_genlist_item_index_get(const Eo *obj); * * @return Name of the item's decorate mode. * - * @ingroup Elm_Genlist_Item + * @ingroup Elm_Genlist_Item_Group */ EOAPI const char *elm_obj_genlist_item_decorate_mode_get(const Eo *obj); @@ -219,7 +227,7 @@ EOAPI const char *elm_obj_genlist_item_decorate_mode_get(const Eo *obj); * @param[in] obj The object. * @param[in] flip The flip mode. * - * @ingroup Elm_Genlist_Item + * @ingroup Elm_Genlist_Item_Group */ EOAPI void elm_obj_genlist_item_flip_set(Eo *obj, Eina_Bool flip); @@ -233,7 +241,7 @@ EOAPI void elm_obj_genlist_item_flip_set(Eo *obj, Eina_Bool flip); * * @return The flip mode. * - * @ingroup Elm_Genlist_Item + * @ingroup Elm_Genlist_Item_Group */ EOAPI Eina_Bool elm_obj_genlist_item_flip_get(const Eo *obj); @@ -261,7 +269,7 @@ EOAPI Eina_Bool elm_obj_genlist_item_flip_get(const Eo *obj); * @param[in] obj The object. * @param[in] mode The selected mode. * - * @ingroup Elm_Genlist_Item + * @ingroup Elm_Genlist_Item_Group */ EOAPI void elm_obj_genlist_item_select_mode_set(Eo *obj, Elm_Object_Select_Mode mode); @@ -274,7 +282,7 @@ EOAPI void elm_obj_genlist_item_select_mode_set(Eo *obj, Elm_Object_Select_Mode * * @return The selected mode. * - * @ingroup Elm_Genlist_Item + * @ingroup Elm_Genlist_Item_Group */ EOAPI Elm_Object_Select_Mode elm_obj_genlist_item_select_mode_get(const Eo *obj); @@ -288,7 +296,7 @@ EOAPI Elm_Object_Select_Mode elm_obj_genlist_item_select_mode_get(const Eo *obj) * * @return Item type. * - * @ingroup Elm_Genlist_Item + * @ingroup Elm_Genlist_Item_Group */ EOAPI Elm_Genlist_Item_Type elm_obj_genlist_item_type_get(const Eo *obj); @@ -304,7 +312,7 @@ EOAPI Elm_Genlist_Item_Type elm_obj_genlist_item_type_get(const Eo *obj); * @param[in] pin The item pin state state ($true pin item, @c false unpin * item). * - * @ingroup Elm_Genlist_Item + * @ingroup Elm_Genlist_Item_Group */ EOAPI void elm_obj_genlist_item_pin_set(Eo *obj, Eina_Bool pin); @@ -315,7 +323,7 @@ EOAPI void elm_obj_genlist_item_pin_set(Eo *obj, Eina_Bool pin); * * @return The item pin state state ($true pin item, @c false unpin item). * - * @ingroup Elm_Genlist_Item + * @ingroup Elm_Genlist_Item_Group */ EOAPI Eina_Bool elm_obj_genlist_item_pin_get(const Eo *obj); @@ -330,7 +338,7 @@ EOAPI Eina_Bool elm_obj_genlist_item_pin_get(const Eo *obj); * * @since 1.9 * - * @ingroup Elm_Genlist_Item + * @ingroup Elm_Genlist_Item_Group */ EOAPI unsigned int elm_obj_genlist_item_subitems_count(Eo *obj); @@ -341,19 +349,19 @@ EOAPI unsigned int elm_obj_genlist_item_subitems_count(Eo *obj); * given item @c it. * @param[in] obj The object. * - * @ingroup Elm_Genlist_Item + * @ingroup Elm_Genlist_Item_Group */ EOAPI void elm_obj_genlist_item_subitems_clear(Eo *obj); /** Promote an item to the top of the list. * - * @ingroup Elm_Genlist_Item + * @ingroup Elm_Genlist_Item_Group */ EOAPI void elm_obj_genlist_item_promote(Eo *obj); /** Demote an item to the end of the list. * - * @ingroup Elm_Genlist_Item + * @ingroup Elm_Genlist_Item_Group */ EOAPI void elm_obj_genlist_item_demote(Eo *obj); @@ -368,7 +376,7 @@ EOAPI void elm_obj_genlist_item_demote(Eo *obj); * @param[in] type The position to bring in, the given item to. @ref * Elm_Genlist_Item_Scrollto_Type. * - * @ingroup Elm_Genlist_Item + * @ingroup Elm_Genlist_Item_Group */ EOAPI void elm_obj_genlist_item_show(Eo *obj, Elm_Genlist_Item_Scrollto_Type type); @@ -384,7 +392,7 @@ EOAPI void elm_obj_genlist_item_show(Eo *obj, Elm_Genlist_Item_Scrollto_Type typ * @param[in] type The position to bring in, the given item to. @ref * Elm_Genlist_Item_Scrollto_Type. * - * @ingroup Elm_Genlist_Item + * @ingroup Elm_Genlist_Item_Group */ EOAPI void elm_obj_genlist_item_bring_in(Eo *obj, Elm_Genlist_Item_Scrollto_Type type); @@ -398,7 +406,7 @@ EOAPI void elm_obj_genlist_item_bring_in(Eo *obj, Elm_Genlist_Item_Scrollto_Type * @param[in] obj The object. * @param[out] l The contents list to return. * - * @ingroup Elm_Genlist_Item + * @ingroup Elm_Genlist_Item_Group */ EOAPI void elm_obj_genlist_item_all_contents_unset(Eo *obj, Eina_List **l); @@ -419,7 +427,7 @@ EOAPI void elm_obj_genlist_item_all_contents_unset(Eo *obj, Eina_List **l); * elm_genlist_item_fields_update. * @param[in] obj The object. * - * @ingroup Elm_Genlist_Item + * @ingroup Elm_Genlist_Item_Group */ EOAPI void elm_obj_genlist_item_update(Eo *obj); @@ -438,7 +446,7 @@ EOAPI void elm_obj_genlist_item_update(Eo *obj); * @param[in] parts The name of item's part. * @param[in] itf The type of item's part type. * - * @ingroup Elm_Genlist_Item + * @ingroup Elm_Genlist_Item_Group */ EOAPI void elm_obj_genlist_item_fields_update(Eo *obj, const char *parts, Elm_Genlist_Item_Field_Type itf); @@ -452,7 +460,7 @@ EOAPI void elm_obj_genlist_item_fields_update(Eo *obj, const char *parts, Elm_Ge * @param[in] obj The object. * @param[in] itc The item class for the item. * - * @ingroup Elm_Genlist_Item + * @ingroup Elm_Genlist_Item_Group */ EOAPI void elm_obj_genlist_item_class_update(Eo *obj, const Elm_Genlist_Item_Class *itc); @@ -489,7 +497,7 @@ EOAPI void elm_obj_genlist_item_class_update(Eo *obj, const Elm_Genlist_Item_Cla * @param[in] decorate_it_type Mode name. * @param[in] decorate_it_set Boolean to define set or unset mode. * - * @ingroup Elm_Genlist_Item + * @ingroup Elm_Genlist_Item_Group */ EOAPI void elm_obj_genlist_item_decorate_mode_set(Eo *obj, const char *decorate_it_type, Eina_Bool decorate_it_set); diff --git a/src/lib/elementary/elm_genlist_item_eo.legacy.h b/src/lib/elementary/elm_genlist_item_eo.legacy.h index 7ef94fcb32..587e45c212 100644 --- a/src/lib/elementary/elm_genlist_item_eo.legacy.h +++ b/src/lib/elementary/elm_genlist_item_eo.legacy.h @@ -15,6 +15,11 @@ typedef Eo Elm_Genlist_Item; #endif /** + * @defgroup Elm_Genlist_Item_Group Genlist Item + * @ingroup Elm_Genlist_Group + */ + +/** * @brief Get the previous item in a genlist widget's internal list of items, * given a handle to one of those items. * diff --git a/src/lib/elementary/elm_genlist_legacy.h b/src/lib/elementary/elm_genlist_legacy.h index 938c6b8f29..1109c88c4a 100644 --- a/src/lib/elementary/elm_genlist_legacy.h +++ b/src/lib/elementary/elm_genlist_legacy.h @@ -11,7 +11,7 @@ * @see elm_object_item_del() * @see elm_genlist_clear() * - * @ingroup Elm_Genlist + * @ingroup Elm_Genlist_Group */ EAPI Evas_Object *elm_genlist_add(Evas_Object *parent); @@ -25,7 +25,7 @@ EAPI Evas_Object *elm_genlist_add(Evas_Object *parent); * @return The item stored in @p obj at position @p nth or @c NULL, if there's * no item with that index (and on errors) * - * @ingroup Genilst + * @ingroup Elm_Genlist_Group * @since 1.8 */ EAPI Elm_Object_Item * diff --git a/src/lib/elementary/elm_genlist_pan_eo.h b/src/lib/elementary/elm_genlist_pan_eo.h index 1826f84584..0b1ba2601f 100644 --- a/src/lib/elementary/elm_genlist_pan_eo.h +++ b/src/lib/elementary/elm_genlist_pan_eo.h @@ -19,6 +19,6 @@ typedef Eo Elm_Genlist_Pan; */ #define ELM_GENLIST_PAN_CLASS elm_genlist_pan_class_get() -EWAPI const Efl_Class *elm_genlist_pan_class_get(void); +EWAPI const Efl_Class *elm_genlist_pan_class_get(void) EINA_CONST; #endif diff --git a/src/lib/elementary/elm_gesture_layer.c b/src/lib/elementary/elm_gesture_layer.c index de1fe793e3..2fb1a43e2b 100644 --- a/src/lib/elementary/elm_gesture_layer.c +++ b/src/lib/elementary/elm_gesture_layer.c @@ -614,8 +614,10 @@ _state_report(Gesture_Info *gesture, * send ptr to user * callback */ { + Eina_Inlist *itr; Func_Data *cb_info; - EINA_INLIST_FOREACH(gesture->cbs[gesture->state], cb_info) + /* elm_gesture_layer_cb_del can be called in Elm_Gesture_Event_Cb cb */ + EINA_INLIST_FOREACH_SAFE(gesture->cbs[gesture->state], itr, cb_info) flags |= cb_info->cb(cb_info->user_data, info); } @@ -1145,11 +1147,12 @@ _pending_device_add(Eina_List *list, * user may cancel refeed of events by setting repeat events. * * @param obj The gesture-layer object. + * @param need_reset Clear all gestures data or not. * * @ingroup Elm_Gesture_Layer */ static Eina_Bool -_event_history_clear(Evas_Object *obj) +_event_history_clear(Evas_Object *obj, Eina_Bool need_reset) { int i; Gesture_Info *p; @@ -1179,16 +1182,17 @@ _event_history_clear(Evas_Object *obj) _states_reset(sd); /* we are ready to start testing for gestures again */ /* Clear all gestures intermediate data */ - { - /* FIXME: +1 because of the mistake in the enum. */ - Gesture_Info **gitr = sd->gesture + 1; - Tests_Array_Funcs *fitr = _glayer_tests_array + 1; - for (; fitr->reset; fitr++, gitr++) - { - if (IS_TESTED_GESTURE(*gitr)) - fitr->reset(*gitr); - } - } + if (need_reset) + { + /* FIXME: +1 because of the mistake in the enum. */ + Gesture_Info **gitr = sd->gesture + 1; + Tests_Array_Funcs *fitr = _glayer_tests_array + 1; + for (; fitr->reset; fitr++, gitr++) + { + if (IS_TESTED_GESTURE(*gitr)) + fitr->reset(*gitr); + } + } /* Disable gesture layer so refeeded events won't be consumed by it */ _callbacks_unregister(obj); @@ -1263,7 +1267,7 @@ _clear_if_finished(Evas_Object *obj) } if (reset_s && (!all_undefined)) - return _event_history_clear(obj); + return _event_history_clear(obj, EINA_TRUE); return EINA_FALSE; } @@ -1348,6 +1352,7 @@ _event_process(void *data, ELM_GESTURE_LAYER_DATA_GET(data, sd); + evas_object_ref(sd->target); /* Start testing candidate gesture from here */ if (_pointer_event_make(data, event_info, event_type, &_pe)) pe = &_pe; @@ -1386,6 +1391,8 @@ _event_process(void *data, Eina_Bool states_reset = _clear_if_finished(data); if (sd->glayer_continues_enable) _continues_gestures_restart(data, states_reset); + + evas_object_unref(sd->target); } static Eina_Bool @@ -3182,7 +3189,7 @@ _zoom_compute(Zoom_Type *st, * @internal * * This function handles zoom with mouse wheel. - * thats a combination of wheel + CTRL key. + * that's a combination of wheel + CTRL key. * @param obj The gesture-layer object. * @param event_info Original input event pointer. * @param event_type Type of original input event. @@ -3812,7 +3819,7 @@ _elm_gesture_layer_efl_canvas_group_group_del(Eo *obj, Elm_Gesture_Layer_Data *s ecore_timer_del(sd->gest_taps_timeout); /* Then take care of clearing events */ - _event_history_clear(obj); + _event_history_clear(obj, EINA_FALSE); sd->pending = eina_list_free(sd->pending); EINA_LIST_FREE(sd->touched, data) diff --git a/src/lib/elementary/elm_gesture_layer.h b/src/lib/elementary/elm_gesture_layer.h index 5987f89765..919d19af04 100644 --- a/src/lib/elementary/elm_gesture_layer.h +++ b/src/lib/elementary/elm_gesture_layer.h @@ -1,5 +1,5 @@ /** - * @defgroup Elm_Gesture_Layer Gesture Layer + * @defgroup Elm_Gesture_Layer_Group Gesture Layer * @ingroup Elementary * * @image html gesture_layer_inheritance_tree.png diff --git a/src/lib/elementary/elm_gesture_layer_eo.h b/src/lib/elementary/elm_gesture_layer_eo.h index 2f15a10660..ce2fa70a75 100644 --- a/src/lib/elementary/elm_gesture_layer_eo.h +++ b/src/lib/elementary/elm_gesture_layer_eo.h @@ -52,7 +52,7 @@ typedef enum */ #define ELM_GESTURE_LAYER_CLASS elm_gesture_layer_class_get() -EWAPI const Efl_Class *elm_gesture_layer_class_get(void); +EWAPI const Efl_Class *elm_gesture_layer_class_get(void) EINA_CONST; /** * @brief Control step value for zoom action. diff --git a/src/lib/elementary/elm_gesture_layer_extra_gestures.c b/src/lib/elementary/elm_gesture_layer_extra_gestures.c index b7bce1926c..dd663a8e79 100644 --- a/src/lib/elementary/elm_gesture_layer_extra_gestures.c +++ b/src/lib/elementary/elm_gesture_layer_extra_gestures.c @@ -50,7 +50,7 @@ _tap_long_single_tap_start_cb(void *data, void *event_info) Evas_Event_Flags flags = EVAS_EVENT_FLAG_NONE; if (!info->nb_taps_on_single) { - gl_debug("\n%s\n", __FUNCTION__); + gl_debug("\n%s\n", __func__); _cb_call(info, ELM_GESTURE_STATE_START, event_info); } return flags; @@ -63,7 +63,7 @@ _tap_long_single_tap_abort_cb(void *data, void *event_info EINA_UNUSED) Evas_Event_Flags flags = EVAS_EVENT_FLAG_NONE; if (!info->long_tap_started) { - gl_debug("%s\n", __FUNCTION__); + gl_debug("%s\n", __func__); _cb_call(info, ELM_GESTURE_STATE_ABORT, NULL); info->nb_taps_on_single = 0; } @@ -73,7 +73,7 @@ _tap_long_single_tap_abort_cb(void *data, void *event_info EINA_UNUSED) static Eina_Bool _tap_long_timeout(void *data) { - gl_debug("%s\n", __FUNCTION__); + gl_debug("%s\n", __func__); Tap_Longpress_Info *info = data; _tap_long_single_tap_abort_cb(info, NULL); info->timer_between_taps = NULL; @@ -83,7 +83,7 @@ _tap_long_timeout(void *data) static Evas_Event_Flags _tap_long_single_tap_end_cb(void *data, void *event_info) { - gl_debug("%s\n", __FUNCTION__); + gl_debug("%s\n", __func__); Tap_Longpress_Info *info = data; Evas_Event_Flags flags = EVAS_EVENT_FLAG_NONE; double timeout_between_taps = elm_gesture_layer_double_tap_timeout_get(info->obj); @@ -100,7 +100,7 @@ _tap_long_long_tap_start_cb(void *data, void *event_info EINA_UNUSED) Evas_Event_Flags flags = EVAS_EVENT_FLAG_NONE; if (info->nb_taps_on_single && info->timer_between_taps) { - gl_debug("%s\n", __FUNCTION__); + gl_debug("%s\n", __func__); info->long_tap_started = EINA_TRUE; ecore_timer_del(info->timer_between_taps); info->timer_between_taps = NULL; @@ -115,7 +115,7 @@ _tap_long_long_tap_abort_cb(void *data, void *event_info EINA_UNUSED) Evas_Event_Flags flags = EVAS_EVENT_FLAG_NONE; if (info->long_tap_started) { - gl_debug("%s\n", __FUNCTION__); + gl_debug("%s\n", __func__); _cb_call(info, ELM_GESTURE_STATE_ABORT, NULL); info->nb_taps_on_single = 0; info->long_tap_started = EINA_FALSE; @@ -136,7 +136,7 @@ _tap_long_long_tap_move_cb(void *data, void *event_info) } else { - gl_debug("%s\n", __FUNCTION__); + gl_debug("%s\n", __func__); _cb_call(info, ELM_GESTURE_STATE_MOVE, event_info); } } @@ -150,7 +150,7 @@ _tap_long_long_tap_end_cb(void *data, void *event_info) Evas_Event_Flags flags = EVAS_EVENT_FLAG_NONE; if (info->long_tap_started) { - gl_debug("%s\n", __FUNCTION__); + gl_debug("%s\n", __func__); _cb_call(info, ELM_GESTURE_STATE_END, event_info); info->long_tap_started = EINA_FALSE; info->nb_taps_on_single = 0; diff --git a/src/lib/elementary/elm_gesture_layer_legacy.h b/src/lib/elementary/elm_gesture_layer_legacy.h index 7c67737e93..a77ae588ec 100644 --- a/src/lib/elementary/elm_gesture_layer_legacy.h +++ b/src/lib/elementary/elm_gesture_layer_legacy.h @@ -10,7 +10,7 @@ * This does not activate the gesture layer. You have to * call elm_gesture_layer_attach() in order to 'activate' gesture-layer. * - * @ingroup Elm_Gesture_Layer + * @ingroup Elm_Gesture_Layer_Group */ EAPI Evas_Object *elm_gesture_layer_add(Evas_Object *parent); @@ -32,7 +32,7 @@ EAPI Evas_Object *elm_gesture_layer_add(Evas_Object *parent); * * @see elm_gesture_layer_tap_longpress_cb_del * @since 1.8 - * @ingroup Elm_Gesture_Layer + * @ingroup Elm_Gesture_Layer_Group */ EAPI void elm_gesture_layer_tap_longpress_cb_add(Evas_Object *obj, Elm_Gesture_State state, Elm_Gesture_Event_Cb cb, void *data); @@ -49,6 +49,6 @@ EAPI void elm_gesture_layer_tap_longpress_cb_add(Evas_Object *obj, Elm_Gesture_S * * @see elm_gesture_layer_tap_longpress_cb_add * @since 1.8 - * @ingroup Elm_Gesture_Layer + * @ingroup Elm_Gesture_Layer_Group */ EAPI void elm_gesture_layer_tap_longpress_cb_del(Evas_Object *obj, Elm_Gesture_State state, Elm_Gesture_Event_Cb cb, void *data); diff --git a/src/lib/elementary/elm_glview.c b/src/lib/elementary/elm_glview.c index a33921a4c9..eaa01f0cf0 100644 --- a/src/lib/elementary/elm_glview.c +++ b/src/lib/elementary/elm_glview.c @@ -53,7 +53,8 @@ _glview_update_surface(Evas_Object *obj) ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd); if (!sd) return; - evas_gl_make_current(sd->evasgl, NULL, NULL); + if (!evas_gl_make_current(sd->evasgl, NULL, NULL)) + return; if (sd->surface) { diff --git a/src/lib/elementary/elm_glview.h b/src/lib/elementary/elm_glview.h index 5829354760..227d3aac16 100644 --- a/src/lib/elementary/elm_glview.h +++ b/src/lib/elementary/elm_glview.h @@ -1,5 +1,5 @@ /** - * @defgroup Elm_GLView GLView + * @defgroup Elm_Glview_Group GLView * @ingroup Elementary * * @image html glview_inheritance_tree.png @@ -23,7 +23,8 @@ */ /** - * @ingroup Elm_GLView + * @addtogroup Elm_Glview_Group + * @{ */ #include "elm_glview_common.h" diff --git a/src/lib/elementary/elm_glview_common.h b/src/lib/elementary/elm_glview_common.h index c84d49bef4..6ebea9054f 100644 --- a/src/lib/elementary/elm_glview_common.h +++ b/src/lib/elementary/elm_glview_common.h @@ -1,5 +1,5 @@ /** - * @addtogroup Elm_GLView + * @addtogroup Elm_Glview_Group * * @{ */ diff --git a/src/lib/elementary/elm_glview_eo.h b/src/lib/elementary/elm_glview_eo.h index 9e8879b805..b693e19587 100644 --- a/src/lib/elementary/elm_glview_eo.h +++ b/src/lib/elementary/elm_glview_eo.h @@ -26,7 +26,7 @@ typedef Eo Elm_Glview; * * See @ref elm_obj_glview_mode_set See elm_opengl_page * - * @ingroup Elm_GLView + * @ingroup Elm_Glview_Group */ typedef enum { @@ -118,7 +118,7 @@ typedef enum */ #define ELM_GLVIEW_CLASS elm_glview_class_get() -EWAPI const Efl_Class *elm_glview_class_get(void); +EWAPI const Efl_Class *elm_glview_class_get(void) EINA_CONST; /** * @brief Constructor with context version number. diff --git a/src/lib/elementary/elm_glview_eo.legacy.h b/src/lib/elementary/elm_glview_eo.legacy.h index 562b31207d..e3ac066d5c 100644 --- a/src/lib/elementary/elm_glview_eo.legacy.h +++ b/src/lib/elementary/elm_glview_eo.legacy.h @@ -26,7 +26,7 @@ typedef Eo Elm_Glview; * * See @ref elm_glview_mode_set See elm_opengl_page * - * @ingroup Elm_GLView + * @ingroup Elm_Glview_Group */ typedef enum { diff --git a/src/lib/elementary/elm_glview_legacy.h b/src/lib/elementary/elm_glview_legacy.h index 84e148c511..a5f66aaa65 100644 --- a/src/lib/elementary/elm_glview_legacy.h +++ b/src/lib/elementary/elm_glview_legacy.h @@ -4,7 +4,7 @@ * @param parent The parent object * @return The new object or NULL if it cannot be created * - * @ingroup Elm_GLView + * @ingroup Elm_Glview_Group */ EAPI Evas_Object *elm_glview_add(Evas_Object *parent); @@ -25,7 +25,7 @@ EAPI Evas_Object *elm_glview_version_add(Evas_Object *parent, Evas_GL_Context_Ve * * @param obj The GLView object * - * @ingroup Elm_GLView + * @ingroup Elm_Glview_Group */ EAPI void elm_glview_changed_set(Evas_Object *obj); @@ -36,7 +36,7 @@ EAPI void elm_glview_changed_set(Evas_Object *obj); * @param w pointer of int width * @param h pointer of int height * - * @ingroup Elm_GLView + * @ingroup Elm_Glview_Group */ EAPI void elm_glview_size_get(const Evas_Object *obj, int *w, int *h); @@ -47,7 +47,7 @@ EAPI void elm_glview_size_get(const Evas_Object *obj, int *w, int *h); * @param w width of GLView * @param h height of GLView * - * @ingroup Elm_GLView + * @ingroup Elm_Glview_Group */ EAPI void elm_glview_size_set(Evas_Object *obj, int w, int h); @@ -66,7 +66,7 @@ EAPI void elm_glview_init_func_set(Evas_Object *obj, Elm_GLView_Func_Cb func); * @param obj The GLView object * @param func The callback function * - * @ingroup Elm_GLView + * @ingroup Elm_Glview_Group */ EAPI void elm_glview_del_func_set(Evas_Object *obj, Elm_GLView_Func_Cb func); @@ -76,7 +76,7 @@ EAPI void elm_glview_del_func_set(Evas_Object *obj, Elm_GLView_Func_Cb func); * @param obj The GLView object * @param func The callback function * - * @ingroup Elm_GLView + * @ingroup Elm_Glview_Group */ EAPI void elm_glview_resize_func_set(Evas_Object *obj, Elm_GLView_Func_Cb func); @@ -86,7 +86,7 @@ EAPI void elm_glview_resize_func_set(Evas_Object *obj, Elm_GLView_Func_Cb func); * @param obj The GLView object * @param func The callback function * - * @ingroup Elm_GLView + * @ingroup Elm_Glview_Group */ EAPI void elm_glview_render_func_set(Evas_Object *obj, Elm_GLView_Func_Cb func); #include "elm_glview_eo.legacy.h" diff --git a/src/lib/elementary/elm_grid.c b/src/lib/elementary/elm_grid.c index 6548f21e16..39a7b9cbc8 100644 --- a/src/lib/elementary/elm_grid.c +++ b/src/lib/elementary/elm_grid.c @@ -73,22 +73,19 @@ _elm_grid_efl_canvas_group_group_add(Eo *obj, void *_pd EINA_UNUSED) EOLIAN static void _elm_grid_efl_canvas_group_group_del(Eo *obj, void *_pd EINA_UNUSED) { - Eina_List *l; - Evas_Object *child; - ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd); /* let's make our grid object the *last* to be processed, since it * may (smart) parent other sub objects here */ - EINA_LIST_FOREACH(wd->subobjs, l, child) - { - if (child == wd->resize_obj) - { - wd->subobjs = - eina_list_demote_list(wd->subobjs, l); - break; - } - } + { + unsigned int resize_id = 0; + if (eina_array_find(wd->children, wd->resize_obj, &resize_id)) + { + //exchange with last + eina_array_data_set(wd->children, resize_id, eina_array_data_get(wd->children, eina_array_count(wd->children) - 1)); + eina_array_data_set(wd->children, eina_array_count(wd->children) - 1, wd->resize_obj); + } + } efl_canvas_group_del(efl_super(obj, MY_CLASS)); } diff --git a/src/lib/elementary/elm_grid.h b/src/lib/elementary/elm_grid.h index 0888ac4dff..f928c586af 100644 --- a/src/lib/elementary/elm_grid.h +++ b/src/lib/elementary/elm_grid.h @@ -1,5 +1,5 @@ /** - * @defgroup Elm_Grid Grid + * @defgroup Elm_Grid_Group Grid * @ingroup Elementary * * @image html grid_inheritance_tree.png diff --git a/src/lib/elementary/elm_grid_eo.h b/src/lib/elementary/elm_grid_eo.h index d9ae0a821e..6b71e0855f 100644 --- a/src/lib/elementary/elm_grid_eo.h +++ b/src/lib/elementary/elm_grid_eo.h @@ -19,7 +19,7 @@ typedef Eo Elm_Grid; */ #define ELM_GRID_CLASS elm_grid_class_get() -EWAPI const Efl_Class *elm_grid_class_get(void); +EWAPI const Efl_Class *elm_grid_class_get(void) EINA_CONST; /** * @brief Set the virtual size of the grid diff --git a/src/lib/elementary/elm_grid_legacy.h b/src/lib/elementary/elm_grid_legacy.h index 6884fb1c06..f3ded0dffc 100644 --- a/src/lib/elementary/elm_grid_legacy.h +++ b/src/lib/elementary/elm_grid_legacy.h @@ -4,7 +4,7 @@ * @param parent The parent object * @return The new object or NULL if it cannot be created * - * @ingroup Elm_Grid + * @ingroup Elm_Grid_Group */ EAPI Evas_Object *elm_grid_add(Evas_Object *parent); @@ -17,7 +17,7 @@ EAPI Evas_Object *elm_grid_add(Evas_Object *parent); * @param w The virtual width at which to pack it * @param h The virtual height at which to pack it * - * @ingroup Elm_Grid + * @ingroup Elm_Grid_Group */ EAPI void elm_grid_pack_set(Evas_Object *subobj, Evas_Coord x, Evas_Coord y, Evas_Coord w, Evas_Coord h); @@ -30,8 +30,8 @@ EAPI void elm_grid_pack_set(Evas_Object *subobj, Evas_Coord x, Evas_Coor * @param w Pointer to integer to store the virtual width * @param h Pointer to integer to store the virtual height * - * @ingroup Elm_Grid + * @ingroup Elm_Grid_Group */ EAPI void elm_grid_pack_get(Evas_Object *subobj, Evas_Coord *x, Evas_Coord *y, Evas_Coord *w, Evas_Coord *h); -#include "elm_grid_eo.legacy.h"
\ No newline at end of file +#include "elm_grid_eo.legacy.h" diff --git a/src/lib/elementary/elm_helper.h b/src/lib/elementary/elm_helper.h index 488372939a..a0ae990a81 100644 --- a/src/lib/elementary/elm_helper.h +++ b/src/lib/elementary/elm_helper.h @@ -68,7 +68,7 @@ elm_validator_regexp_free(Elm_Validator_Regexp *validator) EINA_ARG_NONNULL(1); /** * @brief Get the validation status. * - * @param The given validator + * @param validator The given validator * * @note All return value see here: http://www.gnu.org/software/libc/manual/html_node/Regular-Expressions.html * diff --git a/src/lib/elementary/elm_hover.h b/src/lib/elementary/elm_hover.h index 342b3e3ba6..eeac7708c9 100644 --- a/src/lib/elementary/elm_hover.h +++ b/src/lib/elementary/elm_hover.h @@ -27,11 +27,11 @@ * @li menu * @li hoversel_vertical * - * This widget inherits from the @ref Layout one, so that all the + * This widget inherits from the @ref Elm_Layout one, so that all the * functions acting on it also work for hover objects. * * This widget emits the following signals, besides the ones sent from - * @ref Layout: + * @ref Elm_Layout : * @li @c "clicked" - the user clicked the empty space in the hover to dismiss * @li @c "dismissed" - the user clicked the empty space in the hover to dismiss (since 1.8) * @li @c "smart,changed" - a content object placed under the "smart" diff --git a/src/lib/elementary/elm_hover_eo.h b/src/lib/elementary/elm_hover_eo.h index 8030a27851..60275fd9c5 100644 --- a/src/lib/elementary/elm_hover_eo.h +++ b/src/lib/elementary/elm_hover_eo.h @@ -32,7 +32,7 @@ typedef enum */ #define ELM_HOVER_CLASS elm_hover_class_get() -EWAPI const Efl_Class *elm_hover_class_get(void); +EWAPI const Efl_Class *elm_hover_class_get(void) EINA_CONST; /** * @brief Sets the target object for the hover. diff --git a/src/lib/elementary/elm_hoversel_eo.h b/src/lib/elementary/elm_hoversel_eo.h index cdbf7fcc42..ac4180b5dd 100644 --- a/src/lib/elementary/elm_hoversel_eo.h +++ b/src/lib/elementary/elm_hoversel_eo.h @@ -19,7 +19,7 @@ typedef Eo Elm_Hoversel; */ #define ELM_HOVERSEL_CLASS elm_hoversel_class_get() -EWAPI const Efl_Class *elm_hoversel_class_get(void); +EWAPI const Efl_Class *elm_hoversel_class_get(void) EINA_CONST; /** * @brief Control if the hoversel should expand horizontally. diff --git a/src/lib/elementary/elm_hoversel_item_eo.h b/src/lib/elementary/elm_hoversel_item_eo.h index 13953aef0c..f8645bd831 100644 --- a/src/lib/elementary/elm_hoversel_item_eo.h +++ b/src/lib/elementary/elm_hoversel_item_eo.h @@ -19,7 +19,7 @@ typedef Eo Elm_Hoversel_Item; */ #define ELM_HOVERSEL_ITEM_CLASS elm_hoversel_item_class_get() -EWAPI const Efl_Class *elm_hoversel_item_class_get(void); +EWAPI const Efl_Class *elm_hoversel_item_class_get(void) EINA_CONST; /** * @brief This controls the icon for the given hoversel item. diff --git a/src/lib/elementary/elm_icon.c b/src/lib/elementary/elm_icon.c index 910933d22f..b6aeff0135 100644 --- a/src/lib/elementary/elm_icon.c +++ b/src/lib/elementary/elm_icon.c @@ -85,9 +85,16 @@ _icon_thumb_display(Elm_Icon_Data *sd) int prefix_size; const char **ext, *ptr; static const char *extensions[] = - { - ".avi", ".mp4", ".ogv", ".mov", ".mpg", ".wmv", NULL - }; + { + ".asf", ".avi", ".bdm", ".bdmv", ".clpi", ".cpi", ".dv", ".fla", + ".flv", ".m1v", ".m2t", ".m2v", ".m4v", ".mkv", ".mov", ".mp2", + ".mp2ts", ".mp4", ".mpe", ".mpeg", ".mpg", ".mpl", ".mpls", ".mts", + ".mxf", ".nut", ".nuv", ".ogg", ".ogm", ".ogv", ".qt", ".rm", ".rmj", + ".rmm", ".rms", ".rmvb", ".rmx", ".rv", ".swf", ".ts", ".weba", + ".webm", ".wmv", ".3g2", ".3gp", ".3gp2", ".3gpp", ".3gpp2", ".3p2", + ".264", + NULL + }; prefix_size = eina_stringshare_strlen(sd->thumb.file.path) - 4; if (prefix_size >= 0) @@ -322,7 +329,7 @@ _elm_icon_efl_file_load(Eo *obj, Elm_Icon_Data *sd) if (efl_file_loaded_get(obj)) return 0; err = efl_file_load(efl_super(obj, MY_CLASS)); if (err) return err; - + Efl_Ui_Image_Data *id = efl_data_scope_get(obj, EFL_UI_IMAGE_CLASS); _edje_signals_free(sd); diff --git a/src/lib/elementary/elm_icon_eo.h b/src/lib/elementary/elm_icon_eo.h index b53fed2b44..42e175a8be 100644 --- a/src/lib/elementary/elm_icon_eo.h +++ b/src/lib/elementary/elm_icon_eo.h @@ -19,7 +19,7 @@ typedef Eo Elm_Icon; */ #define ELM_ICON_CLASS elm_icon_class_get() -EWAPI const Efl_Class *elm_icon_class_get(void); +EWAPI const Efl_Class *elm_icon_class_get(void) EINA_CONST; EWAPI extern const Efl_Event_Description _ELM_ICON_EVENT_THUMB_DONE; diff --git a/src/lib/elementary/elm_index.c b/src/lib/elementary/elm_index.c index 00ac57c711..6a4751c6e2 100644 --- a/src/lib/elementary/elm_index.c +++ b/src/lib/elementary/elm_index.c @@ -517,6 +517,17 @@ _elm_index_efl_ui_widget_theme_apply(Eo *obj, Elm_Index_Data *sd) } EOLIAN static void +_elm_index_efl_canvas_group_group_calculate(Eo *obj, Elm_Index_Data *_pd EINA_UNUSED) +{ + Evas_Coord minw = -1, minh = -1; + ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd); + + edje_object_size_min_calc(wd->resize_obj, &minw, &minh); + evas_object_size_hint_min_set(obj, minw, minh); + evas_object_size_hint_max_set(obj, -1, -1); +} + +EOLIAN static void _elm_index_item_efl_object_destructor(Eo *eo_item EINA_UNUSED, Elm_Index_Item_Data *it) { ELM_INDEX_DATA_GET(WIDGET(it), sd); @@ -1693,6 +1704,7 @@ _elm_index_item_efl_access_widget_action_elm_actions_get(const Eo *eo_it EINA_UN /* Internal EO APIs and hidden overrides */ #define ELM_INDEX_EXTRA_OPS \ + EFL_CANVAS_GROUP_CALC_OPS(elm_index), \ EFL_CANVAS_GROUP_ADD_DEL_OPS(elm_index) #include "elm_index_item_eo.c" diff --git a/src/lib/elementary/elm_index.h b/src/lib/elementary/elm_index.h index 6ede67b8d5..69f2b9a719 100644 --- a/src/lib/elementary/elm_index.h +++ b/src/lib/elementary/elm_index.h @@ -1,5 +1,5 @@ /** - * @defgroup Elm_Index Index + * @defgroup Elm_Index_Group Index * @ingroup Elementary * * @image html index_inheritance_tree.png @@ -55,7 +55,7 @@ */ /** - * @addtogroup Elm_Index + * @addtogroup Elm_Index_Group * @{ */ diff --git a/src/lib/elementary/elm_index_eo.h b/src/lib/elementary/elm_index_eo.h index 32af5b1d7b..c7fc586465 100644 --- a/src/lib/elementary/elm_index_eo.h +++ b/src/lib/elementary/elm_index_eo.h @@ -19,7 +19,7 @@ typedef Eo Elm_Index; */ #define ELM_INDEX_CLASS elm_index_class_get() -EWAPI const Efl_Class *elm_index_class_get(void); +EWAPI const Efl_Class *elm_index_class_get(void) EINA_CONST; /** * @brief Enable or disable auto hiding feature for a given index widget. diff --git a/src/lib/elementary/elm_index_item_eo.h b/src/lib/elementary/elm_index_item_eo.h index 39c8a9e0be..e4dbbf820b 100644 --- a/src/lib/elementary/elm_index_item_eo.h +++ b/src/lib/elementary/elm_index_item_eo.h @@ -19,7 +19,7 @@ typedef Eo Elm_Index_Item; */ #define ELM_INDEX_ITEM_CLASS elm_index_item_class_get() -EWAPI const Efl_Class *elm_index_item_class_get(void); +EWAPI const Efl_Class *elm_index_item_class_get(void) EINA_CONST; /** * @brief Set the selected state of an item. diff --git a/src/lib/elementary/elm_index_item_eo.legacy.h b/src/lib/elementary/elm_index_item_eo.legacy.h index d4286f7cef..184401d018 100644 --- a/src/lib/elementary/elm_index_item_eo.legacy.h +++ b/src/lib/elementary/elm_index_item_eo.legacy.h @@ -15,6 +15,11 @@ typedef Eo Elm_Index_Item; #endif /** + * @defgroup Elm_Index_Item_Group Index Item + * @ingroup Elm_Index_Group + */ + +/** * @brief Set the selected state of an item. * * This sets the selected state of the given item @c it. @c true for selected, diff --git a/src/lib/elementary/elm_index_legacy.h b/src/lib/elementary/elm_index_legacy.h index 7f8e7df2eb..d570262f0c 100644 --- a/src/lib/elementary/elm_index_legacy.h +++ b/src/lib/elementary/elm_index_legacy.h @@ -7,7 +7,7 @@ * * This function inserts a new index widget on the canvas. * - * @ingroup Elm_Index + * @ingroup Elm_Index_Group */ EAPI Evas_Object *elm_index_add(Evas_Object *parent); @@ -23,7 +23,7 @@ EAPI Evas_Object *elm_index_add(Evas_Object *parent); * it, i.e., to enable vertical mode. it's an area one Fingers "finger" wide on * the bottom side of the index widget's container. * - * @ingroup Elm_Index + * @ingroup Elm_Index_Group */ EAPI void elm_index_horizontal_set(Evas_Object *obj, Eina_Bool horizontal); @@ -39,7 +39,7 @@ EAPI void elm_index_horizontal_set(Evas_Object *obj, Eina_Bool horizontal); * @return Current status of horizontal mode on index object. * @c true if horizontal mode is enabled or @c false if disabled. * - * @ingroup Elm_Index + * @ingroup Elm_Index_Group */ EAPI Eina_Bool elm_index_horizontal_get(const Evas_Object *obj); diff --git a/src/lib/elementary/elm_interface_fileselector.c b/src/lib/elementary/elm_interface_fileselector.c index 98d6552c70..bec043a88f 100644 --- a/src/lib/elementary/elm_interface_fileselector.c +++ b/src/lib/elementary/elm_interface_fileselector.c @@ -4,7 +4,7 @@ #include "elm_priv.h" -#include "Eio_Eo.h" +#include "Eio.h" #include "elm_interface_fileselector.h" diff --git a/src/lib/elementary/elm_interface_fileselector_eo.h b/src/lib/elementary/elm_interface_fileselector_eo.h index f0996f18ae..dece644a6f 100644 --- a/src/lib/elementary/elm_interface_fileselector_eo.h +++ b/src/lib/elementary/elm_interface_fileselector_eo.h @@ -53,7 +53,7 @@ typedef enum */ #define ELM_INTERFACE_FILESELECTOR_INTERFACE elm_interface_fileselector_interface_get() -EWAPI const Efl_Class *elm_interface_fileselector_interface_get(void); +EWAPI const Efl_Class *elm_interface_fileselector_interface_get(void) EINA_CONST; /** * @brief Enable/disable folder-only view for a given file selector widget diff --git a/src/lib/elementary/elm_interface_scrollable.c b/src/lib/elementary/elm_interface_scrollable.c index 7130efbd94..0721f94030 100644 --- a/src/lib/elementary/elm_interface_scrollable.c +++ b/src/lib/elementary/elm_interface_scrollable.c @@ -946,8 +946,8 @@ _elm_scroll_scroll_bar_size_adjust(Elm_Scrollable_Smart_Interface_Data *sid) -((double)sid->page.y * ((double)vh / (double)h)) / 100.0); elm_obj_pan_pos_get(sid->pan_obj, &px, &py); - if (vx != mx) x = px; - if (vy != my) y = py; + if (!EINA_DBL_EQ(vx, mx)) x = px; + if (!EINA_DBL_EQ(vy, my)) y = py; elm_obj_pan_pos_set(sid->pan_obj, x, y); if (mx > 0) vx = (double)(x - minx) / (double)mx; @@ -2052,10 +2052,11 @@ _scroll_wheel_post_event_cb(void *data, Evas *e EINA_UNUSED) Evas_Coord x = 0, y = 0, vw = 0, vh = 0, cw = 0, ch = 0; int pagenumber_h = 0, pagenumber_v = 0; - int mx = 0, my = 0, minx = 0, miny = 0; + int mx = 0, my = 0, minx = 0, miny = 0, panw = 0, panh = 0; Eina_Bool hold = EINA_FALSE; Evas_Coord pwx, pwy; double t; + long long lx, ly; int direction; EINA_SAFETY_ON_NULL_RETURN_VAL(ev, EINA_TRUE); @@ -2075,6 +2076,7 @@ _scroll_wheel_post_event_cb(void *data, Evas *e EINA_UNUSED) if (sid->scrollto.y.animator) y = sid->scrollto.y.end; elm_obj_pan_pos_max_get(sid->pan_obj, &mx, &my); elm_obj_pan_pos_min_get(sid->pan_obj, &minx, &miny); + elm_pan_content_size_get(sid->pan_obj, &panw, &panh); if (x < minx) x = minx; if (x > mx) x = mx; if (y < miny) y = miny; @@ -2109,7 +2111,7 @@ _scroll_wheel_post_event_cb(void *data, Evas *e EINA_UNUSED) elm_obj_pan_content_size_get(sid->pan_obj, &cw, &ch); if (!_paging_is_enabled(sid)) { - int d = ev->z; + long long d = ev->z; double delta_t = (double)(ev->timestamp - sid->last_wheel) / 1000.0; double mul; @@ -2117,31 +2119,40 @@ _scroll_wheel_post_event_cb(void *data, Evas *e EINA_UNUSED) if (delta_t > 0.2) delta_t = 0.2; mul = 1.0 + (_elm_config->scroll_accel_factor * ((0.2 - delta_t) / 0.2)); mul = mul * (1.0 + (0.15 * sid->last_wheel_mul)); + if (d > 1000) d = 1000; + else if (d < -1000) d = -1000; + if (mul > 100000.0) mul = 100000.0; d *= mul; sid->last_wheel = ev->timestamp; sid->last_wheel_mul = mul; + lx = x; + ly = y; if (!direction) { if ((ch > vh) || (cw <= vw)) - y += d * sid->step.y; + ly += d * (long long)sid->step.y; else { - x += d * sid->step.x; + lx += d * (long long)sid->step.x; direction = 1; } } else { if ((cw > vw) || (ch <= vh)) - x += d * sid->step.x; + lx += d * (long long)sid->step.x; else { - y += d * sid->step.y; + ly += d * (long long)sid->step.y; direction = 0; } } - _scroll_wheel_post_event_go(sid, x, y); + if (ly < (0 - panh)) ly = 0 - panh; + else if (ly > (my + panh)) ly = my + panh; + if (lx < (0 - panw)) lx = 0 - panw; + else if (lx > (mx + panw)) lx = mx + panw; + _scroll_wheel_post_event_go(sid, lx, ly); } else { @@ -2281,8 +2292,8 @@ _elm_scroll_post_event_up(void *data, static Eina_Bool _paging_is_enabled(Elm_Scrollable_Smart_Interface_Data *sid) { - if ((sid->pagerel_h == 0.0) && (!sid->pagesize_h) && - (sid->pagerel_v == 0.0) && (!sid->pagesize_v)) + if (EINA_DBL_EQ(sid->pagerel_h, 0.0) && (!sid->pagesize_h) && + EINA_DBL_EQ(sid->pagerel_v, 0.0) && (!sid->pagesize_v)) return EINA_FALSE; return EINA_TRUE; } @@ -2303,7 +2314,7 @@ _elm_scroll_momentum_animator(void *data, const Efl_Event *event EINA_UNUSED) t = ecore_loop_time_get(); - if (sid->down.anim_dur == 0) dt = 1.0; + if (EINA_DBL_EQ(sid->down.anim_dur, 0)) dt = 1.0; else dt = (t - sid->down.anim_start) / sid->down.anim_dur; if (dt >= 0.0) @@ -2664,7 +2675,7 @@ _elm_scroll_momentum_calc(int dx, int dy, double dt, double *vx, double *vy, int double r = _elm_config->thumbscroll_momentum_friction; const int min_px = 3; - if ( dt == 0 ) return EINA_FALSE; + if (EINA_DBL_EQ(dt, 0)) return EINA_FALSE; // store sign value of distance sign_dx = (dx > 0) - (dx < 0); @@ -3738,7 +3749,7 @@ _elm_scroll_mouse_move_event_cb(void *data, else vy = 1.0; } - if ((vx != 0.0) || (vy != 0.0)) + if (EINA_DBL_NONZERO(vx) || EINA_DBL_NONZERO(vy)) { sid->down.onhold_vx = vx; sid->down.onhold_vy = vy; @@ -4032,6 +4043,9 @@ _elm_interface_scrollable_reset_signals(Eo *obj EINA_UNUSED, Elm_Scrollable_Smar { sid->go_up = sid->go_down = sid->go_right = sid->go_left = EINA_FALSE; + if (!sid->edje_obj) + return; + edje_object_signal_emit(sid->edje_obj, "elm,action,hide,up", "elm"); edje_object_signal_emit(sid->edje_obj, "elm,action,hide,down", "elm"); edje_object_signal_emit(sid->edje_obj, "elm,action,hide,right", "elm"); diff --git a/src/lib/elementary/elm_interface_scrollable.h b/src/lib/elementary/elm_interface_scrollable.h index 93a5f66dcd..29079e3bac 100644 --- a/src/lib/elementary/elm_interface_scrollable.h +++ b/src/lib/elementary/elm_interface_scrollable.h @@ -74,7 +74,7 @@ struct _Elm_Scrollable_Smart_Interface_Data Elm_Scroller_Policy hbar_flags, vbar_flags; Elm_Scroller_Single_Direction one_direction_at_a_time; - Elm_Scroller_Movement_Block block; + Efl_Ui_Layout_Orientation block; struct { diff --git a/src/lib/elementary/elm_inwin.h b/src/lib/elementary/elm_inwin.h index d5fba32e52..bb5c08ef07 100644 --- a/src/lib/elementary/elm_inwin.h +++ b/src/lib/elementary/elm_inwin.h @@ -1,6 +1,6 @@ /** - * @defgroup Elm_Inwin Inwin - * @ingroup Elm_Win + * @defgroup Elm_Inwin_Group Inwin + * @ingroup Elm_Win_Group * * @image html inwin_inheritance_tree.png * @image latex inwin_inheritance_tree.eps @@ -31,9 +31,9 @@ * possible, but it's sized vertically the most it needs to fit its\ * contents. * - * This widget inherits from the @ref Layout one, so that all the + * This widget inherits from the @ref Elm_Layout one, so that all the * functions acting on it also work for inner windown objects. It also - * emits the signals inherited from @ref Layout. + * emits the signals inherited from @ref Elm_Layout. * * Default content parts of the inwin that you can use for are: * @li "default" A content of the inwin diff --git a/src/lib/elementary/elm_inwin_eo.h b/src/lib/elementary/elm_inwin_eo.h index cb6ad90fd7..ee475538da 100644 --- a/src/lib/elementary/elm_inwin_eo.h +++ b/src/lib/elementary/elm_inwin_eo.h @@ -19,7 +19,7 @@ typedef Eo Elm_Inwin; */ #define ELM_INWIN_CLASS elm_inwin_class_get() -EWAPI const Efl_Class *elm_inwin_class_get(void); +EWAPI const Efl_Class *elm_inwin_class_get(void) EINA_CONST; /** * @brief Activates an inwin object, ensuring its visibility diff --git a/src/lib/elementary/elm_inwin_legacy.h b/src/lib/elementary/elm_inwin_legacy.h index 0f672e9886..50a7653770 100644 --- a/src/lib/elementary/elm_inwin_legacy.h +++ b/src/lib/elementary/elm_inwin_legacy.h @@ -14,7 +14,7 @@ * @param parent The parent object * @return The new object or NULL if it cannot be created * - * @ingroup Elm_Inwin + * @ingroup Elm_Inwin_Group */ EAPI Evas_Object *elm_win_inwin_add(Evas_Object *parent); @@ -28,7 +28,7 @@ EAPI Evas_Object *elm_win_inwin_add(Evas_Object *parent); * @param obj The inwin object * @param content The object to set as content * - * @ingroup Elm_Inwin + * @ingroup Elm_Inwin_Group */ EAPI void elm_win_inwin_content_set(Evas_Object *obj, Evas_Object *content); @@ -47,7 +47,7 @@ EAPI void elm_win_inwin_content_set(Evas_Object *obj, Evas_Object *conte * @param obj The inwin object * @return The content that is being used * - * @ingroup Elm_Inwin + * @ingroup Elm_Inwin_Group */ EAPI Evas_Object *elm_win_inwin_content_get(const Evas_Object *obj); @@ -59,7 +59,7 @@ EAPI Evas_Object *elm_win_inwin_content_get(const Evas_Object *obj); * @param obj The inwin object * @return The content that was being used * - * @ingroup Elm_Inwin + * @ingroup Elm_Inwin_Group */ EAPI Evas_Object *elm_win_inwin_content_unset(Evas_Object *obj); diff --git a/src/lib/elementary/elm_label.h b/src/lib/elementary/elm_label.h index 13b52124dc..4157a27af4 100644 --- a/src/lib/elementary/elm_label.h +++ b/src/lib/elementary/elm_label.h @@ -1,5 +1,5 @@ /** - * @defgroup Elm_Label Label + * @defgroup Elm_Label_Group Label * @ingroup Elementary * * @image html label_inheritance_tree.png @@ -28,11 +28,11 @@ * Custom themes can of course invent new markup tags and style them any way * they like. * - * This widget inherits from the @ref Layout one, so that all the + * This widget inherits from the @ref Elm_Layout one, so that all the * functions acting on it also work for label objects. * * This widget emits the following signals, besides the ones sent from - * @ref Layout: + * @ref Elm_Layout : * @li @c "language,changed": The program's language changed. * @li @c "slide,end": The slide is end. * diff --git a/src/lib/elementary/elm_label_eo.c b/src/lib/elementary/elm_label_eo.c index de24d9b94f..39fb7ff2e7 100644 --- a/src/lib/elementary/elm_label_eo.c +++ b/src/lib/elementary/elm_label_eo.c @@ -216,6 +216,6 @@ static const Efl_Class_Description _elm_label_class_desc = { NULL }; -EFL_DEFINE_CLASS(elm_label_class_get, &_elm_label_class_desc, EFL_UI_LAYOUT_BASE_CLASS, ELM_LAYOUT_MIXIN, EFL_UI_LEGACY_INTERFACE, NULL); +EFL_DEFINE_CLASS(elm_label_class_get, &_elm_label_class_desc, EFL_UI_LAYOUT_BASE_CLASS, ELM_LAYOUT_MIXIN, EFL_UI_LEGACY_INTERFACE, EFL_ACCESS_WIDGET_ACTION_MIXIN, NULL); #include "elm_label_eo.legacy.c" diff --git a/src/lib/elementary/elm_label_eo.h b/src/lib/elementary/elm_label_eo.h index 56a0016f76..91f1c15fc0 100644 --- a/src/lib/elementary/elm_label_eo.h +++ b/src/lib/elementary/elm_label_eo.h @@ -31,7 +31,7 @@ typedef enum */ #define ELM_LABEL_CLASS elm_label_class_get() -EWAPI const Efl_Class *elm_label_class_get(void); +EWAPI const Efl_Class *elm_label_class_get(void) EINA_CONST; /** * @brief Control wrap width of the label diff --git a/src/lib/elementary/elm_label_eo.legacy.h b/src/lib/elementary/elm_label_eo.legacy.h index 126207a228..524e8f2ac9 100644 --- a/src/lib/elementary/elm_label_eo.legacy.h +++ b/src/lib/elementary/elm_label_eo.legacy.h @@ -13,7 +13,7 @@ typedef Eo Elm_Label; /** Slide mode of a label widget * - * @ingroup Elm_Label + * @ingroup Elm_Label_Group */ typedef enum { diff --git a/src/lib/elementary/elm_label_legacy.h b/src/lib/elementary/elm_label_legacy.h index afd0927945..abc7248615 100644 --- a/src/lib/elementary/elm_label_legacy.h +++ b/src/lib/elementary/elm_label_legacy.h @@ -4,7 +4,7 @@ * @param parent The parent object * @return The new object or NULL if it cannot be created * - * @ingroup Elm_Label + * @ingroup Elm_Label_Group */ EAPI Evas_Object *elm_label_add(Evas_Object *parent); diff --git a/src/lib/elementary/elm_list.c b/src/lib/elementary/elm_list.c index 7414bd2559..6936cb2e85 100644 --- a/src/lib/elementary/elm_list.c +++ b/src/lib/elementary/elm_list.c @@ -1060,6 +1060,8 @@ _items_fix(Evas_Object *obj) //focus highlight in_theme is set by list item theme. _elm_widget_item_highlight_in_theme( obj, elm_list_first_item_get(obj)); + + eina_array_flush(&walk); } static void @@ -2328,8 +2330,11 @@ _item_new(Evas_Object *obj, evas_object_event_callback_add (it->icon, EVAS_CALLBACK_CHANGED_SIZE_HINTS, _size_hints_changed_cb, obj); - efl_access_object_access_type_set(it->icon, EFL_ACCESS_TYPE_DISABLED); - elm_widget_tree_unfocusable_set(it->icon, EINA_TRUE); + if (elm_widget_is(it->icon)) + { + efl_access_object_access_type_set(it->icon, EFL_ACCESS_TYPE_DISABLED); + elm_widget_tree_unfocusable_set(it->icon, EINA_TRUE); + } } if (it->end) { @@ -2337,8 +2342,11 @@ _item_new(Evas_Object *obj, evas_object_event_callback_add (it->end, EVAS_CALLBACK_CHANGED_SIZE_HINTS, _size_hints_changed_cb, obj); - efl_access_object_access_type_set(it->end, EFL_ACCESS_TYPE_DISABLED); - elm_widget_tree_unfocusable_set(it->end, EINA_TRUE); + if (elm_widget_is(it->end)) + { + efl_access_object_access_type_set(it->end, EFL_ACCESS_TYPE_DISABLED); + elm_widget_tree_unfocusable_set(it->end, EINA_TRUE); + } } if (_elm_config->atspi_mode) diff --git a/src/lib/elementary/elm_list.h b/src/lib/elementary/elm_list.h index 72f5a1084f..e98b336001 100644 --- a/src/lib/elementary/elm_list.h +++ b/src/lib/elementary/elm_list.h @@ -1,5 +1,5 @@ /** - * @defgroup Elm_List List + * @defgroup Elm_List_Group List * @ingroup Elementary * * @image html list_inheritance_tree.png @@ -19,11 +19,11 @@ * A list is a very simple type of list widget. For more robust lists, * @ref Genlist should probably be used. * - * This widget inherits from the @ref Layout one, so that all the + * This widget inherits from the @ref Elm_Layout one, so that all the * functions acting on it also work for list objects. * * This widget emits the following signals, besides the ones sent from - * @ref Layout: + * @ref Elm_Layout : * - @c "activated" - The user has double-clicked or pressed * (enter|return|spacebar) on an item. The @p event_info parameter * is the item that was activated. @@ -75,7 +75,7 @@ * @li @ref elm_object_item_del * @li @ref elm_object_item_signal_emit * - * This widget implements the @b @ref elm-scrollable-interface + * This widget implements the @ref elm-scrollable-interface * interface, so that all (non-deprecated) functions for the base @ref * Scroller widget also work for lists. * @@ -92,7 +92,7 @@ */ /** - * @addtogroup Elm_List + * @addtogroup Elm_List_Group * @{ */ diff --git a/src/lib/elementary/elm_list_eo.h b/src/lib/elementary/elm_list_eo.h index 4587ed0744..ee3e72f908 100644 --- a/src/lib/elementary/elm_list_eo.h +++ b/src/lib/elementary/elm_list_eo.h @@ -19,7 +19,7 @@ typedef Eo Elm_List; */ #define ELM_LIST_CLASS elm_list_class_get() -EWAPI const Efl_Class *elm_list_class_get(void); +EWAPI const Efl_Class *elm_list_class_get(void) EINA_CONST; /** * @brief Control horizontal mode on the list object. @@ -270,7 +270,7 @@ EOAPI Elm_Widget_Item *elm_obj_list_selected_item_get(const Eo *obj); * * @param[in] obj The object. * - * @return A @c list of list items, #Elm.Widget.Item, or @c NULL on failure. + * @return A @c list of list items, #Elm_Widget_Item, or @c NULL on failure. * * @ingroup Elm_List */ @@ -297,7 +297,7 @@ EOAPI Elm_Widget_Item *elm_obj_list_first_item_get(const Eo *obj); * * @param[in] obj The object. * - * @return An @c list of list items, #Elm.Widget.Item, or @c NULL on failure. + * @return An @c list of list items, #Elm_Widget_Item, or @c NULL on failure. * * @ingroup Elm_List */ @@ -541,7 +541,7 @@ EOAPI void elm_obj_list_clear(Eo *obj); * @param[in] func The function to call when the item is clicked. * @param[in] data The data to associate with the item for related callbacks. * @param[in] cmp_func The comparing function to be used to sort list items by - * #Elm.Widget.Item item handles. This function will receive two items and + * #Elm_Widget_Item item handles. This function will receive two items and * compare them, returning a non-negative integer if the second item should be * place after the first, or negative value if should be placed before. * diff --git a/src/lib/elementary/elm_list_eo.legacy.h b/src/lib/elementary/elm_list_eo.legacy.h index 6885674baf..3a2e019c3a 100644 --- a/src/lib/elementary/elm_list_eo.legacy.h +++ b/src/lib/elementary/elm_list_eo.legacy.h @@ -263,7 +263,7 @@ EAPI Elm_Widget_Item *elm_list_selected_item_get(const Elm_List *obj); * * @param[in] obj The object. * - * @return A @c list of list items, #Elm.Widget.Item, or @c NULL on failure. + * @return A @c list of list items, #Elm_Widget_Item, or @c NULL on failure. * * @ingroup Elm_List_Group */ @@ -290,7 +290,7 @@ EAPI Elm_Widget_Item *elm_list_first_item_get(const Elm_List *obj); * * @param[in] obj The object. * - * @return An @c list of list items, #Elm.Widget.Item, or @c NULL on failure. + * @return An @c list of list items, #Elm_Widget_Item, or @c NULL on failure. * * @ingroup Elm_List_Group */ @@ -534,7 +534,7 @@ EAPI void elm_list_clear(Elm_List *obj); * @param[in] func The function to call when the item is clicked. * @param[in] data The data to associate with the item for related callbacks. * @param[in] cmp_func The comparing function to be used to sort list items by - * #Elm.Widget.Item item handles. This function will receive two items and + * #Elm_Widget_Item item handles. This function will receive two items and * compare them, returning a non-negative integer if the second item should be * place after the first, or negative value if should be placed before. * diff --git a/src/lib/elementary/elm_list_item_eo.h b/src/lib/elementary/elm_list_item_eo.h index 8aef9230a9..0b3800a893 100644 --- a/src/lib/elementary/elm_list_item_eo.h +++ b/src/lib/elementary/elm_list_item_eo.h @@ -19,7 +19,7 @@ typedef Eo Elm_List_Item; */ #define ELM_LIST_ITEM_CLASS elm_list_item_class_get() -EWAPI const Efl_Class *elm_list_item_class_get(void); +EWAPI const Efl_Class *elm_list_item_class_get(void) EINA_CONST; /** * @brief Set or unset item as a separator. diff --git a/src/lib/elementary/elm_list_legacy.h b/src/lib/elementary/elm_list_legacy.h index 0cdb591984..1bb601541d 100644 --- a/src/lib/elementary/elm_list_legacy.h +++ b/src/lib/elementary/elm_list_legacy.h @@ -7,7 +7,7 @@ * * This function inserts a new list widget on the canvas. * - * @ingroup Elm_List + * @ingroup Elm_List_Group */ EAPI Evas_Object *elm_list_add(Evas_Object *parent); diff --git a/src/lib/elementary/elm_macros.h b/src/lib/elementary/elm_macros.h index 0ce9b6c5db..4c81567699 100644 --- a/src/lib/elementary/elm_macros.h +++ b/src/lib/elementary/elm_macros.h @@ -9,8 +9,8 @@ // check if the rect (x, y, w, h) includes whole body of rect (xx, yy, ww, hh) #define ELM_RECTS_INCLUDE(x, y, w, h, xx, yy, ww, hh) (((x) <= (xx)) && (((x) + (w)) >= ((xx + (ww))) && ((y) <= (yy)) && (((y) + (h)) >= ((yy) + (hh))))) -// check if the rect (x,y,w,h) is either left of or stays out of body of rect(xx,yy,ww,hh) +// check if the rect (x,y,w,h) is either left of or stays out of body of rect(xx,yy,ww,hh) #define ELM_RECTS_X_AXIS_OUT(x, y, w, h, xx, yy, ww, hh) (((x) < (xx)) || (((x) + (w)) > ((xx) + (ww))) || (((y) + (h)) > ((yy) + (hh)))) -// check if the rect (x,y,w,h) is either top of or stays out of body of rect(xx,yy,ww,hh) +// check if the rect (x,y,w,h) is either top of or stays out of body of rect(xx,yy,ww,hh) #define ELM_RECTS_Y_AXIS_OUT(x, y, w, h, xx, yy, ww, hh) (((y) < (yy)) || (((x) + (w)) > ((xx) + (ww))) || (((y) + (h)) > ((yy) + (hh)))) diff --git a/src/lib/elementary/elm_main.c b/src/lib/elementary/elm_main.c index d6c2b2a82f..d6a4b5dac4 100644 --- a/src/lib/elementary/elm_main.c +++ b/src/lib/elementary/elm_main.c @@ -910,7 +910,6 @@ elm_quicklaunch_sub_shutdown(void) _elm_module_shutdown(); if (_elm_prefs_initted) _elm_prefs_shutdown(); - _efl_ui_dnd_shutdown(); elm_color_class_shutdown(); } @@ -1347,7 +1346,6 @@ elm_quicklaunch_exe_path_get(const char *exe, const char *cwd) } else { - if (!*p) break; p++; } } @@ -1700,14 +1698,14 @@ elm_object_focus_move_policy_set(Evas_Object *obj, Elm_Focus_Move_Policy policy) { EINA_SAFETY_ON_NULL_RETURN(obj); - efl_ui_widget_focus_move_policy_set(obj, policy); + efl_ui_widget_focus_move_policy_set(obj, (Efl_Ui_Focus_Move_Policy)policy); } EAPI Elm_Focus_Move_Policy elm_object_focus_move_policy_get(const Evas_Object *obj) { EINA_SAFETY_ON_NULL_RETURN_VAL(obj, EINA_FALSE); - return efl_ui_widget_focus_move_policy_get(obj); + return (Elm_Focus_Move_Policy)efl_ui_widget_focus_move_policy_get(obj); } EAPI Eina_Bool diff --git a/src/lib/elementary/elm_map.c b/src/lib/elementary/elm_map.c index 6a37e59cb2..6d287fef5e 100644 --- a/src/lib/elementary/elm_map.c +++ b/src/lib/elementary/elm_map.c @@ -4170,8 +4170,6 @@ _elm_map_efl_canvas_group_group_add(Eo *obj, Elm_Map_Data *priv) // FIXME: Tile Provider is better to provide tile size! priv->tsize = DEFAULT_TILE_SIZE; - srand(time(NULL)); - priv->id = ((int)getpid() << 16) | id_num; id_num++; _grid_all_create(priv); @@ -4331,7 +4329,7 @@ _elm_map_efl_ui_zoom_zoom_level_set(Eo *obj, Elm_Map_Data *sd, double zoom) if (sd->mode != EFL_UI_ZOOM_MODE_MANUAL) return; if (zoom < 0) zoom = 0; - if (sd->zoom == zoom) return; + if (EINA_DBL_EQ(sd->zoom, zoom)) return; sd->calc_job.zoom = zoom; sd->calc_job.zoom_mode_set = _zoom_mode_set; diff --git a/src/lib/elementary/elm_map.h b/src/lib/elementary/elm_map.h index bf257309ef..dd766b0049 100644 --- a/src/lib/elementary/elm_map.h +++ b/src/lib/elementary/elm_map.h @@ -1,5 +1,5 @@ /** - * @defgroup Elm_Map Map + * @defgroup Elm_Map_Group Map * @ingroup Elementary * * @image html map_inheritance_tree.png @@ -18,7 +18,7 @@ * @li group of markers and * @li routes. * - * This widget implements the @b @ref elm-scrollable-interface + * This widget implements the @ref elm-scrollable-interface * interface, so that all (non-deprecated) functions for the base @ref * Scroller widget also work for map objects. * diff --git a/src/lib/elementary/elm_map_common.h b/src/lib/elementary/elm_map_common.h index 625094a305..3fa3dcc34b 100644 --- a/src/lib/elementary/elm_map_common.h +++ b/src/lib/elementary/elm_map_common.h @@ -1,5 +1,5 @@ /** - * @addtogroup Elm_Map + * @addtogroup Elm_Map_Group * * @{ */ @@ -472,8 +472,8 @@ EAPI int elm_map_overlay_class_zoom_max_get(const Elm_Map_Over * is clicked, callback will be called and return a virtual group overlays. * * You can change the state (hidden, paused, etc.) or set the content - * or icon of the group overlays by chaning the state of the class overlay. - * Do not modifty the group overlay itself. + * or icon of the group overlays by changing the state of the class overlay. + * Do not modify the group overlay itself. * * @see elm_map_overlay_class_add() */ diff --git a/src/lib/elementary/elm_map_eo.h b/src/lib/elementary/elm_map_eo.h index d33e955cc4..d560228be9 100644 --- a/src/lib/elementary/elm_map_eo.h +++ b/src/lib/elementary/elm_map_eo.h @@ -69,7 +69,7 @@ typedef enum */ #define ELM_MAP_CLASS elm_map_class_get() -EWAPI const Efl_Class *elm_map_class_get(void); +EWAPI const Efl_Class *elm_map_class_get(void) EINA_CONST; /** * @brief Set the minimum zoom of the source. @@ -339,7 +339,7 @@ EOAPI Elm_Map_Overlay *elm_obj_map_overlay_circle_add(Eo *obj, double lon, doubl * have default style layouts at first. * * You can change the state (hidden, paused, etc.) or set the content or icon - * of the group overlays by chaning the state of the class overlay. Do not + * of the group overlays by changing the state of the class overlay. Do not * modify the group overlay itself. * * Also these changes have a influence on the overlays in the same class even diff --git a/src/lib/elementary/elm_map_eo.legacy.h b/src/lib/elementary/elm_map_eo.legacy.h index cd51009b02..4e8968a578 100644 --- a/src/lib/elementary/elm_map_eo.legacy.h +++ b/src/lib/elementary/elm_map_eo.legacy.h @@ -17,7 +17,7 @@ typedef Eo Elm_Map; * See @ref elm_map_sources_get() See @ref elm_map_source_get() See * @ref elm_map_source_set() * - * @ingroup Elm_Map + * @ingroup Elm_Map_Group */ typedef enum { @@ -33,7 +33,7 @@ typedef enum * * See @ref elm_map_route_add() * - * @ingroup Elm_Map + * @ingroup Elm_Map_Group */ typedef enum { @@ -51,7 +51,7 @@ typedef enum * * See @ref elm_map_route_add() * - * @ingroup Elm_Map + * @ingroup Elm_Map_Group */ typedef enum { @@ -332,7 +332,7 @@ EAPI Elm_Map_Overlay *elm_map_overlay_circle_add(Elm_Map *obj, double lon, doubl * have default style layouts at first. * * You can change the state (hidden, paused, etc.) or set the content or icon - * of the group overlays by chaning the state of the class overlay. Do not + * of the group overlays by changing the state of the class overlay. Do not * modify the group overlay itself. * * Also these changes have a influence on the overlays in the same class even diff --git a/src/lib/elementary/elm_map_legacy.h b/src/lib/elementary/elm_map_legacy.h index 37fffcb737..309b56076b 100644 --- a/src/lib/elementary/elm_map_legacy.h +++ b/src/lib/elementary/elm_map_legacy.h @@ -11,7 +11,7 @@ * * See @ref elm_map_zoom_mode_set() See @ref elm_map_zoom_mode_get() * - * @ingroup Elm_Map + * @ingroup Elm_Map_Group */ typedef enum { @@ -33,7 +33,7 @@ typedef enum * * This function inserts a new map widget on the canvas. * - * @ingroup Elm_Map + * @ingroup Elm_Map_Group */ EAPI Evas_Object *elm_map_add(Evas_Object *parent); @@ -55,7 +55,7 @@ EAPI Evas_Object *elm_map_add(Evas_Object *parent); * @param[in] obj The object. * @param[in] zoom The zoom level. * - * @ingroup Elm_Map + * @ingroup Elm_Map_Group */ EAPI void elm_map_zoom_set(Evas_Object *obj, int zoom); @@ -72,7 +72,7 @@ EAPI void elm_map_zoom_set(Evas_Object *obj, int zoom); * * @return The zoom level. * - * @ingroup Elm_Map + * @ingroup Elm_Map_Group */ EAPI int elm_map_zoom_get(const Evas_Object *obj); @@ -97,7 +97,7 @@ EAPI int elm_map_zoom_get(const Evas_Object *obj); * #ELM_MAP_ZOOM_MODE_MANUAL (default), #ELM_MAP_ZOOM_MODE_AUTO_FIT, or * #ELM_MAP_ZOOM_MODE_AUTO_FILL. * - * @ingroup Elm_Map + * @ingroup Elm_Map_Group */ EAPI void elm_map_zoom_mode_set(Evas_Object *obj, Elm_Map_Zoom_Mode mode); @@ -111,7 +111,7 @@ EAPI void elm_map_zoom_mode_set(Evas_Object *obj, Elm_Map_Zoom_Mode mode); * @return The zoom mode of the map, being it one of #ELM_MAP_ZOOM_MODE_MANUAL * (default), #ELM_MAP_ZOOM_MODE_AUTO_FIT, or #ELM_MAP_ZOOM_MODE_AUTO_FILL. * - * @ingroup Elm_Map + * @ingroup Elm_Map_Group */ EAPI Elm_Map_Zoom_Mode elm_map_zoom_mode_get(const Evas_Object *obj); @@ -124,7 +124,7 @@ EAPI Elm_Map_Zoom_Mode elm_map_zoom_mode_get(const Evas_Object *obj); * @param[in] disabled Use @c true to disable mouse wheel or @c false to enable * it. * - * @ingroup Elm_Map + * @ingroup Elm_Map_Group */ EAPI void elm_map_wheel_disabled_set(Evas_Object *obj, Eina_Bool disabled); @@ -137,7 +137,7 @@ EAPI void elm_map_wheel_disabled_set(Evas_Object *obj, Eina_Bool disabled); * * @return Use @c true to disable mouse wheel or @c false to enable it. * - * @ingroup Elm_Map + * @ingroup Elm_Map_Group */ EAPI Eina_Bool elm_map_wheel_disabled_get(const Evas_Object *obj); diff --git a/src/lib/elementary/elm_map_pan_eo.h b/src/lib/elementary/elm_map_pan_eo.h index be8be64595..a452f88fe1 100644 --- a/src/lib/elementary/elm_map_pan_eo.h +++ b/src/lib/elementary/elm_map_pan_eo.h @@ -19,6 +19,6 @@ typedef Eo Elm_Map_Pan; */ #define ELM_MAP_PAN_CLASS elm_map_pan_class_get() -EWAPI const Efl_Class *elm_map_pan_class_get(void); +EWAPI const Efl_Class *elm_map_pan_class_get(void) EINA_CONST; #endif diff --git a/src/lib/elementary/elm_mapbuf.h b/src/lib/elementary/elm_mapbuf.h index 2eed3a1fc4..0506b164ea 100644 --- a/src/lib/elementary/elm_mapbuf.h +++ b/src/lib/elementary/elm_mapbuf.h @@ -1,5 +1,5 @@ /** - * @defgroup Elm_Mapbuf Mapbuf + * @defgroup Elm_Mapbuf_Group Mapbuf * @ingroup Elementary * * @image html mapbuf_inheritance_tree.png @@ -32,7 +32,7 @@ */ /** - * @addtogroup Elm_Mapbuf + * @addtogroup Elm_Mapbuf_Group * @{ */ diff --git a/src/lib/elementary/elm_mapbuf_eo.h b/src/lib/elementary/elm_mapbuf_eo.h index b9ba3f2630..039a8f4313 100644 --- a/src/lib/elementary/elm_mapbuf_eo.h +++ b/src/lib/elementary/elm_mapbuf_eo.h @@ -19,7 +19,7 @@ typedef Eo Elm_Mapbuf; */ #define ELM_MAPBUF_CLASS elm_mapbuf_class_get() -EWAPI const Efl_Class *elm_mapbuf_class_get(void); +EWAPI const Efl_Class *elm_mapbuf_class_get(void) EINA_CONST; /** * @brief Set or unset auto flag for map rendering. diff --git a/src/lib/elementary/elm_mapbuf_legacy.h b/src/lib/elementary/elm_mapbuf_legacy.h index 5c659a8951..69ce7aab20 100644 --- a/src/lib/elementary/elm_mapbuf_legacy.h +++ b/src/lib/elementary/elm_mapbuf_legacy.h @@ -7,8 +7,8 @@ * * This function inserts a new mapbuf widget on the canvas. * - * @ingroup Elm_Mapbuf + * @ingroup Elm_Mapbuf_Group */ EAPI Evas_Object *elm_mapbuf_add(Evas_Object *parent); -#include "elm_mapbuf_eo.legacy.h"
\ No newline at end of file +#include "elm_mapbuf_eo.legacy.h" diff --git a/src/lib/elementary/elm_menu.c b/src/lib/elementary/elm_menu.c index 7da2e551bd..5914a82eff 100644 --- a/src/lib/elementary/elm_menu.c +++ b/src/lib/elementary/elm_menu.c @@ -43,17 +43,31 @@ _elm_menu_efl_ui_l10n_translation_update(Eo *obj EINA_UNUSED, Elm_Menu_Data *sd) elm_wdg_item_translate(EO_OBJ(it)); } +static void _item_del(Elm_Object_Item *eo_item); + +static void +_elm_menu_subitems_clear(Elm_Menu_Item_Data *it) +{ + Elm_Object_Item *sub_it; + + EINA_LIST_FREE(it->submenu.items, sub_it) + { + ELM_MENU_ITEM_DATA_GET(sub_it, item); + + if (item) + { + item->parent = NULL; + _item_del(sub_it); + } + } +} + static void _item_del(Elm_Object_Item *eo_item) { - Elm_Object_Item *child; ELM_MENU_ITEM_DATA_GET(eo_item, item); - Eina_List *itr, *itr2; - EINA_LIST_FOREACH_SAFE(item->submenu.items, itr, itr2, child) - _item_del(child); - eina_list_free(item->submenu.items); - + _elm_menu_subitems_clear(item); efl_del(eo_item); } @@ -391,12 +405,10 @@ _parent_del_cb(void *data, Evas_Object *obj, void *event_info EINA_UNUSED) { - ELM_MENU_DATA_GET(data, sd); ELM_WIDGET_DATA_GET_OR_RETURN(data, wd); evas_object_event_callback_del_full (obj, EVAS_CALLBACK_RESIZE, _parent_resize_cb, data); - sd->parent = NULL; } static void @@ -1013,7 +1025,7 @@ _elm_menu_item_efl_object_destructor(Eo *eo_item, Elm_Menu_Item_Data *item) { ELM_MENU_DATA_GET(WIDGET(item), sd); - elm_menu_item_subitems_clear(eo_item); + _elm_menu_subitems_clear(item); eina_stringshare_del(item->label); eina_stringshare_del(item->icon_str); evas_object_del(item->content); @@ -1147,19 +1159,10 @@ _elm_menu_item_separator_add(Eo *obj, Elm_Menu_Data *sd, Elm_Object_Item *eo_p_i subitem = efl_data_scope_get(eo_subitem, ELM_MENU_ITEM_CLASS); subitem->separator = EINA_TRUE; + subitem->parent = efl_data_scope_get(eo_p_item, ELM_MENU_ITEM_CLASS); + _item_separator_obj_create(subitem); - if (!eo_p_item) - { - elm_box_pack_end(sd->bx, VIEW(subitem)); - sd->items = eina_list_append(sd->items, eo_subitem); - } - else - { - if (!p_item->submenu.bx) _item_submenu_obj_create(p_item); - elm_box_pack_end(p_item->submenu.bx, VIEW(subitem)); - p_item->submenu.items = eina_list_append - (p_item->submenu.items, eo_subitem); - } + _elm_menu_item_add_helper(obj, subitem->parent, subitem, sd); _sizing_eval(obj); @@ -1190,12 +1193,7 @@ _elm_menu_item_subitems_get(const Eo *eo_item EINA_UNUSED, Elm_Menu_Item_Data *i EOLIAN static void _elm_menu_item_subitems_clear(Eo *eo_item EINA_UNUSED, Elm_Menu_Item_Data *it) { - Elm_Object_Item *sub_it; - Eina_List *l, *l_next; - - EINA_LIST_FOREACH_SAFE(it->submenu.items, - l, l_next, sub_it) - efl_del(sub_it); + _elm_menu_subitems_clear(it); } EOLIAN static const Eina_List * diff --git a/src/lib/elementary/elm_menu_eo.h b/src/lib/elementary/elm_menu_eo.h index 1c4a8111eb..259982ead5 100644 --- a/src/lib/elementary/elm_menu_eo.h +++ b/src/lib/elementary/elm_menu_eo.h @@ -19,7 +19,7 @@ typedef Eo Elm_Menu; */ #define ELM_MENU_CLASS elm_menu_class_get() -EWAPI const Efl_Class *elm_menu_class_get(void); +EWAPI const Efl_Class *elm_menu_class_get(void) EINA_CONST; /** * @brief Get the selected item in the widget. diff --git a/src/lib/elementary/elm_menu_item_eo.h b/src/lib/elementary/elm_menu_item_eo.h index 708e77ed6d..1d9a4d8b55 100644 --- a/src/lib/elementary/elm_menu_item_eo.h +++ b/src/lib/elementary/elm_menu_item_eo.h @@ -19,7 +19,7 @@ typedef Eo Elm_Menu_Item; */ #define ELM_MENU_ITEM_CLASS elm_menu_item_class_get() -EWAPI const Efl_Class *elm_menu_item_class_get(void); +EWAPI const Efl_Class *elm_menu_item_class_get(void) EINA_CONST; /** * @brief Set the icon of a menu item to the standard icon with the given name. diff --git a/src/lib/elementary/elm_multibuttonentry_eo.h b/src/lib/elementary/elm_multibuttonentry_eo.h index cac86fc139..095e37f373 100644 --- a/src/lib/elementary/elm_multibuttonentry_eo.h +++ b/src/lib/elementary/elm_multibuttonentry_eo.h @@ -19,7 +19,7 @@ typedef Eo Elm_Multibuttonentry; */ #define ELM_MULTIBUTTONENTRY_CLASS elm_multibuttonentry_class_get() -EWAPI const Efl_Class *elm_multibuttonentry_class_get(void); +EWAPI const Efl_Class *elm_multibuttonentry_class_get(void) EINA_CONST; /** * @brief Control if the multibuttonentry is to be editable or not. diff --git a/src/lib/elementary/elm_multibuttonentry_item_eo.h b/src/lib/elementary/elm_multibuttonentry_item_eo.h index c1f5484cce..cac6b15c09 100644 --- a/src/lib/elementary/elm_multibuttonentry_item_eo.h +++ b/src/lib/elementary/elm_multibuttonentry_item_eo.h @@ -19,7 +19,7 @@ typedef Eo Elm_Multibuttonentry_Item; */ #define ELM_MULTIBUTTONENTRY_ITEM_CLASS elm_multibuttonentry_item_class_get() -EWAPI const Efl_Class *elm_multibuttonentry_item_class_get(void); +EWAPI const Efl_Class *elm_multibuttonentry_item_class_get(void) EINA_CONST; /** * @brief Control the selected state of an item diff --git a/src/lib/elementary/elm_naviframe_eo.h b/src/lib/elementary/elm_naviframe_eo.h index 8b4f4d8c0e..75981dcbb7 100644 --- a/src/lib/elementary/elm_naviframe_eo.h +++ b/src/lib/elementary/elm_naviframe_eo.h @@ -19,7 +19,7 @@ typedef Eo Elm_Naviframe; */ #define ELM_NAVIFRAME_CLASS elm_naviframe_class_get() -EWAPI const Efl_Class *elm_naviframe_class_get(void); +EWAPI const Efl_Class *elm_naviframe_class_get(void) EINA_CONST; /** * @brief Control the event enabled when pushing/popping items diff --git a/src/lib/elementary/elm_naviframe_item_eo.h b/src/lib/elementary/elm_naviframe_item_eo.h index d5b86840f3..bc83d099dd 100644 --- a/src/lib/elementary/elm_naviframe_item_eo.h +++ b/src/lib/elementary/elm_naviframe_item_eo.h @@ -19,7 +19,7 @@ typedef Eo Elm_Naviframe_Item; */ #define ELM_NAVIFRAME_ITEM_CLASS elm_naviframe_item_class_get() -EWAPI const Efl_Class *elm_naviframe_item_class_get(void); +EWAPI const Efl_Class *elm_naviframe_item_class_get(void) EINA_CONST; /** * @brief Pop the top item and delete the items between the top and the above diff --git a/src/lib/elementary/elm_notify.c b/src/lib/elementary/elm_notify.c index ee734b9e39..f4cc7ad4e1 100644 --- a/src/lib/elementary/elm_notify.c +++ b/src/lib/elementary/elm_notify.c @@ -32,29 +32,29 @@ _notify_theme_apply(Evas_Object *obj) ax = sd->horizontal_align; ay = sd->vertical_align; - if (ay == 0.0) + if (EINA_DBL_EQ(ay, 0.0)) { - if (ax == 0.0) + if (EINA_DBL_EQ(ax, 0.0)) position = "top_left"; - else if (ax == 1.0) + else if (EINA_DBL_EQ(ax, 1.0)) position = "top_right"; else position = "top"; } - else if (ay == 1.0) + else if (EINA_DBL_EQ(ay, 1.0)) { - if (ax == 0.0) + if (EINA_DBL_EQ(ax, 0.0)) position = "bottom_left"; - else if (ax == 1.0) + else if (EINA_DBL_EQ(ax, 1.0)) position = "bottom_right"; else position = "bottom"; } else { - if (ax == 0.0) + if (EINA_DBL_EQ(ax, 0.0)) position = "left"; - else if (ax == 1.0) + else if (EINA_DBL_EQ(ax, 1.0)) position = "right"; else position = "center"; @@ -88,10 +88,10 @@ _notify_move_to_orientation(Evas_Object *obj, Evas_Coord x, Evas_Coord y, Evas_C ax = sd->horizontal_align; ay = sd->vertical_align; - if ((efl_ui_mirrored_get(obj)) && (ax != ELM_NOTIFY_ALIGN_FILL)) ax = 1.0 - ax; + if ((efl_ui_mirrored_get(obj)) && (!EINA_DBL_EQ(ax, ELM_NOTIFY_ALIGN_FILL))) ax = 1.0 - ax; - if (ax == ELM_NOTIFY_ALIGN_FILL) minw = w; - if (ay == ELM_NOTIFY_ALIGN_FILL) minh = h; + if (EINA_DBL_EQ(ax, ELM_NOTIFY_ALIGN_FILL)) minw = w; + if (EINA_DBL_EQ(ay, ELM_NOTIFY_ALIGN_FILL)) minh = h; x = x + ((w - minw) * ax); y = y + ((h - minh) * ay); @@ -609,23 +609,23 @@ elm_notify_orient_get(const Evas_Object *obj) elm_notify_align_get(obj, &horizontal, &vertical); - if ((horizontal == 0.5) && (vertical == 0.0)) + if (EINA_DBL_EQ(horizontal, 0.5) && EINA_DBL_EQ(vertical, 0.0)) orient = ELM_NOTIFY_ORIENT_TOP; - else if ((horizontal == 0.5) && (vertical == 0.5)) + else if (EINA_DBL_EQ(horizontal, 0.5) && EINA_DBL_EQ(vertical, 0.5)) orient = ELM_NOTIFY_ORIENT_CENTER; - else if ((horizontal == 0.5) && (vertical == 1.0)) + else if (EINA_DBL_EQ(horizontal, 0.5) && EINA_DBL_EQ(vertical, 1.0)) orient = ELM_NOTIFY_ORIENT_BOTTOM; - else if ((horizontal == 0.0) && (vertical == 0.5)) + else if (EINA_DBL_EQ(horizontal, 0.0) && EINA_DBL_EQ(vertical, 0.5)) orient = ELM_NOTIFY_ORIENT_LEFT; - else if ((horizontal == 1.0) && (vertical == 0.5)) + else if (EINA_DBL_EQ(horizontal, 1.0) && EINA_DBL_EQ(vertical, 0.5)) orient = ELM_NOTIFY_ORIENT_RIGHT; - else if ((horizontal == 0.0) && (vertical == 0.0)) + else if (EINA_DBL_EQ(horizontal, 0.0) && EINA_DBL_EQ(vertical, 0.0)) orient = ELM_NOTIFY_ORIENT_TOP_LEFT; - else if ((horizontal == 1.0) && (vertical == 0.0)) + else if (EINA_DBL_EQ(horizontal, 1.0) && EINA_DBL_EQ(vertical, 0.0)) orient = ELM_NOTIFY_ORIENT_TOP_RIGHT; - else if ((horizontal == 0.0) && (vertical == 1.0)) + else if (EINA_DBL_EQ(horizontal, 0.0) && EINA_DBL_EQ(vertical, 1.0)) orient = ELM_NOTIFY_ORIENT_BOTTOM_LEFT; - else if ((horizontal == 1.0) && (vertical == 1.0)) + else if (EINA_DBL_EQ(horizontal, 1.0) && EINA_DBL_EQ(vertical, 1.0)) orient = ELM_NOTIFY_ORIENT_BOTTOM_RIGHT; else orient = ELM_NOTIFY_ORIENT_TOP; diff --git a/src/lib/elementary/elm_notify.h b/src/lib/elementary/elm_notify.h index 88a2c5cfd3..660cd17233 100644 --- a/src/lib/elementary/elm_notify.h +++ b/src/lib/elementary/elm_notify.h @@ -1,5 +1,5 @@ /** - * @defgroup Elm_Notify Notify + * @defgroup Elm_Notify_Group Notify * @ingroup Elementary * * @image html notify_inheritance_tree.png diff --git a/src/lib/elementary/elm_notify_eo.h b/src/lib/elementary/elm_notify_eo.h index 37b0598982..8055f02143 100644 --- a/src/lib/elementary/elm_notify_eo.h +++ b/src/lib/elementary/elm_notify_eo.h @@ -19,7 +19,7 @@ typedef Eo Elm_Notify; */ #define ELM_NOTIFY_CLASS elm_notify_class_get() -EWAPI const Efl_Class *elm_notify_class_get(void); +EWAPI const Efl_Class *elm_notify_class_get(void) EINA_CONST; /** * @brief Set the alignment of the notify object diff --git a/src/lib/elementary/elm_notify_legacy.h b/src/lib/elementary/elm_notify_legacy.h index ceb39a9dfe..b1d67ad430 100644 --- a/src/lib/elementary/elm_notify_legacy.h +++ b/src/lib/elementary/elm_notify_legacy.h @@ -4,7 +4,7 @@ * @param parent The parent object * @return The new object or NULL if it cannot be created * - * @ingroup Elm_Notify + * @ingroup Elm_Notify_Group */ EAPI Evas_Object *elm_notify_add(Evas_Object *parent); @@ -17,7 +17,7 @@ EAPI Evas_Object *elm_notify_add(Evas_Object *parent); * Once the parent object is set, a previously set one will be disconnected * and replaced. * - * @ingroup Elm_Notify + * @ingroup Elm_Notify_Group */ EAPI void elm_notify_parent_set(Evas_Object *obj, Evas_Object *parent); @@ -29,8 +29,8 @@ EAPI void elm_notify_parent_set(Evas_Object *obj, Evas_O * * @see elm_notify_parent_set() * - * @ingroup Elm_Notify + * @ingroup Elm_Notify_Group */ EAPI Evas_Object *elm_notify_parent_get(const Evas_Object *obj); -#include "elm_notify_eo.legacy.h"
\ No newline at end of file +#include "elm_notify_eo.legacy.h" diff --git a/src/lib/elementary/elm_pan_eo.h b/src/lib/elementary/elm_pan_eo.h index a09652a4c8..d73afa2f8d 100644 --- a/src/lib/elementary/elm_pan_eo.h +++ b/src/lib/elementary/elm_pan_eo.h @@ -19,7 +19,7 @@ typedef Eo Elm_Pan; */ #define ELM_PAN_CLASS elm_pan_class_get() -EWAPI const Efl_Class *elm_pan_class_get(void); +EWAPI const Efl_Class *elm_pan_class_get(void) EINA_CONST; /** * @brief Position diff --git a/src/lib/elementary/elm_panel.c b/src/lib/elementary/elm_panel.c index 97f4267b2b..ef93c71996 100644 --- a/src/lib/elementary/elm_panel.c +++ b/src/lib/elementary/elm_panel.c @@ -868,9 +868,6 @@ _elm_panel_efl_canvas_group_group_add(Eo *obj, Elm_Panel_Data *priv) EOLIAN static void _elm_panel_efl_canvas_group_group_del(Eo *obj, Elm_Panel_Data *sd) { - Evas_Object *child; - Eina_List *l; - ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd); sd->delete_me = EINA_TRUE; @@ -879,15 +876,15 @@ _elm_panel_efl_canvas_group_group_del(Eo *obj, Elm_Panel_Data *sd) /* let's make our panel object the *last* to be processed, since it * may (smart) parent other sub objects here */ - EINA_LIST_FOREACH(wd->subobjs, l, child) - { - if (child == sd->bx) - { - wd->subobjs = - eina_list_demote_list(wd->subobjs, l); - break; - } - } + { + unsigned int resize_id = 0; + if (eina_array_find(wd->children, wd->resize_obj, &resize_id)) + { + //exchange with last + eina_array_data_set(wd->children, resize_id, eina_array_data_get(wd->children, eina_array_count(wd->children) - 1)); + eina_array_data_set(wd->children, eina_array_count(wd->children) - 1, wd->resize_obj); + } + } efl_canvas_group_del(efl_super(obj, MY_CLASS)); } diff --git a/src/lib/elementary/elm_panel.h b/src/lib/elementary/elm_panel.h index c94d9fc584..12bd651240 100644 --- a/src/lib/elementary/elm_panel.h +++ b/src/lib/elementary/elm_panel.h @@ -1,5 +1,5 @@ /** - * @defgroup Elm_Panel Panel + * @defgroup Elm_Panel_Group Panel * @ingroup Elementary * * @image html panel_inheritance_tree.png @@ -18,11 +18,11 @@ * @li #ELM_PANEL_ORIENT_RIGHT * @li #ELM_PANEL_ORIENT_BOTTOM * - * This widget inherits from the @ref Layout one, so that all the + * This widget inherits from the @ref Elm_Layout one, so that all the * functions acting on it also work for panel objects (since 1.8). * * This widget emits the following signals, besides the ones sent from - * @ref Layout: + * @ref Elm_Layout : * @li @c "toggled" : When the panel has been toggled. (since 1.18) * @li @c "scroll" : When the content has been scrolled (moved). (since 1.10) * This signal is emitted only when the panel is scrollable. diff --git a/src/lib/elementary/elm_panel_common.h b/src/lib/elementary/elm_panel_common.h index 236c83dab7..82ec280d7e 100644 --- a/src/lib/elementary/elm_panel_common.h +++ b/src/lib/elementary/elm_panel_common.h @@ -1,5 +1,5 @@ /** - * @addtogroup Elm_Panel + * @addtogroup Elm_Panel_Group * * @{ */ diff --git a/src/lib/elementary/elm_panel_eo.h b/src/lib/elementary/elm_panel_eo.h index 5e045de3ef..7c199a1e39 100644 --- a/src/lib/elementary/elm_panel_eo.h +++ b/src/lib/elementary/elm_panel_eo.h @@ -31,7 +31,7 @@ typedef enum */ #define ELM_PANEL_CLASS elm_panel_class_get() -EWAPI const Efl_Class *elm_panel_class_get(void); +EWAPI const Efl_Class *elm_panel_class_get(void) EINA_CONST; /** * @brief Set the orientation of the panel diff --git a/src/lib/elementary/elm_panel_eo.legacy.h b/src/lib/elementary/elm_panel_eo.legacy.h index d6b8b49d7a..ae99939681 100644 --- a/src/lib/elementary/elm_panel_eo.legacy.h +++ b/src/lib/elementary/elm_panel_eo.legacy.h @@ -13,7 +13,7 @@ typedef Eo Elm_Panel; /** Panel orientation mode * - * @ingroup Elm_Panel + * @ingroup Elm_Panel_Group */ typedef enum { diff --git a/src/lib/elementary/elm_panel_legacy.h b/src/lib/elementary/elm_panel_legacy.h index a95c31046f..6d23e336d7 100644 --- a/src/lib/elementary/elm_panel_legacy.h +++ b/src/lib/elementary/elm_panel_legacy.h @@ -5,8 +5,8 @@ * * @return The panel object, or NULL on failure * - * @ingroup Elm_Panel + * @ingroup Elm_Panel_Group */ EAPI Evas_Object *elm_panel_add(Evas_Object *parent); -#include "elm_panel_eo.legacy.h"
\ No newline at end of file +#include "elm_panel_eo.legacy.h" diff --git a/src/lib/elementary/elm_panes.h b/src/lib/elementary/elm_panes.h index 9704b39c4d..fb510b7e0a 100644 --- a/src/lib/elementary/elm_panes.h +++ b/src/lib/elementary/elm_panes.h @@ -17,11 +17,11 @@ * Panes can be split vertically or horizontally, and contents * size proportion can be customized (homogeneous by default). * - * This widget inherits from the @ref Layout one, so that all the + * This widget inherits from the @ref Elm_Layout one, so that all the * functions acting on it also work for panes objects. * * This widget emits the following signals, besides the ones sent from - * @ref Layout: + * @ref Elm_Layout : * - @c "press" - The panes has been pressed (button wasn't released yet). * - @c "unpress" - The panes was released after being pressed. * - @c "clicked" - The panes has been clicked> diff --git a/src/lib/elementary/elm_photo.c b/src/lib/elementary/elm_photo.c index 9fc593392f..5f8660352c 100644 --- a/src/lib/elementary/elm_photo.c +++ b/src/lib/elementary/elm_photo.c @@ -125,7 +125,7 @@ _drag_done_cb(void *unused EINA_UNUSED, ELM_PHOTO_DATA_GET(obj, sd); elm_object_scroll_freeze_pop(obj); - efl_event_callback_legacy_call(obj, EFL_UI_EVENT_DRAG_END, NULL); + evas_object_smart_callback_call(obj, "drag,end", NULL); sd->drag_started = EINA_FALSE; } @@ -189,8 +189,8 @@ _long_press_cb(void *obj) _drag_done_cb, NULL)) { elm_object_scroll_freeze_push(obj); - efl_event_callback_legacy_call - (obj, EFL_UI_EVENT_DRAG_START, NULL); + evas_object_smart_callback_call + (obj, "drag,start", NULL); sd->drag_started = EINA_TRUE; } } diff --git a/src/lib/elementary/elm_photo_eo.h b/src/lib/elementary/elm_photo_eo.h index 50cdb235b5..a624ca96d1 100644 --- a/src/lib/elementary/elm_photo_eo.h +++ b/src/lib/elementary/elm_photo_eo.h @@ -19,6 +19,6 @@ typedef Eo Elm_Photo; */ #define ELM_PHOTO_CLASS elm_photo_class_get() -EWAPI const Efl_Class *elm_photo_class_get(void); +EWAPI const Efl_Class *elm_photo_class_get(void) EINA_CONST; #endif diff --git a/src/lib/elementary/elm_photocam.h b/src/lib/elementary/elm_photocam.h index 7286366711..fed819a9af 100644 --- a/src/lib/elementary/elm_photocam.h +++ b/src/lib/elementary/elm_photocam.h @@ -1,5 +1,5 @@ /** - * @defgroup Elm_Photocam Photocam + * @defgroup Elm_Photocam_Group Photocam * @ingroup Elementary * * @image html photocam_inheritance_tree.png @@ -42,7 +42,7 @@ * @li @c "focused" - When the photocam has received focus. (since 1.8) * @li @c "unfocused" - When the photocam has lost focus. (since 1.8) * - * This widget implements the @b @ref elm-scrollable-interface + * This widget implements the @ref elm-scrollable-interface * interface, so that all (non-deprecated) functions for the base @ref * Scroller widget also work for photocam objects. * @@ -69,7 +69,7 @@ struct _Elm_Photocam_Progress }; /** - * Structre associated with smart callback 'download,error' + * Structure associated with smart callback 'download,error' * @since 1.8 */ typedef struct _Elm_Photocam_Error Elm_Photocam_Error; diff --git a/src/lib/elementary/elm_photocam_legacy.h b/src/lib/elementary/elm_photocam_legacy.h index f80d8ac49b..9719c30166 100644 --- a/src/lib/elementary/elm_photocam_legacy.h +++ b/src/lib/elementary/elm_photocam_legacy.h @@ -6,7 +6,7 @@ typedef Eo Elm_Photocam; * @param parent The parent object * @return The new object or NULL if it cannot be created * - * @ingroup Elm_Photocam + * @ingroup Elm_Photocam_Group */ EAPI Evas_Object *elm_photocam_add(Evas_Object *parent); @@ -21,7 +21,7 @@ EAPI Evas_Object *elm_photocam_add(Evas_Object *parent); * * This shows the region of the image using animation. * - * @ingroup Elm_Photocam + * @ingroup Elm_Photocam_Group */ EAPI void elm_photocam_image_region_bring_in(Evas_Object *obj, int x, int y, int w, int h); @@ -38,7 +38,7 @@ EAPI void elm_photocam_image_region_bring_in(Evas_Object *obj, * photo that at some time in the future will be displayed at the full * quality needed. * - * @ingroup Elm_Photocam + * @ingroup Elm_Photocam_Group * * @param[in] file The photo file */ @@ -52,7 +52,7 @@ EAPI Evas_Load_Error elm_photocam_file_set(Evas_Object *obj, const char *file); * * @see elm_photocam_file_set() * - * @ingroup Elm_Photocam + * @ingroup Elm_Photocam_Group * */ EAPI const char *elm_photocam_file_get(const Evas_Object *obj); @@ -67,7 +67,7 @@ EAPI const char *elm_photocam_file_get(const Evas_Object *obj); * * @since 1.14 * - * @ingroup Elm_Photocam + * @ingroup Elm_Photocam_Group */ EAPI void elm_photocam_image_orient_set(Evas_Object *obj, Evas_Image_Orient orient); @@ -79,7 +79,7 @@ EAPI void elm_photocam_image_orient_set(Evas_Object *obj, Evas_Image_Orient orie * * @since 1.14 * - * @ingroup Elm_Photocam + * @ingroup Elm_Photocam_Group */ EAPI Evas_Image_Orient elm_photocam_image_orient_get(const Evas_Object *obj); @@ -92,7 +92,7 @@ EAPI Evas_Image_Orient elm_photocam_image_orient_get(const Evas_Object *obj); * * @return The internal image object handle or @c null * - * @ingroup Elm_Photocam + * @ingroup Elm_Photocam_Group */ EAPI Evas_Object* elm_photocam_internal_image_get(const Evas_Object *obj); @@ -106,7 +106,7 @@ EAPI Evas_Object* elm_photocam_internal_image_get(const Evas_Object *obj); * @param[in] w Width of region in image original pixels * @param[in] h Height of region in image original pixels * - * @ingroup Elm_Photocam + * @ingroup Elm_Photocam_Group */ EAPI void elm_photocam_image_region_show(Evas_Object *obj, int x, int y, int w, int h); @@ -119,7 +119,7 @@ EAPI void elm_photocam_image_region_show(Evas_Object *obj, int x, i * @param[out] w A pointer to the width return * @param[out] h A pointer to the height return * - * @ingroup Elm_Photocam + * @ingroup Elm_Photocam_Group */ EAPI void elm_photocam_image_size_get(const Evas_Object *obj, int *w, int *h); @@ -130,7 +130,7 @@ EAPI void elm_photocam_image_size_get(const Evas_Object *obj, int * * * @return The pause state. * - * @ingroup Elm_Photocam + * @ingroup Elm_Photocam_Group */ EAPI Eina_Bool elm_photocam_paused_get(const Evas_Object *obj); @@ -143,7 +143,7 @@ EAPI Eina_Bool elm_photocam_paused_get(const Evas_Object *obj); * * @param[in] paused The pause state. * - * @ingroup Elm_Photocam + * @ingroup Elm_Photocam_Group */ EAPI void elm_photocam_paused_set(Evas_Object *obj, Eina_Bool paused); @@ -160,7 +160,7 @@ EAPI void elm_photocam_paused_set(Evas_Object *obj, Eina_Bool paused * * @param[in] zoom The zoom level to set * - * @ingroup Elm_Photocam + * @ingroup Elm_Photocam_Group */ EAPI void elm_photocam_zoom_set(Evas_Object *obj, double zoom); @@ -174,7 +174,7 @@ EAPI void elm_photocam_zoom_set(Evas_Object *obj, double zoom); * * @return The zoom level to set * - * @ingroup Elm_Photocam + * @ingroup Elm_Photocam_Group */ EAPI double elm_photocam_zoom_get(const Evas_Object *obj); @@ -207,7 +207,7 @@ typedef enum * * @param[in] mode The zoom mode. * - * @ingroup Elm_Photocam + * @ingroup Elm_Photocam_Group */ EAPI void elm_photocam_zoom_mode_set(Evas_Object *obj, Elm_Photocam_Zoom_Mode mode); @@ -218,7 +218,7 @@ EAPI void elm_photocam_zoom_mode_set(Evas_Object *obj, Elm_Photoca * * @return The zoom mode. * - * @ingroup Elm_Photocam + * @ingroup Elm_Photocam_Group */ EAPI Elm_Photocam_Zoom_Mode elm_photocam_zoom_mode_get(const Evas_Object *obj); diff --git a/src/lib/elementary/elm_player_eo.h b/src/lib/elementary/elm_player_eo.h index 8efee210e8..c0b909863c 100644 --- a/src/lib/elementary/elm_player_eo.h +++ b/src/lib/elementary/elm_player_eo.h @@ -19,7 +19,7 @@ typedef Eo Elm_Player; */ #define ELM_PLAYER_CLASS elm_player_class_get() -EWAPI const Efl_Class *elm_player_class_get(void); +EWAPI const Efl_Class *elm_player_class_get(void) EINA_CONST; EWAPI extern const Efl_Event_Description _ELM_PLAYER_EVENT_FORWARD_CLICKED; diff --git a/src/lib/elementary/elm_plug.h b/src/lib/elementary/elm_plug.h index 88ff450217..d57883d5d4 100644 --- a/src/lib/elementary/elm_plug.h +++ b/src/lib/elementary/elm_plug.h @@ -1,5 +1,5 @@ /** - * @defgroup Plug Plug + * @defgroup Elm_Plug_Group Plug * @ingroup Elementary * * @image html plug_inheritance_tree.png @@ -27,7 +27,7 @@ /** - * @addtogroup Plug + * @addtogroup Elm_Plug_Group * @{ */ diff --git a/src/lib/elementary/elm_plug_eo.h b/src/lib/elementary/elm_plug_eo.h index f27785ff88..96a2efe46e 100644 --- a/src/lib/elementary/elm_plug_eo.h +++ b/src/lib/elementary/elm_plug_eo.h @@ -19,7 +19,7 @@ typedef Eo Elm_Plug; */ #define ELM_PLUG_CLASS elm_plug_class_get() -EWAPI const Efl_Class *elm_plug_class_get(void); +EWAPI const Efl_Class *elm_plug_class_get(void) EINA_CONST; /** * @brief Get the basic Evas_Image object from this object (widget). diff --git a/src/lib/elementary/elm_plug_legacy.h b/src/lib/elementary/elm_plug_legacy.h index 58bc85424b..fae24d3a4e 100644 --- a/src/lib/elementary/elm_plug_legacy.h +++ b/src/lib/elementary/elm_plug_legacy.h @@ -4,8 +4,8 @@ * @param parent The parent object * @return The new plug image object or NULL if it cannot be created * - * @ingroup Plug + * @ingroup Elm_Plug_Group */ EAPI Evas_Object *elm_plug_add(Evas_Object *parent); -#include "elm_plug_eo.legacy.h"
\ No newline at end of file +#include "elm_plug_eo.legacy.h" diff --git a/src/lib/elementary/elm_popup_eo.h b/src/lib/elementary/elm_popup_eo.h index e040fe6dbc..f8055dda93 100644 --- a/src/lib/elementary/elm_popup_eo.h +++ b/src/lib/elementary/elm_popup_eo.h @@ -49,7 +49,7 @@ typedef enum */ #define ELM_POPUP_CLASS elm_popup_class_get() -EWAPI const Efl_Class *elm_popup_class_get(void); +EWAPI const Efl_Class *elm_popup_class_get(void) EINA_CONST; /** * @brief Set the alignment of the popup object. diff --git a/src/lib/elementary/elm_popup_eo.legacy.h b/src/lib/elementary/elm_popup_eo.legacy.h index debf944357..a02e667cfe 100644 --- a/src/lib/elementary/elm_popup_eo.legacy.h +++ b/src/lib/elementary/elm_popup_eo.legacy.h @@ -19,7 +19,7 @@ typedef Eo Elm_Popup; * conjunction with elm_popup_orient_get() to know where the popup is * appearing. * - * @ingroup Elm_Popup + * @ingroup Elm_Popup_Group */ typedef enum { diff --git a/src/lib/elementary/elm_popup_item_eo.h b/src/lib/elementary/elm_popup_item_eo.h index 46d6534289..d5ba854a3a 100644 --- a/src/lib/elementary/elm_popup_item_eo.h +++ b/src/lib/elementary/elm_popup_item_eo.h @@ -19,6 +19,6 @@ typedef Eo Elm_Popup_Item; */ #define ELM_POPUP_ITEM_CLASS elm_popup_item_class_get() -EWAPI const Efl_Class *elm_popup_item_class_get(void); +EWAPI const Efl_Class *elm_popup_item_class_get(void) EINA_CONST; #endif diff --git a/src/lib/elementary/elm_prefs.h b/src/lib/elementary/elm_prefs.h index 37f76e57d6..ecc1a25ef9 100644 --- a/src/lib/elementary/elm_prefs.h +++ b/src/lib/elementary/elm_prefs.h @@ -34,7 +34,7 @@ * * Once a prefs widget is created, after elm_prefs_file_set() is * issued on it, all of its UI elements will get default values, - * declared on that file. To fetch an user's own, personal set of + * declared on that file. To fetch a user's own, personal set of * those values, one gets to pair an <b>@ref elm-prefs-data</b> handle * to the prefs widget. * diff --git a/src/lib/elementary/elm_prefs_eo.h b/src/lib/elementary/elm_prefs_eo.h index 5f6fad3bf2..08c70b50fb 100644 --- a/src/lib/elementary/elm_prefs_eo.h +++ b/src/lib/elementary/elm_prefs_eo.h @@ -19,14 +19,14 @@ typedef Eo Elm_Prefs; */ #define ELM_PREFS_CLASS elm_prefs_class_get() -EWAPI const Efl_Class *elm_prefs_class_get(void); +EWAPI const Efl_Class *elm_prefs_class_get(void) EINA_CONST; /** * @brief Set user data for a given prefs widget * * Once a prefs widget is created, after elm_prefs_file_set() is issued on it, * all of its UI elements will get default values, when declared on that file. - * To fetch an user's own, personal set of those values, one gets to pair a + * To fetch a user's own, personal set of those values, one gets to pair a * prefs data handle to the prefs widget. This is what this call is intended * for. * @@ -59,7 +59,7 @@ EOAPI Eina_Bool elm_obj_prefs_data_set(Eo *obj, Elm_Prefs_Data *data); * * Once a prefs widget is created, after elm_prefs_file_set() is issued on it, * all of its UI elements will get default values, when declared on that file. - * To fetch an user's own, personal set of those values, one gets to pair a + * To fetch a user's own, personal set of those values, one gets to pair a * prefs data handle to the prefs widget. This is what this call is intended * for. * @@ -147,7 +147,7 @@ EOAPI void elm_obj_prefs_reset(Eo *obj, Elm_Prefs_Reset_Mode mode); /** * @brief Set the value on a given prefs widget's item. * - * This will change the value of item named @c name programatically. + * This will change the value of item named @c name programmatically. * * @param[in] obj The object. * @param[in] name The name of the item (as declared in the prefs collection) @@ -304,7 +304,7 @@ EOAPI Efl_Canvas_Object *elm_obj_prefs_item_unswallow(Eo *obj, const char *name) * * Each prefs item may have a default visibility state, declared on the $.epb * @c prefs it was loaded with. By this call one may alter that state, - * programatically. + * programmatically. * * @param[in] obj The object. * @param[in] name The name of the item (as declared in the prefs collection) diff --git a/src/lib/elementary/elm_prefs_eo.legacy.h b/src/lib/elementary/elm_prefs_eo.legacy.h index 47fb914d56..85a8f5dd7d 100644 --- a/src/lib/elementary/elm_prefs_eo.legacy.h +++ b/src/lib/elementary/elm_prefs_eo.legacy.h @@ -19,7 +19,7 @@ typedef Eo Elm_Prefs; * * Once a prefs widget is created, after elm_prefs_file_set() is issued on it, * all of its UI elements will get default values, when declared on that file. - * To fetch an user's own, personal set of those values, one gets to pair a + * To fetch a user's own, personal set of those values, one gets to pair a * prefs data handle to the prefs widget. This is what this call is intended * for. * @@ -52,7 +52,7 @@ EAPI Eina_Bool elm_prefs_data_set(Elm_Prefs *obj, Elm_Prefs_Data *data); * * Once a prefs widget is created, after elm_prefs_file_set() is issued on it, * all of its UI elements will get default values, when declared on that file. - * To fetch an user's own, personal set of those values, one gets to pair a + * To fetch a user's own, personal set of those values, one gets to pair a * prefs data handle to the prefs widget. This is what this call is intended * for. * @@ -140,7 +140,7 @@ EAPI void elm_prefs_reset(Elm_Prefs *obj, Elm_Prefs_Reset_Mode mode); /** * @brief Set the value on a given prefs widget's item. * - * This will change the value of item named @c name programatically. + * This will change the value of item named @c name programmatically. * * @param[in] obj The object. * @param[in] name The name of the item (as declared in the prefs collection) @@ -297,7 +297,7 @@ EAPI Efl_Canvas_Object *elm_prefs_item_unswallow(Elm_Prefs *obj, const char *nam * * Each prefs item may have a default visibility state, declared on the $.epb * @c prefs it was loaded with. By this call one may alter that state, - * programatically. + * programmatically. * * @param[in] obj The object. * @param[in] name The name of the item (as declared in the prefs collection) diff --git a/src/lib/elementary/elm_priv.h b/src/lib/elementary/elm_priv.h index ca3ab0620f..aee4b4d8d6 100644 --- a/src/lib/elementary/elm_priv.h +++ b/src/lib/elementary/elm_priv.h @@ -8,6 +8,7 @@ # endif # ifdef HAVE_ELEMENTARY_WL2 # include <Ecore_Wl2.h> +# include "ecore_wl2_internal.h" # endif # ifdef HAVE_ELEMENTARY_DRM # include <Ecore_Drm2.h> @@ -164,7 +165,6 @@ # include "efl_ui_focus_parent_provider.eo.h" # include "efl_ui_focus_parent_provider_standard.eo.h" -# include "efl_ui_selection_manager.eo.h" # include "efl_datetime_manager.eo.h" extern const char *_efl_model_property_itemw; @@ -270,7 +270,7 @@ struct _Efl_Ui_Theme_Data * the users config doesn't need to be wiped - simply new values need * to be put in */ -# define ELM_CONFIG_FILE_GENERATION 0x0016 +# define ELM_CONFIG_FILE_GENERATION 0x0018 # define ELM_CONFIG_VERSION_EPOCH_OFFSET 16 # define ELM_CONFIG_VERSION ((ELM_CONFIG_EPOCH << ELM_CONFIG_VERSION_EPOCH_OFFSET) | \ ELM_CONFIG_FILE_GENERATION) @@ -550,7 +550,7 @@ struct _Elm_Config double glayer_zoom_finger_factor; double glayer_zoom_wheel_factor; double glayer_zoom_distance_tolerance; - double glayer_rotate_finger_enable; + unsigned char glayer_rotate_finger_enable; double glayer_rotate_angular_tolerance; double glayer_line_min_length; double glayer_line_distance_tolerance; @@ -667,9 +667,6 @@ void _elm_prefs_data_init(void); void _elm_prefs_data_shutdown(void); /* init functions for dnd and cnp */ -Eo* _efl_ui_selection_manager_get(Eo *obj); -void _efl_ui_dnd_shutdown(void); - int _elm_ews_wm_init(void); void _elm_ews_wm_shutdown(void); void _elm_ews_wm_rescale(Elm_Theme *th, @@ -851,6 +848,10 @@ void _elm_win_wl_cursor_set(Evas_Object *obj, const char *cursor void _efl_ui_focus_manager_redirect_events_del(Efl_Ui_Focus_Manager *manager, Eo *obj); void _efl_ui_focus_manager_redirect_events_add(Efl_Ui_Focus_Manager *manager, Eo *obj); +EOAPI Eina_Bool efl_ui_focus_manager_calc_update_children(Eo *obj, Efl_Ui_Focus_Object *parent, Eina_List *children EFL_TRANSFER_OWNERSHIP); +EOAPI void efl_ui_focus_manager_calc_update_order(Eo *obj, Efl_Ui_Focus_Object *parent, Eina_List *children EFL_TRANSFER_OWNERSHIP); + + void _efl_access_shutdown(void); /* Combobox: no proper support for Efl.Part API yet. */ @@ -903,10 +904,6 @@ extern Eina_Bool _config_profile_lock; extern Eina_FreeQ *postponed_fq; -# ifdef HAVE_ELEMENTARY_WL2 -extern Ecore_Wl2_Display *_elm_wl_display; -# endif - # ifdef ENABLE_NLS /* Our gettext wrapper, used to disable translation of elm if the app * is not translated. */ @@ -930,6 +927,7 @@ void _elm_entry_entry_paste(Evas_Object *obj, const char *entry); double _elm_atof(const char *s); +void _elm_layout_legacy_icon_signal_emit(Evas_Object *obj); // elm_layout and elm_entry LEGACY signal API (returned the user data pointer) void _elm_layout_signal_callback_add_legacy(Eo *obj, Eo *edje, Eina_List **p_edje_signals, const char *emission, const char *source, Edje_Signal_Cb func, void *data); void *_elm_layout_signal_callback_del_legacy(Eo *obj, Eo *edje, Eina_List **p_edje_signals, const char *emission, const char *source, Edje_Signal_Cb func); @@ -1055,4 +1053,11 @@ typedef struct Efl_Ui_Shared_Win_Data* efl_ui_win_shared_data_get(Efl_Ui_Win *win); +void _selection_changed_event_register(Eo *obj); +void _selection_changed_event_unregister(Eo *obj); +void _drop_event_register(Eo *obj); +void _drop_event_unregister(Eo *obj); +void _register_selection_changed(Efl_Ui_Selection *selection); +Efl_Ui_Win* efl_ui_win_get(Evas_Object *obj); + #endif diff --git a/src/lib/elementary/elm_progressbar.h b/src/lib/elementary/elm_progressbar.h index 8c57fcf76a..bd051e39e6 100644 --- a/src/lib/elementary/elm_progressbar.h +++ b/src/lib/elementary/elm_progressbar.h @@ -30,11 +30,11 @@ * Applications can query the progress bar for its value with * elm_progressbar_value_get(). * - * This widget inherits from the @ref Layout one, so that all the + * This widget inherits from the @ref Elm_Layout one, so that all the * functions acting on it also work for progress bar objects. * * This widget emits the following signals, besides the ones sent from - * @ref Layout: + * @ref Elm_Layout : * @li @c "changed" - when the value is changed (since 1.7) * @li @c "focused" - When the progressbar has received focus. (since 1.8) * @li @c "unfocused" - When the progressbar has lost focus. (since 1.8) diff --git a/src/lib/elementary/elm_radio.h b/src/lib/elementary/elm_radio.h index dfedb190c9..87903d60f7 100644 --- a/src/lib/elementary/elm_radio.h +++ b/src/lib/elementary/elm_radio.h @@ -1,5 +1,5 @@ /** - * @defgroup Elm_Radio Radio + * @defgroup Elm_Radio_Group Radio * @ingroup Elementary * * @image html radio_inheritance_tree.png @@ -33,11 +33,11 @@ * The radio objects will modify this directly. That implies the pointer must * point to valid memory for as long as the radio objects exist. * - * This widget inherits from the @ref Layout one, so that all the + * This widget inherits from the @ref Elm_Layout one, so that all the * functions acting on it also work for radio objects. * * This widget emits the following signals, besides the ones sent from - * @ref Layout: + * @ref Elm_Layout : * @li @c "changed" - This is called when the radio object is selected. If you * want to trace the state change of a radio group, you should add this callback * to all the radio objects in that group. diff --git a/src/lib/elementary/elm_radio_legacy.h b/src/lib/elementary/elm_radio_legacy.h index 35a4741ad1..39e1613537 100644 --- a/src/lib/elementary/elm_radio_legacy.h +++ b/src/lib/elementary/elm_radio_legacy.h @@ -6,7 +6,7 @@ typedef Eo Elm_Radio; * @param parent The parent object * @return The new object or NULL if it cannot be created * - * @ingroup Elm_Radio + * @ingroup Elm_Radio_Group */ EAPI Evas_Object *elm_radio_add(Evas_Object *parent); @@ -18,7 +18,7 @@ EAPI Evas_Object *elm_radio_add(Evas_Object *parent); * * @param[in] value The value to use for the group * - * @ingroup Elm_Radio + * @ingroup Elm_Radio_Group */ EAPI void elm_radio_value_set(Evas_Object *obj, int value); @@ -27,7 +27,7 @@ EAPI void elm_radio_value_set(Evas_Object *obj, int value) * * @return The value to use for the group * - * @ingroup Elm_Radio + * @ingroup Elm_Radio_Group */ EAPI int elm_radio_value_get(const Evas_Object *obj); diff --git a/src/lib/elementary/elm_removed.h b/src/lib/elementary/elm_removed.h index e6e9795135..1e126c578a 100644 --- a/src/lib/elementary/elm_removed.h +++ b/src/lib/elementary/elm_removed.h @@ -1976,7 +1976,7 @@ EINA_DEPRECATED EAPI void elm_flipselector_item_del(Elm_Object_Item *it); EINA_DEPRECATED EAPI void elm_flipselector_interval_set(Evas_Object *obj, double interval); /** - * Get the interval on time updates for an user mouse button hold + * Get the interval on time updates for a user mouse button hold * on a flip selector widget. * * @param obj The flip selector object diff --git a/src/lib/elementary/elm_route_eo.h b/src/lib/elementary/elm_route_eo.h index a1946233e8..64208eda8f 100644 --- a/src/lib/elementary/elm_route_eo.h +++ b/src/lib/elementary/elm_route_eo.h @@ -19,7 +19,7 @@ typedef Eo Elm_Route; */ #define ELM_ROUTE_CLASS elm_route_class_get() -EWAPI const Efl_Class *elm_route_class_get(void); +EWAPI const Efl_Class *elm_route_class_get(void) EINA_CONST; /** * @brief Set map widget for this route diff --git a/src/lib/elementary/elm_scroller.c b/src/lib/elementary/elm_scroller.c index 8d20030a91..95643ce772 100644 --- a/src/lib/elementary/elm_scroller.c +++ b/src/lib/elementary/elm_scroller.c @@ -328,6 +328,7 @@ _elm_scroller_efl_ui_widget_on_access_activate(Eo *obj, Elm_Scroller_Data *_pd E EOLIAN static void _elm_scroller_efl_canvas_group_group_calculate(Eo *obj, Elm_Scroller_Data *sd) { + Evas_Coord ovw, ovh; Evas_Coord vw = 0, vh = 0, minw = 0, minh = 0, maxw = 0, maxh = 0, w, h, vmw, vmh; Evas_Coord h_pagesize, v_pagesize; @@ -345,6 +346,10 @@ _elm_scroller_efl_canvas_group_group_calculate(Eo *obj, Elm_Scroller_Data *sd) elm_interface_scrollable_content_viewport_geometry_get (obj, NULL, NULL, &vw, &vh); + + ovw = vw; + ovh = vh; + if (xw > 0.0) { if ((minw > 0) && (vw < minw)) @@ -372,7 +377,8 @@ _elm_scroller_efl_canvas_group_group_calculate(Eo *obj, Elm_Scroller_Data *sd) { if (!sd->proxy_content[i]) continue; elm_interface_scrollable_paging_get((Eo *)obj, NULL, NULL, &h_pagesize, &v_pagesize); - evas_object_image_fill_set(sd->proxy_content[i], 0, 0, vw, vh); + evas_object_image_fill_set(sd->proxy_content[i], 0, 0, ovw, ovh); + evas_object_image_load_region_set(sd->proxy_content[i], 0, 0, ovw, ovh); evas_object_size_hint_min_set(sd->proxy_content[i], h_pagesize, v_pagesize); } @@ -1208,10 +1214,10 @@ elm_scroller_movement_block_set(Evas_Object *obj, Efl_Ui_Layout_Orientation mode = EFL_UI_LAYOUT_ORIENTATION_DEFAULT; // legacy -> eo - if (block == ELM_SCROLLER_MOVEMENT_BLOCK_HORIZONTAL) - mode = EFL_UI_LAYOUT_ORIENTATION_HORIZONTAL; - else if (block == ELM_SCROLLER_MOVEMENT_BLOCK_VERTICAL) - mode = EFL_UI_LAYOUT_ORIENTATION_VERTICAL; + if (block & ELM_SCROLLER_MOVEMENT_BLOCK_HORIZONTAL) + mode |= EFL_UI_LAYOUT_ORIENTATION_HORIZONTAL; + if (block & ELM_SCROLLER_MOVEMENT_BLOCK_VERTICAL) + mode |= EFL_UI_LAYOUT_ORIENTATION_VERTICAL; elm_interface_scrollable_movement_block_set(obj, mode); } @@ -1220,18 +1226,20 @@ EAPI Elm_Scroller_Movement_Block elm_scroller_movement_block_get(const Evas_Object *obj) { Efl_Ui_Layout_Orientation mode; + Elm_Scroller_Movement_Block mode2 = 0; ELM_SCROLLABLE_CHECK(obj, ELM_SCROLLER_MOVEMENT_NO_BLOCK); mode = elm_interface_scrollable_movement_block_get(obj); // eo -> legacy - if (mode == EFL_UI_LAYOUT_ORIENTATION_HORIZONTAL) - return ELM_SCROLLER_MOVEMENT_BLOCK_HORIZONTAL; - else if (mode == EFL_UI_LAYOUT_ORIENTATION_VERTICAL) - return ELM_SCROLLER_MOVEMENT_BLOCK_VERTICAL; + if (mode & EFL_UI_LAYOUT_ORIENTATION_HORIZONTAL) + mode2 |= ELM_SCROLLER_MOVEMENT_BLOCK_HORIZONTAL; + else if (mode & EFL_UI_LAYOUT_ORIENTATION_VERTICAL) + mode2 |= ELM_SCROLLER_MOVEMENT_BLOCK_VERTICAL; - return ELM_SCROLLER_MOVEMENT_NO_BLOCK; + if (mode2 == 0) return ELM_SCROLLER_MOVEMENT_NO_BLOCK; + return mode2; } EAPI void diff --git a/src/lib/elementary/elm_scroller.h b/src/lib/elementary/elm_scroller.h index b12de04b6c..1dc44075db 100644 --- a/src/lib/elementary/elm_scroller.h +++ b/src/lib/elementary/elm_scroller.h @@ -1,5 +1,5 @@ /** - * @defgroup Elm_Scroller Scroller + * @defgroup Elm_Scroller_Group Scroller * @ingroup Elementary * * @image html scroller_inheritance_tree.png @@ -12,7 +12,7 @@ * always have a small minimum size by default as it won't be limited * by the contents of the scroller. * - * This widget inherits from the @ref Layout one, so that all the + * This widget inherits from the @ref Elm_Layout one, so that all the * functions acting on it also work for scroller objects. * * This widget emits the following signals, besides the ones sent from diff --git a/src/lib/elementary/elm_scroller_eo.h b/src/lib/elementary/elm_scroller_eo.h index 6d4dd6ce38..29f6bef140 100644 --- a/src/lib/elementary/elm_scroller_eo.h +++ b/src/lib/elementary/elm_scroller_eo.h @@ -19,7 +19,7 @@ typedef Eo Elm_Scroller; */ #define ELM_SCROLLER_CLASS elm_scroller_class_get() -EWAPI const Efl_Class *elm_scroller_class_get(void); +EWAPI const Efl_Class *elm_scroller_class_get(void) EINA_CONST; /** * @brief Set custom theme elements for the scroller diff --git a/src/lib/elementary/elm_scroller_legacy.h b/src/lib/elementary/elm_scroller_legacy.h index 76748986c4..2ecfd05f3e 100644 --- a/src/lib/elementary/elm_scroller_legacy.h +++ b/src/lib/elementary/elm_scroller_legacy.h @@ -8,7 +8,7 @@ * * See also @ref elm_interface_scrollable_policy_set. * - * @ingroup Elm_Scroller + * @ingroup Elm_Scroller_Group */ typedef enum { @@ -24,7 +24,7 @@ typedef enum * * See also @ref elm_interface_scrollable_single_direction_set. * - * @ingroup Elm_Scroller + * @ingroup Elm_Scroller_Group */ typedef enum { @@ -46,7 +46,7 @@ typedef enum * * @since 1.8 * - * @ingroup Elm_Scroller + * @ingroup Elm_Scroller_Group */ typedef enum { @@ -61,7 +61,7 @@ typedef enum * @param parent The parent object * @return The new object or NULL if it cannot be created * - * @ingroup Elm_Scroller + * @ingroup Elm_Scroller_Group */ EAPI Evas_Object *elm_scroller_add(Evas_Object *parent); @@ -77,7 +77,7 @@ EAPI Evas_Object *elm_scroller_add(Evas_Object *parent); * right size horizontally and/or vertically to perfectly fit its content in * that direction. * - * @ingroup Elm_Scroller + * @ingroup Elm_Scroller_Group */ EAPI void elm_scroller_content_min_limit(Evas_Object *obj, Eina_Bool w, Eina_Bool h); @@ -94,7 +94,7 @@ EAPI void elm_scroller_content_min_limit(Evas_Object *o * region in the virtual content object (0, 0 starting at the top-left of the * virtual content object) is shown within the scroller. * - * @ingroup Elm_Scroller + * @ingroup Elm_Scroller_Group */ EAPI void elm_scroller_region_show(Evas_Object *obj, Evas_Coord x, Evas_Coord y, Evas_Coord w, Evas_Coord h); @@ -111,7 +111,7 @@ EAPI void elm_scroller_region_show(Evas_Object *obj, Ev * the time, and #ELM_SCROLLER_POLICY_OFF always keeps it off. This applies * respectively for the horizontal and vertical scrollbars. * - * @ingroup Elm_Scroller + * @ingroup Elm_Scroller_Group */ EAPI void elm_scroller_policy_set(Evas_Object *obj, Elm_Scroller_Policy policy_h, Elm_Scroller_Policy policy_v); @@ -124,7 +124,7 @@ EAPI void elm_scroller_policy_set(Evas_Object *obj, Elm * * @see elm_scroller_policy_set() * - * @ingroup Elm_Scroller + * @ingroup Elm_Scroller_Group */ EAPI void elm_scroller_policy_get(const Evas_Object *obj, Elm_Scroller_Policy *policy_h, Elm_Scroller_Policy *policy_v); @@ -138,7 +138,7 @@ EAPI void elm_scroller_policy_get(const Evas_Object *ob * * @since 1.8 * - * @ingroup Elm_Scroller + * @ingroup Elm_Scroller_Group */ EAPI void elm_scroller_single_direction_set(Evas_Object *obj, Elm_Scroller_Single_Direction single_dir); @@ -152,7 +152,7 @@ EAPI void elm_scroller_single_direction_set(Evas_Object * * @since 1.8 * - * @ingroup Elm_Scroller + * @ingroup Elm_Scroller_Group */ EAPI Elm_Scroller_Single_Direction elm_scroller_single_direction_get(const Evas_Object *obj); @@ -173,7 +173,7 @@ EAPI Elm_Scroller_Single_Direction elm_scroller_single_direction_get(const Evas_ * * @see elm_scroller_region_show() * - * @ingroup Elm_Scroller + * @ingroup Elm_Scroller_Group */ EAPI void elm_scroller_region_get(const Evas_Object *obj, Evas_Coord *x, Evas_Coord *y, Evas_Coord *w, Evas_Coord *h); @@ -186,7 +186,7 @@ EAPI void elm_scroller_region_get(const Evas_Object *ob * * This gets the size of the content object of the scroller. * - * @ingroup Elm_Scroller + * @ingroup Elm_Scroller_Group */ EAPI void elm_scroller_child_size_get(const Evas_Object *obj, Evas_Coord *w, Evas_Coord *h); @@ -209,7 +209,7 @@ EAPI void elm_scroller_child_size_get(const Evas_Object * * @since 1.8 * - * @ingroup Elm_Scroller + * @ingroup Elm_Scroller_Group */ EAPI void elm_scroller_page_snap_set(Evas_Object *obj, Eina_Bool page_h_snap, Eina_Bool page_v_snap); @@ -224,7 +224,7 @@ EAPI void elm_scroller_page_snap_set(Evas_Object *obj, * * @since 1.8 * - * @ingroup Elm_Scroller + * @ingroup Elm_Scroller_Group */ EAPI void elm_scroller_page_snap_get(const Evas_Object *obj, Eina_Bool *page_h_snap, Eina_Bool *page_v_snap); @@ -240,7 +240,7 @@ EAPI void elm_scroller_page_snap_get(const Evas_Object * This is enabled by default for both axis. This API will set if it is enabled * for the given axis with the boolean parameters for each axis. * - * @ingroup Elm_Scroller + * @ingroup Elm_Scroller_Group */ EAPI void elm_scroller_bounce_set(Evas_Object *obj, Eina_Bool h_bounce, Eina_Bool v_bounce); @@ -253,7 +253,7 @@ EAPI void elm_scroller_bounce_set(Evas_Object *obj, Ein * * @see elm_scroller_bounce_set() * - * @ingroup Elm_Scroller + * @ingroup Elm_Scroller_Group */ EAPI void elm_scroller_bounce_get(const Evas_Object *obj, Eina_Bool *h_bounce, Eina_Bool *v_bounce); @@ -275,7 +275,7 @@ EAPI void elm_scroller_bounce_get(const Evas_Object *ob * including 1.0. If you only want 1 axis to be page "limited", use 0.0 for * the other axis. * - * @ingroup Elm_Scroller + * @ingroup Elm_Scroller_Group */ EAPI void elm_scroller_page_relative_set(Evas_Object *obj, double h_pagerel, double v_pagerel); @@ -293,7 +293,7 @@ EAPI void elm_scroller_page_relative_set(Evas_Object *o * * @since 1.7 * - * @ingroup Elm_Scroller + * @ingroup Elm_Scroller_Group */ EAPI void elm_scroller_page_relative_get(const Evas_Object *obj, double *h_pagerel, double *v_pagerel); @@ -310,7 +310,7 @@ EAPI void elm_scroller_page_relative_get(const Evas_Obj * @see elm_scroller_page_relative_set() * @see elm_scroller_page_size_get() * - * @ingroup Elm_Scroller + * @ingroup Elm_Scroller_Group */ EAPI void elm_scroller_page_size_set(Evas_Object *obj, Evas_Coord h_pagesize, Evas_Coord v_pagesize); @@ -326,7 +326,7 @@ EAPI void elm_scroller_page_size_set(Evas_Object *obj, * * @since 1.7 * - * @ingroup Elm_Scroller + * @ingroup Elm_Scroller_Group */ EAPI void elm_scroller_page_size_get(const Evas_Object *obj, Evas_Coord *h_pagesize, Evas_Coord *v_pagesize); @@ -346,7 +346,7 @@ EAPI void elm_scroller_page_size_get(const Evas_Object * @see elm_scroller_page_show() * @see elm_scroller_page_bring_in() * - * @ingroup Elm_Scroller + * @ingroup Elm_Scroller_Group */ EAPI void elm_scroller_current_page_get(const Evas_Object *obj, int *h_pagenumber, int *v_pagenumber); @@ -364,7 +364,7 @@ EAPI void elm_scroller_current_page_get(const Evas_Obje * @see elm_scroller_page_show() * @see elm_scroller_page_bring_in() * - * @ingroup Elm_Scroller + * @ingroup Elm_Scroller_Group */ EAPI void elm_scroller_last_page_get(const Evas_Object *obj, int *h_pagenumber, int *v_pagenumber); @@ -390,7 +390,7 @@ EAPI void elm_scroller_last_page_get(const Evas_Object * * @see elm_scroller_page_bring_in() * - * @ingroup Elm_Scroller + * @ingroup Elm_Scroller_Group */ EAPI void elm_scroller_page_show(Evas_Object *obj, int h_pagenumber, int v_pagenumber); @@ -416,7 +416,7 @@ EAPI void elm_scroller_page_show(Evas_Object *obj, int * * @see elm_scroller_page_show() * - * @ingroup Elm_Scroller + * @ingroup Elm_Scroller_Group */ EAPI void elm_scroller_page_bring_in(Evas_Object *obj, int h_pagenumber, int v_pagenumber); @@ -439,7 +439,7 @@ EAPI void elm_scroller_page_bring_in(Evas_Object *obj, * * @see elm_scroller_region_show() * - * @ingroup Elm_Scroller + * @ingroup Elm_Scroller_Group */ EAPI void elm_scroller_region_bring_in(Evas_Object *obj, Evas_Coord x, Evas_Coord y, Evas_Coord w, Evas_Coord h); @@ -462,7 +462,7 @@ EAPI void elm_scroller_region_bring_in(Evas_Object *obj * * Default values for x and y are 0.0 * - * @ingroup Elm_Scroller + * @ingroup Elm_Scroller_Group */ EAPI void elm_scroller_gravity_set(Evas_Object *obj, double x, double y); @@ -477,7 +477,7 @@ EAPI void elm_scroller_gravity_set(Evas_Object *obj, do * * @see elm_scroller_gravity_set() * - * @ingroup Elm_Scroller + * @ingroup Elm_Scroller_Group */ EAPI void elm_scroller_gravity_get(const Evas_Object *obj, double *x, double *y); @@ -501,21 +501,21 @@ EAPI void elm_scroller_gravity_get(const Evas_Object *o * * @since 1.8 * - * @ingroup Elm_Scroller + * @ingroup Elm_Scroller_Group */ EAPI void elm_scroller_movement_block_set(Evas_Object *obj, Elm_Scroller_Movement_Block block); /** * @brief Get a scroller's scroll blocking state * - * @param parent The scroller object + * @param obj The scroller object * @return The blocking state * * @since 1.8 * * @see elm_scroller_movement_block_set() for more details * - * @ingroup Elm_Scroller + * @ingroup Elm_Scroller_Group */ EAPI Elm_Scroller_Movement_Block elm_scroller_movement_block_get(const Evas_Object *obj); @@ -532,7 +532,7 @@ EAPI Elm_Scroller_Movement_Block elm_scroller_movement_block_get(const Evas_Obj * * @since 1.13 * - * @ingroup Elm_Scroller + * @ingroup Elm_Scroller_Group */ EAPI void elm_scroller_step_size_set(Evas_Object *obj, Evas_Coord x, Evas_Coord y); @@ -547,7 +547,7 @@ EAPI void elm_scroller_step_size_set(Evas_Object *obj, * * @since 1.13 * - * @ingroup Elm_Scroller + * @ingroup Elm_Scroller_Group */ EAPI void elm_scroller_step_size_get(const Evas_Object *obj, Evas_Coord *x, Evas_Coord *y); @@ -563,7 +563,7 @@ EAPI void elm_scroller_step_size_get(const Evas_Object * * @since 1.14 * - * @ingroup Elm_Scroller + * @ingroup Elm_Scroller_Group */ EAPI void elm_scroller_loop_set(Evas_Object *obj, Eina_Bool loop_h, Eina_Bool loop_v); @@ -578,7 +578,7 @@ EAPI void elm_scroller_loop_set(Evas_Object *obj, Eina_ * * @see elm_scroller_loop_set() for more details * - * @ingroup Elm_Scroller + * @ingroup Elm_Scroller_Group */ EAPI void elm_scroller_loop_get(const Evas_Object *obj, Eina_Bool *loop_h, Eina_Bool *loop_v); @@ -595,7 +595,7 @@ EAPI void elm_scroller_loop_get(const Evas_Object *obj, * * @see elm_scroller_wheel_disabled_get() * - * @ingroup Elm_Scroller + * @ingroup Elm_Scroller_Group */ EAPI void elm_scroller_wheel_disabled_set(Evas_Object *obj, Eina_Bool disabled); @@ -611,7 +611,7 @@ EAPI void elm_scroller_wheel_disabled_set(Evas_Object * * * @see elm_scroller_wheel_disabled_set() * - * @ingroup Elm_Scroller + * @ingroup Elm_Scroller_Group */ EAPI Eina_Bool elm_scroller_wheel_disabled_get(const Evas_Object *obj); @@ -624,7 +624,7 @@ EAPI Eina_Bool elm_scroller_wheel_disabled_get(const Evas_Ob * @param[in] obj The scroller object * @param[in] propagation The propagation state * - * @ingroup Elm_Scroller + * @ingroup Elm_Scroller_Group */ EAPI void elm_scroller_propagate_events_set(Evas_Object *obj, Eina_Bool propagation); @@ -636,7 +636,7 @@ EAPI void elm_scroller_propagate_events_set(Evas_Object *obj, Eina_Bool propagat * @param[in] obj The scroller object * @return The propagation state * - * @ingroup Elm_Scroller + * @ingroup Elm_Scroller_Group */ EAPI Eina_Bool elm_scroller_propagate_events_get(const Evas_Object *obj); #endif diff --git a/src/lib/elementary/elm_segment_control.h b/src/lib/elementary/elm_segment_control.h index fdfa2dd79d..1ad286b050 100644 --- a/src/lib/elementary/elm_segment_control.h +++ b/src/lib/elementary/elm_segment_control.h @@ -21,11 +21,11 @@ * Only one segment item can be at selected state. A segment item can display * combination of Text and any Evas_Object like Images or other widget. * - * This widget inherits from the @ref Layout one, so that all the + * This widget inherits from the @ref Elm_Layout one, so that all the * functions acting on it also work for segment control objects. * * This widget emits the following signals, besides the ones sent from - * @ref Layout: + * @ref Elm_Layout : * - @c "changed" - When the user clicks on a segment item which is not * previously selected and get selected. The event_info parameter is the * segment item pointer. diff --git a/src/lib/elementary/elm_segment_control_eo.h b/src/lib/elementary/elm_segment_control_eo.h index 36c78056d1..6c8b8f4bb9 100644 --- a/src/lib/elementary/elm_segment_control_eo.h +++ b/src/lib/elementary/elm_segment_control_eo.h @@ -19,7 +19,7 @@ typedef Eo Elm_Segment_Control; */ #define ELM_SEGMENT_CONTROL_CLASS elm_segment_control_class_get() -EWAPI const Efl_Class *elm_segment_control_class_get(void); +EWAPI const Efl_Class *elm_segment_control_class_get(void) EINA_CONST; /** * @brief Get the Segment items count from segment control. diff --git a/src/lib/elementary/elm_segment_control_item_eo.h b/src/lib/elementary/elm_segment_control_item_eo.h index b61ba74a05..e6894161cf 100644 --- a/src/lib/elementary/elm_segment_control_item_eo.h +++ b/src/lib/elementary/elm_segment_control_item_eo.h @@ -19,7 +19,7 @@ typedef Eo Elm_Segment_Control_Item; */ #define ELM_SEGMENT_CONTROL_ITEM_CLASS elm_segment_control_item_class_get() -EWAPI const Efl_Class *elm_segment_control_item_class_get(void); +EWAPI const Efl_Class *elm_segment_control_item_class_get(void) EINA_CONST; /** * @brief Get the index of an item. diff --git a/src/lib/elementary/elm_separator.h b/src/lib/elementary/elm_separator.h index 40d39dce13..5a46b76f8c 100644 --- a/src/lib/elementary/elm_separator.h +++ b/src/lib/elementary/elm_separator.h @@ -9,10 +9,10 @@ * * A separator can be vertical or horizontal. * - * This widget inherits from the @ref Layout one, so that all the + * This widget inherits from the @ref Elm_Layout one, so that all the * functions acting on it also work for separator objects. * - * This widget emits the signals coming from @ref Layout. + * This widget emits the signals coming from @ref Elm_Layout. * * @ref tutorial_separator is a good example of how to use a separator. * @{ diff --git a/src/lib/elementary/elm_separator_eo.h b/src/lib/elementary/elm_separator_eo.h index ce4d5e0539..7c0375acf6 100644 --- a/src/lib/elementary/elm_separator_eo.h +++ b/src/lib/elementary/elm_separator_eo.h @@ -19,7 +19,7 @@ typedef Eo Elm_Separator; */ #define ELM_SEPARATOR_CLASS elm_separator_class_get() -EWAPI const Efl_Class *elm_separator_class_get(void); +EWAPI const Efl_Class *elm_separator_class_get(void) EINA_CONST; /** * @brief Set the horizontal mode of a separator object diff --git a/src/lib/elementary/elm_slider.c b/src/lib/elementary/elm_slider.c index 2c6c26b84d..e5bd17711b 100644 --- a/src/lib/elementary/elm_slider.c +++ b/src/lib/elementary/elm_slider.c @@ -102,7 +102,7 @@ _units_set(Evas_Object *obj) { Eina_Value val; - eina_value_setup(&val, EINA_VALUE_TYPE_DOUBLE); + if (!eina_value_setup(&val, EINA_VALUE_TYPE_DOUBLE)) return; eina_strbuf_reset(sd->format_strbuf); if (!sd->intvl_enable) @@ -147,7 +147,7 @@ _indicator_set(Evas_Object *obj) if (!sd->indi_format_cb) return; - eina_value_setup(&val, EINA_VALUE_TYPE_DOUBLE); + if (!eina_value_setup(&val, EINA_VALUE_TYPE_DOUBLE)) return; eina_strbuf_reset(sd->indi_format_strbuf); eina_value_set(&val, sd->val); @@ -180,7 +180,7 @@ _min_max_set(Evas_Object *obj) Eina_Value val; if (!sd->format_cb) return; - eina_value_setup(&val, EINA_VALUE_TYPE_DOUBLE); + if (!eina_value_setup(&val, EINA_VALUE_TYPE_DOUBLE)) return; str = eina_strbuf_new(); @@ -630,9 +630,6 @@ _elm_slider_efl_ui_widget_widget_input_event_handler(Eo *obj, Elm_Slider_Data *s else _drag_down(obj, NULL, NULL, NULL); efl_input_processed_set(ev, EINA_TRUE); - ELM_SAFE_FREE(sd->wheel_indicator_timer, ecore_timer_del); - sd->wheel_indicator_timer = - ecore_timer_add(0.5, _wheel_indicator_timer_cb, obj); } else return EINA_FALSE; @@ -640,6 +637,13 @@ _elm_slider_efl_ui_widget_widget_input_event_handler(Eo *obj, Elm_Slider_Data *s _val_fetch(obj, EINA_TRUE); evas_object_smart_changed(obj); + if (eo_event->desc == EFL_EVENT_POINTER_WHEEL) + { + ELM_SAFE_FREE(sd->wheel_indicator_timer, ecore_timer_del); + sd->wheel_indicator_timer = + ecore_timer_add(0.5, _wheel_indicator_timer_cb, obj); + } + return EINA_TRUE; } @@ -1266,6 +1270,9 @@ _elm_slider_efl_ui_format_format_cb_set(Eo *obj, Elm_Slider_Data *sd, void *func if (sd->format_cb_data && sd->format_free_cb) sd->format_free_cb(sd->format_cb_data); +// sd->format_cb = NULL; +// sd->format_cb_data = NULL; +// sd->format_free_cb = NULL; if (efl_invalidated_get(obj)) return; @@ -1357,7 +1364,7 @@ _indi_default_format_cb(void *data, Eina_Strbuf *str, const Eina_Value value) if (type != EINA_VALUE_TYPE_DOUBLE) return EINA_FALSE; - eina_value_get(&value, &v); + if (!eina_value_get(&value, &v)) return EINA_FALSE; eina_strbuf_append_printf(str, sd->indi_template, v); return EINA_TRUE; @@ -1497,7 +1504,7 @@ elm_slider_step_set(Evas_Object *obj, double step) ERR("Wrong param. The step(%lf) should be greater than 0.0", step); return; } - if (sd->step == step) return; + if (EINA_DBL_EQ(sd->step, step)) return; sd->step = step; } @@ -1567,7 +1574,9 @@ _format_legacy_to_format_eo_cb(void *data, Eina_Strbuf *str, const Eina_Value va const Eina_Value_Type *type = eina_value_type_get(&value); if (type == EINA_VALUE_TYPE_DOUBLE) - eina_value_get(&value, &val); + { + if (!eina_value_get(&value, &val)) return EINA_FALSE; + } if (sfwd->format_cb) buf = sfwd->format_cb(val); diff --git a/src/lib/elementary/elm_slider.h b/src/lib/elementary/elm_slider.h index 2895342fcd..edcc03b803 100644 --- a/src/lib/elementary/elm_slider.h +++ b/src/lib/elementary/elm_slider.h @@ -29,11 +29,11 @@ * the object or applications scaling factor. At any point code can query the * slider for its value with elm_slider_value_get(). * - * This widget inherits from the @ref Layout one, so that all the + * This widget inherits from the @ref Elm_Layout one, so that all the * functions acting on it also work for slider objects. * * This widget emits the following signals, besides the ones sent from - * @ref Layout: + * @ref Elm_Layout : * - @c "changed" - Whenever the slider value is changed by the user. * - @c "slider,drag,start" - dragging the slider indicator around has started. * - @c "slider,drag,stop" - dragging the slider indicator around has stopped. diff --git a/src/lib/elementary/elm_slider_eo.h b/src/lib/elementary/elm_slider_eo.h index 1f95ec1770..6e21209c4b 100644 --- a/src/lib/elementary/elm_slider_eo.h +++ b/src/lib/elementary/elm_slider_eo.h @@ -19,6 +19,6 @@ typedef Eo Elm_Slider; */ #define ELM_SLIDER_CLASS elm_slider_class_get() -EWAPI const Efl_Class *elm_slider_class_get(void); +EWAPI const Efl_Class *elm_slider_class_get(void) EINA_CONST; #endif diff --git a/src/lib/elementary/elm_slider_legacy.h b/src/lib/elementary/elm_slider_legacy.h index aa32dec6b1..60d29de304 100644 --- a/src/lib/elementary/elm_slider_legacy.h +++ b/src/lib/elementary/elm_slider_legacy.h @@ -256,7 +256,7 @@ EAPI void elm_slider_range_get(const Evas_Object *obj, double *from, double *to) * @ingroup Elm_Slider */ EAPI void elm_slider_indicator_format_set(Evas_Object *obj, const char *indicator); - + /** * @brief Get the indicator label format of the slider. * diff --git a/src/lib/elementary/elm_slider_part_indicator_eo.h b/src/lib/elementary/elm_slider_part_indicator_eo.h index 058a44a356..7fb6d4397c 100644 --- a/src/lib/elementary/elm_slider_part_indicator_eo.h +++ b/src/lib/elementary/elm_slider_part_indicator_eo.h @@ -19,7 +19,7 @@ typedef Eo Elm_Slider_Part_Indicator; */ #define ELM_SLIDER_PART_INDICATOR_CLASS elm_slider_part_indicator_class_get() -EWAPI const Efl_Class *elm_slider_part_indicator_class_get(void); +EWAPI const Efl_Class *elm_slider_part_indicator_class_get(void) EINA_CONST; /** * @brief Set/Get the visible mode of indicator. diff --git a/src/lib/elementary/elm_slideshow.c b/src/lib/elementary/elm_slideshow.c index 5ab5e662f6..7b2d7810de 100644 --- a/src/lib/elementary/elm_slideshow.c +++ b/src/lib/elementary/elm_slideshow.c @@ -63,7 +63,7 @@ _key_action_pause(Evas_Object *obj, const char *params EINA_UNUSED) { ELM_SLIDESHOW_DATA_GET(obj, sd); - if (sd->timeout) + if (EINA_DBL_NONZERO(sd->timeout)) { if (sd->timer) ELM_SAFE_FREE(sd->timer, ecore_timer_del); diff --git a/src/lib/elementary/elm_slideshow.h b/src/lib/elementary/elm_slideshow.h index b13edf960e..70954dba98 100644 --- a/src/lib/elementary/elm_slideshow.h +++ b/src/lib/elementary/elm_slideshow.h @@ -48,11 +48,11 @@ * cached @b before and @b after the current item, in the widget's * item list. * - * This widget inherits from the @ref Layout one, so that all the + * This widget inherits from the @ref Elm_Layout one, so that all the * functions acting on it also work for slideshow objects. * * This widget emits the following signals, besides the ones sent from - * @ref Layout: + * @ref Elm_Layout : * - @c "changed" - when the slideshow switches its view to a new * item. event_info parameter in callback contains the current visible item * - @c "transition,end" - when a slide transition ends. event_info parameter diff --git a/src/lib/elementary/elm_slideshow_eo.h b/src/lib/elementary/elm_slideshow_eo.h index 00dd7aeeb8..c0cc60d30e 100644 --- a/src/lib/elementary/elm_slideshow_eo.h +++ b/src/lib/elementary/elm_slideshow_eo.h @@ -19,7 +19,7 @@ typedef Eo Elm_Slideshow; */ #define ELM_SLIDESHOW_CLASS elm_slideshow_class_get() -EWAPI const Efl_Class *elm_slideshow_class_get(void); +EWAPI const Efl_Class *elm_slideshow_class_get(void) EINA_CONST; /** * @brief Set the number of items to cache, on a given slideshow widget, after @@ -200,7 +200,7 @@ EOAPI double elm_obj_slideshow_timeout_get(const Eo *obj); * * @param[in] obj The object. * - * @return The list of items (#Elm.Widget.Item as data) or @c null on errors. + * @return The list of items (#Elm_Widget_Item as data) or @c null on errors. * * @ingroup Elm_Slideshow */ diff --git a/src/lib/elementary/elm_slideshow_eo.legacy.h b/src/lib/elementary/elm_slideshow_eo.legacy.h index 3670d7c913..ee1d6f7597 100644 --- a/src/lib/elementary/elm_slideshow_eo.legacy.h +++ b/src/lib/elementary/elm_slideshow_eo.legacy.h @@ -192,7 +192,7 @@ EAPI double elm_slideshow_timeout_get(const Elm_Slideshow *obj); * * @param[in] obj The object. * - * @return The list of items (#Elm.Widget.Item as data) or @c null on errors. + * @return The list of items (#Elm_Widget_Item as data) or @c null on errors. * * @ingroup Elm_Slideshow_Group */ diff --git a/src/lib/elementary/elm_slideshow_item_eo.h b/src/lib/elementary/elm_slideshow_item_eo.h index 065a7f6b83..131e572dc6 100644 --- a/src/lib/elementary/elm_slideshow_item_eo.h +++ b/src/lib/elementary/elm_slideshow_item_eo.h @@ -19,7 +19,7 @@ typedef Eo Elm_Slideshow_Item; */ #define ELM_SLIDESHOW_ITEM_CLASS elm_slideshow_item_class_get() -EWAPI const Efl_Class *elm_slideshow_item_class_get(void); +EWAPI const Efl_Class *elm_slideshow_item_class_get(void) EINA_CONST; /** * @brief Display a given slideshow widget's item, programmatically. diff --git a/src/lib/elementary/elm_spinner.c b/src/lib/elementary/elm_spinner.c index 355b9469fb..7441cbd338 100644 --- a/src/lib/elementary/elm_spinner.c +++ b/src/lib/elementary/elm_spinner.c @@ -134,7 +134,7 @@ _entry_show(Elm_Spinner_Data *sd) EINA_LIST_FOREACH(sd->special_values, l, sv) { - if (sv->value == sd->val) + if (EINA_DBL_EQ(sv->value, sd->val)) { snprintf(buf, sizeof(buf), "%s", sv->label); goto apply; @@ -196,7 +196,7 @@ _label_write(Evas_Object *obj) EINA_LIST_FOREACH(sd->special_values, l, sv) { - if (sv->value == sd->val) + if (EINA_DBL_EQ(sv->value, sd->val)) { snprintf(buf, sizeof(buf), "%s", sv->label); goto apply; @@ -245,7 +245,7 @@ _value_set(Evas_Object *obj, if (sd->round > 0) { //Spin value changed by entry input. - if (changed != 0) + if (EINA_DBL_NONZERO(changed)) new_val = sd->val_base + (double)((((int)((val + changed) - sd->val_base)) / sd->round) * sd->round); else @@ -270,16 +270,17 @@ _value_set(Evas_Object *obj, new_val = sd->val_max; } - if (new_val == sd->val) return EINA_FALSE; + if (EINA_DBL_EQ(new_val, sd->val)) return EINA_FALSE; sd->val = new_val; - if (sd->val == sd->val_min) + if (EINA_DBL_EQ(sd->val, sd->val_min)) efl_event_callback_legacy_call(obj, ELM_SPINNER_EVENT_MIN_REACHED, NULL); - else if (sd->val == sd->val_max) + else if (EINA_DBL_EQ(sd->val, sd->val_max)) efl_event_callback_legacy_call(obj, ELM_SPINNER_EVENT_MAX_REACHED, NULL); efl_event_callback_legacy_call(obj, ELM_SPINNER_EVENT_CHANGED, NULL); efl_access_value_changed_signal_emit(obj); + efl_access_object_event_emit(obj, EFL_UI_RANGE_EVENT_CHANGED, NULL); ecore_timer_del(sd->delay_change_timer); sd->delay_change_timer = ecore_timer_add(ELM_SPINNER_DELAY_CHANGE_TIME, _delay_change_timer_cb, obj); @@ -333,7 +334,7 @@ _drag_cb(void *data, else efl_ui_drag_value_get(efl_part(wd->resize_obj, "elm.dragable.slider"), &pos, NULL); - if (sd->drag_prev_pos != 0) + if (EINA_DBL_NONZERO(sd->drag_prev_pos)) sd->drag_val_step = pow((pos - sd->drag_prev_pos), 2); else sd->drag_val_step = 1; @@ -687,7 +688,7 @@ _spin_value(void *data) double real_speed = sd->spin_speed; /* Sanity check: our step size should be at least as large as our rounding value */ - if ((sd->spin_speed != 0.0) && (fabs(sd->spin_speed) < sd->round)) + if (EINA_DBL_NONZERO(sd->spin_speed) && (fabs(sd->spin_speed) < sd->round)) { WRN("The spinning step is smaller than the rounding value, please check your code"); real_speed = sd->spin_speed > 0 ? sd->round : -sd->round; @@ -799,11 +800,11 @@ _button_inc_dec_start_cb(void *data, { if (sd->inc_btn_activated) { - if (sd->val == sd->val_min) return; + if (EINA_DBL_EQ(sd->val, sd->val_min)) return; } else { - if (sd->val == sd->val_max) return; + if (EINA_DBL_EQ(sd->val, sd->val_max)) return; } } } @@ -1437,7 +1438,7 @@ _elm_spinner_label_format_get(const Eo *obj EINA_UNUSED, Elm_Spinner_Data *sd) EOLIAN static void _elm_spinner_efl_ui_range_display_range_limits_set(Eo *obj, Elm_Spinner_Data *sd, double min, double max) { - if ((sd->val_min == min) && (sd->val_max == max)) return; + if (EINA_DBL_EQ(sd->val_min, min) && EINA_DBL_EQ(sd->val_max, max)) return; sd->val_min = min; sd->val_max = max; @@ -1471,7 +1472,7 @@ _elm_spinner_efl_ui_range_interactive_range_step_get(const Eo *obj EINA_UNUSED, EOLIAN static void _elm_spinner_efl_ui_range_display_range_value_set(Eo *obj, Elm_Spinner_Data *sd, double val) { - if (sd->val == val) return; + if (EINA_DBL_EQ(sd->val, val)) return; sd->val = (sd->round <= 0) ? val : sd->val_base + (double)((((int)(val - sd->val_base + (sd->round / 2))) / sd->round) * sd->round); @@ -1519,7 +1520,7 @@ _elm_spinner_special_value_add(Eo *obj, Elm_Spinner_Data *sd, double value, cons EINA_LIST_FOREACH(sd->special_values, l, sv) { - if (sv->value != value) + if (!EINA_DBL_EQ(sv->value, value)) continue; eina_stringshare_replace(&sv->label, label); @@ -1548,7 +1549,7 @@ elm_spinner_special_value_del(Evas_Object *obj, EINA_LIST_FOREACH(sd->special_values, l, sv) { - if (sv->value != value) + if (!EINA_DBL_EQ(sv->value, value)) continue; sd->special_values = eina_list_remove_list(sd->special_values, l); @@ -1571,7 +1572,7 @@ elm_spinner_special_value_get(Evas_Object *obj, EINA_LIST_FOREACH(sd->special_values, l, sv) { - if (sv->value == value) + if (EINA_DBL_EQ(sv->value, value)) return sv->label; } diff --git a/src/lib/elementary/elm_spinner.h b/src/lib/elementary/elm_spinner.h index bbfe2f2fa4..689183fbc1 100644 --- a/src/lib/elementary/elm_spinner.h +++ b/src/lib/elementary/elm_spinner.h @@ -1,5 +1,5 @@ /** - * @defgroup Elm_Spinner Spinner + * @defgroup Elm_Spinner_Group Spinner * @ingroup Elementary * * @image html spinner_inheritance_tree.png @@ -21,11 +21,11 @@ * * It also allows specific values to be replaced by pre-defined labels. * - * This widget inherits from the @ref Layout one, so that all the + * This widget inherits from the @ref Elm_Layout one, so that all the * functions acting on it also work for spinner objects. * * This widget emits the following signals, besides the ones sent from - * @ref Layout: + * @ref Elm_Layout : * - @c "changed" - Whenever the spinner value is changed. * - @c "delay,changed" - A short time after the value is changed by * the user. This will be called only when the user stops dragging @@ -53,7 +53,7 @@ */ /** - * @addtogroup Elm_Spinner + * @addtogroup Elm_Spinner_Group * @{ */ diff --git a/src/lib/elementary/elm_spinner_eo.h b/src/lib/elementary/elm_spinner_eo.h index ff9205c262..2c0be0fe88 100644 --- a/src/lib/elementary/elm_spinner_eo.h +++ b/src/lib/elementary/elm_spinner_eo.h @@ -19,7 +19,7 @@ typedef Eo Elm_Spinner; */ #define ELM_SPINNER_CLASS elm_spinner_class_get() -EWAPI const Efl_Class *elm_spinner_class_get(void); +EWAPI const Efl_Class *elm_spinner_class_get(void) EINA_CONST; /** * @brief Control whether the spinner should wrap when it reaches its minimum @@ -79,7 +79,7 @@ EOAPI void elm_obj_spinner_wrap_set(Eo *obj, Eina_Bool wrap); EOAPI Eina_Bool elm_obj_spinner_wrap_get(const Eo *obj); /** - * @brief Control the interval on time updates for an user mouse button hold on + * @brief Control the interval on time updates for a user mouse button hold on * spinner widgets' arrows. * * This interval value is decreased while the user holds the mouse pointer @@ -103,7 +103,7 @@ EOAPI Eina_Bool elm_obj_spinner_wrap_get(const Eo *obj); EOAPI void elm_obj_spinner_interval_set(Eo *obj, double interval); /** - * @brief Control the interval on time updates for an user mouse button hold on + * @brief Control the interval on time updates for a user mouse button hold on * spinner widgets' arrows. * * This interval value is decreased while the user holds the mouse pointer diff --git a/src/lib/elementary/elm_spinner_eo.legacy.h b/src/lib/elementary/elm_spinner_eo.legacy.h index 798ec39d37..38ae87a832 100644 --- a/src/lib/elementary/elm_spinner_eo.legacy.h +++ b/src/lib/elementary/elm_spinner_eo.legacy.h @@ -72,7 +72,7 @@ EAPI void elm_spinner_wrap_set(Elm_Spinner *obj, Eina_Bool wrap); EAPI Eina_Bool elm_spinner_wrap_get(const Elm_Spinner *obj); /** - * @brief Control the interval on time updates for an user mouse button hold on + * @brief Control the interval on time updates for a user mouse button hold on * spinner widgets' arrows. * * This interval value is decreased while the user holds the mouse pointer @@ -96,7 +96,7 @@ EAPI Eina_Bool elm_spinner_wrap_get(const Elm_Spinner *obj); EAPI void elm_spinner_interval_set(Elm_Spinner *obj, double interval); /** - * @brief Control the interval on time updates for an user mouse button hold on + * @brief Control the interval on time updates for a user mouse button hold on * spinner widgets' arrows. * * This interval value is decreased while the user holds the mouse pointer diff --git a/src/lib/elementary/elm_spinner_legacy.h b/src/lib/elementary/elm_spinner_legacy.h index 1b4e241c0c..0774983451 100644 --- a/src/lib/elementary/elm_spinner_legacy.h +++ b/src/lib/elementary/elm_spinner_legacy.h @@ -7,7 +7,7 @@ * * This function inserts a new spinner widget on the canvas. * - * @ingroup Elm_Spinner + * @ingroup Elm_Spinner_Group * */ EAPI Evas_Object *elm_spinner_add(Evas_Object *parent); @@ -23,7 +23,7 @@ EAPI Evas_Object *elm_spinner_add(Evas_Object *parent); * * @see elm_spinner_special_value_add() for more details. * - * @ingroup Elm_Spinner + * @ingroup Elm_Spinner_Group * @since 1.8 */ EAPI void elm_spinner_special_value_del(Evas_Object *obj, double value); @@ -37,7 +37,7 @@ EAPI void elm_spinner_special_value_del(Evas_Object *obj, double value); * * @see elm_spinner_special_value_add() for more details. * - * @ingroup Elm_Spinner + * @ingroup Elm_Spinner_Group * @since 1.8 */ EAPI const char *elm_spinner_special_value_get(Evas_Object *obj, double value); @@ -58,7 +58,7 @@ EAPI const char *elm_spinner_special_value_get(Evas_Object *obj, double value); * @param[in] min The minimum value. * @param[in] max The maximum value. * - * @ingroup Elm_Spinner + * @ingroup Elm_Spinner_Group */ EAPI void elm_spinner_min_max_set(Evas_Object *obj, double min, double max); @@ -78,7 +78,7 @@ EAPI void elm_spinner_min_max_set(Evas_Object *obj, double min, double max); * @param[out] min The minimum value. * @param[out] max The maximum value. * - * @ingroup Elm_Spinner + * @ingroup Elm_Spinner_Group */ EAPI void elm_spinner_min_max_get(const Evas_Object *obj, double *min, double *max); @@ -96,7 +96,7 @@ EAPI void elm_spinner_min_max_get(const Evas_Object *obj, double *min, double *m * * @param[in] step The step value. * - * @ingroup Elm_Spinner + * @ingroup Elm_Spinner_Group */ EAPI void elm_spinner_step_set(Evas_Object *obj, double step); @@ -114,7 +114,7 @@ EAPI void elm_spinner_step_set(Evas_Object *obj, double step); * * @return The step value. * - * @ingroup Elm_Spinner + * @ingroup Elm_Spinner_Group */ EAPI double elm_spinner_step_get(const Evas_Object *obj); @@ -129,7 +129,7 @@ EAPI double elm_spinner_step_get(const Evas_Object *obj); * * @param[in] val The value to be displayed. * - * @ingroup Elm_Spinner + * @ingroup Elm_Spinner_Group */ EAPI void elm_spinner_value_set(Evas_Object *obj, double val); @@ -144,7 +144,7 @@ EAPI void elm_spinner_value_set(Evas_Object *obj, double val); * * @return The value to be displayed. * - * @ingroup Elm_Spinner + * @ingroup Elm_Spinner_Group */ EAPI double elm_spinner_value_get(const Evas_Object *obj); diff --git a/src/lib/elementary/elm_sys_notify_dbus_eo.h b/src/lib/elementary/elm_sys_notify_dbus_eo.h index c5976e4450..82b8adfe5b 100644 --- a/src/lib/elementary/elm_sys_notify_dbus_eo.h +++ b/src/lib/elementary/elm_sys_notify_dbus_eo.h @@ -19,6 +19,6 @@ typedef Eo Elm_Sys_Notify_Dbus; */ #define ELM_SYS_NOTIFY_DBUS_CLASS elm_sys_notify_dbus_class_get() -EWAPI const Efl_Class *elm_sys_notify_dbus_class_get(void); +EWAPI const Efl_Class *elm_sys_notify_dbus_class_get(void) EINA_CONST; #endif diff --git a/src/lib/elementary/elm_sys_notify_eo.c b/src/lib/elementary/elm_sys_notify_eo.c index 7b57eca751..aede576b2f 100644 --- a/src/lib/elementary/elm_sys_notify_eo.c +++ b/src/lib/elementary/elm_sys_notify_eo.c @@ -11,12 +11,14 @@ Elm_Sys_Notify *_elm_sys_notify_singleton_get(void); EOAPI Elm_Sys_Notify * elm_obj_sys_notify_singleton_get(void) { - elm_sys_notify_class_get(); + const Efl_Class *klass = elm_sys_notify_class_get(); + EINA_SAFETY_ON_NULL_RETURN_VAL(klass, NULL); return _elm_sys_notify_singleton_get(); } EOAPI Elm_Sys_Notify * elm_sys_notify_singleton_get(void) { - elm_sys_notify_class_get(); + const Efl_Class *klass = elm_sys_notify_class_get(); + EINA_SAFETY_ON_NULL_RETURN_VAL(klass, NULL); return _elm_sys_notify_singleton_get(); } diff --git a/src/lib/elementary/elm_sys_notify_eo.h b/src/lib/elementary/elm_sys_notify_eo.h index 0f1f194f07..4094fc6f9c 100644 --- a/src/lib/elementary/elm_sys_notify_eo.h +++ b/src/lib/elementary/elm_sys_notify_eo.h @@ -73,7 +73,7 @@ typedef struct _Elm_Sys_Notify_Action_Invoked */ #define ELM_SYS_NOTIFY_CLASS elm_sys_notify_class_get() -EWAPI const Efl_Class *elm_sys_notify_class_get(void); +EWAPI const Efl_Class *elm_sys_notify_class_get(void) EINA_CONST; /** * @brief Set the notifications server to be used. diff --git a/src/lib/elementary/elm_sys_notify_interface_eo.h b/src/lib/elementary/elm_sys_notify_interface_eo.h index 0c91b0135d..f850399def 100644 --- a/src/lib/elementary/elm_sys_notify_interface_eo.h +++ b/src/lib/elementary/elm_sys_notify_interface_eo.h @@ -32,7 +32,7 @@ typedef enum */ #define ELM_SYS_NOTIFY_INTERFACE_INTERFACE elm_sys_notify_interface_interface_get() -EWAPI const Efl_Class *elm_sys_notify_interface_interface_get(void); +EWAPI const Efl_Class *elm_sys_notify_interface_interface_get(void) EINA_CONST; /** * @brief Causes a notification to be forcefully closed and removed from the diff --git a/src/lib/elementary/elm_systray_eo.h b/src/lib/elementary/elm_systray_eo.h index d50dc412b8..46486c02a9 100644 --- a/src/lib/elementary/elm_systray_eo.h +++ b/src/lib/elementary/elm_systray_eo.h @@ -47,7 +47,7 @@ typedef enum */ #define ELM_SYSTRAY_CLASS elm_systray_class_get() -EWAPI const Efl_Class *elm_systray_class_get(void); +EWAPI const Efl_Class *elm_systray_class_get(void) EINA_CONST; /** * @brief Set the id of the Status Notifier Item. diff --git a/src/lib/elementary/elm_table.c b/src/lib/elementary/elm_table.c index 39c1031536..c34a0b3095 100644 --- a/src/lib/elementary/elm_table.c +++ b/src/lib/elementary/elm_table.c @@ -109,9 +109,6 @@ _elm_table_efl_canvas_group_group_add(Eo *obj, void *_pd EINA_UNUSED) EOLIAN static void _elm_table_efl_canvas_group_group_del(Eo *obj, void *_pd EINA_UNUSED) { - Eina_List *l; - Evas_Object *child; - ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd); evas_object_event_callback_del_full @@ -120,15 +117,15 @@ _elm_table_efl_canvas_group_group_del(Eo *obj, void *_pd EINA_UNUSED) /* let's make our table object the *last* to be processed, since it * may (smart) parent other sub objects here */ - EINA_LIST_FOREACH(wd->subobjs, l, child) - { - if (child == wd->resize_obj) - { - wd->subobjs = - eina_list_demote_list(wd->subobjs, l); - break; - } - } + { + unsigned int resize_id = 0; + if (eina_array_find(wd->children, wd->resize_obj, &resize_id)) + { + //exchange with last + eina_array_data_set(wd->children, resize_id, eina_array_data_get(wd->children, eina_array_count(wd->children) - 1)); + eina_array_data_set(wd->children, eina_array_count(wd->children) - 1, wd->resize_obj); + } + } efl_canvas_group_del(efl_super(obj, MY_CLASS)); } diff --git a/src/lib/elementary/elm_table.h b/src/lib/elementary/elm_table.h index ec9266e786..7cabd06bcd 100644 --- a/src/lib/elementary/elm_table.h +++ b/src/lib/elementary/elm_table.h @@ -1,5 +1,5 @@ /** - * @defgroup Elm_Table Table + * @defgroup Elm_Table_Group Table * @ingroup Elementary * * @image html table_inheritance_tree.png diff --git a/src/lib/elementary/elm_table_eo.h b/src/lib/elementary/elm_table_eo.h index b203ddce63..6075383f19 100644 --- a/src/lib/elementary/elm_table_eo.h +++ b/src/lib/elementary/elm_table_eo.h @@ -19,10 +19,10 @@ typedef Eo Elm_Table; */ #define ELM_TABLE_CLASS elm_table_class_get() -EWAPI const Efl_Class *elm_table_class_get(void); +EWAPI const Efl_Class *elm_table_class_get(void) EINA_CONST; /** - * @brief Control the homogenous state in a table. + * @brief Control the homogeneous state in a table. * * @param[in] obj The object. * @param[in] homogeneous A boolean to set if the layout is homogeneous in the @@ -33,7 +33,7 @@ EWAPI const Efl_Class *elm_table_class_get(void); EOAPI void elm_obj_table_homogeneous_set(Eo *obj, Eina_Bool homogeneous); /** - * @brief Control the homogenous state in a table. + * @brief Control the homogeneous state in a table. * * @param[in] obj The object. * diff --git a/src/lib/elementary/elm_table_eo.legacy.h b/src/lib/elementary/elm_table_eo.legacy.h index 507465310e..0c7ab3fcd8 100644 --- a/src/lib/elementary/elm_table_eo.legacy.h +++ b/src/lib/elementary/elm_table_eo.legacy.h @@ -15,7 +15,7 @@ typedef Eo Elm_Table; #endif /** - * @brief Control the homogenous state in a table. + * @brief Control the homogeneous state in a table. * * @param[in] obj The object. * @param[in] homogeneous A boolean to set if the layout is homogeneous in the @@ -26,7 +26,7 @@ typedef Eo Elm_Table; EAPI void elm_table_homogeneous_set(Elm_Table *obj, Eina_Bool homogeneous); /** - * @brief Control the homogenous state in a table. + * @brief Control the homogeneous state in a table. * * @param[in] obj The object. * diff --git a/src/lib/elementary/elm_table_legacy.h b/src/lib/elementary/elm_table_legacy.h index 314cf0ef39..b9b955a499 100644 --- a/src/lib/elementary/elm_table_legacy.h +++ b/src/lib/elementary/elm_table_legacy.h @@ -4,7 +4,7 @@ * @param parent The parent object * @return The new object or NULL if it cannot be created * - * @ingroup Elm_Table + * @ingroup Elm_Table_Group */ EAPI Evas_Object *elm_table_add(Evas_Object *parent); @@ -23,7 +23,7 @@ EAPI Evas_Object *elm_table_add(Evas_Object *parent); * a value of 0 for col and row, means the top left cell of the table, and a * value of 1 for colspan and rowspan means @p subobj only takes that 1 cell. * - * @ingroup Elm_Table + * @ingroup Elm_Table_Group */ EAPI void elm_table_pack_set(Evas_Object *subobj, int col, int row, int colspan, int rowspan); @@ -38,8 +38,8 @@ EAPI void elm_table_pack_set(Evas_Object *subobj, int col, int row, int col * * @see elm_table_pack_set() * - * @ingroup Elm_Table + * @ingroup Elm_Table_Group */ EAPI void elm_table_pack_get(Evas_Object *subobj, int *col, int *row, int *colspan, int *rowspan); -#include "elm_table_eo.legacy.h"
\ No newline at end of file +#include "elm_table_eo.legacy.h" diff --git a/src/lib/elementary/elm_textpath_legacy.h b/src/lib/elementary/elm_textpath_legacy.h index 1795bdfa60..633dca328b 100644 --- a/src/lib/elementary/elm_textpath_legacy.h +++ b/src/lib/elementary/elm_textpath_legacy.h @@ -6,10 +6,25 @@ typedef Eo Elm_Textpath; * @param[in] parent The parent object * @return The new object or NULL if it cannot be created * - * @ingroup Elm_Textpath + * @ingroup Elm_Textpath_Group * * @since 1.22 */ EAPI Evas_Object *elm_textpath_add(Evas_Object *parent); +/** + * @brief Set the user text style + * + * @param[in] obj The textpath object + * @param[in] style The user text style. If the sytle is $null, the default style will be applied + * + * @note ellipsis in the style will be ignored since textpath supports ellipsis API. + * @see elm_textpath_ellipsis_set() + * + * @ingroup Elm_Textpath_Group + * + * @since 1.25 + */ +EAPI void elm_textpath_text_user_style_set(Evas_Object *obj, const char *style); + #include "efl_ui_textpath_eo.legacy.h" diff --git a/src/lib/elementary/elm_theme.c b/src/lib/elementary/elm_theme.c index 13f41e1abc..8625cb6147 100644 --- a/src/lib/elementary/elm_theme.c +++ b/src/lib/elementary/elm_theme.c @@ -911,7 +911,7 @@ elm_theme_name_available_list_new(void) snprintf(buf, sizeof(buf), "%s/"ELEMENTARY_BASE_DIR"/themes/%s", home, file); if ((!ecore_file_is_dir(buf)) && (ecore_file_size(buf) > 0)) { - if (eina_str_has_extension(file, "edj")) + if (eina_str_has_extension(file, ".edj")) { th = strdup(file); s = strrchr(th, '.'); @@ -929,7 +929,7 @@ elm_theme_name_available_list_new(void) snprintf(buf, sizeof(buf), "%s/themes/%s", _elm_data_dir, file); if ((!ecore_file_is_dir(buf)) && (ecore_file_size(buf) > 0)) { - if (eina_str_has_extension(file, "edj")) + if (eina_str_has_extension(file, ".edj")) { int dupp; diff --git a/src/lib/elementary/elm_thumb.c b/src/lib/elementary/elm_thumb.c index 555ff01635..f883e183ed 100644 --- a/src/lib/elementary/elm_thumb.c +++ b/src/lib/elementary/elm_thumb.c @@ -670,9 +670,16 @@ _elm_thumb_efl_file_load(Eo *obj, Elm_Thumb_Data *sd) int prefix_size; const char **ext, *ptr; static const char *extensions[] = - { - ".avi", ".mp4", ".ogv", ".mov", ".mpg", ".wmv", NULL - }; + { + ".asf", ".avi", ".bdm", ".bdmv", ".clpi", ".cpi", ".dv", ".fla", + ".flv", ".m1v", ".m2t", ".m2v", ".m4v", ".mkv", ".mov", ".mp2", + ".mp2ts", ".mp4", ".mpe", ".mpeg", ".mpg", ".mpl", ".mpls", ".mts", + ".mxf", ".nut", ".nuv", ".ogg", ".ogm", ".ogv", ".qt", ".rm", ".rmj", + ".rmm", ".rms", ".rmvb", ".rmx", ".rv", ".swf", ".ts", ".weba", + ".webm", ".wmv", ".3g2", ".3gp", ".3gp2", ".3gpp", ".3gpp2", ".3p2", + ".264", + NULL + }; if (efl_file_loaded_get(obj)) return 0; prefix_size = eina_stringshare_strlen(sd->file) - 4; diff --git a/src/lib/elementary/elm_thumb_eo.h b/src/lib/elementary/elm_thumb_eo.h index 09eed0a0ba..01c20b037a 100644 --- a/src/lib/elementary/elm_thumb_eo.h +++ b/src/lib/elementary/elm_thumb_eo.h @@ -19,7 +19,7 @@ typedef Eo Elm_Thumb; */ #define ELM_THUMB_CLASS elm_thumb_class_get() -EWAPI const Efl_Class *elm_thumb_class_get(void); +EWAPI const Efl_Class *elm_thumb_class_get(void) EINA_CONST; EWAPI extern const Efl_Event_Description _ELM_THUMB_EVENT_GENERATE_ERROR; diff --git a/src/lib/elementary/elm_thumb_legacy.h b/src/lib/elementary/elm_thumb_legacy.h index 48fcc1a262..4a8965732e 100644 --- a/src/lib/elementary/elm_thumb_legacy.h +++ b/src/lib/elementary/elm_thumb_legacy.h @@ -28,9 +28,9 @@ EAPI Evas_Object *elm_thumb_add(Evas_Object *parent); * * Set the file that will be used as thumbnail @b source. * - * The file can be an image or a video (in that case, acceptable - * extensions are: avi, mp4, ogv, mov, mpg and wmv). To start the - * video animation, use the function elm_thumb_animate(). + * The file can be an image or a video (in that case extension will e used + * to guess if it is a video or not). To start the video animation, use the + * function elm_thumb_animate(). * * @see elm_thumb_file_get() * @see elm_thumb_reload() diff --git a/src/lib/elementary/elm_toolbar.c b/src/lib/elementary/elm_toolbar.c index d6763cebb6..d2f363035a 100644 --- a/src/lib/elementary/elm_toolbar.c +++ b/src/lib/elementary/elm_toolbar.c @@ -127,7 +127,7 @@ _items_visibility_fix(Elm_Toolbar *obj, evas_object_geometry_get(VIEW(it), NULL, NULL, &ciw, &cih); if (!efl_ui_layout_orientation_is_horizontal(sd->dir, EINA_TRUE)) *iw += cih; else *iw += ciw; - //expand is the case where the bx_more stuff is used and the prio.visible is completly ignored. + //expand is the case where the bx_more stuff is used and the prio.visible is completely ignored. //if this is the case - then every item in there is just visible in the box - nothing (beside the items in the other box is hidden) if (!usage_bx_more) { @@ -2436,23 +2436,19 @@ _item_new(Evas_Object *obj, evas_object_data_set(VIEW(it), "item", it); efl_access_object_access_type_set(VIEW(it), EFL_ACCESS_TYPE_DISABLED); - icon_obj = elm_icon_add(VIEW(it)); - efl_parent_set(icon_obj, eo_it); - if (_elm_config->access_mode == ELM_ACCESS_MODE_ON) _access_widget_item_register(it); - if (_item_icon_set(icon_obj, "toolbar/", icon)) + if (icon) { + icon_obj = elm_icon_add(VIEW(it)); + efl_parent_set(icon_obj, eo_it); + evas_object_size_hint_min_set(icon_obj, sd->icon_size, sd->icon_size); + evas_object_size_hint_max_set(icon_obj, sd->icon_size, sd->icon_size); + _item_icon_set(icon_obj, "toolbar/", icon); it->icon = icon_obj; it->icon_str = eina_stringshare_add(icon); } - else - { - it->icon = NULL; - it->icon_str = NULL; - evas_object_del(icon_obj); - } if (!elm_layout_theme_set (VIEW(it), "toolbar", "item", elm_widget_style_get(obj))) @@ -2473,8 +2469,6 @@ _item_new(Evas_Object *obj, if (it->icon) { - evas_object_size_hint_min_set(it->icon, sd->icon_size, sd->icon_size); - evas_object_size_hint_max_set(it->icon, sd->icon_size, sd->icon_size); elm_layout_content_set(VIEW(it), "elm.swallow.icon", it->icon); elm_layout_signal_emit(VIEW(it), "elm,state,icon,visible", "elm"); elm_layout_signal_emit(VIEW(it), "elm,icon,visible", "elm"); @@ -3400,7 +3394,7 @@ _elm_toolbar_shrink_mode_set(Eo *obj, Elm_Toolbar_Data *sd, Elm_Toolbar_Shrink_M elm_toolbar_homogeneous_set(obj, EINA_FALSE); elm_interface_scrollable_policy_set (obj, ELM_SCROLLER_POLICY_OFF, ELM_SCROLLER_POLICY_OFF); - sd->more_item = _item_new(obj, "go-down", "More", NULL, NULL); + sd->more_item = _item_new(obj, "toolbar/more_menu", "More", NULL, NULL); _resizing_eval_item(sd->more_item); } else if (shrink_mode == ELM_TOOLBAR_SHRINK_HIDE) @@ -3414,7 +3408,7 @@ _elm_toolbar_shrink_mode_set(Eo *obj, Elm_Toolbar_Data *sd, Elm_Toolbar_Shrink_M elm_toolbar_homogeneous_set(obj, EINA_FALSE); elm_interface_scrollable_policy_set (obj, ELM_SCROLLER_POLICY_AUTO, ELM_SCROLLER_POLICY_OFF); - sd->more_item = _item_new(obj, "go-down", "More", NULL, NULL); + sd->more_item = _item_new(obj, "toolbar/more_menu", "More", NULL, NULL); _resizing_eval_item(sd->more_item); } else if (shrink_mode == ELM_TOOLBAR_SHRINK_SCROLL) @@ -3504,12 +3498,12 @@ _elm_toolbar_align_set(Eo *obj EINA_UNUSED, Elm_Toolbar_Data *sd, double align) { if (!efl_ui_layout_orientation_is_horizontal(sd->dir, EINA_TRUE)) { - if (sd->align != align) + if (!EINA_DBL_EQ(sd->align, align)) evas_object_box_align_set(sd->bx, 0.5, align); } else { - if (sd->align != align) + if (!EINA_DBL_EQ(sd->align, align)) evas_object_box_align_set(sd->bx, align, 0.5); } sd->align = align; diff --git a/src/lib/elementary/elm_toolbar.h b/src/lib/elementary/elm_toolbar.h index 5dcfaa838f..fc88da16ad 100644 --- a/src/lib/elementary/elm_toolbar.h +++ b/src/lib/elementary/elm_toolbar.h @@ -19,7 +19,7 @@ * * Items can have multiple states, or show menus when selected by the user. * - * This widget implements the @b @ref elm-scrollable-interface + * This widget implements the @ref elm-scrollable-interface * interface, so that all (non-deprecated) functions for the base * @ref Scroller widget also work for toolbars (since 1.8) * diff --git a/src/lib/elementary/elm_toolbar_eo.h b/src/lib/elementary/elm_toolbar_eo.h index ae7d8ae467..8d6fcaa0b6 100644 --- a/src/lib/elementary/elm_toolbar_eo.h +++ b/src/lib/elementary/elm_toolbar_eo.h @@ -47,7 +47,7 @@ typedef enum */ #define ELM_TOOLBAR_CLASS elm_toolbar_class_get() -EWAPI const Efl_Class *elm_toolbar_class_get(void); +EWAPI const Efl_Class *elm_toolbar_class_get(void) EINA_CONST; /** * @brief Get the selected item in the widget. diff --git a/src/lib/elementary/elm_toolbar_eo.legacy.h b/src/lib/elementary/elm_toolbar_eo.legacy.h index d16a3b2ba5..004ac0e744 100644 --- a/src/lib/elementary/elm_toolbar_eo.legacy.h +++ b/src/lib/elementary/elm_toolbar_eo.legacy.h @@ -21,7 +21,7 @@ typedef Eo Elm_Toolbar; * * See also @ref elm_toolbar_shrink_mode_set, @ref elm_toolbar_shrink_mode_get. * - * @ingroup Elm + * @ingroup Elm_Toolbar */ typedef enum { @@ -48,7 +48,7 @@ typedef enum * * @return The selected item or @c null. * - * @ingroup Elm_Toolbar_Group + * @ingroup Elm_Toolbar */ EAPI Elm_Widget_Item *elm_toolbar_selected_item_get(const Elm_Toolbar *obj); @@ -59,7 +59,7 @@ EAPI Elm_Widget_Item *elm_toolbar_selected_item_get(const Elm_Toolbar *obj); * * @return The first item or @c null. * - * @ingroup Elm_Toolbar_Group + * @ingroup Elm_Toolbar */ EAPI Elm_Widget_Item *elm_toolbar_first_item_get(const Elm_Toolbar *obj); @@ -70,7 +70,7 @@ EAPI Elm_Widget_Item *elm_toolbar_first_item_get(const Elm_Toolbar *obj); * * @return The last item or @c null. * - * @ingroup Elm_Toolbar_Group + * @ingroup Elm_Toolbar */ EAPI Elm_Widget_Item *elm_toolbar_last_item_get(const Elm_Toolbar *obj); @@ -81,7 +81,7 @@ EAPI Elm_Widget_Item *elm_toolbar_last_item_get(const Elm_Toolbar *obj); * * @return iterator to widget items * - * @ingroup Elm_Toolbar_Group + * @ingroup Elm_Toolbar */ EAPI Eina_Iterator *elm_toolbar_items_get(const Elm_Toolbar *obj) EINA_WARN_UNUSED_RESULT; @@ -94,7 +94,7 @@ EAPI Eina_Iterator *elm_toolbar_items_get(const Elm_Toolbar *obj) EINA_WARN_UNUS * @param[in] homogeneous Assume the items within the toolbar are of the same * size (true = on, false = off). Default is @c false. * - * @ingroup Elm_Toolbar_Group + * @ingroup Elm_Toolbar */ EAPI void elm_toolbar_homogeneous_set(Elm_Toolbar *obj, Eina_Bool homogeneous); @@ -108,7 +108,7 @@ EAPI void elm_toolbar_homogeneous_set(Elm_Toolbar *obj, Eina_Bool homogeneous); * @return Assume the items within the toolbar are of the same size (true = on, * false = off). Default is @c false. * - * @ingroup Elm_Toolbar_Group + * @ingroup Elm_Toolbar */ EAPI Eina_Bool elm_toolbar_homogeneous_get(const Elm_Toolbar *obj); @@ -123,7 +123,7 @@ EAPI Eina_Bool elm_toolbar_homogeneous_get(const Elm_Toolbar *obj); * @param[in] obj The object. * @param[in] align The new alignment, a float between 0.0 and 1.0. * - * @ingroup Elm_Toolbar_Group + * @ingroup Elm_Toolbar */ EAPI void elm_toolbar_align_set(Elm_Toolbar *obj, double align); @@ -139,7 +139,7 @@ EAPI void elm_toolbar_align_set(Elm_Toolbar *obj, double align); * * @return The new alignment, a float between 0.0 and 1.0. * - * @ingroup Elm_Toolbar_Group + * @ingroup Elm_Toolbar */ EAPI double elm_toolbar_align_get(const Elm_Toolbar *obj); @@ -160,7 +160,7 @@ EAPI double elm_toolbar_align_get(const Elm_Toolbar *obj); * @param[in] mode The select mode If getting mode fails, it returns * #ELM_OBJECT_SELECT_MODE_MAX * - * @ingroup Elm_Toolbar_Group + * @ingroup Elm_Toolbar */ EAPI void elm_toolbar_select_mode_set(Elm_Toolbar *obj, Elm_Object_Select_Mode mode); @@ -182,7 +182,7 @@ EAPI void elm_toolbar_select_mode_set(Elm_Toolbar *obj, Elm_Object_Select_Mode m * @return The select mode If getting mode fails, it returns * #ELM_OBJECT_SELECT_MODE_MAX * - * @ingroup Elm_Toolbar_Group + * @ingroup Elm_Toolbar */ EAPI Elm_Object_Select_Mode elm_toolbar_select_mode_get(const Elm_Toolbar *obj); @@ -194,7 +194,7 @@ EAPI Elm_Object_Select_Mode elm_toolbar_select_mode_get(const Elm_Toolbar *obj); * @param[in] obj The object. * @param[in] icon_size The icon size in pixels * - * @ingroup Elm_Toolbar_Group + * @ingroup Elm_Toolbar */ EAPI void elm_toolbar_icon_size_set(Elm_Toolbar *obj, int icon_size); @@ -207,7 +207,7 @@ EAPI void elm_toolbar_icon_size_set(Elm_Toolbar *obj, int icon_size); * * @return The icon size in pixels * - * @ingroup Elm_Toolbar_Group + * @ingroup Elm_Toolbar */ EAPI int elm_toolbar_icon_size_get(const Elm_Toolbar *obj); @@ -232,7 +232,7 @@ EAPI int elm_toolbar_icon_size_get(const Elm_Toolbar *obj); * @param[in] obj The object. * @param[in] shrink_mode Toolbar's items display behavior * - * @ingroup Elm_Toolbar_Group + * @ingroup Elm_Toolbar */ EAPI void elm_toolbar_shrink_mode_set(Elm_Toolbar *obj, Elm_Toolbar_Shrink_Mode shrink_mode); @@ -258,7 +258,7 @@ EAPI void elm_toolbar_shrink_mode_set(Elm_Toolbar *obj, Elm_Toolbar_Shrink_Mode * * @return Toolbar's items display behavior * - * @ingroup Elm_Toolbar_Group + * @ingroup Elm_Toolbar */ EAPI Elm_Toolbar_Shrink_Mode elm_toolbar_shrink_mode_get(const Elm_Toolbar *obj); @@ -276,7 +276,7 @@ EAPI Elm_Toolbar_Shrink_Mode elm_toolbar_shrink_mode_get(const Elm_Toolbar *obj) * @param[in] obj The object. * @param[in] parent The parent of the menu objects. * - * @ingroup Elm_Toolbar_Group + * @ingroup Elm_Toolbar */ EAPI void elm_toolbar_menu_parent_set(Elm_Toolbar *obj, Efl_Canvas_Object *parent); @@ -295,7 +295,7 @@ EAPI void elm_toolbar_menu_parent_set(Elm_Toolbar *obj, Efl_Canvas_Object *paren * * @return The parent of the menu objects. * - * @ingroup Elm_Toolbar_Group + * @ingroup Elm_Toolbar */ EAPI Efl_Canvas_Object *elm_toolbar_menu_parent_get(const Elm_Toolbar *obj); @@ -311,7 +311,7 @@ EAPI Efl_Canvas_Object *elm_toolbar_menu_parent_get(const Elm_Toolbar *obj); * * @since 1.7 * - * @ingroup Elm_Toolbar_Group + * @ingroup Elm_Toolbar */ EAPI void elm_toolbar_standard_priority_set(Elm_Toolbar *obj, int priority); @@ -328,7 +328,7 @@ EAPI void elm_toolbar_standard_priority_set(Elm_Toolbar *obj, int priority); * * @since 1.7 * - * @ingroup Elm_Toolbar_Group + * @ingroup Elm_Toolbar */ EAPI int elm_toolbar_standard_priority_get(const Elm_Toolbar *obj); @@ -344,7 +344,7 @@ EAPI int elm_toolbar_standard_priority_get(const Elm_Toolbar *obj); * * @return The toolbar more item. * - * @ingroup Elm_Toolbar_Group + * @ingroup Elm_Toolbar */ EAPI Elm_Widget_Item *elm_toolbar_more_item_get(const Elm_Toolbar *obj); @@ -382,7 +382,7 @@ EAPI Elm_Widget_Item *elm_toolbar_more_item_get(const Elm_Toolbar *obj); * * @return The created item or @c NULL upon failure. * - * @ingroup Elm_Toolbar_Group + * @ingroup Elm_Toolbar */ EAPI Elm_Widget_Item *elm_toolbar_item_insert_before(Elm_Toolbar *obj, Elm_Widget_Item *before, const char *icon, const char *label, Evas_Smart_Cb func, const void *data); @@ -420,7 +420,7 @@ EAPI Elm_Widget_Item *elm_toolbar_item_insert_before(Elm_Toolbar *obj, Elm_Widge * * @return The created item or @c NULL upon failure. * - * @ingroup Elm_Toolbar_Group + * @ingroup Elm_Toolbar */ EAPI Elm_Widget_Item *elm_toolbar_item_insert_after(Elm_Toolbar *obj, Elm_Widget_Item *after, const char *icon, const char *label, Evas_Smart_Cb func, const void *data); @@ -457,7 +457,7 @@ EAPI Elm_Widget_Item *elm_toolbar_item_insert_after(Elm_Toolbar *obj, Elm_Widget * * @return The created item or @c NULL upon failure. * - * @ingroup Elm_Toolbar_Group + * @ingroup Elm_Toolbar */ EAPI Elm_Widget_Item *elm_toolbar_item_append(Elm_Toolbar *obj, const char *icon, const char *label, Evas_Smart_Cb func, const void *data); @@ -468,7 +468,7 @@ EAPI Elm_Widget_Item *elm_toolbar_item_append(Elm_Toolbar *obj, const char *icon * * @return The number of items in @c obj toolbar * - * @ingroup Elm_Toolbar_Group + * @ingroup Elm_Toolbar */ EAPI unsigned int elm_toolbar_items_count(const Elm_Toolbar *obj); @@ -505,7 +505,7 @@ EAPI unsigned int elm_toolbar_items_count(const Elm_Toolbar *obj); * * @return The created item or @c NULL upon failure. * - * @ingroup Elm_Toolbar_Group + * @ingroup Elm_Toolbar */ EAPI Elm_Widget_Item *elm_toolbar_item_prepend(Elm_Toolbar *obj, const char *icon, const char *label, Evas_Smart_Cb func, const void *data); @@ -518,7 +518,7 @@ EAPI Elm_Widget_Item *elm_toolbar_item_prepend(Elm_Toolbar *obj, const char *ico * @return The pointer to the toolbar item matching @c label or @c NULL on * failure. * - * @ingroup Elm_Toolbar_Group + * @ingroup Elm_Toolbar */ EAPI Elm_Widget_Item *elm_toolbar_item_find_by_label(const Elm_Toolbar *obj, const char *label); diff --git a/src/lib/elementary/elm_toolbar_item_eo.h b/src/lib/elementary/elm_toolbar_item_eo.h index 44bb2d9810..c78b62e623 100644 --- a/src/lib/elementary/elm_toolbar_item_eo.h +++ b/src/lib/elementary/elm_toolbar_item_eo.h @@ -49,7 +49,7 @@ typedef struct _Elm_Toolbar_Item_State */ #define ELM_TOOLBAR_ITEM_CLASS elm_toolbar_item_class_get() -EWAPI const Efl_Class *elm_toolbar_item_class_get(void); +EWAPI const Efl_Class *elm_toolbar_item_class_get(void) EINA_CONST; /** * @brief Get the item before this one in the widget's list of items. diff --git a/src/lib/elementary/elm_transit.c b/src/lib/elementary/elm_transit.c index 39dc755604..a0813791f4 100644 --- a/src/lib/elementary/elm_transit.c +++ b/src/lib/elementary/elm_transit.c @@ -95,6 +95,7 @@ struct _Elm_Transit_Obj_Data Eina_Bool map_enabled : 1; Eina_Bool visible : 1; Eina_Bool freeze_events : 1; + Eina_Bool anti_alias : 1; } state; int ref; }; @@ -104,7 +105,7 @@ typedef struct _Elm_Transit_Obj_Data Elm_Transit_Obj_Data; static void _transit_obj_data_save(Evas_Object *obj); static void _transit_obj_data_recover(Elm_Transit *transit, Evas_Object *obj); -static void _transit_obj_remove_cb(void *data, Evas *e EINA_UNUSED, Evas_Object *obj, void *event_info EINA_UNUSED); +static void _transit_obj_remove_cb(void *data, const Efl_Event *ev); static void _transit_obj_remove(Elm_Transit *transit, Evas_Object *obj); static void _transit_effect_del(Elm_Transit *transit, Elm_Transit_Effect_Module *effect_module); static void _transit_remove_dead_effects(Elm_Transit *transit); @@ -140,6 +141,7 @@ _transit_obj_data_save(Evas_Object *obj) obj_data->state.visible = evas_object_visible_get(obj); obj_data->state.freeze_events = evas_object_freeze_events_get(obj); obj_data->state.map_enabled = evas_object_map_enable_get(obj); + obj_data->state.anti_alias = evas_object_anti_alias_get(obj); ELM_SAFE_FREE(obj_data->state.map, evas_map_free); @@ -161,15 +163,16 @@ _remove_obj_from_list(Elm_Transit *transit, Evas_Object *obj) if (!eina_list_data_find_list(transit->objs, obj)) break; transit->objs = eina_list_remove(transit->objs, obj); - evas_object_event_callback_del_full(obj, EVAS_CALLBACK_DEL, - _transit_obj_remove_cb, - transit); + efl_event_callback_del(obj, EFL_EVENT_DEL, + _transit_obj_remove_cb, + transit); } } static void -_transit_obj_remove_cb(void *data, Evas *e EINA_UNUSED, Evas_Object *obj, void *event_info EINA_UNUSED) +_transit_obj_remove_cb(void *data, const Efl_Event *ev) { + Eo* obj = ev->object; Elm_Transit *transit = data; Elm_Transit_Obj_Data *obj_data = evas_object_data_get(obj, _transit_key); if (obj_data) @@ -204,6 +207,7 @@ _transit_obj_data_recover(Elm_Transit *transit, Evas_Object *obj) obj_data->state.b, obj_data->state.a); if (obj_data->state.visible) evas_object_show(obj); else evas_object_hide(obj); + evas_object_anti_alias_set(obj, obj_data->state.anti_alias); evas_object_map_enable_set(obj, obj_data->state.map_enabled); evas_object_map_set(obj, obj_data->state.map); } @@ -345,7 +349,7 @@ _transit_animate_cb(void *data) duration = transit->time.duration; transit->progress = elapsed_time / duration; - if (transit->revert_mode && transit->revert_begin_progress == 0) + if (transit->revert_mode && EINA_DBL_EQ(transit->revert_begin_progress, 0)) { transit->revert_begin_progress = transit->progress; transit->time.revert_start = transit->time.current; @@ -651,6 +655,13 @@ elm_transit_object_add(Elm_Transit *transit, Evas_Object *obj) ELM_TRANSIT_CHECK_OR_RETURN(transit); EINA_SAFETY_ON_NULL_RETURN(obj); + // Prevent adding duplicates + if (eina_list_data_find_list(transit->objs, obj)) + { + WRN("Object(%p) is already added", obj); + return; + } + if (transit->animator) { if (!evas_object_data_get(obj, _transit_key)) @@ -660,9 +671,9 @@ elm_transit_object_add(Elm_Transit *transit, Evas_Object *obj) } } - evas_object_event_callback_add(obj, EVAS_CALLBACK_DEL, - _transit_obj_remove_cb, - transit); + efl_event_callback_add(obj, EFL_EVENT_DEL, + _transit_obj_remove_cb, + transit); transit->objs = eina_list_append(transit->objs, obj); } @@ -924,14 +935,14 @@ elm_transit_paused_set(Elm_Transit *transit, Eina_Bool paused) { if (transit->revert_mode) { - if (transit->time.revert_paused == 0) return; + if (EINA_DBL_EQ(transit->time.revert_paused, 0)) return; ecore_animator_thaw(transit->animator); transit->time.revert_delayed += (ecore_loop_time_get() - transit->time.revert_paused); transit->time.revert_paused = 0; } else { - if (transit->time.paused == 0) return; + if (EINA_DBL_EQ(transit->time.paused, 0)) return; ecore_animator_thaw(transit->animator); transit->time.delayed += (ecore_loop_time_get() - transit->time.paused); transit->time.paused = 0; @@ -944,7 +955,7 @@ elm_transit_paused_get(const Elm_Transit *transit) { ELM_TRANSIT_CHECK_OR_RETURN(transit, EINA_FALSE); - if (transit->time.paused == 0) + if (EINA_DBL_EQ(transit->time.paused, 0)) return EINA_FALSE; return EINA_TRUE; @@ -1124,8 +1135,9 @@ struct _Elm_Transit_Effect_Translation }; static void -_translation_object_del_cb(void *data, Evas *e EINA_UNUSED, Evas_Object *obj, void *event_info EINA_UNUSED) +_translation_object_del_cb(void *data, const Efl_Event *ev) { + Eo* obj = ev->object; Elm_Transit_Effect_Translation *translation = data; Eina_List *elist; Elm_Transit_Effect_Translation_Node *translation_node; @@ -1160,8 +1172,8 @@ _translation_nodes_build(Elm_Transit *transit, Elm_Transit_Effect_Translation *t evas_object_geometry_get(obj, &(translation_node->x), &(translation_node->y), NULL, NULL); data_list = eina_list_append(data_list, translation_node); - evas_object_event_callback_add(obj, EVAS_CALLBACK_DEL, - _translation_object_del_cb, translation); + efl_event_callback_add(obj, EFL_EVENT_DEL, + _translation_object_del_cb, translation); } return data_list; } @@ -1177,8 +1189,8 @@ _transit_effect_translation_context_free(Elm_Transit_Effect *effect, Elm_Transit EINA_LIST_FOREACH_SAFE(translation->nodes, elist, elist_next, translation_node) { - evas_object_event_callback_del(translation_node->obj, - EVAS_CALLBACK_DEL, _translation_object_del_cb); + efl_event_callback_del(translation_node->obj, + EFL_EVENT_DEL, _translation_object_del_cb, translation); translation->nodes = eina_list_remove_list(translation->nodes, elist); free(translation_node); } @@ -1273,6 +1285,9 @@ _transit_effect_zoom_op(Elm_Transit_Effect *effect, Elm_Transit *transit , doubl EINA_LIST_FOREACH(transit->objs, elist, obj) { + //Turn on for fixing jiggling by sub-pixel rendering + evas_object_anti_alias_set(obj, EINA_TRUE); + obj_data = evas_object_data_get(obj, _transit_key); if (obj_data && obj_data->state.map_enabled) { @@ -1512,8 +1527,9 @@ struct _Elm_Transit_Effect_Resizable_Flip }; static void -_resizable_flip_object_del_cb(void *data, Evas *e EINA_UNUSED, Evas_Object *obj, void *event_info EINA_UNUSED) +_resizable_flip_object_del_cb(void *data, const Efl_Event *ev) { + Eo* obj = ev->object; Elm_Transit_Effect_ResizableFlip *resizable_flip = data; Eina_List *elist; Elm_Transit_Effect_ResizableFlip_Node *resizable_flip_node; @@ -1521,11 +1537,11 @@ _resizable_flip_object_del_cb(void *data, Evas *e EINA_UNUSED, Evas_Object *obj, EINA_LIST_FOREACH(resizable_flip->nodes, elist, resizable_flip_node) { if (resizable_flip_node->front == obj) - evas_object_event_callback_del(resizable_flip_node->back, - EVAS_CALLBACK_DEL, _resizable_flip_object_del_cb); + efl_event_callback_del(resizable_flip_node->back, + EFL_EVENT_DEL, _resizable_flip_object_del_cb, resizable_flip); else if (resizable_flip_node->back == obj) - evas_object_event_callback_del(resizable_flip_node->front, - EVAS_CALLBACK_DEL, _resizable_flip_object_del_cb); + efl_event_callback_del(resizable_flip_node->front, + EFL_EVENT_DEL, _resizable_flip_object_del_cb, resizable_flip); else continue; resizable_flip->nodes = eina_list_remove_list(resizable_flip->nodes, @@ -1574,10 +1590,10 @@ _resizable_flip_nodes_build(Elm_Transit *transit, Elm_Transit_Effect_ResizableFl data_list = eina_list_append(data_list, resizable_flip_node); - evas_object_event_callback_add(resizable_flip_node->back, - EVAS_CALLBACK_DEL, _resizable_flip_object_del_cb, resizable_flip); - evas_object_event_callback_add(resizable_flip_node->front, - EVAS_CALLBACK_DEL, _resizable_flip_object_del_cb, resizable_flip); + efl_event_callback_add(resizable_flip_node->back, + EFL_EVENT_DEL, _resizable_flip_object_del_cb, resizable_flip); + efl_event_callback_add(resizable_flip_node->front, + EFL_EVENT_DEL, _resizable_flip_object_del_cb, resizable_flip); } return data_list; @@ -1651,10 +1667,10 @@ _transit_effect_resizable_flip_context_free(Elm_Transit_Effect *effect, Elm_Tran resizable_flip->nodes = eina_list_remove_list(resizable_flip->nodes, elist); - evas_object_event_callback_del(resizable_flip_node->back, - EVAS_CALLBACK_DEL, _resizable_flip_object_del_cb); - evas_object_event_callback_del(resizable_flip_node->front, - EVAS_CALLBACK_DEL, _resizable_flip_object_del_cb); + efl_event_callback_del(resizable_flip_node->back, + EFL_EVENT_DEL, _resizable_flip_object_del_cb, resizable_flip); + efl_event_callback_del(resizable_flip_node->front, + EFL_EVENT_DEL, _resizable_flip_object_del_cb, resizable_flip); free(resizable_flip_node); } free(resizable_flip); @@ -2124,8 +2140,9 @@ struct _Elm_Transit_Effect_Fade }; static void -_fade_object_del_cb(void *data, Evas *e EINA_UNUSED, Evas_Object *obj, void *event_info EINA_UNUSED) +_fade_object_del_cb(void *data, const Efl_Event *ev) { + Eo* obj = ev->object; Elm_Transit_Effect_Fade *fade = data; Eina_List *elist; Elm_Transit_Effect_Fade_Node *fade_node; @@ -2133,11 +2150,11 @@ _fade_object_del_cb(void *data, Evas *e EINA_UNUSED, Evas_Object *obj, void *eve EINA_LIST_FOREACH(fade->nodes, elist, fade_node) { if (fade_node->before == obj) - evas_object_event_callback_del(fade_node->after, - EVAS_CALLBACK_DEL, _fade_object_del_cb); + efl_event_callback_del(fade_node->after, + EFL_EVENT_DEL, _fade_object_del_cb, fade); else if (fade_node->after == obj) - evas_object_event_callback_del(fade_node->before, - EVAS_CALLBACK_DEL, _fade_object_del_cb); + efl_event_callback_del(fade_node->before, + EFL_EVENT_DEL, _fade_object_del_cb, fade); else continue; fade->nodes = eina_list_remove_list(fade->nodes, elist); @@ -2178,10 +2195,10 @@ _fade_nodes_build(Elm_Transit *transit, Elm_Transit_Effect_Fade *fade_data) data_list = eina_list_append(data_list, fade); - evas_object_event_callback_add(fade->before, - EVAS_CALLBACK_DEL, _fade_object_del_cb, fade_data); - evas_object_event_callback_add(fade->after, - EVAS_CALLBACK_DEL, _fade_object_del_cb, fade_data); + efl_event_callback_add(fade->before, + EFL_EVENT_DEL, _fade_object_del_cb, fade_data); + efl_event_callback_add(fade->after, + EFL_EVENT_DEL, _fade_object_del_cb, fade_data); } return data_list; } @@ -2206,10 +2223,10 @@ _transit_effect_fade_context_free(Elm_Transit_Effect *effect, Elm_Transit *trans fade_node->after_color.a); fade->nodes = eina_list_remove_list(fade->nodes, elist); - evas_object_event_callback_del(fade_node->before, - EVAS_CALLBACK_DEL, _fade_object_del_cb); - evas_object_event_callback_del(fade_node->after, - EVAS_CALLBACK_DEL, _fade_object_del_cb); + efl_event_callback_del(fade_node->before, + EFL_EVENT_DEL, _fade_object_del_cb, fade); + efl_event_callback_del(fade_node->after, + EFL_EVENT_DEL, _fade_object_del_cb, fade); free(fade_node); } @@ -2315,8 +2332,9 @@ struct _Elm_Transit_Effect_Blend }; static void -_blend_object_del_cb(void *data, Evas *e EINA_UNUSED, Evas_Object *obj, void *event_info EINA_UNUSED) +_blend_object_del_cb(void *data, const Efl_Event *ev) { + Eo* obj = ev->object; Elm_Transit_Effect_Blend *blend = data; Eina_List *elist; Elm_Transit_Effect_Blend_Node *blend_node; @@ -2324,11 +2342,11 @@ _blend_object_del_cb(void *data, Evas *e EINA_UNUSED, Evas_Object *obj, void *ev EINA_LIST_FOREACH(blend->nodes, elist, blend_node) { if (blend_node->after == obj) - evas_object_event_callback_del(blend_node->before, - EVAS_CALLBACK_DEL, _blend_object_del_cb); + efl_event_callback_del(blend_node->before, + EFL_EVENT_DEL, _blend_object_del_cb, blend); else if (blend_node->before == obj) - evas_object_event_callback_del(blend_node->after, - EVAS_CALLBACK_DEL, _blend_object_del_cb); + efl_event_callback_del(blend_node->after, + EFL_EVENT_DEL, _blend_object_del_cb, blend); else continue; blend->nodes = eina_list_remove_list(blend->nodes, elist); @@ -2368,10 +2386,10 @@ _blend_nodes_build(Elm_Transit *transit, Elm_Transit_Effect_Blend *blend) data_list = eina_list_append(data_list, blend_node); - evas_object_event_callback_add(blend_node->before, - EVAS_CALLBACK_DEL, _blend_object_del_cb, blend); - evas_object_event_callback_add(blend_node->after, - EVAS_CALLBACK_DEL, _blend_object_del_cb, blend); + efl_event_callback_add(blend_node->before, + EFL_EVENT_DEL, _blend_object_del_cb, blend); + efl_event_callback_add(blend_node->after, + EFL_EVENT_DEL, _blend_object_del_cb, blend); } return data_list; } @@ -2400,10 +2418,10 @@ _transit_effect_blend_context_free(Elm_Transit_Effect *effect, Elm_Transit *tran blend->nodes = eina_list_remove_list(blend->nodes, elist); - evas_object_event_callback_del(blend_node->before, - EVAS_CALLBACK_DEL, _blend_object_del_cb); - evas_object_event_callback_del(blend_node->after, - EVAS_CALLBACK_DEL, _blend_object_del_cb); + efl_event_callback_del(blend_node->before, + EFL_EVENT_DEL, _blend_object_del_cb, blend); + efl_event_callback_del(blend_node->after, + EFL_EVENT_DEL, _blend_object_del_cb, blend); free(blend_node); } free(blend); @@ -2621,8 +2639,8 @@ _transit_effect_image_animation_op(Elm_Transit_Effect *effect, Elm_Transit *tran const char *file = eina_list_nth(image_animation->images, idx); - elm_image_file_set(obj, file, NULL); elm_image_preload_disabled_set(obj, EINA_TRUE); + elm_image_file_set(obj, file, NULL); } } diff --git a/src/lib/elementary/elm_view_form_eo.h b/src/lib/elementary/elm_view_form_eo.h index 83dbe7e6c2..75560de31a 100644 --- a/src/lib/elementary/elm_view_form_eo.h +++ b/src/lib/elementary/elm_view_form_eo.h @@ -19,7 +19,7 @@ typedef Eo Elm_View_Form; */ #define ELM_VIEW_FORM_CLASS elm_view_form_class_get() -EWAPI const Efl_Class *elm_view_form_class_get(void); +EWAPI const Efl_Class *elm_view_form_class_get(void) EINA_CONST; /** * @brief Set model diff --git a/src/lib/elementary/elm_view_list_eo.h b/src/lib/elementary/elm_view_list_eo.h index f35c275c3b..2688b4f6cb 100644 --- a/src/lib/elementary/elm_view_list_eo.h +++ b/src/lib/elementary/elm_view_list_eo.h @@ -19,7 +19,7 @@ typedef Eo Elm_View_List; */ #define ELM_VIEW_LIST_CLASS elm_view_list_class_get() -EWAPI const Efl_Class *elm_view_list_class_get(void); +EWAPI const Efl_Class *elm_view_list_class_get(void) EINA_CONST; /** * @brief Constructor wrapper diff --git a/src/lib/elementary/elm_web_eo.h b/src/lib/elementary/elm_web_eo.h index 0407b40188..73f4311dfe 100644 --- a/src/lib/elementary/elm_web_eo.h +++ b/src/lib/elementary/elm_web_eo.h @@ -19,7 +19,7 @@ typedef Eo Elm_Web; */ #define ELM_WEB_CLASS elm_web_class_get() -EWAPI const Efl_Class *elm_web_class_get(void); +EWAPI const Efl_Class *elm_web_class_get(void) EINA_CONST; /** * @brief Sets whether to highlight the matched marks. diff --git a/src/lib/elementary/elm_widget.h b/src/lib/elementary/elm_widget.h index ab8ea9a215..233c526ddc 100644 --- a/src/lib/elementary/elm_widget.h +++ b/src/lib/elementary/elm_widget.h @@ -301,7 +301,7 @@ #include "efl_ui.eot.h" typedef Eo Efl_Ui_Focus_Manager; -extern EAPI Eina_Error EFL_UI_THEME_APPLY_ERROR_NONE; +EAPI extern Eina_Error EFL_UI_THEME_APPLY_ERROR_NONE; #define _EFL_UI_FOCUS_MANAGER_EO_CLASS_TYPE #include "efl_ui_focus_object.eo.h" @@ -332,7 +332,7 @@ typedef void (*Elm_Widget_On_Show_Region_Cb)(void *data, Evas_Object *obj, Eina_ typedef struct _Elm_Widget_Smart_Data { Evas_Object *parent_obj; /**< parent object of a widget in the elementary tree */ - Eina_List *subobjs; /**< list of widgets' sub objects in the elementary tree */ + Eina_Array *children; Evas_Object *resize_obj; /**< an unique object for each widget that shows the look of a widget. Resize object's geometry is same as the widget. This resize object is different from that of window's resize object. */ Evas_Object *hover_obj; Evas_Object *bg; @@ -585,6 +585,11 @@ struct _Elm_Widget_Item_Data Eina_Hash *labels; Evas_Object *track_obj; + struct { + void (*realized) (Eo *obj); + void (*unrealized) (Eo *obj); + } func; + Eina_Bool disabled : 1; Eina_Bool on_deletion : 1; Eina_Bool on_translate : 1; diff --git a/src/lib/elementary/elm_widget_combobox.h b/src/lib/elementary/elm_widget_combobox.h index 889f97b28b..2fe0ce8bcb 100644 --- a/src/lib/elementary/elm_widget_combobox.h +++ b/src/lib/elementary/elm_widget_combobox.h @@ -81,6 +81,6 @@ struct _Elm_Combobox_Data #define ELM_COMBOBOX_CLASS elm_combobox_class_get() -EWAPI const Efl_Class *elm_combobox_class_get(void); +EWAPI const Efl_Class *elm_combobox_class_get(void) EINA_CONST; #endif diff --git a/src/lib/elementary/elm_widget_gengrid.h b/src/lib/elementary/elm_widget_gengrid.h index dc93910041..8f55c4b73f 100644 --- a/src/lib/elementary/elm_widget_gengrid.h +++ b/src/lib/elementary/elm_widget_gengrid.h @@ -174,7 +174,7 @@ struct Elm_Gen_Item_Type * this item only once */ Eina_Bool nocache : 1; /* do not use cache for this item */ - /* for non homogenous items */ + /* for non homogeneous items */ Evas_Coord w, h, sw, sh; }; diff --git a/src/lib/elementary/elm_widget_item_container_eo.h b/src/lib/elementary/elm_widget_item_container_eo.h index 066876e5cd..e5966ba51e 100644 --- a/src/lib/elementary/elm_widget_item_container_eo.h +++ b/src/lib/elementary/elm_widget_item_container_eo.h @@ -15,7 +15,7 @@ typedef Eo Elm_Widget_Item_Container; #endif #define ELM_WIDGET_ITEM_CONTAINER_INTERFACE elm_widget_item_container_interface_get() -EWAPI const Efl_Class *elm_widget_item_container_interface_get(void); +EWAPI const Efl_Class *elm_widget_item_container_interface_get(void) EINA_CONST; /** * @brief Get the focused widget item. diff --git a/src/lib/elementary/elm_widget_item_eo.h b/src/lib/elementary/elm_widget_item_eo.h index f077e2152d..d6486e6e5a 100644 --- a/src/lib/elementary/elm_widget_item_eo.h +++ b/src/lib/elementary/elm_widget_item_eo.h @@ -19,7 +19,7 @@ typedef Eo Elm_Widget_Item; */ #define ELM_WIDGET_ITEM_CLASS elm_widget_item_class_get() -EWAPI const Efl_Class *elm_widget_item_class_get(void); +EWAPI const Efl_Class *elm_widget_item_class_get(void) EINA_CONST; /** * @brief Control size restriction state of an object's tooltip @@ -677,7 +677,7 @@ EOAPI void elm_wdg_item_domain_part_text_translatable_set(Eo *obj, const char *p * items may/may not have the internal object so this api may return @c NULL if * the widget item doesn't have it. Additionally, the widget item is * managed/controlled by the widget, the widget item could be changed(moved, - * resized even deleted) anytime by it's own widget's decision. So please dont' + * resized even deleted) anytime by it's own widget's decision. So please don't * change the track object as well as don't keep the track object in your side * as possible but get the track object at the moment you need to refer. * Otherwise, you need to add some callbacks to the track object to track it's diff --git a/src/lib/elementary/elm_widget_item_eo.legacy.h b/src/lib/elementary/elm_widget_item_eo.legacy.h index 2937be3df0..7efaae6374 100644 --- a/src/lib/elementary/elm_widget_item_eo.legacy.h +++ b/src/lib/elementary/elm_widget_item_eo.legacy.h @@ -625,7 +625,7 @@ EAPI void elm_object_item_domain_part_text_translatable_set(Elm_Widget_Item *obj * items may/may not have the internal object so this api may return @c NULL if * the widget item doesn't have it. Additionally, the widget item is * managed/controlled by the widget, the widget item could be changed(moved, - * resized even deleted) anytime by it's own widget's decision. So please dont' + * resized even deleted) anytime by it's own widget's decision. So please don't * change the track object as well as don't keep the track object in your side * as possible but get the track object at the moment you need to refer. * Otherwise, you need to add some callbacks to the track object to track it's diff --git a/src/lib/elementary/elm_widget_item_static_focus.c b/src/lib/elementary/elm_widget_item_static_focus.c index f040cbcf4c..cb8d10bcd0 100644 --- a/src/lib/elementary/elm_widget_item_static_focus.c +++ b/src/lib/elementary/elm_widget_item_static_focus.c @@ -27,43 +27,35 @@ _realized_set(Elm_Widget_Item_Static_Focus *f) } static void -_list_realized_cb(void *data, const Efl_Event *ev) +_list_realized_cb(Eo *obj) { - if (ev->info != data) return; + _realized_set(obj); - _realized_set(data); - - if (!elm_object_item_disabled_get(data) && - elm_genlist_item_type_get(data) != ELM_GENLIST_ITEM_GROUP) - efl_ui_focus_object_setup_order(data); + if (!elm_object_item_disabled_get(obj) && + elm_genlist_item_type_get(obj) != ELM_GENLIST_ITEM_GROUP) + efl_ui_focus_object_setup_order(obj); } static void -_grid_realized_cb(void *data, const Efl_Event *ev) +_grid_realized_cb(Eo *obj) { const Elm_Gen_Item_Class *itc; Eina_Bool is_group = EINA_FALSE; - if (ev->info != data) return; - - _realized_set(data); + _realized_set(obj); - itc = elm_gengrid_item_item_class_get(data); + itc = elm_gengrid_item_item_class_get(obj); is_group = (itc && itc->item_style && !strcmp(itc->item_style, "group_index")); - if (!elm_object_item_disabled_get(data) && !is_group) - { - efl_ui_focus_object_setup_order(data); - } + if (!elm_object_item_disabled_get(obj) && !is_group) + efl_ui_focus_object_setup_order(obj); } static void -_unrealized_cb(void *data, const Efl_Event *ev EINA_UNUSED) +_unrealized_cb(Eo *obj) { - Elm_Widget_Item_Static_Focus_Data *pd = efl_data_scope_get(data, MY_CLASS); - - if (ev->info != data) return; + Elm_Widget_Item_Static_Focus_Data *pd = efl_data_scope_get(obj, MY_CLASS); if (pd) /* if the obect is dead pd is NULL */ { @@ -145,15 +137,10 @@ _elm_widget_item_static_focus_efl_object_constructor(Eo *obj, Elm_Widget_Item_St Eo *ret = efl_constructor(efl_super(obj, MY_CLASS)); if (efl_isa(wpd->widget, ELM_GENLIST_CLASS)) - { - efl_event_callback_add(wpd->widget, ELM_GENLIST_EVENT_REALIZED, _list_realized_cb, obj); - efl_event_callback_add(wpd->widget, ELM_GENLIST_EVENT_UNREALIZED, _unrealized_cb, obj); - } + wpd->func.realized = _list_realized_cb; else - { - efl_event_callback_add(wpd->widget, ELM_GENGRID_EVENT_REALIZED, _grid_realized_cb, obj); - efl_event_callback_add(wpd->widget, ELM_GENGRID_EVENT_UNREALIZED, _unrealized_cb, obj); - } + wpd->func.realized = _grid_realized_cb; + wpd->func.unrealized = _unrealized_cb; return ret; } @@ -161,17 +148,8 @@ EOLIAN static void _elm_widget_item_static_focus_efl_object_destructor(Eo *obj, Elm_Widget_Item_Static_Focus_Data *pd EINA_UNUSED) { Elm_Widget_Item_Data *wpd = efl_data_scope_get(obj, ELM_WIDGET_ITEM_CLASS); - if (efl_isa(wpd->widget, ELM_GENLIST_CLASS)) - { - efl_event_callback_del(wpd->widget, ELM_GENLIST_EVENT_REALIZED, _list_realized_cb, obj); - efl_event_callback_del(wpd->widget, ELM_GENLIST_EVENT_UNREALIZED, _unrealized_cb, obj); - } - else - { - efl_event_callback_del(wpd->widget, ELM_GENGRID_EVENT_REALIZED, _grid_realized_cb, obj); - efl_event_callback_del(wpd->widget, ELM_GENGRID_EVENT_UNREALIZED, _unrealized_cb, obj); - } - + wpd->func.realized = NULL; + wpd->func.unrealized = NULL; if (pd->adapter) efl_del(pd->adapter); diff --git a/src/lib/elementary/elm_widget_item_static_focus_eo.h b/src/lib/elementary/elm_widget_item_static_focus_eo.h index c1f058f042..d5173d06b8 100644 --- a/src/lib/elementary/elm_widget_item_static_focus_eo.h +++ b/src/lib/elementary/elm_widget_item_static_focus_eo.h @@ -21,6 +21,6 @@ typedef Eo Elm_Widget_Item_Static_Focus; */ #define ELM_WIDGET_ITEM_STATIC_FOCUS_CLASS elm_widget_item_static_focus_class_get() -EWAPI const Efl_Class *elm_widget_item_static_focus_class_get(void); +EWAPI const Efl_Class *elm_widget_item_static_focus_class_get(void) EINA_CONST; #endif diff --git a/src/lib/elementary/elm_widget_layout.h b/src/lib/elementary/elm_widget_layout.h index 69565b6fd9..461962ca53 100644 --- a/src/lib/elementary/elm_widget_layout.h +++ b/src/lib/elementary/elm_widget_layout.h @@ -15,7 +15,7 @@ * * @section elm-layout-class The Elementary Layout Class * - * Elementary, besides having the @ref Layout widget, exposes its + * Elementary, besides having the @ref Elm_Layout widget, exposes its * foundation -- the Elementary Layout Class -- in order to create * other widgets which are, basically, a certain layout with some more * logic on top. @@ -76,6 +76,7 @@ typedef struct _Efl_Ui_Layout_Data Eina_Bool calc_subobjs : 1; /**< Set to true if group_calc should also handle subobjs during manual calc */ Eina_Bool cb_theme_changed : 1; /**< if theme,changed event subscriber has been added */ Eina_Bool needs_theme_apply : 1; /**< if theme has not been manually set during construction */ + Eina_Bool frozen_changed : 1; /**< only set if object was changed while frozen */ } Efl_Ui_Layout_Data; typedef struct _Elm_Layout_Data diff --git a/src/lib/elementary/elm_win.h b/src/lib/elementary/elm_win.h index 3e45dd15ff..5e272edebc 100644 --- a/src/lib/elementary/elm_win.h +++ b/src/lib/elementary/elm_win.h @@ -1,5 +1,5 @@ /** - * @defgroup Elm_Win Win + * @defgroup Elm_Win_Group Win * @ingroup Elementary * * @image html win_inheritance_tree.png diff --git a/src/lib/elementary/elm_win_common.h b/src/lib/elementary/elm_win_common.h index a0d4fef44b..9f337f3758 100644 --- a/src/lib/elementary/elm_win_common.h +++ b/src/lib/elementary/elm_win_common.h @@ -1,5 +1,5 @@ /** - * @addtogroup Elm_Win + * @addtogroup Elm_Win_Group * * @{ */ diff --git a/src/lib/elementary/elm_win_eo.h b/src/lib/elementary/elm_win_eo.h index 6643fc59bb..d6d4ed5fa3 100644 --- a/src/lib/elementary/elm_win_eo.h +++ b/src/lib/elementary/elm_win_eo.h @@ -2,7 +2,7 @@ # define ELM_WIN_EO_H /** - * @ingroup Elm_Win + * @ingroup Elm_Win_Group * * @{ */ diff --git a/src/lib/elementary/elm_win_legacy.h b/src/lib/elementary/elm_win_legacy.h index 613e0eb74b..3e0cc3722d 100644 --- a/src/lib/elementary/elm_win_legacy.h +++ b/src/lib/elementary/elm_win_legacy.h @@ -8,7 +8,7 @@ * phones, default is to have the indicator shown. But like TV, default is to * have the indicator hidden. * - * @ingroup Elm_Win + * @ingroup Elm_Win_Group */ typedef enum { @@ -19,7 +19,7 @@ typedef enum /** Defines the opacity modes of indicator that can be shown * - * @ingroup Elm_Win + * @ingroup Elm_Win_Group */ typedef enum { @@ -57,7 +57,7 @@ typedef enum * * Currently, only the X11 backed engines use them. * - * @ingroup Elm_Win + * @ingroup Elm_Win_Group */ typedef enum { @@ -92,13 +92,13 @@ typedef enum * usually used in the EFL. */ /** -* Used to indicate the window is a representation of an object being -* dragged across different windows, or even applications. Typically -* used with elm_win_override_set(). -*/ + * Used to indicate the window is a representation of an object being + * dragged across different windows, or even applications. Typically + * used with elm_win_override_set(). + */ ELM_WIN_DND, - ELM_WIN_INLINED_IMAGE, - ELM_WIN_SOCKET_IMAGE, + ELM_WIN_INLINED_IMAGE, /**< The window is an image. */ + ELM_WIN_SOCKET_IMAGE, /**< The window is an image received through a socket. */ ELM_WIN_FAKE, /**< See elm_win_fake_add(). @since 1.13 */ ELM_WIN_NAVIFRAME_BASIC, /**< Used for naviframe style replacement with @@ -113,7 +113,7 @@ typedef enum * When the application window is being managed by Illume it may request any of * the following layouts for the virtual keyboard. * - * @ingroup Elm_Win + * @ingroup Elm_Win_Group */ typedef enum { @@ -138,7 +138,7 @@ typedef enum /** Define the keygrab modes of window. A window may send commands to the * Keyrouter according this mode, and perform different actions. * - * @ingroup Elm_Win + * @ingroup Elm_Win_Group */ typedef enum { @@ -172,7 +172,7 @@ typedef enum * * @since 1.19 * - * @ingroup Elm_Win + * @ingroup Elm_Win_Group */ typedef enum { @@ -202,7 +202,7 @@ typedef enum * * @return The created object, or @c NULL on failure * - * @ingroup Elm_Win + * @ingroup Elm_Win_Group */ EAPI Evas_Object *elm_win_add(Evas_Object *parent, const char *name, Elm_Win_Type type); @@ -221,7 +221,7 @@ typedef Evas_Object Elm_Win; * * @return The created object, or @c NULL on failure * - * @ingroup Elm_Win + * @ingroup Elm_Win_Group * * @since 1.13 */ @@ -242,7 +242,7 @@ EAPI Evas_Object *elm_win_fake_add(Ecore_Evas *ee); * * @see elm_win_add() * - * @ingroup Elm_Win + * @ingroup Elm_Win_Group */ EAPI Evas_Object *elm_win_util_standard_add(const char *name, const char *title); @@ -263,7 +263,7 @@ EAPI Evas_Object *elm_win_util_standard_add(const char *name, const cha * * @see elm_win_add() * - * @ingroup Elm_Win + * @ingroup Elm_Win_Group * @since 1.13 */ EAPI Evas_Object *elm_win_util_dialog_add(Evas_Object *parent, const char *name, const char *title); @@ -286,7 +286,7 @@ EAPI Evas_Object *elm_win_util_dialog_add(Evas_Object *parent, const ch * @param[in] autodel If @c true, the window will automatically delete itself * when closed. * - * @ingroup Elm_Win + * @ingroup Elm_Win_Group */ EAPI void elm_win_autodel_set(Evas_Object *obj, Eina_Bool autodel); @@ -297,7 +297,7 @@ EAPI void elm_win_autodel_set(Evas_Object *obj, Eina_Bool autodel); * * @return If @c true, the window will automatically delete itself when closed. * - * @ingroup Elm_Win + * @ingroup Elm_Win_Group */ EAPI Eina_Bool elm_win_autodel_get(const Evas_Object *obj); @@ -313,7 +313,7 @@ EAPI Eina_Bool elm_win_autodel_get(const Evas_Object *obj); * a multi window concept in a mobile phone. The way of handling floating mode * window is decided by enlightenment window manager. * - * @ingroup Elm_Win + * @ingroup Elm_Win_Group * @see elm_win_floating_mode_get() * @since 1.8 */ @@ -325,7 +325,7 @@ EAPI void elm_win_floating_mode_set(Evas_Object *obj, Eina_Bool * @param obj The window object * @return If true, the window is floating mode * - * @ingroup Elm_Win + * @ingroup Elm_Win_Group * @see elm_win_floating_mode_set() * @since 1.8 */ @@ -352,7 +352,7 @@ EAPI Eina_Bool elm_win_floating_mode_get(const Evas_Object *obj); * @see elm_win_norender_pop() * @see elm_win_norender_get() * @see elm_win_render() - * @ingroup Elm_Win + * @ingroup Elm_Win_Group * @since 1.7 */ EAPI void elm_win_norender_push(Evas_Object *obj); @@ -368,7 +368,7 @@ EAPI void elm_win_norender_push(Evas_Object *obj); * @see elm_win_norender_push() * @see elm_win_norender_get() * @see elm_win_render() - * @ingroup Elm_Win + * @ingroup Elm_Win_Group * @since 1.7 */ EAPI void elm_win_norender_pop(Evas_Object *obj); @@ -381,7 +381,7 @@ EAPI void elm_win_norender_pop(Evas_Object *obj); * @see elm_win_norender_push() * @see elm_win_norender_pop() * @see elm_win_render() - * @ingroup Elm_Win + * @ingroup Elm_Win_Group * @since 1.7 */ EAPI int elm_win_norender_get(const Evas_Object *obj); @@ -400,7 +400,7 @@ EAPI int elm_win_norender_get(const Evas_Object *obj); * @see elm_win_norender_push() * @see elm_win_norender_pop() * @see elm_win_norender_get() - * @ingroup Elm_Win + * @ingroup Elm_Win_Group * @since 1.7 */ EAPI void elm_win_render(Evas_Object *obj); @@ -416,7 +416,7 @@ EAPI void elm_win_render(Evas_Object *obj); * * @return The Ecore_Wl_Window of @p obj * - * @ingroup Elm_Win + * @ingroup Elm_Win_Group */ EAPI Ecore_Wl2_Window *elm_win_wl_window_get(const Evas_Object *obj); @@ -431,7 +431,7 @@ EAPI Ecore_Wl2_Window *elm_win_wl_window_get(const Evas_Object *obj); * * @return The Ecore_Win32_Window of @p obj * - * @ingroup Elm_Win + * @ingroup Elm_Win_Group * * @since 1.16 */ @@ -448,7 +448,7 @@ EAPI Ecore_Win32_Window *elm_win_win32_window_get(const Evas_Object *obj); * * @see elm_win_wm_rotation_preferred_rotation_get() * - * ingroup Elm_Win + * @ingroup Elm_Win_Group * @since 1.9 */ EAPI void elm_win_wm_rotation_preferred_rotation_set(Evas_Object *obj, int rotation); @@ -477,7 +477,7 @@ EAPI void elm_win_wm_rotation_preferred_rotation_set(Evas_Objec * * @param[in] subobj The resize object to add. * - * @ingroup Elm_Win + * @ingroup Elm_Win_Group */ EAPI void elm_win_resize_object_add(Evas_Object *obj, Evas_Object *subobj); @@ -491,13 +491,13 @@ EAPI void elm_win_resize_object_add(Evas_Object *obj, Evas_Object *subobj); * * @param[in] subobj The resize object to add. * - * @ingroup Elm_Win + * @ingroup Elm_Win_Group */ EAPI void elm_win_resize_object_del(Evas_Object *obj, Evas_Object *subobj); /** Get the Ecore_X_Window of an Evas_Object. * - * @ingroup Elm_Win + * @ingroup Elm_Win_Group */ EAPI Ecore_X_Window elm_win_xwindow_get(const Evas_Object *obj); @@ -506,7 +506,7 @@ EAPI Ecore_X_Window elm_win_xwindow_get(const Evas_Object *obj); * * @return The Ecore_Wl2_Window of @c obj. * - * @ingroup Elm_Win + * @ingroup Elm_Win_Group */ EAPI Ecore_Wl2_Window *elm_win_wl_window_get(const Evas_Object *obj); @@ -518,7 +518,7 @@ EAPI Ecore_Wl2_Window *elm_win_wl_window_get(const Evas_Object *obj); * * @since 1.17 * - * @ingroup Elm_Win + * @ingroup Elm_Win_Group */ EAPI Ecore_Win32_Window *elm_win_win32_window_get(const Evas_Object *obj); @@ -529,7 +529,7 @@ EAPI Ecore_Win32_Window *elm_win_win32_window_get(const Evas_Object *obj); * * @since 1.17 * - * @ingroup Elm_Win + * @ingroup Elm_Win_Group */ EAPI Ecore_Cocoa_Window *elm_win_cocoa_window_get(const Evas_Object *obj); @@ -540,7 +540,7 @@ EAPI Ecore_Cocoa_Window *elm_win_cocoa_window_get(const Evas_Object *obj); * * @since 1.12 * - * @ingroup Elm_Win + * @ingroup Elm_Win_Group */ EAPI void *elm_win_trap_data_get(const Evas_Object *obj); @@ -559,7 +559,7 @@ EAPI void *elm_win_trap_data_get(const Evas_Object *obj); * * @param[in] override If true, the window is overridden. * - * @ingroup Elm_Win + * @ingroup Elm_Win_Group */ EAPI void elm_win_override_set(Evas_Object *obj, Eina_Bool override); @@ -568,7 +568,7 @@ EAPI void elm_win_override_set(Evas_Object *obj, Eina_Bool override); * * @return If true, the window is overridden. * - * @ingroup Elm_Win + * @ingroup Elm_Win_Group */ EAPI Eina_Bool elm_win_override_get(const Evas_Object *obj); @@ -581,7 +581,7 @@ EAPI Eina_Bool elm_win_override_get(const Evas_Object *obj); * If @ref elm_win_override_set is not set, the Window Manager may ignore this * request. * - * @ingroup Elm_Win + * @ingroup Elm_Win_Group */ EAPI void elm_win_lower(Evas_Object *obj); @@ -592,7 +592,7 @@ EAPI void elm_win_lower(Evas_Object *obj); * * @param[in] quickpanel The quickpanel flag. * - * @ingroup Elm_Win + * @ingroup Elm_Win_Group */ EAPI void elm_win_quickpanel_set(Evas_Object *obj, Eina_Bool quickpanel); @@ -601,7 +601,7 @@ EAPI void elm_win_quickpanel_set(Evas_Object *obj, Eina_Bool quickpanel); * * @return The quickpanel flag. * - * @ingroup Elm_Win + * @ingroup Elm_Win_Group */ EAPI Eina_Bool elm_win_quickpanel_get(const Evas_Object *obj); /** @@ -609,7 +609,7 @@ EAPI Eina_Bool elm_win_quickpanel_get(const Evas_Object *obj); * * @param[in] zone The requested zone for this quickpanel. * - * @ingroup Elm_Win + * @ingroup Elm_Win_Group */ EAPI void elm_win_quickpanel_zone_set(Evas_Object *obj, int zone); @@ -618,7 +618,7 @@ EAPI void elm_win_quickpanel_zone_set(Evas_Object *obj, int zone); * * @return The requested zone for this quickpanel. * - * @ingroup Elm_Win + * @ingroup Elm_Win_Group */ EAPI int elm_win_quickpanel_zone_get(const Evas_Object *obj); /** @@ -626,7 +626,7 @@ EAPI int elm_win_quickpanel_zone_get(const Evas_Object *obj); * * @param[in] priority The major priority for this quickpanel or -1. * - * @ingroup Elm_Win + * @ingroup Elm_Win_Group */ EAPI void elm_win_quickpanel_priority_major_set(Evas_Object *obj, int priority); @@ -635,7 +635,7 @@ EAPI void elm_win_quickpanel_priority_major_set(Evas_Object *obj, int priority); * * @return The major priority for this quickpanel or -1. * - * @ingroup Elm_Win + * @ingroup Elm_Win_Group */ EAPI int elm_win_quickpanel_priority_major_get(const Evas_Object *obj); @@ -644,7 +644,7 @@ EAPI int elm_win_quickpanel_priority_major_get(const Evas_Object *obj); * * @param[in] priority The minor priority for this quickpanel. * - * @ingroup Elm_Win + * @ingroup Elm_Win_Group */ EAPI void elm_win_quickpanel_priority_minor_set(Evas_Object *obj, int priority); @@ -653,7 +653,7 @@ EAPI void elm_win_quickpanel_priority_minor_set(Evas_Object *obj, int priority); * * @return The minor priority for this quickpanel. * - * @ingroup Elm_Win + * @ingroup Elm_Win_Group */ EAPI int elm_win_quickpanel_priority_minor_get(const Evas_Object *obj); @@ -662,7 +662,7 @@ EAPI int elm_win_quickpanel_priority_minor_get(const Evas_Object *obj); * * @param[in] mode The mode, one of #Elm_Win_Indicator_Mode. * - * @ingroup Elm_Win + * @ingroup Elm_Win_Group */ EAPI void elm_win_indicator_mode_set(Evas_Object *obj, Elm_Win_Indicator_Mode mode); @@ -671,7 +671,7 @@ EAPI void elm_win_indicator_mode_set(Evas_Object *obj, Elm_Win_Indicator_Mode mo * * @return The mode, one of #Elm_Win_Indicator_Mode. * - * @ingroup Elm_Win + * @ingroup Elm_Win_Group */ EAPI Elm_Win_Indicator_Mode elm_win_indicator_mode_get(const Evas_Object *obj); @@ -680,7 +680,7 @@ EAPI Elm_Win_Indicator_Mode elm_win_indicator_mode_get(const Evas_Object *obj); * * @param[in] mode The mode, one of #Elm_Win_Indicator_Opacity_Mode. * - * @ingroup Elm_Win + * @ingroup Elm_Win_Group */ EAPI void elm_win_indicator_opacity_set(Evas_Object *obj, Elm_Win_Indicator_Opacity_Mode mode); @@ -689,16 +689,16 @@ EAPI void elm_win_indicator_opacity_set(Evas_Object *obj, Elm_Win_Indicator_Opac * * @return The mode, one of #Elm_Win_Indicator_Opacity_Mode. * - * @ingroup Elm_Win + * @ingroup Elm_Win_Group */ EAPI Elm_Win_Indicator_Opacity_Mode elm_win_indicator_opacity_get(const Evas_Object *obj); /** * @brief Sets whether the window is a keyboard. * - * @param[in] mode If true, the window is a virtual keyboard.. + * @param[in] is_keyboard If true, the window is a virtual keyboard.. * - * @ingroup Elm_Win + * @ingroup Elm_Win_Group */ EAPI void elm_win_keyboard_win_set(Evas_Object *obj, Eina_Bool is_keyboard); @@ -707,7 +707,7 @@ EAPI void elm_win_keyboard_win_set(Evas_Object *obj, Eina_Bool is_keyboard); * * @return The mode, If true, the window is a virtual keyboard.. * - * @ingroup Elm_Win + * @ingroup Elm_Win_Group */ EAPI Eina_Bool elm_win_keyboard_win_get(const Evas_Object *obj); @@ -716,7 +716,7 @@ EAPI Eina_Bool elm_win_keyboard_win_get(const Evas_Object *obj); * * @param[in] conformant The conformant flag. * - * @ingroup Elm_Win + * @ingroup Elm_Win_Group */ EAPI void elm_win_conformant_set(Evas_Object *obj, Eina_Bool conformant); @@ -725,7 +725,7 @@ EAPI void elm_win_conformant_set(Evas_Object *obj, Eina_Bool conformant); * * @return The conformant flag. * - * @ingroup Elm_Win + * @ingroup Elm_Win_Group */ EAPI Eina_Bool elm_win_conformant_get(const Evas_Object *obj); @@ -741,7 +741,7 @@ EAPI Eina_Bool elm_win_conformant_get(const Evas_Object *obj); * * @since 1.9 * - * @ingroup Elm_Win + * @ingroup Elm_Win_Group */ EAPI void elm_win_wm_rotation_manual_rotation_done_set(Evas_Object *obj, Eina_Bool set); @@ -754,7 +754,7 @@ EAPI void elm_win_wm_rotation_manual_rotation_done_set(Evas_Object *obj, Eina_Bo * * @since 1.9 * - * @ingroup Elm_Win + * @ingroup Elm_Win_Group */ EAPI Eina_Bool elm_win_wm_rotation_manual_rotation_done_get(const Evas_Object *obj); @@ -765,7 +765,7 @@ EAPI Eina_Bool elm_win_wm_rotation_manual_rotation_done_get(const Evas_Object *o * * @since 1.9 * - * @ingroup Elm_Win + * @ingroup Elm_Win_Group */ EAPI void elm_win_wm_rotation_manual_rotation_done(Evas_Object *obj); @@ -782,7 +782,7 @@ EAPI void elm_win_wm_rotation_manual_rotation_done(Evas_Object *obj); * @param[in] rotation The rotation of the window, in degrees (0-360), * counter-clockwise. * - * @ingroup Elm_Win + * @ingroup Elm_Win_Group */ EAPI void elm_win_rotation_set(Evas_Object *obj, int rotation); @@ -791,7 +791,7 @@ EAPI void elm_win_rotation_set(Evas_Object *obj, int rotation); * * @return The rotation of the window, in degrees (0-360), counter-clockwise. * - * @ingroup Elm_Win + * @ingroup Elm_Win_Group */ EAPI int elm_win_rotation_get(const Evas_Object *obj); @@ -804,7 +804,7 @@ EAPI int elm_win_rotation_get(const Evas_Object *obj); * @param[in] rotation The rotation of the window in degrees (0-360), * counter-clockwise. * - * @ingroup Elm_Win + * @ingroup Elm_Win_Group */ EAPI void elm_win_rotation_with_resize_set(Evas_Object *obj, int rotation); @@ -820,7 +820,7 @@ EAPI void elm_win_rotation_with_resize_set(Evas_Object *obj, int rotation); * * @since 1.9 * - * @ingroup Elm_Win + * @ingroup Elm_Win_Group */ EAPI Eina_Bool elm_win_wm_rotation_supported_get(const Evas_Object *obj); @@ -834,7 +834,7 @@ EAPI Eina_Bool elm_win_wm_rotation_supported_get(const Evas_Object *obj); * * @since 1.9 * - * @ingroup Elm_Win + * @ingroup Elm_Win_Group */ EAPI int elm_win_wm_rotation_preferred_rotation_get(const Evas_Object *obj); @@ -845,7 +845,7 @@ EAPI int elm_win_wm_rotation_preferred_rotation_get(const Evas_Object *obj); * @param[out] x The int to store the x coordinate to. * @param[out] y The int to store the y coordinate to. * - * @ingroup Elm_Win + * @ingroup Elm_Win_Group */ EAPI void elm_win_screen_position_get(const Evas_Object *obj, int *x, int *y); @@ -857,7 +857,7 @@ EAPI void elm_win_screen_position_get(const Evas_Object *obj, int *x, int *y); * @param[out] w Where to return the width value. May be @c null. * @param[out] h Where to return the height value. May be @c null. * - * @ingroup Elm_Win + * @ingroup Elm_Win_Group */ EAPI void elm_win_screen_size_get(const Evas_Object *obj, int *x, int *y, int *w, int *h); @@ -871,7 +871,7 @@ EAPI void elm_win_screen_size_get(const Evas_Object *obj, int *x, int *y, int *w * * @since 1.7 * - * @ingroup Elm_Win + * @ingroup Elm_Win_Group */ EAPI void elm_win_screen_dpi_get(const Evas_Object *obj, int *xdpi, int *ydpi); @@ -880,7 +880,7 @@ EAPI void elm_win_screen_dpi_get(const Evas_Object *obj, int *xdpi, int *ydpi); * * @param[in] icon_name The icon name to set. * - * @ingroup Elm_Win + * @ingroup Elm_Win_Group */ EAPI void elm_win_icon_name_set(Evas_Object *obj, const char *icon_name); @@ -893,7 +893,7 @@ EAPI void elm_win_icon_name_set(Evas_Object *obj, const char *icon_name); * * @return The icon name to set. * - * @ingroup Elm_Win + * @ingroup Elm_Win_Group */ EAPI const char *elm_win_icon_name_get(const Evas_Object *obj); @@ -902,7 +902,7 @@ EAPI const char *elm_win_icon_name_get(const Evas_Object *obj); * * @param[in] withdrawn If true, the window is withdrawn. * - * @ingroup Elm_Win + * @ingroup Elm_Win_Group */ EAPI void elm_win_withdrawn_set(Evas_Object *obj, Eina_Bool withdrawn); @@ -911,7 +911,7 @@ EAPI void elm_win_withdrawn_set(Evas_Object *obj, Eina_Bool withdrawn); * * @return If true, the window is withdrawn. * - * @ingroup Elm_Win + * @ingroup Elm_Win_Group */ EAPI Eina_Bool elm_win_withdrawn_get(const Evas_Object *obj); @@ -920,7 +920,7 @@ EAPI Eina_Bool elm_win_withdrawn_get(const Evas_Object *obj); * * @param[in] urgent If true, the window is urgent. * - * @ingroup Elm_Win + * @ingroup Elm_Win_Group */ EAPI void elm_win_urgent_set(Evas_Object *obj, Eina_Bool urgent); @@ -929,7 +929,7 @@ EAPI void elm_win_urgent_set(Evas_Object *obj, Eina_Bool urgent); * * @return If true, the window is urgent. * - * @ingroup Elm_Win + * @ingroup Elm_Win_Group */ EAPI Eina_Bool elm_win_urgent_get(const Evas_Object *obj); @@ -938,7 +938,7 @@ EAPI Eina_Bool elm_win_urgent_get(const Evas_Object *obj); * * @param[in] demand_attention If true, the window is demand_attention. * - * @ingroup Elm_Win + * @ingroup Elm_Win_Group */ EAPI void elm_win_demand_attention_set(Evas_Object *obj, Eina_Bool demand_attention); @@ -947,7 +947,7 @@ EAPI void elm_win_demand_attention_set(Evas_Object *obj, Eina_Bool demand_attent * * @return If true, the window is demand_attention. * - * @ingroup Elm_Win + * @ingroup Elm_Win_Group */ EAPI Eina_Bool elm_win_demand_attention_get(const Evas_Object *obj); @@ -956,7 +956,7 @@ EAPI Eina_Bool elm_win_demand_attention_get(const Evas_Object *obj); * * @param[in] modal If true, the window is modal. * - * @ingroup Elm_Win + * @ingroup Elm_Win_Group */ EAPI void elm_win_modal_set(Evas_Object *obj, Eina_Bool modal); @@ -965,7 +965,7 @@ EAPI void elm_win_modal_set(Evas_Object *obj, Eina_Bool modal); * * @return If true, the window is modal. * - * @ingroup Elm_Win + * @ingroup Elm_Win_Group */ EAPI Eina_Bool elm_win_modal_get(const Evas_Object *obj); @@ -981,7 +981,7 @@ EAPI Eina_Bool elm_win_modal_get(const Evas_Object *obj); * * @param[in] shaped If @c true, the window is shaped. * - * @ingroup Elm_Win + * @ingroup Elm_Win_Group */ EAPI void elm_win_shaped_set(Evas_Object *obj, Eina_Bool shaped); @@ -990,7 +990,7 @@ EAPI void elm_win_shaped_set(Evas_Object *obj, Eina_Bool shaped); * * @return If @c true, the window is shaped. * - * @ingroup Elm_Win + * @ingroup Elm_Win_Group */ EAPI Eina_Bool elm_win_shaped_get(const Evas_Object *obj); @@ -999,7 +999,7 @@ EAPI Eina_Bool elm_win_shaped_get(const Evas_Object *obj); * * @param[in] title The title. * - * @ingroup Elm_Win + * @ingroup Elm_Win_Group */ EAPI void elm_win_title_set(Evas_Object *obj, const char *title); @@ -1011,7 +1011,7 @@ EAPI void elm_win_title_set(Evas_Object *obj, const char *title); * * @return The title. * - * @ingroup Elm_Win + * @ingroup Elm_Win_Group */ EAPI const char *elm_win_title_get(const Evas_Object *obj); @@ -1025,7 +1025,7 @@ EAPI const char *elm_win_title_get(const Evas_Object *obj); * * @since 1.7 * - * @ingroup Elm_Win + * @ingroup Elm_Win_Group */ EAPI void elm_win_size_base_set(Evas_Object *obj, int w, int h); @@ -1037,7 +1037,7 @@ EAPI void elm_win_size_base_set(Evas_Object *obj, int w, int h); * * @since 1.7 * - * @ingroup Elm_Win + * @ingroup Elm_Win_Group */ EAPI void elm_win_size_base_get(const Evas_Object *obj, int *w, int *h); @@ -1051,7 +1051,7 @@ EAPI void elm_win_size_base_get(const Evas_Object *obj, int *w, int *h); * * @since 1.7 * - * @ingroup Elm_Win + * @ingroup Elm_Win_Group */ EAPI void elm_win_size_step_set(Evas_Object *obj, int w, int h); @@ -1063,7 +1063,7 @@ EAPI void elm_win_size_step_set(Evas_Object *obj, int w, int h); * * @since 1.7 * - * @ingroup Elm_Win + * @ingroup Elm_Win_Group */ EAPI void elm_win_size_step_get(const Evas_Object *obj, int *w, int *h); @@ -1078,7 +1078,7 @@ EAPI void elm_win_size_step_get(const Evas_Object *obj, int *w, int *h); * * @param[in] params Optional parameters for the command. * - * @ingroup Elm_Win + * @ingroup Elm_Win_Group */ EAPI void elm_win_illume_command_send(Evas_Object *obj, Elm_Illume_Command command, void *params); @@ -1089,7 +1089,7 @@ EAPI void elm_win_illume_command_send(Evas_Object *obj, Elm_Illume_Command comma * * @since 1.8 * - * @ingroup Elm_Win + * @ingroup Elm_Win_Group */ EAPI void elm_win_profile_set(Evas_Object *obj, const char *profile); @@ -1100,7 +1100,7 @@ EAPI void elm_win_profile_set(Evas_Object *obj, const char *profile); * * @since 1.8 * - * @ingroup Elm_Win + * @ingroup Elm_Win_Group */ EAPI const char *elm_win_profile_get(const Evas_Object *obj); @@ -1116,7 +1116,7 @@ EAPI const char *elm_win_profile_get(const Evas_Object *obj); * * @param[in] layer The layer of the window. * - * @ingroup Elm_Win + * @ingroup Elm_Win_Group */ EAPI void elm_win_layer_set(Evas_Object *obj, int layer); @@ -1125,7 +1125,7 @@ EAPI void elm_win_layer_set(Evas_Object *obj, int layer); * * @return The layer of the window. * - * @ingroup Elm_Win + * @ingroup Elm_Win_Group */ EAPI int elm_win_layer_get(const Evas_Object *obj); @@ -1140,7 +1140,7 @@ EAPI int elm_win_layer_get(const Evas_Object *obj); * * @return The inlined image object or @c null if none exists. * - * @ingroup Elm_Win + * @ingroup Elm_Win_Group */ EAPI Evas_Object *elm_win_inlined_image_object_get(const Evas_Object *obj); @@ -1149,7 +1149,7 @@ EAPI Evas_Object *elm_win_inlined_image_object_get(const Evas_Object *obj); * * @param[in] oee * - * @ingroup Elm_Win + * @ingroup Elm_Win_Group * * @deprecated */ @@ -1163,7 +1163,7 @@ EAPI void elm_win_fake_canvas_set(Evas_Object *obj, Ecore_Evas *oee) EINA_DEPREC * @param obj The window object * @return The Ecore_Window of an Evas_Object * - * @ingroup Elm_Win + * @ingroup Elm_Win_Group * @since 1.8 * @note Unless you are getting the window id for the purpose of communicating between client<->compositor over dbus, * this is definitely not the function you are looking for. @@ -1175,7 +1175,7 @@ EAPI Ecore_Window elm_win_window_id_get(const Evas_Object *obj); * * @return The Main Menu of the window ($null on error). * - * @ingroup Elm_Win + * @ingroup Elm_Win_Group */ EAPI Evas_Object *elm_win_main_menu_get(Evas_Object *obj); @@ -1184,7 +1184,7 @@ EAPI Evas_Object *elm_win_main_menu_get(Evas_Object *obj); * * @param[in] mode The mode, one of #Elm_Win_Keyboard_Mode. * - * @ingroup Elm_Win + * @ingroup Elm_Win_Group */ EAPI void elm_win_keyboard_mode_set(Elm_Win *obj, Elm_Win_Keyboard_Mode mode); @@ -1193,7 +1193,7 @@ EAPI void elm_win_keyboard_mode_set(Elm_Win *obj, Elm_Win_Keyboard_Mode mode); * * @return The mode, one of #Elm_Win_Keyboard_Mode. * - * @ingroup Elm_Win + * @ingroup Elm_Win_Group */ EAPI Elm_Win_Keyboard_Mode elm_win_keyboard_mode_get(const Elm_Win *obj); @@ -1267,7 +1267,7 @@ EAPI Evas_Object *elm_win_get(Evas_Object *obj); * * @return @c true on success, @c false otherwise * - * @ingroup Efl_Ui_Win + * @ingroup Elm_Win_Group */ EAPI Eina_Bool elm_win_socket_listen(Elm_Win *obj, const char *svcname, int svcnum, Eina_Bool svcsys); @@ -1276,7 +1276,7 @@ EAPI Eina_Bool elm_win_socket_listen(Elm_Win *obj, const char *svcname, int svcn * * @return @c true if window has focus, @c false otherwise * - * @ingroup Efl_Ui_Win + * @ingroup Elm_Win_Group */ EAPI Eina_Bool elm_win_focus_get(const Elm_Win *obj); @@ -1286,7 +1286,7 @@ EAPI Eina_Bool elm_win_focus_get(const Elm_Win *obj); * Places the window pointed by @c obj at the top of the stack, so that it's * not covered by any other window. * - * @ingroup Efl_Ui_Win + * @ingroup Elm_Win_Group */ EAPI void elm_win_raise(Elm_Win *obj); @@ -1298,7 +1298,7 @@ EAPI void elm_win_raise(Elm_Win *obj); * * @since 1.8 * - * @ingroup Efl_Ui_Win + * @ingroup Elm_Win_Group */ EAPI void elm_win_available_profiles_set(Elm_Win *obj, const char **profiles, unsigned int count); @@ -1312,7 +1312,7 @@ EAPI void elm_win_available_profiles_set(Elm_Win *obj, const char **profiles, un * * @since 1.8 * - * @ingroup Efl_Ui_Win + * @ingroup Elm_Win_Group */ EAPI Eina_Bool elm_win_available_profiles_get(const Elm_Win *obj, char ***profiles, unsigned int *count); @@ -1328,7 +1328,7 @@ EAPI Eina_Bool elm_win_available_profiles_get(const Elm_Win *obj, char ***profil * * @since 1.9 * - * @ingroup Efl_Ui_Win + * @ingroup Elm_Win_Group */ EAPI void elm_win_wm_rotation_available_rotations_set(Elm_Win *obj, const int *rotations, unsigned int count); @@ -1345,7 +1345,7 @@ EAPI void elm_win_wm_rotation_available_rotations_set(Elm_Win *obj, const int *r * * @since 1.9 * - * @ingroup Efl_Ui_Win + * @ingroup Elm_Win_Group */ EAPI Eina_Bool elm_win_wm_rotation_available_rotations_get(const Elm_Win *obj, int **rotations, unsigned int *count); @@ -1893,7 +1893,7 @@ EAPI Eina_Bool elm_win_move_resize_start(Evas_Object *obj, Elm_Win_Move_Resize_M * * @param[in] animate The enabled value for the highlight animation. * - * @ingroup Elm_Win + * @ingroup Elm_Win_Group */ EAPI void elm_win_focus_highlight_animate_set(Elm_Win *obj, Eina_Bool animate); @@ -1902,7 +1902,7 @@ EAPI void elm_win_focus_highlight_animate_set(Elm_Win *obj, Eina_Bool animate); * * @return The enabled value for the highlight animation. * - * @ingroup Elm_Win + * @ingroup Elm_Win_Group */ EAPI Eina_Bool elm_win_focus_highlight_animate_get(const Elm_Win *obj); @@ -1914,7 +1914,7 @@ EAPI Eina_Bool elm_win_focus_highlight_animate_get(const Elm_Win *obj); * * @param[in] enabled The enabled value for the highlight. * - * @ingroup Elm_Win + * @ingroup Elm_Win_Group */ EAPI void elm_win_focus_highlight_enabled_set(Elm_Win *obj, Eina_Bool enabled); @@ -1923,7 +1923,7 @@ EAPI void elm_win_focus_highlight_enabled_set(Elm_Win *obj, Eina_Bool enabled); * * @return The enabled value for the highlight. * - * @ingroup Elm_Win + * @ingroup Elm_Win_Group */ EAPI Eina_Bool elm_win_focus_highlight_enabled_get(const Elm_Win *obj); @@ -1935,7 +1935,7 @@ EAPI Eina_Bool elm_win_focus_highlight_enabled_get(const Elm_Win *obj); * * @param[in] style The style or @c null if none. * - * @ingroup Elm_Win + * @ingroup Elm_Win_Group */ EAPI Eina_Bool elm_win_focus_highlight_style_set(Elm_Win *obj, const char *style); @@ -1944,6 +1944,6 @@ EAPI Eina_Bool elm_win_focus_highlight_style_set(Elm_Win *obj, const char *style * * @return The style or @c null if none. * - * @ingroup Elm_Win + * @ingroup Elm_Win_Group */ EAPI const char *elm_win_focus_highlight_style_get(const Elm_Win *obj); diff --git a/src/lib/elementary/els_box.c b/src/lib/elementary/els_box.c index de39796d57..73ff133824 100644 --- a/src/lib/elementary/els_box.c +++ b/src/lib/elementary/els_box.c @@ -246,7 +246,7 @@ _smart_extents_calculate(Evas_Object *box, Evas_Object_Box_Data *priv, int w, in EINA_LIST_FOREACH(priv->children, l, opt) { Evas_Aspect_Control aspect = EVAS_ASPECT_CONTROL_NONE; - int asx, asy, ow = 0, oh = 0, fw, fh, ww, hh; + int asx, asy, ow = 0, oh = 0, fw = 0, fh = 0, ww, hh; double ax, ay; evas_object_size_hint_align_get(opt->obj, &ax, &ay); @@ -329,17 +329,22 @@ _smart_extents_calculate(Evas_Object *box, Evas_Object_Box_Data *priv, int w, in else { /* returns true if at least one item has aspect hint */ - if (_smart_extents_non_homogeneous_calc(priv, w, h, &minw, &minh, &maxw, &maxh, expand, horizontal, 0)) + if (_smart_extents_non_homogeneous_calc(priv, w, h, &minw, &minh, + &maxw, &maxh, expand, + horizontal, EINA_FALSE)) { /* aspect can only be accurately calculated after the full (non-aspected) min size of the box has * been calculated due to the use of this min size during aspect calculations */ int aminw = minw; int aminh = minh; - _smart_extents_padding_calc(priv, &minw, &minh, &maxw, &maxh, horizontal); - _smart_extents_non_homogeneous_calc(priv, w, h, &aminw, &aminh, &maxw, &maxh, expand, horizontal, 1); - if (horizontal) minh = aminh; - else minw = aminw; + _smart_extents_padding_calc(priv, &minw, &minh, &maxw, &maxh, + horizontal); + _smart_extents_non_homogeneous_calc(priv, w, h, &aminw, &aminh, + &maxw, &maxh, expand, + horizontal, EINA_TRUE); + if (horizontal) minw = aminw; + else minh = aminh; } } _smart_extents_padding_calc(priv, &minw, &minh, &maxw, &maxh, horizontal); @@ -390,7 +395,7 @@ _els_box_layout(Evas_Object *o, Evas_Object_Box_Data *priv, Eina_Bool horizontal } count = eina_list_count(priv->children); - if (!expand) + if (EINA_DBL_EQ(expand, 0)) { if (rtl) ax = 1.0 - ax; if (horizontal) @@ -430,8 +435,8 @@ _els_box_layout(Evas_Object *o, Evas_Object_Box_Data *priv, Eina_Bool horizontal fw = fh = 0; xw = xh = 0; /* align(-1) means fill to maximum apportioned size */ - if (ax == -1.0) {fw = 1; ax = 0.5;} - if (ay == -1.0) {fh = 1; ay = 0.5;} + if (EINA_DBL_EQ(ax, -1.0)) {fw = 1; ax = 0.5;} + if (EINA_DBL_EQ(ay, -1.0)) {fh = 1; ay = 0.5;} if (rtl) ax = 1.0 - ax; if (wx > 0.0) xw = 1; if (wy > 0.0) xh = 1; @@ -454,11 +459,13 @@ _els_box_layout(Evas_Object *o, Evas_Object_Box_Data *priv, Eina_Bool horizontal } hh = h; - _box_object_aspect_calc(&ow, &oh, mnw, mnh, mxw, mxh, fw, fh, ww, hh, aspect, asx / (double)asy); - /* non-homogeneous, aspected, expending items are calculated based on object size - * during extents calc, so use this for positioning during layout as well + _box_object_aspect_calc(&ow, &oh, mnw, mnh, mxw, mxh, fw, fh, + ww, hh, aspect, asx / (double)asy); + /* non-homogeneous, aspected, expending items are calculated + * based on object size during extents calc, so use this for + * positioning during layout as well */ - if (xw && aspect && (!homogeneous)) + if (aspect && (!homogeneous)) ww = ow; evas_object_move(obj, ((!rtl) ? (xx + pad_l) : (x + (w - (xx - x) - ww) + pad_r)) @@ -489,8 +496,9 @@ _els_box_layout(Evas_Object *o, Evas_Object_Box_Data *priv, Eina_Bool horizontal } ww = w; - _box_object_aspect_calc(&ow, &oh, mnw, mnh, mxw, mxh, fw, fh, ww, hh, aspect, asx / (double)asy); - if (xh && aspect && (!homogeneous)) + _box_object_aspect_calc(&ow, &oh, mnw, mnh, mxw, mxh, fw, fh, + ww, hh, aspect, asx / (double)asy); + if (aspect && (!homogeneous)) hh = oh; evas_object_move(obj, xx + (Evas_Coord)(((double)(ww - ow)) * ax) + pad_l, diff --git a/src/lib/elementary/els_cursor.c b/src/lib/elementary/els_cursor.c index eeb1d18f85..4b3622a39e 100644 --- a/src/lib/elementary/els_cursor.c +++ b/src/lib/elementary/els_cursor.c @@ -42,6 +42,7 @@ struct _Cursor_Id # define CURSOR(_name, _id, _cid) { _name } #endif +#if defined(HAVE_ELEMENTARY_X) || defined(HAVE_ELEMENTARY_COCOA) || defined(HAVE_ELEMENTARY_WIN32) /* Please keep order in sync with Ecore_X_Cursor.h values! */ static struct _Cursor_Id _cursors[] = { @@ -124,7 +125,6 @@ static struct _Cursor_Id _cursors[] = CURSOR(ELM_CURSOR_XTERM , XTERM , ECORE_COCOA_CURSOR_IBEAM) }; -#if defined(HAVE_ELEMENTARY_X) || defined(HAVE_ELEMENTARY_COCOA) || defined(HAVE_ELEMENTARY_WIN32) static const int _cursors_count = sizeof(_cursors)/sizeof(struct _Cursor_Id); #endif diff --git a/src/lib/elementary/els_tooltip.c b/src/lib/elementary/els_tooltip.c index 78b09e8373..6613745653 100644 --- a/src/lib/elementary/els_tooltip.c +++ b/src/lib/elementary/els_tooltip.c @@ -385,7 +385,7 @@ _elm_tooltip_reconfigure_orient(Elm_Tooltip *tt, { dx = -mx; mx = -(px / 2); - if (tt->rel_pos.x == 0.5) + if (EINA_DBL_EQ(tt->rel_pos.x, 0.5)) { tt->rel_pos.x = 0.5 - dx / (double)tcw; if (tt->rel_pos.x < 0.0) tt->rel_pos.x = 0.0; @@ -395,7 +395,7 @@ _elm_tooltip_reconfigure_orient(Elm_Tooltip *tt, { dx = mx + tw - cw; mx = cw - tw + px / 2; - if (tt->rel_pos.x == 0.5) + if (EINA_DBL_EQ(tt->rel_pos.x, 0.5)) { tt->rel_pos.x = 0.5 + dx / (double)tcw; if (tt->rel_pos.x > 1.0) tt->rel_pos.x = 1.0; @@ -406,7 +406,7 @@ _elm_tooltip_reconfigure_orient(Elm_Tooltip *tt, { dy = -my; my = -(py / 2); - if (tt->rel_pos.y == 0.5) + if (EINA_DBL_EQ(tt->rel_pos.y, 0.5)) { tt->rel_pos.y = 0.5 - dy / (double)tch; if (tt->rel_pos.y < 0.0) tt->rel_pos.y = 0.0; @@ -416,7 +416,7 @@ _elm_tooltip_reconfigure_orient(Elm_Tooltip *tt, { dy = my + th - ch; my = ch - th + py / 2; - if (tt->rel_pos.y == 0.5) + if (EINA_DBL_EQ(tt->rel_pos.y, 0.5)) { tt->rel_pos.y = 0.5 + dy / (double)tch; if (tt->rel_pos.y > 1.0) tt->rel_pos.y = 1.0; diff --git a/src/lib/elementary/meson.build b/src/lib/elementary/meson.build index 8872c2c25c..6076e21f8a 100644 --- a/src/lib/elementary/meson.build +++ b/src/lib/elementary/meson.build @@ -17,6 +17,9 @@ pub_legacy_eo_files = [ 'elm_actionslider_part.eo', 'elm_bubble_part.eo', 'elm_fileselector_part.eo', + 'elm_multibuttonentry_part.eo', + 'elm_interface_scrollable.eo', + 'elm_code_widget.eo', ] pub_eo_file_target = [] @@ -39,7 +42,8 @@ endforeach pub_eo_files = [ 'efl_ui_widget.eo', 'efl_ui_widget_scrollable_content.eo', - 'efl_ui_animation_view.eo', + 'efl_ui_vg_animation.eo', + 'efl_ui_vg_animation_part.eo', 'efl_ui_bg.eo', 'efl_ui_button.eo', 'efl_ui_calendar.eo', @@ -139,17 +143,15 @@ pub_eo_files = [ 'efl_access_window.eo', 'efl_ui_theme.eo', 'efl_config_global.eo', - 'elm_code_widget.eo', 'efl_ui_selection.eo', 'efl_ui_dnd.eo', - 'efl_ui_dnd_container.eo', 'efl_ui_focus_manager_window_root.eo', 'efl_ui_spotlight_container.eo', 'efl_ui_spotlight_manager.eo', - 'efl_ui_spotlight_manager_scroll.eo', - 'efl_ui_spotlight_manager_stack.eo', + 'efl_ui_spotlight_scroll_manager.eo', + 'efl_ui_spotlight_fade_manager.eo', 'efl_ui_spotlight_indicator.eo', - 'efl_ui_spotlight_indicator_icon.eo', + 'efl_ui_spotlight_icon_indicator.eo', 'efl_ui_spotlight_util.eo', 'efl_ui_tab_pager.eo', 'efl_ui_tab_bar.eo', @@ -160,10 +162,8 @@ pub_eo_files = [ 'efl_ui_radio_legacy_part.eo', 'efl_ui_check_legacy_part.eo', 'efl_ui_progressbar_legacy_part.eo', - 'elm_multibuttonentry_part.eo', - 'elm_interface_scrollable.eo', 'efl_ui_image_zoomable_pan.eo', - 'efl_ui_text_part.eo', + 'efl_ui_textbox_part.eo', 'efl_ui_caching_factory.eo', 'efl_ui_widget_factory.eo', 'efl_ui_property_bind_part.eo', @@ -189,6 +189,8 @@ pub_eo_files = [ 'efl_ui_grid_view.eo', 'efl_ui_pager.eo', 'efl_ui_stack.eo', + 'efl_ui_separator.eo', + 'efl_ui_spotlight_animation_manager.eo', ] foreach eo_file : pub_eo_files @@ -209,8 +211,6 @@ endforeach pub_eo_types_files = [ 'elm_general.eot', 'efl_ui.eot', - 'efl_ui_selection_types.eot', - 'efl_ui_dnd_types.eot' ] foreach eo_file : pub_eo_types_files @@ -234,13 +234,12 @@ priv_eo_files = [ 'efl_ui_focus_parent_provider.eo', 'efl_ui_focus_parent_provider_standard.eo', 'efl_ui_state_model.eo', - 'efl_ui_selection_manager.eo', 'efl_datetime_manager.eo', 'efl_ui_size_model.eo', 'efl_ui_homogeneous_model.eo', 'efl_ui_exact_model.eo', 'efl_ui_average_model.eo', - 'efl_ui_spotlight_manager_plain.eo', + 'efl_ui_spotlight_plain_manager.eo', 'efl_ui_collection_focus_manager.eo', ] @@ -301,7 +300,7 @@ elementary_headers_unstable = [ 'efl_ui_widget_flip.h', 'elm_widget_flipselector.h', 'efl_ui_widget_frame.h', - 'efl_ui_animation_view_private.h', + 'efl_ui_vg_animation_private.h', 'elm_widget_gengrid.h', 'elm_widget_genlist.h', 'elm_widget_glview.h', @@ -401,8 +400,8 @@ elementary_pub_headers = [ 'elc_naviframe_common.h', 'elc_popup.h', 'elc_popup_legacy.h', - 'efl_ui_animation_view.h', - 'efl_ui_animation_view_legacy.h', + 'efl_ui_vg_animation.h', + 'efl_ui_vg_animation_legacy.h', 'elm_access.h', 'elm_actionslider.h', 'elm_actionslider_legacy.h', @@ -592,7 +591,7 @@ elementary_pub_headers = [ 'elm_win_legacy.h', 'elm_helper.h', 'elm_part_helper.h', - 'efl_ui_animation_view_eo.legacy.h', + 'efl_ui_vg_animation_eo.legacy.h', 'efl_ui_bg_eo.legacy.h', 'efl_ui_bg_legacy_eo.legacy.h', 'efl_ui_button_eo.legacy.h', @@ -714,7 +713,7 @@ elementary_header_src = [ 'Elementary_Cursor.h' ] + elementary_pub_headers + elementary_headers_unstable -elementary_src = [ +elementary_src = files([ 'elm_priv.h', 'elementary_config.h', 'els_box.h', @@ -731,7 +730,7 @@ elementary_src = [ 'elc_popup.c', 'elc_scrolled_entry.c', 'elm_access.c', - 'efl_ui_animation_view.c', + 'efl_ui_vg_animation.c', 'elm_actionslider.c', 'elm_atspi_app_object.c', 'elm_atspi_bridge.c', @@ -784,6 +783,8 @@ elementary_src = [ 'elm_icon.c', 'efl_ui_image.c', 'elm_index.c', + 'elm_cnp.c', + 'elm_dnd.c', 'efl_access_object.c', 'efl_access_action.c', 'efl_access_component.c', @@ -906,7 +907,6 @@ elementary_src = [ 'efl_ui_scroller.c', 'efl_ui_scroll_manager.c', 'efl_ui_pan.c', - 'efl_ui_selection_manager.c', 'efl_ui_selection_manager_private.h', 'efl_ui_selection.c', 'efl_datetime_manager.c', @@ -914,11 +914,11 @@ elementary_src = [ 'elm_focus_legacy.c', 'efl_ui_spotlight_container.c', 'efl_ui_spotlight_manager.c', - 'efl_ui_spotlight_manager_plain.c', - 'efl_ui_spotlight_manager_scroll.c', - 'efl_ui_spotlight_manager_stack.c', + 'efl_ui_spotlight_plain_manager.c', + 'efl_ui_spotlight_scroll_manager.c', + 'efl_ui_spotlight_fade_manager.c', 'efl_ui_spotlight_indicator.c', - 'efl_ui_spotlight_indicator_icon.c', + 'efl_ui_spotlight_icon_indicator.c', 'efl_ui_spotlight_util.c', 'efl_ui_focus_graph.h', 'efl_ui_focus_graph.c', @@ -945,13 +945,15 @@ elementary_src = [ 'efl_ui_view_model.c', 'efl_ui_collection_view.c', 'efl_ui_pager.c', - 'efl_ui_stack.c' -] + 'efl_ui_stack.c', + 'efl_ui_separator.c', + 'efl_ui_spotlight_animation_manager.c', +]) -elementary_deps = [emile, eo, efl, edje, ethumb, ethumb_client, emotion, ecore_imf, ecore_con, eldbus, efreet, efreet_mime, efreet_trash, eio, atspi, dl, intl] +elementary_deps = [emile, eo, efl, edje, ethumb, ethumb_client, emotion, ecore_imf, ecore_con, eldbus, efreet, eio, buildsystem] elementary_pub_deps = [eina, eet, evas, ecore, ecore_evas, ecore_file, ecore_input, ecore_imf, ecore_con, - edje, eldbus, efreet, efreet_mime, efreet_trash, ethumb_client, efl] - + edje, eldbus, efreet, ethumb_client, efl] +elementary_ext_deps = [atspi, dl, intl, buildsystem_simple] elm_options = configuration_data() config_h.set_quoted('ELM_TOP_BUILD_DIR', meson.build_root()) @@ -961,8 +963,6 @@ config_h.set_quoted('ICON_DIR', join_paths(dir_lib, 'icons')) if sys_windows == false elm_options.set('ELM_UNIX', '1') -else - elm_options.set('DLL_EXPORT', '1') endif elm_options.set('ELM_EFREET', '1') @@ -987,6 +987,10 @@ endif if get_option('wl') config_h.set('HAVE_ELEMENTARY_WL2', '1') elementary_deps += ecore_wl2 + elementary_ext_deps += declare_dependency( + include_directories: include_directories([join_paths('..', '..', 'modules', 'ecore_evas', 'engines', 'wayland'), join_paths('..', '..', 'lib', 'ecore_wl2')]), + dependencies : ecore_wl2_internal_headers + ) endif if get_option('drm') @@ -1009,12 +1013,13 @@ c = configure_file( install_dir : dir_package_include, configuration: elm_options) -elm_package_c_args = package_c_args + ['-DELEMENTARY_BUILD=1'] +# Save in extra variable here to pass to edje_external +elm_package_c_args = package_c_args elementary_lib = library('elementary', elementary_src, pub_eo_file_target, priv_eo_file_target, c, embed_config, - dependencies: elementary_pub_deps + elementary_deps, - include_directories : config_dir + [include_directories('.')] + [include_directories(join_paths('..', '..', '..'))] + [ecore_evas_wayland_engine_include_dir], + dependencies: elementary_pub_deps + elementary_deps + elementary_ext_deps, + include_directories : config_dir + [include_directories('.')] + [include_directories(join_paths('..', '..', '..'))], install: true, c_args : elm_package_c_args, version : meson.project_version() @@ -1027,7 +1032,6 @@ elementary = declare_dependency( dependencies: elementary_pub_deps, ) - if get_option('install-eo-files') install_data(pub_eo_files + pub_eo_types_files, install_dir: join_paths(eolian_include_dir, package_version_name) |