From f326d0461b17ea434f87bafde56e3dbcc78b8c54 Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Thu, 28 Mar 2024 10:41:07 +0100 Subject: [PATCH 01/89] Screen.c: fix missing ; --- nx-X11/programs/Xserver/hw/nxagent/Screen.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nx-X11/programs/Xserver/hw/nxagent/Screen.c b/nx-X11/programs/Xserver/hw/nxagent/Screen.c index 76430fbd10..b78bff37f8 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Screen.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Screen.c @@ -121,7 +121,7 @@ is" without express or implied warranty. void nxagentShowPixmap(PixmapPtr pPixmap, int x, int y, int width, int height); void nxagentFbRestoreArea(PixmapPtr pPixmap, WindowPtr pWin, int xSrc, int ySrc, int width, - int height, int xDst, int yDst) + int height, int xDst, int yDst); #endif #ifdef WATCH From 1cef3ac4f8dfe44cc23e87b59b2b9f9b73db5cbf Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Thu, 28 Mar 2024 10:43:25 +0100 Subject: [PATCH 02/89] Pixmap.c: fix fprintf call Due to the , the second line was taken as the first argument leading to weird output. --- nx-X11/programs/Xserver/hw/nxagent/Pixmap.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nx-X11/programs/Xserver/hw/nxagent/Pixmap.c b/nx-X11/programs/Xserver/hw/nxagent/Pixmap.c index 1bf3fbbc03..5f22640b6f 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Pixmap.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Pixmap.c @@ -244,7 +244,7 @@ PixmapPtr nxagentCreatePixmap(ScreenPtr pScreen, int width, int height, } #ifdef TEST - fprintf(stderr, "nxagentCreatePixmap: Allocated memory for the Virtual %sPixmap %p of real Pixmap %p (%dx%d),", + fprintf(stderr, "nxagentCreatePixmap: Allocated memory for the Virtual %sPixmap %p of real Pixmap %p (%dx%d)," "allocation hint [%d].\n", nxagentShmPixmapTrap ? "Shm " : "", (void *) pVirtual, (void *) pPixmap, width, height, usage_hint); #endif From 39f67db3848d7f856277948f9165f586b62ac589 Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Wed, 27 Mar 2024 22:41:10 +0100 Subject: [PATCH 03/89] Drawable.c: fix build errors with TEST enabled --- nx-X11/programs/Xserver/hw/nxagent/Drawable.c | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/nx-X11/programs/Xserver/hw/nxagent/Drawable.c b/nx-X11/programs/Xserver/hw/nxagent/Drawable.c index 121d549533..6f8ac64a6b 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Drawable.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Drawable.c @@ -282,6 +282,13 @@ int nxagentSynchronizeDrawableData(DrawablePtr pDrawable, unsigned int breakMask static int totalLength; static int totalReconnectedPixmaps; + int width = pDrawable -> width; + int height = pDrawable -> height; + int depth = pDrawable -> depth; + + unsigned int format = (depth == 1) ? XYPixmap : ZPixmap; + int length = nxagentImageLength(width, height, format, 0, depth); + totalLength += length; totalReconnectedPixmaps++; @@ -1531,11 +1538,11 @@ void nxagentMarkCorruptedRegion(DrawablePtr pDrawable, RegionPtr pRegion) { #ifdef TEST - x = pRegion -> extents.x1; - y = pRegion -> extents.y1; + int x = pRegion -> extents.x1; + int y = pRegion -> extents.y1; - width = pRegion -> extents.x2 - pRegion -> extents.x1; - height = pRegion -> extents.y2 - pRegion -> extents.y1; + int width = pRegion -> extents.x2 - pRegion -> extents.x1; + int height = pRegion -> extents.y2 - pRegion -> extents.y1; fprintf(stderr, "nxagentMarkCorruptedRegion: Partly invalidating %s [%p] with " "coordinates [%d,%d][%d,%d].\n", nxagentDrawableType(pDrawable), From 5fb545f58b9abbdfb5b17d6eaea78ad0dfeb7983 Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Thu, 28 Mar 2024 10:47:04 +0100 Subject: [PATCH 04/89] Events.c: explain define --- nx-X11/programs/Xserver/hw/nxagent/NXevents.c | 1 + 1 file changed, 1 insertion(+) diff --git a/nx-X11/programs/Xserver/hw/nxagent/NXevents.c b/nx-X11/programs/Xserver/hw/nxagent/NXevents.c index 9d3045dc77..aca46e10aa 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/NXevents.c +++ b/nx-X11/programs/Xserver/hw/nxagent/NXevents.c @@ -135,6 +135,7 @@ of the copyright holder. #include +/* define this to inform dix about having a own implementation of GetXYStartWindow() */ #define XYWINDOWCALLBACK #include "../../dix/events.c" From ade8d6123c27866525fc7f7d4327e10af0d2d01a Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Mon, 25 Mar 2024 22:47:17 +0100 Subject: [PATCH 05/89] os/Imakefile: only compile rpcauth if we have libtirpc glibc no longer has rpc included, so we can only compile when tirpc is available --- nx-X11/programs/Xserver/os/Imakefile | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/nx-X11/programs/Xserver/os/Imakefile b/nx-X11/programs/Xserver/os/Imakefile index 421f3a85a3..69764a7d87 100644 --- a/nx-X11/programs/Xserver/os/Imakefile +++ b/nx-X11/programs/Xserver/os/Imakefile @@ -75,21 +75,18 @@ XDMAUTHOBJS = XDMAUTHSCRS = #endif -TIRPC_INCLUDES = - #if HasSecureRPC +#if UseTIRPC RPCDEFS = -DSECURE_RPC RPCOBJS = rpcauth.o RPCSRCS = rpcauth.c - -#if UseTIRPC TIRPC_INCLUDES = $$(pkg-config --cflags-only-I 'libtirpc') -#endif - #else RPCDEFS = RPCOBJS = RPCSRCS = +TIRPC_INCLUDES = +#endif #endif #if HasBSD44Sockets From 6785c933e83b1881b15e41115740a6cc066f4512 Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Thu, 28 Mar 2024 21:32:36 +0100 Subject: [PATCH 06/89] Screen.c, Pixmap.c: silence some compiler warnings --- nx-X11/programs/Xserver/hw/nxagent/Pixmap.c | 6 +++--- nx-X11/programs/Xserver/hw/nxagent/Screen.c | 5 +++-- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/nx-X11/programs/Xserver/hw/nxagent/Pixmap.c b/nx-X11/programs/Xserver/hw/nxagent/Pixmap.c index 5f22640b6f..f7be2207de 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Pixmap.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Pixmap.c @@ -611,7 +611,7 @@ int nxagentDestroyNewPixmapResourceType(void * p, XID id) */ #ifdef TEST - fprintf(stderr, "nxagentDestroyNewPixmapResourceType: Destroying mirror id [%ld] for pixmap at [%p].\n", + fprintf(stderr, "nxagentDestroyNewPixmapResourceType: Destroying mirror id [%u] for pixmap at [%p].\n", nxagentPixmapPriv((PixmapPtr) p) -> mid, (void *) p); #endif @@ -630,7 +630,7 @@ void nxagentDisconnectPixmap(void *p0, XID x1, void *p2) fprintf(stderr, "nxagentDisconnectPixmap: Called with bool [%d] and pixmap at [%p].\n", *pBool, (void *) pPixmap); - fprintf(stderr, "nxagentDisconnectPixmap: Virtual pixmap is [%ld].\n", + fprintf(stderr, "nxagentDisconnectPixmap: Virtual pixmap is [%u].\n", nxagentPixmap(pPixmap)); #endif @@ -757,7 +757,7 @@ void nxagentReconnectPixmap(void *p0, XID x1, void *p2) nxagentPixmap(pPixmapPriv -> pVirtualPixmap) = pPixmapPriv -> id; #ifdef TEST - fprintf(stderr, "nxagentReconnectPixmap: Created virtual pixmap with id [%ld] for pixmap at [%p].\n", + fprintf(stderr, "nxagentReconnectPixmap: Created virtual pixmap with id [%u] for pixmap at [%p].\n", nxagentPixmap(pPixmap), (void *) pPixmap); #endif diff --git a/nx-X11/programs/Xserver/hw/nxagent/Screen.c b/nx-X11/programs/Xserver/hw/nxagent/Screen.c index b78bff37f8..2d4afda14e 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Screen.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Screen.c @@ -303,7 +303,8 @@ Bool nxagentIsParentOf(Display *d, XlibWindow possible_parent, XlibWindow candid SAFE_XFree(children); #ifdef TEST - fprintf(stderr, "%s: parent of full screen window [%p] root [%p] possible_parent [%p] candidate [%p]\n", __func__, parent, root, possible_parent, candidate); + fprintf(stderr, "%s: parent of full screen window [%p] root [%p] possible_parent [%p] candidate [%p]\n", + __func__, (void *)parent, (void *)root, (void *)possible_parent, (void *)candidate); #endif return (parent == possible_parent); } @@ -3825,7 +3826,7 @@ void nxagentDropOutput(RROutputPtr o) if (c->outputs[i] == o) { #ifdef DEBUG - fprintf(stderr, "%s: output [%s] is in use by crtc [%p], removing it from there\n", __func__, o->name, c); + fprintf(stderr, "%s: output [%s] is in use by crtc [%p], removing it from there\n", __func__, o->name, (void *)c); #endif RRCrtcSet(c, NULL, 0, 0, RR_Rotate_0, 0, NULL); } From 77477916ec895495a96ddfae0392d936710441da Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Thu, 28 Mar 2024 22:03:53 +0100 Subject: [PATCH 07/89] Pixmap.c: add missing [] to TEST output --- nx-X11/programs/Xserver/hw/nxagent/Pixmap.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nx-X11/programs/Xserver/hw/nxagent/Pixmap.c b/nx-X11/programs/Xserver/hw/nxagent/Pixmap.c index f7be2207de..153b75f8f5 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Pixmap.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Pixmap.c @@ -244,7 +244,7 @@ PixmapPtr nxagentCreatePixmap(ScreenPtr pScreen, int width, int height, } #ifdef TEST - fprintf(stderr, "nxagentCreatePixmap: Allocated memory for the Virtual %sPixmap %p of real Pixmap %p (%dx%d)," + fprintf(stderr, "nxagentCreatePixmap: Allocated memory for the Virtual %sPixmap [%p] of real Pixmap [%p] (%dx%d)," "allocation hint [%d].\n", nxagentShmPixmapTrap ? "Shm " : "", (void *) pVirtual, (void *) pPixmap, width, height, usage_hint); #endif From c2682cf299aef5f79cf53f7d905459aa371769af Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Mon, 1 Apr 2024 19:36:14 +0200 Subject: [PATCH 08/89] NXevents.c: add/improve comments --- nx-X11/programs/Xserver/hw/nxagent/NXevents.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/nx-X11/programs/Xserver/hw/nxagent/NXevents.c b/nx-X11/programs/Xserver/hw/nxagent/NXevents.c index aca46e10aa..68fb3f4120 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/NXevents.c +++ b/nx-X11/programs/Xserver/hw/nxagent/NXevents.c @@ -278,12 +278,13 @@ ProcAllowEvents(register ClientPtr client) /* * called from XYToWindow to determine where XYToWindow() should start * going through the list. + * XYWINDOWCALLBACK needs to be defined for this to work, see dix/events.c. + * It is called from XYtoWindow(). */ static WindowPtr GetXYStartWindow(WindowPtr pWin) { - if (nxagentOption(Rootless)) { /* @@ -349,10 +350,10 @@ CheckMotion(xEvent *xE) #ifdef NXAGENT_SERVER /* - * This code force cursor position to be inside the - * root window of the agent. We can't view a reason - * to do this and it interacts in an undesirable way - * with toggling fullscreen. + * This code forces the cursor position to be inside the root + * window of the agent. We can't view a reason to do this and + * it interacts in an undesirable way with toggling + * fullscreen. * * if ((sprite.hotPhys.x != XE_KBPTR.rootX) || * (sprite.hotPhys.y != XE_KBPTR.rootY)) From 66643feffe47b07a2daef780b3dd4c4a6ba61d01 Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Mon, 1 Apr 2024 20:27:29 +0200 Subject: [PATCH 09/89] NXProperty.c: fix indentations, format comments --- .../programs/Xserver/hw/nxagent/NXproperty.c | 41 +++++++++++-------- 1 file changed, 23 insertions(+), 18 deletions(-) diff --git a/nx-X11/programs/Xserver/hw/nxagent/NXproperty.c b/nx-X11/programs/Xserver/hw/nxagent/NXproperty.c index 4e61f26f0b..8c18047fd7 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/NXproperty.c +++ b/nx-X11/programs/Xserver/hw/nxagent/NXproperty.c @@ -169,19 +169,20 @@ ProcChangeProperty(ClientPtr client) #ifdef NXAGENT_ARTSD { - /* Do not process MCOPGLOBALS property changes, - they are already set reflecting the server side settings. - Just return success. - */ - if (stuff->property == mcop_local_atom) - return client->noClientException; + /* + * Do not process MCOPGLOBALS property changes, + * they are already set reflecting the server side settings. + * Just return success. + */ + if (stuff->property == mcop_local_atom) + return client->noClientException; } #endif #ifdef NXAGENT_SERVER /* prevent clients from changing the NX_AGENT_VERSION property */ if (stuff->property == MakeAtom("NX_AGENT_VERSION", strlen("NX_AGENT_VERSION"), True)) - return client->noClientException; + return client->noClientException; #endif err = ChangeWindowProperty(pWin, stuff->property, stuff->type, (int)format, @@ -189,23 +190,27 @@ ProcChangeProperty(ClientPtr client) if (err != Success) return err; else +#ifdef NXAGENT_SERVER { - if (nxagentOption(Rootless)) - { - nxagentExportProperty(pWin, stuff->property, stuff->type, (int) format, - (int) mode, len, (void *) &stuff[1]); - } + if (nxagentOption(Rootless)) + { + nxagentExportProperty(pWin, stuff->property, stuff->type, (int) format, + (int) mode, len, (void *) &stuff[1]); + } - nxagentGuessClientHint(client, stuff->property, (char *) &stuff[1]); + nxagentGuessClientHint(client, stuff->property, (char *) &stuff[1]); - nxagentGuessShadowHint(client, stuff->property); + nxagentGuessShadowHint(client, stuff->property); - #ifdef NX_DEBUG_INPUT - nxagentGuessDumpInputInfo(client, stuff->property, (char *) &stuff[1]); - #endif + #ifdef NX_DEBUG_INPUT + nxagentGuessDumpInputInfo(client, stuff->property, (char *) &stuff[1]); + #endif - return client->noClientException; + return client->noClientException; } +#else + return client->noClientException; +#endif } /***************** From aac78fd51f2f3929cddf3dc98f30c10d2b4f1f6a Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Sun, 7 Apr 2024 18:28:56 +0200 Subject: [PATCH 10/89] hw/nxagent/NXglxext.c: fix missing opcode variable in TEST mode also add soem whitespace fix --- nx-X11/programs/Xserver/hw/nxagent/NXglxext.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/nx-X11/programs/Xserver/hw/nxagent/NXglxext.c b/nx-X11/programs/Xserver/hw/nxagent/NXglxext.c index 199b4f53b4..c632c8a6dd 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/NXglxext.c +++ b/nx-X11/programs/Xserver/hw/nxagent/NXglxext.c @@ -57,6 +57,11 @@ */ static int __glXDispatch(ClientPtr client) { +#ifdef TEST + REQUEST(xGLXSingleReq); + CARD8 opcode = stuff->glxCode; +#endif + int retval; /* @@ -70,7 +75,7 @@ static int __glXDispatch(ClientPtr client) fprintf(stderr, "__glXDispatch: Going to dispatch GLX operation [%d] for client [%d].\n", opcode, client -> index); #endif - + retval = xorg__glXDispatch(client); nxagentGlxTrap = False; From a3e11cc22091198d618561e1396653d67fed210c Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Sun, 7 Apr 2024 21:34:48 +0200 Subject: [PATCH 11/89] Imake: drop BuildModuleInSubdir Set to No and Only checked by GL --- nx-X11/config/cf/xorg.cf | 9 --------- nx-X11/programs/Xserver/GL/Imakefile | 6 ------ 2 files changed, 15 deletions(-) diff --git a/nx-X11/config/cf/xorg.cf b/nx-X11/config/cf/xorg.cf index c0b753a885..e2207b68e5 100644 --- a/nx-X11/config/cf/xorg.cf +++ b/nx-X11/config/cf/xorg.cf @@ -198,15 +198,6 @@ NX_VERSION_CURRENT_STRING = nxVersionString #define BuildXKBlib YES #endif -/* - * When this is set, modules are always built separately from the libraries - * that statically link into an Xserver. This is for platforms where the - * module and native object formats are different (e.g., OS/2). - */ -#ifndef BuildModuleInSubdir -#define BuildModuleInSubdir NO -#endif - /* * Default settings for which X Servers to build. */ diff --git a/nx-X11/programs/Xserver/GL/Imakefile b/nx-X11/programs/Xserver/GL/Imakefile index 47dbf795cc..8e16b39986 100644 --- a/nx-X11/programs/Xserver/GL/Imakefile +++ b/nx-X11/programs/Xserver/GL/Imakefile @@ -7,14 +7,8 @@ SUBDIRS = glx $(CORE_SUBDIR) - -#if BuildModuleInSubdir -SRCS = glx/module/?*.c $(MSRCS) -OBJS = glx/module/?*.o $(MOBJS) -#else SRCS = glx/?*.c $(MSRCS) OBJS = glx/?*.o $(MOBJS) -#endif DONES = glx/DONE From 1df44b7c8826b597a2eedbfd5eb209687c9ee56b Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Tue, 9 Apr 2024 22:18:36 +0200 Subject: [PATCH 12/89] NXglyphcurs.c: add missing TEST/DEBUG defines --- nx-X11/programs/Xserver/hw/nxagent/NXglyphcurs.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/nx-X11/programs/Xserver/hw/nxagent/NXglyphcurs.c b/nx-X11/programs/Xserver/hw/nxagent/NXglyphcurs.c index a290b1b7ef..012dec7586 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/NXglyphcurs.c +++ b/nx-X11/programs/Xserver/hw/nxagent/NXglyphcurs.c @@ -80,6 +80,13 @@ SOFTWARE. #define True 1 #endif +/* + * Set here the required log level. + */ + +#undef TEST +#undef DEBUG + /* get the bits out of the font in a portable way. to avoid dealing with padding and such-like, we draw the glyph into From ac45ae3bfec21cc28ea15b34bb6c524c9919b2f4 Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Tue, 9 Apr 2024 22:19:21 +0200 Subject: [PATCH 13/89] NXglyphcurs.c: remove register keywords --- nx-X11/programs/Xserver/hw/nxagent/NXglyphcurs.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/nx-X11/programs/Xserver/hw/nxagent/NXglyphcurs.c b/nx-X11/programs/Xserver/hw/nxagent/NXglyphcurs.c index 012dec7586..0905b89fce 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/NXglyphcurs.c +++ b/nx-X11/programs/Xserver/hw/nxagent/NXglyphcurs.c @@ -99,10 +99,10 @@ cursor metrics. */ int -ServerBitsFromGlyph(FontPtr pfont, unsigned ch, register CursorMetricPtr cm, unsigned char **ppbits) +ServerBitsFromGlyph(FontPtr pfont, unsigned ch, CursorMetricPtr cm, unsigned char **ppbits) { - register ScreenPtr pScreen; - register GCPtr pGC; + ScreenPtr pScreen; + GCPtr pGC; xRectangle rect; PixmapPtr ppix; long nby; From 9df98ab60498dd7d361abb9b534acf9fb1f3ce44 Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Tue, 9 Apr 2024 22:19:50 +0200 Subject: [PATCH 14/89] NXglyphcurs.c: mark NX changes --- .../programs/Xserver/hw/nxagent/NXglyphcurs.c | 25 +++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/nx-X11/programs/Xserver/hw/nxagent/NXglyphcurs.c b/nx-X11/programs/Xserver/hw/nxagent/NXglyphcurs.c index 0905b89fce..17344937c5 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/NXglyphcurs.c +++ b/nx-X11/programs/Xserver/hw/nxagent/NXglyphcurs.c @@ -122,14 +122,24 @@ ServerBitsFromGlyph(FontPtr pfont, unsigned ch, CursorMetricPtr cm, unsigned cha /* zeroing the (pad) bits seems to help some ddx cursor handling */ bzero(pbits, nby); +#ifndef NXAGENT_SERVER + ppix = (PixmapPtr)(*pScreen->CreatePixmap)(pScreen, cm->width, + cm->height, 1, + CREATE_PIXMAP_USAGE_SCRATCH); +#else ppix = fbCreatePixmap(pScreen, cm->width, cm->height, 1, CREATE_PIXMAP_USAGE_SCRATCH); +#endif pGC = GetScratchGC(1, pScreen); if (!ppix || !pGC) { if (ppix) +#ifndef NXAGENT_SERVER + (*pScreen->DestroyPixmap)(ppix); +#else fbDestroyPixmap(ppix); +#endif if (pGC) FreeScratchGC(pGC); free(pbits); @@ -159,19 +169,34 @@ ServerBitsFromGlyph(FontPtr pfont, unsigned ch, CursorMetricPtr cm, unsigned cha dixChangeGC(NullClient, pGC, GCFunction | GCForeground | GCFont, NULL, gcval); ValidateGC((DrawablePtr)ppix, pGC); +#ifndef NXAGENT_SERVER + (*pGC->ops->PolyFillRect)((DrawablePtr)ppix, pGC, 1, &rect); +#else fbPolyFillRect((DrawablePtr)ppix, pGC, 1, &rect); +#endif /* draw the glyph */ gcval[0].val = 1; dixChangeGC(NullClient, pGC, GCForeground, NULL, gcval); ValidateGC((DrawablePtr)ppix, pGC); +#ifndef NXAGENT_SERVER + (*pGC->ops->PolyText16)((DrawablePtr)ppix, pGC, cm->xhot, cm->yhot, + 1, (unsigned short *)char2b); + (*pScreen->GetImage)((DrawablePtr)ppix, 0, 0, cm->width, cm->height, + XYPixmap, 1, pbits); +#else miPolyText16((DrawablePtr)ppix, pGC, (int)cm->xhot, (int)cm->yhot, (int)1, (unsigned short*)char2b); fbGetImage((DrawablePtr)ppix, 0, 0, cm->width, cm->height, XYPixmap, 1, pbits); +#endif *ppbits = (unsigned char *)pbits; FreeScratchGC(pGC); +#ifndef NXAGENT_SERVER + (*pScreen->DestroyPixmap)(ppix); +#else fbDestroyPixmap(ppix); +#endif #ifdef TEST fprintf(stderr, "ServerBitsFromGlyph: Destroyed virtual pixmap at [%p].\n", From d1754f8067afdf11216c236fdb9a7f1464345065 Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Sun, 14 Apr 2024 16:48:05 +0200 Subject: [PATCH 15/89] Window.c: improve some TEST/DEBUG output add [] around values where they were missing --- nx-X11/programs/Xserver/hw/nxagent/Window.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/nx-X11/programs/Xserver/hw/nxagent/Window.c b/nx-X11/programs/Xserver/hw/nxagent/Window.c index e23c8392a4..e86d85f867 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Window.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Window.c @@ -3164,8 +3164,8 @@ static void nxagentReconfigureWindowCursor(void * param0, XID param1, void * dat } #ifdef DEBUG - fprintf(stderr, "nxagentReconfigureWindowCursor: %p - ID %lx geometry (%d,%d,%d,%d) " - "cursor %p - ID %lx\n", + fprintf(stderr, "nxagentReconfigureWindowCursor: [%p] - ID [%lx] geometry [%d,%d,%d,%d] " + "cursor [%p] - ID [%lx]\n", pWin, nxagentWindow(pWin), pWin -> drawable.x, pWin -> drawable.y, @@ -3177,7 +3177,7 @@ static void nxagentReconfigureWindowCursor(void * param0, XID param1, void * dat if (nxagentCursor(pCursor, pScreen) == None) { #ifdef NXAGENT_RECONNECT_WINDOW_DEBUG - fprintf(stderr, "nxagentReconfigureWindowCursor: reconnecting valid cursor %lx\n", + fprintf(stderr, "nxagentReconfigureWindowCursor: reconnecting valid cursor [%p]\n", (void*)pCursor); #endif @@ -3207,7 +3207,7 @@ static void nxagentReconfigureWindow(void * param0, XID param1, void * data_buff unsigned long mask = 0; #ifdef DEBUG - fprintf(stderr, "nxagentReconfigureWindow: pWin %p - ID %lx\n", pWin, nxagentWindow(pWin)); + fprintf(stderr, "nxagentReconfigureWindow: pWin [%p] - ID [%lx]\n", pWin, nxagentWindow(pWin)); #endif if (pWin -> drawable.class == InputOnly) @@ -3304,7 +3304,7 @@ Bool nxagentCheckWindowIntegrity(WindowPtr pWin) char *data = calloc(1, length); if (data == NULL) { - FatalError("nxagentCheckWindowIntegrity: Failed to allocate a buffer of size %d.\n", length); + FatalError("nxagentCheckWindowIntegrity: Failed to allocate a buffer of size [%d].\n", length); } unsigned long plane_mask = AllPlanes; @@ -3339,9 +3339,9 @@ Bool nxagentCheckWindowIntegrity(WindowPtr pWin) #endif #ifdef WARNING - fprintf(stderr, "nxagentCheckWindowIntegrity: Window %p width %d, height %d, has been realized " + fprintf(stderr, "nxagentCheckWindowIntegrity: Window [%p] geometry [%d,%d], has been realized " "but the data buffer still differs.\n", (void*) pWin, width, height); - fprintf(stderr, "nxagentCheckWindowIntegrity: bytes_per_line = %d byte pad %d format %d.\n", + fprintf(stderr, "nxagentCheckWindowIntegrity: bytes_per_line = [%d] byte pad [%d] format [%d].\n", image -> bytes_per_line, nxagentImagePad(width, height, 0, depth), image->format); fprintf(stderr, "nxagentCheckWindowIntegrity: image is corrupted!!\n"); @@ -3350,7 +3350,7 @@ Bool nxagentCheckWindowIntegrity(WindowPtr pWin) else { #ifdef WARNING - fprintf(stderr, "nxagentCheckWindowIntegrity: Window %p has been realized " + fprintf(stderr, "nxagentCheckWindowIntegrity: Window [%p] has been realized " "now remote and framebuffer data are synchronized.\n", (void*) pWin); #endif } @@ -3365,7 +3365,7 @@ Bool nxagentCheckWindowIntegrity(WindowPtr pWin) else { #ifdef WARNING - fprintf(stderr, "nxagentCheckWindowIntegrity: ignored window %p with geometry (%d,%d).\n", + fprintf(stderr, "nxagentCheckWindowIntegrity: ignored window [%p] with geometry [%d,%d].\n", (void*) pWin, width, height); #endif } From dd4f18f09b3424bee319461ad4ff61c4d7a31bd4 Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Sun, 14 Apr 2024 17:38:06 +0200 Subject: [PATCH 16/89] Window.c: add debug output --- nx-X11/programs/Xserver/hw/nxagent/Window.c | 28 +++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/nx-X11/programs/Xserver/hw/nxagent/Window.c b/nx-X11/programs/Xserver/hw/nxagent/Window.c index e86d85f867..c18ebde97b 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Window.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Window.c @@ -1863,6 +1863,10 @@ void nxagentSetWMState(WindowPtr pWin, CARD32 desired) -+ */ Bool nxagentRealizeWindow(WindowPtr pWin) { + #ifdef DEBUG + fprintf(stderr, "%s: running for window [0x%x]....\n", __func__, pWin->drawable.id); + #endif + if (nxagentScreenTrap) { return True; @@ -1910,6 +1914,10 @@ Bool nxagentRealizeWindow(WindowPtr pWin) /* See nxagentRealizeWindow for a description */ Bool nxagentUnrealizeWindow(WindowPtr pWin) { + #ifdef DEBUG + fprintf(stderr, "%s: running for window [0x%x]....\n", __func__, pWin->drawable.id); + #endif + if (nxagentScreenTrap) { return True; @@ -1932,6 +1940,10 @@ Bool nxagentUnrealizeWindow(WindowPtr pWin) void nxagentFrameBufferPaintWindow(WindowPtr pWin, RegionPtr pRegion, int what) { + #ifdef DEBUG + fprintf(stderr, "%s: running for window [0x%x]....\n", __func__, pWin->drawable.id); + #endif + if (pWin->backgroundState == BackgroundPixmap) { pWin->background.pixmap = nxagentVirtualPixmap(pWin->background.pixmap); @@ -1972,6 +1984,10 @@ void nxagentFrameBufferPaintWindow(WindowPtr pWin, RegionPtr pRegion, int what) void nxagentPaintWindowBackground(WindowPtr pWin, RegionPtr pRegion, int what) { + #ifdef DEBUG + fprintf(stderr, "%s: running for window [0x%x]....\n", __func__, pWin->drawable.id); + #endif + if (pWin -> realized) { BoxPtr pBox = RegionRects(pRegion); @@ -2008,6 +2024,10 @@ void nxagentPaintWindowBackground(WindowPtr pWin, RegionPtr pRegion, int what) void nxagentPaintWindowBorder(WindowPtr pWin, RegionPtr pRegion, int what) { + #ifdef DEBUG + fprintf(stderr, "%s: running for window [0x%x]....\n", __func__, pWin->drawable.id); + #endif + /* * The framebuffer operations don't take care of clipping to the * actual area of the framebuffer so we need to clip ourselves. @@ -2048,6 +2068,10 @@ void nxagentPaintWindowBorder(WindowPtr pWin, RegionPtr pRegion, int what) */ void nxagentCopyWindow(WindowPtr pWin, xPoint oldOrigin, RegionPtr oldRegion) { + #ifdef DEBUG + fprintf(stderr, "%s: running for window [0x%x]....\n", __func__, pWin->drawable.id); + #endif + fbCopyWindow(pWin, oldOrigin, oldRegion); } @@ -2092,6 +2116,10 @@ void nxagentClipNotify(WindowPtr pWin, int dx, int dy) */ void nxagentWindowExposures(WindowPtr pWin, RegionPtr pRgn, RegionPtr other_exposed) { + #ifdef DEBUG + fprintf(stderr, "%s: running for window [0x%x]....\n", __func__, pWin->drawable.id); + #endif + /* * The problem: we want to synthetize the expose events internally, so * that we reduce the time between a window operation and the corresp- From 191450ad57a746fb10491d780d814be8f01ecf44 Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Sun, 14 Apr 2024 22:03:41 +0200 Subject: [PATCH 17/89] NXshm.c: remove unused extern --- nx-X11/programs/Xserver/hw/nxagent/NXshm.c | 4 ---- 1 file changed, 4 deletions(-) diff --git a/nx-X11/programs/Xserver/hw/nxagent/NXshm.c b/nx-X11/programs/Xserver/hw/nxagent/NXshm.c index 4841c3e7c9..f442148858 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/NXshm.c +++ b/nx-X11/programs/Xserver/hw/nxagent/NXshm.c @@ -75,10 +75,6 @@ in this Software without prior written authorization from The Open Group. extern void fbGetImage(DrawablePtr pDrw, int x, int y, int w, int h, unsigned int format, unsigned long planeMask, char *d); -extern void fbPutImage (DrawablePtr pDrawable, GCPtr pGC, int depth, - int x, int y, int w, int h, int leftPad, int format, - char *pImage); - extern int nxagentImageLength(int, int, int, int, int); void From 911108fdca95918f2bee5dc87fa060c9a40ed64f Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Tue, 16 Apr 2024 21:58:18 +0200 Subject: [PATCH 18/89] Render.c: fix comments --- nx-X11/programs/Xserver/hw/nxagent/Render.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/nx-X11/programs/Xserver/hw/nxagent/Render.c b/nx-X11/programs/Xserver/hw/nxagent/Render.c index 9d29fdcfe3..6d9fb5e90f 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Render.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Render.c @@ -1160,7 +1160,7 @@ void nxagentComposite(CARD8 op, PicturePtr pSrc, PicturePtr pMask, PicturePtr pD /* * Synchronize the content of the shared memory pixmap but pay * attention at not doing this more than once. We need to wait - * until the image data has been recom- posed at the X server side + * until the image data has been recomposed at the X server side * or the operation will use the wrong data. */ @@ -1214,10 +1214,10 @@ void nxagentComposite(CARD8 op, PicturePtr pSrc, PicturePtr pMask, PicturePtr pD /* * The glyphs flag have to be propagated between drawables, in order * to avoid to encode the text with lossy algorithms (like - * JPEG). Unlu- ckily we have verified that if the render com- - * posite propagates the flag, the deferring of render trapezoids - * doesn't work well. Moreover, by commenting out this code we have - * not noticed any visual problems. + * JPEG). Unluckily we have verified that if the render composite + * propagates the flag, the deferring of render trapezoids doesn't + * work well. Moreover, by commenting out this code we have not + * noticed any visual problems. * * if (nxagentDrawableContainGlyphs(pSrc -> pDrawable) == 1) * { @@ -1451,8 +1451,8 @@ void nxagentGlyphs(CARD8 op, PicturePtr pSrc, PicturePtr pDst, /* * We split glyphs lists here and recalculate the offsets of each - * list to make them ab- solute and not relatives to the prior list. - * This way each time we call XRenderComposi- teText it has to deal + * list to make them absolute and not relatives to the prior list. + * This way each time we call XRenderCompositeText it has to deal * only with a list of glyphs. This is done to further improve * caching. */ From 5964974939e214b55d560805b7b12ca2cdfdf626 Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Tue, 16 Apr 2024 22:10:07 +0200 Subject: [PATCH 19/89] Render.c: add some DEBUG output --- nx-X11/programs/Xserver/hw/nxagent/Render.c | 24 +++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/nx-X11/programs/Xserver/hw/nxagent/Render.c b/nx-X11/programs/Xserver/hw/nxagent/Render.c index 6d9fb5e90f..b6f57f7ab7 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Render.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Render.c @@ -1508,6 +1508,10 @@ void nxagentGlyphs(CARD8 op, PicturePtr pSrc, PicturePtr pDst, { for (int j = 0; j < nlists; j++) { + #ifdef DEBUG + fprintf(stderr, "%s: sizeID is [%d] - [%s]\n", __func__, sizeID, "XRenderCompositeText8"); + #endif + XRenderCompositeText8(nxagentDisplay, op, nxagentPicturePriv(pSrc)->picture, @@ -1528,6 +1532,10 @@ void nxagentGlyphs(CARD8 op, PicturePtr pSrc, PicturePtr pDst, { for (int j = 0; j < nlists; j++) { + #ifdef DEBUG + fprintf(stderr, "%s: sizeID is [%d] - [%s]\n", __func__, sizeID, "XRenderCompositeText16"); + #endif + XRenderCompositeText16(nxagentDisplay, op, nxagentPicturePriv(pSrc) -> picture, @@ -1548,6 +1556,10 @@ void nxagentGlyphs(CARD8 op, PicturePtr pSrc, PicturePtr pDst, { for (int j = 0; j < nlists; j++) { + #ifdef DEBUG + fprintf(stderr, "%s: sizeID is [%d] - [%s]\n", __func__, sizeID, "XRenderCompositeText32"); + #endif + XRenderCompositeText32(nxagentDisplay, op, nxagentPicturePriv(pSrc) -> picture, @@ -1582,6 +1594,10 @@ void nxagentGlyphs(CARD8 op, PicturePtr pSrc, PicturePtr pDst, { case 1: { + #ifdef DEBUG + fprintf(stderr, "%s: sizeID is [%d] - [%s]\n", __func__, sizeID, "XRenderCompositeText8"); + #endif + XRenderCompositeText8(nxagentDisplay, op, nxagentPicturePriv(pSrc)->picture, @@ -1597,6 +1613,10 @@ void nxagentGlyphs(CARD8 op, PicturePtr pSrc, PicturePtr pDst, } case 2: { + #ifdef DEBUG + fprintf(stderr, "%s: sizeID is [%d] - [%s]\n", __func__, sizeID, "XRenderCompositeText16"); + #endif + XRenderCompositeText16(nxagentDisplay, op, nxagentPicturePriv(pSrc) -> picture, @@ -1612,6 +1632,10 @@ void nxagentGlyphs(CARD8 op, PicturePtr pSrc, PicturePtr pDst, } case 4: { + #ifdef DEBUG + fprintf(stderr, "%s: sizeID is [%d] - [%s]\n", __func__, sizeID, "XRenderCompositeText32"); + #endif + XRenderCompositeText32(nxagentDisplay, op, nxagentPicturePriv(pSrc) -> picture, From 9f59723a33b6dd83e47a9cf65c8368a3c6cf9e00 Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Tue, 16 Apr 2024 22:10:07 +0200 Subject: [PATCH 20/89] Render.c: add some DEBUG output --- nx-X11/programs/Xserver/hw/nxagent/Render.c | 99 ++++++++++++--------- 1 file changed, 56 insertions(+), 43 deletions(-) diff --git a/nx-X11/programs/Xserver/hw/nxagent/Render.c b/nx-X11/programs/Xserver/hw/nxagent/Render.c index b6f57f7ab7..d21ae98c9e 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Render.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Render.c @@ -1252,6 +1252,11 @@ void nxagentGlyphs(CARD8 op, PicturePtr pSrc, PicturePtr pDst, XGlyphElt8 *elements; + #ifdef DEBUG + fprintf(stderr, "%s: pSrc [%p] pSrc->pDrawable [%p] pDst [%p] pDst->pDrawable [%p]\n", + __func__, pSrc, pSrc ? pSrc->pDrawable : NULL, pDst, pDst ? pDst->pDrawable : NULL); + #endif + if (pSrc == NULL || pDst == NULL) { return; @@ -2042,6 +2047,10 @@ void nxagentAddGlyphs(GlyphSetPtr glyphSet, Glyph *gids, xGlyphInfo *gi, CARD8 *normalizedImages = NULL; + #ifdef DEBUG + fprintf(stderr, "%s: sizeImages [%d]\n", __func__, sizeImages); + #endif + if (sizeImages > 0) { normalizedImages = malloc(sizeImages); @@ -2192,13 +2201,16 @@ Bool nxagentPictureInit(ScreenPtr pScreen, PictFormatPtr formats, int nformats) { #ifdef RENDER #ifdef DEBUG - fprintf(stderr, "nxagentPictureInit: Screen [%p].\n", (void *) pScreen); + fprintf(stderr, "%s: Screen [%p].\n", __func__, (void *) pScreen); #endif nxagentQueryFormats(); - if (fbPictureInit(pScreen, formats, nformats) == 0) + if (fbPictureInit(pScreen, formats, nformats) == FALSE) { + #ifdef DEBUG + fprintf(stderr, "%s: failed: fbPictureInit returned [FALSE]\n", __func__); + #endif return FALSE; } @@ -2215,11 +2227,11 @@ static void nxagentPrintFormat(XRenderPictFormat *pFormat) #ifdef DEBUG if (pFormat == NULL) { - fprintf(stderr, "nxagentPrintFormat: WARNING! null pointer passed to function.\n"); + fprintf(stderr, "%s: WARNING! null pointer passed to function.\n", __func__); return; } - fprintf(stderr, "nxagentPrintFormat: Dumping information for format at [%p]:\n\ + fprintf(stderr, "%s: Dumping information for format at [%p]:\n\ type=%d\n\ depth=%d\n\ red=%d\n\ @@ -2230,6 +2242,7 @@ static void nxagentPrintFormat(XRenderPictFormat *pFormat) blueMask=%d\n\ alpha=%d\n\ alphaMask=%d\n", + __func__, (void *) pFormat, pFormat -> type, pFormat -> depth, @@ -2247,8 +2260,8 @@ static void nxagentPrintFormat(XRenderPictFormat *pFormat) Bool nxagentFillGlyphSet(GlyphSetPtr pGly) { #ifdef DEBUG - fprintf(stderr, "nxagentFillGlyphSet: GlyphSet at [%p] Refcount [%ld] Glyphs [%ld] " - "Format [%p] FDepth [%d] RemoteID [%ld].\n", (void *) pGly, pGly -> refcnt, + fprintf(stderr, "%s: GlyphSet at [%p] Refcount [%ld] Glyphs [%ld] " + "Format [%p] FDepth [%d] RemoteID [%ld].\n", __func__, (void *) pGly, pGly -> refcnt, pGly -> hash.hashSet -> size, (void *) pGly -> format, pGly -> fdepth, pGly -> remoteID); #endif @@ -2282,7 +2295,7 @@ void nxagentReconnectGlyphSet(void* p0, XID x1, void *p2) XRenderPictFormat *pForm = NULL; #ifdef DEBUG - fprintf(stderr, "nxagentReconnectGlyphSet: GlyphSet at [%p].\n", (void *) pGly); + fprintf(stderr, "%s: GlyphSet at [%p].\n", __func__, (void *) pGly); #endif if (pGly -> format) @@ -2325,7 +2338,7 @@ Bool nxagentReconnectAllGlyphSet(void *p) nxagentQueryFormats(); #ifdef DEBUG - fprintf(stderr, "nxagentReconnectAllGlyphSet\n"); + fprintf(stderr, "%s\n", __func__); #endif for (int i = 0; (i < MAXCLIENTS) && (success); i++) @@ -2348,10 +2361,10 @@ void nxagentReconnectPicture(void * p0, XID x1, void *p2) XRenderPictureAttributes attributes; #ifdef TEST - fprintf(stderr, "nxagentReconnectPicture: Called with bool [%d] and picture at [%p].\n", + fprintf(stderr, "%s: Called with bool [%d] and picture at [%p].\n", __func__, *pBool, (void *) pPicture); - fprintf(stderr, "nxagentReconnectPicture: Virtual picture is [%ld].\n", + fprintf(stderr, "%s: Virtual picture is [%ld].\n", __func__, nxagentPicture(pPicture)); #endif @@ -2433,10 +2446,10 @@ void nxagentReconnectPicture(void * p0, XID x1, void *p2) } #ifdef TEST - fprintf(stderr, "nxagentReconnectPicture: Creating picture at [%p] with drawable [%ld] at [%p].\n", + fprintf(stderr, "%s: Creating picture at [%p] with drawable [%ld] at [%p].\n", __func__, (void *) pPicture, nxagentDrawable(pPicture -> pDrawable), (void *) pPicture -> pDrawable); - fprintf(stderr, "nxagentReconnectPicture: Format is at [%p] mask is [%ld] attributes are at [%p].\n", + fprintf(stderr, "%s: Format is at [%p] mask is [%ld] attributes are at [%p].\n", __func__, (void *) pForm, mask, (void *) &attributes); #endif @@ -2451,7 +2464,7 @@ void nxagentReconnectPicture(void * p0, XID x1, void *p2) #endif #ifdef TEST - fprintf(stderr, "nxagentReconnectPicture: Reconnected picture at [%p] with value [%ld].\n", + fprintf(stderr, "%s: Reconnected picture at [%p] with value [%ld].\n", __func__, (void *) pPicture, nxagentPicture(pPicture)); #endif @@ -2474,7 +2487,7 @@ Bool nxagentReconnectAllPicture(void *p) Bool r = True; #ifdef TEST - fprintf(stderr, "nxagentReconnectAllPicture: Going to recreate all pictures.\n"); + fprintf(stderr, "%s: Going to recreate all pictures.\n", __func__); #endif for (int i = 0; i < MAXCLIENTS; i++) @@ -2486,8 +2499,8 @@ Bool nxagentReconnectAllPicture(void *p) #ifdef WARNING if (!r) { - fprintf(stderr, "nxagentReconnectAllPicture: WARNING! Failed to recreate " - "picture for client [%d].\n", i); + fprintf(stderr, "%s: WARNING! Failed to recreate " + "picture for client [%d].\n", __func__, i); } #endif } @@ -2527,7 +2540,7 @@ Bool nxagentDisconnectAllPicture(void) Bool r = True; #ifdef DEBUG - fprintf(stderr, "nxagentDisconnectAllPicture.\n"); + fprintf(stderr, "%s.\n", __func__); #endif for (int i = 0; i < MAXCLIENTS; i++) @@ -2539,8 +2552,8 @@ Bool nxagentDisconnectAllPicture(void) #ifdef WARNING if (!r) { - fprintf(stderr, "nxagentDisconnectAllPicture: WARNING! Failed to disconnect " - "picture for client [%d].\n", i); + fprintf(stderr, "%s: WARNING! Failed to disconnect " + "picture for client [%d].\n", __func__, i); } #endif } @@ -2557,16 +2570,16 @@ void nxagentRenderCreateSolidFill(PicturePtr pPicture, xRenderColor *color) } #ifdef DEBUG - fprintf(stderr, "nxagentRenderCreateSolidFill: Got called.\n"); + fprintf(stderr, "%s: Got called.\n", __func__); if (pPicture == NULL) { - fprintf(stderr, "nxagentRenderCreateSolidFill: WARNING! pPicture pointer is NULL.\n"); + fprintf(stderr, "%s: WARNING! pPicture pointer is NULL.\n", __func__); } if (color == NULL) { - fprintf(stderr, "nxagentRenderCreateSolidFill: WARNING! color pointer is NULL.\n"); + fprintf(stderr, "%s: WARNING! color pointer is NULL.\n", __func__); } #endif /* #ifdef DEBUG */ @@ -2580,7 +2593,7 @@ void nxagentRenderCreateSolidFill(PicturePtr pPicture, xRenderColor *color) #endif #ifdef TEST - fprintf(stderr, "nxagentRenderCreateSolidFill: Created solid fill xid [%lu].\n", id); + fprintf(stderr, "%s: Created solid fill xid [%lu].\n", __func__, id); #endif nxagentPicturePriv(pPicture) -> picture = id; @@ -2597,31 +2610,31 @@ void nxagentRenderCreateLinearGradient(PicturePtr pPicture, xPointFixed *p1, } #ifdef DEBUG - fprintf(stderr, "nxagentRenderCreateLinearGradient: Got called.\n"); + fprintf(stderr, "%s: Got called.\n", __func__); if (pPicture == NULL) { - fprintf(stderr, "nxagentRenderCreateLinearGradient: WARNING! pPicture pointer is NULL.\n"); + fprintf(stderr, "%s: WARNING! pPicture pointer is NULL.\n", __func__); } if (p1 == NULL) { - fprintf(stderr, "nxagentRenderCreateLinearGradient: WARNING! p1 pointer is NULL.\n"); + fprintf(stderr, "%s: WARNING! p1 pointer is NULL.\n", __func__); } if (p2 == NULL) { - fprintf(stderr, "nxagentRenderCreateLinearGradient: WARNING! p2 pointer is NULL.\n"); + fprintf(stderr, "%s: WARNING! p2 pointer is NULL.\n", __func__); } if (stops == NULL) { - fprintf(stderr, "nxagentRenderCreateLinearGradient: WARNING! stops pointer is NULL.\n"); + fprintf(stderr, "%s: WARNING! stops pointer is NULL.\n", __func__); } if (colors == NULL) { - fprintf(stderr, "nxagentRenderCreateLinearGradient: WARNING! colors pointer is NULL.\n"); + fprintf(stderr, "%s: WARNING! colors pointer is NULL.\n", __func__); } #endif /* #ifdef DEBUG */ @@ -2644,7 +2657,7 @@ void nxagentRenderCreateLinearGradient(PicturePtr pPicture, xPointFixed *p1, #endif #ifdef TEST - fprintf(stderr, "nxagentRenderCreateLinearGradient: Created linear gradient xid [%lu].\n", id); + fprintf(stderr, "%s: Created linear gradient xid [%lu].\n", __func__, id); #endif nxagentPicturePriv(pPicture) -> picture = id; @@ -2664,31 +2677,31 @@ void nxagentRenderCreateRadialGradient(PicturePtr pPicture, xPointFixed *inner, } #ifdef DEBUG - fprintf(stderr, "nxagentRenderCreateRadialGradient: Got called.\n"); + fprintf(stderr, "%s: Got called.\n", __func__); if (pPicture == NULL) { - fprintf(stderr, "nxagentRenderCreateRadialGradient: WARNING! pPicture pointer is NULL.\n"); + fprintf(stderr, "%s: WARNING! pPicture pointer is NULL.\n", __func__); } if (inner == NULL) { - fprintf(stderr, "nxagentRenderCreateRadialGradient: WARNING! inner pointer is NULL.\n"); + fprintf(stderr, "%s: WARNING! inner pointer is NULL.\n", __func__); } if (outer == NULL) { - fprintf(stderr, "nxagentRenderCreateRadialGradient: WARNING! outer pointer is NULL.\n"); + fprintf(stderr, "%s: WARNING! outer pointer is NULL.\n", __func__); } if (stops == NULL) { - fprintf(stderr, "nxagentRenderCreateRadialGradient: WARNING! stops pointer is NULL.\n"); + fprintf(stderr, "%s: WARNING! stops pointer is NULL.\n", __func__); } if (colors == NULL) { - fprintf(stderr, "nxagentRenderCreateRadialGradient: WARNING! colors pointer is NULL.\n"); + fprintf(stderr, "%s: WARNING! colors pointer is NULL.\n", __func__); } #endif /* #ifdef DEBUG */ @@ -2713,7 +2726,7 @@ void nxagentRenderCreateRadialGradient(PicturePtr pPicture, xPointFixed *inner, #endif #ifdef TEST - fprintf(stderr, "nxagentRenderCreateRadialGradient: Created radial gradient xid [%lu].\n", id); + fprintf(stderr, "%s: Created radial gradient xid [%lu].\n", __func__, id); #endif nxagentPicturePriv(pPicture) -> picture = id; @@ -2731,26 +2744,26 @@ void nxagentRenderCreateConicalGradient(PicturePtr pPicture, } #ifdef DEBUG - fprintf(stderr, "nxagentRenderCreateConicalGradient: Got called.\n"); + fprintf(stderr, "%s: Got called.\n", __func__); if (pPicture == NULL) { - fprintf(stderr, "nxagentRenderCreateConicalGradient: WARNING! pPicture pointer is NULL.\n"); + fprintf(stderr, "%s: WARNING! pPicture pointer is NULL.\n", __func__); } if (center == NULL) { - fprintf(stderr, "nxagentRenderCreateConicalGradient: WARNING! center pointer is NULL.\n"); + fprintf(stderr, "%s: WARNING! center pointer is NULL.\n", __func__); } if (stops == NULL) { - fprintf(stderr, "nxagentRenderCreateConicalGradient: WARNING! stops pointer is NULL.\n"); + fprintf(stderr, "%s: WARNING! stops pointer is NULL.\n", __func__); } if (colors == NULL) { - fprintf(stderr, "nxagentRenderCreateConicalGradient: WARNING! colors pointer is NULL.\n"); + fprintf(stderr, "%s: WARNING! colors pointer is NULL.\n", __func__); } #endif /* #ifdef DEBUG */ @@ -2772,7 +2785,7 @@ void nxagentRenderCreateConicalGradient(PicturePtr pPicture, #endif #ifdef TEST - fprintf(stderr, "nxagentRenderCreateConicalGradient: Created conical gradient xid [%lu].\n", id); + fprintf(stderr, "%s: Created conical gradient xid [%lu].\n", __func__, id); #endif nxagentPicturePriv(pPicture) -> picture = id; From a70c8be1d21ea6d974d5ac842c1b0b334f2d6573 Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Sat, 20 Apr 2024 22:02:56 +0200 Subject: [PATCH 21/89] Render.c: Fix: init variable once outside the loop otherwise it would be reinitialized for every interation. This was errornously moved in commit 56aaea90b4ee442b57f1370e3cafe0418deadc1d --- nx-X11/programs/Xserver/hw/nxagent/Render.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/nx-X11/programs/Xserver/hw/nxagent/Render.c b/nx-X11/programs/Xserver/hw/nxagent/Render.c index d21ae98c9e..98722e48a8 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Render.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Render.c @@ -2027,9 +2027,10 @@ void nxagentAddGlyphs(GlyphSetPtr glyphSet, Glyph *gids, xGlyphInfo *gi, * as synchronized. */ + Glyph *tempGids = gids; + for (int i = 0; i < nglyphs; i++) { - Glyph *tempGids = gids; GlyphRefPtr gr = FindGlyphRef(&glyphSet -> hash, *tempGids, 0, 0); if (gr && gr -> glyph != DeletedGlyph) From b95fe005c7ab6aa09d287b85e2870507219bacce Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Mon, 22 Apr 2024 22:13:58 +0200 Subject: [PATCH 22/89] NXglyph.c: reformat ResizeGlyphHash --- nx-X11/programs/Xserver/hw/nxagent/NXglyph.c | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) diff --git a/nx-X11/programs/Xserver/hw/nxagent/NXglyph.c b/nx-X11/programs/Xserver/hw/nxagent/NXglyph.c index f116607064..22c45bd9c3 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/NXglyph.c +++ b/nx-X11/programs/Xserver/hw/nxagent/NXglyph.c @@ -221,23 +221,15 @@ ResizeGlyphHash (GlyphHashPtr hash, CARD32 change, Bool global) if (glyph && glyph != DeletedGlyph) { s = hash->table[i].signature; - - #ifdef NXAGENT_SERVER - +#ifdef NXAGENT_SERVER CARD32 c = hash->table[i].corruptedGlyph; - - #endif - +#endif gr = FindGlyphRef (&newHash, s, global, glyph); gr->signature = s; gr->glyph = glyph; - - #ifdef NXAGENT_SERVER - +#ifdef NXAGENT_SERVER gr -> corruptedGlyph = c; - - #endif - +#endif ++newHash.tableEntries; } } From a7a9f35534dcb18a4e084a7a3bf60fb9efdc90ad Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Mon, 22 Apr 2024 22:58:18 +0200 Subject: [PATCH 23/89] Events.c: use existing functions for CriticalOutputPending --- nx-X11/programs/Xserver/hw/nxagent/Events.c | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/nx-X11/programs/Xserver/hw/nxagent/Events.c b/nx-X11/programs/Xserver/hw/nxagent/Events.c index 634dadd364..9bd8dee163 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Events.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Events.c @@ -1184,7 +1184,7 @@ FIXME: Don't enqueue the KeyRelease event if the key was not already mieqEnqueue(&x); - CriticalOutputPending = 1; + SetCriticalOutputPending(); if (!nxagentOption(ViewOnly) && nxagentOption(Shadow)) { @@ -1278,7 +1278,7 @@ FIXME: Don't enqueue the KeyRelease event if the key was not already mieqEnqueue(&x); - CriticalOutputPending = 1; + SetCriticalOutputPending(); } if (!nxagentOption(ViewOnly) && nxagentOption(Shadow)) @@ -1352,7 +1352,7 @@ FIXME: Don't enqueue the KeyRelease event if the key was not already mieqEnqueue(&x); - CriticalOutputPending = 1; + SetCriticalOutputPending(); } if (!nxagentOption(ViewOnly) && nxagentOption(Shadow)) @@ -2224,10 +2224,7 @@ FIXME: Don't enqueue the KeyRelease event if the key was not already * Write the events to our clients. We may flush only in the case of * critical output but this doesn't seem beneficial. * - * if (CriticalOutputPending == 1) - * { - * FlushAllOutput(); - * } + * FlushIfCriticalOutputPending(); */ if (NewOutputPending == 1) @@ -2306,7 +2303,7 @@ int nxagentHandleKeyPress(XEvent *X, enum HandleEventResult *result) mieqEnqueue(&x); - CriticalOutputPending = 1; + SetCriticalOutputPending(); return 1; } From c4887d28c1c390ffb33f3e289a6ec02790a64ab0 Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Mon, 22 Apr 2024 23:00:57 +0200 Subject: [PATCH 24/89] Events.c: make nxagentDebugInput a Boolean because that's what it is... --- nx-X11/programs/Xserver/hw/nxagent/Events.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/nx-X11/programs/Xserver/hw/nxagent/Events.c b/nx-X11/programs/Xserver/hw/nxagent/Events.c index 9bd8dee163..4163c7b71b 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Events.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Events.c @@ -132,7 +132,7 @@ extern Bool nxagentOnce; #ifdef NX_DEBUG_INPUT -int nxagentDebugInput = 0; +Bool nxagentDebugInput = False; #endif #ifdef DEBUG @@ -282,7 +282,7 @@ void nxagentRemoveDuplicatedKeys(XEvent *X); void ProcessInputEvents(void) { #ifdef NX_DEBUG_INPUT - if (nxagentDebugInput == 1) + if (nxagentDebugInput) { fprintf(stderr, "%s: Processing input.\n", __func__); } @@ -1205,7 +1205,7 @@ FIXME: Don't enqueue the KeyRelease event if the key was not already case ButtonPress: { #ifdef NX_DEBUG_INPUT - if (nxagentDebugInput == 1) + if (nxagentDebugInput) { fprintf(stderr, "%s: Going to handle new ButtonPress event.\n", __func__); } @@ -1270,7 +1270,7 @@ FIXME: Don't enqueue the KeyRelease event if the key was not already } #ifdef NX_DEBUG_INPUT - if (nxagentDebugInput == 1) + if (nxagentDebugInput) { fprintf(stderr, "%s: Adding ButtonPress event.\n", __func__); } @@ -1304,7 +1304,7 @@ FIXME: Don't enqueue the KeyRelease event if the key was not already case ButtonRelease: { #ifdef NX_DEBUG_INPUT - if (nxagentDebugInput == 1) + if (nxagentDebugInput) { fprintf(stderr, "%s: Going to handle new ButtonRelease event.\n", __func__); } @@ -1344,7 +1344,7 @@ FIXME: Don't enqueue the KeyRelease event if the key was not already } #ifdef NX_DEBUG_INPUT - if (nxagentDebugInput == 1) + if (nxagentDebugInput) { fprintf(stderr, "%s: Adding ButtonRelease event.\n", __func__); } @@ -1384,7 +1384,7 @@ FIXME: Don't enqueue the KeyRelease event if the key was not already #endif #ifdef NX_DEBUG_INPUT - if (nxagentDebugInput == 1) + if (nxagentDebugInput) { fprintf(stderr, "%s: Handling motion notify window [%ld] root [%ld] child [%ld].\n", __func__, X.xmotion.window, X.xmotion.root, X.xmotion.subwindow); @@ -1439,7 +1439,7 @@ FIXME: Don't enqueue the KeyRelease event if the key was not already && X.xmotion.subwindow == None)) { #ifdef NX_DEBUG_INPUT - if (nxagentDebugInput == 1) + if (nxagentDebugInput) { fprintf(stderr, "%s: Adding motion event [%d, %d] to the queue.\n", __func__, x.u.keyButtonPointer.rootX, x.u.keyButtonPointer.rootY); @@ -4571,11 +4571,11 @@ void nxagentGuessDumpInputInfo(ClientPtr client, Atom property, char *data) { if (*data != 0) { - nxagentDebugInput = 1; + nxagentDebugInput = True; } else { - nxagentDebugInput = 0; + nxagentDebugInput = False; } } } From 35544d4cdaa0e47738d0123ff751676493de948b Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Wed, 24 Apr 2024 21:22:05 +0200 Subject: [PATCH 25/89] NXrender.c: fix indentation --- nx-X11/programs/Xserver/hw/nxagent/NXrender.c | 24 +++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/nx-X11/programs/Xserver/hw/nxagent/NXrender.c b/nx-X11/programs/Xserver/hw/nxagent/NXrender.c index aeeec1e179..b32c83bd6e 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/NXrender.c +++ b/nx-X11/programs/Xserver/hw/nxagent/NXrender.c @@ -611,18 +611,18 @@ ProcRenderComposite (ClientPtr client) (void *) pSrc, (void *) pMask, (void *) pDst); #endif - CompositePicture (stuff->op, - pSrc, - pMask, - pDst, - stuff->xSrc, - stuff->ySrc, - stuff->xMask, - stuff->yMask, - stuff->xDst, - stuff->yDst, - stuff->width, - stuff->height); + CompositePicture (stuff->op, + pSrc, + pMask, + pDst, + stuff->xSrc, + stuff->ySrc, + stuff->xMask, + stuff->yMask, + stuff->xDst, + stuff->yDst, + stuff->width, + stuff->height); } #else From 79272c6fdc4be9bc1f7171d752451d9719af63b5 Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Sun, 28 Apr 2024 13:31:14 +0200 Subject: [PATCH 26/89] GC.c: improve comment --- nx-X11/programs/Xserver/hw/nxagent/GC.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nx-X11/programs/Xserver/hw/nxagent/GC.c b/nx-X11/programs/Xserver/hw/nxagent/GC.c index 46dc758d1d..56d3f70793 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/GC.c +++ b/nx-X11/programs/Xserver/hw/nxagent/GC.c @@ -1251,7 +1251,7 @@ static Bool nxagentCompareRegions(RegionPtr r1, RegionPtr r2) } /* - * This function have to be called in the place of GetScratchGC if the + * This function has to be called in place of GetScratchGC if the * GC will be used to perform operations also on the remote X Server. * This is why we call the XChangeGC at the end of the function. */ From 436034c699f2bc552135cc48a598788a42b239a2 Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Sun, 28 Apr 2024 21:47:58 +0200 Subject: [PATCH 27/89] Client.c: fix TEST output --- nx-X11/programs/Xserver/hw/nxagent/Client.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/nx-X11/programs/Xserver/hw/nxagent/Client.c b/nx-X11/programs/Xserver/hw/nxagent/Client.c index bc768b6736..d530a935ce 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Client.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Client.c @@ -256,7 +256,7 @@ static void freeClientPrivates(ClientPtr client) void nxagentGuessClientHint(ClientPtr client, Atom property, char *data) { #ifdef TEST - fprintf(stderr, "++++++nxagentGuessClientHint: Client [%d] setting property [%s] as [%s].\n", + fprintf(stderr, "nxagentGuessClientHint: Client [%d] setting property [%s] as [%s].\n", client -> index, validateString(NameForAtom(property)), validateString(data)); #endif @@ -267,7 +267,7 @@ void nxagentGuessClientHint(ClientPtr client, Atom property, char *data) if (strcmp(data, "nxclient") == 0) { #ifdef TEST - fprintf(stderr, "++++++nxagentGuessClientHint: Detected nxclient as [%d].\n", client -> index); + fprintf(stderr, "nxagentGuessClientHint: Detected nxclient as [%d].\n", client -> index); #endif nxagentClientHint(client) = NXCLIENT_WINDOW; @@ -275,7 +275,7 @@ void nxagentGuessClientHint(ClientPtr client, Atom property, char *data) else if (strstr(data, "java")) { #ifdef TEST - fprintf(stderr, "++++++nxagentGuessClientHint: Detected java as [%d].\n", client -> index); + fprintf(stderr, "nxagentGuessClientHint: Detected java as [%d].\n", client -> index); #endif nxagentClientHint(client) = JAVA_WINDOW; @@ -289,7 +289,7 @@ void nxagentGuessClientHint(ClientPtr client, Atom property, char *data) strncmp(data, "msgBox", 6) == 0) { #ifdef TEST - fprintf(stderr, "++++++nxagentGuessClientHint: Detected nxclient dialog as [%d].\n", client -> index); + fprintf(stderr, "nxagentGuessClientHint: Detected nxclient dialog as [%d].\n", client -> index); #endif nxagentClientHint(client) = NXCLIENT_DIALOG; From 55e798a19e96ae6b37b757bd6df8cf964c42850b Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Wed, 1 May 2024 15:15:46 +0200 Subject: [PATCH 28/89] NXproperty.y/property.c: fix comments --- nx-X11/programs/Xserver/dix/property.c | 10 +++++----- nx-X11/programs/Xserver/hw/nxagent/NXproperty.c | 10 +++++----- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/nx-X11/programs/Xserver/dix/property.c b/nx-X11/programs/Xserver/dix/property.c index 37af8d5924..b394327bca 100644 --- a/nx-X11/programs/Xserver/dix/property.c +++ b/nx-X11/programs/Xserver/dix/property.c @@ -549,14 +549,14 @@ ProcGetProperty(ClientPtr client) return(Success); } -/* - * Return type, format, value to client - */ + /* + * Return type, format, value to client + */ n = (pProp->format/8) * pProp->size; /* size (bytes) of prop */ ind = stuff->longOffset << 2; - /* If longOffset is invalid such that it causes "len" to - be negative, it's a value error. */ + /* If longOffset is invalid such that it causes "len" to + be negative, it's a value error. */ if (n < ind) { diff --git a/nx-X11/programs/Xserver/hw/nxagent/NXproperty.c b/nx-X11/programs/Xserver/hw/nxagent/NXproperty.c index 8c18047fd7..ea8a98d1c6 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/NXproperty.c +++ b/nx-X11/programs/Xserver/hw/nxagent/NXproperty.c @@ -363,14 +363,14 @@ ProcGetProperty(ClientPtr client) return(Success); } -/* - * Return type, format, value to client - */ + /* + * Return type, format, value to client + */ n = (pProp->format/8) * pProp->size; /* size (bytes) of prop */ ind = stuff->longOffset << 2; - /* If longOffset is invalid such that it causes "len" to - be negative, it's a value error. */ + /* If longOffset is invalid such that it causes "len" to + be negative, it's a value error. */ if (n < ind) { From cc9922e1ea4ad827331e49426bda276c0037dfd8 Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Wed, 1 May 2024 15:16:03 +0200 Subject: [PATCH 29/89] NXproperty.c: fix ifdef indentation --- nx-X11/programs/Xserver/hw/nxagent/NXproperty.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/nx-X11/programs/Xserver/hw/nxagent/NXproperty.c b/nx-X11/programs/Xserver/hw/nxagent/NXproperty.c index ea8a98d1c6..7706bc7bcf 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/NXproperty.c +++ b/nx-X11/programs/Xserver/hw/nxagent/NXproperty.c @@ -270,7 +270,7 @@ ProcGetProperty(ClientPtr client) reply.type = X_Reply; reply.sequenceNumber = client->sequence; - #ifdef NXAGENT_SERVER +#ifdef NXAGENT_SERVER /* * Creating a reply for WM_STATE property if it doesn't exist. @@ -324,7 +324,7 @@ ProcGetProperty(ClientPtr client) return(client->noClientException); } - #endif +#endif /* NXAGENT_SERVER */ if (!pProp) return NullPropertyReply(client, None, 0, &reply); From c1365bbfbb6ae2a06ff5ce993c788805c984eb14 Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Wed, 1 May 2024 15:17:19 +0200 Subject: [PATCH 30/89] Pixmap.c: fix TEST output --- nx-X11/programs/Xserver/hw/nxagent/Pixmap.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nx-X11/programs/Xserver/hw/nxagent/Pixmap.c b/nx-X11/programs/Xserver/hw/nxagent/Pixmap.c index 153b75f8f5..addc81b790 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Pixmap.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Pixmap.c @@ -245,7 +245,7 @@ PixmapPtr nxagentCreatePixmap(ScreenPtr pScreen, int width, int height, #ifdef TEST fprintf(stderr, "nxagentCreatePixmap: Allocated memory for the Virtual %sPixmap [%p] of real Pixmap [%p] (%dx%d)," - "allocation hint [%d].\n", + " allocation hint [%d].\n", nxagentShmPixmapTrap ? "Shm " : "", (void *) pVirtual, (void *) pPixmap, width, height, usage_hint); #endif From 9c2ee1bbe0c2590e263cb46c82d4fc7b3649918f Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Wed, 1 May 2024 16:00:02 +0200 Subject: [PATCH 31/89] Literals.h: allow for TEST and DEBUG code --- nx-X11/programs/Xserver/hw/nxagent/Literals.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/nx-X11/programs/Xserver/hw/nxagent/Literals.h b/nx-X11/programs/Xserver/hw/nxagent/Literals.h index 691e2b4dd2..cd298ce158 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Literals.h +++ b/nx-X11/programs/Xserver/hw/nxagent/Literals.h @@ -23,7 +23,7 @@ /* */ /**************************************************************************/ -#ifdef TEST +#if defined(TEST) || defined(DEBUG) /* * Simple table used to translate a request * opcode to the name of the X request. @@ -211,4 +211,4 @@ static char *nxagentShmRequestLiteral[] = "ShmGetImage", "ShmCreatePixmap" }; -#endif /* TEST */ +#endif /* TEST || DEBUG */ From 3cad7422928a3da1ba5913046d0c8c3affa1170a Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Wed, 1 May 2024 16:00:44 +0200 Subject: [PATCH 32/89] Literals.h: mark with _X_UNUSED to prevent "unused" warnings --- nx-X11/programs/Xserver/hw/nxagent/Literals.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/nx-X11/programs/Xserver/hw/nxagent/Literals.h b/nx-X11/programs/Xserver/hw/nxagent/Literals.h index cd298ce158..c25f227822 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Literals.h +++ b/nx-X11/programs/Xserver/hw/nxagent/Literals.h @@ -29,7 +29,7 @@ * opcode to the name of the X request. */ -static char *nxagentRequestLiteral[] = +_X_UNUSED static char *nxagentRequestLiteral[] = { "None", "CreateWindow", @@ -161,7 +161,7 @@ static char *nxagentRequestLiteral[] = "NoOperation" }; -static char *nxagentRenderRequestLiteral[] = +_X_UNUSED static char *nxagentRenderRequestLiteral[] = { "RenderQueryVersion", "RenderQueryPictFormats", @@ -202,7 +202,7 @@ static char *nxagentRenderRequestLiteral[] = "RenderCreateConicalGradient" }; -static char *nxagentShmRequestLiteral[] = +_X_UNUSED static char *nxagentShmRequestLiteral[] = { "ShmQueryVersion", "ShmAttach", From 687b610ed76b842db361b17254f618c7e3daff94 Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Wed, 1 May 2024 16:01:13 +0200 Subject: [PATCH 33/89] Literals.h: add Drawable types --- nx-X11/programs/Xserver/hw/nxagent/Literals.h | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/nx-X11/programs/Xserver/hw/nxagent/Literals.h b/nx-X11/programs/Xserver/hw/nxagent/Literals.h index c25f227822..8230ae1f2f 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Literals.h +++ b/nx-X11/programs/Xserver/hw/nxagent/Literals.h @@ -211,4 +211,13 @@ _X_UNUSED static char *nxagentShmRequestLiteral[] = "ShmGetImage", "ShmCreatePixmap" }; + +/* see include/pixmap.h */ +_X_UNUSED static char *nxagentDrawableTypeLiteral[] = +{ + "DRAWABLE_WINDOW", + "DRAWABLE_PIXMAP", + "UNDRAWABLE_WINDOW", + "DRAWABLE_BUFFER" +}; #endif /* TEST || DEBUG */ From 08aaec68256b68d872c354a8d1acdbf27bb74254 Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Wed, 1 May 2024 16:21:13 +0200 Subject: [PATCH 34/89] GCOps.c: add/improve DEBUG/TEST statements --- nx-X11/programs/Xserver/hw/nxagent/GCOps.c | 127 ++++++++++++++++----- 1 file changed, 99 insertions(+), 28 deletions(-) diff --git a/nx-X11/programs/Xserver/hw/nxagent/GCOps.c b/nx-X11/programs/Xserver/hw/nxagent/GCOps.c index 23f2728116..d8ed435d0d 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/GCOps.c +++ b/nx-X11/programs/Xserver/hw/nxagent/GCOps.c @@ -70,6 +70,9 @@ is" without express or implied warranty. #undef DEBUG #undef DUMP +/* must come after TEST/DEBUG defines */ +#include "Literals.h" + /* * Temporarily set/reset the trap. */ @@ -576,9 +579,9 @@ RegionPtr nxagentCopyArea(DrawablePtr pSrcDrawable, DrawablePtr pDstDrawable, #ifdef TEST fprintf(stderr, "nxagentCopyArea: Image src [%s:%p], dst [%s:%p] (%d,%d) -> (%d,%d) size (%d,%d)\n", - (pSrcDrawable -> type == DRAWABLE_PIXMAP) ? "PIXMAP" : "WINDOW", (void *) pSrcDrawable, - (pDstDrawable -> type == DRAWABLE_PIXMAP) ? "PIXMAP" : "WINDOW", - (void *) pDstDrawable, srcx, srcy, dstx, dsty, width, height); + nxagentDrawableTypeLiteral[pSrcDrawable -> type], (void *) pSrcDrawable, + nxagentDrawableTypeLiteral[pDstDrawable -> type], + (void *) pDstDrawable, srcx, srcy, dstx, dsty, width, height); #endif /* @@ -766,8 +769,8 @@ RegionPtr nxagentCopyArea(DrawablePtr pSrcDrawable, DrawablePtr pDstDrawable, #ifdef TEST fprintf(stderr, "nxagentCopyArea: Image src [%s:%p], dst [%s:%p] sx %d sy %d dx %d dy %d size w %d h %d\n", - ((pSrcDrawable)->type == DRAWABLE_PIXMAP) ? "PIXMAP" : "WINDOW", (void *) pSrcDrawable, - ((pDstDrawable)->type == DRAWABLE_PIXMAP) ? "PIXMAP" : "WINDOW", + nxagentDrawableTypeLiteral[pSrcDrawable->type], (void *) pSrcDrawable, + nxagentDrawableTypeLiteral[pDstDrawable->type], (void *) pDstDrawable, srcx, srcy, dstx, dsty, width, height); #endif @@ -885,9 +888,9 @@ RegionPtr nxagentCopyPlane(DrawablePtr pSrcDrawable, DrawablePtr pDstDrawable, #ifdef TEST fprintf(stderr, "nxagentCopyPlane: Image src [%s:%p], dst [%s:%p] (%d,%d) -> (%d,%d) size (%d,%d)\n", - ((pSrcDrawable)->type == DRAWABLE_PIXMAP) ? "PIXMAP" : "WINDOW", (void *) pSrcDrawable, - ((pDstDrawable)->type == DRAWABLE_PIXMAP) ? "PIXMAP" : "WINDOW", - (void *) pDstDrawable, srcx, srcy, dstx, dsty, width, height); + nxagentDrawableTypeLiteral[(pSrcDrawable)->type], (void *) pSrcDrawable, + nxagentDrawableTypeLiteral[(pDstDrawable)->type], + (void *) pDstDrawable, srcx, srcy, dstx, dsty, width, height); #endif if (nxagentGCTrap || nxagentShmTrap) @@ -1069,8 +1072,8 @@ void nxagentPolyPoint(DrawablePtr pDrawable, GCPtr pGC, int mode, int nPoints, xPoint *pPoints) { #ifdef TEST - fprintf(stderr, "nxagentPolyPoint: Drawable at [%p] GC at [%p] Points [%d].\n", - (void *) pDrawable, (void *) pGC, nPoints); + fprintf(stderr, "nxagentPolyPoint: Drawable [%s:%p] GC [%p] Points [%d].\n", + nxagentDrawableTypeLiteral[pDrawable->type], (void *) pDrawable, (void *) pGC, nPoints); #endif if (nxagentGCTrap) @@ -1130,6 +1133,10 @@ void nxagentPolyPoint(DrawablePtr pDrawable, GCPtr pGC, int mode, void nxagentPolyLines(DrawablePtr pDrawable, GCPtr pGC, int mode, int nPoints, xPoint *pPoints) { + #ifdef DEBUG + fprintf(stderr, "%s: drawable: [%s:%p]\n", __func__, nxagentDrawableTypeLiteral[pDrawable->type], (void *)pDrawable); + #endif + if (nxagentGCTrap) { if ((pDrawable)->type == DRAWABLE_PIXMAP) @@ -1188,19 +1195,17 @@ void nxagentPolySegment(DrawablePtr pDrawable, GCPtr pGC, int nSegments, xSegment *pSegments) { #ifdef TEST - if (nSegments == 1) { - fprintf(stderr, "nxagentPolySegment: Drawable at [%p] GC at [%p] Segment [%d,%d,%d,%d].\n", - (void *) pDrawable, (void *) pGC, + fprintf(stderr, "nxagentPolySegment: Drawable at [%s:%p] GC at [%p] Segment [%d,%d,%d,%d].\n", + nxagentDrawableTypeLiteral[pDrawable->type], (void *) pDrawable, (void *) pGC, pSegments -> x1, pSegments -> y1, pSegments -> x2, pSegments -> y2); } else { - fprintf(stderr, "nxagentPolySegment: Drawable at [%p] GC at [%p] Segments [%d].\n", - (void *) pDrawable, (void *) pGC, nSegments); + fprintf(stderr, "nxagentPolySegment: Drawable at [%s:%p] GC at [%p] Segments [%d].\n", + nxagentDrawableTypeLiteral[pDrawable->type], (void *) pDrawable, (void *) pGC, nSegments); } - #endif if (nxagentGCTrap) @@ -1265,7 +1270,6 @@ void nxagentPolyRectangle(DrawablePtr pDrawable, GCPtr pGC, int nRectangles, xRectangle *pRectangles) { #ifdef TEST - if (nRectangles == 1) { fprintf(stderr, "nxagentPolyRectangle: Drawable at [%p] GC at [%p] Rectangle [%d,%d][%d,%d].\n", @@ -1277,7 +1281,6 @@ void nxagentPolyRectangle(DrawablePtr pDrawable, GCPtr pGC, fprintf(stderr, "nxagentPolyRectangle: Drawable at [%p] GC at [%p] Rectangles [%d].\n", (void *) pDrawable, (void *) pGC, nRectangles); } - #endif if (nxagentGCTrap) @@ -1345,6 +1348,10 @@ void nxagentPolyRectangle(DrawablePtr pDrawable, GCPtr pGC, void nxagentPolyArc(DrawablePtr pDrawable, GCPtr pGC, int nArcs, xArc *pArcs) { + #ifdef DEBUG + fprintf(stderr, "%s: drawable: [%s:%p]\n", __func__, nxagentDrawableTypeLiteral[pDrawable->type], (void *)pDrawable); + #endif + if (nxagentGCTrap) { if ((pDrawable)->type == DRAWABLE_PIXMAP) @@ -1402,6 +1409,10 @@ void nxagentPolyArc(DrawablePtr pDrawable, GCPtr pGC, void nxagentFillPolygon(DrawablePtr pDrawable, GCPtr pGC, int shape, int mode, int nPoints, xPoint *pPoints) { + #ifdef DEBUG + fprintf(stderr, "%s: drawable: [%s:%p]\n", __func__, nxagentDrawableTypeLiteral[pDrawable->type], (void *)pDrawable); + #endif + xPoint *newPoints = NULL; if (nxagentGCTrap) @@ -1503,19 +1514,17 @@ void nxagentPolyFillRect(DrawablePtr pDrawable, GCPtr pGC, int nRectangles, xRectangle *pRectangles) { #ifdef TEST - if (nRectangles == 1) { - fprintf(stderr, "nxagentPolyFillRect: Drawable at [%p] GC at [%p] FillStyle [%d] Rectangle [%d,%d][%d,%d].\n", - (void *) pDrawable, (void *) pGC, pGC -> fillStyle, + fprintf(stderr, "nxagentPolyFillRect: Drawable at [%s:%p] GC at [%p] FillStyle [%d] Rectangle [%d,%d][%d,%d].\n", + nxagentDrawableTypeLiteral[pDrawable->type], (void *) pDrawable, (void *) pGC, pGC -> fillStyle, pRectangles -> x, pRectangles -> y, pRectangles -> width, pRectangles -> height); } else { - fprintf(stderr, "nxagentPolyFillRect: Drawable at [%p] GC at [%p] FillStyle [%d] Rectangles [%d].\n", - (void *) pDrawable, (void *) pGC, pGC -> fillStyle, nRectangles); + fprintf(stderr, "nxagentPolyFillRect: Drawable at [%s:%p] GC at [%p] FillStyle [%d] Rectangles [%d].\n", + nxagentDrawableTypeLiteral[pDrawable->type], (void *) pDrawable, (void *) pGC, pGC -> fillStyle, nRectangles); } - #endif if (nxagentGCTrap) @@ -1551,15 +1560,45 @@ void nxagentPolyFillRect(DrawablePtr pDrawable, GCPtr pGC, { #ifdef TEST fprintf(stderr, "nxagentPolyFillRect: GC at [%p] uses corrupted tile pixmap at [%p]. Going to " - "corrupt the destination [%s][%p].\n", (void *) pGC, (void *) pGC -> tile.pixmap, - (pDrawable -> type == DRAWABLE_PIXMAP ? "pixmap" : "window"), (void *) pDrawable); - + "corrupt the destination [%s:%p].\n", (void *) pGC, (void *) pGC -> tile.pixmap, + nxagentDrawableTypeLiteral[pDrawable -> type], (void *) pDrawable); #endif inheritCorruptedRegion = True; } } + #ifdef DEBUG + if ((pDrawable)->type == DRAWABLE_PIXMAP) + { + fprintf(stderr, "%s: nxagentPixmapPriv(%p): [%p]\n", __func__, (void *)pDrawable, + (void *)(nxagentPixmapPriv((PixmapPtr)pDrawable))); + if (nxagentRealPixmap((PixmapPtr)pDrawable)) + { + fprintf(stderr, "%s: nxagentRealPixmap(%p): [%p]\n", __func__, (void *)pDrawable, + (void *)(nxagentRealPixmap((PixmapPtr)pDrawable))); + fprintf(stderr, "%s: nxagentCorruptedRegion(%p): [%p]\n", __func__, (void *)pDrawable, + (void *)(nxagentCorruptedRegion(pDrawable))); + fprintf(stderr, "%s: nxagentPixmapCorruptedRegion(%p): [%p]\n", __func__, (void *)pDrawable, + (void *)(nxagentPixmapCorruptedRegion((PixmapPtr)pDrawable))); + } + else + { + fprintf(stderr, "%s: nxagentRealPixmap(%p): is unset!!!\n", __func__, (void *)pDrawable); + } + + if (nxagentVirtualPixmap((PixmapPtr)pDrawable)) + { + fprintf(stderr, "%s: nxagentVirtualPixmap(%p): [%p]\n", __func__, (void *)pDrawable, + (void *)(nxagentVirtualPixmap((PixmapPtr)pDrawable))); + } + else + { + fprintf(stderr, "%s: nxagentVirtualPixmap(%p): is unset!!!\n", __func__, (void *)pDrawable); + } + } + #endif + if (inheritCorruptedRegion || nxagentDrawableStatus(pDrawable) == NotSynchronized) { RegionPtr rectRegion = RegionFromRects(nRectangles, pRectangles, CT_REGION); @@ -1663,6 +1702,10 @@ void nxagentPolyFillRect(DrawablePtr pDrawable, GCPtr pGC, void nxagentPolyFillArc(DrawablePtr pDrawable, GCPtr pGC, int nArcs, xArc *pArcs) { + #ifdef DEBUG + fprintf(stderr, "%s: drawable: [%s:%p]\n", __func__, nxagentDrawableTypeLiteral[pDrawable->type], (void *)pDrawable); + #endif + if (nxagentGCTrap) { if ((pDrawable)->type == DRAWABLE_PIXMAP) @@ -1728,6 +1771,10 @@ void nxagentPolyFillArc(DrawablePtr pDrawable, GCPtr pGC, int nxagentPolyText8(DrawablePtr pDrawable, GCPtr pGC, int x, int y, int count, char *string) { + #ifdef DEBUG + fprintf(stderr, "%s: drawable: [%s:%p]\n", __func__, nxagentDrawableTypeLiteral[pDrawable->type], (void *)pDrawable); + #endif + /* * While the session is suspended the font structure is NULL. */ @@ -1798,6 +1845,10 @@ int nxagentPolyText8(DrawablePtr pDrawable, GCPtr pGC, int x, int nxagentPolyText16(DrawablePtr pDrawable, GCPtr pGC, int x, int y, int count, unsigned short *string) { + #ifdef DEBUG + fprintf(stderr, "%s: drawable: [%s:%p]\n", __func__, nxagentDrawableTypeLiteral[pDrawable->type], (void *)pDrawable); + #endif + /* * While the session is suspended the font structure is NULL. */ @@ -1868,6 +1919,10 @@ int nxagentPolyText16(DrawablePtr pDrawable, GCPtr pGC, int x, void nxagentImageText8(DrawablePtr pDrawable, GCPtr pGC, int x, int y, int count, char *string) { + #ifdef DEBUG + fprintf(stderr, "%s: drawable: [%s:%p]\n", __func__, nxagentDrawableTypeLiteral[pDrawable->type], (void *)pDrawable); + #endif + if (nxagentGCTrap) { if ((pDrawable)->type == DRAWABLE_PIXMAP) @@ -1925,6 +1980,10 @@ void nxagentImageText8(DrawablePtr pDrawable, GCPtr pGC, int x, void nxagentImageText16(DrawablePtr pDrawable, GCPtr pGC, int x, int y, int count, unsigned short *string) { + #ifdef DEBUG + fprintf(stderr, "%s: drawable: [%s:%p]\n", __func__, nxagentDrawableTypeLiteral[pDrawable->type], (void *)pDrawable); + #endif + if (nxagentGCTrap) { if ((pDrawable)->type == DRAWABLE_PIXMAP) @@ -1983,12 +2042,16 @@ void nxagentImageGlyphBlt(DrawablePtr pDrawable, GCPtr pGC, int x, int y, unsigned int nGlyphs, CharInfoPtr *pCharInfo, void * pGlyphBase) { + #ifdef DEBUG + fprintf(stderr, "%s: drawable: [%s:%p]\n", __func__, nxagentDrawableTypeLiteral[pDrawable->type], (void *)pDrawable); + #endif + if ((pDrawable)->type == DRAWABLE_PIXMAP) { #ifdef TEST fprintf(stderr, "GCOps: GC [%p] going to imageGlyphBlt on FB pixmap [%p].\n", (void *) pGC, (void *) nxagentVirtualDrawable(pDrawable)); - #endif + #endif fbImageGlyphBlt(nxagentVirtualDrawable(pDrawable), pGC, x, y, nGlyphs, pCharInfo, pGlyphBase); } @@ -2002,6 +2065,10 @@ void nxagentPolyGlyphBlt(DrawablePtr pDrawable, GCPtr pGC, int x, int y, unsigned int nGlyphs, CharInfoPtr *pCharInfo, void * pGlyphBase) { + #ifdef DEBUG + fprintf(stderr, "%s: drawable: [%s:%p]\n", __func__, nxagentDrawableTypeLiteral[pDrawable->type], (void *)pDrawable); + #endif + if ((pDrawable)->type == DRAWABLE_PIXMAP) { #ifdef TEST @@ -2020,6 +2087,10 @@ void nxagentPolyGlyphBlt(DrawablePtr pDrawable, GCPtr pGC, int x, int y, void nxagentPushPixels(GCPtr pGC, PixmapPtr pBitmap, DrawablePtr pDrawable, int width, int height, int x, int y) { + #ifdef DEBUG + fprintf(stderr, "%s: drawable: [%s:%p]\n", __func__, nxagentDrawableTypeLiteral[pDrawable->type], (void *)pDrawable); + #endif + if ((pDrawable)->type == DRAWABLE_PIXMAP) { #ifdef TEST From bf9e9a8e5f8ae46fc0c4c4937c425f9fa2efe51e Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Wed, 1 May 2024 16:45:29 +0200 Subject: [PATCH 35/89] Screen.c: merge two X2GO ifdefs to one --- nx-X11/programs/Xserver/hw/nxagent/Screen.c | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/nx-X11/programs/Xserver/hw/nxagent/Screen.c b/nx-X11/programs/Xserver/hw/nxagent/Screen.c index 2d4afda14e..e13033af14 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Screen.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Screen.c @@ -1816,13 +1816,6 @@ 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, "%s: Setting WM_CLASS and WM_NAME for window with id [%ld].\n", __func__, @@ -1834,6 +1827,11 @@ N/A #ifdef X2GO if (nxagentX2go) { + /* + * 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) + */ hint.res_name = strdup("X2GoAgent"); hint.res_class = strdup("X2GoAgent"); } From 270a98bafedfbdfb8089361e8f2cb13903a1c4be Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Wed, 1 May 2024 16:49:45 +0200 Subject: [PATCH 36/89] Screen.c: use NULL instead of ugly void pointer stuff --- nx-X11/programs/Xserver/hw/nxagent/Screen.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/nx-X11/programs/Xserver/hw/nxagent/Screen.c b/nx-X11/programs/Xserver/hw/nxagent/Screen.c index e13033af14..fb530f7881 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Screen.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Screen.c @@ -1534,8 +1534,8 @@ N/A pScreen->SaveScreen = nxagentSaveScreen; pScreen->GetImage = nxagentGetImage; pScreen->GetSpans = nxagentGetSpans; - pScreen->PointerNonInterestBox = (void (*)()) 0; - pScreen->SourceValidate = (void (*)()) 0; + pScreen->PointerNonInterestBox = NULL; + pScreen->SourceValidate = NULL; pScreen->CreateScreenResources = nxagentCreateScreenResources; @@ -1611,12 +1611,12 @@ N/A * Backing store procedures. */ - pScreen->SaveDoomedAreas = (void (*)()) 0; - pScreen->RestoreAreas = (RegionPtr (*)()) 0; - pScreen->ExposeCopy = (void (*)()) 0; - pScreen->TranslateBackingStore = (RegionPtr (*)()) 0; - pScreen->ClearBackingStore = (RegionPtr (*)()) 0; - pScreen->DrawGuarantee = (void (*)()) 0; + pScreen->SaveDoomedAreas = NULL; + pScreen->RestoreAreas = NULL; + pScreen->ExposeCopy = NULL; + pScreen->TranslateBackingStore = NULL; + pScreen->ClearBackingStore = NULL; + pScreen->DrawGuarantee = NULL; if (enableBackingStore) { From 0670f7583d63977cb175ffe11a64061f88c1bf31 Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Sun, 5 May 2024 20:39:23 +0200 Subject: [PATCH 37/89] Xext,os,xkb: repeat unifdefs there where remnants of WIN32, CYGWIN and SCO --- nx-X11/programs/Xserver/Xext/security.c | 5 - nx-X11/programs/Xserver/Xext/shm.c | 2 +- nx-X11/programs/Xserver/Xext/xf86bigfont.c | 8 +- nx-X11/programs/Xserver/os/utils.c | 2 - nx-X11/programs/Xserver/xkb/ddxList.c | 37 ------ nx-X11/programs/Xserver/xkb/ddxLoad.c | 126 --------------------- nx-X11/programs/Xserver/xkb/xkbAccessX.c | 2 - nx-X11/programs/Xserver/xkb/xkbInit.c | 2 - 8 files changed, 3 insertions(+), 181 deletions(-) diff --git a/nx-X11/programs/Xserver/Xext/security.c b/nx-X11/programs/Xserver/Xext/security.c index df284d6a30..73fe1af853 100644 --- a/nx-X11/programs/Xserver/Xext/security.c +++ b/nx-X11/programs/Xserver/Xext/security.c @@ -73,11 +73,6 @@ in this Software without prior written authorization from The Open Group. # define DEFAULTPOLICYFILE NULL #endif -#if defined(WIN32) || defined(__CYGWIN__) -#include -#undef index -#endif - static int SecurityErrorBase; /* first Security error number */ static int SecurityEventBase; /* first Security event number */ diff --git a/nx-X11/programs/Xserver/Xext/shm.c b/nx-X11/programs/Xserver/Xext/shm.c index 8680874627..594586f978 100644 --- a/nx-X11/programs/Xserver/Xext/shm.c +++ b/nx-X11/programs/Xserver/Xext/shm.c @@ -149,7 +149,7 @@ static ShmFuncs fbFuncs = {fbShmCreatePixmap, fbShmPutImage}; } -#if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__CYGWIN__) +#if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) static Bool badSysCall = FALSE; diff --git a/nx-X11/programs/Xserver/Xext/xf86bigfont.c b/nx-X11/programs/Xserver/Xext/xf86bigfont.c index a31ffd02cf..0b946a6639 100644 --- a/nx-X11/programs/Xserver/Xext/xf86bigfont.c +++ b/nx-X11/programs/Xserver/Xext/xf86bigfont.c @@ -51,10 +51,6 @@ #ifdef SVR4 #include #endif -#if defined(__CYGWIN__) || defined(__SCO__) -#include -#include -#endif #include #include #include @@ -110,7 +106,7 @@ static unsigned int pagesize; static Bool badSysCall = FALSE; -#if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__CYGWIN__) +#if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) static void SigSysHandler( @@ -198,7 +194,7 @@ XFree86BigfontExtensionInit() FontShmdescIndex = AllocateFontPrivateIndex(); #endif /* HAS_XFONT2 */ -#if !defined(CSRG_BASED) && !defined(__CYGWIN__) +#if !defined(CSRG_BASED) pagesize = SHMLBA; #else # ifdef _SC_PAGESIZE diff --git a/nx-X11/programs/Xserver/os/utils.c b/nx-X11/programs/Xserver/os/utils.c index d49235b751..eff9b1e3c1 100644 --- a/nx-X11/programs/Xserver/os/utils.c +++ b/nx-X11/programs/Xserver/os/utils.c @@ -1214,10 +1214,8 @@ ExpandCommandLine(int *pargc, char ***pargv) { int i; -#if !defined(__CYGWIN__) if (getuid() != geteuid()) return; -#endif for (i = 1; i < *pargc; i++) { diff --git a/nx-X11/programs/Xserver/xkb/ddxList.c b/nx-X11/programs/Xserver/xkb/ddxList.c index ee5d63faca..28f3e0fd5e 100644 --- a/nx-X11/programs/Xserver/xkb/ddxList.c +++ b/nx-X11/programs/Xserver/xkb/ddxList.c @@ -41,21 +41,9 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE. #include #include -#ifdef WIN32 -/* from ddxLoad.c */ -extern const char* Win32TempDir(); -extern int Win32System(const char *cmdline); -#undef System -#define System Win32System - -#define W32_tmparg " '%s'" -#define W32_tmpfile ,tmpname -#define W32_tmplen strlen(tmpname)+3 -#else #define W32_tmparg #define W32_tmpfile #define W32_tmplen 0 -#endif /***====================================================================***/ @@ -127,9 +115,6 @@ FILE *in; Status status; int rval; Bool haveDir; -#ifdef WIN32 -char tmpname[PATH_MAX]; -#endif if ((list->pattern[what]==NULL)||(list->pattern[what][0]=='\0')) return Success; @@ -146,11 +131,6 @@ char tmpname[PATH_MAX]; in= NULL; haveDir= True; -#ifdef WIN32 - strcpy(tmpname, Win32TempDir()); - strcat(tmpname, "\\xkb_XXXXXX"); - (void) mktemp(tmpname); -#endif if (XkbBaseDirectory!=NULL) { if ((list->pattern[what][0]=='*')&&(list->pattern[what][1]=='\0')) { if (asprintf(&buf, "%s/%s.dir", XkbBaseDirectory, @@ -198,23 +178,11 @@ char tmpname[PATH_MAX]; status= Success; if (!haveDir) { -#ifndef WIN32 in= Popen(buf,"r"); -#else - if (xkbDebugFlags) - DebugF("xkb executes: %s\n",buf); - if (System(buf) < 0) - ErrorF("Could not invoke keymap compiler\n"); - else - in= fopen(tmpname, "r"); -#endif } if (!in) { free (buf); -#ifdef WIN32 - unlink(tmpname); -#endif return BadImplementation; } list->nFound[what]= 0; @@ -266,17 +234,12 @@ char tmpname[PATH_MAX]; } status= _AddListComponent(list,what,flags,tmp,client); } -#ifndef WIN32 if (haveDir) fclose(in); else if ((rval=Pclose(in))!=0) { if (xkbDebugFlags) ErrorF("xkbcomp returned exit code %d\n",rval); } -#else - fclose(in); - unlink(tmpname); -#endif free (buf); return status; } diff --git a/nx-X11/programs/Xserver/xkb/ddxLoad.c b/nx-X11/programs/Xserver/xkb/ddxLoad.c index bff69196f6..8529985a3b 100644 --- a/nx-X11/programs/Xserver/xkb/ddxLoad.c +++ b/nx-X11/programs/Xserver/xkb/ddxLoad.c @@ -74,109 +74,20 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE. #define POST_ERROR_MSG1 "\"Errors from xkbcomp are not fatal to the X server\"" #define POST_ERROR_MSG2 "\"End of messages from xkbcomp\"" -#if defined(WIN32) -#define PATHSEPARATOR "\\" -#else #define PATHSEPARATOR "/" -#endif - -#ifdef WIN32 - -#include -const char* -Win32TempDir() -{ - static char buffer[PATH_MAX]; - if (GetTempPath(sizeof(buffer), buffer)) - { - int len; - buffer[sizeof(buffer)-1] = 0; - len = strlen(buffer); - if (len > 0) - if (buffer[len-1] == '\\') - buffer[len-1] = 0; - return buffer; - } - if (getenv("TEMP") != NULL) - return getenv("TEMP"); - else if (getenv("TMP") != NULL) - return getenv("TEMP"); - else - return "/tmp"; -} - -int -Win32System(const char *cmdline) -{ - STARTUPINFO si; - PROCESS_INFORMATION pi; - DWORD dwExitCode; - char *cmd = xstrdup(cmdline); - ZeroMemory( &si, sizeof(si) ); - si.cb = sizeof(si); - ZeroMemory( &pi, sizeof(pi) ); - - if (!CreateProcess(NULL, cmd, NULL, NULL, FALSE, 0, NULL, NULL, &si, &pi)) - { - LPVOID buffer; - if (!FormatMessage( - FORMAT_MESSAGE_ALLOCATE_BUFFER | - FORMAT_MESSAGE_FROM_SYSTEM | - FORMAT_MESSAGE_IGNORE_INSERTS, - NULL, - GetLastError(), - MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), - (LPTSTR) &buffer, - 0, - NULL )) - { - ErrorF("Starting '%s' failed!\n", cmdline); - } - else - { - ErrorF("Starting '%s' failed: %s", cmdline, (char *)buffer); - LocalFree(buffer); - } - - free(cmd); - return -1; - } - /* Wait until child process exits. */ - WaitForSingleObject( pi.hProcess, INFINITE ); - - GetExitCodeProcess( pi.hProcess, &dwExitCode); - - /* Close process and thread handles. */ - CloseHandle( pi.hProcess ); - CloseHandle( pi.hThread ); - free(cmd); - - return dwExitCode; -} -#undef System -#define System(x) Win32System(x) -#endif static void OutputDirectory( char* outdir, size_t size) { -#ifndef WIN32 if (getuid() == 0 && (strlen(XKM_OUTPUT_DIR) < size)) { /* if server running as root it *may* be able to write */ /* FIXME: check whether directory is writable at all */ (void) strcpy (outdir, XKM_OUTPUT_DIR); } else -#else - if (strlen(Win32TempDir()) + 1 < size) - { - (void) strcpy(outdir, Win32TempDir()); - (void) strcat(outdir, "\\"); - } else -#endif if (strlen("/tmp/") < size) { (void) strcpy (outdir, "/tmp/"); @@ -265,9 +176,6 @@ XkbDDXCompileKeymapByNames( XkbDescPtr xkb, FILE * out; char *buf = NULL, keymap[PATH_MAX],xkm_output_dir[PATH_MAX]; -#ifdef WIN32 -char tmpname[PATH_MAX]; -#endif if ((names->keymap==NULL)||(names->keymap[0]=='\0')) { sprintf(keymap,"server-%s",display); } @@ -281,20 +189,9 @@ char tmpname[PATH_MAX]; XkbEnsureSafeMapName(keymap); OutputDirectory(xkm_output_dir, sizeof(xkm_output_dir)); -#ifdef WIN32 - strcpy(tmpname, Win32TempDir()); - strcat(tmpname, "\\xkb_XXXXXX"); - (void) mktemp(tmpname); -#endif if (XkbBaseDirectory!=NULL) { -#ifndef WIN32 char *xkmfile = "-"; -#else - /* WIN32 has no popen. The input must be stored in a file which is used as input - for xkbcomp. xkbcomp does not read from stdin. */ - char *xkmfile = tmpname; -#endif char *xkbbasedir = XkbBaseDirectory; char *xkbbindir = XkbBinDirectory; @@ -308,11 +205,7 @@ char tmpname[PATH_MAX]; buf = NULL; } else { -#ifndef WIN32 char *xkmfile = "-"; -#else - char *xkmfile = tmpname; -#endif if (asprintf(&buf, "xkbcomp -w %d -xkm \"%s\" -em1 %s -emp %s -eml %s \"%s%s.xkm\"", ((xkbDebugFlags<2)?1:((xkbDebugFlags>10)?10:(int)xkbDebugFlags)), @@ -331,11 +224,7 @@ char tmpname[PATH_MAX]; "Callin Popen() with null command.\n"); #endif -#ifndef WIN32 out= Popen(buf,"w"); -#else - out= fopen(tmpname, "w"); -#endif if (out!=NULL) { #ifdef DEBUG @@ -345,7 +234,6 @@ char tmpname[PATH_MAX]; } #endif XkbWriteXKBKeymapForNames(out,names,NULL,xkb,want,need); -#ifndef WIN32 #ifdef __sun if (Pclose(out) != 0) { @@ -354,9 +242,6 @@ char tmpname[PATH_MAX]; if (1) #else if (Pclose(out)==0) -#endif -#else - if (fclose(out)==0 && System(buf) >= 0) #endif { if (xkbDebugFlags) @@ -371,17 +256,9 @@ char tmpname[PATH_MAX]; } else DebugF("Error compiling keymap (%s)\n",keymap); -#ifdef WIN32 - /* remove the temporary file */ - unlink(tmpname); -#endif } else { -#ifndef WIN32 DebugF("Could not invoke keymap compiler\n"); -#else - DebugF("Could not open file %s\n", tmpname); -#endif } if (nameRtrn) nameRtrn[0]= '\0'; @@ -400,9 +277,6 @@ FILE * file; if (mapName!=NULL) { OutputDirectory(xkm_output_dir, sizeof(xkm_output_dir)); if ((XkbBaseDirectory!=NULL)&&(xkm_output_dir[0]!='/') -#ifdef WIN32 - &&(!isalpha(xkm_output_dir[0]) || xkm_output_dir[1]!=':') -#endif ) { if (snprintf(buf, PATH_MAX, "%s/%s%s.xkm", XkbBaseDirectory, xkm_output_dir, mapName) >= PATH_MAX) diff --git a/nx-X11/programs/Xserver/xkb/xkbAccessX.c b/nx-X11/programs/Xserver/xkb/xkbAccessX.c index 3eafaa5b76..d9909aa873 100644 --- a/nx-X11/programs/Xserver/xkb/xkbAccessX.c +++ b/nx-X11/programs/Xserver/xkb/xkbAccessX.c @@ -35,9 +35,7 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE. #include #include "inputstr.h" #include -#if !defined(WIN32) #include -#endif int XkbDfltRepeatDelay= 660; int XkbDfltRepeatInterval= 40; diff --git a/nx-X11/programs/Xserver/xkb/xkbInit.c b/nx-X11/programs/Xserver/xkb/xkbInit.c index f37e202d86..63686506e0 100644 --- a/nx-X11/programs/Xserver/xkb/xkbInit.c +++ b/nx-X11/programs/Xserver/xkb/xkbInit.c @@ -834,12 +834,10 @@ XkbProcessArguments(int argc,char *argv[],int i) } else if (strncmp(argv[i], "-xkbdir", 7) == 0) { if(++i < argc) { -#if !defined(WIN32) && !defined(__CYGWIN__) if (getuid() != geteuid()) { LogMessage(X_WARNING, "-xkbdir is not available for setuid X servers\n"); return -1; } else -#endif { if (strlen(argv[i]) < PATH_MAX) { XkbBaseDirectory= argv[i]; From f404db35d8a777cdee10511fa694380284ffcb8b Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Sun, 5 May 2024 20:51:40 +0200 Subject: [PATCH 38/89] xserver doesn't stop all connections to localhost Backport of the following commit + manual fix at some other locations. commit 75b9383d8a4c113ab3c6cfc1d5efcb5d9982a1bf Author: Jesse Adkins Date: Tue Aug 18 21:13:40 2009 -0700 xserver doesn't stop all connections to localhost X.Org Bugzilla #23329: http://bugs.freedesktop.org/show_bug.cgi?id=23329 Patch #28648: http://bugs.freedesktop.org/attachment.cgi?id=28648 I noticed in xserver at os/access.c that xorg tries to stop connections to localhost by checking against the address 127.0.0.1. However, RFC 3330 defines the localhost network as 127.0.0.0/8. This means that any IPv4 address that starts with 127 is just another name for localhos --- nx-X11/programs/Xserver/os/access.c | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/nx-X11/programs/Xserver/os/access.c b/nx-X11/programs/Xserver/os/access.c index bea4b968a0..bd5a2b69c6 100644 --- a/nx-X11/programs/Xserver/os/access.c +++ b/nx-X11/programs/Xserver/os/access.c @@ -405,8 +405,7 @@ DefineSelf (int fd) * on the other end of the wire. */ if (len == 4 && - addr[0] == 127 && addr[1] == 0 && - addr[2] == 0 && addr[3] == 1) + addr[0] == 127) continue; /* @@ -541,8 +540,8 @@ DefineSelf (int fd) */ if (family == FamilyInternet && !(len == 4 && - ((addr[0] == 127 && addr[1] == 0 && - addr[2] == 0 && addr[3] == 1) || + /* backport 75b9383d8a4c113ab3c6cfc1d5efcb5d9982a1bf */ + ((addr[0] == 127 || (addr[0] == 0 && addr[1] == 0 && addr[2] == 0 && addr[3] == 0))) ) @@ -755,8 +754,7 @@ DefineSelf (int fd) * on the other end of the wire */ if (family == FamilyInternet && - addr[0] == 127 && addr[1] == 0 && - addr[2] == 0 && addr[3] == 1) + addr[0] == 127) continue; #if defined(IPv6) && defined(AF_INET6) else if (family == FamilyInternet6 && @@ -903,8 +901,7 @@ DefineSelf (int fd) continue; if (family == FamilyInternet && - addr[0] == 127 && addr[1] == 0 && - addr[2] == 0 && addr[3] == 1) + addr[0] == 127) continue; /* From 21d40aa17133cdc2fc680078a996332170ff48c1 Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Sun, 5 May 2024 20:59:28 +0200 Subject: [PATCH 39/89] os/access.c: unifdef WINTCP --- nx-X11/programs/Xserver/os/access.c | 145 ---------------------------- 1 file changed, 145 deletions(-) diff --git a/nx-X11/programs/Xserver/os/access.c b/nx-X11/programs/Xserver/os/access.c index bd5a2b69c6..88055546e8 100644 --- a/nx-X11/programs/Xserver/os/access.c +++ b/nx-X11/programs/Xserver/os/access.c @@ -310,150 +310,6 @@ ifioctl (int fd, int cmd, char *arg) * for this fd and add them to the selfhosts list. */ -#ifdef WINTCP /* NCR Wollongong based TCP */ - -#include -#include -#include - -#include -#include -#include -#include -#include -#include - -void -DefineSelf (int fd) -{ - /* - * The Wolongong drivers used by NCR SVR4/MP-RAS don't understand the - * socket IO calls that most other drivers seem to like. Because of - * this, this routine must be special cased for NCR. Eventually, - * this will be cleared up. - */ - - struct ipb ifnet; - struct in_ifaddr ifaddr; - struct strioctl str; - unsigned char *addr; - register HOST *host; - int family, len; - - if ((fd = open ("/dev/ip", O_RDWR, 0 )) < 0) - Error ("Getting interface configuration (1)"); - - /* Indicate that we want to start at the begining */ - ifnet.ib_next = (struct ipb *) 1; - - while (ifnet.ib_next) - { - str.ic_cmd = IPIOC_GETIPB; - str.ic_timout = 0; - str.ic_len = sizeof (struct ipb); - str.ic_dp = (char *) &ifnet; - - if (ioctl (fd, (int) I_STR, (char *) &str) < 0) - { - close (fd); - Error ("Getting interface configuration (2)"); - } - - ifaddr.ia_next = (struct in_ifaddr *) ifnet.if_addrlist; - str.ic_cmd = IPIOC_GETINADDR; - str.ic_timout = 0; - str.ic_len = sizeof (struct in_ifaddr); - str.ic_dp = (char *) &ifaddr; - - if (ioctl (fd, (int) I_STR, (char *) &str) < 0) - { - close (fd); - Error ("Getting interface configuration (3)"); - } - - len = sizeof(struct sockaddr_in); - family = ConvertAddr (IA_SIN(&ifaddr), &len, (void **)&addr); - if (family == -1 || family == FamilyLocal) - continue; - for (host = selfhosts; - host && !addrEqual (family, addr, len, host); - host = host->next) - ; - if (host) - continue; - MakeHost(host,len) - if (host) - { - host->family = family; - host->len = len; - acopy(addr, host->addr, len); - host->next = selfhosts; - selfhosts = host; - } -#ifdef XDMCP - { - struct sockaddr broad_addr; - - /* - * If this isn't an Internet Address, don't register it. - */ - if (family != FamilyInternet) - continue; - - /* - * Ignore 'localhost' entries as they're not useful - * on the other end of the wire. - */ - if (len == 4 && - addr[0] == 127) - continue; - - /* - * Ignore '0.0.0.0' entries as they are - * returned by some OSes for unconfigured NICs but they are - * not useful on the other end of the wire. - */ - if (len == 4 && - addr[0] == 0 && addr[1] == 0 && - addr[2] == 0 && addr[3] == 0) - continue; - - XdmcpRegisterConnection (family, (char *)addr, len); - - -#define IA_BROADADDR(ia) ((struct sockaddr_in *)(&((struct in_ifaddr *)ia)->ia_broadaddr)) - - XdmcpRegisterBroadcastAddress ( - (struct sockaddr_in *) IA_BROADADDR(&ifaddr)); - -#undef IA_BROADADDR - } -#endif /* XDMCP */ - } - - close(fd); - - /* - * add something of FamilyLocalHost - */ - for (host = selfhosts; - host && !addrEqual(FamilyLocalHost, "", 0, host); - host = host->next); - if (!host) - { - MakeHost(host, 0); - if (host) - { - host->family = FamilyLocalHost; - host->len = 0; - acopy("", host->addr, 0); - host->next = selfhosts; - selfhosts = host; - } - } -} - -#else /* WINTCP */ #if !defined(SIOCGIFCONF) void @@ -963,7 +819,6 @@ DefineSelf (int fd) } } #endif /* !SIOCGIFCONF */ -#endif /* WINTCP */ #ifdef XDMCP void From d18879ad42a8aab964a685838e5749565ad5fb68 Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Sun, 5 May 2024 22:00:15 +0200 Subject: [PATCH 40/89] os/utils.c: unifdef USE_CHMOD --- nx-X11/programs/Xserver/os/utils.c | 4 ---- 1 file changed, 4 deletions(-) diff --git a/nx-X11/programs/Xserver/os/utils.c b/nx-X11/programs/Xserver/os/utils.c index eff9b1e3c1..e891758dad 100644 --- a/nx-X11/programs/Xserver/os/utils.c +++ b/nx-X11/programs/Xserver/os/utils.c @@ -381,11 +381,7 @@ LockServer(void) if (write(lfd, pid_str, 11) != 11) FatalError("Could not write pid to lock file in %s\n", tmp); -#ifndef USE_CHMOD - (void) fchmod(lfd, 0444); -#else (void) chmod(tmp, 0444); -#endif (void) close(lfd); /* From ed13175637aca5d7219ac4319cfe5fd8881dce52 Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Sun, 5 May 2024 22:05:20 +0200 Subject: [PATCH 41/89] os: signal handlers return void. commit 843166b033dc0544b9f3cf3c91fc3ae3650bda14 Author: Adam Jackson Date: Mon Apr 6 11:05:17 2009 -0400 os: signal handlers return void. --- nx-X11/programs/Xserver/include/os.h | 13 +++---------- nx-X11/programs/Xserver/os/utils.c | 6 ++---- 2 files changed, 5 insertions(+), 14 deletions(-) diff --git a/nx-X11/programs/Xserver/include/os.h b/nx-X11/programs/Xserver/include/os.h index 920b474db9..7b87795791 100644 --- a/nx-X11/programs/Xserver/include/os.h +++ b/nx-X11/programs/Xserver/include/os.h @@ -86,13 +86,6 @@ typedef struct _NewClientRec *NewClientPtr; #endif #include -/* have to put $(SIGNAL_DEFINES) in DEFINES in Imakefile to get this right */ -#ifdef SIGNALRETURNSINT -#define SIGVAL int -#else -#define SIGVAL void -#endif - extern void (*OsVendorVErrorFProc)(const char *, va_list args); extern int WaitForSomething( @@ -207,9 +200,9 @@ extern void SetDPMSTimers(void); extern void FreeDPMSTimers(void); #endif -extern SIGVAL AutoResetServer(int /*sig*/); +extern void AutoResetServer(int /*sig*/); -extern SIGVAL GiveUp(int /*sig*/); +extern void GiveUp(int /*sig*/); extern void UseMsg(void); @@ -240,7 +233,7 @@ extern _X_EXPORT char *Xvprintf(const char *fmt, va_list va)_X_ATTRIBUTE_PRINTF( extern _X_EXPORT char *XNFprintf(const char *fmt, ...) _X_ATTRIBUTE_PRINTF(1,2) _X_DEPRECATED; extern _X_EXPORT char *XNFvprintf(const char *fmt, va_list va)_X_ATTRIBUTE_PRINTF(1,0) _X_DEPRECATED; -typedef SIGVAL (*OsSigHandlerPtr)(int /* sig */); +typedef void (*OsSigHandlerPtr)(int /* sig */); extern OsSigHandlerPtr OsSignal(int /* sig */, OsSigHandlerPtr /* handler */); diff --git a/nx-X11/programs/Xserver/os/utils.c b/nx-X11/programs/Xserver/os/utils.c index e891758dad..da4e9fb400 100644 --- a/nx-X11/programs/Xserver/os/utils.c +++ b/nx-X11/programs/Xserver/os/utils.c @@ -467,8 +467,7 @@ UnlockServer(void) /* Force connections to close on SIGHUP from init */ -/*ARGSUSED*/ -SIGVAL +void AutoResetServer (int sig) { int olderrno = errno; @@ -487,8 +486,7 @@ AutoResetServer (int sig) /* Force connections to close and then exit on SIGTERM, SIGINT */ -/*ARGSUSED*/ -SIGVAL +void GiveUp(int sig) { int olderrno = errno; From 4a680cf8c091828ee78a7a7a18daa7069df932b9 Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Sun, 5 May 2024 22:07:56 +0200 Subject: [PATCH 42/89] os: unifdef GPROF and X_NOT_POSIX just like xorg-xserver in commit 446fe9eecddd1337f9d5164dd7c301e1ba3dfe32 Author: Daniel Stone Date: Thu Jul 17 21:37:50 2008 +0300 Dead code removal Remove a whole bunch of code that was never built, be it entire files or just dead ifdefs. --- nx-X11/programs/Xserver/os/connection.c | 4 ---- nx-X11/programs/Xserver/os/osdep.h | 3 --- nx-X11/programs/Xserver/os/osinit.c | 7 ------- nx-X11/programs/Xserver/os/utils.c | 15 --------------- 4 files changed, 29 deletions(-) diff --git a/nx-X11/programs/Xserver/os/connection.c b/nx-X11/programs/Xserver/os/connection.c index 4d30dd86f0..78ce8e03f1 100644 --- a/nx-X11/programs/Xserver/os/connection.c +++ b/nx-X11/programs/Xserver/os/connection.c @@ -111,11 +111,7 @@ SOFTWARE. #include #endif -#ifdef X_NOT_POSIX -#define Pid_t int -#else #define Pid_t pid_t -#endif int lastfdesc; /* maximum file descriptor */ diff --git a/nx-X11/programs/Xserver/os/osdep.h b/nx-X11/programs/Xserver/os/osdep.h index e106c55449..f2279dd6ca 100644 --- a/nx-X11/programs/Xserver/os/osdep.h +++ b/nx-X11/programs/Xserver/os/osdep.h @@ -60,7 +60,6 @@ SOFTWARE. #include -#ifndef X_NOT_POSIX #ifdef _POSIX_SOURCE #include #else @@ -68,8 +67,6 @@ SOFTWARE. #include #undef _POSIX_SOURCE #endif -#else /* X_NOT_POSIX */ -#endif /* X_NOT_POSIX */ #ifndef OPEN_MAX #ifdef SVR4 diff --git a/nx-X11/programs/Xserver/os/osinit.c b/nx-X11/programs/Xserver/os/osinit.c index 367635f6cd..0313a8990e 100644 --- a/nx-X11/programs/Xserver/os/osinit.c +++ b/nx-X11/programs/Xserver/os/osinit.c @@ -138,15 +138,8 @@ OsInit(void) #endif } -#ifndef X_NOT_POSIX if (getpgrp () == 0) setpgid (0, 0); -#else -#if !defined(SYSV) - if (getpgrp (0) == 0) - setpgrp (0, getpid ()); -#endif -#endif #ifdef RLIMIT_DATA if (limitDataSpace >= 0) diff --git a/nx-X11/programs/Xserver/os/utils.c b/nx-X11/programs/Xserver/os/utils.c index da4e9fb400..d6a23375d3 100644 --- a/nx-X11/programs/Xserver/os/utils.c +++ b/nx-X11/programs/Xserver/os/utils.c @@ -276,9 +276,6 @@ OsSignal(sig, handler) int sig; OsSigHandlerPtr handler; { -#ifdef X_NOT_POSIX - return signal(sig, handler); -#else struct sigaction act, oact; sigemptyset(&act.sa_mask); @@ -289,7 +286,6 @@ OsSignal(sig, handler) if (sigaction(sig, &act, &oact)) perror("sigaction"); return oact.sa_handler; -#endif } #ifdef SERVER_LOCK @@ -474,13 +470,6 @@ AutoResetServer (int sig) dispatchException |= DE_RESET; isItTimeToYield = TRUE; -#ifdef GPROF - chdir ("/tmp"); - exit (0); -#endif -#if defined(SYSV) && defined(X_NOT_POSIX) - OsSignal (SIGHUP, AutoResetServer); -#endif errno = olderrno; } @@ -497,10 +486,6 @@ GiveUp(int sig) dispatchException |= DE_TERMINATE; isItTimeToYield = TRUE; -#if defined(SYSV) && defined(X_NOT_POSIX) - if (sig) - OsSignal(sig, SIG_IGN); -#endif errno = olderrno; } From 2fd776888346797a085ca493d111fbac791cb461 Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Tue, 7 May 2024 23:37:15 +0200 Subject: [PATCH 43/89] Window.c: Fix: Use correct type for XlibWindow These are filled by libX11 so the type must be the Xlib one. --- nx-X11/programs/Xserver/hw/nxagent/Window.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/nx-X11/programs/Xserver/hw/nxagent/Window.c b/nx-X11/programs/Xserver/hw/nxagent/Window.c index c18ebde97b..1efe491e31 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Window.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Window.c @@ -1401,9 +1401,9 @@ void nxagentConfigureWindow(WindowPtr pWin, unsigned int mask) #ifdef TEST { - Window root_return; - Window parent_return; - Window *children_return = NULL; + XlibWindow root_return; + XlibWindow parent_return; + XlibWindow *children_return = NULL; unsigned int nchildren_return; Status result = XQueryTree(nxagentDisplay, DefaultRootWindow(nxagentDisplay), From 9684da35a45054f94c2b54822f592ece2160ec33 Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Tue, 7 May 2024 23:43:04 +0200 Subject: [PATCH 44/89] Window.c: mark nxagentCheckWindowIntegrity as unused 'cause that's what it is. But as this seems to be a handy debug helper we'll leave it instead of dropping it. Marking it as unused silences a compiler warning. --- nx-X11/programs/Xserver/hw/nxagent/Window.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/nx-X11/programs/Xserver/hw/nxagent/Window.c b/nx-X11/programs/Xserver/hw/nxagent/Window.c index 1efe491e31..b84c71c102 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Window.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Window.c @@ -167,7 +167,7 @@ nxagentWMStateRec; */ #ifdef TEST -static Bool nxagentCheckWindowIntegrity(WindowPtr pWin); +static _X_UNUSED Bool nxagentCheckWindowIntegrity(WindowPtr pWin); #endif WindowPtr nxagentGetWindowFromID(Window id) @@ -3317,7 +3317,7 @@ Bool nxagentCheckIllegalRootMonitoring(WindowPtr pWin, Mask mask) } #ifdef TEST -Bool nxagentCheckWindowIntegrity(WindowPtr pWin) +static _X_UNUSED Bool nxagentCheckWindowIntegrity(WindowPtr pWin) { Bool integrity = True; From dbf565e9ded5ad9c7d1ce8c2344d027263f62364 Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Fri, 10 May 2024 01:09:17 +0200 Subject: [PATCH 45/89] main server Imakefile: drop rules for unused or non-existing stuff --- nx-X11/programs/Xserver/Imakefile | 25 ++----------------------- 1 file changed, 2 insertions(+), 23 deletions(-) diff --git a/nx-X11/programs/Xserver/Imakefile b/nx-X11/programs/Xserver/Imakefile index 8566616609..36966f3baa 100644 --- a/nx-X11/programs/Xserver/Imakefile +++ b/nx-X11/programs/Xserver/Imakefile @@ -58,8 +58,6 @@ INSTPGMFLAGS = #define FBLibs PreFbLibs FbPostFbLibs -#define MiExtLibs $(SHADOW) - #define AllFBLibs PreFbLibs $(FB) PostFbLibs #if BuildGlxExt @@ -76,9 +74,6 @@ INSTPGMFLAGS = #if BuildXKB XKBEXT = xkb/LibraryTargetName(xkb) dependLib($(OS)) XKBDIR = xkb -#if defined(XorgVersion) - XF86XKBOBJS = xkb/xf86KillSrv.o xkb/xf86VT.o xkb/xf86Private.o -#endif #endif #if BuildDBE DBEEXT = dbe/LibraryTargetName(dbe) @@ -135,8 +130,6 @@ INSTPGMFLAGS = BSDEMUL = $(DEPXBSDLIB) FB = fb/LibraryTargetName(fb) DAMAGE = miext/damage/LibraryTargetName(damage) - SHADOW = miext/shadow/LibraryTargetName(shadow) - LAYER = miext/layer/LibraryTargetName(layer) #if !HasFfs && (defined(mingwArchitecture) || defined(cygwinArchitecture)) /* Order of libraries is important when linking in mingw or * cygwin. libmi.a requires ffs from libdix.a. So it is added @@ -147,21 +140,11 @@ INSTPGMFLAGS = #endif MIINITEXTOBJ = mi/miinitext.o DIX = dix/LibraryTargetName(dix) -#if UsbMouseSupport -#if !HasLibUsb - USB = $(XF86OSSRC)/bsd/libusb/LibraryTargetName(usb) -#else - USB = UsbHidLib -#endif -#endif #ifdef ServerExtraSysLibs EXTRASYSLIBS = ServerExtraSysLibs -#endif -#if HasPam && HasPamMisc - PAMLIBS = PamLibraries PamMiscLibraries #endif SYSLIBS = $(ZLIB) MathLibrary $(USB) \ - $(PAMLIBS) $(EXTRASYSLIBS) + $(EXTRASYSLIBS) #if !HasCbrt CBRT = mi/LibraryTargetName(cbrt) #endif @@ -195,11 +178,7 @@ XCOMM FBSUBDIR = fb MIDAMAGEDIR = miext/damage FBDIR = fb -#ifndef Win32Architecture NXAGENTDDXDIR = hw/nxagent -#else -NXAGENTDDXDIR = hw -#endif NXAGENTDIRS = $(STDDIRS) $(FBDIR) $(MIDAMAGEDIR) $(NXAGENTDDXDIR) $(DEPDIRS) @@ -407,7 +386,7 @@ nxagent_static_nolibs: nxagent #endif /* NXAgentServer */ -MIEXTDIRS = $(SHADOWDIR) $(LAYERDIR) $(ROOTLESSDIR) $(MIDAMAGEDIR) +MIEXTDIRS = $(MIDAMAGEDIR) IPLANDIRS = $(IPLAN2P2DIR) $(IPLAN2P4DIR) $(IPLAN2P8DIR) DDXDIRS = $(DECWSDDXDIR) $(SUNDDXDIR) \ $(HPDDXDIR) $(XFREE86DDXDIR) \ From f97907a1a00651a03bafa43035f6adf572a93f2c Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Sat, 11 May 2024 16:35:27 +0200 Subject: [PATCH 46/89] Imake.rules: do not print "using system-wide ..." twice only let the actual print happen and hide the corresponding echo --- nx-X11/config/cf/Imake.rules | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/nx-X11/config/cf/Imake.rules b/nx-X11/config/cf/Imake.rules index ac3b78da2d..2219c1db5b 100644 --- a/nx-X11/config/cf/Imake.rules +++ b/nx-X11/config/cf/Imake.rules @@ -1976,7 +1976,7 @@ DependDependencyStatement() @@\ NoCmpScript(ProgramTargetName($(DEPEND))) @@\ @@\ ProgramTargetName($(DEPEND)): @@\ - echo "using system-wide depend, continuing in $(CURRENT_DIR)" + @echo "using system-wide depend, continuing in $(CURRENT_DIR)" #endif /* UseInstalled */ #endif /* DependDependency */ @@ -2069,7 +2069,7 @@ target:: ProgramTargetName($(IMAKE)) @@\ NoCmpScript(ProgramTargetName($(IMAKE)) $(IMAKE).Osuf) @@\ @@\ ProgramTargetName($(IMAKE)) $(IMAKE).Osuf: @@\ - echo "using system-wide imake, continuing in $(CURRENT_DIR)" + @echo "using system-wide imake, continuing in $(CURRENT_DIR)" #endif /* UseInstalled */ #endif /* ImakeDependency */ From 8298919ec7019befc6b71120f7685a8dd3e3cf69 Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Sat, 11 May 2024 16:48:04 +0200 Subject: [PATCH 47/89] Imake.rules: fix error in Makefile generation "make Makefile" would result in "/bin/sh: 2: @mv: not found" --- nx-X11/config/cf/Imake.rules | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nx-X11/config/cf/Imake.rules b/nx-X11/config/cf/Imake.rules index 2219c1db5b..f8ac988d96 100644 --- a/nx-X11/config/cf/Imake.rules +++ b/nx-X11/config/cf/Imake.rules @@ -1107,7 +1107,7 @@ CplusplusProgramTargetHelper(program,SRCS10,OBJS10,DEPLIBS10,locallib,syslib) #ifndef RMoveToBakFile #define RMoveToBakFile(file) -@if [ -f file ]; then test -n "${VERBOSE}" && set -x; \ @@\ - RemoveFile(file.bak); @$(MV) file file.bak; \ @@\ + RemoveFile(file.bak); $(MV) file file.bak; \ @@\ else exit 0; fi #endif /* RMoveToBakFile */ From 18e78c2be7f7a650aadc644472e4a774b99278c9 Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Sat, 11 May 2024 17:18:29 +0200 Subject: [PATCH 48/89] multiple imake config fixes see ArcticaProject/nx-libs/issues/1058 for details and the original patch. Found and fixed by realsimix Adresses ArcticaProject/nx-libs#1058 (part 1) --- Makefile | 2 +- nx-X11/config/cf/Imake.rules | 6 +++--- nx-X11/config/cf/X11.tmpl | 2 +- nx-X11/config/cf/lnxLib.rules | 6 ++++-- 4 files changed, 9 insertions(+), 7 deletions(-) diff --git a/Makefile b/Makefile index 1e744fa220..9a08e08e27 100644 --- a/Makefile +++ b/Makefile @@ -116,7 +116,7 @@ ifneq "$(strip $(NX_VERSION_CUSTOM))" "" endif imakeconfig: - @echo; + @echo @echo "===> $@" # auto-config some setting diff --git a/nx-X11/config/cf/Imake.rules b/nx-X11/config/cf/Imake.rules index f8ac988d96..005869280c 100644 --- a/nx-X11/config/cf/Imake.rules +++ b/nx-X11/config/cf/Imake.rules @@ -547,7 +547,7 @@ clean cleantc:: @@\ :; \ @@\ else \ @@\ if [ -h dir ]; then \ @@\ - (test -n "${VERBOSE}" && test -n "${VERBOSE}" && set -x; rm -f dir); \ @@\ + (test -n "${VERBOSE}" && set -x; rm -f dir); \ @@\ fi; \ @@\ (test -n "${VERBOSE}" && set -x; $(MKDIRHIER) dir); \ @@\ fi @@ -1976,7 +1976,7 @@ DependDependencyStatement() @@\ NoCmpScript(ProgramTargetName($(DEPEND))) @@\ @@\ ProgramTargetName($(DEPEND)): @@\ - @echo "using system-wide depend, continuing in $(CURRENT_DIR)" + @test -z "${VERBOSE}" || echo "using system-wide depend, continuing in $(CURRENT_DIR)" #endif /* UseInstalled */ #endif /* DependDependency */ @@ -2069,7 +2069,7 @@ target:: ProgramTargetName($(IMAKE)) @@\ NoCmpScript(ProgramTargetName($(IMAKE)) $(IMAKE).Osuf) @@\ @@\ ProgramTargetName($(IMAKE)) $(IMAKE).Osuf: @@\ - @echo "using system-wide imake, continuing in $(CURRENT_DIR)" + @test -z "${VERBOSE}" || echo "using system-wide imake, continuing in $(CURRENT_DIR)" #endif /* UseInstalled */ #endif /* ImakeDependency */ diff --git a/nx-X11/config/cf/X11.tmpl b/nx-X11/config/cf/X11.tmpl index 4bd18aa4ea..22dc190063 100644 --- a/nx-X11/config/cf/X11.tmpl +++ b/nx-X11/config/cf/X11.tmpl @@ -1500,7 +1500,7 @@ install:: deps @@\ $(INSTALL) $(INSTALLFLAGS) $(INSTDATFLAGS) name.html \ @@\ $(DESTDIR)$(DOCHTMLDIR)); \ @@\ for i in name*.png; do \ @@\ - if [ -f $$i ]; then (test -n "${VERBOSE}" && test -n "${VERBOSE}" && set -x; \ @@\ + if [ -f $$i ]; then (test -n "${VERBOSE}" && set -x; \ @@\ $(INSTALL) $(INSTALLFLAGS) $(INSTDATFLAGS) $$i \ @@\ $(DESTDIR)$(DOCHTMLDIR)); \ @@\ fi; \ @@\ diff --git a/nx-X11/config/cf/lnxLib.rules b/nx-X11/config/cf/lnxLib.rules index fc60671ecb..928a4cd5a4 100644 --- a/nx-X11/config/cf/lnxLib.rules +++ b/nx-X11/config/cf/lnxLib.rules @@ -136,7 +136,8 @@ install:: Concat(lib,libname.so.rev) @@\ install:: Concat(lib,libname.so) @@\ MakeDir($(DESTDIR)dest) @@\ @set +e; SetRevisions(rev); \ @@\ - test -n "${VERBOSE}" && set -xe; \ @@\ + set -e; \ @@\ + test -n "${VERBOSE}" && set -x; \ @@\ $(INSTALL) $(INSTALLFLAGS) $(INSTBINFLAGS) Concat(lib,libname.so.$$MAJ.$$MIN) $(DESTDIR)dest; \ @@\ $(RM) Concat($(DESTDIR)dest/lib,libname.so.$$MAJ); \ @@\ $(LN) Concat(lib,libname.so.$$MAJ.$$MIN) Concat($(DESTDIR)dest/lib,libname.so.$$MAJ); \ @@\ @@ -207,7 +208,8 @@ Concat(lib,libname.so): solist $(EXTRALIBRARYDEPS) @@\ @@\ clean:: @@\ @set +e; SetRevisions(rev); \ @@\ - test -n "${VERBOSE}" && set -xe; \ @@\ + set -e; \ @@\ + test -n "${VERBOSE}" && set -xe; \ @@\ $(RM) Concat(lib,libname.so.$$MAJ); \ @@\ $(RM) Concat(lib,libname.so.$$MAJ.$$MIN) @@\ $(RM) Concat(lib,libname.so) From 834c50e10800a23efdfa537ed91dbaa548f8985d Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Sat, 11 May 2024 17:22:28 +0200 Subject: [PATCH 49/89] Revert "nx-X11/Makefile: pass down $(MFLAGS) to imake call, because... we probably want that. Likely." This commit breaks compilation because if compiled without VERBOSE we end up in imake -s -s xmakefile being called. See https://github.com/ArcticaProject/nx-libs/issues/1058#issuecomment-1564570705 As -s in imake defines and output file instead of the silencing the output it is called wrong. This reverts commit 72f11ee838e67757e235e7216fb82679cc3f7d67. Adresses ArcticaProject/nx-libs#1058 (part 2) --- nx-X11/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nx-X11/Makefile b/nx-X11/Makefile index 4249a710fc..364a3ac9f2 100644 --- a/nx-X11/Makefile +++ b/nx-X11/Makefile @@ -70,7 +70,7 @@ xmakefile: else \ exit 0; \ fi - which $(IMAKE) 1>/dev/null && $(IMAKE_CMD) $(MFLAGS) -s xmakefile -DTOPDIR=$(TOP) -DCURDIR=$(CURRENT_DIR) + which $(IMAKE) 1>/dev/null && $(IMAKE_CMD) -s xmakefile -DTOPDIR=$(TOP) -DCURDIR=$(CURRENT_DIR) # don't allow any default rules in this Makefile .SUFFIXES: From a7d2c5abdc8e1573aaec97bcc5912597be61f86c Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Sat, 11 May 2024 19:17:37 +0200 Subject: [PATCH 50/89] Xext/shape.c: remove one include Patch by realsimix: "Oneliner which was for some old distribution but works on all up to RHEL9." Mentioned in ArcticaProject/nx-libs#1054 --- nx-X11/programs/Xserver/Xext/shape.c | 1 - 1 file changed, 1 deletion(-) diff --git a/nx-X11/programs/Xserver/Xext/shape.c b/nx-X11/programs/Xserver/Xext/shape.c index 48a3e952d1..977254d2bb 100644 --- a/nx-X11/programs/Xserver/Xext/shape.c +++ b/nx-X11/programs/Xserver/Xext/shape.c @@ -55,7 +55,6 @@ in this Software without prior written authorization from The Open Group. #endif #include "protocol-versions.h" #include "regionstr.h" -#include "gcstruct.h" typedef RegionPtr (*CreateDftPtr)( WindowPtr /* pWin */ From 9f4119a6e032d2b86becf48def2de1d6a4c60565 Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Sat, 11 May 2024 19:24:28 +0200 Subject: [PATCH 51/89] fbbltone.c: Mark bitmasks as unsigned ints Backport of this commit: commit 1b2d17748f0154da142e9b421d4f6a46e4e5a18c Author: Alan Coopersmith Date: Sun May 22 13:50:14 2011 -0700 fbbltone.c: Mark bitmasks as unsigned ints Clears many Sun compiler warnings: "fbbltone.c", line 491: warning: integer overflow detected: op "<<" "fbbltone.c", line 491: warning: integer overflow detected: op "<<" "fbbltone.c", line 491: warning: integer overflow detected: op "<<" "fbbltone.c", line 491: warning: initializer will be sign-extended: -16777216 "fbbltone.c", line 491: warning: integer overflow detected: op "<<" "fbbltone.c", line 491: warning: initializer will be sign-extended: -1 "fbbltone.c", line 495: warning: integer overflow detected: op "<<" "fbbltone.c", line 495: warning: integer overflow detected: op "<<" "fbbltone.c", line 495: warning: integer overflow detected: op "<<" "fbbltone.c", line 495: warning: initializer will be sign-extended: -256 "fbbltone.c", line 495: warning: integer overflow detected: op "<<" "fbbltone.c", line 495: warning: initializer will be sign-extended: -1 "fbbltone.c", line 499: warning: integer overflow detected: op "<<" "fbbltone.c", line 499: warning: integer overflow detected: op "<<" "fbbltone.c", line 499: warning: integer overflow detected: op "<<" "fbbltone.c", line 499: warning: initializer will be sign-extended: -65536 "fbbltone.c", line 499: warning: integer overflow detected: op "<<" "fbbltone.c", line 499: warning: initializer will be sign-extended: -1 Signed-off-by: Alan Coopersmith Reviewed-by: Jamey Sharp Signed-off-by: Keith Packard --- nx-X11/programs/Xserver/fb/fbbltone.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/nx-X11/programs/Xserver/fb/fbbltone.c b/nx-X11/programs/Xserver/fb/fbbltone.c index f06357a372..72a1db766a 100644 --- a/nx-X11/programs/Xserver/fb/fbbltone.c +++ b/nx-X11/programs/Xserver/fb/fbbltone.c @@ -440,8 +440,8 @@ fbBltOne (FbStip *src, #define Mask24(x,r) (Mask24Pos(x,r) < FB_UNIT ? \ (Mask24Pos(x,r) < 0 ? \ - 0xffffff >> Mask24Neg (x,r) : \ - 0xffffff << Mask24Check(x,r)) : 0) + 0xffffffU >> Mask24Neg (x,r) : \ + 0xffffffU << Mask24Check(x,r)) : 0) #define SelMask24(b,n,r) ((((b) >> n) & 1) * Mask24(n,r)) From 01db94c2dd457d7632d8523e187f6bd4ea947fcd Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Sat, 11 May 2024 21:46:19 +0200 Subject: [PATCH 52/89] fb/fbbltone.c: fix shadowed variable --- nx-X11/programs/Xserver/fb/fbbltone.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/nx-X11/programs/Xserver/fb/fbbltone.c b/nx-X11/programs/Xserver/fb/fbbltone.c index 72a1db766a..e4bbe679c6 100644 --- a/nx-X11/programs/Xserver/fb/fbbltone.c +++ b/nx-X11/programs/Xserver/fb/fbbltone.c @@ -804,12 +804,12 @@ fbBltPlane (FbBits *src, #ifdef FB_24BIT if (srcBpp == 24) { - int w = 24; + int tmpw = 24; rot0 = FbFirst24Rot (srcX); - if (srcX + w > FB_UNIT) - w = FB_UNIT - srcX; - srcMaskFirst = FbRot24(pm,rot0) & FbBitsMask(srcX,w); + if (srcX + tmpw > FB_UNIT) + tmpw = FB_UNIT - srcX; + srcMaskFirst = FbRot24(pm,rot0) & FbBitsMask(srcX,tmpw); } else #endif From 7262bab6d624ca569b9dfecf1f473db78af10658 Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Sat, 11 May 2024 21:53:08 +0200 Subject: [PATCH 53/89] fbcompose.c: fix some shadowed variables --- nx-X11/programs/Xserver/fb/fbcompose.c | 60 +++++++++++++------------- 1 file changed, 30 insertions(+), 30 deletions(-) diff --git a/nx-X11/programs/Xserver/fb/fbcompose.c b/nx-X11/programs/Xserver/fb/fbcompose.c index 7699ae755c..d1eb729649 100644 --- a/nx-X11/programs/Xserver/fb/fbcompose.c +++ b/nx-X11/programs/Xserver/fb/fbcompose.c @@ -2758,10 +2758,10 @@ static void fbFetchSourcePict(PicturePtr pict, int x, int y, int width, CARD32 * if (v.vector[2] == 0) { t = 0; } else { - xFixed_48_16 x, y; - x = ((xFixed_48_16)v.vector[0] << 16) / v.vector[2]; - y = ((xFixed_48_16)v.vector[1] << 16) / v.vector[2]; - t = ((a*x + b*y) >> 16) + off; + xFixed_48_16 xx, yy; + xx = ((xFixed_48_16)v.vector[0] << 16) / v.vector[2]; + yy = ((xFixed_48_16)v.vector[1] << 16) / v.vector[2]; + t = ((a*xx + b*yy) >> 16) + off; } *buffer++ = gradientPixel(pGradient, t, pict->repeatType); v.vector[0] += unit.vector[0]; @@ -2815,18 +2815,18 @@ static void fbFetchSourcePict(PicturePtr pict, int x, int y, int width, CARD32 * } } else { while (buffer < end) { - double x, y; + double xx, yy; double b, c, det, s; if (rz != 0) { - x = rx/rz; - y = ry/rz; + xx = rx/rz; + yy = ry/rz; } else { - x = y = 0.; + xx = yy = 0.; } - x -= pGradient->radial.fx; - y -= pGradient->radial.fy; - b = 2*(x*pGradient->radial.dx + y*pGradient->radial.dy); - c = -(x*x + y*y); + xx -= pGradient->radial.fx; + yy -= pGradient->radial.fy; + b = 2*(xx*pGradient->radial.dx + yy*pGradient->radial.dy); + c = -(xx*xx + yy*yy); det = (b * b) - (4 * pGradient->radial.a * c); s = (-b + sqrt(det))/(2. * pGradient->radial.a); *buffer = gradientPixel(pGradient, @@ -2855,16 +2855,16 @@ static void fbFetchSourcePict(PicturePtr pict, int x, int y, int width, CARD32 * } else { while (buffer < end) { - double x, y, angle; + double xx, yy, angle; if (rz != 0) { - x = rx/rz; - y = ry/rz; + xx = rx/rz; + yy = ry/rz; } else { - x = y = 0.; + xx = yy = 0.; } - x -= pGradient->conical.center.x/65536.; - y -= pGradient->conical.center.y/65536.; - angle = atan2(y, x) + a; + xx -= pGradient->conical.center.x/65536.; + yy -= pGradient->conical.center.y/65536.; + angle = atan2(yy, xx) + a; *buffer = gradientPixel(pGradient, (xFixed_48_16) (angle * (65536. / (2*M_PI))), pict->repeatType); ++buffer; @@ -3268,37 +3268,37 @@ static void fbFetchTransformed(PicturePtr pict, int x, int y, int width, CARD32 xFixed *params = pict->filter_params; INT32 cwidth = xFixedToInt(params[0]); INT32 cheight = xFixedToInt(params[1]); - int xoff = params[0] >> 1; - int yoff = params[1] >> 1; + int xxoff = params[0] >> 1; + int yyoff = params[1] >> 1; params += 2; for (i = 0; i < width; ++i) { if (!v.vector[2]) { buffer[i] = 0; } else { - int x1, x2, y1, y2, x, y; + int x1, x2, y1, y2, xx, yy; INT32 srtot, sgtot, sbtot, satot; xFixed *p = params; if (!affine) { xFixed_48_16 tmp; - tmp = ((xFixed_48_16)v.vector[0] << 16)/v.vector[2] - xoff; + tmp = ((xFixed_48_16)v.vector[0] << 16)/v.vector[2] - xxoff; x1 = xFixedToInt(tmp); - tmp = ((xFixed_48_16)v.vector[1] << 16)/v.vector[2] - yoff; + tmp = ((xFixed_48_16)v.vector[1] << 16)/v.vector[2] - yyoff; y1 = xFixedToInt(tmp); } else { - x1 = xFixedToInt(v.vector[0] - xoff); - y1 = xFixedToInt(v.vector[1] - yoff); + x1 = xFixedToInt(v.vector[0] - xxoff); + y1 = xFixedToInt(v.vector[1] - yyoff); } x2 = x1 + cwidth; y2 = y1 + cheight; srtot = sgtot = sbtot = satot = 0; - for (y = y1; y < y2; y++) { - int ty = (pict->repeatType == RepeatNormal) ? MOD (y, pict->pDrawable->height) : y; - for (x = x1; x < x2; x++) { + for (yy = y1; yy < y2; yy++) { + int ty = (pict->repeatType == RepeatNormal) ? MOD (yy, pict->pDrawable->height) : yy; + for (xx = x1; xx < x2; xx++) { if (*p) { - int tx = (pict->repeatType == RepeatNormal) ? MOD (x, pict->pDrawable->width) : x; + int tx = (pict->repeatType == RepeatNormal) ? MOD (xx, pict->pDrawable->width) : xx; if (RegionContainsPoint(pict->pCompositeClip, tx + dx, ty + dy, &box)) { FbBits *b = bits + (ty + dy)*stride; CARD32 c = fetch(b, tx + dx, indexed); From 30eab489d57c63f1f315632644958838965e35a3 Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Sat, 11 May 2024 21:55:21 +0200 Subject: [PATCH 54/89] fbedgeimp.h: fix shadowed variable --- nx-X11/programs/Xserver/fb/fbedgeimp.h | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/nx-X11/programs/Xserver/fb/fbedgeimp.h b/nx-X11/programs/Xserver/fb/fbedgeimp.h index 6b363d7cec..59f7eed227 100644 --- a/nx-X11/programs/Xserver/fb/fbedgeimp.h +++ b/nx-X11/programs/Xserver/fb/fbedgeimp.h @@ -69,13 +69,12 @@ rasterizeEdges (FbBits *buf, FbBits *a = line; FbBits startmask, endmask; int nmiddle; - int width = rxi - lxi; int x = lxi; a += x >> FB_SHIFT; x &= FB_MASK; - FbMaskBits (x, width, startmask, nmiddle, endmask); + FbMaskBits (x, rxi - lxi, startmask, nmiddle, endmask); if (startmask) *a++ |= startmask; while (nmiddle--) From af86b33faf5fc6bfe26a4d4ed2d3aff069eeac62 Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Mon, 20 May 2024 01:23:55 +0200 Subject: [PATCH 55/89] Keyboard.c: fix typo --- nx-X11/programs/Xserver/hw/nxagent/Keyboard.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nx-X11/programs/Xserver/hw/nxagent/Keyboard.c b/nx-X11/programs/Xserver/hw/nxagent/Keyboard.c index 14a06e20f1..49f26252a5 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Keyboard.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Keyboard.c @@ -757,7 +757,7 @@ N/A { nxagentNumLockKeycode = 0; #ifdef TEST - fprintf(stderr, "%s: Numock key is mapped to some other modifier - disabling special treatment\n", __func__); + fprintf(stderr, "%s: NumLock key is mapped to some other modifier - disabling special treatment\n", __func__); #endif } } From 251fe32df4f29c156e3e5752dd4abeabff68ad1a Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Mon, 20 May 2024 12:09:58 +0200 Subject: [PATCH 56/89] Keyboard.c: fix wrong "rlmvo" keyword variable names and manpage were correct, but the code was not, it expected "rlmvo" instead of "rmlvo". Support the old (wrong) variant, too (but do not document it), since there might be users out there whose setup would break. --- nx-X11/programs/Xserver/hw/nxagent/Keyboard.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/nx-X11/programs/Xserver/hw/nxagent/Keyboard.c b/nx-X11/programs/Xserver/hw/nxagent/Keyboard.c index 49f26252a5..0d6dfb416d 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Keyboard.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Keyboard.c @@ -581,12 +581,13 @@ N/A The original nxagent only supports model/layout values here. It uses these values together with the default rules and empty variant and options. We use a more or less - compatible hack here: The special keyword rlmvo for model + compatible hack here: The special keyword rmlvo for model means that the layout part of the string will contain a full RMLVO config, separated by #, e.g. - rlmvo/base#pc105#de,us#nodeadkeys#lv3:rwin_switch + rmlvo/base#pc105#de,us#nodeadkeys#lv3:rwin_switch */ - if (strncmp(nxagentKeyboard, "rlmvo/", 6) == 0) + /* support "rlmvo" (spelled wrong) which was being used for some time */ + if ((strncmp(nxagentKeyboard, "rmlvo/", 6) == 0) || (strncmp(nxagentKeyboard, "rlmvo/", 6) == 0)) { const char * sep = "#"; char * rmlvo = strdup(&nxagentKeyboard[i+1]); From c9ac944fcffef84672eae9d176fea39de369f856 Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Mon, 20 May 2024 16:00:36 +0200 Subject: [PATCH 57/89] Clipboard.c: make it compile cleanly without NXAGENT_CLIPBOARD do not show warnings about unused functions --- nx-X11/programs/Xserver/hw/nxagent/Clipboard.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/nx-X11/programs/Xserver/hw/nxagent/Clipboard.c b/nx-X11/programs/Xserver/hw/nxagent/Clipboard.c index 91fe5679f9..2881a40318 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Clipboard.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Clipboard.c @@ -329,9 +329,11 @@ static void resetSelectionOwnerOnXServer(void); #endif static void initSelectionOwnerData(int index); static void clearSelectionOwnerData(int index); -static void storeSelectionOwnerData(int index, Selection *sel); static Bool matchSelectionOwner(int index, ClientPtr pClient, WindowPtr pWindow); +#ifdef NXAGENT_CLIPBOARD static void setSelectionOwnerOnXServer(Selection *pSelection); +static void storeSelectionOwnerData(int index, Selection *sel); +#endif static int sendEventToClient(ClientPtr client, xEvent *pEvents); static void sendSelectionNotifyEventToClient(ClientPtr client, Time time, @@ -709,6 +711,7 @@ static void clearSelectionOwnerData(int index) lastSelectionOwner[index].lastTimeChanged = ClientTimeToServerTime(CurrentTime); } +#ifdef NXAGENT_CLIPBOARD static void storeSelectionOwnerData(int index, Selection *sel) { lastSelectionOwner[index].client = sel->client; @@ -716,6 +719,7 @@ static void storeSelectionOwnerData(int index, Selection *sel) lastSelectionOwner[index].windowPtr = sel->pWin; lastSelectionOwner[index].lastTimeChanged = ClientTimeToServerTime(CurrentTime); } +#endif static Bool matchSelectionOwner(int index, ClientPtr pClient, WindowPtr pWindow) { @@ -2369,7 +2373,6 @@ void nxagentSetSelectionCallback(CallbackListPtr *callbacks, void *data, } } } -#endif /* * This is called from the nxagentSetSelectionCallback, so it is using @@ -2468,6 +2471,7 @@ FIXME2: instead of XGetSelectionOwner we could check if the Xfixes } */ } +#endif /* * This is called from dix (ProcConvertSelection) if an nxagent client From f94f6b9f0ca45f244daf1fd731bfc15dbccfbabc Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Tue, 21 May 2024 21:29:39 +0200 Subject: [PATCH 58/89] Keystroke.c: fix output of keystrokes list print a newline AFTER the list, not before. --- nx-X11/programs/Xserver/hw/nxagent/Keystroke.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nx-X11/programs/Xserver/hw/nxagent/Keystroke.c b/nx-X11/programs/Xserver/hw/nxagent/Keystroke.c index c9452f187b..7534d13a37 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Keystroke.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Keystroke.c @@ -544,7 +544,7 @@ char *nxagentFindMatchingKeystrokes(char *name) void nxagentDumpKeystrokes(void) { char *s = nxagentFindMatchingKeystrokes(""); - fprintf(stderr, "Currently known keystrokes:\n%s", s); + fprintf(stderr, "Currently known keystrokes:%s\n", s); SAFE_free(s); } From abc8f389feefea10ceb2d4a4c3b4e69d05dc5227 Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Tue, 21 May 2024 22:32:05 +0200 Subject: [PATCH 59/89] Keyboard.c: fix handling of keyboard=model/layout Did simply not work without passing the default strings. --- nx-X11/programs/Xserver/hw/nxagent/Keyboard.c | 23 +++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) diff --git a/nx-X11/programs/Xserver/hw/nxagent/Keyboard.c b/nx-X11/programs/Xserver/hw/nxagent/Keyboard.c index 0d6dfb416d..1465dd19b2 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Keyboard.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Keyboard.c @@ -763,14 +763,29 @@ N/A } } + /* FIXME: we should use the defaults here for any string that's empty. Unfortunately they are only set + in the Makefile in xkb directory, so we cannot simply refer to them here. Let's hardcode them for now. */ + #define XKB_DFLT_RULES_FILE "base" + #define XKB_DFLT_MODEL "pc102" + #define XKB_DFLT_LAYOUT "us" + #define XKB_DFLT_VARIANT "" + #define XKB_DFLT_OPTIONS "" + #ifdef DEBUG fprintf(stderr, "%s: Going to set rules and init device: " - "[rules='%s',model='%s',layout='%s',variant='%s',options='%s'].\n", __func__, - rules?rules:"(default)", model?model:"(default)", layout?layout:"(default)", - variant?variant:"(default)", options?options:"(default)"); + "[rules='%s', model='%s', layout='%s', variant='%s', options='%s'].\n", __func__, + rules ? rules : "<"XKB_DFLT_RULES_FILE ">", + model ? model : "<"XKB_DFLT_MODEL ">", + layout ? layout : "<"XKB_DFLT_LAYOUT ">", + variant ? variant : "<"XKB_DFLT_VARIANT ">", + options ? options : "<"XKB_DFLT_OPTIONS ">"); #endif - XkbSetRulesDflts(rules, model, layout, variant, options); + XkbSetRulesDflts(rules ? rules : XKB_DFLT_RULES_FILE, + model ? model : XKB_DFLT_MODEL, + layout ? layout : XKB_DFLT_LAYOUT, + variant ? variant : XKB_DFLT_VARIANT, + options ? options : XKB_DFLT_OPTIONS); XkbInitKeyboardDeviceStruct((void *)pDev, &names, &keySyms, modmap, nxagentBell, nxagentChangeKeyboardControl); From ee744cf9f93dc6ae2e5cfdb6644dc83d4f51a1f3 Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Tue, 21 May 2024 22:44:55 +0200 Subject: [PATCH 60/89] naxgent manpage: improve documentation for nx/nx options on the command line --- .../programs/Xserver/hw/nxagent/man/nxagent.1 | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/nx-X11/programs/Xserver/hw/nxagent/man/nxagent.1 b/nx-X11/programs/Xserver/hw/nxagent/man/nxagent.1 index 5f87fa8d45..4a3de4b7e6 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/man/nxagent.1 +++ b/nx-X11/programs/Xserver/hw/nxagent/man/nxagent.1 @@ -589,9 +589,24 @@ for all keystrokes \fBnxagent\fR knows. At startup the active keystrokes are pri show version information and exit .TP 8 .B \-options \fIfilepath|string\fP -path to an options file containing nx/nx options (see below). Instead of a path the options can be specified diretly on the commandline by prefixing the options strings with +path to an options file containing nx/nx options (see below). Instead of a path the options can be specified directly on the commandline by prefixing the options strings with one of .IR nx/nx, -which is mostly useful for testing/debugging. +.IR nx/nx: +.IR nx, +or +.IR nx: +(that's +.IR nx/nx +or +.IR nx +followed by comma or colon). Example: +.PPP + +.nf + $ nxagent -options nx/nx,keyboard=pc105/de :55 +.fi + +This is mostly useful for testing/debugging. .PP In addition to the command line options, \fBnxagent\fR can be configured at session startup and at runtime (i.e. when resuming a suspended session) From 7d8ea0b6f2135b36f0528ec3db79002f59859680 Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Tue, 21 May 2024 22:58:35 +0200 Subject: [PATCH 61/89] nxagent manpage: fix some obvious errors --- nx-X11/programs/Xserver/hw/nxagent/man/nxagent.1 | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/nx-X11/programs/Xserver/hw/nxagent/man/nxagent.1 b/nx-X11/programs/Xserver/hw/nxagent/man/nxagent.1 index 4a3de4b7e6..4f53a1df92 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/man/nxagent.1 +++ b/nx-X11/programs/Xserver/hw/nxagent/man/nxagent.1 @@ -268,7 +268,7 @@ starting \fBnxagent\fR. This option specifies the geometry parameters for the top-level \fBnxagent\fR window. See \(lqGEOMETRY SPECIFICATIONS\(rq in .BR X (__miscmansuffix__) -for a discusson of this option's syntax. This window corresponds to +for a discussion of this option's syntax. This window corresponds to the root window of the nested server. The width .I W and height @@ -466,7 +466,7 @@ The session id. enable autograb mode on \fBnxagent\fR startup. The autograb feature can be toggled via nxagent keystrokes .TP 8 .B \-textclipboard -force text-only clipboard \fBnxagent\fR startup. See option file +force text-only clipboard. See option file option \fBtextclipboard=\fR for an explanation. .TP 8 .B \-nxrealwindowprop @@ -511,7 +511,7 @@ nx/nx option on session resumption disable the use of the render extension .TP 8 .B \-nocomposite/-composite -disable/enable the use of the composite extension (default ist disabled) +disable/enable the use of the composite extension (default is disabled) .TP 8 .B \-nopersistent disable disconnection/reconnection to the X display on @@ -715,7 +715,7 @@ set keycode conversion mode by default (\fIauto\fR) \fBnxagent\fR will activate keycode conversion if it detects an evdev XKEYBOARD setup on the \fBnxproxy\fR side (the standard on Linux systems nowadays). Keycode conversion means that -certain keycodes are mapped to make the keyboard appear as an pc105 +certain keycodes are mapped to make the keyboard appear as a pc105 model. Using \fIoff\fR this conversion can be suppressed and with \fIon\fR it will be forced. From 99bee102279665e4c53eb6ddd51375e2b32d2a40 Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Tue, 21 May 2024 23:07:12 +0200 Subject: [PATCH 62/89] fix various spelling errors --- nx-X11/programs/Xserver/hw/nxagent/Atoms.c | 2 +- nx-X11/programs/Xserver/hw/nxagent/Atoms.h | 2 +- nx-X11/programs/Xserver/hw/nxagent/BitmapUtils.c | 2 +- nx-X11/programs/Xserver/hw/nxagent/Clipboard.c | 16 ++++++++-------- nx-X11/programs/Xserver/hw/nxagent/Events.c | 2 +- nx-X11/programs/Xserver/hw/nxagent/Options.h | 4 ++-- nx-X11/programs/Xserver/hw/nxagent/Pixmap.c | 2 +- nx-X11/programs/Xserver/hw/nxagent/Screen.c | 2 +- nx-X11/programs/Xserver/hw/nxagent/Trap.c | 4 ++-- nx-X11/programs/Xserver/hw/nxagent/Trap.h | 4 ++-- nx-X11/programs/Xserver/hw/nxagent/Window.c | 2 +- .../Xserver/hw/nxagent/compext/Compext.c | 4 ++-- 12 files changed, 23 insertions(+), 23 deletions(-) diff --git a/nx-X11/programs/Xserver/hw/nxagent/Atoms.c b/nx-X11/programs/Xserver/hw/nxagent/Atoms.c index a8d2e447ff..2ea2a1ba23 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Atoms.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Atoms.c @@ -433,7 +433,7 @@ static void nxagentWriteAtom(Atom local, XlibAtom remote, const char *string) #ifdef WARNING if (s == NULL) { - /* we only warn here, because s being NULL ist not problem, it + /* we only warn here, because s being NULL is not problem, it will only result in NULL being stored in the privAtomMap, which is perfectly legal. */ fprintf(stderr, "%s: Malloc failed.\n", __func__); diff --git a/nx-X11/programs/Xserver/hw/nxagent/Atoms.h b/nx-X11/programs/Xserver/hw/nxagent/Atoms.h index c8b059405b..a6934336ac 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Atoms.h +++ b/nx-X11/programs/Xserver/hw/nxagent/Atoms.h @@ -71,7 +71,7 @@ void nxagentWMDetect(void); XlibAtom nxagentMakeAtom(char *, unsigned, Bool); /* - * Converts local atoms to remote atoms and viceversa. + * Converts local atoms to remote atoms and vice-versa. */ Atom nxagentRemoteToLocalAtom(XlibAtom); diff --git a/nx-X11/programs/Xserver/hw/nxagent/BitmapUtils.c b/nx-X11/programs/Xserver/hw/nxagent/BitmapUtils.c index 567c1c3020..57b4406bcf 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/BitmapUtils.c +++ b/nx-X11/programs/Xserver/hw/nxagent/BitmapUtils.c @@ -32,7 +32,7 @@ in this Software without prior written authorization from The Open Group. * Derived from libXfont1's utilbitmap.c (available via fontmisc.h). */ -/* Utility functions for reformating font bitmaps */ +/* Utility functions for reformatting font bitmaps */ static const unsigned char _reverse_byte[0x100] = { 0x00, 0x80, 0x40, 0xc0, 0x20, 0xa0, 0x60, 0xe0, diff --git a/nx-X11/programs/Xserver/hw/nxagent/Clipboard.c b/nx-X11/programs/Xserver/hw/nxagent/Clipboard.c index 2881a40318..12b18e366b 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Clipboard.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Clipboard.c @@ -1973,14 +1973,14 @@ void nxagentHandleSelectionNotifyFromXServer(XEvent *X) #endif /* - * The state machine is able to work in two phases. In the first - * phase we get the size of property data, in the second we get - * the actual data. We save a round-trip by requesting a prede- - * termined amount of data in a single GetProperty and by discar- - * ding the remaining part. This is not the optimal solution (we - * could get the remaining part if it doesn't fit in a single - * reply) but, at least with text, it should work in most situa- - * tions. + * The state machine is able to work in two phases. In the + * first phase we get the size of property data, in the second + * we get the actual data. We save a round-trip by requesting + * a predetermined amount of data in a single GetProperty and + * by discar- ding the remaining part. This is not the optimal + * solution (we could get the remaining part if it doesn't fit + * in a single reply) but, at least with text, it should work + * in most situations. */ setClientSelectionStage(index, SelectionStageQueryData); diff --git a/nx-X11/programs/Xserver/hw/nxagent/Events.c b/nx-X11/programs/Xserver/hw/nxagent/Events.c index 4163c7b71b..a2087ead22 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Events.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Events.c @@ -117,7 +117,7 @@ /* debug individual subsystems */ #undef DEBUG_AUTOGRAB -/* aktivate subsystems if generic DEBUG is activated */ +/* activate subsystems if generic DEBUG is activated */ #ifdef DEBUG #ifndef DEBUG_AUTOGRAB #define DEBUG_AUTOGRAB diff --git a/nx-X11/programs/Xserver/hw/nxagent/Options.h b/nx-X11/programs/Xserver/hw/nxagent/Options.h index 951e3d697e..7e67c9d337 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Options.h +++ b/nx-X11/programs/Xserver/hw/nxagent/Options.h @@ -61,7 +61,7 @@ typedef enum _BackingStoreMode here means "nxclient": Enable or disable copy and paste operations from the user's desktop - to the NX session or vice versa. This option can take four values: + to the NX session or vice-versa. This option can take four values: client The content copied on the client can be pasted inside the NX session. @@ -70,7 +70,7 @@ typedef enum _BackingStoreMode on the client. both The copy & paste operations are allowed both between the - client and the NX session and viceversa. + client and the NX session and vice-versa. none The copy&paste operations between the client and the NX session are never allowed. diff --git a/nx-X11/programs/Xserver/hw/nxagent/Pixmap.c b/nx-X11/programs/Xserver/hw/nxagent/Pixmap.c index addc81b790..470c804e2e 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Pixmap.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Pixmap.c @@ -335,7 +335,7 @@ Bool nxagentDestroyPixmap(PixmapPtr pPixmap) { /* * For some pixmaps we receive the destroy only for the - * virtual. Infact to draw in the framebuffer we can use the + * virtual. In fact to draw in the framebuffer we can use the * virtual pixmap instead of the pointer to the real one. As the * virtual pixmap can collect references, we must transfer those * references to the real pixmap so we can continue as the destroy diff --git a/nx-X11/programs/Xserver/hw/nxagent/Screen.c b/nx-X11/programs/Xserver/hw/nxagent/Screen.c index fb530f7881..ac62b3d7a6 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Screen.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Screen.c @@ -558,7 +558,7 @@ void nxagentSetScreenSaverTime(void) * Returning False the SaveScreens() function (which calls this one) * tries to build a screen-saver creating a new window. In some cases * we do not want this so we return True. If we want the dix to take - * care fo blanking we return False. + * care of blanking we return False. */ static Bool nxagentSaveScreen(ScreenPtr pScreen, int what) { diff --git a/nx-X11/programs/Xserver/hw/nxagent/Trap.c b/nx-X11/programs/Xserver/hw/nxagent/Trap.c index aa2b15bc9e..4307322505 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Trap.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Trap.c @@ -35,8 +35,8 @@ Bool nxagentGCTrap = False; /* - * Set if we are enqueing an internal operation, CreateWindow and - * Reparent- Window. Used to remove any screen operation. + * Set if we are enqueuing an internal operation, CreateWindow and + * ReparentWindow. Used to remove any screen operation. */ Bool nxagentScreenTrap = False; diff --git a/nx-X11/programs/Xserver/hw/nxagent/Trap.h b/nx-X11/programs/Xserver/hw/nxagent/Trap.h index 80a88f223f..2f2ce86c58 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Trap.h +++ b/nx-X11/programs/Xserver/hw/nxagent/Trap.h @@ -43,8 +43,8 @@ extern Bool nxagentGCTrap; /* - * Set if we are enqueing an internal operation, CreateWindow and - * Reparent- Window. Used to remove any screen operation. + * Set if we are enqueuing an internal operation, CreateWindow and + * ReparentWindow. Used to remove any screen operation. */ extern Bool nxagentScreenTrap; diff --git a/nx-X11/programs/Xserver/hw/nxagent/Window.c b/nx-X11/programs/Xserver/hw/nxagent/Window.c index b84c71c102..75bdae510d 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Window.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Window.c @@ -2121,7 +2121,7 @@ void nxagentWindowExposures(WindowPtr pWin, RegionPtr pRgn, RegionPtr other_expo #endif /* - * The problem: we want to synthetize the expose events internally, so + * The problem: we want to synthesize the expose events internally, so * that we reduce the time between a window operation and the corresp- * onding graphical output, but at the same time we need to take care * of the remote exposures, as we need to handle those cases where our diff --git a/nx-X11/programs/Xserver/hw/nxagent/compext/Compext.c b/nx-X11/programs/Xserver/hw/nxagent/compext/Compext.c index e7955caca3..416135f27c 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/compext/Compext.c +++ b/nx-X11/programs/Xserver/hw/nxagent/compext/Compext.c @@ -2259,7 +2259,7 @@ NXPackedImage *NXPackImage(Display *dpy, XImage *src_image, unsigned int method) * Note that we save a new memory allocation * by using the same image as source and des- * tination. This means that PackImage() must - * be able to handle ovelapping areas. + * be able to handle overlapping areas. */ #ifdef TEST_IMAGE @@ -2428,7 +2428,7 @@ XImage *NXInPlacePackImage(Display *dpy, XImage *src_image, unsigned int method) * Note that we save a new memory allocation * by using the same image as source and des- * tination. This means that PackImage() must - * be able to handle ovelapping areas. + * be able to handle overlapping areas. */ #ifdef TEST_IMAGE From 18962d0ec2afce61fe87fd5f88ffe04a777c5254 Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Wed, 22 May 2024 00:39:06 +0200 Subject: [PATCH 63/89] Keyboard.c: use the correct mask for XkbGetKeyboard --- nx-X11/programs/Xserver/hw/nxagent/Keyboard.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nx-X11/programs/Xserver/hw/nxagent/Keyboard.c b/nx-X11/programs/Xserver/hw/nxagent/Keyboard.c index 1465dd19b2..5324eaf909 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Keyboard.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Keyboard.c @@ -708,7 +708,7 @@ N/A /* we don't need the remote keyboard information anymore */ nxagentXkbClearRemoteNames(); - xkb = XkbGetKeyboard(nxagentDisplay, XkbGBN_AllComponentsMask, XkbUseCoreKbd); + xkb = XkbGetKeyboard(nxagentDisplay, XkbAllComponentsMask, XkbUseCoreKbd); if (xkb && xkb->geom) { From 15849122e9096bc5c6a590c962d8e453931c40ca Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Thu, 23 May 2024 23:55:04 +0200 Subject: [PATCH 64/89] Events.c: fix two comments --- nx-X11/programs/Xserver/hw/nxagent/Events.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/nx-X11/programs/Xserver/hw/nxagent/Events.c b/nx-X11/programs/Xserver/hw/nxagent/Events.c index a2087ead22..d23419e466 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Events.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Events.c @@ -1083,7 +1083,7 @@ void nxagentDispatchEvents(PredicateFuncPtr predicate) * and generate a single pair. This is intended to reduce the * impact of the latency on the key auto-repeat, handled by * the remote X server. We may optionally do that only if the - * timestamps in the events show an exces- sive delay. + * timestamps in the events show an excessive delay. */ KeySym keysym = XKeycodeToKeysym(nxagentDisplay, X.xkey.keycode, 0); @@ -4270,7 +4270,7 @@ int nxagentClipAndSendExpose(WindowPtr pWin, void * ptr) /* * The miWindowExposures() clears out the region parameters, so - * the subtract ope- ration must be done before calling it. + * the subtract operation must be done before calling it. */ RegionSubtract(remoteExposeRgn, remoteExposeRgn, exposeRgn); From 8a8cd08e4e4e9e4ddff8f46fad69422065bc13d3 Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Sat, 1 Jun 2024 20:29:43 +0200 Subject: [PATCH 65/89] Events.c: improve debugging/testing output --- nx-X11/programs/Xserver/hw/nxagent/Events.c | 28 +++++++++++++-------- 1 file changed, 17 insertions(+), 11 deletions(-) diff --git a/nx-X11/programs/Xserver/hw/nxagent/Events.c b/nx-X11/programs/Xserver/hw/nxagent/Events.c index d23419e466..23902535c1 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Events.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Events.c @@ -919,7 +919,7 @@ void nxagentDispatchEvents(PredicateFuncPtr predicate) case PropertyNotify: { #ifdef TEST - fprintf(stderr, "%s: PropertyNotify on prop %d[%s] window %lx state %d\n", __func__, + fprintf(stderr, "%s: PropertyNotify on prop [%d][%s] window [0x%lx] state [%d]\n", __func__, (int)X.xproperty.atom, validateString(XGetAtomName(nxagentDisplay, X.xproperty.atom)), X.xproperty.window, X.xproperty.state); #endif @@ -1206,6 +1206,8 @@ FIXME: Don't enqueue the KeyRelease event if the key was not already { #ifdef NX_DEBUG_INPUT if (nxagentDebugInput) + #endif + #if defined(NX_DEBUG_INPUT) || defined(TEST) { fprintf(stderr, "%s: Going to handle new ButtonPress event.\n", __func__); } @@ -1305,6 +1307,8 @@ FIXME: Don't enqueue the KeyRelease event if the key was not already { #ifdef NX_DEBUG_INPUT if (nxagentDebugInput) + #endif + #if defined(NX_DEBUG_INPUT) || defined(TEST) { fprintf(stderr, "%s: Going to handle new ButtonRelease event.\n", __func__); } @@ -1440,6 +1444,8 @@ FIXME: Don't enqueue the KeyRelease event if the key was not already { #ifdef NX_DEBUG_INPUT if (nxagentDebugInput) + #endif + #if defined(NX_DEBUG_INPUT) || defined(TEST) { fprintf(stderr, "%s: Adding motion event [%d, %d] to the queue.\n", __func__, x.u.keyButtonPointer.rootX, x.u.keyButtonPointer.rootY); @@ -1880,7 +1886,7 @@ FIXME: Don't enqueue the KeyRelease event if the key was not already #ifdef DEBUG fprintf(stderr, "%s: Going to handle new Expose event.\n", __func__); - fprintf(stderr, "%s: WARNING! Received Expose event for drawable [%lx]" + fprintf(stderr, "%s: WARNING! Received Expose event for drawable [0x%lx]" " geometry [%d, %d, %d, %d] count [%d].\n", __func__, X.xexpose.window, X.xexpose.x, X.xexpose.y, X.xexpose.width, X.xexpose.height, X.xexpose.count); @@ -1896,7 +1902,7 @@ FIXME: Don't enqueue the KeyRelease event if the key was not already fprintf(stderr, "%s: Going to handle new GraphicsExpose event.\n", __func__); fprintf(stderr, "%s: WARNING! Received GraphicsExpose event " - "for drawable [%lx] geometry [%d, %d, %d, %d] count [%d].\n", __func__, + "for drawable [0x%lx] geometry [%d, %d, %d, %d] count [%d].\n", __func__, X.xgraphicsexpose.drawable, X.xgraphicsexpose.x, X.xgraphicsexpose.y, X.xgraphicsexpose.width, X.xgraphicsexpose.height, X.xgraphicsexpose.count); @@ -1910,7 +1916,7 @@ FIXME: Don't enqueue the KeyRelease event if the key was not already { #ifdef DEBUG fprintf(stderr, "%s: Going to handle new NoExpose event.\n", __func__); - fprintf(stderr, "%s: WARNING! Received NoExpose event for drawable [%lx].\n", __func__, X.xnoexpose.drawable); + fprintf(stderr, "%s: WARNING! Received NoExpose event for drawable [0x%lx].\n", __func__, X.xnoexpose.drawable); #endif break; @@ -2313,7 +2319,7 @@ int nxagentHandlePropertyNotify(XEvent *X) if (nxagentOption(Rootless) && !nxagentNotifyMatchChangeProperty((XPropertyEvent *) X)) { #ifdef TEST - fprintf(stderr, "%s: Property %ld on window %lx.\n", __func__, + fprintf(stderr, "%s: Property [%ld] on window [0x%lx].\n", __func__, X -> xproperty.atom, X -> xproperty.window); #endif @@ -2354,7 +2360,7 @@ int nxagentHandleExposeEvent(XEvent *X) #ifdef DEBUG fprintf(stderr, "%s: Checking remote expose events.\n", __func__); - fprintf(stderr, "%s: Looking for window id [%ld].\n", __func__, X -> xexpose.window); + fprintf(stderr, "%s: Looking for window id [0x%lx].\n", __func__, X -> xexpose.window); #endif Window window = X -> xexpose.window; @@ -2375,7 +2381,7 @@ FIXME: This can be maybe optimized by consuming the do { #ifdef DEBUG - fprintf(stderr, "%s: Adding event for window id [%ld].\n", __func__, X -> xexpose.window); + fprintf(stderr, "%s: Adding event for window id [0x%lx].\n", __func__, X -> xexpose.window); #endif box.x1 = pWin -> drawable.x + wBorderWidth(pWin) + X -> xexpose.x; @@ -2418,7 +2424,7 @@ FIXME: This can be maybe optimized by consuming the &pWin->drawable.pScreen->root->winSize); #ifdef DEBUG - fprintf(stderr, "%s: Sending events for window id [%ld].\n", __func__, X -> xexpose.window); + fprintf(stderr, "%s: Sending events for window id [0x%lx].\n", __func__, X -> xexpose.window); #endif /* @@ -2445,7 +2451,7 @@ FIXME: This can be maybe optimized by consuming the nxagentExposeQueue.exposures[index].remoteRegion, &sum); #ifdef TEST - fprintf(stderr, "%s: Added region for window [%u] to position [%d].\n", __func__, + fprintf(stderr, "%s: Added region for window [0x%x] to position [%d].\n", __func__, nxagentWindow(pWin), index); #endif @@ -3503,7 +3509,7 @@ int nxagentHandleReparentNotify(XEvent* X) WindowPtr pParent = nxagentWindowPtr(X -> xreparent.parent); WindowPtr pEvent = nxagentWindowPtr(X -> xreparent.event); - fprintf(stderr, "%s: event %p[%lx] window %p[%lx] parent %p[%lx] at (%d, %d)\n", __func__, + fprintf(stderr, "%s: event %p[%lx] window [%p][0x%lx] parent [%p][0x%lx] at (%d, %d)\n", __func__, (void*)pEvent, X -> xreparent.event, (void*)pWin, X -> xreparent.window, (void*)pParent, X -> xreparent.parent, X -> xreparent.x, X -> xreparent.y); } @@ -4508,7 +4514,7 @@ void ForwardClientMessage(ClientPtr client, xSendEventReq *stuff) if (pWin->drawable.id == pWin->drawable.pScreen->root->drawable.id) { #ifdef DEBUG - fprintf(stderr, "%s: dest [0x%x] window [0x%x] clmsg.type [%d]->[%d]\n", __func__, stuff->destination, stuff->event.u.clientMessage.window, stuff->event.u.clientMessage.u.l.type, nxagentLocalToRemoteAtom(stuff->event.u.clientMessage.u.l.type)); + fprintf(stderr, "%s: dest [0x%x] window [0x%x] clmsg.type [%d]->[%ld]\n", __func__, stuff->destination, stuff->event.u.clientMessage.window, stuff->event.u.clientMessage.u.l.type, nxagentLocalToRemoteAtom(stuff->event.u.clientMessage.u.l.type)); #endif XEvent X = {0}; From 924ace04f3dd7daea14a667f09c538ba3e0f2345 Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Sun, 2 Jun 2024 15:40:17 +0200 Subject: [PATCH 66/89] Render.c: improve DEBUG/TEST output --- nx-X11/programs/Xserver/hw/nxagent/Render.c | 223 ++++++++++---------- 1 file changed, 117 insertions(+), 106 deletions(-) diff --git a/nx-X11/programs/Xserver/hw/nxagent/Render.c b/nx-X11/programs/Xserver/hw/nxagent/Render.c index 98722e48a8..1a00370158 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Render.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Render.c @@ -202,7 +202,7 @@ nxagentCleanGlyphs(xGlyphInfo *gi, int height = gi -> height; #ifdef DEBUG - fprintf(stderr, "nxagentCleanGlyphs: Found a Glyph with Depth %d, width %d, pad %d.\n", + fprintf(stderr, "%s: Found a Glyph with Depth %d, width %d, pad %d.\n", __func__, depth, gi -> width, BitmapPad(dpy)); #endif @@ -217,9 +217,9 @@ nxagentCleanGlyphs(xGlyphInfo *gi, bytesToClean = bytesPerLine * height; #ifdef DUBUG - fprintf(stderr, "nxagentCleanGlyphs: Found glyph with depth 24, bytes to clean is %d" - "width in bits is %d bytes per line [%d] height [%d].\n", bytesToClean, - widthInBits, bytesPerLine, height); + fprintf(stderr, "%s: Found glyph with depth 24, bytes to clean is %d" + "width in bits is %d bytes per line [%d] height [%d].\n", __func__, + bytesToClean, widthInBits, bytesPerLine, height); #endif if (ImageByteOrder(dpy) == LSBFirst) @@ -238,7 +238,7 @@ nxagentCleanGlyphs(xGlyphInfo *gi, } #ifdef DUMP - fprintf(stderr, "nxagentCleanGlyphs: depth %d, bytesToClean %d, scanline: ", depth, bytesToClean); + fprintf(stderr, "%s: depth %d, bytesToClean %d, scanline: ", __func__, depth, bytesToClean); for (int i = 0; i < bytesPerLine; i++) { fprintf(stderr, "[%d]", images[i]); @@ -261,8 +261,8 @@ nxagentCleanGlyphs(xGlyphInfo *gi, bitsToClean = (bytesPerLine << 3) - (gi -> width); #ifdef DEBUG - fprintf(stderr, "nxagentCleanGlyphs: Found glyph with depth 1, width [%d], height [%d], bitsToClean [%d]," - " bytesPerLine [%d].\n", gi -> width, height, bitsToClean, bytesPerLine); + fprintf(stderr, "%s: Found glyph with depth 1, width [%d], height [%d], bitsToClean [%d]," + " bytesPerLine [%d].\n", __func__, gi -> width, height, bitsToClean, bytesPerLine); #endif bytesToClean = bitsToClean >> 3; @@ -270,8 +270,8 @@ nxagentCleanGlyphs(xGlyphInfo *gi, bitsToClean &= 7; #ifdef DEBUG - fprintf(stderr, "nxagentCleanGlyphs: bitsToClean &=7 is %d, bytesToCLean is %d." - " byte_order is %d, bitmap_bit_order is %d.\n", bitsToClean, bytesToClean, + fprintf(stderr, "%s: bitsToClean &=7 is %d, bytesToCLean is %d." + " byte_order is %d, bitmap_bit_order is %d.\n", __func__, bitsToClean, bytesToClean, ImageByteOrder(dpy), BitmapBitOrder(dpy)); #endif @@ -285,8 +285,8 @@ nxagentCleanGlyphs(xGlyphInfo *gi, images[i * bytesPerLine - j] = 0x00; #ifdef DEBUG - fprintf(stderr, "nxagentCleanGlyphs: byte_order == bitmap_bit_order, cleaning %d, i=%d, j=%d.\n" - , (i * bytesPerLine - j), i, j); + fprintf(stderr, "%s: byte_order == bitmap_bit_order, cleaning %d, i=%d, j=%d.\n", __func__, + (i * bytesPerLine - j), i, j); #endif } @@ -298,8 +298,8 @@ nxagentCleanGlyphs(xGlyphInfo *gi, images[i * bytesPerLine - j] = 0x00; #ifdef DEBUG - fprintf(stderr, "nxagentCleanGlyphs: byte_order %d, bitmap_bit_order %d, cleaning %d, i=%d, j=%d.\n" - , ImageByteOrder(dpy), BitmapBitOrder(dpy), (i * bytesPerLine - j), i, j); + fprintf(stderr, "%s: byte_order %d, bitmap_bit_order %d, cleaning %d, i=%d, j=%d.\n", __func__, + ImageByteOrder(dpy), BitmapBitOrder(dpy), (i * bytesPerLine - j), i, j); #endif } @@ -310,8 +310,8 @@ nxagentCleanGlyphs(xGlyphInfo *gi, images[i * bytesPerLine - j] &= 0xff << bitsToClean; #ifdef DEBUG - fprintf(stderr, "nxagentCleanGlyphs: byte_order MSBFirst, cleaning %d, i=%d, j=%d.\n" - , (i * bytesPerLine - j), i, j); + fprintf(stderr, "%s: byte_order MSBFirst, cleaning %d, i=%d, j=%d.\n", __func__, + (i * bytesPerLine - j), i, j); #endif } else @@ -319,14 +319,14 @@ nxagentCleanGlyphs(xGlyphInfo *gi, images[i * bytesPerLine - j] &= 0xff >> bitsToClean; #ifdef DEBUG - fprintf(stderr, "nxagentCleanGlyphs: byte_order LSBFirst, cleaning %d, i=%d, j=%d.\n" - , (i * bytesPerLine - j), i, j); + fprintf(stderr, "%s: byte_order LSBFirst, cleaning %d, i=%d, j=%d.\n", __func__, + (i * bytesPerLine - j), i, j); #endif } } #ifdef DUMP - fprintf(stderr, "nxagentCleanGlyphs: depth %d, bytesToClean %d, scanline: ", depth, bytesToClean); + fprintf(stderr, "%s: depth %d, bytesToClean %d, scanline: ", __func__, depth, bytesToClean); for (int i = 0; i < bytesPerLine; i++) { fprintf(stderr, "[%d]", images[i]); @@ -351,12 +351,12 @@ nxagentCleanGlyphs(xGlyphInfo *gi, bytesToClean = bytesPerLine - widthInBytes; #ifdef DEBUG - fprintf(stderr, "nxagentCleanGlyphs: nglyphs is %d, width of glyph in bits is %d, in bytes is %d.\n", + fprintf(stderr, "%s: nglyphs is %d, width of glyph in bits is %d, in bytes is %d.\n", __func__, nglyphs, widthInBits, widthInBytes); - fprintf(stderr, "nxagentCleanGlyphs: bytesPerLine is %d bytes, there are %d scanlines.\n", bytesPerLine, height); + fprintf(stderr, "%s: bytesPerLine is %d bytes, there are %d scanlines.\n", __func__, bytesPerLine, height); - fprintf(stderr, "nxagentCleanGlyphs: Bytes to clean for each scanline are %d.\n", bytesToClean); + fprintf(stderr, "%s: Bytes to clean for each scanline are %d.\n", __func__, bytesToClean); #endif if (bytesToClean > 0) @@ -368,12 +368,12 @@ nxagentCleanGlyphs(xGlyphInfo *gi, *(images + (bytesPerLine - i)) = 0; #ifdef DEBUG - fprintf(stderr, "nxagentCleanGlyphs: cleaned a byte.\n"); + fprintf(stderr, "%s: cleaned a byte.\n", __func__); #endif } #ifdef DUMP - fprintf(stderr, "nxagentCleanGlyphs: depth %d, bytesToClean %d, scanline: ", depth, bytesToClean); + fprintf(stderr, "%s: depth %d, bytesToClean %d, scanline: ", __func__, depth, bytesToClean); for (int i = 0; i < bytesPerLine; i++) { fprintf(stderr, "[%d]", images[i]); @@ -390,13 +390,13 @@ nxagentCleanGlyphs(xGlyphInfo *gi, nglyphs--; #ifdef DEBUG - fprintf(stderr, "nxagentCleanGlyphs: Breaking Out.\n"); + fprintf(stderr, "%s: Breaking Out.\n", __func__); #endif } else if (depth == 32) { #ifdef DEBUG - fprintf(stderr, "nxagentCleanGlyphs: Found glyph with depth 32.\n"); + fprintf(stderr, "%s: Found glyph with depth 32.\n", __func__); #endif gi++; @@ -406,7 +406,7 @@ nxagentCleanGlyphs(xGlyphInfo *gi, else { #ifdef WARNING - fprintf(stderr, "nxagentCleanGlyphs: Unrecognized glyph, depth is not 8/16/24/32, it appears to be %d.\n", + fprintf(stderr, "%s: Unrecognized glyph, depth is not 8/16/24/32, it appears to be %d.\n", __func__, depth); #endif @@ -441,8 +441,8 @@ void nxagentRenderExtensionInit(void) minor_version > SERVER_RENDER_MINOR_VERSION)) { #ifdef TEST - fprintf(stderr, "nxagentRenderExtensionInit: Using render version [%d.%d] with " - "remote version [%d.%d].\n", SERVER_RENDER_MAJOR_VERSION, SERVER_RENDER_MINOR_VERSION, + fprintf(stderr, "%s: Using render version [%d.%d] with " + "remote version [%d.%d].\n", __func__, SERVER_RENDER_MAJOR_VERSION, SERVER_RENDER_MINOR_VERSION, major_version, minor_version); #endif @@ -467,8 +467,8 @@ void nxagentRenderExtensionInit(void) else { #ifdef TEST - fprintf(stderr, "nxagentRenderExtensionInit: Local render version %d.%d " - "matches remote version %d.%d.\n", SERVER_RENDER_MAJOR_VERSION, SERVER_RENDER_MINOR_VERSION, + fprintf(stderr, "%s: Local render version %d.%d " + "matches remote version %d.%d.\n", __func__, SERVER_RENDER_MAJOR_VERSION, SERVER_RENDER_MINOR_VERSION, major_version, minor_version); #endif @@ -546,7 +546,7 @@ int nxagentCreatePicture(PicturePtr pPicture, Mask mask) unsigned long valuemask=0; #ifdef DEBUG - fprintf(stderr, "nxagentCreatePicture: Function called with picture at [%p] and mask [%ld].\n", + fprintf(stderr, "%s: Function called with picture at [%p] and mask [%ld].\n", __func__, (void *) pPicture, mask); #endif @@ -561,16 +561,16 @@ int nxagentCreatePicture(PicturePtr pPicture, Mask mask) { if (nxagentIsShmPixmap((PixmapPtr)pPicture -> pDrawable)) { - fprintf (stderr, "nxagentCreatePicture: Picture uses a shared pixmap.\n"); + fprintf (stderr, "%s: Picture uses a shared pixmap.\n", __func__); } else { - fprintf (stderr, "nxagentCreatePicture: Picture uses a plain pixmap.\n"); + fprintf (stderr, "%s: Picture uses a plain pixmap.\n", __func__); } } else { - fprintf (stderr, "nxagentCreatePicture: Picture uses a window.\n"); + fprintf (stderr, "%s: Picture uses a window.\n", __func__); } #endif @@ -674,6 +674,10 @@ int nxagentCreatePicture(PicturePtr pPicture, Mask mask) XRenderPictFormat *pForm = NULL; + #ifdef DEBUG + fprintf(stderr, "%s: picture format [0x%lx]\n", __func__, pPicture->pFormat); + #endif + if (pPicture -> pFormat != NULL) { pForm = nxagentMatchingFormats(pPicture -> pFormat); @@ -682,7 +686,7 @@ int nxagentCreatePicture(PicturePtr pPicture, Mask mask) if (pForm == NULL) { - fprintf(stderr, "nxagentCreatePicture: WARNING! The requested format was not found.\n"); + fprintf(stderr, "%s: WARNING! The requested format was not found.\n", __func__); return 0; } @@ -693,7 +697,7 @@ int nxagentCreatePicture(PicturePtr pPicture, Mask mask) &attributes); #ifdef TEST - fprintf(stderr, "nxagentCreatePicture: Created picture at [%p] with drawable at [%p].\n", + fprintf(stderr, "%s: Created picture at [%p] with drawable at [%p].\n", __func__, (void *) pPicture, (void *) pPicture -> pDrawable); #endif @@ -739,7 +743,7 @@ XRenderPictFormat *nxagentMatchingFormats(PictFormatPtr pFormat) } #ifdef DEBUG - fprintf(stderr, "nxagentMatchingFormats: The requested format was not found.\n"); + fprintf(stderr, "%s: The requested format was not found.\n", __func__); #endif return NULL; @@ -753,7 +757,7 @@ void nxagentDestroyPicture(PicturePtr pPicture) } #ifdef TEST - fprintf(stderr, "nxagentDestroyPicture: Going to destroy picture at [%p].\n", + fprintf(stderr, "%s: Going to destroy picture at [%p].\n", __func__, (void *) pPicture); #endif @@ -769,13 +773,13 @@ int nxagentChangePictureClip(PicturePtr pPicture, int clipType, int nRects, xRectangle *rects, int xOrigin, int yOrigin) { #ifdef TEST - fprintf(stderr, "nxagentChangePictureClip: Going to change clip of picture at [%p].\n", + fprintf(stderr, "%s: Going to change clip of picture at [%p].\n", __func__, (void *) pPicture); #endif #ifdef DEBUG - fprintf(stderr, "nxagentChangePictureClip: clipType [%d] nRects [%d] xRectangle [%p] " - "xOrigin [%d] yOrigin [%d].\n", clipType, nRects, (void *) rects, xOrigin, yOrigin); + fprintf(stderr, "%s: clipType [%d] nRects [%d] xRectangle [%p] " + "xOrigin [%d] yOrigin [%d].\n", __func__, clipType, nRects, (void *) rects, xOrigin, yOrigin); #endif if (pPicture == NULL) @@ -788,7 +792,7 @@ int nxagentChangePictureClip(PicturePtr pPicture, int clipType, int nRects, case CT_PIXMAP: { #ifdef DEBUG - fprintf(stderr, "nxagentChangePictureClip: Clip type is [CT_PIXMAP].\n"); + fprintf(stderr, "%s: Clip type is [CT_PIXMAP].\n", __func__); #endif /* @@ -824,7 +828,7 @@ FIXME: Is this useful or just a waste of bandwidth? case CT_NONE: { #ifdef DEBUG - fprintf(stderr, "nxagentChangePictureClip: Clip type is [CT_NONE].\n"); + fprintf(stderr, "%s: Clip type is [CT_NONE].\n", __func__); #endif /* FIXME: Is this useful or just a waste of bandwidth? @@ -857,7 +861,7 @@ FIXME: Is this useful or just a waste of bandwidth? int index; #ifdef DEBUG - fprintf(stderr, "nxagentChangePictureClip: Clip type is [CT_REGION].\n"); + fprintf(stderr, "%s: Clip type is [CT_REGION].\n", __func__); #endif reg = XCreateRegion(); @@ -897,7 +901,7 @@ FIXME: Is this useful or just a waste of bandwidth? default: { #ifdef DEBUG - fprintf(stderr, "nxagentChangePictureClip: clipType not found\n"); + fprintf(stderr, "%s: clipType not found\n", __func__); #endif break; @@ -913,7 +917,7 @@ void nxagentChangePicture(PicturePtr pPicture, Mask mask) unsigned long valuemask = 0; #ifdef DEBUG - fprintf(stderr, "nxagentChangePicture: Going to change picture at [%p] with mask [%ld].\n", + fprintf(stderr, "%s: Going to change picture at [%p] with mask [%ld].\n", __func__, (void *) pPicture, mask); #endif @@ -1061,7 +1065,7 @@ void nxagentChangePicture(PicturePtr pPicture, Mask mask) #ifdef TEST if (pPicture && pPicture->pDrawable && pPicture -> pDrawable -> type == DRAWABLE_PIXMAP) { - fprintf(stderr, "nxagentChangePicture: %sPixmap [%p] Picture [%p][%p].\n", + fprintf(stderr, "%s: %sPixmap [%p] Picture [%p][%p].\n", __func__, nxagentIsShmPixmap((PixmapPtr)pPicture -> pDrawable) ? "Shared " : "", (void *) pPicture -> pDrawable, (void *) nxagentPicturePriv(pPicture) -> picture, (void *) pPicture); @@ -1085,7 +1089,7 @@ FIXME: Is this useful or just a waste of bandwidth? #ifdef TEST else { - fprintf(stderr, "nxagentChangePicture: Skipping change of picture [%p] on remote X server.\n", + fprintf(stderr, "%s: Skipping change of picture [%p] on remote X server.\n", __func__, (void *) pPicture); } #endif @@ -1100,6 +1104,9 @@ void nxagentComposite(CARD8 op, PicturePtr pSrc, PicturePtr pMask, PicturePtr pD INT16 xSrc, INT16 ySrc, INT16 xMask, INT16 yMask, INT16 xDst, INT16 yDst, CARD16 width, CARD16 height) { + #ifdef DEBUG + fprintf(stderr, "%s: entering...\n", __func__); + #endif if (pSrc == NULL || pDst == NULL) { return; @@ -1108,7 +1115,7 @@ void nxagentComposite(CARD8 op, PicturePtr pSrc, PicturePtr pMask, PicturePtr pD #ifdef DEBUG if (pSrc && pSrc -> pDrawable != NULL) { - fprintf(stderr, "nxagentComposite: Source Picture [%lu][%p] with drawable [%s%s][%p].\n", + fprintf(stderr, "%s: Source Picture [%lu][%p] with drawable [%s%s][%p].\n", __func__, nxagentPicturePriv(pSrc) -> picture, (void *) pSrc, (pSrc -> pDrawable -> type == DRAWABLE_PIXMAP && nxagentIsShmPixmap((PixmapPtr) pSrc -> pDrawable)) ? "Shared " : "", @@ -1117,7 +1124,7 @@ void nxagentComposite(CARD8 op, PicturePtr pSrc, PicturePtr pMask, PicturePtr pD } if (pDst && pDst->pDrawable) { - fprintf(stderr, "nxagentComposite: Destination Picture [%lu][%p] with drawable [%s%s][%p].\n", + fprintf(stderr, "%s: Destination Picture [%lu][%p] with drawable [%s%s][%p].\n", __func__, nxagentPicturePriv(pDst) -> picture, (void *) pDst, (pDst -> pDrawable -> type == DRAWABLE_PIXMAP && nxagentIsShmPixmap((PixmapPtr) pDst -> pDrawable)) ? "Shared " : "", @@ -1127,7 +1134,7 @@ void nxagentComposite(CARD8 op, PicturePtr pSrc, PicturePtr pMask, PicturePtr pD if (pMask && pMask->pDrawable) { - fprintf(stderr, "nxagentComposite: Mask Picture [%lu][%p] with drawable [%s%s][%p].\n", + fprintf(stderr, "%s: Mask Picture [%lu][%p] with drawable [%s%s][%p].\n", __func__, nxagentPicturePriv(pMask) -> picture, (void *) pMask, (pMask -> pDrawable -> type == DRAWABLE_PIXMAP && nxagentIsShmPixmap((PixmapPtr) pMask -> pDrawable)) ? "Shared " : "", @@ -1142,8 +1149,8 @@ void nxagentComposite(CARD8 op, PicturePtr pSrc, PicturePtr pMask, PicturePtr pD #ifdef TEST if ((pDstRegion) && (pDst && pDst->pDrawable)) { - fprintf(stderr, "nxagentComposite: WARNING! Prevented operation on region [%d,%d,%d,%d] " - "for drawable at [%p] with type [%s].\n", pDstRegion -> extents.x1, + fprintf(stderr, "%s: WARNING! Prevented operation on region [%d,%d,%d,%d] " + "for drawable at [%p] with type [%s].\n", __func__, pDstRegion -> extents.x1, pDstRegion -> extents.y1, pDstRegion -> extents.x2, pDstRegion -> extents.y2, (void *) pDst -> pDrawable, pDst -> pDrawable -> type == DRAWABLE_PIXMAP ? "pixmap" : "window"); @@ -1171,7 +1178,7 @@ void nxagentComposite(CARD8 op, PicturePtr pSrc, PicturePtr pMask, PicturePtr pD if (nxagentDrawableStatus(pSrc -> pDrawable) == NotSynchronized) { #ifdef TEST - fprintf(stderr, "nxagentComposite: Synchronizing the source drawable [%p].\n", + fprintf(stderr, "%s: Synchronizing the source drawable [%p].\n", __func__, (void *) pSrc -> pDrawable); #endif @@ -1186,7 +1193,7 @@ void nxagentComposite(CARD8 op, PicturePtr pSrc, PicturePtr pMask, PicturePtr pD if (nxagentDrawableStatus(pDst -> pDrawable) == NotSynchronized) { #ifdef TEST - fprintf(stderr, "nxagentComposite: Synchronizing the destination drawable [%p].\n", + fprintf(stderr, "%s: Synchronizing the destination drawable [%p].\n", __func__, (void *) pDst -> pDrawable); #endif @@ -1203,7 +1210,7 @@ void nxagentComposite(CARD8 op, PicturePtr pSrc, PicturePtr pMask, PicturePtr pD if (nxagentDrawableStatus(pMask -> pDrawable) == NotSynchronized) { #ifdef TEST - fprintf(stderr, "nxagentComposite: Synchronizing the mask drawable [%p].\n", + fprintf(stderr, "%s: Synchronizing the mask drawable [%p].\n", __func__, (void *) pMask -> pDrawable); #endif @@ -1264,7 +1271,7 @@ void nxagentGlyphs(CARD8 op, PicturePtr pSrc, PicturePtr pDst, #ifdef TEST if ((pSrc && pSrc->pDrawable) && (pDst && pDst->pDrawable)) { - fprintf(stderr, "nxagentGlyphs: Called with source [%s][%p] destination [%s][%p] and size id [%d].\n", + fprintf(stderr, "%s: Called with source [%s][%p] destination [%s][%p] and size id [%d].\n", __func__, (pSrc -> pDrawable -> type == DRAWABLE_PIXMAP ? "pixmap" : "window"), (void *) pSrc, (pDst -> pDrawable -> type == DRAWABLE_PIXMAP ? "pixmap" : "window"), (void *) pDst, sizeID); @@ -1317,12 +1324,12 @@ void nxagentGlyphs(CARD8 op, PicturePtr pSrc, PicturePtr pDst, if (pDst -> pDrawable -> type == DRAWABLE_WINDOW) { RegionPtr pRegion = nxagentCreateRegion(pDst -> pDrawable, NULL, glyphBox.x1, glyphBox.y1, - glyphBox.x2 - glyphBox.x1, glyphBox.y2 - glyphBox.y1); + glyphBox.x2 - glyphBox.x1, glyphBox.y2 - glyphBox.y1); if (RegionNil(pRegion)) { #ifdef TEST - fprintf(stderr, "nxagentGlyphs: WARNING! Glyphs prevented on hidden window at [%p].\n", + fprintf(stderr, "%s: WARNING! Glyphs prevented on hidden window at [%p].\n", __func__, (void *) pDst -> pDrawable); #endif @@ -1344,7 +1351,7 @@ void nxagentGlyphs(CARD8 op, PicturePtr pSrc, PicturePtr pDst, { #ifdef TEST if (pSrc && pSrc->pDrawable) { - fprintf(stderr, "nxagentGlyphs: Synchronizing source [%s] at [%p].\n", + fprintf(stderr, "%s Synchronizing source [%s] at [%p].\n", __func__, pSrc -> pDrawable -> type == DRAWABLE_PIXMAP ? "pixmap" : "window", (void *) pSrc -> pDrawable); } @@ -1360,8 +1367,8 @@ void nxagentGlyphs(CARD8 op, PicturePtr pSrc, PicturePtr pDst, { #ifdef DEBUG if (pSrc && pSrc->pDrawable) { - fprintf(stderr, "nxagentGlyphs: Synchronizing source [%s] at [%p] " - "with geometry [%d,%d,%d,%d].\n", + fprintf(stderr, "%s Synchronizing source [%s] at [%p] " + "with geometry [%d,%d,%d,%d].\n", __func__, (pSrc -> pDrawable -> type == DRAWABLE_PIXMAP ? "pixmap" : "window"), (void *) pSrc -> pDrawable, pSrc -> pDrawable -> x, pSrc -> pDrawable -> y, pSrc -> pDrawable -> x + pSrc -> pDrawable -> width, @@ -1375,8 +1382,8 @@ void nxagentGlyphs(CARD8 op, PicturePtr pSrc, PicturePtr pDst, { #ifdef DEBUG if (pSrc && pSrc->pDrawable) { - fprintf(stderr, "nxagentGlyphs: Synchronizing region [%d,%d,%d,%d] of source [%s] at [%p] " - "with geometry [%d,%d,%d,%d].\n", glyphBox.x1, glyphBox.y1, glyphBox.x2, glyphBox.y2, + fprintf(stderr, "%s Synchronizing region [%d,%d,%d,%d] of source [%s] at [%p] " + "with geometry [%d,%d,%d,%d].\n", __func__, glyphBox.x1, glyphBox.y1, glyphBox.x2, glyphBox.y2, (pSrc -> pDrawable -> type == DRAWABLE_PIXMAP ? "pixmap" : "window"), (void *) pSrc -> pDrawable, pSrc -> pDrawable -> x, pSrc -> pDrawable -> y, pSrc -> pDrawable -> x + pSrc -> pDrawable -> width, @@ -1398,7 +1405,7 @@ void nxagentGlyphs(CARD8 op, PicturePtr pSrc, PicturePtr pDst, { #ifdef TEST if (pDst && pDst->pDrawable) { - fprintf(stderr, "nxagentGlyphs: Synchronizing destination [%s] at [%p].\n", + fprintf(stderr, "%s Synchronizing destination [%s] at [%p].\n", __func__, pDst -> pDrawable -> type == DRAWABLE_PIXMAP ? "pixmap" : "window", (void *) pDst -> pDrawable); } @@ -1408,8 +1415,8 @@ void nxagentGlyphs(CARD8 op, PicturePtr pSrc, PicturePtr pDst, { #ifdef DEBUG if (pDst && pDst->pDrawable) { - fprintf(stderr, "nxagentGlyphs: Synchronizing destination [%s] at [%p] " - "with geometry [%d,%d,%d,%d].\n", + fprintf(stderr, "%s Synchronizing destination [%s] at [%p] " + "with geometry [%d,%d,%d,%d].\n", __func__, (pDst -> pDrawable -> type == DRAWABLE_PIXMAP ? "pixmap" : "window"), (void *) pDst -> pDrawable, pDst -> pDrawable -> x, pDst -> pDrawable -> y, pDst -> pDrawable -> x + pDst -> pDrawable -> width, @@ -1423,8 +1430,8 @@ void nxagentGlyphs(CARD8 op, PicturePtr pSrc, PicturePtr pDst, { #ifdef DEBUG if (pDst && pDst->pDrawable) { - fprintf(stderr, "nxagentGlyphs: Synchronizing region [%d,%d,%d,%d] of destination [%s] at [%p] " - "with geometry [%d,%d,%d,%d].\n", glyphBox.x1, glyphBox.y1, glyphBox.x2, glyphBox.y2, + fprintf(stderr, "%s Synchronizing region [%d,%d,%d,%d] of destination [%s] at [%p] " + "with geometry [%d,%d,%d,%d].\n", __func__, glyphBox.x1, glyphBox.y1, glyphBox.x2, glyphBox.y2, (pDst -> pDrawable -> type == DRAWABLE_PIXMAP ? "pixmap" : "window"), (void *) pDst -> pDrawable, pDst -> pDrawable -> x, pDst -> pDrawable -> y, pDst -> pDrawable -> x + pDst -> pDrawable -> width, @@ -1445,7 +1452,7 @@ void nxagentGlyphs(CARD8 op, PicturePtr pSrc, PicturePtr pDst, #ifdef TEST if (pDst && pDst->pDrawable) { - fprintf(stderr, "nxagentGlyphs: Glyph flag set on drawable [%s][%p].\n", + fprintf(stderr, "%s Glyph flag set on drawable [%s][%p].\n", __func__, pDst -> pDrawable -> type == DRAWABLE_PIXMAP ? "pixmap" : "window", (void *) pDst -> pDrawable); } @@ -1475,7 +1482,7 @@ void nxagentGlyphs(CARD8 op, PicturePtr pSrc, PicturePtr pDst, y = elements -> yOff; #ifdef TEST - fprintf(stderr, "nxagentGlyphs: Element [%d] of [%d] has offset [%d,%d].\n", + fprintf(stderr, "%s Element [%d] of [%d] has offset [%d,%d].\n", __func__, j, nlists, elements -> xOff, elements -> yOff); #endif @@ -1487,8 +1494,8 @@ void nxagentGlyphs(CARD8 op, PicturePtr pSrc, PicturePtr pDst, y += glyph -> info.yOff; #ifdef TEST - fprintf(stderr, "nxagentGlyphs: Glyph at index [%d] has offset [%d,%d] and " - "position [%d,%d].\n", i, elements -> nchars, glyph -> info.xOff, + fprintf(stderr, "%s Glyph at index [%d] has offset [%d,%d] and " + "position [%d,%d].\n", __func__, i, elements -> nchars, glyph -> info.xOff, glyph -> info.yOff, x, y); #endif } @@ -1499,7 +1506,7 @@ void nxagentGlyphs(CARD8 op, PicturePtr pSrc, PicturePtr pDst, elements -> yOff += y; #ifdef TEST - fprintf(stderr, "nxagentGlyphs: New offset for list at [%p] is [%d,%d].\n", + fprintf(stderr, "%s New offset for list at [%p] is [%d,%d].\n", __func__, elements, elements -> xOff, elements -> yOff); #endif } @@ -1584,7 +1591,7 @@ void nxagentGlyphs(CARD8 op, PicturePtr pSrc, PicturePtr pDst, default: { #ifdef WARNING - fprintf(stderr, "nxagentGlyphs: WARNING! Invalid size id [%d].\n", + fprintf(stderr, "%s WARNING! Invalid size id [%d].\n", sizeID); #endif break; @@ -1657,7 +1664,7 @@ void nxagentGlyphs(CARD8 op, PicturePtr pSrc, PicturePtr pDst, default: { #ifdef WARNING - fprintf(stderr, "nxagentGlyphs: WARNING! Invalid size id [%d].\n", + fprintf(stderr, "%s WARNING! Invalid size id [%d].\n", __func__, sizeID); #endif break; @@ -1669,6 +1676,10 @@ void nxagentGlyphs(CARD8 op, PicturePtr pSrc, PicturePtr pDst, void nxagentCompositeRects(CARD8 op, PicturePtr pDst, xRenderColor *color, int nRect, xRectangle *rects) { + #ifdef DEBUG + fprintf(stderr, "%s: entering...\n", __func__); + #endif + if (pDst == NULL) { return; @@ -1676,7 +1687,7 @@ void nxagentCompositeRects(CARD8 op, PicturePtr pDst, xRenderColor *color, #ifdef TEST if (pDst && pDst->pDrawable) { - fprintf(stderr, "nxagentCompositeRects: Called for picture at [%p] with [%s] at [%p].\n", + fprintf(stderr, "%s: Called for picture at [%p] with [%s] at [%p].\n", __func__, (void *) pDst, (pDst -> pDrawable -> type == DRAWABLE_PIXMAP ? "pixmap" : "window"), (void *) pDst -> pDrawable); } @@ -1714,7 +1725,7 @@ void nxagentCompositeRects(CARD8 op, PicturePtr pDst, xRenderColor *color, } #ifdef TEST - fprintf(stderr, "nxagentCompositeRects: Going to clean the drawable with extents [%d,%d,%d,%d].\n", + fprintf(stderr, "%s: Going to clean the drawable with extents [%d,%d,%d,%d].\n", __func__, rectRegion -> extents.x1, rectRegion -> extents.y1, rectRegion -> extents.x2, rectRegion -> extents.y2); #endif @@ -1744,8 +1755,8 @@ void nxagentTrapezoids(CARD8 op, PicturePtr pSrc, PicturePtr pDst, int remaining = ntrap; #ifdef TEST - fprintf(stderr, "nxagentTrapezoids: Source [%p] destination [%p] coordinates " - "[%d,%d] elements [%d].\n", (void *) pSrc, (void *) pDst, + fprintf(stderr, "%s: Source [%p] destination [%p] coordinates " + "[%d,%d] elements [%d].\n", __func__, (void *) pSrc, (void *) pDst, xSrc, ySrc, ntrap); #endif @@ -1775,13 +1786,13 @@ FIXME: Is this useful or just a waste of bandwidth? #ifdef TEST if (pSrc->pDrawable) { - fprintf(stderr, "nxagentTrapezoids: Source is a [%s] of geometry [%d,%d].\n", + fprintf(stderr, "%s: Source is a [%s] of geometry [%d,%d].\n", __func__, (pSrc -> pDrawable -> type == DRAWABLE_PIXMAP ? "pixmap" : "window"), pSrc -> pDrawable -> width, pSrc -> pDrawable -> height); } if (pSrc ->pDrawable != pDst -> pDrawable) { - fprintf(stderr, "nxagentTrapezoids: Destination is a [%s] of geometry [%d,%d].\n", + fprintf(stderr, "%s: Destination is a [%s] of geometry [%d,%d].\n", __func__, (pDst -> pDrawable -> type == DRAWABLE_PIXMAP ? "pixmap" : "window"), pDst -> pDrawable -> width, pDst -> pDrawable -> height); } @@ -1799,8 +1810,8 @@ FIXME: Is this useful or just a waste of bandwidth? { #ifdef TEST if (pDst && pDst->pDrawable) { - fprintf(stderr, "nxagentTrapezoids: WARNING! Prevented operation on region [%d,%d,%d,%d] already dirty " - "for drawable [%s][%p].\n", nxagentTrapezoidExtents -> x1, nxagentTrapezoidExtents -> y1, + fprintf(stderr, "%s: WARNING! Prevented operation on region [%d,%d,%d,%d] already dirty " + "for drawable [%s][%p].\n", __func__, nxagentTrapezoidExtents -> x1, nxagentTrapezoidExtents -> y1, nxagentTrapezoidExtents -> x2, nxagentTrapezoidExtents -> y2, pDst -> pDrawable -> type == DRAWABLE_PIXMAP ? "pixmap" : "window", (void *) pDst -> pDrawable); @@ -1831,8 +1842,8 @@ FIXME: Is this useful or just a waste of bandwidth? #ifdef TEST if (pDst && pDst->pDrawable) { - fprintf(stderr, "nxagentTrapezoids: WARNING! Prevented operation on region [%d,%d,%d,%d] " - "for drawable [%s][%p].\n", pDstRegion -> extents.x1, pDstRegion -> extents.y1, + fprintf(stderr, "%s: WARNING! Prevented operation on region [%d,%d,%d,%d] " + "for drawable [%s][%p].\n", __func__, pDstRegion -> extents.x1, pDstRegion -> extents.y1, pDstRegion -> extents.x2, pDstRegion -> extents.y2, pDst -> pDrawable -> type == DRAWABLE_PIXMAP ? "pixmap" : "window", (void *) pDst -> pDrawable); @@ -1855,7 +1866,7 @@ FIXME: Is this useful or just a waste of bandwidth? nxagentDrawableStatus(pSrc -> pDrawable) == NotSynchronized) { #ifdef TEST - fprintf(stderr, "nxagentTrapezoids: Going to synchronize the source drawable at [%p].\n", + fprintf(stderr, "%s: Going to synchronize the source drawable at [%p].\n", __func__, (void *) pSrc -> pDrawable); #endif @@ -1865,7 +1876,7 @@ FIXME: Is this useful or just a waste of bandwidth? if (nxagentDrawableStatus(pDst -> pDrawable) == NotSynchronized) { #ifdef TEST - fprintf(stderr, "nxagentTrapezoids: Going to synchronize the destination drawable at [%p].\n", + fprintf(stderr, "%s: Going to synchronize the destination drawable at [%p].\n", __func__, (void *) pDst -> pDrawable); #endif @@ -1892,7 +1903,7 @@ FIXME: Is this useful or just a waste of bandwidth? void nxagentQueryFormats(void) { #ifdef DEBUG - fprintf(stderr, "nxagentQueryFormats.\n"); + fprintf(stderr, "%s.\n", __func__); #endif if (XRenderQueryFormats(nxagentDisplay)) @@ -1918,8 +1929,8 @@ void nxagentQueryFormats(void) nxagentArrayFormats[i] = *pformat; #ifdef DEBUG - fprintf(stderr, "nxagentQueryFormats: Added format type [%d] depth [%d] rgb [%d,%d,%d] " - "mask rgb [%d,%d,%d] alpha [%d] alpha mask [%d].\n", + fprintf(stderr, "%s: Added format id [%d] type [%d] depth [%d] rgb [%d,%d,%d] " + "mask rgb [%d,%d,%d] alpha [%d] alpha mask [%d].\n", __func__, nxagentArrayFormats[i].id, nxagentArrayFormats[i].type, nxagentArrayFormats[i].depth, nxagentArrayFormats[i].direct.red, nxagentArrayFormats[i].direct.green, nxagentArrayFormats[i].direct.blue, nxagentArrayFormats[i].direct.redMask, nxagentArrayFormats[i].direct.greenMask, @@ -1933,12 +1944,11 @@ void nxagentQueryFormats(void) #ifdef DEBUG if (nxagentNumFormats == 0) { - fprintf(stderr, "nxagentQueryFormats: Number of formats is [%d].\n", - i); + fprintf(stderr, "%s: Number of formats is [%d].\n", __func__, i); } else { - fprintf(stderr, "nxagentQueryFormats: Old number of formats is [%d]. New number of formats is [%d].\n", + fprintf(stderr, "%s: Old number of formats is [%d]. New number of formats is [%d].\n", __func__, nxagentNumFormats, i); } #endif @@ -1950,7 +1960,7 @@ void nxagentQueryFormats(void) void nxagentCreateGlyphSet(GlyphSetPtr pGly) { #ifdef DEBUG - fprintf(stderr, "nxagentCreateGlyphSet: Glyphset at [%p].\n", (void *) pGly); + fprintf(stderr, "%s: Glyphset at [%p].\n", __func__, (void *) pGly); #endif XRenderPictFormat *pForm = NULL; @@ -1978,7 +1988,7 @@ void nxagentReferenceGlyphSet(GlyphSetPtr glyphSet) if (glyphSet -> remoteID == 0) { #ifdef TEST - fprintf(stderr, "nxagentReferenceGlyphSet: Operation deferred because glyphset at [%p] is corrupted.\n", + fprintf(stderr, "%s: Operation deferred because glyphset at [%p] is corrupted.\n", __func__, (void *) glyphSet); #endif @@ -1993,7 +2003,7 @@ void nxagentFreeGlyphSet(GlyphSetPtr glyphSet) if (glyphSet -> remoteID == 0) { #ifdef TEST - fprintf(stderr, "nxagentFreeGlyphs: Operation ignored because glyphset at [%p] is corrupted.\n", + fprintf(stderr, "%s: Operation ignored because glyphset at [%p] is corrupted.\n", __func__, (void *) glyphSet); #endif @@ -2007,14 +2017,14 @@ void nxagentAddGlyphs(GlyphSetPtr glyphSet, Glyph *gids, xGlyphInfo *gi, int nglyphs, CARD8 *images, int sizeImages) { #ifdef DEBUG - fprintf(stderr, "nxagentAddGlyphs: Glyphset at [%p]. Number of glyphs [%d].\n", + fprintf(stderr, "%s: Glyphset at [%p]. Number of glyphs [%d].\n", __func__, (void *) glyphSet, nglyphs); #endif if (glyphSet -> remoteID == 0) { #ifdef TEST - fprintf(stderr, "nxagentAddGlyphs: Going to reconnect the glyhpset at [%p] before adding glyphs.\n", + fprintf(stderr, "%s: Going to reconnect the glyhpset at [%p] before adding glyphs.\n", __func__, (void *) glyphSet); #endif @@ -2036,7 +2046,7 @@ void nxagentAddGlyphs(GlyphSetPtr glyphSet, Glyph *gids, xGlyphInfo *gi, if (gr && gr -> glyph != DeletedGlyph) { #ifdef DEBUG - fprintf(stderr, "nxagentAddGlyphs: Added Glyph [%p][%ld] to glyphset [%p].\n", + fprintf(stderr, "%s: Added Glyph [%p][%ld] to glyphset [%p].\n", __func__, (void *) gr -> glyph, *tempGids, (void *) glyphSet); #endif @@ -2069,7 +2079,7 @@ void nxagentAddGlyphs(GlyphSetPtr glyphSet, Glyph *gids, xGlyphInfo *gi, else { #ifdef PANIC - fprintf(stderr, "nxagentAddGlyphs: PANIC! Allocation of normalized glyph images failed.\n"); + fprintf(stderr, "%s: PANIC! Allocation of normalized glyph images failed.\n", __func__); #endif } } @@ -2109,7 +2119,7 @@ void nxagentFreeGlyphs(GlyphSetPtr glyphSet, CARD32 *gids, int nglyph) if (glyphSet -> remoteID == 0) { #ifdef TEST - fprintf(stderr, "nxagentFreeGlyphs: Operation ignored because glyphset at [%p] is corrupted.\n", + fprintf(stderr, "%s: Operation ignored because glyphset at [%p] is corrupted.\n", __func__, (void *) glyphSet); #endif @@ -2143,7 +2153,7 @@ void nxagentFreeGlyphs(GlyphSetPtr glyphSet, CARD32 *gids, int nglyph) void nxagentSetPictureTransform(PicturePtr pPicture, void * transform) { #ifdef TEST - fprintf(stderr, "nxagentSetPictureTransform: Going to set transform [%p] to picture at [%p].\n", + fprintf(stderr, "%s: Going to set transform [%p] to picture at [%p].\n", __func__, (void *) transform, (void *) pPicture); #endif @@ -2167,7 +2177,7 @@ void nxagentSetPictureFilter(PicturePtr pPicture, char *filter, int name_size, if (szFilter == NULL) { #ifdef WARNING - fprintf(stderr, "nxagentSetPictureFilter: error allocating memory for filter name.\n"); + fprintf(stderr, "%s: error allocating memory for filter name.\n", __func__); #endif return; @@ -2178,7 +2188,7 @@ void nxagentSetPictureFilter(PicturePtr pPicture, char *filter, int name_size, szFilter[name_size] = 0; #ifdef TEST - fprintf(stderr, "nxagentSetPictureFilter: Going to set filter [%s] to picture at [%p].\n", + fprintf(stderr, "%s: Going to set filter [%s] to picture at [%p].\n", __func__, szFilter, (void *) pPicture); #endif /* @@ -2243,7 +2253,7 @@ static void nxagentPrintFormat(XRenderPictFormat *pFormat) blueMask=%d\n\ alpha=%d\n\ alphaMask=%d\n", - __func__, + __func__, (void *) pFormat, pFormat -> type, pFormat -> depth, @@ -2302,6 +2312,7 @@ void nxagentReconnectGlyphSet(void* p0, XID x1, void *p2) if (pGly -> format) { pForm = nxagentMatchingFormats(pGly -> format); + nxagentPrintFormat(pForm); } pGly -> remoteID = XRenderCreateGlyphSet(nxagentDisplay, pForm); From f04500206dd5b1a570db5a59867e003280d89017 Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Sun, 2 Jun 2024 17:01:57 +0200 Subject: [PATCH 67/89] Screen.c: fix comment --- nx-X11/programs/Xserver/hw/nxagent/Screen.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/nx-X11/programs/Xserver/hw/nxagent/Screen.c b/nx-X11/programs/Xserver/hw/nxagent/Screen.c index ac62b3d7a6..0b2fb8bc19 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Screen.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Screen.c @@ -662,8 +662,8 @@ void nxagentInitViewportFrame(ScreenPtr pScreen, WindowPtr pRootWin) } /* - * It is not necessary create the windows on the real X server. But this - * windows are not visible. Create them it is not a great effort, and avoids + * It is not necessary create the windows on the real X server. But these + * windows are not visible. Create them, it is not a great effort, and avoids * many errors. * * nxagentScreenTrap = True; From 621a67c81f0dedc79e84500a888586ed71e1a038 Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Sun, 2 Jun 2024 20:21:00 +0200 Subject: [PATCH 68/89] Events.c: make nxagentInputEvent a Boolean --- nx-X11/programs/Xserver/hw/nxagent/Events.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/nx-X11/programs/Xserver/hw/nxagent/Events.c b/nx-X11/programs/Xserver/hw/nxagent/Events.c index 23902535c1..be62daf644 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Events.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Events.c @@ -263,7 +263,7 @@ Time nxagentLastWindowDestroyedTime = 0; * Set this flag when an user input event is received. */ -int nxagentInputEvent = 0; +Bool nxagentInputEvent = False; int nxagentKeyDown = 0; @@ -936,7 +936,7 @@ void nxagentDispatchEvents(PredicateFuncPtr predicate) fprintf(stderr, "%s: Going to handle new KeyPress event.\n", __func__); #endif - nxagentInputEvent = 1; + nxagentInputEvent = True; nxagentKeyDown++; @@ -1130,7 +1130,7 @@ FIXME: Don't enqueue the KeyRelease event if the key was not already fprintf(stderr, "%s: Going to handle new KeyRelease event.\n", __func__); #endif - nxagentInputEvent = 1; + nxagentInputEvent = True; nxagentKeyDown--; @@ -1213,7 +1213,7 @@ FIXME: Don't enqueue the KeyRelease event if the key was not already } #endif - nxagentInputEvent = 1; + nxagentInputEvent = True; if (nxagentOption(Fullscreen)) { @@ -1314,7 +1314,7 @@ FIXME: Don't enqueue the KeyRelease event if the key was not already } #endif - nxagentInputEvent = 1; + nxagentInputEvent = True; if (viewportCursor) { @@ -1496,7 +1496,7 @@ FIXME: Don't enqueue the KeyRelease event if the key was not already if (!nxagentOption(Shadow)) { - nxagentInputEvent = 1; + nxagentInputEvent = True; } break; @@ -1764,7 +1764,7 @@ FIXME: Don't enqueue the KeyRelease event if the key was not already } } - nxagentInputEvent = 1; + nxagentInputEvent = True; break; } @@ -1800,7 +1800,7 @@ FIXME: Don't enqueue the KeyRelease event if the key was not already } } - nxagentInputEvent = 1; + nxagentInputEvent = True; break; } @@ -4322,9 +4322,9 @@ int nxagentUserInput(void *p) nxagentDispatchEvents(NULL); } - if (nxagentInputEvent == 1) + if (nxagentInputEvent) { - nxagentInputEvent = 0; + nxagentInputEvent = False; result = 1; } From 83a75c9fbb82a9d6f421b73610e1c440a406c5c3 Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Sun, 2 Jun 2024 20:23:39 +0200 Subject: [PATCH 69/89] Events.c: make sendKey a Boolean --- nx-X11/programs/Xserver/hw/nxagent/Events.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/nx-X11/programs/Xserver/hw/nxagent/Events.c b/nx-X11/programs/Xserver/hw/nxagent/Events.c index be62daf644..2ab09f9cb3 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Events.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Events.c @@ -1105,7 +1105,7 @@ void nxagentDispatchEvents(PredicateFuncPtr predicate) case KeyRelease: { enum HandleEventResult result; - int sendKey = 0; + Bool sendKey = False; /* FIXME: If we don't flush the queue here, it could happen that the @@ -1123,7 +1123,7 @@ FIXME: Don't enqueue the KeyRelease event if the key was not already if (BitIsOn(inputInfo.keyboard -> key -> down, nxagentConvertKeycode(X.xkey.keycode))) { - sendKey = 1; + sendKey = True; } #ifdef TEST @@ -1176,7 +1176,7 @@ FIXME: Don't enqueue the KeyRelease event if the key was not already /* do not send a KeyRelease for a special keystroke since we also did not send a KeyPress event in that case */ - if (!(nxagentCheckSpecialKeystroke(&X.xkey, &result)) && (sendKey == 1)) + if (!(nxagentCheckSpecialKeystroke(&X.xkey, &result)) && (sendKey)) { #ifdef TEST fprintf(stderr, "%s: passing KeyRelease event to clients\n", __func__); From 2c6f4dc348a64006cd30c99d7ae0efa3939d5da6 Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Sun, 2 Jun 2024 20:25:08 +0200 Subject: [PATCH 70/89] Events.c: NewOutputPending is a Boolean --- nx-X11/programs/Xserver/hw/nxagent/Events.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nx-X11/programs/Xserver/hw/nxagent/Events.c b/nx-X11/programs/Xserver/hw/nxagent/Events.c index 2ab09f9cb3..eb1bc2be6d 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Events.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Events.c @@ -2233,7 +2233,7 @@ FIXME: Don't enqueue the KeyRelease event if the key was not already * FlushIfCriticalOutputPending(); */ - if (NewOutputPending == 1) + if (NewOutputPending) { #ifdef TEST fprintf(stderr, "%s: Flushed the processed events to clients.\n", __func__); From 168d6e674b1c1571a6bb61d33f86dd799ddb2b91 Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Sun, 2 Jun 2024 20:34:29 +0200 Subject: [PATCH 71/89] Events.c: make event handling functions return Booleans --- nx-X11/programs/Xserver/hw/nxagent/Events.c | 103 ++++++++++---------- nx-X11/programs/Xserver/hw/nxagent/Events.h | 20 ++-- 2 files changed, 62 insertions(+), 61 deletions(-) diff --git a/nx-X11/programs/Xserver/hw/nxagent/Events.c b/nx-X11/programs/Xserver/hw/nxagent/Events.c index eb1bc2be6d..030f2537fe 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Events.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Events.c @@ -2108,7 +2108,7 @@ FIXME: Don't enqueue the KeyRelease event if the key was not already * Let's check if this is a XKB state modification event. */ - if (nxagentHandleXkbKeyboardStateEvent(&X) == 0 && nxagentHandleXFixesSelectionNotify(&X) == 0) + if (!nxagentHandleXkbKeyboardStateEvent(&X) && !nxagentHandleXFixesSelectionNotify(&X)) { #ifdef TEST fprintf(stderr, "%s: WARNING! Unhandled event code [%d].\n", __func__, X.type); @@ -2258,7 +2258,7 @@ FIXME: Don't enqueue the KeyRelease event if the key was not already * Functions providing the ad-hoc handling of the remote X events. */ -int nxagentHandleKeyPress(XEvent *X, enum HandleEventResult *result) +Bool nxagentHandleKeyPress(XEvent *X, enum HandleEventResult *result) { if (!nxagentXkbState.Initialized) { @@ -2282,7 +2282,8 @@ int nxagentHandleKeyPress(XEvent *X, enum HandleEventResult *result) #ifdef TEST fprintf(stderr, "%s: NOT passing KeyPress event to clients\n", __func__); #endif - return 1; + /* FIXME: shouldn't this be False? */ + return True; } if (X -> xkey.keycode == nxagentCapsLockKeycode) @@ -2311,10 +2312,10 @@ int nxagentHandleKeyPress(XEvent *X, enum HandleEventResult *result) SetCriticalOutputPending(); - return 1; + return True; } -int nxagentHandlePropertyNotify(XEvent *X) +Bool nxagentHandlePropertyNotify(XEvent *X) { if (nxagentOption(Rootless) && !nxagentNotifyMatchChangeProperty((XPropertyEvent *) X)) { @@ -2333,7 +2334,7 @@ int nxagentHandlePropertyNotify(XEvent *X) fprintf(stderr, "%s: WARNING! Asynchronous get property queue is full.\n", __func__); #endif - return 0; + return False; } NXCollectProperty(nxagentDisplay, resource, @@ -2351,10 +2352,10 @@ int nxagentHandlePropertyNotify(XEvent *X) #endif } - return 1; + return True; } -int nxagentHandleExposeEvent(XEvent *X) +Bool nxagentHandleExposeEvent(XEvent *X) { StaticResizedWindowStruct *resizedWinPtr = NULL; @@ -2468,10 +2469,10 @@ FIXME: This can be maybe optimized by consuming the RegionUninit(&sum); } - return 1; + return True; } -int nxagentHandleGraphicsExposeEvent(XEvent *X) +Bool nxagentHandleGraphicsExposeEvent(XEvent *X) { /* * Send an expose event to client, instead of graphics expose. If @@ -2504,7 +2505,8 @@ int nxagentHandleGraphicsExposeEvent(XEvent *X) fprintf(stderr, "%s: WARNING! Storing pixmap not found.\n", __func__); #endif - return 1; + /* FIXME: shouldn't this be False? */ + return True; } pBSwindow = (miBSWindowPtr) pStoringPixmapRec -> pSavedWindow -> backStorage; @@ -2515,7 +2517,8 @@ int nxagentHandleGraphicsExposeEvent(XEvent *X) fprintf(stderr, "%s: WARNING! Back storage not found.\n", __func__); #endif - return 1; + /* FIXME: shouldn't this be False? */ + return True; } pWin = pStoringPixmapRec -> pSavedWindow; @@ -2570,10 +2573,10 @@ int nxagentHandleGraphicsExposeEvent(XEvent *X) RegionDestroy(exposeRegion); - return 1; + return True; } -int nxagentHandleClientMessageEvent(XEvent *X, enum HandleEventResult *result) +Bool nxagentHandleClientMessageEvent(XEvent *X, enum HandleEventResult *result) { *result = doNothing; @@ -2591,7 +2594,7 @@ int nxagentHandleClientMessageEvent(XEvent *X, enum HandleEventResult *result) #endif nxagentHandleProxyEvent(X); - return 1; + return True; } #ifdef TEST @@ -2615,7 +2618,7 @@ int nxagentHandleClientMessageEvent(XEvent *X, enum HandleEventResult *result) fprintf(stderr, "%s: WARNING Invalid type in client message.\n", __func__); #endif - return 0; + return False; } WindowPtr pWin = nxagentWindowPtr(X -> xclient.window); @@ -2635,7 +2638,7 @@ int nxagentHandleClientMessageEvent(XEvent *X, enum HandleEventResult *result) } #endif - return 0; + return False; } if (message_type == MakeAtom("WM_PROTOCOLS", strlen("WM_PROTOCOLS"), False)) @@ -2654,7 +2657,7 @@ int nxagentHandleClientMessageEvent(XEvent *X, enum HandleEventResult *result) fprintf(stderr, "%s: WARNING Invalid value in client message of type WM_PROTOCOLS.\n", __func__); #endif - return 0; + return False; } #ifdef TEST else @@ -2673,10 +2676,10 @@ int nxagentHandleClientMessageEvent(XEvent *X, enum HandleEventResult *result) (long int) message_type, validateString(NameForAtom(message_type))); #endif - return 0; + return False; } - return 1; + return True; } if (X -> xclient.message_type == nxagentAtoms[1]) /* WM_PROTOCOLS */ @@ -2715,10 +2718,10 @@ int nxagentHandleClientMessageEvent(XEvent *X, enum HandleEventResult *result) } } - return 1; + return True; } -int nxagentHandleXkbKeyboardStateEvent(XEvent *X) +Bool nxagentHandleXkbKeyboardStateEvent(XEvent *X) { XkbEvent *xkbev = (XkbEvent *) X; @@ -2818,13 +2821,13 @@ int nxagentHandleXkbKeyboardStateEvent(XEvent *X) nxagentSendFakeKey(77); } - return 1; + return True; } - return 0; + return False; } -int nxagentHandleXFixesSelectionNotify(XEvent *X) +Bool nxagentHandleXFixesSelectionNotify(XEvent *X) { XFixesSelectionEvent *xfixesEvent = (XFixesSelectionEvent *) X; @@ -2833,7 +2836,7 @@ int nxagentHandleXFixesSelectionNotify(XEvent *X) #ifdef DEBUG fprintf(stderr, "%s: XFixes not initialized - doing nothing.\n", __func__); #endif - return 0; + return False; } if (xfixesEvent -> type != (nxagentXFixesInfo.EventBase + XFixesSelectionNotify)) @@ -2841,7 +2844,7 @@ int nxagentHandleXFixesSelectionNotify(XEvent *X) #ifdef DEBUG fprintf(stderr, "%s: event type is [%d] - doing nothing.\n", __func__, xfixesEvent->type); #endif - return 0; + return False; } #ifdef DEBUG @@ -2881,7 +2884,7 @@ int nxagentHandleXFixesSelectionNotify(XEvent *X) #ifdef DEBUG fprintf(stderr, "%s: (new) owner is nxagent (window is [0x%lx]) - ignoring it.\n", __func__, xfixesEvent->xfixesselection.window); #endif - return 0; + return False; } /* @@ -2907,10 +2910,10 @@ int nxagentHandleXFixesSelectionNotify(XEvent *X) #endif } - return 1; + return True; } -int nxagentHandleProxyEvent(XEvent *X) +Bool nxagentHandleProxyEvent(XEvent *X) { switch (X -> xclient.data.l[0]) { @@ -2937,7 +2940,7 @@ int nxagentHandleProxyEvent(XEvent *X) #endif - return 1; + return True; } case NXCommitSplitNotify: { @@ -2960,7 +2963,7 @@ int nxagentHandleProxyEvent(XEvent *X) nxagentHandleCommitSplitEvent(client, request, position); - return 1; + return True; } case NXEndSplitNotify: { @@ -2977,7 +2980,7 @@ int nxagentHandleProxyEvent(XEvent *X) nxagentHandleEndSplitEvent(client); - return 1; + return True; } case NXEmptySplitNotify: { @@ -2991,7 +2994,7 @@ int nxagentHandleProxyEvent(XEvent *X) nxagentHandleEmptySplitEvent(); - return 1; + return True; } case NXCollectPropertyNotify: { @@ -3003,7 +3006,7 @@ int nxagentHandleProxyEvent(XEvent *X) nxagentHandleCollectPropertyEvent(X); - return 1; + return True; } case NXCollectGrabPointerNotify: { @@ -3015,7 +3018,7 @@ int nxagentHandleProxyEvent(XEvent *X) nxagentHandleCollectGrabPointerEvent(resource); - return 1; + return True; } case NXCollectInputFocusNotify: { @@ -3031,7 +3034,7 @@ int nxagentHandleProxyEvent(XEvent *X) nxagentHandleCollectInputFocusEvent(resource); - return 1; + return True; } default: { @@ -3044,7 +3047,7 @@ int nxagentHandleProxyEvent(XEvent *X) (int) X -> xclient.data.l[0]); #endif - return 0; + return False; } } } @@ -3132,7 +3135,7 @@ int nxagentCheckWindowConfiguration(XConfigureEvent* X) return 1; } -int nxagentHandleConfigureNotify(XEvent* X) +Bool nxagentHandleConfigureNotify(XEvent* X) { #ifdef DEBUG fprintf(stderr, "%s: Event info:\n", __func__); @@ -3180,7 +3183,7 @@ int nxagentHandleConfigureNotify(XEvent* X) nxagentCheckWindowConfiguration((XConfigureEvent*)X); - return 1; + return True; } if (nxagentWindowTopLevel(pWinWindow) && !X -> xconfigure.override_redirect) @@ -3266,7 +3269,7 @@ int nxagentHandleConfigureNotify(XEvent* X) TryClientEvents(wClient(pWinWindow), &x, 1, 1, 1, 0); } - return 1; + return True; } } else /* (nxagentOption(Rootless)) */ @@ -3448,7 +3451,7 @@ int nxagentHandleConfigureNotify(XEvent* X) } } - return 1; + return True; } else { @@ -3467,7 +3470,7 @@ int nxagentHandleConfigureNotify(XEvent* X) nxagentChangeScreenConfig(0, nxagentOption(Width), nxagentOption(Height), True); - return 1; + return True; } } } @@ -3476,10 +3479,10 @@ int nxagentHandleConfigureNotify(XEvent* X) fprintf(stderr, "%s: received for unexpected window [%ld]\n", __func__, X -> xconfigure.window); #endif - return 0; + return False; } -int nxagentHandleReparentNotify(XEvent* X) +Bool nxagentHandleReparentNotify(XEvent* X) { #ifdef TEST fprintf(stderr, "%s: Going to handle a new reparent event (serial [%ld].\n", __func__, X->xreparent.serial); @@ -3504,7 +3507,6 @@ int nxagentHandleReparentNotify(XEvent* X) WindowPtr pWin = nxagentWindowPtr(X -> xreparent.window); #ifdef TEST - { WindowPtr pParent = nxagentWindowPtr(X -> xreparent.parent); WindowPtr pEvent = nxagentWindowPtr(X -> xreparent.event); @@ -3513,7 +3515,6 @@ int nxagentHandleReparentNotify(XEvent* X) (void*)pEvent, X -> xreparent.event, (void*)pWin, X -> xreparent.window, (void*)pParent, X -> xreparent.parent, X -> xreparent.x, X -> xreparent.y); } - #endif if (nxagentWindowTopLevel(pWin)) @@ -3587,7 +3588,7 @@ int nxagentHandleReparentNotify(XEvent* X) } } - return 1; + return True; } else if (nxagentWMIsRunning && !nxagentOption(Fullscreen) && nxagentOption(WMBorderWidth) == -1) @@ -3604,7 +3605,7 @@ int nxagentHandleReparentNotify(XEvent* X) fprintf(stderr, "%s: WARNING! XGetWindowAttributes for parent window failed.\n", __func__); #endif - return 1; + return True; } XlibWindow junk; @@ -3661,7 +3662,7 @@ int nxagentHandleReparentNotify(XEvent* X) fprintf(stderr, "%s: WARNING! XGetWindowAttributes failed for parent window.\n", __func__); #endif - return 1; + return True; } /* @@ -3686,7 +3687,7 @@ int nxagentHandleReparentNotify(XEvent* X) } } - return 1; + return True; } /* diff --git a/nx-X11/programs/Xserver/hw/nxagent/Events.h b/nx-X11/programs/Xserver/hw/nxagent/Events.h index b3e7f8a173..379bbbcc61 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Events.h +++ b/nx-X11/programs/Xserver/hw/nxagent/Events.h @@ -105,28 +105,28 @@ extern int nxagentInitXkbKeyboardState(void); * received from the remote X server. */ -extern int nxagentHandleXkbKeyboardStateEvent(XEvent *X); +extern Bool nxagentHandleXkbKeyboardStateEvent(XEvent *X); /* * Handle sync and karma messages and other notification event coming * from proxy. */ -extern int nxagentHandleProxyEvent(XEvent *X); +extern Bool nxagentHandleProxyEvent(XEvent *X); /* * Other functions providing the ad-hoc handling of the remote X * events. */ -extern int nxagentHandleExposeEvent(XEvent *X); -extern int nxagentHandleGraphicsExposeEvent(XEvent *X); -extern int nxagentHandleClientMessageEvent(XEvent *X, enum HandleEventResult*); -extern int nxagentHandlePropertyNotify(XEvent *X); -extern int nxagentHandleKeyPress(XEvent *X, enum HandleEventResult*); -extern int nxagentHandleReparentNotify(XEvent *X); -extern int nxagentHandleConfigureNotify(XEvent *X); -extern int nxagentHandleXFixesSelectionNotify(XEvent *X); +extern Bool nxagentHandleExposeEvent(XEvent *X); +extern Bool nxagentHandleGraphicsExposeEvent(XEvent *X); +extern Bool nxagentHandleClientMessageEvent(XEvent *X, enum HandleEventResult*); +extern Bool nxagentHandlePropertyNotify(XEvent *X); +extern Bool nxagentHandleKeyPress(XEvent *X, enum HandleEventResult*); +extern Bool nxagentHandleReparentNotify(XEvent *X); +extern Bool nxagentHandleConfigureNotify(XEvent *X); +extern Bool nxagentHandleXFixesSelectionNotify(XEvent *X); /* * Send a fake keystroke to the remote X server. From a22d14005debc9954e21cb5afd23edf252b3126d Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Sun, 2 Jun 2024 20:35:00 +0200 Subject: [PATCH 72/89] Events.c: disable unused function no need to compile if it is unused --- nx-X11/programs/Xserver/hw/nxagent/Events.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/nx-X11/programs/Xserver/hw/nxagent/Events.c b/nx-X11/programs/Xserver/hw/nxagent/Events.c index 030f2537fe..6456e244a1 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Events.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Events.c @@ -4365,7 +4365,8 @@ int nxagentUserInput(void *p) return result; } -int nxagentHandleRRScreenChangeNotify(XEvent *X) +#if 0 +Bool nxagentHandleRRScreenChangeNotify(XEvent *X) { XRRScreenChangeNotifyEvent *Xr = (XRRScreenChangeNotifyEvent *) X; @@ -4383,8 +4384,9 @@ int nxagentHandleRRScreenChangeNotify(XEvent *X) nxagentShadowSetWindowsSize(); - return 1; + return True; } +#endif /* * Returns true if there is any event waiting to be dispatched. This From 13ef42916efa4f4d7acb4f749c4e770774dbf8c4 Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Sun, 2 Jun 2024 21:45:03 +0200 Subject: [PATCH 73/89] NXresource.c: make nxagentFindClientResource return a Boolean --- nx-X11/programs/Xserver/hw/nxagent/Drawable.c | 14 +++++++------- nx-X11/programs/Xserver/hw/nxagent/NXdispatch.c | 6 +++--- nx-X11/programs/Xserver/hw/nxagent/NXresource.c | 6 +++--- 3 files changed, 13 insertions(+), 13 deletions(-) diff --git a/nx-X11/programs/Xserver/hw/nxagent/Drawable.c b/nx-X11/programs/Xserver/hw/nxagent/Drawable.c index 6f8ac64a6b..a44818f4c8 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Drawable.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Drawable.c @@ -117,7 +117,7 @@ void nxagentExposeBackgroundPredicate(void *p0, XID x1, void *p2); * Imported from NXresource.c */ -extern int nxagentFindClientResource(int, RESTYPE, void *); +extern Bool nxagentFindClientResource(int, RESTYPE, void *); unsigned long nxagentGetColor(DrawablePtr pDrawable, int xPixel, int yPixel); unsigned long nxagentGetDrawableColor(DrawablePtr pDrawable); @@ -1358,12 +1358,12 @@ FIXME: All drawables should be set as synchronized and never marked as */ if (nxagentSynchronization.pDrawable != NULL && - nxagentFindClientResource(serverClient -> index, RT_NX_CORR_WINDOW, - nxagentSynchronization.pDrawable) == 0 && - nxagentFindClientResource(serverClient -> index, RT_NX_CORR_BACKGROUND, - nxagentSynchronization.pDrawable) == 0 && - nxagentFindClientResource(serverClient -> index, RT_NX_CORR_PIXMAP, - nxagentSynchronization.pDrawable) == 0) + !nxagentFindClientResource(serverClient -> index, RT_NX_CORR_WINDOW, + nxagentSynchronization.pDrawable) && + !nxagentFindClientResource(serverClient -> index, RT_NX_CORR_BACKGROUND, + nxagentSynchronization.pDrawable) && + !nxagentFindClientResource(serverClient -> index, RT_NX_CORR_PIXMAP, + nxagentSynchronization.pDrawable)) { #ifdef TEST fprintf(stderr, "nxagentSynchronizationLoop: Synchronization drawable [%p] removed from resources.\n", diff --git a/nx-X11/programs/Xserver/hw/nxagent/NXdispatch.c b/nx-X11/programs/Xserver/hw/nxagent/NXdispatch.c index e9e3888863..9364dbab8e 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/NXdispatch.c +++ b/nx-X11/programs/Xserver/hw/nxagent/NXdispatch.c @@ -185,7 +185,7 @@ extern WindowPtr nxagentViewportFrameBelow; extern int nxagentMaxAllowedResets; -extern int nxagentFindClientResource(int, RESTYPE, void *); +extern Bool nxagentFindClientResource(int, RESTYPE, void *); #ifdef NXAGENT_CLIPBOARD extern int nxagentPrimarySelection; @@ -855,7 +855,7 @@ ProcCloseFont(register ClientPtr client) if (pFont -> refcnt > 0) { - if (nxagentFindClientResource(serverClient -> index, RT_NX_FONT, pFont) == 0) + if (!nxagentFindClientResource(serverClient -> index, RT_NX_FONT, pFont)) { #ifdef TEST fprintf(stderr, "%s: Switching resource for font at [%p].\n", __func__, @@ -955,7 +955,7 @@ ProcFreePixmap(register ClientPtr client) if (pMap -> refcnt > 0) { - if (nxagentFindClientResource(serverClient -> index, RT_NX_PIXMAP, pMap) == 0) + if (!nxagentFindClientResource(serverClient -> index, RT_NX_PIXMAP, pMap)) { #ifdef TEST fprintf(stderr, "ProcFreePixmap: Switching resource for pixmap at [%p].\n", diff --git a/nx-X11/programs/Xserver/hw/nxagent/NXresource.c b/nx-X11/programs/Xserver/hw/nxagent/NXresource.c index 53b355ff8a..8442db0cb1 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/NXresource.c +++ b/nx-X11/programs/Xserver/hw/nxagent/NXresource.c @@ -140,7 +140,7 @@ static int nxagentResChangedFlag = 0; #endif #ifdef NXAGENT_SERVER -int nxagentFindClientResource(int client, RESTYPE type, void * value) +Bool nxagentFindClientResource(int client, RESTYPE type, void * value) { for (int i = 0; i < clientTable[client].buckets; i++) { @@ -156,12 +156,12 @@ int nxagentFindClientResource(int client, RESTYPE type, void * value) pResource -> type, client); #endif - return 1; + return True; } } } - return 0; + return False; } int nxagentSwitchResourceType(int client, RESTYPE type, void * value) From f54d46a7fa14db58d7b8359ee55642f8d776c543 Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Sun, 2 Jun 2024 21:45:43 +0200 Subject: [PATCH 74/89] NXresource.c: make nxagentSwitchResourceType return a Boolean --- nx-X11/programs/Xserver/hw/nxagent/NXresource.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/nx-X11/programs/Xserver/hw/nxagent/NXresource.c b/nx-X11/programs/Xserver/hw/nxagent/NXresource.c index 8442db0cb1..4d31ed49af 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/NXresource.c +++ b/nx-X11/programs/Xserver/hw/nxagent/NXresource.c @@ -164,7 +164,7 @@ Bool nxagentFindClientResource(int client, RESTYPE type, void * value) return False; } -int nxagentSwitchResourceType(int client, RESTYPE type, void * value) +Bool nxagentSwitchResourceType(int client, RESTYPE type, void * value) { RESTYPE internalType = 0; @@ -182,7 +182,7 @@ int nxagentSwitchResourceType(int client, RESTYPE type, void * value) } else { - return 0; + return False; } if (client == serverClient -> index) @@ -192,7 +192,7 @@ int nxagentSwitchResourceType(int client, RESTYPE type, void * value) client); #endif - return 0; + return False; } for (int i = 0; i < clientTable[serverClient -> index].buckets; i++) @@ -212,12 +212,12 @@ int nxagentSwitchResourceType(int client, RESTYPE type, void * value) FreeResource(pResource -> id, RT_NONE); - return 1; + return True; } } } - return 0; + return False; } #endif /* NXAGENT_SERVER */ From 5d2b64e1b8230d48919baeca3d6fd53a4162fcf4 Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Sun, 2 Jun 2024 21:46:45 +0200 Subject: [PATCH 75/89] NXresource.c: make nxagentSwitchResourceType static is only used inside this module --- nx-X11/programs/Xserver/hw/nxagent/NXresource.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nx-X11/programs/Xserver/hw/nxagent/NXresource.c b/nx-X11/programs/Xserver/hw/nxagent/NXresource.c index 4d31ed49af..a833b63a6c 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/NXresource.c +++ b/nx-X11/programs/Xserver/hw/nxagent/NXresource.c @@ -164,7 +164,7 @@ Bool nxagentFindClientResource(int client, RESTYPE type, void * value) return False; } -Bool nxagentSwitchResourceType(int client, RESTYPE type, void * value) +static Bool nxagentSwitchResourceType(int client, RESTYPE type, void * value) { RESTYPE internalType = 0; From 20e360c75996a61a81f10433ca2eb8f7af62ab2e Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Mon, 3 Jun 2024 20:00:52 +0200 Subject: [PATCH 76/89] GCOps.c: drop unused function nxagentBitBlitHelper --- nx-X11/programs/Xserver/hw/nxagent/GCOps.c | 24 ---------------------- 1 file changed, 24 deletions(-) diff --git a/nx-X11/programs/Xserver/hw/nxagent/GCOps.c b/nx-X11/programs/Xserver/hw/nxagent/GCOps.c index d8ed435d0d..7b59bd8a36 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/GCOps.c +++ b/nx-X11/programs/Xserver/hw/nxagent/GCOps.c @@ -91,12 +91,6 @@ static int nxagentSaveGCTrap; nxagentGCTrap = nxagentSaveGCTrap; \ } -/* - * This is currently unused. - */ - -RegionPtr nxagentBitBlitHelper(GC *pGC); - /* * The NX agent implementation of the X server's graphics functions. */ @@ -187,24 +181,6 @@ void nxagentQueryBestSize(int class, unsigned short *pwidth, } } -RegionPtr nxagentBitBlitHelper(GC *pGC) -{ - #ifdef TEST - fprintf(stderr, "nxagentBitBlitHelper: Called for GC at [%p].\n", (void *) pGC); - #endif - - /* - * Force NullRegion. We consider enough the graphics expose events - * generated internally by the nxagent server. - */ - - #ifdef TEST - fprintf(stderr, "nxagentBitBlitHelper: WARNING! Skipping check on exposures events.\n"); - #endif - - return NullRegion; -} - /* * The deferring of X_RenderCompositeTrapezoids caused an ugly effect * on pulldown menu: as the background may be not synchronized, the From 77fa3c03cbc25aa34e9bb356c1de7cad4d2ef874 Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Tue, 4 Jun 2024 21:01:41 +0200 Subject: [PATCH 77/89] Window.c: improve TEST/DEBUG output --- nx-X11/programs/Xserver/hw/nxagent/Window.c | 322 +++++++++++--------- 1 file changed, 182 insertions(+), 140 deletions(-) diff --git a/nx-X11/programs/Xserver/hw/nxagent/Window.c b/nx-X11/programs/Xserver/hw/nxagent/Window.c index 75bdae510d..f1a4301647 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Window.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Window.c @@ -266,7 +266,7 @@ Bool nxagentCreateWindow(WindowPtr pWin) attributes.backing_store = NotUseful; #ifdef TEST - fprintf(stderr, "nxagentCreateWindow: Backing store on window at [%p] is [%d].\n", + fprintf(stderr, "%s: Backing store on window at [%p] is [%d].\n", __func__, (void*)pWin, attributes.backing_store); #endif @@ -333,16 +333,16 @@ Bool nxagentCreateWindow(WindowPtr pWin) */ #ifdef TEST - fprintf(stderr, "nxagentCreateWindow: Going to create new window.\n"); + fprintf(stderr, "%s: Going to create new window.\n", __func__); #endif #ifdef TEST - fprintf(stderr, "nxagentCreateWindow: Creating %swindow at %p current event mask = %lX mask & CWEventMask = %ld " - "event_mask = %lX\n", - nxagentWindowTopLevel(pWin) ? "toplevel " : "", (void*)pWin, pWin -> eventMask, + fprintf(stderr, "%s: Creating %swindow at [%p][0x%x] current event mask [%X] mask & CWEventMask [%ld] " + "event_mask [%lX]\n", __func__, + nxagentWindowTopLevel(pWin) ? "toplevel " : "", (void*)pWin, pWin->drawable.id, pWin -> eventMask, mask & CWEventMask, attributes.event_mask); - fprintf(stderr, "nxagentCreateWindow: position [%d,%d] size [%d,%d] depth [%d] border [%d] class [%d].\n", + fprintf(stderr, "%s: position [%d,%d] size [%d,%d] depth [%d] border [%d] class [%d].\n", __func__, pWin->origin.x - wBorderWidth(pWin), pWin->origin.y - wBorderWidth(pWin), pWin->drawable.width, pWin->drawable.height, pWin->drawable.depth, pWin->borderWidth, pWin->drawable.class); @@ -447,12 +447,12 @@ Bool nxagentCreateWindow(WindowPtr pWin) if (ChangeWindowProperty(pWin, prop, XA_WINDOW, 32, PropModeReplace, 1, nxagentWindowPriv(pWin), 1) != Success) { - fprintf(stderr, "nxagentCreateWindow: Adding NX_REAL_WINDOW failed.\n"); + fprintf(stderr, "%s: Adding NX_REAL_WINDOW failed.\n", __func__); } #ifdef DEBUG else { - fprintf(stderr, "nxagentCreateWindow: Added NX_REAL_WINDOW for Window ID [%x].\n", nxagentWindowPriv(pWin)->window); + fprintf(stderr, "%s: Added NX_REAL_WINDOW for Window ID [0x%x].\n", __func__, nxagentWindowPriv(pWin)->window); } #endif } @@ -544,6 +544,11 @@ Bool nxagentDestroyWindow(WindowPtr pWin) return 1; } + #ifdef DEBUG + fprintf(stderr, "%s: Called with window [%p][0x%x] remote [0x%x].\n", __func__, + (void *) pWin, pWin->drawable.id, nxagentWindow(pWin)); + #endif + nxagentClearClipboard(NULL, pWin); for (int j = 0; j < nxagentExposeQueue.length; j++) @@ -601,7 +606,7 @@ Bool nxagentDestroyWindow(WindowPtr pWin) nxagentSynchronization.pDrawable = NULL; #ifdef TEST - fprintf(stderr, "nxagentDestroyWindow: Synchronization drawable [%p] removed from resources.\n", + fprintf(stderr, "%s: Synchronization drawable [%p] removed from resources.\n", __func__, (void *) pWin); #endif } @@ -632,7 +637,7 @@ Bool nxagentDestroyWindow(WindowPtr pWin) !nxagentLastWindowDestroyed && nxagentSomeWindowsAreMapped() == False) { #ifdef TEST - fprintf(stderr, "nxagentDestroyWindow: Last mapped window as been destroyed.\n"); + fprintf(stderr, "%s: Last mapped window as been destroyed.\n", __func__); #endif nxagentLastWindowDestroyed = True; @@ -664,8 +669,8 @@ Bool nxagentPositionWindow(WindowPtr pWin, int x, int y) } #ifdef TEST - fprintf(stderr, "nxagentPositionWindow: Changing position of window [%p][%ld] to [%d,%d].\n", - (void *) pWin, nxagentWindow(pWin), x, y); + fprintf(stderr, "%s: Changing position of window [%p][0x%x] remote [0x%x] to [%d,%d].\n", __func__, + (void *) pWin, pWin->drawable.id, nxagentWindow(pWin), x, y); #endif nxagentAddConfiguredWindow(pWin, CWSibling | CWX | CWY | CWWidth | @@ -681,6 +686,11 @@ void nxagentRestackWindow(WindowPtr pWin, WindowPtr pOldNextSib) return; } + #ifdef DEBUG + fprintf(stderr, "%s: Called with window [%p][0x%x] remote [0x%x].\n", __func__, + (void *) pWin, pWin->drawable.id, nxagentWindow(pWin)); + #endif + nxagentAddConfiguredWindow(pWin, CW_RootlessRestack); } @@ -1074,7 +1084,7 @@ void nxagentMoveViewport(ScreenPtr pScreen, int hShift, int vShift) */ #ifdef DEBUG - fprintf(stderr, "nxagentMoveViewport: RootX[%i] RootY[%i], hShift[%i] vShift[%i].\n", + fprintf(stderr, "%s: RootX[%i] RootY[%i], hShift[%i] vShift[%i].\n", __func__, nxagentOption(RootX), nxagentOption(RootY), hShift, vShift); #endif @@ -1146,12 +1156,12 @@ void nxagentMoveViewport(ScreenPtr pScreen, int hShift, int vShift) if (doMove) { #ifdef TEST - fprintf(stderr, "nxagentMoveViewport: New viewport geometry: (%d, %d)-" - "(%d, %d)\n", -nxagentOption(RootX), -nxagentOption(RootY), + fprintf(stderr, "%s: New viewport geometry: (%d, %d)-" + "(%d, %d)\n", __func__, -nxagentOption(RootX), -nxagentOption(RootY), -nxagentOption(RootX) + nxagentOption(Width), -nxagentOption(RootY) + nxagentOption(Height)); - fprintf(stderr, "nxagentMoveViewport: Root geometry x=[%d] y=[%d]\n", + fprintf(stderr, "%s: Root geometry x=[%d] y=[%d]\n", __func__, pScreen->root -> drawable.x, pScreen->root -> drawable.y ); #endif @@ -1183,7 +1193,7 @@ void nxagentMoveViewport(ScreenPtr pScreen, int hShift, int vShift) } #ifdef DEBUG - fprintf(stderr, "nxagentMoveViewport: hRect p1[%i, %i] - p2[%i, %i].\n", hRect.x1, hRect.y1, hRect.x2, hRect.y2); + fprintf(stderr, "%s: hRect p1[%i, %i] - p2[%i, %i].\n", __func__, hRect.x1, hRect.y1, hRect.x2, hRect.y2); #endif BoxRec vRect = {.x1 = -newX, .y1 = -newY}; @@ -1201,7 +1211,7 @@ void nxagentMoveViewport(ScreenPtr pScreen, int hShift, int vShift) } #ifdef DEBUG - fprintf(stderr, "nxagentMoveViewport: vRect p1[%i, %i] - p2[%i, %i].\n", vRect.x1, vRect.y1, vRect.x2, vRect.y2); + fprintf(stderr, "%s: vRect p1[%i, %i] - p2[%i, %i].\n", __func__, vRect.x1, vRect.y1, vRect.x2, vRect.y2); #endif if (oldX != newX && hRect.x1 != hRect.x2 && hRect.y1 != hRect.y2) @@ -1233,18 +1243,19 @@ void nxagentConfigureWindow(WindowPtr pWin, unsigned int mask) { unsigned int valuemask; XWindowChanges values; - int offX = nxagentWindowPriv(pWin)->x - pWin->origin.x; - int offY = nxagentWindowPriv(pWin)->y - pWin->origin.y; if (nxagentScreenTrap) { #ifdef TEST - fprintf(stderr, "nxagentConfigureWindow: WARNING: Called with the screen trap set.\n"); + fprintf(stderr, "%s: WARNING: Called with the screen trap set.\n", __func__); #endif return; } + int offX = nxagentWindowPriv(pWin)->x - pWin->origin.x; + int offY = nxagentWindowPriv(pWin)->y - pWin->origin.y; + if (nxagentOption(Rootless) && nxagentWindowTopLevel(pWin)) { @@ -1259,8 +1270,8 @@ void nxagentConfigureWindow(WindowPtr pWin, unsigned int mask) } #ifdef TEST - fprintf(stderr, "nxagentConfigureWindow: Called with window [%p][%ld] and mask [%x].\n", - (void *) pWin, nxagentWindow(pWin), mask); + fprintf(stderr, "%s: Called with window [%p][0x%x] remote [0x%x] and mask [%x].\n", __func__, + (void *) pWin, pWin->drawable.id, nxagentWindow(pWin), mask); #endif nxagentMoveCorruptedRegion(pWin, mask); @@ -1311,8 +1322,8 @@ void nxagentConfigureWindow(WindowPtr pWin, unsigned int mask) if (valuemask) { #ifdef TEST - fprintf(stderr, "nxagentConfigureWindow: Going to configure window [%p][%ld] with mask [%x].\n", - (void *) pWin, nxagentWindow(pWin), valuemask); + fprintf(stderr, "%s: Going to configure window [%p][0x%x] remote [0x%x] with mask [%x].\n", __func__, + (void *) pWin, pWin->drawable.id, nxagentWindow(pWin), valuemask); #endif if (pWin->bitGravity == StaticGravity && @@ -1320,8 +1331,8 @@ void nxagentConfigureWindow(WindowPtr pWin, unsigned int mask) ((mask & CWWidth) || (mask & CWHeight))) { #ifdef TEST - fprintf(stderr, "nxagentConfigureWindow: Window has StaticGravity. Going to translate Expose events by offset [%d, %d].\n", - offX, offY); + fprintf(stderr, "%s: Window has StaticGravity. Going to translate Expose events by offset [%d, %d].\n", + __func__, offX, offY); #endif nxagentAddStaticResizedWindow(pWin, XNextRequest(nxagentDisplay), offX, offY); @@ -1363,8 +1374,8 @@ void nxagentConfigureWindow(WindowPtr pWin, unsigned int mask) values.stack_mode = Above; #ifdef TEST - fprintf(stderr, "nxagentConfigureWindow: Going to configure top sibling [%ld] " - "with mask [%x] and parent [%ld].\n", nxagentWindow(pSib), + fprintf(stderr, "%s: Going to configure top sibling [0x%x] " + "with mask [%x] and parent [0x%x].\n", __func__, nxagentWindow(pSib), valuemask, nxagentWindowParent(pWin)); #endif @@ -1387,8 +1398,8 @@ void nxagentConfigureWindow(WindowPtr pWin, unsigned int mask) values.sibling = nxagentWindowSiblingAbove(pSib); #ifdef TEST - fprintf(stderr, "nxagentConfigureWindow: Going to configure other sibling [%ld] " - "with mask [%x] and parent [%ld] below [%ld].\n", nxagentWindow(pSib), + fprintf(stderr, "%s: Going to configure other sibling [0x%x] " + "with mask [%x] and parent [0x%x] below [0x%lx].\n", __func__, nxagentWindow(pSib), valuemask, nxagentWindowParent(pWin), nxagentWindowSiblingAbove(pSib)); #endif @@ -1411,7 +1422,7 @@ void nxagentConfigureWindow(WindowPtr pWin, unsigned int mask) if (result) { - fprintf(stderr, "nxagentConfigureWindow: Children of the root: "); + fprintf(stderr, "%s: Children of the root: ", __func__); while(nchildren_return > 0) { pSib = nxagentWindowPtr(children_return[--nchildren_return]); @@ -1424,7 +1435,7 @@ void nxagentConfigureWindow(WindowPtr pWin, unsigned int mask) } else { - fprintf(stderr, "nxagentConfigureWindow: Failed QueryTree request.\n "); + fprintf(stderr, "%s: Failed QueryTree request.\n", __func__); } SAFE_XFree(children_return); @@ -1447,7 +1458,7 @@ void nxagentConfigureWindow(WindowPtr pWin, unsigned int mask) * values.stack_mode = Above; * * #ifdef TEST - * fprintf(stderr, "nxagentConfigureWindow: Going to configure splash window [%ld].\n", + * fprintf(stderr, "%s: Going to configure splash window [0x%x].\n", __func__, * nxagentSplashWindow); * #endif * @@ -1463,8 +1474,8 @@ void nxagentConfigureWindow(WindowPtr pWin, unsigned int mask) if (!pWin -> prevSib) { #ifdef TEST - fprintf(stderr, "nxagentConfigureWindow: Raising window [%p][%ld].\n", - (void *) pWin, nxagentWindow(pWin)); + fprintf(stderr, "%s: Raising window [%p][0x%x] remote [0x%x].\n", __func__, + (void *) pWin, pWin->drawable.id, nxagentWindow(pWin)); #endif XRaiseWindow(nxagentDisplay, nxagentWindow(pWin)); @@ -1472,8 +1483,8 @@ void nxagentConfigureWindow(WindowPtr pWin, unsigned int mask) else if (!pWin -> nextSib) { #ifdef TEST - fprintf(stderr, "nxagentConfigureWindow: Lowering window [%p][%ld].\n", - (void *) pWin, nxagentWindow(pWin)); + fprintf(stderr, "%sw: Lowering window [%p][0x%x] remote [0x%x].\n", __func__, + (void *) pWin, pWin->drawable.id, nxagentWindow(pWin)); #endif XLowerWindow(nxagentDisplay, nxagentWindow(pWin)); @@ -1483,8 +1494,8 @@ void nxagentConfigureWindow(WindowPtr pWin, unsigned int mask) XlibWindow windowList[2]; #ifdef TEST - fprintf(stderr, "nxagentConfigureWindow: Putting window [%p][%ld] in the middle.\n", - (void *) pWin, nxagentWindow(pWin)); + fprintf(stderr, "%s: Putting window [%p][0x%x] remote [0x%x] in the middle.\n", __func__, + (void *) pWin, pWin->drawable.id, nxagentWindow(pWin)); #endif windowList[0] = nxagentWindow(pWin->prevSib); @@ -1528,9 +1539,9 @@ void nxagentReparentWindow(WindowPtr pWin, WindowPtr pOldParent) } #ifdef TEST - fprintf(stderr, "nxagentReparentWindow: window at %p [%lx] previous parent at %p [%lx].\n", - (void*)pWin, nxagentWindow(pWin), - (void*)pOldParent, nxagentWindow(pOldParent)); + fprintf(stderr, "%s: window at [%p][0x%x] remote [0x%x] previous parent at [%p][0x%x] remote [0x%x].\n", __func__, + (void*)pWin, pWin->drawable.id, nxagentWindow(pWin), + (void*)pOldParent, pOldParent->drawable.id, nxagentWindow(pOldParent)); #endif XReparentWindow(nxagentDisplay, nxagentWindow(pWin), @@ -1554,8 +1565,8 @@ Bool nxagentChangeWindowAttributes(WindowPtr pWin, unsigned long mask) XSetWindowAttributes attributes; #ifdef TEST - fprintf(stderr, "nxagentChangeWindowAttributes: Changing attributes for window at [%p] with mask [%lu].\n", - (void *) pWin, mask); + fprintf(stderr, "%s: Changing attributes for window at [%p][0x%x] remote [0x%x] with mask [%lu].\n", __func__, + (void*)pWin, pWin->drawable.id, nxagentWindow(pWin), mask); #endif if (nxagentScreenTrap) @@ -1605,8 +1616,8 @@ Bool nxagentChangeWindowAttributes(WindowPtr pWin, unsigned long mask) nxagentWindowPriv(pWin -> parent) -> hasTransparentChildren = 1; #ifdef DEBUG - fprintf(stderr, "nxagentChangeWindowAttributes: WARNING! Window at [%p] got the " - "hasTransparentChildren flag.\n", (void *) pWin); + fprintf(stderr, "%s: WARNING! Window at [%p] got the " + "hasTransparentChildren flag.\n", __func__, (void *) pWin); #endif } @@ -1629,8 +1640,8 @@ Bool nxagentChangeWindowAttributes(WindowPtr pWin, unsigned long mask) if (nxagentDrawableStatus((DrawablePtr) pWin -> background.pixmap) == NotSynchronized) { #ifdef TEST - fprintf(stderr, "nxagentChangeWindowAttributes: The window at [%p] has the background at [%p] " - "not synchronized.\n", (void *) pWin, (void *) pWin -> background.pixmap); + fprintf(stderr, "%s: The window at [%p] has the background at [%p] " + "not synchronized.\n", __func__, (void *) pWin, (void *) pWin -> background.pixmap); #endif if (nxagentIsCorruptedBackground(pWin -> background.pixmap) == 0) @@ -1719,8 +1730,8 @@ Bool nxagentChangeWindowAttributes(WindowPtr pWin, unsigned long mask) attributes.backing_store = pWin -> backingStore; #ifdef TEST - fprintf(stderr, "nxagentChangeWindowAttributes: Changing backing store value to %d" - " for window at %p.\n", pWin -> backingStore, (void*)pWin); + fprintf(stderr, "%s: Changing backing store value to %d for window at %p.\n", + __func__, pWin -> backingStore, (void*)pWin); #endif } @@ -1792,8 +1803,8 @@ Bool nxagentChangeWindowAttributes(WindowPtr pWin, unsigned long mask) else { #ifdef WARNING - fprintf(stderr, "nxagentChangeWindowAttributes: WARNING! Bad colormap " - "[%lu] for window at [%p].\n", wColormap(pWin), (void *) pWin); + fprintf(stderr, "%s: WARNING! Bad colormap [%lu] for window at [%p].\n", + __func__, wColormap(pWin), (void *) pWin); #endif mask &= ~CWColormap; @@ -1864,7 +1875,8 @@ void nxagentSetWMState(WindowPtr pWin, CARD32 desired) Bool nxagentRealizeWindow(WindowPtr pWin) { #ifdef DEBUG - fprintf(stderr, "%s: running for window [0x%x]....\n", __func__, pWin->drawable.id); + fprintf(stderr, "%s: Called with window [%p][0x%x] remote [0x%x].\n", __func__, + (void *) pWin, pWin->drawable.id, nxagentWindow(pWin)); #endif if (nxagentScreenTrap) @@ -1915,7 +1927,8 @@ Bool nxagentRealizeWindow(WindowPtr pWin) Bool nxagentUnrealizeWindow(WindowPtr pWin) { #ifdef DEBUG - fprintf(stderr, "%s: running for window [0x%x]....\n", __func__, pWin->drawable.id); + fprintf(stderr, "%s: Called with window [%p][0x%x] remote [0x%x].\n", __func__, + (void *) pWin, pWin->drawable.id, nxagentWindow(pWin)); #endif if (nxagentScreenTrap) @@ -1941,7 +1954,8 @@ Bool nxagentUnrealizeWindow(WindowPtr pWin) void nxagentFrameBufferPaintWindow(WindowPtr pWin, RegionPtr pRegion, int what) { #ifdef DEBUG - fprintf(stderr, "%s: running for window [0x%x]....\n", __func__, pWin->drawable.id); + fprintf(stderr, "%s: Called with window [%p][0x%x] remote [0x%x].\n", __func__, + (void *) pWin, pWin->drawable.id, nxagentWindow(pWin)); #endif if (pWin->backgroundState == BackgroundPixmap) @@ -1985,7 +1999,8 @@ void nxagentFrameBufferPaintWindow(WindowPtr pWin, RegionPtr pRegion, int what) void nxagentPaintWindowBackground(WindowPtr pWin, RegionPtr pRegion, int what) { #ifdef DEBUG - fprintf(stderr, "%s: running for window [0x%x]....\n", __func__, pWin->drawable.id); + fprintf(stderr, "%s: Called with window [%p][0x%x] remote [0x%x].\n", __func__, + (void *) pWin, pWin->drawable.id, nxagentWindow(pWin)); #endif if (pWin -> realized) @@ -2005,8 +2020,8 @@ void nxagentPaintWindowBackground(WindowPtr pWin, RegionPtr pRegion, int what) #ifdef TEST else { - fprintf(stderr, "nxagentPaintWindowBackground: Saving the operation with window " - "at [%p] not realized.\n", (void *) pWin); + fprintf(stderr, "%s: Saving the operation with window at [%p] not realized.\n", + __func__, (void *) pWin); } #endif @@ -2025,7 +2040,8 @@ void nxagentPaintWindowBackground(WindowPtr pWin, RegionPtr pRegion, int what) void nxagentPaintWindowBorder(WindowPtr pWin, RegionPtr pRegion, int what) { #ifdef DEBUG - fprintf(stderr, "%s: running for window [0x%x]....\n", __func__, pWin->drawable.id); + fprintf(stderr, "%s: Called with window [%p][0x%x] remote [0x%x].\n", __func__, + (void *) pWin, pWin->drawable.id, nxagentWindow(pWin)); #endif /* @@ -2069,7 +2085,8 @@ void nxagentPaintWindowBorder(WindowPtr pWin, RegionPtr pRegion, int what) void nxagentCopyWindow(WindowPtr pWin, xPoint oldOrigin, RegionPtr oldRegion) { #ifdef DEBUG - fprintf(stderr, "%s: running for window [0x%x]....\n", __func__, pWin->drawable.id); + fprintf(stderr, "%s: Called with window [%p][0x%x] remote [0x%x].\n", __func__, + (void *) pWin, pWin->drawable.id, nxagentWindow(pWin)); #endif fbCopyWindow(pWin, oldOrigin, oldRegion); @@ -2086,6 +2103,11 @@ void nxagentCopyWindow(WindowPtr pWin, xPoint oldOrigin, RegionPtr oldRegion) */ void nxagentClipNotify(WindowPtr pWin, int dx, int dy) { + #ifdef DEBUG + fprintf(stderr, "%s: Called with window [%p][0x%x] remote [0x%x].\n", __func__, + (void *) pWin, pWin->drawable.id, nxagentWindow(pWin)); + #endif + /* * nxagentConfigureWindow(pWin, CWStackMode); */ @@ -2117,7 +2139,8 @@ void nxagentClipNotify(WindowPtr pWin, int dx, int dy) void nxagentWindowExposures(WindowPtr pWin, RegionPtr pRgn, RegionPtr other_exposed) { #ifdef DEBUG - fprintf(stderr, "%s: running for window [0x%x]....\n", __func__, pWin->drawable.id); + fprintf(stderr, "%s: Called with window [%p][0x%x] remote [0x%x].\n", __func__, + (void *) pWin, pWin->drawable.id, nxagentWindow(pWin)); #endif /* @@ -2161,7 +2184,7 @@ void nxagentWindowExposures(WindowPtr pWin, RegionPtr pRgn, RegionPtr other_expo if (!nxagentExposeArrayIsInitialized) { #ifdef TEST - fprintf(stderr, "nxagentWindowExposures: Initializing expose queue.\n"); + fprintf(stderr, "%s: Initializing expose queue.\n", __func__); #endif for (int i = 0; i < EXPOSED_SIZE; i++) @@ -2229,8 +2252,8 @@ void nxagentWindowExposures(WindowPtr pWin, RegionPtr pRgn, RegionPtr other_expo nxagentExposeQueue.exposures[index].remoteRegion, &temp); #ifdef TEST - fprintf(stderr, "nxagentWindowExposures: Added region to remoteRegion for window [%ld] to position [%d].\n", - nxagentWindow(pWin), nxagentExposeQueue.length); + fprintf(stderr, "%s: Added region to remoteRegion for window [%p][0x%x] remote [0x%x] to queue pos [%d].\n", __func__, + (void *)pWin, pWin->drawable.id, nxagentWindow(pWin), nxagentExposeQueue.length); #endif } else @@ -2239,8 +2262,8 @@ void nxagentWindowExposures(WindowPtr pWin, RegionPtr pRgn, RegionPtr other_expo nxagentExposeQueue.exposures[index].localRegion, &temp); #ifdef TEST - fprintf(stderr, "nxagentWindowExposures: Added region to localRegion for window [%ld] to position [%d].\n", - nxagentWindow(pWin), nxagentExposeQueue.length); + fprintf(stderr, "%s: Added region to localRegion for window [%p][0x%x] remote [0x%x] to queue pos [%d].\n", __func__, + (void *)pWin, pWin->drawable.id, nxagentWindow(pWin), nxagentExposeQueue.length); #endif } @@ -2249,7 +2272,7 @@ void nxagentWindowExposures(WindowPtr pWin, RegionPtr pRgn, RegionPtr other_expo nxagentExposeQueue.exposures[index].serial = nxagentExposeSerial; #ifdef TEST - fprintf(stderr, "nxagentWindowExposures: Added region to queue with serial [%d].\n", nxagentExposeSerial); + fprintf(stderr, "%s: Added region to queue with serial [%d].\n", __func__, nxagentExposeSerial); #endif /* @@ -2274,7 +2297,7 @@ void nxagentWindowExposures(WindowPtr pWin, RegionPtr pRgn, RegionPtr other_expo RegionUninit(&temp); #ifdef TEST - fprintf(stderr, "nxagentWindowExposures: WARNING! Reached maximum size of collect exposures vector.\n"); + fprintf(stderr, "%s: WARNING! Reached maximum size of collect exposures vector.\n", __func__); #endif if ((pRgn != NULL && RegionNotEmpty(pRgn) != 0) || @@ -2348,8 +2371,8 @@ void nxagentShapeWindow(WindowPtr pWin) } #ifdef DEBUG - fprintf(stderr, "nxagentShapeWindow: Window at [%p][%ld].\n", - (void *) pWin, nxagentWindow(pWin)); + fprintf(stderr, "%s: Called with window [%p][0x%x] remote [0x%x].\n", __func__, + (void *) pWin, pWin->drawable.id, nxagentWindow(pWin)); #endif /* @@ -2360,13 +2383,13 @@ void nxagentShapeWindow(WindowPtr pWin) wBoundingShape(pWin))) { #ifdef DEBUG - fprintf(stderr, "nxagentShapeWindow: Bounding shape differs.\n"); + fprintf(stderr, "%s: Bounding shape differs.\n", __func__); #endif if (wBoundingShape(pWin)) { #ifdef DEBUG - fprintf(stderr, "nxagentShapeWindow: wBounding shape has [%ld] rects.\n", + fprintf(stderr, "%s: wBounding shape has [%ld] rects.\n", __func__ RegionNumRects(wBoundingShape(pWin))); #endif @@ -2400,7 +2423,7 @@ void nxagentShapeWindow(WindowPtr pWin) else { #ifdef DEBUG - fprintf(stderr, "nxagentShapeWindow: wBounding shape does not exist. Removing the shape.\n"); + fprintf(stderr, "%s: wBounding shape does not exist. Removing the shape.\n", __func__); #endif RegionEmpty(nxagentWindowPriv(pWin)->boundingShape); @@ -2413,13 +2436,13 @@ void nxagentShapeWindow(WindowPtr pWin) if (!nxagentRegionEqual(nxagentWindowPriv(pWin)->clipShape, wClipShape(pWin))) { #ifdef DEBUG - fprintf(stderr, "nxagentShapeWindow: Clip shape differs.\n"); + fprintf(stderr, "%s: Clip shape differs.\n", __func__); #endif if (wClipShape(pWin)) { #ifdef DEBUG - fprintf(stderr, "nxagentShapeWindow: wClip shape has [%ld] rects.\n", + fprintf(stderr, "%s: wClip shape has [%ld] rects.\n", __func__, RegionNumRects(wClipShape(pWin))); #endif @@ -2453,7 +2476,7 @@ void nxagentShapeWindow(WindowPtr pWin) else { #ifdef DEBUG - fprintf(stderr, "nxagentShapeWindow: wClip shape does not exist. Removing the shape.\n"); + fprintf(stderr, "%s: wClip shape does not exist. Removing the shape.\n", __func__); #endif RegionEmpty(nxagentWindowPriv(pWin)->clipShape); @@ -2467,6 +2490,11 @@ void nxagentShapeWindow(WindowPtr pWin) static int nxagentForceExposure(WindowPtr pWin, void * ptr) { + #ifdef DEBUG + fprintf(stderr, "%s: Called with window [%p][0x%x] remote [0x%x].\n", __func__, + (void *) pWin, pWin->drawable.id, nxagentWindow(pWin)); + #endif + if (pWin -> drawable.class != InputOnly) { WindowPtr pRoot = pWin->drawable.pScreen->root; @@ -2534,7 +2562,7 @@ void nxagentMapDefaultWindows(void) */ #ifdef TEST - fprintf(stderr, "nxagentMapDefaultWindows: Showing the splash window.\n"); + fprintf(stderr, "%s: Showing the splash window.\n", __func__); #endif nxagentShowSplashWindow(nxagentDefaultWindows[pScreen->myNum]); @@ -2550,7 +2578,7 @@ void nxagentMapDefaultWindows(void) if (!nxagentOption(Shadow) || !nxagentWMIsRunning) { #ifdef TEST - fprintf(stderr, "nxagentMapDefaultWindows: Mapping default window id [%ld].\n", + fprintf(stderr, "%s: Mapping default window id [0x%x].\n", __func__, nxagentDefaultWindows[pScreen->myNum]); #endif @@ -2596,7 +2624,7 @@ void nxagentMapDefaultWindows(void) if (nxagentIconWindow != None) { #ifdef TEST - fprintf(stderr, "nxagentMapDefaultWindows: Mapping icon window id [%ld].\n", + fprintf(stderr, "%s: Mapping icon window id [0x%x].\n", __func__, nxagentIconWindow); #endif @@ -2614,7 +2642,7 @@ void nxagentMapDefaultWindows(void) } #ifdef TEST - fprintf(stderr, "nxagentMapDefaultWindows: Completed mapping of default windows.\n"); + fprintf(stderr, "%s: Completed mapping of default windows.\n", __func__); #endif } @@ -2623,7 +2651,7 @@ Bool nxagentDisconnectAllWindows(void) Bool succeeded = True; #if defined(NXAGENT_RECONNECT_DEBUG) || defined(NXAGENT_RECONNECT_WINDOW_DEBUG) - fprintf(stderr, "nxagentDisconnectAllWindows\n"); + fprintf(stderr, "%s\n", __func__); #endif for (int i = 0; i < screenInfo.numScreens; i++) @@ -2633,7 +2661,7 @@ Bool nxagentDisconnectAllWindows(void) } #ifdef NXAGENT_RECONNECT_WINDOW_DEBUG - fprintf(stderr, "nxagentDisconnectAllWindows: all windows disconnected\n"); + fprintf(stderr, "%s: all windows disconnected\n", __func__); #endif return succeeded; @@ -2663,8 +2691,8 @@ void nxagentDisconnectWindow(void * p0, XID x1, void * p2) #endif #ifdef NXAGENT_RECONNECT_CURSOR_DEBUG - fprintf(stderr, "nxagentDisconnectWindow: window %p - disconnecting cursor %p ID %lx\n", - pWin, pCursor, nxagentCursor(pCursor, pScreen)); + fprintf(stderr, "%s: window [%p] - disconnecting cursor [%p][0x%x]\n", __func__, + (void *)pWin, (void *))pCursor, nxagentCursor(pCursor, pScreen)); #endif nxagentDisconnectCursor(pCursor, (XID)0, pBool); @@ -2672,8 +2700,8 @@ void nxagentDisconnectWindow(void * p0, XID x1, void * p2) if (!*pBool) { #ifdef WARNING - fprintf(stderr, "nxagentDisconnectWindow: WARNING failed disconnection of cursor at [%p]" - " for window at [%p]: ignoring it.\n", (void*)pCursor, (void*)pWin); + fprintf(stderr, "%s: WARNING failed disconnection of cursor at [%p]" + " for window at [%p]: ignoring it.\n", __func__, (void*)pCursor, (void*)pWin); #endif *pBool = True; @@ -2682,8 +2710,8 @@ void nxagentDisconnectWindow(void * p0, XID x1, void * p2) #ifdef NXAGENT_RECONNECT_CURSOR_DEBUG else if (pCursor) { - fprintf(stderr, "nxagentDisconnectWindow: window %p - cursor %p already disconnected\n", - pWin, pCursor); + fprintf(stderr, "%s: window [%p] - cursor [%p] already disconnected\n", __func__, + (void *)pWin, (void *)pCursor); } #endif @@ -2693,12 +2721,12 @@ void nxagentDisconnectWindow(void * p0, XID x1, void * p2) if (DeleteProperty(pWin, prop) != Success) { - fprintf(stderr, "nxagentDisconnectWindow: Deleting NX_REAL_WINDOW failed.\n"); + fprintf(stderr, "%s: Deleting NX_REAL_WINDOW failed.\n", __func__); } #ifdef DEBUG else { - fprintf(stderr, "nxagentDisconnectWindow: Deleting NX_REAL_WINDOW from Window ID [%x].\n", nxagentWindowPriv(pWin)->window); + fprintf(stderr, "%s: Deleting NX_REAL_WINDOW from Window ID [%x].\n", __func__, nxagentWindowPriv(pWin)->window); } #endif } @@ -2719,13 +2747,13 @@ Bool nxagentReconnectAllWindows(void *p0) */ #if defined(NXAGENT_RECONNECT_DEBUG) || defined(NXAGENT_RECONNECT_WINDOW_DEBUG) - fprintf(stderr, "nxagentReconnectAllWindows\n"); + fprintf(stderr, "%s\n", __func__); #endif if (screenInfo.screens[0]->root -> backgroundState == BackgroundPixmap && screenInfo.screens[0]->root -> background.pixmap == NULL) { - FatalError("nxagentReconnectAllWindows: correct the FIXME\n"); + FatalError("%s: correct the FIXME\n", __func__); } if (nxagentOption(Fullscreen)) @@ -2737,7 +2765,7 @@ Bool nxagentReconnectAllWindows(void *p0) if (!nxagentLoopOverWindows(nxagentReconnectWindow)) { #ifdef WARNING - fprintf(stderr, "nxagentReconnectAllWindows: couldn't recreate windows\n"); + fprintf(stderr, "%s: couldn't recreate windows\n", __func__); #endif return False; @@ -2745,13 +2773,13 @@ Bool nxagentReconnectAllWindows(void *p0) #ifdef NXAGENT_RECONNECT_WINDOW_DEBUG XSync(nxagentDisplay, 0); - fprintf(stderr, "nxagentReconnectAllWindows: all windows recreated\n"); + fprintf(stderr, "%s: all windows recreated\n", __func__); #endif if (!nxagentLoopOverWindows(nxagentReconfigureWindow)) { #ifdef WARNING - fprintf(stderr, "nxagentReconnectAllWindows: couldn't reconfigure windows\n"); + fprintf(stderr, "%s: couldn't reconfigure windows\n", __func__); #endif return False; @@ -2780,13 +2808,13 @@ Bool nxagentReconnectAllWindows(void *p0) #ifdef NXAGENT_RECONNECT_WINDOW_DEBUG XSync(nxagentDisplay, 0); - fprintf(stderr, "nxagentReconnectAllWindows: All windows reconfigured.\n"); + fprintf(stderr, "%s: All windows reconfigured.\n", __func__); #endif if (!nxagentInitClipboard(screenInfo.screens[0]->root)) { #ifdef WARNING - fprintf(stderr, "nxagentReconnectAllWindows: WARNING! Couldn't initialize the clipboard.\n"); + fprintf(stderr, "%s: WARNING! Couldn't initialize the clipboard.\n", __func__); #endif return False; @@ -2794,7 +2822,7 @@ Bool nxagentReconnectAllWindows(void *p0) #ifdef NXAGENT_RECONNECT_WINDOW_DEBUG XSync(nxagentDisplay, 0); - fprintf(stderr, "nxagentReconnectAllWindows: Clipboard initialized.\n"); + fprintf(stderr, "%s: Clipboard initialized.\n", __func__); #endif #ifdef VIEWPORT_FRAME @@ -2829,20 +2857,20 @@ Bool nxagentSetWindowCursors(void *p0) */ #if defined(NXAGENT_RECONNECT_DEBUG) || defined(NXAGENT_RECONNECT_WINDOW_DEBUG) - fprintf(stderr, "nxagentSetWindowCursors: Going to loop over the windows.\n"); + fprintf(stderr, "%s Going to loop over the windows.\n", __func__); #endif if (!nxagentLoopOverWindows(nxagentReconfigureWindowCursor)) { #ifdef WARNING - fprintf(stderr, "nxagentSetWindowCursors: WARNING! Couldn't configure all windows' cursors.\n"); + fprintf(stderr, "%s WARNING! Couldn't configure all windows' cursors.\n", __func__); #endif return False; } #ifdef NXAGENT_RECONNECT_WINDOW_DEBUG - fprintf(stderr, "nxagentSetWindowCursors: All cursors configured.\n"); + fprintf(stderr, "%s All cursors configured.\n", __func__); #endif nxagentReDisplayCurrentCursor(); @@ -2895,7 +2923,8 @@ static void nxagentReconnectWindow(void * param0, XID param1, void * data_buffer } #ifdef NXAGENT_RECONNECT_WINDOW_DEBUG - fprintf(stderr, "nxagentReconnectWindow: %p - ID %lx\n", pWin, nxagentWindow(pWin)); + fprintf(stderr, "%s: Called with window [%p][0x%x] remote [0x%x].\n", __func__, + (void *) pWin, pWin->drawable.id, nxagentWindow(pWin)); #endif if (pWin->drawable.class == InputOnly) @@ -2968,10 +2997,10 @@ static void nxagentReconnectWindow(void * param0, XID param1, void * data_buffer #endif #ifdef TEST - fprintf(stderr, "nxagentReconnectWindow: Going to create new window.\n"); - fprintf(stderr, "nxagentReconnectWindow: Recreating %swindow at %p current event mask = %lX mask & CWEventMask = %ld " - "event_mask = %lX\n", - nxagentWindowTopLevel(pWin) ? "toplevel " : "", (void*)pWin, pWin -> eventMask, + fprintf(stderr, "%s: Going to create new remote window.\n", __func__); + fprintf(stderr, "%s: Recreating %swindow at [%p][0x%x] current event mask [%X] mask & CWEventMask [%ld] " + "event_mask [%lX]\n", __func__, + nxagentWindowTopLevel(pWin) ? "toplevel " : "", (void*)pWin, pWin->drawable.id, pWin -> eventMask, mask & CWEventMask, attributes.event_mask); #endif @@ -3037,8 +3066,7 @@ static void nxagentReconnectWindow(void * param0, XID param1, void * data_buffer #endif #ifdef TEST - fprintf(stderr, "nxagentReconnectWindow: Created new window with id [0x%x].\n", - nxagentWindowPriv(pWin)->window); + fprintf(stderr, "%s: Recreated new remote window with id [0x%x].\n", __func__, nxagentWindow(pWin)); #endif /* @@ -3088,7 +3116,7 @@ static void nxagentReconnectWindow(void * param0, XID param1, void * data_buffer type == XA_WM_SIZE_HINTS) { #ifdef TEST - fprintf(stderr, "nxagentReconnectWindow: setting WMSizeHints on window %p [%lx - %lx].\n", + fprintf(stderr, "%s: setting WMSizeHints on window %p [0x%x - 0x%x].\n", __func__, (void*)pWin, pWin -> drawable.id, nxagentWindow(pWin)); #endif @@ -3131,7 +3159,7 @@ static void nxagentReconnectWindow(void * param0, XID param1, void * data_buffer else { #ifdef WARNING - fprintf(stderr, "nxagentReconnectWindow: Failed to get property WM_NORMAL_HINTS on window %p\n", + fprintf(stderr, "%s: Failed to get property WM_NORMAL_HINTS on window [%p]\n", __func__, (void*)pWin); #endif } @@ -3157,12 +3185,12 @@ static void nxagentReconnectWindow(void * param0, XID param1, void * data_buffer if (ChangeWindowProperty(pWin, prop, XA_WINDOW, 32, PropModeReplace, 1, nxagentWindowPriv(pWin), 1) != Success) { - fprintf(stderr, "nxagentReconnectWindow: Updating NX_REAL_WINDOW failed.\n"); + fprintf(stderr, "%s: Updating NX_REAL_WINDOW failed.\n", __func__); } #ifdef DEBUG else { - fprintf(stderr, "nxagentReconnectWindow: Updated NX_REAL_WINDOW for Window ID [%x].\n", nxagentWindowPriv(pWin)->window); + fprintf(stderr, "%s: Updated NX_REAL_WINDOW for Window ID [%x].\n", __func__, nxagentWindowPriv(pWin)->window); } #endif } @@ -3192,8 +3220,8 @@ static void nxagentReconfigureWindowCursor(void * param0, XID param1, void * dat } #ifdef DEBUG - fprintf(stderr, "nxagentReconfigureWindowCursor: [%p] - ID [%lx] geometry [%d,%d,%d,%d] " - "cursor [%p] - ID [%lx]\n", + fprintf(stderr, "%s: [%p] - ID [%lx] geometry [%d,%d,%d,%d] " + "cursor [%p] - ID [%lx]\n", __func__, pWin, nxagentWindow(pWin), pWin -> drawable.x, pWin -> drawable.y, @@ -3205,7 +3233,7 @@ static void nxagentReconfigureWindowCursor(void * param0, XID param1, void * dat if (nxagentCursor(pCursor, pScreen) == None) { #ifdef NXAGENT_RECONNECT_WINDOW_DEBUG - fprintf(stderr, "nxagentReconfigureWindowCursor: reconnecting valid cursor [%p]\n", + fprintf(stderr, "%s: reconnecting valid cursor [%p]\n", __func__, (void*)pCursor); #endif @@ -3214,8 +3242,8 @@ static void nxagentReconfigureWindowCursor(void * param0, XID param1, void * dat if (!*pBool) { #ifdef WARNING - fprintf(stderr, "nxagentReconfigureWindowCursor: WARNING " - "failed reconnection of cursor at [%p] for window at [%p]: ignoring it.\n", + fprintf(stderr, "%s: WARNING " + "failed reconnection of cursor at [%p] for window at [%p]: ignoring it.\n", __func__, (void*)pCursor, (void*)pWin); #endif @@ -3235,7 +3263,8 @@ static void nxagentReconfigureWindow(void * param0, XID param1, void * data_buff unsigned long mask = 0; #ifdef DEBUG - fprintf(stderr, "nxagentReconfigureWindow: pWin [%p] - ID [%lx]\n", pWin, nxagentWindow(pWin)); + fprintf(stderr, "%s: Called with window [%p][0x%x] remote [0x%x].\n", __func__, + (void *) pWin, pWin->drawable.id, nxagentWindow(pWin)); #endif if (pWin -> drawable.class == InputOnly) @@ -3332,7 +3361,7 @@ static _X_UNUSED Bool nxagentCheckWindowIntegrity(WindowPtr pWin) char *data = calloc(1, length); if (data == NULL) { - FatalError("nxagentCheckWindowIntegrity: Failed to allocate a buffer of size [%d].\n", length); + FatalError("%s: Failed to allocate a buffer of size [%d].\n", __func__, length); } unsigned long plane_mask = AllPlanes; @@ -3367,19 +3396,19 @@ static _X_UNUSED Bool nxagentCheckWindowIntegrity(WindowPtr pWin) #endif #ifdef WARNING - fprintf(stderr, "nxagentCheckWindowIntegrity: Window [%p] geometry [%d,%d], has been realized " - "but the data buffer still differs.\n", (void*) pWin, width, height); - fprintf(stderr, "nxagentCheckWindowIntegrity: bytes_per_line = [%d] byte pad [%d] format [%d].\n", + fprintf(stderr, "%s: Window [%p] geometry [%d,%d], has been realized " + "but the data buffer still differs.\n", __func__, (void*) pWin, width, height); + fprintf(stderr, "%s: bytes_per_line = [%d] byte pad [%d] format [%d].\n", __func__, image -> bytes_per_line, nxagentImagePad(width, height, 0, depth), image->format); - fprintf(stderr, "nxagentCheckWindowIntegrity: image is corrupted!!\n"); + fprintf(stderr, "%s: image is corrupted!!\n", __func__); #endif } else { #ifdef WARNING - fprintf(stderr, "nxagentCheckWindowIntegrity: Window [%p] has been realized " - "now remote and framebuffer data are synchronized.\n", (void*) pWin); + fprintf(stderr, "%s: Window [%p] has been realized " + "now remote and framebuffer data are synchronized.\n", __func__ ,(void*) pWin); #endif } @@ -3393,7 +3422,7 @@ static _X_UNUSED Bool nxagentCheckWindowIntegrity(WindowPtr pWin) else { #ifdef WARNING - fprintf(stderr, "nxagentCheckWindowIntegrity: ignored window [%p] with geometry [%d,%d].\n", + fprintf(stderr, "%s: ignored window [%p] with geometry [%d,%d].\n", __func__, (void*) pWin, width, height); #endif } @@ -3498,8 +3527,8 @@ void nxagentFlushConfigureWindow(void) }; #ifdef DEBUG - fprintf(stderr, "nxagentFlushConfigureWindow: Sending synch ConfigureWindow for " - "index [%d] serial [%d].\n", i, nxagentExposeQueue.exposures[i].serial); + fprintf(stderr, "%s: Sending synch ConfigureWindow for " + "index [%d] serial [%d].\n", __func__, i, nxagentExposeQueue.exposures[i].serial); #endif XConfigureWindow(nxagentDisplay, nxagentConfiguredSynchroWindow, @@ -3545,9 +3574,12 @@ void nxagentPostValidateTree(WindowPtr pParent, WindowPtr pChild, VTKind kind) */ void nxagentAddConfiguredWindow(WindowPtr pWin, unsigned int valuemask) { - unsigned int mask; + #ifdef DEBUG + fprintf(stderr, "%s: Called with window [%p][0x%x] remote [0x%x] with mask [%x].\n", __func__, + (void *) pWin, pWin->drawable.id, nxagentWindow(pWin), valuemask); + #endif - mask = valuemask & (CWSibling | CWX | CWY | CWWidth | CWHeight | + unsigned int mask = valuemask & (CWSibling | CWX | CWY | CWWidth | CWHeight | CWBorderWidth | CWStackMode | CW_Map | CW_Update | CW_Shape); valuemask &= ~(CWSibling | CWX | CWY | CWWidth | CWHeight | CWBorderWidth | CWStackMode); @@ -3622,6 +3654,11 @@ void nxagentDeleteConfiguredWindow(WindowPtr pWin) { ConfiguredWindowStruct *index, *previous, *tmp; + #ifdef DEBUG + fprintf(stderr, "%s: Called with window [%p][0x%x] remote [0x%x].\n", __func__, + (void *) pWin, pWin->drawable.id, nxagentWindow(pWin)); + #endif + index = nxagentConfiguredWindowList; while (index) @@ -3674,6 +3711,11 @@ void nxagentAddStaticResizedWindow(WindowPtr pWin, unsigned long sequence, int o { StaticResizedWindowStruct *tmp = nxagentStaticResizedWindowList; + #ifdef DEBUG + fprintf(stderr, "%s: Called with window [%p][0x%x] remote [0x%x].\n", __func__, + (void *) pWin, pWin->drawable.id, nxagentWindow(pWin)); + #endif + nxagentStaticResizedWindowList = malloc(sizeof(StaticResizedWindowStruct)); if (!nxagentStaticResizedWindowList) { @@ -3778,13 +3820,13 @@ void nxagentEmptyBackingStoreRegion(void * param0, XID param1, void * data_buffe RegionEmpty(&pBackingStore->SavedRegion); #ifdef TEST - fprintf(stderr, "nxagentEmptyBackingStoreRegion: Emptying saved region for window at [%p].\n", (void*) pWin); + fprintf(stderr, "%s: Emptying saved region for window at [%p].\n", __func__, (void*) pWin); #endif if (pBackingStore -> pBackingPixmap != NULL) { #ifdef TEST - fprintf(stderr, "nxagentEmptyBackingStoreRegion: Emptying corrupted region for drawable at [%p].\n", + fprintf(stderr, "%s: Emptying corrupted region for drawable at [%p].\n", __func__, (void*) pBackingStore -> pBackingPixmap); #endif @@ -3798,7 +3840,7 @@ void nxagentEmptyAllBackingStoreRegions(void) if (nxagentLoopOverWindows(nxagentEmptyBackingStoreRegion) == 0) { #ifdef WARNING - fprintf(stderr, "nxagentEmptyAllSavedRegions: Failed to empty backing store saved regions.\n"); + fprintf(stderr, "%s: Failed to empty backing store saved regions.\n", __func__); #endif } } @@ -3818,7 +3860,7 @@ int nxagentAddItemBSPixmapList(unsigned long id, PixmapPtr pPixmap, WindowPtr pW if (nxagentBSPixmapList[i] == NULL) { - FatalError("nxagentAddItemBSPixmapList: Failed to allocate memory for nxagentBSPixmapList.\n"); + FatalError("%s: Failed to allocate memory for nxagentBSPixmapList.\n", __func__); } nxagentBSPixmapList[i] -> storingPixmapId = id; @@ -3828,7 +3870,7 @@ int nxagentAddItemBSPixmapList(unsigned long id, PixmapPtr pPixmap, WindowPtr pW nxagentBSPixmapList[i] -> backingStoreY = bsy; #ifdef TEST - fprintf(stderr, "nxagentAddItemBSPixmapList: Added Pixmap with id [%lu] to nxagentBSPixmapList.\n", id); + fprintf(stderr, "%s: Added Pixmap with id [%lu] to nxagentBSPixmapList.\n", __func__, id); #endif return 1; @@ -3842,7 +3884,7 @@ int nxagentAddItemBSPixmapList(unsigned long id, PixmapPtr pPixmap, WindowPtr pW nxagentBSPixmapList[i] -> backingStoreY = bsy; #ifdef TEST - fprintf(stderr, "nxagentAddItemBSPixmapList: Updated existing item for id [%lu].\n", id); + fprintf(stderr, "%s: Updated existing item for id [%lu].\n", __func__, id); #endif return 1; @@ -3850,7 +3892,7 @@ int nxagentAddItemBSPixmapList(unsigned long id, PixmapPtr pPixmap, WindowPtr pW } #ifdef TEST - fprintf(stderr, "nxagentAddItemBSPixmapList: WARNING! List item full.\n"); + fprintf(stderr, "%s: WARNING! List item full.\n", __func__); #endif return 0; @@ -3886,7 +3928,7 @@ int nxagentRemoveItemBSPixmapList(unsigned long pixmapId) } #ifdef TEST - fprintf(stderr, "nxagentRemoveItemBSPixmapList: Removed Pixmap with id [%lu] from list.\n", + fprintf(stderr, "%s: Removed Pixmap with id [%lu] from list.\n", __func__, pixmapId); #endif @@ -3895,7 +3937,7 @@ int nxagentRemoveItemBSPixmapList(unsigned long pixmapId) } #ifdef TEST - fprintf(stderr, "nxagentRemoveItemBSPixmapList: WARNING! Can't remove item [%lu]: item not found.\n", + fprintf(stderr, "%s: WARNING! Can't remove item [%lu]: item not found.\n", __func__, pixmapId); #endif From 9266d708ec5fc372b17574deafbda657308584dc Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Tue, 4 Jun 2024 21:52:51 +0200 Subject: [PATCH 78/89] Window.c: add missing include required for nxagentImagePad --- nx-X11/programs/Xserver/hw/nxagent/Window.c | 24 +++++++++++++-------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/nx-X11/programs/Xserver/hw/nxagent/Window.c b/nx-X11/programs/Xserver/hw/nxagent/Window.c index f1a4301647..0be290edb8 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Window.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Window.c @@ -63,6 +63,7 @@ #include "Composite.h" #include "Events.h" #include "Utils.h" +#include "Image.h" #include #include "compext/Compext.h" @@ -400,7 +401,7 @@ Bool nxagentCreateWindow(WindowPtr pWin) { char *winname = NULL; - if (-1 != asprintf(&winname, "%s %s[0x%lx]", nxagentWindowName, + if (-1 != asprintf(&winname, "%s %s[0x%x]", nxagentWindowName, (pWin->drawable.id == pWin->drawable.pScreen->root->drawable.id) ? "Root" : "Private", pWin->drawable.id)) { @@ -503,7 +504,7 @@ void nxagentSetVersionProperty(WindowPtr pWin) #ifdef DEBUG else { - fprintf(stderr, "%s: Added property [%s], value [%s] for root window [%x].\n", __func__, name, NX_VERSION_CURRENT_STRING, pWin); + fprintf(stderr, "%s: Added property [%s], value [%s] for root window [%p].\n", __func__, name, NX_VERSION_CURRENT_STRING, (void *)pWin); } #endif } @@ -1881,6 +1882,9 @@ Bool nxagentRealizeWindow(WindowPtr pWin) if (nxagentScreenTrap) { + #ifdef DEBUG + fprintf(stderr, "%s: doing nothing because of nxagentScreenTrap\n", __func__); + #endif return True; } @@ -1920,6 +1924,9 @@ Bool nxagentRealizeWindow(WindowPtr pWin) nxagentLastWindowDestroyed = False; + #ifdef DEBUG + fprintf(stderr, "%s: leaving...\n", __func__); + #endif return True; } @@ -2389,7 +2396,7 @@ void nxagentShapeWindow(WindowPtr pWin) if (wBoundingShape(pWin)) { #ifdef DEBUG - fprintf(stderr, "%s: wBounding shape has [%ld] rects.\n", __func__ + fprintf(stderr, "%s: wBounding shape has [%d] rects.\n", __func__, RegionNumRects(wBoundingShape(pWin))); #endif @@ -2442,7 +2449,7 @@ void nxagentShapeWindow(WindowPtr pWin) if (wClipShape(pWin)) { #ifdef DEBUG - fprintf(stderr, "%s: wClip shape has [%ld] rects.\n", __func__, + fprintf(stderr, "%s: wClip shape has [%d] rects.\n", __func__, RegionNumRects(wClipShape(pWin))); #endif @@ -3054,7 +3061,7 @@ static void nxagentReconnectWindow(void * param0, XID param1, void * data_buffer { char *winname = NULL; - if (-1 != asprintf(&winname, "%s %s[0x%lx]", nxagentWindowName, + if (-1 != asprintf(&winname, "%s %s[0x%x]", nxagentWindowName, (pWin->drawable.id == pWin->drawable.pScreen->root->drawable.id) ? "Root" : "Private", pWin->drawable.id)) { @@ -3220,14 +3227,13 @@ static void nxagentReconfigureWindowCursor(void * param0, XID param1, void * dat } #ifdef DEBUG - fprintf(stderr, "%s: [%p] - ID [%lx] geometry [%d,%d,%d,%d] " - "cursor [%p] - ID [%lx]\n", __func__, - pWin, nxagentWindow(pWin), + fprintf(stderr, "%s: [%p][0x%x] geometry [%d,%d,%d,%d] cursor [%p][0x%x]\n", __func__, + (void *)pWin, nxagentWindow(pWin), pWin -> drawable.x, pWin -> drawable.y, pWin -> drawable.width, pWin -> drawable.height, - pCursor, nxagentCursor(pCursor, pScreen)); + (void *)pCursor, nxagentCursor(pCursor, pScreen)); #endif if (nxagentCursor(pCursor, pScreen) == None) From 9974507a503daaac02652419a40a13aeea85212b Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Tue, 4 Jun 2024 22:05:58 +0200 Subject: [PATCH 79/89] Window.c: fix comments --- nx-X11/programs/Xserver/hw/nxagent/Window.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/nx-X11/programs/Xserver/hw/nxagent/Window.c b/nx-X11/programs/Xserver/hw/nxagent/Window.c index 0be290edb8..c07920a0c5 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Window.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Window.c @@ -1872,7 +1872,7 @@ void nxagentSetWMState(WindowPtr pWin, CARD32 desired) * exposure events for underlying windows; this is taken care of by * DIX. DIX does, however, call PaintWindowBackground() and * PaintWindowBorder() to perform some of these. --+ */ + */ Bool nxagentRealizeWindow(WindowPtr pWin) { #ifdef DEBUG @@ -3016,7 +3016,7 @@ static void nxagentReconnectWindow(void * param0, XID param1, void * data_buffer * server for windows. The NXWin minimize the windows moving * them out of the screen area, this behaviour can cause * problem when a rootless session is disconnected and an - * apps is minimized. It will be solved with new Xorg + * app is minimized. It will be solved with new Xorg * version of the NXWin server. */ From 48fd5937aca3abaed0a4fd4d8ea105c3dc5c0c69 Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Tue, 4 Jun 2024 23:45:38 +0200 Subject: [PATCH 80/89] Window.c: use shorter macro to retrieve the remote window nxagentWindowPriv(pWin)->window is identical to nxagentWindow(pWin) --- nx-X11/programs/Xserver/hw/nxagent/Window.c | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/nx-X11/programs/Xserver/hw/nxagent/Window.c b/nx-X11/programs/Xserver/hw/nxagent/Window.c index c07920a0c5..1b34687a52 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Window.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Window.c @@ -394,7 +394,7 @@ Bool nxagentCreateWindow(WindowPtr pWin) { fprintf(stderr, "NXAGENT_WINDOW_ID: %s_WINDOW,WID:[0x%x],INT:[0x%x]\n", (pWin->drawable.id == pWin->drawable.pScreen->root->drawable.id) ? "ROOT" : "PRIVATE", - nxagentWindowPriv(pWin)->window, pWin->drawable.id); + nxagentWindow(pWin), pWin->drawable.id); } #ifdef DEBUG @@ -405,7 +405,7 @@ Bool nxagentCreateWindow(WindowPtr pWin) (pWin->drawable.id == pWin->drawable.pScreen->root->drawable.id) ? "Root" : "Private", pWin->drawable.id)) { - Xutf8SetWMProperties(nxagentDisplay, nxagentWindowPriv(pWin)->window, + Xutf8SetWMProperties(nxagentDisplay, nxagentWindow(pWin), winname, winname, NULL , 0 , NULL, NULL, NULL); SAFE_free(winname); } @@ -413,8 +413,7 @@ Bool nxagentCreateWindow(WindowPtr pWin) #endif #ifdef TEST - fprintf(stderr, "%s: Created new window with id [0x%x].\n", __func__, - nxagentWindowPriv(pWin)->window); + fprintf(stderr, "%s: Created new remote window with id [0x%x].\n", __func__, nxagentWindow(pWin)); #endif /* @@ -427,7 +426,7 @@ Bool nxagentCreateWindow(WindowPtr pWin) XlibAtom prop = nxagentMakeAtom("WM_PROTOCOLS", strlen("WM_PROTOCOLS"), True); XlibAtom atom = nxagentMakeAtom("WM_DELETE_WINDOW", strlen("WM_DELETE_WINDOW"), True); - XSetWMProtocols(nxagentDisplay, nxagentWindowPriv(pWin)->window, &atom, 1); + XSetWMProtocols(nxagentDisplay, nxagentWindow(pWin), &atom, 1); nxagentAddPropertyToList(prop, pWin); @@ -453,7 +452,7 @@ Bool nxagentCreateWindow(WindowPtr pWin) #ifdef DEBUG else { - fprintf(stderr, "%s: Added NX_REAL_WINDOW for Window ID [0x%x].\n", __func__, nxagentWindowPriv(pWin)->window); + fprintf(stderr, "%s: Added NX_REAL_WINDOW for Window ID [0x%x].\n", __func__, nxagentWindow(pWin)); } #endif } @@ -2733,7 +2732,7 @@ void nxagentDisconnectWindow(void * p0, XID x1, void * p2) #ifdef DEBUG else { - fprintf(stderr, "%s: Deleting NX_REAL_WINDOW from Window ID [%x].\n", __func__, nxagentWindowPriv(pWin)->window); + fprintf(stderr, "%s: Deleting NX_REAL_WINDOW from Window ID [%x].\n", __func__, nxagentWindow(pWin)); } #endif } @@ -3054,7 +3053,7 @@ static void nxagentReconnectWindow(void * param0, XID param1, void * data_buffer { fprintf(stderr, "NXAGENT_WINDOW_ID: %s_WINDOW,WID:[0x%x],INT:[0x%x]\n", (pWin->drawable.id == pWin->drawable.pScreen->root->drawable.id) ? "ROOT" : "PRIVATE", - nxagentWindowPriv(pWin)->window, pWin->drawable.id); + nxagentWindow(pWin), pWin->drawable.id); } #ifdef DEBUG @@ -3065,7 +3064,7 @@ static void nxagentReconnectWindow(void * param0, XID param1, void * data_buffer (pWin->drawable.id == pWin->drawable.pScreen->root->drawable.id) ? "Root" : "Private", pWin->drawable.id)) { - Xutf8SetWMProperties(nxagentDisplay, nxagentWindowPriv(pWin)->window, + Xutf8SetWMProperties(nxagentDisplay, nxagentWindow(pWin), winname, winname, NULL , 0 , NULL, NULL, NULL); SAFE_free(winname); } @@ -3197,7 +3196,7 @@ static void nxagentReconnectWindow(void * param0, XID param1, void * data_buffer #ifdef DEBUG else { - fprintf(stderr, "%s: Updated NX_REAL_WINDOW for Window ID [%x].\n", __func__, nxagentWindowPriv(pWin)->window); + fprintf(stderr, "%s: Updated NX_REAL_WINDOW for Window ID [%x].\n", __func__, nxagentWindow(pWin)); } #endif } From 4bed83a2e29fcb1b92b7a8f8cba9134682f80a7a Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Tue, 4 Jun 2024 23:45:58 +0200 Subject: [PATCH 81/89] Window.c: align identical code nxagentCreateWindow and nxagentReconnectWindow are very similar. So let's try to give identical code identical structure. --- nx-X11/programs/Xserver/hw/nxagent/Window.c | 48 +++++++++++---------- 1 file changed, 26 insertions(+), 22 deletions(-) diff --git a/nx-X11/programs/Xserver/hw/nxagent/Window.c b/nx-X11/programs/Xserver/hw/nxagent/Window.c index 1b34687a52..25735afe9c 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Window.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Window.c @@ -351,17 +351,16 @@ Bool nxagentCreateWindow(WindowPtr pWin) nxagentWindowPriv(pWin)->window = XCreateWindow(nxagentDisplay, nxagentWindowParent(pWin), - pWin->origin.x - - wBorderWidth(pWin), - pWin->origin.y - - wBorderWidth(pWin), + pWin->origin.x - wBorderWidth(pWin), + pWin->origin.y - wBorderWidth(pWin), pWin->drawable.width, pWin->drawable.height, pWin->borderWidth, pWin->drawable.depth, pWin->drawable.class, visual, - mask, &attributes); + mask, + &attributes); nxagentWindowPriv(pWin) -> isMapped = 0; nxagentWindowPriv(pWin) -> isRedirected = 0; @@ -2933,6 +2932,8 @@ static void nxagentReconnectWindow(void * param0, XID param1, void * data_buffer (void *) pWin, pWin->drawable.id, nxagentWindow(pWin)); #endif + /* FIXME: this is largely identical to nxagentCreateWindow */ + if (pWin->drawable.class == InputOnly) { mask = CWEventMask; @@ -2942,8 +2943,6 @@ static void nxagentReconnectWindow(void * param0, XID param1, void * data_buffer { mask = CWEventMask | CWBackingStore; - attributes.backing_store = NotUseful; - if (pWin->optional) { mask |= CWBackingPlanes | CWBackingPixel; @@ -2951,6 +2950,13 @@ static void nxagentReconnectWindow(void * param0, XID param1, void * data_buffer attributes.backing_pixel = pWin->optional->backingPixel; } + attributes.backing_store = NotUseful; + + #ifdef TEST + fprintf(stderr, "%s: Backing store on window at [%p] is [%d].\n", __func__, + (void*)pWin, attributes.backing_store); + #endif + /* FIXME: Do we need to set save unders attribute here? */ @@ -2976,7 +2982,7 @@ static void nxagentReconnectWindow(void * param0, XID param1, void * data_buffer attributes.colormap = nxagentDefaultVisualColormap(visual); } } - else + else /* FIXME? nxagentCreateWindow has >if (pWin->optional)< here */ { visual = CopyFromParent; } @@ -3034,20 +3040,18 @@ static void nxagentReconnectWindow(void * param0, XID param1, void * data_buffer } } - nxagentWindow(pWin) = XCreateWindow(nxagentDisplay, - nxagentWindowParent(pWin), - pWin->origin.x - - wBorderWidth(pWin), - pWin->origin.y - - wBorderWidth(pWin), - pWin->drawable.width, - pWin->drawable.height, - pWin->borderWidth, - pWin->drawable.depth, - pWin->drawable.class, - visual, - mask, - &attributes); + nxagentWindowPriv(pWin)->window = XCreateWindow(nxagentDisplay, + nxagentWindowParent(pWin), + pWin->origin.x - wBorderWidth(pWin), + pWin->origin.y - wBorderWidth(pWin), + pWin->drawable.width, + pWin->drawable.height, + pWin->borderWidth, + pWin->drawable.depth, + pWin->drawable.class, + visual, + mask, + &attributes); if (nxagentReportPrivateWindowIds) { From 46e7e4765ca6123e3d13ff40954e039e68b7f10e Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Sat, 8 Jun 2024 17:18:15 +0200 Subject: [PATCH 82/89] Render.c: simplify nxagent{Create,Change}Picture improve readabiliy by using a macro for repeated code --- nx-X11/programs/Xserver/hw/nxagent/Render.c | 258 ++++---------------- 1 file changed, 48 insertions(+), 210 deletions(-) diff --git a/nx-X11/programs/Xserver/hw/nxagent/Render.c b/nx-X11/programs/Xserver/hw/nxagent/Render.c index 1a00370158..5b80824c9c 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Render.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Render.c @@ -540,6 +540,16 @@ void nxagentRenderRealizeCursor(ScreenPtr pScreen, CursorPtr pCursor) nxagentCursor(pCursor, pScreen) = XRenderCreateCursor(nxagentDisplay, nxagentPicture(pPicture), x, y); } +/* little helper for better readable code below */ +#define COPYPICTVAL(_mask, _member, _src) { \ + if (mask & _mask) \ + { \ + attributes._member = (_src); \ + valuemask |= (_mask); \ + nxagentSetPictureRemoteValue(pPicture, _member, attributes._member); \ + } \ + } + int nxagentCreatePicture(PicturePtr pPicture, Mask mask) { XRenderPictureAttributes attributes; @@ -581,96 +591,19 @@ int nxagentCreatePicture(PicturePtr pPicture, Mask mask) memset(&(nxagentPicturePriv(pPicture) -> lastServerValues), 0, sizeof(XRenderPictureAttributes)); - if (mask & CPRepeat) - { - attributes.repeat = (Bool)pPicture -> repeat; - valuemask |= CPRepeat; - nxagentSetPictureRemoteValue(pPicture, repeat, attributes.repeat); - } - - if (mask & CPAlphaMap) - { - attributes.alpha_map = nxagentPicturePriv(pPicture -> alphaMap) -> picture; - valuemask |= CPAlphaMap; - nxagentSetPictureRemoteValue(pPicture, alpha_map, attributes.alpha_map); - } - - if (mask & CPAlphaXOrigin) - { - attributes.alpha_x_origin = pPicture -> alphaOrigin.x; - valuemask |= CPAlphaXOrigin; - nxagentSetPictureRemoteValue(pPicture, alpha_x_origin, attributes.alpha_x_origin); - } - - if (mask & CPAlphaYOrigin) - { - attributes.alpha_y_origin = pPicture -> alphaOrigin.y; - valuemask |= CPAlphaYOrigin; - nxagentSetPictureRemoteValue(pPicture, alpha_y_origin, attributes.alpha_y_origin); - } - - if (mask & CPClipXOrigin) - { - attributes.clip_x_origin = pPicture -> clipOrigin.x; - valuemask |= CPClipXOrigin; - nxagentSetPictureRemoteValue(pPicture, clip_x_origin, attributes.clip_x_origin); - } - - if (mask & CPClipYOrigin) - { - attributes.clip_y_origin = pPicture -> clipOrigin.y; - valuemask |= CPClipYOrigin; - nxagentSetPictureRemoteValue(pPicture, clip_y_origin, attributes.clip_y_origin); - } - - if (mask & CPGraphicsExposure) - { - attributes.graphics_exposures = (Bool)pPicture -> graphicsExposures; - valuemask |= CPGraphicsExposure; - nxagentSetPictureRemoteValue(pPicture, graphics_exposures, attributes.graphics_exposures); - } - - if (mask & CPSubwindowMode) - { - attributes.subwindow_mode = pPicture -> subWindowMode; - valuemask |= CPSubwindowMode; - nxagentSetPictureRemoteValue(pPicture, subwindow_mode, attributes.subwindow_mode); - } - - if (mask & CPClipMask) - { - attributes.clip_mask = None; - valuemask |= CPClipMask; - nxagentSetPictureRemoteValue(pPicture, clip_mask, attributes.clip_mask); - } - - if (mask & CPPolyEdge) - { - attributes.poly_edge = pPicture -> polyEdge; - valuemask |= CPPolyEdge; - nxagentSetPictureRemoteValue(pPicture, poly_edge, attributes.poly_edge); - } - - if (mask & CPPolyMode) - { - attributes.poly_mode = pPicture -> polyMode; - valuemask |= CPPolyMode; - nxagentSetPictureRemoteValue(pPicture, poly_mode, attributes.poly_mode); - } - - if (mask & CPDither) - { - attributes.dither = pPicture -> dither; - valuemask |= CPDither; - nxagentSetPictureRemoteValue(pPicture, dither, attributes.dither); - } - - if (mask & CPComponentAlpha) - { - attributes.component_alpha = pPicture -> componentAlpha; - valuemask |= CPComponentAlpha; - nxagentSetPictureRemoteValue(pPicture, component_alpha, attributes.component_alpha); - } + COPYPICTVAL(CPRepeat, repeat, (Bool)pPicture->repeat); + COPYPICTVAL(CPAlphaMap, alpha_map, nxagentPicturePriv(pPicture->alphaMap)->picture); + COPYPICTVAL(CPAlphaXOrigin, alpha_x_origin, pPicture->alphaOrigin.x); + COPYPICTVAL(CPAlphaYOrigin, alpha_y_origin, pPicture->alphaOrigin.y); + COPYPICTVAL(CPClipXOrigin, clip_x_origin, pPicture->clipOrigin.x); + COPYPICTVAL(CPClipYOrigin, clip_y_origin, pPicture->clipOrigin.y); + COPYPICTVAL(CPGraphicsExposure, graphics_exposures, (Bool)pPicture->graphicsExposures); + COPYPICTVAL(CPSubwindowMode, subwindow_mode, pPicture->subWindowMode); + COPYPICTVAL(CPClipMask, clip_mask, None); + COPYPICTVAL(CPPolyEdge, poly_edge, pPicture->polyEdge); + COPYPICTVAL(CPPolyMode, poly_mode, pPicture->polyMode); + COPYPICTVAL(CPDither, dither, pPicture->dither); + COPYPICTVAL(CPComponentAlpha, component_alpha, pPicture->componentAlpha); XRenderPictFormat *pForm = NULL; @@ -911,6 +844,19 @@ FIXME: Is this useful or just a waste of bandwidth? return 1; } +/* little helper for better readable code below */ +#define CHGPICTVAL(_mask, _member, _src) { \ + if (mask & _mask) \ + { \ + attributes._member = (_src); \ + if (!nxagentCheckPictureRemoteValue(pPicture, _member, attributes._member)) \ + { \ + valuemask |= _mask; \ + nxagentSetPictureRemoteValue(pPicture, _member, attributes._member); \ + } \ + } \ + } + void nxagentChangePicture(PicturePtr pPicture, Mask mask) { XRenderPictureAttributes attributes; @@ -926,86 +872,14 @@ void nxagentChangePicture(PicturePtr pPicture, Mask mask) return; } - if (mask & CPRepeat) - { - attributes.repeat = (Bool)pPicture -> repeat; - if (!nxagentCheckPictureRemoteValue(pPicture, repeat, attributes.repeat)) - { - valuemask |= CPRepeat; - nxagentSetPictureRemoteValue(pPicture, repeat, attributes.repeat); - } - } - - if (mask & CPAlphaMap) - { - attributes.alpha_map = nxagentPicturePriv(pPicture -> alphaMap) -> picture; - if (!nxagentCheckPictureRemoteValue(pPicture, alpha_map, attributes.alpha_map)) - { - valuemask |= CPAlphaMap; - nxagentSetPictureRemoteValue(pPicture, alpha_map, attributes.alpha_map); - } - } - - if (mask & CPAlphaXOrigin) - { - attributes.alpha_x_origin = pPicture -> alphaOrigin.x; - if (!nxagentCheckPictureRemoteValue(pPicture, alpha_x_origin, attributes.alpha_x_origin)) - { - valuemask |= CPAlphaXOrigin; - nxagentSetPictureRemoteValue(pPicture, alpha_x_origin, attributes.alpha_x_origin); - } - } - - if (mask & CPAlphaYOrigin) - { - attributes.alpha_y_origin = pPicture -> alphaOrigin.y; - if (!nxagentCheckPictureRemoteValue(pPicture, alpha_y_origin, attributes.alpha_y_origin)) - { - valuemask |= CPAlphaYOrigin; - nxagentSetPictureRemoteValue(pPicture, alpha_y_origin, attributes.alpha_y_origin); - } - } - - if (mask & CPClipXOrigin) - { - attributes.clip_x_origin = pPicture -> clipOrigin.x; - if (!nxagentCheckPictureRemoteValue(pPicture, clip_x_origin, attributes.clip_x_origin)) - { - valuemask |= CPClipXOrigin; - nxagentSetPictureRemoteValue(pPicture, clip_x_origin, attributes.clip_x_origin); - } - } - - if (mask & CPClipYOrigin) - { - attributes.clip_y_origin = pPicture -> clipOrigin.y; - if (!nxagentCheckPictureRemoteValue(pPicture, clip_y_origin, attributes.clip_y_origin)) - { - valuemask |= CPClipYOrigin; - nxagentSetPictureRemoteValue(pPicture, clip_y_origin, attributes.clip_y_origin); - } - } - - if (mask & CPGraphicsExposure) - { - attributes.graphics_exposures = (Bool)pPicture -> graphicsExposures; - if (!nxagentCheckPictureRemoteValue(pPicture, graphics_exposures, attributes.graphics_exposures)) - { - valuemask |= CPGraphicsExposure; - nxagentSetPictureRemoteValue(pPicture, graphics_exposures, attributes.graphics_exposures); - } - } - - if (mask & CPSubwindowMode) - { - attributes.subwindow_mode = pPicture -> subWindowMode; - if (!nxagentCheckPictureRemoteValue(pPicture, subwindow_mode, attributes.subwindow_mode)) - { - valuemask |= CPSubwindowMode; - nxagentSetPictureRemoteValue(pPicture, subwindow_mode, attributes.subwindow_mode); - } - } - + CHGPICTVAL(CPRepeat, repeat, (Bool)pPicture->repeat); + CHGPICTVAL(CPAlphaMap, alpha_map, nxagentPicturePriv(pPicture->alphaMap)->picture); + CHGPICTVAL(CPAlphaXOrigin, alpha_x_origin, pPicture->alphaOrigin.x); + CHGPICTVAL(CPAlphaYOrigin, alpha_y_origin, pPicture->alphaOrigin.y); + CHGPICTVAL(CPClipXOrigin, clip_x_origin, pPicture->clipOrigin.x); + CHGPICTVAL(CPClipYOrigin, clip_y_origin, pPicture->clipOrigin.y); + CHGPICTVAL(CPGraphicsExposure, graphics_exposures, (Bool)pPicture->graphicsExposures); + CHGPICTVAL(CPSubwindowMode, subwindow_mode, pPicture->subWindowMode); if (mask & CPClipMask) { /* @@ -1021,46 +895,10 @@ void nxagentChangePicture(PicturePtr pPicture, Mask mask) nxagentSetPictureRemoteValue(pPicture, clip_mask, 0); } } - - if (mask & CPPolyEdge) - { - attributes.poly_edge = pPicture -> polyEdge; - if (!nxagentCheckPictureRemoteValue(pPicture, poly_edge, attributes.poly_edge)) - { - valuemask |= CPPolyEdge; - nxagentSetPictureRemoteValue(pPicture, poly_edge, attributes.poly_edge); - } - } - - if (mask & CPPolyMode) - { - attributes.poly_mode = pPicture -> polyMode; - if (!nxagentCheckPictureRemoteValue(pPicture, poly_mode, attributes.poly_mode)) - { - valuemask |= CPPolyMode; - nxagentSetPictureRemoteValue(pPicture, poly_mode, attributes.poly_mode); - } - } - - if (mask & CPDither) - { - attributes.dither = pPicture -> dither; - if (!nxagentCheckPictureRemoteValue(pPicture, dither, attributes.dither)) - { - valuemask |= CPDither; - nxagentSetPictureRemoteValue(pPicture, dither, attributes.dither); - } - } - - if (mask & CPComponentAlpha) - { - attributes.component_alpha = pPicture -> componentAlpha; - if (!nxagentCheckPictureRemoteValue(pPicture, component_alpha, attributes.component_alpha)) - { - valuemask |= CPComponentAlpha; - nxagentSetPictureRemoteValue(pPicture, component_alpha, attributes.component_alpha); - } - } + CHGPICTVAL(CPPolyEdge, poly_edge, pPicture->polyEdge); + CHGPICTVAL(CPPolyMode, poly_mode, pPicture->polyMode); + CHGPICTVAL(CPDither, dither, pPicture->dither); + CHGPICTVAL(CPComponentAlpha, component_alpha, pPicture->componentAlpha); #ifdef TEST if (pPicture && pPicture->pDrawable && pPicture -> pDrawable -> type == DRAWABLE_PIXMAP) From 18073adcbb696ef973122044854c64744101190f Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Sat, 8 Jun 2024 17:25:53 +0200 Subject: [PATCH 83/89] Render.c: fix format specifiers --- nx-X11/programs/Xserver/hw/nxagent/Render.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/nx-X11/programs/Xserver/hw/nxagent/Render.c b/nx-X11/programs/Xserver/hw/nxagent/Render.c index 5b80824c9c..359647f9f3 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Render.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Render.c @@ -556,7 +556,7 @@ int nxagentCreatePicture(PicturePtr pPicture, Mask mask) unsigned long valuemask=0; #ifdef DEBUG - fprintf(stderr, "%s: Function called with picture at [%p] and mask [%ld].\n", __func__, + fprintf(stderr, "%s: Function called with picture at [%p] and mask [%d].\n", __func__, (void *) pPicture, mask); #endif @@ -608,7 +608,7 @@ int nxagentCreatePicture(PicturePtr pPicture, Mask mask) XRenderPictFormat *pForm = NULL; #ifdef DEBUG - fprintf(stderr, "%s: picture format [0x%lx]\n", __func__, pPicture->pFormat); + fprintf(stderr, "%s: picture format [%p]\n", __func__, (void *)pPicture->pFormat); #endif if (pPicture -> pFormat != NULL) @@ -863,7 +863,7 @@ void nxagentChangePicture(PicturePtr pPicture, Mask mask) unsigned long valuemask = 0; #ifdef DEBUG - fprintf(stderr, "%s: Going to change picture at [%p] with mask [%ld].\n", __func__, + fprintf(stderr, "%s: Going to change picture at [%p] with mask [%d].\n", __func__, (void *) pPicture, mask); #endif @@ -1098,8 +1098,8 @@ void nxagentGlyphs(CARD8 op, PicturePtr pSrc, PicturePtr pDst, XGlyphElt8 *elements; #ifdef DEBUG - fprintf(stderr, "%s: pSrc [%p] pSrc->pDrawable [%p] pDst [%p] pDst->pDrawable [%p]\n", - __func__, pSrc, pSrc ? pSrc->pDrawable : NULL, pDst, pDst ? pDst->pDrawable : NULL); + fprintf(stderr, "%s: pSrc [%p] pSrc->pDrawable [%p] pDst [%p] pDst->pDrawable [%p]\n", __func__, + (void *)pSrc, pSrc ? (void *)pSrc->pDrawable : NULL, (void *)pDst, pDst ? (void *)pDst->pDrawable : NULL); #endif if (pSrc == NULL || pDst == NULL) @@ -1767,7 +1767,7 @@ void nxagentQueryFormats(void) nxagentArrayFormats[i] = *pformat; #ifdef DEBUG - fprintf(stderr, "%s: Added format id [%d] type [%d] depth [%d] rgb [%d,%d,%d] " + fprintf(stderr, "%s: Added format id [%ld] type [%d] depth [%d] rgb [%d,%d,%d] " "mask rgb [%d,%d,%d] alpha [%d] alpha mask [%d].\n", __func__, nxagentArrayFormats[i].id, nxagentArrayFormats[i].type, nxagentArrayFormats[i].depth, nxagentArrayFormats[i].direct.red, nxagentArrayFormats[i].direct.green, nxagentArrayFormats[i].direct.blue, @@ -2109,8 +2109,8 @@ static void nxagentPrintFormat(XRenderPictFormat *pFormat) Bool nxagentFillGlyphSet(GlyphSetPtr pGly) { #ifdef DEBUG - fprintf(stderr, "%s: GlyphSet at [%p] Refcount [%ld] Glyphs [%ld] " - "Format [%p] FDepth [%d] RemoteID [%ld].\n", __func__, (void *) pGly, pGly -> refcnt, + fprintf(stderr, "%s: GlyphSet at [%p] Refcount [%d] Glyphs [%d] " + "Format [%p] FDepth [%d] RemoteID [%d].\n", __func__, (void *) pGly, pGly -> refcnt, pGly -> hash.hashSet -> size, (void *) pGly -> format, pGly -> fdepth, pGly -> remoteID); #endif @@ -2296,7 +2296,7 @@ void nxagentReconnectPicture(void * p0, XID x1, void *p2) } #ifdef TEST - fprintf(stderr, "%s: Creating picture at [%p] with drawable [%ld] at [%p].\n", __func__, + fprintf(stderr, "%s: Creating picture at [%p] with drawable [%d] at [%p].\n", __func__, (void *) pPicture, nxagentDrawable(pPicture -> pDrawable), (void *) pPicture -> pDrawable); fprintf(stderr, "%s: Format is at [%p] mask is [%ld] attributes are at [%p].\n", __func__, From 5f7c8e73b3eaceb7651957c2701e055286d8aadd Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Sat, 8 Jun 2024 17:44:53 +0200 Subject: [PATCH 84/89] Render.c: merge masks in nxagentReconnectPicture --- nx-X11/programs/Xserver/hw/nxagent/Render.c | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/nx-X11/programs/Xserver/hw/nxagent/Render.c b/nx-X11/programs/Xserver/hw/nxagent/Render.c index 359647f9f3..f6b91a76d6 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Render.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Render.c @@ -2260,19 +2260,11 @@ void nxagentReconnectPicture(void * p0, XID x1, void *p2) } attributes.subwindow_mode = pPicture -> subWindowMode; - mask |= CPSubwindowMode; - attributes.poly_edge = pPicture -> polyEdge; - mask |= CPPolyEdge; - attributes.poly_mode = pPicture -> polyMode; - mask |= CPPolyMode; - attributes.dither = pPicture -> dither; - mask |= CPDither; - attributes.component_alpha = pPicture -> componentAlpha; - mask |= CPComponentAlpha; + mask |= (CPSubwindowMode | CPPolyEdge | CPPolyMode | CPDither | CPComponentAlpha); XRenderPictFormat *pForm = NULL; From 1873e50a14a4097f2c84e8cb3991f55422080824 Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Sat, 8 Jun 2024 18:05:57 +0200 Subject: [PATCH 85/89] Render.c: some simplifications --- nx-X11/programs/Xserver/hw/nxagent/Render.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/nx-X11/programs/Xserver/hw/nxagent/Render.c b/nx-X11/programs/Xserver/hw/nxagent/Render.c index f6b91a76d6..5113a9798d 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Render.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Render.c @@ -553,14 +553,14 @@ void nxagentRenderRealizeCursor(ScreenPtr pScreen, CursorPtr pCursor) int nxagentCreatePicture(PicturePtr pPicture, Mask mask) { XRenderPictureAttributes attributes; - unsigned long valuemask=0; + unsigned long valuemask = 0; #ifdef DEBUG fprintf(stderr, "%s: Function called with picture at [%p] and mask [%d].\n", __func__, (void *) pPicture, mask); #endif - if (pPicture == NULL) + if (!pPicture) { return 0; } @@ -611,15 +611,15 @@ int nxagentCreatePicture(PicturePtr pPicture, Mask mask) fprintf(stderr, "%s: picture format [%p]\n", __func__, (void *)pPicture->pFormat); #endif - if (pPicture -> pFormat != NULL) + if (pPicture -> pFormat) { pForm = nxagentMatchingFormats(pPicture -> pFormat); nxagentPrintFormat(pForm); } - if (pForm == NULL) + if (!pForm) { - fprintf(stderr, "%s: WARNING! The requested format was not found.\n", __func__); + fprintf(stderr, "%s: WARNING! The requested format was not found - not creating picture.\n", __func__); return 0; } From cefbf13a1d36c538fdbb6ae15b753cb1eeb1e0b5 Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Mon, 24 Jun 2024 22:11:28 +0200 Subject: [PATCH 86/89] Render.c: fix typo --- nx-X11/programs/Xserver/hw/nxagent/Render.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nx-X11/programs/Xserver/hw/nxagent/Render.c b/nx-X11/programs/Xserver/hw/nxagent/Render.c index 5113a9798d..b64a301101 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Render.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Render.c @@ -216,7 +216,7 @@ nxagentCleanGlyphs(xGlyphInfo *gi, bytesToClean = bytesPerLine * height; - #ifdef DUBUG + #ifdef DEBUG fprintf(stderr, "%s: Found glyph with depth 24, bytes to clean is %d" "width in bits is %d bytes per line [%d] height [%d].\n", __func__, bytesToClean, widthInBits, bytesPerLine, height); From cbae2aec0b2536660f97aec60baa28155c56f4e3 Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Mon, 24 Jun 2024 22:20:24 +0200 Subject: [PATCH 87/89] Render.c: improve DEBUG/TEST output add [] around placeholders just as everywhere else. --- nx-X11/programs/Xserver/hw/nxagent/Render.c | 46 ++++++++++----------- 1 file changed, 23 insertions(+), 23 deletions(-) diff --git a/nx-X11/programs/Xserver/hw/nxagent/Render.c b/nx-X11/programs/Xserver/hw/nxagent/Render.c index b64a301101..a4909e1cfa 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Render.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Render.c @@ -202,8 +202,8 @@ nxagentCleanGlyphs(xGlyphInfo *gi, int height = gi -> height; #ifdef DEBUG - fprintf(stderr, "%s: Found a Glyph with Depth %d, width %d, pad %d.\n", __func__, - depth, gi -> width, BitmapPad(dpy)); + fprintf(stderr, "%s: Found a Glyph with Depth [%d], width [%d], pad [%d], nglyphs [%d].\n", __func__, + depth, gi -> width, BitmapPad(dpy), nglyphs); #endif while (nglyphs > 0) @@ -217,8 +217,8 @@ nxagentCleanGlyphs(xGlyphInfo *gi, bytesToClean = bytesPerLine * height; #ifdef DEBUG - fprintf(stderr, "%s: Found glyph with depth 24, bytes to clean is %d" - "width in bits is %d bytes per line [%d] height [%d].\n", __func__, + fprintf(stderr, "%s: Found glyph with depth 24, bytes to clean is [%d]" + "width in bits is [%d] bytes per line [%d] height [%d].\n", __func__, bytesToClean, widthInBits, bytesPerLine, height); #endif @@ -238,7 +238,7 @@ nxagentCleanGlyphs(xGlyphInfo *gi, } #ifdef DUMP - fprintf(stderr, "%s: depth %d, bytesToClean %d, scanline: ", __func__, depth, bytesToClean); + fprintf(stderr, "%s: depth [%d], bytesToClean [%d], scanline: ", __func__, depth, bytesToClean); for (int i = 0; i < bytesPerLine; i++) { fprintf(stderr, "[%d]", images[i]); @@ -270,8 +270,8 @@ nxagentCleanGlyphs(xGlyphInfo *gi, bitsToClean &= 7; #ifdef DEBUG - fprintf(stderr, "%s: bitsToClean &=7 is %d, bytesToCLean is %d." - " byte_order is %d, bitmap_bit_order is %d.\n", __func__, bitsToClean, bytesToClean, + fprintf(stderr, "%s: bitsToClean &=7 is [%d], bytesToCLean is [%d]." + " byte_order is [%d], bitmap_bit_order is [%d].\n", __func__, bitsToClean, bytesToClean, ImageByteOrder(dpy), BitmapBitOrder(dpy)); #endif @@ -285,7 +285,7 @@ nxagentCleanGlyphs(xGlyphInfo *gi, images[i * bytesPerLine - j] = 0x00; #ifdef DEBUG - fprintf(stderr, "%s: byte_order == bitmap_bit_order, cleaning %d, i=%d, j=%d.\n", __func__, + fprintf(stderr, "%s: byte_order == bitmap_bit_order, cleaning [%d], i=[%d], j=[%d].\n", __func__, (i * bytesPerLine - j), i, j); #endif @@ -298,7 +298,7 @@ nxagentCleanGlyphs(xGlyphInfo *gi, images[i * bytesPerLine - j] = 0x00; #ifdef DEBUG - fprintf(stderr, "%s: byte_order %d, bitmap_bit_order %d, cleaning %d, i=%d, j=%d.\n", __func__, + fprintf(stderr, "%s: byte_order [%d], bitmap_bit_order [%d], cleaning [%d], i=[%d], j=[%d].\n", __func__, ImageByteOrder(dpy), BitmapBitOrder(dpy), (i * bytesPerLine - j), i, j); #endif @@ -310,7 +310,7 @@ nxagentCleanGlyphs(xGlyphInfo *gi, images[i * bytesPerLine - j] &= 0xff << bitsToClean; #ifdef DEBUG - fprintf(stderr, "%s: byte_order MSBFirst, cleaning %d, i=%d, j=%d.\n", __func__, + fprintf(stderr, "%s: byte_order MSBFirst, cleaning [%d], i=[%d], j=[%d].\n", __func__, (i * bytesPerLine - j), i, j); #endif } @@ -319,14 +319,14 @@ nxagentCleanGlyphs(xGlyphInfo *gi, images[i * bytesPerLine - j] &= 0xff >> bitsToClean; #ifdef DEBUG - fprintf(stderr, "%s: byte_order LSBFirst, cleaning %d, i=%d, j=%d.\n", __func__, + fprintf(stderr, "%s: byte_order LSBFirst, cleaning [%d], i=[%d], j=[%d].\n", __func__, (i * bytesPerLine - j), i, j); #endif } } #ifdef DUMP - fprintf(stderr, "%s: depth %d, bytesToClean %d, scanline: ", __func__, depth, bytesToClean); + fprintf(stderr, "%s: depth [%d], bytesToClean [%d], scanline: ", __func__, depth, bytesToClean); for (int i = 0; i < bytesPerLine; i++) { fprintf(stderr, "[%d]", images[i]); @@ -351,12 +351,12 @@ nxagentCleanGlyphs(xGlyphInfo *gi, bytesToClean = bytesPerLine - widthInBytes; #ifdef DEBUG - fprintf(stderr, "%s: nglyphs is %d, width of glyph in bits is %d, in bytes is %d.\n", __func__, + fprintf(stderr, "%s: nglyphs is [%d], width of glyph in bits is [%d], in bytes is [%d].\n", __func__, nglyphs, widthInBits, widthInBytes); - fprintf(stderr, "%s: bytesPerLine is %d bytes, there are %d scanlines.\n", __func__, bytesPerLine, height); + fprintf(stderr, "%s: bytesPerLine is [%d] bytes, there are [%d] scanlines.\n", __func__, bytesPerLine, height); - fprintf(stderr, "%s: Bytes to clean for each scanline are %d.\n", __func__, bytesToClean); + fprintf(stderr, "%s: Bytes to clean for each scanline are [%d].\n", __func__, bytesToClean); #endif if (bytesToClean > 0) @@ -373,7 +373,7 @@ nxagentCleanGlyphs(xGlyphInfo *gi, } #ifdef DUMP - fprintf(stderr, "%s: depth %d, bytesToClean %d, scanline: ", __func__, depth, bytesToClean); + fprintf(stderr, "%s: depth [%d], bytesToClean [%d], scanline: ", __func__, depth, bytesToClean); for (int i = 0; i < bytesPerLine; i++) { fprintf(stderr, "[%d]", images[i]); @@ -406,7 +406,7 @@ nxagentCleanGlyphs(xGlyphInfo *gi, else { #ifdef WARNING - fprintf(stderr, "%s: Unrecognized glyph, depth is not 8/16/24/32, it appears to be %d.\n", __func__, + fprintf(stderr, "%s: Unrecognized glyph, depth is not 8/16/24/32, it appears to be [%d].\n", __func__, depth); #endif @@ -454,8 +454,8 @@ void nxagentRenderExtensionInit(void) minor_version < SERVER_RENDER_MINOR_VERSION)) { #ifdef TEST - fprintf(stderr, "Info: Local render version %d.%d is higher " - "than remote version %d.%d.\n", SERVER_RENDER_MAJOR_VERSION, SERVER_RENDER_MINOR_VERSION, + fprintf(stderr, "Info: Local render version [%d.%d] is higher " + "than remote version [%d.%d].\n", SERVER_RENDER_MAJOR_VERSION, SERVER_RENDER_MINOR_VERSION, major_version, minor_version); fprintf(stderr, "Info: Lowering the render version reported to clients.\n"); @@ -467,8 +467,8 @@ void nxagentRenderExtensionInit(void) else { #ifdef TEST - fprintf(stderr, "%s: Local render version %d.%d " - "matches remote version %d.%d.\n", __func__, SERVER_RENDER_MAJOR_VERSION, SERVER_RENDER_MINOR_VERSION, + fprintf(stderr, "%s: Local render version [%d.%d] " + "matches remote version [%d.%d].\n", __func__, SERVER_RENDER_MAJOR_VERSION, SERVER_RENDER_MINOR_VERSION, major_version, minor_version); #endif @@ -2357,10 +2357,10 @@ void nxagentDisconnectPicture(void * p0, XID x1, void* p2) Bool *pBool = (Bool *) p2; #ifdef TEST - fprintf(stderr, "nxagentDisconnectPicture: Called with bool [%d] and picture at [%p].\n", + fprintf(stderr, "%s: Called with bool [%d] and picture at [%p].\n", __func__, *pBool, (void *) pPicture); - fprintf(stderr, "nxagentDisconnectPicture: Virtual picture is [%ld].\n", + fprintf(stderr, "%s: Virtual picture is [%ld].\n", __func__, nxagentPicture(pPicture)); #endif From fcdb151b4fa73db5996c9d537bb591f334462303 Mon Sep 17 00:00:00 2001 From: Mike Gabriel Date: Sat, 29 Jun 2024 21:14:58 +0200 Subject: [PATCH 88/89] .github/workflows/nx-libs.yml: Assure libtirpc-dev being installed for Debian/Ubuntu builds. --- .github/workflows/nx-libs.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/nx-libs.yml b/.github/workflows/nx-libs.yml index c77a1d003e..c76467e75a 100644 --- a/.github/workflows/nx-libs.yml +++ b/.github/workflows/nx-libs.yml @@ -100,7 +100,7 @@ jobs: apt-get install -q -y \ libpixman-1-dev libjpeg-dev libxcomposite-dev libxdamage-dev \ libxml2-dev libxfont-dev libxinerama-dev libxpm-dev libxrandr-dev \ - libxtst-dev x11proto-fonts-dev + libxtst-dev x11proto-fonts-dev libtirpc-dev # soft requirements apt-get install -q -y \ quilt x11-xkb-utils From 8f3b446b1336d2c54690468c062c3098df96ba96 Mon Sep 17 00:00:00 2001 From: Mike Gabriel Date: Sat, 29 Jun 2024 21:26:43 +0200 Subject: [PATCH 89/89] .github/workflows/nx-libs.yml: Drop CI builds against CentOS Stream 8. End-of-life since 2024-05-31. --- .github/workflows/nx-libs.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.github/workflows/nx-libs.yml b/.github/workflows/nx-libs.yml index c76467e75a..88b1f5e2bf 100644 --- a/.github/workflows/nx-libs.yml +++ b/.github/workflows/nx-libs.yml @@ -27,8 +27,6 @@ jobs: - { container: 'debian:sid', cc-version: clang } - { container: 'quay.io/centos/centos:7', cc-version: gcc } - { container: 'quay.io/centos/centos:7', cc-version: clang } - - { container: 'quay.io/centos/centos:stream8', cc-version: gcc } - - { container: 'quay.io/centos/centos:stream8', cc-version: clang } - { container: 'quay.io/centos/centos:stream9', cc-version: gcc } - { container: 'quay.io/centos/centos:stream9', cc-version: clang } - { container: 'fedora:latest', cc-version: gcc }