From f0f91ed2608f98c4ddef6eb7bc289e36e8569a93 Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Sun, 7 Mar 2021 14:12:53 +0100 Subject: Compext.c: some scope improvements --- .../programs/Xserver/hw/nxagent/compext/Compext.c | 47 +++++----------------- 1 file changed, 10 insertions(+), 37 deletions(-) (limited to 'nx-X11') diff --git a/nx-X11/programs/Xserver/hw/nxagent/compext/Compext.c b/nx-X11/programs/Xserver/hw/nxagent/compext/Compext.c index 7a6cb9e30..bd839f5e7 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/compext/Compext.c +++ b/nx-X11/programs/Xserver/hw/nxagent/compext/Compext.c @@ -324,13 +324,11 @@ int _NXInternalInitResources(Display *dpy) int _NXInternalResetResources(Display *dpy) { - int i; - #ifdef TEST fprintf(stderr, "******_NXInternalResetResources: Clearing all the internal structures.\n"); #endif - for (i = 0; i < NXNumberOfResources; i++) + for (int i = 0; i < NXNumberOfResources; i++) { _NXSplitResources[i] = 0; _NXUnpackResources[i] = 0; @@ -913,10 +911,6 @@ Status NXGetUnpackParameters(Display *dpy, unsigned int *entries, unsigned char register unsigned n; - #ifdef TEST - register unsigned i; - #endif - if (*entries < NXNumberOfPackMethods) { #ifdef TEST @@ -979,7 +973,7 @@ Status NXGetUnpackParameters(Display *dpy, unsigned int *entries, unsigned char fprintf(stderr, "******NXGetUnpackParameters: Got reply with methods: "); - for (i = 0; i < n; i++) + for (unsigned int i = 0; i < n; i++) { if (supported_methods[i] != 0) { @@ -1812,12 +1806,6 @@ int NXSetUnpackColormapCompat(Display *dpy, unsigned int resource, register int dst_data_length; - #ifdef DUMP - - int i; - - #endif - LockDisplay(dpy); GetReq(NXSetUnpackColormapCompat, req); @@ -1862,7 +1850,7 @@ int NXSetUnpackColormapCompat(Display *dpy, unsigned int resource, fprintf(stderr, "******NXSetUnpackColormapCompat: Dumping colormap entries:\n"); - for (i = 0; i < entries; i++) + for (int i = 0; i < entries; i++) { fprintf(stderr, "******NXSetUnpackColormapCompat: [%d] -> [0x%x].\n", i, *((int *) (dst_data + (i * 4)))); @@ -1907,12 +1895,6 @@ int NXSetUnpackAlphaCompat(Display *dpy, unsigned int resource, register unsigned int dst_data_length; - #ifdef DUMP - - int i; - - #endif - LockDisplay(dpy); GetReq(NXSetUnpackAlphaCompat, req); @@ -1962,7 +1944,7 @@ int NXSetUnpackAlphaCompat(Display *dpy, unsigned int resource, fprintf(stderr, "******NXSetUnpackAlphaCompat: Dumping alpha channel data:\n"); - for (i = 0; i < dst_data_length; i++) + for (int i = 0; i < dst_data_length; i++) { fprintf(stderr, "******NXSetUnpackAlphaCompat: [%d] -> [0x%02x].\n", i, ((unsigned int) *(dst_data + i)) & 0xff); @@ -2573,11 +2555,9 @@ int NXAllocColors(Display *dpy, Colormap colormap, unsigned int entries, Bool alloc_error = False; - register unsigned int i; - LockDisplay(dpy); - for (i = 0; i < entries; i++) + for (unsigned int i = 0; i < entries; i++) { GetReq(AllocColor, req); @@ -2588,7 +2568,7 @@ int NXAllocColors(Display *dpy, Colormap colormap, unsigned int entries, req -> blue = screens_in_out[i].blue; } - for (i = 0; i < entries; i++) + for (unsigned int i = 0; i < entries; i++) { result = _XReply(dpy, (xReply *) &rep, 0, xTrue); @@ -3163,21 +3143,18 @@ void _NXCacheDump(const char *label) { char s[MD5_LENGTH * 2 + 1]; - int i; - int j; - #ifdef DEBUG fprintf(stderr, "%s: Dumping the content of image cache:\n", label); #endif - for (i = 0; i < NXImageCacheSize; i++) + for (int i = 0; i < NXImageCacheSize; i++) { if (NXImageCache[i].image == NULL) { break; } - for (j = 0; j < MD5_LENGTH; j++) + for (int j = 0; j < MD5_LENGTH; j++) { sprintf(s + (j * 2), "%02X", ((unsigned char *) NXImageCache[i].md5)[j]); } @@ -3362,8 +3339,6 @@ int NXCacheAddImage(NXPackedImage *image, unsigned int method, unsigned char *md void NXFreeCache(Display *dpy) { - int i; - if (NXImageCache == NULL) { #ifdef DEBUG @@ -3378,7 +3353,7 @@ void NXFreeCache(Display *dpy) NXImageCacheSize); #endif - for (i = 0; i < NXImageCacheSize; i++) + for (int i = 0; i < NXImageCacheSize; i++) { if (NXImageCache[i].image != NULL) { @@ -3625,9 +3600,7 @@ static Bool _NXCollectImageHandler(Display *dpy, xReply *rep, char *buf, int NXGetCollectImageResource(Display *dpy) { - int i; - - for (i = 0; i < NXNumberOfResources; i++) + for (int i = 0; i < NXNumberOfResources; i++) { if (_NXCollectedImages[i] == NULL) { -- cgit v1.2.3 From 906aa0714de9f2aa2b9d2600d44658864cce0070 Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Sun, 7 Mar 2021 14:13:09 +0100 Subject: Compext.c: add specific DEBUG and TEST macros --- .../programs/Xserver/hw/nxagent/compext/Compext.c | 302 +++++++++++---------- 1 file changed, 159 insertions(+), 143 deletions(-) (limited to 'nx-X11') diff --git a/nx-X11/programs/Xserver/hw/nxagent/compext/Compext.c b/nx-X11/programs/Xserver/hw/nxagent/compext/Compext.c index bd839f5e7..a77e4fc79 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/compext/Compext.c +++ b/nx-X11/programs/Xserver/hw/nxagent/compext/Compext.c @@ -74,7 +74,23 @@ #define PANIC #define WARNING #undef TEST +#undef TEST_DISPLAY +#undef TEST_IMAGE +#undef TEST_INPUT +#undef TEST_PARAMS +#undef TEST_POINTER +#undef TEST_PROPERTY +#undef TEST_SPLIT +#undef TEST_UNPACK #undef DEBUG +#undef DEBUG_DISPLAY +#undef DEBUG_IMAGE +#undef DEBUG_INPUT +#undef DEBUG_PARAMS +#undef DEBUG_POINTER +#undef DEBUG_PROPERTY +#undef DEBUG_SPLIT +#undef DEBUG_UNPACK #undef DUMP /* @@ -271,7 +287,7 @@ extern int _NXInternalResetEncoders(Display *dpy); int NXInitDisplay(Display *dpy) { - #ifdef TEST + #ifdef TEST_DISPLAY fprintf(stderr, "******NXInitDisplay: Called for display at [%p].\n", (void *) dpy); #endif @@ -286,7 +302,7 @@ int NXInitDisplay(Display *dpy) return 1; } - #ifdef TEST + #ifdef TEST_DISPLAY fprintf(stderr, "******NXInitDisplay: WARNING! Internal structures already initialized.\n"); #endif @@ -295,7 +311,7 @@ int NXInitDisplay(Display *dpy) int NXResetDisplay(Display *dpy) { - #ifdef TEST + #ifdef TEST_DISPLAY fprintf(stderr, "******NXResetDisplay: Called for display at [%p].\n", (void *) dpy); #endif @@ -310,7 +326,7 @@ int NXResetDisplay(Display *dpy) return 1; } - #ifdef TEST + #ifdef TEST_DISPLAY fprintf(stderr, "******NXResetDisplay: WARNING! Internal structures already reset.\n"); #endif @@ -324,7 +340,7 @@ int _NXInternalInitResources(Display *dpy) int _NXInternalResetResources(Display *dpy) { - #ifdef TEST + #if defined(TEST_IMAGE) || defined(TEST_PROPERTY) || defined(TEST_POINTER) || defined(TEST_INPUT) fprintf(stderr, "******_NXInternalResetResources: Clearing all the internal structures.\n"); #endif @@ -335,7 +351,7 @@ int _NXInternalResetResources(Display *dpy) if (_NXCollectedImages[i] != NULL) { - #ifdef TEST + #ifdef TEST_IMAGE fprintf(stderr, "******_NXInternalResetResources: WARNING! Clearing collect image data " "for resource [%d].\n", i); #endif @@ -357,7 +373,7 @@ int _NXInternalResetResources(Display *dpy) if (_NXCollectedProperties[i] != NULL) { - #ifdef TEST + #ifdef TEST_PROPERTY fprintf(stderr, "******_NXInternalResetResources: WARNING! Clearing collect property data " "for resource [%d].\n", i); #endif @@ -376,7 +392,7 @@ int _NXInternalResetResources(Display *dpy) if (_NXCollectedGrabPointers[i] != NULL) { - #ifdef TEST + #ifdef TEST_POINTER fprintf(stderr, "******_NXInternalResetResources: WARNING! Clearing grab pointer data " "for resource [%d].\n", i); #endif @@ -393,7 +409,7 @@ int _NXInternalResetResources(Display *dpy) if (_NXCollectedInputFocuses[i] != NULL) { - #ifdef TEST + #ifdef TEST_INPUT fprintf(stderr, "******_NXInternalResetResources: WARNING! Clearing collect input focus data " "for resource [%d].\n", i); #endif @@ -452,7 +468,7 @@ int NXSetDisplayBuffer(Display *dpy, int size) if (dpy -> bufmax - size == dpy -> buffer) { - #ifdef TEST + #ifdef TEST_DISPLAY fprintf(stderr, "******NXSetDisplayBuffer: Nothing to do with buffer size matching.\n"); #endif @@ -482,7 +498,7 @@ int NXSetDisplayBuffer(Display *dpy, int size) dpy -> bufptr = dpy -> buffer; dpy -> bufmax = dpy -> bufptr + size; - #ifdef TEST + #ifdef TEST_DISPLAY fprintf(stderr, "******NXSetDisplayBuffer: Set the display output buffer size to [%d].\n", size); #endif @@ -525,7 +541,7 @@ int NXHandleDisplayError(int value) _NXHandleDisplayError = value; - #ifdef TEST + #ifdef TEST_DISPLAY fprintf(stderr, "******NXHandleDisplayError: Set the flag to [%d] with previous value [%d].\n", value, previous); #endif @@ -594,7 +610,7 @@ int NXDisplayReadable(Display *dpy) if (result == 0) { - #ifdef DEBUG + #ifdef DEBUG_DISPLAY fprintf(stderr, "******NXDisplayReadable: Returning [%d] bytes readable from fd [%d].\n", readable, dpy -> fd); #endif @@ -602,7 +618,7 @@ int NXDisplayReadable(Display *dpy) return readable; } - #ifdef DEBUG + #ifdef DEBUG_DISPLAY fprintf(stderr, "******NXDisplayReadable: WARNING! Error detected on display fd [%d].\n", dpy -> fd); #endif @@ -612,7 +628,7 @@ int NXDisplayReadable(Display *dpy) int NXDisplayFlushable(Display *dpy) { - #ifdef DEBUG + #ifdef DEBUG_DISPLAY int flushable; @@ -635,7 +651,7 @@ int NXDisplayFlushable(Display *dpy) int NXDisplayCongestion(Display *dpy) { - #ifdef DEBUG + #ifdef DEBUG_DISPLAY int congestion = NXTransCongestion(dpy -> fd); @@ -656,7 +672,7 @@ int NXFlushDisplay(Display *dpy, int what) if (!(dpy -> flags & XlibDisplayWriting) && dpy -> bufptr - dpy -> buffer > 0) { - #ifdef DEBUG + #ifdef DEBUG_DISPLAY fprintf(stderr, "******NXFlushDisplay: Writing with [%d] bytes in the buffer.\n", (int) (dpy -> bufptr - dpy -> buffer)); #endif @@ -669,7 +685,7 @@ int NXFlushDisplay(Display *dpy, int what) return 0; } - #ifdef DEBUG + #ifdef DEBUG_DISPLAY fprintf(stderr, "******NXFlushDisplay: Flushing with [%d] bytes in the NX transport.\n", NXDisplayFlushable(dpy)); #endif @@ -683,7 +699,7 @@ NXDisplayErrorPredicate NXSetDisplayErrorPredicate(NXDisplayErrorPredicate predi _NXDisplayErrorFunction = predicate; - #ifdef TEST + #ifdef TEST_DISPLAY fprintf(stderr, "******NXSetDisplayErrorPredicate: Set the predicate to [%p] with previous value [%p].\n", predicate, previous); #endif @@ -697,7 +713,7 @@ NXDisplayBlockHandler NXSetDisplayBlockHandler(NXDisplayBlockHandler handler) _NXDisplayBlockFunction = handler; - #ifdef TEST + #ifdef TEST_DISPLAY fprintf(stderr, "******NXSetDisplayBlockHandler: Set the handler to [%p] with previous value [%p].\n", handler, previous); #endif @@ -711,7 +727,7 @@ NXDisplayWriteHandler NXSetDisplayWriteHandler(NXDisplayWriteHandler handler) _NXDisplayWriteFunction = handler; - #ifdef TEST + #ifdef TEST_DISPLAY fprintf(stderr, "******NXSetDisplayWriteHandler: Set the handler to [%p] with previous value [%p].\n", handler, previous); #endif @@ -728,7 +744,7 @@ NXDisplayFlushHandler NXSetDisplayFlushHandler(NXDisplayFlushHandler handler, Di NXTransHandler(NX_FD_ANY, NX_HANDLER_FLUSH, (void (*)(void *, int)) handler, (void *) display); - #ifdef TEST + #ifdef TEST_DISPLAY fprintf(stderr, "******NXSetDisplayFlushHandler: Set the handler to [%p] with display [%p] " "and previous value [%p].\n", handler, display, previous); #endif @@ -749,7 +765,7 @@ NXDisplayStatisticsHandler NXSetDisplayStatisticsHandler(NXDisplayStatisticsHand NXTransHandler(NX_FD_ANY, NX_HANDLER_STATISTICS, (void (*)(void *, int)) handler, (void *) buffer); - #ifdef TEST + #ifdef TEST_DISPLAY fprintf(stderr, "******NXSetDisplayStatisticsHandler: Set the handler to [%p] with buffer pointer [%p] " "and previous value [%p].\n", handler, buffer, previous); #endif @@ -818,14 +834,14 @@ Status NXGetControlParameters(Display *dpy, unsigned int *link_type, unsigned in GetEmptyReq(NXGetControlParameters, req); - #ifdef TEST + #ifdef TEST_PARAMS fprintf(stderr, "******NXGetControlParameters: Sending message opcode [%d].\n", X_NXGetControlParameters); #endif if (_XReply(dpy, (xReply *) &rep, 0, xTrue) == xFalse) { - #ifdef TEST + #ifdef TEST_PARAMS fprintf(stderr, "******NXGetControlParameters: Error receiving reply.\n"); #endif @@ -836,7 +852,7 @@ Status NXGetControlParameters(Display *dpy, unsigned int *link_type, unsigned in return 0; } - #ifdef TEST + #ifdef TEST_PARAMS fprintf(stderr, "******NXGetControlParameters: Got reply with link type [%u].\n", rep.linkType); fprintf(stderr, "******NXGetControlParameters: Local protocol major [%u] minor [%u] patch [%u].\n", @@ -913,7 +929,7 @@ Status NXGetUnpackParameters(Display *dpy, unsigned int *entries, unsigned char if (*entries < NXNumberOfPackMethods) { - #ifdef TEST + #ifdef TEST_PARAMS fprintf(stderr, "******NXGetUnpackParameters: Requested only [%d] entries while they should be [%d].\n", *entries, NXNumberOfPackMethods); #endif @@ -927,14 +943,14 @@ Status NXGetUnpackParameters(Display *dpy, unsigned int *entries, unsigned char req -> entries = *entries; - #ifdef TEST + #ifdef TEST_PARAMS fprintf(stderr, "******NXGetUnpackParameters: Sending message opcode [%d] with [%d] requested entries.\n", X_NXGetUnpackParameters, *entries); #endif if (_XReply(dpy, (xReply *) &rep, 0, xFalse) == xFalse || rep.length == 0) { - #ifdef TEST + #ifdef TEST_PARAMS fprintf(stderr, "******NXGetUnpackParameters: Error receiving reply.\n"); #endif @@ -947,7 +963,7 @@ Status NXGetUnpackParameters(Display *dpy, unsigned int *entries, unsigned char if ((n = rep.length << 2) > *entries) { - #ifdef TEST + #ifdef TEST_PARAMS fprintf(stderr, "******NXGetUnpackParameters: Got [%d] bytes of reply data while they should be [%d].\n", n, *entries); #endif @@ -963,13 +979,13 @@ Status NXGetUnpackParameters(Display *dpy, unsigned int *entries, unsigned char *entries = n; - #ifdef TEST + #ifdef TEST_PARAMS fprintf(stderr, "******NXGetUnpackParameters: Reading [%d] bytes of reply data.\n", n); #endif _XReadPad(dpy, (char *) supported_methods, n); - #ifdef TEST + #ifdef TEST_PARAMS fprintf(stderr, "******NXGetUnpackParameters: Got reply with methods: "); @@ -1051,12 +1067,12 @@ Status NXGetShmemParameters(Display *dpy, unsigned int *enable_client, req -> clientSegment = *client_segment; req -> serverSegment = *server_segment; - #ifdef TEST + #ifdef TEST_PARAMS fprintf(stderr, "******NXGetShmemParameters: Sending message opcode [%d] at stage [%d].\n", X_NXGetShmemParameters, stage); #endif - #ifdef TEST + #ifdef TEST_PARAMS if (stage == 0) { @@ -1095,7 +1111,7 @@ Status NXGetShmemParameters(Display *dpy, unsigned int *enable_client, if (_XReply(dpy, (xReply *) &rep, 0, xTrue) == xFalse) { - #ifdef TEST + #ifdef TEST_PARAMS fprintf(stderr, "******NXGetShmemParameters: Error receiving reply.\n"); #endif @@ -1120,7 +1136,7 @@ Status NXGetShmemParameters(Display *dpy, unsigned int *enable_client, *client_size = rep.clientSize; *server_size = rep.serverSize; - #ifdef TEST + #ifdef TEST_PARAMS fprintf(stderr, "******NXGetShmemParameters: Got final reply with enabled client [%u] and server [%u].\n", *enable_client, *enable_server); @@ -1162,13 +1178,13 @@ Status NXGetFontParameters(Display *dpy, unsigned int path_length, char path_dat register unsigned n; - #ifdef TEST + #ifdef TEST_PARAMS register unsigned i; #endif if (path_length < 1) { - #ifdef TEST + #ifdef TEST_PARAMS fprintf(stderr, "******NXGetFontParameters: No room to store the reply.\n"); #endif @@ -1181,14 +1197,14 @@ Status NXGetFontParameters(Display *dpy, unsigned int path_length, char path_dat GetReq(NXGetFontParameters, req); - #ifdef TEST + #ifdef TEST_PARAMS fprintf(stderr, "******NXGetFontParameters: Sending message opcode [%d].\n", X_NXGetFontParameters); #endif if (_XReply(dpy, (xReply *) &rep, 0, xFalse) == xFalse || rep.length == 0) { - #ifdef TEST + #ifdef TEST_PARAMS fprintf(stderr, "******NXGetFontParameters: Error receiving reply.\n"); #endif @@ -1201,7 +1217,7 @@ Status NXGetFontParameters(Display *dpy, unsigned int path_length, char path_dat if ((n = rep.length << 2) > path_length) { - #ifdef TEST + #ifdef TEST_PARAMS fprintf(stderr, "******NXGetFontParameters: Got [%d] bytes of reply data with only room for [%d].\n", n, path_length); #endif @@ -1215,7 +1231,7 @@ Status NXGetFontParameters(Display *dpy, unsigned int path_length, char path_dat return 0; } - #ifdef TEST + #ifdef TEST_PARAMS fprintf(stderr, "******NXGetFontParameters: Reading [%d] bytes of reply data.\n", n); #endif @@ -1228,7 +1244,7 @@ Status NXGetFontParameters(Display *dpy, unsigned int path_length, char path_dat if (*path_data > path_length - 1) { - #ifdef TEST + #ifdef TEST_PARAMS fprintf(stderr, "******NXGetFontParameters: Inconsistent length in the returned string.\n"); #endif @@ -1239,7 +1255,7 @@ Status NXGetFontParameters(Display *dpy, unsigned int path_length, char path_dat return 0; } - #ifdef TEST + #ifdef TEST_PARAMS fprintf(stderr, "******NXGetFontParameters: Got font path of [%d] bytes and value [", (int) *path_data); @@ -1270,7 +1286,7 @@ unsigned int NXAllocSplit(Display *dpy, unsigned int resource) { _NXSplitResources[resource] = 1; - #ifdef TEST + #ifdef TEST_SPLIT fprintf(stderr, "******NXAllocSplit: Reserved resource [%u].\n", resource); #endif @@ -1279,7 +1295,7 @@ unsigned int NXAllocSplit(Display *dpy, unsigned int resource) } } - #ifdef TEST + #ifdef TEST_SPLIT fprintf(stderr, "******NXAllocSplit: WARNING! Resource limit exausted.\n"); #endif @@ -1287,7 +1303,7 @@ unsigned int NXAllocSplit(Display *dpy, unsigned int resource) } else if (resource >= 0 && resource < NXNumberOfResources) { - #ifdef TEST + #ifdef TEST_SPLIT if (_NXSplitResources[resource] == 0) { @@ -1328,7 +1344,7 @@ int NXStartSplit(Display *dpy, unsigned int resource, unsigned int mode) req -> resource = resource; req -> mode = mode; - #ifdef TEST + #ifdef TEST_SPLIT fprintf(stderr, "******NXStartSplit: Sending opcode [%d] with resource [%d] mode [%d].\n", X_NXStartSplit, resource, mode); #endif @@ -1355,7 +1371,7 @@ int NXEndSplit(Display *dpy, unsigned int resource) req -> resource = resource; - #ifdef TEST + #ifdef TEST_SPLIT fprintf(stderr, "******NXEndSplit: Sending opcode [%d] with resource [%d].\n", X_NXStartSplit, resource); #endif @@ -1389,7 +1405,7 @@ int NXCommitSplit(Display *dpy, unsigned int resource, unsigned int propagate, req -> request = request; req -> position = position; - #ifdef TEST + #ifdef TEST_SPLIT fprintf(stderr, "******NXCommitSplit: Sending opcode [%d] with resource [%d] propagate [%d] " "request [%d] position [%d].\n", X_NXCommitSplit, resource, propagate, request, position); @@ -1410,7 +1426,7 @@ int NXAbortSplit(Display *dpy, unsigned int resource) GetReq(NXAbortSplit, req); - #ifdef TEST + #ifdef TEST_SPLIT fprintf(stderr, "******NXAbortSplit: Sending message opcode [%d] with resource [%u].\n", X_NXAbortSplit, resource); #endif @@ -1432,7 +1448,7 @@ int NXFinishSplit(Display *dpy, unsigned int resource) GetReq(NXFinishSplit, req); - #ifdef TEST + #ifdef TEST_SPLIT fprintf(stderr, "******NXFinishSplit: Sending message opcode [%d] with resource [%u].\n", X_NXFinishSplit, resource); #endif @@ -1456,7 +1472,7 @@ int NXFreeSplit(Display *dpy, unsigned int resource) GetReq(NXFreeSplit, req); - #ifdef TEST + #ifdef TEST_SPLIT fprintf(stderr, "******NXFreeSplit: Sending message opcode [%d] with resource [%u].\n", X_NXFreeSplit, resource); #endif @@ -1467,14 +1483,14 @@ int NXFreeSplit(Display *dpy, unsigned int resource) SyncHandle(); - #ifdef TEST + #ifdef TEST_SPLIT fprintf(stderr, "******NXFreeSplit: Making the resource [%u] newly available.\n", resource); #endif _NXSplitResources[resource] = 0; } - #ifdef TEST + #ifdef TEST_SPLIT else { fprintf(stderr, "******NXFreeSplit: Nothing to do for resource [%u].\n", @@ -1502,7 +1518,7 @@ int NXSetExposeParameters(Display *dpy, int expose, int graphics_expose, int no_ req -> graphicsExpose = graphics_expose; req -> noExpose = no_expose; - #ifdef TEST + #ifdef TEST_PARAMS fprintf(stderr, "******NXSetExposeParameters: Sending message opcode [%d] with flags [%d][%d][%d].\n", X_NXSetExposeParameters, req -> expose, req -> graphicsExpose, req -> noExpose); #endif @@ -1532,7 +1548,7 @@ int NXSetCacheParameters(Display *dpy, int enable_cache, int enable_split, req -> enableSave = enable_save; req -> enableLoad = enable_load; - #ifdef TEST + #ifdef TEST_PARAMS fprintf(stderr, "******NXSetCacheParameters: Sending message opcode [%d] with " "flags [%d][%d][%d][%d].\n", X_NXSetCacheParameters, req -> enableCache, req -> enableSplit, req -> enableSave, req -> enableLoad); @@ -1555,7 +1571,7 @@ unsigned int NXAllocUnpack(Display *dpy, unsigned int resource) { _NXUnpackResources[resource] = 1; - #ifdef TEST + #ifdef TEST_UNPACK fprintf(stderr, "******NXAllocUnpack: Reserved resource [%u].\n", resource); #endif @@ -1564,7 +1580,7 @@ unsigned int NXAllocUnpack(Display *dpy, unsigned int resource) } } - #ifdef TEST + #ifdef TEST_UNPACK fprintf(stderr, "******NXAllocUnpack: WARNING! Resource limit exausted.\n"); #endif @@ -1572,7 +1588,7 @@ unsigned int NXAllocUnpack(Display *dpy, unsigned int resource) } else if (resource >= 0 && resource < NXNumberOfResources) { - #ifdef TEST + #ifdef TEST_UNPACK if (_NXUnpackResources[resource] == 0) { @@ -1634,7 +1650,7 @@ int NXSetUnpackGeometry(Display *dpy, unsigned int resource, Visual *visual) return -1; } - #ifdef TEST + #ifdef TEST_UNPACK fprintf(stderr, "******NXSetUnpackGeometry: Resource [%u] Depth/Bpp [1/%d][4/%d][8/%d]" "[16/%d][24/%d][32/%d].\n", resource, req -> depth1Bpp, req -> depth4Bpp, req -> depth8Bpp, req -> depth16Bpp, req -> depth24Bpp, req -> depth32Bpp); @@ -1677,7 +1693,7 @@ int NXSetUnpackColormap(Display *dpy, unsigned int resource, unsigned int method req -> length += (dst_data_length >> 2); - #ifdef TEST + #ifdef TEST_UNPACK fprintf(stderr, "******NXSetUnpackColormap: Resource [%u] data size [%u] destination " "data size [%u].\n", resource, data_length, dst_data_length); #endif @@ -1740,7 +1756,7 @@ int NXSetUnpackAlpha(Display *dpy, unsigned int resource, unsigned int method, req -> length += (dst_data_length >> 2); - #ifdef TEST + #ifdef TEST_UNPACK fprintf(stderr, "******NXSetUnpackAlpha: Resource [%u] data size [%u] destination data size [%u].\n", resource, data_length, dst_data_length); #endif @@ -1817,7 +1833,7 @@ int NXSetUnpackColormapCompat(Display *dpy, unsigned int resource, req -> length += (dst_data_length >> 2); - #ifdef TEST + #ifdef TEST_UNPACK fprintf(stderr, "******NXSetUnpackColormapCompat: Resource [%u] number of entries [%u] " "destination data size [%u].\n", resource, entries, dst_data_length); #endif @@ -1906,7 +1922,7 @@ int NXSetUnpackAlphaCompat(Display *dpy, unsigned int resource, req -> length += (dst_data_length >> 2); - #ifdef TEST + #ifdef TEST_UNPACK fprintf(stderr, "******NXSetUnpackAlphaCompat: Resource [%u] number of entries [%u] " "destination data size [%u].\n", resource, entries, dst_data_length); #endif @@ -1986,7 +2002,7 @@ int NXFreeUnpack(Display *dpy, unsigned int resource) GetReq(NXFreeUnpack, req); - #ifdef TEST + #ifdef TEST_UNPACK fprintf(stderr, "******NXFreeUnpack: Sending message opcode [%d] with resource [%u].\n", X_NXFreeUnpack, resource); #endif @@ -1997,14 +2013,14 @@ int NXFreeUnpack(Display *dpy, unsigned int resource) SyncHandle(); - #ifdef TEST + #ifdef TEST_UNPACK fprintf(stderr, "******NXFreeUnpack: Making the resource [%u] newly available.\n", resource); #endif _NXUnpackResources[resource] = 0; } - #ifdef TEST + #ifdef TEST_UNPACK else { fprintf(stderr, "******NXFreeUnpack: Nothing to do for resource [%u].\n", @@ -2056,7 +2072,7 @@ int NXDestroyPackedImage(NXPackedImage *image) int NXCleanImage(XImage *image) { - #ifdef TEST + #ifdef TEST_IMAGE fprintf(stderr, "******NXCleanImage: Cleaning image with format [%d] depth [%d] " "bits per pixel [%d].\n", image -> format, image -> depth, image -> bits_per_pixel); @@ -2091,7 +2107,7 @@ NXPackedImage *NXPackImage(Display *dpy, XImage *src_image, unsigned int method) unsigned int dst_bits_per_pixel; unsigned int dst_packed_bits_per_pixel; - #ifdef TEST + #ifdef TEST_IMAGE fprintf(stderr, "******NXPackImage: Going to pack a new image with method [%d].\n", method); #endif @@ -2143,7 +2159,7 @@ NXPackedImage *NXPackImage(Display *dpy, XImage *src_image, unsigned int method) *dst_image = *src_image; - #ifdef TEST + #ifdef TEST_IMAGE fprintf(stderr, "******NXPackImage: Source width [%d], bytes per line [%d] with depth [%d].\n", src_image -> width, src_image -> bytes_per_line, src_image -> depth); #endif @@ -2174,7 +2190,7 @@ NXPackedImage *NXPackImage(Display *dpy, XImage *src_image, unsigned int method) dst_bits_per_pixel = dst_image -> bits_per_pixel; dst_packed_bits_per_pixel = MethodBitsPerPixel(method); - #ifdef TEST + #ifdef TEST_IMAGE fprintf(stderr, "******NXPackImage: Destination depth [%d], bits per pixel [%d], packed bits per pixel [%d].\n", dst_image -> depth, dst_bits_per_pixel, dst_packed_bits_per_pixel); #endif @@ -2221,7 +2237,7 @@ NXPackedImage *NXPackImage(Display *dpy, XImage *src_image, unsigned int method) * be able to handle ovelapping areas. */ - #ifdef TEST + #ifdef TEST_IMAGE fprintf(stderr, "******NXPackImage: Plain bits per pixel [%d], data size [%d].\n", dst_bits_per_pixel, dst_data_size); #endif @@ -2229,7 +2245,7 @@ NXPackedImage *NXPackImage(Display *dpy, XImage *src_image, unsigned int method) dst_packed_data_size = dst_data_size * dst_packed_bits_per_pixel / dst_bits_per_pixel; - #ifdef TEST + #ifdef TEST_IMAGE fprintf(stderr, "******NXPackImage: Packed bits per pixel [%d], data size [%d].\n", dst_packed_bits_per_pixel, dst_packed_data_size); #endif @@ -2278,7 +2294,7 @@ XImage *NXInPlacePackImage(Display *dpy, XImage *src_image, unsigned int method) unsigned int dst_bits_per_pixel; unsigned int dst_packed_bits_per_pixel; - #ifdef TEST + #ifdef TEST_IMAGE fprintf(stderr, "******NXInPlacePackImage: Going to pack a new image with method [%d].\n", method); #endif @@ -2329,7 +2345,7 @@ XImage *NXInPlacePackImage(Display *dpy, XImage *src_image, unsigned int method) *dst_image = *src_image; - #ifdef TEST + #ifdef TEST_IMAGE fprintf(stderr, "******NXInPlacePackImage: Source width [%d], bytes per line [%d] with depth [%d].\n", src_image -> width, src_image -> bytes_per_line, src_image -> depth); #endif @@ -2347,7 +2363,7 @@ XImage *NXInPlacePackImage(Display *dpy, XImage *src_image, unsigned int method) dst_bits_per_pixel = dst_image -> bits_per_pixel; dst_packed_bits_per_pixel = MethodBitsPerPixel(method); - #ifdef TEST + #ifdef TEST_IMAGE fprintf(stderr, "******NXInPlacePackImage: Destination depth [%d], bits per pixel [%d], packed bits per pixel [%d].\n", dst_image -> depth, dst_bits_per_pixel, dst_packed_bits_per_pixel); #endif @@ -2355,7 +2371,7 @@ XImage *NXInPlacePackImage(Display *dpy, XImage *src_image, unsigned int method) if (dst_packed_bits_per_pixel > dst_bits_per_pixel || ShouldMaskImage(src_image, mask) == 0) { - #ifdef TEST + #ifdef TEST_IMAGE fprintf(stderr, "******NXInPlacePackImage: Just clean image packed_bits_per_pixel[%d], bits_per_pixel[%d].\n", dst_packed_bits_per_pixel, dst_bits_per_pixel); #endif @@ -2390,7 +2406,7 @@ XImage *NXInPlacePackImage(Display *dpy, XImage *src_image, unsigned int method) * be able to handle ovelapping areas. */ - #ifdef TEST + #ifdef TEST_IMAGE fprintf(stderr, "******NXInPlacePackImage: Plain bits per pixel [%d], data size [%d].\n", dst_bits_per_pixel, dst_data_size); #endif @@ -2398,7 +2414,7 @@ XImage *NXInPlacePackImage(Display *dpy, XImage *src_image, unsigned int method) dst_packed_data_size = dst_data_size * dst_packed_bits_per_pixel / dst_bits_per_pixel; - #ifdef TEST + #ifdef TEST_IMAGE fprintf(stderr, "******NXInPlacePackImage: Packed bits per pixel [%d], data size [%d].\n", dst_packed_bits_per_pixel, dst_packed_data_size); #endif @@ -2433,7 +2449,7 @@ int NXPutPackedImage(Display *dpy, unsigned int resource, Drawable drawable, req -> drawable = drawable; req -> gc = ((GC) gc) -> gid; - #ifdef TEST + #ifdef TEST_IMAGE fprintf(stderr, "******NXPutPackedImage: Image resource [%d] drawable [%d] gc [%d].\n", req -> resource, (int) req -> drawable, (int) req -> gc); #endif @@ -2474,7 +2490,7 @@ int NXPutPackedImage(Display *dpy, unsigned int resource, Drawable drawable, req -> method = method; - #ifdef TEST + #ifdef TEST_IMAGE fprintf(stderr, "******NXPutPackedImage: Source image depth [%d] destination depth [%d] " "method [%d].\n", req -> srcDepth, req -> dstDepth, req -> method); #endif @@ -2508,7 +2524,7 @@ int NXPutPackedImage(Display *dpy, unsigned int resource, Drawable drawable, dst_data_length = ROUNDUP(src_data_length, 4); - #ifdef TEST + #ifdef TEST_IMAGE fprintf(stderr, "******NXPutPackedImage: Source data length [%d] request data length [%d].\n", src_data_length, dst_data_length); #endif @@ -2921,7 +2937,7 @@ void NXMaskImage(XImage *image, unsigned int method) { maskMethod = MASK_8_COLORS; - #ifdef DEBUG + #ifdef DEBUG_IMAGE fprintf(stderr, "******NXMaskImage: Method is MASK_8_COLORS\n"); #endif @@ -2932,7 +2948,7 @@ void NXMaskImage(XImage *image, unsigned int method) { maskMethod = MASK_64_COLORS; - #ifdef DEBUG + #ifdef DEBUG_IMAGE fprintf(stderr, "******NXMaskImage: Method is MASK_64K_COLORS\n"); #endif @@ -2943,7 +2959,7 @@ void NXMaskImage(XImage *image, unsigned int method) { maskMethod = MASK_256_COLORS; - #ifdef DEBUG + #ifdef DEBUG_IMAGE fprintf(stderr, "******NXMaskImage: Method is MASK_256_COLORS\n"); #endif @@ -2954,7 +2970,7 @@ void NXMaskImage(XImage *image, unsigned int method) { maskMethod = MASK_512_COLORS; - #ifdef DEBUG + #ifdef DEBUG_IMAGE fprintf(stderr, "******NXMaskImage: Method is MASK_512K_COLORS\n"); #endif @@ -2965,7 +2981,7 @@ void NXMaskImage(XImage *image, unsigned int method) { maskMethod = MASK_4K_COLORS; - #ifdef DEBUG + #ifdef DEBUG_IMAGE fprintf(stderr, "******NXMaskImage: Method is MASK_4K_COLORS\n"); #endif @@ -2976,7 +2992,7 @@ void NXMaskImage(XImage *image, unsigned int method) { maskMethod = MASK_32K_COLORS; - #ifdef DEBUG + #ifdef DEBUG_IMAGE fprintf(stderr, "******NXMaskImage: Method is MASK_32K_COLORS\n"); #endif @@ -2987,7 +3003,7 @@ void NXMaskImage(XImage *image, unsigned int method) { maskMethod = MASK_64K_COLORS; - #ifdef DEBUG + #ifdef DEBUG_IMAGE fprintf(stderr, "******NXMaskImage: Method is MASK_64K_COLORS\n"); #endif @@ -2998,7 +3014,7 @@ void NXMaskImage(XImage *image, unsigned int method) { maskMethod = MASK_256K_COLORS; - #ifdef DEBUG + #ifdef DEBUG_IMAGE fprintf(stderr, "******NXMaskImage: Method is MASK_256K_COLORS\n"); #endif @@ -3009,7 +3025,7 @@ void NXMaskImage(XImage *image, unsigned int method) { maskMethod = MASK_2M_COLORS; - #ifdef DEBUG + #ifdef DEBUG_IMAGE fprintf(stderr, "******NXMaskImage: Method is MASK_2M_COLORS\n"); #endif @@ -3020,7 +3036,7 @@ void NXMaskImage(XImage *image, unsigned int method) { maskMethod = MASK_16M_COLORS; - #ifdef DEBUG + #ifdef DEBUG_IMAGE fprintf(stderr, "******NXMaskImage: Method is MASK_16M_COLORS\n"); #endif @@ -3037,7 +3053,7 @@ void NXMaskImage(XImage *image, unsigned int method) } } - #ifdef TEST + #ifdef TEST_IMAGE fprintf(stderr, "******NXMaskImage: packMethod[%d] => maskMethod[%d]\n", method, maskMethod); #endif @@ -3080,7 +3096,7 @@ void NXMaskImage(XImage *image, unsigned int method) if (ShouldMaskImage(image, mask) == 0) { - #ifdef TEST + #ifdef TEST_IMAGE fprintf(stderr, "******NXMaskImage: the image will not be masked\n"); #endif } @@ -3103,7 +3119,7 @@ void NXInitCache(Display *dpy, int entries) { if (NXImageCache != NULL && NXImageCacheSize == entries) { - #ifdef DEBUG + #ifdef DEBUG_IMAGE fprintf(stderr, "******NXInitCache: Nothing to do with image cache at [%p] and [%d] entries.\n", NXImageCache, NXImageCacheSize); #endif @@ -3111,7 +3127,7 @@ void NXInitCache(Display *dpy, int entries) return; } - #ifdef DEBUG + #ifdef DEBUG_IMAGE fprintf(stderr, "******NXInitCache: Initializing the cache with [%d] entries.\n", entries); #endif @@ -3130,7 +3146,7 @@ void NXInitCache(Display *dpy, int entries) NXImageCacheSize = entries; - #ifdef DEBUG + #ifdef DEBUG_IMAGE fprintf(stderr, "******NXInitCache: Image cache initialized with [%d] entries.\n", entries); #endif } @@ -3143,7 +3159,7 @@ void _NXCacheDump(const char *label) { char s[MD5_LENGTH * 2 + 1]; - #ifdef DEBUG + #ifdef DEBUG_IMAGE fprintf(stderr, "%s: Dumping the content of image cache:\n", label); #endif @@ -3159,7 +3175,7 @@ void _NXCacheDump(const char *label) sprintf(s + (j * 2), "%02X", ((unsigned char *) NXImageCache[i].md5)[j]); } - #ifdef DEBUG + #ifdef DEBUG_IMAGE fprintf(stderr, "%s: [%d][%s].\n", label, i, s); #endif } @@ -3221,7 +3237,7 @@ XImage *NXCacheFindImage(NXPackedImage *src_image, unsigned int *method, unsigne NXImageCacheHits++; - #ifdef DEBUG + #ifdef DEBUG_IMAGE fprintf(stderr, "******NXCacheFindImage: Found at position [%d] with hits [%d] and [%d] packs.\n", i, NXImageCacheHits, NXImageCacheOps); #endif @@ -3236,7 +3252,7 @@ XImage *NXCacheFindImage(NXPackedImage *src_image, unsigned int *method, unsigne if (i > 16) { - #ifdef DEBUG + #ifdef DEBUG_IMAGE fprintf(stderr, "******NXCacheFindImage: Moving the image at the head of the list.\n"); #endif @@ -3297,7 +3313,7 @@ int NXCacheAddImage(NXPackedImage *image, unsigned int method, unsigned char *md if (NXImageCacheOps >= NXImageCacheSize) { - #ifdef DEBUG + #ifdef DEBUG_IMAGE fprintf(stderr, "******NXCacheAddImage: Freeing up the oldest entry.\n"); #endif @@ -3315,7 +3331,7 @@ int NXCacheAddImage(NXPackedImage *image, unsigned int method, unsigned char *md NXImageCacheOps++; - #ifdef DEBUG + #ifdef DEBUG_IMAGE fprintf(stderr, "******NXCacheAddImage: Going to add new image with data size [%d].\n", image -> xoffset); #endif @@ -3341,14 +3357,14 @@ void NXFreeCache(Display *dpy) { if (NXImageCache == NULL) { - #ifdef DEBUG + #ifdef DEBUG_IMAGE fprintf(stderr, "******NXFreeCache: Nothing to do with a null image cache.\n"); #endif return; } - #ifdef DEBUG + #ifdef DEBUG_IMAGE fprintf(stderr, "******NXFreeCache: Freeing the cache with [%d] entries.\n", NXImageCacheSize); #endif @@ -3412,7 +3428,7 @@ static Bool _NXCollectImageHandler(Display *dpy, xReply *rep, char *buf, if ((rep -> generic.sequenceNumber % 65536) != ((CARD16)(state -> sequence) % 65536)) { - #ifdef TEST + #ifdef TEST_IMAGE fprintf(stderr, "******_NXCollectImageHandler: Unmatched sequence [%d] for opcode [%d] " "with length [%d].\n", rep -> generic.sequenceNumber, rep -> generic.type, (int) rep -> generic.length << 2); @@ -3421,7 +3437,7 @@ static Bool _NXCollectImageHandler(Display *dpy, xReply *rep, char *buf, return False; } - #ifdef TEST + #ifdef TEST_IMAGE fprintf(stderr, "******_NXCollectImageHandler: Going to handle asynchronous GetImage reply.\n"); #endif @@ -3438,7 +3454,7 @@ static Bool _NXCollectImageHandler(Display *dpy, xReply *rep, char *buf, if (rep -> generic.type == X_Error) { - #ifdef TEST + #ifdef TEST_IMAGE fprintf(stderr, "******_NXCollectImageHandler: Error received from X server for resource [%d].\n", state -> resource); #endif @@ -3452,7 +3468,7 @@ static Bool _NXCollectImageHandler(Display *dpy, xReply *rep, char *buf, return False; } - #ifdef TEST + #ifdef TEST_IMAGE fprintf(stderr, "******_NXCollectImageHandler: Matched request with sequence [%ld].\n", state -> sequence); #endif @@ -3477,7 +3493,7 @@ static Bool _NXCollectImageHandler(Display *dpy, xReply *rep, char *buf, return False; } - #ifdef TEST + #ifdef TEST_IMAGE fprintf(stderr, "******_NXCollectImageHandler: Going to get reply with size [%d].\n", (int) rep -> generic.length << 2); #endif @@ -3502,7 +3518,7 @@ static Bool _NXCollectImageHandler(Display *dpy, xReply *rep, char *buf, return False; } - #ifdef TEST + #ifdef TEST_IMAGE fprintf(stderr, "******_NXCollectImageHandler: Got reply with depth [%d] visual [%d] size [%d].\n", async_rep -> depth, (int) async_rep -> visual, (int) async_rep -> length << 2); #endif @@ -3531,7 +3547,7 @@ static Bool _NXCollectImageHandler(Display *dpy, xReply *rep, char *buf, return False; } - #ifdef TEST + #ifdef TEST_IMAGE fprintf(stderr, "******_NXCollectImageHandler: Going to get data with size [%d].\n", async_size); #endif @@ -3578,7 +3594,7 @@ static Bool _NXCollectImageHandler(Display *dpy, xReply *rep, char *buf, return True; } - #ifdef TEST + #ifdef TEST_IMAGE fprintf(stderr, "******_NXCollectImageHandler: Successfully stored image data for resource [%d].\n", state -> resource); #endif @@ -3668,7 +3684,7 @@ int NXCollectImage(Display *dpy, unsigned int resource, Drawable drawable, req -> height = height; req -> planeMask = plane_mask; - #ifdef TEST + #ifdef TEST_IMAGE fprintf(stderr, "******NXCollectImage: Sending message opcode [%d] sequence [%ld] for resource [%d].\n", X_GetImage, dpy -> request, resource); @@ -3745,7 +3761,7 @@ int NXGetCollectedImage(Display *dpy, unsigned int resource, XImage **image) SAFE_free(state); - #ifdef TEST + #ifdef TEST_IMAGE fprintf(stderr, "******NXGetCollectedImage: Returning GetImage data for resource [%u].\n", resource); #endif @@ -3794,7 +3810,7 @@ static Bool _NXCollectPropertyHandler(Display *dpy, xReply *rep, char *buf, if ((rep -> generic.sequenceNumber % 65536) != ((CARD16)(state -> sequence) % 65536)) { - #ifdef TEST + #ifdef TEST_PROPERTY fprintf(stderr, "******_NXCollectPropertyHandler: Unmatched sequence [%d] for opcode [%d] " "with length [%d].\n", rep -> generic.sequenceNumber, rep -> generic.type, (int) rep -> generic.length << 2); @@ -3803,7 +3819,7 @@ static Bool _NXCollectPropertyHandler(Display *dpy, xReply *rep, char *buf, return False; } - #ifdef TEST + #ifdef TEST_PROPERTY fprintf(stderr, "******_NXCollectPropertyHandler: Going to handle asynchronous GetProperty reply.\n"); #endif @@ -3820,7 +3836,7 @@ static Bool _NXCollectPropertyHandler(Display *dpy, xReply *rep, char *buf, if (rep -> generic.type == X_Error) { - #ifdef TEST + #ifdef TEST_PROPERTY fprintf(stderr, "******_NXCollectPropertyHandler: Error received from X server for resource [%d].\n", state -> resource); #endif @@ -3834,7 +3850,7 @@ static Bool _NXCollectPropertyHandler(Display *dpy, xReply *rep, char *buf, return False; } - #ifdef TEST + #ifdef TEST_PROPERTY fprintf(stderr, "******_NXCollectPropertyHandler: Matched request with sequence [%ld].\n", state -> sequence); #endif @@ -3859,7 +3875,7 @@ static Bool _NXCollectPropertyHandler(Display *dpy, xReply *rep, char *buf, return False; } - #ifdef TEST + #ifdef TEST_PROPERTY fprintf(stderr, "******_NXCollectPropertyHandler: Going to get reply with size [%d].\n", (int) rep -> generic.length << 2); #endif @@ -3884,7 +3900,7 @@ static Bool _NXCollectPropertyHandler(Display *dpy, xReply *rep, char *buf, return False; } - #ifdef TEST + #ifdef TEST_PROPERTY fprintf(stderr, "******_NXCollectPropertyHandler: Got reply with format [%d] type [%d] size [%d].\n", async_rep -> format, (int) async_rep -> propertyType, (int) async_rep -> length << 2); @@ -3921,7 +3937,7 @@ static Bool _NXCollectPropertyHandler(Display *dpy, xReply *rep, char *buf, return False; } - #ifdef TEST + #ifdef TEST_PROPERTY fprintf(stderr, "******_NXCollectPropertyHandler: Going to get data with size [%d].\n", async_size); #endif @@ -3935,12 +3951,12 @@ static Bool _NXCollectPropertyHandler(Display *dpy, xReply *rep, char *buf, state -> data = async_data; - #ifdef TEST + #ifdef TEST_PROPERTY fprintf(stderr, "******_NXCollectPropertyHandler: Successfully stored property data for resource [%d].\n", state -> resource); #endif } - #ifdef TEST + #ifdef TEST_PROPERTY else { fprintf(stderr, "******_NXCollectPropertyHandler: WARNING! Null property data stored for resource [%d].\n", @@ -4019,7 +4035,7 @@ int NXCollectProperty(Display *dpy, unsigned int resource, Window window, Atom p req -> longOffset = long_offset; req -> longLength = long_length; - #ifdef TEST + #ifdef TEST_PROPERTY fprintf(stderr, "******NXCollectProperty: Sending message opcode [%d] sequence [%ld] for resource [%d].\n", X_GetProperty, dpy -> request, resource); @@ -4105,7 +4121,7 @@ int NXGetCollectedProperty(Display *dpy, unsigned int resource, Atom *actual_typ _NXCollectedProperties[resource] = NULL; - #ifdef TEST + #ifdef TEST_PROPERTY fprintf(stderr, "******NXGetCollectedProperty: Returning GetProperty data for resource [%u].\n", resource); #endif @@ -4148,7 +4164,7 @@ static Bool _NXCollectGrabPointerHandler(Display *dpy, xReply *rep, char *buf, if ((rep -> generic.sequenceNumber % 65536) != ((CARD16)(state -> sequence) % 65536)) { - #ifdef TEST + #ifdef TEST_POINTER fprintf(stderr, "******_NXCollectGrabPointerHandler: Unmatched sequence [%d] for opcode [%d] " "with length [%d].\n", rep -> generic.sequenceNumber, rep -> generic.type, (int) rep -> generic.length << 2); @@ -4157,7 +4173,7 @@ static Bool _NXCollectGrabPointerHandler(Display *dpy, xReply *rep, char *buf, return False; } - #ifdef TEST + #ifdef TEST_POINTER fprintf(stderr, "******_NXCollectGrabPointerHandler: Going to handle asynchronous GrabPointer reply.\n"); #endif @@ -4167,7 +4183,7 @@ static Bool _NXCollectGrabPointerHandler(Display *dpy, xReply *rep, char *buf, if (rep -> generic.type == X_Error) { - #ifdef TEST + #ifdef TEST_POINTER fprintf(stderr, "******_NXCollectGrabPointerHandler: Error received from X server for resource [%d].\n", state -> resource); #endif @@ -4181,7 +4197,7 @@ static Bool _NXCollectGrabPointerHandler(Display *dpy, xReply *rep, char *buf, return False; } - #ifdef TEST + #ifdef TEST_POINTER fprintf(stderr, "******_NXCollectGrabPointerHandler: Matched request with sequence [%ld].\n", state -> sequence); #endif @@ -4206,7 +4222,7 @@ static Bool _NXCollectGrabPointerHandler(Display *dpy, xReply *rep, char *buf, return False; } - #ifdef TEST + #ifdef TEST_POINTER fprintf(stderr, "******_NXCollectGrabPointerHandler: Going to get reply with size [%d].\n", (int) rep -> generic.length << 2); #endif @@ -4231,7 +4247,7 @@ static Bool _NXCollectGrabPointerHandler(Display *dpy, xReply *rep, char *buf, return False; } - #ifdef TEST + #ifdef TEST_POINTER fprintf(stderr, "******_NXCollectGrabPointerHandler: Got reply with status [%d] size [%d].\n", async_rep -> status, (int) async_rep -> length << 2); #endif @@ -4311,7 +4327,7 @@ int NXCollectGrabPointer(Display *dpy, unsigned int resource, Window grab_window req -> cursor = cursor; req -> time = time; - #ifdef TEST + #ifdef TEST_POINTER fprintf(stderr, "******NXCollectGrabPointer: Sending message opcode [%d] sequence [%ld] " "for resource [%d].\n", X_GrabPointer, dpy -> request, resource); #endif @@ -4379,7 +4395,7 @@ int NXGetCollectedGrabPointer(Display *dpy, unsigned int resource, int *status) _NXCollectedGrabPointers[resource] = NULL; - #ifdef TEST + #ifdef TEST_POINTER fprintf(stderr, "******NXGetCollectedGrabPointer: Returning GrabPointer data for resource [%u].\n", resource); #endif @@ -4422,7 +4438,7 @@ static Bool _NXCollectInputFocusHandler(Display *dpy, xReply *rep, char *buf, if ((rep -> generic.sequenceNumber % 65536) != ((CARD16)(state -> sequence) % 65536)) { - #ifdef TEST + #ifdef TEST_INPUT fprintf(stderr, "******_NXCollectInputFocusHandler: Unmatched sequence [%d] for opcode [%d] " "with length [%d].\n", rep -> generic.sequenceNumber, rep -> generic.type, (int) rep -> generic.length << 2); @@ -4431,7 +4447,7 @@ static Bool _NXCollectInputFocusHandler(Display *dpy, xReply *rep, char *buf, return False; } - #ifdef TEST + #ifdef TEST_INPUT fprintf(stderr, "******_NXCollectInputFocusHandler: Going to handle asynchronous GetInputFocus reply.\n"); #endif @@ -4441,7 +4457,7 @@ static Bool _NXCollectInputFocusHandler(Display *dpy, xReply *rep, char *buf, if (rep -> generic.type == X_Error) { - #ifdef TEST + #ifdef TEST_INPUT fprintf(stderr, "******_NXCollectInputFocusHandler: Error received from X server for resource [%d].\n", state -> resource); #endif @@ -4455,7 +4471,7 @@ static Bool _NXCollectInputFocusHandler(Display *dpy, xReply *rep, char *buf, return False; } - #ifdef TEST + #ifdef TEST_INPUT fprintf(stderr, "******_NXCollectInputFocusHandler: Matched request with sequence [%ld].\n", state -> sequence); #endif @@ -4480,7 +4496,7 @@ static Bool _NXCollectInputFocusHandler(Display *dpy, xReply *rep, char *buf, return False; } - #ifdef TEST + #ifdef TEST_INPUT fprintf(stderr, "******_NXCollectInputFocusHandler: Going to get reply with size [%d].\n", (int) rep -> generic.length << 2); #endif @@ -4505,7 +4521,7 @@ static Bool _NXCollectInputFocusHandler(Display *dpy, xReply *rep, char *buf, return False; } - #ifdef TEST + #ifdef TEST_INPUT fprintf(stderr, "******_NXCollectInputFocusHandler: Got reply with focus [%d] revert to [%d] " "size [%d].\n", (int) async_rep -> focus, (int) async_rep -> revertTo, (int) async_rep -> length << 2); @@ -4576,7 +4592,7 @@ int NXCollectInputFocus(Display *dpy, unsigned int resource) GetEmptyReq(GetInputFocus, req); - #ifdef TEST + #ifdef TEST_INPUT fprintf(stderr, "******NXCollectInputFocus: Sending message opcode [%d] sequence [%ld] for resource [%d].\n", X_GetInputFocus, dpy -> request, resource); #endif @@ -4647,7 +4663,7 @@ int NXGetCollectedInputFocus(Display *dpy, unsigned int resource, _NXCollectedInputFocuses[resource] = NULL; - #ifdef TEST + #ifdef TEST_INPUT fprintf(stderr, "******NXGetCollectedInputFocus: Returning GetInputFocus data for resource [%u].\n", resource); #endif -- cgit v1.2.3 From 8fe2c114084743e8726ae39089e3aa1491d22719 Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Tue, 9 Feb 2021 19:09:21 +0100 Subject: Use NXAGENT_ONSTART define at more locations marking all the code that is not really required when not using nomachine's nxclient. --- nx-X11/programs/Xserver/hw/nxagent/Atoms.c | 7 +++++-- nx-X11/programs/Xserver/hw/nxagent/Clipboard.c | 3 +++ nx-X11/programs/Xserver/hw/nxagent/Reconnect.c | 2 ++ nx-X11/programs/Xserver/hw/nxagent/Screen.c | 1 + nx-X11/programs/Xserver/hw/nxagent/Splash.c | 2 ++ nx-X11/programs/Xserver/hw/nxagent/Window.c | 2 ++ 6 files changed, 15 insertions(+), 2 deletions(-) (limited to 'nx-X11') diff --git a/nx-X11/programs/Xserver/hw/nxagent/Atoms.c b/nx-X11/programs/Xserver/hw/nxagent/Atoms.c index ea7ad7599..2ddf87e55 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Atoms.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Atoms.c @@ -89,9 +89,12 @@ static char *nxagentAtomNames[NXAGENT_NUMBER_OF_ATOMS + 1] = "WM_NX_READY", /* 3 */ /* nxagent takes the ownership of the selection with this name to signal the nxclient (or any other watching program) - it is ready. */ + it is ready. This is only used if NXAGENT_ONSTART is defined. + We cannot enclose it in #ifdef here because we use the numeric + indices to this structure at multiple places. */ "MCOPGLOBALS", /* 4 */ - /* used for artsd support. */ + /* used for artsd support. Only used if compiled with + NXAGENT_ARTSD */ "NX_CUT_BUFFER_SERVER", /* 5 */ /* this is the name of a property on nxagent's window on the real X server. This property is used for passing clipboard diff --git a/nx-X11/programs/Xserver/hw/nxagent/Clipboard.c b/nx-X11/programs/Xserver/hw/nxagent/Clipboard.c index 8ac2241a6..22fc96f4f 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Clipboard.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Clipboard.c @@ -2237,6 +2237,7 @@ Bool nxagentInitClipboard(WindowPtr pWin) nxagentXFixesInfo.Initialized = True; } +#ifdef NXAGENT_ONSTART /* The first paste from CLIPBOARD did not work directly after session start. Removing this code makes it work. It is unsure why @@ -2247,6 +2248,7 @@ Bool nxagentInitClipboard(WindowPtr pWin) if (nxagentSessionId[0]) { + // nxagentAtoms[10] is the CLIPBOARD atom #ifdef TEST fprintf(stderr, "%s: setting the ownership of %s to %lx" " and registering for PropertyChangeMask events\n", __func__, @@ -2258,6 +2260,7 @@ Bool nxagentInitClipboard(WindowPtr pWin) nxagentChangeWindowAttributes(pWin, CWEventMask); } */ +#endif if (nxagentReconnectTrap) { diff --git a/nx-X11/programs/Xserver/hw/nxagent/Reconnect.c b/nx-X11/programs/Xserver/hw/nxagent/Reconnect.c index e6d3ce6ec..58c1fc4e2 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Reconnect.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Reconnect.c @@ -503,12 +503,14 @@ Bool nxagentReconnectSession(void) nxagentMapDefaultWindows(); +#ifdef NXAGENT_ONSTART /* * Ensure that the SetSelectionOwner request is sent through the * link. */ XFlush(nxagentDisplay); +#endif NXTransContinue(NULL); diff --git a/nx-X11/programs/Xserver/hw/nxagent/Screen.c b/nx-X11/programs/Xserver/hw/nxagent/Screen.c index b87c1e225..500006868 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Screen.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Screen.c @@ -1865,6 +1865,7 @@ N/A (unsigned char*) "X-AGENT", strlen("X-AGENT")); } +#endif XSelectInput(nxagentDisplay, nxagentFullscreenWindow, nxagentGetDefaultEventMask()); } diff --git a/nx-X11/programs/Xserver/hw/nxagent/Splash.c b/nx-X11/programs/Xserver/hw/nxagent/Splash.c index 37f965f04..a4dfb73d2 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Splash.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Splash.c @@ -344,6 +344,7 @@ void nxagentRemoveSplashWindow(void) nxagentSplashWindow = None; nxagentRefreshWindows(screenInfo.screens[0]->root); +#ifdef NXAGENT_ONSTART #ifdef TEST fprintf(stderr, "%s: setting the ownership of %s (%d) on window [0x%lx]\n", __func__, "NX_CUT_BUFFER_SERVER", (int)serverTransToAgentProperty, nxagentWindow(screenInfo.screens[0]->root)); @@ -351,6 +352,7 @@ void nxagentRemoveSplashWindow(void) XSetSelectionOwner(nxagentDisplay, serverTransToAgentProperty, nxagentWindow(screenInfo.screens[0]->root), CurrentTime); +#endif } if (nxagentPixmapLogo) diff --git a/nx-X11/programs/Xserver/hw/nxagent/Window.c b/nx-X11/programs/Xserver/hw/nxagent/Window.c index 5f12fd48a..00439d2e0 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Window.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Window.c @@ -2575,12 +2575,14 @@ void nxagentMapDefaultWindows(void) } } +#ifdef NXAGENT_ONSTART /* * Send a SetSelectionOwner request to notify of the agent start. */ XSetSelectionOwner(nxagentDisplay, serverTransToAgentProperty, nxagentDefaultWindows[i], CurrentTime); +#endif } /* -- cgit v1.2.3 From 111ac2eed54438971554bd71115316472f1c9976 Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Tue, 9 Feb 2021 19:31:20 +0100 Subject: nxagent: make X2GO support optional --- nx-X11/programs/Xserver/hw/nxagent/Args.c | 6 ++++++ nx-X11/programs/Xserver/hw/nxagent/Display.c | 4 ++++ nx-X11/programs/Xserver/hw/nxagent/Icons.h | 2 ++ nx-X11/programs/Xserver/hw/nxagent/Imakefile | 2 ++ nx-X11/programs/Xserver/hw/nxagent/Init.c | 4 +++- nx-X11/programs/Xserver/hw/nxagent/Init.h | 2 ++ nx-X11/programs/Xserver/hw/nxagent/Keyboard.c | 4 +++- nx-X11/programs/Xserver/hw/nxagent/Keystroke.c | 6 +++++- nx-X11/programs/Xserver/hw/nxagent/Screen.c | 5 +++++ nx-X11/programs/Xserver/hw/nxagent/Splash.c | 7 +++++++ 10 files changed, 39 insertions(+), 3 deletions(-) (limited to 'nx-X11') diff --git a/nx-X11/programs/Xserver/hw/nxagent/Args.c b/nx-X11/programs/Xserver/hw/nxagent/Args.c index 72d6d050c..9ecf2fb8a 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Args.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Args.c @@ -197,10 +197,12 @@ int ddxProcessArgument(int argc, char *argv[], int i) nxagentProgName = strdup(basename(basec)); SAFE_free(basec); +#ifdef X2GO /* * Check if we are running as X2Go Agent */ checkX2goAgent(); +#endif } #ifdef TEST @@ -691,6 +693,7 @@ int ddxProcessArgument(int argc, char *argv[], int i) { SAFE_free(nxagentKeyboard); +#ifdef X2GO if (nxagentX2go && strcmp(argv[i], "null/null") == 0) { #ifdef TEST @@ -701,6 +704,7 @@ int ddxProcessArgument(int argc, char *argv[], int i) nxagentKeyboard = strdup("clone"); } else +#endif { nxagentKeyboard = strdup(argv[i]); } @@ -1775,11 +1779,13 @@ N/A if (*nxagentWindowName == '\0') { +#ifdef X2GO if(nxagentX2go) { snprintf(nxagentWindowName, NXAGENTWINDOWNAMELENGTH, "X2Go Agent"); } else +#endif { snprintf(nxagentWindowName, NXAGENTWINDOWNAMELENGTH, "NX Agent"); } diff --git a/nx-X11/programs/Xserver/hw/nxagent/Display.c b/nx-X11/programs/Xserver/hw/nxagent/Display.c index 89d49edf1..95b5aa3af 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Display.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Display.c @@ -92,7 +92,9 @@ is" without express or implied warranty. #include "compext/Compext.h" #include NXAGENT_ICON_NAME +#ifdef X2GO #include X2GOAGENT_ICON_NAME +#endif /* * Set here the required log level. @@ -1849,6 +1851,7 @@ Bool nxagentMakeIcon(Display *disp, Pixmap *nxIcon, Pixmap *nxMask) { char** agentIconData; +#ifdef X2GO /* * selecting x2go icon when running as X2Go agent */ @@ -1857,6 +1860,7 @@ Bool nxagentMakeIcon(Display *disp, Pixmap *nxIcon, Pixmap *nxMask) agentIconData = x2goagentIconData; } else +#endif { agentIconData = nxagentIconData; } diff --git a/nx-X11/programs/Xserver/hw/nxagent/Icons.h b/nx-X11/programs/Xserver/hw/nxagent/Icons.h index a8a155cec..30457402b 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Icons.h +++ b/nx-X11/programs/Xserver/hw/nxagent/Icons.h @@ -32,6 +32,8 @@ #define NXAGENT_ICON_NAME "nxagent.xpm" +#ifdef X2GO #define X2GOAGENT_ICON_NAME "x2goagent.xpm" +#endif #endif /* __Icons_H__ */ diff --git a/nx-X11/programs/Xserver/hw/nxagent/Imakefile b/nx-X11/programs/Xserver/hw/nxagent/Imakefile index a713467ae..94ae5b2ff 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Imakefile +++ b/nx-X11/programs/Xserver/hw/nxagent/Imakefile @@ -206,6 +206,7 @@ INCLUDES = \ # This only has an effect if NX_TRANS_WAKEUP is also set for os/WaitFor.c # NXAGENT_ARTSD enable special handling of MCOPGLOBALS property used by artsd. # NXAGENT_RENDER_CLEANUP cleanup padding bits/bytes of glyphs to possibly increase compression rate +# X2GO include code to support running as x2goagent # ### macros not investigated yet: # @@ -259,6 +260,7 @@ DEFINES = \ -DRANDR_15_INTERFACE=1 \ -DPANORAMIX \ -UDEBUG_TREE \ + -DX2GO \ -DSYSTEMFONTDIR=\"$(SYSTEMFONTDIR)\" \ $(NULL) diff --git a/nx-X11/programs/Xserver/hw/nxagent/Init.c b/nx-X11/programs/Xserver/hw/nxagent/Init.c index e8e230956..b120e685e 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Init.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Init.c @@ -173,7 +173,8 @@ int nxagentSaveUnder; */ Bool nxagentDoFullGeneration = True; - /* +#ifdef X2GO +/* * True if agent is running as X2goAgent * False if agent is running as NXAgent */ @@ -196,6 +197,7 @@ void checkX2goAgent(void) else nxagentX2go = False; } +#endif /* * Called at X server's initialization. diff --git a/nx-X11/programs/Xserver/hw/nxagent/Init.h b/nx-X11/programs/Xserver/hw/nxagent/Init.h index 6fa1bedd7..1b87f2296 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Init.h +++ b/nx-X11/programs/Xserver/hw/nxagent/Init.h @@ -45,8 +45,10 @@ extern int nxagentDoFullGeneration; extern int nxagentBackingStore; extern int nxagentSaveUnder; +#ifdef X2GO extern int nxagentX2go; void checkX2goAgent(void); +#endif extern ServerGrabInfoRec nxagentGrabServerInfo; diff --git a/nx-X11/programs/Xserver/hw/nxagent/Keyboard.c b/nx-X11/programs/Xserver/hw/nxagent/Keyboard.c index 731844874..2142adc8e 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Keyboard.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Keyboard.c @@ -663,7 +663,8 @@ XkbError: #endif nxagentChangeOption(KeycodeConversion, KeycodeConversionOff); - /* +#ifdef X2GO + /* * when cloning we do not want X2Go to set the keyboard * via a keyboard file generated by nxagent. The defined * method for switching that off is the creation of a dir @@ -692,6 +693,7 @@ XkbError: { nxagentWriteKeyboardFile(nxagentRemoteRules, nxagentRemoteModel, nxagentRemoteLayout, nxagentRemoteVariant, nxagentRemoteOptions); } +#endif } nxagentKeycodeConversionSetup(); } diff --git a/nx-X11/programs/Xserver/hw/nxagent/Keystroke.c b/nx-X11/programs/Xserver/hw/nxagent/Keystroke.c index aff2e56ab..828649e5a 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Keystroke.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Keystroke.c @@ -314,11 +314,15 @@ void nxagentInitKeystrokes(Bool force) done = True; +#ifdef X2GO if (nxagentX2go) { homefile = "/.x2go/config/keystrokes.cfg"; etcfile = "/etc/x2go/keystrokes.cfg"; envvar = "X2GO_KEYSTROKEFILE"; - } else { + } + else +#endif + { homefile = "/.nx/config/keystrokes.cfg"; etcfile = "/etc/nxagent/keystrokes.cfg"; envvar = "NXAGENT_KEYSTROKEFILE"; diff --git a/nx-X11/programs/Xserver/hw/nxagent/Screen.c b/nx-X11/programs/Xserver/hw/nxagent/Screen.c index 500006868..febb47c12 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Screen.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Screen.c @@ -1814,11 +1814,13 @@ N/A #endif } +#ifdef X2GO /* * Setting WM_CLASS to "X2GoAgent" when running in X2Go Agent mode * we need it to properly display all window parameters by some WMs * (for example on Maemo) */ +#endif { #ifdef TEST fprintf(stderr, "nxagentOpenScreen: Setting WM_CLASS and WM_NAME for window with id [%ld].\n", @@ -1827,12 +1829,14 @@ N/A XClassHint hint; +#ifdef X2GO if(nxagentX2go) { hint.res_name = strdup("X2GoAgent"); hint.res_class = strdup("X2GoAgent"); } else +#endif { hint.res_name = strdup("NXAgent"); hint.res_class = strdup("NXAgent"); @@ -1850,6 +1854,7 @@ N/A if (nxagentOption(Fullscreen)) { +#ifdef NXAGENT_ONSTART /* * FIXME: Do we still need to set this property? */ diff --git a/nx-X11/programs/Xserver/hw/nxagent/Splash.c b/nx-X11/programs/Xserver/hw/nxagent/Splash.c index a4dfb73d2..898868925 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Splash.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Splash.c @@ -48,6 +48,12 @@ #undef TEST #undef DEBUG +#ifndef X2GO +void nxagentShowSplashWindow(XlibWindow parentWindow) {} +void nxagentPaintLogo(XlibWindow win, int scale, int width, int height) {} +void nxagentRemoveSplashWindow(void) {} +Bool nxagentHaveSplashWindow(void) {return False;} +#else /* * Colors used to paint the splash screen. */ @@ -361,3 +367,4 @@ void nxagentRemoveSplashWindow(void) nxagentPixmapLogo = (XlibPixmap) 0; } } +#endif /* ifdef X2GO */ -- cgit v1.2.3 From 666c4d16aea1f35a50595ef81ab8bb94b23b1097 Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Tue, 9 Feb 2021 19:38:08 +0100 Subject: nxagent: drop NXAGENT_SHAPE define was never used in the past years, we were always compiling with -DNXAGENT_SHAPE2 --- nx-X11/programs/Xserver/hw/nxagent/Imakefile | 1 - nx-X11/programs/Xserver/hw/nxagent/Window.c | 20 +++++--------------- 2 files changed, 5 insertions(+), 16 deletions(-) (limited to 'nx-X11') diff --git a/nx-X11/programs/Xserver/hw/nxagent/Imakefile b/nx-X11/programs/Xserver/hw/nxagent/Imakefile index 94ae5b2ff..f62ff9185 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Imakefile +++ b/nx-X11/programs/Xserver/hw/nxagent/Imakefile @@ -192,7 +192,6 @@ INCLUDES = \ ### list of existing NXAGENT macros: # -# NXAGENT_SHAPE Old shape code # NXAGENT_SHAPE2 New shape code # NXAGENT_FIXKEYS Force the release of pressed key when losing focus # NXAGENT_CLIPBOARD Enables clipboard cut and paste function between X servers. diff --git a/nx-X11/programs/Xserver/hw/nxagent/Window.c b/nx-X11/programs/Xserver/hw/nxagent/Window.c index 00439d2e0..0e26a322c 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Window.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Window.c @@ -2079,13 +2079,11 @@ void nxagentClipNotify(WindowPtr pWin, int dx, int dy) nxagentAddConfiguredWindow(pWin, CWStackMode); nxagentAddConfiguredWindow(pWin, CW_Shape); - #ifndef NXAGENT_SHAPE - #ifdef SHAPE - /* - * nxagentShapeWindow(pWin); - */ - #endif /* SHAPE */ - #endif /* NXAGENT_SHAPE */ + #ifdef SHAPE + /* + * nxagentShapeWindow(pWin); + */ + #endif /* SHAPE */ } /* @@ -2378,10 +2376,8 @@ void nxagentShapeWindow(WindowPtr pWin) XUnionRectWithRegion(&rect, reg, reg); } - #ifndef NXAGENT_SHAPE XShapeCombineRegion(nxagentDisplay, nxagentWindow(pWin), ShapeBounding, 0, 0, reg, ShapeSet); - #endif XDestroyRegion(reg); } @@ -2393,10 +2389,8 @@ void nxagentShapeWindow(WindowPtr pWin) RegionEmpty(nxagentWindowPriv(pWin)->boundingShape); - #ifndef NXAGENT_SHAPE XShapeCombineMask(nxagentDisplay, nxagentWindow(pWin), ShapeBounding, 0, 0, None, ShapeSet); - #endif } } @@ -2437,10 +2431,8 @@ void nxagentShapeWindow(WindowPtr pWin) XUnionRectWithRegion(&rect, reg, reg); } - #ifndef NXAGENT_SHAPE XShapeCombineRegion(nxagentDisplay, nxagentWindow(pWin), ShapeClip, 0, 0, reg, ShapeSet); - #endif XDestroyRegion(reg); } @@ -2452,10 +2444,8 @@ void nxagentShapeWindow(WindowPtr pWin) RegionEmpty(nxagentWindowPriv(pWin)->clipShape); - #ifndef NXAGENT_SHAPE XShapeCombineMask(nxagentDisplay, nxagentWindow(pWin), ShapeClip, 0, 0, None, ShapeSet); - #endif } } } -- cgit v1.2.3 From 3fcb7ae3f1bef5eab1b9a284dac24bc5db2aeaca Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Tue, 9 Feb 2021 19:40:47 +0100 Subject: nxagent: drop NXAGENT_SHAPE2 define it was the default for years now, so let's drop the define and include the code unconditonally. --- nx-X11/programs/Xserver/hw/nxagent/Imakefile | 2 -- nx-X11/programs/Xserver/hw/nxagent/Window.c | 34 ++++++++-------------------- 2 files changed, 10 insertions(+), 26 deletions(-) (limited to 'nx-X11') diff --git a/nx-X11/programs/Xserver/hw/nxagent/Imakefile b/nx-X11/programs/Xserver/hw/nxagent/Imakefile index f62ff9185..4e48f62f5 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Imakefile +++ b/nx-X11/programs/Xserver/hw/nxagent/Imakefile @@ -192,7 +192,6 @@ INCLUDES = \ ### list of existing NXAGENT macros: # -# NXAGENT_SHAPE2 New shape code # NXAGENT_FIXKEYS Force the release of pressed key when losing focus # NXAGENT_CLIPBOARD Enables clipboard cut and paste function between X servers. # NXAGENT_RANDR_MODE_PREFIX Prefix for RandR display modes (i.e., nx_x) (default: nx_) @@ -245,7 +244,6 @@ DEFINES = \ -UXF86VIDMODE -UXFreeXDGA -UXF86MISC -UXF86DRI \ -DNXAGENT_SERVER \ -DNXAGENT_RENDER_CLEANUP \ - -DNXAGENT_SHAPE2 \ -DNXAGENT_FIXKEYS \ -DNXAGENT_CLIPBOARD \ -DNXAGENT_WAKEUP=1000 \ diff --git a/nx-X11/programs/Xserver/hw/nxagent/Window.c b/nx-X11/programs/Xserver/hw/nxagent/Window.c index 0e26a322c..6f98ee57b 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Window.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Window.c @@ -471,13 +471,8 @@ Bool nxagentCreateWindow(WindowPtr pWin) } #ifdef SHAPE - #ifdef NXAGENT_SHAPE2 - nxagentWindowPriv(pWin)->boundingShape = NULL; - nxagentWindowPriv(pWin)->clipShape = NULL; - #else - nxagentWindowPriv(pWin)->boundingShape = RegionCreate(NULL, 1); - nxagentWindowPriv(pWin)->clipShape = RegionCreate(NULL, 1); - #endif + nxagentWindowPriv(pWin)->boundingShape = NULL; + nxagentWindowPriv(pWin)->clipShape = NULL; #endif /* SHAPE */ fbCreateWindow(pWin); @@ -583,21 +578,16 @@ Bool nxagentDestroyWindow(WindowPtr pWin) pWindowPriv->siblingAbove; } - #ifdef NXAGENT_SHAPE2 - #ifdef SHAPE - if (pWindowPriv->boundingShape) - { - RegionDestroy(pWindowPriv->boundingShape); - } - - if (pWindowPriv->clipShape) - { - RegionDestroy(pWindowPriv->clipShape); - } - #endif - #else + #ifdef SHAPE + if (pWindowPriv->boundingShape) + { RegionDestroy(pWindowPriv->boundingShape); + } + + if (pWindowPriv->clipShape) + { RegionDestroy(pWindowPriv->clipShape); + } #endif if (pWindowPriv -> corruptedRegion) @@ -2352,12 +2342,10 @@ void nxagentShapeWindow(WindowPtr pWin) RegionNumRects(wBoundingShape(pWin))); #endif - #ifdef NXAGENT_SHAPE2 if (!nxagentWindowPriv(pWin)->boundingShape) { nxagentWindowPriv(pWin)->boundingShape = RegionCreate(NULL, 1); } - #endif RegionCopy(nxagentWindowPriv(pWin)->boundingShape, wBoundingShape(pWin)); @@ -2407,12 +2395,10 @@ void nxagentShapeWindow(WindowPtr pWin) RegionNumRects(wClipShape(pWin))); #endif - #ifdef NXAGENT_SHAPE2 if (!nxagentWindowPriv(pWin)->clipShape) { nxagentWindowPriv(pWin)->clipShape = RegionCreate(NULL, 1); } - #endif RegionCopy(nxagentWindowPriv(pWin)->clipShape, wClipShape(pWin)); -- cgit v1.2.3 From 5271eed2dbca1d24819578429dad1b0313a281f5 Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Sun, 7 Mar 2021 19:15:32 +0100 Subject: Error.c: untabify --- nx-X11/programs/Xserver/hw/nxagent/Error.c | 150 ++++++++++++++--------------- 1 file changed, 75 insertions(+), 75 deletions(-) (limited to 'nx-X11') diff --git a/nx-X11/programs/Xserver/hw/nxagent/Error.c b/nx-X11/programs/Xserver/hw/nxagent/Error.c index 8c9a52d2e..93f4f4387 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Error.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Error.c @@ -136,105 +136,105 @@ static int nxagentPrintError(dpy, event, fp) XGetErrorDatabaseText(dpy, mtype, "XError", "X Error", mesg, BUFSIZ); (void) fprintf(fp, "%s: %s\n ", mesg, buffer); XGetErrorDatabaseText(dpy, mtype, "MajorCode", "Request Major code %d", - mesg, BUFSIZ); + mesg, BUFSIZ); (void) fprintf(fp, mesg, event->request_code); if (event->request_code < 128) { - snprintf(number, sizeof(number), "%d", event->request_code); - XGetErrorDatabaseText(dpy, "XRequest", number, "", buffer, BUFSIZ); + snprintf(number, sizeof(number), "%d", event->request_code); + XGetErrorDatabaseText(dpy, "XRequest", number, "", buffer, BUFSIZ); } else { #ifndef NXAGENT_SERVER - for (ext = dpy->ext_procs; - ext && (ext->codes.major_opcode != event->request_code); - ext = ext->next) - ; - if (ext) { - strncpy(buffer, ext->name, BUFSIZ); - buffer[BUFSIZ - 1] = '\0'; + for (ext = dpy->ext_procs; + ext && (ext->codes.major_opcode != event->request_code); + ext = ext->next) + ; + if (ext) { + strncpy(buffer, ext->name, BUFSIZ); + buffer[BUFSIZ - 1] = '\0'; } else #endif - buffer[0] = '\0'; + buffer[0] = '\0'; } (void) fprintf(fp, " (%s)\n", buffer); if (event->request_code >= 128) { - XGetErrorDatabaseText(dpy, mtype, "MinorCode", "Request Minor code %d", - mesg, BUFSIZ); - fputs(" ", fp); - (void) fprintf(fp, mesg, event->minor_code); + XGetErrorDatabaseText(dpy, mtype, "MinorCode", "Request Minor code %d", + mesg, BUFSIZ); + fputs(" ", fp); + (void) fprintf(fp, mesg, event->minor_code); #ifndef NXAGENT_SERVER - if (ext) { - snprintf(mesg, sizeof(mesg), "%s.%d", ext->name, event->minor_code); - XGetErrorDatabaseText(dpy, "XRequest", mesg, "", buffer, BUFSIZ); - (void) fprintf(fp, " (%s)", buffer); - } + if (ext) { + snprintf(mesg, sizeof(mesg), "%s.%d", ext->name, event->minor_code); + XGetErrorDatabaseText(dpy, "XRequest", mesg, "", buffer, BUFSIZ); + (void) fprintf(fp, " (%s)", buffer); + } #endif - fputs("\n", fp); + fputs("\n", fp); } if (event->error_code >= 128) { - /* kludge, try to find the extension that caused it */ - buffer[0] = '\0'; + /* kludge, try to find the extension that caused it */ + buffer[0] = '\0'; #ifndef NXAGENT_SERVER - for (ext = dpy->ext_procs; ext; ext = ext->next) { - if (ext->error_string) - (*ext->error_string)(dpy, event->error_code, &ext->codes, - buffer, BUFSIZ); - if (buffer[0]) { - bext = ext; - break; - } - if (ext->codes.first_error && - ext->codes.first_error < (int)event->error_code && - (!bext || ext->codes.first_error > bext->codes.first_error)) - bext = ext; - } - if (bext) - snprintf(buffer, sizeof(buffer), "%s.%d", bext->name, - event->error_code - bext->codes.first_error); - else + for (ext = dpy->ext_procs; ext; ext = ext->next) { + if (ext->error_string) + (*ext->error_string)(dpy, event->error_code, &ext->codes, + buffer, BUFSIZ); + if (buffer[0]) { + bext = ext; + break; + } + if (ext->codes.first_error && + ext->codes.first_error < (int)event->error_code && + (!bext || ext->codes.first_error > bext->codes.first_error)) + bext = ext; + } + if (bext) + snprintf(buffer, sizeof(buffer), "%s.%d", bext->name, + event->error_code - bext->codes.first_error); + else #endif - strcpy(buffer, "Value"); - XGetErrorDatabaseText(dpy, mtype, buffer, "", mesg, BUFSIZ); - if (mesg[0]) { - fputs(" ", fp); - (void) fprintf(fp, mesg, event->resourceid); - fputs("\n", fp); - } - /* let extensions try to print the values */ + strcpy(buffer, "Value"); + XGetErrorDatabaseText(dpy, mtype, buffer, "", mesg, BUFSIZ); + if (mesg[0]) { + fputs(" ", fp); + (void) fprintf(fp, mesg, event->resourceid); + fputs("\n", fp); + } + /* let extensions try to print the values */ #ifndef NXAGENT_SERVER - for (ext = dpy->ext_procs; ext; ext = ext->next) { - if (ext->error_values) - (*ext->error_values)(dpy, event, fp); - } + for (ext = dpy->ext_procs; ext; ext = ext->next) { + if (ext->error_values) + (*ext->error_values)(dpy, event, fp); + } #endif } else if ((event->error_code == BadWindow) || - (event->error_code == BadPixmap) || - (event->error_code == BadCursor) || - (event->error_code == BadFont) || - (event->error_code == BadDrawable) || - (event->error_code == BadColor) || - (event->error_code == BadGC) || - (event->error_code == BadIDChoice) || - (event->error_code == BadValue) || - (event->error_code == BadAtom)) { - if (event->error_code == BadValue) - XGetErrorDatabaseText(dpy, mtype, "Value", "Value 0x%x", - mesg, BUFSIZ); - else if (event->error_code == BadAtom) - XGetErrorDatabaseText(dpy, mtype, "AtomID", "AtomID 0x%x", - mesg, BUFSIZ); - else - XGetErrorDatabaseText(dpy, mtype, "ResourceID", "ResourceID 0x%x", - mesg, BUFSIZ); - fputs(" ", fp); - (void) fprintf(fp, mesg, event->resourceid); - fputs("\n", fp); + (event->error_code == BadPixmap) || + (event->error_code == BadCursor) || + (event->error_code == BadFont) || + (event->error_code == BadDrawable) || + (event->error_code == BadColor) || + (event->error_code == BadGC) || + (event->error_code == BadIDChoice) || + (event->error_code == BadValue) || + (event->error_code == BadAtom)) { + if (event->error_code == BadValue) + XGetErrorDatabaseText(dpy, mtype, "Value", "Value 0x%x", + mesg, BUFSIZ); + else if (event->error_code == BadAtom) + XGetErrorDatabaseText(dpy, mtype, "AtomID", "AtomID 0x%x", + mesg, BUFSIZ); + else + XGetErrorDatabaseText(dpy, mtype, "ResourceID", "ResourceID 0x%x", + mesg, BUFSIZ); + fputs(" ", fp); + (void) fprintf(fp, mesg, event->resourceid); + fputs("\n", fp); } XGetErrorDatabaseText(dpy, mtype, "ErrorSerial", "Error Serial #%d", - mesg, BUFSIZ); + mesg, BUFSIZ); fputs(" ", fp); (void) fprintf(fp, mesg, event->serial); #ifndef NXAGENT_SERVER XGetErrorDatabaseText(dpy, mtype, "CurrentSerial", "Current Serial #%d", - mesg, BUFSIZ); + mesg, BUFSIZ); fputs("\n ", fp); (void) fprintf(fp, mesg, (unsigned long long)(X_DPY_GET_REQUEST(dpy))); #endif -- cgit v1.2.3 From 9b1dd340146ab62bfca9fc4c247edfbec2da2356 Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Sun, 7 Mar 2021 20:21:37 +0100 Subject: document additional options only nxagent knows about --- nx-X11/programs/Xserver/hw/nxagent/man/nxagent.1 | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'nx-X11') diff --git a/nx-X11/programs/Xserver/hw/nxagent/man/nxagent.1 b/nx-X11/programs/Xserver/hw/nxagent/man/nxagent.1 index 2a83a5afb..ebc528d37 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/man/nxagent.1 +++ b/nx-X11/programs/Xserver/hw/nxagent/man/nxagent.1 @@ -459,6 +459,9 @@ The nx-X11 system adds the following command line arguments: .B \-forcenx force use of NX protocol messages assuming communication through \fBnxproxy\fR .TP 8 +.B \-id \fIstring\fP +The session id. +.TP 8 .B \-autograb enable autograb mode on \fBnxagent\fR startup. The autograb feature can be toggled via nxagent keystrokes .TP 8 @@ -740,6 +743,9 @@ enable/disable shared pixmaps support. Accepted values: \fI1\fR (enable, default type of connecting operating system (supported: \fIlinux\fR, \fIwindows\fR, \fIsolaris\fR and \fImacosx\fR) .TP 8 +.B clients= +filename where to log output of the nxagent's clients. This is ignored if no session id has been provided. It then points to stderr. Default: /clients. +.TP 8 .B shadow= define the display that should be shadowed .TP 8 @@ -749,6 +755,9 @@ unique identifier for the shadow session .B shadowmode= full access (set to \fI1\fR) or viewing-only (set to \fI0\fR, default) .TP 8 +.B state= +filename where to store the state of the nxagent (for easier interoperation with software like x2go. Default: sessiondir/state. +.TP 8 .B defer= defer image updates (enabled for all connection types except LAN), accepts values \fI0\fR, \fI1\fR and \fI2\fR -- cgit v1.2.3 From d3573613f209c7d133269a5953ef80f8f947ce0e Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Tue, 9 Mar 2021 18:43:18 +0100 Subject: Compext.c: document function return codes --- .../programs/Xserver/hw/nxagent/compext/Compext.c | 64 ++++++++++++++++++++++ 1 file changed, 64 insertions(+) (limited to 'nx-X11') diff --git a/nx-X11/programs/Xserver/hw/nxagent/compext/Compext.c b/nx-X11/programs/Xserver/hw/nxagent/compext/Compext.c index a77e4fc79..4aaa356e4 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/compext/Compext.c +++ b/nx-X11/programs/Xserver/hw/nxagent/compext/Compext.c @@ -454,6 +454,11 @@ int NXSetDisplayPolicy(Display *dpy, int policy) } } +/* + * return codes: + * -1 something went wrong + * 1 success + */ int NXSetDisplayBuffer(Display *dpy, int size) { /* @@ -817,6 +822,11 @@ void _NXInternalLostSequenceFunction(Display *dpy, unsigned long newseq, #endif } +/* + * return codes: + * 0 error receiving reply + * 1 success + */ Status NXGetControlParameters(Display *dpy, unsigned int *link_type, unsigned int *local_major, unsigned int *local_minor, unsigned int *local_patch, unsigned int *remote_major, unsigned int *remote_minor, @@ -919,6 +929,11 @@ Status NXGetControlParameters(Display *dpy, unsigned int *link_type, unsigned in * remote proxy? */ +/* + * return codes: + * 0 something went wrong + * 1 success + */ Status NXGetUnpackParameters(Display *dpy, unsigned int *entries, unsigned char supported_methods[]) { register xNXGetUnpackParametersReq *req; @@ -1021,6 +1036,11 @@ Status NXGetUnpackParameters(Display *dpy, unsigned int *entries, unsigned char * reserve the XID that will be used by the remote. */ +/* + * return codes: + * 0 something went wrong + * 1 success + */ Status NXGetShmemParameters(Display *dpy, unsigned int *enable_client, unsigned int *enable_server, unsigned int *client_segment, unsigned int *server_segment, unsigned int *client_size, @@ -1170,6 +1190,11 @@ Status NXGetShmemParameters(Display *dpy, unsigned int *enable_client, * advertise only the fonts that can be opened at both sides. */ +/* + * return codes: + * 0 something went wrong + * 1 success + */ Status NXGetFontParameters(Display *dpy, unsigned int path_length, char path_data[]) { _X_UNUSED register xNXGetFontParametersReq *req; @@ -3627,6 +3652,12 @@ int NXGetCollectImageResource(Display *dpy) return -1; } +/* + * return codes: + * 0 no data found for resource (currently unused) + * -1 Failed + * True (1) Handler has been installed, will generate NXCollectImageNotify event when answer arrives + */ int NXCollectImage(Display *dpy, unsigned int resource, Drawable drawable, int src_x, int src_y, unsigned int width, unsigned int height, unsigned long plane_mask, int format) @@ -3984,6 +4015,12 @@ int NXGetCollectPropertyResource(Display *dpy) return -1; } +/* + * return codes: + * 0 no data found for resource (currently unused) + * -1 Failed + * True Handler has been installed, will generate NXCollectPropertyNotify event when answer arrives + */ int NXCollectProperty(Display *dpy, unsigned int resource, Window window, Atom property, long long_offset, long long_length, Bool delete, Atom req_type) { @@ -4092,6 +4129,11 @@ int NXCollectProperty(Display *dpy, unsigned int resource, Window window, Atom p return True; } +/* + * return codes: + * 0 not data available + * True success + */ int NXGetCollectedProperty(Display *dpy, unsigned int resource, Atom *actual_type_return, int *actual_format_return, unsigned long *nitems_return, unsigned long *bytes_after_return, unsigned char **data) @@ -4274,6 +4316,12 @@ int NXGetCollectGrabPointerResource(Display *dpy) return -1; } +/* + * return codes: + * 0 no data found for resource + * -1 Failed + * True Handler has been installed, will generate NXCollectGrabPointerNotify event when answer arrives + */ int NXCollectGrabPointer(Display *dpy, unsigned int resource, Window grab_window, Bool owner_events, unsigned int event_mask, int pointer_mode, int keyboard_mode, Window confine_to, Cursor cursor, Time time) @@ -4373,6 +4421,11 @@ int NXCollectGrabPointer(Display *dpy, unsigned int resource, Window grab_window return True; } +/* + * return codes: + * 0 not data available + * True success + */ int NXGetCollectedGrabPointer(Display *dpy, unsigned int resource, int *status) { register _NXCollectGrabPointerState *state; @@ -4550,6 +4603,12 @@ int NXGetCollectInputFocusResource(Display *dpy) return -1; } +/* + * return codes: + * 0 no data found for resource (currently unused) + * -1 Failed + * True (1) Handler has been installed, will generate NXCollectInputFocusNotify event when answer arrives + */ int NXCollectInputFocus(Display *dpy, unsigned int resource) { _X_UNUSED register xReq *req; @@ -4639,6 +4698,11 @@ int NXCollectInputFocus(Display *dpy, unsigned int resource) return True; } +/* + * return codes: + * 0 not data available + * True success + */ int NXGetCollectedInputFocus(Display *dpy, unsigned int resource, Window *focus_return, int *revert_to_return) { -- cgit v1.2.3 From e9a0f94d058c4297e279bae98fbb7fc0ed5ed4c4 Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Wed, 10 Mar 2021 22:50:46 +0100 Subject: Compext.c: print received vs expected sequence number Should help in debugging "unexpected async reply" problems --- .../programs/Xserver/hw/nxagent/compext/Compext.c | 28 ++++++++++++++++++++++ 1 file changed, 28 insertions(+) (limited to 'nx-X11') diff --git a/nx-X11/programs/Xserver/hw/nxagent/compext/Compext.c b/nx-X11/programs/Xserver/hw/nxagent/compext/Compext.c index 4aaa356e4..7fd54e86f 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/compext/Compext.c +++ b/nx-X11/programs/Xserver/hw/nxagent/compext/Compext.c @@ -3450,6 +3450,13 @@ static Bool _NXCollectImageHandler(Display *dpy, xReply *rep, char *buf, state = (_NXCollectImageState *) data; + #ifdef DEBUG_IMAGE + fprintf(stderr, "******%s: sequence: received [%ld] expected [%ld] 16bit received [%d] expected [%d]\n", + __func__, + (long) rep -> generic.sequenceNumber, (long)state -> sequence, + rep -> generic.sequenceNumber % 65536, (int)(state -> sequence) % 65536); + #endif + if ((rep -> generic.sequenceNumber % 65536) != ((CARD16)(state -> sequence) % 65536)) { @@ -3838,6 +3845,13 @@ static Bool _NXCollectPropertyHandler(Display *dpy, xReply *rep, char *buf, state = (_NXCollectPropertyState *) data; + #ifdef DEBUG_PROPERTY + fprintf(stderr, "******%s: sequence: received [%ld] expected [%ld] 16bit received [%d] expected [%d]\n", + __func__, + (long) rep -> generic.sequenceNumber, (long)state -> sequence, + rep -> generic.sequenceNumber % 65536, (int)(state -> sequence) % 65536); + #endif + if ((rep -> generic.sequenceNumber % 65536) != ((CARD16)(state -> sequence) % 65536)) { @@ -4203,6 +4217,13 @@ static Bool _NXCollectGrabPointerHandler(Display *dpy, xReply *rep, char *buf, state = (_NXCollectGrabPointerState *) data; + #ifdef DEBUG_POINTER + fprintf(stderr, "******%s: sequence: received [%ld] expected [%ld] 16bit received [%d] expected [%d]\n", + __func__, + (long) rep -> generic.sequenceNumber, (long)state -> sequence, + rep -> generic.sequenceNumber % 65536, (int)(state -> sequence) % 65536); + #endif + if ((rep -> generic.sequenceNumber % 65536) != ((CARD16)(state -> sequence) % 65536)) { @@ -4488,6 +4509,13 @@ static Bool _NXCollectInputFocusHandler(Display *dpy, xReply *rep, char *buf, state = (_NXCollectInputFocusState *) data; + #ifdef DEBUG_INPUT + fprintf(stderr, "******%s: sequence: received [%ld] expected [%ld] 16bit received [%d] expected [%d]\n", + __func__, + (long) rep -> generic.sequenceNumber, (long)state -> sequence, + rep -> generic.sequenceNumber % 65536, (int)(state -> sequence) % 65536); + #endif + if ((rep -> generic.sequenceNumber % 65536) != ((CARD16)(state -> sequence) % 65536)) { -- cgit v1.2.3 From 3228dcfc5643e18bc7f115b7ac835267d13f42ee Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Wed, 10 Mar 2021 23:04:01 +0100 Subject: Compext.c: fix misleading error message An X reply contains a type which is X_Reply or X_Error. This is not an opcode which is used when installing the handler. --- nx-X11/programs/Xserver/hw/nxagent/compext/Compext.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'nx-X11') diff --git a/nx-X11/programs/Xserver/hw/nxagent/compext/Compext.c b/nx-X11/programs/Xserver/hw/nxagent/compext/Compext.c index 7fd54e86f..7e5a9799d 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/compext/Compext.c +++ b/nx-X11/programs/Xserver/hw/nxagent/compext/Compext.c @@ -3461,7 +3461,7 @@ static Bool _NXCollectImageHandler(Display *dpy, xReply *rep, char *buf, ((CARD16)(state -> sequence) % 65536)) { #ifdef TEST_IMAGE - fprintf(stderr, "******_NXCollectImageHandler: Unmatched sequence [%d] for opcode [%d] " + fprintf(stderr, "******_NXCollectImageHandler: Unmatched sequence [%d] of type [%d] " "with length [%d].\n", rep -> generic.sequenceNumber, rep -> generic.type, (int) rep -> generic.length << 2); #endif @@ -3856,9 +3856,10 @@ static Bool _NXCollectPropertyHandler(Display *dpy, xReply *rep, char *buf, ((CARD16)(state -> sequence) % 65536)) { #ifdef TEST_PROPERTY - fprintf(stderr, "******_NXCollectPropertyHandler: Unmatched sequence [%d] for opcode [%d] " - "with length [%d].\n", rep -> generic.sequenceNumber, rep -> generic.type, + fprintf(stderr, "******_NXCollectPropertyHandler: Unmatched sequence [%d] of type [%d] " + "with length [%d].\n", rep -> generic.sequenceNumber, rep -> generic.type, (int) rep -> generic.length << 2); + #endif return False; @@ -4228,7 +4229,7 @@ static Bool _NXCollectGrabPointerHandler(Display *dpy, xReply *rep, char *buf, ((CARD16)(state -> sequence) % 65536)) { #ifdef TEST_POINTER - fprintf(stderr, "******_NXCollectGrabPointerHandler: Unmatched sequence [%d] for opcode [%d] " + fprintf(stderr, "******_NXCollectGrabPointerHandler: Unmatched sequence [%d] of type [%d] " "with length [%d].\n", rep -> generic.sequenceNumber, rep -> generic.type, (int) rep -> generic.length << 2); #endif @@ -4520,7 +4521,7 @@ static Bool _NXCollectInputFocusHandler(Display *dpy, xReply *rep, char *buf, ((CARD16)(state -> sequence) % 65536)) { #ifdef TEST_INPUT - fprintf(stderr, "******_NXCollectInputFocusHandler: Unmatched sequence [%d] for opcode [%d] " + fprintf(stderr, "******_NXCollectInputFocusHandler: Unmatched sequence [%d] of type [%d] " "with length [%d].\n", rep -> generic.sequenceNumber, rep -> generic.type, (int) rep -> generic.length << 2); #endif -- cgit v1.2.3 From 2739d0868f849a186f7b06cb0032ee0d2c599532 Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Wed, 17 Mar 2021 22:17:55 +0100 Subject: Compext.c: fix comparisons of 16bit sequence numbers rep->generic.sequenceNumber is of type CARD16 state->sequence is of type unsigned long Converting state->sequence to an int as it has been done since the first version of nxcomp I know of (1.3.0-18 from 2003) is wrong here because for numbers > INT_MAX this will result in a negative number, which, after applying the 16bit modulo, will not match rep->generic.sequenceNumber. Example with numbers: CARD16 c = 24565 unsigned long u = 3179110389 c % 65536 = 24565 u % 65536 = 24565 (int)(u) = -1115856907 (int)(u) % 65536 = -40971 -40971 will not match 24565 To fix this we need to ensure the number stays positive. We use CARD16 for this to match the type in the request which is a 16bit number. On my system CARD16 is unsigned short which is guaranteed to contain _at least_ the 0-65,535 range. As there is no upper limit of the range we cannot drop the modulo because we need this value to be 16bit and not more. Thanks to Norm Green for providing log after log until we could finally identify the reason for him seeing "Xlib: unexpected async reply (sequence 0x94b01439)!" when pasting stopped working. --- .../programs/Xserver/hw/nxagent/compext/Compext.c | 24 +++++++++++----------- 1 file changed, 12 insertions(+), 12 deletions(-) (limited to 'nx-X11') diff --git a/nx-X11/programs/Xserver/hw/nxagent/compext/Compext.c b/nx-X11/programs/Xserver/hw/nxagent/compext/Compext.c index 7e5a9799d..dcb91348b 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/compext/Compext.c +++ b/nx-X11/programs/Xserver/hw/nxagent/compext/Compext.c @@ -3451,10 +3451,10 @@ static Bool _NXCollectImageHandler(Display *dpy, xReply *rep, char *buf, state = (_NXCollectImageState *) data; #ifdef DEBUG_IMAGE - fprintf(stderr, "******%s: sequence: received [%ld] expected [%ld] 16bit received [%d] expected [%d]\n", + fprintf(stderr, "******%s: sequence: received [%hu] expected [%lu] 16bit received [%hu] expected [%hu]\n", __func__, - (long) rep -> generic.sequenceNumber, (long)state -> sequence, - rep -> generic.sequenceNumber % 65536, (int)(state -> sequence) % 65536); + rep -> generic.sequenceNumber, state -> sequence, + rep -> generic.sequenceNumber % 65536, (CARD16)(state -> sequence) % 65536); #endif if ((rep -> generic.sequenceNumber % 65536) != @@ -3846,10 +3846,10 @@ static Bool _NXCollectPropertyHandler(Display *dpy, xReply *rep, char *buf, state = (_NXCollectPropertyState *) data; #ifdef DEBUG_PROPERTY - fprintf(stderr, "******%s: sequence: received [%ld] expected [%ld] 16bit received [%d] expected [%d]\n", + fprintf(stderr, "******%s: sequence: received [%hu] expected [%lu] 16bit received [%hu] expected [%hu]\n", __func__, - (long) rep -> generic.sequenceNumber, (long)state -> sequence, - rep -> generic.sequenceNumber % 65536, (int)(state -> sequence) % 65536); + rep -> generic.sequenceNumber, state -> sequence, + rep -> generic.sequenceNumber % 65536, (CARD16)(state -> sequence) % 65536); #endif if ((rep -> generic.sequenceNumber % 65536) != @@ -4219,10 +4219,10 @@ static Bool _NXCollectGrabPointerHandler(Display *dpy, xReply *rep, char *buf, state = (_NXCollectGrabPointerState *) data; #ifdef DEBUG_POINTER - fprintf(stderr, "******%s: sequence: received [%ld] expected [%ld] 16bit received [%d] expected [%d]\n", + fprintf(stderr, "******%s: sequence: received [%hu] expected [%lu] 16bit received [%hu] expected [%hu]\n", __func__, - (long) rep -> generic.sequenceNumber, (long)state -> sequence, - rep -> generic.sequenceNumber % 65536, (int)(state -> sequence) % 65536); + rep -> generic.sequenceNumber, state -> sequence, + rep -> generic.sequenceNumber % 65536, (CARD16)(state -> sequence) % 65536); #endif if ((rep -> generic.sequenceNumber % 65536) != @@ -4511,10 +4511,10 @@ static Bool _NXCollectInputFocusHandler(Display *dpy, xReply *rep, char *buf, state = (_NXCollectInputFocusState *) data; #ifdef DEBUG_INPUT - fprintf(stderr, "******%s: sequence: received [%ld] expected [%ld] 16bit received [%d] expected [%d]\n", + fprintf(stderr, "******%s: sequence: received [%hu] expected [%lu] 16bit received [%hu] expected [%hu]\n", __func__, - (long) rep -> generic.sequenceNumber, (long)state -> sequence, - rep -> generic.sequenceNumber % 65536, (int)(state -> sequence) % 65536); + rep -> generic.sequenceNumber, state -> sequence, + rep -> generic.sequenceNumber % 65536, (CARD16)(state -> sequence) % 65536); #endif if ((rep -> generic.sequenceNumber % 65536) != -- cgit v1.2.3 From 555cbcb325887b3e19bf7ffc3890f60485681e54 Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Mon, 29 Mar 2021 23:07:18 +0200 Subject: nxagent: add command line switch to enable composite We have it disabled by default but there hasn't been a way to enable it. --- nx-X11/programs/Xserver/composite/compext.c | 6 ++++++ nx-X11/programs/Xserver/hw/nxagent/Args.c | 11 ++++++++++- nx-X11/programs/Xserver/hw/nxagent/Options.c | 2 +- nx-X11/programs/Xserver/hw/nxagent/man/nxagent.1 | 4 ++-- nx-X11/programs/Xserver/os/utils.c | 4 +--- 5 files changed, 20 insertions(+), 7 deletions(-) (limited to 'nx-X11') diff --git a/nx-X11/programs/Xserver/composite/compext.c b/nx-X11/programs/Xserver/composite/compext.c index 8513c6d73..a63b02075 100644 --- a/nx-X11/programs/Xserver/composite/compext.c +++ b/nx-X11/programs/Xserver/composite/compext.c @@ -39,6 +39,7 @@ static DevPrivateKeyRec CompositeClientPrivateKeyRec; #define CompositeClientPrivateKey (&CompositeClientPrivateKeyRec) #else /* !defined(NXAGENT_SERVER) */ +#include "../hw/nxagent/Options.h" static int CompositeClientPrivIndex = -1; #endif /* !defined(NXAGENT_SERVER) */ @@ -623,6 +624,11 @@ CompositeExtensionInit (void) /* Assume initialization is going to fail */ noCompositeExtension = TRUE; +#ifdef NXAGENT_SERVER + if (!nxagentOption(Composite)) + return; +#endif + fprintf(stderr, "COMPOSITE: trying to initialize extension.\n"); for (s = 0; s < screenInfo.numScreens; s++) { diff --git a/nx-X11/programs/Xserver/hw/nxagent/Args.c b/nx-X11/programs/Xserver/hw/nxagent/Args.c index 9ecf2fb8a..f96c2e238 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Args.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Args.c @@ -737,6 +737,14 @@ int ddxProcessArgument(int argc, char *argv[], int i) return 1; } + /* the composite extension is disabled by default so we provide a + way to enable it */ + if (!strcmp(argv[i], "-composite")) + { + nxagentChangeOption(Composite, True); + return 1; + } + if (!strcmp(argv[i], "-nodamage")) { nxagentChangeOption(UseDamage, False); @@ -2106,7 +2114,8 @@ void ddxUseMsg(void) ErrorF("-sync synchronize with the real server\n"); #ifdef RENDER ErrorF("-norender disable the use of the render extension\n"); - ErrorF("-nocomposite disable the use of the composite extension\n"); + ErrorF("-nocomposite disable the use of the composite extension (default)\n"); + ErrorF("-composite enable the use of the composite extension\n"); #endif ErrorF("-nopersistent disable disconnection/reconnection to the X display on SIGHUP\n"); ErrorF("-noshmem disable use of shared memory extension\n"); diff --git a/nx-X11/programs/Xserver/hw/nxagent/Options.c b/nx-X11/programs/Xserver/hw/nxagent/Options.c index afc6899e3..be6e5d5e1 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Options.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Options.c @@ -129,7 +129,7 @@ void nxagentInitOptions(void) nxagentOptions.DisplayBuffer = UNDEFINED; nxagentOptions.DisplayCoalescence = 0; - nxagentOptions.Composite = True; + nxagentOptions.Composite = False; nxagentOptions.IgnoreVisibility = False; diff --git a/nx-X11/programs/Xserver/hw/nxagent/man/nxagent.1 b/nx-X11/programs/Xserver/hw/nxagent/man/nxagent.1 index ebc528d37..74349cda7 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/man/nxagent.1 +++ b/nx-X11/programs/Xserver/hw/nxagent/man/nxagent.1 @@ -506,8 +506,8 @@ nx/nx option on session resumption .B \-norender disable the use of the render extension .TP 8 -.B \-nocomposite -disable the use of the composite extension +.B \-nocomposite/-composite +disable/enable the use of the composite extension (default ist disabled) .TP 8 .B \-nopersistent disable disconnection/reconnection to the X display on diff --git a/nx-X11/programs/Xserver/os/utils.c b/nx-X11/programs/Xserver/os/utils.c index 853a33736..c788fae01 100644 --- a/nx-X11/programs/Xserver/os/utils.c +++ b/nx-X11/programs/Xserver/os/utils.c @@ -146,9 +146,7 @@ Bool noTestExtensions; Bool noBigReqExtension = FALSE; #endif #ifdef COMPOSITE -/* COMPOSITE is disabled by default for now until the - * interface is stable */ -Bool noCompositeExtension = TRUE; +Bool noCompositeExtension = FALSE; #endif #ifdef DAMAGE Bool noDamageExtension = FALSE; -- cgit v1.2.3 From 31c456bf358ea3bb87419aa0bcacd956b3e91e90 Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Mon, 29 Mar 2021 23:43:45 +0200 Subject: Composite.c: fix comment --- nx-X11/programs/Xserver/hw/nxagent/Composite.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'nx-X11') diff --git a/nx-X11/programs/Xserver/hw/nxagent/Composite.c b/nx-X11/programs/Xserver/hw/nxagent/Composite.c index 745696219..7cecd3490 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Composite.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Composite.c @@ -140,10 +140,10 @@ void nxagentRedirectDefaultWindows(void) /* * When trying to redirect only the top level window, and not the - * subwindows, we incur in a strange be- haviour. The top level is - * unmapped, mapped, unmap- ped and then reparented. This at first + * subwindows, we incur in a strange behaviour. The top level is + * unmapped, mapped, unmapped and then reparented. This at first * makes the agent think that the window manager is gone, then the - * agent window disappears. To make thinks even more weird, this + * agent window disappears. To make things even more weird, this * happens only at reconnection. */ -- cgit v1.2.3 From 3823b0a5b65bcfd4d38d9db9c481ef119781549e Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Mon, 29 Mar 2021 23:51:01 +0200 Subject: nxagent: make nxagentCompositeEnable a Boolean there's no need for that variable to be tri-state --- nx-X11/programs/Xserver/hw/nxagent/Composite.c | 12 +++++------- nx-X11/programs/Xserver/hw/nxagent/Composite.h | 2 +- nx-X11/programs/Xserver/hw/nxagent/GCOps.c | 2 +- nx-X11/programs/Xserver/hw/nxagent/Image.c | 2 +- nx-X11/programs/Xserver/hw/nxagent/Pixels.h | 2 +- 5 files changed, 9 insertions(+), 11 deletions(-) (limited to 'nx-X11') diff --git a/nx-X11/programs/Xserver/hw/nxagent/Composite.c b/nx-X11/programs/Xserver/hw/nxagent/Composite.c index 7cecd3490..9e14a82bb 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Composite.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Composite.c @@ -47,7 +47,7 @@ * Set if the composite extension is supported by the remote display. */ -int nxagentCompositeEnable = UNDEFINED; +Bool nxagentCompositeEnable = False; void nxagentCompositeExtensionInit(void) { @@ -55,7 +55,7 @@ void nxagentCompositeExtensionInit(void) * Set the flag only if the initialization completes. */ - nxagentCompositeEnable = 0; + nxagentCompositeEnable = False; if (nxagentOption(Composite)) { @@ -96,7 +96,7 @@ void nxagentCompositeExtensionInit(void) fprintf(stderr, "nxagentCompositeExtensionInit: Enabling the use of the composite extension.\n"); #endif - nxagentCompositeEnable = 1; + nxagentCompositeEnable = True; } #ifdef TEST else @@ -115,8 +115,7 @@ void nxagentCompositeExtensionInit(void) void nxagentRedirectDefaultWindows(void) { - if (nxagentOption(Rootless) || - nxagentCompositeEnable == 0) + if (nxagentOption(Rootless) || !nxagentCompositeEnable) { #ifdef TEST fprintf(stderr, "nxagentRedirectDefaultWindows: Not redirecting default " @@ -154,8 +153,7 @@ void nxagentRedirectDefaultWindows(void) void nxagentRedirectWindow(WindowPtr pWin) { - if (!nxagentOption(Rootless) || - nxagentCompositeEnable == 0) + if (!nxagentOption(Rootless) || !nxagentCompositeEnable) { #ifdef TEST fprintf(stderr, "nxagentRedirectWindow: Not redirecting window id [%ld] " diff --git a/nx-X11/programs/Xserver/hw/nxagent/Composite.h b/nx-X11/programs/Xserver/hw/nxagent/Composite.h index abe2551bf..02f08f878 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Composite.h +++ b/nx-X11/programs/Xserver/hw/nxagent/Composite.h @@ -31,7 +31,7 @@ * its use is enabled. */ -extern int nxagentCompositeEnable; +extern Bool nxagentCompositeEnable; /* * Query the composite extension on the diff --git a/nx-X11/programs/Xserver/hw/nxagent/GCOps.c b/nx-X11/programs/Xserver/hw/nxagent/GCOps.c index 57b7c2b57..bac9947f0 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/GCOps.c +++ b/nx-X11/programs/Xserver/hw/nxagent/GCOps.c @@ -700,7 +700,7 @@ RegionPtr nxagentCopyArea(DrawablePtr pSrcDrawable, DrawablePtr pDstDrawable, if (!nxagentOption(IgnoreVisibility) && pDstDrawable -> type == DRAWABLE_WINDOW && (!nxagentWindowIsVisible((WindowPtr) pDstDrawable) || - (!nxagentDefaultWindowIsVisible() && nxagentCompositeEnable == 0))) + (!nxagentDefaultWindowIsVisible() && !nxagentCompositeEnable))) { #ifdef TEST fprintf(stderr, "nxagentCopyArea: Prevented operation on fully obscured window at [%p].\n", diff --git a/nx-X11/programs/Xserver/hw/nxagent/Image.c b/nx-X11/programs/Xserver/hw/nxagent/Image.c index 8c828df20..ad278491e 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Image.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Image.c @@ -526,7 +526,7 @@ void nxagentPutImage(DrawablePtr pDrawable, GCPtr pGC, int depth, if (!nxagentOption(IgnoreVisibility) && pDrawable -> type == DRAWABLE_WINDOW && (!nxagentWindowIsVisible((WindowPtr) pDrawable) || - (!nxagentDefaultWindowIsVisible() && nxagentCompositeEnable == 0))) + (!nxagentDefaultWindowIsVisible() && !nxagentCompositeEnable))) { #ifdef TEST diff --git a/nx-X11/programs/Xserver/hw/nxagent/Pixels.h b/nx-X11/programs/Xserver/hw/nxagent/Pixels.h index cf5e50c04..f2b43b0fc 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Pixels.h +++ b/nx-X11/programs/Xserver/hw/nxagent/Pixels.h @@ -174,7 +174,7 @@ FIXME: Changed macro: NXAGENT_SHOULD_DEFER_COMPOSITE #define NXAGENT_SHOULD_SYNCHRONIZE_WINDOW(pDrawable) \ (nxagentWindowIsVisible((WindowPtr) pDrawable) && \ - (nxagentDefaultWindowIsVisible() || nxagentCompositeEnable == 1)) + (nxagentDefaultWindowIsVisible() || nxagentCompositeEnable)) #define MINIMUM_PIXMAP_USAGE_COUNTER 2 -- cgit v1.2.3 From af5cf2659c4cc7c009ed7fa0fbb1a58e210e6453 Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Mon, 29 Mar 2021 23:58:49 +0200 Subject: nxagent: treat enableBackingStore as Boolean Use TRUE and FALSE like dix does. --- nx-X11/programs/Xserver/hw/nxagent/Args.c | 6 +++--- nx-X11/programs/Xserver/hw/nxagent/Screen.c | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) (limited to 'nx-X11') diff --git a/nx-X11/programs/Xserver/hw/nxagent/Args.c b/nx-X11/programs/Xserver/hw/nxagent/Args.c index f96c2e238..b4f9e7c83 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Args.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Args.c @@ -1998,16 +1998,16 @@ FIXME: In rootless mode the backing-store support is not functional yet. */ if (nxagentOption(Rootless)) { - enableBackingStore = 0; + enableBackingStore = FALSE; } else if (nxagentOption(BackingStore) == BackingStoreUndefined || nxagentOption(BackingStore) == BackingStoreForce) { - enableBackingStore = 1; + enableBackingStore = TRUE; } else if (nxagentOption(BackingStore) == BackingStoreNever) { - enableBackingStore = 0; + enableBackingStore = FALSE; } /* diff --git a/nx-X11/programs/Xserver/hw/nxagent/Screen.c b/nx-X11/programs/Xserver/hw/nxagent/Screen.c index febb47c12..1cc4e5448 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Screen.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Screen.c @@ -1616,7 +1616,7 @@ N/A pScreen->ClearBackingStore = (RegionPtr (*)()) 0; pScreen->DrawGuarantee = (void (*)()) 0; - if (enableBackingStore == 1) + if (enableBackingStore) { #ifdef TEST fprintf(stderr, "nxagentOpenScreen: Going to initialize backing store.\n"); -- cgit v1.2.3 From a6d018bef8897ccac1b481e14d94f9436841b21a Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Tue, 30 Mar 2021 00:02:05 +0200 Subject: nxagent: make nxagentAlpha* Booleans --- nx-X11/programs/Xserver/hw/nxagent/Args.c | 4 ++-- nx-X11/programs/Xserver/hw/nxagent/Image.c | 6 +++--- nx-X11/programs/Xserver/hw/nxagent/Image.h | 4 ++-- nx-X11/programs/Xserver/hw/nxagent/NXrender.c | 2 +- nx-X11/programs/Xserver/hw/nxagent/Render.c | 4 ++-- 5 files changed, 10 insertions(+), 10 deletions(-) (limited to 'nx-X11') diff --git a/nx-X11/programs/Xserver/hw/nxagent/Args.c b/nx-X11/programs/Xserver/hw/nxagent/Args.c index b4f9e7c83..e134d3be2 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Args.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Args.c @@ -1884,11 +1884,11 @@ N/A fprintf(stderr, "nxagentPostProcessArgs: WARNING! Using backward compatible alpha encoding.\n"); #endif - nxagentAlphaCompat = 1; + nxagentAlphaCompat = True; } else { - nxagentAlphaCompat = 0; + nxagentAlphaCompat = False; } nxagentRemoteMajor = remoteMajor; diff --git a/nx-X11/programs/Xserver/hw/nxagent/Image.c b/nx-X11/programs/Xserver/hw/nxagent/Image.c index ad278491e..c033bf70d 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Image.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Image.c @@ -87,8 +87,8 @@ int nxagentSplitThreshold = -1; * Set if images can use the alpha channel. */ -int nxagentAlphaEnabled = 0; -int nxagentAlphaCompat = 0; +Bool nxagentAlphaEnabled = False; +Bool nxagentAlphaCompat = False; /* * Used to reformat image when connecting to displays having different @@ -418,7 +418,7 @@ FIXME: Here the split trap is always set and so the caching of the * send the alpha data in compressed form. */ - if (nxagentAlphaCompat == 0) + if (!nxagentAlphaCompat) { NXSetUnpackAlpha(nxagentDisplay, resource, PACK_NONE, size, data, size); } diff --git a/nx-X11/programs/Xserver/hw/nxagent/Image.h b/nx-X11/programs/Xserver/hw/nxagent/Image.h index 6e22fa9f6..5876f5152 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Image.h +++ b/nx-X11/programs/Xserver/hw/nxagent/Image.h @@ -61,8 +61,8 @@ extern int nxagentSplitThreshold; * can be sent in compressed form. */ -extern int nxagentAlphaEnabled; -extern int nxagentAlphaCompat; +extern Bool nxagentAlphaEnabled; +extern Bool nxagentAlphaCompat; /* * Reset the visual and alpha cache diff --git a/nx-X11/programs/Xserver/hw/nxagent/NXrender.c b/nx-X11/programs/Xserver/hw/nxagent/NXrender.c index 5851eb05c..eed64f808 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/NXrender.c +++ b/nx-X11/programs/Xserver/hw/nxagent/NXrender.c @@ -123,7 +123,7 @@ extern void nxagentRenderCreateConicalGradient(PicturePtr pPicture, xRenderColor *colors); #ifdef NXAGENT_SERVER -extern int nxagentAlphaEnabled; +extern Bool nxagentAlphaEnabled; #endif /* diff --git a/nx-X11/programs/Xserver/hw/nxagent/Render.c b/nx-X11/programs/Xserver/hw/nxagent/Render.c index 98d7aef67..205940ed7 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Render.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Render.c @@ -703,7 +703,7 @@ int nxagentCreatePicture(PicturePtr pPicture, Mask mask) nxagentPicturePriv(pPicture) -> picture = id; - if (nxagentAlphaEnabled == 1 && pPicture -> pDrawable->depth == 32 && + if (nxagentAlphaEnabled && pPicture -> pDrawable -> depth == 32 && pPicture -> pFormat -> direct.alpha != 0) { if (pPicture -> pDrawable -> type == DRAWABLE_PIXMAP) @@ -2431,7 +2431,7 @@ void nxagentReconnectPicture(void * p0, XID x1, void *p2) (void *) pPicture, nxagentPicture(pPicture)); #endif - if (nxagentAlphaEnabled == 1 && pPicture -> pDrawable -> depth == 32 && + if (nxagentAlphaEnabled && pPicture -> pDrawable -> depth == 32 && pPicture -> pFormat -> direct.alpha != 0) { if (pPicture -> pDrawable -> type == DRAWABLE_PIXMAP) -- cgit v1.2.3 From 4a6ca0033c568959123a58914c420ea4b866113a Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Tue, 30 Mar 2021 00:10:47 +0200 Subject: nxagent: make nxagentX2go a Boolean everywhere also correct ugly if formatting regarding nxagentX2go --- nx-X11/programs/Xserver/hw/nxagent/Args.c | 2 +- nx-X11/programs/Xserver/hw/nxagent/Init.h | 2 +- nx-X11/programs/Xserver/hw/nxagent/Keystroke.c | 2 +- nx-X11/programs/Xserver/hw/nxagent/Screen.c | 2 +- nx-X11/programs/Xserver/hw/nxagent/Splash.c | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) (limited to 'nx-X11') diff --git a/nx-X11/programs/Xserver/hw/nxagent/Args.c b/nx-X11/programs/Xserver/hw/nxagent/Args.c index e134d3be2..b1c0231f1 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Args.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Args.c @@ -1788,7 +1788,7 @@ N/A if (*nxagentWindowName == '\0') { #ifdef X2GO - if(nxagentX2go) + if (nxagentX2go) { snprintf(nxagentWindowName, NXAGENTWINDOWNAMELENGTH, "X2Go Agent"); } diff --git a/nx-X11/programs/Xserver/hw/nxagent/Init.h b/nx-X11/programs/Xserver/hw/nxagent/Init.h index 1b87f2296..f62193358 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Init.h +++ b/nx-X11/programs/Xserver/hw/nxagent/Init.h @@ -46,7 +46,7 @@ extern int nxagentBackingStore; extern int nxagentSaveUnder; #ifdef X2GO -extern int nxagentX2go; +extern Bool nxagentX2go; void checkX2goAgent(void); #endif diff --git a/nx-X11/programs/Xserver/hw/nxagent/Keystroke.c b/nx-X11/programs/Xserver/hw/nxagent/Keystroke.c index 828649e5a..5196e28b7 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Keystroke.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Keystroke.c @@ -35,7 +35,7 @@ #include "Options.h" #include "Keyboard.h" #include "Drawable.h" -#include "Init.h" /* extern int nxagentX2go */ +#include "Init.h" /* extern Bool nxagentX2go */ #include "Utils.h" #include diff --git a/nx-X11/programs/Xserver/hw/nxagent/Screen.c b/nx-X11/programs/Xserver/hw/nxagent/Screen.c index 1cc4e5448..31b8b68a3 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Screen.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Screen.c @@ -1830,7 +1830,7 @@ N/A XClassHint hint; #ifdef X2GO - if(nxagentX2go) + if (nxagentX2go) { hint.res_name = strdup("X2GoAgent"); hint.res_class = strdup("X2GoAgent"); diff --git a/nx-X11/programs/Xserver/hw/nxagent/Splash.c b/nx-X11/programs/Xserver/hw/nxagent/Splash.c index 898868925..d28a96df1 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Splash.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Splash.c @@ -74,7 +74,7 @@ void nxagentShowSplashWindow(XlibWindow parentWindow) /* * Show splash window only when running as X2Go Agent */ - if(!nxagentX2go) + if (!nxagentX2go) return; #ifdef TEST -- cgit v1.2.3 From 18a8a3610a4fff04aa77b360bb23cd4f308972f5 Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Tue, 30 Mar 2021 00:15:20 +0200 Subject: nxagent: fix some variable types in Init --- nx-X11/programs/Xserver/hw/nxagent/Init.c | 2 +- nx-X11/programs/Xserver/hw/nxagent/Init.h | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) (limited to 'nx-X11') diff --git a/nx-X11/programs/Xserver/hw/nxagent/Init.c b/nx-X11/programs/Xserver/hw/nxagent/Init.c index b120e685e..8a9964154 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Init.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Init.c @@ -156,7 +156,7 @@ FIXME: These, if not removed, should at least be moved to Display.h and Display.c. */ int nxagentBackingStore; -int nxagentSaveUnder; +Bool nxagentSaveUnder; /* * This is true at startup and set to the value of diff --git a/nx-X11/programs/Xserver/hw/nxagent/Init.h b/nx-X11/programs/Xserver/hw/nxagent/Init.h index f62193358..ec0bb3483 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Init.h +++ b/nx-X11/programs/Xserver/hw/nxagent/Init.h @@ -40,10 +40,10 @@ is" without express or implied warranty. #ifndef __Init_H__ #define __Init_H__ -extern int nxagentDoFullGeneration; +extern Bool nxagentDoFullGeneration; extern int nxagentBackingStore; -extern int nxagentSaveUnder; +extern Bool nxagentSaveUnder; #ifdef X2GO extern Bool nxagentX2go; -- cgit v1.2.3 From 9f1d0a807fd4da80e366d439b945e924bd2cfe95 Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Tue, 30 Mar 2021 00:20:26 +0200 Subject: Trap.h: fix type of traps They are Booleans for some time now but this change was missing in Trap.h --- nx-X11/programs/Xserver/hw/nxagent/Trap.h | 28 +++++++++++++++------------- 1 file changed, 15 insertions(+), 13 deletions(-) (limited to 'nx-X11') diff --git a/nx-X11/programs/Xserver/hw/nxagent/Trap.h b/nx-X11/programs/Xserver/hw/nxagent/Trap.h index 4203d2b13..1c10f00ea 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Trap.h +++ b/nx-X11/programs/Xserver/hw/nxagent/Trap.h @@ -26,6 +26,8 @@ #ifndef __Traps_H__ #define __Traps_H__ +#include + #ifndef False #define False 0 #endif @@ -38,72 +40,72 @@ * Set if we are dispatching a render extension request. Used to avoid * reentrancy in GC operations. */ -extern int nxagentGCTrap; +extern Bool nxagentGCTrap; /* * Set if we are enqueing an internal operation, CreateWindow and * Reparent- Window. Used to remove any screen operation. */ -extern int nxagentScreenTrap; +extern Bool nxagentScreenTrap; /* * Set if we are executing a GC operation only on the X side. Used to * avoid reentrancy in FB layer. */ -extern int nxagentFBTrap; +extern Bool nxagentFBTrap; /* * Set if we are dispatching a shared memory extension request. */ -extern int nxagentShmTrap; +extern Bool nxagentShmTrap; /* * Set if a shared pixmap operation is requested by the client. */ -extern int nxagentShmPixmapTrap; +extern Bool nxagentShmPixmapTrap; /* * Set if we are dispatching a XVideo extension request. */ -extern int nxagentXvTrap; +extern Bool nxagentXvTrap; /* * Set if we are dispatching a GLX extension request. */ -extern int nxagentGlxTrap; +extern Bool nxagentGlxTrap; /* * Set while we are resuming the session. */ -extern int nxagentReconnectTrap; +extern Bool nxagentReconnectTrap; /* * Set if we need to realize a drawable by using a lossless encoding. */ -extern int nxagentLosslessTrap; +extern Bool nxagentLosslessTrap; /* * Set to force the synchronization of a drawable. */ -extern int nxagentSplitTrap; +extern Bool nxagentSplitTrap; /* * Set to avoid CapsLock synchronization problems when CapsLock is the * first key to be pressed in the session. */ -extern int nxagentXkbCapsTrap; +extern Bool nxagentXkbCapsTrap; /* * Set to avoid NumLock synchronization problems when NumLock is the * first key to be pressed in the session. */ -extern int nxagentXkbNumTrap; +extern Bool nxagentXkbNumTrap; /* * Set to indicate we are processing a clipboard event triggered by * the real X server. This is used to avoid endless loops if callbacks * would trigger another event by the real X server */ -extern int nxagentExternalClipboardEventTrap; +extern Bool nxagentExternalClipboardEventTrap; #endif /* __Trap_H__ */ -- cgit v1.2.3 From fcc1b57fb980b821138301a9585b91d10bfd0901 Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Sat, 1 May 2021 19:53:17 +0200 Subject: nxagent: add missing command line switches to usage text --- nx-X11/programs/Xserver/hw/nxagent/Args.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'nx-X11') diff --git a/nx-X11/programs/Xserver/hw/nxagent/Args.c b/nx-X11/programs/Xserver/hw/nxagent/Args.c index b1c0231f1..be13efacd 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Args.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Args.c @@ -2112,6 +2112,9 @@ void ddxUseMsg(void) ErrorF("-autodpi detect real server's DPI and use that in the session\n"); ErrorF("-display string display name of the real server\n"); ErrorF("-sync synchronize with the real server\n"); + ErrorF("-nxrealwindowprop set property NX_REAL_WINDOW for each X11 window inside nxagent\n"); + ErrorF("-reportwids report externally exposed X11 window IDs to the session log\n"); + ErrorF("-reportprivatewids report internal X11 window ID to the session log\n"); #ifdef RENDER ErrorF("-norender disable the use of the render extension\n"); ErrorF("-nocomposite disable the use of the composite extension (default)\n"); @@ -2129,6 +2132,7 @@ void ddxUseMsg(void) ErrorF("-irlimit maximum image data rate to the encoder input in kB/s.\n"); ErrorF("-tile WxH maximum size of image tiles (minimum allowed: 32x32)\n"); ErrorF("-keystrokefile file file with keyboard shortcut definitions\n"); + ErrorF("-options file|string path to an options file or an option string (for testing/debugging)\n"); ErrorF("-verbose print more warning and error messages\n"); ErrorF("-D enable desktop mode\n"); ErrorF("-R enable rootless mode\n"); -- cgit v1.2.3