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:
Consolatis 2024-11-28 04:46:33 +01:00
parent 71943b3b1e
commit 546c5d000d
4 changed files with 31 additions and 4 deletions

View file

@ -128,6 +128,7 @@ struct wlr_xwm {
struct wlr_drag *drag;
struct wlr_xwayland_surface *drag_focus;
struct wlr_xwayland_surface *drop_focus;
const xcb_query_extension_reply_t *xfixes;
const xcb_query_extension_reply_t *xres;
@ -150,6 +151,7 @@ struct wlr_xwm {
struct wl_listener seat_drag_destroy;
struct wl_listener seat_drag_source_destroy;
struct wl_listener drag_focus_destroy;
struct wl_listener drop_focus_destroy;
};
struct wlr_xwm *xwm_create(struct wlr_xwayland *wlr_xwayland, int wm_fd);