types/wlr_keyboard: uniformize events name

This commit is contained in:
Simon Zeni 2022-03-09 15:05:12 -05:00 committed by Kirill Primak
parent bd6c000d14
commit 9a17200446
18 changed files with 23 additions and 23 deletions

View File

@ -36,7 +36,7 @@ void handle_keyboard_key(struct libinput_event *event,
struct wlr_keyboard *kb) { struct wlr_keyboard *kb) {
struct libinput_event_keyboard *kbevent = struct libinput_event_keyboard *kbevent =
libinput_event_get_keyboard_event(event); libinput_event_get_keyboard_event(event);
struct wlr_event_keyboard_key wlr_event = { 0 }; struct wlr_keyboard_key_event wlr_event = { 0 };
wlr_event.time_msec = wlr_event.time_msec =
usec_to_msec(libinput_event_keyboard_get_time_usec(kbevent)); usec_to_msec(libinput_event_keyboard_get_time_usec(kbevent));
wlr_event.keycode = libinput_event_keyboard_get_key(kbevent); wlr_event.keycode = libinput_event_keyboard_get_key(kbevent);

View File

@ -32,7 +32,7 @@ static void keyboard_handle_enter(void *data, struct wl_keyboard *wl_keyboard,
uint32_t *keycode_ptr; uint32_t *keycode_ptr;
wl_array_for_each(keycode_ptr, keys) { wl_array_for_each(keycode_ptr, keys) {
struct wlr_event_keyboard_key event = { struct wlr_keyboard_key_event event = {
.keycode = *keycode_ptr, .keycode = *keycode_ptr,
.state = WL_KEYBOARD_KEY_STATE_PRESSED, .state = WL_KEYBOARD_KEY_STATE_PRESSED,
.time_msec = get_current_time_msec(), .time_msec = get_current_time_msec(),
@ -54,7 +54,7 @@ static void keyboard_handle_leave(void *data, struct wl_keyboard *wl_keyboard,
for (size_t i = 0; i < num_keycodes; ++i) { for (size_t i = 0; i < num_keycodes; ++i) {
uint32_t keycode = pressed[i]; uint32_t keycode = pressed[i];
struct wlr_event_keyboard_key event = { struct wlr_keyboard_key_event event = {
.keycode = keycode, .keycode = keycode,
.state = WL_KEYBOARD_KEY_STATE_RELEASED, .state = WL_KEYBOARD_KEY_STATE_RELEASED,
.time_msec = get_current_time_msec(), .time_msec = get_current_time_msec(),
@ -68,7 +68,7 @@ static void keyboard_handle_key(void *data, struct wl_keyboard *wl_keyboard,
uint32_t serial, uint32_t time, uint32_t key, uint32_t state) { uint32_t serial, uint32_t time, uint32_t key, uint32_t state) {
struct wlr_keyboard *keyboard = data; struct wlr_keyboard *keyboard = data;
struct wlr_event_keyboard_key wlr_event = { struct wlr_keyboard_key_event wlr_event = {
.keycode = key, .keycode = key,
.state = state, .state = state,
.time_msec = time, .time_msec = time,

View File

@ -20,7 +20,7 @@
static void send_key_event(struct wlr_x11_backend *x11, uint32_t key, static void send_key_event(struct wlr_x11_backend *x11, uint32_t key,
enum wl_keyboard_key_state st, xcb_timestamp_t time) { enum wl_keyboard_key_state st, xcb_timestamp_t time) {
struct wlr_event_keyboard_key ev = { struct wlr_keyboard_key_event ev = {
.time_msec = time, .time_msec = time,
.keycode = key, .keycode = key,
.state = st, .state = st,

View File

@ -185,7 +185,7 @@ static void new_output_notify(struct wl_listener *listener, void *data) {
static void keyboard_key_notify(struct wl_listener *listener, void *data) { static void keyboard_key_notify(struct wl_listener *listener, void *data) {
struct sample_keyboard *keyboard = wl_container_of(listener, keyboard, key); struct sample_keyboard *keyboard = wl_container_of(listener, keyboard, key);
struct sample_state *sample = keyboard->sample; struct sample_state *sample = keyboard->sample;
struct wlr_event_keyboard_key *event = data; struct wlr_keyboard_key_event *event = data;
uint32_t keycode = event->keycode + 8; uint32_t keycode = event->keycode + 8;
const xkb_keysym_t *syms; const xkb_keysym_t *syms;
int nsyms = xkb_state_key_get_syms(keyboard->device->keyboard->xkb_state, int nsyms = xkb_state_key_get_syms(keyboard->device->keyboard->xkb_state,

View File

@ -183,7 +183,7 @@ static void new_output_notify(struct wl_listener *listener, void *data) {
static void keyboard_key_notify(struct wl_listener *listener, void *data) { static void keyboard_key_notify(struct wl_listener *listener, void *data) {
struct sample_keyboard *keyboard = wl_container_of(listener, keyboard, key); struct sample_keyboard *keyboard = wl_container_of(listener, keyboard, key);
struct sample_state *sample = keyboard->sample; struct sample_state *sample = keyboard->sample;
struct wlr_event_keyboard_key *event = data; struct wlr_keyboard_key_event *event = data;
uint32_t keycode = event->keycode + 8; uint32_t keycode = event->keycode + 8;
const xkb_keysym_t *syms; const xkb_keysym_t *syms;
int nsyms = xkb_state_key_get_syms(keyboard->device->keyboard->xkb_state, int nsyms = xkb_state_key_get_syms(keyboard->device->keyboard->xkb_state,

View File

@ -228,7 +228,7 @@ static void handle_tablet_tool_axis(struct wl_listener *listener, void *data) {
static void keyboard_key_notify(struct wl_listener *listener, void *data) { static void keyboard_key_notify(struct wl_listener *listener, void *data) {
struct sample_keyboard *keyboard = wl_container_of(listener, keyboard, key); struct sample_keyboard *keyboard = wl_container_of(listener, keyboard, key);
struct sample_state *sample = keyboard->state; struct sample_state *sample = keyboard->state;
struct wlr_event_keyboard_key *event = data; struct wlr_keyboard_key_event *event = data;
uint32_t keycode = event->keycode + 8; uint32_t keycode = event->keycode + 8;
const xkb_keysym_t *syms; const xkb_keysym_t *syms;
int nsyms = xkb_state_key_get_syms(keyboard->device->keyboard->xkb_state, int nsyms = xkb_state_key_get_syms(keyboard->device->keyboard->xkb_state,

View File

@ -129,7 +129,7 @@ static void new_output_notify(struct wl_listener *listener, void *data) {
static void keyboard_key_notify(struct wl_listener *listener, void *data) { static void keyboard_key_notify(struct wl_listener *listener, void *data) {
struct sample_keyboard *keyboard = wl_container_of(listener, keyboard, key); struct sample_keyboard *keyboard = wl_container_of(listener, keyboard, key);
struct sample_state *sample = keyboard->sample; struct sample_state *sample = keyboard->sample;
struct wlr_event_keyboard_key *event = data; struct wlr_keyboard_key_event *event = data;
uint32_t keycode = event->keycode + 8; uint32_t keycode = event->keycode + 8;
const xkb_keysym_t *syms; const xkb_keysym_t *syms;
int nsyms = xkb_state_key_get_syms(keyboard->device->keyboard->xkb_state, int nsyms = xkb_state_key_get_syms(keyboard->device->keyboard->xkb_state,

View File

@ -134,7 +134,7 @@ static void new_output_notify(struct wl_listener *listener, void *data) {
static void keyboard_key_notify(struct wl_listener *listener, void *data) { static void keyboard_key_notify(struct wl_listener *listener, void *data) {
struct sample_keyboard *keyboard = wl_container_of(listener, keyboard, key); struct sample_keyboard *keyboard = wl_container_of(listener, keyboard, key);
struct sample_state *sample = keyboard->sample; struct sample_state *sample = keyboard->sample;
struct wlr_event_keyboard_key *event = data; struct wlr_keyboard_key_event *event = data;
uint32_t keycode = event->keycode + 8; uint32_t keycode = event->keycode + 8;
const xkb_keysym_t *syms; const xkb_keysym_t *syms;
int nsyms = xkb_state_key_get_syms(keyboard->device->keyboard->xkb_state, int nsyms = xkb_state_key_get_syms(keyboard->device->keyboard->xkb_state,

View File

@ -109,7 +109,7 @@ static void new_output_notify(struct wl_listener *listener, void *data) {
static void keyboard_key_notify(struct wl_listener *listener, void *data) { static void keyboard_key_notify(struct wl_listener *listener, void *data) {
struct sample_keyboard *keyboard = wl_container_of(listener, keyboard, key); struct sample_keyboard *keyboard = wl_container_of(listener, keyboard, key);
struct sample_state *sample = keyboard->sample; struct sample_state *sample = keyboard->sample;
struct wlr_event_keyboard_key *event = data; struct wlr_keyboard_key_event *event = data;
uint32_t keycode = event->keycode + 8; uint32_t keycode = event->keycode + 8;
const xkb_keysym_t *syms; const xkb_keysym_t *syms;
int nsyms = xkb_state_key_get_syms(keyboard->device->keyboard->xkb_state, int nsyms = xkb_state_key_get_syms(keyboard->device->keyboard->xkb_state,

View File

@ -261,7 +261,7 @@ static void new_output_notify(struct wl_listener *listener, void *data) {
static void keyboard_key_notify(struct wl_listener *listener, void *data) { static void keyboard_key_notify(struct wl_listener *listener, void *data) {
struct sample_keyboard *keyboard = wl_container_of(listener, keyboard, key); struct sample_keyboard *keyboard = wl_container_of(listener, keyboard, key);
struct sample_state *sample = keyboard->sample; struct sample_state *sample = keyboard->sample;
struct wlr_event_keyboard_key *event = data; struct wlr_keyboard_key_event *event = data;
uint32_t keycode = event->keycode + 8; uint32_t keycode = event->keycode + 8;
const xkb_keysym_t *syms; const xkb_keysym_t *syms;
int nsyms = xkb_state_key_get_syms(keyboard->device->keyboard->xkb_state, int nsyms = xkb_state_key_get_syms(keyboard->device->keyboard->xkb_state,

View File

@ -172,7 +172,7 @@ static void new_output_notify(struct wl_listener *listener, void *data) {
static void keyboard_key_notify(struct wl_listener *listener, void *data) { static void keyboard_key_notify(struct wl_listener *listener, void *data) {
struct sample_keyboard *keyboard = wl_container_of(listener, keyboard, key); struct sample_keyboard *keyboard = wl_container_of(listener, keyboard, key);
struct sample_state *sample = keyboard->sample; struct sample_state *sample = keyboard->sample;
struct wlr_event_keyboard_key *event = data; struct wlr_keyboard_key_event *event = data;
uint32_t keycode = event->keycode + 8; uint32_t keycode = event->keycode + 8;
const xkb_keysym_t *syms; const xkb_keysym_t *syms;
int nsyms = xkb_state_key_get_syms(keyboard->device->keyboard->xkb_state, int nsyms = xkb_state_key_get_syms(keyboard->device->keyboard->xkb_state,

View File

@ -1,7 +1,7 @@
#include <wlr/types/wlr_keyboard.h> #include <wlr/types/wlr_keyboard.h>
void keyboard_key_update(struct wlr_keyboard *keyboard, void keyboard_key_update(struct wlr_keyboard *keyboard,
struct wlr_event_keyboard_key *event); struct wlr_keyboard_key_event *event);
bool keyboard_modifier_update(struct wlr_keyboard *keyboard); bool keyboard_modifier_update(struct wlr_keyboard *keyboard);

View File

@ -26,7 +26,7 @@ void wlr_keyboard_init(struct wlr_keyboard *keyboard,
void wlr_keyboard_finish(struct wlr_keyboard *keyboard); void wlr_keyboard_finish(struct wlr_keyboard *keyboard);
void wlr_keyboard_notify_key(struct wlr_keyboard *keyboard, void wlr_keyboard_notify_key(struct wlr_keyboard *keyboard,
struct wlr_event_keyboard_key *event); struct wlr_keyboard_key_event *event);
void wlr_keyboard_notify_modifiers(struct wlr_keyboard *keyboard, void wlr_keyboard_notify_modifiers(struct wlr_keyboard *keyboard,
uint32_t mods_depressed, uint32_t mods_latched, uint32_t mods_locked, uint32_t mods_depressed, uint32_t mods_latched, uint32_t mods_locked,
uint32_t group); uint32_t group);

View File

@ -94,7 +94,7 @@ struct wlr_keyboard {
void *data; void *data;
}; };
struct wlr_event_keyboard_key { struct wlr_keyboard_key_event {
uint32_t time_msec; uint32_t time_msec;
uint32_t keycode; uint32_t keycode;
bool update_state; // if backend doesn't update modifiers on its own bool update_state; // if backend doesn't update modifiers on its own

View File

@ -188,7 +188,7 @@ static void keyboard_handle_key(
struct tinywl_keyboard *keyboard = struct tinywl_keyboard *keyboard =
wl_container_of(listener, keyboard, key); wl_container_of(listener, keyboard, key);
struct tinywl_server *server = keyboard->server; struct tinywl_server *server = keyboard->server;
struct wlr_event_keyboard_key *event = data; struct wlr_keyboard_key_event *event = data;
struct wlr_seat *seat = server->seat; struct wlr_seat *seat = server->seat;
/* Translate libinput keycode -> xkbcommon */ /* Translate libinput keycode -> xkbcommon */

View File

@ -61,7 +61,7 @@ bool keyboard_modifier_update(struct wlr_keyboard *keyboard) {
} }
void keyboard_key_update(struct wlr_keyboard *keyboard, void keyboard_key_update(struct wlr_keyboard *keyboard,
struct wlr_event_keyboard_key *event) { struct wlr_keyboard_key_event *event) {
if (event->state == WL_KEYBOARD_KEY_STATE_PRESSED) { if (event->state == WL_KEYBOARD_KEY_STATE_PRESSED) {
set_add(keyboard->keycodes, &keyboard->num_keycodes, set_add(keyboard->keycodes, &keyboard->num_keycodes,
WLR_KEYBOARD_KEYS_CAP, event->keycode); WLR_KEYBOARD_KEYS_CAP, event->keycode);
@ -92,7 +92,7 @@ void wlr_keyboard_notify_modifiers(struct wlr_keyboard *keyboard,
} }
void wlr_keyboard_notify_key(struct wlr_keyboard *keyboard, void wlr_keyboard_notify_key(struct wlr_keyboard *keyboard,
struct wlr_event_keyboard_key *event) { struct wlr_keyboard_key_event *event) {
keyboard_key_update(keyboard, event); keyboard_key_update(keyboard, event);
wlr_signal_emit_safe(&keyboard->events.key, event); wlr_signal_emit_safe(&keyboard->events.key, event);
@ -137,7 +137,7 @@ void wlr_keyboard_finish(struct wlr_keyboard *kb) {
size_t orig_num_keycodes = kb->num_keycodes; size_t orig_num_keycodes = kb->num_keycodes;
for (size_t i = 0; i < orig_num_keycodes; ++i) { for (size_t i = 0; i < orig_num_keycodes; ++i) {
assert(kb->num_keycodes == orig_num_keycodes - i); assert(kb->num_keycodes == orig_num_keycodes - i);
struct wlr_event_keyboard_key event = { struct wlr_keyboard_key_event event = {
.time_msec = get_current_time_msec(), .time_msec = get_current_time_msec(),
.keycode = kb->keycodes[orig_num_keycodes - i - 1], .keycode = kb->keycodes[orig_num_keycodes - i - 1],
.update_state = false, .update_state = false,

View File

@ -69,7 +69,7 @@ struct wlr_keyboard_group *wlr_keyboard_group_from_wlr_keyboard(
} }
static bool process_key(struct keyboard_group_device *group_device, static bool process_key(struct keyboard_group_device *group_device,
struct wlr_event_keyboard_key *event) { struct wlr_keyboard_key_event *event) {
struct wlr_keyboard_group *group = group_device->keyboard->group; struct wlr_keyboard_group *group = group_device->keyboard->group;
struct keyboard_group_key *key, *tmp; struct keyboard_group_key *key, *tmp;
@ -188,7 +188,7 @@ static void refresh_state(struct keyboard_group_device *device,
for (size_t i = 0; i < device->keyboard->num_keycodes; i++) { for (size_t i = 0; i < device->keyboard->num_keycodes; i++) {
struct timespec now; struct timespec now;
clock_gettime(CLOCK_MONOTONIC, &now); clock_gettime(CLOCK_MONOTONIC, &now);
struct wlr_event_keyboard_key event = { struct wlr_keyboard_key_event event = {
.time_msec = (int64_t)now.tv_sec * 1000 + now.tv_nsec / 1000000, .time_msec = (int64_t)now.tv_sec * 1000 + now.tv_nsec / 1000000,
.keycode = device->keyboard->keycodes[i], .keycode = device->keyboard->keycodes[i],
.update_state = true, .update_state = true,

View File

@ -78,7 +78,7 @@ static void virtual_keyboard_key(struct wl_client *client,
"Cannot send a keypress before defining a keymap"); "Cannot send a keypress before defining a keymap");
return; return;
} }
struct wlr_event_keyboard_key event = { struct wlr_keyboard_key_event event = {
.time_msec = time, .time_msec = time,
.keycode = key, .keycode = key,
.update_state = false, .update_state = false,