From: Vladimir Panteleev Date: Fri, 4 Feb 2022 02:46:50 +0000 (+0000) Subject: Update the MULTIPLE property with conversion outcomes X-Git-Tag: emacs-29.0.90~2523 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=5098f2b844b05e4ebbbbf44c5adbc3d7975e43e6;p=emacs.git 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. --- diff --git a/src/xselect.c b/src/xselect.c index 537be2ddd54..f2a64dd9534 100644 --- a/src/xselect.c +++ b/src/xselect.c @@ -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