aboutsummaryrefslogtreecommitdiff
path: root/xwayland/selection/outgoing.c
diff options
context:
space:
mode:
authorTudor Brindus <me@tbrindus.ca>2021-02-01 21:19:00 -0500
committerSimon Ser <contact@emersion.fr>2021-02-04 17:16:43 +0100
commit3d46d3f7a1d8e9d2a276e40500e75388546341db (patch)
tree869f69711c8b3a1d4ecd13e4466b6e0c86293046 /xwayland/selection/outgoing.c
parent2fa257313ac888f8b61fba8e7c457eac9e1973c3 (diff)
xwayland/selection: allow simultaneous Wayland-to-X11 transfers
There seems to be no reason why we can't service multiple Wayland-to-X11 transfers concurrently, so long as they are to different windows (or possibly, same windows but different target properties?) This commit removes the queuing logic, but retains the request de-duplication from #2428.
Diffstat (limited to 'xwayland/selection/outgoing.c')
-rw-r--r--xwayland/selection/outgoing.c33
1 files changed, 3 insertions, 30 deletions
diff --git a/xwayland/selection/outgoing.c b/xwayland/selection/outgoing.c
index 787298d4..7c5c5f40 100644
--- a/xwayland/selection/outgoing.c
+++ b/xwayland/selection/outgoing.c
@@ -55,30 +55,11 @@ static int xwm_selection_flush_source_data(
static void xwm_selection_transfer_start_outgoing(
struct wlr_xwm_selection_transfer *transfer);
-static struct wlr_xwm_selection_transfer *xwm_selection_transfer_get_first(
- struct wlr_xwm_selection *selection) {
- struct wlr_xwm_selection_transfer *first = NULL;
- if (!wl_list_empty(&selection->outgoing)) {
- first = wl_container_of(selection->outgoing.prev, first, link);
- }
-
- return first;
-}
-
void xwm_selection_transfer_destroy_outgoing(
struct wlr_xwm_selection_transfer *transfer) {
- struct wlr_xwm_selection *selection = transfer->selection;
- bool was_first = transfer == xwm_selection_transfer_get_first(selection);
wl_list_remove(&transfer->link);
wlr_log(WLR_DEBUG, "Destroying transfer %p", transfer);
- // Start next queued transfer if we just removed the active one.
- if (was_first && !wl_list_empty(&selection->outgoing)) {
- wlr_log(WLR_DEBUG, "Destroyed transfer was active, starting next");
- xwm_selection_transfer_start_outgoing(
- xwm_selection_transfer_get_first(selection));
- }
-
xwm_selection_transfer_remove_event_source(transfer);
xwm_selection_transfer_close_wl_client_fd(transfer);
wl_array_release(&transfer->source_data);
@@ -232,7 +213,6 @@ static void xwm_selection_transfer_start_outgoing(
struct wl_event_loop *loop =
wl_display_get_event_loop(xwm->xwayland->wl_display);
wlr_log(WLR_DEBUG, "Starting transfer %p", transfer);
- assert(transfer == xwm_selection_transfer_get_first(transfer->selection));
transfer->event_source = wl_event_loop_add_fd(loop, transfer->wl_client_fd,
WL_EVENT_READABLE, xwm_data_source_read, transfer);
}
@@ -328,21 +308,14 @@ static bool xwm_selection_send_data(struct wlr_xwm_selection *selection,
wlr_log(WLR_DEBUG, "Destroying stale transfer %p", outgoing);
xwm_selection_send_notify(selection->xwm, &outgoing->request, false);
xwm_selection_transfer_destroy_outgoing(outgoing);
+ } else {
+ wlr_log(WLR_DEBUG, "Transfer %p still running", outgoing);
}
}
wl_list_insert(&selection->outgoing, &transfer->link);
- // We can only handle one transfer at a time
- if (wl_list_length(&selection->outgoing) == 1) {
- wlr_log(WLR_DEBUG, "No transfer active, starting %p now", transfer);
- xwm_selection_transfer_start_outgoing(transfer);
- } else {
- struct wlr_xwm_selection_transfer *outgoing;
- wl_list_for_each(outgoing, &selection->outgoing, link) {
- wlr_log(WLR_DEBUG, "Transfer %p still queued", outgoing);
- }
- }
+ xwm_selection_transfer_start_outgoing(transfer);
return true;
}