(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
							
								
									223b3be7c8
								
							
						
					
					
						commit
						4c0b262c6c
					
				|  | @ -449,6 +449,10 @@ ProcVidModeAddModeLine(ClientPtr client) | |||
|     int dotClock; | ||||
|     int ver; | ||||
| 
 | ||||
|     /* limited to local-only connections */ | ||||
|     if (!VidModeAllowNonLocal && !client->local) | ||||
|         return VidModeErrorBase + XF86VidModeClientNotLocal; | ||||
| 
 | ||||
|     DEBUG_P("XF86VidModeAddModeline"); | ||||
| 
 | ||||
|     ver = ClientMajorVersion(client); | ||||
|  | @ -619,6 +623,10 @@ ProcVidModeDeleteModeLine(ClientPtr client) | |||
|     int len, dotClock; | ||||
|     int ver; | ||||
| 
 | ||||
|     /* limited to local-only connections */ | ||||
|     if (!VidModeAllowNonLocal && !client->local) | ||||
|         return VidModeErrorBase + XF86VidModeClientNotLocal; | ||||
| 
 | ||||
|     DEBUG_P("XF86VidModeDeleteModeline"); | ||||
| 
 | ||||
|     ver = ClientMajorVersion(client); | ||||
|  | @ -743,6 +751,10 @@ ProcVidModeModModeLine(ClientPtr client) | |||
|     int len, dotClock; | ||||
|     int ver; | ||||
| 
 | ||||
|     /* limited to local-only connections */ | ||||
|     if (!VidModeAllowNonLocal && !client->local) | ||||
|         return VidModeErrorBase + XF86VidModeClientNotLocal; | ||||
| 
 | ||||
|     DEBUG_P("XF86VidModeModModeline"); | ||||
| 
 | ||||
|     ver = ClientMajorVersion(client); | ||||
|  | @ -1004,6 +1016,10 @@ ProcVidModeSwitchMode(ClientPtr client) | |||
| 
 | ||||
|     REQUEST_SIZE_MATCH(xXF86VidModeSwitchModeReq); | ||||
| 
 | ||||
|     /* limited to local-only connections */ | ||||
|     if (!VidModeAllowNonLocal && !client->local) | ||||
|         return VidModeErrorBase + XF86VidModeClientNotLocal; | ||||
| 
 | ||||
|     if (stuff->screen >= screenInfo.numScreens) | ||||
|         return BadValue; | ||||
|     pScreen = screenInfo.screens[stuff->screen]; | ||||
|  | @ -1032,6 +1048,10 @@ ProcVidModeSwitchToMode(ClientPtr client) | |||
| 
 | ||||
|     DEBUG_P("XF86VidModeSwitchToMode"); | ||||
| 
 | ||||
|     /* limited to local-only connections */ | ||||
|     if (!VidModeAllowNonLocal && !client->local) | ||||
|         return VidModeErrorBase + XF86VidModeClientNotLocal; | ||||
| 
 | ||||
|     ver = ClientMajorVersion(client); | ||||
| 
 | ||||
|     if (ver < 2) { | ||||
|  | @ -1136,6 +1156,10 @@ ProcVidModeLockModeSwitch(ClientPtr client) | |||
| 
 | ||||
|     DEBUG_P("XF86VidModeLockModeSwitch"); | ||||
| 
 | ||||
|     /* limited to local-only connections */ | ||||
|     if (!VidModeAllowNonLocal && !client->local) | ||||
|         return VidModeErrorBase + XF86VidModeClientNotLocal; | ||||
| 
 | ||||
|     if (stuff->screen >= screenInfo.numScreens) | ||||
|         return BadValue; | ||||
|     pScreen = screenInfo.screens[stuff->screen]; | ||||
|  | @ -1299,6 +1323,10 @@ ProcVidModeSetViewPort(ClientPtr client) | |||
| 
 | ||||
|     REQUEST_SIZE_MATCH(xXF86VidModeSetViewPortReq); | ||||
| 
 | ||||
|     /* limited to local-only connections */ | ||||
|     if (!VidModeAllowNonLocal && !client->local) | ||||
|         return VidModeErrorBase + XF86VidModeClientNotLocal; | ||||
| 
 | ||||
|     if (stuff->screen >= screenInfo.numScreens) | ||||
|         return BadValue; | ||||
|     pScreen = screenInfo.screens[stuff->screen]; | ||||
|  | @ -1397,6 +1425,10 @@ ProcVidModeSetGamma(ClientPtr client) | |||
| 
 | ||||
|     REQUEST_SIZE_MATCH(xXF86VidModeSetGammaReq); | ||||
| 
 | ||||
|     /* limited to local-only connections */ | ||||
|     if (!VidModeAllowNonLocal && !client->local) | ||||
|         return VidModeErrorBase + XF86VidModeClientNotLocal; | ||||
| 
 | ||||
|     if (stuff->screen >= screenInfo.numScreens) | ||||
|         return BadValue; | ||||
|     pScreen = screenInfo.screens[stuff->screen]; | ||||
|  | @ -1464,6 +1496,10 @@ ProcVidModeSetGammaRamp(ClientPtr client) | |||
|     ScreenPtr pScreen; | ||||
|     VidModePtr pVidMode; | ||||
| 
 | ||||
|     /* limited to local-only connections */ | ||||
|     if (!VidModeAllowNonLocal && !client->local) | ||||
|         return VidModeErrorBase + XF86VidModeClientNotLocal; | ||||
| 
 | ||||
|     REQUEST(xXF86VidModeSetGammaRampReq); | ||||
|     REQUEST_AT_LEAST_SIZE(xXF86VidModeSetGammaRampReq); | ||||
| 
 | ||||
|  | @ -1671,9 +1707,6 @@ ProcVidModeDispatch(ClientPtr client) | |||
|         return ProcVidModeGetGammaRampSize(client); | ||||
|     case X_XF86VidModeGetPermissions: | ||||
|         return ProcVidModeGetPermissions(client); | ||||
|     default: | ||||
|         if (VidModeAllowNonLocal || client->local) { | ||||
|             switch (stuff->data) { | ||||
|     case X_XF86VidModeAddModeLine: | ||||
|         return ProcVidModeAddModeLine(client); | ||||
|     case X_XF86VidModeDeleteModeLine: | ||||
|  | @ -1696,10 +1729,6 @@ ProcVidModeDispatch(ClientPtr client) | |||
|         return BadRequest; | ||||
|     } | ||||
| } | ||||
|         else | ||||
|             return VidModeErrorBase + XF86VidModeClientNotLocal; | ||||
|     } | ||||
| } | ||||
| 
 | ||||
| static int _X_COLD | ||||
| SProcVidModeGetModeLine(ClientPtr client) | ||||
|  | @ -2061,9 +2090,6 @@ SProcVidModeDispatch(ClientPtr client) | |||
|         return SProcVidModeGetGammaRampSize(client); | ||||
|     case X_XF86VidModeGetPermissions: | ||||
|         return SProcVidModeGetPermissions(client); | ||||
|     default: | ||||
|         if (VidModeAllowNonLocal || client->local) { | ||||
|             switch (stuff->data) { | ||||
|     case X_XF86VidModeAddModeLine: | ||||
|         return SProcVidModeAddModeLine(client); | ||||
|     case X_XF86VidModeDeleteModeLine: | ||||
|  | @ -2086,10 +2112,6 @@ SProcVidModeDispatch(ClientPtr client) | |||
|         return BadRequest; | ||||
|     } | ||||
| } | ||||
|         else | ||||
|             return VidModeErrorBase + XF86VidModeClientNotLocal; | ||||
|     } | ||||
| } | ||||
| 
 | ||||
| void | ||||
| VidModeAddExtension(Bool allow_non_local) | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue