[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
master 5098f2b844 2/2: Update the MULTIPLE property with conversion outc
From: |
Po Lu |
Subject: |
master 5098f2b844 2/2: Update the MULTIPLE property with conversion outcomes |
Date: |
Fri, 4 Feb 2022 20:07:31 -0500 (EST) |
branch: master
commit 5098f2b844b05e4ebbbbf44c5adbc3d7975e43e6
Author: Vladimir Panteleev <git@cy.md>
Commit: Po Lu <luangruo@yahoo.com>
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.
---
src/xselect.c | 13 +++++++++++--
1 file changed, 11 insertions(+), 2 deletions(-)
diff --git a/src/xselect.c b/src/xselect.c
index 537be2ddd5..f2a64dd953 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