From 1e5ee575d4912665dd2356681f0827d5229fa1f5 Mon Sep 17 00:00:00 2001 From: Mike Gabriel Date: Fri, 13 Feb 2015 14:14:26 +0100 Subject: 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. --- doc/nx-X11_vs_XOrg69_patches/oscolor.c.NX.patch | 214 ++++++++++++++++++++++++ 1 file changed, 214 insertions(+) create mode 100644 doc/nx-X11_vs_XOrg69_patches/oscolor.c.NX.patch (limited to 'doc/nx-X11_vs_XOrg69_patches/oscolor.c.NX.patch') diff --git a/doc/nx-X11_vs_XOrg69_patches/oscolor.c.NX.patch b/doc/nx-X11_vs_XOrg69_patches/oscolor.c.NX.patch new file mode 100644 index 000000000..88acc878a --- /dev/null +++ b/doc/nx-X11_vs_XOrg69_patches/oscolor.c.NX.patch @@ -0,0 +1,214 @@ +--- ./nx-X11/programs/Xserver/os/oscolor.c.X.original 2015-02-13 14:03:44.788440645 +0100 ++++ ./nx-X11/programs/Xserver/os/oscolor.c 2015-02-13 14:03:44.788440645 +0100 +@@ -47,6 +47,17 @@ + ******************************************************************/ + /* $Xorg: oscolor.c,v 1.4 2001/02/09 02:05:23 xorgcvs Exp $ */ + ++#ifdef NX_TRANS_SOCKET ++ ++#include ++#include ++#include ++ ++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 + #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; + } -- cgit v1.2.3