api: deprecate XKB_MAP_COMPILE_PLACEHOLDER, and use KEYMAP instead of MAP
authorRan Benita <ran234@gmail.com>
Sat, 8 Feb 2014 14:40:20 +0000 (16:40 +0200)
committerRan Benita <ran234@gmail.com>
Sat, 8 Feb 2014 14:40:20 +0000 (16:40 +0200)
The PLACEHOLDER was not meant to be used, but c++ doesn't like passing 0
to enums, so it was used. For this reason we add all the NO_FLAGS items,
so the PLACEHOLDER shouldn't be used anymore.

Second, XKB_MAP is the prefix we used ages ago, KEYMAP is the expected
prefix here. So deprecate that as well.

The old names may still be used through the xkbcommon-compat.h header,
which is included by default (no need to include directly).

Signed-off-by: Ran Benita <ran234@gmail.com>
src/keymap.c
src/x11/keymap.c
test/x11.c
xkbcommon/xkbcommon-compat.h
xkbcommon/xkbcommon.h

index 0830cc1..abf1387 100644 (file)
@@ -132,7 +132,7 @@ xkb_keymap_new_from_names(struct xkb_context *ctx,
         return NULL;
     }
 
-    if (flags & ~(XKB_MAP_COMPILE_PLACEHOLDER)) {
+    if (flags & ~(XKB_KEYMAP_COMPILE_NO_FLAGS)) {
         log_err_func(ctx, "unrecognized flags: %#x\n", flags);
         return NULL;
     }
@@ -193,7 +193,7 @@ xkb_keymap_new_from_buffer(struct xkb_context *ctx,
         return NULL;
     }
 
-    if (flags & ~(XKB_MAP_COMPILE_PLACEHOLDER)) {
+    if (flags & ~(XKB_KEYMAP_COMPILE_NO_FLAGS)) {
         log_err_func(ctx, "unrecognized flags: %#x\n", flags);
         return NULL;
     }
@@ -230,7 +230,7 @@ xkb_keymap_new_from_file(struct xkb_context *ctx,
         return NULL;
     }
 
-    if (flags & ~(XKB_MAP_COMPILE_PLACEHOLDER)) {
+    if (flags & ~(XKB_KEYMAP_COMPILE_NO_FLAGS)) {
         log_err_func(ctx, "unrecognized flags: %#x\n", flags);
         return NULL;
     }
index fd05fab..aa91033 100644 (file)
@@ -1125,7 +1125,7 @@ xkb_x11_keymap_new_from_device(struct xkb_context *ctx,
     struct xkb_keymap *keymap;
     const enum xkb_keymap_format format = XKB_KEYMAP_FORMAT_TEXT_V1;
 
-    if (flags & ~(XKB_MAP_COMPILE_PLACEHOLDER)) {
+    if (flags & ~(XKB_KEYMAP_COMPILE_NO_FLAGS)) {
         log_err_func(ctx, "unrecognized flags: %#x\n", flags);
         return NULL;
     }
index f16dded..232e136 100644 (file)
@@ -56,7 +56,7 @@ main(void)
     assert(device_id != -1);
 
     keymap = xkb_x11_keymap_new_from_device(ctx, conn, device_id,
-                                            XKB_MAP_COMPILE_NO_FLAGS);
+                                            XKB_KEYMAP_COMPILE_NO_FLAGS);
     assert(keymap);
 
     state = xkb_x11_state_new_from_device(keymap, conn, device_id);
index f96e4c8..299732f 100644 (file)
@@ -91,4 +91,8 @@
 
 #define xkb_state_get_map(state) xkb_state_get_keymap(state)
 
+/* Not needed anymore, since there's NO_FLAGS. */
+#define XKB_MAP_COMPILE_PLACEHOLDER XKB_KEYMAP_COMPILE_NO_FLAGS
+#define XKB_MAP_COMPILE_NO_FLAGS XKB_KEYMAP_COMPILE_NO_FLAGS
+
 #endif
index cc9262f..1e6c803 100644 (file)
@@ -681,9 +681,7 @@ xkb_context_set_log_fn(struct xkb_context *context,
 /** Flags for keymap compilation. */
 enum xkb_keymap_compile_flags {
     /** Do not apply any flags. */
-    XKB_MAP_COMPILE_NO_FLAGS = 0,
-    /** Apparently you can't have empty enums.  What a drag. */
-    XKB_MAP_COMPILE_PLACEHOLDER = 0
+    XKB_KEYMAP_COMPILE_NO_FLAGS = 0
 };
 
 /**