[xkbcommon] Make C++ happy.

Wander Lairson Costa wander.lairson at gmail.com
Tue Sep 24 16:26:27 PDT 2013


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++.

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



More information about the wayland-devel mailing list