Fix primary selection not sent to xwayland when clipboard is empty

This commit is contained in:
emersion 2017-12-26 12:20:01 +01:00
parent 4a11609b76
commit 998267e291
No known key found for this signature in database
GPG Key ID: 0FDE7BE0E88F5E48
1 changed files with 7 additions and 7 deletions

View File

@ -148,14 +148,18 @@ static void xwm_selection_source_send(struct wlr_xwm_selection *selection,
struct wlr_data_source *source = selection->xwm->seat->selection_source; struct wlr_data_source *source = selection->xwm->seat->selection_source;
if (source != NULL) { if (source != NULL) {
source->send(source, mime_type, fd); source->send(source, mime_type, fd);
return;
} }
} else if (selection == &selection->xwm->primary_selection) { } else if (selection == &selection->xwm->primary_selection) {
struct wlr_primary_selection_source *source = struct wlr_primary_selection_source *source =
selection->xwm->seat->primary_selection_source; selection->xwm->seat->primary_selection_source;
if (source != NULL) { if (source != NULL) {
source->send(source, mime_type, fd); source->send(source, mime_type, fd);
return;
} }
} }
wlr_log(L_DEBUG, "not sending selection: no selection source available");
} }
static void xwm_selection_send_data(struct wlr_xwm_selection *selection, static void xwm_selection_send_data(struct wlr_xwm_selection *selection,
@ -221,6 +225,9 @@ static void xwm_selection_send_targets(struct wlr_xwm_selection *selection) {
struct wl_array *mime_types = xwm_selection_source_get_mime_types(selection); struct wl_array *mime_types = xwm_selection_source_get_mime_types(selection);
if (mime_types == NULL) { if (mime_types == NULL) {
wlr_log(L_DEBUG, "not sending selection targets: "
"no selection source available");
xwm_selection_send_notify(selection, XCB_ATOM_NONE);
return; return;
} }
@ -309,13 +316,6 @@ static void xwm_handle_selection_request(struct wlr_xwm *xwm,
selection->incr = 0; selection->incr = 0;
selection->flush_property_on_delete = 0; selection->flush_property_on_delete = 0;
if (xwm->seat->selection_source == NULL) {
wlr_log(L_DEBUG, "not handling selection request: "
"no selection source assigned to xwayland seat");
xwm_selection_send_notify(selection, XCB_ATOM_NONE);
return;
}
// No xwayland surface focused, deny access to clipboard // No xwayland surface focused, deny access to clipboard
if (xwm->focus_surface == NULL) { if (xwm->focus_surface == NULL) {
wlr_log(L_DEBUG, "denying read access to clipboard: " wlr_log(L_DEBUG, "denying read access to clipboard: "