xwayland: send drag'n'drop action to data source

This commit is contained in:
emersion 2018-03-29 11:19:42 -04:00
parent 6fd50947bd
commit 5dc5f446a8
No known key found for this signature in database
GPG Key ID: 0FDE7BE0E88F5E48
1 changed files with 10 additions and 1 deletions

View File

@ -1010,7 +1010,10 @@ int xwm_handle_selection_client_message(struct wlr_xwm *xwm,
drag->source->accepted = accepted; drag->source->accepted = accepted;
drag->source->current_dnd_action = action; 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", wlr_log(L_DEBUG, "DND_STATUS window=%d accepted=%d action=%d",
target_window, accepted, action); target_window, accepted, action);
return 1; return 1;
@ -1159,6 +1162,10 @@ static void seat_handle_drag_focus(struct wl_listener *listener, void *data) {
} }
if (xwm->drag_focus != NULL) { 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); 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) { static void seat_handle_drag_destroy(struct wl_listener *listener, void *data) {
struct wlr_xwm *xwm = wl_container_of(listener, xwm, seat_drag_destroy); 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) { if (xwm->drag_focus != NULL) {
xwm_dnd_send_leave(xwm); xwm_dnd_send_leave(xwm);
} }