xwm: Don't clear the selection if it has no text type available

weston maintains a copy of the most recently selected "thing" - it picks
the first available type when it copies, and saves that one only.

When an application quits weston will make the saved selection active.

When xwm sees the selection set it will check if any of the offered types
are text.  If no text type is offered it will clear the selection.

weston then interprets this in the same way as an application exiting and
causing the selection to be unset, and we get caught in a live lock with
both weston and xwayland consuming as much cpu as they can.

The simple fix is to just remove the test for text presence.

Signed-off-by: Derek Foreman <derekf@osg.samsung.com>
Reviewed-by: Carlos Garnacho <carlosg@gnome.org>
dev
Derek Foreman 9 years ago committed by Bryce Harrington
parent 22b1f93432
commit 4e18448286
  1. 28
      xwayland/selection.c

@ -655,8 +655,6 @@ weston_wm_set_selection(struct wl_listener *listener, void *data)
struct weston_wm *wm = struct weston_wm *wm =
container_of(listener, struct weston_wm, selection_listener); container_of(listener, struct weston_wm, selection_listener);
struct weston_data_source *source = seat->selection_data_source; struct weston_data_source *source = seat->selection_data_source;
const char **p, **end;
int has_text_plain = 0;
if (source == NULL) { if (source == NULL) {
if (wm->selection_owner == wm->selection_window) if (wm->selection_owner == wm->selection_window)
@ -670,28 +668,10 @@ weston_wm_set_selection(struct wl_listener *listener, void *data)
if (source->send == data_source_send) if (source->send == data_source_send)
return; return;
p = source->mime_types.data; xcb_set_selection_owner(wm->conn,
end = (const char **) wm->selection_window,
((char *) source->mime_types.data + source->mime_types.size); wm->atom.clipboard,
while (p < end) { XCB_TIME_CURRENT_TIME);
weston_log(" %s\n", *p);
if (strcmp(*p, "text/plain") == 0 ||
strcmp(*p, "text/plain;charset=utf-8") == 0)
has_text_plain = 1;
p++;
}
if (has_text_plain) {
xcb_set_selection_owner(wm->conn,
wm->selection_window,
wm->atom.clipboard,
XCB_TIME_CURRENT_TIME);
} else {
xcb_set_selection_owner(wm->conn,
XCB_ATOM_NONE,
wm->atom.clipboard,
XCB_TIME_CURRENT_TIME);
}
} }
void void

Loading…
Cancel
Save