This will help make the init procedure safer, by limiting the number of Rust objects that need to be carried to the C side and may be mangled on the way there. The second benefit is that it allows outputs to become part of new state management.
39 lines
1.3 KiB
C
39 lines
1.3 KiB
C
#include "eek/eek-keyboard.h"
|
|
|
|
#include "wayland.h"
|
|
|
|
struct squeek_wayland *squeek_wayland = NULL;
|
|
|
|
void squeek_wayland_init_global(struct squeek_outputs *outputs) {
|
|
struct squeek_wayland *wayland = {0};
|
|
wayland->outputs = outputs;
|
|
squeek_wayland = wayland;
|
|
}
|
|
|
|
// The following functions only exist
|
|
// to create linkable symbols out of inline functions,
|
|
// because those are not directly callable from Rust
|
|
|
|
void
|
|
eek_virtual_keyboard_v1_key(struct zwp_virtual_keyboard_v1 *zwp_virtual_keyboard_v1, uint32_t time, uint32_t key, uint32_t state) {
|
|
zwp_virtual_keyboard_v1_key(zwp_virtual_keyboard_v1, time, key, state);
|
|
}
|
|
|
|
|
|
void eek_virtual_keyboard_update_keymap(struct zwp_virtual_keyboard_v1 *zwp_virtual_keyboard_v1, struct keymap *keymap) {
|
|
zwp_virtual_keyboard_v1_keymap(zwp_virtual_keyboard_v1,
|
|
WL_KEYBOARD_KEYMAP_FORMAT_XKB_V1,
|
|
keymap->fd, keymap->fd_len);
|
|
}
|
|
|
|
void
|
|
eek_virtual_keyboard_set_modifiers(struct zwp_virtual_keyboard_v1 *zwp_virtual_keyboard_v1, uint32_t mods_depressed) {
|
|
zwp_virtual_keyboard_v1_modifiers(zwp_virtual_keyboard_v1,
|
|
mods_depressed, 0, 0, 0);
|
|
}
|
|
|
|
int squeek_output_add_listener(struct wl_output *wl_output,
|
|
const struct wl_output_listener *listener, void *data) {
|
|
return wl_output_add_listener(wl_output, listener, data);
|
|
}
|