Edit

kc3-lang/libxkbcommon/src/keymap-formats.h

Branch :

  • Show log

    Commit

  • Author : Pierre Le Marre
    Date : 2025-05-07 10:20:25
    Hash : 44c8deb2
    Message : Introduce keymap format v2 and make it the default for parsing - Added `XKB_KEYMAP_FORMAT_TEXT_V2`. - Made `xkb_keymap_new_from_names()` use the new keymap format. - Made the tools default to the new keymap format for input. This is in preparation for changes in the parsing & state handling. For now it changes nothing.

  • src/keymap-formats.h
  • /*
     * Copyright © 2025 Pierre Le Marre <dev@wismill.eu>
     *
     * SPDX-License-Identifier: MIT
     */
    
    #pragma once
    
    #include "config.h"
    
    #include "xkbcommon/xkbcommon.h"
    
    #define DEFAULT_INPUT_KEYMAP_FORMAT  XKB_KEYMAP_FORMAT_TEXT_V2
    #define DEFAULT_OUTPUT_KEYMAP_FORMAT XKB_KEYMAP_USE_ORIGINAL_FORMAT
    
    /**
     * Provide an array of the supported keymap formats, sorted in ascending order
     * (newest last).
     *
     * @param[out] formats An array of the supported keymap formats.
     *
     * @returns The size of the array.
     *
     * @memberof xkb_keymap
     */
    size_t
    xkb_keymap_supported_formats(const enum xkb_keymap_format **formats);
    
    /**
     * Check if the given keymap format is supported.
     *
     * @param[in] format A keymap format to test.
     *
     * @memberof xkb_keymap
     */
    bool
    xkb_keymap_is_supported_format(enum xkb_keymap_format format);
    
    /**
     * Parse a keymap version.
     *
     * @param[in] raw A raw keymap format string. May be the numeric value or the
     * label of the version, starting with `v`.
     *
     * @return The corresponding format or 0 on error.
     */
    enum xkb_keymap_format
    xkb_keymap_parse_format(const char *raw);