|
| 1 | +/* |
| 2 | + * Copyright (C) 2015, 2016 Igalia S.L. |
| 3 | + * All rights reserved. |
| 4 | + * |
| 5 | + * Redistribution and use in source and binary forms, with or without |
| 6 | + * modification, are permitted provided that the following conditions |
| 7 | + * are met: |
| 8 | + * 1. Redistributions of source code must retain the above copyright |
| 9 | + * notice, this list of conditions and the following disclaimer. |
| 10 | + * 2. Redistributions in binary form must reproduce the above copyright |
| 11 | + * notice, this list of conditions and the following disclaimer in the |
| 12 | + * documentation and/or other materials provided with the distribution. |
| 13 | + * |
| 14 | + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
| 15 | + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
| 16 | + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A |
| 17 | + * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |
| 18 | + * HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
| 19 | + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
| 20 | + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
| 21 | + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
| 22 | + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 23 | + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 24 | + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 25 | + */ |
| 26 | + |
| 27 | +#if !defined(__WPE_H_INSIDE__) && !defined(WPE_COMPILATION) |
| 28 | +#error "Only <wpe/wpe.h> can be included directly." |
| 29 | +#endif |
| 30 | + |
| 31 | +#ifndef wpe_input_xkb_h |
| 32 | +#define wpe_input_xkb_h |
| 33 | + |
| 34 | +/** |
| 35 | + * SECTION:input |
| 36 | + * @short_description: Input Handling |
| 37 | + * @title: Input |
| 38 | + */ |
| 39 | + |
| 40 | +#if defined(WPE_ENABLE_XKB) && WPE_ENABLE_XKB |
| 41 | + |
| 42 | +#if defined(WPE_COMPILATION) |
| 43 | +#include "export.h" |
| 44 | +#endif |
| 45 | + |
| 46 | +#include <stdbool.h> |
| 47 | +#include <stdint.h> |
| 48 | +#include <xkbcommon/xkbcommon.h> |
| 49 | +#include <xkbcommon/xkbcommon-compose.h> |
| 50 | + |
| 51 | +#ifdef __cplusplus |
| 52 | +extern "C" { |
| 53 | +#endif |
| 54 | + |
| 55 | +struct wpe_input_xkb_context; |
| 56 | + |
| 57 | +struct wpe_input_xkb_keymap_entry { |
| 58 | + uint32_t hardware_key_code; |
| 59 | + int32_t layout; |
| 60 | + int32_t level; |
| 61 | +}; |
| 62 | + |
| 63 | +WPE_EXPORT |
| 64 | +struct wpe_input_xkb_context* |
| 65 | +wpe_input_xkb_context_get_default(); |
| 66 | + |
| 67 | +WPE_EXPORT |
| 68 | +struct xkb_context* |
| 69 | +wpe_input_xkb_context_get_context(struct wpe_input_xkb_context*); |
| 70 | + |
| 71 | +WPE_EXPORT |
| 72 | +struct xkb_keymap* |
| 73 | +wpe_input_xkb_context_get_keymap(struct wpe_input_xkb_context*); |
| 74 | + |
| 75 | +WPE_EXPORT |
| 76 | +void |
| 77 | +wpe_input_xkb_context_set_keymap(struct wpe_input_xkb_context*, struct xkb_keymap*); |
| 78 | + |
| 79 | +WPE_EXPORT |
| 80 | +struct xkb_state* |
| 81 | +wpe_input_xkb_context_get_state(struct wpe_input_xkb_context*); |
| 82 | + |
| 83 | +WPE_EXPORT |
| 84 | +struct xkb_compose_table* |
| 85 | +wpe_input_xkb_context_get_compose_table(struct wpe_input_xkb_context*); |
| 86 | + |
| 87 | +WPE_EXPORT |
| 88 | +void |
| 89 | +wpe_input_xkb_context_set_compose_table(struct wpe_input_xkb_context*, struct xkb_compose_table*); |
| 90 | + |
| 91 | +WPE_EXPORT |
| 92 | +struct xkb_compose_state* |
| 93 | +wpe_input_xkb_context_get_compose_state(struct wpe_input_xkb_context*); |
| 94 | + |
| 95 | +WPE_EXPORT |
| 96 | +uint32_t |
| 97 | +wpe_input_xkb_context_get_modifiers(struct wpe_input_xkb_context*, uint32_t depressed, uint32_t latched, uint32_t locked, uint32_t group); |
| 98 | + |
| 99 | +WPE_EXPORT |
| 100 | +uint32_t |
| 101 | +wpe_input_xkb_context_get_key_code(struct wpe_input_xkb_context*, uint32_t hardware_key_code, bool pressed); |
| 102 | + |
| 103 | +WPE_EXPORT |
| 104 | +void |
| 105 | +wpe_input_xkb_context_get_entries_for_key_code(struct wpe_input_xkb_context*, uint32_t key_code, struct wpe_input_xkb_keymap_entry**, uint32_t* n_entries); |
| 106 | + |
| 107 | +#ifdef __cplusplus |
| 108 | +} |
| 109 | +#endif |
| 110 | + |
| 111 | +#endif /* defined(WPE_ENABLE_XKB) && WPE_ENABLE_XKB */ |
| 112 | + |
| 113 | +#endif /* wpe_input_xkb_h */ |
0 commit comments