discomfitor pushed a commit to branch master.

http://git.enlightenment.org/core/efl.git/commit/?id=19239b9251aedb1f4d553bcdeae67b4e937a2190

commit 19239b9251aedb1f4d553bcdeae67b4e937a2190
Author: Mike Blumenkrantz <zm...@osg.samsung.com>
Date:   Wed Apr 20 11:11:34 2016 -0400

    ecore-wl2: update wl dnd/clipboard support to v3 of protocol
    
    this code is mostly copied from weston:
    78d4bf9a3ec990dceee23fd53962a69891352a0e
    9c93179023fe894e417ccd20533d72d672d976fc
    
    credit to Carlos Garnacho <carl...@gnome.org> as original author
    
    fix T3455
    
    @feature
---
 src/lib/ecore_wl2/ecore_wl2_display.c |  3 ++-
 src/lib/ecore_wl2/ecore_wl2_dnd.c     | 27 ++++++++++++++++++++++++++-
 src/lib/ecore_wl2/ecore_wl2_private.h |  3 +++
 3 files changed, 31 insertions(+), 2 deletions(-)

diff --git a/src/lib/ecore_wl2/ecore_wl2_display.c 
b/src/lib/ecore_wl2/ecore_wl2_display.c
index 27f7bc8..ed7ee71 100644
--- a/src/lib/ecore_wl2/ecore_wl2_display.c
+++ b/src/lib/ecore_wl2/ecore_wl2_display.c
@@ -115,8 +115,9 @@ _cb_global_add(void *data, struct wl_registry *registry, 
unsigned int id, const
      }
    else if (!strcmp(interface, "wl_data_device_manager"))
      {
+        ewd->wl.data_device_manager_version = MIN(version, 3);
         ewd->wl.data_device_manager =
-          wl_registry_bind(registry, id, &wl_data_device_manager_interface, 1);
+          wl_registry_bind(registry, id, &wl_data_device_manager_interface, 
ewd->wl.data_device_manager_version);
      }
    else if (!strcmp(interface, "wl_shell"))
      {
diff --git a/src/lib/ecore_wl2/ecore_wl2_dnd.c 
b/src/lib/ecore_wl2/ecore_wl2_dnd.c
index 4aca1f0..439ca8f 100644
--- a/src/lib/ecore_wl2/ecore_wl2_dnd.c
+++ b/src/lib/ecore_wl2/ecore_wl2_dnd.c
@@ -56,9 +56,28 @@ _offer_cb_offer(void *data, struct wl_data_offer *offer 
EINA_UNUSED, const char
    if (t) *t = strdup(type);
 }
 
+
+static void
+data_offer_source_actions(void *data, struct wl_data_offer *wl_data_offer 
EINA_UNUSED, uint32_t source_actions)
+{
+   Ecore_Wl2_Dnd_Source *source = data;
+
+   source->source_actions = source_actions;
+}
+
+static void
+data_offer_action(void *data, struct wl_data_offer *wl_data_offer EINA_UNUSED, 
uint32_t dnd_action)
+{
+   Ecore_Wl2_Dnd_Source *source = data;
+
+   source->dnd_action = dnd_action;
+}
+
 static const struct wl_data_offer_listener _offer_listener =
 {
-   _offer_cb_offer
+   _offer_cb_offer,
+   data_offer_source_actions,
+   data_offer_action
 };
 
 static void
@@ -321,6 +340,12 @@ _ecore_wl2_dnd_enter(Ecore_Wl2_Input *input, struct 
wl_data_offer *offer, struct
         input->drag.source = wl_data_offer_get_user_data(offer);
         num = (input->drag.source->types.size / sizeof(char *));
         types = input->drag.source->types.data;
+        if (input->display->wl.data_device_manager_version >=
+            WL_DATA_OFFER_SET_ACTIONS_SINCE_VERSION)
+          wl_data_offer_set_actions(offer,
+               WL_DATA_DEVICE_MANAGER_DND_ACTION_COPY |
+               WL_DATA_DEVICE_MANAGER_DND_ACTION_MOVE,
+               WL_DATA_DEVICE_MANAGER_DND_ACTION_MOVE);
      }
    else
      {
diff --git a/src/lib/ecore_wl2/ecore_wl2_private.h 
b/src/lib/ecore_wl2/ecore_wl2_private.h
index 0de0190..c1a4e6a 100644
--- a/src/lib/ecore_wl2/ecore_wl2_private.h
+++ b/src/lib/ecore_wl2/ecore_wl2_private.h
@@ -74,6 +74,7 @@ struct _Ecore_Wl2_Display
         struct wl_compositor *compositor;
         struct wl_subcompositor *subcompositor;
         struct wl_data_device_manager *data_device_manager;
+        int data_device_manager_version;
         struct wl_shm *shm;
         struct zwp_linux_dmabuf_v1 *dmabuf;
         struct wl_shell *wl_shell;
@@ -178,6 +179,8 @@ typedef struct _Ecore_Wl2_Dnd_Source
 
    struct wl_data_offer *offer;
    struct wl_array types;
+   uint32_t dnd_action;
+   uint32_t source_actions;
 } Ecore_Wl2_Dnd_Source;
 
 

-- 


Reply via email to