aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--nx-X11/programs/Xserver/hw/nxagent/Atoms.c1
-rw-r--r--nx-X11/programs/Xserver/hw/nxagent/Atoms.h2
-rw-r--r--nx-X11/programs/Xserver/hw/nxagent/Clipboard.c24
3 files changed, 22 insertions, 5 deletions
diff --git a/nx-X11/programs/Xserver/hw/nxagent/Atoms.c b/nx-X11/programs/Xserver/hw/nxagent/Atoms.c
index 1c48df61c..d9d203faa 100644
--- a/nx-X11/programs/Xserver/hw/nxagent/Atoms.c
+++ b/nx-X11/programs/Xserver/hw/nxagent/Atoms.c
@@ -90,6 +90,7 @@ static char *nxagentAtomNames[NXAGENT_NUMBER_OF_ATOMS + 1] =
"UTF8_STRING", /* 12 */
"_NET_WM_STATE", /* 13 */
"_NET_WM_STATE_FULLSCREEN", /* 14 */
+ "NX_CUT_BUFFER_CLIENT", /* 15 */
NULL,
NULL
};
diff --git a/nx-X11/programs/Xserver/hw/nxagent/Atoms.h b/nx-X11/programs/Xserver/hw/nxagent/Atoms.h
index 08eb1cfff..cbbb7bd1d 100644
--- a/nx-X11/programs/Xserver/hw/nxagent/Atoms.h
+++ b/nx-X11/programs/Xserver/hw/nxagent/Atoms.h
@@ -30,7 +30,7 @@
#include "../../include/window.h"
#include "screenint.h"
-#define NXAGENT_NUMBER_OF_ATOMS 16
+#define NXAGENT_NUMBER_OF_ATOMS 17
extern Atom nxagentAtoms[NXAGENT_NUMBER_OF_ATOMS];
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)
{