Xi: xtest: use X_SEND_REPLY_SIMPLE()

Use X_SEND_REPLY_SIMPLE() for sending out simple replies.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
This commit is contained in:
Enrico Weigelt, metux IT consult
2025-08-21 19:31:28 +02:00
committed by Enrico Weigelt
parent 4c79fd513a
commit 64996477f5
12 changed files with 27 additions and 75 deletions

View File

@@ -55,6 +55,7 @@ SOFTWARE.
#include <X11/extensions/XI.h>
#include <X11/extensions/XIproto.h> /* control constants */
#include "dix/dix_priv.h"
#include "dix/exevents_priv.h"
#include "dix/input_priv.h"
#include "dix/resource_priv.h"
@@ -128,7 +129,6 @@ ProcXChangeDeviceControl(ClientPtr client)
xChangeDeviceControlReply rep = {
.RepType = X_ChangeDeviceControl,
.sequenceNumber = client->sequence,
.status = Success,
};
@@ -230,10 +230,7 @@ ProcXChangeDeviceControl(ClientPtr client)
SendEventToAllWindows(dev, DevicePresenceNotifyMask,
(xEvent *) &dpn, 1);
if (client->swapped) {
swaps(&rep.sequenceNumber);
}
WriteToClient(client, sizeof(xChangeDeviceControlReply), &rep);
X_SEND_REPLY_SIMPLE(client, rep);
}
return ret;

View File

@@ -52,12 +52,14 @@ SOFTWARE.
#include <dix-config.h>
#include "windowstr.h" /* focus struct */
#include "inputstr.h" /* DeviceIntPtr */
#include <X11/extensions/XI.h>
#include <X11/extensions/XIproto.h>
#include "exglobals.h"
#include "dix/dix_priv.h"
#include "windowstr.h" /* focus struct */
#include "inputstr.h" /* DeviceIntPtr */
#include "exglobals.h"
#include "getfocus.h"
/***********************************************************************
@@ -85,9 +87,7 @@ ProcXGetDeviceFocus(ClientPtr client)
focus = dev->focus;
xGetDeviceFocusReply rep = {
.repType = X_Reply,
.RepType = X_GetDeviceFocus,
.sequenceNumber = client->sequence,
.time = focus->time.milliseconds,
.revertTo = focus->revert,
};
@@ -102,11 +102,9 @@ ProcXGetDeviceFocus(ClientPtr client)
rep.focus = focus->win->drawable.id;
if (client->swapped) {
swaps(&rep.sequenceNumber);
swapl(&rep.length);
swapl(&rep.focus);
swapl(&rep.time);
}
WriteToClient(client, sizeof(xGetDeviceFocusReply), &rep);
X_SEND_REPLY_SIMPLE(client, rep);
return Success;
}

View File

@@ -52,9 +52,12 @@ SOFTWARE.
#include <dix-config.h>
#include "inputstr.h" /* DeviceIntPtr */
#include <X11/extensions/XI.h>
#include <X11/extensions/XIproto.h>
#include "dix/dix_priv.h"
#include "inputstr.h" /* DeviceIntPtr */
#include "exevents.h"
#include "exglobals.h"
@@ -94,22 +97,17 @@ ProcXGetExtensionVersion(ClientPtr client)
return BadLength;
xGetExtensionVersionReply rep = {
.repType = X_Reply,
.RepType = X_GetExtensionVersion,
.sequenceNumber = client->sequence,
.major_version = XIVersion.major_version,
.minor_version = XIVersion.minor_version,
.present = TRUE
};
if (client->swapped) {
swaps(&rep.sequenceNumber);
swapl(&rep.length);
swaps(&rep.major_version);
swaps(&rep.minor_version);
}
WriteToClient(client, sizeof(xGetExtensionVersionReply), &rep);
X_SEND_REPLY_SIMPLE(client, rep);
return Success;
}

View File

@@ -112,9 +112,7 @@ ProcXGrabDevice(ClientPtr client)
return BadLength;
xGrabDeviceReply rep = {
.repType = X_Reply,
.RepType = X_GrabDevice,
.sequenceNumber = client->sequence,
};
rc = dixLookupDevice(&dev, stuff->deviceid, client, DixGrabAccess);
@@ -136,11 +134,7 @@ ProcXGrabDevice(ClientPtr client)
if (rc != Success)
return rc;
if (client->swapped) {
swaps(&rep.sequenceNumber);
swapl(&rep.length);
}
WriteToClient(client, sizeof(xGrabDeviceReply), &rep);
X_SEND_REPLY_SIMPLE(client, rep);
return Success;
}

View File

@@ -55,6 +55,7 @@ SOFTWARE.
#include <X11/extensions/XI.h>
#include <X11/extensions/XIproto.h>
#include "dix/dix_priv.h"
#include "dix/input_priv.h"
#include "inputstr.h" /* DeviceIntPtr */
@@ -95,16 +96,10 @@ ProcXSetDeviceButtonMapping(ClientPtr client)
return ret;
xSetDeviceButtonMappingReply rep = {
.repType = X_Reply,
.RepType = X_SetDeviceButtonMapping,
.sequenceNumber = client->sequence,
.status = (ret == Success ? MappingSuccess : MappingBusy),
};
if (client->swapped) {
swaps(&rep.sequenceNumber);
}
WriteToClient(client, sizeof(xSetDeviceButtonMappingReply), &rep);
X_SEND_REPLY_SIMPLE(client, rep);
return Success;
}

View File

@@ -55,6 +55,7 @@ SOFTWARE.
#include <X11/extensions/XI.h>
#include <X11/extensions/XIproto.h>
#include "dix/dix_priv.h"
#include "dix/input_priv.h"
#include "dix/resource_priv.h"
@@ -79,9 +80,7 @@ ProcXSetDeviceValuators(ClientPtr client)
REQUEST_AT_LEAST_SIZE(xSetDeviceValuatorsReq);
xSetDeviceValuatorsReply rep = {
.repType = X_Reply,
.RepType = X_SetDeviceValuators,
.sequenceNumber = client->sequence,
.status = Success
};
@@ -111,9 +110,6 @@ ProcXSetDeviceValuators(ClientPtr client)
if (rep.status != Success && rep.status != AlreadyGrabbed)
return rep.status;
if (client->swapped) {
swaps(&rep.sequenceNumber);
}
WriteToClient(client, sizeof(xSetDeviceValuatorsReply), &rep);
X_SEND_REPLY_SIMPLE(client, rep);
return Success;
}

View File

@@ -56,6 +56,7 @@ SOFTWARE.
#include <X11/extensions/XI2.h>
#include <X11/extensions/XIproto.h>
#include "dix/dix_priv.h"
#include "dix/input_priv.h"
#include "inputstr.h" /* DeviceIntPtr */
@@ -95,15 +96,10 @@ ProcXSetDeviceModifierMapping(ClientPtr client)
return ret;
xSetDeviceModifierMappingReply rep = {
.repType = X_Reply,
.RepType = X_SetDeviceModifierMapping,
.sequenceNumber = client->sequence,
.success = ret,
};
if (client->swapped) {
swaps(&rep.sequenceNumber);
}
WriteToClient(client, sizeof(xSetDeviceModifierMappingReply), &rep);
X_SEND_REPLY_SIMPLE(client, rep);
return Success;
}

View File

@@ -55,6 +55,7 @@ SOFTWARE.
#include <X11/extensions/XI.h>
#include <X11/extensions/XIproto.h>
#include "dix/dix_priv.h"
#include "dix/input_priv.h"
#include "dix/resource_priv.h"
@@ -79,9 +80,7 @@ ProcXSetDeviceMode(ClientPtr client)
REQUEST_SIZE_MATCH(xSetDeviceModeReq);
xSetDeviceModeReply rep = {
.repType = X_Reply,
.RepType = X_SetDeviceMode,
.sequenceNumber = client->sequence,
};
rc = dixLookupDevice(&dev, stuff->deviceid, client, DixSetAttrAccess);
@@ -112,11 +111,6 @@ ProcXSetDeviceMode(ClientPtr client)
return rep.status;
}
if (client->swapped) {
swaps(&rep.sequenceNumber);
swapl(&rep.length);
}
WriteToClient(client, sizeof(xSetDeviceModeReply), &rep);
X_SEND_REPLY_SIMPLE(client, rep);
return Success;
}

View File

@@ -74,18 +74,14 @@ ProcXIGetClientPointer(ClientPtr client)
winclient = client;
xXIGetClientPointerReply rep = {
.repType = X_Reply,
.RepType = X_XIGetClientPointer,
.sequenceNumber = client->sequence,
.set = (winclient->clientPtr != NULL),
.deviceid = (winclient->clientPtr) ? winclient->clientPtr->id : 0
};
if (client->swapped) {
swaps(&rep.sequenceNumber);
swapl(&rep.length);
swaps(&rep.deviceid);
}
WriteToClient(client, sizeof(xXIGetClientPointerReply), &rep);
X_SEND_REPLY_SIMPLE(client, rep);
return Success;
}

View File

@@ -123,16 +123,11 @@ ProcXIGrabDevice(ClientPtr client)
return ret;
xXIGrabDeviceReply rep = {
.repType = X_Reply,
.RepType = X_XIGrabDevice,
.sequenceNumber = client->sequence,
.status = status
};
if (client->swapped) {
swaps(&rep.sequenceNumber);
}
WriteToClient(client, sizeof(rep), &rep);
X_SEND_REPLY_SIMPLE(client, rep);
return ret;
}

View File

@@ -35,6 +35,7 @@
#include <X11/X.h>
#include <X11/extensions/XI2proto.h>
#include "dix/dix_priv.h"
#include "dix/exevents_priv.h"
#include "os/fmt.h"
@@ -113,20 +114,16 @@ ProcXIQueryVersion(ClientPtr client)
}
xXIQueryVersionReply rep = {
.repType = X_Reply,
.RepType = X_XIQueryVersion,
.sequenceNumber = client->sequence,
.major_version = major,
.minor_version = minor
};
if (client->swapped) {
swaps(&rep.sequenceNumber);
swaps(&rep.major_version);
swaps(&rep.minor_version);
}
WriteToClient(client, sizeof(xXIQueryVersionReply), &rep);
X_SEND_REPLY_SIMPLE(client, rep);
return Success;
}

View File

@@ -99,9 +99,7 @@ ProcXIGetFocus(ClientPtr client)
return BadDevice;
xXIGetFocusReply rep = {
.repType = X_Reply,
.RepType = X_XIGetFocus,
.sequenceNumber = client->sequence,
};
if (dev->focus->win == NoneWin)
@@ -114,10 +112,8 @@ ProcXIGetFocus(ClientPtr client)
rep.focus = dev->focus->win->drawable.id;
if (client->swapped) {
swaps(&rep.sequenceNumber);
swapl(&rep.length);
swapl(&rep.focus);
}
WriteToClient(client, sizeof(xXIGetFocusReply), &rep);
X_SEND_REPLY_SIMPLE(client, rep);
return Success;
}