dix: write out X_GetKeyboardMapping 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
							
								
									e1db3b431e
								
							
						
					
					
						commit
						3f4b59f5b5
					
				| 
						 | 
				
			
			@ -1956,7 +1956,6 @@ ProcSetPointerMapping(ClientPtr client)
 | 
			
		|||
int
 | 
			
		||||
ProcGetKeyboardMapping(ClientPtr client)
 | 
			
		||||
{
 | 
			
		||||
    xGetKeyboardMappingReply rep;
 | 
			
		||||
    DeviceIntPtr kbd = PickKeyboard(client);
 | 
			
		||||
    XkbDescPtr xkb;
 | 
			
		||||
    KeySymsPtr syms;
 | 
			
		||||
| 
						 | 
				
			
			@ -1985,14 +1984,20 @@ ProcGetKeyboardMapping(ClientPtr client)
 | 
			
		|||
    if (!syms)
 | 
			
		||||
        return BadAlloc;
 | 
			
		||||
 | 
			
		||||
    rep = (xGetKeyboardMappingReply) {
 | 
			
		||||
    xGetKeyboardMappingReply rep = {
 | 
			
		||||
        .type = X_Reply,
 | 
			
		||||
        .keySymsPerKeyCode = syms->mapWidth,
 | 
			
		||||
        .sequenceNumber = client->sequence,
 | 
			
		||||
        /* length is a count of 4 byte quantities and KeySyms are 4 bytes */
 | 
			
		||||
        .length = syms->mapWidth * stuff->count
 | 
			
		||||
    };
 | 
			
		||||
    WriteReplyToClient(client, sizeof(xGetKeyboardMappingReply), &rep);
 | 
			
		||||
 | 
			
		||||
    if (client->swapped) {
 | 
			
		||||
        swaps(&rep.sequenceNumber);
 | 
			
		||||
        swapl(&rep.length);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    WriteToClient(client, sizeof(rep), &rep);
 | 
			
		||||
    client->pSwapReplyFunc = (ReplySwapPtr) CopySwap32Write;
 | 
			
		||||
    WriteSwappedDataToClient(client,
 | 
			
		||||
                             syms->mapWidth * stuff->count * sizeof(KeySym),
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -535,15 +535,6 @@ SListExtensionsReply(ClientPtr pClient, int size, xListExtensionsReply * pRep)
 | 
			
		|||
    WriteToClient(pClient, size, pRep);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void _X_COLD
 | 
			
		||||
SGetKeyboardMappingReply(ClientPtr pClient, int size,
 | 
			
		||||
                         xGetKeyboardMappingReply * pRep)
 | 
			
		||||
{
 | 
			
		||||
    swaps(&pRep->sequenceNumber);
 | 
			
		||||
    swapl(&pRep->length);
 | 
			
		||||
    WriteToClient(pClient, size, pRep);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void _X_COLD
 | 
			
		||||
SGetKeyboardControlReply(ClientPtr pClient, int size,
 | 
			
		||||
                         xGetKeyboardControlReply * pRep)
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -813,7 +813,7 @@ ReplySwapPtr ReplySwapVector[256] = {
 | 
			
		|||
    (ReplySwapPtr) SGenericReply,               /* SQueryExtensionReply, */
 | 
			
		||||
    (ReplySwapPtr) SListExtensionsReply,
 | 
			
		||||
    ReplyNotSwappd,                             /* 100 */
 | 
			
		||||
    (ReplySwapPtr) SGetKeyboardMappingReply,
 | 
			
		||||
    ReplyNotSwappd,
 | 
			
		||||
    ReplyNotSwappd,
 | 
			
		||||
    (ReplySwapPtr) SGetKeyboardControlReply,
 | 
			
		||||
    ReplyNotSwappd,
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -154,11 +154,6 @@ extern void SListExtensionsReply(ClientPtr /* pClient */ ,
 | 
			
		|||
                                 int /* size */ ,
 | 
			
		||||
                                 xListExtensionsReply * /* pRep */ );
 | 
			
		||||
 | 
			
		||||
extern void SGetKeyboardMappingReply(ClientPtr /* pClient */ ,
 | 
			
		||||
                                     int /* size */ ,
 | 
			
		||||
                                     xGetKeyboardMappingReply *
 | 
			
		||||
                                     /* pRep */ );
 | 
			
		||||
 | 
			
		||||
extern void SGetKeyboardControlReply(ClientPtr /* pClient */ ,
 | 
			
		||||
                                     int /* size */ ,
 | 
			
		||||
                                     xGetKeyboardControlReply *
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue