wlvncc/include/keyboard.h

49 lines
1.5 KiB
C
Raw Normal View History

2020-07-10 14:33:04 +00:00
/*
* Copyright (c) 2020 Andri Yngvason
*
* Permission to use, copy, modify, and/or distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
* REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
* AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
* INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
* LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
* OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
* PERFORMANCE OF THIS SOFTWARE.
*/
2020-07-10 14:26:27 +00:00
#pragma once
#include <stdbool.h>
#include <wayland-client.h>
struct xkb_context;
struct xkb_keymap;
struct xkb_state;
struct keyboard {
struct wl_keyboard* wl_keyboard;
struct wl_list link;
struct xkb_context* context;
struct xkb_keymap* keymap;
struct xkb_state* state;
};
struct keyboard_collection {
struct wl_list keyboards;
void (*on_event)(struct keyboard_collection*, struct keyboard*,
uint32_t key, bool is_pressed);
void* userdata;
};
struct keyboard_collection* keyboard_collection_new(void);
void keyboard_collection_destroy(struct keyboard_collection*);
int keyboard_collection_add_wl_keyboard(struct keyboard_collection* self,
struct wl_keyboard* wl_keyboard);
void keyboard_collection_remove_wl_keyboard(struct keyboard_collection* self,
struct wl_keyboard* wl_keyboard);