i guess davemds will get mad, since he was complaining about
namespaces and this one, Efl.Selection clearly misses a proper
namespace.

On Thu, Jan 11, 2018 at 7:02 AM, Thiep Ha <[email protected]> wrote:
> thiep pushed a commit to branch master.
>
> http://git.enlightenment.org/core/efl.git/commit/?id=f191d6821f0fd94389dc92c8353b769eaacad28a
>
> commit f191d6821f0fd94389dc92c8353b769eaacad28a
> Author: Thiep Ha <[email protected]>
> Date:   Tue Jan 9 15:34:12 2018 +0900
>
>     selection: add efl_selection interface
>
>     Efl_Selection is the object interface for selection api of elm_cnp.
>     It allows get, set, clear, check selection.
> ---
>  src/Makefile_Elementary.am                 |  2 +
>  src/lib/elementary/Elementary.h            |  1 +
>  src/lib/elementary/efl_selection.c         | 62 
> ++++++++++++++++++++++++++++++
>  src/lib/elementary/efl_selection.eo        | 45 ++++++++++++++++++++++
>  src/lib/elementary/efl_selection_manager.c |  4 +-
>  src/lib/elementary/efl_ui_widget.eo        |  2 +-
>  6 files changed, 113 insertions(+), 3 deletions(-)
>
> diff --git a/src/Makefile_Elementary.am b/src/Makefile_Elementary.am
> index b1ac2657ae..a1712eca5e 100644
> --- a/src/Makefile_Elementary.am
> +++ b/src/Makefile_Elementary.am
> @@ -97,6 +97,7 @@ elm_public_eolian_files = \
>         lib/elementary/efl_access_window.eo \
>         lib/elementary/efl_config_global.eo \
>         lib/elementary/elm_code_widget.eo \
> +       lib/elementary/efl_selection.eo \
>         $(NULL)
>
>  # More public files -- FIXME
> @@ -761,6 +762,7 @@ lib_elementary_libelementary_la_SOURCES = \
>         lib/elementary/efl_ui_scroll_manager.c \
>         lib/elementary/efl_ui_pan.c \
>         lib/elementary/efl_selection_manager.c \
> +       lib/elementary/efl_selection.c \
>         $(NULL)
>
>
> diff --git a/src/lib/elementary/Elementary.h b/src/lib/elementary/Elementary.h
> index b5c58c77f7..2e5e4cb5b7 100644
> --- a/src/lib/elementary/Elementary.h
> +++ b/src/lib/elementary/Elementary.h
> @@ -324,6 +324,7 @@ EAPI extern Elm_Version *elm_version;
>  # include "efl_selection_types.eot.h"
>  # include "efl_ui_dnd_types.eot.h"
>  # include <efl_ui_pan.eo.h>
> +# include "efl_selection.eo.h"
>  #endif
>
>  /* include deprecated calls last of all */
> diff --git a/src/lib/elementary/efl_selection.c 
> b/src/lib/elementary/efl_selection.c
> new file mode 100644
> index 0000000000..9f086e340e
> --- /dev/null
> +++ b/src/lib/elementary/efl_selection.c
> @@ -0,0 +1,62 @@
> +#ifdef HAVE_CONFIG_H
> +# include "elementary_config.h"
> +#endif
> +
> +#define EFL_SELECTION_MANAGER_BETA
> +
> +#include <Elementary.h>
> +#include "elm_priv.h"
> +
> +#define MY_CLASS EFL_SELECTION_MIXIN
> +#define MY_CLASS_NAME "Efl.Selection"
> +
> +static inline Eo*
> +_selection_manager_get(Eo *obj)
> +{
> +   Eo *top = elm_widget_top_get(obj);
> +   if (!top)
> +     {
> +        top = obj;
> +     }
> +   Eo *sel_man = efl_key_data_get(top, "__selection_manager");
> +   if (!sel_man)
> +     {
> +        sel_man = efl_add(EFL_SELECTION_MANAGER_CLASS, top);
> +        efl_key_data_set(top, "__selection_manager", sel_man);
> +     }
> +   return sel_man;
> +}
> +
> +EOLIAN static void
> +_efl_selection_selection_get(Eo *obj, void *pd EINA_UNUSED, 
> Efl_Selection_Type type, Efl_Selection_Format format,
> +                                     void *data_func_data, 
> Efl_Selection_Data_Ready data_func, Eina_Free_Cb data_func_free_cb, unsigned 
> int seat)
> +{
> +   Eo *sel_man = _selection_manager_get(obj);
> +   efl_selection_manager_selection_get(sel_man, obj, type, format,
> +                                       data_func_data, data_func,
> +                                       data_func_free_cb, seat);
> +}
> +
> +EOLIAN static Eina_Future *
> +_efl_selection_selection_set(Eo *obj, void *pd EINA_UNUSED, 
> Efl_Selection_Type type, Efl_Selection_Format format, Eina_Slice data, 
> unsigned int seat)
> +{
> +   Eo *sel_man = _selection_manager_get(obj);
> +   return efl_selection_manager_selection_set(sel_man, obj, type, format, 
> data, seat);
> +}
> +
> +EOLIAN static void
> +_efl_selection_selection_clear(Eo *obj, void *pd EINA_UNUSED, 
> Efl_Selection_Type type, unsigned int seat)
> +{
> +   Eo *sel_man = _selection_manager_get(obj);
> +   efl_selection_manager_selection_clear(sel_man, obj, type, seat);
> +}
> +
> +EOLIAN static Eina_Bool
> +_efl_selection_has_owner(Eo *obj, void *pd EINA_UNUSED, Efl_Selection_Type 
> type, unsigned int seat)
> +{
> +    Eo *sel_man = _selection_manager_get(obj);
> +    return efl_selection_manager_selection_has_owner(sel_man, obj, type, 
> seat);
> +}
> +
> +
> +#include "efl_selection.eo.c"
> diff --git a/src/lib/elementary/efl_selection.eo 
> b/src/lib/elementary/efl_selection.eo
> new file mode 100644
> index 0000000000..2f836567a1
> --- /dev/null
> +++ b/src/lib/elementary/efl_selection.eo
> @@ -0,0 +1,45 @@
> +import efl_selection_types;
> +
> +mixin Efl.Selection {
> +   [[Efl Selection class]]
> +   data: null;
> +   methods {
> +      selection_set {
> +         [[Set the selection data to the object]]
> +         params {
> +            @in type: Efl.Selection.Type; [[Selection Type]]
> +            @in format: Efl.Selection.Format; [[Selection Format]]
> +            @in data: Eina.Slice;
> +            @in seat: uint;[[Specified seat for multiple seats case.]]
> +         }
> +         return: ptr(Eina.Future); [[Future for tracking when the selection 
> is lost]]
> +      }
> +      selection_get {
> +         [[Get the data from the object that has selection]]
> +         params {
> +            @in type: Efl.Selection.Type; [[Selection Type]]
> +            @in format: Efl.Selection.Format; [[Selection Format]]
> +            @in data_func: Efl.Selection.Data_Ready; [[Data ready function 
> pointer]]
> +            @in seat: uint;[[Specified seat for multiple seats case.]]
> +         }
> +      }
> +      selection_clear {
> +         [[Clear the selection data from the object]]
> +         params {
> +            @in type: Efl.Selection.Type; [[Selection Type]]
> +            @in seat: uint; [[Specified seat for multiple seats case.]]
> +         }
> +      }
> +      has_owner {
> +         [[Determine whether the selection data has owner]]
> +         params {
> +            @in type: Efl.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]]
> +      }
> +   }
> +   events {
> +      selection,changed; [[Called when display server's selection has 
> changed]]
> +   }
> +}
> diff --git a/src/lib/elementary/efl_selection_manager.c 
> b/src/lib/elementary/efl_selection_manager.c
> index 23bde3bded..6aaf9d8eed 100644
> --- a/src/lib/elementary/efl_selection_manager.c
> +++ b/src/lib/elementary/efl_selection_manager.c
> @@ -753,7 +753,7 @@ _x11_fixes_selection_notify(void *data, int t 
> EINA_UNUSED, void *event)
>     e.type = type;
>     e.seat = 1; /* under x11 this is always the default seat */
>     e.exist = !!ev->owner;
> -   //efl_event_callback_call(sel->owner, 
> EFL_SELECTION_EVENT_SELECTION_CHANGED, &e);
> +   efl_event_callback_call(sel->owner, 
> EFL_SELECTION_EVENT_SELECTION_CHANGED, &e);
>     //ecore_event_add(ELM_CNP_EVENT_SELECTION_CHANGED, e, NULL, NULL);
>
>     return ECORE_CALLBACK_RENEW;
> @@ -2512,7 +2512,7 @@ _wl_selection_changed(void *data, int type EINA_UNUSED, 
> void *event)
>     e.display = 
> ecore_wl2_display_connect(ecore_wl2_display_name_get(ev->display));
>     e.exist = !!ecore_wl2_dnd_selection_get(seat);
>     //ecore_event_add(ELM_CNP_EVENT_SELECTION_CHANGED, e, 
> _wl_selection_changed_free, ev->display);
> -   //efl_event_callback_call(sel->request_obj, 
> EFL_SELECTION_EVENT_SELECTION_CHANGED, &e);
> +   efl_event_callback_call(sel->request_obj, 
> EFL_SELECTION_EVENT_SELECTION_CHANGED, &e);
>
>     return ECORE_CALLBACK_RENEW;
>  }
> diff --git a/src/lib/elementary/efl_ui_widget.eo 
> b/src/lib/elementary/efl_ui_widget.eo
> index f4933d4438..d0c1797c80 100644
> --- a/src/lib/elementary/efl_ui_widget.eo
> +++ b/src/lib/elementary/efl_ui_widget.eo
> @@ -17,7 +17,7 @@ struct Efl.Ui.Widget.Focus_State {
>  abstract Efl.Ui.Widget (Efl.Canvas.Group, Efl.Access,
>                          Efl.Access.Component, Efl.Ui.Focus.User, Efl.Part,
>                          Efl.Ui.Focus.Object, Efl.Ui.Base, Efl.Ui.Cursor,
> -                        Efl.Ui.Translatable)
> +                        Efl.Ui.Translatable, Efl.Selection)
>  {
>     [[Elementary widget abstract class]]
>     legacy_prefix: elm_widget;
>
> --
>
>



-- 
Gustavo Sverzut Barbieri
--------------------------------------
Mobile: +55 (16) 99354-9890

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
enlightenment-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/enlightenment-devel

Reply via email to