xwayland: add a size-safe wrapper for xcb_send_event

xcb_send_event expects the caller to always provide 32 byte data, even if the actual event struct is
smaller than that.

Reference: https://gitlab.freedesktop.org/xorg/lib/libxcb/-/issues/18
This commit is contained in:
Ilia Bozhinov 2024-04-20 14:59:40 +02:00
parent cc10a5259d
commit c63275d75e
4 changed files with 35 additions and 8 deletions

View file

@ -49,11 +49,12 @@ static void xwm_dnd_send_event(struct wlr_xwm *xwm, xcb_atom_t type,
.data = *data,
};
xcb_send_event(xwm->xcb_conn,
xwm_send_event_with_size(xwm->xcb_conn,
0, // propagate
dest->window_id,
XCB_EVENT_MASK_NO_EVENT,
(const char *)&event);
&event,
sizeof(event));
xcb_flush(xwm->xcb_conn);
}