Re: [PATCH weston v7 2/5] data-device: Implement DnD actions

2016-01-15 Thread Carlos Garnacho
Hey Jonas,

On Fri, Jan 15, 2016 at 7:10 AM, Jonas Ådahl  wrote:
> On Thu, Jan 14, 2016 at 11:46:34PM +0100, Carlos Garnacho wrote:
>> The policy in weston in order to determine the chosen DnD action is
>> deliberately simple, and is probably the minimals that any compositor
>> should be doing here.
>>
>> Besides honoring the set_actions requests on both wl_data_source and
>> wl_data_offer, weston now will emit the newly added "action" events
>> notifying both source and dest of the chosen action.
>>
>> The "dnd" client has been updated too (although minimally), so it
>> notifies the compositor of a "move" action on both sides.
>>
>> Changes since v6:
>>   - Emit errors as defined in DnD actions patch v10.
>>
>> Changes since v5:
>>   - Use enum types and values for not-a-bitfield stored values.
>> handle errors when finding unexpected dnd_actions values.
>>
>> Changes since v4:
>>   - Added compositor-side version checks. Spaces vs tabs fixes.
>> Fixed resource versioning. Initialized new weston_data_source/offer
>> fields.
>>
>> Changes since v3:
>>   - Put data_source.action to use in the dnd client, now updates
>> the dnd surface like data_source.target events do.
>>
>> Changes since v2:
>>   - Split from DnD progress notification changes.
>>
>> Changes since v1:
>>   - Updated to v2 of DnD actions protocol changes, implement
>> wl_data_offer.source_actions.
>>   - Fixed coding style issues.
>>
>> Signed-off-by: Carlos Garnacho 
>> Reviewed-by: Michael Catanzaro 
>
> Mostly looks good, except for one part regarding the order of
> wl_data_source.set_actions and wl_data_device.start_drag. I also have a
> question regarding what to do with events during "ask". See the comments
> inline.
>
>> ---
>>  clients/dnd.c |  32 +--
>>  clients/window.c  |  25 
>>  src/compositor.h  |   5 ++
>>  src/data-device.c | 169 
>> --
>>  4 files changed, 221 insertions(+), 10 deletions(-)
>>
>> diff --git a/clients/dnd.c b/clients/dnd.c
>> index 48111d9..ddf3fcc 100644
>> --- a/clients/dnd.c
>> +++ b/clients/dnd.c
>> @@ -72,6 +72,7 @@ struct dnd_drag {
>>   struct item *item;
>>   int x_offset, y_offset;
>>   int width, height;
>> + uint32_t dnd_action;
>>   const char *mime_type;
>>
>>   struct wl_surface *drag_surface;
>> @@ -266,16 +267,13 @@ dnd_get_item(struct dnd *dnd, int32_t x, int32_t y)
>>  }
>>
>>  static void
>> -data_source_target(void *data,
>> -struct wl_data_source *source, const char *mime_type)
>> +dnd_drag_update_surface(struct dnd_drag *dnd_drag)
>>  {
>> - struct dnd_drag *dnd_drag = data;
>>   struct dnd *dnd = dnd_drag->dnd;
>>   cairo_surface_t *surface;
>>   struct wl_buffer *buffer;
>>
>> - dnd_drag->mime_type = mime_type;
>> - if (mime_type)
>> + if (dnd_drag->mime_type && dnd_drag->dnd_action)
>>   surface = dnd_drag->opaque;
>>   else
>>   surface = dnd_drag->translucent;
>> @@ -288,6 +286,16 @@ data_source_target(void *data,
>>  }
>>
>>  static void
>> +data_source_target(void *data,
>> +struct wl_data_source *source, const char *mime_type)
>> +{
>> + struct dnd_drag *dnd_drag = data;
>> +
>> + dnd_drag->mime_type = mime_type;
>> + dnd_drag_update_surface(dnd_drag);
>> +}
>> +
>> +static void
>>  data_source_send(void *data, struct wl_data_source *source,
>>const char *mime_type, int32_t fd)
>>  {
>> @@ -360,12 +368,22 @@ data_source_drag_finished(void *data, struct 
>> wl_data_source *source)
>>   dnd_drag_destroy(dnd_drag);
>>  }
>>
>> +static void
>> +data_source_action(void *data, struct wl_data_source *source, uint32_t 
>> dnd_action)
>> +{
>> + struct dnd_drag *dnd_drag = data;
>> +
>> + dnd_drag->dnd_action = dnd_action;
>> + dnd_drag_update_surface(dnd_drag);
>> +}
>> +
>>  static const struct wl_data_source_listener data_source_listener = {
>>   data_source_target,
>>   data_source_send,
>>   data_source_cancelled,
>>   data_source_drop_performed,
>>   data_source_drag_finished,
>> + data_source_action,
>>  };
>>
>>  static cairo_surface_t *
>> @@ -428,6 +446,8 @@ create_drag_source(struct dnd *dnd,
>>   dnd_drag->item = item;
>>   dnd_drag->x_offset = x - item->x;
>>   dnd_drag->y_offset = y - item->y;
>> + dnd_drag->dnd_action = WL_DATA_DEVICE_MANAGER_DND_ACTION_MOVE;
>> + dnd_drag->mime_type = NULL;
>>
>>   for (i = 0; i < ARRAY_LENGTH(dnd->items); i++) {
>>   if (item == dnd->items[i]){
>> @@ -461,6 +481,8 @@ create_drag_source(struct dnd *dnd,
>> window_get_wl_surface(dnd->window),
>> dnd_drag->drag_surface,
>> serial);
>> + wl_data_source_set_actions(dnd_drag->data_source,
>> +   

Re: [PATCH weston v7 2/5] data-device: Implement DnD actions

2016-01-14 Thread Jonas Ådahl
Hey,

Found a couple of more issues. Comments inline.

On Thu, Jan 14, 2016 at 11:46:34PM +0100, Carlos Garnacho wrote:
> The policy in weston in order to determine the chosen DnD action is
> deliberately simple, and is probably the minimals that any compositor
> should be doing here.
> 
> Besides honoring the set_actions requests on both wl_data_source and
> wl_data_offer, weston now will emit the newly added "action" events
> notifying both source and dest of the chosen action.
> 
> The "dnd" client has been updated too (although minimally), so it
> notifies the compositor of a "move" action on both sides.
> 
> Changes since v6:
>   - Emit errors as defined in DnD actions patch v10.
> 
> Changes since v5:
>   - Use enum types and values for not-a-bitfield stored values.
> handle errors when finding unexpected dnd_actions values.
> 
> Changes since v4:
>   - Added compositor-side version checks. Spaces vs tabs fixes.
> Fixed resource versioning. Initialized new weston_data_source/offer
> fields.
> 
> Changes since v3:
>   - Put data_source.action to use in the dnd client, now updates
> the dnd surface like data_source.target events do.
> 
> Changes since v2:
>   - Split from DnD progress notification changes.
> 
> Changes since v1:
>   - Updated to v2 of DnD actions protocol changes, implement
> wl_data_offer.source_actions.
>   - Fixed coding style issues.
> 
> Signed-off-by: Carlos Garnacho 
> Reviewed-by: Michael Catanzaro 
> ---
>  clients/dnd.c |  32 +--
>  clients/window.c  |  25 
>  src/compositor.h  |   5 ++
>  src/data-device.c | 169 
> --
>  4 files changed, 221 insertions(+), 10 deletions(-)
> 
> diff --git a/clients/dnd.c b/clients/dnd.c
> index 48111d9..ddf3fcc 100644
> --- a/clients/dnd.c
> +++ b/clients/dnd.c
> @@ -72,6 +72,7 @@ struct dnd_drag {
>   struct item *item;
>   int x_offset, y_offset;
>   int width, height;
> + uint32_t dnd_action;
>   const char *mime_type;
>  
>   struct wl_surface *drag_surface;
> @@ -266,16 +267,13 @@ dnd_get_item(struct dnd *dnd, int32_t x, int32_t y)
>  }
>  
>  static void
> -data_source_target(void *data,
> -struct wl_data_source *source, const char *mime_type)
> +dnd_drag_update_surface(struct dnd_drag *dnd_drag)
>  {
> - struct dnd_drag *dnd_drag = data;
>   struct dnd *dnd = dnd_drag->dnd;
>   cairo_surface_t *surface;
>   struct wl_buffer *buffer;
>  
> - dnd_drag->mime_type = mime_type;
> - if (mime_type)
> + if (dnd_drag->mime_type && dnd_drag->dnd_action)
>   surface = dnd_drag->opaque;
>   else
>   surface = dnd_drag->translucent;
> @@ -288,6 +286,16 @@ data_source_target(void *data,
>  }
>  
>  static void
> +data_source_target(void *data,
> +struct wl_data_source *source, const char *mime_type)
> +{
> + struct dnd_drag *dnd_drag = data;
> +
> + dnd_drag->mime_type = mime_type;
> + dnd_drag_update_surface(dnd_drag);
> +}
> +
> +static void
>  data_source_send(void *data, struct wl_data_source *source,
>const char *mime_type, int32_t fd)
>  {
> @@ -360,12 +368,22 @@ data_source_drag_finished(void *data, struct 
> wl_data_source *source)
>   dnd_drag_destroy(dnd_drag);
>  }
>  
> +static void
> +data_source_action(void *data, struct wl_data_source *source, uint32_t 
> dnd_action)
> +{
> + struct dnd_drag *dnd_drag = data;
> +
> + dnd_drag->dnd_action = dnd_action;
> + dnd_drag_update_surface(dnd_drag);
> +}
> +
>  static const struct wl_data_source_listener data_source_listener = {
>   data_source_target,
>   data_source_send,
>   data_source_cancelled,
>   data_source_drop_performed,
>   data_source_drag_finished,
> + data_source_action,
>  };
>  
>  static cairo_surface_t *
> @@ -428,6 +446,8 @@ create_drag_source(struct dnd *dnd,
>   dnd_drag->item = item;
>   dnd_drag->x_offset = x - item->x;
>   dnd_drag->y_offset = y - item->y;
> + dnd_drag->dnd_action = WL_DATA_DEVICE_MANAGER_DND_ACTION_MOVE;
> + dnd_drag->mime_type = NULL;
>  
>   for (i = 0; i < ARRAY_LENGTH(dnd->items); i++) {
>   if (item == dnd->items[i]){
> @@ -461,6 +481,8 @@ create_drag_source(struct dnd *dnd,
> window_get_wl_surface(dnd->window),
> dnd_drag->drag_surface,
> serial);
> + wl_data_source_set_actions(dnd_drag->data_source,
> +
> WL_DATA_DEVICE_MANAGER_DND_ACTION_MOVE);

This call must be above the start_drag, and inside a version check.

>  
>   dnd_drag->opaque =
>   create_drag_icon(dnd_drag, item, x, y, 1);
> diff --git a/clients/window.c b/clients/window.c
> index c93edb1..db1fe57 100644
> --- a/clients/wind

Re: [PATCH weston v7 2/5] data-device: Implement DnD actions

2016-01-14 Thread Jonas Ådahl
On Thu, Jan 14, 2016 at 11:46:34PM +0100, Carlos Garnacho wrote:
> The policy in weston in order to determine the chosen DnD action is
> deliberately simple, and is probably the minimals that any compositor
> should be doing here.
> 
> Besides honoring the set_actions requests on both wl_data_source and
> wl_data_offer, weston now will emit the newly added "action" events
> notifying both source and dest of the chosen action.
> 
> The "dnd" client has been updated too (although minimally), so it
> notifies the compositor of a "move" action on both sides.
> 
> Changes since v6:
>   - Emit errors as defined in DnD actions patch v10.
> 
> Changes since v5:
>   - Use enum types and values for not-a-bitfield stored values.
> handle errors when finding unexpected dnd_actions values.
> 
> Changes since v4:
>   - Added compositor-side version checks. Spaces vs tabs fixes.
> Fixed resource versioning. Initialized new weston_data_source/offer
> fields.
> 
> Changes since v3:
>   - Put data_source.action to use in the dnd client, now updates
> the dnd surface like data_source.target events do.
> 
> Changes since v2:
>   - Split from DnD progress notification changes.
> 
> Changes since v1:
>   - Updated to v2 of DnD actions protocol changes, implement
> wl_data_offer.source_actions.
>   - Fixed coding style issues.
> 
> Signed-off-by: Carlos Garnacho 
> Reviewed-by: Michael Catanzaro 

Mostly looks good, except for one part regarding the order of
wl_data_source.set_actions and wl_data_device.start_drag. I also have a
question regarding what to do with events during "ask". See the comments
inline.

> ---
>  clients/dnd.c |  32 +--
>  clients/window.c  |  25 
>  src/compositor.h  |   5 ++
>  src/data-device.c | 169 
> --
>  4 files changed, 221 insertions(+), 10 deletions(-)
> 
> diff --git a/clients/dnd.c b/clients/dnd.c
> index 48111d9..ddf3fcc 100644
> --- a/clients/dnd.c
> +++ b/clients/dnd.c
> @@ -72,6 +72,7 @@ struct dnd_drag {
>   struct item *item;
>   int x_offset, y_offset;
>   int width, height;
> + uint32_t dnd_action;
>   const char *mime_type;
>  
>   struct wl_surface *drag_surface;
> @@ -266,16 +267,13 @@ dnd_get_item(struct dnd *dnd, int32_t x, int32_t y)
>  }
>  
>  static void
> -data_source_target(void *data,
> -struct wl_data_source *source, const char *mime_type)
> +dnd_drag_update_surface(struct dnd_drag *dnd_drag)
>  {
> - struct dnd_drag *dnd_drag = data;
>   struct dnd *dnd = dnd_drag->dnd;
>   cairo_surface_t *surface;
>   struct wl_buffer *buffer;
>  
> - dnd_drag->mime_type = mime_type;
> - if (mime_type)
> + if (dnd_drag->mime_type && dnd_drag->dnd_action)
>   surface = dnd_drag->opaque;
>   else
>   surface = dnd_drag->translucent;
> @@ -288,6 +286,16 @@ data_source_target(void *data,
>  }
>  
>  static void
> +data_source_target(void *data,
> +struct wl_data_source *source, const char *mime_type)
> +{
> + struct dnd_drag *dnd_drag = data;
> +
> + dnd_drag->mime_type = mime_type;
> + dnd_drag_update_surface(dnd_drag);
> +}
> +
> +static void
>  data_source_send(void *data, struct wl_data_source *source,
>const char *mime_type, int32_t fd)
>  {
> @@ -360,12 +368,22 @@ data_source_drag_finished(void *data, struct 
> wl_data_source *source)
>   dnd_drag_destroy(dnd_drag);
>  }
>  
> +static void
> +data_source_action(void *data, struct wl_data_source *source, uint32_t 
> dnd_action)
> +{
> + struct dnd_drag *dnd_drag = data;
> +
> + dnd_drag->dnd_action = dnd_action;
> + dnd_drag_update_surface(dnd_drag);
> +}
> +
>  static const struct wl_data_source_listener data_source_listener = {
>   data_source_target,
>   data_source_send,
>   data_source_cancelled,
>   data_source_drop_performed,
>   data_source_drag_finished,
> + data_source_action,
>  };
>  
>  static cairo_surface_t *
> @@ -428,6 +446,8 @@ create_drag_source(struct dnd *dnd,
>   dnd_drag->item = item;
>   dnd_drag->x_offset = x - item->x;
>   dnd_drag->y_offset = y - item->y;
> + dnd_drag->dnd_action = WL_DATA_DEVICE_MANAGER_DND_ACTION_MOVE;
> + dnd_drag->mime_type = NULL;
>  
>   for (i = 0; i < ARRAY_LENGTH(dnd->items); i++) {
>   if (item == dnd->items[i]){
> @@ -461,6 +481,8 @@ create_drag_source(struct dnd *dnd,
> window_get_wl_surface(dnd->window),
> dnd_drag->drag_surface,
> serial);
> + wl_data_source_set_actions(dnd_drag->data_source,
> +
> WL_DATA_DEVICE_MANAGER_DND_ACTION_MOVE);
>  
>   dnd_drag->opaque =
>   create_drag_icon(dnd_drag, item, x, y, 1);
> diff --gi

[PATCH weston v7 2/5] data-device: Implement DnD actions

2016-01-14 Thread Carlos Garnacho
The policy in weston in order to determine the chosen DnD action is
deliberately simple, and is probably the minimals that any compositor
should be doing here.

Besides honoring the set_actions requests on both wl_data_source and
wl_data_offer, weston now will emit the newly added "action" events
notifying both source and dest of the chosen action.

The "dnd" client has been updated too (although minimally), so it
notifies the compositor of a "move" action on both sides.

Changes since v6:
  - Emit errors as defined in DnD actions patch v10.

Changes since v5:
  - Use enum types and values for not-a-bitfield stored values.
handle errors when finding unexpected dnd_actions values.

Changes since v4:
  - Added compositor-side version checks. Spaces vs tabs fixes.
Fixed resource versioning. Initialized new weston_data_source/offer
fields.

Changes since v3:
  - Put data_source.action to use in the dnd client, now updates
the dnd surface like data_source.target events do.

Changes since v2:
  - Split from DnD progress notification changes.

Changes since v1:
  - Updated to v2 of DnD actions protocol changes, implement
wl_data_offer.source_actions.
  - Fixed coding style issues.

Signed-off-by: Carlos Garnacho 
Reviewed-by: Michael Catanzaro 
---
 clients/dnd.c |  32 +--
 clients/window.c  |  25 
 src/compositor.h  |   5 ++
 src/data-device.c | 169 --
 4 files changed, 221 insertions(+), 10 deletions(-)

diff --git a/clients/dnd.c b/clients/dnd.c
index 48111d9..ddf3fcc 100644
--- a/clients/dnd.c
+++ b/clients/dnd.c
@@ -72,6 +72,7 @@ struct dnd_drag {
struct item *item;
int x_offset, y_offset;
int width, height;
+   uint32_t dnd_action;
const char *mime_type;
 
struct wl_surface *drag_surface;
@@ -266,16 +267,13 @@ dnd_get_item(struct dnd *dnd, int32_t x, int32_t y)
 }
 
 static void
-data_source_target(void *data,
-  struct wl_data_source *source, const char *mime_type)
+dnd_drag_update_surface(struct dnd_drag *dnd_drag)
 {
-   struct dnd_drag *dnd_drag = data;
struct dnd *dnd = dnd_drag->dnd;
cairo_surface_t *surface;
struct wl_buffer *buffer;
 
-   dnd_drag->mime_type = mime_type;
-   if (mime_type)
+   if (dnd_drag->mime_type && dnd_drag->dnd_action)
surface = dnd_drag->opaque;
else
surface = dnd_drag->translucent;
@@ -288,6 +286,16 @@ data_source_target(void *data,
 }
 
 static void
+data_source_target(void *data,
+  struct wl_data_source *source, const char *mime_type)
+{
+   struct dnd_drag *dnd_drag = data;
+
+   dnd_drag->mime_type = mime_type;
+   dnd_drag_update_surface(dnd_drag);
+}
+
+static void
 data_source_send(void *data, struct wl_data_source *source,
 const char *mime_type, int32_t fd)
 {
@@ -360,12 +368,22 @@ data_source_drag_finished(void *data, struct 
wl_data_source *source)
dnd_drag_destroy(dnd_drag);
 }
 
+static void
+data_source_action(void *data, struct wl_data_source *source, uint32_t 
dnd_action)
+{
+   struct dnd_drag *dnd_drag = data;
+
+   dnd_drag->dnd_action = dnd_action;
+   dnd_drag_update_surface(dnd_drag);
+}
+
 static const struct wl_data_source_listener data_source_listener = {
data_source_target,
data_source_send,
data_source_cancelled,
data_source_drop_performed,
data_source_drag_finished,
+   data_source_action,
 };
 
 static cairo_surface_t *
@@ -428,6 +446,8 @@ create_drag_source(struct dnd *dnd,
dnd_drag->item = item;
dnd_drag->x_offset = x - item->x;
dnd_drag->y_offset = y - item->y;
+   dnd_drag->dnd_action = WL_DATA_DEVICE_MANAGER_DND_ACTION_MOVE;
+   dnd_drag->mime_type = NULL;
 
for (i = 0; i < ARRAY_LENGTH(dnd->items); i++) {
if (item == dnd->items[i]){
@@ -461,6 +481,8 @@ create_drag_source(struct dnd *dnd,
  window_get_wl_surface(dnd->window),
  dnd_drag->drag_surface,
  serial);
+   wl_data_source_set_actions(dnd_drag->data_source,
+  
WL_DATA_DEVICE_MANAGER_DND_ACTION_MOVE);
 
dnd_drag->opaque =
create_drag_icon(dnd_drag, item, x, y, 1);
diff --git a/clients/window.c b/clients/window.c
index c93edb1..db1fe57 100644
--- a/clients/window.c
+++ b/clients/window.c
@@ -3323,6 +3323,8 @@ struct data_offer {
int fd;
data_func_t func;
int32_t x, y;
+   uint32_t dnd_action;
+   uint32_t source_actions;
void *user_data;
 };
 
@@ -3336,8 +3338,26 @@ data_offer_offer(void *data, struct wl_data_offer 
*wl_data_offer, const char *ty
*p = strdup(type);
 }
 
+static void
+d

[PATCH weston v7 2/5] data-device: Implement DnD actions

2015-12-23 Thread Carlos Garnacho
The policy in weston in order to determine the chosen DnD action is
deliberately simple, and is probably the minimals that any compositor
should be doing here.

Besides honoring the set_actions requests on both wl_data_source and
wl_data_offer, weston now will emit the newly added "action" events
notifying both source and dest of the chosen action.

The "dnd" client has been updated too (although minimally), so it
notifies the compositor of a "move" action on both sides.

Changes since v6:
  - Misc changes after updating the previous patch to make
wl_data_offer.finish with the wrong state an error.

Changes since v5:
  - Use enum types and values for not-a-bitfield stored values.
handle errors when finding unexpected dnd_actions values.

Changes since v4:
  - Added compositor-side version checks. Spaces vs tabs fixes.
Fixed resource versioning. Initialized new weston_data_source/offer
fields.

Changes since v3:
  - Put data_source.action to use in the dnd client, now updates
the dnd surface like data_source.target events do.

Changes since v2:
  - Split from DnD progress notification changes.

Changes since v1:
  - Updated to v2 of DnD actions protocol changes, implement
wl_data_offer.source_actions.
  - Fixed coding style issues.

Signed-off-by: Carlos Garnacho 
Reviewed-by: Michael Catanzaro 
---
 clients/dnd.c |  32 ++---
 clients/window.c  |  25 +++
 src/compositor.h  |   4 ++
 src/data-device.c | 131 --
 4 files changed, 183 insertions(+), 9 deletions(-)

diff --git a/clients/dnd.c b/clients/dnd.c
index 48111d9..ddf3fcc 100644
--- a/clients/dnd.c
+++ b/clients/dnd.c
@@ -72,6 +72,7 @@ struct dnd_drag {
struct item *item;
int x_offset, y_offset;
int width, height;
+   uint32_t dnd_action;
const char *mime_type;
 
struct wl_surface *drag_surface;
@@ -266,16 +267,13 @@ dnd_get_item(struct dnd *dnd, int32_t x, int32_t y)
 }
 
 static void
-data_source_target(void *data,
-  struct wl_data_source *source, const char *mime_type)
+dnd_drag_update_surface(struct dnd_drag *dnd_drag)
 {
-   struct dnd_drag *dnd_drag = data;
struct dnd *dnd = dnd_drag->dnd;
cairo_surface_t *surface;
struct wl_buffer *buffer;
 
-   dnd_drag->mime_type = mime_type;
-   if (mime_type)
+   if (dnd_drag->mime_type && dnd_drag->dnd_action)
surface = dnd_drag->opaque;
else
surface = dnd_drag->translucent;
@@ -288,6 +286,16 @@ data_source_target(void *data,
 }
 
 static void
+data_source_target(void *data,
+  struct wl_data_source *source, const char *mime_type)
+{
+   struct dnd_drag *dnd_drag = data;
+
+   dnd_drag->mime_type = mime_type;
+   dnd_drag_update_surface(dnd_drag);
+}
+
+static void
 data_source_send(void *data, struct wl_data_source *source,
 const char *mime_type, int32_t fd)
 {
@@ -360,12 +368,22 @@ data_source_drag_finished(void *data, struct 
wl_data_source *source)
dnd_drag_destroy(dnd_drag);
 }
 
+static void
+data_source_action(void *data, struct wl_data_source *source, uint32_t 
dnd_action)
+{
+   struct dnd_drag *dnd_drag = data;
+
+   dnd_drag->dnd_action = dnd_action;
+   dnd_drag_update_surface(dnd_drag);
+}
+
 static const struct wl_data_source_listener data_source_listener = {
data_source_target,
data_source_send,
data_source_cancelled,
data_source_drop_performed,
data_source_drag_finished,
+   data_source_action,
 };
 
 static cairo_surface_t *
@@ -428,6 +446,8 @@ create_drag_source(struct dnd *dnd,
dnd_drag->item = item;
dnd_drag->x_offset = x - item->x;
dnd_drag->y_offset = y - item->y;
+   dnd_drag->dnd_action = WL_DATA_DEVICE_MANAGER_DND_ACTION_MOVE;
+   dnd_drag->mime_type = NULL;
 
for (i = 0; i < ARRAY_LENGTH(dnd->items); i++) {
if (item == dnd->items[i]){
@@ -461,6 +481,8 @@ create_drag_source(struct dnd *dnd,
  window_get_wl_surface(dnd->window),
  dnd_drag->drag_surface,
  serial);
+   wl_data_source_set_actions(dnd_drag->data_source,
+  
WL_DATA_DEVICE_MANAGER_DND_ACTION_MOVE);
 
dnd_drag->opaque =
create_drag_icon(dnd_drag, item, x, y, 1);
diff --git a/clients/window.c b/clients/window.c
index db96185..9c67b91 100644
--- a/clients/window.c
+++ b/clients/window.c
@@ -3362,6 +3362,8 @@ struct data_offer {
int fd;
data_func_t func;
int32_t x, y;
+   uint32_t dnd_action;
+   uint32_t source_actions;
void *user_data;
 };
 
@@ -3375,8 +3377,26 @@ data_offer_offer(void *data, struct wl_data_offer 
*wl_data_off