dix: write out X_TranslateCoords reply directly
No need for using a complex callback machinery, if we just move the little pieces of byte-swapping directly into the request handler. Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
This commit is contained in:
		
							parent
							
								
									b06fc7e68c
								
							
						
					
					
						commit
						df63401d6d
					
				| 
						 | 
				
			
			@ -622,7 +622,6 @@ PanoramiXTranslateCoords(ClientPtr client)
 | 
			
		|||
    REQUEST(xTranslateCoordsReq);
 | 
			
		||||
    int rc;
 | 
			
		||||
    WindowPtr pWin, pDst;
 | 
			
		||||
    xTranslateCoordsReply rep;
 | 
			
		||||
 | 
			
		||||
    REQUEST_SIZE_MATCH(xTranslateCoordsReq);
 | 
			
		||||
    rc = dixLookupWindow(&pWin, stuff->srcWid, client, DixReadAccess);
 | 
			
		||||
| 
						 | 
				
			
			@ -631,7 +630,8 @@ PanoramiXTranslateCoords(ClientPtr client)
 | 
			
		|||
    rc = dixLookupWindow(&pDst, stuff->dstWid, client, DixReadAccess);
 | 
			
		||||
    if (rc != Success)
 | 
			
		||||
        return rc;
 | 
			
		||||
    rep = (xTranslateCoordsReply) {
 | 
			
		||||
 | 
			
		||||
    xTranslateCoordsReply rep = {
 | 
			
		||||
        .type = X_Reply,
 | 
			
		||||
        .sequenceNumber = client->sequence,
 | 
			
		||||
        .length = 0,
 | 
			
		||||
| 
						 | 
				
			
			@ -682,7 +682,13 @@ PanoramiXTranslateCoords(ClientPtr client)
 | 
			
		|||
        rep.dstY += screenInfo.screens[0]->y;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    WriteReplyToClient(client, sizeof(xTranslateCoordsReply), &rep);
 | 
			
		||||
    if (client->swapped) {
 | 
			
		||||
        swaps(&rep.sequenceNumber);
 | 
			
		||||
        swapl(&rep.child);
 | 
			
		||||
        swaps(&rep.dstX);
 | 
			
		||||
        swaps(&rep.dstY);
 | 
			
		||||
    }
 | 
			
		||||
    WriteToClient(client, sizeof(rep), &rep);
 | 
			
		||||
    return Success;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1219,7 +1219,6 @@ ProcTranslateCoords(ClientPtr client)
 | 
			
		|||
    REQUEST(xTranslateCoordsReq);
 | 
			
		||||
 | 
			
		||||
    WindowPtr pWin, pDst;
 | 
			
		||||
    xTranslateCoordsReply rep;
 | 
			
		||||
    int rc;
 | 
			
		||||
 | 
			
		||||
    REQUEST_SIZE_MATCH(xTranslateCoordsReq);
 | 
			
		||||
| 
						 | 
				
			
			@ -1230,7 +1229,7 @@ ProcTranslateCoords(ClientPtr client)
 | 
			
		|||
    if (rc != Success)
 | 
			
		||||
        return rc;
 | 
			
		||||
 | 
			
		||||
    rep = (xTranslateCoordsReply) {
 | 
			
		||||
    xTranslateCoordsReply rep = {
 | 
			
		||||
        .type = X_Reply,
 | 
			
		||||
        .sequenceNumber = client->sequence,
 | 
			
		||||
        .length = 0
 | 
			
		||||
| 
						 | 
				
			
			@ -1281,7 +1280,14 @@ ProcTranslateCoords(ClientPtr client)
 | 
			
		|||
        rep.dstX = x - pDst->drawable.x;
 | 
			
		||||
        rep.dstY = y - pDst->drawable.y;
 | 
			
		||||
    }
 | 
			
		||||
    WriteReplyToClient(client, sizeof(xTranslateCoordsReply), &rep);
 | 
			
		||||
 | 
			
		||||
    if (client->swapped) {
 | 
			
		||||
        swaps(&rep.sequenceNumber);
 | 
			
		||||
        swapl(&rep.child);
 | 
			
		||||
        swaps(&rep.dstX);
 | 
			
		||||
        swaps(&rep.dstY);
 | 
			
		||||
    }
 | 
			
		||||
    WriteToClient(client, sizeof(rep), &rep);
 | 
			
		||||
    return Success;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -305,16 +305,6 @@ SGetMotionEventsReply(ClientPtr pClient, int size, xGetMotionEventsReply * pRep)
 | 
			
		|||
    WriteToClient(pClient, size, pRep);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void _X_COLD
 | 
			
		||||
STranslateCoordsReply(ClientPtr pClient, int size, xTranslateCoordsReply * pRep)
 | 
			
		||||
{
 | 
			
		||||
    swaps(&pRep->sequenceNumber);
 | 
			
		||||
    swapl(&pRep->child);
 | 
			
		||||
    swaps(&pRep->dstX);
 | 
			
		||||
    swaps(&pRep->dstY);
 | 
			
		||||
    WriteToClient(pClient, size, pRep);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void _X_COLD
 | 
			
		||||
SGetInputFocusReply(ClientPtr pClient, int size, xGetInputFocusReply * pRep)
 | 
			
		||||
{
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -755,7 +755,7 @@ ReplySwapPtr ReplySwapVector[256] = {
 | 
			
		|||
    ReplyNotSwappd,
 | 
			
		||||
    (ReplySwapPtr) SQueryPointerReply,
 | 
			
		||||
    (ReplySwapPtr) SGetMotionEventsReply,
 | 
			
		||||
    (ReplySwapPtr) STranslateCoordsReply,       /* 40 */
 | 
			
		||||
    ReplyNotSwappd,                             /* 40 */
 | 
			
		||||
    ReplyNotSwappd,
 | 
			
		||||
    ReplyNotSwappd,
 | 
			
		||||
    (ReplySwapPtr) SGetInputFocusReply,
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -85,11 +85,6 @@ extern void SGetMotionEventsReply(ClientPtr /* pClient */ ,
 | 
			
		|||
                                  xGetMotionEventsReply *       /* pRep */
 | 
			
		||||
    );
 | 
			
		||||
 | 
			
		||||
extern void STranslateCoordsReply(ClientPtr /* pClient */ ,
 | 
			
		||||
                                  int /* size */ ,
 | 
			
		||||
                                  xTranslateCoordsReply *       /* pRep */
 | 
			
		||||
    );
 | 
			
		||||
 | 
			
		||||
extern void SGetInputFocusReply(ClientPtr /* pClient */ ,
 | 
			
		||||
                                int /* size */ ,
 | 
			
		||||
                                xGetInputFocusReply * /* pRep */ );
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue