mirror of
https://github.com/X11Libre/xserver.git
synced 2026-03-24 10:14:52 +00:00
Xi: ProcXGetDeviceDontPropagateList(): use x_rpcbuf_t
Use x_rpcbuf_t for reply payload assembly and byte-swapping, instead of writing in little pieces via complicated callbacks. Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
This commit is contained in:
committed by
Enrico Weigelt
parent
e6e2b88cff
commit
036cbb4ff2
16
Xi/getprop.c
16
Xi/getprop.c
@@ -56,6 +56,7 @@ SOFTWARE.
|
||||
#include <X11/extensions/XIproto.h>
|
||||
|
||||
#include "dix/dix_priv.h"
|
||||
#include "dix/rpcbuf_priv.h"
|
||||
|
||||
#include "inputstr.h" /* DeviceIntPtr */
|
||||
#include "windowstr.h" /* window structs */
|
||||
@@ -109,6 +110,8 @@ ProcXGetDeviceDontPropagateList(ClientPtr client)
|
||||
if (rc != Success)
|
||||
return rc;
|
||||
|
||||
x_rpcbuf_t rpcbuf = { .swapped = client->swapped, .err_clear = TRUE };
|
||||
|
||||
if ((others = wOtherInputMasks(pWin)) != 0) {
|
||||
for (i = 0; i < EMASKSIZE; i++)
|
||||
ClassFromMask(NULL, others->dontPropagateMask[i], i, &count, COUNT);
|
||||
@@ -123,21 +126,22 @@ ProcXGetDeviceDontPropagateList(ClientPtr client)
|
||||
for (i = 0; i < EMASKSIZE; i++)
|
||||
tbuf = ClassFromMask(tbuf, others->dontPropagateMask[i], i,
|
||||
NULL, CREATE);
|
||||
|
||||
x_rpcbuf_write_CARD32s(&rpcbuf, buf, count);
|
||||
free(buf);
|
||||
}
|
||||
}
|
||||
|
||||
if (rpcbuf.error)
|
||||
return BadAlloc;
|
||||
|
||||
if (client->swapped) {
|
||||
swaps(&rep.sequenceNumber);
|
||||
swapl(&rep.length);
|
||||
swaps(&rep.count);
|
||||
}
|
||||
WriteToClient(client, sizeof(xGetDeviceDontPropagateListReply), &rep);
|
||||
|
||||
if (count) {
|
||||
client->pSwapReplyFunc = (ReplySwapPtr) Swap32Write;
|
||||
WriteSwappedDataToClient(client, count * sizeof(XEventClass), buf);
|
||||
free(buf);
|
||||
}
|
||||
WriteRpcbufToClient(client, &rpcbuf);
|
||||
return Success;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user