Ecore_Wayland: Raise a event when data source cancelled

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
This commit is contained in:
vivek 2014-09-19 08:42:49 -04:00 committed by Chris Michael
parent e096a3490b
commit 0e9a691d62
2 changed files with 18 additions and 1 deletions

View 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
{

View 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