xkbcommon-features.h 7.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279
  1. /*
  2. * Copyright © 2026 Pierre Le Marre
  3. *
  4. * SPDX-License-Identifier: MIT
  5. *
  6. * Author: Pierre Le Marre <dev@wismill.eu>
  7. */
  8. #ifndef _XKBCOMMON_FEATURES_H_
  9. #define _XKBCOMMON_FEATURES_H_
  10. #include <stdint.h>
  11. #include <xkbcommon/xkbcommon.h>
  12. #ifdef __cplusplus
  13. extern "C" {
  14. #endif
  15. /**
  16. * @file
  17. * @brief Test features availability
  18. */
  19. /**
  20. * @defgroup test-api Features availability
  21. * Test features availability
  22. *
  23. * @{
  24. */
  25. /*
  26. * Numeric namespace for `xkb_feature` enumerators
  27. * ───────────────────────────────────────────────
  28. *
  29. * Values are opaque constants. The segmented decimal namespace is purely
  30. * organizational and is never meant to be parsed or decomposed at runtime.
  31. *
  32. * Values follow the pattern `AABCD`:
  33. *
  34. * | Numeric pattern | Segment | Description |
  35. * | --------------- | ---------- | ------------------------------------------------------------ |
  36. * | AA000 | Module | Top-level object; unallocated slots are independent spares |
  37. * | 00B00 | Sub-module | Functional category; primary slots at ×200, companions +100 |
  38. * | 000CD | Feature | Fine-grained index within a sub-module; related pairs at +20 |
  39. *
  40. * Current module assignments:
  41. *
  42. * Slot Module
  43. * ──────────────────────────
  44. * 0 Core / global
  45. * 1 Error
  46. * 2 (reserved for error or context-related object)
  47. * 3 Context
  48. * 4 (reserved for context-related object)
  49. * 5 Logging
  50. * 6-8 (reserved for logging or core keymap-related objects)
  51. * 9 Keysym
  52. * 10-17 (reserved for core keymap-related objects and keymap builders)
  53. * 18 RMLVO
  54. * 19-20 (reserved for core keymap-related objects and keymap builders)
  55. * 21 Keymap
  56. * 22-23 (reserved for keymap and state -related objects)
  57. * 24 Keyboard state components
  58. * 25 Keyboard state machine builder
  59. * 26 Keyboard state machine (reserved)
  60. * 27 Keyboard events / input
  61. * 28-29 (spare)
  62. * 30 Compose table
  63. * 31 Compose state
  64. * 32 (spare)
  65. *
  66. * Cross sub-modules:
  67. *
  68. * Slot Sub-module
  69. * ──────────────────────────
  70. * 0 General / components / properties
  71. * 100 General / components / properties
  72. * 200 Creation / parsing
  73. * 300 Update
  74. * 400 Serialization
  75. * 500 (spare / module-specific)
  76. * 600 Iterator
  77. * 700 (spare / module-specific)
  78. * 800 Query
  79. * 900 (spare / module-specific)
  80. *
  81. * The current values are meant to leave enough room for future additions.
  82. */
  83. /**
  84. * @enum xkb_feature
  85. *
  86. * Enumerate all the features testable with `xkb_feature_supported()`.
  87. *
  88. * @since 1.14.0
  89. */
  90. enum xkb_feature {
  91. /**
  92. * The enumeration @ref xkb_feature
  93. *
  94. * @since 1.14.0
  95. */
  96. XKB_FEATURE_ENUM_FEATURE = 1,
  97. /**
  98. * The enumeration @ref xkb_error_code
  99. *
  100. * @since 1.14.0
  101. */
  102. XKB_FEATURE_ENUM_ERROR_CODE = 1000,
  103. /**
  104. * The enumeration @ref xkb_context_flags
  105. *
  106. * @since 1.14.0
  107. */
  108. XKB_FEATURE_ENUM_CONTEXT_FLAGS = 3200,
  109. /**
  110. * The enumeration @ref xkb_log_level
  111. *
  112. * @since 1.14.0
  113. */
  114. XKB_FEATURE_ENUM_LOG_LEVEL = 5100,
  115. /**
  116. * The enumeration @ref xkb_keysym_flags
  117. *
  118. * @since 1.14.0
  119. */
  120. XKB_FEATURE_ENUM_KEYSYM_FLAGS = 9200,
  121. /**
  122. * The enumeration @ref xkb_rmlvo_builder_flags
  123. *
  124. * @since 1.14.0
  125. */
  126. XKB_FEATURE_ENUM_RMLVO_BUILDER_FLAGS = 18200,
  127. /**
  128. * The enumeration @ref xkb_keymap_format
  129. *
  130. * @since 1.14.0
  131. */
  132. XKB_FEATURE_ENUM_KEYMAP_FORMAT = 21000,
  133. /**
  134. * The enumeration @ref xkb_keymap_compile_flags
  135. *
  136. * @since 1.14.0
  137. */
  138. XKB_FEATURE_ENUM_KEYMAP_COMPILE_FLAGS = 21200,
  139. /**
  140. * The enumeration @ref xkb_keymap_serialize_flags
  141. *
  142. * @since 1.14.0
  143. */
  144. XKB_FEATURE_ENUM_KEYMAP_SERIALIZE_FLAGS = 21400,
  145. /**
  146. * The enumeration @ref xkb_keymap_key_iterator_flags
  147. *
  148. * @since 1.14.0
  149. */
  150. XKB_FEATURE_ENUM_KEYMAP_KEY_ITERATOR_FLAGS = 21600,
  151. /**
  152. * The enumeration @ref xkb_state_component
  153. *
  154. * @since 1.14.0
  155. */
  156. XKB_FEATURE_ENUM_STATE_COMPONENT = 24000,
  157. /**
  158. * The enumeration @ref xkb_layout_out_of_range_policy
  159. *
  160. * @since 1.14.0
  161. */
  162. XKB_FEATURE_ENUM_LAYOUT_OUT_OF_RANGE_POLICY = 24020,
  163. /**
  164. * The enumeration @ref xkb_a11y_flags
  165. *
  166. * @since 1.14.0
  167. */
  168. XKB_FEATURE_ENUM_A11Y_FLAGS = 24040,
  169. /**
  170. * The enumeration @ref xkb_keyboard_control_flags
  171. *
  172. * @since 1.14.0
  173. */
  174. XKB_FEATURE_ENUM_KEYBOARD_CONTROL_FLAGS = 24060,
  175. /**
  176. * The enumeration @ref xkb_state_mode
  177. *
  178. * @since 1.14.0
  179. */
  180. XKB_FEATURE_ENUM_STATE_MODE = 24200,
  181. /**
  182. * The enumeration @ref xkb_state_match
  183. *
  184. * @since 1.14.0
  185. */
  186. XKB_FEATURE_ENUM_STATE_MATCH = 24820,
  187. /**
  188. * The enumeration @ref xkb_consumed_mode
  189. *
  190. * @since 1.14.0
  191. */
  192. XKB_FEATURE_ENUM_CONSUMED_MODE = 24840,
  193. /**
  194. * The enumeration @ref xkb_machine_builder_flags
  195. *
  196. * @since 1.14.0
  197. */
  198. XKB_FEATURE_ENUM_MACHINE_BUILDER_FLAGS = 25200,
  199. /**
  200. * The enumeration @ref xkb_event_type
  201. *
  202. * @since 1.14.0
  203. */
  204. XKB_FEATURE_ENUM_EVENT_TYPE = 27000,
  205. /**
  206. * The enumeration @ref xkb_key_direction
  207. *
  208. * @since 1.14.0
  209. */
  210. XKB_FEATURE_ENUM_KEY_DIRECTION = 27020,
  211. /**
  212. * The enumeration @ref xkb_events_flags
  213. *
  214. * @since 1.14.0
  215. */
  216. XKB_FEATURE_ENUM_EVENTS_FLAGS = 27600,
  217. /**
  218. * The enumeration @ref xkb_compose_format
  219. *
  220. * @since 1.14.0
  221. */
  222. XKB_FEATURE_ENUM_COMPOSE_FORMAT = 30000,
  223. /**
  224. * The enumeration @ref xkb_compose_compile_flags
  225. *
  226. * @since 1.14.0
  227. */
  228. XKB_FEATURE_ENUM_COMPOSE_COMPILE_FLAGS = 30200,
  229. /**
  230. * The enumeration @ref xkb_compose_status
  231. *
  232. * @since 1.14.0
  233. */
  234. XKB_FEATURE_ENUM_COMPOSE_STATUS = 31000,
  235. /**
  236. * The enumeration @ref xkb_compose_state_flags
  237. *
  238. * @since 1.14.0
  239. */
  240. XKB_FEATURE_ENUM_COMPOSE_STATE_FLAGS = 31200,
  241. /**
  242. * The enumeration @ref xkb_compose_feed_result
  243. *
  244. * @since 1.14.0
  245. */
  246. XKB_FEATURE_ENUM_COMPOSE_FEED_RESULT = 31300,
  247. };
  248. /**
  249. * Test feature support.
  250. *
  251. * This is useful when the library is dynamically linked.
  252. *
  253. * @param feature The [feature](@ref xkb_feature) to check
  254. * @param value The value to check. Ignored if @p feature does not use
  255. * a value parameter; refer to the feature’s description.
  256. *
  257. * @returns `true` if the feature is supported, `false` otherwise.
  258. *
  259. * @since 1.14.0
  260. */
  261. XKB_EXPORT bool
  262. xkb_feature_supported(enum xkb_feature feature, uint32_t value);
  263. /** @} */
  264. #ifdef __cplusplus
  265. } /* extern "C" */
  266. #endif
  267. #endif /* _XKBCOMMON_FEATURES_H_ */