From bb0d888f2500290693232704c2a477cf321cdec6 Mon Sep 17 00:00:00 2001 From: Dominique Martinet Date: Fri, 29 Dec 2017 16:30:59 +0100 Subject: xwayland selection: further cleanup on Xwayland exit This is necessary if our last primary/clipboard selection was on Xwayland, and we try to paste to native wayland after Xwayland died --- xwayland/selection.c | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) (limited to 'xwayland/selection.c') diff --git a/xwayland/selection.c b/xwayland/selection.c index 00e45182..79819565 100644 --- a/xwayland/selection.c +++ b/xwayland/selection.c @@ -826,6 +826,30 @@ void xwm_selection_init(struct wlr_xwm *xwm) { selection_init(xwm, &xwm->primary_selection, xwm->atoms[PRIMARY]); } +void xwm_selection_finish(struct wlr_xwm *xwm) { + if (!xwm) { + return; + } + if (xwm->selection_window) { + xcb_destroy_window(xwm->xcb_conn, xwm->selection_window); + } + if (xwm->seat) { + if (xwm->seat->selection_source && + xwm->seat->selection_source->cancel == data_source_cancel) { + wlr_seat_set_selection(xwm->seat, NULL, + wl_display_next_serial(xwm->xwayland->wl_display)); + } + if (xwm->seat->primary_selection_source && + xwm->seat->primary_selection_source->cancel == primary_selection_source_cancel) { + wlr_seat_set_primary_selection(xwm->seat, NULL, + wl_display_next_serial(xwm->xwayland->wl_display)); + } + wl_list_remove(&xwm->seat_selection.link); + wl_list_remove(&xwm->seat_primary_selection.link); + } + +} + static void xwm_selection_set_owner(struct wlr_xwm_selection *selection, bool set) { if (set) { -- cgit v1.2.3 From 41649a1f9a37379f470dad34aa81bbb13d8b70c1 Mon Sep 17 00:00:00 2001 From: Dominique Martinet Date: Fri, 29 Dec 2017 20:30:49 +0100 Subject: xwm_selection_finish: set NULL seat for xwayland While they could eventually be split appart, the current approach could lead to double wl_list_remove() calls on selections which is incorrect --- xwayland/selection.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'xwayland/selection.c') diff --git a/xwayland/selection.c b/xwayland/selection.c index 79819565..65599145 100644 --- a/xwayland/selection.c +++ b/xwayland/selection.c @@ -844,8 +844,7 @@ void xwm_selection_finish(struct wlr_xwm *xwm) { wlr_seat_set_primary_selection(xwm->seat, NULL, wl_display_next_serial(xwm->xwayland->wl_display)); } - wl_list_remove(&xwm->seat_selection.link); - wl_list_remove(&xwm->seat_primary_selection.link); + wlr_xwayland_set_seat(xwm->xwayland, NULL); } } -- cgit v1.2.3