diff --git a/randr/randr.c b/randr/randr.c index f367d1f168..67132b3c34 100644 --- a/randr/randr.c +++ b/randr/randr.c @@ -50,8 +50,6 @@ static int RRNScreens; real->mem = priv->mem; \ } -static int SProcRRDispatch(ClientPtr pClient); - int RREventBase; int RRErrorBase; RESTYPE RRClientType, RREventType; /* resource types for event masks */ @@ -721,13 +719,3 @@ RRVerticalRefresh(xRRModeInfo * mode) refresh = 0xffff; return (CARD16) refresh; } - -static int _X_COLD -SProcRRDispatch(ClientPtr client) -{ - REQUEST(xReq); - if (stuff->data >= RRNumberRequests || !SProcRandrVector[stuff->data]) - return BadRequest; - UpdateCurrentTimeIf(); - return (*SProcRandrVector[stuff->data]) (client); -} diff --git a/randr/randrstr_priv.h b/randr/randrstr_priv.h index a125f293ab..7037e81db3 100644 --- a/randr/randrstr_priv.h +++ b/randr/randrstr_priv.h @@ -141,4 +141,6 @@ int ProcRRSelectInput(ClientPtr client); int ProcRRDispatch(ClientPtr client); +int SProcRRDispatch(ClientPtr client); + #endif /* _XSERVER_RANDRSTR_PRIV_H_ */ diff --git a/randr/rrsdispatch.c b/randr/rrsdispatch.c index 70cbd4a684..c7f3ec165d 100644 --- a/randr/rrsdispatch.c +++ b/randr/rrsdispatch.c @@ -647,60 +647,71 @@ SProcRRFreeLease(ClientPtr client) { return ProcRRFreeLease(client); } -int (*SProcRandrVector[RRNumberRequests]) (ClientPtr) = { - SProcRRQueryVersion, /* 0 */ -/* we skip 1 to make old clients fail pretty immediately */ - NULL, /* 1 SProcRandrOldGetScreenInfo */ -/* V1.0 apps share the same set screen config request id */ - SProcRRSetScreenConfig, /* 2 */ - NULL, /* 3 SProcRandrOldScreenChangeSelectInput */ -/* 3 used to be ScreenChangeSelectInput; deprecated */ - SProcRRSelectInput, /* 4 */ - SProcRRGetScreenInfo, /* 5 */ -/* V1.2 additions */ - SProcRRGetScreenSizeRange, /* 6 */ - SProcRRSetScreenSize, /* 7 */ - SProcRRGetScreenResources, /* 8 */ - SProcRRGetOutputInfo, /* 9 */ - SProcRRListOutputProperties, /* 10 */ - SProcRRQueryOutputProperty, /* 11 */ - SProcRRConfigureOutputProperty, /* 12 */ - SProcRRChangeOutputProperty, /* 13 */ - SProcRRDeleteOutputProperty, /* 14 */ - SProcRRGetOutputProperty, /* 15 */ - SProcRRCreateMode, /* 16 */ - SProcRRDestroyMode, /* 17 */ - SProcRRAddOutputMode, /* 18 */ - SProcRRDeleteOutputMode, /* 19 */ - SProcRRGetCrtcInfo, /* 20 */ - SProcRRSetCrtcConfig, /* 21 */ - SProcRRGetCrtcGammaSize, /* 22 */ - SProcRRGetCrtcGamma, /* 23 */ - SProcRRSetCrtcGamma, /* 24 */ -/* V1.3 additions */ - SProcRRGetScreenResourcesCurrent, /* 25 */ - SProcRRSetCrtcTransform, /* 26 */ - SProcRRGetCrtcTransform, /* 27 */ - SProcRRGetPanning, /* 28 */ - SProcRRSetPanning, /* 29 */ - SProcRRSetOutputPrimary, /* 30 */ - SProcRRGetOutputPrimary, /* 31 */ -/* V1.4 additions */ - SProcRRGetProviders, /* 32 */ - SProcRRGetProviderInfo, /* 33 */ - SProcRRSetProviderOffloadSink, /* 34 */ - SProcRRSetProviderOutputSource, /* 35 */ - SProcRRListProviderProperties, /* 36 */ - SProcRRQueryProviderProperty, /* 37 */ - SProcRRConfigureProviderProperty, /* 38 */ - SProcRRChangeProviderProperty, /* 39 */ - SProcRRDeleteProviderProperty, /* 40 */ - SProcRRGetProviderProperty, /* 41 */ -/* V1.5 additions */ - SProcRRGetMonitors, /* 42 */ - SProcRRSetMonitor, /* 43 */ - SProcRRDeleteMonitor, /* 44 */ -/* V1.6 additions */ - SProcRRCreateLease, /* 45 */ - SProcRRFreeLease, /* 46 */ -}; +#define HANDLER(name) case X_##name: return SProc##name(client) + +int +SProcRRDispatch(ClientPtr client) +{ + REQUEST(xReq); + UpdateCurrentTimeIf(); + + switch (stuff->data) { + HANDLER(RRQueryVersion); + HANDLER(RRSetScreenConfig); + HANDLER(RRSelectInput); + HANDLER(RRGetScreenInfo); + + /* V1.2 additions */ + HANDLER(RRGetScreenSizeRange); + HANDLER(RRSetScreenSize); + HANDLER(RRGetScreenResources); + HANDLER(RRGetOutputInfo); + HANDLER(RRListOutputProperties); + HANDLER(RRQueryOutputProperty); + HANDLER(RRConfigureOutputProperty); + HANDLER(RRChangeOutputProperty); + HANDLER(RRDeleteOutputProperty); + HANDLER(RRGetOutputProperty); + HANDLER(RRCreateMode); + HANDLER(RRDestroyMode); + HANDLER(RRAddOutputMode); + HANDLER(RRDeleteOutputMode); + HANDLER(RRGetCrtcInfo); + HANDLER(RRSetCrtcConfig); + HANDLER(RRGetCrtcGammaSize); + HANDLER(RRGetCrtcGamma); + HANDLER(RRSetCrtcGamma); + + /* V1.3 additions */ + HANDLER(RRGetScreenResourcesCurrent); + HANDLER(RRSetCrtcTransform); + HANDLER(RRGetCrtcTransform); + HANDLER(RRGetPanning); + HANDLER(RRSetPanning); + HANDLER(RRSetOutputPrimary); + HANDLER(RRGetOutputPrimary); + + /* V1.4 additions */ + HANDLER(RRGetProviders); + HANDLER(RRGetProviderInfo); + HANDLER(RRSetProviderOffloadSink); + HANDLER(RRSetProviderOutputSource); + HANDLER(RRListProviderProperties); + HANDLER(RRQueryProviderProperty); + HANDLER(RRConfigureProviderProperty); + HANDLER(RRChangeProviderProperty); + HANDLER(RRDeleteProviderProperty); + HANDLER(RRGetProviderProperty); + + /* V1.5 additions */ + HANDLER(RRGetMonitors); + HANDLER(RRSetMonitor); + HANDLER(RRDeleteMonitor); + + /* V1.6 additions */ + HANDLER(RRCreateLease); + HANDLER(RRFreeLease); + } + + return BadRequest; +}