forked from enlightenment/efl
ecore-wl2: add display object to all events
this is required in order to determine which connection an event originated from
This commit is contained in:
parent
1a7279f72e
commit
05fd3771e7
|
@ -75,6 +75,7 @@ typedef struct _Ecore_Wl2_Global
|
|||
{
|
||||
Eina_Stringshare *interface;
|
||||
unsigned int id, version;
|
||||
Ecore_Wl2_Display *display;
|
||||
} Ecore_Wl2_Global;
|
||||
|
||||
typedef struct _Ecore_Wl2_Event_Global
|
||||
|
@ -89,6 +90,7 @@ typedef struct _Ecore_Wl2_Event_Focus_In
|
|||
unsigned int window;
|
||||
unsigned int timestamp;
|
||||
Eo *dev; //The seat device
|
||||
Ecore_Wl2_Display *display;
|
||||
} Ecore_Wl2_Event_Focus_In;
|
||||
|
||||
typedef struct _Ecore_Wl2_Event_Focus_Out
|
||||
|
@ -96,6 +98,7 @@ typedef struct _Ecore_Wl2_Event_Focus_Out
|
|||
unsigned int window;
|
||||
unsigned int timestamp;
|
||||
Eo *dev; //The seat device
|
||||
Ecore_Wl2_Display *display;
|
||||
} Ecore_Wl2_Event_Focus_Out;
|
||||
|
||||
typedef struct _Ecore_Wl2_Event_Dnd_Enter
|
||||
|
@ -104,6 +107,7 @@ typedef struct _Ecore_Wl2_Event_Dnd_Enter
|
|||
Ecore_Wl2_Offer *offer;
|
||||
int x, y;
|
||||
unsigned int seat;
|
||||
Ecore_Wl2_Display *display;
|
||||
} Ecore_Wl2_Event_Dnd_Enter;
|
||||
|
||||
typedef struct _Ecore_Wl2_Event_Dnd_Leave
|
||||
|
@ -111,6 +115,7 @@ typedef struct _Ecore_Wl2_Event_Dnd_Leave
|
|||
unsigned int win, source;
|
||||
Ecore_Wl2_Offer *offer;
|
||||
unsigned int seat;
|
||||
Ecore_Wl2_Display *display;
|
||||
} Ecore_Wl2_Event_Dnd_Leave;
|
||||
|
||||
typedef struct _Ecore_Wl2_Event_Dnd_Motion
|
||||
|
@ -119,6 +124,7 @@ typedef struct _Ecore_Wl2_Event_Dnd_Motion
|
|||
Ecore_Wl2_Offer *offer;
|
||||
int x, y;
|
||||
unsigned int seat;
|
||||
Ecore_Wl2_Display *display;
|
||||
} Ecore_Wl2_Event_Dnd_Motion;
|
||||
|
||||
typedef struct _Ecore_Wl2_Event_Dnd_Drop
|
||||
|
@ -127,12 +133,14 @@ typedef struct _Ecore_Wl2_Event_Dnd_Drop
|
|||
int x, y;
|
||||
Ecore_Wl2_Offer *offer;
|
||||
unsigned int seat;
|
||||
Ecore_Wl2_Display *display;
|
||||
} Ecore_Wl2_Event_Dnd_Drop;
|
||||
|
||||
typedef struct _Ecore_Wl2_Event_Dnd_End
|
||||
{
|
||||
unsigned int win, source;
|
||||
unsigned int seat;
|
||||
Ecore_Wl2_Display *display;
|
||||
} Ecore_Wl2_Event_Dnd_End;
|
||||
|
||||
struct _Ecore_Wl2_Event_Data_Source_Event
|
||||
|
@ -141,6 +149,7 @@ struct _Ecore_Wl2_Event_Data_Source_Event
|
|||
Ecore_Wl2_Drag_Action action;
|
||||
unsigned int seat;
|
||||
uint32_t serial;
|
||||
Ecore_Wl2_Display *display;
|
||||
};
|
||||
|
||||
typedef struct _Ecore_Wl2_Event_Data_Source_Event Ecore_Wl2_Event_Data_Source_End;
|
||||
|
@ -151,6 +160,7 @@ typedef struct _Ecore_Wl2_Event_Data_Source_Target
|
|||
{
|
||||
char *type;
|
||||
unsigned int seat;
|
||||
Ecore_Wl2_Display *display;
|
||||
} Ecore_Wl2_Event_Data_Source_Target;
|
||||
|
||||
typedef struct _Ecore_Wl2_Event_Data_Source_Send
|
||||
|
@ -159,12 +169,14 @@ typedef struct _Ecore_Wl2_Event_Data_Source_Send
|
|||
int fd;
|
||||
unsigned int seat;
|
||||
uint32_t serial;
|
||||
Ecore_Wl2_Display *display;
|
||||
} Ecore_Wl2_Event_Data_Source_Send;
|
||||
|
||||
typedef struct _Ecore_Wl2_Event_Seat_Name
|
||||
{
|
||||
Eina_Stringshare *name;
|
||||
unsigned int id;
|
||||
Ecore_Wl2_Display *display;
|
||||
} Ecore_Wl2_Event_Seat_Name;
|
||||
|
||||
typedef struct _Ecore_Wl2_Event_Seat_Capabilities
|
||||
|
@ -173,6 +185,7 @@ typedef struct _Ecore_Wl2_Event_Seat_Capabilities
|
|||
Eina_Bool pointer_enabled : 1;
|
||||
Eina_Bool keyboard_enabled : 1;
|
||||
Eina_Bool touch_enabled : 1;
|
||||
Ecore_Wl2_Display *display;
|
||||
} Ecore_Wl2_Event_Seat_Capabilities;
|
||||
|
||||
typedef enum
|
||||
|
@ -228,6 +241,7 @@ typedef struct _Ecore_Wl2_Event_Offer_Data_Ready
|
|||
int len;
|
||||
const char *mimetype;
|
||||
unsigned int seat;
|
||||
Ecore_Wl2_Display *display;
|
||||
} Ecore_Wl2_Event_Offer_Data_Ready;
|
||||
|
||||
typedef enum _Ecore_Wl2_Window_Type
|
||||
|
|
|
@ -80,6 +80,7 @@ data_source_target_free(void *data EINA_UNUSED, void *event)
|
|||
if (!ev) return;
|
||||
|
||||
free(ev->type);
|
||||
ecore_wl2_display_disconnect(ev->display);
|
||||
free(ev);
|
||||
}
|
||||
|
||||
|
@ -95,6 +96,8 @@ data_source_target(void *data, struct wl_data_source *source EINA_UNUSED, const
|
|||
ev = calloc(1, sizeof(Ecore_Wl2_Event_Data_Source_Target));
|
||||
if (!ev) return;
|
||||
ev->seat = input->id;
|
||||
ev->display = input->display;
|
||||
ev->display->refs++;
|
||||
|
||||
if (mime_type) ev->type = strdup(mime_type);
|
||||
|
||||
|
@ -134,6 +137,8 @@ data_source_send(void *data, struct wl_data_source *source, const char *mime_typ
|
|||
ev->serial = input->data.selection.serial;
|
||||
else
|
||||
ev->serial = input->data.drag.serial;
|
||||
ev->display = input->display;
|
||||
ev->display->refs++;
|
||||
|
||||
ecore_event_add(ECORE_WL2_EVENT_DATA_SOURCE_SEND, ev,
|
||||
data_source_send_free, NULL);
|
||||
|
@ -149,6 +154,8 @@ event_fill(struct _Ecore_Wl2_Event_Data_Source_Event *ev, Ecore_Wl2_Input *input
|
|||
ev->action = input->data.drag.action;
|
||||
ev->seat = input->id;
|
||||
ev->serial = input->data.drag.serial;
|
||||
ev->display = input->display;
|
||||
ev->display->refs++;
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -161,7 +168,7 @@ data_source_event_emit(Ecore_Wl2_Input *input, int event, Eina_Bool cancel)
|
|||
|
||||
event_fill((void*)ev, input);
|
||||
|
||||
ecore_event_add(event, ev, NULL, NULL);
|
||||
ecore_event_add(event, ev, _display_event_free, ev->display);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -215,10 +222,11 @@ static void
|
|||
_unset_serial(void *user_data, void *event)
|
||||
{
|
||||
Ecore_Wl2_Offer *offer = user_data;
|
||||
Ecore_Wl2_Event_Dnd_Enter *ev = event;
|
||||
|
||||
if (offer)
|
||||
offer->serial = 0;
|
||||
|
||||
ecore_wl2_display_disconnect(ev->display);
|
||||
free(event);
|
||||
}
|
||||
|
||||
|
@ -269,6 +277,8 @@ _ecore_wl2_dnd_enter(Ecore_Wl2_Input *input, struct wl_data_offer *offer, struct
|
|||
ev->y = y;
|
||||
ev->offer = input->drag;
|
||||
ev->seat = input->id;
|
||||
ev->display = input->display;
|
||||
ev->display->refs++;
|
||||
|
||||
ecore_event_add(ECORE_WL2_EVENT_DND_ENTER, ev, _unset_serial, input->drag);
|
||||
}
|
||||
|
@ -277,10 +287,11 @@ static void
|
|||
_delay_offer_destroy(void *user_data, void *event)
|
||||
{
|
||||
Ecore_Wl2_Offer *offer = user_data;
|
||||
Ecore_Wl2_Event_Dnd_Leave *ev = event;
|
||||
|
||||
if (offer)
|
||||
_ecore_wl2_offer_unref(offer);
|
||||
|
||||
ecore_wl2_display_disconnect(ev->display);
|
||||
free(event);
|
||||
}
|
||||
|
||||
|
@ -299,6 +310,8 @@ _ecore_wl2_dnd_leave(Ecore_Wl2_Input *input)
|
|||
ev->offer = input->drag;
|
||||
ev->offer->ref++;
|
||||
ev->seat = input->id;
|
||||
ev->display = input->display;
|
||||
ev->display->refs++;
|
||||
|
||||
input->drag->window_id = 0;
|
||||
ecore_event_add(ECORE_WL2_EVENT_DND_LEAVE, ev, _delay_offer_destroy, ev->offer);
|
||||
|
@ -326,6 +339,8 @@ _ecore_wl2_dnd_motion(Ecore_Wl2_Input *input, int x, int y, uint32_t serial)
|
|||
ev->y = y;
|
||||
ev->offer = input->drag;
|
||||
ev->seat = input->id;
|
||||
ev->display = input->display;
|
||||
ev->display->refs++;
|
||||
|
||||
ecore_event_add(ECORE_WL2_EVENT_DND_MOTION, ev, _unset_serial, input->drag);
|
||||
}
|
||||
|
@ -346,8 +361,10 @@ _ecore_wl2_dnd_drop(Ecore_Wl2_Input *input)
|
|||
ev->y = input->pointer.sy;
|
||||
ev->offer = input->drag;
|
||||
ev->seat = input->id;
|
||||
ev->display = input->display;
|
||||
ev->display->refs++;
|
||||
|
||||
ecore_event_add(ECORE_WL2_EVENT_DND_DROP, ev, NULL, NULL);
|
||||
ecore_event_add(ECORE_WL2_EVENT_DND_DROP, ev, _display_event_free, ev->display);
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -720,12 +737,14 @@ static void
|
|||
_free_buf(void *user_data, void *event)
|
||||
{
|
||||
Read_Buffer *buf = user_data;
|
||||
Ecore_Wl2_Event_Offer_Data_Ready *ev = event;
|
||||
|
||||
_ecore_wl2_offer_unref(buf->offer);
|
||||
|
||||
free(buf->data);
|
||||
free(buf->mimetype);
|
||||
free(user_data);
|
||||
ecore_wl2_display_disconnect(ev->display);
|
||||
free(event);
|
||||
}
|
||||
|
||||
|
@ -764,6 +783,8 @@ _offer_receive_fd_cb(void *data, Ecore_Fd_Handler *fdh)
|
|||
ev->len = buf->len;
|
||||
ev->mimetype = buf->mimetype;
|
||||
ev->seat = buf->offer->input->id;
|
||||
ev->display = buf->offer->input->display;
|
||||
ev->display->refs++;
|
||||
ecore_event_add(ECORE_WL2_EVENT_OFFER_DATA_READY, ev, _free_buf, buf);
|
||||
|
||||
buf->offer->reads = eina_list_remove(buf->offer->reads, fdh);
|
||||
|
|
|
@ -408,6 +408,16 @@ _ecore_wl2_input_mouse_up_send(Ecore_Wl2_Input *input, Ecore_Wl2_Window *window,
|
|||
_input_event_cb_free, ev->dev);
|
||||
}
|
||||
|
||||
static void
|
||||
_input_event_focus_cb_free(void *data, void *event)
|
||||
{
|
||||
Ecore_Wl2_Event_Focus_In *ev = event;
|
||||
if (data)
|
||||
efl_unref(data);
|
||||
ecore_wl2_display_disconnect(ev->display);
|
||||
free(event);
|
||||
}
|
||||
|
||||
void
|
||||
_ecore_wl2_input_focus_in_send(Ecore_Wl2_Window *window)
|
||||
{
|
||||
|
@ -423,7 +433,9 @@ _ecore_wl2_input_focus_in_send(Ecore_Wl2_Window *window)
|
|||
ev->timestamp = input->timestamp;
|
||||
ev->window = window->id;
|
||||
ev->dev = _ecore_wl2_seat_dev_get(input, window->id);
|
||||
ecore_event_add(ECORE_WL2_EVENT_FOCUS_IN, ev, _input_event_cb_free,
|
||||
ev->display = input->display;
|
||||
ev->display->refs++;
|
||||
ecore_event_add(ECORE_WL2_EVENT_FOCUS_IN, ev, _input_event_focus_cb_free,
|
||||
ev->dev);
|
||||
}
|
||||
|
||||
|
@ -442,7 +454,9 @@ _ecore_wl2_input_focus_out_send(Ecore_Wl2_Window *window)
|
|||
ev->timestamp = input->timestamp;
|
||||
ev->window = window->id;
|
||||
ev->dev = _ecore_wl2_seat_dev_get(input, window->id);
|
||||
ecore_event_add(ECORE_WL2_EVENT_FOCUS_OUT, ev, _input_event_cb_free,
|
||||
ev->display = input->display;
|
||||
ev->display->refs++;
|
||||
ecore_event_add(ECORE_WL2_EVENT_FOCUS_OUT, ev, _input_event_focus_cb_free,
|
||||
ev->dev);
|
||||
}
|
||||
|
||||
|
@ -1260,8 +1274,10 @@ _seat_cb_capabilities(void *data, struct wl_seat *seat, enum wl_seat_capability
|
|||
ev->pointer_enabled = !!(caps & WL_SEAT_CAPABILITY_POINTER);
|
||||
ev->keyboard_enabled = !!(caps & WL_SEAT_CAPABILITY_KEYBOARD);
|
||||
ev->touch_enabled = !!(caps & WL_SEAT_CAPABILITY_TOUCH);
|
||||
ev->display = input->display;
|
||||
ev->display->refs++;
|
||||
|
||||
ecore_event_add(ECORE_WL2_EVENT_SEAT_CAPABILITIES_CHANGED, ev, NULL, NULL);
|
||||
ecore_event_add(ECORE_WL2_EVENT_SEAT_CAPABILITIES_CHANGED, ev, _display_event_free, ev->display);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -1271,6 +1287,7 @@ _cb_seat_event_free(void *data EINA_UNUSED, void *event)
|
|||
|
||||
ev = event;
|
||||
eina_stringshare_del(ev->name);
|
||||
ecore_wl2_display_disconnect(ev->display);
|
||||
free(ev);
|
||||
}
|
||||
|
||||
|
@ -1288,6 +1305,8 @@ _seat_cb_name(void *data, struct wl_seat *seat EINA_UNUSED, const char *name)
|
|||
|
||||
ev->id = input->id;
|
||||
ev->name = eina_stringshare_add(name);
|
||||
ev->display = input->display;
|
||||
ev->display->refs++;
|
||||
|
||||
ecore_event_add(ECORE_WL2_EVENT_SEAT_NAME_CHANGED, ev,
|
||||
_cb_seat_event_free, NULL);
|
||||
|
|
Loading…
Reference in New Issue