Commit d210c584 authored by Ulrich Sibiller's avatar Ulrich Sibiller Committed by Mike Gabriel

Clipboard.c: rename variables/atoms to better reflect their meaning

Unfortunately we cannot rename NX_CUT_BUFFER_SERVER, too, without breaking compatibility because this one is used to signal nomachine's nxclient after the splash screen is gone (see Splash.c, Window.c and ArticaProject/nx-libs#838)
parent 40c243fd
...@@ -81,6 +81,9 @@ static char *nxagentAtomNames[NXAGENT_NUMBER_OF_ATOMS + 1] = ...@@ -81,6 +81,9 @@ static char *nxagentAtomNames[NXAGENT_NUMBER_OF_ATOMS + 1] =
"WM_NX_READY", /* 3 */ "WM_NX_READY", /* 3 */
"MCOPGLOBALS", /* 4 */ "MCOPGLOBALS", /* 4 */
"NX_CUT_BUFFER_SERVER", /* 5 */ "NX_CUT_BUFFER_SERVER", /* 5 */
/* Unfortunately we cannot rename this to NX_SELTRANS_TO_AGENT
because nomachine's nxclient is depending on this
selection */
"TARGETS", /* 6 */ "TARGETS", /* 6 */
"TEXT", /* 7 */ "TEXT", /* 7 */
"NX_AGENT_SIGNATURE", /* 8 */ "NX_AGENT_SIGNATURE", /* 8 */
...@@ -90,7 +93,7 @@ static char *nxagentAtomNames[NXAGENT_NUMBER_OF_ATOMS + 1] = ...@@ -90,7 +93,7 @@ static char *nxagentAtomNames[NXAGENT_NUMBER_OF_ATOMS + 1] =
"UTF8_STRING", /* 12 */ "UTF8_STRING", /* 12 */
"_NET_WM_STATE", /* 13 */ "_NET_WM_STATE", /* 13 */
"_NET_WM_STATE_FULLSCREEN", /* 14 */ "_NET_WM_STATE_FULLSCREEN", /* 14 */
"NX_CUT_BUFFER_CLIENT", /* 15 */ "NX_SELTRANS_FROM_AGENT", /* 15 */
"COMPOUND_TEXT", /* 16 */ "COMPOUND_TEXT", /* 16 */
NULL, NULL,
NULL NULL
......
...@@ -72,7 +72,7 @@ static int agentClipboardInitialized = False; ...@@ -72,7 +72,7 @@ static int agentClipboardInitialized = False;
static int clientAccum; static int clientAccum;
#endif #endif
XlibAtom serverCutProperty; XlibAtom serverTransToAgentProperty;
Atom clientCutProperty; Atom clientCutProperty;
static Window serverWindow; static Window serverWindow;
...@@ -137,7 +137,7 @@ static XlibAtom serverTIMESTAMP; ...@@ -137,7 +137,7 @@ static XlibAtom serverTIMESTAMP;
static XlibAtom serverTEXT; static XlibAtom serverTEXT;
static XlibAtom serverCOMPOUND_TEXT; static XlibAtom serverCOMPOUND_TEXT;
static XlibAtom serverUTF8_STRING; static XlibAtom serverUTF8_STRING;
static XlibAtom serverClientCutProperty; static XlibAtom serverTransFromAgentProperty;
static Atom clientTARGETS; static Atom clientTARGETS;
static Atom clientTIMESTAMP; static Atom clientTIMESTAMP;
static Atom clientTEXT; static Atom clientTEXT;
...@@ -365,10 +365,10 @@ void nxagentPrintClipboardStat(char *header) ...@@ -365,10 +365,10 @@ void nxagentPrintClipboardStat(char *header)
fprintf(stderr, " serverCOMPOUND_TEXT [% d][%s]\n", serverCOMPOUND_TEXT, s); fprintf(stderr, " serverCOMPOUND_TEXT [% d][%s]\n", serverCOMPOUND_TEXT, s);
SAFE_XFree(s); s = XGetAtomName(nxagentDisplay, serverUTF8_STRING); SAFE_XFree(s); s = XGetAtomName(nxagentDisplay, serverUTF8_STRING);
fprintf(stderr, " serverUTF8_STRING [% 4d][%s]\n", serverUTF8_STRING, s); fprintf(stderr, " serverUTF8_STRING [% 4d][%s]\n", serverUTF8_STRING, s);
SAFE_XFree(s); s = XGetAtomName(nxagentDisplay, serverCutProperty); SAFE_XFree(s); s = XGetAtomName(nxagentDisplay, serverTransToAgentProperty);
fprintf(stderr, " serverCutProperty [% 4d][%s]\n", serverCutProperty, s); fprintf(stderr, " serverTransToAgentProperty [% 4d][%s]\n", serverTransFromAgentProperty, s);
SAFE_XFree(s); s = XGetAtomName(nxagentDisplay, serverClientCutProperty); SAFE_XFree(s); s = XGetAtomName(nxagentDisplay, serverTransFromAgentProperty);
fprintf(stderr, " serverClientCutProperty [% 4d][%s]\n", serverClientCutProperty, s); fprintf(stderr, " serverTransFromAgentProperty [% 4d][%s]\n", serverTransToAgentProperty, s);
SAFE_XFree(s); s = XGetAtomName(nxagentDisplay, serverTIMESTAMP); SAFE_XFree(s); s = XGetAtomName(nxagentDisplay, serverTIMESTAMP);
fprintf(stderr, " serverTIMESTAMP [% 4d][%s]\n", serverTIMESTAMP, s); fprintf(stderr, " serverTIMESTAMP [% 4d][%s]\n", serverTIMESTAMP, s);
...@@ -896,11 +896,11 @@ void nxagentRequestSelection(XEvent *X) ...@@ -896,11 +896,11 @@ void nxagentRequestSelection(XEvent *X)
{ {
/* /*
* Request the real X server to transfer the selection content * Request the real X server to transfer the selection content
* to the NX_CUT_BUFFER_CLIENT property of the serverWindow. * to the NX_CUT_BUFFER_SERVER property of the serverWindow.
* FIXME: document how we can end up here * FIXME: document how we can end up here
*/ */
XConvertSelection(nxagentDisplay, CurrentSelections[i].selection, XConvertSelection(nxagentDisplay, CurrentSelections[i].selection,
X->xselectionrequest.target, serverCutProperty, X->xselectionrequest.target, serverTransToAgentProperty,
serverWindow, lastClientTime); serverWindow, lastClientTime);
#ifdef DEBUG #ifdef DEBUG
...@@ -1057,7 +1057,7 @@ void nxagentTransferSelection(int resource) ...@@ -1057,7 +1057,7 @@ void nxagentTransferSelection(int resource)
result = NXCollectProperty(nxagentDisplay, result = NXCollectProperty(nxagentDisplay,
nxagentLastClipboardClient, nxagentLastClipboardClient,
serverWindow, serverWindow,
serverCutProperty, serverTransToAgentProperty,
0, 0,
0, 0,
False, False,
...@@ -1111,7 +1111,7 @@ void nxagentTransferSelection(int resource) ...@@ -1111,7 +1111,7 @@ void nxagentTransferSelection(int resource)
result = NXCollectProperty(nxagentDisplay, result = NXCollectProperty(nxagentDisplay,
nxagentLastClipboardClient, nxagentLastClipboardClient,
serverWindow, serverWindow,
serverCutProperty, serverTransToAgentProperty,
0, 0,
lastClientPropertySize, lastClientPropertySize,
False, False,
...@@ -1323,11 +1323,11 @@ void nxagentHandleSelectionNotifyFromXServer(XEvent *X) ...@@ -1323,11 +1323,11 @@ void nxagentHandleSelectionNotifyFromXServer(XEvent *X)
* We reach here after a paste inside the nxagent, triggered by * We reach here after a paste inside the nxagent, triggered by
* the XConvertSelection call in nxagentConvertSelection(). This * the XConvertSelection call in nxagentConvertSelection(). This
* means that data we need has been transferred to the * means that data we need has been transferred to the
* serverCutProperty of the serverWindow (our window on the real X * serverTransToAgentProperty of the serverWindow (our window on the real X
* server). We now need to transfer it to the original requestor, * server). We now need to transfer it to the original requestor,
* which is stored in the lastClient* variables. * which is stored in the lastClient* variables.
*/ */
if ((lastClientStage == SelectionStageNone) && (X->xselection.property == serverCutProperty)) if ((lastClientStage == SelectionStageNone) && (X->xselection.property == serverTransToAgentProperty))
{ {
#ifdef DEBUG #ifdef DEBUG
fprintf(stderr, "%s: Starting selection transferral for client [%d].\n", __func__, fprintf(stderr, "%s: Starting selection transferral for client [%d].\n", __func__,
...@@ -1368,7 +1368,7 @@ void nxagentHandleSelectionNotifyFromXServer(XEvent *X) ...@@ -1368,7 +1368,7 @@ void nxagentHandleSelectionNotifyFromXServer(XEvent *X)
/* if the last owner was an internal one */ /* if the last owner was an internal one */
if (IS_INTERNAL_OWNER(i) && if (IS_INTERNAL_OWNER(i) &&
lastSelectionOwner[i].windowPtr != NULL && lastSelectionOwner[i].windowPtr != NULL &&
X->xselection.property == serverClientCutProperty) X->xselection.property == serverTransFromAgentProperty)
{ {
Atom atomReturnType; Atom atomReturnType;
int resultFormat; int resultFormat;
...@@ -1902,7 +1902,7 @@ int nxagentConvertSelection(ClientPtr client, WindowPtr pWin, Atom selection, ...@@ -1902,7 +1902,7 @@ int nxagentConvertSelection(ClientPtr client, WindowPtr pWin, Atom selection,
SetClientSelectionStage(None); SetClientSelectionStage(None);
/* /*
* store the original requestor, we need that later after * store the original requestor, we need that later after
* serverCutProperty contains the desired selection content * serverTransToAgentProperty contains the desired selection content
*/ */
lastClientRequestor = requestor; lastClientRequestor = requestor;
lastClientClientPtr = client; lastClientClientPtr = client;
...@@ -1927,20 +1927,20 @@ int nxagentConvertSelection(ClientPtr client, WindowPtr pWin, Atom selection, ...@@ -1927,20 +1927,20 @@ int nxagentConvertSelection(ClientPtr client, WindowPtr pWin, Atom selection,
if (target == clientUTF8_STRING) if (target == clientUTF8_STRING)
{ {
#ifdef DEBUG #ifdef DEBUG
fprintf(stderr, "%s: Sending XConvertSelection with target [%d][UTF8_STRING], property [%d][NX_CUT_BUFFER_SERVER]\n", __func__, fprintf(stderr, "%s: Sending XConvertSelection with target [%d][%s], property [%d][%s]\n", __func__,
serverUTF8_STRING, serverCutProperty); serverUTF8_STRING, szAgentUTF8_STRING, serverTransToAgentProperty, "NX_CUT_BUFFER_SERVER");
#endif #endif
XConvertSelection(nxagentDisplay, selection, serverUTF8_STRING, serverCutProperty, XConvertSelection(nxagentDisplay, selection, serverUTF8_STRING, serverTransToAgentProperty,
serverWindow, CurrentTime); serverWindow, CurrentTime);
} }
else else
{ {
#ifdef DEBUG #ifdef DEBUG
fprintf(stderr, "%s: Sending XConvertSelection with target [%d][%s], property [%d][NX_CUT_BUFFER_SERVER]\n", __func__, fprintf(stderr, "%s: Sending XConvertSelection with target [%d][%s], property [%d][%s]\n", __func__,
XA_STRING, validateString(NameForAtom(XA_STRING)), serverCutProperty); XA_STRING, validateString(NameForAtom(XA_STRING)), serverTransToAgentProperty, "NX_CUT_BUFFER_SERVER");
#endif #endif
XConvertSelection(nxagentDisplay, selection, XA_STRING, serverCutProperty, XConvertSelection(nxagentDisplay, selection, XA_STRING, serverTransToAgentProperty,
serverWindow, CurrentTime); serverWindow, CurrentTime);
} }
...@@ -2028,18 +2028,18 @@ int nxagentSendNotify(xEvent *event) ...@@ -2028,18 +2028,18 @@ int nxagentSendNotify(xEvent *event)
* *
* .property must be a server-side Atom. As this property is only * .property must be a server-side Atom. As this property is only
* set on our serverWindow and normally there are few other * set on our serverWindow and normally there are few other
* properties except serverCutProperty, the only thing we need to * properties except serverTransToAgentProperty, the only thing
* ensure is that the internal Atom clientCutProperty differs * we need to ensure is that the internal Atom clientCutProperty
* from the server-side serverCutProperty Atom. The actual name is * differs from the server-side serverTransToAgentProperty
* not important. To be clean here we use a separate * Atom. The actual name is not important. To be clean here we use
* serverClientCutProperty. * a separate serverTransFromAgentProperty.
*/ */
XSelectionEvent eventSelection = { XSelectionEvent eventSelection = {
.requestor = serverWindow, .requestor = serverWindow,
.selection = event->u.selectionNotify.selection, .selection = event->u.selectionNotify.selection,
.target = event->u.selectionNotify.target, .target = event->u.selectionNotify.target,
.property = serverClientCutProperty, .property = serverTransFromAgentProperty,
.time = CurrentTime, .time = CurrentTime,
}; };
...@@ -2172,24 +2172,24 @@ Bool nxagentInitClipboard(WindowPtr pWin) ...@@ -2172,24 +2172,24 @@ Bool nxagentInitClipboard(WindowPtr pWin)
* Server side properties to hold pasted data. * Server side properties to hold pasted data.
* see nxagentSendNotify for an explanation * see nxagentSendNotify for an explanation
*/ */
serverClientCutProperty = nxagentAtoms[15]; /* NX_CUT_BUFFER_CLIENT */ serverTransFromAgentProperty = nxagentAtoms[15]; /* NX_SELTRANS_FROM_AGENT */
serverCutProperty = nxagentAtoms[5]; /* NX_CUT_BUFFER_SERVER */ serverTransToAgentProperty = nxagentAtoms[5]; /* NX_CUT_BUFFER_SERVER */
if (serverCutProperty == None) if (serverTransToAgentProperty == None)
{ {
#ifdef PANIC #ifdef PANIC
fprintf(stderr, "%s: PANIC! Could not create NX_CUT_BUFFER_SERVER atom\n", __func__); fprintf(stderr, "%s: PANIC! Could not create %s atom\n", __func__, "NX_CUT_BUFFER_SERVER");
#endif #endif
return False; return False;
} }
#ifdef TEST #ifdef TEST
fprintf(stderr, "%s: Setting owner of selection [%s][%d] on window 0x%x\n", __func__, fprintf(stderr, "%s: Setting owner of selection [%d][%s] on window 0x%x\n", __func__,
"NX_CUT_BUFFER_SERVER", (int) serverCutProperty, serverWindow); (int) serverTransToAgentProperty, "NX_CUT_BUFFER_SERVER", serverWindow);
#endif #endif
XSetSelectionOwner(nxagentDisplay, serverCutProperty, serverWindow, CurrentTime); XSetSelectionOwner(nxagentDisplay, serverTransToAgentProperty, serverWindow, CurrentTime);
if (XQueryExtension(nxagentDisplay, if (XQueryExtension(nxagentDisplay,
"XFIXES", "XFIXES",
...@@ -2285,7 +2285,7 @@ Bool nxagentInitClipboard(WindowPtr pWin) ...@@ -2285,7 +2285,7 @@ Bool nxagentInitClipboard(WindowPtr pWin)
{ {
#ifdef PANIC #ifdef PANIC
fprintf(stderr, "%s: PANIC! " fprintf(stderr, "%s: PANIC! "
"Could not create NX_CUT_BUFFER_CLIENT atom.\n", __func__); "Could not create %s atom.\n", __func__, szAgentNX_CUT_BUFFER_CLIENT);
#endif #endif
return False; return False;
......
...@@ -41,7 +41,7 @@ typedef struct _XFixesAgentInfo ...@@ -41,7 +41,7 @@ typedef struct _XFixesAgentInfo
extern XFixesAgentInfoRec nxagentXFixesInfo; extern XFixesAgentInfoRec nxagentXFixesInfo;
/* /*
* Create the NX_CUT_BUFFER_CLIENT atom and * Create the NX_SELTRANS_FROM_AGENT atom and
* initialize the required property to exchange * initialize the required property to exchange
* data with the X server. * data with the X server.
*/ */
......
...@@ -412,10 +412,10 @@ void nxagentRemoveSplashWindow(void) ...@@ -412,10 +412,10 @@ void nxagentRemoveSplashWindow(void)
#ifdef TEST #ifdef TEST
fprintf(stderr, "%s: setting the ownership of %s (%d) on window 0x%lx\n", __func__ fprintf(stderr, "%s: setting the ownership of %s (%d) on window 0x%lx\n", __func__
"NX_CUT_BUFFER_SERVER", (int)serverCutProperty, nxagentWindow(screenInfo.screens[0]->root)); "NX_CUT_BUFFER_SERVER", (int)serverTransToAgentProperty, nxagentWindow(screenInfo.screens[0]->root));
#endif #endif
XSetSelectionOwner(nxagentDisplay, serverCutProperty, XSetSelectionOwner(nxagentDisplay, serverTransToAgentProperty,
nxagentWindow(screenInfo.screens[0]->root), CurrentTime); nxagentWindow(screenInfo.screens[0]->root), CurrentTime);
} }
......
...@@ -2602,7 +2602,7 @@ void nxagentMapDefaultWindows(void) ...@@ -2602,7 +2602,7 @@ void nxagentMapDefaultWindows(void)
* to notify of the agent start. * to notify of the agent start.
*/ */
XSetSelectionOwner(nxagentDisplay, serverCutProperty, XSetSelectionOwner(nxagentDisplay, serverTransToAgentProperty,
nxagentDefaultWindows[i], CurrentTime); nxagentDefaultWindows[i], CurrentTime);
} }
......
...@@ -178,7 +178,7 @@ do\ ...@@ -178,7 +178,7 @@ do\
WindowPtr nxagentWindowPtr(Window window); WindowPtr nxagentWindowPtr(Window window);
#ifdef XlibAtom #ifdef XlibAtom
extern XlibAtom serverCutProperty; extern XlibAtom serverTransToAgentProperty;
#endif #endif
/* /*
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment