[Xcb] [PATCH 2/1] XKB: Rewrite AXOption

Ran Benita ran234 at gmail.com
Wed Sep 25 11:42:11 PDT 2013


On Tue, Sep 24, 2013 at 09:59:30AM -0400, Peter Harris wrote:
> AXOption can be an <enum> instead of a <union>, which is a much simpler
> construct.
> 
> Signed-off-by: Peter Harris <pharris at opentext.com>
> ---
> 
> AXOption was only ever a <union> in the first place due to a typo in an
> <enum>.
> 
> I'd really like to see this patch go in, because <union> is a terrible
> construct. That said, I am aware that this change will break anybody
> using this particular piece of (unofficial) API. Comments welcome.

The current code just follows the spec literally, but I agree with the
sentiment, and X11/extensions/XKB.h does the same (though it does
provice a mask to separate them). So maybe add small comment? Anyway,

Reviewed-By: Ran Benita <ran234 at gmail.com>

(For both patches - first one should definitely go in).

> 
>  src/xkb.xml |   26 +++++++++-----------------
>  1 file changed, 9 insertions(+), 17 deletions(-)
> 
> diff --git a/src/xkb.xml b/src/xkb.xml
> index 9d3a540..25c9e79 100644
> --- a/src/xkb.xml
> +++ b/src/xkb.xml
> @@ -130,29 +130,21 @@ authorization from the authors.
>  		<item name="ControlsEnabled"> <bit>31</bit> </item>
>  	</enum>
>  
> -	<enum name="AXFBOpt">
> +	<enum name="AXOption">
>  		<item name="SKPressFB">     <bit>0</bit> </item>
>  		<item name="SKAcceptFB">    <bit>1</bit> </item>
>  		<item name="FeatureFB">     <bit>2</bit> </item>
>  		<item name="SlowWarnFB">    <bit>3</bit> </item>
>  		<item name="IndicatorFB">   <bit>4</bit> </item>
>  		<item name="StickyKeysFB">  <bit>5</bit> </item>
> +		<item name="TwoKeys">       <bit>6</bit> </item>
> +		<item name="LatchToLock">   <bit>7</bit> </item>
>  		<item name="SKReleaseFB">   <bit>8</bit> </item>
>  		<item name="SKRejectFB">    <bit>9</bit> </item>
>  		<item name="BKRejectFB">    <bit>10</bit> </item>
>  		<item name="DumbBell">      <bit>11</bit> </item>
>  	</enum>
>  
> -	<enum name="AXSKOpt">
> -		<item name="TwoKeys">     <bit>6</bit> </item>
> -		<item name="LatchToLock"> <bit>7</bit> </item>
> -	</enum>
> -
> -	<union name="AXOption">
> -		<field name="fbopt" type="CARD16" enum="AXFBOpt" />
> -		<field name="skopt" type="CARD16" enum="AXSKOpt" />
> -	</union>
> -
>  	<typedef oldname="CARD16" newname="DeviceSpec" />
>  
>  	<enum name="LedClassResult">
> @@ -1227,10 +1219,10 @@ authorization from the authors.
>  			<field name="mouseKeysTimeToMax" type="CARD16" />
>  			<field name="mouseKeysMaxSpeed" type="CARD16" />
>  			<field name="mouseKeysCurve" type="INT16" />
> -			<field name="accessXOption" type="AXOption" />
> +			<field name="accessXOption" type="CARD16" mask="AXOption" />
>  			<field name="accessXTimeout" type="CARD16" />
> -			<field name="accessXTimeoutOptionsMask" type="AXOption" />
> -			<field name="accessXTimeoutOptionsValues" type="AXOption" />
> +			<field name="accessXTimeoutOptionsMask" type="CARD16" mask="AXOption" />
> +			<field name="accessXTimeoutOptionsValues" type="CARD16" mask="AXOption" />
>  			<pad bytes="2" />
>  			<field name="accessXTimeoutMask" type="CARD32" mask="BoolCtrl" />
>  			<field name="accessXTimeoutValues" type="CARD32" mask="BoolCtrl" />
> @@ -1253,7 +1245,7 @@ authorization from the authors.
>  		<field name="ignoreLockVirtualMods" type="CARD16" mask="VMod" />
>  		<field name="mouseKeysDfltBtn" type="CARD8" />
>  		<field name="groupsWrap" type="CARD8" />
> -		<field name="accessXOptions" type="AXOption" />
> +		<field name="accessXOptions" type="CARD16" mask="AXOption" />
>  		<pad bytes="2" />
>  		<field name="affectEnabledControls" type="CARD32" mask="BoolCtrl" />
>  		<field name="enabledControls" type="CARD32" mask="BoolCtrl" />
> @@ -1270,8 +1262,8 @@ authorization from the authors.
>  		<field name="accessXTimeout" type="CARD16" />
>  		<field name="accessXTimeoutMask" type="CARD32" mask="BoolCtrl" />
>  		<field name="accessXTimeoutValues" type="CARD32" mask="BoolCtrl" />
> -		<field name="accessXTimeoutOptionsMask" type="AXOption" />
> -		<field name="accessXTimeoutOptionsValues" type="AXOption" />
> +		<field name="accessXTimeoutOptionsMask" type="CARD16" mask="AXOption" />
> +		<field name="accessXTimeoutOptionsValues" type="CARD16" mask="AXOption" />
>  		<list name="perKeyRepeat" type="CARD8">
>  			<value>32</value>
>  		</list>
> -- 
> 1.7.10.4
> 
> _______________________________________________
> Xcb mailing list
> Xcb at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/xcb


More information about the Xcb mailing list