Xi: use REPLY_*() macros for preparing / sending replies
Use the new macros for preparing and sending replies to clients. Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
This commit is contained in:
parent
83a63a64a0
commit
c2270f38b3
|
@ -100,7 +100,6 @@ ProcXChangeDeviceControl(ClientPtr client)
|
||||||
|
|
||||||
xChangeDeviceControlReply rep = {
|
xChangeDeviceControlReply rep = {
|
||||||
.RepType = X_ChangeDeviceControl,
|
.RepType = X_ChangeDeviceControl,
|
||||||
.sequenceNumber = client->sequence,
|
|
||||||
.status = Success,
|
.status = Success,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -202,10 +201,7 @@ ProcXChangeDeviceControl(ClientPtr client)
|
||||||
SendEventToAllWindows(dev, DevicePresenceNotifyMask,
|
SendEventToAllWindows(dev, DevicePresenceNotifyMask,
|
||||||
(xEvent *) &dpn, 1);
|
(xEvent *) &dpn, 1);
|
||||||
|
|
||||||
if (client->swapped) {
|
REPLY_SEND();
|
||||||
swaps(&rep.sequenceNumber);
|
|
||||||
}
|
|
||||||
WriteToClient(client, sizeof(xChangeDeviceControlReply), &rep);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
|
|
|
@ -86,18 +86,11 @@ ProcXGetDeviceButtonMapping(ClientPtr client)
|
||||||
return BadMatch;
|
return BadMatch;
|
||||||
|
|
||||||
xGetDeviceButtonMappingReply rep = {
|
xGetDeviceButtonMappingReply rep = {
|
||||||
.repType = X_Reply,
|
|
||||||
.RepType = X_GetDeviceButtonMapping,
|
.RepType = X_GetDeviceButtonMapping,
|
||||||
.sequenceNumber = client->sequence,
|
|
||||||
.nElts = b->numButtons,
|
.nElts = b->numButtons,
|
||||||
.length = bytes_to_int32(b->numButtons),
|
.length = bytes_to_int32(b->numButtons),
|
||||||
};
|
};
|
||||||
|
|
||||||
if (client->swapped) {
|
REPLY_SEND_EXTRA(&b->map[1], rep.nElts);
|
||||||
swaps(&rep.sequenceNumber);
|
|
||||||
swapl(&rep.length);
|
|
||||||
}
|
|
||||||
WriteToClient(client, sizeof(xGetDeviceButtonMappingReply), &rep);
|
|
||||||
WriteToClient(client, rep.nElts, &b->map[1]);
|
|
||||||
return Success;
|
return Success;
|
||||||
}
|
}
|
||||||
|
|
33
Xi/getdctl.c
33
Xi/getdctl.c
|
@ -88,15 +88,10 @@ CopySwapDeviceResolution(ClientPtr client, ValuatorClassPtr v, char *buf,
|
||||||
*iptr++ = a->min_resolution;
|
*iptr++ = a->min_resolution;
|
||||||
for (i = 0, a = v->axes; i < v->numAxes; i++, a++)
|
for (i = 0, a = v->axes; i < v->numAxes; i++, a++)
|
||||||
*iptr++ = a->max_resolution;
|
*iptr++ = a->max_resolution;
|
||||||
if (client->swapped) {
|
|
||||||
swaps(&r->control);
|
CLIENT_STRUCT_CARD16_2(r, control, length);
|
||||||
swaps(&r->length);
|
CLIENT_STRUCT_CARD32_1(r, num_valuators);
|
||||||
swapl(&r->num_valuators);
|
REPLY_BUF_CARD32(buf, (3 * v->numAxes));
|
||||||
iptr = (int *) buf;
|
|
||||||
for (i = 0; i < (3 * v->numAxes); i++, iptr++) {
|
|
||||||
swapl(iptr);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -109,10 +104,7 @@ CopySwapDeviceCore(ClientPtr client, DeviceIntPtr dev, char *buf)
|
||||||
c->status = dev->coreEvents;
|
c->status = dev->coreEvents;
|
||||||
c->iscore = (dev == inputInfo.keyboard || dev == inputInfo.pointer);
|
c->iscore = (dev == inputInfo.keyboard || dev == inputInfo.pointer);
|
||||||
|
|
||||||
if (client->swapped) {
|
CLIENT_STRUCT_CARD16_2(c, control, length);
|
||||||
swaps(&c->control);
|
|
||||||
swaps(&c->length);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -124,10 +116,7 @@ CopySwapDeviceEnable(ClientPtr client, DeviceIntPtr dev, char *buf)
|
||||||
e->length = sizeof(xDeviceEnableState);
|
e->length = sizeof(xDeviceEnableState);
|
||||||
e->enable = dev->enabled;
|
e->enable = dev->enabled;
|
||||||
|
|
||||||
if (client->swapped) {
|
CLIENT_STRUCT_CARD16_2(e, control, length);
|
||||||
swaps(&e->control);
|
|
||||||
swaps(&e->length);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************
|
/***********************************************************************
|
||||||
|
@ -189,18 +178,10 @@ ProcXGetDeviceControl(ClientPtr client)
|
||||||
}
|
}
|
||||||
|
|
||||||
xGetDeviceControlReply rep = {
|
xGetDeviceControlReply rep = {
|
||||||
.repType = X_Reply,
|
|
||||||
.RepType = X_GetDeviceControl,
|
.RepType = X_GetDeviceControl,
|
||||||
.sequenceNumber = client->sequence,
|
|
||||||
.length = bytes_to_int32(total_length),
|
|
||||||
};
|
};
|
||||||
|
|
||||||
if (client->swapped) {
|
REPLY_SEND_EXTRA(buf, total_length);
|
||||||
swaps(&rep.sequenceNumber);
|
|
||||||
swapl(&rep.length);
|
|
||||||
}
|
|
||||||
WriteToClient(client, sizeof(xGetDeviceControlReply), &rep);
|
|
||||||
WriteToClient(client, total_length, savbuf);
|
|
||||||
free(savbuf);
|
free(savbuf);
|
||||||
return Success;
|
return Success;
|
||||||
}
|
}
|
||||||
|
|
73
Xi/getfctl.c
73
Xi/getfctl.c
|
@ -86,13 +86,10 @@ CopySwapKbdFeedback(ClientPtr client, KbdFeedbackPtr k, char **buf)
|
||||||
k2->global_auto_repeat = k->ctrl.autoRepeat;
|
k2->global_auto_repeat = k->ctrl.autoRepeat;
|
||||||
for (i = 0; i < 32; i++)
|
for (i = 0; i < 32; i++)
|
||||||
k2->auto_repeats[i] = k->ctrl.autoRepeats[i];
|
k2->auto_repeats[i] = k->ctrl.autoRepeats[i];
|
||||||
if (client->swapped) {
|
|
||||||
swaps(&k2->length);
|
CLIENT_STRUCT_CARD16_3(k2, length, pitch, duration);
|
||||||
swaps(&k2->pitch);
|
CLIENT_STRUCT_CARD32_2(k2, led_mask, led_values);
|
||||||
swaps(&k2->duration);
|
|
||||||
swapl(&k2->led_mask);
|
|
||||||
swapl(&k2->led_values);
|
|
||||||
}
|
|
||||||
*buf += sizeof(xKbdFeedbackState);
|
*buf += sizeof(xKbdFeedbackState);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -114,12 +111,9 @@ CopySwapPtrFeedback(ClientPtr client, PtrFeedbackPtr p, char **buf)
|
||||||
p2->accelNum = p->ctrl.num;
|
p2->accelNum = p->ctrl.num;
|
||||||
p2->accelDenom = p->ctrl.den;
|
p2->accelDenom = p->ctrl.den;
|
||||||
p2->threshold = p->ctrl.threshold;
|
p2->threshold = p->ctrl.threshold;
|
||||||
if (client->swapped) {
|
|
||||||
swaps(&p2->length);
|
CLIENT_STRUCT_CARD16_4(p2, length, accelNum, accelDenom, threshold);
|
||||||
swaps(&p2->accelNum);
|
|
||||||
swaps(&p2->accelDenom);
|
|
||||||
swaps(&p2->threshold);
|
|
||||||
}
|
|
||||||
*buf += sizeof(xPtrFeedbackState);
|
*buf += sizeof(xPtrFeedbackState);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -141,12 +135,10 @@ CopySwapIntegerFeedback(ClientPtr client, IntegerFeedbackPtr i, char **buf)
|
||||||
i2->resolution = i->ctrl.resolution;
|
i2->resolution = i->ctrl.resolution;
|
||||||
i2->min_value = i->ctrl.min_value;
|
i2->min_value = i->ctrl.min_value;
|
||||||
i2->max_value = i->ctrl.max_value;
|
i2->max_value = i->ctrl.max_value;
|
||||||
if (client->swapped) {
|
|
||||||
swaps(&i2->length);
|
CLIENT_STRUCT_CARD16_1(i2, length);
|
||||||
swapl(&i2->resolution);
|
CLIENT_STRUCT_CARD32_3(i2, resolution, min_value, max_value);
|
||||||
swapl(&i2->min_value);
|
|
||||||
swapl(&i2->max_value);
|
|
||||||
}
|
|
||||||
*buf += sizeof(xIntegerFeedbackState);
|
*buf += sizeof(xIntegerFeedbackState);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -174,15 +166,10 @@ CopySwapStringFeedback(ClientPtr client, StringFeedbackPtr s, char **buf)
|
||||||
kptr = (KeySym *) (*buf);
|
kptr = (KeySym *) (*buf);
|
||||||
for (i = 0; i < s->ctrl.num_symbols_supported; i++)
|
for (i = 0; i < s->ctrl.num_symbols_supported; i++)
|
||||||
*kptr++ = *(s->ctrl.symbols_supported + i);
|
*kptr++ = *(s->ctrl.symbols_supported + i);
|
||||||
if (client->swapped) {
|
|
||||||
swaps(&s2->length);
|
CLIENT_STRUCT_CARD16_3(s2, length, max_symbols, num_syms_supported);
|
||||||
swaps(&s2->max_symbols);
|
REPLY_BUF_CARD32((CARD32*)buf, s->ctrl.num_symbols_supported);
|
||||||
swaps(&s2->num_syms_supported);
|
|
||||||
kptr = (KeySym *) (*buf);
|
|
||||||
for (i = 0; i < s->ctrl.num_symbols_supported; i++, kptr++) {
|
|
||||||
swapl(kptr);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
*buf += (s->ctrl.num_symbols_supported * sizeof(KeySym));
|
*buf += (s->ctrl.num_symbols_supported * sizeof(KeySym));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -203,11 +190,10 @@ CopySwapLedFeedback(ClientPtr client, LedFeedbackPtr l, char **buf)
|
||||||
l2->id = l->ctrl.id;
|
l2->id = l->ctrl.id;
|
||||||
l2->led_values = l->ctrl.led_values;
|
l2->led_values = l->ctrl.led_values;
|
||||||
l2->led_mask = l->ctrl.led_mask;
|
l2->led_mask = l->ctrl.led_mask;
|
||||||
if (client->swapped) {
|
|
||||||
swaps(&l2->length);
|
CLIENT_STRUCT_CARD16_1(l2, length);
|
||||||
swapl(&l2->led_values);
|
CLIENT_STRUCT_CARD32_2(l2, led_values, led_mask);
|
||||||
swapl(&l2->led_mask);
|
|
||||||
}
|
|
||||||
*buf += sizeof(xLedFeedbackState);
|
*buf += sizeof(xLedFeedbackState);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -229,11 +215,9 @@ CopySwapBellFeedback(ClientPtr client, BellFeedbackPtr b, char **buf)
|
||||||
b2->percent = b->ctrl.percent;
|
b2->percent = b->ctrl.percent;
|
||||||
b2->pitch = b->ctrl.pitch;
|
b2->pitch = b->ctrl.pitch;
|
||||||
b2->duration = b->ctrl.duration;
|
b2->duration = b->ctrl.duration;
|
||||||
if (client->swapped) {
|
|
||||||
swaps(&b2->length);
|
CLIENT_STRUCT_CARD16_3(b2, length, pitch, duration);
|
||||||
swaps(&b2->pitch);
|
|
||||||
swaps(&b2->duration);
|
|
||||||
}
|
|
||||||
*buf += sizeof(xBellFeedbackState);
|
*buf += sizeof(xBellFeedbackState);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -262,9 +246,7 @@ ProcXGetFeedbackControl(ClientPtr client)
|
||||||
return rc;
|
return rc;
|
||||||
|
|
||||||
xGetFeedbackControlReply rep = {
|
xGetFeedbackControlReply rep = {
|
||||||
.repType = X_Reply,
|
|
||||||
.RepType = X_GetFeedbackControl,
|
.RepType = X_GetFeedbackControl,
|
||||||
.sequenceNumber = client->sequence,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
for (k = dev->kbdfeed; k; k = k->next) {
|
for (k = dev->kbdfeed; k; k = k->next) {
|
||||||
|
@ -314,14 +296,7 @@ ProcXGetFeedbackControl(ClientPtr client)
|
||||||
for (b = dev->bell; b; b = b->next)
|
for (b = dev->bell; b; b = b->next)
|
||||||
CopySwapBellFeedback(client, b, &buf);
|
CopySwapBellFeedback(client, b, &buf);
|
||||||
|
|
||||||
rep.length = bytes_to_int32(total_length);
|
REPLY_FIELD_CARD16(num_feedbacks);
|
||||||
|
REPLY_SEND_EXTRA(savbuf, total_length);
|
||||||
if (client->swapped) {
|
|
||||||
swaps(&rep.sequenceNumber);
|
|
||||||
swapl(&rep.length);
|
|
||||||
swaps(&rep.num_feedbacks);
|
|
||||||
}
|
|
||||||
WriteToClient(client, sizeof(xGetFeedbackControlReply), &rep);
|
|
||||||
WriteToClient(client, total_length, savbuf);
|
|
||||||
return Success;
|
return Success;
|
||||||
}
|
}
|
||||||
|
|
|
@ -87,9 +87,7 @@ ProcXGetDeviceFocus(ClientPtr client)
|
||||||
focus = dev->focus;
|
focus = dev->focus;
|
||||||
|
|
||||||
xGetDeviceFocusReply rep = {
|
xGetDeviceFocusReply rep = {
|
||||||
.repType = X_Reply,
|
|
||||||
.RepType = X_GetDeviceFocus,
|
.RepType = X_GetDeviceFocus,
|
||||||
.sequenceNumber = client->sequence,
|
|
||||||
.time = focus->time.milliseconds,
|
.time = focus->time.milliseconds,
|
||||||
.revertTo = focus->revert,
|
.revertTo = focus->revert,
|
||||||
};
|
};
|
||||||
|
@ -103,15 +101,8 @@ ProcXGetDeviceFocus(ClientPtr client)
|
||||||
else
|
else
|
||||||
rep.focus = focus->win->drawable.id;
|
rep.focus = focus->win->drawable.id;
|
||||||
|
|
||||||
rep.time = focus->time.milliseconds;
|
REPLY_FIELD_CARD32(focus);
|
||||||
rep.revertTo = focus->revert;
|
REPLY_FIELD_CARD32(time);
|
||||||
|
REPLY_SEND();
|
||||||
if (client->swapped) {
|
|
||||||
swaps(&rep.sequenceNumber);
|
|
||||||
swapl(&rep.length);
|
|
||||||
swapl(&rep.focus);
|
|
||||||
swapl(&rep.time);
|
|
||||||
}
|
|
||||||
WriteToClient(client, sizeof(xGetDeviceFocusReply), &rep);
|
|
||||||
return Success;
|
return Success;
|
||||||
}
|
}
|
||||||
|
|
|
@ -104,18 +104,12 @@ ProcXGetDeviceKeyMapping(ClientPtr client)
|
||||||
return BadAlloc;
|
return BadAlloc;
|
||||||
|
|
||||||
xGetDeviceKeyMappingReply rep = {
|
xGetDeviceKeyMappingReply rep = {
|
||||||
.repType = X_Reply,
|
|
||||||
.RepType = X_GetDeviceKeyMapping,
|
.RepType = X_GetDeviceKeyMapping,
|
||||||
.sequenceNumber = client->sequence,
|
|
||||||
.keySymsPerKeyCode = syms->mapWidth,
|
.keySymsPerKeyCode = syms->mapWidth,
|
||||||
.length = (syms->mapWidth * stuff->count) /* KeySyms are 4 bytes */
|
.length = (syms->mapWidth * stuff->count) /* KeySyms are 4 bytes */
|
||||||
};
|
};
|
||||||
|
|
||||||
if (client->swapped) {
|
REPLY_SEND();
|
||||||
swaps(&rep.sequenceNumber);
|
|
||||||
swapl(&rep.length);
|
|
||||||
}
|
|
||||||
WriteToClient(client, sizeof(xGetDeviceKeyMappingReply), &rep);
|
|
||||||
|
|
||||||
client->pSwapReplyFunc = (ReplySwapPtr) CopySwap32Write;
|
client->pSwapReplyFunc = (ReplySwapPtr) CopySwap32Write;
|
||||||
WriteSwappedDataToClient(client,
|
WriteSwappedDataToClient(client,
|
||||||
|
|
13
Xi/getmmap.c
13
Xi/getmmap.c
|
@ -86,21 +86,12 @@ ProcXGetDeviceModifierMapping(ClientPtr client)
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
xGetDeviceModifierMappingReply rep = {
|
xGetDeviceModifierMappingReply rep = {
|
||||||
.repType = X_Reply,
|
|
||||||
.RepType = X_GetDeviceModifierMapping,
|
.RepType = X_GetDeviceModifierMapping,
|
||||||
.sequenceNumber = client->sequence,
|
|
||||||
.numKeyPerModifier = max_keys_per_mod,
|
.numKeyPerModifier = max_keys_per_mod,
|
||||||
/* length counts 4 byte quantities - there are 8 modifiers 1 byte big */
|
|
||||||
.length = max_keys_per_mod << 1
|
|
||||||
};
|
};
|
||||||
|
|
||||||
if (client->swapped) {
|
/* 8 modifiers per key, each CARD8 */
|
||||||
swaps(&rep.sequenceNumber);
|
REPLY_SEND_EXTRA(modkeymap, max_keys_per_mod * 8);
|
||||||
swapl(&rep.length);
|
|
||||||
}
|
|
||||||
WriteToClient(client, sizeof(xGetDeviceModifierMappingReply), &rep);
|
|
||||||
WriteToClient(client, max_keys_per_mod * 8, modkeymap);
|
|
||||||
|
|
||||||
free(modkeymap);
|
free(modkeymap);
|
||||||
|
|
||||||
return Success;
|
return Success;
|
||||||
|
|
10
Xi/getprop.c
10
Xi/getprop.c
|
@ -86,9 +86,7 @@ ProcXGetDeviceDontPropagateList(ClientPtr client)
|
||||||
REQUEST_FIELD_CARD32(window);
|
REQUEST_FIELD_CARD32(window);
|
||||||
|
|
||||||
xGetDeviceDontPropagateListReply rep = {
|
xGetDeviceDontPropagateListReply rep = {
|
||||||
.repType = X_Reply,
|
|
||||||
.RepType = X_GetDeviceDontPropagateList,
|
.RepType = X_GetDeviceDontPropagateList,
|
||||||
.sequenceNumber = client->sequence,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
rc = dixLookupWindow(&pWin, stuff->window, client, DixGetAttrAccess);
|
rc = dixLookupWindow(&pWin, stuff->window, client, DixGetAttrAccess);
|
||||||
|
@ -110,12 +108,8 @@ ProcXGetDeviceDontPropagateList(ClientPtr client)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (client->swapped) {
|
REPLY_FIELD_CARD16(count);
|
||||||
swaps(&rep.sequenceNumber);
|
REPLY_SEND();
|
||||||
swapl(&rep.length);
|
|
||||||
swaps(&rep.count);
|
|
||||||
}
|
|
||||||
WriteToClient(client, sizeof(xGetDeviceDontPropagateListReply), &rep);
|
|
||||||
|
|
||||||
if (count) {
|
if (count) {
|
||||||
client->pSwapReplyFunc = (ReplySwapPtr) Swap32Write;
|
client->pSwapReplyFunc = (ReplySwapPtr) Swap32Write;
|
||||||
|
|
|
@ -87,9 +87,7 @@ ProcXGetSelectedExtensionEvents(ClientPtr client)
|
||||||
REQUEST_FIELD_CARD32(window);
|
REQUEST_FIELD_CARD32(window);
|
||||||
|
|
||||||
xGetSelectedExtensionEventsReply rep = {
|
xGetSelectedExtensionEventsReply rep = {
|
||||||
.repType = X_Reply,
|
|
||||||
.RepType = X_GetSelectedExtensionEvents,
|
.RepType = X_GetSelectedExtensionEvents,
|
||||||
.sequenceNumber = client->sequence,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
rc = dixLookupWindow(&pWin, stuff->window, client, DixGetAttrAccess);
|
rc = dixLookupWindow(&pWin, stuff->window, client, DixGetAttrAccess);
|
||||||
|
@ -128,13 +126,9 @@ ProcXGetSelectedExtensionEvents(ClientPtr client)
|
||||||
ClassFromMask(aclient, others->mask[i], i, NULL, CREATE);
|
ClassFromMask(aclient, others->mask[i], i, NULL, CREATE);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (client->swapped) {
|
REPLY_FIELD_CARD16(this_client_count);
|
||||||
swaps(&rep.sequenceNumber);
|
REPLY_FIELD_CARD16(all_clients_count);
|
||||||
swapl(&rep.length);
|
REPLY_SEND();
|
||||||
swaps(&rep.this_client_count);
|
|
||||||
swaps(&rep.all_clients_count);
|
|
||||||
}
|
|
||||||
WriteToClient(client, sizeof(xGetSelectedExtensionEventsReply), &rep);
|
|
||||||
|
|
||||||
if (total_length) {
|
if (total_length) {
|
||||||
client->pSwapReplyFunc = (ReplySwapPtr) Swap32Write;
|
client->pSwapReplyFunc = (ReplySwapPtr) Swap32Write;
|
||||||
|
|
14
Xi/getvers.c
14
Xi/getvers.c
|
@ -82,22 +82,14 @@ ProcXGetExtensionVersion(ClientPtr client)
|
||||||
return BadLength;
|
return BadLength;
|
||||||
|
|
||||||
xGetExtensionVersionReply rep = {
|
xGetExtensionVersionReply rep = {
|
||||||
.repType = X_Reply,
|
|
||||||
.RepType = X_GetExtensionVersion,
|
.RepType = X_GetExtensionVersion,
|
||||||
.sequenceNumber = client->sequence,
|
|
||||||
.major_version = XIVersion.major_version,
|
.major_version = XIVersion.major_version,
|
||||||
.minor_version = XIVersion.minor_version,
|
.minor_version = XIVersion.minor_version,
|
||||||
.present = TRUE
|
.present = TRUE
|
||||||
};
|
};
|
||||||
|
|
||||||
if (client->swapped) {
|
REPLY_FIELD_CARD16(major_version);
|
||||||
swaps(&rep.sequenceNumber);
|
REPLY_FIELD_CARD16(minor_version);
|
||||||
swapl(&rep.length);
|
REPLY_SEND();
|
||||||
swaps(&rep.major_version);
|
|
||||||
swaps(&rep.minor_version);
|
|
||||||
}
|
|
||||||
|
|
||||||
WriteToClient(client, sizeof(xGetExtensionVersionReply), &rep);
|
|
||||||
|
|
||||||
return Success;
|
return Success;
|
||||||
}
|
}
|
||||||
|
|
|
@ -92,9 +92,7 @@ ProcXGrabDevice(ClientPtr client)
|
||||||
REQUEST_BUF_CARD32(&stuff[1], stuff->event_count);
|
REQUEST_BUF_CARD32(&stuff[1], stuff->event_count);
|
||||||
|
|
||||||
xGrabDeviceReply rep = {
|
xGrabDeviceReply rep = {
|
||||||
.repType = X_Reply,
|
|
||||||
.RepType = X_GrabDevice,
|
.RepType = X_GrabDevice,
|
||||||
.sequenceNumber = client->sequence,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
rc = dixLookupDevice(&dev, stuff->deviceid, client, DixGrabAccess);
|
rc = dixLookupDevice(&dev, stuff->deviceid, client, DixGrabAccess);
|
||||||
|
@ -116,11 +114,7 @@ ProcXGrabDevice(ClientPtr client)
|
||||||
if (rc != Success)
|
if (rc != Success)
|
||||||
return rc;
|
return rc;
|
||||||
|
|
||||||
if (client->swapped) {
|
REPLY_SEND();
|
||||||
swaps(&rep.sequenceNumber);
|
|
||||||
swapl(&rep.length);
|
|
||||||
}
|
|
||||||
WriteToClient(client, sizeof(xGrabDeviceReply), &rep);
|
|
||||||
return Success;
|
return Success;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -88,11 +88,7 @@ ProcXGetDeviceMotionEvents(ClientPtr client)
|
||||||
MaybeStopDeviceHint(dev, client);
|
MaybeStopDeviceHint(dev, client);
|
||||||
|
|
||||||
xGetDeviceMotionEventsReply rep = {
|
xGetDeviceMotionEventsReply rep = {
|
||||||
.repType = X_Reply,
|
|
||||||
.RepType = X_GetDeviceMotionEvents,
|
.RepType = X_GetDeviceMotionEvents,
|
||||||
.sequenceNumber = client->sequence,
|
|
||||||
.length = 0,
|
|
||||||
.nEvents = 0,
|
|
||||||
.axes = v->numAxes,
|
.axes = v->numAxes,
|
||||||
.mode = Absolute /* XXX we don't do relative at the moment */
|
.mode = Absolute /* XXX we don't do relative at the moment */
|
||||||
};
|
};
|
||||||
|
@ -111,8 +107,10 @@ ProcXGetDeviceMotionEvents(ClientPtr client)
|
||||||
rep.nEvents = GetMotionHistory(dev, (xTimecoord **) &coords, /* XXX */
|
rep.nEvents = GetMotionHistory(dev, (xTimecoord **) &coords, /* XXX */
|
||||||
start.milliseconds, stop.milliseconds,
|
start.milliseconds, stop.milliseconds,
|
||||||
(ScreenPtr) NULL, FALSE);
|
(ScreenPtr) NULL, FALSE);
|
||||||
|
if (rep.nEvents < 0)
|
||||||
|
rep.nEvents = 0;
|
||||||
|
|
||||||
length = rep.nEvents * size;
|
length = rep.nEvents * size;
|
||||||
rep.length = bytes_to_int32(length);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -123,8 +121,9 @@ ProcXGetDeviceMotionEvents(ClientPtr client)
|
||||||
swapl(&rep.nEvents);
|
swapl(&rep.nEvents);
|
||||||
}
|
}
|
||||||
|
|
||||||
WriteToClient(client, sizeof(xGetDeviceMotionEventsReply), &rep);
|
REPLY_BUF_CARD32(coords, bytes_to_int32(length));
|
||||||
WriteToClient(client, length, coords);
|
REPLY_FIELD_CARD32(nEvents);
|
||||||
|
REPLY_SEND_EXTRA(coords, length);
|
||||||
free(coords);
|
free(coords);
|
||||||
return Success;
|
return Success;
|
||||||
}
|
}
|
||||||
|
|
34
Xi/listdev.c
34
Xi/listdev.c
|
@ -136,9 +136,9 @@ CopySwapButtonClass(ClientPtr client, ButtonClassPtr b, char **buf)
|
||||||
b2->class = ButtonClass;
|
b2->class = ButtonClass;
|
||||||
b2->length = sizeof(xButtonInfo);
|
b2->length = sizeof(xButtonInfo);
|
||||||
b2->num_buttons = b->numButtons;
|
b2->num_buttons = b->numButtons;
|
||||||
if (client && client->swapped) {
|
|
||||||
swaps(&b2->num_buttons);
|
CLIENT_STRUCT_CARD16_1(b2, num_buttons);
|
||||||
}
|
|
||||||
*buf += sizeof(xButtonInfo);
|
*buf += sizeof(xButtonInfo);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -169,9 +169,8 @@ CopySwapDevice(ClientPtr client, DeviceIntPtr d, int num_classes, char **buf)
|
||||||
else
|
else
|
||||||
dev->use = IsXExtensionDevice;
|
dev->use = IsXExtensionDevice;
|
||||||
|
|
||||||
if (client->swapped) {
|
CLIENT_STRUCT_CARD32_1(dev, type);
|
||||||
swapl(&dev->type);
|
|
||||||
}
|
|
||||||
*buf += sizeof(xDeviceInfo);
|
*buf += sizeof(xDeviceInfo);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -192,9 +191,9 @@ CopySwapKeyClass(ClientPtr client, KeyClassPtr k, char **buf)
|
||||||
k2->min_keycode = k->xkbInfo->desc->min_key_code;
|
k2->min_keycode = k->xkbInfo->desc->min_key_code;
|
||||||
k2->max_keycode = k->xkbInfo->desc->max_key_code;
|
k2->max_keycode = k->xkbInfo->desc->max_key_code;
|
||||||
k2->num_keys = k2->max_keycode - k2->min_keycode + 1;
|
k2->num_keys = k2->max_keycode - k2->min_keycode + 1;
|
||||||
if (client && client->swapped) {
|
|
||||||
swaps(&k2->num_keys);
|
CLIENT_STRUCT_CARD16_1(k2, num_keys);
|
||||||
}
|
|
||||||
*buf += sizeof(xKeyInfo);
|
*buf += sizeof(xKeyInfo);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -230,9 +229,7 @@ CopySwapValuatorClass(ClientPtr client, DeviceIntPtr dev, char **buf)
|
||||||
v2->num_axes = t_axes;
|
v2->num_axes = t_axes;
|
||||||
v2->mode = valuator_get_mode(dev, 0);
|
v2->mode = valuator_get_mode(dev, 0);
|
||||||
v2->motion_buffer_size = v->numMotionEvents;
|
v2->motion_buffer_size = v->numMotionEvents;
|
||||||
if (client && client->swapped) {
|
CLIENT_STRUCT_CARD32_1(v2, motion_buffer_size);
|
||||||
swapl(&v2->motion_buffer_size);
|
|
||||||
}
|
|
||||||
*buf += sizeof(xValuatorInfo);
|
*buf += sizeof(xValuatorInfo);
|
||||||
a = v->axes + (VPC * i);
|
a = v->axes + (VPC * i);
|
||||||
a2 = (xAxisInfoPtr) * buf;
|
a2 = (xAxisInfoPtr) * buf;
|
||||||
|
@ -240,11 +237,7 @@ CopySwapValuatorClass(ClientPtr client, DeviceIntPtr dev, char **buf)
|
||||||
a2->min_value = a->min_value;
|
a2->min_value = a->min_value;
|
||||||
a2->max_value = a->max_value;
|
a2->max_value = a->max_value;
|
||||||
a2->resolution = a->resolution;
|
a2->resolution = a->resolution;
|
||||||
if (client && client->swapped) {
|
CLIENT_STRUCT_CARD32_3(a2, min_value, max_value, resolution);
|
||||||
swapl(&a2->min_value);
|
|
||||||
swapl(&a2->max_value);
|
|
||||||
swapl(&a2->resolution);
|
|
||||||
}
|
|
||||||
a2++;
|
a2++;
|
||||||
a++;
|
a++;
|
||||||
*buf += sizeof(xAxisInfo);
|
*buf += sizeof(xAxisInfo);
|
||||||
|
@ -378,15 +371,12 @@ ProcXListInputDevices(ClientPtr client)
|
||||||
}
|
}
|
||||||
|
|
||||||
xListInputDevicesReply rep = {
|
xListInputDevicesReply rep = {
|
||||||
.repType = X_Reply,
|
|
||||||
.RepType = X_ListInputDevices,
|
.RepType = X_ListInputDevices,
|
||||||
.sequenceNumber = client->sequence,
|
|
||||||
.ndevices = numdevs,
|
.ndevices = numdevs,
|
||||||
.length = bytes_to_int32(total_length),
|
|
||||||
};
|
};
|
||||||
|
|
||||||
WriteReplyToClient(client, sizeof(xListInputDevicesReply), &rep);
|
REPLY_SEND_EXTRA(savbuf, total_length);
|
||||||
WriteToClient(client, total_length, savbuf);
|
|
||||||
free(savbuf);
|
free(savbuf);
|
||||||
free(skip);
|
free(skip);
|
||||||
return Success;
|
return Success;
|
||||||
|
|
11
Xi/opendev.c
11
Xi/opendev.c
|
@ -131,19 +131,10 @@ ProcXOpenDevice(ClientPtr client)
|
||||||
evbase[j++].event_type_base = event_base[OtherClass];
|
evbase[j++].event_type_base = event_base[OtherClass];
|
||||||
|
|
||||||
xOpenDeviceReply rep = {
|
xOpenDeviceReply rep = {
|
||||||
.repType = X_Reply,
|
|
||||||
.RepType = X_OpenDevice,
|
.RepType = X_OpenDevice,
|
||||||
.sequenceNumber = client->sequence,
|
|
||||||
.length = bytes_to_int32(j * sizeof(xInputClassInfo)),
|
|
||||||
.num_classes = j
|
.num_classes = j
|
||||||
};
|
};
|
||||||
|
|
||||||
if (client->swapped) {
|
REPLY_SEND_EXTRA(evbase, j * sizeof(xInputClassInfo));
|
||||||
swaps(&rep.sequenceNumber);
|
|
||||||
swapl(&rep.length);
|
|
||||||
}
|
|
||||||
|
|
||||||
WriteToClient(client, sizeof(xOpenDeviceReply), &rep);
|
|
||||||
WriteToClient(client, j * sizeof(xInputClassInfo), evbase);
|
|
||||||
return Success;
|
return Success;
|
||||||
}
|
}
|
||||||
|
|
23
Xi/queryst.c
23
Xi/queryst.c
|
@ -68,7 +68,6 @@ ProcXQueryDeviceState(ClientPtr client)
|
||||||
ValuatorClassPtr v;
|
ValuatorClassPtr v;
|
||||||
xValuatorState *tv;
|
xValuatorState *tv;
|
||||||
DeviceIntPtr dev;
|
DeviceIntPtr dev;
|
||||||
double *values;
|
|
||||||
|
|
||||||
REQUEST_HEAD_STRUCT(xQueryDeviceStateReq);
|
REQUEST_HEAD_STRUCT(xQueryDeviceStateReq);
|
||||||
|
|
||||||
|
@ -107,7 +106,6 @@ ProcXQueryDeviceState(ClientPtr client)
|
||||||
tk->length = sizeof(xKeyState);
|
tk->length = sizeof(xKeyState);
|
||||||
tk->num_keys = k->xkbInfo->desc->max_key_code -
|
tk->num_keys = k->xkbInfo->desc->max_key_code -
|
||||||
k->xkbInfo->desc->min_key_code + 1;
|
k->xkbInfo->desc->min_key_code + 1;
|
||||||
if (rc != BadAccess)
|
|
||||||
for (i = 0; i < 32; i++)
|
for (i = 0; i < 32; i++)
|
||||||
tk->keys[i] = k->down[i];
|
tk->keys[i] = k->down[i];
|
||||||
buf += sizeof(xKeyState);
|
buf += sizeof(xKeyState);
|
||||||
|
@ -132,31 +130,20 @@ ProcXQueryDeviceState(ClientPtr client)
|
||||||
tv->mode |= (dev->proximity &&
|
tv->mode |= (dev->proximity &&
|
||||||
!dev->proximity->in_proximity) ? OutOfProximity : 0;
|
!dev->proximity->in_proximity) ? OutOfProximity : 0;
|
||||||
buf += sizeof(xValuatorState);
|
buf += sizeof(xValuatorState);
|
||||||
for (i = 0, values = v->axisVal; i < v->numAxes; i++) {
|
int *buf2 = (int *)buf;
|
||||||
|
for (i = 0; i < v->numAxes; i++) {
|
||||||
if (rc != BadAccess)
|
if (rc != BadAccess)
|
||||||
*((int *) buf) = *values;
|
buf2[i] = v->axisVal[i];
|
||||||
values++;
|
|
||||||
if (client->swapped) {
|
|
||||||
swapl((int *) buf);
|
|
||||||
}
|
|
||||||
buf += sizeof(int);
|
|
||||||
}
|
}
|
||||||
|
REPLY_BUF_CARD32(buf2, v->numAxes);
|
||||||
}
|
}
|
||||||
|
|
||||||
xQueryDeviceStateReply rep = {
|
xQueryDeviceStateReply rep = {
|
||||||
.repType = X_Reply,
|
|
||||||
.RepType = X_QueryDeviceState,
|
.RepType = X_QueryDeviceState,
|
||||||
.sequenceNumber = client->sequence,
|
|
||||||
.length = bytes_to_int32(total_length),
|
|
||||||
.num_classes = num_classes
|
.num_classes = num_classes
|
||||||
};
|
};
|
||||||
|
|
||||||
if (client->swapped) {
|
REPLY_SEND_EXTRA(savbuf, total_length);
|
||||||
swaps(&rep.sequenceNumber);
|
|
||||||
swapl(&rep.length);
|
|
||||||
}
|
|
||||||
WriteToClient(client, sizeof(xQueryDeviceStateReply), &rep);
|
|
||||||
WriteToClient(client, total_length, savbuf);
|
|
||||||
free(savbuf);
|
free(savbuf);
|
||||||
return Success;
|
return Success;
|
||||||
}
|
}
|
||||||
|
|
|
@ -101,10 +101,6 @@ ProcXSetDeviceButtonMapping(ClientPtr client)
|
||||||
.status = (ret == Success ? MappingSuccess : MappingBusy),
|
.status = (ret == Success ? MappingSuccess : MappingBusy),
|
||||||
};
|
};
|
||||||
|
|
||||||
if (client->swapped) {
|
REPLY_SEND();
|
||||||
swaps(&rep.sequenceNumber);
|
|
||||||
}
|
|
||||||
WriteToClient(client, sizeof(xSetDeviceButtonMappingReply), &rep);
|
|
||||||
|
|
||||||
return Success;
|
return Success;
|
||||||
}
|
}
|
||||||
|
|
|
@ -79,9 +79,7 @@ ProcXSetDeviceValuators(ClientPtr client)
|
||||||
REQUEST_HEAD_AT_LEAST(xSetDeviceValuatorsReq);
|
REQUEST_HEAD_AT_LEAST(xSetDeviceValuatorsReq);
|
||||||
|
|
||||||
xSetDeviceValuatorsReply rep = {
|
xSetDeviceValuatorsReply rep = {
|
||||||
.repType = X_Reply,
|
|
||||||
.RepType = X_SetDeviceValuators,
|
.RepType = X_SetDeviceValuators,
|
||||||
.sequenceNumber = client->sequence,
|
|
||||||
.status = Success
|
.status = Success
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -111,9 +109,6 @@ ProcXSetDeviceValuators(ClientPtr client)
|
||||||
if (rep.status != Success && rep.status != AlreadyGrabbed)
|
if (rep.status != Success && rep.status != AlreadyGrabbed)
|
||||||
return rep.status;
|
return rep.status;
|
||||||
|
|
||||||
if (client->swapped) {
|
REPLY_SEND();
|
||||||
swaps(&rep.sequenceNumber);
|
|
||||||
}
|
|
||||||
WriteToClient(client, sizeof(xSetDeviceValuatorsReply), &rep);
|
|
||||||
return Success;
|
return Success;
|
||||||
}
|
}
|
||||||
|
|
|
@ -101,9 +101,6 @@ ProcXSetDeviceModifierMapping(ClientPtr client)
|
||||||
.success = ret,
|
.success = ret,
|
||||||
};
|
};
|
||||||
|
|
||||||
if (client->swapped) {
|
REPLY_SEND();
|
||||||
swaps(&rep.sequenceNumber);
|
|
||||||
}
|
|
||||||
WriteToClient(client, sizeof(xSetDeviceModifierMappingReply), &rep);
|
|
||||||
return Success;
|
return Success;
|
||||||
}
|
}
|
||||||
|
|
|
@ -79,9 +79,7 @@ ProcXSetDeviceMode(ClientPtr client)
|
||||||
REQUEST_HEAD_STRUCT(xSetDeviceModeReq);
|
REQUEST_HEAD_STRUCT(xSetDeviceModeReq);
|
||||||
|
|
||||||
xSetDeviceModeReply rep = {
|
xSetDeviceModeReply rep = {
|
||||||
.repType = X_Reply,
|
|
||||||
.RepType = X_SetDeviceMode,
|
.RepType = X_SetDeviceMode,
|
||||||
.sequenceNumber = client->sequence,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
rc = dixLookupDevice(&dev, stuff->deviceid, client, DixSetAttrAccess);
|
rc = dixLookupDevice(&dev, stuff->deviceid, client, DixSetAttrAccess);
|
||||||
|
@ -112,11 +110,6 @@ ProcXSetDeviceMode(ClientPtr client)
|
||||||
return rep.status;
|
return rep.status;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (client->swapped) {
|
REPLY_SEND();
|
||||||
swaps(&rep.sequenceNumber);
|
|
||||||
swapl(&rep.length);
|
|
||||||
}
|
|
||||||
|
|
||||||
WriteToClient(client, sizeof(xSetDeviceModeReply), &rep);
|
|
||||||
return Success;
|
return Success;
|
||||||
}
|
}
|
||||||
|
|
|
@ -45,34 +45,24 @@
|
||||||
int
|
int
|
||||||
ProcXIGetClientPointer(ClientPtr client)
|
ProcXIGetClientPointer(ClientPtr client)
|
||||||
{
|
{
|
||||||
int rc;
|
|
||||||
ClientPtr winclient;
|
|
||||||
|
|
||||||
REQUEST_HEAD_STRUCT(xXIGetClientPointerReq);
|
REQUEST_HEAD_STRUCT(xXIGetClientPointerReq);
|
||||||
REQUEST_FIELD_CARD32(win);
|
REQUEST_FIELD_CARD32(win);
|
||||||
|
|
||||||
|
ClientPtr winclient;
|
||||||
if (stuff->win != None) {
|
if (stuff->win != None) {
|
||||||
rc = dixLookupResourceOwner(&winclient, stuff->win, client, DixGetAttrAccess);
|
if (dixLookupResourceOwner(&winclient, stuff->win, client, DixGetAttrAccess) != Success)
|
||||||
|
|
||||||
if (rc != Success)
|
|
||||||
return BadWindow;
|
return BadWindow;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
winclient = client;
|
winclient = client;
|
||||||
|
|
||||||
xXIGetClientPointerReply rep = {
|
xXIGetClientPointerReply rep = {
|
||||||
.repType = X_Reply,
|
|
||||||
.RepType = X_XIGetClientPointer,
|
.RepType = X_XIGetClientPointer,
|
||||||
.sequenceNumber = client->sequence,
|
|
||||||
.set = (winclient->clientPtr != NULL),
|
.set = (winclient->clientPtr != NULL),
|
||||||
.deviceid = (winclient->clientPtr) ? winclient->clientPtr->id : 0
|
.deviceid = (winclient->clientPtr) ? winclient->clientPtr->id : 0
|
||||||
};
|
};
|
||||||
|
|
||||||
if (client->swapped) {
|
REPLY_FIELD_CARD16(deviceid);
|
||||||
swaps(&rep.sequenceNumber);
|
REPLY_SEND();
|
||||||
swapl(&rep.length);
|
|
||||||
swaps(&rep.deviceid);
|
|
||||||
}
|
|
||||||
WriteToClient(client, sizeof(xXIGetClientPointerReply), &rep);
|
|
||||||
return Success;
|
return Success;
|
||||||
}
|
}
|
||||||
|
|
|
@ -110,17 +110,12 @@ ProcXIGrabDevice(ClientPtr client)
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
xXIGrabDeviceReply rep = {
|
xXIGrabDeviceReply rep = {
|
||||||
.repType = X_Reply,
|
|
||||||
.RepType = X_XIGrabDevice,
|
.RepType = X_XIGrabDevice,
|
||||||
.sequenceNumber = client->sequence,
|
|
||||||
.status = status
|
.status = status
|
||||||
};
|
};
|
||||||
|
|
||||||
if (client->swapped) {
|
REPLY_SEND();
|
||||||
swaps(&rep.sequenceNumber);
|
return Success;
|
||||||
}
|
|
||||||
WriteToClient(client, sizeof(rep), &rep);
|
|
||||||
return ret;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
|
|
|
@ -51,13 +51,6 @@ int
|
||||||
ProcXIPassiveGrabDevice(ClientPtr client)
|
ProcXIPassiveGrabDevice(ClientPtr client)
|
||||||
{
|
{
|
||||||
DeviceIntPtr dev, mod_dev;
|
DeviceIntPtr dev, mod_dev;
|
||||||
xXIPassiveGrabDeviceReply rep = {
|
|
||||||
.repType = X_Reply,
|
|
||||||
.RepType = X_XIPassiveGrabDevice,
|
|
||||||
.sequenceNumber = client->sequence,
|
|
||||||
.length = 0,
|
|
||||||
.num_modifiers = 0
|
|
||||||
};
|
|
||||||
int i, ret = Success;
|
int i, ret = Success;
|
||||||
uint32_t *modifiers;
|
uint32_t *modifiers;
|
||||||
xXIGrabModifierInfo *modifiers_failed = NULL;
|
xXIGrabModifierInfo *modifiers_failed = NULL;
|
||||||
|
@ -185,6 +178,8 @@ ProcXIPassiveGrabDevice(ClientPtr client)
|
||||||
|
|
||||||
mod_dev = (InputDevIsFloating(dev)) ? dev : GetMaster(dev, MASTER_KEYBOARD);
|
mod_dev = (InputDevIsFloating(dev)) ? dev : GetMaster(dev, MASTER_KEYBOARD);
|
||||||
|
|
||||||
|
int num_mod = 0;
|
||||||
|
|
||||||
for (i = 0; i < stuff->num_modifiers; i++, modifiers++) {
|
for (i = 0; i < stuff->num_modifiers; i++, modifiers++) {
|
||||||
uint8_t status = Success;
|
uint8_t status = Success;
|
||||||
|
|
||||||
|
@ -221,27 +216,24 @@ ProcXIPassiveGrabDevice(ClientPtr client)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (status != GrabSuccess) {
|
if (status != GrabSuccess) {
|
||||||
xXIGrabModifierInfo *info = modifiers_failed + rep.num_modifiers;
|
xXIGrabModifierInfo *info = modifiers_failed + num_mod;
|
||||||
|
|
||||||
info->status = status;
|
info->status = status;
|
||||||
info->modifiers = *modifiers;
|
info->modifiers = *modifiers;
|
||||||
if (client->swapped)
|
CLIENT_STRUCT_CARD32_1(info, modifiers);
|
||||||
swapl(&info->modifiers);
|
num_mod++;
|
||||||
|
|
||||||
rep.num_modifiers++;
|
|
||||||
rep.length += bytes_to_int32(sizeof(xXIGrabModifierInfo));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t length = rep.length; /* save it before swapping */
|
xXIPassiveGrabDeviceReply rep = {
|
||||||
|
.RepType = X_XIPassiveGrabDevice,
|
||||||
|
.num_modifiers = num_mod,
|
||||||
|
};
|
||||||
|
|
||||||
if (client->swapped) {
|
uint32_t length = bytes_to_int32(sizeof(xXIGrabModifierInfo) * num_mod);
|
||||||
swaps(&rep.sequenceNumber);
|
|
||||||
swapl(&rep.length);
|
REPLY_FIELD_CARD16(num_modifiers);
|
||||||
swaps(&rep.num_modifiers);
|
REPLY_SEND_EXTRA(modifiers_failed, length * 4);
|
||||||
}
|
|
||||||
WriteToClient(client, sizeof(rep), &rep);
|
|
||||||
WriteToClient(client, length * 4, modifiers_failed);
|
|
||||||
|
|
||||||
out:
|
out:
|
||||||
free(modifiers_failed);
|
free(modifiers_failed);
|
||||||
|
|
|
@ -853,11 +853,10 @@ ProcXListDeviceProperties(ClientPtr client)
|
||||||
Atom *atoms;
|
Atom *atoms;
|
||||||
int natoms;
|
int natoms;
|
||||||
DeviceIntPtr dev;
|
DeviceIntPtr dev;
|
||||||
int rc = Success;
|
|
||||||
|
|
||||||
REQUEST_HEAD_STRUCT(xListDevicePropertiesReq);
|
REQUEST_HEAD_STRUCT(xListDevicePropertiesReq);
|
||||||
|
|
||||||
rc = dixLookupDevice(&dev, stuff->deviceid, client, DixListPropAccess);
|
int rc = dixLookupDevice(&dev, stuff->deviceid, client, DixListPropAccess);
|
||||||
if (rc != Success)
|
if (rc != Success)
|
||||||
return rc;
|
return rc;
|
||||||
|
|
||||||
|
@ -866,25 +865,17 @@ ProcXListDeviceProperties(ClientPtr client)
|
||||||
return rc;
|
return rc;
|
||||||
|
|
||||||
xListDevicePropertiesReply rep = {
|
xListDevicePropertiesReply rep = {
|
||||||
.repType = X_Reply,
|
|
||||||
.RepType = X_ListDeviceProperties,
|
.RepType = X_ListDeviceProperties,
|
||||||
.sequenceNumber = client->sequence,
|
.sequenceNumber = client->sequence,
|
||||||
.length = natoms,
|
.length = natoms,
|
||||||
.nAtoms = natoms
|
.nAtoms = natoms
|
||||||
};
|
};
|
||||||
|
|
||||||
if (client->swapped) {
|
REPLY_FIELD_CARD16(nAtoms);
|
||||||
swaps(&rep.sequenceNumber);
|
REPLY_SEND();
|
||||||
swapl(&rep.length);
|
|
||||||
swaps(&rep.nAtoms);
|
|
||||||
}
|
|
||||||
WriteToClient(client, sizeof(xListDevicePropertiesReply), &rep);
|
|
||||||
if (natoms) {
|
|
||||||
client->pSwapReplyFunc = (ReplySwapPtr) Swap32Write;
|
|
||||||
WriteSwappedDataToClient(client, natoms * sizeof(Atom), atoms);
|
|
||||||
free(atoms);
|
free(atoms);
|
||||||
}
|
|
||||||
return rc;
|
return Success;
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
|
@ -976,9 +967,7 @@ ProcXGetDeviceProperty(ClientPtr client)
|
||||||
return rc;
|
return rc;
|
||||||
|
|
||||||
xGetDevicePropertyReply rep = {
|
xGetDevicePropertyReply rep = {
|
||||||
.repType = X_Reply,
|
|
||||||
.RepType = X_GetDeviceProperty,
|
.RepType = X_GetDeviceProperty,
|
||||||
.sequenceNumber = client->sequence,
|
|
||||||
.length = bytes_to_int32(length),
|
.length = bytes_to_int32(length),
|
||||||
.propertyType = type,
|
.propertyType = type,
|
||||||
.bytesAfter = bytes_after,
|
.bytesAfter = bytes_after,
|
||||||
|
@ -990,14 +979,10 @@ ProcXGetDeviceProperty(ClientPtr client)
|
||||||
if (stuff->delete && (rep.bytesAfter == 0))
|
if (stuff->delete && (rep.bytesAfter == 0))
|
||||||
send_property_event(dev, stuff->property, XIPropertyDeleted);
|
send_property_event(dev, stuff->property, XIPropertyDeleted);
|
||||||
|
|
||||||
if (client->swapped) {
|
REPLY_FIELD_CARD32(propertyType);
|
||||||
swaps(&rep.sequenceNumber);
|
REPLY_FIELD_CARD32(bytesAfter);
|
||||||
swapl(&rep.length);
|
REPLY_FIELD_CARD32(nItems);
|
||||||
swapl(&rep.propertyType);
|
REPLY_SEND();
|
||||||
swapl(&rep.bytesAfter);
|
|
||||||
swapl(&rep.nItems);
|
|
||||||
}
|
|
||||||
WriteToClient(client, sizeof(xGenericReply), &rep);
|
|
||||||
|
|
||||||
if (length) {
|
if (length) {
|
||||||
switch (rep.format) {
|
switch (rep.format) {
|
||||||
|
@ -1051,19 +1036,14 @@ ProcXIListProperties(ClientPtr client)
|
||||||
return rc;
|
return rc;
|
||||||
|
|
||||||
xXIListPropertiesReply rep = {
|
xXIListPropertiesReply rep = {
|
||||||
.repType = X_Reply,
|
|
||||||
.RepType = X_XIListProperties,
|
.RepType = X_XIListProperties,
|
||||||
.sequenceNumber = client->sequence,
|
|
||||||
.length = natoms,
|
.length = natoms,
|
||||||
.num_properties = natoms
|
.num_properties = natoms
|
||||||
};
|
};
|
||||||
|
|
||||||
if (client->swapped) {
|
REPLY_FIELD_CARD16(num_properties);
|
||||||
swaps(&rep.sequenceNumber);
|
REPLY_SEND();
|
||||||
swapl(&rep.length);
|
|
||||||
swaps(&rep.num_properties);
|
|
||||||
}
|
|
||||||
WriteToClient(client, sizeof(xXIListPropertiesReply), &rep);
|
|
||||||
if (natoms) {
|
if (natoms) {
|
||||||
client->pSwapReplyFunc = (ReplySwapPtr) Swap32Write;
|
client->pSwapReplyFunc = (ReplySwapPtr) Swap32Write;
|
||||||
WriteSwappedDataToClient(client, natoms * sizeof(Atom), atoms);
|
WriteSwappedDataToClient(client, natoms * sizeof(Atom), atoms);
|
||||||
|
@ -1165,9 +1145,7 @@ ProcXIGetProperty(ClientPtr client)
|
||||||
return rc;
|
return rc;
|
||||||
|
|
||||||
xXIGetPropertyReply rep = {
|
xXIGetPropertyReply rep = {
|
||||||
.repType = X_Reply,
|
|
||||||
.RepType = X_XIGetProperty,
|
.RepType = X_XIGetProperty,
|
||||||
.sequenceNumber = client->sequence,
|
|
||||||
.length = bytes_to_int32(length),
|
.length = bytes_to_int32(length),
|
||||||
.type = type,
|
.type = type,
|
||||||
.bytes_after = bytes_after,
|
.bytes_after = bytes_after,
|
||||||
|
@ -1178,14 +1156,10 @@ ProcXIGetProperty(ClientPtr client)
|
||||||
if (length && stuff->delete && (rep.bytes_after == 0))
|
if (length && stuff->delete && (rep.bytes_after == 0))
|
||||||
send_property_event(dev, stuff->property, XIPropertyDeleted);
|
send_property_event(dev, stuff->property, XIPropertyDeleted);
|
||||||
|
|
||||||
if (client->swapped) {
|
REPLY_FIELD_CARD32(type);
|
||||||
swaps(&rep.sequenceNumber);
|
REPLY_FIELD_CARD32(bytes_after);
|
||||||
swapl(&rep.length);
|
REPLY_FIELD_CARD32(num_items);
|
||||||
swapl(&rep.type);
|
REPLY_SEND();
|
||||||
swapl(&rep.bytes_after);
|
|
||||||
swapl(&rep.num_items);
|
|
||||||
}
|
|
||||||
WriteToClient(client, sizeof(xXIGetPropertyReply), &rep);
|
|
||||||
|
|
||||||
if (length) {
|
if (length) {
|
||||||
switch (rep.format) {
|
switch (rep.format) {
|
||||||
|
|
|
@ -101,12 +101,11 @@ ProcXIQueryDevice(ClientPtr client)
|
||||||
}
|
}
|
||||||
|
|
||||||
xXIQueryDeviceReply rep = {
|
xXIQueryDeviceReply rep = {
|
||||||
.repType = X_Reply,
|
|
||||||
.RepType = X_XIQueryDevice,
|
.RepType = X_XIQueryDevice,
|
||||||
.sequenceNumber = client->sequence,
|
|
||||||
.length = len / 4,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
int buf_len = len;
|
||||||
|
|
||||||
ptr = info;
|
ptr = info;
|
||||||
if (dev) {
|
if (dev) {
|
||||||
len = ListDeviceInfo(client, dev, (xXIDeviceInfo *) info);
|
len = ListDeviceInfo(client, dev, (xXIDeviceInfo *) info);
|
||||||
|
@ -138,15 +137,9 @@ ProcXIQueryDevice(ClientPtr client)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
len = rep.length * 4;
|
REPLY_FIELD_CARD16(num_devices);
|
||||||
|
REPLY_SEND_EXTRA(ptr, buf_len);
|
||||||
|
|
||||||
if (client->swapped) {
|
|
||||||
swaps(&rep.sequenceNumber);
|
|
||||||
swapl(&rep.length);
|
|
||||||
swaps(&rep.num_devices);
|
|
||||||
}
|
|
||||||
WriteToClient(client, sizeof(xXIQueryDeviceReply), &rep);
|
|
||||||
WriteToClient(client, len, ptr);
|
|
||||||
free(ptr);
|
free(ptr);
|
||||||
free(skip);
|
free(skip);
|
||||||
return rc;
|
return rc;
|
||||||
|
|
|
@ -115,9 +115,7 @@ ProcXIQueryPointer(ClientPtr client)
|
||||||
pSprite = pDev->spriteInfo->sprite;
|
pSprite = pDev->spriteInfo->sprite;
|
||||||
|
|
||||||
xXIQueryPointerReply rep = {
|
xXIQueryPointerReply rep = {
|
||||||
.repType = X_Reply,
|
|
||||||
.RepType = X_XIQueryPointer,
|
.RepType = X_XIQueryPointer,
|
||||||
.sequenceNumber = client->sequence,
|
|
||||||
.length = 6,
|
.length = 6,
|
||||||
.root = (InputDevCurrentRootWindow(pDev))->drawable.id,
|
.root = (InputDevCurrentRootWindow(pDev))->drawable.id,
|
||||||
.root_x = double_to_fp1616(pSprite->hot.x),
|
.root_x = double_to_fp1616(pSprite->hot.x),
|
||||||
|
@ -183,19 +181,14 @@ ProcXIQueryPointer(ClientPtr client)
|
||||||
}
|
}
|
||||||
#endif /* XINERAMA */
|
#endif /* XINERAMA */
|
||||||
|
|
||||||
if (client->swapped) {
|
REPLY_FIELD_CARD32(root);
|
||||||
swaps(&rep.sequenceNumber);
|
REPLY_FIELD_CARD32(child);
|
||||||
swapl(&rep.length);
|
REPLY_FIELD_CARD32(root_x);
|
||||||
swapl(&rep.root);
|
REPLY_FIELD_CARD32(root_y);
|
||||||
swapl(&rep.child);
|
REPLY_FIELD_CARD32(win_x);
|
||||||
swapl(&rep.root_x);
|
REPLY_FIELD_CARD32(win_y);
|
||||||
swapl(&rep.root_y);
|
REPLY_FIELD_CARD16(buttons_len);
|
||||||
swapl(&rep.win_x);
|
REPLY_SEND_EXTRA(buttons, buttons_size);
|
||||||
swapl(&rep.win_y);
|
|
||||||
swaps(&rep.buttons_len);
|
|
||||||
}
|
|
||||||
WriteToClient(client, sizeof(xXIQueryPointerReply), &rep);
|
|
||||||
WriteToClient(client, buttons_size, buttons);
|
|
||||||
|
|
||||||
free(buttons);
|
free(buttons);
|
||||||
|
|
||||||
|
|
|
@ -115,19 +115,12 @@ ProcXIQueryVersion(ClientPtr client)
|
||||||
}
|
}
|
||||||
|
|
||||||
xXIQueryVersionReply rep = {
|
xXIQueryVersionReply rep = {
|
||||||
.repType = X_Reply,
|
|
||||||
.RepType = X_XIQueryVersion,
|
.RepType = X_XIQueryVersion,
|
||||||
.sequenceNumber = client->sequence,
|
|
||||||
.major_version = major,
|
.major_version = major,
|
||||||
.minor_version = minor
|
.minor_version = minor
|
||||||
};
|
};
|
||||||
|
|
||||||
if (client->swapped) {
|
REPLY_FIELD_CARD16(major_version);
|
||||||
swaps(&rep.sequenceNumber);
|
REPLY_FIELD_CARD16(minor_version);
|
||||||
swaps(&rep.major_version);
|
|
||||||
swaps(&rep.minor_version);
|
|
||||||
}
|
|
||||||
WriteToClient(client, sizeof(xXIQueryVersionReply), &rep);
|
|
||||||
|
|
||||||
return Success;
|
return Success;
|
||||||
}
|
}
|
||||||
|
|
|
@ -135,8 +135,7 @@ ProcXISelectEvents(ClientPtr client)
|
||||||
if (len < bytes_to_int32(sizeof(xXIEventMask)))
|
if (len < bytes_to_int32(sizeof(xXIEventMask)))
|
||||||
return BadLength;
|
return BadLength;
|
||||||
len -= bytes_to_int32(sizeof(xXIEventMask));
|
len -= bytes_to_int32(sizeof(xXIEventMask));
|
||||||
swaps(&evmask->deviceid);
|
CLIENT_STRUCT_CARD16_2(evmask, deviceid, mask_len);
|
||||||
swaps(&evmask->mask_len);
|
|
||||||
if (len < evmask->mask_len)
|
if (len < evmask->mask_len)
|
||||||
return BadLength;
|
return BadLength;
|
||||||
len -= evmask->mask_len;
|
len -= evmask->mask_len;
|
||||||
|
@ -338,9 +337,7 @@ ProcXIGetSelectedEvents(ClientPtr client)
|
||||||
return rc;
|
return rc;
|
||||||
|
|
||||||
xXIGetSelectedEventsReply rep = {
|
xXIGetSelectedEventsReply rep = {
|
||||||
.repType = X_Reply,
|
|
||||||
.RepType = X_XIGetSelectedEvents,
|
.RepType = X_XIGetSelectedEvents,
|
||||||
.sequenceNumber = client->sequence,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
masks = wOtherInputMasks(win);
|
masks = wOtherInputMasks(win);
|
||||||
|
@ -377,12 +374,9 @@ ProcXIGetSelectedEvents(ClientPtr client)
|
||||||
evmask->deviceid = i;
|
evmask->deviceid = i;
|
||||||
evmask->mask_len = mask_len;
|
evmask->mask_len = mask_len;
|
||||||
rep.num_masks++;
|
rep.num_masks++;
|
||||||
rep.length += sizeof(xXIEventMask) / 4 + evmask->mask_len;
|
length += sizeof(xXIEventMask) + mask_len * 4;
|
||||||
|
|
||||||
if (client->swapped) {
|
CLIENT_STRUCT_CARD16_2(evmask, deviceid, mask_len);
|
||||||
swaps(&evmask->deviceid);
|
|
||||||
swaps(&evmask->mask_len);
|
|
||||||
}
|
|
||||||
|
|
||||||
memcpy(&evmask[1], devmask, j + 1);
|
memcpy(&evmask[1], devmask, j + 1);
|
||||||
evmask = (xXIEventMask *) ((char *) evmask +
|
evmask = (xXIEventMask *) ((char *) evmask +
|
||||||
|
@ -395,13 +389,7 @@ ProcXIGetSelectedEvents(ClientPtr client)
|
||||||
finish: ;
|
finish: ;
|
||||||
uint32_t length = rep.length; /* save before swapping it */
|
uint32_t length = rep.length; /* save before swapping it */
|
||||||
|
|
||||||
if (client->swapped) {
|
REPLY_FIELD_CARD16(num_masks);
|
||||||
swaps(&rep.sequenceNumber);
|
REPLY_SEND_EXTRA(buffer, length);
|
||||||
swapl(&rep.length);
|
|
||||||
swaps(&rep.num_masks);
|
|
||||||
}
|
|
||||||
WriteToClient(client, sizeof(xXIGetSelectedEventsReply), &rep);
|
|
||||||
WriteToClient(client, length * 4, buffer);
|
|
||||||
|
|
||||||
return Success;
|
return Success;
|
||||||
}
|
}
|
||||||
|
|
|
@ -78,9 +78,7 @@ ProcXIGetFocus(ClientPtr client)
|
||||||
return BadDevice;
|
return BadDevice;
|
||||||
|
|
||||||
xXIGetFocusReply rep = {
|
xXIGetFocusReply rep = {
|
||||||
.repType = X_Reply,
|
|
||||||
.RepType = X_XIGetFocus,
|
.RepType = X_XIGetFocus,
|
||||||
.sequenceNumber = client->sequence,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
if (dev->focus->win == NoneWin)
|
if (dev->focus->win == NoneWin)
|
||||||
|
@ -92,11 +90,7 @@ ProcXIGetFocus(ClientPtr client)
|
||||||
else
|
else
|
||||||
rep.focus = dev->focus->win->drawable.id;
|
rep.focus = dev->focus->win->drawable.id;
|
||||||
|
|
||||||
if (client->swapped) {
|
REPLY_FIELD_CARD32(focus);
|
||||||
swaps(&rep.sequenceNumber);
|
REPLY_SEND();
|
||||||
swapl(&rep.length);
|
|
||||||
swapl(&rep.focus);
|
|
||||||
}
|
|
||||||
WriteToClient(client, sizeof(xXIGetFocusReply), &rep);
|
|
||||||
return Success;
|
return Success;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue