[PATCH kbproto 2/5] Convert mask specifications to (next - 1) scheme
Mark Kettenis
mark.kettenis at xs4all.nl
Sat Feb 6 05:20:39 PST 2010
> From: Dirk Wallenstein <halsmit at t-online.de>
> Date: Fri, 5 Feb 2010 20:42:44 +0100
>
> This makes editing flags less error-prone.
But this doesn't work if the mask doesn't start with bit 0.
Oh, and it changes the type of the constants too.
I don't think this is a good idea.
> Signed-off-by: Dirk Wallenstein <halsmit at t-online.de>
> ---
> XKB.h | 34 +++++++++++++++++-----------------
> XKBgeom.h | 2 +-
> XKBproto.h | 2 +-
> 3 files changed, 19 insertions(+), 19 deletions(-)
>
> diff --git a/XKB.h b/XKB.h
> index a3b3bc0..e36921b 100644
> --- a/XKB.h
> +++ b/XKB.h
> @@ -104,7 +104,7 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE.
> #define XkbActionMessageMask (1L << 9)
> #define XkbAccessXNotifyMask (1L << 10)
> #define XkbExtensionDeviceNotifyMask (1L << 11)
> -#define XkbAllEventsMask (0xFFF)
> +#define XkbAllEventsMask ((1L << 12)-1)
>
> /*
> * NewKeyboardNotify event details:
> @@ -112,7 +112,7 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE.
> #define XkbNKN_KeycodesMask (1L << 0)
> #define XkbNKN_GeometryMask (1L << 1)
> #define XkbNKN_DeviceIDMask (1L << 2)
> -#define XkbAllNewKeyboardEventsMask (0x7)
> +#define XkbAllNewKeyboardEventsMask ((1L << 3)-1)
>
> /*
> * AccessXNotify event types:
> @@ -139,7 +139,7 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE.
> #define XkbAXN_BKAcceptMask (1L << 4)
> #define XkbAXN_BKRejectMask (1L << 5)
> #define XkbAXN_AXKWarningMask (1L << 6)
> -#define XkbAllAccessXEventsMask (0x7f)
> +#define XkbAllAccessXEventsMask ((1L << 7)-1)
>
> /*
> * Miscellaneous event details:
> @@ -186,7 +186,7 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE.
> #define XkbNamesMask (1L << 4)
> #define XkbGeometryMask (1L << 5)
> #define XkbControlsMask (1L << 6)
> -#define XkbAllComponentsMask (0x7f)
> +#define XkbAllComponentsMask ((1L << 7)-1)
>
> /*
> * State detail mask:
> @@ -209,7 +209,7 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE.
> #define XkbLookupModsMask (1L << 11)
> #define XkbCompatLookupModsMask (1L << 12)
> #define XkbPointerButtonMask (1L << 13)
> -#define XkbAllStateComponentsMask (0x3fff)
> +#define XkbAllStateComponentsMask ((1L << 14)-1)
>
> /*
> * Controls detail masks:
> @@ -252,6 +252,7 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE.
> #define XkbOverlay1Mask (1L << 10)
> #define XkbOverlay2Mask (1L << 11)
> #define XkbIgnoreGroupLockMask (1L << 12)
> +#define XkbAllBooleanCtrlsMask ((1L << 13)-1)
> #define XkbGroupsWrapMask (1L << 27)
> #define XkbInternalModsMask (1L << 28)
> #define XkbIgnoreLockModsMask (1L << 29)
> @@ -260,8 +261,7 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE.
>
> #define XkbAccessXOptionsMask (XkbStickyKeysMask|XkbAccessXFeedbackMask)
>
> -#define XkbAllBooleanCtrlsMask (0x00001FFF)
> -#define XkbAllControlsMask (0xF8001FFF)
> +#define XkbAllControlsMask (0xF8000000|XkbAllBooleanCtrlsMask)
> #define XkbAllControlEventsMask XkbAllControlsMask
>
> /*
> @@ -285,9 +285,9 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE.
> #define XkbAX_SKRejectFBMask (1L << 9)
> #define XkbAX_BKRejectFBMask (1L << 10)
> #define XkbAX_DumbBellFBMask (1L << 11)
> +#define XkbAX_AllOptionsMask ((1L << 12)-1)
> #define XkbAX_FBOptionsMask (0xF3F)
> #define XkbAX_SKOptionsMask (0x0C0)
> -#define XkbAX_AllOptionsMask (0xFFF)
>
> /*
> * XkbUseCoreKbd is used to specify the core keyboard without having
> @@ -368,8 +368,8 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE.
> #define XkbGroup2Mask (1<<1)
> #define XkbGroup3Mask (1<<2)
> #define XkbGroup4Mask (1<<3)
> +#define XkbAllGroupsMask ((1<<4)-1)
> #define XkbAnyGroupMask (1<<7)
> -#define XkbAllGroupsMask (0xf)
>
> /*
> * BuildCoreState: Given a keyboard group and a modifier state,
> @@ -586,7 +586,7 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE.
> #define XkbTwoLevelMask (1<<1)
> #define XkbAlphabeticMask (1<<2)
> #define XkbKeypadMask (1<<3)
> -#define XkbAllRequiredTypes (0xf)
> +#define XkbAllRequiredTypes ((1<<4)-1)
>
> #define XkbShiftLevel(n) ((n)-1)
> #define XkbShiftLevelMask(n) (1<<((n)-1))
> @@ -613,7 +613,7 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE.
> #define XkbExplicitAutoRepeatMask (1<<5)
> #define XkbExplicitBehaviorMask (1<<6)
> #define XkbExplicitVModMapMask (1<<7)
> -#define XkbAllExplicitMask (0xff)
> +#define XkbAllExplicitMask ((1<<8)-1)
>
> /*
> * Map components masks:
> @@ -691,7 +691,7 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE.
> */
> #define XkbSymInterpMask (1<<0)
> #define XkbGroupCompatMask (1<<1)
> -#define XkbAllCompatMask (0x3)
> +#define XkbAllCompatMask ((1<<2)-1)
>
> /*
> * Names component mask:
> @@ -706,6 +706,7 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE.
> #define XkbPhysSymbolsNameMask (1<<3)
> #define XkbTypesNameMask (1<<4)
> #define XkbCompatNameMask (1<<5)
> +#define XkbComponentNamesMask ((1<<6)-1)
> #define XkbKeyTypeNamesMask (1<<6)
> #define XkbKTLevelNamesMask (1<<7)
> #define XkbIndicatorNamesMask (1<<8)
> @@ -714,8 +715,7 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE.
> #define XkbVirtualModNamesMask (1<<11)
> #define XkbGroupNamesMask (1<<12)
> #define XkbRGNamesMask (1<<13)
> -#define XkbComponentNamesMask (0x3f)
> -#define XkbAllNamesMask (0x3fff)
> +#define XkbAllNamesMask ((1<<14)-1)
>
> /*
> * GetByName components:
> @@ -731,7 +731,7 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE.
> #define XkbGBN_KeyNamesMask (1L << 5)
> #define XkbGBN_GeometryMask (1L << 6)
> #define XkbGBN_OtherNamesMask (1L << 7)
> -#define XkbGBN_AllComponentsMask (0xff)
> +#define XkbGBN_AllComponentsMask ((1L << 8)-1)
>
> /*
> * ListComponents flags
> @@ -762,8 +762,8 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE.
> #define XkbXI_IndicatorNamesMask (1L << 2)
> #define XkbXI_IndicatorMapsMask (1L << 3)
> #define XkbXI_IndicatorStateMask (1L << 4)
> +#define XkbXI_AllFeaturesMask ((1L << 5)-1)
> #define XkbXI_UnsupportedFeatureMask (1L << 15)
> -#define XkbXI_AllFeaturesMask (0x001f)
> #define XkbXI_AllDeviceFeaturesMask (0x001e)
>
> #define XkbXI_IndicatorsMask (0x001c)
> @@ -778,7 +778,7 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE.
> #define XkbPCF_AutoResetControlsMask (1L << 2)
> #define XkbPCF_LookupStateWhenGrabbed (1L << 3)
> #define XkbPCF_SendEventUsesXKBState (1L << 4)
> -#define XkbPCF_AllFlagsMask (0x1F)
> +#define XkbPCF_AllFlagsMask ((1L << 5)-1)
>
> /*
> * Debugging flags and controls
> diff --git a/XKBgeom.h b/XKBgeom.h
> index 89f902f..7c36146 100644
> --- a/XKBgeom.h
> +++ b/XKBgeom.h
> @@ -303,7 +303,7 @@ typedef struct _XkbGeometry {
> #define XkbGeomSectionsMask (1<<3)
> #define XkbGeomDoodadsMask (1<<4)
> #define XkbGeomKeyAliasesMask (1<<5)
> -#define XkbGeomAllMask (0x3f)
> +#define XkbGeomAllMask ((1<<6)-1)
>
> typedef struct _XkbGeometrySizes {
> unsigned int which;
> diff --git a/XKBproto.h b/XKBproto.h
> index 97dd4d2..8bd21ef 100644
> --- a/XKBproto.h
> +++ b/XKBproto.h
> @@ -356,7 +356,7 @@ typedef struct _xkbGetMapReply {
>
> #define XkbSetMapResizeTypes (1L<<0)
> #define XkbSetMapRecomputeActions (1L<<1)
> -#define XkbSetMapAllFlags (0x3)
> +#define XkbSetMapAllFlags ((1L<<2)-1)
>
> typedef struct _xkbSetMap {
> CARD8 reqType;
> --
> 1.6.5.3
>
> _______________________________________________
> xorg-devel mailing list
> xorg-devel at lists.x.org
> http://lists.x.org/mailman/listinfo/xorg-devel
>
More information about the xorg-devel
mailing list