From 533f08ddb9748c20bd736f356c3a7fe38f53a113 Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Mon, 26 Oct 2020 23:18:27 +0100 Subject: Clipboard.c: add TARGET_SIZES --- nx-X11/programs/Xserver/hw/nxagent/Atoms.c | 8 +++++++- nx-X11/programs/Xserver/hw/nxagent/Atoms.h | 2 +- nx-X11/programs/Xserver/hw/nxagent/Clipboard.c | 21 +++++++++++++++++++++ 3 files changed, 29 insertions(+), 2 deletions(-) diff --git a/nx-X11/programs/Xserver/hw/nxagent/Atoms.c b/nx-X11/programs/Xserver/hw/nxagent/Atoms.c index 86022ee62..6ce8b21e8 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Atoms.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Atoms.c @@ -149,7 +149,13 @@ static char *nxagentAtomNames[NXAGENT_NUMBER_OF_ATOMS + 2] = /* request to insert content of property into selection. Standard ICCCM Atom */ "SAVE_TARGETS", /* 22 */ - /* request tp save clipboard content to clipboard manager on exit */ + /* request to save clipboard content to clipboard manager on + exit, see + https://www.freedesktop.org/wiki/ClipboardManager */ + "TARGET_SIZES", /* 23 */ + /* request to retrieve the sizes of the clipboard content in + various formats, see + https://www.freedesktop.org/wiki/ClipboardManager */ NULL, NULL }; diff --git a/nx-X11/programs/Xserver/hw/nxagent/Atoms.h b/nx-X11/programs/Xserver/hw/nxagent/Atoms.h index 84da3ec8e..4a73a817d 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 23 +#define NXAGENT_NUMBER_OF_ATOMS 24 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 9dc5f8ad7..dd8b049db 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Clipboard.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Clipboard.c @@ -154,6 +154,7 @@ static XlibAtom serverDELETE; static XlibAtom serverINSERT_SELECTION; static XlibAtom serverINSERT_PROPERTY; static XlibAtom serverSAVE_TARGETS; +static XlibAtom serverTARGET_SIZES; static XlibAtom serverTEXT; static XlibAtom serverCOMPOUND_TEXT; static XlibAtom serverUTF8_STRING; @@ -166,6 +167,7 @@ static Atom clientDELETE; static Atom clientINSERT_SELECTION; static Atom clientINSERT_PROPERTY; static Atom clientSAVE_TARGETS; +static Atom clientTARGET_SIZES; static Atom clientTEXT; static Atom clientCOMPOUND_TEXT; static Atom clientUTF8_STRING; @@ -179,6 +181,7 @@ static char szAgentDELETE[] = "DELETE"; static char szAgentINSERT_SELECTION[] = "INSERT_SELECTION"; static char szAgentINSERT_PROPERTY[] = "INSERT_PROPERTY"; static char szAgentSAVE_TARGETS[] = "SAVE_TARGETS"; +static char szAgentTARGET_SIZES[] = "TARGET_SIZES"; static char szAgentCOMPOUND_TEXT[] = "COMPOUND_TEXT"; static char szAgentUTF8_STRING[] = "UTF8_STRING"; static char szAgentNX_CUT_BUFFER_CLIENT[] = "NX_CUT_BUFFER_CLIENT"; @@ -871,6 +874,14 @@ void nxagentHandleSelectionRequestFromXServer(XEvent *X) replyRequestSelectionToXServer(X, False); return; } + else if (X->xselectionrequest.target == serverTARGET_SIZES) + { + #ifdef DEBUG + fprintf(stderr, "%s: (currently) unsupported target [TARGET_SIZES] - denying request.\n", __func__); + #endif + replyRequestSelectionToXServer(X, False); + return; + } else { fprintf(stderr, "%s: target [%ld][%s].\n", __func__, X->xselectionrequest.target, @@ -2062,6 +2073,14 @@ int nxagentConvertSelection(ClientPtr client, WindowPtr pWin, Atom selection, sendSelectionNotifyEventToClient(client, time, requestor, selection, target, None); return 1; } + else if (target == clientTARGET_SIZES) + { + #ifdef DEBUG + fprintf(stderr, "%s: (currently) unsupported target [TARGET_SIZES] - denying request.\n", __func__); + #endif + sendSelectionNotifyEventToClient(client, time, requestor, selection, target, None); + return 1; + } if (lastClients[index].clientPtr == client) { @@ -2378,6 +2397,7 @@ Bool nxagentInitClipboard(WindowPtr pWin) clientINSERT_SELECTION = MakeAtom(szAgentINSERT_SELECTION, strlen(szAgentINSERT_SELECTION), True); clientINSERT_PROPERTY = MakeAtom(szAgentINSERT_PROPERTY, strlen(szAgentINSERT_PROPERTY), True); clientSAVE_TARGETS = MakeAtom(szAgentSAVE_TARGETS, strlen(szAgentSAVE_TARGETS), True); + clientTARGET_SIZES = MakeAtom(szAgentTARGET_SIZES, strlen(szAgentTARGET_SIZES), True); SAFE_free(lastSelectionOwner); lastSelectionOwner = (SelectionOwner *) malloc(nxagentMaxSelections * sizeof(SelectionOwner)); @@ -2438,6 +2458,7 @@ Bool nxagentInitClipboard(WindowPtr pWin) serverINSERT_SELECTION = nxagentAtoms[20]; /* INSERT_SELECTION */ serverINSERT_PROPERTY = nxagentAtoms[21]; /* INSERT_PROPERTY */ serverSAVE_TARGETS = nxagentAtoms[22]; /* SAVE_TARGETS */ + serverTARGET_SIZES = nxagentAtoms[23]; /* TARGET_SIZES */ /* * Server side properties to hold pasted data. -- cgit v1.2.3