Commit 3fd7e5f9 authored by Ulrich Sibiller's avatar Ulrich Sibiller Committed by Mike Gabriel

Add nxagentExternalClipboardEventTrap

parent 58cd3574
...@@ -2968,7 +2968,19 @@ int nxagentHandleXFixesSelectionNotify(XEvent *X) ...@@ -2968,7 +2968,19 @@ int nxagentHandleXFixesSelectionNotify(XEvent *X)
info.selection = &CurrentSelections[i]; info.selection = &CurrentSelections[i];
info.kind = xfixesEvent->xfixesselection.subtype; 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); CallCallbacks(&SelectionCallback, &info);
nxagentExternalClipboardEventTrap = 0;
} }
} }
return 1; return 1;
......
...@@ -120,3 +120,11 @@ int nxagentXkbCapsTrap = 0; ...@@ -120,3 +120,11 @@ int nxagentXkbCapsTrap = 0;
int nxagentXkbNumTrap = 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;
...@@ -121,4 +121,12 @@ extern int nxagentXkbCapsTrap; ...@@ -121,4 +121,12 @@ extern int nxagentXkbCapsTrap;
extern int nxagentXkbNumTrap; 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__ */ #endif /* __Trap_H__ */
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment