(submit/cleanup-vidmode-dispatch) Xext: vidmode: simplify dispatcher
These dispatcher functions are much more complex than they're usually are (just switch/case statement). Bring them in line with the standard scheme used in the Xserver, so further steps become easier. Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
This commit is contained in:
parent
9a6a2574e9
commit
24d90b9c09
|
@ -451,6 +451,10 @@ ProcVidModeAddModeLine(ClientPtr client)
|
||||||
int dotClock;
|
int dotClock;
|
||||||
int ver;
|
int ver;
|
||||||
|
|
||||||
|
/* limited to local-only connections */
|
||||||
|
if (!VidModeAllowNonLocal && !client->local)
|
||||||
|
return VidModeErrorBase + XF86VidModeClientNotLocal;
|
||||||
|
|
||||||
DEBUG_P("XF86VidModeAddModeline");
|
DEBUG_P("XF86VidModeAddModeline");
|
||||||
|
|
||||||
ver = ClientMajorVersion(client);
|
ver = ClientMajorVersion(client);
|
||||||
|
@ -621,6 +625,10 @@ ProcVidModeDeleteModeLine(ClientPtr client)
|
||||||
int len, dotClock;
|
int len, dotClock;
|
||||||
int ver;
|
int ver;
|
||||||
|
|
||||||
|
/* limited to local-only connections */
|
||||||
|
if (!VidModeAllowNonLocal && !client->local)
|
||||||
|
return VidModeErrorBase + XF86VidModeClientNotLocal;
|
||||||
|
|
||||||
DEBUG_P("XF86VidModeDeleteModeline");
|
DEBUG_P("XF86VidModeDeleteModeline");
|
||||||
|
|
||||||
ver = ClientMajorVersion(client);
|
ver = ClientMajorVersion(client);
|
||||||
|
@ -745,6 +753,10 @@ ProcVidModeModModeLine(ClientPtr client)
|
||||||
int len, dotClock;
|
int len, dotClock;
|
||||||
int ver;
|
int ver;
|
||||||
|
|
||||||
|
/* limited to local-only connections */
|
||||||
|
if (!VidModeAllowNonLocal && !client->local)
|
||||||
|
return VidModeErrorBase + XF86VidModeClientNotLocal;
|
||||||
|
|
||||||
DEBUG_P("XF86VidModeModModeline");
|
DEBUG_P("XF86VidModeModModeline");
|
||||||
|
|
||||||
ver = ClientMajorVersion(client);
|
ver = ClientMajorVersion(client);
|
||||||
|
@ -1006,6 +1018,10 @@ ProcVidModeSwitchMode(ClientPtr client)
|
||||||
|
|
||||||
REQUEST_SIZE_MATCH(xXF86VidModeSwitchModeReq);
|
REQUEST_SIZE_MATCH(xXF86VidModeSwitchModeReq);
|
||||||
|
|
||||||
|
/* limited to local-only connections */
|
||||||
|
if (!VidModeAllowNonLocal && !client->local)
|
||||||
|
return VidModeErrorBase + XF86VidModeClientNotLocal;
|
||||||
|
|
||||||
if (stuff->screen >= screenInfo.numScreens)
|
if (stuff->screen >= screenInfo.numScreens)
|
||||||
return BadValue;
|
return BadValue;
|
||||||
pScreen = screenInfo.screens[stuff->screen];
|
pScreen = screenInfo.screens[stuff->screen];
|
||||||
|
@ -1034,6 +1050,10 @@ ProcVidModeSwitchToMode(ClientPtr client)
|
||||||
|
|
||||||
DEBUG_P("XF86VidModeSwitchToMode");
|
DEBUG_P("XF86VidModeSwitchToMode");
|
||||||
|
|
||||||
|
/* limited to local-only connections */
|
||||||
|
if (!VidModeAllowNonLocal && !client->local)
|
||||||
|
return VidModeErrorBase + XF86VidModeClientNotLocal;
|
||||||
|
|
||||||
ver = ClientMajorVersion(client);
|
ver = ClientMajorVersion(client);
|
||||||
|
|
||||||
if (ver < 2) {
|
if (ver < 2) {
|
||||||
|
@ -1138,6 +1158,10 @@ ProcVidModeLockModeSwitch(ClientPtr client)
|
||||||
|
|
||||||
DEBUG_P("XF86VidModeLockModeSwitch");
|
DEBUG_P("XF86VidModeLockModeSwitch");
|
||||||
|
|
||||||
|
/* limited to local-only connections */
|
||||||
|
if (!VidModeAllowNonLocal && !client->local)
|
||||||
|
return VidModeErrorBase + XF86VidModeClientNotLocal;
|
||||||
|
|
||||||
if (stuff->screen >= screenInfo.numScreens)
|
if (stuff->screen >= screenInfo.numScreens)
|
||||||
return BadValue;
|
return BadValue;
|
||||||
pScreen = screenInfo.screens[stuff->screen];
|
pScreen = screenInfo.screens[stuff->screen];
|
||||||
|
@ -1301,6 +1325,10 @@ ProcVidModeSetViewPort(ClientPtr client)
|
||||||
|
|
||||||
REQUEST_SIZE_MATCH(xXF86VidModeSetViewPortReq);
|
REQUEST_SIZE_MATCH(xXF86VidModeSetViewPortReq);
|
||||||
|
|
||||||
|
/* limited to local-only connections */
|
||||||
|
if (!VidModeAllowNonLocal && !client->local)
|
||||||
|
return VidModeErrorBase + XF86VidModeClientNotLocal;
|
||||||
|
|
||||||
if (stuff->screen >= screenInfo.numScreens)
|
if (stuff->screen >= screenInfo.numScreens)
|
||||||
return BadValue;
|
return BadValue;
|
||||||
pScreen = screenInfo.screens[stuff->screen];
|
pScreen = screenInfo.screens[stuff->screen];
|
||||||
|
@ -1399,6 +1427,10 @@ ProcVidModeSetGamma(ClientPtr client)
|
||||||
|
|
||||||
REQUEST_SIZE_MATCH(xXF86VidModeSetGammaReq);
|
REQUEST_SIZE_MATCH(xXF86VidModeSetGammaReq);
|
||||||
|
|
||||||
|
/* limited to local-only connections */
|
||||||
|
if (!VidModeAllowNonLocal && !client->local)
|
||||||
|
return VidModeErrorBase + XF86VidModeClientNotLocal;
|
||||||
|
|
||||||
if (stuff->screen >= screenInfo.numScreens)
|
if (stuff->screen >= screenInfo.numScreens)
|
||||||
return BadValue;
|
return BadValue;
|
||||||
pScreen = screenInfo.screens[stuff->screen];
|
pScreen = screenInfo.screens[stuff->screen];
|
||||||
|
@ -1466,6 +1498,10 @@ ProcVidModeSetGammaRamp(ClientPtr client)
|
||||||
ScreenPtr pScreen;
|
ScreenPtr pScreen;
|
||||||
VidModePtr pVidMode;
|
VidModePtr pVidMode;
|
||||||
|
|
||||||
|
/* limited to local-only connections */
|
||||||
|
if (!VidModeAllowNonLocal && !client->local)
|
||||||
|
return VidModeErrorBase + XF86VidModeClientNotLocal;
|
||||||
|
|
||||||
REQUEST(xXF86VidModeSetGammaRampReq);
|
REQUEST(xXF86VidModeSetGammaRampReq);
|
||||||
REQUEST_AT_LEAST_SIZE(xXF86VidModeSetGammaRampReq);
|
REQUEST_AT_LEAST_SIZE(xXF86VidModeSetGammaRampReq);
|
||||||
|
|
||||||
|
@ -1673,9 +1709,6 @@ ProcVidModeDispatch(ClientPtr client)
|
||||||
return ProcVidModeGetGammaRampSize(client);
|
return ProcVidModeGetGammaRampSize(client);
|
||||||
case X_XF86VidModeGetPermissions:
|
case X_XF86VidModeGetPermissions:
|
||||||
return ProcVidModeGetPermissions(client);
|
return ProcVidModeGetPermissions(client);
|
||||||
default:
|
|
||||||
if (VidModeAllowNonLocal || client->local) {
|
|
||||||
switch (stuff->data) {
|
|
||||||
case X_XF86VidModeAddModeLine:
|
case X_XF86VidModeAddModeLine:
|
||||||
return ProcVidModeAddModeLine(client);
|
return ProcVidModeAddModeLine(client);
|
||||||
case X_XF86VidModeDeleteModeLine:
|
case X_XF86VidModeDeleteModeLine:
|
||||||
|
@ -1698,10 +1731,6 @@ ProcVidModeDispatch(ClientPtr client)
|
||||||
return BadRequest;
|
return BadRequest;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
|
||||||
return VidModeErrorBase + XF86VidModeClientNotLocal;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static int _X_COLD
|
static int _X_COLD
|
||||||
SProcVidModeGetModeLine(ClientPtr client)
|
SProcVidModeGetModeLine(ClientPtr client)
|
||||||
|
@ -2063,9 +2092,6 @@ SProcVidModeDispatch(ClientPtr client)
|
||||||
return SProcVidModeGetGammaRampSize(client);
|
return SProcVidModeGetGammaRampSize(client);
|
||||||
case X_XF86VidModeGetPermissions:
|
case X_XF86VidModeGetPermissions:
|
||||||
return SProcVidModeGetPermissions(client);
|
return SProcVidModeGetPermissions(client);
|
||||||
default:
|
|
||||||
if (VidModeAllowNonLocal || client->local) {
|
|
||||||
switch (stuff->data) {
|
|
||||||
case X_XF86VidModeAddModeLine:
|
case X_XF86VidModeAddModeLine:
|
||||||
return SProcVidModeAddModeLine(client);
|
return SProcVidModeAddModeLine(client);
|
||||||
case X_XF86VidModeDeleteModeLine:
|
case X_XF86VidModeDeleteModeLine:
|
||||||
|
@ -2088,10 +2114,6 @@ SProcVidModeDispatch(ClientPtr client)
|
||||||
return BadRequest;
|
return BadRequest;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
|
||||||
return VidModeErrorBase + XF86VidModeClientNotLocal;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
void
|
||||||
VidModeAddExtension(Bool allow_non_local)
|
VidModeAddExtension(Bool allow_non_local)
|
||||||
|
|
Loading…
Reference in New Issue