diff options
author | Dominique Martinet <asmadeus@codewreck.org> | 2017-12-29 16:30:59 +0100 |
---|---|---|
committer | Dominique Martinet <asmadeus@codewreck.org> | 2017-12-29 16:30:59 +0100 |
commit | bb0d888f2500290693232704c2a477cf321cdec6 (patch) | |
tree | 248f107be762d521e0cb8f1c792ceaf6cbacc81e /xwayland | |
parent | f8a346380c8d22a11c5acf72b74e35a6dca4f5a2 (diff) |
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
Diffstat (limited to 'xwayland')
-rw-r--r-- | xwayland/selection.c | 24 | ||||
-rw-r--r-- | xwayland/xwm.c | 8 |
2 files changed, 25 insertions, 7 deletions
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) { diff --git a/xwayland/xwm.c b/xwayland/xwm.c index facc5566..5b710b85 100644 --- a/xwayland/xwm.c +++ b/xwayland/xwm.c @@ -1092,9 +1092,7 @@ void xwm_destroy(struct wlr_xwm *xwm) { if (!xwm) { return; } - if (xwm->selection_window) { - xcb_destroy_window(xwm->xcb_conn, xwm->selection_window); - } + xwm_selection_finish(xwm); if (xwm->cursor) { xcb_free_cursor(xwm->xcb_conn, xwm->cursor); } @@ -1114,10 +1112,6 @@ void xwm_destroy(struct wlr_xwm *xwm) { wl_list_for_each_safe(xsurface, tmp, &xwm->unpaired_surfaces, link) { wlr_xwayland_surface_destroy(xsurface); } - if (xwm->seat) { - wl_list_remove(&xwm->seat_selection.link); - wl_list_remove(&xwm->seat_primary_selection.link); - } wl_list_remove(&xwm->compositor_surface_create.link); xcb_disconnect(xwm->xcb_conn); |