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
aa9a93461d
commit
4137323e87
|
@ -447,6 +447,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);
|
||||||
|
@ -617,6 +621,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);
|
||||||
|
@ -741,6 +749,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);
|
||||||
|
@ -1008,6 +1020,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];
|
||||||
|
@ -1036,6 +1052,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) {
|
||||||
|
@ -1140,6 +1160,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];
|
||||||
|
@ -1303,6 +1327,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];
|
||||||
|
@ -1401,6 +1429,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];
|
||||||
|
@ -1468,6 +1500,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);
|
||||||
|
|
||||||
|
@ -1675,9 +1711,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:
|
||||||
|
@ -1700,10 +1733,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)
|
||||||
|
@ -2065,9 +2094,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:
|
||||||
|
@ -2090,10 +2116,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