aboutsummaryrefslogtreecommitdiff
path: root/nx-X11/programs/Xserver/hw/nxagent
diff options
context:
space:
mode:
authorUlrich Sibiller <uli42@gmx.de>2018-11-05 22:16:25 +0100
committerMike Gabriel <mike.gabriel@das-netzwerkteam.de>2018-11-09 15:36:31 +0100
commit49607e93f53c7d15c8d18b36763e855ecb42a496 (patch)
treed5ba7a097214845b8e4c82b6c56ed4c854f3a49a /nx-X11/programs/Xserver/hw/nxagent
parentfccef5fc5794c3aab5c28dbe354c3dc3a86cc07b (diff)
downloadnx-libs-49607e93f53c7d15c8d18b36763e855ecb42a496.tar.gz
nx-libs-49607e93f53c7d15c8d18b36763e855ecb42a496.tar.bz2
nx-libs-49607e93f53c7d15c8d18b36763e855ecb42a496.zip
Lift Xext to xorg 1.4.2
Diffstat (limited to 'nx-X11/programs/Xserver/hw/nxagent')
-rw-r--r--nx-X11/programs/Xserver/hw/nxagent/NXshm.c165
-rw-r--r--nx-X11/programs/Xserver/hw/nxagent/NXxvdisp.c195
2 files changed, 216 insertions, 144 deletions
diff --git a/nx-X11/programs/Xserver/hw/nxagent/NXshm.c b/nx-X11/programs/Xserver/hw/nxagent/NXshm.c
index 5e8e8ed6b..246d39355 100644
--- a/nx-X11/programs/Xserver/hw/nxagent/NXshm.c
+++ b/nx-X11/programs/Xserver/hw/nxagent/NXshm.c
@@ -95,15 +95,21 @@ ShmExtensionInit(void)
}
#endif
+#ifdef NXAGENT_SERVER
if (nxagentOption(SharedMemory) == False)
{
return;
}
+#endif
sharedPixmaps = xFalse;
pixmapFormat = 0;
{
+#ifdef NXAGENT_SERVER
sharedPixmaps = nxagentOption(SharedPixmaps);
+#else
+ sharedPixmaps = xTrue;
+#endif
pixmapFormat = shmPixFormat[0];
for (i = 0; i < screenInfo.numScreens; i++)
{
@@ -156,7 +162,7 @@ ShmExtensionInit(void)
}
static void
-miShmPutImage(dst, pGC, depth, format, w, h, sx, sy, sw, sh, dx, dy, data)
+nxagent_miShmPutImage(dst, pGC, depth, format, w, h, sx, sy, sw, sh, dx, dy, data)
DrawablePtr dst;
GCPtr pGC;
int depth, w, h, sx, sy, sw, sh, dx, dy;
@@ -166,18 +172,15 @@ miShmPutImage(dst, pGC, depth, format, w, h, sx, sy, sw, sh, dx, dy, data)
PixmapPtr pmap;
GCPtr putGC;
- nxagentShmTrap = 0;
putGC = GetScratchGC(depth, dst->pScreen);
if (!putGC)
{
- nxagentShmTrap = 1;
return;
}
pmap = (*dst->pScreen->CreatePixmap)(dst->pScreen, sw, sh, depth,
CREATE_PIXMAP_USAGE_SCRATCH);
if (!pmap)
{
- nxagentShmTrap = 1;
FreeScratchGC(putGC);
return;
}
@@ -192,9 +195,28 @@ miShmPutImage(dst, pGC, depth, format, w, h, sx, sy, sw, sh, dx, dy, data)
(void)(*pGC->ops->CopyArea)((DrawablePtr)pmap, dst, pGC, 0, 0, sw, sh,
dx, dy);
(*pmap->drawable.pScreen->DestroyPixmap)(pmap);
+}
+
+static void
+miShmPutImage(dst, pGC, depth, format, w, h, sx, sy, sw, sh, dx, dy, data)
+ DrawablePtr dst;
+ GCPtr pGC;
+ int depth, w, h, sx, sy, sw, sh, dx, dy;
+ unsigned int format;
+ char *data;
+{
+ /* Careful! This wrapper DEACTIVATES the trap! */
+
+ nxagentShmTrap = 0;
+
+ nxagent_miShmPutImage(dst, pGC, depth, format, w, h, sx, sy, sw, sh, dx, dy, data);
+
nxagentShmTrap = 1;
+
+ return;
}
+
static void
fbShmPutImage(dst, pGC, depth, format, w, h, sx, sy, sw, sh, dx, dy, data)
DrawablePtr dst;
@@ -203,6 +225,7 @@ fbShmPutImage(dst, pGC, depth, format, w, h, sx, sy, sw, sh, dx, dy, data)
unsigned int format;
char *data;
{
+#ifdef NXAGENT_SERVER
int length;
char *newdata;
extern int nxagentImageLength(int, int, int, int, int);
@@ -211,6 +234,7 @@ fbShmPutImage(dst, pGC, depth, format, w, h, sx, sy, sw, sh, dx, dy, data)
fprintf(stderr, "fbShmPutImage: Called with drawable at [%p] GC at [%p] data at [%p].\n",
(void *) dst, (void *) pGC, (void *) data);
#endif
+#endif
if ((format == ZPixmap) || (depth == 1))
{
@@ -227,6 +251,7 @@ fbShmPutImage(dst, pGC, depth, format, w, h, sx, sy, sw, sh, dx, dy, data)
(void)(*pGC->ops->CopyArea)((DrawablePtr)pPixmap, dst, pGC,
sx, sy, sw, sh, dx, dy);
+#ifdef NXAGENT_SERVER
/*
* We updated the internal framebuffer,
* now we want to go on the real X.
@@ -255,6 +280,7 @@ fbShmPutImage(dst, pGC, depth, format, w, h, sx, sy, sw, sh, dx, dy, data)
#endif
}
+#endif /* NXAGENT_SERVER */
FreeScratchPixmapHeader(pPixmap);
}
else
@@ -345,17 +371,46 @@ ProcShmPutImage(client)
stuff->srcY, stuff->totalWidth, stuff->totalHeight);
#endif
- #ifdef TEST
- fprintf(stderr, "ProcShmPutImage: Calling (*shmFuncs[pDraw->pScreen->myNum]->PutImage)().\n");
- #endif
-
- (*shmFuncs[pDraw->pScreen->myNum]->PutImage)(
- pDraw, pGC, stuff->depth, stuff->format,
- stuff->totalWidth, stuff->totalHeight,
- stuff->srcX, stuff->srcY,
- stuff->srcWidth, stuff->srcHeight,
+#ifndef NXAGENT_SERVER
+ /*
+ It seems like this code was removed for a good reason. Including
+ it leads to very strange issues when coupled with libXcomp and using
+ connection speed settings lower than LAN (and even on LAN some icons
+ are not showing up correctly, e.g., when using MATE).
+
+ Further investigation on why this happens pending and might happen at a
+ later time.
+
+ See also ArcticaProject/nx-libs#656
+ */
+ if ((((stuff->format == ZPixmap) && (stuff->srcX == 0)) ||
+ ((stuff->format != ZPixmap) &&
+ (stuff->srcX < screenInfo.bitmapScanlinePad) &&
+ ((stuff->format == XYBitmap) ||
+ - ((stuff->srcY == 0) &&
+ - (stuff->srcHeight == stuff->totalHeight))))) &&
+ ((stuff->srcX + stuff->srcWidth) == stuff->totalWidth))
+ (*pGC->ops->PutImage) (pDraw, pGC, stuff->depth,
stuff->dstX, stuff->dstY,
- shmdesc->addr + stuff->offset);
+ stuff->totalWidth, stuff->srcHeight,
+ stuff->srcX, stuff->format,
+ shmdesc->addr + stuff->offset +
+ (stuff->srcY * length));
+- else
+#endif
+ {
+ #ifdef TEST
+ fprintf(stderr, "ProcShmPutImage: Calling (*shmFuncs[pDraw->pScreen->myNum]->PutImage)().\n");
+ #endif
+
+ (*shmFuncs[pDraw->pScreen->myNum]->PutImage)(
+ pDraw, pGC, stuff->depth, stuff->format,
+ stuff->totalWidth, stuff->totalHeight,
+ stuff->srcX, stuff->srcY,
+ stuff->srcWidth, stuff->srcHeight,
+ stuff->dstX, stuff->dstY,
+ shmdesc->addr + stuff->offset);
+ }
if (stuff->sendEvent)
{
@@ -376,7 +431,7 @@ ProcShmPutImage(client)
static PixmapPtr
-fbShmCreatePixmap (pScreen, width, height, depth, addr)
+nxagent_fbShmCreatePixmap (pScreen, width, height, depth, addr)
ScreenPtr pScreen;
int width;
int height;
@@ -385,47 +440,59 @@ fbShmCreatePixmap (pScreen, width, height, depth, addr)
{
register PixmapPtr pPixmap;
- nxagentShmPixmapTrap = 1;
-
pPixmap = (*pScreen->CreatePixmap)(pScreen, width, height, depth, 0);
if (!pPixmap)
{
- nxagentShmPixmapTrap = 0;
-
return NullPixmap;
}
- #ifdef TEST
+ #if defined(NXAGENT_SERVER) && defined(TEST)
fprintf(stderr,"fbShmCreatePixmap: Width [%d] Height [%d] Depth [%d] Hint[%d]\n", width, height, depth, 0);
#endif
if (!(*pScreen->ModifyPixmapHeader)(pPixmap, width, height, depth,
BitsPerPixel(depth), PixmapBytePad(width, depth), (void *)addr))
{
- #ifdef WARNING
+ #if defined(NXAGENT_SERVER) && defined(WARNING)
fprintf(stderr,"fbShmCreatePixmap: Return Null Pixmap.\n");
#endif
(*pScreen->DestroyPixmap)(pPixmap);
- nxagentShmPixmapTrap = 0;
-
return NullPixmap;
}
+ return pPixmap;
+}
+
+static PixmapPtr
+fbShmCreatePixmap (pScreen, width, height, depth, addr)
+ ScreenPtr pScreen;
+ int width;
+ int height;
+ int depth;
+ char *addr;
+{
+ PixmapPtr result;
+
+ nxagentShmPixmapTrap = 1;
+
+ result = nxagent_fbShmCreatePixmap(pScreen, width, height, depth, addr);
+
nxagentShmPixmapTrap = 0;
- return pPixmap;
+ return result;
}
static int
-ProcShmDispatch (client)
+nxagent_ProcShmDispatch (client)
register ClientPtr client;
{
REQUEST(xReq);
+#ifdef NXAGENT_SERVER
#ifdef TEST
fprintf(stderr, "ProcShmDispatch: Going to execute operation [%d] for client [%d].\n",
stuff -> data, client -> index);
@@ -436,6 +503,7 @@ ProcShmDispatch (client)
nxagentShmRequestLiteral[stuff->data], stuff->data);
}
#endif
+#endif
switch (stuff->data)
{
@@ -447,36 +515,18 @@ ProcShmDispatch (client)
return ProcShmDetach(client);
case X_ShmPutImage:
{
- int result;
-
+#ifdef NXAGENT_SERVER
#ifdef TEST
fprintf(stderr, "ProcShmDispatch: Going to execute ProcShmPutImage() for client [%d].\n",
client -> index);
#endif
-
- nxagentShmTrap = 1;
+#endif
#ifdef PANORAMIX
if ( !noPanoramiXExtension )
- {
- result = ProcPanoramiXShmPutImage(client);
-
- nxagentShmTrap = 0;
-
- return result;
- }
+ return ProcPanoramiXShmPutImage(client);
#endif
-
- result = ProcShmPutImage(client);
-
- nxagentShmTrap = 0;
-
- #ifdef TEST
- fprintf(stderr, "ProcShmDispatch: Returning from ProcShmPutImage() for client [%d].\n",
- client -> index);
- #endif
-
- return result;
+ return ProcShmPutImage(client);
}
case X_ShmGetImage:
#ifdef PANORAMIX
@@ -495,6 +545,23 @@ ProcShmDispatch (client)
}
}
+/* A wrapper that handles the trap. This construct is used
+ to keep the derived code closer to the original
+*/
+static int
+ProcShmDispatch (register ClientPtr client)
+{
+ int result;
+
+ nxagentShmTrap = 1;
+
+ result = nxagent_ProcShmDispatch(client);
+
+ nxagentShmTrap = 0;
+
+ return result;
+}
+
static int
SProcShmDispatch (client)
register ClientPtr client;
@@ -523,11 +590,15 @@ SProcShmDispatch (client)
client -> index);
#endif
+#ifdef NXAGENT_SERVER
nxagentShmTrap = 1;
+#endif
result = SProcShmPutImage(client);
+#ifdef NXAGENT_SERVER
nxagentShmTrap = 0;
+#endif
#ifdef TEST
fprintf(stderr, "SProcShmDispatch: Returning from SProcShmPutImage() for client [%d].\n",
diff --git a/nx-X11/programs/Xserver/hw/nxagent/NXxvdisp.c b/nx-X11/programs/Xserver/hw/nxagent/NXxvdisp.c
index ea617aa4b..336ec1060 100644
--- a/nx-X11/programs/Xserver/hw/nxagent/NXxvdisp.c
+++ b/nx-X11/programs/Xserver/hw/nxagent/NXxvdisp.c
@@ -64,194 +64,195 @@ SOFTWARE.
*/
int
-ProcXvDispatch(ClientPtr client)
+nxagent_ProcXvDispatch(ClientPtr client)
{
- int result;
-
REQUEST(xReq);
UpdateCurrentTime();
- /*
- * Report upstream that we are
- * dispatching a XVideo operation.
- */
-
- nxagentXvTrap = 1;
-
- #ifdef TEST
- fprintf(stderr, "ProcXvDispatch: Going to dispatch XVideo operation [%d] for client [%d].\n",
- stuff->data, client -> index);
- #endif
-
switch (stuff->data)
{
- case xv_QueryExtension: result = (ProcXvQueryExtension(client)); break;
- case xv_QueryAdaptors: result = (ProcXvQueryAdaptors(client)); break;
- case xv_QueryEncodings: result = (ProcXvQueryEncodings(client)); break;
+ case xv_QueryExtension: return(ProcXvQueryExtension(client));
+ case xv_QueryAdaptors: return(ProcXvQueryAdaptors(client));
+ case xv_QueryEncodings: return(ProcXvQueryEncodings(client));
case xv_PutVideo:
#ifdef PANORAMIX
if(!noPanoramiXExtension)
- result = (XineramaXvPutVideo(client));
+ return(XineramaXvPutVideo(client));
else
#endif
- {
- result = (ProcXvPutVideo(client));
- }
- break;
+ return(ProcXvPutVideo(client));
case xv_PutStill:
#ifdef PANORAMIX
if(!noPanoramiXExtension)
- result = (XineramaXvPutStill(client));
+ return(XineramaXvPutStill(client));
else
#endif
{
- result = (ProcXvPutStill(client));
+ return(ProcXvPutStill(client));
}
- break;
- case xv_GetVideo: result = (ProcXvGetVideo(client)); break;
- case xv_GetStill: result = (ProcXvGetStill(client)); break;
- case xv_GrabPort: result = (ProcXvGrabPort(client)); break;
- case xv_UngrabPort: result = (ProcXvUngrabPort(client)); break;
- case xv_SelectVideoNotify: result = (ProcXvSelectVideoNotify(client)); break;
- case xv_SelectPortNotify: result = (ProcXvSelectPortNotify(client)); break;
+ case xv_GetVideo: return(ProcXvGetVideo(client));
+ case xv_GetStill: return(ProcXvGetStill(client));
+ case xv_GrabPort: return(ProcXvGrabPort(client));
+ case xv_UngrabPort: return(ProcXvUngrabPort(client));
+ case xv_SelectVideoNotify: return(ProcXvSelectVideoNotify(client));
+ case xv_SelectPortNotify: return(ProcXvSelectPortNotify(client));
case xv_StopVideo:
#ifdef PANORAMIX
if(!noPanoramiXExtension)
- result = (XineramaXvStopVideo(client));
+ return(XineramaXvStopVideo(client));
else
#endif
- {
- result = (ProcXvStopVideo(client));
- }
- break;
+ return(ProcXvStopVideo(client));
case xv_SetPortAttribute:
#ifdef PANORAMIX
if(!noPanoramiXExtension)
- result = (XineramaXvSetPortAttribute(client));
+ return(XineramaXvSetPortAttribute(client));
else
#endif
- {
- result = (ProcXvSetPortAttribute(client));
- }
- break;
- case xv_GetPortAttribute: result = (ProcXvGetPortAttribute(client)); break;
- case xv_QueryBestSize: result = (ProcXvQueryBestSize(client)); break;
- case xv_QueryPortAttributes: result = (ProcXvQueryPortAttributes(client)); break;
+ return(ProcXvSetPortAttribute(client));
+ case xv_GetPortAttribute: return(ProcXvGetPortAttribute(client));
+ case xv_QueryBestSize: return(ProcXvQueryBestSize(client));
+ case xv_QueryPortAttributes: return(ProcXvQueryPortAttributes(client));
case xv_PutImage:
#ifdef PANORAMIX
if(!noPanoramiXExtension)
- result = (XineramaXvPutImage(client));
+ return(XineramaXvPutImage(client));
else
#endif
- {
- result = (ProcXvPutImage(client));
- }
- break;
+ return(ProcXvPutImage(client));
#ifdef MITSHM
case xv_ShmPutImage:
#ifdef PANORAMIX
if(!noPanoramiXExtension)
- result = (XineramaXvShmPutImage(client));
+ return(XineramaXvShmPutImage(client));
else
#endif
- {
- result = (ProcXvShmPutImage(client));
- }
- break;
+ return(ProcXvShmPutImage(client));
#endif
- case xv_QueryImageAttributes: result = (ProcXvQueryImageAttributes(client)); break;
- case xv_ListImageFormats: result = (ProcXvListImageFormats(client)); break;
+ case xv_QueryImageAttributes: return(ProcXvQueryImageAttributes(client));
+ case xv_ListImageFormats: return(ProcXvListImageFormats(client));
default:
if (stuff->data < xvNumRequests)
{
SendErrorToClient(client, XvReqCode, stuff->data, 0,
BadImplementation);
- result = (BadImplementation); break;
+ return(BadImplementation);
}
else
{
SendErrorToClient(client, XvReqCode, stuff->data, 0, BadRequest);
- result = (BadRequest); break;
+ return(BadRequest);
}
}
-
- nxagentXvTrap = 0;
-
- #ifdef TEST
- fprintf(stderr, "ProcXvDispatch: Dispatched XVideo operation [%d] for client [%d].\n",
- stuff->data, client -> index);
- #endif
-
- return result;
}
int
-SProcXvDispatch(ClientPtr client)
+ProcXvDispatch(ClientPtr client)
{
int result;
- REQUEST(xReq);
-
- UpdateCurrentTime();
-
/*
* Report upstream that we are
* dispatching a XVideo operation.
*/
+ #ifdef TEST
+ fprintf(stderr, "ProcXvDispatch: Going to dispatch XVideo operation [%d] for client [%d].\n",
+ stuff->data, client -> index);
+ #endif
+
nxagentXvTrap = 1;
+ result = nxagent_ProcXvDispatch(client);
+
+ nxagentXvTrap = 0;
+
#ifdef TEST
- fprintf(stderr, "SProcXvDispatch: Going to dispatch XVideo operation [%d] for client [%d].\n",
+ fprintf(stderr, "ProcXvDispatch: Dispatched XVideo operation [%d] for client [%d].\n",
stuff->data, client -> index);
#endif
+ return result;
+}
+
+
+int
+nxagent_SProcXvDispatch(ClientPtr client)
+{
+ REQUEST(xReq);
+
+ UpdateCurrentTime();
+
switch (stuff->data)
{
- case xv_QueryExtension: result = (SProcXvQueryExtension(client)); break;
- case xv_QueryAdaptors: result = (SProcXvQueryAdaptors(client)); break;
- case xv_QueryEncodings: result = (SProcXvQueryEncodings(client)); break;
- case xv_PutVideo: result = (SProcXvPutVideo(client)); break;
- case xv_PutStill: result = (SProcXvPutStill(client)); break;
- case xv_GetVideo: result = (SProcXvGetVideo(client)); break;
- case xv_GetStill: result = (SProcXvGetStill(client)); break;
- case xv_GrabPort: result = (SProcXvGrabPort(client)); break;
- case xv_UngrabPort: result = (SProcXvUngrabPort(client)); break;
- case xv_SelectVideoNotify: result = (SProcXvSelectVideoNotify(client)); break;
- case xv_SelectPortNotify: result = (SProcXvSelectPortNotify(client)); break;
- case xv_StopVideo: result = (SProcXvStopVideo(client)); break;
- case xv_SetPortAttribute: result = (SProcXvSetPortAttribute(client)); break;
- case xv_GetPortAttribute: result = (SProcXvGetPortAttribute(client)); break;
- case xv_QueryBestSize: result = (SProcXvQueryBestSize(client)); break;
- case xv_QueryPortAttributes: result = (SProcXvQueryPortAttributes(client)); break;
- case xv_PutImage: result = (SProcXvPutImage(client)); break;
+ case xv_QueryExtension: return(SProcXvQueryExtension(client));
+ case xv_QueryAdaptors: return(SProcXvQueryAdaptors(client));
+ case xv_QueryEncodings: return(SProcXvQueryEncodings(client));
+ case xv_PutVideo: return(SProcXvPutVideo(client));
+ case xv_PutStill: return(SProcXvPutStill(client));
+ case xv_GetVideo: return(SProcXvGetVideo(client));
+ case xv_GetStill: return(SProcXvGetStill(client));
+ case xv_GrabPort: return(SProcXvGrabPort(client));
+ case xv_UngrabPort: return(SProcXvUngrabPort(client));
+ case xv_SelectVideoNotify: return(SProcXvSelectVideoNotify(client));
+ case xv_SelectPortNotify: return(SProcXvSelectPortNotify(client));
+ case xv_StopVideo: return(SProcXvStopVideo(client));
+ case xv_SetPortAttribute: return(SProcXvSetPortAttribute(client));
+ case xv_GetPortAttribute: return(SProcXvGetPortAttribute(client));
+ case xv_QueryBestSize: return(SProcXvQueryBestSize(client));
+ case xv_QueryPortAttributes: return(SProcXvQueryPortAttributes(client));
+ case xv_PutImage: return(SProcXvPutImage(client));
#ifdef MITSHM
- case xv_ShmPutImage: result = (SProcXvShmPutImage(client)); break;
+ case xv_ShmPutImage: return(SProcXvShmPutImage(client));
#endif
- case xv_QueryImageAttributes: result = (SProcXvQueryImageAttributes(client)); break;
- case xv_ListImageFormats: result = (SProcXvListImageFormats(client)); break;
+ case xv_QueryImageAttributes: return(SProcXvQueryImageAttributes(client));
+ case xv_ListImageFormats: return(SProcXvListImageFormats(client));
default:
if (stuff->data < xvNumRequests)
{
SendErrorToClient(client, XvReqCode, stuff->data, 0,
BadImplementation);
- result = (BadImplementation); break;
+ return(BadImplementation);
}
else
{
SendErrorToClient(client, XvReqCode, stuff->data, 0, BadRequest);
- result = (BadRequest); break;
+ return(BadRequest);
}
}
+}
+
+
+int
+SProcXvDispatch(ClientPtr client)
+{
+ int result;
+
+ /*
+ * Report upstream that we are
+ * dispatching a XVideo operation.
+ */
+
+ #ifdef TEST
+ fprintf(stderr, "SProcXvDispatch: Going to dispatch XVideo operation [%d] for client [%d].\n",
+ stuff->data, client -> index);
+ #endif
+
+ nxagentXvTrap = 1;
+
+ result = nxagent_SProcXvDispatch(client);
nxagentXvTrap = 0;
#ifdef TEST
- fprintf(stderr, "ProcXvDispatch: Dispatched XVideo operation [%d] for client [%d].\n",
+ fprintf(stderr, "SProcXvDispatch: Dispatched XVideo operation [%d] for client [%d].\n",
stuff->data, client -> index);
#endif
return result;
}
+
+
+
#endif /* !defined(__sun) && !defined(__CYGWIN__) */