[xkbcommon] Make C++ happy.

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


On Tue, Sep 24, 2013 at 08:26:27PM -0300, Wander Lairson Costa wrote:
> C++ has a stronger type system than C and will not implicitly convert
> int's to enum's. If we do not want to give any flags to xkb_context_new,
> we must pass 0 as its argument.
> 
> Therefore, we create a valid xkb_context_flags enum 0 value to avoid ugly
> casts in C++.

That makes sense. But for consistency sake we had better add those to
the other enum flags as well. The enum xkb_keymap_compile_flags already
has a placeholder value set to 0, but we can't remove it, so lets add
an alias there too.

Ran

> 
> Signed-off-by: Wander Lairson Costa <wander.lairson at gmail.com>
> ---
>  xkbcommon/xkbcommon.h | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/xkbcommon/xkbcommon.h b/xkbcommon/xkbcommon.h
> index 1480b1b..e6e14bd 100644
> --- a/xkbcommon/xkbcommon.h
> +++ b/xkbcommon/xkbcommon.h
> @@ -425,6 +425,8 @@ xkb_keysym_to_utf32(xkb_keysym_t keysym);
>  
>  /** Flags for context creation. */
>  enum xkb_context_flags {
> +    /** Do not apply any context flags. */
> +    XKB_CONTEXT_NO_FLAG = 0,
>      /** Create this context with an empty include path. */
>      XKB_CONTEXT_NO_DEFAULT_INCLUDES = (1 << 0),
>      /** Don't take RMLVO names from the environment. */
> -- 
> 1.8.1.2
> 
> _______________________________________________
> wayland-devel mailing list
> wayland-devel at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/wayland-devel


More information about the wayland-devel mailing list