Ecore_Wayland: Raise a event when data source cancelled
authorvivek <vivek.ellur@samsung.com>
Fri, 19 Sep 2014 12:42:49 +0000 (08:42 -0400)
committerChris Michael <cp.michael@samsung.com>
Fri, 19 Sep 2014 12:42:49 +0000 (08:42 -0400)
Summary:
  1) Created a event struct for data source cancel event
  2) Raise a event when data source is cancelled

Signed-off-by: vivek <vivek.ellur@samsung.com>
Reviewers: devilhorns

Subscribers: cedric

Differential Revision: https://phab.enlightenment.org/D1465

src/lib/ecore_wayland/Ecore_Wayland.h
src/lib/ecore_wayland/ecore_wl_dnd.c

index 5a8dcf3..455f0a7 100644 (file)
@@ -59,6 +59,7 @@ typedef struct _Ecore_Wl_Event_Dnd_Position Ecore_Wl_Event_Dnd_Position;
 typedef struct _Ecore_Wl_Event_Dnd_Leave Ecore_Wl_Event_Dnd_Leave;
 typedef struct _Ecore_Wl_Event_Dnd_Drop Ecore_Wl_Event_Dnd_Drop;
 typedef struct _Ecore_Wl_Event_Dnd_End Ecore_Wl_Event_Dnd_End;
+typedef struct _Ecore_Wl_Event_Data_Source_Cancelled Ecore_Wl_Event_Data_Source_Cancelled; /** @since 1.12 */
 typedef struct _Ecore_Wl_Event_Data_Source_Send Ecore_Wl_Event_Data_Source_Send; /** @since 1.7 */
 typedef struct _Ecore_Wl_Event_Selection_Data_Ready Ecore_Wl_Event_Selection_Data_Ready; /** @since 1.7 */
 typedef struct _Ecore_Wl_Event_Interfaces_Bound Ecore_Wl_Event_Interfaces_Bound;
@@ -183,6 +184,12 @@ struct _Ecore_Wl_Event_Dnd_End
    unsigned int win, source;
 };
 
+/** @since 1.12 */
+struct _Ecore_Wl_Event_Data_Source_Cancelled
+{
+   unsigned int win, source;
+};
+
 /** @since 1.7 */
 struct _Ecore_Wl_Event_Data_Source_Send
 {
index 7136ba5..c816e9d 100644 (file)
@@ -767,14 +767,24 @@ static void
 _ecore_wl_dnd_source_cb_cancelled(void *data, struct wl_data_source *source)
 {
    Ecore_Wl_Input *input;
+   Ecore_Wl_Event_Data_Source_Cancelled *ev;
 
    LOGFN(__FILE__, __LINE__, __FUNCTION__);
 
    if (!(input = data)) return;
 
-   /* FIXME: Raise an Ecore_Wl_Event here */
    wl_data_source_destroy(source);
    if (input->data_source == source) input->data_source = NULL;
+
+   if (!(ev = calloc(1, sizeof(Ecore_Wl_Event_Data_Source_Cancelled)))) return;
+
+   if (input->pointer_focus)
+     ev->win = input->pointer_focus->id;
+
+   if (input->keyboard_focus)
+     ev->source = input->keyboard_focus->id;
+
+   ecore_event_add(ECORE_WL_EVENT_DATA_SOURCE_CANCELLED, ev, NULL, NULL);
 }
 
 static void