Xext: dpms: 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:
Enrico Weigelt, metux IT consult 2024-07-02 17:51:56 +02:00
parent 9614b41afb
commit 428855b0df

View File

@ -302,20 +302,13 @@ ProcDPMSGetVersion(ClientPtr client)
REQUEST_FIELD_CARD16(minorVersion); REQUEST_FIELD_CARD16(minorVersion);
xDPMSGetVersionReply rep = { xDPMSGetVersionReply rep = {
.type = X_Reply,
.sequenceNumber = client->sequence,
.length = 0,
.majorVersion = SERVER_DPMS_MAJOR_VERSION, .majorVersion = SERVER_DPMS_MAJOR_VERSION,
.minorVersion = SERVER_DPMS_MINOR_VERSION .minorVersion = SERVER_DPMS_MINOR_VERSION
}; };
if (client->swapped) { REPLY_FIELD_CARD16(majorVersion);
swaps(&rep.sequenceNumber); REPLY_FIELD_CARD16(minorVersion);
swaps(&rep.majorVersion); REPLY_SEND_RET_SUCCESS();
swaps(&rep.minorVersion);
}
WriteToClient(client, sizeof(xDPMSGetVersionReply), &rep);
return Success;
} }
static int static int
@ -324,17 +317,10 @@ ProcDPMSCapable(ClientPtr client)
REQUEST_HEAD_STRUCT(xDPMSCapableReq); REQUEST_HEAD_STRUCT(xDPMSCapableReq);
xDPMSCapableReply rep = { xDPMSCapableReply rep = {
.type = X_Reply,
.sequenceNumber = client->sequence,
.length = 0,
.capable = TRUE .capable = TRUE
}; };
if (client->swapped) { REPLY_SEND_RET_SUCCESS();
swaps(&rep.sequenceNumber);
}
WriteToClient(client, sizeof(xDPMSCapableReply), &rep);
return Success;
} }
static int static int
@ -343,22 +329,15 @@ ProcDPMSGetTimeouts(ClientPtr client)
REQUEST_HEAD_STRUCT(xDPMSGetTimeoutsReq); REQUEST_HEAD_STRUCT(xDPMSGetTimeoutsReq);
xDPMSGetTimeoutsReply rep = { xDPMSGetTimeoutsReply rep = {
.type = X_Reply,
.sequenceNumber = client->sequence,
.length = 0,
.standby = DPMSStandbyTime / MILLI_PER_SECOND, .standby = DPMSStandbyTime / MILLI_PER_SECOND,
.suspend = DPMSSuspendTime / MILLI_PER_SECOND, .suspend = DPMSSuspendTime / MILLI_PER_SECOND,
.off = DPMSOffTime / MILLI_PER_SECOND .off = DPMSOffTime / MILLI_PER_SECOND
}; };
if (client->swapped) { REPLY_FIELD_CARD16(standby);
swaps(&rep.sequenceNumber); REPLY_FIELD_CARD16(suspend);
swaps(&rep.standby); REPLY_FIELD_CARD16(off);
swaps(&rep.suspend); REPLY_SEND_RET_SUCCESS();
swaps(&rep.off);
}
WriteToClient(client, sizeof(xDPMSGetTimeoutsReply), &rep);
return Success;
} }
static int static int
@ -445,19 +424,12 @@ ProcDPMSInfo(ClientPtr client)
REQUEST_HEAD_STRUCT(xDPMSInfoReq); REQUEST_HEAD_STRUCT(xDPMSInfoReq);
xDPMSInfoReply rep = { xDPMSInfoReply rep = {
.type = X_Reply,
.sequenceNumber = client->sequence,
.length = 0,
.power_level = DPMSPowerLevel, .power_level = DPMSPowerLevel,
.state = DPMSEnabled .state = DPMSEnabled
}; };
if (client->swapped) { REPLY_FIELD_CARD16(power_level);
swaps(&rep.sequenceNumber); REPLY_SEND_RET_SUCCESS();
swaps(&rep.power_level);
}
WriteToClient(client, sizeof(xDPMSInfoReply), &rep);
return Success;
} }
static int static int