mirror of
https://gitlab.freedesktop.org/wlroots/wlroots.git
synced 2024-11-21 22:52:20 +00:00
types/wlr_keyboard: uniformize events name
This commit is contained in:
parent
bd6c000d14
commit
9a17200446
@ -36,7 +36,7 @@ void handle_keyboard_key(struct libinput_event *event,
|
||||
struct wlr_keyboard *kb) {
|
||||
struct libinput_event_keyboard *kbevent =
|
||||
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 =
|
||||
usec_to_msec(libinput_event_keyboard_get_time_usec(kbevent));
|
||||
wlr_event.keycode = libinput_event_keyboard_get_key(kbevent);
|
||||
|
@ -32,7 +32,7 @@ static void keyboard_handle_enter(void *data, struct wl_keyboard *wl_keyboard,
|
||||
|
||||
uint32_t *keycode_ptr;
|
||||
wl_array_for_each(keycode_ptr, keys) {
|
||||
struct wlr_event_keyboard_key event = {
|
||||
struct wlr_keyboard_key_event event = {
|
||||
.keycode = *keycode_ptr,
|
||||
.state = WL_KEYBOARD_KEY_STATE_PRESSED,
|
||||
.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) {
|
||||
uint32_t keycode = pressed[i];
|
||||
|
||||
struct wlr_event_keyboard_key event = {
|
||||
struct wlr_keyboard_key_event event = {
|
||||
.keycode = keycode,
|
||||
.state = WL_KEYBOARD_KEY_STATE_RELEASED,
|
||||
.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) {
|
||||
struct wlr_keyboard *keyboard = data;
|
||||
|
||||
struct wlr_event_keyboard_key wlr_event = {
|
||||
struct wlr_keyboard_key_event wlr_event = {
|
||||
.keycode = key,
|
||||
.state = state,
|
||||
.time_msec = time,
|
||||
|
@ -20,7 +20,7 @@
|
||||
|
||||
static void send_key_event(struct wlr_x11_backend *x11, uint32_t key,
|
||||
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,
|
||||
.keycode = key,
|
||||
.state = st,
|
||||
|
@ -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) {
|
||||
struct sample_keyboard *keyboard = wl_container_of(listener, keyboard, key);
|
||||
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;
|
||||
const xkb_keysym_t *syms;
|
||||
int nsyms = xkb_state_key_get_syms(keyboard->device->keyboard->xkb_state,
|
||||
|
@ -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) {
|
||||
struct sample_keyboard *keyboard = wl_container_of(listener, keyboard, key);
|
||||
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;
|
||||
const xkb_keysym_t *syms;
|
||||
int nsyms = xkb_state_key_get_syms(keyboard->device->keyboard->xkb_state,
|
||||
|
@ -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) {
|
||||
struct sample_keyboard *keyboard = wl_container_of(listener, keyboard, key);
|
||||
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;
|
||||
const xkb_keysym_t *syms;
|
||||
int nsyms = xkb_state_key_get_syms(keyboard->device->keyboard->xkb_state,
|
||||
|
@ -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) {
|
||||
struct sample_keyboard *keyboard = wl_container_of(listener, keyboard, key);
|
||||
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;
|
||||
const xkb_keysym_t *syms;
|
||||
int nsyms = xkb_state_key_get_syms(keyboard->device->keyboard->xkb_state,
|
||||
|
@ -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) {
|
||||
struct sample_keyboard *keyboard = wl_container_of(listener, keyboard, key);
|
||||
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;
|
||||
const xkb_keysym_t *syms;
|
||||
int nsyms = xkb_state_key_get_syms(keyboard->device->keyboard->xkb_state,
|
||||
|
@ -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) {
|
||||
struct sample_keyboard *keyboard = wl_container_of(listener, keyboard, key);
|
||||
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;
|
||||
const xkb_keysym_t *syms;
|
||||
int nsyms = xkb_state_key_get_syms(keyboard->device->keyboard->xkb_state,
|
||||
|
@ -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) {
|
||||
struct sample_keyboard *keyboard = wl_container_of(listener, keyboard, key);
|
||||
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;
|
||||
const xkb_keysym_t *syms;
|
||||
int nsyms = xkb_state_key_get_syms(keyboard->device->keyboard->xkb_state,
|
||||
|
@ -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) {
|
||||
struct sample_keyboard *keyboard = wl_container_of(listener, keyboard, key);
|
||||
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;
|
||||
const xkb_keysym_t *syms;
|
||||
int nsyms = xkb_state_key_get_syms(keyboard->device->keyboard->xkb_state,
|
||||
|
@ -1,7 +1,7 @@
|
||||
#include <wlr/types/wlr_keyboard.h>
|
||||
|
||||
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);
|
||||
|
||||
|
@ -26,7 +26,7 @@ void wlr_keyboard_init(struct wlr_keyboard *keyboard,
|
||||
void wlr_keyboard_finish(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,
|
||||
uint32_t mods_depressed, uint32_t mods_latched, uint32_t mods_locked,
|
||||
uint32_t group);
|
||||
|
@ -94,7 +94,7 @@ struct wlr_keyboard {
|
||||
void *data;
|
||||
};
|
||||
|
||||
struct wlr_event_keyboard_key {
|
||||
struct wlr_keyboard_key_event {
|
||||
uint32_t time_msec;
|
||||
uint32_t keycode;
|
||||
bool update_state; // if backend doesn't update modifiers on its own
|
||||
|
@ -188,7 +188,7 @@ static void keyboard_handle_key(
|
||||
struct tinywl_keyboard *keyboard =
|
||||
wl_container_of(listener, keyboard, key);
|
||||
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;
|
||||
|
||||
/* Translate libinput keycode -> xkbcommon */
|
||||
|
@ -61,7 +61,7 @@ bool keyboard_modifier_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) {
|
||||
set_add(keyboard->keycodes, &keyboard->num_keycodes,
|
||||
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,
|
||||
struct wlr_event_keyboard_key *event) {
|
||||
struct wlr_keyboard_key_event *event) {
|
||||
keyboard_key_update(keyboard, 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;
|
||||
for (size_t i = 0; i < 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(),
|
||||
.keycode = kb->keycodes[orig_num_keycodes - i - 1],
|
||||
.update_state = false,
|
||||
|
@ -69,7 +69,7 @@ struct wlr_keyboard_group *wlr_keyboard_group_from_wlr_keyboard(
|
||||
}
|
||||
|
||||
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 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++) {
|
||||
struct timespec 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,
|
||||
.keycode = device->keyboard->keycodes[i],
|
||||
.update_state = true,
|
||||
|
@ -78,7 +78,7 @@ static void virtual_keyboard_key(struct wl_client *client,
|
||||
"Cannot send a keypress before defining a keymap");
|
||||
return;
|
||||
}
|
||||
struct wlr_event_keyboard_key event = {
|
||||
struct wlr_keyboard_key_event event = {
|
||||
.time_msec = time,
|
||||
.keycode = key,
|
||||
.update_state = false,
|
||||
|
Loading…
Reference in New Issue
Block a user