Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions include/xkbcommon/xkbcommon.h
Original file line number Diff line number Diff line change
Expand Up @@ -313,6 +313,16 @@ typedef uint32_t xkb_led_mask_t;
*/
#define xkb_keycode_is_legal_x11(key) ((key) >= 8 && (key) <= 255)

/**
* Get the version of libxkbcommon in use.
*
* @returns a triplet representing MAJOR.MINOR.PATCH library version.
*
* @since 1.14.0
*/
XKB_EXPORT const uint8_t *
xkb_get_version(void);

/**
* @defgroup rules-api Rules
* Utility functions related to *rules*, whose purpose is introduced in:
Expand Down
10 changes: 10 additions & 0 deletions meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -324,6 +324,15 @@ yacc_gen = generator(
output: ['@[email protected]', '@[email protected]'],
arguments: ['--defines=@OUTPUT1@', '-o', '@OUTPUT0@', '-p', '_xkbcommon_', '@INPUT@'],
)
version_file = configure_file(
input: 'src/version.c.in',
output: 'version.c',
configuration: {
'MAJOR': xkbcommon_project_version[0],
'MINOR': xkbcommon_project_version[1],
'PATCH': xkbcommon_project_version[2],
},
)
libxkbcommon_sources = [
'src/compose/constants.h',
'src/compose/parser.c',
Expand Down Expand Up @@ -394,6 +403,7 @@ libxkbcommon_sources = [
'src/utils-numbers.h',
'src/utils-paths.c',
'src/utils-paths.h',
version_file,
]
libxkbcommon_link_args = []
libxkbcommon_link_deps = []
Expand Down
18 changes: 18 additions & 0 deletions src/version.c.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
/*
* Copyright © 2025 Pierre Le Marre
* SPDX-License-Identifier: MIT
*/

#include "config.h"

#include <stdint.h>

#include "xkbcommon/xkbcommon.h"

static const uint8_t version[] = { @MAJOR@, @MINOR@, @PATCH@ };

const uint8_t *
xkb_get_version(void)
{
return version;
}
1 change: 1 addition & 0 deletions xkbcommon.map
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,7 @@ global:

V_1.14.0 {
global:
xkb_get_version;
xkb_keymap_key_iterator_new;
xkb_keymap_key_iterator_destroy;
xkb_keymap_key_iterator_next;
Expand Down
Loading