Xext: dpms: use new marshal generator for dpms extension

Using the recently introduced extension marshal generator tool for
generating much of the glue code, based on a simple yaml.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
This commit is contained in:
Enrico Weigelt, metux IT consult
2024-03-08 14:33:50 +01:00
parent 829bfb392f
commit 6b846ad1e5
3 changed files with 47 additions and 162 deletions

View File

@@ -459,168 +459,7 @@ ProcDPMSInfo(ClientPtr client)
return Success;
}
static int
ProcDPMSDispatch(ClientPtr client)
{
REQUEST(xReq);
switch (stuff->data) {
case X_DPMSGetVersion:
return ProcDPMSGetVersion(client);
case X_DPMSCapable:
return ProcDPMSCapable(client);
case X_DPMSGetTimeouts:
return ProcDPMSGetTimeouts(client);
case X_DPMSSetTimeouts:
return ProcDPMSSetTimeouts(client);
case X_DPMSEnable:
return ProcDPMSEnable(client);
case X_DPMSDisable:
return ProcDPMSDisable(client);
case X_DPMSForceLevel:
return ProcDPMSForceLevel(client);
case X_DPMSInfo:
return ProcDPMSInfo(client);
case X_DPMSSelectInput:
return ProcDPMSSelectInput(client);
default:
return BadRequest;
}
}
static int _X_COLD
SProcDPMSGetVersion(ClientPtr client)
{
REQUEST(xDPMSGetVersionReq);
swaps(&stuff->length);
REQUEST_SIZE_MATCH(xDPMSGetVersionReq);
swaps(&stuff->majorVersion);
swaps(&stuff->minorVersion);
return ProcDPMSGetVersion(client);
}
static int _X_COLD
SProcDPMSCapable(ClientPtr client)
{
REQUEST(xDPMSCapableReq);
swaps(&stuff->length);
REQUEST_SIZE_MATCH(xDPMSCapableReq);
return ProcDPMSCapable(client);
}
static int _X_COLD
SProcDPMSGetTimeouts(ClientPtr client)
{
REQUEST(xDPMSGetTimeoutsReq);
swaps(&stuff->length);
REQUEST_SIZE_MATCH(xDPMSGetTimeoutsReq);
return ProcDPMSGetTimeouts(client);
}
static int _X_COLD
SProcDPMSSetTimeouts(ClientPtr client)
{
REQUEST(xDPMSSetTimeoutsReq);
swaps(&stuff->length);
REQUEST_SIZE_MATCH(xDPMSSetTimeoutsReq);
swaps(&stuff->standby);
swaps(&stuff->suspend);
swaps(&stuff->off);
return ProcDPMSSetTimeouts(client);
}
static int _X_COLD
SProcDPMSEnable(ClientPtr client)
{
REQUEST(xDPMSEnableReq);
swaps(&stuff->length);
REQUEST_SIZE_MATCH(xDPMSEnableReq);
return ProcDPMSEnable(client);
}
static int _X_COLD
SProcDPMSDisable(ClientPtr client)
{
REQUEST(xDPMSDisableReq);
swaps(&stuff->length);
REQUEST_SIZE_MATCH(xDPMSDisableReq);
return ProcDPMSDisable(client);
}
static int _X_COLD
SProcDPMSForceLevel(ClientPtr client)
{
REQUEST(xDPMSForceLevelReq);
swaps(&stuff->length);
REQUEST_SIZE_MATCH(xDPMSForceLevelReq);
swaps(&stuff->level);
return ProcDPMSForceLevel(client);
}
static int _X_COLD
SProcDPMSInfo(ClientPtr client)
{
REQUEST(xDPMSInfoReq);
swaps(&stuff->length);
REQUEST_SIZE_MATCH(xDPMSInfoReq);
return ProcDPMSInfo(client);
}
static int _X_COLD
SProcDPMSSelectInput(ClientPtr client)
{
REQUEST(xDPMSSelectInputReq);
swaps(&stuff->length);
REQUEST_SIZE_MATCH(xDPMSSelectInputReq);
swapl(&stuff->eventMask);
return ProcDPMSSelectInput(client);
}
static int _X_COLD
SProcDPMSDispatch(ClientPtr client)
{
REQUEST(xReq);
switch (stuff->data) {
case X_DPMSGetVersion:
return SProcDPMSGetVersion(client);
case X_DPMSCapable:
return SProcDPMSCapable(client);
case X_DPMSGetTimeouts:
return SProcDPMSGetTimeouts(client);
case X_DPMSSetTimeouts:
return SProcDPMSSetTimeouts(client);
case X_DPMSEnable:
return SProcDPMSEnable(client);
case X_DPMSDisable:
return SProcDPMSDisable(client);
case X_DPMSForceLevel:
return SProcDPMSForceLevel(client);
case X_DPMSInfo:
return SProcDPMSInfo(client);
case X_DPMSSelectInput:
return SProcDPMSSelectInput(client);
default:
return BadRequest;
}
}
#include "dpms-marshal.h"
static void
DPMSCloseDownExtension(ExtensionEntry *e)

45
Xext/dpms.yml Normal file
View File

@@ -0,0 +1,45 @@
extension: DPMS
requests:
DPMSGetVersion:
payload:
- name: 'majorVersion'
type: CARD16
- name: 'minorVersion'
type: CARD16
DPMSCapable: {}
DPMSGetTimeouts:
code: X_DPMSGetTimeouts
DPMSSetTimeouts:
code: X_DPMSSetTimeouts
payload:
- name: 'standby'
type: CARD16
- name: 'suspend'
type: CARD16
- name: 'off'
type: CARD16
- name: 'pad0'
type: CARD16
DPMSEnable:
code: X_DPMSEnable
struct: xDPMSEnableReq
DPMSDisable:
code: X_DPMSDisable
struct: xDPMSDisableReq
DPMSForceLevel:
code: X_DPMSForceLevel
struct: xDPMSForceLevelReq
payload:
- name: 'level'
type: CARD16
- name: 'pad0'
type: CARD16
DPMSInfo:
code: X_DPMSInfo
DPMSSelectInput:
code: X_DPMSSelectInput
payload:
- name: 'length'
type: CARD16
- name: 'eventMask'
type: CARD32

View File

@@ -16,6 +16,7 @@ hdrs_xext = [
if build_dpms
srcs_xext += 'dpms.c'
srcs_xext += extension_marshal_generator.process('dpms.yml')
endif
if build_mitshm