diff --git a/randr/randr.c b/randr/randr.c index 078514a3c..59d101ba7 100644 --- a/randr/randr.c +++ b/randr/randr.c @@ -50,6 +50,7 @@ static int RRNScreens; real->mem = priv->mem; \ } +static int ProcRRDispatch(ClientPtr pClient); static int SProcRRDispatch(ClientPtr pClient); int RREventBase; @@ -737,6 +738,16 @@ RRVerticalRefresh(xRRModeInfo * mode) return (CARD16) refresh; } +static int +ProcRRDispatch(ClientPtr client) +{ + REQUEST(xReq); + if (stuff->data >= RRNumberRequests || !ProcRandrVector[stuff->data]) + return BadRequest; + UpdateCurrentTimeIf(); + return (*ProcRandrVector[stuff->data]) (client); +} + static int _X_COLD SProcRRDispatch(ClientPtr client) { diff --git a/randr/randrstr_priv.h b/randr/randrstr_priv.h index a125f293a..7f802215f 100644 --- a/randr/randrstr_priv.h +++ b/randr/randrstr_priv.h @@ -33,6 +33,7 @@ extern int RREventBase, RRErrorBase; +extern int (*ProcRandrVector[RRNumberRequests]) (ClientPtr); extern int (*SProcRandrVector[RRNumberRequests]) (ClientPtr); extern RESTYPE RRClientType, RREventType; /* resource types for event masks */ @@ -139,6 +140,4 @@ int ProcRRQueryVersion(ClientPtr client); int ProcRRSelectInput(ClientPtr client); -int ProcRRDispatch(ClientPtr client); - #endif /* _XSERVER_RANDRSTR_PRIV_H_ */ diff --git a/randr/rrdispatch.c b/randr/rrdispatch.c index 866c6f252..4381f52ca 100644 --- a/randr/rrdispatch.c +++ b/randr/rrdispatch.c @@ -211,69 +211,60 @@ ProcRRSelectInput(ClientPtr client) return Success; } -int -ProcRRDispatch(ClientPtr client) -{ - REQUEST(xReq); - UpdateCurrentTimeIf(); - - switch (stuff->data) { - case X_RRQueryVersion: return ProcRRQueryVersion(client); - case X_RRSetScreenConfig: return ProcRRSetScreenConfig(client); - case X_RRSelectInput: return ProcRRSelectInput(client); - case X_RRGetScreenInfo: return ProcRRGetScreenInfo(client); - - /* V1.2 additions */ - case X_RRGetScreenSizeRange: return ProcRRGetScreenSizeRange(client); - case X_RRSetScreenSize: return ProcRRSetScreenSize(client); - case X_RRGetScreenResources: return ProcRRGetScreenResources(client); - case X_RRGetOutputInfo: return ProcRRGetOutputInfo(client); - case X_RRListOutputProperties: return ProcRRListOutputProperties(client); - case X_RRQueryOutputProperty: return ProcRRQueryOutputProperty(client); - case X_RRConfigureOutputProperty: return ProcRRConfigureOutputProperty(client); - case X_RRChangeOutputProperty: return ProcRRChangeOutputProperty(client); - case X_RRDeleteOutputProperty: return ProcRRDeleteOutputProperty(client); - case X_RRGetOutputProperty: return ProcRRGetOutputProperty(client); - case X_RRCreateMode: return ProcRRCreateMode(client); - case X_RRDestroyMode: return ProcRRDestroyMode(client); - case X_RRAddOutputMode: return ProcRRAddOutputMode(client); - case X_RRDeleteOutputMode: return ProcRRDeleteOutputMode(client); - case X_RRGetCrtcInfo: return ProcRRGetCrtcInfo(client); - case X_RRSetCrtcConfig: return ProcRRSetCrtcConfig(client); - case X_RRGetCrtcGammaSize: return ProcRRGetCrtcGammaSize(client); - case X_RRGetCrtcGamma: return ProcRRGetCrtcGamma(client); - case X_RRSetCrtcGamma: return ProcRRSetCrtcGamma(client); - - /* V1.3 additions */ - case X_RRGetScreenResourcesCurrent: return ProcRRGetScreenResourcesCurrent(client); - case X_RRSetCrtcTransform: return ProcRRSetCrtcTransform(client); - case X_RRGetCrtcTransform: return ProcRRGetCrtcTransform(client); - case X_RRGetPanning: return ProcRRGetPanning(client); - case X_RRSetPanning: return ProcRRSetPanning(client); - case X_RRSetOutputPrimary: return ProcRRSetOutputPrimary(client); - case X_RRGetOutputPrimary: return ProcRRGetOutputPrimary(client); - - /* V1.4 additions */ - case X_RRGetProviders: return ProcRRGetProviders(client); - case X_RRGetProviderInfo: return ProcRRGetProviderInfo(client); - case X_RRSetProviderOffloadSink: return ProcRRSetProviderOffloadSink(client); - case X_RRSetProviderOutputSource: return ProcRRSetProviderOutputSource(client); - case X_RRListProviderProperties: return ProcRRListProviderProperties(client); - case X_RRQueryProviderProperty: return ProcRRQueryProviderProperty(client); - case X_RRConfigureProviderProperty: return ProcRRConfigureProviderProperty(client); - case X_RRChangeProviderProperty: return ProcRRChangeProviderProperty(client); - case X_RRDeleteProviderProperty: return ProcRRDeleteProviderProperty(client); - case X_RRGetProviderProperty: return ProcRRGetProviderProperty(client); - - /* V1.5 additions */ - case X_RRGetMonitors: return ProcRRGetMonitors(client); - case X_RRSetMonitor: return ProcRRSetMonitor(client); - case X_RRDeleteMonitor: return ProcRRDeleteMonitor(client); - - /* V1.6 additions */ - case X_RRCreateLease: return ProcRRCreateLease(client); - case X_RRFreeLease: return ProcRRFreeLease(client); - } - - return BadRequest; -} +int (*ProcRandrVector[RRNumberRequests]) (ClientPtr) = { + ProcRRQueryVersion, /* 0 */ +/* we skip 1 to make old clients fail pretty immediately */ + NULL, /* 1 ProcRandrOldGetScreenInfo */ +/* V1.0 apps share the same set screen config request id */ + ProcRRSetScreenConfig, /* 2 */ + NULL, /* 3 ProcRandrOldScreenChangeSelectInput */ +/* 3 used to be ScreenChangeSelectInput; deprecated */ + ProcRRSelectInput, /* 4 */ + ProcRRGetScreenInfo, /* 5 */ +/* V1.2 additions */ + ProcRRGetScreenSizeRange, /* 6 */ + ProcRRSetScreenSize, /* 7 */ + ProcRRGetScreenResources, /* 8 */ + ProcRRGetOutputInfo, /* 9 */ + ProcRRListOutputProperties, /* 10 */ + ProcRRQueryOutputProperty, /* 11 */ + ProcRRConfigureOutputProperty, /* 12 */ + ProcRRChangeOutputProperty, /* 13 */ + ProcRRDeleteOutputProperty, /* 14 */ + ProcRRGetOutputProperty, /* 15 */ + ProcRRCreateMode, /* 16 */ + ProcRRDestroyMode, /* 17 */ + ProcRRAddOutputMode, /* 18 */ + ProcRRDeleteOutputMode, /* 19 */ + ProcRRGetCrtcInfo, /* 20 */ + ProcRRSetCrtcConfig, /* 21 */ + ProcRRGetCrtcGammaSize, /* 22 */ + ProcRRGetCrtcGamma, /* 23 */ + ProcRRSetCrtcGamma, /* 24 */ +/* V1.3 additions */ + ProcRRGetScreenResourcesCurrent, /* 25 */ + ProcRRSetCrtcTransform, /* 26 */ + ProcRRGetCrtcTransform, /* 27 */ + ProcRRGetPanning, /* 28 */ + ProcRRSetPanning, /* 29 */ + ProcRRSetOutputPrimary, /* 30 */ + ProcRRGetOutputPrimary, /* 31 */ +/* V1.4 additions */ + ProcRRGetProviders, /* 32 */ + ProcRRGetProviderInfo, /* 33 */ + ProcRRSetProviderOffloadSink, /* 34 */ + ProcRRSetProviderOutputSource, /* 35 */ + ProcRRListProviderProperties, /* 36 */ + ProcRRQueryProviderProperty, /* 37 */ + ProcRRConfigureProviderProperty, /* 38 */ + ProcRRChangeProviderProperty, /* 39 */ + ProcRRDeleteProviderProperty, /* 40 */ + ProcRRGetProviderProperty, /* 41 */ +/* V1.5 additions */ + ProcRRGetMonitors, /* 42 */ + ProcRRSetMonitor, /* 43 */ + ProcRRDeleteMonitor, /* 44 */ +/* V1.6 additions */ + ProcRRCreateLease, /* 45 */ + ProcRRFreeLease, /* 46 */ +};