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