Update the MULTIPLE property with conversion outcomes

Per the ICCCM spec:

> If the owner fails to convert the target named by an atom in the
> MULTIPLE property, it should replace that atom in the property with
> None.

* src/xselect.c (x_handle_selection_request): Do it.
This commit is contained in:
Vladimir Panteleev
2022-02-04 02:46:50 +00:00
committed by Po Lu
parent de687e8983
commit 5098f2b844

View File

@@ -795,6 +795,7 @@ x_handle_selection_request (struct selection_input_event *event)
Window requestor = SELECTION_EVENT_REQUESTOR (event);
Lisp_Object multprop;
ptrdiff_t j, nselections;
struct selection_data cs;
if (property == None) goto DONE;
multprop
@@ -811,11 +812,19 @@ x_handle_selection_request (struct selection_input_event *event)
Lisp_Object subtarget = AREF (multprop, 2*j);
Atom subproperty = symbol_to_x_atom (dpyinfo,
AREF (multprop, 2*j+1));
bool subsuccess = false;
if (subproperty != None)
x_convert_selection (selection_symbol, subtarget,
subproperty, true, dpyinfo);
subsuccess = x_convert_selection (selection_symbol, subtarget,
subproperty, true, dpyinfo);
if (!subsuccess)
ASET (multprop, 2*j+1, Qnil);
}
/* Save conversion results */
lisp_data_to_selection_data (dpyinfo, multprop, &cs);
XChangeProperty (dpyinfo->display, requestor, property,
cs.type, cs.format, PropModeReplace,
cs.data, cs.size);
success = true;
}
else