forked from enlightenment/efl
ecore-wl2: update wl dnd/clipboard support to v3 of protocol
this code is mostly copied from weston: 78d4bf9a3ec990dceee23fd53962a69891352a0e 9c93179023fe894e417ccd20533d72d672d976fc credit to Carlos Garnacho <carlosg@gnome.org> as original author fix T3455 @feature
This commit is contained in:
parent
1f6746cedb
commit
19239b9251
|
@ -115,8 +115,9 @@ _cb_global_add(void *data, struct wl_registry *registry, unsigned int id, const
|
|||
}
|
||||
else if (!strcmp(interface, "wl_data_device_manager"))
|
||||
{
|
||||
ewd->wl.data_device_manager_version = MIN(version, 3);
|
||||
ewd->wl.data_device_manager =
|
||||
wl_registry_bind(registry, id, &wl_data_device_manager_interface, 1);
|
||||
wl_registry_bind(registry, id, &wl_data_device_manager_interface, ewd->wl.data_device_manager_version);
|
||||
}
|
||||
else if (!strcmp(interface, "wl_shell"))
|
||||
{
|
||||
|
|
|
@ -56,9 +56,28 @@ _offer_cb_offer(void *data, struct wl_data_offer *offer EINA_UNUSED, const char
|
|||
if (t) *t = strdup(type);
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
data_offer_source_actions(void *data, struct wl_data_offer *wl_data_offer EINA_UNUSED, uint32_t source_actions)
|
||||
{
|
||||
Ecore_Wl2_Dnd_Source *source = data;
|
||||
|
||||
source->source_actions = source_actions;
|
||||
}
|
||||
|
||||
static void
|
||||
data_offer_action(void *data, struct wl_data_offer *wl_data_offer EINA_UNUSED, uint32_t dnd_action)
|
||||
{
|
||||
Ecore_Wl2_Dnd_Source *source = data;
|
||||
|
||||
source->dnd_action = dnd_action;
|
||||
}
|
||||
|
||||
static const struct wl_data_offer_listener _offer_listener =
|
||||
{
|
||||
_offer_cb_offer
|
||||
_offer_cb_offer,
|
||||
data_offer_source_actions,
|
||||
data_offer_action
|
||||
};
|
||||
|
||||
static void
|
||||
|
@ -321,6 +340,12 @@ _ecore_wl2_dnd_enter(Ecore_Wl2_Input *input, struct wl_data_offer *offer, struct
|
|||
input->drag.source = wl_data_offer_get_user_data(offer);
|
||||
num = (input->drag.source->types.size / sizeof(char *));
|
||||
types = input->drag.source->types.data;
|
||||
if (input->display->wl.data_device_manager_version >=
|
||||
WL_DATA_OFFER_SET_ACTIONS_SINCE_VERSION)
|
||||
wl_data_offer_set_actions(offer,
|
||||
WL_DATA_DEVICE_MANAGER_DND_ACTION_COPY |
|
||||
WL_DATA_DEVICE_MANAGER_DND_ACTION_MOVE,
|
||||
WL_DATA_DEVICE_MANAGER_DND_ACTION_MOVE);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -74,6 +74,7 @@ struct _Ecore_Wl2_Display
|
|||
struct wl_compositor *compositor;
|
||||
struct wl_subcompositor *subcompositor;
|
||||
struct wl_data_device_manager *data_device_manager;
|
||||
int data_device_manager_version;
|
||||
struct wl_shm *shm;
|
||||
struct zwp_linux_dmabuf_v1 *dmabuf;
|
||||
struct wl_shell *wl_shell;
|
||||
|
@ -178,6 +179,8 @@ typedef struct _Ecore_Wl2_Dnd_Source
|
|||
|
||||
struct wl_data_offer *offer;
|
||||
struct wl_array types;
|
||||
uint32_t dnd_action;
|
||||
uint32_t source_actions;
|
||||
} Ecore_Wl2_Dnd_Source;
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue