aboutsummaryrefslogtreecommitdiff
path: root/nx-X11/programs/Xserver/hw/nxagent/Clipboard.c
diff options
context:
space:
mode:
authorUlrich Sibiller <uli42@gmx.de>2019-08-06 22:54:55 +0200
committerMike Gabriel <mike.gabriel@das-netzwerkteam.de>2019-09-29 17:44:08 +0200
commit92ad24a3b7069f009e2abe0f8b46cca717db110a (patch)
tree66dfb4b406522ac0c9593d8a4f7b0e4d8fa0c280 /nx-X11/programs/Xserver/hw/nxagent/Clipboard.c
parent9a144136d76589b2b7a7a55a38f2b8bd64ac7e5f (diff)
downloadnx-libs-92ad24a3b7069f009e2abe0f8b46cca717db110a.tar.gz
nx-libs-92ad24a3b7069f009e2abe0f8b46cca717db110a.tar.bz2
nx-libs-92ad24a3b7069f009e2abe0f8b46cca717db110a.zip
Clipboard.c: translate internal to external atom
serverClientCutProperty is the external equivalent of the internal clientCutProperty. We need it on the server side, too, because we use the property on the serverWindow on the real X server. We could (mis)use serverCutProperty here but this might introduce race conditions when both sides request selections simultaneously.
Diffstat (limited to 'nx-X11/programs/Xserver/hw/nxagent/Clipboard.c')
-rw-r--r--nx-X11/programs/Xserver/hw/nxagent/Clipboard.c24
1 files changed, 20 insertions, 4 deletions
diff --git a/nx-X11/programs/Xserver/hw/nxagent/Clipboard.c b/nx-X11/programs/Xserver/hw/nxagent/Clipboard.c
index 8255612ac..5d6c7cd7f 100644
--- a/nx-X11/programs/Xserver/hw/nxagent/Clipboard.c
+++ b/nx-X11/programs/Xserver/hw/nxagent/Clipboard.c
@@ -129,6 +129,7 @@ static Atom serverTARGETS;
static Atom serverTIMESTAMP;
static Atom serverTEXT;
static Atom serverUTF8_STRING;
+static Atom serverClientCutProperty;
static Atom clientTARGETS;
static Atom clientTEXT;
static Atom clientCOMPOUND_TEXT;
@@ -328,6 +329,8 @@ void nxagentPrintClipboardStat(char *header)
fprintf(stderr, " serverUTF8_STRING [% 4d][%s]\n", serverUTF8_STRING, s);
SAFE_XFree(s); s = XGetAtomName(nxagentDisplay, serverCutProperty);
fprintf(stderr, " serverCutProperty [% 4d][%s]\n", serverCutProperty, s);
+ SAFE_XFree(s); s = XGetAtomName(nxagentDisplay, serverClientCutProperty);
+ fprintf(stderr, " serverClientCutProperty [% 4d][%s]\n", serverClientCutProperty, s);
SAFE_XFree(s); s = XGetAtomName(nxagentDisplay, serverTIMESTAMP);
fprintf(stderr, " serverTIMESTAMP [% 4d][%s]\n", serverTIMESTAMP, s);
@@ -1127,7 +1130,7 @@ void nxagentNotifySelection(XEvent *X)
{
if ((lastSelectionOwner[i].client != NULL) &&
(lastSelectionOwner[i].windowPtr != NULL) &&
- (X->xselection.property == clientCutProperty))
+ (X->xselection.property == serverClientCutProperty))
{
Atom atomReturnType;
int resultFormat;
@@ -1624,19 +1627,30 @@ int nxagentSendNotify(xEvent *event)
/*
* 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 no other
+ * properties except serverCutProperty, the only thing we need to
+ * ensure is that the internal Atom clientCutProperty must differ
+ * from the server-side serverCutProperty Atom. The actual name is
+ * not important. To be clean here we use a seperate
+ * serverClientCutProperty.
*/
XSelectionEvent eventSelection = {
.requestor = serverWindow,
.selection = event->u.selectionNotify.selection,
.target = event->u.selectionNotify.target,
- .property = event->u.selectionNotify.property,
+ .property = serverClientCutProperty,
.time = CurrentTime,
};
/*
- * On real server, the right CLIPBOARD atom is
- * XInternAtom(nxagentDisplay, "CLIPBOARD", 1).
+ * On the real server, the right CLIPBOARD atom is
+ * XInternAtom(nxagentDisplay, "CLIPBOARD", 1), which is stored in
+ * lastSelectionOwner[nxagentClipboardSelection].selection. For
+ * PRIMARY there's nothing to map because that is identical on all
+ * X servers (defined in Xatom.h).
*/
if (event->u.selectionNotify.selection == MakeAtom("CLIPBOARD", 9, 0))
@@ -1728,6 +1742,8 @@ int nxagentInitClipboard(WindowPtr pWin)
serverTARGETS = nxagentAtoms[6]; /* TARGETS */
serverTEXT = nxagentAtoms[7]; /* TEXT */
serverUTF8_STRING = nxagentAtoms[12]; /* UTF8_STRING */
+ /* see nxagentSendNotify for an explanation */
+ serverClientCutProperty = nxagentAtoms[15]; /* NX_CUT_BUFFER_CLIENT */
if (serverCutProperty == None)
{