diff options
author | Mike Gabriel <mike.gabriel@das-netzwerkteam.de> | 2024-06-30 12:37:04 +0200 |
---|---|---|
committer | Mike Gabriel <mike.gabriel@das-netzwerkteam.de> | 2024-06-30 12:37:04 +0200 |
commit | 314ec41b8e26ba6d161f0a47d08ce5f239d9bb1c (patch) | |
tree | 4ca541c9c14b9b015e5f12227e784a7a418d8d9a | |
parent | e18eb77f397b72c1a10141d2bafa2dc975ab7d38 (diff) | |
parent | 8f3b446b1336d2c54690468c062c3098df96ba96 (diff) | |
download | nx-libs-314ec41b8e26ba6d161f0a47d08ce5f239d9bb1c.tar.gz nx-libs-314ec41b8e26ba6d161f0a47d08ce5f239d9bb1c.tar.bz2 nx-libs-314ec41b8e26ba6d161f0a47d08ce5f239d9bb1c.zip |
Merge branch 'uli42-pr/various10' into 3.6.x
Attribute GH PR #1075: https://github.com/ArcticaProject/nx-libs/pull/1075
59 files changed, 1043 insertions, 1359 deletions
diff --git a/.github/workflows/nx-libs.yml b/.github/workflows/nx-libs.yml index c77a1d003..88b1f5e2b 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 } @@ -100,7 +98,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 @@ -116,7 +116,7 @@ ifneq "$(strip $(NX_VERSION_CUSTOM))" "" endif imakeconfig: - @echo; + @echo @echo "===> $@" # auto-config some setting diff --git a/nx-X11/Makefile b/nx-X11/Makefile index 4249a710f..364a3ac9f 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: diff --git a/nx-X11/config/cf/Imake.rules b/nx-X11/config/cf/Imake.rules index ac3b78da2..005869280 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 @@ -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 */ @@ -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 4bd18aa4e..22dc19006 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 fc60671ec..928a4cd5a 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) diff --git a/nx-X11/config/cf/xorg.cf b/nx-X11/config/cf/xorg.cf index c0b753a88..e2207b68e 100644 --- a/nx-X11/config/cf/xorg.cf +++ b/nx-X11/config/cf/xorg.cf @@ -199,15 +199,6 @@ NX_VERSION_CURRENT_STRING = nxVersionString #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 47dbf795c..8e16b3998 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 diff --git a/nx-X11/programs/Xserver/Imakefile b/nx-X11/programs/Xserver/Imakefile index 856661660..36966f3ba 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) \ diff --git a/nx-X11/programs/Xserver/Xext/security.c b/nx-X11/programs/Xserver/Xext/security.c index df284d6a3..73fe1af85 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 <nx-X11/Xos.h> -#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/shape.c b/nx-X11/programs/Xserver/Xext/shape.c index 48a3e952d..977254d2b 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 */ diff --git a/nx-X11/programs/Xserver/Xext/shm.c b/nx-X11/programs/Xserver/Xext/shm.c index 868087462..594586f97 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 a31ffd02c..0b946a663 100644 --- a/nx-X11/programs/Xserver/Xext/xf86bigfont.c +++ b/nx-X11/programs/Xserver/Xext/xf86bigfont.c @@ -51,10 +51,6 @@ #ifdef SVR4 #include <sys/sysmacros.h> #endif -#if defined(__CYGWIN__) || defined(__SCO__) -#include <sys/param.h> -#include <sys/sysmacros.h> -#endif #include <sys/ipc.h> #include <sys/shm.h> #include <sys/stat.h> @@ -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/dix/property.c b/nx-X11/programs/Xserver/dix/property.c index 37af8d592..b394327bc 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/fb/fbbltone.c b/nx-X11/programs/Xserver/fb/fbbltone.c index f06357a37..e4bbe679c 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)) @@ -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 diff --git a/nx-X11/programs/Xserver/fb/fbcompose.c b/nx-X11/programs/Xserver/fb/fbcompose.c index 7699ae755..d1eb72964 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); diff --git a/nx-X11/programs/Xserver/fb/fbedgeimp.h b/nx-X11/programs/Xserver/fb/fbedgeimp.h index 6b363d7ce..59f7eed22 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--) diff --git a/nx-X11/programs/Xserver/hw/nxagent/Atoms.c b/nx-X11/programs/Xserver/hw/nxagent/Atoms.c index a8d2e447f..2ea2a1ba2 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 c8b059405..a6934336a 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 567c1c302..57b4406bc 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/Client.c b/nx-X11/programs/Xserver/hw/nxagent/Client.c index bc768b673..d530a935c 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; diff --git a/nx-X11/programs/Xserver/hw/nxagent/Clipboard.c b/nx-X11/programs/Xserver/hw/nxagent/Clipboard.c index 91fe5679f..12b18e366 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) { @@ -1969,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); @@ -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 diff --git a/nx-X11/programs/Xserver/hw/nxagent/Drawable.c b/nx-X11/programs/Xserver/hw/nxagent/Drawable.c index 121d54953..a44818f4c 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); @@ -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++; @@ -1351,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", @@ -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), diff --git a/nx-X11/programs/Xserver/hw/nxagent/Events.c b/nx-X11/programs/Xserver/hw/nxagent/Events.c index 634dadd36..6456e244a 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 @@ -132,7 +132,7 @@ extern Bool nxagentOnce; #ifdef NX_DEBUG_INPUT -int nxagentDebugInput = 0; +Bool nxagentDebugInput = False; #endif #ifdef DEBUG @@ -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; @@ -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__); } @@ -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 @@ -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++; @@ -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); @@ -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,14 +1123,14 @@ 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 fprintf(stderr, "%s: Going to handle new KeyRelease event.\n", __func__); #endif - nxagentInputEvent = 1; + nxagentInputEvent = True; nxagentKeyDown--; @@ -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__); @@ -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)) { @@ -1205,13 +1205,15 @@ FIXME: Don't enqueue the KeyRelease event if the key was not already case ButtonPress: { #ifdef NX_DEBUG_INPUT - if (nxagentDebugInput == 1) + if (nxagentDebugInput) + #endif + #if defined(NX_DEBUG_INPUT) || defined(TEST) { fprintf(stderr, "%s: Going to handle new ButtonPress event.\n", __func__); } #endif - nxagentInputEvent = 1; + nxagentInputEvent = True; if (nxagentOption(Fullscreen)) { @@ -1270,7 +1272,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__); } @@ -1278,7 +1280,7 @@ FIXME: Don't enqueue the KeyRelease event if the key was not already mieqEnqueue(&x); - CriticalOutputPending = 1; + SetCriticalOutputPending(); } if (!nxagentOption(ViewOnly) && nxagentOption(Shadow)) @@ -1304,13 +1306,15 @@ FIXME: Don't enqueue the KeyRelease event if the key was not already case ButtonRelease: { #ifdef NX_DEBUG_INPUT - if (nxagentDebugInput == 1) + if (nxagentDebugInput) + #endif + #if defined(NX_DEBUG_INPUT) || defined(TEST) { fprintf(stderr, "%s: Going to handle new ButtonRelease event.\n", __func__); } #endif - nxagentInputEvent = 1; + nxagentInputEvent = True; if (viewportCursor) { @@ -1344,7 +1348,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__); } @@ -1352,7 +1356,7 @@ FIXME: Don't enqueue the KeyRelease event if the key was not already mieqEnqueue(&x); - CriticalOutputPending = 1; + SetCriticalOutputPending(); } if (!nxagentOption(ViewOnly) && nxagentOption(Shadow)) @@ -1384,7 +1388,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 +1443,9 @@ 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) + #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); @@ -1490,7 +1496,7 @@ FIXME: Don't enqueue the KeyRelease event if the key was not already if (!nxagentOption(Shadow)) { - nxagentInputEvent = 1; + nxagentInputEvent = True; } break; @@ -1758,7 +1764,7 @@ FIXME: Don't enqueue the KeyRelease event if the key was not already } } - nxagentInputEvent = 1; + nxagentInputEvent = True; break; } @@ -1794,7 +1800,7 @@ FIXME: Don't enqueue the KeyRelease event if the key was not already } } - nxagentInputEvent = 1; + nxagentInputEvent = True; break; } @@ -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; @@ -2102,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); @@ -2224,13 +2230,10 @@ 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) + if (NewOutputPending) { #ifdef TEST fprintf(stderr, "%s: Flushed the processed events to clients.\n", __func__); @@ -2255,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) { @@ -2279,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) @@ -2306,17 +2310,17 @@ int nxagentHandleKeyPress(XEvent *X, enum HandleEventResult *result) mieqEnqueue(&x); - CriticalOutputPending = 1; + SetCriticalOutputPending(); - return 1; + return True; } -int nxagentHandlePropertyNotify(XEvent *X) +Bool 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 @@ -2330,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, @@ -2348,16 +2352,16 @@ int nxagentHandlePropertyNotify(XEvent *X) #endif } - return 1; + return True; } -int nxagentHandleExposeEvent(XEvent *X) +Bool nxagentHandleExposeEvent(XEvent *X) { StaticResizedWindowStruct *resizedWinPtr = NULL; #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; @@ -2378,7 +2382,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; @@ -2421,7 +2425,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 /* @@ -2448,7 +2452,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 @@ -2465,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 @@ -2501,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; @@ -2512,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; @@ -2567,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; @@ -2588,7 +2594,7 @@ int nxagentHandleClientMessageEvent(XEvent *X, enum HandleEventResult *result) #endif nxagentHandleProxyEvent(X); - return 1; + return True; } #ifdef TEST @@ -2612,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); @@ -2632,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)) @@ -2651,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 @@ -2670,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 */ @@ -2712,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; @@ -2815,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; @@ -2830,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)) @@ -2838,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 @@ -2878,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; } /* @@ -2904,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]) { @@ -2934,7 +2940,7 @@ int nxagentHandleProxyEvent(XEvent *X) #endif - return 1; + return True; } case NXCommitSplitNotify: { @@ -2957,7 +2963,7 @@ int nxagentHandleProxyEvent(XEvent *X) nxagentHandleCommitSplitEvent(client, request, position); - return 1; + return True; } case NXEndSplitNotify: { @@ -2974,7 +2980,7 @@ int nxagentHandleProxyEvent(XEvent *X) nxagentHandleEndSplitEvent(client); - return 1; + return True; } case NXEmptySplitNotify: { @@ -2988,7 +2994,7 @@ int nxagentHandleProxyEvent(XEvent *X) nxagentHandleEmptySplitEvent(); - return 1; + return True; } case NXCollectPropertyNotify: { @@ -3000,7 +3006,7 @@ int nxagentHandleProxyEvent(XEvent *X) nxagentHandleCollectPropertyEvent(X); - return 1; + return True; } case NXCollectGrabPointerNotify: { @@ -3012,7 +3018,7 @@ int nxagentHandleProxyEvent(XEvent *X) nxagentHandleCollectGrabPointerEvent(resource); - return 1; + return True; } case NXCollectInputFocusNotify: { @@ -3028,7 +3034,7 @@ int nxagentHandleProxyEvent(XEvent *X) nxagentHandleCollectInputFocusEvent(resource); - return 1; + return True; } default: { @@ -3041,7 +3047,7 @@ int nxagentHandleProxyEvent(XEvent *X) (int) X -> xclient.data.l[0]); #endif - return 0; + return False; } } } @@ -3129,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__); @@ -3177,7 +3183,7 @@ int nxagentHandleConfigureNotify(XEvent* X) nxagentCheckWindowConfiguration((XConfigureEvent*)X); - return 1; + return True; } if (nxagentWindowTopLevel(pWinWindow) && !X -> xconfigure.override_redirect) @@ -3263,7 +3269,7 @@ int nxagentHandleConfigureNotify(XEvent* X) TryClientEvents(wClient(pWinWindow), &x, 1, 1, 1, 0); } - return 1; + return True; } } else /* (nxagentOption(Rootless)) */ @@ -3445,7 +3451,7 @@ int nxagentHandleConfigureNotify(XEvent* X) } } - return 1; + return True; } else { @@ -3464,7 +3470,7 @@ int nxagentHandleConfigureNotify(XEvent* X) nxagentChangeScreenConfig(0, nxagentOption(Width), nxagentOption(Height), True); - return 1; + return True; } } } @@ -3473,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); @@ -3501,16 +3507,14 @@ int nxagentHandleReparentNotify(XEvent* X) WindowPtr pWin = nxagentWindowPtr(X -> xreparent.window); #ifdef TEST - { 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); } - #endif if (nxagentWindowTopLevel(pWin)) @@ -3584,7 +3588,7 @@ int nxagentHandleReparentNotify(XEvent* X) } } - return 1; + return True; } else if (nxagentWMIsRunning && !nxagentOption(Fullscreen) && nxagentOption(WMBorderWidth) == -1) @@ -3601,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; @@ -3658,7 +3662,7 @@ int nxagentHandleReparentNotify(XEvent* X) fprintf(stderr, "%s: WARNING! XGetWindowAttributes failed for parent window.\n", __func__); #endif - return 1; + return True; } /* @@ -3683,7 +3687,7 @@ int nxagentHandleReparentNotify(XEvent* X) } } - return 1; + return True; } /* @@ -4273,7 +4277,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); @@ -4319,9 +4323,9 @@ int nxagentUserInput(void *p) nxagentDispatchEvents(NULL); } - if (nxagentInputEvent == 1) + if (nxagentInputEvent) { - nxagentInputEvent = 0; + nxagentInputEvent = False; result = 1; } @@ -4361,7 +4365,8 @@ int nxagentUserInput(void *p) return result; } -int nxagentHandleRRScreenChangeNotify(XEvent *X) +#if 0 +Bool nxagentHandleRRScreenChangeNotify(XEvent *X) { XRRScreenChangeNotifyEvent *Xr = (XRRScreenChangeNotifyEvent *) X; @@ -4379,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 @@ -4511,7 +4517,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}; @@ -4574,11 +4580,11 @@ void nxagentGuessDumpInputInfo(ClientPtr client, Atom property, char *data) { if (*data != 0) { - nxagentDebugInput = 1; + nxagentDebugInput = True; } else { - nxagentDebugInput = 0; + nxagentDebugInput = False; } } } diff --git a/nx-X11/programs/Xserver/hw/nxagent/Events.h b/nx-X11/programs/Xserver/hw/nxagent/Events.h index b3e7f8a17..379bbbcc6 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. diff --git a/nx-X11/programs/Xserver/hw/nxagent/GC.c b/nx-X11/programs/Xserver/hw/nxagent/GC.c index 46dc758d1..56d3f7079 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. */ diff --git a/nx-X11/programs/Xserver/hw/nxagent/GCOps.c b/nx-X11/programs/Xserver/hw/nxagent/GCOps.c index 23f272811..7b59bd8a3 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. */ @@ -89,12 +92,6 @@ static int nxagentSaveGCTrap; } /* - * This is currently unused. - */ - -RegionPtr nxagentBitBlitHelper(GC *pGC); - -/* * The NX agent implementation of the X server's graphics functions. */ @@ -184,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 @@ -576,9 +555,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 +745,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 +864,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 +1048,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 +1109,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 +1171,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 +1246,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 +1257,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 +1324,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 +1385,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 +1490,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 +1536,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 +1678,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 +1747,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 +1821,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 +1895,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 +1956,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 +2018,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 +2041,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 +2063,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 diff --git a/nx-X11/programs/Xserver/hw/nxagent/Keyboard.c b/nx-X11/programs/Xserver/hw/nxagent/Keyboard.c index 14a06e20f..5324eaf90 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Keyboard.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Keyboard.c @@ -581,12 +581,13 @@ XkbError: 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]); @@ -707,7 +708,7 @@ XkbError: /* 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) { @@ -757,19 +758,34 @@ XkbError: { 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 } } + /* 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); diff --git a/nx-X11/programs/Xserver/hw/nxagent/Keystroke.c b/nx-X11/programs/Xserver/hw/nxagent/Keystroke.c index c9452f187..7534d13a3 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); } diff --git a/nx-X11/programs/Xserver/hw/nxagent/Literals.h b/nx-X11/programs/Xserver/hw/nxagent/Literals.h index 691e2b4dd..8230ae1f2 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Literals.h +++ b/nx-X11/programs/Xserver/hw/nxagent/Literals.h @@ -23,13 +23,13 @@ /* */ /**************************************************************************/ -#ifdef TEST +#if defined(TEST) || defined(DEBUG) /* * Simple table used to translate a request * 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", @@ -211,4 +211,13 @@ static char *nxagentShmRequestLiteral[] = "ShmGetImage", "ShmCreatePixmap" }; -#endif /* TEST */ + +/* see include/pixmap.h */ +_X_UNUSED static char *nxagentDrawableTypeLiteral[] = +{ + "DRAWABLE_WINDOW", + "DRAWABLE_PIXMAP", + "UNDRAWABLE_WINDOW", + "DRAWABLE_BUFFER" +}; +#endif /* TEST || DEBUG */ diff --git a/nx-X11/programs/Xserver/hw/nxagent/NXdispatch.c b/nx-X11/programs/Xserver/hw/nxagent/NXdispatch.c index e9e388886..9364dbab8 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/NXevents.c b/nx-X11/programs/Xserver/hw/nxagent/NXevents.c index 9d3045dc7..68fb3f412 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 <nx-X11/Xlib.h> +/* define this to inform dix about having a own implementation of GetXYStartWindow() */ #define XYWINDOWCALLBACK #include "../../dix/events.c" @@ -277,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)) { /* @@ -348,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)) diff --git a/nx-X11/programs/Xserver/hw/nxagent/NXglxext.c b/nx-X11/programs/Xserver/hw/nxagent/NXglxext.c index 199b4f53b..c632c8a6d 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; diff --git a/nx-X11/programs/Xserver/hw/nxagent/NXglyph.c b/nx-X11/programs/Xserver/hw/nxagent/NXglyph.c index f11660706..22c45bd9c 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; } } diff --git a/nx-X11/programs/Xserver/hw/nxagent/NXglyphcurs.c b/nx-X11/programs/Xserver/hw/nxagent/NXglyphcurs.c index a290b1b7e..17344937c 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/NXglyphcurs.c +++ b/nx-X11/programs/Xserver/hw/nxagent/NXglyphcurs.c @@ -81,6 +81,13 @@ SOFTWARE. #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 a bitmap, then read the bits out with GetImage, which @@ -92,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; @@ -115,14 +122,24 @@ ServerBitsFromGlyph(FontPtr pfont, unsigned ch, register CursorMetricPtr cm, uns /* 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); @@ -152,19 +169,34 @@ ServerBitsFromGlyph(FontPtr pfont, unsigned ch, register CursorMetricPtr cm, uns 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", diff --git a/nx-X11/programs/Xserver/hw/nxagent/NXproperty.c b/nx-X11/programs/Xserver/hw/nxagent/NXproperty.c index 4e61f26f0..7706bc7bc 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 } /***************** @@ -265,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. @@ -319,7 +324,7 @@ ProcGetProperty(ClientPtr client) return(client->noClientException); } - #endif +#endif /* NXAGENT_SERVER */ if (!pProp) return NullPropertyReply(client, None, 0, &reply); @@ -358,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) { diff --git a/nx-X11/programs/Xserver/hw/nxagent/NXrender.c b/nx-X11/programs/Xserver/hw/nxagent/NXrender.c index aeeec1e17..b32c83bd6 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 diff --git a/nx-X11/programs/Xserver/hw/nxagent/NXresource.c b/nx-X11/programs/Xserver/hw/nxagent/NXresource.c index 53b355ff8..a833b63a6 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,15 +156,15 @@ 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) +static 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 */ diff --git a/nx-X11/programs/Xserver/hw/nxagent/NXshm.c b/nx-X11/programs/Xserver/hw/nxagent/NXshm.c index 4841c3e7c..f44214885 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 diff --git a/nx-X11/programs/Xserver/hw/nxagent/Options.h b/nx-X11/programs/Xserver/hw/nxagent/Options.h index 951e3d697..7e67c9d33 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 1bf3fbbc0..470c804e2 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Pixmap.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Pixmap.c @@ -244,8 +244,8 @@ 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", + 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 @@ -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 @@ -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/Render.c b/nx-X11/programs/Xserver/hw/nxagent/Render.c index 9d29fdcfe..a4909e1cf 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, "nxagentCleanGlyphs: Found a Glyph with Depth %d, width %d, pad %d.\n", - 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) @@ -216,10 +216,10 @@ 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); + #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); #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 @@ -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, "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 @@ -540,17 +540,27 @@ 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; - unsigned long valuemask=0; + 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 [%d].\n", __func__, (void *) pPicture, mask); #endif - if (pPicture == NULL) + if (!pPicture) { return 0; } @@ -561,16 +571,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 @@ -581,108 +591,35 @@ 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; - if (pPicture -> pFormat != NULL) + #ifdef DEBUG + fprintf(stderr, "%s: picture format [%p]\n", __func__, (void *)pPicture->pFormat); + #endif + + if (pPicture -> pFormat) { pForm = nxagentMatchingFormats(pPicture -> pFormat); nxagentPrintFormat(pForm); } - if (pForm == NULL) + if (!pForm) { - fprintf(stderr, "nxagentCreatePicture: WARNING! The requested format was not found.\n"); + fprintf(stderr, "%s: WARNING! The requested format was not found - not creating picture.\n", __func__); return 0; } @@ -693,7 +630,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 +676,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 +690,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 +706,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 +725,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 +761,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 +794,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 +834,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; @@ -907,13 +844,26 @@ 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; 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 [%d].\n", __func__, (void *) pPicture, mask); #endif @@ -922,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) { /* @@ -1017,51 +895,15 @@ 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) { - 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 +927,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 +942,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 +953,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 +962,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 +972,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 +987,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"); @@ -1160,7 +1005,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. */ @@ -1171,7 +1016,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 +1031,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 +1048,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 @@ -1214,10 +1059,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) * { @@ -1252,6 +1097,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__, + (void *)pSrc, pSrc ? (void *)pSrc->pDrawable : NULL, (void *)pDst, pDst ? (void *)pDst->pDrawable : NULL); + #endif + if (pSrc == NULL || pDst == NULL) { return; @@ -1259,7 +1109,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); @@ -1312,12 +1162,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 @@ -1339,7 +1189,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); } @@ -1355,8 +1205,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, @@ -1370,8 +1220,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, @@ -1393,7 +1243,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); } @@ -1403,8 +1253,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, @@ -1418,8 +1268,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, @@ -1440,7 +1290,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); } @@ -1451,8 +1301,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. */ @@ -1470,7 +1320,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 @@ -1482,8 +1332,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 } @@ -1494,7 +1344,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 } @@ -1508,6 +1358,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 +1382,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 +1406,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, @@ -1567,7 +1429,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; @@ -1582,6 +1444,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 +1463,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 +1482,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, @@ -1628,7 +1502,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; @@ -1640,6 +1514,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; @@ -1647,7 +1525,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); } @@ -1685,7 +1563,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 @@ -1715,8 +1593,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 @@ -1746,13 +1624,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); } @@ -1770,8 +1648,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); @@ -1802,8 +1680,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); @@ -1826,7 +1704,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 @@ -1836,7 +1714,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 @@ -1863,7 +1741,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)) @@ -1889,8 +1767,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 [%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, nxagentArrayFormats[i].direct.redMask, nxagentArrayFormats[i].direct.greenMask, @@ -1904,12 +1782,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 @@ -1921,7 +1798,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; @@ -1949,7 +1826,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 @@ -1964,7 +1841,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 @@ -1978,14 +1855,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 @@ -1998,15 +1875,16 @@ 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) { #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 @@ -2018,6 +1896,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); @@ -2035,7 +1917,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 } } @@ -2075,7 +1957,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 @@ -2109,7 +1991,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 @@ -2133,7 +2015,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; @@ -2144,7 +2026,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 /* @@ -2168,13 +2050,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; } @@ -2191,11 +2076,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\ @@ -2206,6 +2091,7 @@ static void nxagentPrintFormat(XRenderPictFormat *pFormat) blueMask=%d\n\ alpha=%d\n\ alphaMask=%d\n", + __func__, (void *) pFormat, pFormat -> type, pFormat -> depth, @@ -2223,8 +2109,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 [%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 @@ -2258,12 +2144,13 @@ 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) { pForm = nxagentMatchingFormats(pGly -> format); + nxagentPrintFormat(pForm); } pGly -> remoteID = XRenderCreateGlyphSet(nxagentDisplay, pForm); @@ -2301,7 +2188,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++) @@ -2324,10 +2211,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 @@ -2373,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; @@ -2409,10 +2288,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 [%d] 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 @@ -2427,7 +2306,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 @@ -2450,7 +2329,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++) @@ -2462,8 +2341,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 } @@ -2478,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 @@ -2503,7 +2382,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++) @@ -2515,8 +2394,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 } @@ -2533,16 +2412,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 */ @@ -2556,7 +2435,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; @@ -2573,31 +2452,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 */ @@ -2620,7 +2499,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; @@ -2640,31 +2519,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 */ @@ -2689,7 +2568,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; @@ -2707,26 +2586,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 */ @@ -2748,7 +2627,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; diff --git a/nx-X11/programs/Xserver/hw/nxagent/Screen.c b/nx-X11/programs/Xserver/hw/nxagent/Screen.c index 76430fbd1..0b2fb8bc1 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 @@ -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); } @@ -557,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) { @@ -661,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; @@ -1533,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; @@ -1610,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) { @@ -1815,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__, @@ -1833,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"); } @@ -3825,7 +3824,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); } diff --git a/nx-X11/programs/Xserver/hw/nxagent/Trap.c b/nx-X11/programs/Xserver/hw/nxagent/Trap.c index aa2b15bc9..430732250 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 80a88f223..2f2ce86c5 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 e23c8392a..25735afe9 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 <nx/NX.h> #include "compext/Compext.h" @@ -167,7 +168,7 @@ nxagentWMStateRec; */ #ifdef TEST -static Bool nxagentCheckWindowIntegrity(WindowPtr pWin); +static _X_UNUSED Bool nxagentCheckWindowIntegrity(WindowPtr pWin); #endif WindowPtr nxagentGetWindowFromID(Window id) @@ -266,7 +267,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 +334,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); @@ -350,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; @@ -393,18 +393,18 @@ 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 { 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)) { - Xutf8SetWMProperties(nxagentDisplay, nxagentWindowPriv(pWin)->window, + Xutf8SetWMProperties(nxagentDisplay, nxagentWindow(pWin), winname, winname, NULL , 0 , NULL, NULL, NULL); SAFE_free(winname); } @@ -412,8 +412,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 /* @@ -426,7 +425,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); @@ -447,12 +446,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__, nxagentWindow(pWin)); } #endif } @@ -503,7 +502,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 } @@ -544,6 +543,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 +605,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 +636,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 +668,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 +685,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 +1083,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 +1155,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 +1192,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 +1210,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 +1242,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 +1269,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 +1321,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 +1330,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 +1373,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 +1397,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 @@ -1401,9 +1411,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), @@ -1411,7 +1421,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 +1434,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 +1457,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 +1473,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 +1482,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 +1493,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 +1538,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 +1564,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 +1615,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 +1639,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 +1729,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 +1802,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; @@ -1860,11 +1870,19 @@ 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 + fprintf(stderr, "%s: Called with window [%p][0x%x] remote [0x%x].\n", __func__, + (void *) pWin, pWin->drawable.id, nxagentWindow(pWin)); + #endif + if (nxagentScreenTrap) { + #ifdef DEBUG + fprintf(stderr, "%s: doing nothing because of nxagentScreenTrap\n", __func__); + #endif return True; } @@ -1904,12 +1922,20 @@ Bool nxagentRealizeWindow(WindowPtr pWin) nxagentLastWindowDestroyed = False; + #ifdef DEBUG + fprintf(stderr, "%s: leaving...\n", __func__); + #endif return True; } /* See nxagentRealizeWindow for a description */ Bool nxagentUnrealizeWindow(WindowPtr pWin) { + #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 (nxagentScreenTrap) { return True; @@ -1932,6 +1958,11 @@ Bool nxagentUnrealizeWindow(WindowPtr pWin) void nxagentFrameBufferPaintWindow(WindowPtr pWin, RegionPtr pRegion, int what) { + #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->backgroundState == BackgroundPixmap) { pWin->background.pixmap = nxagentVirtualPixmap(pWin->background.pixmap); @@ -1972,6 +2003,11 @@ void nxagentFrameBufferPaintWindow(WindowPtr pWin, RegionPtr pRegion, int what) void nxagentPaintWindowBackground(WindowPtr pWin, RegionPtr pRegion, int what) { + #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 -> realized) { BoxPtr pBox = RegionRects(pRegion); @@ -1989,8 +2025,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 @@ -2008,6 +2044,11 @@ void nxagentPaintWindowBackground(WindowPtr pWin, RegionPtr pRegion, int what) void nxagentPaintWindowBorder(WindowPtr pWin, RegionPtr pRegion, int what) { + #ifdef DEBUG + fprintf(stderr, "%s: Called with window [%p][0x%x] remote [0x%x].\n", __func__, + (void *) pWin, pWin->drawable.id, nxagentWindow(pWin)); + #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 +2089,11 @@ void nxagentPaintWindowBorder(WindowPtr pWin, RegionPtr pRegion, int what) */ void nxagentCopyWindow(WindowPtr pWin, xPoint oldOrigin, RegionPtr oldRegion) { + #ifdef DEBUG + 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); } @@ -2062,6 +2108,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); */ @@ -2092,8 +2143,13 @@ void nxagentClipNotify(WindowPtr pWin, int dx, int dy) */ void nxagentWindowExposures(WindowPtr pWin, RegionPtr pRgn, RegionPtr other_exposed) { + #ifdef DEBUG + fprintf(stderr, "%s: Called with window [%p][0x%x] remote [0x%x].\n", __func__, + (void *) pWin, pWin->drawable.id, nxagentWindow(pWin)); + #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 @@ -2133,7 +2189,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++) @@ -2201,8 +2257,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 @@ -2211,8 +2267,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 } @@ -2221,7 +2277,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 /* @@ -2246,7 +2302,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) || @@ -2320,8 +2376,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 /* @@ -2332,13 +2388,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 [%d] rects.\n", __func__, RegionNumRects(wBoundingShape(pWin))); #endif @@ -2372,7 +2428,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); @@ -2385,13 +2441,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 [%d] rects.\n", __func__, RegionNumRects(wClipShape(pWin))); #endif @@ -2425,7 +2481,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); @@ -2439,6 +2495,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; @@ -2506,7 +2567,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]); @@ -2522,7 +2583,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 @@ -2568,7 +2629,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 @@ -2586,7 +2647,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 } @@ -2595,7 +2656,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++) @@ -2605,7 +2666,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; @@ -2635,8 +2696,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); @@ -2644,8 +2705,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; @@ -2654,8 +2715,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 @@ -2665,12 +2726,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__, nxagentWindow(pWin)); } #endif } @@ -2691,13 +2752,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)) @@ -2709,7 +2770,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; @@ -2717,13 +2778,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; @@ -2752,13 +2813,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; @@ -2766,7 +2827,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 @@ -2801,20 +2862,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(); @@ -2867,9 +2928,12 @@ 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 + /* FIXME: this is largely identical to nxagentCreateWindow */ + if (pWin->drawable.class == InputOnly) { mask = CWEventMask; @@ -2879,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; @@ -2888,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? */ @@ -2913,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; } @@ -2940,10 +3009,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 @@ -2952,7 +3021,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. */ @@ -2971,37 +3040,35 @@ 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) { 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 { 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)) { - Xutf8SetWMProperties(nxagentDisplay, nxagentWindowPriv(pWin)->window, + Xutf8SetWMProperties(nxagentDisplay, nxagentWindow(pWin), winname, winname, NULL , 0 , NULL, NULL, NULL); SAFE_free(winname); } @@ -3009,8 +3076,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 /* @@ -3060,7 +3126,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 @@ -3103,7 +3169,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 } @@ -3129,12 +3195,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__, nxagentWindow(pWin)); } #endif } @@ -3164,20 +3230,19 @@ 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", - 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) { #ifdef NXAGENT_RECONNECT_WINDOW_DEBUG - fprintf(stderr, "nxagentReconfigureWindowCursor: reconnecting valid cursor %lx\n", + fprintf(stderr, "%s: reconnecting valid cursor [%p]\n", __func__, (void*)pCursor); #endif @@ -3186,8 +3251,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 @@ -3207,7 +3272,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) @@ -3289,7 +3355,7 @@ Bool nxagentCheckIllegalRootMonitoring(WindowPtr pWin, Mask mask) } #ifdef TEST -Bool nxagentCheckWindowIntegrity(WindowPtr pWin) +static _X_UNUSED Bool nxagentCheckWindowIntegrity(WindowPtr pWin) { Bool integrity = True; @@ -3304,7 +3370,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("%s: Failed to allocate a buffer of size [%d].\n", __func__, length); } unsigned long plane_mask = AllPlanes; @@ -3339,19 +3405,19 @@ Bool nxagentCheckWindowIntegrity(WindowPtr pWin) #endif #ifdef WARNING - fprintf(stderr, "nxagentCheckWindowIntegrity: Window %p width %d, height %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 } @@ -3365,7 +3431,7 @@ 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 } @@ -3470,8 +3536,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, @@ -3517,9 +3583,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); @@ -3594,6 +3663,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) @@ -3646,6 +3720,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) { @@ -3750,13 +3829,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 @@ -3770,7 +3849,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 } } @@ -3790,7 +3869,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; @@ -3800,7 +3879,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; @@ -3814,7 +3893,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; @@ -3822,7 +3901,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; @@ -3858,7 +3937,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 @@ -3867,7 +3946,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 diff --git a/nx-X11/programs/Xserver/hw/nxagent/compext/Compext.c b/nx-X11/programs/Xserver/hw/nxagent/compext/Compext.c index e7955caca..416135f27 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 diff --git a/nx-X11/programs/Xserver/hw/nxagent/man/nxagent.1 b/nx-X11/programs/Xserver/hw/nxagent/man/nxagent.1 index 5f87fa8d4..4f53a1df9 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=<bool>\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 @@ -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) @@ -700,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. diff --git a/nx-X11/programs/Xserver/include/os.h b/nx-X11/programs/Xserver/include/os.h index 920b474db..7b8779579 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 <string.h> -/* 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/Imakefile b/nx-X11/programs/Xserver/os/Imakefile index 421f3a85a..69764a7d8 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 diff --git a/nx-X11/programs/Xserver/os/access.c b/nx-X11/programs/Xserver/os/access.c index bea4b968a..88055546e 100644 --- a/nx-X11/programs/Xserver/os/access.c +++ b/nx-X11/programs/Xserver/os/access.c @@ -310,151 +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 <sys/un.h> -#include <stropts.h> -#include <tiuser.h> - -#include <sys/stream.h> -#include <net/if.h> -#include <netinet/ip.h> -#include <netinet/ip_var.h> -#include <netinet/in.h> -#include <netinet/in_var.h> - -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 && addr[1] == 0 && - addr[2] == 0 && addr[3] == 1) - 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 @@ -541,8 +396,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 +610,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 +757,7 @@ DefineSelf (int fd) continue; if (family == FamilyInternet && - addr[0] == 127 && addr[1] == 0 && - addr[2] == 0 && addr[3] == 1) + addr[0] == 127) continue; /* @@ -966,7 +819,6 @@ DefineSelf (int fd) } } #endif /* !SIOCGIFCONF */ -#endif /* WINTCP */ #ifdef XDMCP void diff --git a/nx-X11/programs/Xserver/os/connection.c b/nx-X11/programs/Xserver/os/connection.c index 4d30dd86f..78ce8e03f 100644 --- a/nx-X11/programs/Xserver/os/connection.c +++ b/nx-X11/programs/Xserver/os/connection.c @@ -111,11 +111,7 @@ SOFTWARE. #include <nx-X11/extensions/security.h> #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 e106c5544..f2279dd6c 100644 --- a/nx-X11/programs/Xserver/os/osdep.h +++ b/nx-X11/programs/Xserver/os/osdep.h @@ -60,7 +60,6 @@ SOFTWARE. #include <X11/Xdmcp.h> -#ifndef X_NOT_POSIX #ifdef _POSIX_SOURCE #include <limits.h> #else @@ -68,8 +67,6 @@ SOFTWARE. #include <limits.h> #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 367635f6c..0313a8990 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 d49235b75..d6a23375d 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 @@ -381,11 +377,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); /* @@ -471,28 +463,19 @@ UnlockServer(void) /* Force connections to close on SIGHUP from init */ -/*ARGSUSED*/ -SIGVAL +void AutoResetServer (int sig) { int olderrno = errno; 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; } /* Force connections to close and then exit on SIGTERM, SIGINT */ -/*ARGSUSED*/ -SIGVAL +void GiveUp(int sig) { int olderrno = errno; @@ -503,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; } @@ -1214,10 +1193,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 ee5d63fac..28f3e0fd5 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 <xkbsrv.h> #include <nx-X11/extensions/XI.h> -#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 bff69196f..8529985a3 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 <nx-X11/Xwindows.h> -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) { @@ -355,9 +243,6 @@ char tmpname[PATH_MAX]; #else if (Pclose(out)==0) #endif -#else - if (fclose(out)==0 && System(buf) >= 0) -#endif { if (xkbDebugFlags) DebugF("xkb executes: %s\n",buf); @@ -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 3eafaa5b7..d9909aa87 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 <nx-X11/keysym.h> #include "inputstr.h" #include <xkbsrv.h> -#if !defined(WIN32) #include <sys/time.h> -#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 f37e202d8..63686506e 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]; |