xwayland: make wayland → xwayland work

This commit is contained in:
emersion 2018-03-28 17:26:29 -04:00
parent 30babb3865
commit 3effe153bc
No known key found for this signature in database
GPG Key ID: 0FDE7BE0E88F5E48
3 changed files with 26 additions and 12 deletions

View File

@ -537,9 +537,11 @@ static uint32_t pointer_drag_button(struct wlr_seat_pointer_grab *grab,
drag->source->dnd_drop(drag->source);
}
if (drag->source->offer != NULL) {
drag->source->offer->in_ask =
drag->source->current_dnd_action ==
WL_DATA_DEVICE_MANAGER_DND_ACTION_ASK;
}
struct wlr_drag_drop_event event = {
.drag = drag,

View File

@ -24,7 +24,7 @@ static xcb_atom_t data_device_manager_dnd_action_to_atom(
return XCB_ATOM_NONE;
}
/*static enum wl_data_device_manager_dnd_action
static enum wl_data_device_manager_dnd_action
data_device_manager_dnd_action_from_atom(struct wlr_xwm *xwm,
enum atom_name atom) {
if (atom == xwm->atoms[DND_ACTION_COPY] ||
@ -36,7 +36,7 @@ static xcb_atom_t data_device_manager_dnd_action_to_atom(
return WL_DATA_DEVICE_MANAGER_DND_ACTION_ASK;
}
return WL_DATA_DEVICE_MANAGER_DND_ACTION_NONE;
}*/
}
static void xwm_selection_send_notify(struct wlr_xwm_selection *selection,
xcb_atom_t property) {
@ -963,15 +963,25 @@ int xwm_handle_selection_client_message(struct wlr_xwm *xwm,
if (ev->type == xwm->atoms[DND_STATUS]) {
struct wlr_drag *drag = xwm->drag;
if (drag == NULL) {
return 0;
wlr_log(L_DEBUG, "Ignoring XdndStatus client message because "
"there's no current drag");
return 1;
}
// xcb_client_message_data_t *data = &ev->data;
// xcb_window_t target_window = data->data32[0];
// bool accepted = data->data32[1] & 1;
// xcb_atom_t action = data->data32[4];
xcb_client_message_data_t *data = &ev->data;
xcb_window_t target_window = data->data32[0];
bool accepted = data->data32[1] & 1;
xcb_atom_t action_atom = data->data32[4];
// TODO: drag->source->dnd_action(data_device_manager_dnd_action_from_atom(xwm, action))
enum wl_data_device_manager_dnd_action action =
data_device_manager_dnd_action_from_atom(xwm, action_atom);
drag->source->accepted = accepted;
drag->source->current_dnd_action = action;
// TODO: drag->source->dnd_action()
wlr_log(L_DEBUG, "DND_STATUS window=%d accepted=%d action=%d",
target_window, accepted, action);
return 1;
} else {
return 0;
@ -1150,6 +1160,7 @@ static void seat_handle_drag_drop(struct wl_listener *listener, void *data) {
return; // No xwayland surface focused
}
wlr_log(L_DEBUG, "Wayland drag dropped over an Xwayland window");
xwm_dnd_send_drop(xwm, event->time);
}

View File

@ -559,7 +559,8 @@ static void read_surface_property(struct wlr_xwm *xwm,
read_surface_motif_hints(xwm, xsurface, reply);
} else {
char *prop_name = get_atom_name(xwm, property);
wlr_log(L_DEBUG, "unhandled x11 property %u (%s)", property, prop_name);
wlr_log(L_DEBUG, "unhandled X11 property %u (%s) for window %u",
property, prop_name, xsurface->window_id);
free(prop_name);
}