Commit 1e5ee575 authored by Mike Gabriel's avatar Mike Gabriel

nx-X11 vs. X.Org 6.9 patches for further studying / documentation

NoMachine kept all original X.Org 6.9 files in the nx-X11 source tree. These files have been removed in Feb 2015 during a major code cleanup. For later studying we provide all diffs of the changes that NoMachine employed on the original X.Org X11 code tree in the doc/nx-X11_vs_XOrg69_patches folder.
parent 1fd8551f
--- ./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;
--- ./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
--- ./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 &&
--- ./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
}
}
--- ./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()
--- ./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
}
}
--- ./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,
--- ./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;)
--- ./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;
}
-
--- ./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;
}
+
--- ./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;
}
--- ./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) \
--- ./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)
--- ./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);
}
+
}
--- ./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,
--- ./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;
--- ./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"
--- ./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);
}
+
--- ./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
--- ./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);
}
--- ./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
}
}
--- ./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;
}
--- ./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;
}
--- ./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,
--- ./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;
--- ./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 */,
--- ./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;
}
--- ./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
--- ./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
--- ./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,
--- ./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) {
--- ./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,
--- ./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)
{
--- ./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;
--- ./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
--- ./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;
--- ./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 */
}
--- ./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 == ',') {
--- ./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)
--- ./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);
--- ./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;
--- ./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 );
--- ./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 */
--- ./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();
--- ./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)
--- ./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;
}
--- ./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
--- ./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);
--- ./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;
--- ./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_ */
--- ./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 */
--- ./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)
{
--- ./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)
{
--- ./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)
--- ./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)
{
--- ./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,
--- ./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;
--- ./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
--- ./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;
--- ./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");
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment