aboutsummaryrefslogtreecommitdiff
path: root/nx-X11/programs/Xserver/hw
diff options
context:
space:
mode:
Diffstat (limited to 'nx-X11/programs/Xserver/hw')
-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__ */