int ProcXGetDeviceDontPropagateList(ClientPtr client) { CARD16 count = 0; int i, rc; XEventClass *buf = NULL, *tbuf; WindowPtr pWin; xGetDeviceDontPropagateListReply rep; OtherInputMasks *others; REQUEST(xGetDeviceDontPropagateListReq); REQUEST_SIZE_MATCH(xGetDeviceDontPropagateListReq); rep.repType = X_Reply; rep.RepType = X_GetDeviceDontPropagateList; rep.sequenceNumber = client->sequence; rep.length = 0; rep.count = 0; rc = dixLookupWindow(&pWin, stuff->window, client, DixGetAttrAccess); if (rc != Success) return rc; if ((others = wOtherInputMasks(pWin)) != 0) { for (i = 0; i < EMASKSIZE; i++) ClassFromMask(NULL, others->dontPropagateMask[i], i, &count, COUNT); if (count) { rep.count = count; buf = (XEventClass *) malloc(rep.count * sizeof(XEventClass)); rep.length = bytes_to_int32(rep.count * sizeof(XEventClass)); tbuf = buf; for (i = 0; i < EMASKSIZE; i++) tbuf = ClassFromMask(tbuf, others->dontPropagateMask[i], i, NULL, CREATE); } } WriteReplyToClient(client, sizeof(xGetDeviceDontPropagateListReply), &rep); if (count) { client->pSwapReplyFunc = (ReplySwapPtr) Swap32Write; WriteSwappedDataToClient(client, count * sizeof(XEventClass), buf); free(buf); } return Success; }
int ProcXGetSelectedExtensionEvents(ClientPtr client) { int i, rc, total_length = 0; xGetSelectedExtensionEventsReply rep; WindowPtr pWin; XEventClass *buf = NULL; XEventClass *tclient; XEventClass *aclient; OtherInputMasks *pOthers; InputClientsPtr others; REQUEST(xGetSelectedExtensionEventsReq); REQUEST_SIZE_MATCH(xGetSelectedExtensionEventsReq); rep.repType = X_Reply; rep.RepType = X_GetSelectedExtensionEvents; rep.length = 0; rep.sequenceNumber = client->sequence; rep.this_client_count = 0; rep.all_clients_count = 0; rc = dixLookupWindow(&pWin, stuff->window, client, DixGetAttrAccess); if (rc != Success) return rc; if ((pOthers = wOtherInputMasks(pWin)) != 0) { for (others = pOthers->inputClients; others; others = others->next) for (i = 0; i < EMASKSIZE; i++) ClassFromMask(NULL, others->mask[i], i, &rep.all_clients_count, COUNT); for (others = pOthers->inputClients; others; others = others->next) if (SameClient(others, client)) { for (i = 0; i < EMASKSIZE; i++) ClassFromMask(NULL, others->mask[i], i, &rep.this_client_count, COUNT); break; } total_length = (rep.all_clients_count + rep.this_client_count) * sizeof(XEventClass); rep.length = bytes_to_int32(total_length); buf = (XEventClass *) malloc(total_length); tclient = buf; aclient = buf + rep.this_client_count; if (others) for (i = 0; i < EMASKSIZE; i++) tclient = ClassFromMask(tclient, others->mask[i], i, NULL, CREATE); for (others = pOthers->inputClients; others; others = others->next) for (i = 0; i < EMASKSIZE; i++) aclient = ClassFromMask(aclient, others->mask[i], i, NULL, CREATE); } WriteReplyToClient(client, sizeof(xGetSelectedExtensionEventsReply), &rep); if (total_length) { client->pSwapReplyFunc = (ReplySwapPtr) Swap32Write; WriteSwappedDataToClient(client, total_length, buf); } free(buf); return Success; }
int ProcXGetSelectedExtensionEvents(ClientPtr client) { int i, rc, total_length = 0; xGetSelectedExtensionEventsReply rep; WindowPtr pWin; XEventClass *buf = NULL; XEventClass *tclient; XEventClass *aclient; OtherInputMasks *pOthers; InputClientsPtr others; REQUEST(xGetSelectedExtensionEventsReq); REQUEST_SIZE_MATCH(xGetSelectedExtensionEventsReq); rep = (xGetSelectedExtensionEventsReply) { .repType = X_Reply, .RepType = X_GetSelectedExtensionEvents, .sequenceNumber = client->sequence, .length = 0, .this_client_count = 0, .all_clients_count = 0 }; rc = dixLookupWindow(&pWin, stuff->window, client, DixGetAttrAccess); if (rc != Success) return rc; if ((pOthers = wOtherInputMasks(pWin)) != 0) { for (others = pOthers->inputClients; others; others = others->next) for (i = 0; i < EMASKSIZE; i++) ClassFromMask(NULL, others->mask[i], i, &rep.all_clients_count, COUNT); for (others = pOthers->inputClients; others; others = others->next) if (SameClient(others, client)) { for (i = 0; i < EMASKSIZE; i++) ClassFromMask(NULL, others->mask[i], i, &rep.this_client_count, COUNT); break; } total_length = (rep.all_clients_count + rep.this_client_count) * sizeof(XEventClass); rep.length = bytes_to_int32(total_length); buf = (XEventClass *) malloc(total_length); tclient = buf; aclient = buf + rep.this_client_count; if (others) for (i = 0; i < EMASKSIZE; i++) tclient = ClassFromMask(tclient, others->mask[i], i, NULL, CREATE); for (others = pOthers->inputClients; others; others = others->next) for (i = 0; i < EMASKSIZE; i++) aclient = ClassFromMask(aclient, others->mask[i], i, NULL, CREATE); } WriteReplyToClient(client, sizeof(xGetSelectedExtensionEventsReply), &rep); if (total_length) { client->pSwapReplyFunc = (ReplySwapPtr) Swap32Write; WriteSwappedDataToClient(client, total_length, buf); } free(buf); return Success; } /*********************************************************************** * * This procedure writes the reply for the XGetSelectedExtensionEvents function, * if the client and server have a different byte ordering. * */ void SRepXGetSelectedExtensionEvents(ClientPtr client, int size, xGetSelectedExtensionEventsReply * rep) { swaps(&rep->sequenceNumber); swapl(&rep->length); swaps(&rep->this_client_count); swaps(&rep->all_clients_count); WriteToClient(client, size, rep); }
int ProcXGetDeviceDontPropagateList(ClientPtr client) { CARD16 count = 0; int i, rc; XEventClass *buf = NULL, *tbuf; WindowPtr pWin; xGetDeviceDontPropagateListReply rep; OtherInputMasks *others; REQUEST(xGetDeviceDontPropagateListReq); REQUEST_SIZE_MATCH(xGetDeviceDontPropagateListReq); rep = (xGetDeviceDontPropagateListReply) { .repType = X_Reply, .RepType = X_GetDeviceDontPropagateList, .sequenceNumber = client->sequence, .length = 0, .count = 0 }; rc = dixLookupWindow(&pWin, stuff->window, client, DixGetAttrAccess); if (rc != Success) return rc; if ((others = wOtherInputMasks(pWin)) != 0) { for (i = 0; i < EMASKSIZE; i++) ClassFromMask(NULL, others->dontPropagateMask[i], i, &count, COUNT); if (count) { rep.count = count; buf = xallocarray(rep.count, sizeof(XEventClass)); rep.length = bytes_to_int32(rep.count * sizeof(XEventClass)); tbuf = buf; for (i = 0; i < EMASKSIZE; i++) tbuf = ClassFromMask(tbuf, others->dontPropagateMask[i], i, NULL, CREATE); } } WriteReplyToClient(client, sizeof(xGetDeviceDontPropagateListReply), &rep); if (count) { client->pSwapReplyFunc = (ReplySwapPtr) Swap32Write; WriteSwappedDataToClient(client, count * sizeof(XEventClass), buf); free(buf); } return Success; } /*********************************************************************** * * This procedure gets a list of event classes from a mask word. * A single mask may translate to more than one event class. * */ XEventClass * ClassFromMask(XEventClass * buf, Mask mask, int maskndx, CARD16 *count, int mode) { int i, j; int id = maskndx; Mask tmask = 0x80000000; for (i = 0; i < 32; i++, tmask >>= 1) if (tmask & mask) { for (j = 0; j < ExtEventIndex; j++) if (EventInfo[j].mask == tmask) { if (mode == COUNT) (*count)++; else *buf++ = (id << 8) | EventInfo[j].type; } } return buf; }
int ProcXGetSelectedExtensionEvents(register ClientPtr client) { int i; int total_length = 0; xGetSelectedExtensionEventsReply rep; WindowPtr pWin; XEventClass *buf = NULL; XEventClass *tclient; XEventClass *aclient; OtherInputMasks *pOthers; InputClientsPtr others; REQUEST(xGetSelectedExtensionEventsReq); REQUEST_SIZE_MATCH(xGetSelectedExtensionEventsReq); rep.repType = X_Reply; rep.RepType = X_GetSelectedExtensionEvents; rep.length = 0; rep.sequenceNumber = client->sequence; rep.this_client_count = 0; rep.all_clients_count = 0; if (!(pWin = LookupWindow(stuff->window, client))) { SendErrorToClient(client, IReqCode, X_GetSelectedExtensionEvents, 0, BadWindow); return Success; } if ((pOthers = wOtherInputMasks(pWin)) != 0) { for (others = pOthers->inputClients; others; others = others->next) for (i = 0; i < EMASKSIZE; i++) tclient = ClassFromMask(NULL, others->mask[i], i, &rep.all_clients_count, COUNT); for (others = pOthers->inputClients; others; others = others->next) if (SameClient(others, client)) { for (i = 0; i < EMASKSIZE; i++) tclient = ClassFromMask(NULL, others->mask[i], i, &rep.this_client_count, COUNT); break; } total_length = (rep.all_clients_count + rep.this_client_count) * sizeof(XEventClass); rep.length = (total_length + 3) >> 2; buf = (XEventClass *) xalloc(total_length); tclient = buf; aclient = buf + rep.this_client_count; if (others) for (i = 0; i < EMASKSIZE; i++) tclient = ClassFromMask(tclient, others->mask[i], i, NULL, CREATE); for (others = pOthers->inputClients; others; others = others->next) for (i = 0; i < EMASKSIZE; i++) aclient = ClassFromMask(aclient, others->mask[i], i, NULL, CREATE); } WriteReplyToClient(client, sizeof(xGetSelectedExtensionEventsReply), &rep); if (total_length) { client->pSwapReplyFunc = (ReplySwapPtr) Swap32Write; WriteSwappedDataToClient(client, total_length, buf); xfree(buf); } return Success; }