mirror of
https://github.com/hyprwm/wlroots-hyprland.git
synced 2024-12-22 18:09:49 +01:00
xwm: end transfers when the requestor is destroyed
This improves the failure cases when incremental transfers fail to complete successfully for one reason or another.
This commit is contained in:
parent
f82a27f55a
commit
58bcec9d94
3 changed files with 24 additions and 0 deletions
|
@ -56,6 +56,8 @@ struct wlr_xwm_selection *xwm_get_selection(struct wlr_xwm *xwm,
|
|||
void xwm_send_incr_chunk(struct wlr_xwm_selection_transfer *transfer);
|
||||
void xwm_handle_selection_request(struct wlr_xwm *xwm,
|
||||
xcb_selection_request_event_t *req);
|
||||
void xwm_handle_selection_destroy_notify(struct wlr_xwm *xwm,
|
||||
xcb_destroy_notify_event_t *event);
|
||||
|
||||
void xwm_get_incr_chunk(struct wlr_xwm_selection_transfer *transfer);
|
||||
void xwm_handle_selection_notify(struct wlr_xwm *xwm,
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
#include <wayland-util.h>
|
||||
#include <wlr/types/wlr_data_device.h>
|
||||
#include <wlr/types/wlr_primary_selection.h>
|
||||
#include <wlr/util/log.h>
|
||||
|
@ -417,3 +418,23 @@ void xwm_handle_selection_request(struct wlr_xwm *xwm,
|
|||
free(mime_type);
|
||||
}
|
||||
}
|
||||
|
||||
void xwm_handle_selection_destroy_notify(struct wlr_xwm *xwm,
|
||||
xcb_destroy_notify_event_t *event) {
|
||||
struct wlr_xwm_selection *selections[] = {
|
||||
&xwm->clipboard_selection,
|
||||
&xwm->primary_selection,
|
||||
&xwm->dnd_selection,
|
||||
};
|
||||
|
||||
for (size_t i = 0; i < sizeof(selections)/sizeof(selections[0]); ++i) {
|
||||
struct wlr_xwm_selection *selection = selections[i];
|
||||
|
||||
struct wlr_xwm_selection_transfer *outgoing, *tmp;
|
||||
wl_list_for_each_safe(outgoing, tmp, &selection->outgoing, outgoing_link) {
|
||||
if (event->window == outgoing->request.requestor) {
|
||||
xwm_selection_transfer_destroy_outgoing(outgoing);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -846,6 +846,7 @@ static void xwm_handle_destroy_notify(struct wlr_xwm *xwm,
|
|||
return;
|
||||
}
|
||||
xwayland_surface_destroy(xsurface);
|
||||
xwm_handle_selection_destroy_notify(xwm, ev);
|
||||
}
|
||||
|
||||
static void xwm_handle_configure_request(struct wlr_xwm *xwm,
|
||||
|
|
Loading…
Reference in a new issue