summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThiep Ha <thiepha@gmail.com>2017-12-06 17:31:48 +0900
committerThiep Ha <thiepha@gmail.com>2017-12-08 11:17:23 +0900
commite8aab94ee6b63125e3f558b9a40060dc9e9a7a0e (patch)
treeb840eb92190b855b84b011a057f8f1fba63326c7
parenta13525f2f7400a4e565fc67c7d1acbe5960cc6a7 (diff)
downloadefl-e8aab94ee6b63125e3f558b9a40060dc9e9a7a0e.tar.gz
add selection_has_owner api
-rw-r--r--src/lib/efl/interfaces/efl_selection.eo6
-rw-r--r--src/lib/elementary/efl_cnp.c8
-rw-r--r--src/lib/elementary/efl_cnp.eo1
-rw-r--r--src/lib/elementary/efl_selection_manager.c21
-rw-r--r--src/lib/elementary/efl_selection_manager.eo11
-rw-r--r--src/lib/elementary/efl_selection_manager_private.h2
6 files changed, 42 insertions, 7 deletions
diff --git a/src/lib/efl/interfaces/efl_selection.eo b/src/lib/efl/interfaces/efl_selection.eo
index a5805c3bbd..eaa71f6cd5 100644
--- a/src/lib/efl/interfaces/efl_selection.eo
+++ b/src/lib/efl/interfaces/efl_selection.eo
@@ -31,6 +31,12 @@ interface Efl.Selection {
@in seat: uint @optional; [[Specified seat for multiple seats case.]]
}
}
+ has_owner {
+ params {
+ @in seat: uint @optional; [[Specified seat for multiple seats case.]]
+ }
+ return: bool;
+ }
/*selection_loss_feedback { //name!!!
params {
@in type: Efl.Selection.Type; [[Selection type]]
diff --git a/src/lib/elementary/efl_cnp.c b/src/lib/elementary/efl_cnp.c
index 8ee97e55eb..ff8ad276de 100644
--- a/src/lib/elementary/efl_cnp.c
+++ b/src/lib/elementary/efl_cnp.c
@@ -61,6 +61,14 @@ _efl_cnp_efl_selection_selection_clear(Eo *obj, Efl_Cnp_Data *pd, Efl_Selection_
efl_selection_manager_selection_clear(sel_man, obj, type, seat);
}
+EOLIAN static Eina_Bool
+_efl_cnp_efl_selection_has_owner(Eo *obj, Efl_Cnp_Data *pd, unsigned int seat)
+{
+ ERR("In");
+ Eo *sel_man = _selection_manager_get(obj);
+ return efl_selection_manager_selection_has_owner(sel_man, obj, seat);
+}
+
//issue: selection clear only come with window-level
//if a window has two entries, selection moves from one entry to the other
//the selection clear does not come (still in that window)
diff --git a/src/lib/elementary/efl_cnp.eo b/src/lib/elementary/efl_cnp.eo
index e1073f4cad..a0c57a08d5 100644
--- a/src/lib/elementary/efl_cnp.eo
+++ b/src/lib/elementary/efl_cnp.eo
@@ -10,6 +10,7 @@ mixin Efl.Cnp (Efl.Selection) {
Efl.Selection.selection_set;
Efl.Selection.selection_get;
Efl.Selection.selection_clear;
+ Efl.Selection.has_owner;
//Efl.Selection.selection_loss_feedback;
}
/*events {
diff --git a/src/lib/elementary/efl_selection_manager.c b/src/lib/elementary/efl_selection_manager.c
index 3d44c6665c..ff98256557 100644
--- a/src/lib/elementary/efl_selection_manager.c
+++ b/src/lib/elementary/efl_selection_manager.c
@@ -3918,6 +3918,7 @@ _efl_selection_manager_selection_set(Eo *obj, Efl_Selection_Manager_Data *pd,
#endif
}
+//TODO: add support for local
EOLIAN static void
_efl_selection_manager_selection_get(Eo *obj, Efl_Selection_Manager_Data *pd,
Efl_Object *owner, Efl_Selection_Type type,
@@ -3997,6 +3998,24 @@ _efl_selection_manager_selection_clear(Eo *obj, Efl_Selection_Manager_Data *pd,
#endif
}
+EOLIAN static Eina_Bool
+_efl_selection_manager_selection_has_owner(Eo *obj, Efl_Selection_Manager_Data *pd,
+ Efl_Object *request, unsigned int seat)
+{
+#ifdef HAVE_ELEMENTARY_X
+ if (_x11_xwin_get(request))
+ return !!ecore_x_selection_owner_get(ECORE_X_ATOM_SELECTION_CLIPBOARD);
+#endif
+#ifdef HAVE_ELEMENTARY_WL2
+ Ecore_Wl2_Window *win;
+
+ win = _wl_window_get(request);
+ if (win)
+ return !!ecore_wl2_dnd_selection_get(_wl_default_seat_get(win, request));
+#endif
+ return EINA_FALSE;
+}
+
/*
EOLIAN static Efl_Future *
_efl_selection_manager_selection_loss_feedback(Eo *obj, Efl_Selection_Manager_Data *pd,
@@ -4252,7 +4271,7 @@ _efl_selection_manager_drag_item_container_del(Eo *obj, Efl_Selection_Manager_Da
_item_container_del_internal(dc, EINA_TRUE);
}
-static Efl_Object *
+static Eo *
_efl_selection_manager_efl_object_constructor(Eo *obj, Efl_Selection_Manager_Data *pd)
{
obj = efl_constructor(efl_super(obj, MY_CLASS));
diff --git a/src/lib/elementary/efl_selection_manager.eo b/src/lib/elementary/efl_selection_manager.eo
index bcd190f2f6..a4078f2dd0 100644
--- a/src/lib/elementary/efl_selection_manager.eo
+++ b/src/lib/elementary/efl_selection_manager.eo
@@ -29,13 +29,14 @@ class Efl.Selection.Manager (Efl.Object, Efl.Selection, Efl.Dnd) {
@in seat: uint @optional; [[Specified seat for multiple seats case.]]
}
}
- /*selection_loss_feedback { //name!!!: xxx_set
+ selection_has_owner {
+ [[Check if the request object has selection or not]]
params {
- @in owner: Efl.Object; [[Seleciton owner]]
- @in type: Efl.Selection.Type; [[Selection type]]
+ @in request: Efl.Object; [[the request object]]
+ @in seat: uint @optional; [[Specified seat for multiple seats case.]]
}
- return: future<generic_value>; [[Future of selection that is ready]]
- }*/
+ return: bool; [[EINA_TRUE if the request object has selection, otherwise, EINA_FALSE]]
+ }
drag_start {
[[This starts a drag and drop process at the drag side.
During dragging, there are three events emitted as belows:
diff --git a/src/lib/elementary/efl_selection_manager_private.h b/src/lib/elementary/efl_selection_manager_private.h
index caaa702975..33534cfe7a 100644
--- a/src/lib/elementary/efl_selection_manager_private.h
+++ b/src/lib/elementary/efl_selection_manager_private.h
@@ -271,7 +271,7 @@ Sel_Manager_Wl_Format_Translation sm_wl_convertion[] = {
struct _Efl_Selection_Manager_Data
{
- Efl_Object *sel_man;
+ Eo *sel_man;
#ifdef HAVE_ELEMENTARY_X
Ecore_Event_Handler *notify_handler;
Ecore_Event_Handler *clear_handler;