ecore-wl2: add 'cancelled' to Ecore_Wl2_Event_Data_Source_End
authorMike Blumenkrantz <zmike@osg.samsung.com>
Fri, 12 May 2017 16:08:32 +0000 (12:08 -0400)
committerMike Blumenkrantz <zmike@osg.samsung.com>
Fri, 12 May 2017 16:08:25 +0000 (12:08 -0400)
it's impossible to know the result of a drag operation without this
member

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

index 1dbfbd4..9c3e959 100644 (file)
@@ -152,7 +152,15 @@ struct _Ecore_Wl2_Event_Data_Source_Event
    Ecore_Wl2_Display *display;
 };
 
-typedef struct _Ecore_Wl2_Event_Data_Source_Event Ecore_Wl2_Event_Data_Source_End;
+typedef struct Ecore_Wl2_Event_Data_Source_End
+{
+   unsigned int win, source;
+   Ecore_Wl2_Drag_Action action;
+   unsigned int seat;
+   uint32_t serial;
+   Ecore_Wl2_Display *display;
+   Eina_Bool cancelled;
+} Ecore_Wl2_Event_Data_Source_End;
 typedef struct _Ecore_Wl2_Event_Data_Source_Event Ecore_Wl2_Event_Data_Source_Drop;
 typedef struct _Ecore_Wl2_Event_Data_Source_Event Ecore_Wl2_Event_Data_Source_Action;
 
index 3c52694..132eeb3 100644 (file)
@@ -162,11 +162,20 @@ static void
 data_source_event_emit(Ecore_Wl2_Input *input, int event, Eina_Bool cancel)
 {
    struct _Ecore_Wl2_Event_Data_Source_Event *ev;
+   Ecore_Wl2_Event_Data_Source_End *ev2;
 
-   ev = calloc(1, sizeof(struct _Ecore_Wl2_Event_Data_Source_Event));
+   if (event == ECORE_WL2_EVENT_DATA_SOURCE_END)
+     {
+        ev2 = calloc(1, sizeof(Ecore_Wl2_Event_Data_Source_End));
+        ev = (void*)ev2;
+     }
+   else
+     ev = calloc(1, sizeof(struct _Ecore_Wl2_Event_Data_Source_Event));
    EINA_SAFETY_ON_NULL_RETURN(ev);
 
    event_fill((void*)ev, input);
+   if (event == ECORE_WL2_EVENT_DATA_SOURCE_END)
+     ev2->cancelled = cancel;
 
    ecore_event_add(event, ev, _display_event_free, ev->display);
 }
@@ -179,14 +188,14 @@ data_source_cancelled(void *data, struct wl_data_source *source)
    if (input->data.drag.source == source) input->data.drag.source = NULL;
    input->data.drag.action = WL_DATA_DEVICE_MANAGER_DND_ACTION_NONE;
    wl_data_source_destroy(source);
-   data_source_event_emit(input, ECORE_WL2_EVENT_DATA_SOURCE_END);
+   data_source_event_emit(input, ECORE_WL2_EVENT_DATA_SOURCE_END, 1);
 }
 
 static void
 data_source_dnd_drop_performed(void *data, struct wl_data_source *source EINA_UNUSED)
 {
    Ecore_Wl2_Input *input = data;
-   data_source_event_emit(input, ECORE_WL2_EVENT_DATA_SOURCE_DROP);
+   data_source_event_emit(input, ECORE_WL2_EVENT_DATA_SOURCE_DROP, 0);
 }
 
 static void
@@ -196,7 +205,7 @@ data_source_dnd_finished(void *data, struct wl_data_source *source)
 
    if (input->data.drag.source == source) input->data.drag.source = NULL;
    wl_data_source_destroy(source);
-   data_source_event_emit(input, ECORE_WL2_EVENT_DATA_SOURCE_END);
+   data_source_event_emit(input, ECORE_WL2_EVENT_DATA_SOURCE_END, 0);
 }
 
 static void
@@ -205,7 +214,7 @@ data_source_action(void *data, struct wl_data_source *source EINA_UNUSED, uint32
    Ecore_Wl2_Input *input = data;
 
    input->data.drag.action = dnd_action;
-   data_source_event_emit(input, ECORE_WL2_EVENT_DATA_SOURCE_ACTION);
+   data_source_event_emit(input, ECORE_WL2_EVENT_DATA_SOURCE_ACTION, 0);
 }
 
 static const struct wl_data_source_listener _source_listener =