aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorUlrich Sibiller <uli42@gmx.de>2019-06-10 14:18:06 +0200
committerMike Gabriel <mike.gabriel@das-netzwerkteam.de>2019-06-11 12:22:17 +0200
commit3fd7e5f93fe0cc3198c5cc2fb5da9635b849c5be (patch)
tree1c6687b1c1b606113a29d4eae09262e882db6e2f
parent58cd35745086567b5b1fa0fc7a295e849ac070ce (diff)
downloadnx-libs-3fd7e5f93fe0cc3198c5cc2fb5da9635b849c5be.tar.gz
nx-libs-3fd7e5f93fe0cc3198c5cc2fb5da9635b849c5be.tar.bz2
nx-libs-3fd7e5f93fe0cc3198c5cc2fb5da9635b849c5be.zip
Add nxagentExternalClipboardEventTrap
-rw-r--r--nx-X11/programs/Xserver/hw/nxagent/Events.c12
-rw-r--r--nx-X11/programs/Xserver/hw/nxagent/Trap.c8
-rw-r--r--nx-X11/programs/Xserver/hw/nxagent/Trap.h8
3 files changed, 28 insertions, 0 deletions
diff --git a/nx-X11/programs/Xserver/hw/nxagent/Events.c b/nx-X11/programs/Xserver/hw/nxagent/Events.c
index 7ec97dada..4bddbba3a 100644
--- a/nx-X11/programs/Xserver/hw/nxagent/Events.c
+++ b/nx-X11/programs/Xserver/hw/nxagent/Events.c
@@ -2968,7 +2968,19 @@ int nxagentHandleXFixesSelectionNotify(XEvent *X)
info.selection = &CurrentSelections[i];
info.kind = xfixesEvent->xfixesselection.subtype;
+
+ /*
+ * The trap indicates that we are triggered by a clipboard event
+ * originating from the real X server. In that case we do not
+ * want to propagate back changes to the real X server, because
+ * it already knows about them and we would end up in an
+ * infinite loop of events. If there was a better way to
+ * identify that situation during Callback processing we could
+ * get rid of the Trap...
+ */
+ nxagentExternalClipboardEventTrap = 1;
CallCallbacks(&SelectionCallback, &info);
+ nxagentExternalClipboardEventTrap = 0;
}
}
return 1;
diff --git a/nx-X11/programs/Xserver/hw/nxagent/Trap.c b/nx-X11/programs/Xserver/hw/nxagent/Trap.c
index c582f6a16..f219bb43c 100644
--- a/nx-X11/programs/Xserver/hw/nxagent/Trap.c
+++ b/nx-X11/programs/Xserver/hw/nxagent/Trap.c
@@ -120,3 +120,11 @@ int nxagentXkbCapsTrap = 0;
int nxagentXkbNumTrap = 0;
+
+/*
+ * Set to indicate we are processing a clipboard event triggered by
+ * the real X server. This is used to avoid endless loops if callbacks
+ * would trigger another event by the real X server
+ */
+
+int nxagentExternalClipboardEventTrap = 0;
diff --git a/nx-X11/programs/Xserver/hw/nxagent/Trap.h b/nx-X11/programs/Xserver/hw/nxagent/Trap.h
index f0884f657..9f0c055c8 100644
--- a/nx-X11/programs/Xserver/hw/nxagent/Trap.h
+++ b/nx-X11/programs/Xserver/hw/nxagent/Trap.h
@@ -121,4 +121,12 @@ extern int nxagentXkbCapsTrap;
extern int nxagentXkbNumTrap;
+/*
+ * Set to indicate we are processing a clipboard event triggered by
+ * the real X server. This is used to avoid endless loops if callbacks
+ * would trigger another event by the real X server
+ */
+
+extern int nxagentExternalClipboardEventTrap;
+
#endif /* __Trap_H__ */