ecore_wl2: save action of data source in seperated field
authorMarcel Hollerbach <marcel-hollerbach@t-online.de>
Thu, 22 Sep 2016 07:26:02 +0000 (09:26 +0200)
committerMarcel Hollerbach <marcel-hollerbach@t-online.de>
Fri, 23 Sep 2016 09:14:41 +0000 (11:14 +0200)
the drag.source is only available if the drag is happing inside the same
client.

So for the case there are two efl apps (A,B) , where A started the dnd and
the B is currently entered by the dnd, then A has the data source, and B
has the offer, if B sets a action on the offer A tried to set it on a
field which does not exist there, this fixes that. It saves the action
to a undepended field.

src/lib/ecore_wl2/ecore_wl2_dnd.c
src/lib/ecore_wl2/ecore_wl2_private.h

index 628d25a..74299f3 100644 (file)
@@ -153,8 +153,8 @@ data_source_event_emit(Ecore_Wl2_Input *input, int event)
      ev->source = input->focus.keyboard->id;
 
    if (!ev->win) ev->win = ev->source;
-   if (input->drag.source)
-     ev->action = input->drag.source->dnd_action;
+
+   ev->action = input->data.action;
 
    ecore_event_add(event, ev, NULL, NULL);
 }
@@ -164,9 +164,8 @@ data_source_cancelled(void *data, struct wl_data_source *source)
 {
    Ecore_Wl2_Input *input = data;
 
-   if (input->drag.source)
-     input->drag.source->dnd_action = 0;
    if (input->data.source == source) input->data.source = NULL;
+   input->data.action = WL_DATA_DEVICE_MANAGER_DND_ACTION_NONE;
    wl_data_source_destroy(source);
    data_source_event_emit(input, ECORE_WL2_EVENT_DATA_SOURCE_END);
 }
@@ -193,8 +192,7 @@ data_source_action(void *data, struct wl_data_source *source EINA_UNUSED, uint32
 {
    Ecore_Wl2_Input *input = data;
 
-   if (input->drag.source)
-     input->drag.source->dnd_action = dnd_action;
+   input->data.action = dnd_action;
    data_source_event_emit(input, ECORE_WL2_EVENT_DATA_SOURCE_ACTION);
 }
 
index 59f63fc..c15c681 100644 (file)
@@ -345,6 +345,7 @@ struct _Ecore_Wl2_Input
         struct wl_data_device *device;
         struct wl_data_source *source;
         struct wl_array types;
+        uint32_t action;
      } data;
 
    struct