aboutsummaryrefslogtreecommitdiff
path: root/nx-X11
diff options
context:
space:
mode:
authorUlrich Sibiller <uli42@gmx.de>2020-11-17 16:20:20 +0100
committerUlrich Sibiller <uli42@gmx.de>2021-06-20 20:12:51 +0200
commit41ea3b68425f45bdcd90a21baa84506f48332782 (patch)
treefe7ccae6050140b68206ac75314a0f3f010e9cd7 /nx-X11
parent53c03eaf3bfe06c445e9353c97663553afb1a3f7 (diff)
downloadnx-libs-41ea3b68425f45bdcd90a21baa84506f48332782.tar.gz
nx-libs-41ea3b68425f45bdcd90a21baa84506f48332782.tar.bz2
nx-libs-41ea3b68425f45bdcd90a21baa84506f48332782.zip
Clipboard.c: correctly pass back failure to real X server
Diffstat (limited to 'nx-X11')
-rw-r--r--nx-X11/programs/Xserver/hw/nxagent/Clipboard.c68
1 files changed, 46 insertions, 22 deletions
diff --git a/nx-X11/programs/Xserver/hw/nxagent/Clipboard.c b/nx-X11/programs/Xserver/hw/nxagent/Clipboard.c
index 10dafcda6..ceed43aa9 100644
--- a/nx-X11/programs/Xserver/hw/nxagent/Clipboard.c
+++ b/nx-X11/programs/Xserver/hw/nxagent/Clipboard.c
@@ -2594,33 +2594,57 @@ int nxagentSendNotificationToSelfViaXServer(xEvent *event)
else
{
/*
- * Setup selection notify event to real server.
- *
- * .property must be a server-side Atom. As this property is only
- * set on our serverWindow and normally there are few other
- * properties except serverTransToAgentProperty, the only thing
- * we need to ensure is that the internal Atom clientCutProperty
- * differs from the server-side serverTransToAgentProperty
- * Atom. The actual name is not important. To be clean here we use
- * a separate serverTransFromAgentProperty.
+ * if the property is 0 (reporting failure) we can directly
+ * answer to the lastServer about the failure!
*/
+ if (lastServers[index].requestor != None && event->u.selectionNotify.property == 0)
+ {
+ #ifdef DEBUG
+ fprintf(stderr, "%s: passing on failure to lastServers[%d].requestor [%ld].\n", __func__,
+ index, lastServers[index].requestor);
+ #endif
- XSelectionEvent eventSelection = {
- .requestor = serverWindow,
- .selection = translateLocalToRemoteSelection(event->u.selectionNotify.selection),
- .target = translateLocalToRemoteTarget(event->u.selectionNotify.target),
- .property = serverTransFromAgentProperty,
- .time = CurrentTime,
- };
+ XSelectionEvent eventSelection = {
+ .requestor = lastServers[index].requestor,
+ .selection = remSelAtoms[index],
+ .target = lastServers[index].target,
+ .property = 0,
+ .time = lastServers[index].time,
+ };
+ sendSelectionNotifyEventToXServer(&eventSelection);
- #ifdef DEBUG
- fprintf(stderr, "%s: remote property [%ld][%s].\n", __func__,
- serverTransFromAgentProperty, NameForRemAtom(serverTransFromAgentProperty));
- #endif
+ lastServers[index].requestor = None;
+ return 1;
+ }
+ else
+ {
+ /*
+ * Setup selection notify event to real server.
+ *
+ * .property must be a server-side Atom. As this property is only
+ * set on our serverWindow and normally there are few other
+ * properties except serverTransToAgentProperty, the only thing
+ * we need to ensure is that the internal Atom clientCutProperty
+ * differs from the server-side serverTransToAgentProperty
+ * Atom. The actual name is not important. To be clean here we use
+ * a separate serverTransFromAgentProperty.
+ */
- sendSelectionNotifyEventToXServer(&eventSelection);
+ XSelectionEvent eventSelection = {
+ .requestor = serverWindow,
+ .selection = translateLocalToRemoteSelection(event->u.selectionNotify.selection),
+ .target = translateLocalToRemoteTarget(event->u.selectionNotify.target),
+ .property = serverTransFromAgentProperty,
+ .time = CurrentTime,
+ };
- return 1;
+ #ifdef DEBUG
+ fprintf(stderr, "%s: remote property [%ld][%s].\n", __func__,
+ serverTransFromAgentProperty, NameForRemAtom(serverTransFromAgentProperty));
+ #endif
+ sendSelectionNotifyEventToXServer(&eventSelection);
+ return 1;
+ }
}
}