diff options
author | Mike Gabriel <mike.gabriel@das-netzwerkteam.de> | 2021-10-18 09:28:50 +0200 |
---|---|---|
committer | Mike Gabriel <mike.gabriel@das-netzwerkteam.de> | 2021-10-18 09:28:50 +0200 |
commit | b7034724abb859db36a3fa4312e4827141114f45 (patch) | |
tree | 5e4406bd491e61be781de5b2075dabd76ba9514b /nx-X11/programs/Xserver/hw/nxagent/Atoms.c | |
parent | b67b910a6adf3287fad10cc97cf9484b0057b0bd (diff) | |
parent | 31057d00b8cdbe97837f508c3cb0f2c521a30266 (diff) | |
download | nx-libs-b7034724abb859db36a3fa4312e4827141114f45.tar.gz nx-libs-b7034724abb859db36a3fa4312e4827141114f45.tar.bz2 nx-libs-b7034724abb859db36a3fa4312e4827141114f45.zip |
Merge branch 'uli42-pr/many_clipboard_fixes' into 3.6.x
Attributes GH PR #1018: https://github.com/ArcticaProject/nx-libs/pull/1018
Diffstat (limited to 'nx-X11/programs/Xserver/hw/nxagent/Atoms.c')
-rw-r--r-- | nx-X11/programs/Xserver/hw/nxagent/Atoms.c | 71 |
1 files changed, 70 insertions, 1 deletions
diff --git a/nx-X11/programs/Xserver/hw/nxagent/Atoms.c b/nx-X11/programs/Xserver/hw/nxagent/Atoms.c index 2ddf87e55..6ce8b21e8 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Atoms.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Atoms.c @@ -76,7 +76,7 @@ Atom nxagentAtoms[NXAGENT_NUMBER_OF_ATOMS]; * Careful! Do not change indices here! Some of those are referenced * at other places via nxagentAtoms[index]. */ -static char *nxagentAtomNames[NXAGENT_NUMBER_OF_ATOMS + 1] = +static char *nxagentAtomNames[NXAGENT_NUMBER_OF_ATOMS + 2] = { "NX_IDENTITY", /* 0 */ /* NX_IDENTITY was used in earlier nx versions to communicate @@ -135,6 +135,27 @@ static char *nxagentAtomNames[NXAGENT_NUMBER_OF_ATOMS + 1] = "COMPOUND_TEXT", /* 16 */ /* one of the supported data formats for selections. Standard ICCCM Atom */ + "INCR", /* 17 */ + /* incremental clipboard transfers. Standard + ICCCM Atom */ + "MULTIPLE", /* 18 */ + /* request selection in multiple formats at once. Standard + ICCCM Atom */ + "DELETE", /* 19 */ + /* request to delete selection. Standard ICCCM Atom */ + "INSERT_SELECTION", /* 20 */ + /* request to insert other selection. Standard ICCCM Atom */ + "INSERT_PROPERTY", /* 21 */ + /* request to insert content of property into selection. Standard + ICCCM Atom */ + "SAVE_TARGETS", /* 22 */ + /* 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 }; @@ -750,6 +771,54 @@ XlibAtom nxagentLocalToRemoteAtom(Atom local) } } +/* + * This is mainly used to simplify debug prints. It returns + * the string for a remote atom or NULL if atom is unknown/invalid + * + * The string must NOT be freed by the caller. + */ +const char *nxagentRemoteAtomToString(XlibAtom remote) +{ + if (remote == None || remote == BAD_RESOURCE) + { + #ifdef DEBUG + fprintf(stderr, "%s: remote [%d] is None or BAD_RESOURCE\n", __func__, remote); + #endif + return NULL; + } + + /* no mapping required for built-in atoms */ + if (remote <= XA_LAST_PREDEFINED) + { + #ifdef DEBUG + fprintf(stderr, "%s: remote [%d] is <= XA_LAST_PREDEFINED [%d]\n", __func__, remote, XA_LAST_PREDEFINED); + #endif + + /* simply use the builtin string that is the same on every X server */ + return NameForAtom(remote); + } + + AtomMap *current = nxagentFindAtomByRemoteValue(remote); + if (current) + { + return current->string; + } + else + { + /* fill up the cache */ + Atom local = nxagentRemoteToLocalAtom(remote); + if (local != None) + { + current = nxagentFindAtomByRemoteValue(remote); + if (current) + { + return current->string; + } + } + } + return NULL; +} + Atom nxagentRemoteToLocalAtom(XlibAtom remote) { if (remote == None || remote == BAD_RESOURCE) |