mirror of
https://gitlab.freedesktop.org/wlroots/wlroots.git
synced 2025-11-23 06:59:44 -05:00
xwayland: fix xdg->xwayland drag-and-drop
As struct wlr_drag is destroyed on drop and in the process resets the focus, a xwayland dnd listener would also reset xwm->drag_focus. This prevents the xcb replies from being processed and also prevents the transfer if a compositor would not additionally request new focus in its wlr_drag destroy handler (which is something usually only done when in a focus-follows-mouse setting). This patch creates a new xwm->drop_focus pointer which is a copy of xwm->drag_focus at drop time. The xcb reply handler and transfer logic now use the new xwm->drop_focus for their authorization checks.
This commit is contained in:
parent
71943b3b1e
commit
546c5d000d
4 changed files with 31 additions and 4 deletions
|
|
@ -410,8 +410,11 @@ void xwm_handle_selection_request(struct wlr_xwm *xwm,
|
|||
return;
|
||||
}
|
||||
|
||||
bool dnd_allowed = selection == &xwm->dnd_selection
|
||||
&& (xwm->drag_focus != NULL || xwm->drop_focus != NULL);
|
||||
|
||||
// No xwayland surface focused, deny access to clipboard
|
||||
if (xwm->focus_surface == NULL && xwm->drag_focus == NULL) {
|
||||
if (xwm->focus_surface == NULL && !dnd_allowed) {
|
||||
if (wlr_log_get_verbosity() >= WLR_DEBUG) {
|
||||
char *selection_name = xwm_get_atom_name(xwm, selection->atom);
|
||||
wlr_log(WLR_DEBUG, "denying read access to selection %u (%s): "
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue