diff options
author | Ulrich Sibiller <uli42@gmx.de> | 2018-10-16 00:19:58 +0200 |
---|---|---|
committer | Mike Gabriel <mike.gabriel@das-netzwerkteam.de> | 2018-10-27 20:55:02 +0200 |
commit | 5d26addd3df578b057e9820015018d019a85296f (patch) | |
tree | 512b4b9e1800c04c0550680fae7e59e63173cff2 | |
parent | 1c4c9f60978d5ef13e10e85ec2ce18898196177b (diff) | |
download | nx-libs-5d26addd3df578b057e9820015018d019a85296f.tar.gz nx-libs-5d26addd3df578b057e9820015018d019a85296f.tar.bz2 nx-libs-5d26addd3df578b057e9820015018d019a85296f.zip |
Clipboard.c: new debug function to reduce duplicate code
-rw-r--r-- | nx-X11/programs/Xserver/hw/nxagent/Clipboard.c | 66 |
1 files changed, 53 insertions, 13 deletions
diff --git a/nx-X11/programs/Xserver/hw/nxagent/Clipboard.c b/nx-X11/programs/Xserver/hw/nxagent/Clipboard.c index ae73f36e5..a7a1cbdf3 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Clipboard.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Clipboard.c @@ -212,6 +212,57 @@ int nxagentSendNotify(xEvent *event); void nxagentPrintClipboardStat(char *); +#ifdef DEBUG +void nxagentPrintSelectionStat(int sel) +{ + SelectionOwner lOwner = lastSelectionOwner[sel]; + Selection curSel = CurrentSelections[sel]; + char *s =NULL; + +#ifdef CLIENTIDS + fprintf(stderr, " lastSelectionOwner[].client [%p] index [%d] PID [%d] Cmd [%s]\n", + lOwner.client, + lOwner.client ? lOwner.client->index : -1, + GetClientPid(lOwner.client), + GetClientCmdName(lOwner.client)); +#else + fprintf(stderr, " lastSelectionOwner[].client [%p] index [%d]\n", + lOwner.client, + lOwner.client ? lOwner.client->index : -1); +#endif + fprintf(stderr, " lastSelectionOwner[].window [0x%x]\n", lOwner.window); + fprintf(stderr, " lastSelectionOwner[].windowPtr [%p]\n", lOwner.windowPtr); + fprintf(stderr, " lastSelectionOwner[].lastTimeChanged [%u]\n", lOwner.lastTimeChanged); + + /* + print the selection name. + */ + if (lOwner.client) + { + fprintf(stderr, " lastSelectionOwner[].selection [% 4d][%s] (local)\n", lOwner.selection, NameForAtom(lOwner.selection)); + } + else + { + SAFE_XFree(s); s = XGetAtomName(nxagentDisplay, lOwner.selection); + fprintf(stderr, " lastSelectionOwner[].selection [% 4d][%s] (remote)\n", lOwner.selection, validateString(s)); + SAFE_XFree(s); + } +#ifdef CLIENTIDS + fprintf(stderr, " CurrentSelections[].client [%p] index [%d] PID [%d] Cmd [%s]\n", + curSel.client, + curSel.client ? curSel.client->index : -1, + GetClientPid(curSel.client), + GetClientCmdName(curSel.client)); +#else + fprintf(stderr, " CurrentSelections[].client [%p] index [%d]\n", + curSel.client, + curSel.client ? curSel.client->index : -1); +#endif + fprintf(stderr, " CurrentSelections[].window [0x%x]\n", curSel.window); + return; +} +#endif + void nxagentPrintClipboardStat(char *header) { #ifdef DEBUG @@ -259,20 +310,9 @@ void nxagentPrintClipboardStat(char *header) fprintf(stderr, " lastClientStage (ClientSelectionStage) [%d][%s]\n", lastClientStage, GetClientSelectionStageString(lastClientStage)); fprintf(stderr, "PRIMARY\n"); - fprintf(stderr, " lastSelectionOwner[].client [%p]\n", (void *)lastSelectionOwner[nxagentPrimarySelection].client); - fprintf(stderr, " lastSelectionOwner[].window [0x%x]\n", lastSelectionOwner[nxagentPrimarySelection].window); - fprintf(stderr, " lastSelectionOwner[].windowPtr [%p]\n", (void *)lastSelectionOwner[nxagentPrimarySelection].windowPtr); - fprintf(stderr, " lastSelectionOwner[].lastTimeChanged [%u]\n", lastSelectionOwner[nxagentPrimarySelection].lastTimeChanged); - fprintf(stderr, " CurrentSelections[].client [%p]\n", (void *)CurrentSelections[nxagentPrimarySelection].client); - fprintf(stderr, " CurrentSelections[].window [0x%x]\n", CurrentSelections[nxagentPrimarySelection].window); - + nxagentPrintSelectionStat(nxagentPrimarySelection); fprintf(stderr, "CLIPBOARD\n"); - fprintf(stderr, " lastSelectionOwner[].client [%p]\n", (void *)lastSelectionOwner[nxagentClipboardSelection].client); - fprintf(stderr, " lastSelectionOwner[].window [0x%x]\n", lastSelectionOwner[nxagentClipboardSelection].window); - fprintf(stderr, " lastSelectionOwner[].windowPtr [%p]\n", (void *)lastSelectionOwner[nxagentClipboardSelection].windowPtr); - fprintf(stderr, " lastSelectionOwner[].lastTimeChanged [%u]\n", lastSelectionOwner[nxagentClipboardSelection].lastTimeChanged); - fprintf(stderr, " CurrentSelections[].client [%p]\n", (void *)CurrentSelections[nxagentClipboardSelection].client); - fprintf(stderr, " CurrentSelections[].window [0x%x]\n", CurrentSelections[nxagentClipboardSelection].window); + nxagentPrintSelectionStat(nxagentClipboardSelection); fprintf(stderr, "Atoms (server side)\n"); SAFE_XFree(s); s = XGetAtomName(nxagentDisplay, serverTARGETS); |