New upstream version 3.5.99.27

This commit is contained in:
geos_one
2025-08-08 20:00:36 +02:00
commit bc8d10cc33
4267 changed files with 1757978 additions and 0 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,33 @@
--- ./nx-X11/config/cf/cross.def.X.original 2015-02-13 14:03:44.396448342 +0100
+++ ./nx-X11/config/cf/cross.def 2015-02-10 19:13:13.392701311 +0100
@@ -16,16 +16,16 @@
#define StandardDefines -Dlinux -D__arm__ -D_POSIX_SOURCE \
-D_BSD_SOURCE -D_GNU_SOURCE -DX_LOCALE
#undef CcCmd
-#define StdIncDir /skiff/local/arm-linux/include
+#define StdIncDir /opt/Embedix/tools/arm-linux/include
#define PreIncDir
#undef PostIncDir
-#define PostIncDir /skiff/local/lib/gcc-lib/arm-linux/2.95.2/include
-#define CcCmd /skiff/local/bin/arm-linux-gcc
+#define PostIncDir /opt/Embedix/tools/lib/gcc-lib/arm-linux/2.95.2/include
+#define CcCmd /opt/Embedix/tools/bin/arm-linux-gcc
#undef CplusplusCmd
#define HasCplusplus YES
-#define CplusplusCmd /skiff/local/bin/arm-linux-g++
+#define CplusplusCmd /opt/Embedix/tools/bin/arm-linux-g++
#define DoRanlibCmd YES
-#define RanlibCmd /skiff/local/bin/arm-linux-ranlib
+#define RanlibCmd /opt/Embedix/tools/bin/arm-linux-ranlib
#undef ExtraLoadFlags
#define ExtraLoadFlags
#define FbNoPixelAddrCode
@@ -33,7 +33,7 @@
#define TermcapLibrary -ltermcap
#undef LdPostLib
-#define LdPostLib -L/skiff/local/arm-linux/lib
+#define LdPostLib -L/opt/Embedix/tools/arm-linux/lib
#undef ExtensionOSDefines
#define ExtensionOSDefines

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,112 @@
--- ./nx-X11/config/cf/iPAQH3600.cf.X.original 2015-02-13 14:03:44.400448260 +0100
+++ ./nx-X11/config/cf/iPAQH3600.cf 2015-02-13 14:03:44.400448260 +0100
@@ -0,0 +1,109 @@
+/* $XFree86: xc/config/cf/iPAQH3600.cf,v 1.2 2000/10/10 14:05:48 tsi Exp $ */
+/*
+ * This configuration file contains additional configuration needed
+ * to cross compile X for the Compaq iPAQ H3600 PocketPC.
+ * To use this, add the following to host.def:
+ #define KDriveXServer YES
+ #define XiPAQH3500Server YES
+ */
+
+#define CrossCompiling YES
+
+#undef i386Architecture
+#define Arm32Architecture
+
+#undef OptimizedCDebugFlags
+#define OptimizedCDebugFlags -O2
+#define ServerCDebugFlags -O2
+#undef StandardDefines
+#define StandardDefines -Dlinux -D__arm__ -D_POSIX_SOURCE \
+ -D_BSD_SOURCE -D_GNU_SOURCE -DX_LOCALE
+#undef CcCmd
+#define StdIncDir /opt/Embedix/tools/arm-linux/include
+#define PreIncDir
+#undef PostIncDir
+#define PostIncDir /opt/Embedix/tools/lib/gcc-lib/arm-linux/2.95.2/include
+#define CcCmd /opt/Embedix/tools/bin/arm-linux-gcc
+#define DoRanlibCmd YES
+#define RanlibCmd /opt/Embedix/tools/bin/arm-linux-ranlib
+#undef ExtraLoadFlags
+#define ExtraLoadFlags
+#define FbNoPixelAddrCode
+#undef TermcapLibrary
+#define TermcapLibrary -ltermcap
+
+#undef LdPostLib
+#define LdPostLib -L/opt/Embedix/tools/arm-linux/lib
+
+#undef XfbdevServer
+#define XfbdevServer YES
+#undef BuildXprint
+#define BuildLBX NO
+#define BuildFonts NO
+#define BuildAppgroup NO
+#define BuildRECORD NO
+#define BuildDBE NO
+#define BuildXCSecurity NO
+#define ItsyCompilerBug YES
+#define FontServerAccess NO
+#define ServerXdmcpDefines /**/
+
+#undef ExtensionOSDefines
+#define ExtensionOSDefines
+
+#define ProjectRoot /usr/X11R6
+
+#define GzipFontCompression YES
+
+#define KdriveServerExtraDefines -DITSY -DMAXSCREENS=1
+
+#define HostLinkRule(target, flags, src, libs) cc -I$(BUILDINCDIR) -o target src
+
+/* ComplexHostProgramTarget - Compile a program such that we can run
+ * it on this host, i.e., don't use the default cross compiler.
+ */
+#ifndef ComplexHostProgramTarget
+#define ComplexHostProgramTarget(program) @@\
+ CC=cc @@\
+ STD_INCLUDES= @@\
+ CFLAGS=$(TOP_INCLUDES) $(INCLUDES) $(BOOTSTRAPCFLAGS) @@\
+EXTRA_LOAD_FLAGS= @@\
+ PROGRAM = program @@\
+ @@\
+AllTarget(program) @@\
+ @@\
+program: $(OBJS) $(DEPLIBS) @@\
+ RemoveTargetProgram($@) @@\
+ HostLinkRule($@,$(_NOOP_),$(OBJS),$(DEPLIBS) $(LOCAL_LIBRARIES)) @@\
+ @@\
+DependTarget() @@\
+ @@\
+LintTarget() @@\
+ @@\
+clean:: @@\
+ RemoveFile(ProgramTargetName(program))
+#endif /* ComplexHostProgramTarget */
+
+#ifndef SimpleHostProgramTarget
+#define SimpleHostProgramTarget(program) @@\
+ SRCS = program.c @@\
+ @@\
+ CC=cc @@\
+ STD_INCLUDES= @@\
+ CFLAGS=$(TOP_INCLUDES) $(INCLUDES) $(BOOTSTRAPCFLAGS) @@\
+EXTRA_LOAD_FLAGS= @@\
+ PROGRAM = program @@\
+ @@\
+AllTarget(program) @@\
+ @@\
+program: program.o $(DEPLIBS) @@\
+ RemoveTargetProgram($@) @@\
+ HostLinkRule($@,$(_NOOP_),program.o,$(DEPLIBS) $(LOCAL_LIBRARIES)) @@\
+ @@\
+DependTarget() @@\
+ @@\
+LintTarget() @@\
+ @@\
+clean:: @@\
+ RemoveFile(ProgramTargetName(program))
+#endif /* SimpleHostProgramTarget */

View File

@@ -0,0 +1,50 @@
--- ./nx-X11/config/cf/sun.cf.X.original 2015-02-13 14:03:44.400448260 +0100
+++ ./nx-X11/config/cf/sun.cf 2015-02-13 14:03:44.400448260 +0100
@@ -299,7 +299,12 @@
#if OSMajorVersion == 4
# if OSMinorVersion == 1
+/*
+ * Currently the NX transport only works with select().
+ *
# define HasPoll YES
+ */
+# define HasPoll NO
# endif
# if OSMinorVersion > 1 || (OSMinorVersion == 1 && OSTeenyVersion > 1)
/* You ALSO need this if you have Sun ld patch 100170-06 or later to 4.1.1 */
@@ -359,10 +364,12 @@
# endif
#endif
-#define ServerOSDefines XFree86ServerOSDefines IncludeCG2HeaderDefine
+#define ServerOSDefines XFree86ServerOSDefines IncludeCG2HeaderDefine \
+ -DPIXPRIV
#define ServerExtraDefines AllocateLocalDefines XFree86ServerDefines \
CompilerServerExtraDefines \
- OSServerExtraDefines ArchServerExtraDefines
+ OSServerExtraDefines ArchServerExtraDefines \
+ -DPIXPRIV
#ifndef HasPerl
/* Solaris 8 comes with perl. Earlier versions don't. */
@@ -384,7 +391,8 @@
#endif
#if OSMajorVersion > 4
-# define ConnectionFlags -DTCPCONN -DUNIXCONN -DLOCALCONN
+/* #define ConnectionFlags -DTCPCONN -DUNIXCONN -DLOCALCONN */
+#define ConnectionFlags -DUNIXCONN -DTCPCONN
# if HasSunC
# ifdef DefaultSunProCCompilerDir
# ifndef CcCmd
@@ -452,7 +460,8 @@
# endif
# define ToolkitStringsABIOptions -intelabi SolarisABIFlag
# else
-# define StandardDefines -Dsun -Dsparc -DSVR4 -D__EXTENSIONS__ LargefileDefines
+# define StandardDefines -Dsun -Dsparc -DSVR4 -D__EXTENSIONS__ LargefileDefines \
+ -DPIXPRIV
# define ToolkitStringsABIOptions -sparcabi SolarisABIFlag
# endif
# define ExtraLibraries -lsocket -lnsl

View File

@@ -0,0 +1,122 @@
--- ./nx-X11/config/cf/sunLib.tmpl.X.original 2015-02-13 14:03:44.400448260 +0100
+++ ./nx-X11/config/cf/sunLib.tmpl 2015-02-13 14:03:44.400448260 +0100
@@ -45,119 +45,6 @@
#else /* else it's Solaris */
-/* Solaris uses single digit library versions, and versions of libraries
- * defined in SVID specs should match the versions specified there.
- */
-
-#ifndef SharedX11Rev
-# define SharedX11Rev 4
-#endif
-#ifndef SharedOldXRev
-# define SharedOldXRev 6
-#endif
-#ifndef SharedXextRev
-# define SharedXextRev 0
-#endif
-#ifndef SharedXauRev
-# define SharedXauRev 6
-#endif
-#ifndef SharedXdmcpRev
-# define SharedXdmcpRev 6
-#endif
-#ifndef SharedXmuRev
-# define SharedXmuRev 4
-#endif
-#ifndef SharedXmuuRev
-# define SharedXmuuRev 1
-#endif
-#ifndef SharedXpRev
-# define SharedXpRev 1
-#endif
-#ifndef SharedXpmRev
-# define SharedXpmRev 4
-#endif
-#ifndef SharedXtRev
-# define SharedXtRev 4
-#endif
-#ifndef SharedXaw6Rev
-# define SharedXaw6Rev 5
-#endif
-#ifndef SharedXiRev
-# define SharedXiRev 5
-#endif
-#ifndef SharedXtstRev
-# define SharedXtstRev 1
-#endif
-#ifndef SharedFSRev
-# define SharedFSRev 5
-#endif
-#ifndef SharedICERev
-# define SharedICERev 6
-#endif
-#ifndef SharedSMRev
-# define SharedSMRev 6
-#endif
-#ifndef SharedXcursor
-# define SharedXcursorRev 1
-#endif
-#ifndef SharedXdamageRev
-# define SharedXdamageRev 1
-#endif
-#ifndef SharedXevieRev
-# define SharedXevieRev 1
-#endif
-#ifndef SharedXfixesRev
-# define SharedXfixesRev 1
-#endif
-#ifndef SharedXftRev
-# define SharedXftRev 2
-#endif
-#ifndef SharedXineramaRev
-# define SharedXineramaRev 1
-#endif
-#ifndef SharedXrenderRev
-# define SharedXrenderRev 1
-#endif
-#ifndef SharedXResRev
-# define SharedXResRev 1
-#endif
-#ifndef SharedXvRev
-# define SharedXvRev 1
-#endif
-#ifndef SharedXvMCRev
-# define SharedXvMCRev 1
-#endif
-#ifndef SharedXrandrRev
-# define SharedXrandrRev 2
-#endif
-#ifndef SharedXssRev
-# define SharedXssRev 1
-#endif
-#ifndef SharedFontconfigRev
-# define SharedFontconfigRev 1
-#endif
-#ifndef SharedGlxRev
-# define SharedGlxRev 1
-#endif
-#ifndef SharedGluRev
-# define SharedGluRev 1
-#endif
-#ifndef SharedGLwRev
-# define SharedGLwRev 1
-#endif
-#ifndef SharedOSMesaRev
-# define SharedOSMesaRev 4
-#endif
-#ifndef SharedxkbfileRev
-# define SharedxkbfileRev 5
-#endif
-#ifndef SharedXxf86miscRev
-# define SharedXxf86miscRev 1
-#endif
-#ifndef SharedXxf86vmRev
-# define SharedXxf86vmRev 1
-#endif
-
# if ThreadedX
# if OSMinorVersion > 3
# define SharedThreadReqs /**/

View File

@@ -0,0 +1,24 @@
--- ./nx-X11/config/cf/svr4.cf.X.original 2015-02-13 14:03:44.400448260 +0100
+++ ./nx-X11/config/cf/svr4.cf 2015-02-13 14:03:44.400448260 +0100
@@ -51,7 +51,12 @@
#ifndef HasLdRunPath
#define HasLdRunPath YES
#endif
+/*
+ * Currently the NX transport only works with select().
+ *
#define HasPoll YES
+ */
+#define HasPoll NO
#ifndef SVR4Architecture
#define SVR4Architecture
#endif
@@ -278,7 +283,7 @@
# define XFree86ServerDefines /* */
#endif
#ifndef XFree86ServerOSDefines
-# define XFree86ServerOSDefines -DDDXOSINIT
+# define XFree86ServerOSDefines -DDDXOSINIT -DDDXOSFATALERROR -DDDXOSVERRORF
#endif
#if HasGcc2ForCplusplus

View File

@@ -0,0 +1,10 @@
--- ./nx-X11/extras/Mesa/src/mesa/drivers/dri/common/glcontextmodes.c.X.original 2015-02-13 14:03:44.416447966 +0100
+++ ./nx-X11/extras/Mesa/src/mesa/drivers/dri/common/glcontextmodes.c 2015-02-10 19:13:14.992641502 +0100
@@ -44,6 +44,7 @@
# include "GL/glxint.h"
# ifdef XFree86Server
+void *memset( void * ptr, int val, size_t size);
# include "GL/glx_ansic.h"
extern void * __glXMalloc( size_t size );
extern void __glXFree( void * ptr );

View File

@@ -0,0 +1,103 @@
--- ./nx-X11/extras/Mesa/src/mesa/main/context.c.X.original 2015-02-13 14:03:44.464447019 +0100
+++ ./nx-X11/extras/Mesa/src/mesa/main/context.c 2015-02-10 19:13:14.800648672 +0100
@@ -131,6 +131,10 @@
#endif
#include "shaderobjects.h"
+#ifdef NXAGENT_SERVER
+#include "WSDrawBuffer.h"
+#endif
+
#ifdef USE_SPARC_ASM
#include "sparc/sparc.h"
#endif
@@ -143,6 +147,47 @@
int MESA_DEBUG_FLAGS = 0;
#endif
+#ifdef NXAGENT_SERVER
+extern WSDrawBufferPtr pWSDrawBuffer;
+
+int IsWSDrawBuffer(GLframebuffer *mesa_buffer)
+{
+ WSDrawBufferPtr p = pWSDrawBuffer;
+
+ while (p != NULL) {
+ if (p -> DrawBuffer == mesa_buffer) {
+ return 1;
+ }
+ p = p -> next;
+ }
+ return 0;
+}
+
+void FreeWSDrawBuffer(GLframebuffer *mesa_buffer)
+{
+ WSDrawBufferPtr p = pWSDrawBuffer;
+ WSDrawBufferPtr pOld = NULL;
+
+ if (p == NULL)
+ return;
+
+ if (p -> DrawBuffer == mesa_buffer) {
+ pWSDrawBuffer = p -> next;
+ free(p);
+ return;
+ }
+
+ while (p -> next != NULL) {
+ if (p -> next -> DrawBuffer == mesa_buffer) {
+ pOld = p -> next;
+ p -> next = p -> next -> next;
+ free(pOld);
+ return;
+ }
+ p = p -> next;
+ }
+}
+#endif
/* ubyte -> float conversion */
GLfloat _mesa_ubyte_to_float_color_tab[256];
@@ -1520,6 +1565,10 @@
_mesa_make_current( GLcontext *newCtx, GLframebuffer *drawBuffer,
GLframebuffer *readBuffer )
{
+ #ifdef NXAGENT_SERVER
+ int flag;
+ #endif
+
if (MESA_VERBOSE & VERBOSE_API)
_mesa_debug(newCtx, "_mesa_make_current()\n");
@@ -1558,11 +1607,30 @@
ASSERT(readBuffer->Name == 0);
newCtx->WinSysDrawBuffer = drawBuffer;
newCtx->WinSysReadBuffer = readBuffer;
+
+#ifdef NXAGENT_SERVER
+ flag = 0;
+ if (newCtx->DrawBuffer) {
+ if (!IsWSDrawBuffer(newCtx->DrawBuffer)) {
+ if (newCtx->DrawBuffer->Name == 0) {
+ flag = 1;
+ }
+ FreeWSDrawBuffer(newCtx->DrawBuffer);
+ }
+ else flag = 1;
+ }
+
+ if (!newCtx->DrawBuffer || flag) {
+ newCtx->DrawBuffer = drawBuffer;
+ newCtx->ReadBuffer = readBuffer;
+ }
+#else
/* don't replace user-buffer bindings with window system buffer */
if (!newCtx->DrawBuffer || newCtx->DrawBuffer->Name == 0) {
newCtx->DrawBuffer = drawBuffer;
newCtx->ReadBuffer = readBuffer;
}
+#endif
newCtx->NewState |= _NEW_BUFFERS;

View File

@@ -0,0 +1,67 @@
--- ./nx-X11/include/Xpoll.h.in.X.original 2015-02-13 14:03:44.612444107 +0100
+++ ./nx-X11/include/Xpoll.h.in 2015-02-10 19:13:14.464661220 +0100
@@ -51,6 +51,23 @@
/* $XFree86: xc/include/Xpoll.h,v 3.8 2001/01/17 17:53:11 dawes Exp $ */
+/**************************************************************************/
+/* */
+/* Copyright (c) 2001, 2011 NoMachine, http://www.nomachine.com/. */
+/* */
+/* NX-X11, NX protocol compression and NX extensions to this software */
+/* are copyright of NoMachine. Redistribution and use of the present */
+/* software is allowed according to terms specified in the file LICENSE */
+/* which comes in the source distribution. */
+/* */
+/* Check http://www.nomachine.com/licensing.html for applicability. */
+/* */
+/* NX and NoMachine are trademarks of Medialogic S.p.A. */
+/* */
+/* All rights reserved. */
+/* */
+/**************************************************************************/
+
#ifndef _XPOLL_H_
#define _XPOLL_H_
@@ -120,6 +137,31 @@
} fd_set;
#endif
+/*
+ * Replace the standard Select with a version giving NX a
+ * chance to check its own descriptors. This doesn't cover
+ * the cases where the system is using poll or when system-
+ * specific defines override the Select definition (OS/2).
+ * See XlibInt.c for _XSelect().
+ */
+
+#ifdef NX_TRANS_SOCKET
+
+extern int _XSelect(int maxfds, fd_set *readfds, fd_set *writefds,
+ fd_set *exceptfds, struct timeval *timeout);
+
+#ifndef hpux /* and perhaps old BSD ??? */
+# define Select(n,r,w,e,t) _XSelect(n,(fd_set*)r,(fd_set*)w,(fd_set*)e,(struct timeval*)t)
+#else
+# ifndef _XPG4_EXTENDED /* HPUX 9.x and earlier */
+# define Select(n,r,w,e,t) _XSelect(n,(int*)r,(int*)w,(int*)e,(struct timeval*)t)
+# else
+# define Select(n,r,w,e,t) _XSelect(n,(fd_set*)r,(fd_set*)w,(fd_set*)e,(struct timeval*)t)
+# endif
+#endif
+
+#else /* #ifdef NX_TRANS_SOCKET */
+
#ifndef hpux /* and perhaps old BSD ??? */
# define Select(n,r,w,e,t) select(n,(fd_set*)r,(fd_set*)w,(fd_set*)e,(struct timeval*)t)
#else
@@ -130,6 +172,8 @@
# endif
#endif
+#endif /* #ifdef NX_TRANS_SOCKET */
+
#define __X_FDS_BITS @USE_FDS_BITS@
#ifndef __FDS_BITS

View File

@@ -0,0 +1,14 @@
--- ./nx-X11/include/extensions/XKBsrv.h.X.original 2015-02-13 14:03:44.612444107 +0100
+++ ./nx-X11/include/extensions/XKBsrv.h 2015-02-10 19:13:14.644654498 +0100
@@ -73,6 +73,11 @@
#include <X11/extensions/XKBproto.h>
#include "inputstr.h"
+#ifdef NXAGENT_SERVER
+extern char *_NXGetXkbBasePath(const char *path);
+extern char *_NXGetXkbCompPath(const char *path);
+#endif
+
typedef struct _XkbInterest {
DeviceIntPtr dev;
ClientPtr client;

View File

@@ -0,0 +1,59 @@
--- ./nx-X11/lib/X11/ChkIfEv.c.X.original 2015-02-13 14:03:44.620443950 +0100
+++ ./nx-X11/lib/X11/ChkIfEv.c 2015-02-10 19:13:13.120711494 +0100
@@ -83,3 +83,56 @@
UnlockDisplay(dpy);
return False;
}
+
+#ifdef NX_TRANS_SOCKET
+
+/*
+ * This is just like XCheckIfEvent() but doesn't
+ * flush the output buffer if it can't read new
+ * events.
+ */
+
+Bool XCheckIfEventNoFlush (dpy, event, predicate, arg)
+ register Display *dpy;
+ Bool (*predicate)(
+ Display* /* display */,
+ XEvent* /* event */,
+ char* /* arg */
+ ); /* function to call */
+ register XEvent *event; /* XEvent to be filled in. */
+ char *arg;
+{
+ register _XQEvent *prev, *qelt;
+ unsigned long qe_serial = 0;
+ int n; /* time through count */
+
+ LockDisplay(dpy);
+ prev = NULL;
+ for (n = 2; --n >= 0;) {
+ for (qelt = prev ? prev->next : dpy->head;
+ qelt;
+ prev = qelt, qelt = qelt->next) {
+ if(qelt->qserial_num > qe_serial
+ && (*predicate)(dpy, &qelt->event, arg)) {
+ *event = qelt->event;
+ _XDeq(dpy, prev, qelt);
+ UnlockDisplay(dpy);
+ return True;
+ }
+ }
+ if (prev)
+ qe_serial = prev->qserial_num;
+ switch (n) {
+ case 1:
+ _XEventsQueued(dpy, QueuedAfterReading);
+ break;
+ }
+ if (prev && prev->qserial_num != qe_serial)
+ /* another thread has snatched this event */
+ prev = NULL;
+ }
+ UnlockDisplay(dpy);
+ return False;
+}
+
+#endif

View File

@@ -0,0 +1,319 @@
--- ./nx-X11/lib/X11/ConnDis.c.X.original 2015-02-13 14:03:44.620443950 +0100
+++ ./nx-X11/lib/X11/ConnDis.c 2015-02-10 19:13:13.008715687 +0100
@@ -25,6 +25,24 @@
in this Software without prior written authorization from The Open Group.
*/
+
+/**************************************************************************/
+/* */
+/* Copyright (c) 2001, 2011 NoMachine, http://www.nomachine.com/. */
+/* */
+/* NX-X11, NX protocol compression and NX extensions to this software */
+/* are copyright of NoMachine. Redistribution and use of the present */
+/* software is allowed according to terms specified in the file LICENSE */
+/* which comes in the source distribution. */
+/* */
+/* Check http://www.nomachine.com/licensing.html for applicability. */
+/* */
+/* NX and NoMachine are trademarks of Medialogic S.p.A. */
+/* */
+/* All rights reserved. */
+/* */
+/**************************************************************************/
+
/* $XFree86: xc/lib/X11/ConnDis.c,v 3.28 2003/12/02 23:33:17 herrb Exp $ */
/*
@@ -162,6 +180,39 @@
saddrlen = 0; /* set so that we can clear later */
saddr = NULL;
+#if defined(NX_TRANS_SOCKET) && defined(NX_TRANS_TEST)
+ fprintf(stderr, "_X11TransConnectDisplay: Called with display_name [%s].\n", display_name);
+#endif
+
+#ifdef NX_TRANS_SOCKET
+
+ /*
+ * Check if user selected the "nx"
+ * protocol or an "nx" hostname.
+ */
+
+ if (!strncasecmp(p, "nx/", 3) || !strcasecmp(p, "nx") ||
+ !strncasecmp(p, "nx:", 3) || !strncasecmp(p, "nx,", 3))
+ {
+ if (*(display_name + 2) == '/')
+ {
+ p += 3;
+ }
+
+ pprotocol = copystring ("nx", 2);
+
+ if (!pprotocol) goto bad;
+
+#ifdef NX_TRANS_TEST
+ fprintf(stderr, "_X11TransConnectDisplay: Forced protocol to [%s].\n", pprotocol);
+#endif
+
+ }
+ else
+ {
+
+#endif
+
/*
* Step 0, find the protocol. This is delimited by the optional
* slash ('/').
@@ -176,6 +227,60 @@
} else
p = display_name; /* reset the pointer in
case no protocol was given */
+#ifdef NX_TRANS_SOCKET
+
+ } /* End of step 0. */
+
+ /*
+ * Check if user specified the "nx" protocol or
+ * hostname is "nx" or in the form "nx,...".
+ */
+
+ if (pprotocol && !strcasecmp(pprotocol, "nx"))
+ {
+
+#ifdef NX_TRANS_TEST
+ fprintf(stderr, "_X11TransConnectDisplay: Checking hostname [%s].\n", p);
+#endif
+
+ /*
+ * Options can include a "display=" tuple so
+ * need to scan right to left.
+ */
+
+ lastp = p;
+ lastc = NULL;
+
+ for (; *p; p++)
+ if (*p == ':')
+ lastc = p;
+
+ /*
+ * Don't complain if no screen was provided.
+ */
+
+ if (lastc)
+ {
+ phostname = copystring (lastp, lastc - lastp);
+
+ p = lastc;
+ }
+ else
+ {
+ phostname = copystring (lastp, strlen(lastp));
+ }
+
+ if (!phostname) goto bad;
+
+#ifdef NX_TRANS_TEST
+ fprintf(stderr, "_X11TransConnectDisplay: Forced hostname [%s].\n", phostname);
+#endif
+
+ }
+ else
+ {
+
+#endif
/*
* Step 1, find the hostname. This is delimited by either one colon,
@@ -240,6 +345,20 @@
}
#endif
+#ifdef NX_TRANS_SOCKET
+
+ } /* End of step 1. */
+
+ /*
+ * Check if no display was specified. In this case
+ * search the "port=n" option in NX host string.
+ */
+
+ if (*p)
+ {
+
+#endif
+
/*
* Step 2, find the display number. This field is required and is
@@ -254,6 +373,66 @@
goto bad;
idisplay = atoi (pdpynum);
+#ifdef NX_TRANS_SOCKET
+
+ }
+ else
+ {
+ char *host = NULL;
+ char *name = NULL;
+ char *value = NULL;
+
+#ifdef NX_TRANS_TEST
+ fprintf(stderr, "_X11TransConnectDisplay: Searching port in port [%s].\n", phostname);
+#endif
+
+ if (!strncasecmp(phostname, "nx,", 3))
+ {
+ host = copystring(phostname + 3, strlen(phostname) - 3);
+ }
+
+ if (!host) goto bad;
+
+ idisplay = -1;
+
+ name = strtok(host, "=");
+
+ while (name)
+ {
+ value = strtok(NULL, ",");
+
+ if (value == NULL || strstr(value, "=") != NULL ||
+ strstr(name, ",") != NULL || strlen(value) >= 128)
+ {
+ Xfree(host);
+
+ goto bad;
+ }
+ else if (strcasecmp(name, "port") == 0)
+ {
+ idisplay = atoi(value);
+
+ pdpynum = copystring(value, strlen(value));
+
+ if (!pdpynum) goto bad;
+
+ break;
+ }
+
+ name = strtok(NULL, "=");
+ }
+
+ Xfree(host);
+
+ if (idisplay == -1)
+ {
+ goto bad;
+ }
+
+ } /* End of step 2. */
+
+#endif
+
/*
* Step 3, find the screen number. This field is optional. It is
@@ -286,6 +465,27 @@
* is "unix", then choose BSD UNIX domain sockets (if configured).
*/
+#ifdef NX_TRANS_SOCKET
+
+ /*
+ * If user selected the "nx" protocol
+ * force "local" transport.
+ */
+
+ if (pprotocol && !strcasecmp(pprotocol, "nx"))
+ {
+ pprotocol = copystring ("local", 5);
+
+ if (!pprotocol) goto bad;
+
+#ifdef NX_TRANS_TEST
+ fprintf(stderr, "_X11TransConnectDisplay: Converted protocol to [%s].\n", pprotocol);
+#endif
+
+ }
+
+#endif
+
#if defined(TCPCONN) || defined(UNIXCONN) || defined(LOCALCONN) || defined(MNX_TCPCONN) || defined(OS2PIPECONN)
if (!pprotocol) {
if (!phostname) {
@@ -358,14 +558,26 @@
* being a server listening at all, which is why we have to not retry
* too many times).
*/
+#if defined(NX_TRANS_SOCKET) && defined(NX_TRANS_TEST)
+ fprintf(stderr, "_X11TransConnectDisplay: Entering connection loop.\n");
+#endif
for(retry=X_CONNECTION_RETRIES; retry>=0; retry-- )
{
+#if defined(NX_TRANS_SOCKET) && defined(NX_TRANS_TEST)
+ fprintf(stderr, "_X11TransConnectDisplay: Going to call _X11TransOpenCOTSClient(address) with address [%s].\n", address);
+#endif
if ( (trans_conn = _X11TransOpenCOTSClient(address)) == NULL )
{
break;
}
+#if defined(NX_TRANS_SOCKET) && defined(NX_TRANS_TEST)
+ fprintf(stderr, "_X11TransConnectDisplay: Going to call _X11TransConnect(trans_conn,address).\n");
+#endif
if ((connect_stat = _X11TransConnect(trans_conn,address)) < 0 )
{
+#if defined(NX_TRANS_SOCKET) && defined(NX_TRANS_TEST)
+ fprintf(stderr, "_X11TransConnectDisplay: Going to call _X11TransClose(trans_conn).\n");
+#endif
_X11TransClose(trans_conn);
trans_conn = NULL;
@@ -378,6 +590,9 @@
break;
}
+#if defined(NX_TRANS_SOCKET) && defined(NX_TRANS_TEST)
+ fprintf(stderr, "_X11TransConnectDisplay: Going to call _X11TransGetPeerAddr(trans_conn, &family, &saddrlen, &saddr).\n");
+#endif
_X11TransGetPeerAddr(trans_conn, &family, &saddrlen, &saddr);
/*
@@ -386,6 +601,9 @@
* X protocol (ie FamilyInternet).
*/
+#if defined(NX_TRANS_SOCKET) && defined(NX_TRANS_TEST)
+ fprintf(stderr, "_X11TransConnectDisplay: Going to call _X11TransConvertAddress(&family, &saddrlen, &saddr).\n");
+#endif
if( _X11TransConvertAddress(&family, &saddrlen, &saddr) < 0 )
{
_X11TransClose(trans_conn);
@@ -402,6 +620,9 @@
break;
}
+#if defined(NX_TRANS_SOCKET) && defined(NX_TRANS_TEST)
+ fprintf(stderr, "_X11TransConnectDisplay: Out of connection loop.\n");
+#endif
if (address != addrbuf) Xfree (address);
address = addrbuf;
@@ -570,6 +791,17 @@
if (len != 0)
return -1;
+#ifdef NX_TRANS_SOCKET
+ if (_NXDisplayWriteFunction != NULL) {
+ (*_NXDisplayWriteFunction)(dpy, len);
+ }
+#ifdef NX_TRANS_CHANGE
+ if (_NXDisplayCongestionFunction != NULL &&
+ _X11TransSocketCongestionChange(dpy->trans_conn, &congestion) == 1) {
+ (*_NXDisplayCongestionFunction)(dpy, congestion);
+ }
+#endif
+#endif
#ifdef K5AUTH
if (auth_length == 14 &&

View File

@@ -0,0 +1,13 @@
--- ./nx-X11/lib/X11/IfEvent.c.X.original 2015-02-13 14:03:44.620443950 +0100
+++ ./nx-X11/lib/X11/IfEvent.c 2015-02-10 19:13:12.796723642 +0100
@@ -71,5 +71,10 @@
if (prev && prev->qserial_num != qe_serial)
/* another thread has snatched this event */
prev = NULL;
+#ifdef NX_TRANS_SOCKET
+ if (_XGetIOError(dpy)) {
+ return 0;
+ }
+#endif
}
}

View File

@@ -0,0 +1,13 @@
--- ./nx-X11/lib/X11/MaskEvent.c.X.original 2015-02-13 14:03:44.620443950 +0100
+++ ./nx-X11/lib/X11/MaskEvent.c 2015-02-10 19:13:12.944718089 +0100
@@ -75,5 +75,10 @@
if (prev && prev->qserial_num != qe_serial)
/* another thread has snatched this event */
prev = NULL;
+#ifdef NX_TRANS_SOCKET
+ if (_XGetIOError(dpy)) {
+ return 0;
+ }
+#endif
}
}

View File

@@ -0,0 +1,96 @@
--- ./nx-X11/lib/X11/OpenDis.c.X.original 2015-02-13 14:03:44.620443950 +0100
+++ ./nx-X11/lib/X11/OpenDis.c 2015-02-10 19:13:12.748725444 +0100
@@ -24,6 +24,24 @@
in this Software without prior written authorization from The Open Group.
*/
+
+/**************************************************************************/
+/* */
+/* Copyright (c) 2001, 2011 NoMachine, http://www.nomachine.com/. */
+/* */
+/* NX-X11, NX protocol compression and NX extensions to this software */
+/* are copyright of NoMachine. Redistribution and use of the present */
+/* software is allowed according to terms specified in the file LICENSE */
+/* which comes in the source distribution. */
+/* */
+/* Check http://www.nomachine.com/licensing.html for applicability. */
+/* */
+/* NX and NoMachine are trademarks of Medialogic S.p.A. */
+/* */
+/* All rights reserved. */
+/* */
+/**************************************************************************/
+
/* $XFree86: xc/lib/X11/OpenDis.c,v 3.16 2003/07/04 16:24:23 eich Exp $ */
#define NEED_REPLIES
@@ -43,6 +61,10 @@
#include "XKBlib.h"
#endif /* XKB */
+#ifdef NX_TRANS_SOCKET
+extern void *_X11TransSocketProxyConnInfo(XtransConnInfo);
+#endif
+
#ifdef X_NOT_POSIX
#define Size_t unsigned int
#else
@@ -117,6 +139,9 @@
bzero((char *) &client, sizeof(client));
bzero((char *) &prefix, sizeof(prefix));
+#if defined(NX_TRANS_SOCKET) && defined(NX_TRANS_TEST)
+ fprintf(stderr, "\nXOpenDisplay: Called with display [%s].\n", display);
+#endif
/*
* If the display specifier string supplied as an argument to this
* routine is NULL or a pointer to NULL, read the DISPLAY variable.
@@ -162,6 +187,9 @@
dpy->fd = _X11TransGetConnectionNumber (dpy->trans_conn);
+#if defined(NX_TRANS_SOCKET) && defined(NX_TRANS_TEST)
+ fprintf(stderr, "\nXOpenDisplay: Connected display with dpy->fd = [%d].\n", dpy->fd);
+#endif
/* Initialize as much of the display structure as we can.
* Initialize pointers to NULL so that XFreeDisplayStructure will
* work if we run out of memory before we finish initializing.
@@ -258,6 +286,10 @@
conn_buf_size = 1024 * strtol(xlib_buffer_size, NULL, 10);
if (conn_buf_size < XLIBMINBUFSIZE)
conn_buf_size = XLIBMINBUFSIZE;
+#if defined(NX_TRANS_SOCKET) && defined(NX_TRANS_TEST)
+ fprintf (stderr, "Xlib: Running with XLIBBUFFERSIZE [%d] XLIBMINBUFSIZE [%d] "
+ "buffer size [%ld].\n", XLIBDEFAULTBUFSIZE, XLIBMINBUFSIZE, conn_buf_size);
+#endif
if ((dpy->bufptr = dpy->buffer = Xcalloc(1, conn_buf_size)) == NULL) {
OutOfMemory (dpy, setup);
@@ -324,9 +356,16 @@
if (prefix.majorVersion != X_PROTOCOL) {
/* XXX - printing messages marks a bad programming interface */
+#ifdef NX_TRANS_SOCKET
+ if (_X11TransSocketProxyConnInfo(dpy->trans_conn) == NULL) {
+ fprintf (stderr, "Xlib: client uses different protocol version (%d) "
+ "than server (%d)!\r\n", X_PROTOCOL, prefix.majorVersion);
+ }
+#else
fprintf (stderr,
"Xlib: client uses different protocol version (%d) than server (%d)!\r\n",
X_PROTOCOL, prefix.majorVersion);
+#endif
_XDisconnectDisplay (dpy->trans_conn);
Xfree ((char *)dpy);
return(NULL);
@@ -698,6 +737,9 @@
/*
* and return successfully
*/
+#if defined(NX_TRANS_SOCKET) && defined(NX_TRANS_TEST)
+ fprintf(stderr, "XOpenDisplay: Returning display at [%p].\n", dpy);
+#endif
return(dpy);
}

View File

@@ -0,0 +1,14 @@
--- ./nx-X11/lib/X11/PeekIfEv.c.X.original 2015-02-13 14:03:44.620443950 +0100
+++ ./nx-X11/lib/X11/PeekIfEv.c 2015-02-10 19:13:12.952717788 +0100
@@ -71,6 +71,11 @@
if (prev && prev->qserial_num != qe_serial)
/* another thread has snatched this event */
prev = NULL;
+#ifdef NX_TRANS_SOCKET
+ if (_XGetIOError(dpy)) {
+ return 0;
+ }
+#endif
}
}

View File

@@ -0,0 +1,30 @@
--- ./nx-X11/lib/X11/Pending.c.X.original 2015-02-13 14:03:44.620443950 +0100
+++ ./nx-X11/lib/X11/Pending.c 2015-02-10 19:13:12.880720490 +0100
@@ -25,6 +25,8 @@
*/
+#include <stdio.h>
+
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
@@ -37,11 +39,18 @@
int mode;
{
int ret_val;
+#if defined(NX_TRANS_SOCKET) && defined(NX_TRANS_TEST)
+ fprintf(stderr, "\nXEventsQueued: Called with a display at [%p].\n", dpy);
+#endif
+
LockDisplay(dpy);
if (dpy->qlen || (mode == QueuedAlready))
ret_val = dpy->qlen;
else
ret_val = _XEventsQueued (dpy, mode);
+#if defined(NX_TRANS_SOCKET) && defined(NX_TRANS_TEST)
+ fprintf(stderr, "\nXEventsQueued: Going to unlock the display at [%p].\n", dpy);
+#endif
UnlockDisplay(dpy);
return ret_val;
}

View File

@@ -0,0 +1,84 @@
--- ./nx-X11/lib/X11/XKBMAlloc.c.X.original 2015-02-13 14:03:44.620443950 +0100
+++ ./nx-X11/lib/X11/XKBMAlloc.c 2015-02-10 19:13:12.836722141 +0100
@@ -738,8 +738,13 @@
_XkbFree(prev_key_sym_map);
return BadAlloc;
}
+#ifdef NXAGENT_SERVER
+ bzero((char *)&xkb->map->key_sym_map[xkb->max_key_code+1],
+ tmp*sizeof(XkbSymMapRec));
+#else
bzero((char *)&xkb->map->key_sym_map[xkb->max_key_code],
tmp*sizeof(XkbSymMapRec));
+#endif
if (changes) {
changes->map.changed= _ExtendRange(changes->map.changed,
XkbKeySymsMask,maxKC,
@@ -756,7 +761,11 @@
_XkbFree(prev_modmap);
return BadAlloc;
}
+#ifdef NXAGENT_SERVER
+ bzero((char *)&xkb->map->modmap[xkb->max_key_code+1],tmp);
+#else
bzero((char *)&xkb->map->modmap[xkb->max_key_code],tmp);
+#endif
if (changes) {
changes->map.changed= _ExtendRange(changes->map.changed,
XkbModifierMapMask,maxKC,
@@ -775,8 +784,13 @@
_XkbFree(prev_behaviors);
return BadAlloc;
}
+#ifdef NXAGENT_SERVER
+ bzero((char *)&xkb->server->behaviors[xkb->max_key_code+1],
+ tmp*sizeof(XkbBehavior));
+#else
bzero((char *)&xkb->server->behaviors[xkb->max_key_code],
tmp*sizeof(XkbBehavior));
+#endif
if (changes) {
changes->map.changed= _ExtendRange(changes->map.changed,
XkbKeyBehaviorsMask,maxKC,
@@ -793,8 +807,13 @@
_XkbFree(prev_key_acts);
return BadAlloc;
}
+#ifdef NXAGENT_SERVER
+ bzero((char *)&xkb->server->key_acts[xkb->max_key_code+1],
+ tmp*sizeof(unsigned short));
+#else
bzero((char *)&xkb->server->key_acts[xkb->max_key_code],
tmp*sizeof(unsigned short));
+#endif
if (changes) {
changes->map.changed= _ExtendRange(changes->map.changed,
XkbKeyActionsMask,maxKC,
@@ -811,8 +830,13 @@
_XkbFree(prev_vmodmap);
return BadAlloc;
}
+#ifdef NXAGENT_SERVER
+ bzero((char *)&xkb->server->vmodmap[xkb->max_key_code+1],
+ tmp*sizeof(unsigned short));
+#else
bzero((char *)&xkb->server->vmodmap[xkb->max_key_code],
tmp*sizeof(unsigned short));
+#endif
if (changes) {
changes->map.changed= _ExtendRange(changes->map.changed,
XkbVirtualModMapMask,maxKC,
@@ -830,8 +854,13 @@
_XkbFree(prev_keys);
return BadAlloc;
}
+#ifdef NXAGENT_SERVER
+ bzero((char *)&xkb->names->keys[xkb->max_key_code+1],
+ tmp*sizeof(XkbKeyNameRec));
+#else
bzero((char *)&xkb->names->keys[xkb->max_key_code],
tmp*sizeof(XkbKeyNameRec));
+#endif
if (changes) {
changes->names.changed= _ExtendRange(changes->names.changed,
XkbKeyNamesMask,maxKC,

View File

@@ -0,0 +1,30 @@
--- ./nx-X11/lib/X11/Xlib.h.X.original 2015-02-13 14:03:44.624443872 +0100
+++ ./nx-X11/lib/X11/Xlib.h 2015-02-10 19:13:12.720726495 +0100
@@ -2102,6 +2102,27 @@
XPointer /* arg */
);
+#ifdef NX_TRANS_SOCKET
+
+/*
+ * This is just like XCheckIfEvent() but doesn't
+ * flush the output buffer if it can't read new
+ * events.
+ */
+
+extern Bool XCheckIfEventNoFlush(
+ Display* /* display */,
+ XEvent* /* event_return */,
+ Bool (*) (
+ Display* /* display */,
+ XEvent* /* event */,
+ XPointer /* arg */
+ ) /* predicate */,
+ XPointer /* arg */
+);
+
+#endif
+
extern Bool XCheckMaskEvent(
Display* /* display */,
long /* event_mask */,

View File

@@ -0,0 +1,41 @@
--- ./nx-X11/lib/X11/XlibAsync.c.X.original 2015-02-13 14:03:44.624443872 +0100
+++ ./nx-X11/lib/X11/XlibAsync.c 2015-02-10 19:13:13.064713591 +0100
@@ -27,6 +27,23 @@
*/
+/**************************************************************************/
+/* */
+/* Copyright (c) 2001, 2011 NoMachine, http://www.nomachine.com/. */
+/* */
+/* NX-X11, NX protocol compression and NX extensions to this software */
+/* are copyright of NoMachine. Redistribution and use of the present */
+/* software is allowed according to terms specified in the file LICENSE */
+/* which comes in the source distribution. */
+/* */
+/* Check http://www.nomachine.com/licensing.html for applicability. */
+/* */
+/* NX and NoMachine are trademarks of Medialogic S.p.A. */
+/* */
+/* All rights reserved. */
+/* */
+/**************************************************************************/
+
#define NEED_REPLIES
#ifdef HAVE_CONFIG_H
#include <config.h>
@@ -122,6 +139,14 @@
*/
if ((rep->generic.length << 2) > len)
_XEatData (dpy, (rep->generic.length << 2) - len);
+#ifdef NX_TRANS_SOCKET
+
+ /*
+ * The original code has provision
+ * for returning already.
+ */
+
+#endif
_XIOError (dpy);
return (char *)rep;
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,59 @@
--- ./nx-X11/lib/X11/Xlibint.h.X.original 2015-02-13 14:03:44.624443872 +0100
+++ ./nx-X11/lib/X11/Xlibint.h 2015-02-10 19:13:12.888720189 +0100
@@ -27,6 +27,24 @@
from The Open Group.
*/
+
+/**************************************************************************/
+/* */
+/* Copyright (c) 2001, 2011 NoMachine, http://www.nomachine.com/. */
+/* */
+/* NX-X11, NX protocol compression and NX extensions to this software */
+/* are copyright of NoMachine. Redistribution and use of the present */
+/* software is allowed according to terms specified in the file LICENSE */
+/* which comes in the source distribution. */
+/* */
+/* Check http://www.nomachine.com/licensing.html for applicability. */
+/* */
+/* NX and NoMachine are trademarks of Medialogic S.p.A. */
+/* */
+/* All rights reserved. */
+/* */
+/**************************************************************************/
+
/* $XFree86: xc/lib/X11/Xlibint.h,v 3.27 2003/05/27 22:26:26 tsi Exp $ */
#ifndef _XLIBINT_H_
@@ -44,6 +62,15 @@
#include <X11/Xproto.h> /* to declare xEvent */
#include <X11/XlibConf.h> /* for configured options like XTHREADS */
+#ifdef NX_TRANS_SOCKET
+
+#include "NXvars.h"
+
+#define _XGetIOError(dpy) \
+ (dpy -> flags & XlibDisplayIOError)
+
+#endif
+
#ifdef WIN32
#define _XFlush _XFlushIt
#endif
@@ -348,9 +375,15 @@
#define LOCKED 1
#define UNLOCKED 0
+#ifdef NX_TRANS_SOCKET
+#ifndef BUFSIZE /* Output buffer size is configurable */
+#define BUFSIZE 8192 /* but this is still used for reading. */
+#endif
+#else
#ifndef BUFSIZE
#define BUFSIZE 2048 /* X output buffer size. */
#endif
+#endif
#ifndef PTSPERBATCH
#define PTSPERBATCH 1024 /* point batching */
#endif

View File

@@ -0,0 +1,14 @@
--- ./nx-X11/lib/X11/cmsProp.c.X.original 2015-02-13 14:03:44.624443872 +0100
+++ ./nx-X11/lib/X11/cmsProp.c 2015-02-10 19:13:12.948717938 +0100
@@ -121,7 +121,11 @@
char *prop_ret;
int format_ret;
long len = 6516;
+ #ifdef NXAGENT_SERVER
+ unsigned long nitems_ret, after_ret = 0;
+ #else
unsigned long nitems_ret, after_ret;
+ #endif
Atom atom_ret;
while (XGetWindowProperty (pDpy, w, property, 0, len, False,

View File

@@ -0,0 +1,62 @@
--- ./nx-X11/lib/Xau/AuRead.c.X.original 2015-02-13 14:03:44.624443872 +0100
+++ ./nx-X11/lib/Xau/AuRead.c 2015-02-10 19:13:12.488735202 +0100
@@ -32,14 +32,29 @@
#endif
#include <X11/Xauth.h>
#include <stdlib.h>
+#include <errno.h>
static int
read_short (unsigned short *shortp, FILE *file)
{
unsigned char file_short[2];
- if (fread ((char *) file_short, (int) sizeof (file_short), 1, file) != 1)
- return 0;
+ /*
+ * Added a check on EINTR to prevent the fread() call to be
+ * interrupted by any signal not blocked by OsBlockSignals().
+ */
+
+ for (;;) {
+ if (fread ((char *) file_short, (int) sizeof (file_short), 1, file) != 1) {
+ if (errno == EINTR && ferror (file)) {
+ perror ("Reading from auth file");
+ clearerr (file);
+ continue;
+ }
+ return 0;
+ }
+ break;
+ }
*shortp = file_short[0] * 256 + file_short[1];
return 1;
}
@@ -58,11 +73,22 @@
data = malloc ((unsigned) len);
if (!data)
return 0;
- if (fread (data, (int) sizeof (char), (int) len, file) != len) {
- bzero (data, len);
- free (data);
- return 0;
- }
+ for (;;)
+ {
+ if (fread (data, (int) sizeof (char), (int) len, file) != len)
+ {
+ if (errno == EINTR && ferror (file))
+ {
+ perror ("Reading from auth file");
+ clearerr (file);
+ continue;
+ }
+ bzero (data, len);
+ free (data);
+ return 0;
+ }
+ break;
+ }
}
*stringp = data;
*countp = len;

View File

@@ -0,0 +1,547 @@
--- ./nx-X11/lib/Xrender/Glyph.c.X.original 2015-02-13 14:03:44.652443320 +0100
+++ ./nx-X11/lib/Xrender/Glyph.c 2015-02-10 19:13:12.580731749 +0100
@@ -27,6 +27,26 @@
#endif
#include "Xrenderint.h"
+/*
+ * NX_RENDER_CLEANUP enables cleaning of padding bytes
+ */
+
+#define NX_RENDER_CLEANUP
+
+#define PANIC
+#define WARNING
+#undef TEST
+#undef DEBUG
+#undef DUMP
+
+#ifdef NX_RENDER_CLEANUP
+
+#include <stdio.h>
+
+#define ROUNDUP(nbits, pad) ((((nbits) + ((pad)-1)) / (pad)) * ((pad)>>3))
+
+#endif /* NX_RENDER_CLEANUP */
+
GlyphSet
XRenderCreateGlyphSet (Display *dpy, _Xconst XRenderPictFormat *format)
{
@@ -81,6 +101,248 @@
SyncHandle();
}
+#ifdef NX_RENDER_CLEANUP
+
+void
+XRenderCleanGlyphs(xGlyphInfo *gi,
+ int nglyphs,
+ CARD8 *images,
+ int depth,
+ Display *dpy)
+{
+
+ int widthInBits;
+ int bytesPerLine;
+ int bytesToClean;
+ int bitsToClean;
+ int widthInBytes;
+ int height = gi -> height;
+ register int i;
+ int j;
+
+ #ifdef DEBUG
+ fprintf(stderr, "nxagentCleanGlyphs: Found a Glyph with Depth %d, width %d, pad %d.\n",
+ depth, gi -> width, dpy -> bitmap_pad);
+ #endif
+
+ while (nglyphs > 0)
+ {
+ if (depth == 24)
+ {
+ widthInBits = gi -> width * 32;
+
+ bytesPerLine = ROUNDUP(widthInBits, dpy -> bitmap_pad);
+
+ 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);
+ #endif
+
+ if (dpy -> byte_order == LSBFirst)
+ {
+ for (i = 3; i < bytesToClean; i += 4)
+ {
+ images[i] = 0x00;
+ }
+ }
+ else
+ {
+ for (i = 0; i < bytesToClean; i += 4)
+ {
+ images[i] = 0x00;
+ }
+ }
+
+ #ifdef DUMP
+ fprintf(stderr, "nxagentCleanGlyphs: depth %d, bytesToClean %d, scanline: ", depth, bytesToClean);
+ for (i = 0; i < bytesPerLine; i++)
+ {
+ fprintf(stderr, "[%d]", images[i]);
+ }
+ fprintf(stderr,"\n");
+ #endif
+
+ images += bytesToClean;
+
+ gi++;
+
+ nglyphs--;
+ }
+ else if (depth == 1)
+ {
+ widthInBits = gi -> width;
+
+ bytesPerLine = ROUNDUP(widthInBits, dpy -> bitmap_pad);
+
+ 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);
+ #endif
+
+ bytesToClean = bitsToClean >> 3;
+
+ 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,
+ dpy -> byte_order, dpy -> bitmap_bit_order);
+ #endif
+
+ for (i = 1; i <= height; i++)
+ {
+ if (dpy -> byte_order == dpy -> bitmap_bit_order)
+ {
+ for (j = 1; j <= bytesToClean; j++)
+ {
+ images[i * bytesPerLine - j] = 0x00;
+
+ #ifdef DEBUG
+ fprintf(stderr, "nxagentCleanGlyphs: byte_order = bitmap_bit_orde, cleaning %d, i=%d, j=%d.\n"
+ , (i * bytesPerLine - j), i, j);
+ #endif
+
+ }
+ }
+ else
+ {
+ for (j = bytesToClean; j >= 1; j--)
+ {
+ images[i * bytesPerLine - j] = 0x00;
+
+ #ifdef DEBUG
+ fprintf(stderr, "nxagentCleanGlyphs: byte_order %d, bitmap_bit_order %d, cleaning %d, i=%d, j=%d.\n"
+ , dpy -> byte_order, dpy -> bitmap_bit_order, (i * bytesPerLine - j), i, j);
+ #endif
+
+ }
+ }
+
+ if (dpy -> bitmap_bit_order == MSBFirst)
+ {
+ 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);
+ #endif
+ }
+ else
+ {
+ 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);
+ #endif
+ }
+ }
+
+ #ifdef DUMP
+ fprintf(stderr, "nxagentCleanGlyphs: depth %d, bytesToClean %d, scanline: ", depth, bytesToClean);
+ for (i = 0; i < bytesPerLine; i++)
+ {
+ fprintf(stderr, "[%d]", images[i]);
+ }
+ fprintf(stderr,"\n");
+ #endif
+
+ images += bytesPerLine * height;
+
+ gi++;
+
+ nglyphs--;
+ }
+ else if ((depth == 8) || (depth == 16) )
+ {
+ widthInBits = gi -> width * depth;
+
+ bytesPerLine = ROUNDUP(widthInBits, dpy -> bitmap_pad);
+
+ widthInBytes = (widthInBits >> 3);
+
+ bytesToClean = bytesPerLine - widthInBytes;
+
+ #ifdef DEBUG
+ fprintf(stderr, "nxagentCleanGlyphs: nglyphs is %d, width of glyph in bits is %d, in bytes is %d.\n",
+ nglyphs, widthInBits, widthInBytes);
+
+ fprintf(stderr, "nxagentCleanGlyphs: bytesPerLine is %d bytes, there are %d scanlines.\n", bytesPerLine, height);
+
+ fprintf(stderr, "nxagentCleanGlyphs: Bytes to clean for each scanline are %d.\n", bytesToClean);
+ #endif
+
+ if (bytesToClean > 0)
+ {
+ while (height > 0)
+ {
+ i = bytesToClean;
+
+ while (i > 0)
+ {
+ *(images + (bytesPerLine - i)) = 0;
+
+ #ifdef DEBUG
+ fprintf(stderr, "nxagentCleanGlyphs: cleaned a byte.\n");
+ #endif
+
+ i--;
+ }
+
+ #ifdef DUMP
+ fprintf(stderr, "nxagentCleanGlyphs: depth %d, bytesToClean %d, scanline: ", depth, bytesToClean);
+ for (i = 0; i < bytesPerLine; i++)
+ {
+ fprintf(stderr, "[%d]", images[i]);
+ }
+ fprintf(stderr,"\n");
+ #endif
+
+ images += bytesPerLine;
+
+ height--;
+ }
+ }
+
+ gi++;
+
+ nglyphs--;
+
+ #ifdef DEBUG
+ fprintf(stderr, "nxagentCleanGlyphs: Breaking Out.\n");
+ #endif
+ }
+ else if (depth == 32)
+ {
+ #ifdef DEBUG
+ fprintf(stderr, "nxagentCleanGlyphs: Found glyph with depth 32.\n");
+ #endif
+
+ gi++;
+
+ nglyphs--;
+ }
+ else
+ {
+ #ifdef WARNING
+ fprintf(stderr, "nxagentCleanGlyphs: Unrecognized glyph, depth is not 8/16/24/32, it appears to be %d.\n",
+ depth);
+ #endif
+
+ gi++;
+
+ nglyphs--;
+ }
+ }
+}
+
+#endif /* #ifdef NX_RENDER_CLEANUP */
+
void
XRenderAddGlyphs (Display *dpy,
GlyphSet glyphset,
@@ -404,6 +666,14 @@
_Xconst char *chars;
int nchars;
+ #ifdef NX_RENDER_CLEANUP
+
+ char tmpChar[4];
+ int bytes_to_clean;
+ int bytes_to_write;
+
+ #endif /* NX_RENDER_CLEANUP */
+
if (!nelt)
return;
@@ -464,6 +734,14 @@
{
glyphset = elts[i].glyphset;
BufAlloc (xGlyphElt *, elt, SIZEOF (xGlyphElt));
+
+ #ifdef NX_RENDER_CLEANUP
+
+ elt->pad1 = 0;
+ elt->pad2 = 0;
+
+ #endif /* NX_RENDER_CLEANUP */
+
elt->len = 0xff;
elt->deltax = 0;
elt->deltay = 0;
@@ -478,11 +756,88 @@
int this_chars = nchars > MAX_8 ? MAX_8 : nchars;
BufAlloc (xGlyphElt *, elt, SIZEOF(xGlyphElt))
+
+ #ifdef NX_RENDER_CLEANUP
+
+ elt->pad1 = 0;
+ elt->pad2 = 0;
+
+ #endif /* NX_RENDER_CLEANUP */
+
elt->len = this_chars;
elt->deltax = xDst;
elt->deltay = yDst;
xDst = 0;
yDst = 0;
+
+ #ifdef NX_RENDER_CLEANUP
+
+ bytes_to_write = this_chars & ~3;
+
+ bytes_to_clean = ((this_chars + 3) & ~3) - this_chars;
+
+ #ifdef DEBUG
+ fprintf(stderr, "XRenderCompositeText8: bytes_to_write %d, bytes_to_clean are %d,"
+ " this_chars %d.\n", bytes_to_write, bytes_to_clean, this_chars);
+ #endif
+
+ if (bytes_to_clean > 0)
+ {
+ if (bytes_to_write > 0)
+ {
+ #ifdef DEBUG
+ fprintf(stderr, "XRenderCompositeText8: found %d clean bytes, bytes_to_clean are %d,"
+ " this_chars %d.\n", bytes_to_write, bytes_to_clean, this_chars);
+ #endif
+
+ Data (dpy, chars, bytes_to_write);
+ chars += bytes_to_write;
+ }
+
+ bytes_to_write = this_chars % 4;
+ memcpy (tmpChar, chars, bytes_to_write);
+ chars += bytes_to_write;
+
+ #ifdef DEBUG
+ fprintf(stderr, "XRenderCompositeText8: last 32 bit, bytes_to_write are %d,"
+ " bytes_to_clean are %d, this_chars are %d.\n", bytes_to_write, bytes_to_clean, this_chars);
+ #endif
+
+ #ifdef DUMP
+ fprintf(stderr, "XRenderCompositeText8: bytes_to_clean %d, ", bytes_to_clean);
+ #endif
+
+ while (bytes_to_clean > 0)
+ {
+ tmpChar[4 - bytes_to_clean] = 0;
+ bytes_to_clean--;
+
+ #ifdef DEBUG
+ fprintf(stderr, "XRenderCompositeText8: Cleaned %d byte.\n", 4 - bytes_to_clean);
+ #endif
+ }
+
+ Data (dpy, tmpChar, 4);
+ nchars -= this_chars;
+
+ #ifdef DUMP
+ fprintf(stderr, "Data: ");
+ for (i = 0; i < 4; i++)
+ {
+ fprintf(stderr, "[%d]", tmpChar[i]);
+ }
+ fprintf(stderr,"\n");
+ #endif
+
+ #ifdef DEBUG
+ fprintf(stderr, "XRenderCompositeText8: nchars now is %d.\n", nchars);
+ #endif
+
+ continue;
+ }
+
+ #endif /* NX_RENDER_CLEANUP */
+
Data (dpy, chars, this_chars);
nchars -= this_chars;
chars += this_chars;
@@ -517,6 +872,14 @@
_Xconst unsigned short *chars;
int nchars;
+ #ifdef NX_RENDER_CLEANUP
+
+ int bytes_to_write;
+ int bytes_to_clean;
+ char tmpChar[4];
+
+ #endif /* NX_RENDER_CLEANUP */
+
if (!nelt)
return;
@@ -574,6 +937,14 @@
{
glyphset = elts[i].glyphset;
BufAlloc (xGlyphElt *, elt, SIZEOF (xGlyphElt));
+
+ #ifdef NX_RENDER_CLEANUP
+
+ elt->pad1 = 0;
+ elt->pad2 = 0;
+
+ #endif /* NX_RENDER_CLEANUP */
+
elt->len = 0xff;
elt->deltax = 0;
elt->deltay = 0;
@@ -587,13 +958,77 @@
{
int this_chars = nchars > MAX_16 ? MAX_16 : nchars;
int this_bytes = this_chars * 2;
-
+
BufAlloc (xGlyphElt *, elt, SIZEOF(xGlyphElt))
+
+ #ifdef NX_RENDER_CLEANUP
+
+ elt->pad1 = 0;
+ elt->pad2 = 0;
+
+ #endif /* NX_RENDER_CLEANUP */
+
elt->len = this_chars;
elt->deltax = xDst;
elt->deltay = yDst;
xDst = 0;
yDst = 0;
+
+ #ifdef NX_RENDER_CLEANUP
+
+ bytes_to_write = this_bytes & ~3;
+ bytes_to_clean = ((this_bytes + 3) & ~3) - this_bytes;
+
+ #ifdef DEBUG
+ fprintf(stderr, "XRenderCompositeText16: this_chars %d, this_bytes %d.\n"
+ "bytes_to_write %d, bytes_to_clean are %d.\n", this_chars, this_bytes,
+ bytes_to_write, bytes_to_clean);
+ #endif
+
+ if (bytes_to_clean > 0)
+ {
+ if (bytes_to_write > 0)
+ {
+ Data16 (dpy, chars, bytes_to_write);
+
+ /*
+ * Cast chars to avoid errors with pointer arithmetic.
+ */
+
+ chars = (unsigned short *) ((char *) chars + bytes_to_write);
+ }
+
+ bytes_to_write = this_bytes % 4;
+ memcpy (tmpChar, (char *) chars, bytes_to_write);
+ chars = (unsigned short *) ((char *) chars + bytes_to_write);
+
+ #ifdef DEBUG
+ fprintf(stderr, "XRenderCompositeText16: last 32 bit, bytes_to_write are %d,"
+ " bytes_to_clean are %d.\n", bytes_to_write, bytes_to_clean);
+ #endif
+
+ while (bytes_to_clean > 0)
+ {
+ tmpChar[4 - bytes_to_clean] = 0;
+ bytes_to_clean--;
+
+ #ifdef DEBUG
+ fprintf(stderr, "XRenderCompositeText16: Cleaned %d byte.\n", 4 - bytes_to_clean);
+ #endif
+ }
+
+ Data16 (dpy, tmpChar, 4);
+ nchars -= this_chars;
+
+ #ifdef DEBUG
+ fprintf(stderr, "XRenderCompositeText16: nchars now is %d.\n", nchars);
+ #endif
+
+ continue;
+ }
+
+ #endif /* NX_RENDER_CLEANUP */
+
Data16 (dpy, chars, this_bytes);
nchars -= this_chars;
chars += this_chars;
@@ -681,6 +1116,14 @@
{
glyphset = elts[i].glyphset;
BufAlloc (xGlyphElt *, elt, SIZEOF (xGlyphElt));
+
+ #ifdef NX_RENDER_CLEANUP
+
+ elt->pad1 = 0;
+ elt->pad2 = 0;
+
+ #endif /* NX_RENDER_CLEANUP */
+
elt->len = 0xff;
elt->deltax = 0;
elt->deltay = 0;
@@ -695,11 +1138,25 @@
int this_chars = nchars > MAX_32 ? MAX_32 : nchars;
int this_bytes = this_chars * 4;
BufAlloc (xGlyphElt *, elt, SIZEOF(xGlyphElt))
+
+ #ifdef NX_RENDER_CLEANUP
+
+ elt->pad1 = 0;
+ elt->pad2 = 0;
+
+ #endif /* NX_RENDER_CLEANUP */
+
elt->len = this_chars;
elt->deltax = xDst;
elt->deltay = yDst;
xDst = 0;
yDst = 0;
+
+ #ifdef TEST
+ fprintf(stderr, "XRenderCompositeText32: this_chars %d, this_bytes %d.\n",
+ this_chars, this_bytes);
+ #endif
+
DataInt32 (dpy, chars, this_bytes);
nchars -= this_chars;
chars += this_chars;

View File

@@ -0,0 +1,39 @@
--- ./nx-X11/lib/Xrender/Xrender.h.X.original 2015-02-13 14:03:44.652443320 +0100
+++ ./nx-X11/lib/Xrender/Xrender.h 2015-02-10 19:13:12.596731149 +0100
@@ -25,6 +25,8 @@
#ifndef _XRENDER_H_
#define _XRENDER_H_
+#define NX_CLEANUP
+
#include <X11/extensions/render.h>
#include <X11/Xlib.h>
@@ -32,6 +34,10 @@
#include <X11/Xosdefs.h>
#include <X11/Xutil.h>
+#ifdef NX_CLEANUP
+#include "renderproto.h"
+#endif
+
typedef struct {
short red;
short redMask;
@@ -296,6 +302,16 @@
void
XRenderFreeGlyphSet (Display *dpy, GlyphSet glyphset);
+#ifdef NX_CLEANUP
+
+void XRenderCleanGlyphs (xGlyphInfo *gi,
+ int nglyphs,
+ CARD8 *images,
+ int depth,
+ Display *dpy);
+
+#endif /* #ifdef NX_CLEANUP */
+
void
XRenderAddGlyphs (Display *dpy,
GlyphSet glyphset,

View File

@@ -0,0 +1,42 @@
--- ./nx-X11/lib/Xt/NextEvent.c.X.original 2015-02-13 14:03:44.656443242 +0100
+++ ./nx-X11/lib/Xt/NextEvent.c 2015-02-13 14:03:44.656443242 +0100
@@ -58,6 +58,24 @@
in this Software without prior written authorization from The Open Group.
*/
+
+/**************************************************************************/
+/* */
+/* Copyright (c) 2001, 2011 NoMachine, http://www.nomachine.com/. */
+/* */
+/* NX-X11, NX protocol compression and NX extensions to this software */
+/* are copyright of NoMachine. Redistribution and use of the present */
+/* software is allowed according to terms specified in the file LICENSE */
+/* which comes in the source distribution. */
+/* */
+/* Check http://www.nomachine.com/licensing.html for applicability. */
+/* */
+/* NX and NoMachine are trademarks of Medialogic S.p.A. */
+/* */
+/* All rights reserved. */
+/* */
+/**************************************************************************/
+
/* $XFree86: xc/lib/Xt/NextEvent.c,v 3.26 2002/06/04 21:55:42 dawes Exp $ */
#ifdef HAVE_CONFIG_H
@@ -345,6 +363,14 @@
wait_fds_ptr_t wf)
{
#ifndef USE_POLL
+
+#if defined(NX_TRANS_SOCKET) && defined(NX_TRANS_TEST)
+
+ fprintf(stderr, "Xt::IoWait: Select called with [%d][%p][%p][%p][%p].\n",
+ wf->nfds, (void *) &wf->rmask, (void *) &wf->wmask, (void *) &wf->emask,
+ (void *) wt->wait_time_ptr);
+#endif
+
return Select (wf->nfds, &wf->rmask, &wf->wmask, &wf->emask,
wt->wait_time_ptr);
#else

View File

@@ -0,0 +1,22 @@
--- ./nx-X11/lib/font/fontfile/encparse.c.X.original 2015-02-13 14:03:44.668443005 +0100
+++ ./nx-X11/lib/font/fontfile/encparse.c 2015-02-10 19:13:12.336740907 +0100
@@ -867,8 +867,10 @@
if(!strcasecmp(encoding_name, charset)) {
/* Found it */
if(file_name[0] != '/') {
- if(strlen(dir) + strlen(file_name) >= MAXFONTFILENAMELEN)
+ if(strlen(dir) + strlen(file_name) >= MAXFONTFILENAMELEN) {
+ fclose(file);
return NULL;
+ }
strcpy(buf, dir);
strcat(buf, file_name);
} else {
@@ -877,6 +879,7 @@
f = FontFileOpen(buf);
if(f == NULL) {
+ fclose(file);
return NULL;
}
encoding = parseEncodingFile(f, 0);

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,11 @@
--- ./nx-X11/programs/Xserver/GL/glx/render2.c.X.original 2015-02-13 14:03:44.680442769 +0100
+++ ./nx-X11/programs/Xserver/GL/glx/render2.c 2015-02-10 19:13:14.416663013 +0100
@@ -43,7 +43,7 @@
#include "unpack.h"
#include "g_disptab.h"
#include "g_disptab_EXT.h"
-
+#include "indirect_size.h"
void __glXDisp_Map1f(GLbyte *pc)
{

View File

@@ -0,0 +1,11 @@
--- ./nx-X11/programs/Xserver/GL/glx/render2swap.c.X.original 2015-02-13 14:03:44.680442769 +0100
+++ ./nx-X11/programs/Xserver/GL/glx/render2swap.c 2015-02-10 19:13:14.376664506 +0100
@@ -43,7 +43,7 @@
#include "unpack.h"
#include "g_disptab.h"
#include "g_disptab_EXT.h"
-
+#include "indirect_size.h"
void __glXDispSwap_Map1f(GLbyte *pc)
{

View File

@@ -0,0 +1,11 @@
--- ./nx-X11/programs/Xserver/GL/mesa/X/Imakefile.X.original 2015-02-13 14:03:44.680442769 +0100
+++ ./nx-X11/programs/Xserver/GL/mesa/X/Imakefile 2015-02-10 19:13:14.340665851 +0100
@@ -57,7 +57,7 @@
-I$(XF86OSSRC) \
-I$(DRMSRCDIR)/shared-core
- DEFINES = $(GLX_DEFINES) $(GLXSRV_DEFINES) /*-DUSE_X86_ASM*/ /*-DUSE_SPARC_ASM*/
+ DEFINES = $(GLX_DEFINES) $(GLXSRV_DEFINES) -DNXAGENT_SERVER /*-DUSE_X86_ASM*/ /*-DUSE_SPARC_ASM*/
#ifdef IHaveModules
ModuleObjectRule()

View File

@@ -0,0 +1,70 @@
--- ./nx-X11/programs/Xserver/GL/mesa/X/xf86glx.c.X.original 2015-02-13 14:03:44.680442769 +0100
+++ ./nx-X11/programs/Xserver/GL/mesa/X/xf86glx.c 2015-02-10 19:13:14.340665851 +0100
@@ -71,6 +71,10 @@
#include "glcontextmodes.h"
+#ifdef NXAGENT_SERVER
+#include "../main/WSDrawBuffer.h"
+#endif
+
/*
* This structure is statically allocated in the __glXScreens[]
* structure. This struct is not used anywhere other than in
@@ -95,6 +99,36 @@
NULL /* WrappedPositionWindow is overwritten */
};
+#ifdef NXAGENT_SERVER
+WSDrawBufferPtr pWSDrawBuffer = NULL;
+
+void AddWSDrawBuffer(GLframebuffer *mesa_buffer)
+{
+ WSDrawBufferPtr prevWSDB;
+ WSDrawBufferPtr newWSDB;
+ WSDrawBufferPtr p;
+
+ prevWSDB = NULL;
+ newWSDB = NULL;
+ p = pWSDrawBuffer;
+ while (p != NULL) {
+ prevWSDB = p;
+ if (prevWSDB -> DrawBuffer == mesa_buffer) {
+ return;
+ }
+ p = p -> next;
+ }
+ newWSDB = malloc(sizeof(WSDrawBufferRec));
+ newWSDB -> DrawBuffer = mesa_buffer;
+ newWSDB -> next = NULL;
+
+ if (pWSDrawBuffer == NULL)
+ pWSDrawBuffer = newWSDB;
+ else
+ prevWSDB -> next = newWSDB;
+}
+#endif
+
void *__glXglDDXScreenInfo(void) {
return &__glDDXScreenInfo;
}
@@ -748,6 +782,10 @@
__MESA_buffer buf = (__MESA_buffer)glPriv->private;
__GLXdrawablePrivate *glxPriv = (__GLXdrawablePrivate *)glPriv->other;
+#ifdef NXAGENT_SERVER
+ AddWSDrawBuffer(& (buf -> xm_buf -> mesa_buffer) );
+#endif
+
/* Destroy Mesa's buffers */
if (buf->xm_buf)
XMesaDestroyBuffer(buf->xm_buf);
@@ -757,7 +795,7 @@
glPriv->frontBuffer.resize = buf->fbresize;
__glXFree(glPriv->private);
- glPriv->private = NULL;
+ glPriv->private = NULL;
}
__GLinterface *__MESA_createContext(__GLimports *imports,

View File

@@ -0,0 +1,315 @@
--- ./nx-X11/programs/Xserver/Xext/security.c.X.original 2015-02-13 14:03:44.684442691 +0100
+++ ./nx-X11/programs/Xserver/Xext/security.c 2015-02-13 14:03:44.684442691 +0100
@@ -27,6 +27,23 @@
*/
/* $XFree86: xc/programs/Xserver/Xext/security.c,v 1.16tsi Exp $ */
+/**************************************************************************/
+/* */
+/* Copyright (c) 2001, 2011 NoMachine, http://www.nomachine.com/. */
+/* */
+/* NX-X11, NX protocol compression and NX extensions to this software */
+/* are copyright of NoMachine. Redistribution and use of the present */
+/* software is allowed according to terms specified in the file LICENSE */
+/* which comes in the source distribution. */
+/* */
+/* Check http://www.nomachine.com/licensing.html for applicability. */
+/* */
+/* NX and NoMachine are trademarks of Medialogic S.p.A. */
+/* */
+/* All rights reserved. */
+/* */
+/**************************************************************************/
+
#ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h>
#endif
@@ -54,14 +71,49 @@
#include <stdio.h> /* for file reading operations */
#include <X11/Xatom.h> /* for XA_STRING */
+#ifdef NXAGENT_SERVER
+
+#include <unistd.h>
+#include <string.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+
+#endif
+
#ifndef DEFAULTPOLICYFILE
# define DEFAULTPOLICYFILE NULL
#endif
+
+#ifdef NXAGENT_SERVER
+
+#define NX_ALTERNATIVEPOLICYFILE "/usr/lib/xserver/SecurityPolicy"
+
+#endif
+
#if defined(WIN32) || defined(__CYGWIN__)
#include <X11/Xos.h>
#undef index
#endif
+/*
+ * Set here the required NX log level.
+ */
+
+#ifdef NXAGENT_SERVER
+
+#define PANIC
+#define WARNING
+#undef TEST
+#undef DEBUG
+
+#endif
+
+#ifdef NXAGENT_SERVER
+
+static char _NXPolicyFilePath[1024];
+
+#endif
+
#include "modinit.h"
static int SecurityErrorBase; /* first Security error number */
@@ -87,6 +139,115 @@
ClientPtr /*client*/
);
+#ifdef NXAGENT_SERVER
+
+/*
+ * This function returns the SecurityPolicy
+ * file full path. This path is referred by
+ * SecurityPolicyFile variable (generally it
+ * contains the hardcoded path at compile time).
+ * If the path does not exist, the function will
+ * try a set of well known paths.
+ */
+
+const char *_NXGetPolicyFilePath(const char *path)
+{
+
+ struct stat SecurityPolicyStat;
+
+ /*
+ * Check the policy file path only once.
+ */
+
+ if (*_NXPolicyFilePath != '\0')
+ {
+ return _NXPolicyFilePath;
+ }
+
+ if (stat(path, &SecurityPolicyStat) == 0)
+ {
+ if (strlen(path) + 1 > 1024)
+ {
+ #ifdef WARNING
+ fprintf(stderr, "_NXGetPolicyFilePath: WARNING! Maximum length of SecurityPolicy file path exceeded.\n");
+ #endif
+
+ goto _NXGetPolicyFilePathError;
+ }
+
+ strcpy(_NXPolicyFilePath, path);
+
+ #ifdef TEST
+ fprintf(stderr, "_NXGetPolicyFilePath: Using SecurityPolicy file path [%s].\n",
+ _NXPolicyFilePath);
+ #endif
+
+ return _NXPolicyFilePath;
+ }
+
+ if (stat(DEFAULTPOLICYFILE, &SecurityPolicyStat) == 0)
+ {
+ if (strlen(DEFAULTPOLICYFILE) + 1 > 1024)
+ {
+ #ifdef WARNING
+ fprintf(stderr, "_NXGetPolicyFilePath: WARNING! Maximum length of SecurityPolicy file path exceeded.\n");
+ #endif
+
+ goto _NXGetPolicyFilePathError;
+ }
+
+ strcpy(_NXPolicyFilePath, DEFAULTPOLICYFILE);
+
+ #ifdef TEST
+ fprintf(stderr, "_NXGetPolicyFilePath: Using SecurityPolicy file path [%s].\n",
+ _NXPolicyFilePath);
+ #endif
+
+ return _NXPolicyFilePath;
+ }
+
+ if (stat(NX_ALTERNATIVEPOLICYFILE, &SecurityPolicyStat) == 0)
+ {
+ if (strlen(NX_ALTERNATIVEPOLICYFILE) + 1 > 1024)
+ {
+ #ifdef WARNING
+ fprintf(stderr, "_NXGetPolicyFilePath: WARNING! Maximum length of SecurityPolicy file path exceeded.\n");
+ #endif
+
+ goto _NXGetPolicyFilePathError;
+ }
+
+ strcpy(_NXPolicyFilePath, NX_ALTERNATIVEPOLICYFILE);
+
+ #ifdef TEST
+ fprintf(stderr, "_NXGetPolicyFilePath: Using SecurityPolicy file path [%s].\n",
+ _NXPolicyFilePath);
+ #endif
+
+ return _NXPolicyFilePath;
+ }
+
+_NXGetPolicyFilePathError:
+
+ if (strlen(path) + 1 > 1024)
+ {
+ #ifdef WARNING
+ fprintf(stderr, "_NXGetPolicyFilePath: WARNING! Maximum length of SecurityPolicy file exceeded.\n");
+ #endif
+ }
+
+ strcpy(_NXPolicyFilePath, path);
+
+ #ifdef TEST
+ fprintf(stderr, "_NXGetPolicyFilePath: Using default SecurityPolicy file path [%s].\n",
+ _NXPolicyFilePath);
+ #endif
+
+ return _NXPolicyFilePath;
+}
+
+#endif
+
/* SecurityAudit
*
* Arguments:
@@ -1647,18 +1808,60 @@
SecurityMaxPropertyName = 0;
+#ifdef NXAGENT_SERVER
+
+ if (!_NXGetPolicyFilePath(SecurityPolicyFile))
+ {
+ return;
+ }
+
+#else
+
if (!SecurityPolicyFile)
return;
+#endif
+
#ifndef __UNIXOS2__
+
+#ifdef NXAGENT_SERVER
+
+ f = Fopen(_NXGetPolicyFilePath(SecurityPolicyFile), "r");
+
+#else
+
f = Fopen(SecurityPolicyFile, "r");
+
+#endif
+
+#else
+
+#ifdef NXAGENT_SERVER
+
+ f = Fopen((char*)__XOS2RedirRoot( _NXGetPolicyFilePath(SecurityPolicyFile)), "r");
+
#else
+
f = Fopen((char*)__XOS2RedirRoot(SecurityPolicyFile), "r");
-#endif
+
+#endif
+
+#endif
+
if (!f)
{
+#ifdef NXAGENT_SERVER
+
+ ErrorF("error opening security policy file %s\n",
+ _NXGetPolicyFilePath(SecurityPolicyFile));
+
+#else
+
ErrorF("error opening security policy file %s\n",
SecurityPolicyFile);
+
+#endif
+
return;
}
@@ -1678,8 +1881,19 @@
char *v = SecurityParseString(&p);
if (strcmp(v, SECURITY_POLICY_FILE_VERSION) != 0)
{
+
+#ifdef NXAGENT_SERVER
+
+ ErrorF("%s: invalid security policy file version, ignoring file\n",
+ _NXGetPolicyFilePath(SecurityPolicyFile));
+
+#else
+
ErrorF("%s: invalid security policy file version, ignoring file\n",
SecurityPolicyFile);
+
+#endif
+
break;
}
validLine = TRUE;
@@ -1706,9 +1920,22 @@
}
}
+#ifdef NXAGENT_SERVER
+
+ if (!validLine)
+ {
+ ErrorF("Line %d of %s invalid, ignoring\n",
+ lineNumber, _NXGetPolicyFilePath(SecurityPolicyFile));
+ }
+
+#else
+
if (!validLine)
ErrorF("Line %d of %s invalid, ignoring\n",
lineNumber, SecurityPolicyFile);
+
+#endif
+
} /* end while more input */
#ifdef PROPDEBUG
@@ -1799,7 +2026,17 @@
{
struct stat buf;
static time_t lastmod = 0;
+
+#ifdef NXAGENT_SERVER
+
+ int ret = stat(_NXGetPolicyFilePath(SecurityPolicyFile), &buf);
+
+#else
+
int ret = stat(SecurityPolicyFile , &buf);
+
+#endif
+
if ( (ret == 0) && (buf.st_mtime > lastmod) )
{
ErrorF("reloading property rules\n");

View File

@@ -0,0 +1,86 @@
--- ./nx-X11/programs/Xserver/dix/dixfonts.c.X.original 2015-02-13 14:03:44.704442298 +0100
+++ ./nx-X11/programs/Xserver/dix/dixfonts.c 2015-02-13 14:03:44.704442298 +0100
@@ -72,6 +72,63 @@
#include <stdio.h>
#endif
+#ifdef NX_TRANS_SOCKET
+
+char _NXFontPath[1024];
+
+/*
+ * Override the default font path and make
+ * it configurable at run time, based on
+ * the NX_FONT environment.
+ */
+
+static const char *_NXGetFontPath(const char *path)
+{
+ const char *fontEnv;
+
+ /*
+ * Check the environment only once.
+ */
+
+ if (*_NXFontPath != '\0')
+ {
+ return _NXFontPath;
+ }
+
+ fontEnv = getenv("NX_FONT");
+
+ if (fontEnv != NULL && *fontEnv != '\0')
+ {
+ if (strlen(fontEnv) + 1 > 1024)
+ {
+#ifdef NX_TRANS_TEST
+ fprintf(stderr, "_NXGetFontPath: WARNING! Maximum length of font path exceeded.\n");
+#endif
+ goto _NXGetFontPathError;
+ }
+
+ strcpy(_NXFontPath, fontEnv);
+
+#ifdef NX_TRANS_TEST
+ fprintf(stderr, "_NXGetFontPath: Using NX font path [%s].\n", _NXFontPath);
+#endif
+
+ return _NXFontPath;
+ }
+
+_NXGetFontPathError:
+
+ strcpy(_NXFontPath, path);
+
+#ifdef NX_TRANS_TEST
+ fprintf(stderr, "_NXGetFontPath: Using default font path [%s].\n", _NXFontPath);
+#endif
+
+ return _NXFontPath;
+}
+
+#endif
+
#ifdef PANORAMIX
#include "panoramiX.h"
#endif
@@ -1817,11 +1874,19 @@
bad;
/* get enough for string, plus values -- use up commas */
+#ifdef NX_TRANS_SOCKET
+ len = strlen(_NXGetFontPath(path)) + 1;
+#else
len = strlen(path) + 1;
+#endif
nump = cp = newpath = (unsigned char *) ALLOCATE_LOCAL(len);
if (!newpath)
return BadAlloc;
+#ifdef NX_TRANS_SOCKET
+ pp = (unsigned char *) _NXGetFontPath(path);
+#else
pp = (unsigned char *) path;
+#endif
cp++;
while (*pp) {
if (*pp == ',') {

View File

@@ -0,0 +1,18 @@
--- ./nx-X11/programs/Xserver/dix/pixmap.c.X.original 2015-02-13 14:03:44.704442298 +0100
+++ ./nx-X11/programs/Xserver/dix/pixmap.c 2015-02-10 19:13:13.696689930 +0100
@@ -121,7 +121,14 @@
if (pScreen->totalPixmapSize > ((size_t)-1) - pixDataSize)
return NullPixmap;
- pPixmap = (PixmapPtr)xalloc(pScreen->totalPixmapSize + pixDataSize);
+ /*
+ * FIXME: Allocate 4 bytes at the end of each pixmap. This
+ * is a quick workaround intended to fix a problem reported
+ * by Valgrind due to fbBlt() writing just after the end of
+ * the pixmap buffer. This may be a RENDER bug.
+ */
+
+ pPixmap = (PixmapPtr)xalloc(pScreen->totalPixmapSize + pixDataSize + 4);
if (!pPixmap)
return NullPixmap;
ppriv = (DevUnion *)(pPixmap + 1);

View File

@@ -0,0 +1,12 @@
--- ./nx-X11/programs/Xserver/fb/fbtrap.c.X.original 2015-02-13 14:03:44.704442298 +0100
+++ ./nx-X11/programs/Xserver/fb/fbtrap.c 2015-02-10 19:13:14.156672722 +0100
@@ -115,6 +115,9 @@
RenderEdge l, r;
xFixed t, b;
+ if (!xTrapezoidValid (trap))
+ return;
+
fbGetDrawable (pPicture->pDrawable, buf, stride, bpp, pxoff, pyoff);
width = pPicture->pDrawable->width;

View File

@@ -0,0 +1,138 @@
--- ./nx-X11/programs/Xserver/hw/nxagent/X/NXdamage.c.X.original 2015-02-13 14:03:44.740441589 +0100
+++ ./nx-X11/programs/Xserver/hw/nxagent/X/NXdamage.c 2015-02-10 19:13:13.828684988 +0100
@@ -1,3 +1,20 @@
+/**************************************************************************/
+/* */
+/* Copyright (c) 2001, 2011 NoMachine, http://www.nomachine.com/. */
+/* */
+/* NXAGENT, NX protocol compression and NX extensions to this software */
+/* are copyright of NoMachine. Redistribution and use of the present */
+/* software is allowed according to terms specified in the file LICENSE */
+/* which comes in the source distribution. */
+/* */
+/* Check http://www.nomachine.com/licensing.html for applicability. */
+/* */
+/* NX and NoMachine are trademarks of Medialogic S.p.A. */
+/* */
+/* All rights reserved. */
+/* */
+/**************************************************************************/
+
/*
* $Id: damage.c,v 1.19 2005/10/06 21:55:41 anholt Exp $
*
@@ -1358,17 +1375,24 @@
if (n != 0) {
damageDamageChars (pDrawable, pGC->font, x + pDrawable->x, y + pDrawable->y, n,
charinfo, imageblt, pGC->subWindowMode);
+
+#ifndef NXAGENT_SERVER
+
if (imageblt)
(*pGC->ops->ImageGlyphBlt)(pDrawable, pGC, x, y, n, charinfo,
FONTGLYPHS(pGC->font));
else
(*pGC->ops->PolyGlyphBlt)(pDrawable, pGC, x, y, n, charinfo,
FONTGLYPHS(pGC->font));
+#endif
+
}
DEALLOCATE_LOCAL(charinfo);
return x + w;
}
+#ifndef NXAGENT_SERVER
+
static int
damagePolyText8(DrawablePtr pDrawable,
GCPtr pGC,
@@ -1445,6 +1469,89 @@
DAMAGE_GC_OP_EPILOGUE(pGC, pDrawable);
}
+#else /* #ifndef NXAGENT_SERVER */
+
+static int
+damagePolyText8(DrawablePtr pDrawable,
+ GCPtr pGC,
+ int x,
+ int y,
+ int count,
+ char *chars)
+{
+ DAMAGE_GC_OP_PROLOGUE(pGC, pDrawable);
+
+ if (checkGCDamage (pDrawable, pGC))
+ damageText (pDrawable, pGC, x, y, (unsigned long) count, chars,
+ Linear8Bit, TT_POLY8);
+
+ x = (*pGC->ops->PolyText8)(pDrawable, pGC, x, y, count, chars);
+
+ DAMAGE_GC_OP_EPILOGUE(pGC, pDrawable);
+ return x;
+}
+
+static int
+damagePolyText16(DrawablePtr pDrawable,
+ GCPtr pGC,
+ int x,
+ int y,
+ int count,
+ unsigned short *chars)
+{
+ DAMAGE_GC_OP_PROLOGUE(pGC, pDrawable);
+
+ if (checkGCDamage (pDrawable, pGC))
+ damageText (pDrawable, pGC, x, y, (unsigned long) count, (char *) chars,
+ FONTLASTROW(pGC->font) == 0 ? Linear16Bit : TwoD16Bit,
+ TT_POLY16);
+
+ x = (*pGC->ops->PolyText16)(pDrawable, pGC, x, y, count, chars);
+
+ DAMAGE_GC_OP_EPILOGUE(pGC, pDrawable);
+ return x;
+}
+
+static void
+damageImageText8(DrawablePtr pDrawable,
+ GCPtr pGC,
+ int x,
+ int y,
+ int count,
+ char *chars)
+{
+ DAMAGE_GC_OP_PROLOGUE(pGC, pDrawable);
+
+ if (checkGCDamage (pDrawable, pGC))
+ damageText (pDrawable, pGC, x, y, (unsigned long) count, chars,
+ Linear8Bit, TT_IMAGE8);
+
+ (*pGC->ops->ImageText8)(pDrawable, pGC, x, y, count, chars);
+
+ DAMAGE_GC_OP_EPILOGUE(pGC, pDrawable);
+}
+
+static void
+damageImageText16(DrawablePtr pDrawable,
+ GCPtr pGC,
+ int x,
+ int y,
+ int count,
+ unsigned short *chars)
+{
+ DAMAGE_GC_OP_PROLOGUE(pGC, pDrawable);
+
+ if (checkGCDamage (pDrawable, pGC))
+ damageText (pDrawable, pGC, x, y, (unsigned long) count, (char *) chars,
+ FONTLASTROW(pGC->font) == 0 ? Linear16Bit : TwoD16Bit,
+ TT_IMAGE16);
+
+ (*pGC->ops->ImageText16)(pDrawable, pGC, x, y, count, chars);
+
+ DAMAGE_GC_OP_EPILOGUE(pGC, pDrawable);
+}
+
+#endif /* #ifndef NXAGENT_SERVER */
static void
damageImageGlyphBlt(DrawablePtr pDrawable,

View File

@@ -0,0 +1,892 @@
--- ./nx-X11/programs/Xserver/hw/nxagent/X/NXdixfonts.c.X.original 2015-02-13 14:03:44.744441510 +0100
+++ ./nx-X11/programs/Xserver/hw/nxagent/X/NXdixfonts.c 2015-02-13 14:03:44.744441510 +0100
@@ -1,3 +1,20 @@
+/**************************************************************************/
+/* */
+/* Copyright (c) 2001, 2011 NoMachine, http://www.nomachine.com/. */
+/* */
+/* NXAGENT, NX protocol compression and NX extensions to this software */
+/* are copyright of NoMachine. Redistribution and use of the present */
+/* software is allowed according to terms specified in the file LICENSE */
+/* which comes in the source distribution. */
+/* */
+/* Check http://www.nomachine.com/licensing.html for applicability. */
+/* */
+/* NX and NoMachine are trademarks of Medialogic S.p.A. */
+/* */
+/* All rights reserved. */
+/* */
+/**************************************************************************/
+
/* $XdotOrg: xc/programs/Xserver/dix/dixfonts.c,v 1.8 2005/07/03 08:53:38 daniels Exp $ */
/* $XFree86: xc/programs/Xserver/dix/dixfonts.c,v 3.28 2003/11/08 02:02:03 dawes Exp $ */
/************************************************************************
@@ -68,12 +85,84 @@
#include "dixfontstr.h"
#include "closestr.h"
+/*
+#define NXAGENT_DEBUG
+*/
+
#ifdef DEBUG
#include <stdio.h>
#endif
+#include "Agent.h"
+#include "Font.h"
+
+#ifndef NX_TRANS_SOCKET
+
+#define NX_TRANS_SOCKET
+
+#endif
+
+#ifdef NX_TRANS_SOCKET
+
+char _NXFontPath[1024];
+
+/*
+ * Override the default font path and make
+ * it configurable at run time, based on
+ * the NX_FONT environment.
+ */
+
+static const char *_NXGetFontPath(const char *path)
+{
+ const char *fontEnv;
+
+ /*
+ * Check the environment only once.
+ */
+
+ if (*_NXFontPath != '\0')
+ {
+ return _NXFontPath;
+ }
+
+ fontEnv = getenv("NX_FONT");
+
+ if (fontEnv != NULL && *fontEnv != '\0')
+ {
+ if (strlen(fontEnv) + 1 > 1024)
+ {
+#ifdef NX_TRANS_TEST
+ fprintf(stderr, "_NXGetFontPath: WARNING! Maximum length of font path exceeded.\n");
+#endif
+ goto _NXGetFontPathError;
+ }
+
+ strcpy(_NXFontPath, fontEnv);
+
+#ifdef NX_TRANS_TEST
+ fprintf(stderr, "_NXGetFontPath: Using NX font path [%s].\n", _NXFontPath);
+#endif
+
+ return _NXFontPath;
+ }
+
+_NXGetFontPathError:
+
+ strncpy(_NXFontPath, path, 1023);
+ _NXFontPath[1023] = '\0';
+
+#ifdef NX_TRANS_TEST
+ fprintf(stderr, "_NXGetFontPath: Using default font path [%s].\n", _NXFontPath);
+#endif
+
+ return _NXFontPath;
+}
+
+#endif
+
#ifdef PANORAMIX
-#include "panoramiX.h"
+#include "../../Xext/panoramiX.h"
+#include "../../Xext/panoramiXsrv.h"
#endif
#ifdef LBX
@@ -245,6 +334,9 @@
*newname;
int newlen;
int aliascount = 20;
+ char nxagentOrigFontName[256];
+ int nxagentOrigFontNameLen;
+
/*
* Decide at runtime what FontFormat to use.
*/
@@ -276,6 +368,13 @@
BitmapFormatScanlineUnit8;
+
+ nxagentOrigFontNameLen = (c -> origFontNameLen < 256) ? c -> origFontNameLen : 255;
+
+ memcpy(nxagentOrigFontName, c -> origFontName, nxagentOrigFontNameLen);
+
+ nxagentOrigFontName[nxagentOrigFontNameLen] = 0;
+
if (client->clientGone)
{
if (c->current_fpe < c->num_fpes)
@@ -324,6 +423,9 @@
if (!c->slept) {
c->slept = TRUE;
ClientSleep(client, (ClientSleepProcPtr)doOpenFont, (pointer) c);
+#ifdef NXAGENT_DEBUG
+ fprintf(stderr, " NXdixfonts: doOpenFont: client [%lx] sleeping.\n", client);
+#endif
}
return TRUE;
}
@@ -352,10 +454,15 @@
pScr = screenInfo.screens[i];
if (pScr->RealizeFont)
{
- if (!(*pScr->RealizeFont) (pScr, pfont))
+
+ /* NXAGENT uses useless screen pointer to pass the original font name
+ * to realizeFont, could be a source of problems in the future.
+ */
+
+ if (!(*pScr->RealizeFont) ((ScreenPtr)nxagentOrigFontName, pfont))
{
CloseFont (pfont, (Font) 0);
- err = AllocError;
+ err=BadFontName;
goto bail;
}
}
@@ -365,8 +472,19 @@
err = AllocError;
goto bail;
}
+ if( nxagentFontPriv(pfont) -> mirrorID == 0 )
+ {
+ extern RESTYPE RT_NX_FONT;
+
+ nxagentFontPriv(pfont) -> mirrorID = FakeClientID(0);
+ if (!AddResource(nxagentFontPriv(pfont) -> mirrorID, RT_NX_FONT, (pointer) pfont)) {
+ FreeResource(c->fontid, RT_NONE);
+ err = AllocError;
+ goto bail;
+ }
+ }
if (patternCache && pfont != c->non_cachable_font)
- CacheFontPattern(patternCache, c->origFontName, c->origFontNameLen,
+ CacheFontPattern(patternCache, nxagentOrigFontName, nxagentOrigFontNameLen,
pfont);
bail:
if (err != Successful && c->client != serverClient) {
@@ -374,7 +492,12 @@
c->fontid, FontToXError(err));
}
if (c->slept)
+ {
ClientWakeup(c->client);
+#ifdef NXAGENT_DEBUG
+ fprintf(stderr, " NXdixfonts: doOpenFont: client [%lx] wakeup.\n", client);
+#endif
+ }
for (i = 0; i < c->num_fpes; i++) {
FreeFPE(c->fpe_list[i]);
}
@@ -502,7 +625,10 @@
LbxFreeFontTag(pfont);
#endif
#ifdef XF86BIGFONT
- XF86BigfontFreeFontShm(pfont);
+ {
+ extern void XF86BigfontFreeFontShm(FontPtr);
+ XF86BigfontFreeFontShm(pfont);
+ }
#endif
fpe = pfont->fpe;
(*fpe_functions[fpe->type].close_font) (fpe, pfont);
@@ -631,6 +757,9 @@
ClientSleep(client,
(ClientSleepProcPtr)doListFontsAndAliases,
(pointer) c);
+#ifdef NXAGENT_DEBUG
+ fprintf(stderr, " NXdixfonts: doListFont (1): client [%lx] sleeping.\n", client);
+#endif
}
return TRUE;
}
@@ -677,6 +806,12 @@
(ClientSleepProcPtr)doListFontsAndAliases,
(pointer) c);
c->slept = TRUE;
+#ifdef NXAGENT_DEBUG
+ fprintf(stderr, " NXdixfonts: doListFont (2): client [%lx] sleeping.\n", client);
+#endif
+#ifdef NXAGENT_DEBUG
+ fprintf(stderr, " NXdixfonts: doListFont (3): client [%lx] sleeping.\n", client);
+#endif
}
return TRUE;
}
@@ -813,6 +948,24 @@
reply.nFonts--;
else
{
+ {
+ /* dirty hack: don't list to client fonts not existing on the remote side */
+ char tmp[256];
+
+ memcpy(tmp, names->names[i], names->length[i]);
+ tmp[ names->length[i] ] = 0;
+
+ if (nxagentFontLookUp(tmp) == 0)
+ {
+#ifdef NXAGENT_FONTMATCH_DEBUG
+ fprintf(stderr, "doListFontsAndAliases:\n");
+ fprintf(stderr, " removing font: %s \n", tmp);
+#endif
+ reply.nFonts--;
+ stringLens -= names->length[i];
+ continue;
+ }
+ }
*bufptr++ = names->length[i];
memmove( bufptr, names->names[i], names->length[i]);
bufptr += names->length[i];
@@ -827,7 +980,12 @@
bail:
if (c->slept)
+ {
ClientWakeup(client);
+#ifdef NXAGENT_DEBUG
+ fprintf(stderr, " NXdixfonts: doListFont: client [%lx] wakeup.\n", client);
+#endif
+ }
for (i = 0; i < c->num_fpes; i++)
FreeFPE(c->fpe_list[i]);
xfree(c->fpe_list);
@@ -862,7 +1020,7 @@
xfree(c);
return BadAlloc;
}
- c->names = MakeFontNamesRecord(max_names < 100 ? max_names : 100);
+ c->names = MakeFontNamesRecord(max_names < nxagentMaxFontNames ? max_names : nxagentMaxFontNames);
if (!c->names)
{
xfree(c->fpe_list);
@@ -933,6 +1091,9 @@
{
ClientSleep(client, (ClientSleepProcPtr)doListFontsWithInfo, c);
c->slept = TRUE;
+#ifdef NXAGENT_DEBUG
+ fprintf(stderr, " NXdixfonts: doListFontWinfo (1): client [%lx] sleeping.\n", client);
+#endif
}
return TRUE;
}
@@ -954,6 +1115,9 @@
(ClientSleepProcPtr)doListFontsWithInfo,
c);
c->slept = TRUE;
+#ifdef NXAGENT_DEBUG
+ fprintf(stderr, " NXdixfonts: doListFontWinfo (2): client [%lx] sleeping.\n", client);
+#endif
}
return TRUE;
}
@@ -1035,6 +1199,23 @@
}
else if (err == Successful)
{
+
+ if (c->haveSaved)
+ {
+ numFonts = c->savedNumFonts;
+ name = c->savedName;
+ namelen = strlen(name);
+ }
+
+ if (nxagentFontLookUp(name) == 0)
+ {
+#ifdef NXAGENT_FONTMATCH_DEBUG
+ fprintf(stderr, "doListFontsAndAliases (with info):\n");
+ fprintf(stderr, " removing font: %s \n", name);
+#endif
+ continue;
+ }
+
length = sizeof(*reply) + pFontInfo->nprops * sizeof(xFontProp);
reply = c->reply;
if (c->length < length)
@@ -1048,12 +1229,6 @@
c->reply = reply;
c->length = length;
}
- if (c->haveSaved)
- {
- numFonts = c->savedNumFonts;
- name = c->savedName;
- namelen = strlen(name);
- }
reply->type = X_Reply;
reply->length = (sizeof *reply - sizeof(xGenericReply) +
pFontInfo->nprops * sizeof(xFontProp) +
@@ -1100,7 +1275,12 @@
WriteSwappedDataToClient(client, length, &finalReply);
bail:
if (c->slept)
+ {
ClientWakeup(client);
+#ifdef NXAGENT_DEBUG
+ fprintf(stderr, " NXdixfonts: doListFontWinfo: client [%lx] wakeup.\n", client);
+#endif
+ }
for (i = 0; i < c->num_fpes; i++)
FreeFPE(c->fpe_list[i]);
xfree(c->reply);
@@ -1347,6 +1527,11 @@
err = BadAlloc;
goto bail;
}
+
+ pGC->tileIsPixel = TRUE;
+ pGC->tile.pixel = 0;
+ pGC->stipple = NullPixmap;
+
if ((err = CopyGC(c->pGC, pGC, GCFunction |
GCPlaneMask | GCForeground |
GCBackground | GCFillStyle |
@@ -1371,6 +1556,9 @@
ClientSleep(client,
(ClientSleepProcPtr)doPolyText,
(pointer) c);
+#ifdef NXAGENT_DEBUG
+ fprintf(stderr, " NXdixfonts: doPolyText (1): client [%lx] sleeping.\n", client);
+#endif
/* Set up to perform steps 3 and 4 */
client_state = START_SLEEP;
@@ -1419,6 +1607,9 @@
if (c->slept)
{
ClientWakeup(c->client);
+#ifdef NXAGENT_DEBUG
+ fprintf(stderr, " NXdixfonts: doPolytext: client [%lx] wakeup.\n", client);
+#endif
ChangeGC(c->pGC, clearGCmask, clearGC);
/* Unreference the font from the scratch GC */
@@ -1535,6 +1726,11 @@
err = BadAlloc;
goto bail;
}
+
+ pGC->tileIsPixel = TRUE;
+ pGC->tile.pixel = 0;
+ pGC->stipple = NullPixmap;
+
if ((err = CopyGC(c->pGC, pGC, GCFunction | GCPlaneMask |
GCForeground | GCBackground | GCFillStyle |
GCTile | GCStipple | GCTileStipXOrigin |
@@ -1553,6 +1749,10 @@
c->slept = TRUE;
ClientSleep(client, (ClientSleepProcPtr)doImageText, (pointer) c);
+#ifdef NXAGENT_DEBUG
+ fprintf(stderr, " NXdixfonts: doImageText (1): client [%lx] sleeping.\n", client);
+#endif
+
}
return TRUE;
}
@@ -1575,6 +1775,9 @@
if (c->slept)
{
ClientWakeup(c->client);
+#ifdef NXAGENT_DEBUG
+ fprintf(stderr, " NXdixfonts: doImageText: client [%lx] wakeup.\n", client);
+#endif
ChangeGC(c->pGC, clearGCmask, clearGC);
/* Unreference the font from the scratch GC */
@@ -1751,11 +1954,13 @@
err = (*fpe_functions[fpe->type].init_fpe) (fpe);
if (err != Successful)
{
+ #ifndef NXAGENT_SERVER
if (persist)
{
ErrorF("Could not init font path element %s, removing from list!\n",
fpe->name);
}
+ #endif
xfree (fpe->name);
xfree (fpe);
}
@@ -1817,11 +2022,19 @@
bad;
/* get enough for string, plus values -- use up commas */
+#ifdef NX_TRANS_SOCKET
+ len = strlen(_NXGetFontPath(path)) + 1;
+#else
len = strlen(path) + 1;
+#endif
nump = cp = newpath = (unsigned char *) ALLOCATE_LOCAL(len);
if (!newpath)
return BadAlloc;
+#ifdef NX_TRANS_SOCKET
+ pp = (unsigned char *) _NXGetFontPath(path);
+#else
pp = (unsigned char *) path;
+#endif
cp++;
while (*pp) {
if (*pp == ',') {
@@ -2148,3 +2361,445 @@
}
#endif
+
+
+typedef struct
+{
+ LFclosurePtr c;
+ OFclosurePtr oc;
+} nxFs,*nxFsPtr;
+
+static Bool
+#if NeedFunctionPrototypes
+nxdoListFontsAndAliases(ClientPtr client, nxFsPtr fss)
+#else
+nxdoListFontsAndAliases(client, fss)
+ ClientPtr client;
+ nxFsPtr fss;
+#endif
+{
+ LFclosurePtr c=fss->c;
+ OFclosurePtr oc=fss->oc;
+ FontPathElementPtr fpe;
+ int err = Successful;
+ char *name, *resolved=NULL;
+ int namelen, resolvedlen;
+ int i;
+ int aliascount = 0;
+ char tmp[256];
+ tmp[0]=0;
+ if (client->clientGone)
+ {
+ if (c->current.current_fpe < c->num_fpes)
+ {
+ fpe = c->fpe_list[c->current.current_fpe];
+ (*fpe_functions[fpe->type].client_died) ((pointer) client, fpe);
+ }
+ err = Successful;
+ goto bail;
+ }
+
+ if (!c->current.patlen)
+ goto finish;
+
+ while (c->current.current_fpe < c->num_fpes) {
+ fpe = c->fpe_list[c->current.current_fpe];
+ err = Successful;
+
+ if (!fpe_functions[fpe->type].start_list_fonts_and_aliases)
+ {
+ /* This FPE doesn't support/require list_fonts_and_aliases */
+
+ err = (*fpe_functions[fpe->type].list_fonts)
+ ((pointer) c->client, fpe, c->current.pattern,
+ c->current.patlen, c->current.max_names - c->names->nnames,
+ c->names);
+
+ if (err == Suspended) {
+ if (!c->slept) {
+ c->slept = TRUE;
+ ClientSleep(client,
+ (ClientSleepProcPtr)nxdoListFontsAndAliases,
+ (pointer) fss);
+#ifdef NXAGENT_DEBUG
+ fprintf(stderr, " NXdixfonts: nxdoListFont (1): client [%lx] sleeping.\n", client);
+#endif
+ }
+ return TRUE;
+ }
+
+ err = BadFontName;
+ }
+ else
+ {
+ /* Start of list_fonts_and_aliases functionality. Modeled
+ after list_fonts_with_info in that it resolves aliases,
+ except that the information collected from FPEs is just
+ names, not font info. Each list_next_font_or_alias()
+ returns either a name into name/namelen or an alias into
+ name/namelen and its target name into resolved/resolvedlen.
+ The code at this level then resolves the alias by polling
+ the FPEs. */
+
+ if (!c->current.list_started) {
+ err = (*fpe_functions[fpe->type].start_list_fonts_and_aliases)
+ ((pointer) c->client, fpe, c->current.pattern,
+ c->current.patlen, c->current.max_names - c->names->nnames,
+ &c->current.private);
+ if (err == Suspended) {
+ if (!c->slept) {
+ ClientSleep(client,
+ (ClientSleepProcPtr)nxdoListFontsAndAliases,
+ (pointer) fss);
+ c->slept = TRUE;
+#ifdef NXAGENT_DEBUG
+ fprintf(stderr, " NXdixfonts: nxdoListFont (2): client [%lx] sleeping.\n", client);
+#endif
+ }
+ return TRUE;
+ }
+ if (err == Successful)
+ c->current.list_started = TRUE;
+ }
+ if (err == Successful) {
+ char *tmpname;
+ name = 0;
+ err = (*fpe_functions[fpe->type].list_next_font_or_alias)
+ ((pointer) c->client, fpe, &name, &namelen, &tmpname,
+ &resolvedlen, c->current.private);
+ if (err == Suspended) {
+ if (!c->slept) {
+ ClientSleep(client,
+ (ClientSleepProcPtr)nxdoListFontsAndAliases,
+ (pointer) fss);
+ c->slept = TRUE;
+#ifdef NXAGENT_DEBUG
+ fprintf(stderr, " NXdixfonts: nxdoListFont (3): client [%lx] sleeping.\n", client);
+#endif
+ }
+ return TRUE;
+ }
+ if (err == FontNameAlias) {
+ if (resolved) xfree(resolved);
+ resolved = (char *) xalloc(resolvedlen + 1);
+ if (resolved)
+ {
+ memmove(resolved, tmpname, resolvedlen);
+ resolved[resolvedlen] = '\0';
+ }
+ }
+ }
+
+ if (err == Successful)
+ {
+ if (c->haveSaved)
+ {
+ if (c->savedName)
+ {
+ memcpy(tmp,c->savedName,c->savedNameLen>255?255:c->savedNameLen);
+ tmp[c->savedNameLen>255?256:c->savedNameLen]=0;
+ if (nxagentFontLookUp(tmp))
+ break;
+ else tmp[0]=0;
+ }
+ }
+ else
+ {
+ memcpy(tmp,name,namelen>255?255:namelen);
+ tmp[namelen>255?256:namelen]=0;
+ if (nxagentFontLookUp(tmp))
+ break;
+ else tmp[0]=0;
+ }
+ }
+
+ /*
+ * When we get an alias back, save our state and reset back to
+ * the start of the FPE looking for the specified name. As
+ * soon as a real font is found for the alias, pop back to the
+ * old state
+ */
+ else if (err == FontNameAlias) {
+ char tmp_pattern[XLFDMAXFONTNAMELEN];
+ /*
+ * when an alias recurses, we need to give
+ * the last FPE a chance to clean up; so we call
+ * it again, and assume that the error returned
+ * is BadFontName, indicating the alias resolution
+ * is complete.
+ */
+ memmove(tmp_pattern, resolved, resolvedlen);
+ if (c->haveSaved)
+ {
+ char *tmpname;
+ int tmpnamelen;
+
+ tmpname = 0;
+ (void) (*fpe_functions[fpe->type].list_next_font_or_alias)
+ ((pointer) c->client, fpe, &tmpname, &tmpnamelen,
+ &tmpname, &tmpnamelen, c->current.private);
+ if (--aliascount <= 0)
+ {
+ err = BadFontName;
+ goto ContBadFontName;
+ }
+ }
+ else
+ {
+ c->saved = c->current;
+ c->haveSaved = TRUE;
+ if (c->savedName)
+ xfree(c->savedName);
+ c->savedName = (char *)xalloc(namelen + 1);
+ if (c->savedName)
+ {
+ memmove(c->savedName, name, namelen);
+ c->savedName[namelen] = '\0';
+ }
+ c->savedNameLen = namelen;
+ aliascount = 20;
+ }
+ memmove(c->current.pattern, tmp_pattern, resolvedlen);
+ c->current.patlen = resolvedlen;
+ c->current.max_names = c->names->nnames + 1;
+ c->current.current_fpe = -1;
+ c->current.private = 0;
+ err = BadFontName;
+ }
+ }
+ /*
+ * At the end of this FPE, step to the next. If we've finished
+ * processing an alias, pop state back. If we've collected enough
+ * font names, quit.
+ */
+ if (err == BadFontName) {
+ ContBadFontName: ;
+ c->current.list_started = FALSE;
+ c->current.current_fpe++;
+ err = Successful;
+ if (c->haveSaved)
+ {
+ if (c->names->nnames == c->current.max_names ||
+ c->current.current_fpe == c->num_fpes) {
+ c->haveSaved = FALSE;
+ c->current = c->saved;
+ /* Give the saved namelist a chance to clean itself up */
+ continue;
+ }
+ }
+ if (c->names->nnames == c->current.max_names)
+ break;
+ }
+ }
+
+ /*
+ * send the reply
+ */
+bail:
+finish:
+ if (strlen(tmp))
+ {
+#ifdef NXAGENT_FONTMATCH_DEBUG
+ fprintf(stderr, "nxListFont changed (0) font to %s\n",tmp);
+#endif
+ memcpy(oc->fontname, tmp, strlen(tmp));
+ oc->fnamelen = strlen(tmp);
+
+ oc->origFontName = oc->fontname;
+ oc->origFontNameLen = oc->fnamelen;
+
+ }
+ else
+ {
+ for (i = 0; i < c->names->nnames; i++)
+ {
+ if (c->names->length[i] > 255)
+ continue;
+ else
+ {
+ memcpy(tmp, c->names->names[i], c->names->length[i]);
+ tmp[ c->names->length[i] ] = 0;
+ if (nxagentFontLookUp(tmp) == 0)
+ continue;
+ memcpy(oc->fontname, tmp, strlen(tmp));
+ oc->fnamelen = strlen(tmp);
+
+ oc->origFontName = oc->fontname;
+ oc->origFontNameLen = oc->fnamelen;
+
+#ifdef NXAGENT_FONTMATCH_DEBUG
+ fprintf(stderr, "nxListFont changed (1) font to %s\n",tmp);
+#endif
+ break;
+ }
+ }
+ }
+
+ if (c->slept)
+ {
+ ClientWakeup(client);
+#ifdef NXAGENT_DEBUG
+ fprintf(stderr, " NXdixfonts: nxdoListFont: client [%lx] wakeup.\n", client);
+#endif
+ }
+ for (i = 0; i < c->num_fpes; i++)
+ FreeFPE(c->fpe_list[i]);
+ xfree(c->fpe_list);
+ if (c->savedName) xfree(c->savedName);
+ FreeFontNames(c->names);
+ xfree(c);
+ xfree(fss);
+ if (resolved) xfree(resolved);
+
+ return doOpenFont(client, oc);
+}
+
+int
+nxOpenFont(client, fid, flags, lenfname, pfontname)
+ ClientPtr client;
+ XID fid;
+ Mask flags;
+ unsigned lenfname;
+ char *pfontname;
+{
+ nxFsPtr fss;
+ LFclosurePtr c;
+ OFclosurePtr oc;
+ int i;
+ FontPtr cached = (FontPtr)0;
+
+#ifdef FONTDEBUG
+ char *f;
+ f = (char *)xalloc(lenfname + 1);
+ memmove(f, pfontname, lenfname);
+ f[lenfname] = '\0';
+ ErrorF("OpenFont: fontname is \"%s\"\n", f);
+ xfree(f);
+#endif
+ if (!lenfname || lenfname > XLFDMAXFONTNAMELEN)
+ return BadName;
+ if (patternCache)
+ {
+
+ /*
+ ** Check name cache. If we find a cached version of this font that
+ ** is cachable, immediately satisfy the request with it. If we find
+ ** a cached version of this font that is non-cachable, we do not
+ ** satisfy the request with it. Instead, we pass the FontPtr to the
+ ** FPE's open_font code (the fontfile FPE in turn passes the
+ ** information to the rasterizer; the fserve FPE ignores it).
+ **
+ ** Presumably, the font is marked non-cachable because the FPE has
+ ** put some licensing restrictions on it. If the FPE, using
+ ** whatever logic it relies on, determines that it is willing to
+ ** share this existing font with the client, then it has the option
+ ** to return the FontPtr we passed it as the newly-opened font.
+ ** This allows the FPE to exercise its licensing logic without
+ ** having to create another instance of a font that already exists.
+ */
+
+ cached = FindCachedFontPattern(patternCache, pfontname, lenfname);
+ if (cached && cached->info.cachable)
+ {
+ if (!AddResource(fid, RT_FONT, (pointer) cached))
+ return BadAlloc;
+ cached->refcnt++;
+ return Success;
+ }
+ }
+ if (!(fss = (nxFsPtr) xalloc(sizeof(nxFs))))
+ return BadAlloc;
+
+ if (!(c = (LFclosurePtr) xalloc(sizeof *c)))
+ {
+ xfree(fss);
+ return BadAlloc;
+ }
+ c->fpe_list = (FontPathElementPtr *)
+ xalloc(sizeof(FontPathElementPtr) * num_fpes);
+ if (!c->fpe_list) {
+ xfree(c);
+ xfree(fss);
+ return BadAlloc;
+ }
+ c->names = MakeFontNamesRecord(100);
+ if (!c->names)
+ {
+ xfree(c->fpe_list);
+ xfree(c);
+ xfree(fss);
+ return BadAlloc;
+ }
+ memmove( c->current.pattern, pfontname, lenfname);
+ for (i = 0; i < num_fpes; i++) {
+ c->fpe_list[i] = font_path_elements[i];
+ UseFPE(c->fpe_list[i]);
+ }
+ c->client = client;
+ c->num_fpes = num_fpes;
+ c->current.patlen = lenfname;
+ c->current.current_fpe = 0;
+ c->current.max_names = nxagentMaxFontNames;
+ c->current.list_started = FALSE;
+ c->current.private = 0;
+ c->haveSaved = FALSE;
+ c->slept = FALSE;
+ c->savedName = 0;
+
+ oc = (OFclosurePtr) xalloc(sizeof(OFclosureRec));
+ if (!oc)
+ {
+ for (i = 0; i < c->num_fpes; i++)
+ FreeFPE(c->fpe_list[i]);
+ xfree(c->fpe_list);
+ xfree(c);
+ xfree(fss);
+ return BadAlloc;
+ }
+ oc->fontname = (char *) xalloc(256);/* I don't want to deal with future reallocs errors */
+ oc->origFontName = pfontname;
+ oc->origFontNameLen = lenfname;
+ if (!oc->fontname) {
+ for (i = 0; i < c->num_fpes; i++)
+ FreeFPE(c->fpe_list[i]);
+ xfree(c->fpe_list);
+ xfree(c);
+ xfree(oc);
+ xfree(fss);
+ return BadAlloc;
+ }
+ /*
+ * copy the current FPE list, so that if it gets changed by another client
+ * while we're blocking, the request still appears atomic
+ */
+ oc->fpe_list = (FontPathElementPtr *)
+ xalloc(sizeof(FontPathElementPtr) * num_fpes);
+ if (!oc->fpe_list) {
+ xfree(oc->fontname);
+ xfree(oc);
+ for (i = 0; i < c->num_fpes; i++)
+ FreeFPE(c->fpe_list[i]);
+ xfree(c->fpe_list);
+ xfree(c);
+ xfree(fss);
+ return BadAlloc;
+ }
+ memmove(oc->fontname, pfontname, lenfname);
+ for (i = 0; i < num_fpes; i++) {
+ oc->fpe_list[i] = font_path_elements[i];
+ UseFPE(oc->fpe_list[i]);
+ }
+ oc->client = client;
+ oc->fontid = fid;
+ oc->current_fpe = 0;
+ oc->num_fpes = num_fpes;
+ oc->fnamelen = lenfname;
+ oc->slept = FALSE;
+ oc->flags = flags;
+ oc->non_cachable_font = cached;
+ fss->c=c;
+ fss->oc=oc;
+ nxdoListFontsAndAliases(client, fss);
+ return Success;
+}
+

View File

@@ -0,0 +1,648 @@
--- ./nx-X11/programs/Xserver/hw/nxagent/X/NXevents.c.X.original 2015-02-13 14:03:44.744441510 +0100
+++ ./nx-X11/programs/Xserver/hw/nxagent/X/NXevents.c 2015-02-10 19:13:13.788686485 +0100
@@ -1,3 +1,20 @@
+/**************************************************************************/
+/* */
+/* Copyright (c) 2001, 2011 NoMachine, http://www.nomachine.com/. */
+/* */
+/* NXAGENT, NX protocol compression and NX extensions to this software */
+/* are copyright of NoMachine. Redistribution and use of the present */
+/* software is allowed according to terms specified in the file LICENSE */
+/* which comes in the source distribution. */
+/* */
+/* Check http://www.nomachine.com/licensing.html for applicability. */
+/* */
+/* NX and NoMachine are trademarks of Medialogic S.p.A. */
+/* */
+/* All rights reserved. */
+/* */
+/**************************************************************************/
+
/* $XdotOrg: xc/programs/Xserver/dix/events.c,v 1.17 2005/08/25 22:11:04 anholt Exp $ */
/* $XFree86: xc/programs/Xserver/dix/events.c,v 3.51 2004/01/12 17:04:52 tsi Exp $ */
/************************************************************
@@ -116,6 +133,7 @@
#endif
#include <X11/X.h>
+#include "Xlib.h"
#include "misc.h"
#include "resource.h"
#define NEED_EVENTS
@@ -163,7 +181,22 @@
#include "dixevents.h"
#include "dixgrabs.h"
-#include "dispatch.h"
+#include "../../dix/dispatch.h"
+
+#include "NXlib.h"
+
+#include "Events.h"
+#include "Windows.h"
+#include "Args.h"
+
+#ifdef NX_DEBUG_INPUT
+extern int nxagentDebugInput;
+extern int nxagentDebugInputDevices;
+#endif
+
+extern Display *nxagentDisplay;
+
+extern WindowPtr nxagentLastEnteredWindow;
#define EXTENSION_EVENT_BASE 64
@@ -1322,6 +1355,51 @@
mouse->fromPassiveGrab = autoGrab;
PostNewCursor();
CheckGrabForSyncs(mouse,(Bool)grab->pointerMode, (Bool)grab->keyboardMode);
+
+ #ifdef NXAGENT_SERVER
+
+ /*
+ * If grab is synchronous, events are delivered to clients only if they send
+ * an AllowEvent request. If mode field in AllowEvent request is SyncPointer, the
+ * delivered event is saved in a queue and replayed later, when grab is released.
+ * We should export sync grab to X as async in order to avoid events to be
+ * queued twice, in the agent and in the X server. This solution have a drawback:
+ * replayed events are not delivered to that application that are not clients of
+ * the agent.
+ * A different solution could be to make the grab asynchronous in the agent and
+ * to export it as synchronous. But this seems to be less safe.
+ *
+ * To make internal grab asynchronous, change previous line as follows.
+ *
+ * if (nxagentOption(Rootless))
+ * {
+ * CheckGrabForSyncs(mouse, GrabModeAsync, (Bool)grab->keyboardMode);
+ * }
+ * else
+ * {
+ * CheckGrabForSyncs(mouse,(Bool)grab->pointerMode, (Bool)grab->keyboardMode);
+ * }
+ */
+
+ if (nxagentOption(Rootless) == 1)
+ {
+ /*
+ * FIXME: We should use the correct value
+ * for the cursor. Temporarily we set it
+ * to None.
+ */
+
+ int resource = nxagentWaitForResource(NXGetCollectGrabPointerResource,
+ nxagentCollectGrabPointerPredicate);
+
+ NXCollectGrabPointer(nxagentDisplay, resource, nxagentWindow(grab -> window),
+ 1, grab -> eventMask & PointerGrabMask,
+ GrabModeAsync, GrabModeAsync, (grab -> confineTo) ?
+ nxagentWindow(grab -> confineTo) : None,
+ None, CurrentTime);
+ }
+
+ #endif
}
void
@@ -1346,6 +1424,22 @@
if (grab->cursor)
FreeCursor(grab->cursor, (Cursor)0);
ComputeFreezes();
+
+ #ifdef NXAGENT_SERVER
+
+ if (nxagentOption(Rootless) == 1)
+ {
+ XUngrabPointer(nxagentDisplay, CurrentTime);
+
+ if (sprite.win == ROOT)
+ {
+ mouse -> button -> state &=
+ ~(Button1Mask | Button2Mask | Button3Mask |
+ Button4Mask | Button5Mask);
+ }
+ }
+
+ #endif
}
void
@@ -1546,6 +1640,17 @@
client->errorValue = stuff->mode;
return BadValue;
}
+
+ /*
+ * This is not necessary if we export grab to X as asynchronous.
+ *
+ * if (nxagentOption(Rootless) && stuff -> mode != ReplayKeyboard &&
+ * stuff -> mode != SyncKeyboard && stuff -> mode != AsyncKeyboard)
+ * {
+ * XAllowEvents(nxagentDisplay, stuff -> mode, CurrentTime);
+ * }
+ */
+
return Success;
}
@@ -1582,11 +1687,28 @@
int i;
int type;
-#ifdef DEBUG
+#ifdef NX_DEBUG_INPUT
+ if (grab && nxagentDebugInput && grab->window)
+ {
+ fprintf(stderr, "TryClientEvents: Grab window is [0x%x].\n",
+ (unsigned int)grab->window->drawable.id);
+ if (!SameClient(grab, client))
+ fprintf(stderr, "TryClientEvents: Events are going to be "
+ "discarded.\n");
+ }
+#endif
+#if defined(DEBUG) || defined(NX_DEBUG_INPUT)
+#ifdef NX_DEBUG_INPUT
+ if (nxagentDebugInput == 1)
+ fprintf(stderr, "Event([%d, %d], mask=0x%x), client=%d",
+ pEvents->u.u.type, pEvents->u.u.detail, (unsigned int)mask,
+ client->index);
+#else
if (debug_events) ErrorF(
"Event([%d, %d], mask=0x%x), client=%d",
pEvents->u.u.type, pEvents->u.u.detail, mask, client->index);
#endif
+#endif
if ((client) && (client != serverClient) && (!client->clientGone) &&
((filter == CantBeFiltered) || (mask & filter)))
{
@@ -1600,10 +1722,17 @@
if (WID(inputInfo.pointer->valuator->motionHintWindow) ==
pEvents->u.keyButtonPointer.event)
{
-#ifdef DEBUG
+#if defined(DEBUG) || defined(NX_DEBUG_INPUT)
+#ifdef NX_DEBUG_INPUT
+ if (nxagentDebugInput == 1)
+ {
+ fprintf(stderr,"\nmotionHintWindow == keyButtonPointer.event\n");
+ }
+#else
if (debug_events) ErrorF("\n");
fprintf(stderr,"motionHintWindow == keyButtonPointer.event\n");
#endif
+#endif
return 1; /* don't send, but pretend we did */
}
pEvents->u.u.detail = NotifyHint;
@@ -1640,16 +1769,26 @@
}
WriteEventsToClient(client, count, pEvents);
-#ifdef DEBUG
+#if defined(DEBUG) || defined(NX_DEBUG_INPUT)
+#ifdef NX_DEBUG_INPUT
+ if (nxagentDebugInput == 1)
+ fprintf(stderr, " delivered\n");
+#else
if (debug_events) ErrorF( " delivered\n");
#endif
+#endif
return 1;
}
else
{
-#ifdef DEBUG
+#if defined(DEBUG) || defined(NX_DEBUG_INPUT)
+#ifdef NX_DEBUG_INPUT
+ if (nxagentDebugInput == 1)
+ fprintf(stderr, "\n");
+#else
if (debug_events) ErrorF("\n");
#endif
+#endif
return 0;
}
}
@@ -1727,6 +1866,12 @@
tempGrab.pointerMode = GrabModeAsync;
tempGrab.confineTo = NullWindow;
tempGrab.cursor = NullCursor;
+ #ifdef NX_DEBUG_INPUT
+ if (nxagentDebugInputDevices == 1)
+ {
+ fprintf(stderr, "DeliverEventsToWindow: Activating passive grab on pointer.\n");
+ }
+ #endif
(*inputInfo.pointer->ActivateGrab)(inputInfo.pointer, &tempGrab,
currentTime, TRUE);
}
@@ -1999,7 +2144,26 @@
BoxRec box;
spriteTraceGood = 1; /* root window still there */
- pWin = ROOT->firstChild;
+
+ if (nxagentOption(Rootless))
+ {
+ if (nxagentLastEnteredWindow == NULL)
+ {
+ return ROOT;
+ }
+
+ pWin = ROOT->lastChild;
+
+ while (pWin && pWin != ROOT->firstChild && pWin != nxagentLastEnteredWindow)
+ {
+ pWin = pWin->prevSib;
+ }
+ }
+ else
+ {
+ pWin = ROOT->firstChild;
+ }
+
while (pWin)
{
if ((pWin->mapped) &&
@@ -2090,13 +2254,22 @@
ConfineToShape(sprite.hotShape, &sprite.hot.x, &sprite.hot.y);
#endif
sprite.hotPhys = sprite.hot;
- if ((sprite.hotPhys.x != XE_KBPTR.rootX) ||
- (sprite.hotPhys.y != XE_KBPTR.rootY))
- {
- (*sprite.hotPhys.pScreen->SetCursorPosition)(
- sprite.hotPhys.pScreen,
- sprite.hotPhys.x, sprite.hotPhys.y, FALSE);
- }
+
+ /*
+ * 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.
+ *
+ * if ((sprite.hotPhys.x != XE_KBPTR.rootX) ||
+ * (sprite.hotPhys.y != XE_KBPTR.rootY))
+ * {
+ * (*sprite.hotPhys.pScreen->SetCursorPosition)(
+ * sprite.hotPhys.pScreen,
+ * sprite.hotPhys.x, sprite.hotPhys.y, FALSE);
+ * }
+ */
+
XE_KBPTR.rootX = sprite.hot.x;
XE_KBPTR.rootY = sprite.hot.y;
}
@@ -2176,6 +2349,10 @@
DefineInitialRootWindow(register WindowPtr win)
{
register ScreenPtr pScreen = win->drawable.pScreen;
+ #ifdef VIEWPORT_FRAME
+ extern void nxagentInitViewportFrame(ScreenPtr, WindowPtr);
+ #endif
+ extern int nxagentShadowInit(ScreenPtr, WindowPtr);
sprite.hotPhys.pScreen = pScreen;
sprite.hotPhys.x = pScreen->width / 2;
@@ -2215,6 +2392,18 @@
REGION_NULL(pScreen, &sprite.Reg2);
}
#endif
+
+ #ifdef VIEWPORT_FRAME
+ nxagentInitViewportFrame(pScreen, win);
+ #endif
+
+ if (nxagentOption(Shadow))
+ {
+ if (nxagentShadowInit(pScreen, win) == -1)
+ {
+ FatalError("Failed to connect to display '%s'", nxagentShadowDisplayName);
+ }
+ }
}
/*
@@ -2553,6 +2742,13 @@
tempGrab.modifiersDetail.exact&(~0x1f00);
}
#endif
+ #ifdef NX_DEBUG_INPUT
+ if (nxagentDebugInputDevices == 1)
+ {
+ fprintf(stderr, "CheckPassiveGrabsOnWindow: Activating passive grab on %s.\n",
+ device == inputInfo.keyboard ? "keyboard" : "pointer");
+ }
+ #endif
(*device->ActivateGrab)(device, grab, currentTime, TRUE);
FixUpEventFromWindow(xE, grab->window, None, TRUE);
@@ -2911,7 +3107,17 @@
else
DeliverFocusedEvent(keybd, xE, sprite.win, count);
if (deactivateGrab)
+ #ifdef NX_DEBUG_INPUT
+ {
+ if (nxagentDebugInputDevices == 1)
+ {
+ fprintf(stderr, "ProcessKeyboardEvent: Deactivating grab on keyboard.\n");
+ }
+ #endif
(*keybd->DeactivateGrab)(keybd);
+ #ifdef NX_DEBUG_INPUT
+ }
+ #endif
}
#ifdef XKB
@@ -2961,7 +3167,9 @@
Bool deactivateGrab = FALSE;
register ButtonClassPtr butc = mouse->button;
#ifdef XKB
- XkbSrvInfoPtr xkbi= inputInfo.keyboard->key->xkbInfo;
+ XkbSrvInfoPtr xkbi;
+
+ xkbi = inputInfo.keyboard->key->xkbInfo;
#endif
#ifdef XEVIE
if(xevieFlag && clients[xevieClientIndex] && !xeviegrabState &&
@@ -2970,6 +3178,12 @@
xevieEventSent = 0;
else {
xeviemouse = mouse;
+ #ifdef NX_DEBUG_INPUT
+ if (nxagentDebugInput == 1)
+ {
+ fprintf(stderr, "ProcessPointerEvent: Going to send XEVIE event.\n");
+ }
+ #endif
WriteToClient(clients[xevieClientIndex], sizeof(xEvent), (char *)xE);
return;
}
@@ -3024,14 +3238,38 @@
#if !defined(XFree86Server) || !defined(XINPUT)
xE->u.u.detail = butc->map[key];
#endif
+ #ifdef NX_DEBUG_INPUT
+ if (xE->u.u.detail == 0)
+ {
+ if (nxagentDebugInput == 1)
+ {
+ fprintf(stderr, "ProcessPointerEvent: WARNING! detail == 0"
+ " for ButtonPress.\n");
+ }
+ return;
+ }
+ #else
if (xE->u.u.detail == 0)
return;
+ #endif
if (xE->u.u.detail <= 5)
butc->state |= (Button1Mask >> 1) << xE->u.u.detail;
filters[MotionNotify] = Motion_Filter(butc);
if (!grab)
+ #ifdef NX_DEBUG_INPUT
+ if (CheckDeviceGrabs(mouse, xE, 0, count))
+ {
+ if (nxagentDebugInput == 1)
+ {
+ fprintf(stderr, "ProcessPointerEvent: CheckDeviceGrabs"
+ " returned True for ButtonPress.\n");
+ }
+ return;
+ }
+ #else
if (CheckDeviceGrabs(mouse, xE, 0, count))
return;
+ #endif
break;
case ButtonRelease:
mouse->valuator->motionHintWindow = NullWindow;
@@ -3043,8 +3281,20 @@
#if !defined(XFree86Server) || !defined(XINPUT)
xE->u.u.detail = butc->map[key];
#endif
+ #ifdef NX_DEBUG_INPUT
if (xE->u.u.detail == 0)
+ {
+ if (nxagentDebugInput == 1)
+ {
+ fprintf(stderr, "ProcessPointerEvent: WARNING! detail == 0"
+ " for ButtonRelease.\n");
+ }
return;
+ }
+ #else
+ if (xE->u.u.detail == 0)
+ return;
+ #endif
if (xE->u.u.detail <= 5)
butc->state &= ~((Button1Mask >> 1) << xE->u.u.detail);
filters[MotionNotify] = Motion_Filter(butc);
@@ -3055,6 +3305,36 @@
FatalError("bogus pointer event from ddx");
}
}
+ #ifdef NX_DEBUG_INPUT
+ else if (!CheckMotion(xE))
+ {
+ if (nxagentDebugInput == 1)
+ {
+ fprintf(stderr, "ProcessPointerEvent: CheckMotion returned False"
+ " for MotionNotify.\n");
+ }
+ return;
+ }
+ if (grab)
+ {
+ if (nxagentDebugInput == 1)
+ {
+ fprintf(stderr, "ProcessPointerEvent: Going to deliver grabbed "
+ "events (count = %d).\n", count);
+ }
+ DeliverGrabbedEvent(xE, mouse, deactivateGrab, count);
+ }
+ else
+ {
+ if (nxagentDebugInput == 1)
+ {
+ fprintf(stderr, "ProcessPointerEvent: Going to deliver device "
+ "events (count = %d).\n", count);
+ }
+ DeliverDeviceEvents(sprite.win, xE, NullGrab, NullWindow,
+ mouse, count);
+ }
+ #else
else if (!CheckMotion(xE))
return;
if (grab)
@@ -3062,8 +3342,19 @@
else
DeliverDeviceEvents(sprite.win, xE, NullGrab, NullWindow,
mouse, count);
+ #endif
if (deactivateGrab)
+ #ifdef NX_DEBUG_INPUT
+ {
+ if (nxagentDebugInputDevices == 1)
+ {
+ fprintf(stderr, "ProcessPointerEvent: Deactivating grab on pointer.\n");
+ }
+ #endif
(*mouse->DeactivateGrab)(mouse);
+ #ifdef NX_DEBUG_INPUT
+ }
+ #endif
}
#define AtMostOneClient \
@@ -3784,6 +4075,12 @@
pWin = SecurityLookupWindow(stuff->grabWindow, client, SecurityReadAccess);
if (!pWin)
return BadWindow;
+ #ifdef NX_DEBUG_INPUT
+ if (nxagentDebugInputDevices == 1)
+ {
+ fprintf(stderr, "ProcGrabPointer: pWin [%p] client [%d].\n", pWin, client -> index);
+ }
+ #endif
if (stuff->confineTo == None)
confineTo = NullWindow;
else
@@ -3843,6 +4140,12 @@
tempGrab.keyboardMode = stuff->keyboardMode;
tempGrab.pointerMode = stuff->pointerMode;
tempGrab.device = device;
+ #ifdef NX_DEBUG_INPUT
+ if (nxagentDebugInputDevices == 1)
+ {
+ fprintf(stderr, "ProcGrabPointer: Activating active grab on pointer.\n");
+ }
+ #endif
(*device->ActivateGrab)(device, &tempGrab, time, FALSE);
if (oldCursor)
FreeCursor (oldCursor, (Cursor)0);
@@ -3906,6 +4209,12 @@
TimeStamp time;
REQUEST(xResourceReq);
+ #ifdef NX_DEBUG_INPUT
+ if (nxagentDebugInputDevices == 1)
+ {
+ fprintf(stderr, "ProcUngrabPointer: client [%d].\n", client -> index);
+ }
+ #endif
REQUEST_SIZE_MATCH(xResourceReq);
UpdateCurrentTime();
grab = device->grab;
@@ -3913,7 +4222,25 @@
if ((CompareTimeStamps(time, currentTime) != LATER) &&
(CompareTimeStamps(time, device->grabTime) != EARLIER) &&
(grab) && SameClient(grab, client))
+ #ifdef NX_DEBUG_INPUT
+ {
+ if (nxagentDebugInputDevices == 1)
+ {
+ fprintf(stderr, "ProcUngrabPointer: Deactivating grab on pointer.\n");
+ }
+ #endif
(*device->DeactivateGrab)(device);
+ #ifdef NX_DEBUG_INPUT
+ }
+ else
+ {
+ if (nxagentDebugInputDevices == 1)
+ {
+ fprintf(stderr, "ProcUngrabPointer: current time [%lu] request time [%lu] grab time [%lu].\n",
+ currentTime.milliseconds, time.milliseconds, device->grabTime.milliseconds);
+ }
+ }
+ #endif
return Success;
}
@@ -3968,6 +4295,12 @@
tempGrab.pointerMode = other_mode;
tempGrab.eventMask = mask;
tempGrab.device = dev;
+ #ifdef NX_DEBUG_INPUT
+ if (nxagentDebugInputDevices == 1)
+ {
+ fprintf(stderr, "GrabDevice: Activating active grab on keyboard.\n");
+ }
+ #endif
(*dev->ActivateGrab)(dev, &tempGrab, time, FALSE);
*status = GrabSuccess;
}
@@ -3981,6 +4314,12 @@
REQUEST(xGrabKeyboardReq);
int result;
+ #ifdef NX_DEBUG_INPUT
+ if (nxagentDebugInputDevices == 1)
+ {
+ fprintf(stderr, "ProcGrabKeyboard: client [%d].\n", client -> index);
+ }
+ #endif
REQUEST_SIZE_MATCH(xGrabKeyboardReq);
#ifdef XCSECURITY
if (!SecurityCheckDeviceAccess(client, inputInfo.keyboard, TRUE))
@@ -4011,6 +4350,12 @@
TimeStamp time;
REQUEST(xResourceReq);
+ #ifdef NX_DEBUG_INPUT
+ if (nxagentDebugInputDevices == 1)
+ {
+ fprintf(stderr, "ProcUngrabKeyboard: client [%d].\n", client -> index);
+ }
+ #endif
REQUEST_SIZE_MATCH(xResourceReq);
UpdateCurrentTime();
grab = device->grab;
@@ -4018,7 +4363,25 @@
if ((CompareTimeStamps(time, currentTime) != LATER) &&
(CompareTimeStamps(time, device->grabTime) != EARLIER) &&
(grab) && SameClient(grab, client))
+ #ifdef NX_DEBUG_INPUT
+ {
+ if (nxagentDebugInputDevices == 1)
+ {
+ fprintf(stderr, "ProcUngrabKeyboard: Deactivating grab on keyboard.\n");
+ }
+ #endif
(*device->DeactivateGrab)(device);
+ #ifdef NX_DEBUG_INPUT
+ }
+ else
+ {
+ if (nxagentDebugInputDevices == 1)
+ {
+ fprintf(stderr, "ProcUngrabKeyboard: current time [%lu] request time [%lu] grab time [%lu].\n",
+ currentTime.milliseconds, time.milliseconds, device->grabTime.milliseconds);
+ }
+ }
+ #endif
return Success;
}
@@ -4152,6 +4515,17 @@
/* The client's event type must be a core event type or one defined by an
extension. */
+
+#ifdef NXAGENT_CLIPBOARD
+
+ if (stuff -> event.u.u.type == SelectionNotify)
+ {
+ extern int nxagentSendNotify(xEvent*);
+ if (nxagentSendNotify(&stuff->event) == 1)
+ return Success;
+ }
+#endif
+
if ( ! ((stuff->event.u.u.type > X_Reply &&
stuff->event.u.u.type < LASTEvent) ||
(stuff->event.u.u.type >= EXTENSION_EVENT_BASE &&

View File

@@ -0,0 +1,70 @@
--- ./nx-X11/programs/Xserver/hw/nxagent/X/NXextension.c.X.original 2015-02-13 14:03:44.744441510 +0100
+++ ./nx-X11/programs/Xserver/hw/nxagent/X/NXextension.c 2015-02-10 19:13:13.804685886 +0100
@@ -1,3 +1,20 @@
+/**************************************************************************/
+/* */
+/* Copyright (c) 2001, 2011 NoMachine, http://www.nomachine.com/. */
+/* */
+/* NXAGENT, NX protocol compression and NX extensions to this software */
+/* are copyright of NoMachine. Redistribution and use of the present */
+/* software is allowed according to terms specified in the file LICENSE */
+/* which comes in the source distribution. */
+/* */
+/* Check http://www.nomachine.com/licensing.html for applicability. */
+/* */
+/* NX and NoMachine are trademarks of Medialogic S.p.A. */
+/* */
+/* All rights reserved. */
+/* */
+/**************************************************************************/
+
/* $XFree86: xc/programs/Xserver/dix/extension.c,v 3.11 2001/12/14 19:59:31 dawes Exp $ */
/***********************************************************
@@ -60,7 +77,7 @@
#include "extnsionst.h"
#include "gcstruct.h"
#include "scrnintstr.h"
-#include "dispatch.h"
+#include "../../dix/dispatch.h"
#ifdef XCSECURITY
#define _SECURITY_SERVER
#include <X11/extensions/security.h>
@@ -69,6 +86,8 @@
#include "lbxserve.h"
#endif
+#include "Trap.h"
+
#define EXTENSION_BASE 128
#define EXTENSION_EVENT_BASE 64
#define LAST_EVENT 128
@@ -324,6 +343,13 @@
{
i = FindExtension((char *)&stuff[1], stuff->nbytes);
if (i < 0
+
+ /*
+ * Hide RENDER if our implementation
+ * is faulty.
+ */
+
+ || (nxagentRenderTrap && strcmp(extensions[i]->name, "RENDER") == 0)
#ifdef XCSECURITY
/* don't show insecure extensions to untrusted clients */
|| (client->trustLevel == XSecurityClientUntrusted &&
@@ -370,6 +396,14 @@
!extensions[i]->secure)
continue;
#endif
+ /*
+ * Hide RENDER if our implementation
+ * is faulty.
+ */
+
+ if (nxagentRenderTrap && strcmp(extensions[i]->name, "RENDER") == 0)
+ continue;
+
total_length += strlen(extensions[i]->name) + 1;
reply.nExtensions += 1 + extensions[i]->num_aliases;
for (j = extensions[i]->num_aliases; --j >= 0;)

View File

@@ -0,0 +1,118 @@
--- ./nx-X11/programs/Xserver/hw/nxagent/X/NXglxext.c.X.original 2015-02-13 14:03:44.744441510 +0100
+++ ./nx-X11/programs/Xserver/hw/nxagent/X/NXglxext.c 2015-02-10 19:13:13.808685737 +0100
@@ -1,3 +1,20 @@
+/**************************************************************************/
+/* */
+/* Copyright (c) 2001, 2011 NoMachine, http://www.nomachine.com/. */
+/* */
+/* NXAGENT, NX protocol compression and NX extensions to this software */
+/* are copyright of NoMachine. Redistribution and use of the present */
+/* software is allowed according to terms specified in the file LICENSE */
+/* which comes in the source distribution. */
+/* */
+/* Check http://www.nomachine.com/licensing.html for applicability. */
+/* */
+/* NX and NoMachine are trademarks of Medialogic S.p.A. */
+/* */
+/* All rights reserved. */
+/* */
+/**************************************************************************/
+
/* $XFree86: xc/programs/Xserver/GL/glx/glxext.c,v 1.9 2003/09/28 20:15:43 alanh Exp $
** The contents of this file are subject to the GLX Public License Version 1.0
** (the "License"). You may not use this file except in compliance with the
@@ -33,6 +50,12 @@
#include "glxext.h"
#include "micmap.h"
+#include "Trap.h"
+
+#define PANIC
+#define WARNING
+#undef TEST
+#undef DEBUG
void GlxWrapInitVisuals(miInitVisualsProcPtr *);
void GlxSetVisualConfigs(int nconfigs,
@@ -395,6 +418,8 @@
*/
static int __glXDispatch(ClientPtr client)
{
+ int result;
+
REQUEST(xGLXSingleReq);
CARD8 opcode;
int (*proc)(__GLXclientState *cl, GLbyte *pc);
@@ -444,11 +469,35 @@
** Use the opcode to index into the procedure table.
*/
proc = __glXSingleTable[opcode];
- return (*proc)(cl, (GLbyte *) stuff);
+
+ /*
+ * Report upstream that we are
+ * dispatching a GLX operation.
+ */
+
+ nxagentGlxTrap = 1;
+
+ #ifdef TEST
+ fprintf(stderr, "__glXDispatch: Going to dispatch GLX operation [%d] for client [%d].\n",
+ opcode, client -> index);
+ #endif
+
+ result = (*proc)(cl, (GLbyte *) stuff);
+
+ nxagentGlxTrap = 0;
+
+ #ifdef TEST
+ fprintf(stderr, "__glXDispatch: Dispatched GLX operation [%d] for client [%d].\n",
+ opcode, client -> index);
+ #endif
+
+ return result;
}
static int __glXSwapDispatch(ClientPtr client)
{
+ int result;
+
REQUEST(xGLXSingleReq);
CARD8 opcode;
int (*proc)(__GLXclientState *cl, GLbyte *pc);
@@ -490,7 +539,29 @@
** Use the opcode to index into the procedure table.
*/
proc = __glXSwapSingleTable[opcode];
- return (*proc)(cl, (GLbyte *) stuff);
+
+ /*
+ * Report upstream that we are
+ * dispatching a GLX operation.
+ */
+
+ nxagentGlxTrap = 1;
+
+ #ifdef TEST
+ fprintf(stderr, "__glXDispatch: Going to dispatch GLX operation [%d] for client [%d].\n",
+ opcode, client -> index);
+ #endif
+
+ result = (*proc)(cl, (GLbyte *) stuff);
+
+ nxagentGlxTrap = 0;
+
+ #ifdef TEST
+ fprintf(stderr, "__glXDispatch: Dispatched GLX operation [%d] for client [%d].\n",
+ opcode, client -> index);
+ #endif
+
+ return result;
}
int __glXNoSuchSingleOpcode(__GLXclientState *cl, GLbyte *pc)
@@ -502,4 +573,3 @@
{
return;
}
-

View File

@@ -0,0 +1,160 @@
--- ./nx-X11/programs/Xserver/hw/nxagent/X/NXglyph.c.X.original 2015-02-13 14:03:44.744441510 +0100
+++ ./nx-X11/programs/Xserver/hw/nxagent/X/NXglyph.c 2015-02-10 19:13:13.824685138 +0100
@@ -1,3 +1,20 @@
+/**************************************************************************/
+/* */
+/* Copyright (c) 2001, 2011 NoMachine, http://www.nomachine.com/. */
+/* */
+/* NXAGENT, NX protocol compression and NX extensions to this software */
+/* are copyright of NoMachine. Redistribution and use of the present */
+/* software is allowed according to terms specified in the file LICENSE */
+/* which comes in the source distribution. */
+/* */
+/* Check http://www.nomachine.com/licensing.html for applicability. */
+/* */
+/* NX and NoMachine are trademarks of Medialogic S.p.A. */
+/* */
+/* All rights reserved. */
+/* */
+/**************************************************************************/
+
/*
* $XFree86: xc/programs/Xserver/render/glyph.c,v 1.5 2001/01/30 07:01:22 keithp Exp $
*
@@ -40,9 +57,25 @@
#include "dixstruct.h"
#include "gcstruct.h"
#include "servermd.h"
+
+#ifdef NXAGENT_SERVER
+
+#include "NXpicturestr.h"
+#include "NXglyphstr.h"
+#include "Render.h"
+
+#define PANIC
+#define WARNING
+#undef DEBUG
+#undef TEST
+
+#else
+
#include "picturestr.h"
#include "glyphstr.h"
+#endif
+
#if HAVE_STDINT_H
#include <stdint.h>
#elif !defined(UINT32_MAX)
@@ -293,7 +326,7 @@
gr->signature = hash;
globalGlyphs[glyphSet->fdepth].tableEntries++;
}
-
+
/* Insert/replace glyphset value */
gr = FindGlyphRef (&glyphSet->hash, id, FALSE, 0);
++glyph->refcnt;
@@ -303,6 +336,13 @@
glyphSet->hash.tableEntries++;
gr->glyph = glyph;
gr->signature = id;
+
+ #ifdef NXAGENT_SERVER
+
+ gr -> corruptedGlyph = 1;
+
+ #endif
+
CheckDuplicates (&globalGlyphs[glyphSet->fdepth], "AddGlyph bottom");
}
@@ -324,6 +364,36 @@
return FALSE;
}
+#ifdef NXAGENT_SERVER
+
+GlyphPtr FindGlyph (GlyphSetPtr glyphSet, Glyph id)
+{
+ GlyphRefPtr gr;
+ GlyphPtr glyph;
+
+ gr = FindGlyphRef (&glyphSet->hash, id, FALSE, 0);
+ glyph = gr -> glyph;
+
+ if (glyph == DeletedGlyph)
+ {
+ glyph = 0;
+ }
+ else if (gr -> corruptedGlyph == 1)
+ {
+ #ifdef DEBUG
+ fprintf(stderr, "FindGlyphRef: Going to synchronize the glyph [%p] for glyphset [%p].\n",
+ (void *) glyph, (void *) glyphSet);
+ #endif
+
+ nxagentAddGlyphs(glyphSet, &id, &(glyph -> info), 1,
+ (CARD8*)(glyph + 1), glyph -> size - sizeof(xGlyphInfo));
+ }
+
+ return glyph;
+}
+
+#else
+
GlyphPtr
FindGlyph (GlyphSetPtr glyphSet, Glyph id)
{
@@ -335,6 +405,8 @@
return glyph;
}
+#endif
+
GlyphPtr
AllocateGlyph (xGlyphInfo *gi, int fdepth)
{
@@ -379,6 +451,12 @@
int oldSize;
CARD32 s;
+ #ifdef NXAGENT_SERVER
+
+ CARD32 c;
+
+ #endif
+
tableEntries = hash->tableEntries + change;
hashSet = FindGlyphHashSet (tableEntries);
if (hashSet == hash->hashSet)
@@ -396,9 +474,23 @@
if (glyph && glyph != DeletedGlyph)
{
s = hash->table[i].signature;
+
+ #ifdef NXAGENT_SERVER
+
+ c = hash->table[i].corruptedGlyph;
+
+ #endif
+
gr = FindGlyphRef (&newHash, s, global, glyph);
gr->signature = s;
gr->glyph = glyph;
+
+ #ifdef NXAGENT_SERVER
+
+ gr -> corruptedGlyph = c;
+
+ #endif
+
++newHash.tableEntries;
}
}
@@ -486,3 +578,4 @@
}
return Success;
}
+

View File

@@ -0,0 +1,121 @@
--- ./nx-X11/programs/Xserver/hw/nxagent/X/NXglyphcurs.c.X.original 2015-02-13 14:03:44.744441510 +0100
+++ ./nx-X11/programs/Xserver/hw/nxagent/X/NXglyphcurs.c 2015-02-10 19:13:13.808685737 +0100
@@ -1,3 +1,20 @@
+/**************************************************************************/
+/* */
+/* Copyright (c) 2001, 2011 NoMachine, http://www.nomachine.com/. */
+/* */
+/* NXAGENT, NX protocol compression and NX extensions to this software */
+/* are copyright of NoMachine. Redistribution and use of the present */
+/* software is allowed according to terms specified in the file LICENSE */
+/* which comes in the source distribution. */
+/* */
+/* Check http://www.nomachine.com/licensing.html for applicability. */
+/* */
+/* NX and NoMachine are trademarks of Medialogic S.p.A. */
+/* */
+/* All rights reserved. */
+/* */
+/**************************************************************************/
+
/************************************************************************
Copyright 1987, 1998 The Open Group
@@ -62,6 +79,12 @@
#include "opaque.h"
#include "servermd.h"
+#include "../../fb/fb.h"
+#include "Pixmaps.h"
+
+#ifndef True
+#define True 1
+#endif
/*
get the bits out of the font in a portable way. to avoid
@@ -98,44 +121,68 @@
/* zeroing the (pad) bits seems to help some ddx cursor handling */
bzero(pbits, nby);
- ppix = (PixmapPtr)(*pScreen->CreatePixmap)(pScreen, cm->width,
- cm->height, 1);
+ ppix = fbCreatePixmap(pScreen, cm->width, cm->height, 1);
pGC = GetScratchGC(1, pScreen);
if (!ppix || !pGC)
{
if (ppix)
- (*pScreen->DestroyPixmap)(ppix);
+ fbDestroyPixmap(ppix);
if (pGC)
FreeScratchGC(pGC);
xfree(pbits);
return BadAlloc;
}
+ #ifdef TEST
+ fprintf(stderr, "ServerBitsFromGlyph: Created virtual pixmap at [%p] with width [%d] height [%d] depth [%d].\n",
+ (void *) ppix, cm->width, cm->height, 1);
+ #endif
+
+ nxagentPixmapPriv(ppix) -> id = 0;
+ nxagentPixmapPriv(ppix) -> mid = 0;
+ nxagentPixmapPriv(ppix) -> isVirtual = True;
+ nxagentPixmapPriv(ppix) -> pRealPixmap = NULL;
+ nxagentPixmapPriv(ppix) -> pVirtualPixmap = NULL;
+
rect.x = 0;
rect.y = 0;
rect.width = cm->width;
rect.height = cm->height;
- /* fill the pixmap with 0 */
- gcval[0].val = GXcopy;
- gcval[1].val = 0;
- gcval[2].ptr = (pointer)pfont;
- dixChangeGC(NullClient, pGC, GCFunction | GCForeground | GCFont,
- NULL, gcval);
+ pGC->stateChanges |= GCFunction | GCForeground | GCFont;
+ pGC->alu = GXcopy;
+
+ pGC->fgPixel = 0;
+
+ pfont->refcnt++;
+
+ if (pGC->font)
+ CloseFont(pGC->font, (Font)0);
+
+ pGC->font = pfont;
+
ValidateGC((DrawablePtr)ppix, pGC);
- (*pGC->ops->PolyFillRect)((DrawablePtr)ppix, pGC, 1, &rect);
+ fbPolyFillRect((DrawablePtr)ppix, pGC, 1, &rect);
/* draw the glyph */
gcval[0].val = 1;
- dixChangeGC(NullClient, pGC, GCForeground, NULL, gcval);
+ pGC->fgPixel = 1;
+
+ pGC->stateChanges |= GCForeground;
+
ValidateGC((DrawablePtr)ppix, pGC);
- (*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);
+ 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);
*ppbits = (unsigned char *)pbits;
FreeScratchGC(pGC);
- (*pScreen->DestroyPixmap)(ppix);
+ fbDestroyPixmap(ppix);
+
+ #ifdef TEST
+ fprintf(stderr, "ServerBitsFromGlyph: Destroyed virtual pixmap at [%p].\n",
+ (void *) ppix);
+ #endif
+
return Success;
}

View File

@@ -0,0 +1,59 @@
--- ./nx-X11/programs/Xserver/hw/nxagent/X/NXglyphstr.h.X.original 2015-02-13 14:03:44.744441510 +0100
+++ ./nx-X11/programs/Xserver/hw/nxagent/X/NXglyphstr.h 2015-02-10 19:13:13.780686785 +0100
@@ -1,3 +1,20 @@
+/**************************************************************************/
+/* */
+/* Copyright (c) 2001, 2011 NoMachine, http://www.nomachine.com/. */
+/* */
+/* NXAGENT, NX protocol compression and NX extensions to this software */
+/* are copyright of NoMachine. Redistribution and use of the present */
+/* software is allowed according to terms specified in the file LICENSE */
+/* which comes in the source distribution. */
+/* */
+/* Check http://www.nomachine.com/licensing.html for applicability. */
+/* */
+/* NX and NoMachine are trademarks of Medialogic S.p.A. */
+/* */
+/* All rights reserved. */
+/* */
+/**************************************************************************/
+
/*
* $XFree86: xc/programs/Xserver/render/glyphstr.h,v 1.3 2000/11/20 07:13:13 keithp Exp $
*
@@ -23,11 +40,18 @@
* Author: Keith Packard, SuSE, Inc.
*/
+/*
+ * This must keep the same symbol as the original glyphstr.h
+ * or symbols will be redefined. The code here adds a field
+ * to _GlyphSet. This should be done by defining a new type
+ * and casting when appropriate.
+ */
+
#ifndef _GLYPHSTR_H_
#define _GLYPHSTR_H_
#include <X11/extensions/renderproto.h>
-#include "picture.h"
+#include "../../render/picture.h"
#include "screenint.h"
#define GlyphFormat1 0
@@ -47,6 +71,7 @@
typedef struct _GlyphRef {
CARD32 signature;
GlyphPtr glyph;
+ CARD16 corruptedGlyph;
} GlyphRefRec, *GlyphRefPtr;
#define DeletedGlyph ((GlyphPtr) 1)
@@ -70,6 +95,7 @@
GlyphHashRec hash;
int maxPrivate;
pointer *devPrivates;
+ CARD32 remoteID;
} GlyphSetRec, *GlyphSetPtr;
#define GlyphSetGetPrivate(pGlyphSet,n) \

View File

@@ -0,0 +1,116 @@
--- ./nx-X11/programs/Xserver/hw/nxagent/X/NXmiexpose.c.X.original 2015-02-13 14:03:44.744441510 +0100
+++ ./nx-X11/programs/Xserver/hw/nxagent/X/NXmiexpose.c 2015-02-10 19:13:13.768687235 +0100
@@ -1,3 +1,20 @@
+/**************************************************************************/
+/* */
+/* Copyright (c) 2001, 2011 NoMachine, http://www.nomachine.com/. */
+/* */
+/* NXAGENT, NX protocol compression and NX extensions to this software */
+/* are copyright of NoMachine. Redistribution and use of the present */
+/* software is allowed according to terms specified in the file LICENSE */
+/* which comes in the source distribution. */
+/* */
+/* Check http://www.nomachine.com/licensing.html for applicability. */
+/* */
+/* NX and NoMachine are trademarks of Medialogic S.p.A. */
+/* */
+/* All rights reserved. */
+/* */
+/**************************************************************************/
+
/* $XdotOrg: xc/programs/Xserver/mi/miexpose.c,v 1.6 2005/07/03 08:53:51 daniels Exp $ */
/* $XFree86: xc/programs/Xserver/mi/miexpose.c,v 3.9tsi Exp $ */
/***********************************************************
@@ -109,6 +126,12 @@
the region package can call this.
*/
+#ifdef NXAGENT_SERVER
+
+#include "Windows.h"
+
+#endif
+
#ifndef RECTLIMIT
#define RECTLIMIT 25 /* pick a number, any number > 8 */
#endif
@@ -158,6 +181,20 @@
BoxRec expBox;
Bool extents;
+#ifdef NXAGENT_SERVER
+
+ /*
+ * Set the elements reported by the compiler
+ * as uninitialized.
+ */
+
+ expBox.x1 = 0;
+ expBox.y1 = 0;
+ expBox.x2 = 0;
+ expBox.y2 = 0;
+
+#endif
+
/* This prevents warning about pscr not being used. */
pGC->pScreen = pscr = pGC->pScreen;
@@ -498,6 +535,11 @@
WindowPtr pWin;
register RegionPtr prgn, other_exposed;
{
+#ifdef NXAGENT_SERVER
+
+ int total;
+
+#endif
RegionPtr exposures = prgn;
if (pWin->backStorage && prgn)
/*
@@ -533,7 +575,20 @@
}
exposures = other_exposed;
}
+#ifdef NXAGENT_SERVER
+
+ /*
+ * If the number of rectangles is greater
+ * than 4, let the function decide.
+ */
+
+ total = REGION_NUM_RECTS(exposures);
+
+ if (clientInterested && exposures && (total > RECTLIMIT ||
+ (total > 4 && nxagentExtentsPredicate(total) == 1)))
+#else
if (clientInterested && exposures && (REGION_NUM_RECTS(exposures) > RECTLIMIT))
+#endif
{
/*
* If we have LOTS of rectangles, we decide to take the extents
@@ -666,6 +721,25 @@
register xRectangle *prect;
int numRects;
+#ifdef NXAGENT_SERVER
+
+ /*
+ * Set the elements reported by the compiler
+ * as uninitialized.
+ */
+
+ prgnWin.extents.x1 = 0;
+ prgnWin.extents.y1 = 0;
+ prgnWin.extents.x2 = 0;
+ prgnWin.extents.y2 = 0;
+
+ prgnWin.data = NULL;
+
+ oldCorner.x = 0;
+ oldCorner.y = 0;
+
+#endif
+
gcmask = 0;
if (what == PW_BACKGROUND)

View File

@@ -0,0 +1,156 @@
--- ./nx-X11/programs/Xserver/hw/nxagent/X/NXmiglyph.c.X.original 2015-02-13 14:03:44.744441510 +0100
+++ ./nx-X11/programs/Xserver/hw/nxagent/X/NXmiglyph.c 2015-02-10 19:13:13.804685886 +0100
@@ -1,3 +1,20 @@
+/**************************************************************************/
+/* */
+/* Copyright (c) 2001, 2011 NoMachine, http://www.nomachine.com/. */
+/* */
+/* NXAGENT, NX protocol compression and NX extensions to this software */
+/* are copyright of NoMachine. Redistribution and use of the present */
+/* software is allowed according to terms specified in the file LICENSE */
+/* which comes in the source distribution. */
+/* */
+/* Check http://www.nomachine.com/licensing.html for applicability. */
+/* */
+/* NX and NoMachine are trademarks of Medialogic S.p.A. */
+/* */
+/* All rights reserved. */
+/* */
+/**************************************************************************/
+
/*
* $XFree86: xc/programs/Xserver/render/miglyph.c,v 1.4 2000/11/20 07:13:13 keithp Exp $
*
@@ -35,6 +52,12 @@
#include "picturestr.h"
#include "mipict.h"
+#ifdef NXAGENT_SERVER
+
+#include "Render.h"
+
+#endif
+
void
miGlyphExtents (int nlist,
GlyphListPtr list,
@@ -45,7 +68,7 @@
int n;
GlyphPtr glyph;
int x, y;
-
+
x = 0;
y = 0;
extents->x1 = MAXSHORT;
@@ -113,25 +136,58 @@
int error;
BoxRec extents;
CARD32 component_alpha;
-
+
+ #ifdef NXAGENT_SERVER
+
+ /*
+ * Get rid of the warning.
+ */
+
+ extents.x1 = 0;
+ extents.y1 = 0;
+
+ #endif
+
if (maskFormat)
{
GCPtr pGC;
xRectangle rect;
-
- miGlyphExtents (nlist, list, glyphs, &extents);
-
+
+ #ifdef NXAGENT_SERVER
+
+ if (nxagentGlyphsExtents != NullBox)
+ {
+ memcpy(&extents, nxagentGlyphsExtents, sizeof(BoxRec));
+ }
+ else
+ {
+ nxagentGlyphsExtents = (BoxPtr) xalloc(sizeof(BoxRec));
+
+ miGlyphExtents (nlist, list, glyphs, &extents);
+
+ memcpy(nxagentGlyphsExtents, &extents, sizeof(BoxRec));
+ }
+
+ #else
+
+ miGlyphExtents (nlist, list, glyphs, &extents);
+
+ #endif
+
if (extents.x2 <= extents.x1 || extents.y2 <= extents.y1)
return;
width = extents.x2 - extents.x1;
height = extents.y2 - extents.y1;
pMaskPixmap = (*pScreen->CreatePixmap) (pScreen, width, height, maskFormat->depth);
+
if (!pMaskPixmap)
return;
+
component_alpha = NeedsComponent(maskFormat->format);
pMask = CreatePicture (0, &pMaskPixmap->drawable,
maskFormat, CPComponentAlpha, &component_alpha,
serverClient, &error);
+
if (!pMask)
{
(*pScreen->DestroyPixmap) (pMaskPixmap);
@@ -160,6 +216,7 @@
x += list->xOff;
y += list->yOff;
n = list->len;
+
while (n--)
{
glyph = *glyphs++;
@@ -184,6 +241,21 @@
(*pScreen->ModifyPixmapHeader) (pPixmap,
glyph->info.width, glyph->info.height,
0, 0, -1, (pointer) (glyph + 1));
+
+ #ifdef NXAGENT_SERVER
+
+ /*
+ * The following line fixes a problem with glyphs that appeared
+ * as clipped. It was a side effect due the validate function
+ * "ValidatePicture" that makes a check on the Drawable serial
+ * number instead of the picture serial number, failing thus
+ * the clip mask update.
+ */
+
+ pPicture->pDrawable->serialNumber = NEXT_SERIAL_NUMBER;
+
+ #endif
+
pPixmap->drawable.serialNumber = NEXT_SERIAL_NUMBER;
if (maskFormat)
{
@@ -215,6 +287,7 @@
x += glyph->info.xOff;
y += glyph->info.yOff;
}
+
list++;
if (pPicture)
{
@@ -237,7 +310,9 @@
0, 0,
x, y,
width, height);
+
FreePicture ((pointer) pMask, (XID) 0);
(*pScreen->DestroyPixmap) (pMaskPixmap);
}
+
}

View File

@@ -0,0 +1,65 @@
--- ./nx-X11/programs/Xserver/hw/nxagent/X/NXmitrap.c.X.original 2015-02-13 14:03:44.744441510 +0100
+++ ./nx-X11/programs/Xserver/hw/nxagent/X/NXmitrap.c 2015-02-10 19:13:13.820685287 +0100
@@ -1,3 +1,20 @@
+/**************************************************************************/
+/* */
+/* Copyright (c) 2001, 2011 NoMachine, http://www.nomachine.com/. */
+/* */
+/* NXAGENT, NX protocol compression and NX extensions to this software */
+/* are copyright of NoMachine. Redistribution and use of the present */
+/* software is allowed according to terms specified in the file LICENSE */
+/* which comes in the source distribution. */
+/* */
+/* Check http://www.nomachine.com/licensing.html for applicability. */
+/* */
+/* NX and NoMachine are trademarks of Medialogic S.p.A. */
+/* */
+/* All rights reserved. */
+/* */
+/**************************************************************************/
+
/*
* $XFree86: xc/programs/Xserver/render/mitrap.c,v 1.8 2002/09/03 19:28:28 keithp Exp $
*
@@ -35,6 +52,12 @@
#include "picturestr.h"
#include "mipict.h"
+#ifdef NXAGENT_SERVER
+
+#include "Render.h"
+
+#endif
+
PicturePtr
miCreateAlphaPicture (ScreenPtr pScreen,
PicturePtr pDst,
@@ -159,7 +182,27 @@
xDst = traps[0].left.p1.x >> 16;
yDst = traps[0].left.p1.y >> 16;
- miTrapezoidBounds (ntrap, traps, &bounds);
+ #ifdef NXAGENT_SERVER
+
+ if (nxagentTrapezoidExtents != NullBox)
+ {
+ memcpy(&bounds, nxagentTrapezoidExtents, sizeof(BoxRec));
+ }
+ else
+ {
+ nxagentTrapezoidExtents = (BoxPtr) xalloc(sizeof(BoxRec));
+
+ miTrapezoidBounds (ntrap, traps, &bounds);
+
+ memcpy(nxagentTrapezoidExtents, &bounds, sizeof(BoxRec));
+ }
+
+ #else
+
+ miTrapezoidBounds (ntrap, traps, &bounds);
+
+ #endif
+
if (bounds.y1 >= bounds.y2 || bounds.x1 >= bounds.x2)
return;
pPicture = miCreateAlphaPicture (pScreen, pDst, maskFormat,

View File

@@ -0,0 +1,53 @@
--- ./nx-X11/programs/Xserver/hw/nxagent/X/NXmiwindow.c.X.original 2015-02-13 14:03:44.744441510 +0100
+++ ./nx-X11/programs/Xserver/hw/nxagent/X/NXmiwindow.c 2015-02-10 19:13:13.776686935 +0100
@@ -1,3 +1,20 @@
+/**************************************************************************/
+/* */
+/* Copyright (c) 2001, 2011 NoMachine, http://www.nomachine.com/. */
+/* */
+/* NXAGENT, NX protocol compression and NX extensions to this software */
+/* are copyright of NoMachine. Redistribution and use of the present */
+/* software is allowed according to terms specified in the file LICENSE */
+/* which comes in the source distribution. */
+/* */
+/* Check http://www.nomachine.com/licensing.html for applicability. */
+/* */
+/* NX and NoMachine are trademarks of Medialogic S.p.A. */
+/* */
+/* All rights reserved. */
+/* */
+/**************************************************************************/
+
/* $XFree86: xc/programs/Xserver/mi/miwindow.c,v 1.9tsi Exp $ */
/***********************************************************
@@ -1048,8 +1065,29 @@
bsExposed = (*pScreen->TranslateBackingStore)
(pWin, 0, 0, pOldClip,
pWin->drawable.x, pWin->drawable.y);
+#ifdef NXAGENT_SERVER
+
+ /*
+ * We got a few, rare, segfaults here after having
+ * started using the backing store. It may be a
+ * different bug but miChangeSaveUnder() calls mi-
+ * CheckSubSaveUnder() that, in turn, can change
+ * the backing store attribute of the window. This
+ * means that we may try to destroy the region
+ * even if it was not created at the beginning of
+ * this function as, at the time, the backing store
+ * was off. miCheckSubSaveUnder() appear to get a
+ * pointer to the parent, so maybe doesn't change
+ * the attribute of the window itself. This is to
+ * be better investigated.
+ */
+
+ if (WasViewable && pOldClip)
+ REGION_DESTROY(pScreen, pOldClip);
+#else
if (WasViewable)
REGION_DESTROY(pScreen, pOldClip);
+#endif
if (bsExposed)
{
RegionPtr valExposed = NullRegion;

View File

@@ -0,0 +1,615 @@
--- ./nx-X11/programs/Xserver/hw/nxagent/X/NXpicture.c.X.original 2015-02-13 14:03:44.744441510 +0100
+++ ./nx-X11/programs/Xserver/hw/nxagent/X/NXpicture.c 2015-02-13 14:03:44.744441510 +0100
@@ -1,3 +1,20 @@
+/**************************************************************************/
+/* */
+/* Copyright (c) 2001, 2011 NoMachine, http://www.nomachine.com/. */
+/* */
+/* NXAGENT, NX protocol compression and NX extensions to this software */
+/* are copyright of NoMachine. Redistribution and use of the present */
+/* software is allowed according to terms specified in the file LICENSE */
+/* which comes in the source distribution. */
+/* */
+/* Check http://www.nomachine.com/licensing.html for applicability. */
+/* */
+/* NX and NoMachine are trademarks of Medialogic S.p.A. */
+/* */
+/* All rights reserved. */
+/* */
+/**************************************************************************/
+
/*
* $XFree86: xc/programs/Xserver/render/picture.c,v 1.29 2002/11/23 02:38:15 keithp Exp $
*
@@ -40,7 +57,21 @@
#include "dixstruct.h"
#include "gcstruct.h"
#include "servermd.h"
-#include "picturestr.h"
+#include "NXpicturestr.h"
+
+#include "Screen.h"
+#include "Pixmaps.h"
+#include "Drawable.h"
+#include "Render.h"
+
+#define PANIC
+#define WARNING
+#undef TEST
+#undef DEBUG
+
+void *nxagentVisualFromID(ScreenPtr pScreen, VisualID visual);
+
+void *nxagentMatchingFormats(PictFormatPtr pForm);
int PictureScreenPrivateIndex = -1;
int PictureWindowPrivateIndex;
@@ -50,6 +81,13 @@
RESTYPE GlyphSetType;
int PictureCmapPolicy = PictureCmapPolicyDefault;
+typedef struct _formatInit {
+ CARD32 format;
+ CARD8 depth;
+} FormatInitRec, *FormatInitPtr;
+
+void nxagentPictureCreateDefaultFormats(ScreenPtr pScreen, FormatInitRec *formats, int *nformats);
+
/* Picture Private machinery */
static int picturePrivateCount;
@@ -189,11 +227,6 @@
return 0;
}
-typedef struct _formatInit {
- CARD32 format;
- CARD8 depth;
-} FormatInitRec, *FormatInitPtr;
-
static int
addFormat (FormatInitRec formats[256],
int nformat,
@@ -207,6 +240,11 @@
return nformat;
formats[nformat].format = format;
formats[nformat].depth = depth;
+
+ #ifdef DEBUG
+ fprintf(stderr, "addFormat: Added format [%lu] depth [%d].\n", format, depth);
+ #endif
+
return ++nformat;
}
@@ -215,10 +253,13 @@
PictFormatPtr
PictureCreateDefaultFormats (ScreenPtr pScreen, int *nformatp)
{
- int nformats, f;
+ int nformats, f;
PictFormatPtr pFormats;
FormatInitRec formats[1024];
CARD32 format;
+
+#ifndef NXAGENT_SERVER
+
CARD8 depth;
VisualPtr pVisual;
int v;
@@ -228,7 +269,16 @@
int d;
DepthPtr pDepth;
+#endif
+
nformats = 0;
+
+#ifdef NXAGENT_SERVER
+
+ nxagentPictureCreateDefaultFormats(pScreen, formats, &nformats);
+
+#else
+
/* formats required by protocol */
formats[nformats].format = PICT_a1;
formats[nformats].depth = 1;
@@ -254,6 +304,7 @@
if (!depth)
continue;
bpp = BitsPerPixel (depth);
+
switch (pVisual->class) {
case DirectColor:
case TrueColor:
@@ -296,6 +347,7 @@
break;
}
}
+
/*
* Walk supported depths and add useful Direct formats
*/
@@ -304,16 +356,18 @@
pDepth = &pScreen->allowedDepths[d];
bpp = BitsPerPixel (pDepth->depth);
format = 0;
+
switch (bpp) {
case 16:
/* depth 12 formats */
- if (pDepth->depth >= 12)
- {
- nformats = addFormat (formats, nformats,
- PICT_x4r4g4b4, pDepth->depth);
- nformats = addFormat (formats, nformats,
- PICT_x4b4g4r4, pDepth->depth);
- }
+ if (pDepth->depth >= 12)
+ {
+ nformats = addFormat (formats, nformats,
+ PICT_x4r4g4b4, pDepth->depth);
+ nformats = addFormat (formats, nformats,
+ PICT_x4b4g4r4, pDepth->depth);
+ }
+
/* depth 15 formats */
if (pDepth->depth >= 15)
{
@@ -325,18 +379,18 @@
/* depth 16 formats */
if (pDepth->depth >= 16)
{
- nformats = addFormat (formats, nformats,
- PICT_a1r5g5b5, pDepth->depth);
- nformats = addFormat (formats, nformats,
- PICT_a1b5g5r5, pDepth->depth);
+ nformats = addFormat (formats, nformats,
+ PICT_a1r5g5b5, pDepth->depth);
+ nformats = addFormat (formats, nformats,
+ PICT_a1b5g5r5, pDepth->depth);
nformats = addFormat (formats, nformats,
PICT_r5g6b5, pDepth->depth);
nformats = addFormat (formats, nformats,
PICT_b5g6r5, pDepth->depth);
nformats = addFormat (formats, nformats,
PICT_a4r4g4b4, pDepth->depth);
- nformats = addFormat (formats, nformats,
- PICT_a4b4g4r4, pDepth->depth);
+ nformats = addFormat (formats, nformats,
+ PICT_a4b4g4r4, pDepth->depth);
}
break;
case 24:
@@ -359,7 +413,8 @@
break;
}
}
-
+
+#endif
pFormats = (PictFormatPtr) xalloc (nformats * sizeof (PictFormatRec));
if (!pFormats)
@@ -368,9 +423,9 @@
for (f = 0; f < nformats; f++)
{
pFormats[f].id = FakeClientID (0);
- pFormats[f].depth = formats[f].depth;
- format = formats[f].format;
- pFormats[f].format = format;
+ pFormats[f].depth = formats[f].depth;
+ format = formats[f].format;
+ pFormats[f].format = format;
switch (PICT_FORMAT_TYPE(format)) {
case PICT_TYPE_ARGB:
pFormats[f].type = PictTypeDirect;
@@ -427,6 +482,29 @@
pFormats[f].index.vid = pScreen->visuals[PICT_FORMAT_VIS(format)].vid;
break;
}
+
+#ifdef NXAGENT_SERVER
+ if (nxagentMatchingFormats(&pFormats[f]) != NULL)
+ {
+ #ifdef DEBUG
+ fprintf(stderr, "PictureCreateDefaultFormats: Format with type [%d] depth [%d] rgb [%d,%d,%d] "
+ "mask rgb [%d,%d,%d] alpha [%d] alpha mask [%d] matches.\n",
+ pFormats[f].type, pFormats[f].depth, pFormats[f].direct.red, pFormats[f].direct.green,
+ pFormats[f].direct.blue, pFormats[f].direct.redMask, pFormats[f].direct.greenMask,
+ pFormats[f].direct.blueMask, pFormats[f].direct.alpha, pFormats[f].direct.alphaMask);
+ #endif
+ }
+ else
+ {
+ #ifdef DEBUG
+ fprintf(stderr, "PictureCreateDefaultFormats: Format with type [%d] depth [%d] rgb [%d,%d,%d] "
+ "mask rgb [%d,%d,%d] alpha [%d] alpha mask [%d] doesn't match.\n",
+ pFormats[f].type, pFormats[f].depth, pFormats[f].direct.red, pFormats[f].direct.green,
+ pFormats[f].direct.blue, pFormats[f].direct.redMask, pFormats[f].direct.greenMask,
+ pFormats[f].direct.blueMask, pFormats[f].direct.alpha, pFormats[f].direct.alphaMask);
+ #endif
+ }
+#endif
}
*nformatp = nformats;
return pFormats;
@@ -795,9 +873,20 @@
else
ppriv->ptr = (pointer)NULL;
}
+
+ nxagentPicturePriv(pPicture) -> picture = 0;
+
return pPicture;
}
+/*
+ * Let picture always point to the virtual pixmap.
+ * For sure this is not the best way to deal with
+ * the virtual frame-buffer.
+ */
+
+#define NXAGENT_PICTURE_ALWAYS_POINTS_TO_VIRTUAL
+
PicturePtr
CreatePicture (Picture pid,
DrawablePtr pDrawable,
@@ -823,6 +912,12 @@
pPicture->format = pFormat->format | (pDrawable->bitsPerPixel << 24);
if (pDrawable->type == DRAWABLE_PIXMAP)
{
+ #ifdef NXAGENT_PICTURE_ALWAYS_POINTS_TO_VIRTUAL
+
+ pPicture->pDrawable = nxagentVirtualDrawable(pDrawable);
+
+ #endif
+
++((PixmapPtr)pDrawable)->refcnt;
pPicture->pNext = 0;
}
@@ -972,7 +1067,49 @@
static PicturePtr createSourcePicture(void)
{
PicturePtr pPicture;
- pPicture = (PicturePtr) xalloc(sizeof(PictureRec));
+
+ extern int nxagentPicturePrivateIndex;
+
+ unsigned int totalPictureSize;
+
+ DevUnion *ppriv;
+
+ char *privPictureRecAddr;
+
+ int i;
+
+ /*
+ * Compute size of entire PictureRect, plus privates.
+ */
+
+ totalPictureSize = sizeof(PictureRec) +
+ picturePrivateCount * sizeof(DevUnion) +
+ sizeof(nxagentPrivPictureRec);
+
+ pPicture = (PicturePtr) xalloc(totalPictureSize);
+
+ if (pPicture != NULL)
+ {
+ ppriv = (DevUnion *) (pPicture + 1);
+
+ for (i = 0; i < picturePrivateCount; ++i)
+ {
+ /*
+ * Other privates are inaccessible.
+ */
+
+ ppriv[i].ptr = NULL;
+ }
+
+ privPictureRecAddr = (char *) &ppriv[picturePrivateCount];
+
+ ppriv[nxagentPicturePrivateIndex].ptr = (pointer) privPictureRecAddr;
+
+ pPicture -> devPrivates = ppriv;
+
+ nxagentPicturePriv(pPicture) -> picture = 0;
+ }
+
pPicture->pDrawable = 0;
pPicture->pFormat = 0;
pPicture->pNext = 0;
@@ -1294,6 +1431,12 @@
pPixmap->refcnt++;
}
}
+
+ #ifdef DEBUG
+ fprintf(stderr, "ChangePicture: Going to call ChangePictureClip with clipType [%d] pPixmap [%p].\n",
+ clipType, (void *) pPixmap);
+ #endif
+
error = (*ps->ChangePictureClip)(pPicture, clipType,
(pointer)pPixmap, 0);
break;
@@ -1600,6 +1743,10 @@
if (--pPicture->refcnt == 0)
{
+#ifdef NXAGENT_SERVER
+ nxagentDestroyPicture(pPicture);
+#endif
+
if (pPicture->transform)
xfree (pPicture->transform);
if (!pPicture->pDrawable) {
@@ -1698,6 +1845,13 @@
ValidatePicture (pSrc);
ValidatePicture (pDst);
+
+ #ifdef TEST
+ fprintf(stderr, "CompositeGlyphs: Going to composite glyphs with "
+ "source at [%p] and destination at [%p].\n",
+ (void *) pSrc, (void *) pDst);
+ #endif
+
(*ps->Glyphs) (op, pSrc, pDst, maskFormat, xSrc, ySrc, nlist, lists, glyphs);
}
@@ -1862,3 +2016,255 @@
vector->vector[2] = xFixed1;
return TRUE;
}
+
+#ifndef True
+# define True 1
+#endif
+
+#ifndef False
+# define False 0
+#endif
+
+void nxagentReconnectPictFormat(void*, XID, void*);
+
+Bool nxagentReconnectAllPictFormat(void *p)
+{
+ PictFormatPtr formats_old, formats;
+ int nformats, nformats_old;
+ VisualPtr pVisual;
+ Bool success = True;
+ Bool matched;
+ int i, n;
+ CARD32 type, a, r, g, b;
+
+ #if defined(NXAGENT_RECONNECT_DEBUG) || defined(NXAGENT_RECONNECT_PICTFORMAT_DEBUG)
+ fprintf(stderr, "nxagentReconnectAllPictFormat\n");
+ #endif
+
+ formats_old = GetPictureScreen(nxagentDefaultScreen) -> formats;
+ nformats_old = GetPictureScreen(nxagentDefaultScreen) -> nformats;
+
+ /*
+ * TODO: We could copy PictureCreateDefaultFormats,
+ * in order not to waste ID with FakeClientID().
+ */
+ formats = PictureCreateDefaultFormats (nxagentDefaultScreen, &nformats);
+
+ if (!formats)
+ return False;
+
+ for (n = 0; n < nformats; n++)
+ {
+ if (formats[n].type == PictTypeIndexed)
+ {
+ pVisual = nxagentVisualFromID(nxagentDefaultScreen, formats[n].index.vid);
+
+ if ((pVisual->class | DynamicClass) == PseudoColor)
+ type = PICT_TYPE_COLOR;
+ else
+ type = PICT_TYPE_GRAY;
+ a = r = g = b = 0;
+ }
+ else
+ {
+ if ((formats[n].direct.redMask|
+ formats[n].direct.blueMask|
+ formats[n].direct.greenMask) == 0)
+ type = PICT_TYPE_A;
+ else if (formats[n].direct.red > formats[n].direct.blue)
+ type = PICT_TYPE_ARGB;
+ else
+ type = PICT_TYPE_ABGR;
+ a = Ones (formats[n].direct.alphaMask);
+ r = Ones (formats[n].direct.redMask);
+ g = Ones (formats[n].direct.greenMask);
+ b = Ones (formats[n].direct.blueMask);
+ }
+ formats[n].format = PICT_FORMAT(0,type,a,r,g,b);
+ }
+
+ for (n = 0; n < nformats_old; n++)
+ {
+ for (i = 0, matched = False; (!matched) && (i < nformats); i++)
+ {
+ if (formats_old[n].format == formats[i].format &&
+ formats_old[n].type == formats[i].type &&
+ formats_old[n].direct.red == formats[i].direct.red &&
+ formats_old[n].direct.green == formats[i].direct.green &&
+ formats_old[n].direct.blue == formats[i].direct.blue &&
+ formats_old[n].direct.redMask == formats[i].direct.redMask &&
+ formats_old[n].direct.greenMask == formats[i].direct.greenMask &&
+ formats_old[n].direct.blueMask == formats[i].direct.blueMask &&
+ formats_old[n].direct.alpha == formats[i].direct.alpha &&
+ formats_old[n].direct.alphaMask == formats[i].direct.alphaMask)
+ {
+ /*
+ * Regard depth 16 and 15 as were the same, if all other values match.
+ */
+
+ if ((formats_old[n].depth == formats[i].depth) ||
+ ((formats_old[n].depth == 15 || formats_old[n].depth == 16) &&
+ (formats[i].depth == 15 || formats[i].depth == 16)))
+ {
+ matched = True;
+ }
+ }
+ }
+
+ if (!matched)
+ {
+ return False;
+ }
+ }
+
+ xfree(formats);
+
+ /* TODO: Perhaps do i have to do PictureFinishInit ?. */
+ /* TODO: We have to check for new Render protocol version. */
+
+ for (i = 0; (i < MAXCLIENTS) && (success); i++)
+ {
+ if (clients[i])
+ {
+ FindClientResourcesByType(clients[i], PictFormatType, nxagentReconnectPictFormat, &success);
+ }
+ }
+
+ return success;
+}
+
+/*
+ * It seem we don't have nothing
+ * to do for reconnect PictureFormat.
+ */
+
+void nxagentReconnectPictFormat(void *p0, XID x1, void *p2)
+{
+ PictFormatPtr pFormat;
+ Bool *pBool;
+
+ pFormat = (PictFormatPtr)p0;
+ pBool = (Bool*)p2;
+
+ #if defined(NXAGENT_RECONNECT_DEBUG) || defined(NXAGENT_RECONNECT_PICTFORMAT_DEBUG)
+ fprintf(stderr, "nxagentReconnectPictFormat.\n");
+ #endif
+}
+
+/*
+ * The set of picture formats may change considerably
+ * between different X servers. This poses a problem
+ * while migrating NX sessions, because a requisite to
+ * successfully reconnect the session is that all pic-
+ * ture formats have to be available on the new X server.
+ * To reduce such problems, we use a limited set of
+ * pictures available on the most X servers.
+ */
+
+void nxagentPictureCreateDefaultFormats(ScreenPtr pScreen, FormatInitRec *formats, int *nformats)
+{
+ DepthPtr pDepth;
+ VisualPtr pVisual;
+
+ CARD32 format;
+ CARD8 depth;
+
+ int r, g, b;
+ int bpp;
+ int d;
+ int v;
+
+
+ formats[*nformats].format = PICT_a1;
+ formats[*nformats].depth = 1;
+ *nformats += 1;
+ formats[*nformats].format = PICT_a4;
+ formats[*nformats].depth = 4;
+ *nformats += 1;
+ formats[*nformats].format = PICT_a8;
+ formats[*nformats].depth = 8;
+ *nformats += 1;
+ formats[*nformats].format = PICT_a8r8g8b8;
+ formats[*nformats].depth = 32;
+ *nformats += 1;
+
+ /*
+ * This format should be required by the
+ * protocol, but it's not used by Xgl.
+ *
+ * formats[*nformats].format = PICT_x8r8g8b8;
+ * formats[*nformats].depth = 32;
+ * *nformats += 1;
+ */
+
+ /* now look through the depths and visuals adding other formats */
+ for (v = 0; v < pScreen->numVisuals; v++)
+ {
+ pVisual = &pScreen->visuals[v];
+ depth = visualDepth (pScreen, pVisual);
+ if (!depth)
+ continue;
+
+ bpp = BitsPerPixel (depth);
+
+ switch (pVisual->class)
+ {
+ case DirectColor:
+ case TrueColor:
+ r = Ones (pVisual->redMask);
+ g = Ones (pVisual->greenMask);
+ b = Ones (pVisual->blueMask);
+
+ if (pVisual->offsetBlue == 0 &&
+ pVisual->offsetGreen == b &&
+ pVisual->offsetRed == b + g)
+ {
+ format = PICT_FORMAT(bpp, PICT_TYPE_ARGB, 0, r, g, b);
+ *nformats = addFormat (formats, *nformats, format, depth);
+ }
+ break;
+ case StaticColor:
+ case PseudoColor:
+ case StaticGray:
+ case GrayScale:
+ break;
+ }
+ }
+
+ for (d = 0; d < pScreen -> numDepths; d++)
+ {
+ pDepth = &pScreen -> allowedDepths[d];
+ bpp = BitsPerPixel(pDepth -> depth);
+
+ switch (bpp) {
+ case 16:
+ if (pDepth->depth == 15)
+ {
+ *nformats = addFormat (formats, *nformats,
+ PICT_x1r5g5b5, pDepth->depth);
+ }
+
+ if (pDepth->depth == 16)
+ {
+ *nformats = addFormat (formats, *nformats,
+ PICT_r5g6b5, pDepth->depth);
+ }
+ break;
+ case 24:
+ if (pDepth->depth == 24)
+ {
+ *nformats = addFormat (formats, *nformats,
+ PICT_r8g8b8, pDepth->depth);
+ }
+ break;
+ case 32:
+ if (pDepth->depth == 24)
+ {
+ *nformats = addFormat (formats, *nformats,
+ PICT_x8r8g8b8, pDepth->depth);
+ }
+ break;
+ }
+ }
+}
+

View File

@@ -0,0 +1,42 @@
--- ./nx-X11/programs/Xserver/hw/nxagent/X/NXpicturestr.h.X.original 2015-02-13 14:03:44.744441510 +0100
+++ ./nx-X11/programs/Xserver/hw/nxagent/X/NXpicturestr.h 2015-02-13 14:03:44.744441510 +0100
@@ -1,3 +1,20 @@
+/**************************************************************************/
+/* */
+/* Copyright (c) 2001, 2011 NoMachine, http://www.nomachine.com/. */
+/* */
+/* NXAGENT, NX protocol compression and NX extensions to this software */
+/* are copyright of NoMachine. Redistribution and use of the present */
+/* software is allowed according to terms specified in the file LICENSE */
+/* which comes in the source distribution. */
+/* */
+/* Check http://www.nomachine.com/licensing.html for applicability. */
+/* */
+/* NX and NoMachine are trademarks of Medialogic S.p.A. */
+/* */
+/* All rights reserved. */
+/* */
+/**************************************************************************/
+
/*
* $Id: picturestr.h,v 1.15 2005/12/09 18:35:21 ajax Exp $
*
@@ -23,10 +40,17 @@
* Author: Keith Packard, SuSE, Inc.
*/
+/*
+ * This must keep the same symbol as the original
+ * picturestr.h or symbols will be redefined. We
+ * should define a new types and cast when appro-
+ * priate.
+ */
+
#ifndef _PICTURESTR_H_
#define _PICTURESTR_H_
-#include "glyphstr.h"
+#include "NXglyphstr.h"
#include "scrnintstr.h"
#include "resource.h"

View File

@@ -0,0 +1,358 @@
--- ./nx-X11/programs/Xserver/hw/nxagent/X/NXproperty.c.X.original 2015-02-13 14:03:44.744441510 +0100
+++ ./nx-X11/programs/Xserver/hw/nxagent/X/NXproperty.c 2015-02-10 19:13:13.772687085 +0100
@@ -1,3 +1,20 @@
+/**************************************************************************/
+/* */
+/* Copyright (c) 2001, 2011 NoMachine, http://www.nomachine.com/. */
+/* */
+/* NXAGENT, NX protocol compression and NX extensions to this software */
+/* are copyright of NoMachine. Redistribution and use of the present */
+/* software is allowed according to terms specified in the file LICENSE */
+/* which comes in the source distribution. */
+/* */
+/* Check http://www.nomachine.com/licensing.html for applicability. */
+/* */
+/* NX and NoMachine are trademarks of Medialogic S.p.A. */
+/* */
+/* All rights reserved. */
+/* */
+/**************************************************************************/
+
/* $XFree86: xc/programs/Xserver/dix/property.c,v 3.12 2002/02/19 11:09:22 alanh Exp $ */
/***********************************************************
@@ -58,7 +75,7 @@
#include "windowstr.h"
#include "propertyst.h"
#include "dixstruct.h"
-#include "dispatch.h"
+#include "../../dix/dispatch.h"
#include "swaprep.h"
#ifdef XCSECURITY
#define _SECURITY_SERVER
@@ -69,6 +86,11 @@
#include "lbxtags.h"
#endif
+#include "Options.h"
+#include "Rootless.h"
+#include "Client.h"
+#include "Windows.h"
+
#if defined(LBX) || defined(LBX_COMPAT)
#if 0 /* no header in X11 environment, not used in X11 environment */
int fWriteToClient(ClientPtr client, int len, char *buf)
@@ -78,6 +100,17 @@
#endif
#endif
+extern Atom clientCutProperty;
+
+#ifdef NXAGENT_SERVER
+typedef struct
+{
+ CARD32 state;
+ Window icon;
+}
+nxagentWMStateRec;
+#endif
+
/*****************************************************************
* Property Stuff
*
@@ -234,6 +267,15 @@
totalSize = len * sizeInBytes;
REQUEST_FIXED_SIZE(xChangePropertyReq, totalSize);
+#ifdef NXAGENT_CLIPBOARD
+ {
+ extern WindowPtr nxagentGetClipboardWindow(Atom, WindowPtr);
+
+ pWin = nxagentGetClipboardWindow(stuff->property, NULL);
+ }
+
+ if (pWin == NULL)
+#endif
pWin = (WindowPtr)SecurityLookupWindow(stuff->window, client,
SecurityWriteAccess);
if (!pWin)
@@ -261,6 +303,18 @@
}
#endif
+#ifdef NXAGENT_ARTSD
+ {
+ /* Do not process MCOPGLOBALS property changes,
+ they are already set reflecting the server side settings.
+ Just return success.
+ */
+ extern Atom mcop_local_atom;
+ if (stuff->property == mcop_local_atom)
+ return client->noClientException;
+ }
+#endif
+
#ifdef LBX
err = LbxChangeWindowProperty(client, pWin, stuff->property, stuff->type,
(int)format, (int)mode, len, TRUE, (pointer)&stuff[1], TRUE, NULL);
@@ -271,7 +325,23 @@
if (err != Success)
return err;
else
- return client->noClientException;
+ {
+ if (nxagentOption(Rootless) == 1)
+ {
+ nxagentExportProperty(pWin, stuff->property, stuff->type, (int) format,
+ (int) mode, len, (pointer) &stuff[1]);
+ }
+
+ nxagentGuessClientHint(client, stuff->property, (char *) &stuff[1]);
+
+ nxagentGuessShadowHint(client, stuff->property);
+
+ #ifdef NX_DEBUG_INPUT
+ nxagentGuessDumpInputInfo(client, stuff->property, (char *) &stuff[1]);
+ #endif
+
+ return client->noClientException;
+ }
}
int
@@ -289,10 +359,23 @@
int sizeInBytes;
int totalSize;
pointer data;
+ int copySize;
sizeInBytes = format>>3;
totalSize = len * sizeInBytes;
+ copySize = nxagentOption(CopyBufferSize);
+
+ if (copySize != COPY_UNLIMITED && property == clientCutProperty)
+ {
+ if (totalSize > copySize)
+ {
+ totalSize = copySize;
+ totalSize = totalSize - (totalSize % sizeInBytes);
+ len = totalSize / sizeInBytes;
+ }
+ }
+
/* first see if property already exists */
pProp = wUserProps (pWin);
@@ -491,6 +574,11 @@
int
ProcGetProperty(ClientPtr client)
{
+ #ifdef NXAGENT_SERVER
+ nxagentWMStateRec wmState;
+ nxagentWMStateRec *wmsP = &wmState;
+ #endif
+
PropertyPtr pProp, prevProp;
unsigned long n, len, ind;
WindowPtr pWin;
@@ -498,6 +586,7 @@
REQUEST(xGetPropertyReq);
REQUEST_SIZE_MATCH(xGetPropertyReq);
+
if (stuff->delete)
UpdateCurrentTime();
pWin = (WindowPtr)SecurityLookupWindow(stuff->window, client,
@@ -533,6 +622,59 @@
reply.type = X_Reply;
reply.sequenceNumber = client->sequence;
+
+ #ifdef NXAGENT_SERVER
+
+ /*
+ * Creating a reply for WM_STATE property if it doesn't exist.
+ * This is intended to allow drag & drop work in JAva 1.6 when
+ * the agent is connected to NXWin in multiwindow mode.
+ */
+
+ if (nxagentOption(Rootless) &&
+ nxagentWindowTopLevel(pWin) &&
+ (!pProp) &&
+ strcmp(NameForAtom(stuff->property), "WM_STATE") == 0)
+ {
+ wmState.state = 1;
+ wmState.icon = None;
+
+ if (ChangeWindowProperty(pWin, stuff->property, stuff->property, 32, 0, 2, &wmState, 1) == Success)
+ {
+ nxagentExportProperty(pWin, stuff->property, stuff->property, 32, 0, 2, &wmState);
+ }
+
+ n = 8;
+ ind = stuff->longOffset << 2;
+
+ if (n < ind)
+ {
+ client->errorValue = stuff->longOffset;
+ return BadValue;
+ }
+
+ len = min(n - ind, 4 * stuff->longLength);
+
+ reply.bytesAfter = n - (ind + len);
+ reply.length = (len + 3) >> 2;
+
+ reply.format = 32;
+ reply.nItems = len / 4;
+ reply.propertyType = stuff->property;
+
+ WriteReplyToClient(client, sizeof(xGenericReply), &reply);
+
+ if (len)
+ {
+ client->pSwapReplyFunc = (ReplySwapPtr)CopySwap32Write;
+
+ WriteSwappedDataToClient(client, len, (char *)wmsP + ind);
+ }
+
+ return(client->noClientException);
+ }
+ #endif
+
if (!pProp)
return NullPropertyReply(client, None, 0, &reply);
@@ -643,6 +785,126 @@
return(client->noClientException);
}
+#ifdef NXAGENT_CLIPBOARD
+/* GetWindowProperty clipboard use only */
+int
+GetWindowProperty(pWin, property, longOffset, longLength, delete,
+ type, actualType, format, nItems, bytesAfter, propData )
+ WindowPtr pWin;
+ Atom property;
+ long longOffset;
+ long longLength;
+ Bool delete;
+ Atom type;
+ Atom *actualType;
+ int *format;
+ unsigned long *nItems;
+ unsigned long *bytesAfter;
+ unsigned char **propData;
+{
+ PropertyPtr pProp, prevProp;
+ unsigned long n, len, ind;
+
+ if (!pWin)
+ return BadWindow;
+
+
+ if (!ValidAtom(property))
+ {
+ return(BadAtom);
+ }
+ if ((type != AnyPropertyType) && !ValidAtom(type))
+ {
+ return(BadAtom);
+ }
+
+ pProp = wUserProps (pWin);
+ prevProp = (PropertyPtr)NULL;
+
+ while (pProp)
+ {
+ if (pProp->propertyName == property)
+ break;
+ prevProp = pProp;
+ pProp = pProp->next;
+ }
+
+
+ if (!pProp)
+ return (BadAtom);
+
+ /* If the request type and actual type don't match. Return the
+ property information, but not the data. */
+
+ if (((type != pProp->type) &&
+ (type != AnyPropertyType))
+ )
+ {
+ *bytesAfter = pProp->size;
+ *format = pProp->format;
+ *nItems = 0;
+ *actualType = pProp->type;
+ return(Success);
+ }
+
+/*
+ * Return type, format, value to client
+ */
+ n = (pProp->format/8) * pProp->size; /* size (bytes) of prop */
+ ind = longOffset << 2;
+
+ /* If longOffset is invalid such that it causes "len" to
+ be negative, it's a value error. */
+
+ if (n < ind)
+ {
+ return BadValue;
+ }
+
+ len = min(n - ind, 4 * longLength);
+
+ *bytesAfter = n - (ind + len);
+ *format = pProp->format;
+ *nItems = len / (pProp->format / 8 );
+ *actualType = pProp->type;
+
+ if (delete && (*bytesAfter == 0))
+ { /* send the event */
+ xEvent event;
+
+ event.u.u.type = PropertyNotify;
+ event.u.property.window = pWin->drawable.id;
+ event.u.property.state = PropertyDelete;
+ event.u.property.atom = pProp->propertyName;
+ event.u.property.time = currentTime.milliseconds;
+ DeliverEvents(pWin, &event, 1, (WindowPtr)NULL);
+ }
+
+ if (len)
+ {
+ *propData = (unsigned char *)(pProp->data) + ind;
+ }
+
+ if (delete && (*bytesAfter == 0))
+ { /* delete the Property */
+#ifdef LBX
+ if (pProp->tag_id)
+ TagDeleteTag(pProp->tag_id);
+#endif
+ if (prevProp == (PropertyPtr)NULL) /* takes care of head */
+ {
+ if (!(pWin->optional->userProps = pProp->next))
+ CheckWindowOptionalNeed (pWin);
+ }
+ else
+ prevProp->next = pProp->next;
+ xfree(pProp->data);
+ xfree(pProp);
+ }
+ return(Success);
+}
+#endif
+
int
ProcListProperties(ClientPtr client)
{
@@ -727,3 +989,4 @@
else
return(result);
}
+

View File

@@ -0,0 +1,948 @@
--- ./nx-X11/programs/Xserver/hw/nxagent/X/NXrender.c.X.original 2015-02-13 14:03:44.748441432 +0100
+++ ./nx-X11/programs/Xserver/hw/nxagent/X/NXrender.c 2015-02-10 19:13:13.800686036 +0100
@@ -24,6 +24,23 @@
* Author: Keith Packard, SuSE, Inc.
*/
+/**************************************************************************/
+/* */
+/* Copyright (c) 2001, 2011 NoMachine, http://www.nomachine.com/. */
+/* */
+/* NXAGENT, NX protocol compression and NX extensions to this software */
+/* are copyright of NoMachine. Redistribution and use of the present */
+/* software is allowed according to terms specified in the file LICENSE */
+/* which comes in the source distribution. */
+/* */
+/* Check http://www.nomachine.com/licensing.html for applicability. */
+/* */
+/* NX and NoMachine are trademarks of Medialogic S.p.A. */
+/* */
+/* All rights reserved. */
+/* */
+/**************************************************************************/
+
#define NEED_REPLIES
#define NEED_EVENTS
#ifdef HAVE_DIX_CONFIG_H
@@ -44,8 +61,6 @@
#include "servermd.h"
#include <X11/extensions/render.h>
#include <X11/extensions/renderproto.h>
-#include "picturestr.h"
-#include "glyphstr.h"
#include <X11/Xfuncproto.h>
#include "cursorstr.h"
#ifdef EXTMODULE
@@ -56,6 +71,95 @@
#define UINT32_MAX 0xffffffffU
#endif
+#include "NXpicturestr.h"
+#include "NXglyphstr.h"
+
+#include "Trap.h"
+
+#include "Render.h"
+#include "Pixmaps.h"
+#include "Options.h"
+#include "Screen.h"
+#include "Cursor.h"
+
+/*
+ * Set here the required log level.
+ */
+
+#define PANIC
+#define WARNING
+#undef TEST
+#undef DEBUG
+
+#ifdef TEST
+#include "Literals.h"
+#endif
+
+/*
+ * From NXmiglyph.c.
+ */
+
+void miGlyphExtents(int nlist, GlyphListPtr list,
+ GlyphPtr *glyphs, BoxPtr extents);
+
+/*
+ * From NXmitrap.c.
+ */
+
+void miTrapezoidBounds (int ntrap, xTrapezoid *traps, BoxPtr box);
+
+/*
+ * Functions from Render.c.
+ */
+
+int nxagentCursorSaveRenderInfo(ScreenPtr, CursorPtr);
+void nxagentCursorPostSaveRenderInfo(CursorPtr, ScreenPtr, PicturePtr, int, int);
+int nxagentRenderRealizeCursor(ScreenPtr, CursorPtr);
+int nxagentCreatePicture(PicturePtr, Mask);
+void nxagentChangePicture(PicturePtr, Mask);
+int nxagentChangePictureClip(PicturePtr, int, int, xRectangle *, int, int);
+void nxagentComposite(CARD8, PicturePtr, PicturePtr, PicturePtr, INT16, INT16,
+ INT16, INT16, INT16, INT16, CARD16, CARD16);
+void nxagentCompositeRects(CARD8, PicturePtr, xRenderColor *, int, xRectangle *);
+void nxagentCreateGlyphSet(GlyphSetPtr glyphSet);
+void nxagentReferenceGlyphSet(GlyphSetPtr glyphSet);
+void nxagentFreeGlyphs(GlyphSetPtr glyphSet, CARD32 *gids, int nglyph);
+void nxagentFreeGlyphSet(GlyphSetPtr glyphSet);
+void nxagentSetPictureTransform(PicturePtr pPicture, pointer transform);
+void nxagentSetPictureFilter(PicturePtr pPicture, char *filter, int name_size,
+ pointer params, int nparams);
+void nxagentTrapezoids(CARD8 op, PicturePtr pSrc, PicturePtr pDst, PictFormatPtr maskFormat,
+ INT16 xSrc, INT16 ySrc, int ntrap, xTrapezoid *traps);
+
+void nxagentRenderCreateSolidFill(PicturePtr pPicture, xRenderColor *color);
+
+void nxagentRenderCreateLinearGradient(PicturePtr pPicture, xPointFixed *p1,
+ xPointFixed *p2, int nStops,
+ xFixed *stops,
+ xRenderColor *colors);
+
+void nxagentRenderCreateRadialGradient(PicturePtr pPicture, xPointFixed *inner,
+ xPointFixed *outer,
+ xFixed innerRadius,
+ xFixed outerRadius,
+ int nStops,
+ xFixed *stops,
+ xRenderColor *colors);
+
+void nxagentRenderCreateConicalGradient(PicturePtr pPicture,
+ xPointFixed *center,
+ xFixed angle, int nStops,
+ xFixed *stops,
+ xRenderColor *colors);
+
+
+/*
+ * The void pointer is actually a XGlyphElt8.
+ */
+
+void nxagentGlyphs(CARD8, PicturePtr, PicturePtr, PictFormatPtr,
+ INT16, INT16, int, void *, int, GlyphPtr *);
+
static int ProcRenderQueryVersion (ClientPtr pClient);
static int ProcRenderQueryPictFormats (ClientPtr pClient);
static int ProcRenderQueryPictIndexValues (ClientPtr pClient);
@@ -290,8 +394,8 @@
rep.type = X_Reply;
rep.length = 0;
rep.sequenceNumber = client->sequence;
- rep.majorVersion = RENDER_MAJOR;
- rep.minorVersion = RENDER_MINOR;
+ rep.majorVersion = nxagentRenderVersionMajor;
+ rep.minorVersion = nxagentRenderVersionMinor;
if (client->swapped) {
swaps(&rep.sequenceNumber, n);
swapl(&rep.length, n);
@@ -363,6 +467,8 @@
int n;
int numScreens;
int numSubpixel;
+
+ extern int nxagentAlphaEnabled;
/* REQUEST(xRenderQueryPictFormatsReq); */
REQUEST_SIZE_MATCH(xRenderQueryPictFormatsReq);
@@ -439,7 +545,7 @@
pictForm->direct.greenMask = pFormat->direct.greenMask;
pictForm->direct.blue = pFormat->direct.blue;
pictForm->direct.blueMask = pFormat->direct.blueMask;
- pictForm->direct.alpha = pFormat->direct.alpha;
+ pictForm->direct.alpha = nxagentAlphaEnabled ? pFormat->direct.alpha : 0;
pictForm->direct.alphaMask = pFormat->direct.alphaMask;
if (pFormat->type == PictTypeIndexed && pFormat->index.pColormap)
pictForm->colormap = pFormat->index.pColormap->mid;
@@ -656,6 +762,8 @@
&error);
if (!pPicture)
return error;
+ nxagentCreatePicture(pPicture, stuff -> mask);
+
if (!AddResource (stuff->pid, PictureType, (pointer)pPicture))
return BadAlloc;
return Success;
@@ -667,6 +775,7 @@
PicturePtr pPicture;
REQUEST(xRenderChangePictureReq);
int len;
+ int error;
REQUEST_AT_LEAST_SIZE(xRenderChangePictureReq);
VERIFY_PICTURE (pPicture, stuff->picture, client, SecurityWriteAccess,
@@ -676,8 +785,12 @@
if (Ones(stuff->mask) != len)
return BadLength;
- return ChangePicture (pPicture, stuff->mask, (XID *) (stuff + 1),
+ error = ChangePicture (pPicture, stuff->mask, (XID *) (stuff + 1),
(DevUnion *) 0, client);
+
+ nxagentChangePicture(pPicture, stuff->mask);
+
+ return error;
}
static int
@@ -694,13 +807,26 @@
if (!pPicture->pDrawable)
return BadDrawable;
- nr = (client->req_len << 2) - sizeof(xRenderChangePictureReq);
+ /*
+ * The original code used sizeof(xRenderChangePictureReq).
+ * This was harmless, as both structures have the same size.
+ *
+ * nr = (client->req_len << 2) - sizeof(xRenderChangePictureReq);
+ */
+ nr = (client->req_len << 2) - sizeof(xRenderSetPictureClipRectanglesReq);
if (nr & 4)
return BadLength;
nr >>= 3;
result = SetPictureClipRects (pPicture,
stuff->xOrigin, stuff->yOrigin,
nr, (xRectangle *) &stuff[1]);
+ nxagentChangePictureClip (pPicture,
+ CT_NONE,
+ nr,
+ (xRectangle *) &stuff[1],
+ (int)stuff -> xOrigin,
+ (int)stuff -> yOrigin);
+
if (client->noClientException != Success)
return(client->noClientException);
else
@@ -717,6 +843,7 @@
VERIFY_PICTURE (pPicture, stuff->picture, client, SecurityDestroyAccess,
RenderErrBase + BadPicture);
+
FreeResource (stuff->picture, RT_NONE);
return(client->noClientException);
}
@@ -733,6 +860,71 @@
return FALSE;
}
+/*
+ * Check if both pictures have drawables which are
+ * virtual pixmaps. See the corresponding define
+ * in NXpicture.c
+ */
+
+#define NXAGENT_PICTURE_ALWAYS_POINTS_TO_VIRTUAL
+
+#ifdef NXAGENT_PICTURE_ALWAYS_POINTS_TO_VIRTUAL
+
+#define nxagentCompositePredicate(pSrc, pDst) TRUE
+
+#else
+
+/*
+ * This is still under development. The final
+ * goal is to let pictures point to the real
+ * pixmaps instead of pointing to virtuals.
+ */
+
+int nxagentCompositePredicate(PicturePtr pSrc, PicturePtr pDst)
+{
+ PixmapPtr pPixmap1;
+ PixmapPtr pPixmap2;
+
+ pPixmap1 = (pSrc -> pDrawable -> type == DRAWABLE_PIXMAP ?
+ ((PixmapPtr) pSrc -> pDrawable) : NULL);
+
+ pPixmap2 = (pDst -> pDrawable -> type == DRAWABLE_PIXMAP ?
+ ((PixmapPtr) pDst -> pDrawable) : NULL);
+
+ if (pPixmap1 == NULL || pPixmap2 == NULL)
+ {
+ #ifdef TEST
+ fprintf(stderr, "nxagentCompositePredicate: Case 0.\n");
+ #endif
+
+ return FALSE;
+ }
+ else
+ {
+ #ifdef TEST
+ fprintf(stderr, "nxagentCompositePredicate: Case 1.\n");
+ #endif
+
+ if (nxagentPixmapIsVirtual(pPixmap1) == 1 &&
+ nxagentPixmapIsVirtual(pPixmap2) == 1)
+ {
+ #ifdef TEST
+ fprintf(stderr, "nxagentCompositePredicate: Case 2.\n");
+ #endif
+
+ return TRUE;
+ }
+ }
+
+ #ifdef TEST
+ fprintf(stderr, "nxagentCompositePredicate: Case 3.\n");
+ #endif
+
+ return FALSE;
+}
+
+#endif
+
static int
ProcRenderComposite (ClientPtr client)
{
@@ -753,9 +945,32 @@
RenderErrBase + BadPicture);
VERIFY_ALPHA (pMask, stuff->mask, client, SecurityReadAccess,
RenderErrBase + BadPicture);
+/*
+FIXME: Imported change from newest version of Xorg. Changed pSrc to pDst.
+
if ((pSrc->pDrawable && pSrc->pDrawable->pScreen != pDst->pDrawable->pScreen) ||
(pMask && pMask->pDrawable && pSrc->pDrawable->pScreen != pMask->pDrawable->pScreen))
return BadMatch;
+*/
+ if ((pSrc->pDrawable && pSrc->pDrawable->pScreen != pDst->pDrawable->pScreen) ||
+ (pMask && pMask->pDrawable && pDst->pDrawable->pScreen != pMask->pDrawable->pScreen))
+ return BadMatch;
+
+ ValidatePicture (pSrc);
+ if (pMask)
+ ValidatePicture (pMask);
+ ValidatePicture (pDst);
+
+ #ifdef NXAGENT_PICTURE_ALWAYS_POINTS_TO_VIRTUAL
+
+ if (nxagentCompositePredicate(pSrc, pDst))
+ {
+ #ifdef TEST
+ fprintf(stderr, "ProcRenderComposite: Going to composite with "
+ "source at [%p] mask at [%p] and destination at [%p].\n",
+ (void *) pSrc, (void *) pMask, (void *) pDst);
+ #endif
+
CompositePicture (stuff->op,
pSrc,
pMask,
@@ -768,6 +983,78 @@
stuff->yDst,
stuff->width,
stuff->height);
+ }
+
+ #else
+
+ if (pSrc -> pDrawable -> type == DRAWABLE_PIXMAP &&
+ pDst -> pDrawable -> type == DRAWABLE_PIXMAP &&
+ (!pMask || pMask -> pDrawable -> type == DRAWABLE_PIXMAP))
+ {
+ PixmapPtr pVirtualPixmapSrc;
+ PixmapPtr pVirtualPixmapDst;
+ PixmapPtr pVirtualPixmapMask;
+
+ PicturePtr pVirtualPictureSrc;
+ PicturePtr pVirtualPictureDst;
+ PicturePtr pVirtualPictureMask;
+
+ pVirtualPixmapSrc = (PixmapPtr) pSrc -> pDrawable;
+ pVirtualPictureSrc = nxagentPixmapPriv(pVirtualPixmapSrc) -> pPicture;
+
+ pVirtualPixmapDst = (PixmapPtr) pDst -> pDrawable;
+ pVirtualPictureDst = nxagentPixmapPriv(pVirtualPixmapDst) -> pPicture;
+
+ if (pMask)
+ {
+ pVirtualPixmapMask = (PixmapPtr) pMask -> pDrawable;
+ pVirtualPictureMask = nxagentPixmapPriv(pVirtualPixmapMask) -> pPicture;
+ }
+ else
+ {
+ pVirtualPixmapMask = NULL;
+ pVirtualPictureMask = NULL;
+ }
+
+ if (pVirtualPictureSrc && pVirtualPictureDst)
+ {
+ #ifdef TEST
+ fprintf(stderr, "ProcRenderComposite: Going to composite with "
+ "source at [%p] mask at [%p] and destination at [%p].\n",
+ (void *) pVirtualPixmapSrc, (void *) pVirtualPixmapMask,
+ (void *) pVirtualPixmapDst);
+ #endif
+
+ CompositePicture (stuff->op,
+ pVirtualPictureSrc,
+ pVirtualPictureMask,
+ pVirtualPictureDst,
+ stuff->xSrc,
+ stuff->ySrc,
+ stuff->xMask,
+ stuff->yMask,
+ stuff->xDst,
+ stuff->yDst,
+ stuff->width,
+ stuff->height);
+ }
+ }
+
+ #endif
+
+ nxagentComposite (stuff -> op,
+ pSrc,
+ pMask,
+ pDst,
+ stuff -> xSrc,
+ stuff -> ySrc,
+ stuff -> xMask,
+ stuff -> yMask,
+ stuff -> xDst,
+ stuff -> yDst,
+ stuff -> width,
+ stuff -> height);
+
return Success;
}
@@ -818,9 +1105,33 @@
return BadLength;
ntraps /= sizeof (xTrapezoid);
if (ntraps)
+ {
+ if (pFormat != NULL)
+ {
+ nxagentTrapezoidExtents = (BoxPtr) xalloc(sizeof(BoxRec));
+
+ miTrapezoidBounds (ntraps, (xTrapezoid *) &stuff[1], nxagentTrapezoidExtents);
+ }
+
+ if (nxagentCompositePredicate(pSrc, pDst) == 1)
+ {
CompositeTrapezoids (stuff->op, pSrc, pDst, pFormat,
stuff->xSrc, stuff->ySrc,
ntraps, (xTrapezoid *) &stuff[1]);
+ }
+
+ nxagentTrapezoids (stuff->op, pSrc, pDst, pFormat,
+ stuff->xSrc, stuff->ySrc,
+ ntraps, (xTrapezoid *) &stuff[1]);
+
+ if (nxagentTrapezoidExtents != NullBox)
+ {
+ xfree(nxagentTrapezoidExtents);
+
+ nxagentTrapezoidExtents = NullBox;
+ }
+ }
+
return client->noClientException;
}
@@ -1029,6 +1340,9 @@
return BadAlloc;
if (!AddResource (stuff->gsid, GlyphSetType, (pointer)glyphSet))
return BadAlloc;
+
+ nxagentCreateGlyphSet(glyphSet);
+
return Success;
}
@@ -1052,6 +1366,9 @@
return RenderErrBase + BadGlyphSet;
}
glyphSet->refcnt++;
+
+ nxagentReferenceGlyphSet(glyphSet);
+
if (!AddResource (stuff->gsid, GlyphSetType, (pointer)glyphSet))
return BadAlloc;
return client->noClientException;
@@ -1076,6 +1393,9 @@
client->errorValue = stuff->glyphset;
return RenderErrBase + BadGlyphSet;
}
+
+ nxagentFreeGlyphSet(glyphSet);
+
FreeResource (stuff->glyphset, RT_NONE);
return client->noClientException;
}
@@ -1092,7 +1412,7 @@
REQUEST(xRenderAddGlyphsReq);
GlyphNewRec glyphsLocal[NLOCALGLYPH];
GlyphNewPtr glyphsBase, glyphs;
- GlyphPtr glyph;
+ GlyphPtr glyph = NULL;
int remain, nglyphs;
CARD32 *gids;
xGlyphInfo *gi;
@@ -1100,6 +1420,8 @@
int size;
int err = BadAlloc;
+ int totSizeImages;
+
REQUEST_AT_LEAST_SIZE(xRenderAddGlyphsReq);
glyphSet = (GlyphSetPtr) SecurityLookupIDByType (client,
stuff->glyphset,
@@ -1128,10 +1450,12 @@
glyphs = glyphsBase;
+ totSizeImages = 0;
gids = (CARD32 *) (stuff + 1);
gi = (xGlyphInfo *) (gids + nglyphs);
bits = (CARD8 *) (gi + nglyphs);
remain -= (sizeof (CARD32) + sizeof (xGlyphInfo)) * nglyphs;
+
while (remain >= 0 && nglyphs)
{
glyph = AllocateGlyph (gi, glyphSet->fdepth);
@@ -1152,12 +1476,14 @@
if (size & 3)
size += 4 - (size & 3);
bits += size;
+ totSizeImages += size;
remain -= size;
gi++;
gids++;
glyphs++;
nglyphs--;
}
+
if (nglyphs || remain)
{
err = BadLength;
@@ -1216,6 +1542,9 @@
}
nglyph = ((client->req_len << 2) - sizeof (xRenderFreeGlyphsReq)) >> 2;
gids = (CARD32 *) (stuff + 1);
+
+ nxagentFreeGlyphs(glyphSet, gids, nglyph);
+
while (nglyph-- > 0)
{
glyph = *gids++;
@@ -1228,6 +1557,14 @@
return client->noClientException;
}
+typedef struct XGlyphElt8{
+ GlyphSet glyphset;
+ _Xconst char *chars;
+ int nchars;
+ int xOff;
+ int yOff;
+} XGlyphElt8;
+
static int
ProcRenderCompositeGlyphs (ClientPtr client)
{
@@ -1248,6 +1585,8 @@
int size;
int n;
+ XGlyphElt8 *elements, *elementsBase;
+
REQUEST(xRenderCompositeGlyphsReq);
REQUEST_AT_LEAST_SIZE(xRenderCompositeGlyphsReq);
@@ -1335,9 +1674,15 @@
if (!listsBase)
return BadAlloc;
}
+
+ elementsBase = xalloc(nlist * sizeof(XGlyphElt8));
+ if (!elementsBase)
+ return BadAlloc;
+
buffer = (CARD8 *) (stuff + 1);
glyphs = glyphsBase;
lists = listsBase;
+ elements = elementsBase;
while (buffer + sizeof (xGlyphElt) < end)
{
elt = (xGlyphElt *) buffer;
@@ -1345,6 +1690,11 @@
if (elt->len == 0xff)
{
+ #ifdef DEBUG
+ fprintf(stderr, "ProcRenderCompositeGlyphs: Glyphset change with base size [%d].\n",
+ size);
+ #endif
+
if (buffer + sizeof (GlyphSet) < end)
{
memcpy(&gs, buffer, sizeof(GlyphSet));
@@ -1370,6 +1720,22 @@
lists->yOff = elt->deltay;
lists->format = glyphSet->format;
lists->len = 0;
+
+ if (glyphSet -> remoteID == 0)
+ {
+ #ifdef TEST
+ fprintf(stderr, "ProcRenderCompositeGlyphs: Going to reconnect glyphset at [%p].\n",
+ (void *) glyphSet);
+ #endif
+
+ nxagentReconnectGlyphSet(glyphSet, (XID) 0, (void*) NULL);
+ }
+
+ elements -> glyphset = glyphSet -> remoteID;
+ elements -> chars = (char *) buffer;
+ elements -> nchars = elt->len;
+ elements -> xOff = elt->deltax;
+ elements -> yOff = elt->deltay;
n = elt->len;
while (n--)
{
@@ -1396,26 +1762,65 @@
if (space & 3)
buffer += 4 - (space & 3);
lists++;
+ elements++;
}
}
if (buffer > end)
return BadLength;
- CompositeGlyphs (stuff->op,
- pSrc,
- pDst,
- pFormat,
- stuff->xSrc,
- stuff->ySrc,
- nlist,
- listsBase,
- glyphsBase);
+ /*
+ * We need to know the glyphs extents to synchronize
+ * the drawables involved in the composite text ope-
+ * ration. Also we need to synchronize only the back-
+ * ground of the text we are going to render, so the
+ * operations on the framebuffer must be executed
+ * after the X requests.
+ */
+
+ nxagentGlyphsExtents = (BoxPtr) xalloc(sizeof(BoxRec));
+
+ miGlyphExtents(nlist, listsBase, glyphsBase, nxagentGlyphsExtents);
+
+ nxagentGlyphs(stuff -> op,
+ pSrc,
+ pDst,
+ pFormat,
+ stuff -> xSrc,
+ stuff -> ySrc,
+ nlist,
+ elementsBase,
+ size,
+ glyphsBase);
+
+ if (nxagentCompositePredicate(pSrc, pDst) == 1)
+ {
+ #ifdef TEST
+ fprintf(stderr, "ProcRenderCompositeGlyphs: Going to composite glyphs with "
+ "source at [%p] and destination at [%p].\n",
+ (void *) pSrc, (void *) pDst);
+ #endif
+
+ CompositeGlyphs(stuff -> op,
+ pSrc,
+ pDst,
+ pFormat,
+ stuff -> xSrc,
+ stuff -> ySrc,
+ nlist,
+ listsBase,
+ glyphsBase);
+ }
+
+ xfree(nxagentGlyphsExtents);
+ nxagentGlyphsExtents = NullBox;
if (glyphsBase != glyphsLocal)
DEALLOCATE_LOCAL (glyphsBase);
if (listsBase != listsLocal)
DEALLOCATE_LOCAL (listsBase);
+ xfree(elementsBase);
+
return client->noClientException;
}
@@ -1447,6 +1852,13 @@
&stuff->color,
things,
(xRectangle *) &stuff[1]);
+
+ ValidatePicture (pDst);
+ nxagentCompositeRects(stuff -> op,
+ pDst,
+ &stuff -> color,
+ things,
+ (xRectangle *) &stuff[1]);
return client->noClientException;
}
@@ -1495,6 +1907,8 @@
CARD32 twocolor[3];
int ncolor;
+ RealizeCursorProcPtr saveRealizeCursor;
+
REQUEST_SIZE_MATCH (xRenderCreateCursorReq);
LEGAL_NEW_RESOURCE(stuff->cid, client);
@@ -1662,6 +2076,20 @@
cm.height = height;
cm.xhot = stuff->x;
cm.yhot = stuff->y;
+
+ /*
+ * This cursor uses RENDER, so we make sure
+ * that it is allocated in a way that allows
+ * the mi and dix layers to handle it but we
+ * later create it on the server by mirror-
+ * ing the RENDER operation we got from the
+ * client.
+ */
+
+ saveRealizeCursor = pScreen -> RealizeCursor;
+
+ pScreen -> RealizeCursor = nxagentCursorSaveRenderInfo;
+
pCursor = AllocCursorARGB (srcbits, mskbits, argbbits, &cm,
GetColor(twocolor[0], 16),
GetColor(twocolor[0], 8),
@@ -1669,7 +2097,27 @@
GetColor(twocolor[1], 16),
GetColor(twocolor[1], 8),
GetColor(twocolor[1], 0));
- if (pCursor && AddResource(stuff->cid, RT_CURSOR, (pointer)pCursor))
+
+ pScreen -> RealizeCursor = saveRealizeCursor;
+
+ /*
+ * Store into the private data members the
+ * information needed to recreate it at
+ * reconnection. This is done in two steps
+ * as in the first step we don't have the
+ * picture info.
+ */
+
+ if (pCursor == NULL)
+ {
+ return BadAlloc;
+ }
+
+ nxagentCursorPostSaveRenderInfo(pCursor, pScreen, pSrc, stuff -> x, stuff -> y);
+
+ nxagentRenderRealizeCursor(pScreen, pCursor);
+
+ if (AddResource(stuff->cid, RT_CURSOR, (pointer)pCursor))
return (client->noClientException);
return BadAlloc;
}
@@ -1685,6 +2133,9 @@
VERIFY_PICTURE (pPicture, stuff->picture, client, SecurityWriteAccess,
RenderErrBase + BadPicture);
result = SetPictureTransform (pPicture, (PictTransform *) &stuff->transform);
+
+ nxagentSetPictureTransform(pPicture, &stuff->transform);
+
if (client->noClientException != Success)
return(client->noClientException);
else
@@ -1785,7 +2236,7 @@
{
register int n;
- for (i = 0; i < reply->numAliases; i++)
+ for (i = 0; i < (int)reply->numAliases; i++)
{
swaps (&aliases[i], n);
}
@@ -1817,6 +2268,9 @@
params = (xFixed *) (name + ((stuff->nbytes + 3) & ~3));
nparams = ((xFixed *) stuff + client->req_len) - params;
result = SetPictureFilter (pPicture, name, stuff->nbytes, params, nparams);
+
+ nxagentSetPictureFilter(pPicture, name, stuff->nbytes, params, nparams);
+
return result;
}
@@ -1859,7 +2313,14 @@
xfree (cursors);
if (ret != Success)
return ret;
-
+
+ nxagentAnimCursorBits = pCursor -> bits;
+
+ for (i = 0; i < MAXSCREENS; i++)
+ {
+ pCursor -> devPriv[i] = NULL;
+ }
+
if (AddResource (stuff->cid, RT_CURSOR, (pointer)pCursor))
return client->noClientException;
return BadAlloc;
@@ -1901,6 +2362,11 @@
pPicture = CreateSolidPicture(stuff->pid, &stuff->color, &error);
if (!pPicture)
return error;
+ /* AGENT SERVER */
+
+ nxagentRenderCreateSolidFill(pPicture, &stuff -> color);
+
+ /* AGENT SERVER */
if (!AddResource (stuff->pid, PictureType, (pointer)pPicture))
return BadAlloc;
return Success;
@@ -1932,6 +2398,12 @@
stuff->nStops, stops, colors, &error);
if (!pPicture)
return error;
+ /* AGENT SERVER */
+
+ nxagentRenderCreateLinearGradient(pPicture, &stuff->p1, &stuff->p2,
+ stuff->nStops, stops, colors);
+
+ /* AGENT SERVER */
if (!AddResource (stuff->pid, PictureType, (pointer)pPicture))
return BadAlloc;
return Success;
@@ -1962,6 +2434,14 @@
stuff->nStops, stops, colors, &error);
if (!pPicture)
return error;
+ /* AGENT SERVER */
+
+ nxagentRenderCreateRadialGradient(pPicture, &stuff->inner, &stuff->outer,
+ stuff->inner_radius,
+ stuff->outer_radius,
+ stuff->nStops, stops, colors);
+
+ /* AGENT SERVER */
if (!AddResource (stuff->pid, PictureType, (pointer)pPicture))
return BadAlloc;
return Success;
@@ -1991,6 +2471,13 @@
stuff->nStops, stops, colors, &error);
if (!pPicture)
return error;
+ /* AGENT SERVER */
+
+ nxagentRenderCreateConicalGradient(pPicture, &stuff->center,
+ stuff->angle, stuff->nStops, stops,
+ colors);
+
+ /* AGENT SERVER */
if (!AddResource (stuff->pid, PictureType, (pointer)pPicture))
return BadAlloc;
return Success;
@@ -2000,10 +2487,41 @@
static int
ProcRenderDispatch (ClientPtr client)
{
+ int result;
+
REQUEST(xReq);
+
+ /*
+ * Let the client fail if we are
+ * hiding the RENDER extension.
+ */
+ if (nxagentRenderTrap)
+ {
+ return BadRequest;
+ }
+
if (stuff->data < RenderNumberRequests)
- return (*ProcRenderVector[stuff->data]) (client);
+ {
+ #ifdef TEST
+ fprintf(stderr, "ProcRenderDispatch: Request [%s] OPCODE#%d.\n",
+ nxagentRenderRequestLiteral[stuff->data], stuff->data);
+ #endif
+
+ /*
+ * Set the nxagentGCTrap flag while
+ * dispatching a render operation to
+ * avoid reentrancy in GCOps.c.
+ */
+
+ nxagentGCTrap = 1;
+
+ result = (*ProcRenderVector[stuff->data]) (client);
+
+ nxagentGCTrap = 0;
+
+ return result;
+ }
else
return BadRequest;
}
@@ -2253,7 +2771,7 @@
SProcRenderAddGlyphs (ClientPtr client)
{
register int n;
- register int i;
+ register unsigned int i;
CARD32 *gids;
void *end;
xGlyphInfo *gi;
@@ -2595,10 +3113,36 @@
static int
SProcRenderDispatch (ClientPtr client)
{
+ int result;
+
REQUEST(xReq);
+ /*
+ * Let the client fail if we are
+ * hiding the RENDER extension.
+ */
+
+ if (nxagentRenderTrap)
+ {
+ return BadRequest;
+ }
+
if (stuff->data < RenderNumberRequests)
- return (*SProcRenderVector[stuff->data]) (client);
+ {
+ /*
+ * Set the nxagentGCTrap flag while
+ * dispatching a render operation to
+ * avoid reentrancy in GCOps.c.
+ */
+
+ nxagentGCTrap = 1;
+
+ result = (*SProcRenderVector[stuff->data]) (client);
+
+ nxagentGCTrap = 0;
+
+ return result;
+ }
else
return BadRequest;
}
@@ -3314,3 +3858,4 @@
}
#endif /* PANORAMIX */
+

View File

@@ -0,0 +1,426 @@
--- ./nx-X11/programs/Xserver/hw/nxagent/X/NXresource.c.X.original 2015-02-13 14:03:44.748441432 +0100
+++ ./nx-X11/programs/Xserver/hw/nxagent/X/NXresource.c 2015-02-10 19:13:13.820685287 +0100
@@ -1,3 +1,20 @@
+/**************************************************************************/
+/* */
+/* Copyright (c) 2001, 2011 NoMachine, http://www.nomachine.com/. */
+/* */
+/* NXAGENT, NX protocol compression and NX extensions to this software */
+/* are copyright of NoMachine. Redistribution and use of the present */
+/* software is allowed according to terms specified in the file LICENSE */
+/* which comes in the source distribution. */
+/* */
+/* Check http://www.nomachine.com/licensing.html for applicability. */
+/* */
+/* NX and NoMachine are trademarks of Medialogic S.p.A. */
+/* */
+/* All rights reserved. */
+/* */
+/**************************************************************************/
+
/************************************************************
Copyright 1987, 1998 The Open Group
@@ -125,6 +142,20 @@
#endif
#include <assert.h>
+#ifdef NXAGENT_SERVER
+
+#include "Agent.h"
+#include "Font.h"
+#include "Pixmaps.h"
+#include "GCs.h"
+
+#define PANIC
+#define WARNING
+#undef TEST
+#undef DEBUG
+
+#endif
+
static void RebuildTable(
int /*client*/
);
@@ -170,6 +201,10 @@
#endif
+#ifdef NXAGENT_SERVER
+static int nxagentResChangedFlag = 0;
+#endif
+
RESTYPE
CreateNewResourceType(DeleteType deleteFunc)
{
@@ -422,13 +457,107 @@
return id;
}
+#ifdef NXAGENT_SERVER
+
+int nxagentFindClientResource(int client, RESTYPE type, pointer value)
+{
+ ResourcePtr pResource;
+ ResourcePtr *resources;
+
+ int i;
+
+ for (i = 0; i < clientTable[client].buckets; i++)
+ {
+ resources = clientTable[client].resources;
+
+ for (pResource = resources[i]; pResource; pResource = pResource -> next)
+ {
+ if (pResource -> type == type && pResource -> value == value)
+ {
+ #ifdef TEST
+ fprintf(stderr, "nxagentFindClientResource: Found resource [%p] type [%lu] "
+ "for client [%d].\n", (void *) value,
+ pResource -> type, client);
+ #endif
+
+ return 1;
+ }
+ }
+ }
+
+ return 0;
+}
+
+int nxagentSwitchResourceType(int client, RESTYPE type, pointer value)
+{
+ ResourcePtr pResource;
+ ResourcePtr *resources;
+
+ RESTYPE internalType = 0;
+
+ int i;
+
+ if (type == RT_PIXMAP)
+ {
+ internalType = RT_NX_PIXMAP;
+ }
+ else if (type == RT_GC)
+ {
+ internalType = RT_NX_GC;
+ }
+ else if (type == RT_FONT)
+ {
+ internalType = RT_NX_FONT;
+ }
+ else
+ {
+ return 0;
+ }
+
+ if (client == serverClient -> index)
+ {
+ #ifdef TEST
+ fprintf(stderr, "nxagentSwitchResourceType: Requesting client is [%d]. Skipping the resource switch.\n",
+ client);
+ #endif
+
+ return 0;
+ }
+
+ for (i = 0; i < clientTable[serverClient -> index].buckets; i++)
+ {
+ resources = clientTable[serverClient -> index].resources;
+
+ for (pResource = resources[i]; pResource; pResource = pResource -> next)
+ {
+ if (pResource -> type == internalType &&
+ pResource -> value == value)
+ {
+ #ifdef TEST
+ fprintf(stderr, "nxagentSwitchResourceType: Changing resource [%p] type from [%lu] to "
+ "[%lu] for server client [%d].\n", (void *) value,
+ (unsigned long) pResource -> type, (unsigned long) type, serverClient -> index);
+ #endif
+
+ FreeResource(pResource -> id, RT_NONE);
+
+ return 1;
+ }
+ }
+ }
+
+ return 0;
+}
+
+#endif
+
Bool
AddResource(XID id, RESTYPE type, pointer value)
{
int client;
register ClientResourceRec *rrec;
register ResourcePtr res, *head;
-
+
client = CLIENT_ID(id);
rrec = &clientTable[client];
if (!rrec->buckets)
@@ -437,6 +566,18 @@
(unsigned long)id, type, (unsigned long)value, client);
FatalError("client not in use\n");
}
+
+#ifdef NXAGENT_SERVER
+
+ nxagentSwitchResourceType(client, type, value);
+
+ #ifdef TEST
+ fprintf(stderr, "AddResource: Adding resource for client [%d] type [%lu] value [%p] id [%lu].\n",
+ client, (unsigned long) type, (void *) value, (unsigned long) id);
+ #endif
+
+#endif
+
if ((rrec->elements >= 4*rrec->buckets) &&
(rrec->hashsize < MAXHASHSIZE))
RebuildTable(client);
@@ -453,6 +594,9 @@
res->value = value;
*head = res;
rrec->elements++;
+ #ifdef NXAGENT_SERVER
+ nxagentResChangedFlag = 1;
+ #endif
if (!(id & SERVER_BIT) && (id >= rrec->expectID))
rrec->expectID = id + 1;
return TRUE;
@@ -517,6 +661,14 @@
int elements;
Bool gotOne = FALSE;
+#ifdef NXAGENT_SERVER
+
+ #ifdef TEST
+ fprintf(stderr, "FreeResource: Freeing resource id [%lu].\n", (unsigned long) id);
+ #endif
+
+#endif
+
if (((cid = CLIENT_ID(id)) < MAXCLIENTS) && clientTable[cid].buckets)
{
head = &clientTable[cid].resources[Hash(cid, id)];
@@ -530,6 +682,9 @@
RESTYPE rtype = res->type;
*prev = res->next;
elements = --*eltptr;
+ #ifdef NXAGENT_SERVER
+ nxagentResChangedFlag = 1;
+ #endif
if (rtype & RC_CACHED)
FlushClientCaches(res->id);
if (rtype != skipDeleteFuncType)
@@ -570,6 +725,9 @@
if (res->id == id && res->type == type)
{
*prev = res->next;
+ #ifdef NXAGENT_SERVER
+ nxagentResChangedFlag = 1;
+ #endif
if (type & RC_CACHED)
FlushClientCaches(res->id);
if (!skipFree)
@@ -634,10 +792,28 @@
int i, elements;
register int *eltptr;
+ #ifdef NXAGENT_SERVER
+ register ResourcePtr **resptr;
+ #endif
+
if (!client)
client = serverClient;
+/*
+ * If func triggers a resource table
+ * rebuild then restart the loop.
+ */
+
+#ifdef NXAGENT_SERVER
+RestartLoop:
+#endif
+
resources = clientTable[client->index].resources;
+
+ #ifdef NXAGENT_SERVER
+ resptr = &clientTable[client->index].resources;
+ #endif
+
eltptr = &clientTable[client->index].elements;
for (i = 0; i < clientTable[client->index].buckets; i++)
{
@@ -646,8 +822,44 @@
next = this->next;
if (!type || this->type == type) {
elements = *eltptr;
+
+ /*
+ * FIXME:
+ * It is not safe to let a function change the resource
+ * table we are reading!
+ */
+
+ #ifdef NXAGENT_SERVER
+ nxagentResChangedFlag = 0;
+ #endif
(*func)(this->value, this->id, cdata);
+
+ /*
+ * Avoid that a call to RebuildTable() could invalidate the
+ * pointer. This is safe enough, because in RebuildTable()
+ * the new pointer is allocated just before the old one is
+ * freed, so it can't point to the same address.
+ */
+
+ #ifdef NXAGENT_SERVER
+ if (*resptr != resources)
+ goto RestartLoop;
+ #endif
+
+ /*
+ * It's not enough to check if the number of elements has
+ * changed, beacause it could happen that the number of
+ * resources that have been added matches the number of
+ * the freed ones.
+ * 'nxagentResChangedFlag' is set if a resource has been
+ * added or freed.
+ */
+
+ #ifdef NXAGENT_SERVER
+ if (*eltptr != elements || nxagentResChangedFlag)
+ #else
if (*eltptr != elements)
+ #endif
next = resources[i]; /* start over */
}
}
@@ -665,10 +877,28 @@
int i, elements;
register int *eltptr;
+ #ifdef NXAGENT_SERVER
+ register ResourcePtr **resptr;
+ #endif
+
if (!client)
client = serverClient;
+/*
+ * If func triggers a resource table
+ * rebuild then restart the loop.
+ */
+
+#ifdef NXAGENT_SERVER
+RestartLoop:
+#endif
+
resources = clientTable[client->index].resources;
+
+ #ifdef NXAGENT_SERVER
+ resptr = &clientTable[client->index].resources;
+ #endif
+
eltptr = &clientTable[client->index].elements;
for (i = 0; i < clientTable[client->index].buckets; i++)
{
@@ -676,8 +906,44 @@
{
next = this->next;
elements = *eltptr;
+
+ /*
+ * FIXME:
+ * It is not safe to let a function change the resource
+ * table we are reading!
+ */
+
+ #ifdef NXAGENT_SERVER
+ nxagentResChangedFlag = 0;
+ #endif
(*func)(this->value, this->id, this->type, cdata);
+
+ /*
+ * Avoid that a call to RebuildTable() could invalidate the
+ * pointer. This is safe enough, because in RebuildTable()
+ * the new pointer is allocated just before the old one is
+ * freed, so it can't point to the same address.
+ */
+
+ #ifdef NXAGENT_SERVER
+ if (*resptr != resources)
+ goto RestartLoop;
+ #endif
+
+ /*
+ * It's not enough to check if the number of elements has
+ * changed, beacause it could happen that the number of
+ * resources that have been added matches the number of
+ * the freed ones.
+ * 'nxagentResChangedFlag' is set if a resource has been
+ * added or freed.
+ */
+
+ #ifdef NXAGENT_SERVER
+ if (*eltptr != elements || nxagentResChangedFlag)
+ #else
if (*eltptr != elements)
+ #endif
next = resources[i]; /* start over */
}
}
@@ -695,15 +961,44 @@
ResourcePtr this;
int i;
+ #ifdef NXAGENT_SERVER
+ ResourcePtr **resptr;
+ Bool res;
+ #endif
+
if (!client)
client = serverClient;
+/*
+ * If func triggers a resource table
+ * rebuild then restart the loop.
+ */
+
+#ifdef NXAGENT_SERVER
+RestartLoop:
+#endif
+
resources = clientTable[client->index].resources;
+
+ #ifdef NXAGENT_SERVER
+ resptr = &clientTable[client->index].resources;
+ #endif
+
for (i = 0; i < clientTable[client->index].buckets; i++) {
for (this = resources[i]; this; this = this->next) {
if (!type || this->type == type) {
+ #ifdef NXAGENT_SERVER
+ res = (*func)(this->value, this->id, cdata);
+
+ if (*resptr != resources)
+ goto RestartLoop;
+
+ if (res)
+ return this->value;
+ #else
if((*func)(this->value, this->id, cdata))
return this->value;
+ #endif
}
}
}
@@ -952,3 +1247,4 @@
}
#endif /* XCSECURITY */
+

View File

@@ -0,0 +1,373 @@
--- ./nx-X11/programs/Xserver/hw/nxagent/X/NXshm.c.X.original 2015-02-13 14:03:44.748441432 +0100
+++ ./nx-X11/programs/Xserver/hw/nxagent/X/NXshm.c 2015-02-10 19:13:13.812685587 +0100
@@ -1,3 +1,20 @@
+/**************************************************************************/
+/* */
+/* Copyright (c) 2001, 2011 NoMachine, http://www.nomachine.com/. */
+/* */
+/* NXAGENT, NX protocol compression and NX extensions to this software */
+/* are copyright of NoMachine. Redistribution and use of the present */
+/* software is allowed according to terms specified in the file LICENSE */
+/* which comes in the source distribution. */
+/* */
+/* Check http://www.nomachine.com/licensing.html for applicability. */
+/* */
+/* NX and NoMachine are trademarks of Medialogic S.p.A. */
+/* */
+/* All rights reserved. */
+/* */
+/**************************************************************************/
+
/* $XFree86: xc/programs/Xserver/Xext/shm.c,v 3.41 2003/12/17 23:28:56 alanh Exp $ */
/************************************************************
@@ -73,6 +90,31 @@
#include "modinit.h"
+#include "Trap.h"
+#include "Agent.h"
+#include "Drawable.h"
+#include "Pixmaps.h"
+
+/*
+ * Set here the required log level.
+ */
+
+#define PANIC
+#define WARNING
+#undef TEST
+#undef DEBUG
+
+#ifdef TEST
+#include "Literals.h"
+#endif
+
+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);
+
typedef struct _ShmDesc {
struct _ShmDesc *next;
int shmid;
@@ -216,15 +258,25 @@
}
#endif
+ if (nxagentOption(SharedMemory) == False)
+ {
+ return;
+ }
+
sharedPixmaps = xFalse;
pixmapFormat = 0;
{
- sharedPixmaps = xTrue;
+ sharedPixmaps = nxagentOption(SharedPixmaps);
pixmapFormat = shmPixFormat[0];
for (i = 0; i < screenInfo.numScreens; i++)
{
if (!shmFuncs[i])
+ {
+ #ifdef TEST
+ fprintf(stderr, "ShmExtensionInit: Registering shmFuncs as miFuncs.\n");
+ #endif
shmFuncs[i] = &miFuncs;
+ }
if (!shmFuncs[i]->CreatePixmap)
sharedPixmaps = xFalse;
if (shmPixFormat[i] && (shmPixFormat[i] != pixmapFormat))
@@ -335,6 +387,9 @@
ShmRegisterFbFuncs(pScreen)
ScreenPtr pScreen;
{
+ #ifdef TEST
+ fprintf(stderr, "ShmRegisterFbFuncs: Registering shmFuncs as fbFuncs.\n");
+ #endif
shmFuncs[pScreen->myNum] = &fbFuncs;
}
@@ -512,12 +567,17 @@
PixmapPtr pmap;
GCPtr putGC;
+ nxagentShmTrap = 0;
putGC = GetScratchGC(depth, dst->pScreen);
if (!putGC)
+ {
+ nxagentShmTrap = 1;
return;
+ }
pmap = (*dst->pScreen->CreatePixmap)(dst->pScreen, sw, sh, depth);
if (!pmap)
{
+ nxagentShmTrap = 1;
FreeScratchGC(putGC);
return;
}
@@ -532,6 +592,7 @@
(void)(*pGC->ops->CopyArea)((DrawablePtr)pmap, dst, pGC, 0, 0, sw, sh,
dx, dy);
(*pmap->drawable.pScreen->DestroyPixmap)(pmap);
+ nxagentShmTrap = 1;
}
static void
@@ -542,6 +603,15 @@
unsigned int format;
char *data;
{
+ int length;
+ char *newdata;
+ extern int nxagentImageLength(int, int, int, int, int);
+
+ #ifdef TEST
+ fprintf(stderr, "fbShmPutImage: Called with drawable at [%p] GC at [%p] data at [%p].\n",
+ (void *) dst, (void *) pGC, (void *) data);
+ #endif
+
if ((format == ZPixmap) || (depth == 1))
{
PixmapPtr pPixmap;
@@ -556,11 +626,45 @@
else
(void)(*pGC->ops->CopyArea)((DrawablePtr)pPixmap, dst, pGC,
sx, sy, sw, sh, dx, dy);
+
+ /*
+ * We updated the internal framebuffer,
+ * now we want to go on the real X.
+ */
+
+ #ifdef TEST
+ fprintf(stderr, "fbShmPutImage: Realizing the PutImage with depth [%d] "
+ " format [%d] w [%d] h [%d] sx [%d] sy [%d] sw [%d] "
+ " sh [%d] dx [%d].\n", depth, format, w, h,
+ sx, sy, sw, sh, dx);
+ #endif
+
+ length = nxagentImageLength(sw, sh, format, 0, depth);
+
+ if ((newdata = xalloc(length)) != NULL)
+ {
+ fbGetImage((DrawablePtr) pPixmap, sx, sy, sw, sh, format, AllPlanes, newdata);
+ (*pGC->ops->PutImage)(dst, pGC, depth, dx, dy, sw, sh, 0, format, newdata);
+
+ xfree(newdata);
+ }
+ else
+ {
+ #ifdef WARNING
+ fprintf(stderr, "fbShmPutImage: WARNING! Data allocation failed.\n");
+ #endif
+ }
+
FreeScratchPixmapHeader(pPixmap);
}
else
+ {
+ #ifdef TEST
+ fprintf(stderr, "fbShmPutImage: Calling miShmPutImage().\n");
+ #endif
miShmPutImage(dst, pGC, depth, format, w, h, sx, sy, sw, sh, dx, dy,
data);
+ }
}
@@ -895,26 +999,22 @@
return BadValue;
}
- if ((((stuff->format == ZPixmap) && (stuff->srcX == 0)) ||
- ((stuff->format != ZPixmap) &&
- (stuff->srcX < screenInfo.bitmapScanlinePad) &&
- ((stuff->format == XYBitmap) ||
- ((stuff->srcY == 0) &&
- (stuff->srcHeight == stuff->totalHeight))))) &&
- ((stuff->srcX + stuff->srcWidth) == stuff->totalWidth))
- (*pGC->ops->PutImage) (pDraw, pGC, stuff->depth,
- stuff->dstX, stuff->dstY,
- stuff->totalWidth, stuff->srcHeight,
- stuff->srcX, stuff->format,
- shmdesc->addr + stuff->offset +
- (stuff->srcY * length));
- else
- (*shmFuncs[pDraw->pScreen->myNum]->PutImage)(
- pDraw, pGC, stuff->depth, stuff->format,
- stuff->totalWidth, stuff->totalHeight,
- stuff->srcX, stuff->srcY,
- stuff->srcWidth, stuff->srcHeight,
- stuff->dstX, stuff->dstY,
+ #ifdef TEST
+ fprintf(stderr, "ProcShmPutImage: Format [%d] srcX [%d] srcY [%d], "
+ "totalWidth [%d] totalHeight [%d]\n", stuff->format, stuff->srcX,
+ stuff->srcY, stuff->totalWidth, stuff->totalHeight);
+ #endif
+
+ #ifdef TEST
+ fprintf(stderr, "ProcShmPutImage: Calling (*shmFuncs[pDraw->pScreen->myNum]->PutImage)().\n");
+ #endif
+
+ (*shmFuncs[pDraw->pScreen->myNum]->PutImage)(
+ pDraw, pGC, stuff->depth, stuff->format,
+ stuff->totalWidth, stuff->totalHeight,
+ stuff->srcX, stuff->srcY,
+ stuff->srcWidth, stuff->srcHeight,
+ stuff->dstX, stuff->dstY,
shmdesc->addr + stuff->offset);
if (stuff->sendEvent)
@@ -1056,15 +1156,37 @@
{
register PixmapPtr pPixmap;
- pPixmap = (*pScreen->CreatePixmap)(pScreen, 0, 0, pScreen->rootDepth);
+ nxagentShmPixmapTrap = 1;
+
+ pPixmap = (*pScreen->CreatePixmap)(pScreen, width, height, depth);
+
if (!pPixmap)
- return NullPixmap;
+ {
+ nxagentShmPixmapTrap = 0;
+
+ return NullPixmap;
+ }
+
+ #ifdef TEST
+ fprintf(stderr,"fbShmCreatePixmap: Width [%d] Height [%d] Depth [%d]\n", width, height, depth);
+ #endif
if (!(*pScreen->ModifyPixmapHeader)(pPixmap, width, height, depth,
- BitsPerPixel(depth), PixmapBytePad(width, depth), (pointer)addr)) {
- (*pScreen->DestroyPixmap)(pPixmap);
- return NullPixmap;
+ BitsPerPixel(depth), PixmapBytePad(width, depth), (pointer)addr))
+ {
+ #ifdef WARNING
+ fprintf(stderr,"fbShmCreatePixmap: Return Null Pixmap.\n");
+ #endif
+
+ (*pScreen->DestroyPixmap)(pPixmap);
+
+ nxagentShmPixmapTrap = 0;
+
+ return NullPixmap;
}
+
+ nxagentShmPixmapTrap = 0;
+
return pPixmap;
}
@@ -1146,6 +1268,18 @@
register ClientPtr client;
{
REQUEST(xReq);
+
+ #ifdef TEST
+ fprintf(stderr, "ProcShmDispatch: Going to execute operation [%d] for client [%d].\n",
+ stuff -> data, client -> index);
+
+ if (stuff->data <= X_ShmCreatePixmap)
+ {
+ fprintf(stderr, "ProcShmDispatch: Request [%s] OPCODE#%d.\n",
+ nxagentShmRequestLiteral[stuff->data], stuff->data);
+ }
+ #endif
+
switch (stuff->data)
{
case X_ShmQueryVersion:
@@ -1155,11 +1289,38 @@
case X_ShmDetach:
return ProcShmDetach(client);
case X_ShmPutImage:
+ {
+ int result;
+
+ #ifdef TEST
+ fprintf(stderr, "ProcShmDispatch: Going to execute ProcShmPutImage() for client [%d].\n",
+ client -> index);
+ #endif
+
+ nxagentShmTrap = 1;
+
#ifdef PANORAMIX
if ( !noPanoramiXExtension )
- return ProcPanoramiXShmPutImage(client);
+ {
+ result = ProcPanoramiXShmPutImage(client);
+
+ nxagentShmTrap = 0;
+
+ return result;
+ }
#endif
- return ProcShmPutImage(client);
+
+ result = ProcShmPutImage(client);
+
+ nxagentShmTrap = 0;
+
+ #ifdef TEST
+ fprintf(stderr, "ProcShmDispatch: Returning from ProcShmPutImage() for client [%d].\n",
+ client -> index);
+ #endif
+
+ return result;
+ }
case X_ShmGetImage:
#ifdef PANORAMIX
if ( !noPanoramiXExtension )
@@ -1290,6 +1451,12 @@
register ClientPtr client;
{
REQUEST(xReq);
+
+ #ifdef TEST
+ fprintf(stderr, "SProcShmDispatch: Going to execute operation [%d] for client [%d].\n",
+ stuff -> data, client -> index);
+ #endif
+
switch (stuff->data)
{
case X_ShmQueryVersion:
@@ -1299,7 +1466,27 @@
case X_ShmDetach:
return SProcShmDetach(client);
case X_ShmPutImage:
- return SProcShmPutImage(client);
+ {
+ int result;
+
+ #ifdef TEST
+ fprintf(stderr, "SProcShmDispatch: Going to execute SProcShmPutImage() for client [%d].\n",
+ client -> index);
+ #endif
+
+ nxagentShmTrap = 1;
+
+ result = SProcShmPutImage(client);
+
+ nxagentShmTrap = 0;
+
+ #ifdef TEST
+ fprintf(stderr, "SProcShmDispatch: Returning from SProcShmPutImage() for client [%d].\n",
+ client -> index);
+ #endif
+
+ return result;
+ }
case X_ShmGetImage:
return SProcShmGetImage(client);
case X_ShmCreatePixmap:
@@ -1308,3 +1495,4 @@
return BadRequest;
}
}
+

View File

@@ -0,0 +1,561 @@
--- ./nx-X11/programs/Xserver/hw/nxagent/X/NXwindow.c.X.original 2015-02-13 14:03:44.748441432 +0100
+++ ./nx-X11/programs/Xserver/hw/nxagent/X/NXwindow.c 2015-02-10 19:13:13.780686785 +0100
@@ -1,3 +1,20 @@
+/**************************************************************************/
+/* */
+/* Copyright (c) 2001, 2011 NoMachine, http://www.nomachine.com/. */
+/* */
+/* NXAGENT, NX protocol compression and NX extensions to this software */
+/* are copyright of NoMachine. Redistribution and use of the present */
+/* software is allowed according to terms specified in the file LICENSE */
+/* which comes in the source distribution. */
+/* */
+/* Check http://www.nomachine.com/licensing.html for applicability. */
+/* */
+/* NX and NoMachine are trademarks of Medialogic S.p.A. */
+/* */
+/* All rights reserved. */
+/* */
+/**************************************************************************/
+
/* $XdotOrg: xc/programs/Xserver/dix/window.c,v 1.12 2005/07/03 08:53:38 daniels Exp $ */
/* $Xorg: window.c,v 1.4 2001/02/09 02:04:41 xorgcvs Exp $ */
/*
@@ -97,9 +114,10 @@
#include "dixstruct.h"
#include "gcstruct.h"
#include "servermd.h"
+#include "selection.h"
#ifdef PANORAMIX
-#include "panoramiX.h"
-#include "panoramiXsrv.h"
+#include "../../Xext/panoramiX.h"
+#include "../../Xext/panoramiXsrv.h"
#endif
#include "dixevents.h"
#include "globals.h"
@@ -112,6 +130,19 @@
#include <X11/extensions/security.h>
#endif
+#include "Screen.h"
+#include "Options.h"
+#include "Atoms.h"
+#include "Clipboard.h"
+#include "Splash.h"
+#include "Rootless.h"
+#include "Composite.h"
+#include "Drawable.h"
+#include "Colormap.h"
+
+extern Bool nxagentWMIsRunning;
+extern Bool nxagentScreenTrap;
+
/******
* Window stuff for server
*
@@ -160,10 +191,25 @@
#define SubStrSend(pWin,pParent) (StrSend(pWin) || SubSend(pParent))
+/*
+ * Set here the required log level.
+ */
+
+#define PANIC
+#define WARNING
+#undef TEST
+#undef DEBUG
+
int numSaveUndersViewable = 0;
int deltaSaveUndersViewable = 0;
-#ifdef DEBUG
+WindowPtr nxagentRootTileWindow;
+
+/*
+ * This block used the DEBUG symbol.
+ */
+
+#ifdef WINDOW_TREE_DEBUG
/******
* PrintWindowTree
* For debugging only
@@ -289,6 +335,31 @@
#endif
}
+#ifdef NXAGENT_SERVER
+
+void nxagentClearSplash(WindowPtr pW)
+{
+ int w, h;
+ ScreenPtr pScreen;
+
+ w = pW->drawable.width;
+ h = pW->drawable.height;
+
+ pScreen = pW->drawable.pScreen;
+
+ if (pW->backgroundState == BackgroundPixmap)
+ {
+ (*pScreen->DestroyPixmap)(pW->background.pixmap);
+ }
+
+ pW->backgroundState = BackgroundPixel;
+ pW->background.pixel = nxagentLogoBlack;
+
+ (*pScreen->ChangeWindowAttributes)(pW, CWBackPixmap|CWBackPixel);
+}
+
+#endif /* NXAGENT_SERVER */
+
static void
MakeRootTile(WindowPtr pWin)
{
@@ -333,6 +404,9 @@
FreeScratchGC(pGC);
+#ifdef NXAGENT_SERVER
+ nxagentRootTileWindow = pWin;
+#endif /* NXAGENT_SERVER */
}
WindowPtr
@@ -458,9 +532,16 @@
return FALSE;
if (disableBackingStore)
- pScreen->backingStoreSupport = NotUseful;
+ {
+ pScreen -> backingStoreSupport = NotUseful;
+ }
+
if (enableBackingStore)
- pScreen->backingStoreSupport = Always;
+ {
+ pScreen -> backingStoreSupport = Always;
+ }
+
+ pScreen->saveUnderSupport = False;
#ifdef DO_SAVE_UNDERS
if ((pScreen->backingStoreSupport != NotUseful) &&
@@ -480,6 +561,107 @@
return TRUE;
}
+#ifdef NXAGENT_SERVER
+
+void
+InitRootWindow(WindowPtr pWin)
+{
+ ScreenPtr pScreen;
+
+ #ifdef TEST
+ fprintf(stderr, "InitRootWindow: Called for window at [%p][%ld] with parent [%p].\n",
+ (void *) pWin, nxagentWindowPriv(pWin)->window, (void *) pWin -> parent);
+ #endif
+
+ if (nxagentOption(Rootless))
+ {
+ #ifdef TEST
+ fprintf(stderr, "InitRootWindow: Assigned agent root to window at [%p][%ld] with parent [%p].\n",
+ (void *) pWin, nxagentWindowPriv(pWin)->window, (void *) pWin -> parent);
+ #endif
+
+ nxagentRootlessWindow = pWin;
+ }
+
+ pScreen = pWin->drawable.pScreen;
+
+ /*
+ * A root window is created for each screen by main
+ * and the pointer is saved in WindowTable as in the
+ * following snippet:
+ *
+ * for (i = 0; i < screenInfo.numScreens; i++)
+ * InitRootWindow(WindowTable[i]);
+ *
+ * Our root window on the real display was already
+ * created at the time the screen was opened, so it
+ * is unclear how this window (or the other window,
+ * if you prefer) fits in the big picture.
+ */
+
+ #ifdef TEST
+ fprintf(stderr, "InitRootWindow: Going to create window as root at [%p][%ld] with parent [%p].\n",
+ (void *) pWin, nxagentWindowPriv(pWin)->window, (void *) pWin -> parent);
+ #endif
+
+ if (!(*pScreen->CreateWindow)(pWin))
+ return; /* XXX */
+
+ #ifdef TEST
+ fprintf(stderr, "InitRootWindow: Created window as root at [%p][%ld] with parent [%p].\n",
+ (void *) pWin, nxagentWindowPriv(pWin)->window, (void *) pWin -> parent);
+ #endif
+
+ (*pScreen->PositionWindow)(pWin, 0, 0);
+
+ pWin->cursorIsNone = FALSE;
+ pWin->optional->cursor = rootCursor;
+ rootCursor->refcnt++;
+ pWin->backingStore = defaultBackingStore;
+ pWin->forcedBS = (defaultBackingStore != NotUseful);
+
+ #ifdef NXAGENT_SPLASH
+ /* We SHOULD check for an error value here XXX */
+ pWin -> background.pixel = pScreen -> blackPixel;
+ (*pScreen->ChangeWindowAttributes)(pWin,
+ CWBackPixel|CWBorderPixel|CWCursor|CWBackingStore);
+ #else
+ (*pScreen->ChangeWindowAttributes)(pWin,
+ CWBackPixmap|CWBorderPixel|CWCursor|CWBackingStore);
+ #endif
+
+ MakeRootTile(pWin);
+
+ /*
+ * Map both the root and the default agent window.
+ */
+
+ #ifdef TEST
+ fprintf(stderr, "InitRootWindow: Mapping default windows.\n");
+ #endif
+
+ nxagentInitAtoms(pWin);
+
+ nxagentInitClipboard(pWin);
+
+ nxagentMapDefaultWindows();
+
+ nxagentRedirectDefaultWindows();
+
+ #ifdef NXAGENT_ARTSD
+ {
+ char artsd_port[10];
+ int nPort;
+ extern void nxagentPropagateArtsdProperties(ScreenPtr pScreen, char *port);
+ nPort = atoi(display) + 7000;
+ sprintf(artsd_port,"%d", nPort);
+ nxagentPropagateArtsdProperties(pScreen, artsd_port);
+ }
+ #endif
+}
+
+#else /* NXAGENT_SERVER */
+
void
InitRootWindow(WindowPtr pWin)
{
@@ -502,6 +684,8 @@
MapWindow(pWin, serverClient);
}
+#endif /* NXAGENT_SERVER */
+
/* Set the region to the intersection of the rectangle and the
* window's winSize. The window is typically the parent of the
* window from which the region came.
@@ -512,7 +696,9 @@
register int x, register int y,
register int w, register int h)
{
+#ifndef NXAGENT_SERVER
ScreenPtr pScreen = pWin->drawable.pScreen;
+#endif /* NXAGENT_SERVER */
BoxRec box;
box = *(REGION_EXTENTS(pScreen, &pWin->winSize));
@@ -907,6 +1093,14 @@
if (pWin->prevSib)
pWin->prevSib->nextSib = pWin->nextSib;
}
+
+ if (pWin -> optional &&
+ pWin -> optional -> colormap &&
+ pWin -> parent)
+ {
+ nxagentSetInstalledColormapWindows(pWin -> drawable.pScreen);
+ }
+
xfree(pWin);
return Success;
}
@@ -1147,6 +1341,12 @@
goto PatchUp;
}
pWin->backingStore = val;
+
+ #ifdef TEST
+ fprintf(stderr, "ChangeWindowAttributes: Changed backing store value to %d for window at %p.\n",
+ val, (void*)pWin);
+ #endif
+
pWin->forcedBS = FALSE;
break;
case CWBackingPlanes:
@@ -1227,6 +1427,22 @@
#endif /* DO_SAVE_UNDERS */
break;
case CWEventMask:
+ /*
+ * TODO: Some applications like java bean shell
+ * don' t work if they cannot monitor the root
+ * window for Structure Redirect events. However
+ * this doesn't seem to be the best solution, since
+ * also an X server with a window manager running,
+ * doesn't allow to monitor for those events, but
+ * the java bean shell works flawlessy on this
+ * server.
+ *
+ * if (nxagentCheckIllegalRootMonitoring(pWin, (Mask)*pVlist))
+ * {
+ * return BadAccess;
+ * }
+ */
+
result = EventSelectForWindow(pWin, client, (Mask )*pVlist);
if (result)
{
@@ -1611,8 +1827,9 @@
pRgn = REGION_CREATE(pWin->drawable.pScreen, &box, 1);
#ifdef SHAPE
if (wBoundingShape (pWin) || wClipShape (pWin)) {
+#ifndef NXAGENT_SERVER
ScreenPtr pScreen = pWin->drawable.pScreen;
-
+#endif /* NXAGENT_SERVER */
REGION_TRANSLATE(pScreen, pRgn, - pWin->drawable.x,
- pWin->drawable.y);
if (wBoundingShape (pWin))
@@ -1647,8 +1864,9 @@
(int)pWin->drawable.height);
#ifdef SHAPE
if (wBoundingShape (pWin) || wClipShape (pWin)) {
+#ifndef NXAGENT_SERVER
ScreenPtr pScreen = pWin->drawable.pScreen;
-
+#endif /* NXAGENT_SERVER */
REGION_TRANSLATE(pScreen, &pWin->winSize, - pWin->drawable.x,
- pWin->drawable.y);
if (wBoundingShape (pWin))
@@ -1689,8 +1907,9 @@
(int)(pWin->drawable.height + (bw<<1)));
#ifdef SHAPE
if (wBoundingShape (pWin)) {
+#ifndef NXAGENT_SERVER
ScreenPtr pScreen = pWin->drawable.pScreen;
-
+#endif /* NXAGENT_SERVER */
REGION_TRANSLATE(pScreen, &pWin->borderSize, - pWin->drawable.x,
- pWin->drawable.y);
REGION_INTERSECT(pScreen, &pWin->borderSize, &pWin->borderSize,
@@ -1800,7 +2019,19 @@
pSib->drawable.y = pWin->drawable.y + pSib->origin.y;
SetWinSize (pSib);
SetBorderSize (pSib);
- (*pScreen->PositionWindow)(pSib, pSib->drawable.x, pSib->drawable.y);
+
+ /*
+ * Don't force X to move children. It will position them
+ * according with gravity.
+ *
+ * (*pScreen->PositionWindow)(pSib, pSib->drawable.x, pSib->drawable.y);
+ */
+
+ /*
+ * Update pSib privates, as this window is moved by X.
+ */
+
+ nxagentAddConfiguredWindow(pSib, CW_Update);
if ( (pChild = pSib->firstChild) )
{
@@ -1812,8 +2043,10 @@
pChild->origin.y;
SetWinSize (pChild);
SetBorderSize (pChild);
- (*pScreen->PositionWindow)(pChild,
- pChild->drawable.x, pChild->drawable.y);
+
+ (*pScreen->PositionWindow)(pChild, pChild->drawable.x,
+ pChild->drawable.y);
+
if (pChild->firstChild)
{
pChild = pChild->firstChild;
@@ -1900,8 +2133,9 @@
BoxPtr pBox)
{
RegionPtr pRgn;
+#ifndef NXAGENT_SERVER
ScreenPtr pScreen = pWin->drawable.pScreen;
-
+#endif /* NXAGENT_SERVER */
pRgn = REGION_CREATE(pScreen, pBox, 1);
if (wBoundingShape (pWin)) {
REGION_TRANSLATE(pScreen, pRgn, -pWin->origin.x,
@@ -2286,6 +2520,28 @@
/* Figure out if the window should be moved. Doesnt
make the changes to the window if event sent */
+ #ifdef TEST
+ if (nxagentWindowTopLevel(pWin))
+ {
+
+ fprintf(stderr, "ConfigureWindow: pWin [%p] mask [%lu] client [%p]\n",
+ pWin, mask, client);
+
+ fprintf(stderr, "ConfigureWindow: x [%d] y [%d] w [%d] h [%d] CWStackMode [%d] "
+ "smode [%d] pSib [%p]\n",
+ x, y, w, h, (mask & CWStackMode) ? 1 : 0, smode, pSib);
+ }
+ #endif
+
+ if (nxagentOption(Rootless) && nxagentWindowTopLevel(pWin) &&
+ pWin -> overrideRedirect == 0 &&
+ nxagentScreenTrap == 0)
+ {
+ nxagentConfigureRootlessWindow(pWin, x, y, w, h, bw, pSib, smode, mask);
+
+ return Success;
+ }
+
if (mask & CWStackMode)
pSib = WhereDoIGoInTheStack(pWin, pSib, pParent->drawable.x + x,
pParent->drawable.y + y,
@@ -2443,6 +2699,9 @@
if (action != RESTACK_WIN)
CheckCursorConfinement(pWin);
+
+ nxagentFlushConfigureWindow();
+
return(Success);
#undef RESTACK_WIN
#undef MOVE_WIN
@@ -2468,6 +2727,20 @@
xEvent event;
BoxRec box;
+ #ifdef TEST
+ fprintf(stderr, "CirculateWindow: pParent [%p] direction [%d] client [%p]\n",
+ pParent, direction, client);
+ #endif
+
+ /*
+ * if (nxagentOption(Rootless) && nxagentWMIsRunning &&
+ * nxagentWindowTopLevel(pWin) && pWin -> overrideRedirect == 0)
+ * {
+ * nxagentCirculateRootlessWindows(direction);
+ * return Success;
+ * }
+ */
+
pHead = RealChildHead(pParent);
pFirst = pHead ? pHead->nextSib : pParent->firstChild;
if (direction == RaiseLowest)
@@ -2582,6 +2855,12 @@
/* insert at begining of pParent */
pWin->parent = pParent;
pPrev = RealChildHead(pParent);
+
+ if (pWin->parent == WindowTable[0])
+ {
+ nxagentSetTopLevelEventMask(pWin);
+ }
+
if (pPrev)
{
pWin->nextSib = pPrev->nextSib;
@@ -2614,7 +2893,9 @@
if (pScreen->ReparentWindow)
(*pScreen->ReparentWindow)(pWin, pPriorParent);
+
(*pScreen->PositionWindow)(pWin, pWin->drawable.x, pWin->drawable.y);
+
ResizeChildrenWinSize(pWin, 0, 0, 0, 0);
CheckWindowOptionalNeed(pWin);
@@ -2677,6 +2958,13 @@
#endif
WindowPtr pLayerWin;
+ #ifdef TEST
+ if (nxagentWindowTopLevel(pWin))
+ {
+ fprintf(stderr, "MapWindow: pWin [%p] client [%p]\n", pWin, client);
+ }
+ #endif
+
if (pWin->mapped)
return(Success);
@@ -2782,6 +3070,8 @@
REGION_UNINIT(pScreen, &temp);
}
+ nxagentFlushConfigureWindow();
+
return(Success);
}
@@ -2981,6 +3271,14 @@
ScreenPtr pScreen = pWin->drawable.pScreen;
WindowPtr pLayerWin = pWin;
+ #ifdef TEST
+ if (nxagentWindowTopLevel(pWin))
+ {
+ fprintf(stderr, "UnmapWindow: pWin [%p] fromConfigure [%d]\n", pWin,
+ fromConfigure);
+ }
+ #endif
+
if ((!pWin->mapped) || (!(pParent = pWin->parent)))
return(Success);
if (SubStrSend(pWin, pParent))
@@ -3324,9 +3622,19 @@
(* screenInfo.screens[i]->SaveScreen) (screenInfo.screens[i], on);
if (savedScreenInfo[i].ExternalScreenSaver)
{
- if ((*savedScreenInfo[i].ExternalScreenSaver)
- (screenInfo.screens[i], type, on == SCREEN_SAVER_FORCER))
- continue;
+ if (nxagentOption(Timeout) != 0)
+ {
+ #ifdef TEST
+ fprintf(stderr, "SaveScreens: An external screen-saver handler is installed. "
+ "Ignoring it to let the auto-disconnect feature work.\n");
+ #endif
+ }
+ else
+ {
+ if ((*savedScreenInfo[i].ExternalScreenSaver)
+ (screenInfo.screens[i], type, on == SCREEN_SAVER_FORCER))
+ continue;
+ }
}
if (type == screenIsSaved)
continue;
@@ -3669,6 +3977,11 @@
}
else
pWin->cursorIsNone = TRUE;
+/* FIXME
+ There is an error when disposing ClientResources on Agent exit
+ this xfree is not valid in some window at exit
+*/
+
xfree (pWin->optional);
pWin->optional = NULL;
}
@@ -3851,3 +4164,4 @@
}
#endif
+

View File

@@ -0,0 +1,266 @@
--- ./nx-X11/programs/Xserver/hw/nxagent/X/NXxvdisp.c.X.original 2015-02-13 14:03:44.748441432 +0100
+++ ./nx-X11/programs/Xserver/hw/nxagent/X/NXxvdisp.c 2015-02-13 14:03:44.748441432 +0100
@@ -1,3 +1,20 @@
+/**************************************************************************/
+/* */
+/* Copyright (c) 2001, 2011 NoMachine, http://www.nomachine.com/. */
+/* */
+/* NXAGENT, NX protocol compression and NX extensions to this software */
+/* are copyright of NoMachine. Redistribution and use of the present */
+/* software is allowed according to terms specified in the file LICENSE */
+/* which comes in the source distribution. */
+/* */
+/* Check http://www.nomachine.com/licensing.html for applicability. */
+/* */
+/* NX and NoMachine are trademarks of Medialogic S.p.A. */
+/* */
+/* All rights reserved. */
+/* */
+/**************************************************************************/
+
/* $XdotOrg: xc/programs/Xserver/Xext/xvdisp.c,v 1.6 2005/07/03 08:53:36 daniels Exp $ */
/***********************************************************
Copyright 1991 by Digital Equipment Corporation, Maynard, Massachusetts,
@@ -71,6 +88,11 @@
#include <X11/extensions/shmstr.h>
#endif
+#include "Trap.h"
+
+#undef TEST
+#undef DEBUG
+
#ifdef EXTMODULE
#include "xf86_ansic.h"
#endif
@@ -227,129 +249,175 @@
int
ProcXvDispatch(ClientPtr client)
{
+ int result;
+
REQUEST(xReq);
UpdateCurrentTime();
+ /*
+ * Report upstream that we are
+ * dispatching a XVideo operation.
+ */
+
+ nxagentXvTrap = 1;
+
+ #ifdef TEST
+ fprintf(stderr, "ProcXvDispatch: Going to dispatch XVideo operation [%d] for client [%d].\n",
+ stuff->data, client -> index);
+ #endif
+
switch (stuff->data)
{
- case xv_QueryExtension: return(ProcXvQueryExtension(client));
- case xv_QueryAdaptors: return(ProcXvQueryAdaptors(client));
- case xv_QueryEncodings: return(ProcXvQueryEncodings(client));
+ case xv_QueryExtension: result = (ProcXvQueryExtension(client)); break;
+ case xv_QueryAdaptors: result = (ProcXvQueryAdaptors(client)); break;
+ case xv_QueryEncodings: result = (ProcXvQueryEncodings(client)); break;
case xv_PutVideo:
#ifdef PANORAMIX
if(!noPanoramiXExtension)
- return(XineramaXvPutVideo(client));
+ result = (XineramaXvPutVideo(client)); break;
else
#endif
- return(ProcXvPutVideo(client));
+ result = (ProcXvPutVideo(client)); break;
case xv_PutStill:
#ifdef PANORAMIX
if(!noPanoramiXExtension)
- return(XineramaXvPutStill(client));
+ result = (XineramaXvPutStill(client)); break
else
#endif
- return(ProcXvPutStill(client));
- case xv_GetVideo: return(ProcXvGetVideo(client));
- case xv_GetStill: return(ProcXvGetStill(client));
- case xv_GrabPort: return(ProcXvGrabPort(client));
- case xv_UngrabPort: return(ProcXvUngrabPort(client));
- case xv_SelectVideoNotify: return(ProcXvSelectVideoNotify(client));
- case xv_SelectPortNotify: return(ProcXvSelectPortNotify(client));
+ result = (ProcXvPutStill(client)); break;
+ case xv_GetVideo: result = (ProcXvGetVideo(client)); break;
+ case xv_GetStill: result = (ProcXvGetStill(client)); break;
+ case xv_GrabPort: result = (ProcXvGrabPort(client)); break;
+ case xv_UngrabPort: result = (ProcXvUngrabPort(client)); break;
+ case xv_SelectVideoNotify: result = (ProcXvSelectVideoNotify(client)); break;
+ case xv_SelectPortNotify: result = (ProcXvSelectPortNotify(client)); break;
case xv_StopVideo:
#ifdef PANORAMIX
if(!noPanoramiXExtension)
- return(XineramaXvStopVideo(client));
+ result = (XineramaXvStopVideo(client)); break;
else
#endif
- return(ProcXvStopVideo(client));
+ result = (ProcXvStopVideo(client)); break;
case xv_SetPortAttribute:
#ifdef PANORAMIX
if(!noPanoramiXExtension)
- return(XineramaXvSetPortAttribute(client));
+ result = (XineramaXvSetPortAttribute(client)); break;
else
#endif
- return(ProcXvSetPortAttribute(client));
- case xv_GetPortAttribute: return(ProcXvGetPortAttribute(client));
- case xv_QueryBestSize: return(ProcXvQueryBestSize(client));
- case xv_QueryPortAttributes: return(ProcXvQueryPortAttributes(client));
+ result = (ProcXvSetPortAttribute(client)); break;
+ case xv_GetPortAttribute: result = (ProcXvGetPortAttribute(client)); break;
+ case xv_QueryBestSize: result = (ProcXvQueryBestSize(client)); break;
+ case xv_QueryPortAttributes: result = (ProcXvQueryPortAttributes(client)); break;
case xv_PutImage:
#ifdef PANORAMIX
if(!noPanoramiXExtension)
- return(XineramaXvPutImage(client));
+ result = (XineramaXvPutImage(client)); break;
else
#endif
- return(ProcXvPutImage(client));
+ result = (ProcXvPutImage(client)); break;
#ifdef MITSHM
case xv_ShmPutImage:
#ifdef PANORAMIX
if(!noPanoramiXExtension)
- return(XineramaXvShmPutImage(client));
+ result = (XineramaXvShmPutImage(client)); break;
else
#endif
- return(ProcXvShmPutImage(client));
+ result = (ProcXvShmPutImage(client)); break;
#endif
- case xv_QueryImageAttributes: return(ProcXvQueryImageAttributes(client));
- case xv_ListImageFormats: return(ProcXvListImageFormats(client));
+ case xv_QueryImageAttributes: result = (ProcXvQueryImageAttributes(client)); break;
+ case xv_ListImageFormats: result = (ProcXvListImageFormats(client)); break;
default:
if (stuff->data < xvNumRequests)
{
SendErrorToClient(client, XvReqCode, stuff->data, 0,
BadImplementation);
- return(BadImplementation);
+ result = (BadImplementation); break;
}
else
{
SendErrorToClient(client, XvReqCode, stuff->data, 0, BadRequest);
- return(BadRequest);
+ result = (BadRequest); break;
}
}
+
+ nxagentXvTrap = 0;
+
+ #ifdef TEST
+ fprintf(stderr, "ProcXvDispatch: Dispatched XVideo operation [%d] for client [%d].\n",
+ stuff->data, client -> index);
+ #endif
+
+ return result;
}
int
SProcXvDispatch(ClientPtr client)
{
+ int result;
+
REQUEST(xReq);
UpdateCurrentTime();
+ /*
+ * Report upstream that we are
+ * dispatching a XVideo operation.
+ */
+
+ nxagentXvTrap = 1;
+
+ #ifdef TEST
+ fprintf(stderr, "SProcXvDispatch: Going to dispatch XVideo operation [%d] for client [%d].\n",
+ stuff->data, client -> index);
+ #endif
+
switch (stuff->data)
{
- case xv_QueryExtension: return(SProcXvQueryExtension(client));
- case xv_QueryAdaptors: return(SProcXvQueryAdaptors(client));
- case xv_QueryEncodings: return(SProcXvQueryEncodings(client));
- case xv_PutVideo: return(SProcXvPutVideo(client));
- case xv_PutStill: return(SProcXvPutStill(client));
- case xv_GetVideo: return(SProcXvGetVideo(client));
- case xv_GetStill: return(SProcXvGetStill(client));
- case xv_GrabPort: return(SProcXvGrabPort(client));
- case xv_UngrabPort: return(SProcXvUngrabPort(client));
- case xv_SelectVideoNotify: return(SProcXvSelectVideoNotify(client));
- case xv_SelectPortNotify: return(SProcXvSelectPortNotify(client));
- case xv_StopVideo: return(SProcXvStopVideo(client));
- case xv_SetPortAttribute: return(SProcXvSetPortAttribute(client));
- case xv_GetPortAttribute: return(SProcXvGetPortAttribute(client));
- case xv_QueryBestSize: return(SProcXvQueryBestSize(client));
- case xv_QueryPortAttributes: return(SProcXvQueryPortAttributes(client));
- case xv_PutImage: return(SProcXvPutImage(client));
+ case xv_QueryExtension: result = (SProcXvQueryExtension(client)); break;
+ case xv_QueryAdaptors: result = (SProcXvQueryAdaptors(client)); break;
+ case xv_QueryEncodings: result = (SProcXvQueryEncodings(client)); break;
+ case xv_PutVideo: result = (SProcXvPutVideo(client)); break;
+ case xv_PutStill: result = (SProcXvPutStill(client)); break;
+ case xv_GetVideo: result = (SProcXvGetVideo(client)); break;
+ case xv_GetStill: result = (SProcXvGetStill(client)); break;
+ case xv_GrabPort: result = (SProcXvGrabPort(client)); break;
+ case xv_UngrabPort: result = (SProcXvUngrabPort(client)); break;
+ case xv_SelectVideoNotify: result = (SProcXvSelectVideoNotify(client)); break;
+ case xv_SelectPortNotify: result = (SProcXvSelectPortNotify(client)); break;
+ case xv_StopVideo: result = (SProcXvStopVideo(client)); break;
+ case xv_SetPortAttribute: result = (SProcXvSetPortAttribute(client)); break;
+ case xv_GetPortAttribute: result = (SProcXvGetPortAttribute(client)); break;
+ case xv_QueryBestSize: result = (SProcXvQueryBestSize(client)); break;
+ case xv_QueryPortAttributes: result = (SProcXvQueryPortAttributes(client)); break;
+ case xv_PutImage: result = (SProcXvPutImage(client)); break;
#ifdef MITSHM
- case xv_ShmPutImage: return(SProcXvShmPutImage(client));
+ case xv_ShmPutImage: result = (SProcXvShmPutImage(client)); break;
#endif
- case xv_QueryImageAttributes: return(SProcXvQueryImageAttributes(client));
- case xv_ListImageFormats: return(SProcXvListImageFormats(client));
+ case xv_QueryImageAttributes: result = (SProcXvQueryImageAttributes(client)); break;
+ case xv_ListImageFormats: result = (SProcXvListImageFormats(client)); break;
default:
if (stuff->data < xvNumRequests)
{
SendErrorToClient(client, XvReqCode, stuff->data, 0,
BadImplementation);
- return(BadImplementation);
+ result = (BadImplementation); break;
}
else
{
SendErrorToClient(client, XvReqCode, stuff->data, 0, BadRequest);
- return(BadRequest);
+ result = (BadRequest); break;
}
}
+
+ nxagentXvTrap = 0;
+
+ #ifdef TEST
+ fprintf(stderr, "ProcXvDispatch: Dispatched XVideo operation [%d] for client [%d].\n",
+ stuff->data, client -> index);
+ #endif
+
+ return result;
}
static int
@@ -2215,3 +2283,4 @@
}
#endif
+

View File

@@ -0,0 +1,12 @@
--- ./nx-X11/programs/Xserver/include/dixstruct.h.X.original 2015-02-13 14:03:44.780440803 +0100
+++ ./nx-X11/programs/Xserver/include/dixstruct.h 2015-02-10 19:13:14.300667345 +0100
@@ -170,6 +170,9 @@
extern Bool SmartScheduleIdle;
extern Bool SmartScheduleTimerStopped;
extern Bool SmartScheduleStartTimer(void);
+#ifdef NXAGENT_SERVER
+extern Bool SmartScheduleStopTimer(void);
+#endif
#define SMART_MAX_PRIORITY (20)
#define SMART_MIN_PRIORITY (-20)

View File

@@ -0,0 +1,271 @@
--- ./nx-X11/programs/Xserver/os/WaitFor.c.X.original 2015-02-13 14:03:44.788440645 +0100
+++ ./nx-X11/programs/Xserver/os/WaitFor.c 2015-02-10 19:13:13.464698616 +0100
@@ -48,6 +48,23 @@
/* $Xorg: WaitFor.c,v 1.4 2001/02/09 02:05:22 xorgcvs Exp $ */
+/**************************************************************************/
+/* */
+/* Copyright (c) 2001, 2011 NoMachine, http://www.nomachine.com/. */
+/* */
+/* NX-X11, NX protocol compression and NX extensions to this software */
+/* are copyright of NoMachine. Redistribution and use of the present */
+/* software is allowed according to terms specified in the file LICENSE */
+/* which comes in the source distribution. */
+/* */
+/* Check http://www.nomachine.com/licensing.html for applicability. */
+/* */
+/* NX and NoMachine are trademarks of Medialogic S.p.A. */
+/* */
+/* All rights reserved. */
+/* */
+/**************************************************************************/
+
/*****************************************************************
* OS Dependent input routines:
*
@@ -80,6 +97,12 @@
#include "dpmsproc.h"
#endif
+#if defined(NX_TRANS_SOCKET) && defined(NX_TRANS_WAKEUP)
+
+static unsigned long startTimeInMillis;
+
+#endif
+
#ifdef WIN32
/* Error codes from windows sockets differ from fileio error codes */
#undef EINTR
@@ -169,8 +192,18 @@
Bool someReady = FALSE;
#endif
+#if defined(NX_TRANS_SOCKET) && defined(NX_TRANS_DEBUG)
+ fprintf(stderr, "WaitForSomething: Got called.\n");
+#endif
+
FD_ZERO(&clientsReadable);
+#if defined(NX_TRANS_SOCKET) && defined(NX_TRANS_WAKEUP)
+
+ startTimeInMillis = GetTimeInMillis();
+
+#endif
+
/* We need a while loop here to handle
crashed connections and the screen saver timeout */
while (1)
@@ -231,18 +264,127 @@
XTestComputeWaitTime (&waittime);
}
#endif /* XTESTEXT1 */
+
+#if defined(NX_TRANS_SOCKET) && defined(NX_TRANS_WAKEUP)
+
+ /*
+ * If caller has marked the first element of pClientsReady[],
+ * bail out of select after a short timeout. We need this to
+ * let the NX agent remove the splash screen when the timeout
+ * is expired. A better option would be to use the existing
+ * screen-saver timeout but it can be modified by clients, so
+ * we would need a special handling. This hack is trivial and
+ * keeps WaitForSomething() backward compatible with the exis-
+ * ting servers.
+ */
+
+ if (pClientsReady[0] == -1)
+ {
+ unsigned long timeoutInMillis;
+
+#if defined(NX_TRANS_SOCKET) && defined(NX_TRANS_WAKEUP) && defined(NX_TRANS_DEBUG)
+ fprintf(stderr, "WaitForSomething: pClientsReady[0] is [%d], pClientsReady[1] is [%d].\n",
+ pClientsReady[0], pClientsReady[1]);
+#endif
+
+ timeoutInMillis = GetTimeInMillis();
+
+ if (timeoutInMillis - startTimeInMillis >= NX_TRANS_WAKEUP)
+ {
+#if defined(NX_TRANS_SOCKET) && defined(NX_TRANS_WAKEUP) && defined(NX_TRANS_DEBUG)
+ fprintf(stderr, "WaitForSomething: Returning 0 because of wakeup timeout.\n");
+#endif
+ return 0;
+ }
+
+ timeoutInMillis = NX_TRANS_WAKEUP - (timeoutInMillis - startTimeInMillis);
+
+#if defined(NX_TRANS_SOCKET) && defined(NX_TRANS_WAKEUP) && defined(NX_TRANS_DEBUG)
+ fprintf(stderr, "WaitForSomething: Milliseconds to next wakeup are %ld.\n",
+ timeoutInMillis);
+#endif
+ if (wt == NULL || (wt -> tv_sec * MILLI_PER_SECOND +
+ wt -> tv_usec / MILLI_PER_SECOND) > timeoutInMillis)
+ {
+ if ((waittime.tv_sec * MILLI_PER_SECOND +
+ waittime.tv_usec / MILLI_PER_SECOND) > timeoutInMillis)
+ {
+ waittime.tv_sec = timeoutInMillis / MILLI_PER_SECOND;
+ waittime.tv_usec = (timeoutInMillis * MILLI_PER_SECOND) %
+ (MILLI_PER_SECOND * 1000);
+ wt = &waittime;
+ }
+
+#if defined(NX_TRANS_SOCKET) && defined(NX_TRANS_WAKEUP) && defined(NX_TRANS_DEBUG)
+ fprintf(stderr, "WaitForSomething: Next wakeup timeout set to %ld milliseconds.\n",
+ (waittime.tv_sec * MILLI_PER_SECOND) +
+ (waittime.tv_usec / MILLI_PER_SECOND));
+#endif
+ }
+#if defined(NX_TRANS_SOCKET) && defined(NX_TRANS_WAKEUP) && defined(NX_TRANS_DEBUG)
+ else
+ {
+ fprintf(stderr, "WaitForSomething: Using existing timeout of %ld milliseconds.\n",
+ (waittime.tv_sec * MILLI_PER_SECOND) +
+ (waittime.tv_usec / MILLI_PER_SECOND));
+ }
+#endif
+ }
+#endif
+
/* keep this check close to select() call to minimize race */
+#if defined(NX_TRANS_SOCKET) && defined(NX_TRANS_DEBUG)
if (dispatchException)
+ {
i = -1;
+
+ fprintf(stderr, "WaitForSomething: Value of dispatchException is true. Set i = -1.\n");
+ }
+#else
+ if (dispatchException)
+ i = -1;
+#endif
else if (AnyClientsWriteBlocked)
{
+#if defined(NX_TRANS_SOCKET) && defined(NX_TRANS_DEBUG)
+ if (wt == NULL)
+ {
+ fprintf(stderr, "WaitForSomething: Executing select with LastSelectMask and "
+ "clientsWritable and null timeout.\n");
+ }
+ else
+ {
+ fprintf(stderr, "WaitForSomething: Executing select with LastSelectMask, "
+ "clientsWritable, %ld secs and %ld usecs.\n",
+ wt -> tv_sec, wt -> tv_usec);
+ }
+#endif
XFD_COPYSET(&ClientsWriteBlocked, &clientsWritable);
i = Select (MaxClients, &LastSelectMask, &clientsWritable, NULL, wt);
}
else
{
+#if defined(NX_TRANS_SOCKET) && defined(NX_TRANS_DEBUG)
+ if (wt == NULL)
+ {
+ fprintf(stderr, "WaitForSomething: Executing select with LastSelectMask and null timeout.\n");
+ }
+ else
+ {
+ fprintf(stderr, "WaitForSomething: Executing select with LastSelectMask, %ld secs and %ld usecs.\n",
+ wt -> tv_sec, wt -> tv_usec);
+ }
+#endif
i = Select (MaxClients, &LastSelectMask, NULL, NULL, wt);
}
+#if defined(NX_TRANS_SOCKET) && defined(NX_TRANS_DEBUG)
+ fprintf(stderr, "WaitForSomething: Bailed out with i = [%d] and errno = [%d].\n", i, errno);
+
+ if (i < 0)
+ {
+ fprintf(stderr, "WaitForSomething: Error is [%s].\n", strerror(errno));
+ }
+#endif
selecterr = GetErrno();
WakeupHandler(i, (pointer)&LastSelectMask);
#ifdef XTESTEXT1
@@ -261,15 +403,31 @@
#endif
if (i <= 0) /* An error or timeout occurred */
{
- if (dispatchException)
- return 0;
+#if defined(NX_TRANS_SOCKET) && defined(NX_TRANS_DEBUG)
+ if (dispatchException)
+ {
+ fprintf(stderr, "WaitForSomething: Returning 0 because of (dispatchException).\n");
+ return 0;
+ }
+#else
+ if (dispatchException)
+ return 0;
+#endif
if (i < 0)
{
if (selecterr == EBADF) /* Some client disconnected */
{
CheckConnections ();
- if (! XFD_ANYSET (&AllClients))
- return 0;
+#if defined(NX_TRANS_SOCKET) && defined(NX_TRANS_DEBUG)
+ if (! XFD_ANYSET (&AllClients))
+ {
+ fprintf(stderr, "WaitForSomething: Returning 0 because of (! XFD_ANYSET (&AllClients)).\n");
+ return 0;
+ }
+#else
+ if (! XFD_ANYSET (&AllClients))
+ return 0;
+#endif
}
else if (selecterr == EINVAL)
{
@@ -293,8 +451,18 @@
break;
}
#endif
+#if defined(NX_TRANS_SOCKET)
+ if (*checkForInput[0] != *checkForInput[1])
+ {
+#if defined(NX_TRANS_SOCKET) && defined(NX_TRANS_DEBUG)
+ fprintf(stderr, "WaitForSomething: Returning 0 because of (*checkForInput[0] != *checkForInput[1]).\n");
+#endif
+ return 0;
+ }
+#else
if (*checkForInput[0] != *checkForInput[1])
return 0;
+#endif
if (timers)
{
@@ -358,9 +526,19 @@
/* Windows keyboard and mouse events are added to the input queue
in Block- and WakupHandlers. There is no device to check if
data is ready. So check here if new input is available */
+#if defined(NX_TRANS_SOCKET)
+ if (*checkForInput[0] != *checkForInput[1])
+ {
+#if defined(NX_TRANS_SOCKET) && defined(NX_TRANS_DEBUG)
+ fprintf(stderr, "WaitForSomething: Returning 0 because of (*checkForInput[0] != *checkForInput[1]).\n");
+#endif
+ return 0;
+ }
+#else
if (*checkForInput[0] != *checkForInput[1])
return 0;
#endif
+#endif
}
}
@@ -429,6 +607,9 @@
#endif
}
}
+#if defined(NX_TRANS_SOCKET) && defined(NX_TRANS_DEBUG)
+ fprintf(stderr, "WaitForSomething: Returning nready.\n");
+#endif
return nready;
}

View File

@@ -0,0 +1,271 @@
--- ./nx-X11/programs/Xserver/os/auth.c.X.original 2015-02-13 14:03:44.788440645 +0100
+++ ./nx-X11/programs/Xserver/os/auth.c 2015-02-10 19:13:13.452699065 +0100
@@ -28,6 +28,23 @@
*/
/* $XFree86: auth.c,v 1.13 2003/04/27 21:31:08 herrb Exp $ */
+/**************************************************************************/
+/* */
+/* Copyright (c) 2001, 2011 NoMachine, http://www.nomachine.com/. */
+/* */
+/* NX-X11, NX protocol compression and NX extensions to this software */
+/* are copyright of NoMachine. Redistribution and use of the present */
+/* software is allowed according to terms specified in the file LICENSE */
+/* which comes in the source distribution. */
+/* */
+/* Check http://www.nomachine.com/licensing.html for applicability. */
+/* */
+/* NX and NoMachine are trademarks of Medialogic S.p.A. */
+/* */
+/* All rights reserved. */
+/* */
+/**************************************************************************/
+
/*
* authorization hooks for the server
* Author: Keith Packard, MIT X Consortium
@@ -129,7 +146,24 @@
void
InitAuthorization (char *file_name)
{
+#ifdef __sun
+ char * envBuffer;
+#endif
authorization_file = file_name;
+#ifdef NX_TRANS_AUTH
+#ifdef NX_TRANS_TEST
+ fprintf(stderr, "InitAuthorization: Going to propagate auth file '%s' to the environment.\n",
+ authorization_file);
+#endif
+#ifdef __sun
+ envBuffer = malloc(15+strlen(authorization_file));
+ sprintf(envBuffer,"NX_XAUTHORITY=%s",authorization_file);
+ putenv(envBuffer);
+#else
+ setenv("NX_XAUTHORITY", authorization_file, 1);
+#endif
+#endif
+
}
static int
@@ -144,6 +178,68 @@
if (!authorization_file)
return 0;
+#ifdef NX_TRANS_AUTH
+
+ /*
+ * We think that the way LoadAuthorization() is working is wrong.
+ * It doesn't reset the list of stored authorizations before reading
+ * the new cookies. Our take is that if a new auth file is to be
+ * read, the only cookies that are to be accepted are those that are
+ * in the new file, not those in the file -plus- those that have
+ * been in the file in the past. Furthermore, if the list can't be
+ * read or it is empty, it should assume that it ignores which co-
+ * okies are valid and thus it should disable any access. Your mile-
+ * age can vary. A less draconian approach could be to leave the old
+ * cookies if the file can't be read and remove them only if the
+ * file is empty.
+ *
+ * Adding the cookies without removing the old values for the same
+ * protocol has an important implication. If an user shares the co-
+ * okie with somebody and later wants to revoke the access to the
+ * display, changing the cookie will not work. This is especially
+ * important with NX. For security reasons, after reconnecting the
+ * session to a different display, it is advisable to generate a
+ * new set of cookies, but doing that it is useless with the current
+ * code, as the old cookies are going to be still accepted. On the
+ * same topic, consider that once an user has got access to the X
+ * server, he/she can freely enable host authentication from any
+ * host, so the safe behaviour should be to reset the host based
+ * authenthication at least at reconnection, and keep as valid only
+ * the cookies that are actually in the file. This behaviour would
+ * surely break many applications, among them a SSH connection run
+ * inside a NX session, as ssh -X reads the cookie for the display
+ * only at session startup and does not read the cookies again
+ * when the auth file is changed.
+ *
+ * Another bug (or feature, depending on how you want to consider
+ * it) is that if the authority file contains entries for different
+ * displays (as it is the norm when the authority file is the default
+ * .Xauthority in the user's home), the server will match -any- of
+ * the cookies, even cookies that are not for its own display. This
+ * means that you have be careful when passing an authority file to
+ * nxagent or Xnest and maybe keep separate files for letting nxagent
+ * find the cookie to be used to connect to the remote display and
+ * for letting it find what cookies to accept. If the file is the
+ * same, clients will be able to connect to nxagent with both the
+ * cookies.
+ */
+
+#ifdef NX_TRANS_AUTH_RESET
+
+ #ifdef NX_TRANS_TEST
+ fprintf(stderr, "LoadAuthorization: Resetting authorization info.\n");
+ #endif
+
+ for (i = 0; i < NUM_AUTHORIZATION; i++) {
+ if (protocols[i].Reset) {
+ (*protocols[i].Reset) ();
+ }
+ }
+
+#endif
+
+#endif /* #ifdef NX_TRANS_AUTH */
+
f = Fopen (authorization_file, "r");
if (!f)
return -1;
@@ -154,6 +250,14 @@
memcmp (protocols[i].name, auth->name, (int) auth->name_length) == 0 &&
protocols[i].Add)
{
+#ifdef NX_TRANS_AUTH
+
+ #ifdef NX_TRANS_TEST
+ fprintf(stderr, "LoadAuthorization: Adding new record from file [%s].\n",
+ authorization_file);
+ #endif
+
+#endif
++count;
(*protocols[i].Add) (auth->data_length, auth->data,
FakeClientID(0));
@@ -162,7 +266,46 @@
XauDisposeAuth (auth);
}
+#ifdef NX_TRANS_AUTH
+
+ if (count == 0)
+ {
+ fprintf(stderr, "Warning: No authorization record could be read from file '%s'.\n",
+ authorization_file);
+
+ fprintf(stderr, "Warning: Please, create a valid authorization cookie using the command\n"
+ "Warning: 'xauth -f %s add <display> MIT-MAGIC-COOKIE-1 <cookie>'.\n",
+ authorization_file);
+ }
+
+#endif
+
+#ifdef NX_TRANS_AUTH
+ if (Fclose (f) != 0)
+ {
+ /*
+ * If the Fclose() fails, for example because of a signal,
+ * it's advisable to return the number of protocols read,
+ * if any, or otherwise the server would believe that no
+ * cookie is valid and eventually fall back to host based
+ * authentication. Note anyway that the new code in Check-
+ * Authorization() doesn't care the return value and gives
+ * a chance to the function to check the file at the next
+ * connection.
+ */
+
+ if (count > 0)
+ {
+ return count;
+ }
+ else
+ {
+ return -1;
+ }
+ }
+#else
Fclose (f);
+#endif
return count;
}
@@ -194,7 +337,10 @@
int i;
struct stat buf;
static time_t lastmod = 0;
+
+ #ifndef NX_TRANS_AUTH
static Bool loaded = FALSE;
+ #endif
if (!authorization_file || stat(authorization_file, &buf))
{
@@ -225,7 +371,67 @@
* entries for this server), and reloading it later fails, don't
* change anything. (loadauth == -1 && loaded)
*/
-
+
+#ifdef NX_TRANS_AUTH
+
+ /*
+ * The implementation of CheckAuthorization() was changed. The way
+ * the auth file was handled previously was questionable and could
+ * open the way to a vast array of security problems. There might be
+ * ways for an attacker to prevent the server from reading the file
+ * and it was enough for the server to fail reading the file once
+ * (because of a not blocked signal, for example) to leave the dis-
+ * play open to all the users running a session on the same terminal
+ * server.
+ *
+ * In NX we want to have only two cases: either we have to check an
+ * authorization file or we don't. In the first case we need to do our
+ * best to read the file at any new client access and never fall back
+ * to host based authentication. Falling back to local host access has
+ * no way back, as it will always take precedence over the auth cookie
+ * (unless the user explicitly disables, one by one, all the rules
+ * allowing local access, if and only if he/she becomes aware of the
+ * problem). In the second case we assume that user doesn't care secu-
+ * rity and so allow unrestricted access from the local machine.
+ */
+
+ #ifdef NX_TRANS_TEST
+ fprintf(stderr, "CheckAuthorization: Going to set authorization with loadauth [%d].\n",
+ loadauth);
+ #endif
+
+ if (authorization_file)
+ {
+ #ifdef NX_TRANS_TEST
+ fprintf(stderr, "CheckAuthorization: Disabling local host access.\n");
+ #endif
+
+ DisableLocalHost();
+ }
+ else
+ {
+ /*
+ * Enable host-based authentication only if
+ * the authorization file was not specified
+ * either on the command line or in the env-
+ * ironment.
+ */
+
+ #ifdef NX_TRANS_TEST
+ fprintf(stderr, "CheckAuthorization: Enabling local host access.\n");
+ #endif
+
+ EnableLocalHost();
+ }
+
+ /*
+ * Avoid the 'unused variable' warning.
+ */
+
+ loadauth = loadauth;
+
+#else /* #ifdef NX_TRANS_AUTH */
+
if (loadauth > 0)
{
DisableLocalHost(); /* got at least one */
@@ -233,6 +439,8 @@
}
else if (loadauth == 0 || !loaded)
EnableLocalHost ();
+
+#endif /* #ifdef NX_TRANS_AUTH */
}
if (name_length) {
for (i = 0; i < NUM_AUTHORIZATION; i++) {

View File

@@ -0,0 +1,48 @@
--- ./nx-X11/programs/Xserver/os/connection.c.X.original 2015-02-13 14:03:44.788440645 +0100
+++ ./nx-X11/programs/Xserver/os/connection.c 2015-02-10 19:13:13.452699065 +0100
@@ -486,6 +486,45 @@
#endif
}
+#ifdef NX_TRANS_SOCKET
+
+/*
+ * The following block is now defined also
+ * under Cygwin to support this environment.
+ */
+
+#ifndef __DARWIN__
+
+/*
+ * This is defined in Xtranssock.c and must
+ * be called explicitly as it doesn't share
+ * a pointer in the transport function table.
+ */
+
+extern void _XSERVTransSocketRejectConnection(XtransConnInfo);
+
+void
+RejectWellKnownSockets ()
+{
+ int i;
+
+ for (i = 0; i < ListenTransCount; i++)
+ {
+ _XSERVTransSocketRejectConnection(ListenTransConns[i]);
+ }
+}
+
+#endif /* #ifndef __DARWIN__ */
+
+#else /* #ifdef NX_TRANS_SOCKET */
+
+void
+RejectWellKnownSockets ()
+{
+}
+
+#endif /* #ifdef NX_TRANS_SOCKET */
+
void
ResetWellKnownSockets (void)
{

View File

@@ -0,0 +1,136 @@
--- ./nx-X11/programs/Xserver/os/log.c.X.original 2015-02-13 14:03:44.788440645 +0100
+++ ./nx-X11/programs/Xserver/os/log.c 2015-02-13 14:03:44.788440645 +0100
@@ -78,6 +78,23 @@
/* $XFree86: xc/programs/Xserver/os/log.c,v 1.6 2003/11/07 13:45:27 tsi Exp $ */
+/**************************************************************************/
+/* */
+/* Copyright (c) 2001, 2011 NoMachine, http://www.nomachine.com/. */
+/* */
+/* NX-X11, NX protocol compression and NX extensions to this software */
+/* are copyright of NoMachine. Redistribution and use of the present */
+/* software is allowed according to terms specified in the file LICENSE */
+/* which comes in the source distribution. */
+/* */
+/* Check http://www.nomachine.com/licensing.html for applicability. */
+/* */
+/* NX and NoMachine are trademarks of Medialogic S.p.A. */
+/* */
+/* All rights reserved. */
+/* */
+/**************************************************************************/
+
#ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h>
#endif
@@ -98,9 +115,17 @@
#define getpid(x) _getpid(x)
#endif
+#ifdef NX_TRANS_SOCKET
+
+#include "NX.h"
+
+#endif
#ifdef DDXOSVERRORF
void (*OsVendorVErrorFProc)(const char *, va_list args) = NULL;
+#ifdef NX_TRANS_EXIT
+int OsVendorVErrorFFatal = 0;
+#endif
#endif
static FILE *logFile = NULL;
@@ -265,6 +290,32 @@
*/
if (verb < 0 || logFileVerbosity >= verb || logVerbosity >= verb) {
vsnprintf(tmpBuffer, sizeof(tmpBuffer), f, args);
+#ifdef NX_TRANS_EXIT
+ /*
+ * Beautify the message. Make the
+ * first letter uppercase.
+ */
+
+ *tmpBuffer = toupper(*tmpBuffer);
+
+ /*
+ * Remove the trailing newline.
+ */
+
+ if (strlen(tmpBuffer) > 0 &&
+ *(tmpBuffer + strlen(tmpBuffer) - 1) == '\n') {
+ *(tmpBuffer + strlen(tmpBuffer) - 1) = '\0';
+ }
+
+ /*
+ * Remove the trailing full-stop.
+ */
+
+ if (strlen(tmpBuffer) > 0 &&
+ *(tmpBuffer + strlen(tmpBuffer) - 1) == '.') {
+ *(tmpBuffer + strlen(tmpBuffer) - 1) = '\0';
+ }
+#endif /* #ifdef NX_TRANS_EXIT */
len = strlen(tmpBuffer);
}
if ((verb < 0 || logVerbosity >= verb) && len > 0)
@@ -404,12 +455,22 @@
void
AbortServer(void)
{
+#if defined(NX_TRANS_SOCKET) && defined(NX_TRANS_TEST)
+ fprintf(stderr, "AbortServer: Going to abort the current server.\n");
+#endif
OsCleanup(TRUE);
AbortDDX();
fflush(stderr);
if (CoreDump)
abort();
+#ifdef NX_TRANS_EXIT
+#ifdef NX_TRANS_TEST
+ fprintf(stderr, "AbortServer: Going to clean up NX resources and exit.\n");
+#endif
+ NXTransExit(1);
+#else /* #ifdef NX_TRANS_EXIT */
exit (1);
+#endif
}
#ifndef AUDIT_PREFIX
@@ -533,6 +594,27 @@
va_list args;
static Bool beenhere = FALSE;
+#ifdef NX_TRANS_EXIT
+ if (beenhere) {
+ fprintf(stderr, "Error: Aborting session with fatal error function reentered.\n");
+ }
+ else {
+ /*
+ * Tell to the log function that this
+ * is a fatal error.
+ */
+
+ OsVendorVErrorFFatal = 1;
+
+ fprintf(stderr, "Error: Aborting session with '");
+
+ va_start(args, f);
+ VErrorF(f, args);
+ va_end(args);
+
+ fprintf(stderr, "'.\n");
+ }
+#else /* #ifdef NX_TRANS_EXIT */
if (beenhere)
ErrorF("\nFatalError re-entered, aborting\n");
else
@@ -542,6 +624,7 @@
VErrorF(f, args);
va_end(args);
ErrorF("\n");
+#endif /* #ifdef NX_TRANS_EXIT */
#ifdef DDXOSFATALERROR
if (!beenhere)
OsVendorFatalError();

View File

@@ -0,0 +1,214 @@
--- ./nx-X11/programs/Xserver/os/oscolor.c.X.original 2015-02-13 14:03:44.788440645 +0100
+++ ./nx-X11/programs/Xserver/os/oscolor.c 2015-02-13 14:03:44.788440645 +0100
@@ -47,6 +47,17 @@
******************************************************************/
/* $Xorg: oscolor.c,v 1.4 2001/02/09 02:05:23 xorgcvs Exp $ */
+#ifdef NX_TRANS_SOCKET
+
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <unistd.h>
+
+static char* nxAltRgbPaths[] = {"/usr/NX/share/rgb", "/usr/share/X11/rgb", "/etc/X11/rgb"};
+static char _NXRgbPath[1024];
+
+#endif
+
#ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h>
#endif
@@ -174,6 +185,154 @@
static dbEntryPtr hashTab[HASHSIZE];
+#ifdef NX_TRANS_SOCKET
+
+static int NXVerifyRgbPath(char *path)
+{
+ int size;
+ char *rgbPath;
+ struct stat rgbFileStat;
+
+ /*
+ * Check if rgb file is present.
+ */
+
+ size = strlen(path) + strlen(".txt") + 1;
+
+ rgbPath = (char *) ALLOCATE_LOCAL(size + 1);
+
+ strcpy(rgbPath, path);
+
+ #ifdef NX_TRANS_TEST
+ fprintf(stderr, "NXVerifyRgbPath: Looking for [%s] file.\n",
+ rgbPath);
+ #endif
+
+ if (stat(rgbPath, &rgbFileStat) != 0)
+ {
+
+ #ifdef NX_TRANS_TEST
+ fprintf(stderr, "NXVerifyRgbPath: Can't find the rgb file [%s].\n",
+ rgbPath);
+ #endif
+
+ strcat(rgbPath, ".txt");
+
+ #ifdef NX_TRANS_TEST
+ fprintf(stderr, "NXVerifyRgbPath: Looking for [%s] file.\n",
+ rgbPath);
+ #endif
+
+ if (stat(rgbPath, &rgbFileStat) != 0)
+ {
+
+ #ifdef NX_TRANS_TEST
+ fprintf(stderr, "NXVerifyRgbPath: Can't find the rgb file [%s].\n",
+ rgbPath);
+ #endif
+
+ DEALLOCATE_LOCAL(rgbPath);
+
+ return 0;
+ }
+ }
+
+ #ifdef NX_TRANS_TEST
+ fprintf(stderr, "NXVerifyRgbPath: rgb path [%s] is valid.\n",
+ path);
+ #endif
+
+ DEALLOCATE_LOCAL(rgbPath);
+
+ return 1;
+}
+
+static const char *_NXGetRgbPath(const char *path)
+{
+ const char *systemEnv;
+ char rgbPath[1024];
+ int numAltRgbPaths;
+ int i;
+
+ /*
+ * Check the environment only once.
+ */
+
+ if (*_NXRgbPath != '\0')
+ {
+ return _NXRgbPath;
+ }
+
+ systemEnv = getenv("NX_SYSTEM");
+
+ if (systemEnv != NULL && *systemEnv != '\0')
+ {
+ if (strlen(systemEnv) + strlen("/share/rgb") + 1 > 1024)
+ {
+
+ #ifdef NX_TRANS_TEST
+ fprintf(stderr, "_NXGetRgbPath: WARNING! Maximum length of rgb file path exceeded.\n");
+ #endif
+
+ goto _NXGetRgbPathError;
+ }
+
+ strcpy(rgbPath, systemEnv);
+ strcat(rgbPath, "/share/rgb");
+
+ if (NXVerifyRgbPath(rgbPath) == 1)
+ {
+ strcpy(_NXRgbPath, systemEnv);
+ strcat(_NXRgbPath, "/share/rgb");
+
+ #ifdef NX_TRANS_TEST
+ fprintf(stderr, "_NXGetRgbPath: Using rgb file path [%s].\n",
+ _NXRgbPath);
+ #endif
+
+ return _NXRgbPath;
+ }
+ }
+
+ numAltRgbPaths = sizeof(nxAltRgbPaths) / sizeof(*nxAltRgbPaths);
+
+ for (i = 0; i < numAltRgbPaths; i++)
+ {
+ if (NXVerifyRgbPath(nxAltRgbPaths[i]) == 1)
+ {
+ if (strlen(nxAltRgbPaths[i]) + 1 > 1024)
+ {
+ #ifdef NX_TRANS_TEST
+ fprintf(stderr, "_NXGetRgbPath: WARNING! Maximum length of rgb file path exceeded.\n");
+ #endif
+
+ goto _NXGetRgbPathError;
+ }
+
+ strcpy(_NXRgbPath, nxAltRgbPaths[i]);
+
+ #ifdef NX_TRANS_TEST
+ fprintf(stderr, "_NXGetRgbPath: Using rgb file path [%s].\n",
+ _NXRgbPath);
+ #endif
+
+ return _NXRgbPath;
+ }
+ }
+
+_NXGetRgbPathError:
+
+ strcpy(_NXRgbPath, path);
+
+ #ifdef NX_TRANS_TEST
+ fprintf(stderr, "_NXGetRgbPath: Using default rgb file path [%s].\n",
+ _NXRgbPath);
+ #endif
+
+ return _NXRgbPath;
+}
+
+#endif
static dbEntryPtr
lookup(char *name, int len, Bool create)
@@ -229,9 +388,26 @@
if (!was_here)
{
#ifndef __UNIXOS2__
+#ifdef NX_TRANS_SOCKET
+ /*
+ * Add the trailing '.txt' if a
+ * 'rgb' file is not found.
+ */
+
+ struct stat statbuf;
+
+ path = (char*)ALLOCATE_LOCAL(strlen(_NXGetRgbPath(rgbPath)) + 5);
+ strcpy(path, _NXGetRgbPath(rgbPath));
+
+ if (stat(path, &statbuf) != 0)
+ {
+ strcat(path, ".txt");
+ }
+#else
path = (char*)ALLOCATE_LOCAL(strlen(rgbPath) +5);
strcpy(path, rgbPath);
strcat(path, ".txt");
+#endif
#else
char *tmp = (char*)__XOS2RedirRoot(rgbPath);
path = (char*)ALLOCATE_LOCAL(strlen(tmp) +5);
@@ -240,7 +416,11 @@
#endif
if (!(rgb = fopen(path, "r")))
{
+#ifdef NX_TRANS_SOCKET
+ ErrorF( "Couldn't open RGB_DB '%s'\n", _NXGetRgbPath(rgbPath));
+#else
ErrorF( "Couldn't open RGB_DB '%s'\n", rgbPath );
+#endif
DEALLOCATE_LOCAL(path);
return FALSE;
}

View File

@@ -0,0 +1,250 @@
--- ./nx-X11/programs/Xserver/os/utils.c.X.original 2015-02-13 14:03:44.792440567 +0100
+++ ./nx-X11/programs/Xserver/os/utils.c 2015-02-13 14:03:44.788440645 +0100
@@ -52,6 +52,23 @@
*/
/* $XFree86: xc/programs/Xserver/os/utils.c,v 3.96 2004/01/07 04:16:37 dawes Exp $ */
+/**************************************************************************/
+/* */
+/* Copyright (c) 2001, 2011 NoMachine, http://www.nomachine.com/. */
+/* */
+/* NX-X11, NX protocol compression and NX extensions to this software */
+/* are copyright of NoMachine. Redistribution and use of the present */
+/* software is allowed according to terms specified in the file LICENSE */
+/* which comes in the source distribution. */
+/* */
+/* Check http://www.nomachine.com/licensing.html for applicability. */
+/* */
+/* NX and NoMachine are trademarks of Medialogic S.p.A. */
+/* */
+/* All rights reserved. */
+/* */
+/**************************************************************************/
+
#ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h>
#endif
@@ -246,6 +263,20 @@
#include <errno.h>
+#ifdef NX_TRANS_SOCKET
+
+#include "NX.h"
+#include "NXvars.h"
+
+#endif
+
+#ifdef NX_TRANS_EXIT
+
+void (*OsVendorStartRedirectErrorFProc)() = NULL;
+void (*OsVendorEndRedirectErrorFProc)() = NULL;
+
+#endif
+
Bool CoreDump;
#ifdef PANORAMIX
@@ -543,6 +574,10 @@
{
int olderrno = errno;
+#if defined(NX_TRANS_SOCKET) && defined(NX_TRANS_TEST)
+ fprintf(stderr, "GiveUp: Called with signal [%d].\n", sig);
+#endif
+
dispatchException |= DE_TERMINATE;
isItTimeToYield = TRUE;
#if defined(SYSV) && defined(X_NOT_POSIX)
@@ -1548,12 +1583,21 @@
#define SMART_SCHEDULE_TIMER ITIMER_REAL
#endif
+#ifdef NX_TRANS_SOCKET
+void
+SmartScheduleStopTimer (void)
+#else
static void
SmartScheduleStopTimer (void)
+#endif
{
#ifdef SMART_SCHEDULE_POSSIBLE
struct itimerval timer;
-
+
+ #ifdef NX_TRANS_TEST
+ fprintf(stderr, "SmartScheduleStopTimer: Stopping timer.\n");
+ #endif
+
timer.it_interval.tv_sec = 0;
timer.it_interval.tv_usec = 0;
timer.it_value.tv_sec = 0;
@@ -1568,7 +1612,21 @@
{
#ifdef SMART_SCHEDULE_POSSIBLE
struct itimerval timer;
-
+
+ #ifdef NX_TRANS_SOCKET
+
+ if (SmartScheduleDisable)
+ {
+ return FALSE;
+ }
+
+ #endif
+
+ #ifdef NX_TRANS_TEST
+ fprintf(stderr, "SmartScheduleStartTimer: Starting timer with [%ld] ms.\n",
+ SmartScheduleInterval);
+ #endif
+
SmartScheduleTimerStopped = FALSE;
timer.it_interval.tv_sec = 0;
timer.it_interval.tv_usec = SmartScheduleInterval * 1000;
@@ -1586,6 +1644,12 @@
int olderrno = errno;
SmartScheduleTime += SmartScheduleInterval;
+
+ #ifdef NX_TRANS_TEST
+ fprintf(stderr, "SmartScheduleTimer: Got timer with time [%ld] ms.\n",
+ SmartScheduleTime);
+ #endif
+
if (SmartScheduleIdle)
{
SmartScheduleStopTimer ();
@@ -1603,6 +1667,10 @@
if (SmartScheduleDisable)
return TRUE;
+ #ifdef NX_TRANS_TEST
+ fprintf(stderr, "SmartScheduleInit: Initializing the smart scheduler.\n");
+ #endif
+
bzero ((char *) &act, sizeof(struct sigaction));
/* Set up the timer signal function */
@@ -1714,6 +1782,11 @@
ErrorF("System: `%s'\n", command);
#endif
+#ifdef NX_TRANS_EXIT
+ if (OsVendorStartRedirectErrorFProc != NULL) {
+ OsVendorStartRedirectErrorFProc();
+ }
+#endif
switch (pid = fork()) {
case -1: /* error */
p = -1;
@@ -1730,6 +1803,11 @@
} while (p == -1 && errno == EINTR);
}
+#ifdef NX_TRANS_EXIT
+ if (OsVendorEndRedirectErrorFProc != NULL) {
+ OsVendorEndRedirectErrorFProc();
+ }
+#endif
#ifdef SIGCHLD
signal(SIGCHLD, csig);
@@ -1765,11 +1843,23 @@
return NULL;
}
+#ifdef NX_TRANS_EXIT
+ if (OsVendorStartRedirectErrorFProc != NULL) {
+ OsVendorStartRedirectErrorFProc();
+ }
+ OsBlockSignals ();
+#endif
switch (pid = fork()) {
case -1: /* error */
close(pdes[0]);
close(pdes[1]);
xfree(cur);
+#ifdef NX_TRANS_EXIT
+ if (OsVendorEndRedirectErrorFProc != NULL) {
+ OsVendorEndRedirectErrorFProc();
+ }
+ OsReleaseSignals ();
+#endif
return NULL;
case 0: /* child */
if (setgid(getgid()) == -1)
@@ -1791,12 +1881,61 @@
}
close(pdes[1]);
}
+
+ #ifdef NX_TRANS_SOCKET
+
+ /*
+ * Check if the child process should not
+ * use the parent's libraries.
+ */
+
+ if (_NXUnsetLibraryPath)
+ {
+ #ifndef __sun
+
+ unsetenv ("LD_LIBRARY_PATH");
+
+ #else
+
+ extern char **environ;
+
+ char **ep = environ;
+
+ ep = environ;
+
+ while (*ep)
+ {
+ if (!strncmp("LD_LIBRARY_PATH=", *ep, strlen("LD_LIBRARY_PATH=")))
+ {
+ break;
+ }
+
+ *ep++;
+ }
+
+ while (*ep)
+ {
+ *ep = *(ep + 1);
+ ep++;
+ }
+
+ #endif
+ }
+
+ #endif
+
+ #ifdef NX_TRANS_EXIT
+ OsReleaseSignals ();
+ #endif
+
execl("/bin/sh", "sh", "-c", command, (char *)NULL);
_exit(127);
}
+#ifndef NX_TRANS_EXIT
/* Avoid EINTR during stdio calls */
OsBlockSignals ();
+#endif
/* parent */
if (*type == 'r') {
@@ -1945,6 +2084,11 @@
/* allow EINTR again */
OsReleaseSignals ();
+#ifdef NX_TRANS_EXIT
+ if (OsVendorEndRedirectErrorFProc != NULL) {
+ OsVendorEndRedirectErrorFProc();
+ }
+#endif
return pid == -1 ? -1 : pstat;
}

View File

@@ -0,0 +1,59 @@
--- ./nx-X11/programs/Xserver/os/xdmcp.c.X.original 2015-02-13 14:03:44.792440567 +0100
+++ ./nx-X11/programs/Xserver/os/xdmcp.c 2015-02-10 19:13:13.472698316 +0100
@@ -59,6 +59,13 @@
#include <netdir.h>
#endif
+#ifndef NX_TRANS_SOCKET
+
+#define NX_TRANS_SOCKET
+#define NX_TRANS_TEST
+
+#endif
+
#ifdef XDMCP
#undef REQUEST
@@ -71,6 +78,15 @@
#define X_INCLUDE_NETDB_H
#include <X11/Xos_r.h>
+#ifdef NX_TRANS_SOCKET
+
+xdmcp_states XdmcpState;
+
+int XdmcpStartTime;
+int XdmcpTimeOutRtx;
+
+#endif
+
extern char *defaultDisplayClass;
static int xdmcpSocket, sessionSocket;
@@ -590,6 +606,12 @@
void
XdmcpInit(void)
{
+#ifdef NX_TRANS_SOCKET
+
+ XdmcpStartTime = GetTimeInMillis();
+
+#endif
+
state = XDM_INIT_STATE;
#ifdef HASXDMAUTH
if (xdmAuthCookie)
@@ -699,6 +721,13 @@
fd_set* LastSelectMask = (fd_set*)pReadmask;
fd_set devicesReadable;
+#ifdef NX_TRANS_SOCKET
+
+ XdmcpState = state;
+ XdmcpTimeOutRtx = timeOutRtx;
+
+#endif
+
if (state == XDM_OFF)
return;
if (i > 0)

View File

@@ -0,0 +1,75 @@
--- ./nx-X11/programs/Xserver/os/xprintf.c.X.original 2015-02-13 14:03:44.792440567 +0100
+++ ./nx-X11/programs/Xserver/os/xprintf.c 2015-02-10 19:13:13.480698017 +0100
@@ -43,6 +43,63 @@
# endif
#endif
+#ifdef NX_TRANS_SOCKET
+
+#define PANIC
+#define WARNING
+#undef TEST
+#undef DEBUG
+
+#define START_SIZE 256
+#define END_SIZE 2048
+
+char *
+Xvprintf(const char *format, va_list va)
+{
+ char *ret;
+ char *newret;
+ int size;
+ int r;
+
+ size = 0;
+
+ for (;;)
+ {
+ if (size == 0)
+ {
+ ret = (char *)malloc(START_SIZE);
+ if (ret == NULL)
+ return NULL;
+ size = START_SIZE;
+ }
+ else if (size < END_SIZE &&
+ (newret = (char *) realloc(ret, 2 * size)) != NULL)
+ {
+ ret = newret;
+ size = 2 * size;
+ }
+ else
+ {
+ free(ret);
+ return NULL;
+ }
+
+ r = vsnprintf(ret, size, format, va);
+
+ if (r == -1 || r == size || r > size || r == size - 1)
+ {
+ continue;
+ }
+ else
+ {
+ ret[r] = 0;
+ return ret;
+ }
+ }
+}
+
+#else
+
char *
Xvprintf(const char *format, va_list va)
{
@@ -63,6 +120,8 @@
return ret;
}
+#endif
+
char *Xprintf(const char *format, ...)
{
char *ret;

View File

@@ -0,0 +1,195 @@
--- ./nx-X11/programs/Xserver/randr/panoramiXproto.h.X.original 2015-02-13 14:03:44.792440567 +0100
+++ ./nx-X11/programs/Xserver/randr/panoramiXproto.h 2015-02-10 19:13:13.612693075 +0100
@@ -0,0 +1,192 @@
+/* $Xorg: panoramiXproto.h,v 1.4 2000/08/18 04:05:45 coskrey Exp $ */
+/*****************************************************************
+Copyright (c) 1991, 1997 Digital Equipment Corporation, Maynard, Massachusetts.
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+DIGITAL EQUIPMENT CORPORATION BE LIABLE FOR ANY CLAIM, DAMAGES, INCLUDING,
+BUT NOT LIMITED TO CONSEQUENTIAL OR INCIDENTAL DAMAGES, OR OTHER LIABILITY,
+WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR
+IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of Digital Equipment Corporation
+shall not be used in advertising or otherwise to promote the sale, use or other
+dealings in this Software without prior written authorization from Digital
+Equipment Corporation.
+******************************************************************/
+/* $XFree86: xc/include/extensions/panoramiXproto.h,v 3.5 2000/03/01 01:04:21 dawes Exp $ */
+
+/* THIS IS NOT AN X PROJECT TEAM SPECIFICATION */
+
+#ifndef _PANORAMIXPROTO_H_
+#define _PANORAMIXPROTO_H_
+
+#define PANORAMIX_PROTOCOL_NAME "XINERAMA"
+
+#define X_PanoramiXQueryVersion 0
+#define X_PanoramiXGetState 1
+#define X_PanoramiXGetScreenCount 2
+#define X_PanoramiXGetScreenSize 3
+
+#define X_XineramaIsActive 4
+#define X_XineramaQueryScreens 5
+
+typedef struct _PanoramiXQueryVersion {
+ CARD8 reqType; /* always PanoramiXReqCode */
+ CARD8 panoramiXReqType; /* always X_PanoramiXQueryVersion */
+ CARD16 length B16;
+ CARD8 clientMajor;
+ CARD8 clientMinor;
+ CARD16 unused B16;
+} xPanoramiXQueryVersionReq;
+
+#define sz_xPanoramiXQueryVersionReq 8
+
+typedef struct {
+ CARD8 type; /* must be X_Reply */
+ CARD8 pad1; /* unused */
+ CARD16 sequenceNumber B16; /* last sequence number */
+ CARD32 length B32; /* 0 */
+ CARD16 majorVersion B16;
+ CARD16 minorVersion B16;
+ CARD32 pad2 B32; /* unused */
+ CARD32 pad3 B32; /* unused */
+ CARD32 pad4 B32; /* unused */
+ CARD32 pad5 B32; /* unused */
+ CARD32 pad6 B32; /* unused */
+} xPanoramiXQueryVersionReply;
+
+#define sz_xPanoramiXQueryVersionReply 32
+
+
+typedef struct _PanoramiXGetState {
+ CARD8 reqType; /* always PanoramiXReqCode */
+ CARD8 panoramiXReqType; /* always X_PanoramiXGetState */
+ CARD16 length B16;
+ CARD32 window B32;
+} xPanoramiXGetStateReq;
+#define sz_xPanoramiXGetStateReq 8
+
+typedef struct {
+ BYTE type;
+ BYTE state;
+ CARD16 sequenceNumber B16;
+ CARD32 length B32;
+ CARD32 window B32;
+ CARD32 pad1 B32; /* unused */
+ CARD32 pad2 B32; /* unused */
+ CARD32 pad3 B32; /* unused */
+ CARD32 pad4 B32; /* unused */
+ CARD32 pad5 B32; /* unused */
+} xPanoramiXGetStateReply;
+
+#define sz_panoramiXGetStateReply 32
+
+typedef struct _PanoramiXGetScreenCount {
+ CARD8 reqType; /* always PanoramiXReqCode */
+ CARD8 panoramiXReqType; /* always X_PanoramiXGetScreenCount */
+ CARD16 length B16;
+ CARD32 window B32;
+} xPanoramiXGetScreenCountReq;
+#define sz_xPanoramiXGetScreenCountReq 8
+
+typedef struct {
+ BYTE type;
+ BYTE ScreenCount;
+ CARD16 sequenceNumber B16;
+ CARD32 length B32;
+ CARD32 window B32;
+ CARD32 pad1 B32; /* unused */
+ CARD32 pad2 B32; /* unused */
+ CARD32 pad3 B32; /* unused */
+ CARD32 pad4 B32; /* unused */
+ CARD32 pad5 B32; /* unused */
+} xPanoramiXGetScreenCountReply;
+#define sz_panoramiXGetScreenCountReply 32
+
+typedef struct _PanoramiXGetScreenSize {
+ CARD8 reqType; /* always PanoramiXReqCode */
+ CARD8 panoramiXReqType; /* always X_PanoramiXGetState */
+ CARD16 length B16;
+ CARD32 window B32;
+ CARD32 screen B32;
+} xPanoramiXGetScreenSizeReq;
+#define sz_xPanoramiXGetScreenSizeReq 12
+
+typedef struct {
+ BYTE type;
+ CARD8 pad1;
+ CARD16 sequenceNumber B16;
+ CARD32 length B32;
+ CARD32 width B32;
+ CARD32 height B32;
+ CARD32 window B32;
+ CARD32 screen B32;
+ CARD32 pad2 B32; /* unused */
+ CARD32 pad3 B32; /* unused */
+} xPanoramiXGetScreenSizeReply;
+#define sz_panoramiXGetScreenSizeReply 32
+
+/************ Alternate protocol ******************/
+
+typedef struct {
+ CARD8 reqType;
+ CARD8 panoramiXReqType;
+ CARD16 length B16;
+} xXineramaIsActiveReq;
+#define sz_xXineramaIsActiveReq 4
+
+typedef struct {
+ BYTE type;
+ CARD8 pad1;
+ CARD16 sequenceNumber B16;
+ CARD32 length B32;
+ CARD32 state B32;
+ CARD32 pad2 B32;
+ CARD32 pad3 B32;
+ CARD32 pad4 B32;
+ CARD32 pad5 B32;
+ CARD32 pad6 B32;
+} xXineramaIsActiveReply;
+#define sz_XineramaIsActiveReply 32
+
+
+typedef struct {
+ CARD8 reqType;
+ CARD8 panoramiXReqType;
+ CARD16 length B16;
+} xXineramaQueryScreensReq;
+#define sz_xXineramaQueryScreensReq 4
+
+typedef struct {
+ BYTE type;
+ CARD8 pad1;
+ CARD16 sequenceNumber B16;
+ CARD32 length B32;
+ CARD32 number B32;
+ CARD32 pad2 B32;
+ CARD32 pad3 B32;
+ CARD32 pad4 B32;
+ CARD32 pad5 B32;
+ CARD32 pad6 B32;
+} xXineramaQueryScreensReply;
+#define sz_XineramaQueryScreensReply 32
+
+typedef struct {
+ INT16 x_org B16;
+ INT16 y_org B16;
+ CARD16 width B16;
+ CARD16 height B16;
+} xXineramaScreenInfo;
+#define sz_XineramaScreenInfo 8
+
+#endif

View File

@@ -0,0 +1,72 @@
--- ./nx-X11/programs/Xserver/randr/randr.c.X.original 2015-02-13 14:03:44.792440567 +0100
+++ ./nx-X11/programs/Xserver/randr/randr.c 2015-02-10 19:13:13.616692925 +0100
@@ -25,6 +25,23 @@
* Keith Packard, Intel Corporation
*/
+/**************************************************************************/
+/* */
+/* Copyright (c) 2001, 2011 NoMachine, http://www.nomachine.com/. */
+/* */
+/* NX-X11, NX protocol compression and NX extensions to this software */
+/* are copyright of NoMachine. Redistribution and use of the present */
+/* software is allowed according to terms specified in the file LICENSE */
+/* which comes in the source distribution. */
+/* */
+/* Check http://www.nomachine.com/licensing.html for applicability. */
+/* */
+/* NX and NoMachine are trademarks of Medialogic S.p.A. */
+/* */
+/* All rights reserved. */
+/* */
+/**************************************************************************/
+
#define NEED_REPLIES
#define NEED_EVENTS
#ifdef HAVE_DIX_CONFIG_H
@@ -56,9 +73,14 @@
int RREventBase;
int RRErrorBase;
RESTYPE RRClientType, RREventType; /* resource types for event masks */
-DevPrivateKey RRClientPrivateKey = &RRClientPrivateKey;
+#ifndef NXAGENT_SERVER
+DevPrivateKey RRClientPrivateKey = &RRClientPrivateKey;
DevPrivateKey rrPrivKey = &rrPrivKey;
+#else
+int RRClientPrivateIndex;
+int rrPrivIndex = -1;
+#endif
static void
RRClientCallback (CallbackListPtr *list,
@@ -203,6 +225,10 @@
{
if (RRGeneration != serverGeneration)
{
+ #ifdef NXAGENT_SERVER
+ if ((rrPrivIndex = AllocateScreenPrivateIndex()) < 0)
+ return FALSE;
+ #endif
if (!RRModeInit ())
return FALSE;
if (!RRCrtcInit ())
@@ -324,10 +350,18 @@
if (RRNScreens == 0) return;
+ #ifndef NXAGENT_SERVER
if (!dixRequestPrivate(RRClientPrivateKey,
sizeof (RRClientRec) +
screenInfo.numScreens * sizeof (RRTimesRec)))
return;
+ #else
+ RRClientPrivateIndex = AllocateClientPrivateIndex ();
+ if (!AllocateClientPrivate (RRClientPrivateIndex,
+ sizeof (RRClientRec) +
+ screenInfo.numScreens * sizeof (RRTimesRec)))
+ return;
+ #endif
if (!AddCallback (&ClientStateCallback, RRClientCallback, 0))
return;

View File

@@ -0,0 +1,144 @@
--- ./nx-X11/programs/Xserver/randr/randr.h.X.original 2015-02-13 14:03:44.792440567 +0100
+++ ./nx-X11/programs/Xserver/randr/randr.h 2015-02-10 19:13:13.628692476 +0100
@@ -0,0 +1,141 @@
+/*
+ * Copyright © 2000 Compaq Computer Corporation
+ * Copyright © 2002 Hewlett Packard Company
+ * Copyright © 2006 Intel Corporation
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that copyright
+ * notice and this permission notice appear in supporting documentation, and
+ * that the name of the copyright holders not be used in advertising or
+ * publicity pertaining to distribution of the software without specific,
+ * written prior permission. The copyright holders make no representations
+ * about the suitability of this software for any purpose. It is provided "as
+ * is" without express or implied warranty.
+ *
+ * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+ * EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
+ * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
+ * OF THIS SOFTWARE.
+ *
+ * Author: Jim Gettys, HP Labs, Hewlett-Packard, Inc.
+ * Keith Packard, Intel Corporation
+ */
+
+#ifndef _RANDR_H_
+#define _RANDR_H_
+
+typedef unsigned short Rotation;
+typedef unsigned short SizeID;
+typedef unsigned short SubpixelOrder;
+typedef unsigned short Connection;
+typedef unsigned short XRandrRotation;
+typedef unsigned short XRandrSizeID;
+typedef unsigned short XRandrSubpixelOrder;
+typedef unsigned long XRandrModeFlags;
+
+#define RANDR_NAME "RANDR"
+#define RANDR_MAJOR 1
+#define RANDR_MINOR 2
+
+#define RRNumberErrors 3
+#define RRNumberEvents 2
+#define RRNumberRequests 25
+
+#define X_RRQueryVersion 0
+/* we skip 1 to make old clients fail pretty immediately */
+#define X_RROldGetScreenInfo 1
+#define X_RR1_0SetScreenConfig 2
+/* V1.0 apps share the same set screen config request id */
+#define X_RRSetScreenConfig 2
+#define X_RROldScreenChangeSelectInput 3
+/* 3 used to be ScreenChangeSelectInput; deprecated */
+#define X_RRSelectInput 4
+#define X_RRGetScreenInfo 5
+
+/* V1.2 additions */
+#define X_RRGetScreenSizeRange 6
+#define X_RRSetScreenSize 7
+#define X_RRGetScreenResources 8
+#define X_RRGetOutputInfo 9
+#define X_RRListOutputProperties 10
+#define X_RRQueryOutputProperty 11
+#define X_RRConfigureOutputProperty 12
+#define X_RRChangeOutputProperty 13
+#define X_RRDeleteOutputProperty 14
+#define X_RRGetOutputProperty 15
+#define X_RRCreateMode 16
+#define X_RRDestroyMode 17
+#define X_RRAddOutputMode 18
+#define X_RRDeleteOutputMode 19
+#define X_RRGetCrtcInfo 20
+#define X_RRSetCrtcConfig 21
+#define X_RRGetCrtcGammaSize 22
+#define X_RRGetCrtcGamma 23
+#define X_RRSetCrtcGamma 24
+
+/* Event selection bits */
+#define RRScreenChangeNotifyMask (1L << 0)
+/* V1.2 additions */
+#define RRCrtcChangeNotifyMask (1L << 1)
+#define RROutputChangeNotifyMask (1L << 2)
+#define RROutputPropertyNotifyMask (1L << 3)
+
+/* Event codes */
+#define RRScreenChangeNotify 0
+/* V1.2 additions */
+#define RRNotify 1
+/* RRNotify Subcodes */
+#define RRNotify_CrtcChange 0
+#define RRNotify_OutputChange 1
+#define RRNotify_OutputProperty 2
+
+/* used in the rotation field; rotation and reflection in 0.1 proto. */
+#define RR_Rotate_0 1
+#define RR_Rotate_90 2
+#define RR_Rotate_180 4
+#define RR_Rotate_270 8
+
+/* new in 1.0 protocol, to allow reflection of screen */
+
+#define RR_Reflect_X 16
+#define RR_Reflect_Y 32
+
+#define RRSetConfigSuccess 0
+#define RRSetConfigInvalidConfigTime 1
+#define RRSetConfigInvalidTime 2
+#define RRSetConfigFailed 3
+
+/* new in 1.2 protocol */
+
+#define RR_HSyncPositive 0x00000001
+#define RR_HSyncNegative 0x00000002
+#define RR_VSyncPositive 0x00000004
+#define RR_VSyncNegative 0x00000008
+#define RR_Interlace 0x00000010
+#define RR_DoubleScan 0x00000020
+#define RR_CSync 0x00000040
+#define RR_CSyncPositive 0x00000080
+#define RR_CSyncNegative 0x00000100
+#define RR_HSkewPresent 0x00000200
+#define RR_BCast 0x00000400
+#define RR_PixelMultiplex 0x00000800
+#define RR_DoubleClock 0x00001000
+#define RR_ClockDivideBy2 0x00002000
+
+#define RR_Connected 0
+#define RR_Disconnected 1
+#define RR_UnknownConnection 2
+
+#define BadRROutput 0
+#define BadRRCrtc 1
+#define BadRRMode 2
+
+/* Conventional RandR output properties */
+
+#define RR_PROPERTY_RANDR_EDID "RANDR_EDID"
+
+#endif /* _RANDR_H_ */

View File

@@ -0,0 +1,658 @@
--- ./nx-X11/programs/Xserver/randr/randrproto.h.X.original 2015-02-13 14:03:44.792440567 +0100
+++ ./nx-X11/programs/Xserver/randr/randrproto.h 2015-02-10 19:13:13.632692326 +0100
@@ -0,0 +1,655 @@
+/*
+ * Copyright © 2000 Compaq Computer Corporation
+ * Copyright © 2002 Hewlett-Packard Company
+ * Copyright © 2006 Intel Corporation
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that copyright
+ * notice and this permission notice appear in supporting documentation, and
+ * that the name of the copyright holders not be used in advertising or
+ * publicity pertaining to distribution of the software without specific,
+ * written prior permission. The copyright holders make no representations
+ * about the suitability of this software for any purpose. It is provided "as
+ * is" without express or implied warranty.
+ *
+ * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+ * EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
+ * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
+ * OF THIS SOFTWARE.
+ *
+ * Author: Jim Gettys, Hewlett-Packard Company, Inc.
+ * Keith Packard, Intel Corporation
+ */
+
+/* note that RANDR 1.0 is incompatible with version 0.0, or 0.1 */
+/* V1.0 removes depth switching from the protocol */
+#ifndef _XRANDRP_H_
+#define _XRANDRP_H_
+
+/*#include <X11/extensions/randr.h>*/
+#include "randr.h"
+
+#define Window CARD32
+#define Drawable CARD32
+#define Font CARD32
+#define Pixmap CARD32
+#define Cursor CARD32
+#define Colormap CARD32
+#define GContext CARD32
+#define Atom CARD32
+#define Time CARD32
+#define KeyCode CARD8
+#define KeySym CARD32
+#define RROutput CARD32
+#define RRMode CARD32
+#define RRCrtc CARD32
+#define RRModeFlags CARD32
+
+#define Rotation CARD16
+#define SizeID CARD16
+#define SubpixelOrder CARD16
+
+/*
+ * data structures
+ */
+
+typedef struct {
+ CARD16 widthInPixels B16;
+ CARD16 heightInPixels B16;
+ CARD16 widthInMillimeters B16;
+ CARD16 heightInMillimeters B16;
+} xScreenSizes;
+#define sz_xScreenSizes 8
+
+/*
+ * requests and replies
+ */
+
+typedef struct {
+ CARD8 reqType;
+ CARD8 randrReqType;
+ CARD16 length B16;
+ CARD32 majorVersion B32;
+ CARD32 minorVersion B32;
+} xRRQueryVersionReq;
+#define sz_xRRQueryVersionReq 12
+
+typedef struct {
+ BYTE type; /* X_Reply */
+ BYTE pad1;
+ CARD16 sequenceNumber B16;
+ CARD32 length B32;
+ CARD32 majorVersion B32;
+ CARD32 minorVersion B32;
+ CARD32 pad2 B32;
+ CARD32 pad3 B32;
+ CARD32 pad4 B32;
+ CARD32 pad5 B32;
+} xRRQueryVersionReply;
+#define sz_xRRQueryVersionReply 32
+
+typedef struct {
+ CARD8 reqType;
+ CARD8 randrReqType;
+ CARD16 length B16;
+ Window window B32;
+} xRRGetScreenInfoReq;
+#define sz_xRRGetScreenInfoReq 8
+
+/*
+ * the xRRScreenInfoReply structure is followed by:
+ *
+ * the size information
+ */
+
+
+typedef struct {
+ BYTE type; /* X_Reply */
+ BYTE setOfRotations;
+ CARD16 sequenceNumber B16;
+ CARD32 length B32;
+ Window root B32;
+ Time timestamp B32;
+ Time configTimestamp B32;
+ CARD16 nSizes B16;
+ SizeID sizeID B16;
+ Rotation rotation B16;
+ CARD16 rate B16;
+ CARD16 nrateEnts B16;
+ CARD16 pad B16;
+} xRRGetScreenInfoReply;
+#define sz_xRRGetScreenInfoReply 32
+
+typedef struct {
+ CARD8 reqType;
+ CARD8 randrReqType;
+ CARD16 length B16;
+ Drawable drawable B32;
+ Time timestamp B32;
+ Time configTimestamp B32;
+ SizeID sizeID B16;
+ Rotation rotation B16;
+} xRR1_0SetScreenConfigReq;
+#define sz_xRR1_0SetScreenConfigReq 20
+
+typedef struct {
+ CARD8 reqType;
+ CARD8 randrReqType;
+ CARD16 length B16;
+ Drawable drawable B32;
+ Time timestamp B32;
+ Time configTimestamp B32;
+ SizeID sizeID B16;
+ Rotation rotation B16;
+ CARD16 rate B16;
+ CARD16 pad B16;
+} xRRSetScreenConfigReq;
+#define sz_xRRSetScreenConfigReq 24
+
+typedef struct {
+ BYTE type; /* X_Reply */
+ CARD8 status;
+ CARD16 sequenceNumber B16;
+ CARD32 length B32;
+ Time newTimestamp B32;
+ Time newConfigTimestamp B32;
+ Window root;
+ CARD16 subpixelOrder B16;
+ CARD16 pad4 B16;
+ CARD32 pad5 B32;
+ CARD32 pad6 B32;
+} xRRSetScreenConfigReply;
+#define sz_xRRSetScreenConfigReply 32
+
+typedef struct {
+ CARD8 reqType;
+ CARD8 randrReqType;
+ CARD16 length B16;
+ Window window B32;
+ CARD16 enable B16;
+ CARD16 pad2 B16;
+} xRRSelectInputReq;
+#define sz_xRRSelectInputReq 12
+
+/*
+ * Additions for version 1.2
+ */
+
+typedef struct _xRRModeInfo {
+ RRMode id B32;
+ CARD16 width B16;
+ CARD16 height B16;
+ CARD32 dotClock B32;
+ CARD16 hSyncStart B16;
+ CARD16 hSyncEnd B16;
+ CARD16 hTotal B16;
+ CARD16 hSkew B16;
+ CARD16 vSyncStart B16;
+ CARD16 vSyncEnd B16;
+ CARD16 vTotal B16;
+ CARD16 nameLength B16;
+ RRModeFlags modeFlags B32;
+} xRRModeInfo;
+#define sz_xRRModeInfo 32
+
+typedef struct {
+ CARD8 reqType;
+ CARD8 randrReqType;
+ CARD16 length B16;
+ Window window B32;
+} xRRGetScreenSizeRangeReq;
+#define sz_xRRGetScreenSizeRangeReq 8
+
+typedef struct {
+ BYTE type; /* X_Reply */
+ CARD8 pad;
+ CARD16 sequenceNumber B16;
+ CARD32 length B32;
+ CARD16 minWidth B16;
+ CARD16 minHeight B16;
+ CARD16 maxWidth B16;
+ CARD16 maxHeight B16;
+ CARD32 pad0 B32;
+ CARD32 pad1 B32;
+ CARD32 pad2 B32;
+ CARD32 pad3 B32;
+} xRRGetScreenSizeRangeReply;
+#define sz_xRRGetScreenSizeRangeReply 32
+
+typedef struct {
+ CARD8 reqType;
+ CARD8 randrReqType;
+ CARD16 length B16;
+ Window window B32;
+ CARD16 width B16;
+ CARD16 height B16;
+ CARD32 widthInMillimeters B32;
+ CARD32 heightInMillimeters B32;
+} xRRSetScreenSizeReq;
+#define sz_xRRSetScreenSizeReq 20
+
+typedef struct {
+ CARD8 reqType;
+ CARD8 randrReqType;
+ CARD16 length B16;
+ Window window B32;
+} xRRGetScreenResourcesReq;
+#define sz_xRRGetScreenResourcesReq 8
+
+typedef struct {
+ BYTE type;
+ CARD8 pad;
+ CARD16 sequenceNumber B16;
+ CARD32 length B32;
+ Time timestamp B32;
+ Time configTimestamp B32;
+ CARD16 nCrtcs B16;
+ CARD16 nOutputs B16;
+ CARD16 nModes B16;
+ CARD16 nbytesNames B16;
+ CARD32 pad1 B32;
+ CARD32 pad2 B32;
+} xRRGetScreenResourcesReply;
+#define sz_xRRGetScreenResourcesReply 32
+
+typedef struct {
+ CARD8 reqType;
+ CARD8 randrReqType;
+ CARD16 length B16;
+ RROutput output B32;
+ Time configTimestamp B32;
+} xRRGetOutputInfoReq;
+#define sz_xRRGetOutputInfoReq 12
+
+typedef struct {
+ BYTE type;
+ CARD8 status;
+ CARD16 sequenceNumber B16;
+ CARD32 length B32;
+ Time timestamp B32;
+ RRCrtc crtc B32;
+ CARD32 mmWidth B32;
+ CARD32 mmHeight B32;
+ CARD8 connection;
+ CARD8 subpixelOrder;
+ CARD16 nCrtcs B16;
+ CARD16 nModes B16;
+ CARD16 nPreferred B16;
+ CARD16 nClones B16;
+ CARD16 nameLength B16;
+} xRRGetOutputInfoReply;
+#define sz_xRRGetOutputInfoReply 36
+
+typedef struct {
+ CARD8 reqType;
+ CARD8 randrReqType;
+ CARD16 length B16;
+ RROutput output B32;
+} xRRListOutputPropertiesReq;
+#define sz_xRRListOutputPropertiesReq 8
+
+typedef struct {
+ BYTE type;
+ CARD8 pad0;
+ CARD16 sequenceNumber B16;
+ CARD32 length B32;
+ CARD16 nAtoms B16;
+ CARD16 pad1 B16;
+ CARD32 pad2 B32;
+ CARD32 pad3 B32;
+ CARD32 pad4 B32;
+ CARD32 pad5 B32;
+ CARD32 pad6 B32;
+} xRRListOutputPropertiesReply;
+#define sz_xRRListOutputPropertiesReply 32
+
+typedef struct {
+ CARD8 reqType;
+ CARD8 randrReqType;
+ CARD16 length B16;
+ RROutput output B32;
+ Atom property B32;
+} xRRQueryOutputPropertyReq;
+#define sz_xRRQueryOutputPropertyReq 12
+
+typedef struct {
+ BYTE type;
+ BYTE pad0;
+ CARD16 sequenceNumber B16;
+ CARD32 length B32;
+ BOOL pending;
+ BOOL range;
+ BOOL immutable;
+ BYTE pad1;
+ CARD32 pad2 B32;
+ CARD32 pad3 B32;
+ CARD32 pad4 B32;
+ CARD32 pad5 B32;
+ CARD32 pad6 B32;
+} xRRQueryOutputPropertyReply;
+#define sz_xRRQueryOutputPropertyReply 32
+
+typedef struct {
+ CARD8 reqType;
+ CARD8 randrReqType;
+ CARD16 length B16;
+ RROutput output B32;
+ Atom property B32;
+ BOOL pending;
+ BOOL range;
+ CARD16 pad B16;
+} xRRConfigureOutputPropertyReq;
+#define sz_xRRConfigureOutputPropertyReq 16
+
+typedef struct {
+ CARD8 reqType;
+ CARD8 randrReqType;
+ CARD16 length B16;
+ RROutput output B32;
+ Atom property B32;
+ Atom type B32;
+ CARD8 format;
+ CARD8 mode;
+ CARD16 pad;
+ CARD32 nUnits B32;
+} xRRChangeOutputPropertyReq;
+#define sz_xRRChangeOutputPropertyReq 24
+
+typedef struct {
+ CARD8 reqType;
+ CARD8 randrReqType;
+ CARD16 length B16;
+ RROutput output B32;
+ Atom property B32;
+} xRRDeleteOutputPropertyReq;
+#define sz_xRRDeleteOutputPropertyReq 12
+
+typedef struct {
+ CARD8 reqType;
+ CARD8 randrReqType;
+ CARD16 length B16;
+ RROutput output B32;
+ Atom property B32;
+ Atom type B32;
+ CARD32 longOffset B32;
+ CARD32 longLength B32;
+#ifdef __cplusplus
+ BOOL _delete;
+#else
+ BOOL delete;
+#endif
+ BOOL pending;
+ CARD16 pad1 B16;
+} xRRGetOutputPropertyReq;
+#define sz_xRRGetOutputPropertyReq 28
+
+typedef struct {
+ BYTE type;
+ CARD8 format;
+ CARD16 sequenceNumber B16;
+ CARD32 length B32;
+ Atom propertyType B32;
+ CARD32 bytesAfter B32;
+ CARD32 nItems B32;
+ CARD32 pad1 B32;
+ CARD32 pad2 B32;
+ CARD32 pad3 B32;
+} xRRGetOutputPropertyReply;
+#define sz_xRRGetOutputPropertyReply 32
+
+typedef struct {
+ CARD8 reqType;
+ CARD8 randrReqType;
+ CARD16 length B16;
+ Window window B32;
+ xRRModeInfo modeInfo;
+} xRRCreateModeReq;
+#define sz_xRRCreateModeReq 40
+
+typedef struct {
+ BYTE type;
+ CARD8 pad0;
+ CARD16 sequenceNumber B16;
+ CARD32 length B32;
+ RRMode mode B32;
+ CARD32 pad1 B32;
+ CARD32 pad2 B32;
+ CARD32 pad3 B32;
+ CARD32 pad4 B32;
+ CARD32 pad5 B32;
+} xRRCreateModeReply;
+#define sz_xRRCreateModeReply 32
+
+typedef struct {
+ CARD8 reqType;
+ CARD8 randrReqType;
+ CARD16 length B16;
+ RRMode mode B32;
+} xRRDestroyModeReq;
+#define sz_xRRDestroyModeReq 8
+
+typedef struct {
+ CARD8 reqType;
+ CARD8 randrReqType;
+ CARD16 length B16;
+ RROutput output B32;
+ RRMode mode B32;
+} xRRAddOutputModeReq;
+#define sz_xRRAddOutputModeReq 12
+
+typedef struct {
+ CARD8 reqType;
+ CARD8 randrReqType;
+ CARD16 length B16;
+ RROutput output B32;
+ RRMode mode B32;
+} xRRDeleteOutputModeReq;
+#define sz_xRRDeleteOutputModeReq 12
+
+typedef struct {
+ CARD8 reqType;
+ CARD8 randrReqType;
+ CARD16 length B16;
+ RRCrtc crtc B32;
+ Time configTimestamp B32;
+} xRRGetCrtcInfoReq;
+#define sz_xRRGetCrtcInfoReq 12
+
+typedef struct {
+ BYTE type;
+ CARD8 status;
+ CARD16 sequenceNumber B16;
+ CARD32 length B32;
+ Time timestamp B32;
+ INT16 x B16;
+ INT16 y B16;
+ CARD16 width B16;
+ CARD16 height B16;
+ RRMode mode B32;
+ Rotation rotation B16;
+ Rotation rotations B16;
+ CARD16 nOutput B16;
+ CARD16 nPossibleOutput B16;
+} xRRGetCrtcInfoReply;
+#define sz_xRRGetCrtcInfoReply 32
+
+typedef struct {
+ CARD8 reqType;
+ CARD8 randrReqType;
+ CARD16 length B16;
+ RRCrtc crtc B32;
+ Time timestamp B32;
+ Time configTimestamp B32;
+ INT16 x B16;
+ INT16 y B16;
+ RRMode mode B32;
+ Rotation rotation B16;
+ CARD16 pad B16;
+} xRRSetCrtcConfigReq;
+#define sz_xRRSetCrtcConfigReq 28
+
+typedef struct {
+ BYTE type;
+ CARD8 status;
+ CARD16 sequenceNumber B16;
+ CARD32 length B32;
+ Time newTimestamp B32;
+ CARD32 pad1 B32;
+ CARD32 pad2 B16;
+ CARD32 pad3 B32;
+ CARD32 pad4 B32;
+ CARD32 pad5 B32;
+} xRRSetCrtcConfigReply;
+#define sz_xRRSetCrtcConfigReply 32
+
+typedef struct {
+ CARD8 reqType;
+ CARD8 randrReqType;
+ CARD16 length B16;
+ RRCrtc crtc B32;
+} xRRGetCrtcGammaSizeReq;
+#define sz_xRRGetCrtcGammaSizeReq 8
+
+typedef struct {
+ BYTE type;
+ CARD8 status;
+ CARD16 sequenceNumber B16;
+ CARD32 length B32;
+ CARD16 size B16;
+ CARD16 pad1 B16;
+ CARD32 pad2 B32;
+ CARD32 pad3 B32;
+ CARD32 pad4 B32;
+ CARD32 pad5 B32;
+ CARD32 pad6 B32;
+} xRRGetCrtcGammaSizeReply;
+#define sz_xRRGetCrtcGammaSizeReply 32
+
+typedef struct {
+ CARD8 reqType;
+ CARD8 randrReqType;
+ CARD16 length B16;
+ RRCrtc crtc B32;
+} xRRGetCrtcGammaReq;
+#define sz_xRRGetCrtcGammaReq 8
+
+typedef struct {
+ BYTE type;
+ CARD8 status;
+ CARD16 sequenceNumber B16;
+ CARD32 length B32;
+ CARD16 size B16;
+ CARD16 pad1 B16;
+ CARD32 pad2 B32;
+ CARD32 pad3 B32;
+ CARD32 pad4 B32;
+ CARD32 pad5 B32;
+ CARD32 pad6 B32;
+} xRRGetCrtcGammaReply;
+#define sz_xRRGetCrtcGammaReply 32
+
+typedef struct {
+ CARD8 reqType;
+ CARD8 randrReqType;
+ CARD16 length B16;
+ RRCrtc crtc B32;
+ CARD16 size B16;
+ CARD16 pad1 B16;
+} xRRSetCrtcGammaReq;
+#define sz_xRRSetCrtcGammaReq 12
+
+/*
+ * event
+ */
+typedef struct {
+ CARD8 type; /* always evBase + ScreenChangeNotify */
+ CARD8 rotation; /* new rotation */
+ CARD16 sequenceNumber B16;
+ Time timestamp B32; /* time screen was changed */
+ Time configTimestamp B32; /* time config data was changed */
+ Window root B32; /* root window */
+ Window window B32; /* window requesting notification */
+ SizeID sizeID B16; /* new size ID */
+ CARD16 subpixelOrder B16; /* subpixel order */
+ CARD16 widthInPixels B16; /* new size */
+ CARD16 heightInPixels B16;
+ CARD16 widthInMillimeters B16;
+ CARD16 heightInMillimeters B16;
+} xRRScreenChangeNotifyEvent;
+#define sz_xRRScreenChangeNotifyEvent 32
+
+typedef struct {
+ CARD8 type; /* always evBase + RRNotify */
+ CARD8 subCode; /* RRNotify_CrtcChange */
+ CARD16 sequenceNumber B16;
+ Time timestamp B32; /* time crtc was changed */
+ Window window B32; /* window requesting notification */
+ RRCrtc crtc B32; /* affected CRTC */
+ RRMode mode B32; /* current mode */
+ CARD16 rotation B16; /* rotation and reflection */
+ CARD16 pad1 B16; /* unused */
+ INT16 x B16; /* new location */
+ INT16 y B16;
+ CARD16 width B16; /* new size */
+ CARD16 height B16;
+} xRRCrtcChangeNotifyEvent;
+#define sz_xRRCrtcChangeNotifyEvent 32
+
+typedef struct {
+ CARD8 type; /* always evBase + RRNotify */
+ CARD8 subCode; /* RRNotify_OutputChange */
+ CARD16 sequenceNumber B16;
+ Time timestamp B32; /* time crtc was changed */
+ Time configTimestamp B32; /* time crtc was changed */
+ Window window B32; /* window requesting notification */
+ RROutput output B32; /* affected output */
+ RRCrtc crtc B32; /* current crtc */
+ RRMode mode B32; /* current mode */
+ CARD16 rotation B16; /* rotation and reflection */
+ CARD8 connection; /* connection status */
+ CARD8 subpixelOrder; /* subpixel order */
+} xRROutputChangeNotifyEvent;
+#define sz_xRROutputChangeNotifyEvent 32
+
+typedef struct {
+ CARD8 type; /* always evBase + RRNotify */
+ CARD8 subCode; /* RRNotify_OutputProperty */
+ CARD16 sequenceNumber B16;
+ Window window B32; /* window requesting notification */
+ RROutput output B32; /* affected output */
+ Atom atom B32; /* property name */
+ Time timestamp B32; /* time crtc was changed */
+ CARD8 state; /* NewValue or Deleted */
+ CARD8 pad1;
+ CARD16 pad2 B16;
+ CARD32 pad3 B32;
+ CARD32 pad4 B32;
+} xRROutputPropertyNotifyEvent;
+#define sz_xRROutputPropertyNotifyEvent 32
+
+#undef RRModeFlags
+#undef RRCrtc
+#undef RRMode
+#undef RROutput
+#undef RRMode
+#undef RRCrtc
+#undef Drawable
+#undef Window
+#undef Font
+#undef Pixmap
+#undef Cursor
+#undef Colormap
+#undef GContext
+#undef Atom
+#undef Time
+#undef KeyCode
+#undef KeySym
+#undef Rotation
+#undef SizeID
+#undef SubpixelOrder
+
+#endif /* _XRANDRP_H_ */

View File

@@ -0,0 +1,67 @@
--- ./nx-X11/programs/Xserver/randr/registry.h.X.original 2015-02-13 14:03:44.792440567 +0100
+++ ./nx-X11/programs/Xserver/randr/registry.h 2015-02-10 19:13:13.616692925 +0100
@@ -0,0 +1,64 @@
+/***********************************************************
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHOR BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+******************************************************************/
+
+#ifndef DIX_REGISTRY_H
+#define DIX_REGISTRY_H
+
+/*
+ * Result returned from any unsuccessful lookup
+ */
+#define XREGISTRY_UNKNOWN "<unknown>"
+
+#ifdef XREGISTRY
+
+#include "resource.h"
+#include "extnsionst.h"
+
+/* Internal string registry - for auditing, debugging, security, etc. */
+
+/*
+ * Registration functions. The name string is not copied, so it must
+ * not be a stack variable.
+ */
+void RegisterResourceName(RESTYPE type, char *name);
+void RegisterExtensionNames(ExtensionEntry *ext);
+
+/*
+ * Lookup functions. The returned string must not be modified or freed.
+ */
+const char *LookupMajorName(int major);
+const char *LookupRequestName(int major, int minor);
+const char *LookupEventName(int event);
+const char *LookupErrorName(int error);
+const char *LookupResourceName(RESTYPE rtype);
+
+/*
+ * Setup and teardown
+ */
+void dixResetRegistry(void);
+
+#else /* XREGISTRY */
+
+/* Define calls away when the registry is not being built. */
+
+#define RegisterResourceName(a, b) { ; }
+#define RegisterExtensionNames(a) { ; }
+
+#define LookupMajorName(a) XREGISTRY_UNKNOWN
+#define LookupRequestName(a, b) XREGISTRY_UNKNOWN
+#define LookupEventName(a) XREGISTRY_UNKNOWN
+#define LookupErrorName(a) XREGISTRY_UNKNOWN
+#define LookupResourceName(a) XREGISTRY_UNKNOWN
+
+#define dixResetRegistry() { ; }
+
+#endif /* XREGISTRY */
+#endif /* DIX_REGISTRY_H */

View File

@@ -0,0 +1,48 @@
--- ./nx-X11/programs/Xserver/randr/rrcrtc.c.X.original 2015-02-13 14:03:44.792440567 +0100
+++ ./nx-X11/programs/Xserver/randr/rrcrtc.c 2015-02-10 19:13:13.624692625 +0100
@@ -20,6 +20,23 @@
* OF THIS SOFTWARE.
*/
+/**************************************************************************/
+/* */
+/* Copyright (c) 2001, 2011 NoMachine, http://www.nomachine.com/. */
+/* */
+/* NX-X11, NX protocol compression and NX extensions to this software */
+/* are copyright of NoMachine. Redistribution and use of the present */
+/* software is allowed according to terms specified in the file LICENSE */
+/* which comes in the source distribution. */
+/* */
+/* Check http://www.nomachine.com/licensing.html for applicability. */
+/* */
+/* NX and NoMachine are trademarks of Medialogic S.p.A. */
+/* */
+/* All rights reserved. */
+/* */
+/**************************************************************************/
+
#include "randrstr.h"
#include "swaprep.h"
#include "registry.h"
@@ -836,6 +853,9 @@
rep.status = RRSetConfigFailed;
goto sendReply;
}
+ #ifdef NXAGENT_SERVER /* Bug 21987 */
+ pScrPriv->lastSetTime = time;
+ #endif
rep.status = RRSetConfigSuccess;
sendReply:
@@ -846,7 +866,11 @@
/* rep.status has already been filled in */
rep.length = 0;
rep.sequenceNumber = client->sequence;
+ #ifndef NXAGENT_SERVER /* Bug 21987 */
rep.newTimestamp = pScrPriv->lastConfigTime.milliseconds;
+ #else
+ rep.newTimestamp = pScrPriv->lastSetTime.milliseconds;
+ #endif
if (client->swapped)
{

View File

@@ -0,0 +1,15 @@
--- ./nx-X11/programs/Xserver/randr/rrdispatch.c.X.original 2015-02-13 14:03:44.792440567 +0100
+++ ./nx-X11/programs/Xserver/randr/rrdispatch.c 2015-02-10 19:13:13.632692326 +0100
@@ -76,7 +76,12 @@
int rc;
REQUEST_SIZE_MATCH(xRRSelectInputReq);
+ #ifndef NXAGENT_SERVER
rc = dixLookupWindow(&pWin, stuff->window, client, DixWriteAccess);
+ #else
+ pWin = SecurityLookupWindow(stuff->window, client, SecurityWriteAccess);
+ rc = pWin ? Success : BadWindow;
+ #endif
if (rc != Success)
return rc;
pHead = (RREventPtr *)SecurityLookupIDByType(client,

View File

@@ -0,0 +1,39 @@
--- ./nx-X11/programs/Xserver/randr/rrmode.c.X.original 2015-02-13 14:03:44.792440567 +0100
+++ ./nx-X11/programs/Xserver/randr/rrmode.c 2015-02-10 19:13:13.612693075 +0100
@@ -20,6 +20,23 @@
* OF THIS SOFTWARE.
*/
+/**************************************************************************/
+/* */
+/* Copyright (c) 2001, 2011 NoMachine, http://www.nomachine.com/. */
+/* */
+/* NX-X11, NX protocol compression and NX extensions to this software */
+/* are copyright of NoMachine. Redistribution and use of the present */
+/* software is allowed according to terms specified in the file LICENSE */
+/* which comes in the source distribution. */
+/* */
+/* Check http://www.nomachine.com/licensing.html for applicability. */
+/* */
+/* NX and NoMachine are trademarks of Medialogic S.p.A. */
+/* */
+/* All rights reserved. */
+/* */
+/**************************************************************************/
+
#include "randrstr.h"
#include "registry.h"
@@ -288,7 +305,12 @@
RRModePtr mode;
REQUEST_AT_LEAST_SIZE (xRRCreateModeReq);
+ #ifndef NXAGENT_SERVER
rc = dixLookupWindow(&pWin, stuff->window, client, DixReadAccess);
+ #else
+ pWin = SecurityLookupWindow(stuff->window, client, SecurityReadAccess);
+ rc = pWin ? Success : BadWindow;
+ #endif
if (rc != Success)
return rc;

View File

@@ -0,0 +1,107 @@
--- ./nx-X11/programs/Xserver/randr/rrscreen.c.X.original 2015-02-13 14:03:44.792440567 +0100
+++ ./nx-X11/programs/Xserver/randr/rrscreen.c 2015-02-10 19:13:13.632692326 +0100
@@ -20,6 +20,23 @@
* OF THIS SOFTWARE.
*/
+/**************************************************************************/
+/* */
+/* Copyright (c) 2001, 2011 NoMachine, http://www.nomachine.com/. */
+/* */
+/* NX-X11, NX protocol compression and NX extensions to this software */
+/* are copyright of NoMachine. Redistribution and use of the present */
+/* software is allowed according to terms specified in the file LICENSE */
+/* which comes in the source distribution. */
+/* */
+/* Check http://www.nomachine.com/licensing.html for applicability. */
+/* */
+/* NX and NoMachine are trademarks of Medialogic S.p.A. */
+/* */
+/* All rights reserved. */
+/* */
+/**************************************************************************/
+
#include "randrstr.h"
extern char *ConnectionInfo;
@@ -212,7 +229,12 @@
int rc;
REQUEST_SIZE_MATCH(xRRGetScreenInfoReq);
+ #ifndef NXAGENT_SERVER
rc = dixLookupWindow(&pWin, stuff->window, client, DixReadAccess);
+ #else
+ pWin = SecurityLookupWindow(stuff->window, client, SecurityReadAccess);
+ rc = pWin ? Success : BadWindow;
+ #endif
if (rc != Success)
return rc;
@@ -263,7 +285,12 @@
int i, rc;
REQUEST_SIZE_MATCH(xRRSetScreenSizeReq);
+ #ifndef NXAGENT_SERVER
rc = dixLookupWindow(&pWin, stuff->window, client, DixReadAccess);
+ #else
+ pWin = SecurityLookupWindow(stuff->window, client, SecurityReadAccess);
+ rc = pWin ? Success : BadWindow;
+ #endif
if (rc != Success)
return rc;
@@ -333,7 +360,12 @@
CARD8 *names;
REQUEST_SIZE_MATCH(xRRGetScreenResourcesReq);
+ #ifndef NXAGENT_SERVER
rc = dixLookupWindow(&pWin, stuff->window, client, DixReadAccess);
+ #else
+ pWin = SecurityLookupWindow(stuff->window, client, SecurityReadAccess);
+ rc = pWin ? Success : BadWindow;
+ #endif
if (rc != Success)
return rc;
@@ -582,7 +614,12 @@
RROutputPtr output;
REQUEST_SIZE_MATCH(xRRGetScreenInfoReq);
+ #ifndef NXAGENT_SERVER
rc = dixLookupWindow(&pWin, stuff->window, client, DixReadAccess);
+ #else
+ pWin = SecurityLookupWindow(stuff->window, client, SecurityReadAccess);
+ rc = pWin ? Success : BadWindow;
+ #endif
if (rc != Success)
return rc;
@@ -756,7 +793,12 @@
has_rate = FALSE;
}
+ #ifndef NXAGENT_SERVER
rc = dixLookupDrawable(&pDraw, stuff->drawable, client, 0, DixWriteAccess);
+ #else
+ pDraw = SecurityLookupDrawable(stuff->drawable, client, SecurityWriteAccess);
+ rc = pDraw ? Success : BadDrawable;
+ #endif
if (rc != Success)
return rc;
@@ -921,8 +963,15 @@
if (!RRCrtcSet (crtc, mode, 0, 0, stuff->rotation, 1, &output))
rep.status = RRSetConfigFailed;
+ #ifndef NXAGENT_SERVER /* Bug 21987 */
else
rep.status = RRSetConfigSuccess;
+ #else
+ else {
+ rep.status = RRSetConfigSuccess;
+ pScrPriv->lastSetTime = time;
+ }
+ #endif
/*
* XXX Configure other crtcs to mirror as much as possible

View File

@@ -0,0 +1,72 @@
--- ./nx-X11/programs/Xserver/randr/rrxinerama.c.X.original 2015-02-13 14:03:44.792440567 +0100
+++ ./nx-X11/programs/Xserver/randr/rrxinerama.c 2015-02-10 19:13:13.620692775 +0100
@@ -68,9 +68,30 @@
* David Thomas <davtom@dream.org.uk>.
*/
+/**************************************************************************/
+/* */
+/* Copyright (c) 2001, 2011 NoMachine, http://www.nomachine.com/. */
+/* */
+/* NX-X11, NX protocol compression and NX extensions to this software */
+/* are copyright of NoMachine. Redistribution and use of the present */
+/* software is allowed according to terms specified in the file LICENSE */
+/* which comes in the source distribution. */
+/* */
+/* Check http://www.nomachine.com/licensing.html for applicability. */
+/* */
+/* NX and NoMachine are trademarks of Medialogic S.p.A. */
+/* */
+/* All rights reserved. */
+/* */
+/**************************************************************************/
+
#include "randrstr.h"
#include "swaprep.h"
+#ifndef NXAGENT_SERVER
#include <X11/extensions/panoramiXproto.h>
+#else
+#include "panoramiXproto.h"
+#endif
#define RR_XINERAMA_MAJOR_VERSION 1
#define RR_XINERAMA_MINOR_VERSION 1
@@ -122,7 +143,12 @@
Bool active = FALSE;
REQUEST_SIZE_MATCH(xPanoramiXGetStateReq);
+ #ifndef NXAGENT_SERVER
rc = dixLookupWindow(&pWin, stuff->window, client, DixGetAttrAccess);
+ #else
+ pWin = SecurityLookupWindow(stuff->window, client, SecurityReadAccess);
+ rc = pWin ? Success : BadWindow;
+ #endif
if(rc != Success)
return rc;
@@ -185,7 +211,12 @@
register int n, rc;
REQUEST_SIZE_MATCH(xPanoramiXGetScreenCountReq);
+ #ifndef NXAGENT_SERVER
rc = dixLookupWindow(&pWin, stuff->window, client, DixGetAttrAccess);
+ #else
+ pWin = SecurityLookupWindow(stuff->window, client, SecurityReadAccess);
+ rc = pWin ? Success : BadWindow;
+ #endif
if (rc != Success)
return rc;
@@ -213,7 +244,12 @@
register int n, rc;
REQUEST_SIZE_MATCH(xPanoramiXGetScreenSizeReq);
+ #ifndef NXAGENT_SERVER
rc = dixLookupWindow(&pWin, stuff->window, client, DixGetAttrAccess);
+ #else
+ pWin = SecurityLookupWindow(stuff->window, client, SecurityReadAccess);
+ rc = pWin ? Success : BadWindow;
+ #endif
if (rc != Success)
return rc;

View File

@@ -0,0 +1,10 @@
--- ./nx-X11/programs/Xserver/render/renderedge.c.X.original 2015-02-13 14:03:44.792440567 +0100
+++ ./nx-X11/programs/Xserver/render/renderedge.c 2015-02-10 19:13:13.592693823 +0100
@@ -143,6 +143,7 @@
dx = x_bot - x_top;
dy = y_bot - y_top;
e->dy = dy;
+ e->dx = 0;
if (dy)
{
if (dx >= 0)

View File

@@ -0,0 +1,12 @@
--- ./nx-X11/programs/Xserver/xfixes/cursor.c.X.original 2015-02-13 14:03:44.792440567 +0100
+++ ./nx-X11/programs/Xserver/xfixes/cursor.c 2015-02-10 19:13:13.508696968 +0100
@@ -96,7 +96,8 @@
CursorCurrent = pCursor;
for (e = cursorEvents; e; e = e->next)
{
- if (e->eventMask & XFixesDisplayCursorNotifyMask)
+ if ((e->eventMask & XFixesDisplayCursorNotifyMask) &&
+ !e->pClient->clientGone)
{
xXFixesCursorNotifyEvent ev;
ev.type = XFixesEventBase + XFixesCursorNotify;

View File

@@ -0,0 +1,13 @@
--- ./nx-X11/programs/Xserver/xfixes/select.c.X.original 2015-02-13 14:03:44.792440567 +0100
+++ ./nx-X11/programs/Xserver/xfixes/select.c 2015-02-10 19:13:13.504697118 +0100
@@ -78,7 +78,9 @@
}
for (e = selectionEvents; e; e = e->next)
{
- if (e->selection == selection->selection && (e->eventMask & eventMask))
+ if (e->selection == selection->selection &&
+ (e->eventMask & eventMask) &&
+ !e->pClient->clientGone)
{
xXFixesSelectionNotifyEvent ev;

View File

@@ -0,0 +1,21 @@
--- ./nx-X11/programs/Xserver/xkb/ddxKillSrv.c.X.original 2015-02-13 14:03:44.792440567 +0100
+++ ./nx-X11/programs/Xserver/xkb/ddxKillSrv.c 2015-02-10 19:13:13.736688433 +0100
@@ -52,10 +52,18 @@
int
XkbDDXTerminateServer(DeviceIntPtr dev,KeyCode key,XkbAction *act)
{
+#ifdef NXAGENT_SERVER
+
+ return 0;
+
+#else
+
#ifdef XF86DDXACTIONS
xf86ProcessActionEvent(ACTION_TERMINATE, NULL);
#else
GiveUp(1);
#endif
return 0;
+
+#endif /* NXAGENT_SERVER */
}

View File

@@ -0,0 +1,443 @@
--- ./nx-X11/programs/Xserver/xkb/ddxLoad.c.X.original 2015-02-13 14:03:44.792440567 +0100
+++ ./nx-X11/programs/Xserver/xkb/ddxLoad.c 2015-02-13 14:03:44.792440567 +0100
@@ -34,6 +34,7 @@
#include <xkb-config.h>
#endif
+#include <errno.h>
#include <stdio.h>
#include <ctype.h>
#define NEED_EVENTS 1
@@ -175,6 +176,310 @@
# endif
#endif
+#ifdef NXAGENT_SERVER
+
+#define NX_XKB_BASE_DIRECTORY "/usr/lib/X11/xkb"
+#define NX_XKB_ALTERNATE_BASE_DIRECTORY "/usr/share/X11/xkb"
+#define NX_KEYMAP_DIR_FILE "keymap.dir"
+#define NX_ALT_XKBCOMP_PATH "/usr/bin"
+
+static char _NXXkbBasePath[PATH_MAX];
+static char _NXXkbCompPath[PATH_MAX];
+
+static int NXVerifyXkbBaseDirectory(const char *dirPath)
+{
+ int size;
+ char *keymapDirFilePath;
+ struct stat keymapDirFileStat;
+
+ /*
+ * If keymap.dir file
+ * is not present into
+ * Xkb Base Directory,
+ * we suppose that the
+ * path is not valid.
+ */
+
+ size = strlen(dirPath) + strlen("/") +
+ strlen(NX_KEYMAP_DIR_FILE) + 1;
+
+ if ((keymapDirFilePath = malloc((size + 1) * sizeof(char))) == NULL)
+ {
+ FatalError("NXVerifyXkbBaseDirectory: malloc failed.\n");
+ }
+
+ strcpy(keymapDirFilePath, dirPath);
+ strcat(keymapDirFilePath, "/");
+ strcat(keymapDirFilePath, NX_KEYMAP_DIR_FILE);
+
+ #ifdef TEST
+ fprintf(stderr, "NXVerifyXkbBaseDirectory: Looking for [%s] file.\n",
+ keymapDirFilePath);
+ #endif
+
+ if (stat(keymapDirFilePath, &keymapDirFileStat) != 0)
+ {
+
+ #ifdef TEST
+ fprintf(stderr, "NXVerifyXkbBaseDirectory: Can't find the keymap.dir file [%s].\n",
+ keymapDirFilePath);
+ #endif
+
+ free(keymapDirFilePath);
+
+ return 0;
+ }
+
+ #ifdef TEST
+ fprintf(stderr, "NXVerifyXkbBaseDirectory: Xkb Base Directory [%s] is valid.\n",
+ dirPath);
+ #endif
+
+ free(keymapDirFilePath);
+
+ return 1;
+}
+
+/*
+ * This function returns the directory
+ * containing the configuration files.
+ * This directory is referred by Xkb-
+ * BaseDirectory variable (generally
+ * it contains the hardcoded path at
+ * compile time). If the directory
+ * does not exist, the function will
+ * try a set of well known directories.
+ */
+
+char *_NXGetXkbBasePath(const char *path)
+{
+ /*
+ * Check the xkb base directory only once.
+ */
+
+ if (*_NXXkbBasePath != '\0')
+ {
+ return _NXXkbBasePath;
+ }
+
+ if (NXVerifyXkbBaseDirectory(XkbBaseDirectory) == 1)
+ {
+ if (strlen(XkbBaseDirectory) + 1 > PATH_MAX)
+ {
+ #ifdef TEST
+ fprintf(stderr, "_NXGetXkbBasePath: WARNING! Maximum length of xkb base path exceeded.\n");
+ #endif
+
+ goto _NXGetXkbBasePathError;
+ }
+
+ strcpy(_NXXkbBasePath, XkbBaseDirectory);
+
+ #ifdef TEST
+ fprintf(stderr, "_NXGetXkbBasePath: Using NX xkb base directory path [%s].\n",
+ _NXXkbBasePath);
+ #endif
+
+ return _NXXkbBasePath;
+ }
+
+ if (NXVerifyXkbBaseDirectory(NX_XKB_BASE_DIRECTORY) == 1)
+ {
+ if (strlen(NX_XKB_BASE_DIRECTORY) + 1 > PATH_MAX)
+ {
+ #ifdef TEST
+ fprintf(stderr, "_NXGetXkbBasePath: WARNING! Maximum length of xkb base path exceeded.\n");
+ #endif
+
+ goto _NXGetXkbBasePathError;
+ }
+
+ strcpy(_NXXkbBasePath, NX_XKB_BASE_DIRECTORY);
+
+ #ifdef TEST
+ fprintf(stderr, "_NXGetXkbBasePath: Using NX xkb base directory path [%s].\n",
+ _NXXkbBasePath);
+ #endif
+
+ return _NXXkbBasePath;
+ }
+
+ if (NXVerifyXkbBaseDirectory(NX_XKB_ALTERNATE_BASE_DIRECTORY) == 1)
+ {
+ if (strlen(NX_XKB_ALTERNATE_BASE_DIRECTORY) + 1 > PATH_MAX)
+ {
+ #ifdef TEST
+ fprintf(stderr, "_NXGetXkbBasePath: WARNING! Maximum length of xkb base path exceeded.\n");
+ #endif
+
+ goto _NXGetXkbBasePathError;
+ }
+
+ strcpy(_NXXkbBasePath, NX_XKB_ALTERNATE_BASE_DIRECTORY);
+
+ #ifdef TEST
+ fprintf(stderr, "_NXGetXkbBasePath: Using NX xkb base directory path [%s].\n",
+ _NXXkbBasePath);
+ #endif
+
+ return _NXXkbBasePath;
+ }
+
+_NXGetXkbBasePathError:
+
+ if (strlen(path) + 1 > PATH_MAX)
+ {
+ #ifdef TEST
+ fprintf(stderr, "_NXGetXkbBasePath: WARNING! Maximum length of xkb base path exceeded.\n");
+ #endif
+ }
+
+ strcpy(_NXXkbBasePath, path);
+
+ #ifdef TEST
+ fprintf(stderr, "_NXGetXkbBasePath: Using default xkb base path [%s].\n",
+ _NXXkbBasePath);
+ #endif
+
+ return _NXXkbBasePath;
+}
+
+static int NXVerifyXkbCompPath(char *path)
+{
+ char *xkbCompPath;
+ int xkbCompPathSize;
+ struct stat xkbCompPathStat;
+
+ if (path == NULL)
+ {
+ return 0;
+ }
+
+ xkbCompPathSize = strlen(path) + strlen("/") +
+ strlen("xkbcomp") + 1;
+
+ if ((xkbCompPath = malloc((xkbCompPathSize + 1) * sizeof(char))) == NULL)
+ {
+ FatalError("NXVerifyXkbCompPath: WARNING! malloc failed.\n");
+
+ return 0;
+ }
+
+ strcpy(xkbCompPath, path);
+ strcat(xkbCompPath, "/");
+ strcat(xkbCompPath, "xkbcomp");
+
+ if (stat(xkbCompPath, &xkbCompPathStat) != 0)
+ {
+ #ifdef NX_TRANS_TEST
+ fprintf(stderr, "NXVerifyXkbCompPath: WARNING! Failed to stat xkbcomp path [%s].\n",
+ xkbCompPath);
+ #endif
+
+ free(xkbCompPath);
+
+ return 0;
+ }
+
+ free(xkbCompPath);
+
+ return 1;
+}
+
+/*
+ * This function returns the directory
+ * containing the xkbcomp executable.
+ * The function will first try to locate
+ * the executable in the hardcoded path
+ * (the same path as the "base" xkb one)
+ * and, if the xkbcomp file couldn't be
+ * found, the function will not include
+ * an explicit path and will rely on the
+ * PATH environment to list the directory.
+ */
+
+char *_NXGetXkbCompPath(const char *path)
+{
+
+ char * xkbCompPath;
+
+ /*
+ * Check the xkbcomp executable
+ * directory only once.
+ */
+
+ if (*_NXXkbCompPath != '\0')
+ {
+ return _NXXkbCompPath;
+ }
+
+ xkbCompPath = _NXGetXkbBasePath(path);
+
+ if (NXVerifyXkbCompPath(xkbCompPath) == 1)
+ {
+ if (strlen(xkbCompPath) + 1 > PATH_MAX)
+ {
+ #ifdef TEST
+ fprintf(stderr, "_NXGetXkbCompPath: WARNING! Maximum length of xkbcomp path exceeded.\n");
+ #endif
+
+ goto _NXGetXkbCompPathError;
+ }
+
+ strcpy(_NXXkbCompPath, xkbCompPath);
+
+ #ifdef TEST
+ fprintf(stderr, "_NXGetXkbCompPath: Using xkbcomp path [%s].\n",
+ _NXXkbCompPath);
+ #endif
+
+ return _NXXkbCompPath;
+ }
+
+ xkbCompPath = NX_ALT_XKBCOMP_PATH;
+
+ if (NXVerifyXkbCompPath(xkbCompPath) == 1)
+ {
+ if (strlen(xkbCompPath) + 1 > PATH_MAX)
+ {
+ #ifdef TEST
+ fprintf(stderr, "_NXGetXkbCompPath: WARNING! Maximum length of xkbcomp path exceeded.\n");
+ #endif
+
+ goto _NXGetXkbCompPathError;
+ }
+
+ strcpy(_NXXkbCompPath, xkbCompPath);
+
+ #ifdef TEST
+ fprintf(stderr, "_NXGetXkbCompPath: Using NX xkbcomp path [%s].\n",
+ _NXXkbCompPath);
+ #endif
+
+ return _NXXkbCompPath;
+ }
+
+_NXGetXkbCompPathError:
+
+ if (strlen(path) + 1 > PATH_MAX)
+ {
+ #ifdef TEST
+ fprintf(stderr, "_NXGetXkbCompPath: WARNING! Maximum length of xkbcomp path exceeded.\n");
+ #endif
+ }
+
+ strcpy(_NXXkbCompPath, path);
+
+ #ifdef TEST
+ fprintf(stderr, "_NXGetXkbCompPath: Using default xkbcomp path [%s].\n",
+ _NXXkbCompPath);
+ #endif
+
+ return _NXXkbCompPath;
+}
+
+#endif
+
static void
OutputDirectory(
char* outdir,
@@ -240,14 +545,36 @@
XkbEnsureSafeMapName(outFile);
OutputDirectory(xkm_output_dir, sizeof(xkm_output_dir));
+#ifdef NXAGENT_SERVER
+
+ if (_NXGetXkbCompPath(XkbBaseDirectory) != NULL)
+ {
+
+#else
+
if (XkbBaseDirectory!=NULL) {
+
+#endif
+
#ifndef __UNIXOS2__
+
+#ifdef NXAGENT_SERVER
+ char *xkbbasedir = _NXGetXkbBasePath(XkbBaseDirectory);
+ char *xkbbindir = _NXGetXkbCompPath(XkbBinDirectory);
+#else
char *xkbbasedir = XkbBaseDirectory;
char *xkbbindir = XkbBinDirectory;
+#endif
+
#else
/* relocate the basedir and replace the slashes with backslashes */
+#ifdef NXAGENT_SERVER
+ char *xkbbasedir = (char*)__XOS2RedirRoot(_NXGetXkbBasePath(XkbBaseDirectory));
+ char *xkbbindir = (char*)__XOS2RedirRoot(_NXGetXkbCompPath(XkbBinDirectory));
+#else
char *xkbbasedir = (char*)__XOS2RedirRoot(XkbBaseDirectory);
char *xkbbindir = (char*)__XOS2RedirRoot(XkbBinDirectory);
+#endif
int i;
for (i=0; i<strlen(xkbbasedir); i++)
@@ -332,7 +659,13 @@
strcat(tmpname, "\\xkb_XXXXXX");
(void) mktemp(tmpname);
#endif
+
+#ifdef NXAGENT_SERVER
+ if (_NXGetXkbCompPath(XkbBaseDirectory)!=NULL) {
+#else
if (XkbBaseDirectory!=NULL) {
+#endif
+
#ifndef WIN32
char *xkmfile = "-";
#else
@@ -341,12 +674,22 @@
char *xkmfile = tmpname;
#endif
#ifndef __UNIXOS2__
+#ifdef NXAGENT_SERVER
+ char *xkbbasedir = _NXGetXkbBasePath(XkbBaseDirectory);
+ char *xkbbindir = _NXGetXkbCompPath(XkbBinDirectory);
+#else
char *xkbbasedir = XkbBaseDirectory;
char *xkbbindir = XkbBinDirectory;
+#endif
#else
int i;
+#ifdef NXAGENT_SERVER
+ char *xkbbasedir = (char*)__XOS2RedirRoot(_NXGetXkbBasePath(XkbBaseDirectory));
+ char *xkbbindir = (char*)__XOS2RedirRoot(_NXGetXkbCompPath(XkbBinDirectory));
+#else
char *xkbbasedir = (char*)__XOS2RedirRoot(XkbBaseDirectory);
char *xkbbindir = (char*)__XOS2RedirRoot(XkbBinDirectory);
+#endif
for (i=0; i<strlen(xkbbasedir); i++)
if (xkbbasedir[i]=='/') xkbbasedir[i]='\\';
for (i=0; i<strlen(xkbbindir); i++)
@@ -375,6 +718,15 @@
xkm_output_dir,keymap);
}
+ #ifdef TEST
+ if (buf != NULL)
+ fprintf(stderr, "XkbDDXCompileKeymapByNames: "
+ "Executing command [%s].\n", buf);
+ else
+ fprintf(stderr, "XkbDDXCompileKeymapByNames: "
+ "Callin Popen() with null command.\n");
+ #endif
+
#ifndef WIN32
out= Popen(buf,"w");
#else
@@ -390,7 +742,15 @@
#endif
XkbWriteXKBKeymapForNames(out,names,NULL,xkb,want,need);
#ifndef WIN32
+#ifdef __sun
+ if (Pclose(out) != 0)
+ {
+ ErrorF("Warning: Spurious failure reported in Pclose() runnning 'xkbcomp'.\n");
+ }
+ if (1)
+#else
if (Pclose(out)==0)
+#endif
#else
if (fclose(out)==0 && System(buf) >= 0)
#endif
@@ -415,9 +775,15 @@
{
int i;
char name[PATH_MAX];
+#ifdef NXAGENT_SERVER
+ if (_NXGetXkbCompPath(XkbBaseDirectory)!=NULL)
+ sprintf(name,"%s/%s%s.xkm", _NXGetXkbCompPath(XkbBaseDirectory)
+ ,xkm_output_dir, keymap);
+#else
if (XkbBaseDirectory!=NULL)
sprintf(name,"%s/%s%s.xkm", XkbBaseDirectory
,xkm_output_dir, keymap);
+#endif
else
sprintf(name,"%s%s.xkm", xkm_output_dir, keymap);
for (i = 0; i < 10; i++) {

View File

@@ -0,0 +1,24 @@
--- ./nx-X11/programs/Xserver/xkb/xkbDflts.h.X.original 2015-02-13 14:03:44.792440567 +0100
+++ ./nx-X11/programs/Xserver/xkb/xkbDflts.h 2015-02-10 19:13:13.736688433 +0100
@@ -417,10 +417,21 @@
XkbSI_AnyOfOrNone, 0xff,
255,
{ XkbSA_LockControls, { 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00 } } },
+
+#ifndef NX_TRANS_SOCKET
+
+ /*
+ * Make sure that the server can't be killed
+ * by pressing this key-sequence.
+ */
+
{ XK_Terminate_Server, 0x0000,
XkbSI_AnyOfOrNone, 0xff,
255,
{ XkbSA_Terminate, { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } } },
+
+#endif
+
{ XK_ISO_Group_Latch, 0x0000,
XkbSI_LevelOneOnly|XkbSI_AnyOfOrNone, 0xff,
3,

View File

@@ -0,0 +1,40 @@
--- ./nx-X11/programs/xterm/charproc.c.X.original 2015-02-13 14:03:44.800440409 +0100
+++ ./nx-X11/programs/xterm/charproc.c 2015-02-13 14:03:44.796440488 +0100
@@ -82,6 +82,23 @@
* SOFTWARE.
*/
+/**************************************************************************/
+/* */
+/* Copyright (c) 2001, 2011 NoMachine, http://www.nomachine.com/. */
+/* */
+/* NX-X11, NX protocol compression and NX extensions to this software */
+/* are copyright of NoMachine. Redistribution and use of the present */
+/* software is allowed according to terms specified in the file LICENSE */
+/* which comes in the source distribution. */
+/* */
+/* Check http://www.nomachine.com/licensing.html for applicability. */
+/* */
+/* NX and NoMachine are trademarks of Medialogic S.p.A. */
+/* */
+/* All rights reserved. */
+/* */
+/**************************************************************************/
+
/* charproc.c */
#include <version.h>
@@ -3177,6 +3194,13 @@
}
if (need_cleanup)
Cleanup(0);
+
+#if defined(NX_TRANS_SOCKET) && defined(NX_TRANS_TEST)
+ fprintf(stderr, "xterm::in_put: Select called with [%d][%p][%p][%p][%p].\n",
+ max_plus1, (void *) &select_mask, (void *) &write_mask, (void *) 0,
+ (void *) (time_select ? &select_timeout : 0));
+#endif
+
i = Select(max_plus1, &select_mask, &write_mask, 0,
(time_select ? &select_timeout : 0));
if (i < 0) {

View File

@@ -0,0 +1,42 @@
--- ./nx-X11/programs/xterm/main.c.X.original 2015-02-13 14:03:44.804440330 +0100
+++ ./nx-X11/programs/xterm/main.c 2015-02-13 14:03:44.804440330 +0100
@@ -91,8 +91,39 @@
******************************************************************/
+/**************************************************************************/
+/* */
+/* Copyright (c) 2001, 2011 NoMachine, http://www.nomachine.com/. */
+/* */
+/* NX-X11, NX protocol compression and NX extensions to this software */
+/* are copyright of NoMachine. Redistribution and use of the present */
+/* software is allowed according to terms specified in the file LICENSE */
+/* which comes in the source distribution. */
+/* */
+/* Check http://www.nomachine.com/licensing.html for applicability. */
+/* */
+/* NX and NoMachine are trademarks of Medialogic S.p.A. */
+/* */
+/* All rights reserved. */
+/* */
+/**************************************************************************/
+
/* $XFree86: xc/programs/xterm/main.c,v 3.199 2005/11/13 23:10:36 dickey Exp $ */
+#ifdef NX_TRANS_EXIT
+
+/*
+ * Redefine the libc exit() function to be
+ * sure we get rid of proxy and detect any
+ * abnormal termination.
+ */
+
+extern void NXTransExit(int code) __attribute__((noreturn));
+
+#define exit(code) NXTransExit(code)
+
+#endif /* #ifdef NX_TRANS_EXIT */
+
/* main.c */
#define RES_OFFSET(field) XtOffsetOf(XTERM_RESOURCE, field)

File diff suppressed because it is too large Load Diff