aboutsummaryrefslogtreecommitdiff
path: root/doc/nx-X11_vs_XOrg69_patches/context.c.NX.patch
diff options
context:
space:
mode:
authorMike Gabriel <mike.gabriel@das-netzwerkteam.de>2015-02-13 14:14:26 +0100
committerMike Gabriel <mike.gabriel@das-netzwerkteam.de>2015-02-13 14:18:50 +0100
commit1e5ee575d4912665dd2356681f0827d5229fa1f5 (patch)
tree31db7768b2686507a5f9ea2ffa03d9c62ccf78c9 /doc/nx-X11_vs_XOrg69_patches/context.c.NX.patch
parent1fd8551f1632efbc2655c9293087bba08cf2f0c9 (diff)
downloadnx-libs-1e5ee575d4912665dd2356681f0827d5229fa1f5.tar.gz
nx-libs-1e5ee575d4912665dd2356681f0827d5229fa1f5.tar.bz2
nx-libs-1e5ee575d4912665dd2356681f0827d5229fa1f5.zip
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.
Diffstat (limited to 'doc/nx-X11_vs_XOrg69_patches/context.c.NX.patch')
-rw-r--r--doc/nx-X11_vs_XOrg69_patches/context.c.NX.patch103
1 files changed, 103 insertions, 0 deletions
diff --git a/doc/nx-X11_vs_XOrg69_patches/context.c.NX.patch b/doc/nx-X11_vs_XOrg69_patches/context.c.NX.patch
new file mode 100644
index 000000000..92dedfc0a
--- /dev/null
+++ b/doc/nx-X11_vs_XOrg69_patches/context.c.NX.patch
@@ -0,0 +1,103 @@
+--- ./nx-X11/extras/Mesa/src/mesa/main/context.c.X.original 2015-02-13 14:03:44.464447019 +0100
++++ ./nx-X11/extras/Mesa/src/mesa/main/context.c 2015-02-10 19:13:14.800648672 +0100
+@@ -131,6 +131,10 @@
+ #endif
+ #include "shaderobjects.h"
+
++#ifdef NXAGENT_SERVER
++#include "WSDrawBuffer.h"
++#endif
++
+ #ifdef USE_SPARC_ASM
+ #include "sparc/sparc.h"
+ #endif
+@@ -143,6 +147,47 @@
+ int MESA_DEBUG_FLAGS = 0;
+ #endif
+
++#ifdef NXAGENT_SERVER
++extern WSDrawBufferPtr pWSDrawBuffer;
++
++int IsWSDrawBuffer(GLframebuffer *mesa_buffer)
++{
++ WSDrawBufferPtr p = pWSDrawBuffer;
++
++ while (p != NULL) {
++ if (p -> DrawBuffer == mesa_buffer) {
++ return 1;
++ }
++ p = p -> next;
++ }
++ return 0;
++}
++
++void FreeWSDrawBuffer(GLframebuffer *mesa_buffer)
++{
++ WSDrawBufferPtr p = pWSDrawBuffer;
++ WSDrawBufferPtr pOld = NULL;
++
++ if (p == NULL)
++ return;
++
++ if (p -> DrawBuffer == mesa_buffer) {
++ pWSDrawBuffer = p -> next;
++ free(p);
++ return;
++ }
++
++ while (p -> next != NULL) {
++ if (p -> next -> DrawBuffer == mesa_buffer) {
++ pOld = p -> next;
++ p -> next = p -> next -> next;
++ free(pOld);
++ return;
++ }
++ p = p -> next;
++ }
++}
++#endif
+
+ /* ubyte -> float conversion */
+ GLfloat _mesa_ubyte_to_float_color_tab[256];
+@@ -1520,6 +1565,10 @@
+ _mesa_make_current( GLcontext *newCtx, GLframebuffer *drawBuffer,
+ GLframebuffer *readBuffer )
+ {
++ #ifdef NXAGENT_SERVER
++ int flag;
++ #endif
++
+ if (MESA_VERBOSE & VERBOSE_API)
+ _mesa_debug(newCtx, "_mesa_make_current()\n");
+
+@@ -1558,11 +1607,30 @@
+ ASSERT(readBuffer->Name == 0);
+ newCtx->WinSysDrawBuffer = drawBuffer;
+ newCtx->WinSysReadBuffer = readBuffer;
++
++#ifdef NXAGENT_SERVER
++ flag = 0;
++ if (newCtx->DrawBuffer) {
++ if (!IsWSDrawBuffer(newCtx->DrawBuffer)) {
++ if (newCtx->DrawBuffer->Name == 0) {
++ flag = 1;
++ }
++ FreeWSDrawBuffer(newCtx->DrawBuffer);
++ }
++ else flag = 1;
++ }
++
++ if (!newCtx->DrawBuffer || flag) {
++ newCtx->DrawBuffer = drawBuffer;
++ newCtx->ReadBuffer = readBuffer;
++ }
++#else
+ /* don't replace user-buffer bindings with window system buffer */
+ if (!newCtx->DrawBuffer || newCtx->DrawBuffer->Name == 0) {
+ newCtx->DrawBuffer = drawBuffer;
+ newCtx->ReadBuffer = readBuffer;
+ }
++#endif
+
+ newCtx->NewState |= _NEW_BUFFERS;
+