aboutsummaryrefslogtreecommitdiff
path: root/xwayland/selection.c
diff options
context:
space:
mode:
authoremersion <contact@emersion.fr>2018-03-29 11:19:42 -0400
committeremersion <contact@emersion.fr>2018-03-29 11:19:42 -0400
commit5dc5f446a812ae5281dee23a5a05917f2f12447d (patch)
tree2b82f400a29eb9f301881f0f4d30cc17a6218489 /xwayland/selection.c
parent6fd50947bda5c609bba0eea1fef5e27a5524dc38 (diff)
xwayland: send drag'n'drop action to data source
Diffstat (limited to 'xwayland/selection.c')
-rw-r--r--xwayland/selection.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/xwayland/selection.c b/xwayland/selection.c
index d5872f83..fa7e478b 100644
--- a/xwayland/selection.c
+++ b/xwayland/selection.c
@@ -1010,7 +1010,10 @@ int xwm_handle_selection_client_message(struct wlr_xwm *xwm,
drag->source->accepted = accepted;
drag->source->current_dnd_action = action;
- // TODO: drag->source->dnd_action()
+ if (drag->source->dnd_action) {
+ drag->source->dnd_action(drag->source, action);
+ }
+
wlr_log(L_DEBUG, "DND_STATUS window=%d accepted=%d action=%d",
target_window, accepted, action);
return 1;
@@ -1159,6 +1162,10 @@ static void seat_handle_drag_focus(struct wl_listener *listener, void *data) {
}
if (xwm->drag_focus != NULL) {
+ if (drag->source->dnd_action) {
+ drag->source->dnd_action(drag->source,
+ WL_DATA_DEVICE_MANAGER_DND_ACTION_NONE);
+ }
xwm_dnd_send_leave(xwm);
}
@@ -1197,6 +1204,8 @@ static void seat_handle_drag_drop(struct wl_listener *listener, void *data) {
static void seat_handle_drag_destroy(struct wl_listener *listener, void *data) {
struct wlr_xwm *xwm = wl_container_of(listener, xwm, seat_drag_destroy);
+ // Don't reset drag focus yet because the target will read the drag source
+ // right after
if (xwm->drag_focus != NULL) {
xwm_dnd_send_leave(xwm);
}