wlr-keyboard: take out modifiers event struct (for now)

This commit is contained in:
Tony Crisci 2017-11-09 17:29:28 -05:00
parent c680ace5e8
commit 739361aa70
9 changed files with 13 additions and 35 deletions

View File

@ -54,7 +54,6 @@ void handle_keyboard_key(struct libinput_event *event,
struct libinput_event_keyboard *kbevent =
libinput_event_get_keyboard_event(event);
struct wlr_event_keyboard_key wlr_event = { 0 };
wlr_event.device = wlr_dev;
wlr_event.time_msec =
usec_to_msec(libinput_event_keyboard_get_time_usec(kbevent));
wlr_event.keycode = libinput_event_keyboard_get_key(kbevent);

View File

@ -151,7 +151,6 @@ static void keyboard_handle_key(void *data, struct wl_keyboard *wl_keyboard,
assert(dev && dev->keyboard);
struct wlr_event_keyboard_key wlr_event;
wlr_event.device = dev;
wlr_event.keycode = key;
wlr_event.state = state;
wlr_event.time_msec = time;
@ -163,15 +162,8 @@ static void keyboard_handle_modifiers(void *data, struct wl_keyboard *wl_keyboar
uint32_t mods_locked, uint32_t group) {
struct wlr_input_device *dev = data;
assert(dev && dev->keyboard);
struct wlr_event_keyboard_modifiers wlr_event;
wlr_event.device = dev;
wlr_event.keyboard = dev->keyboard;
wlr_event.mods_depressed = mods_depressed;
wlr_event.mods_latched = mods_latched;
wlr_event.mods_locked = mods_locked;
wlr_event.group = group;
wlr_keyboard_notify_modifiers(dev->keyboard, &wlr_event);
wlr_keyboard_notify_modifiers(dev->keyboard, mods_depressed, mods_latched,
mods_locked, group);
}
static void keyboard_handle_repeat_info(void *data, struct wl_keyboard *wl_keyboard,

View File

@ -50,7 +50,6 @@ static bool handle_x11_event(struct wlr_x11_backend *x11, xcb_generic_event_t *e
case XCB_KEY_RELEASE: {
xcb_key_press_event_t *ev = (xcb_key_press_event_t *)event;
struct wlr_event_keyboard_key key = {
.device = &x11->keyboard_dev,
.time_msec = ev->time,
.keycode = ev->detail - 8,
.state = event->response_type == XCB_KEY_PRESS ?

View File

@ -27,7 +27,6 @@ void roots_keyboard_destroy(struct roots_keyboard *keyboard);
void roots_keyboard_handle_key(struct roots_keyboard *keyboard,
struct wlr_event_keyboard_key *event);
void roots_keyboard_handle_modifiers(struct roots_keyboard *r_keyboard,
struct wlr_event_keyboard_modifiers *event);
void roots_keyboard_handle_modifiers(struct roots_keyboard *r_keyboard);
#endif

View File

@ -14,6 +14,7 @@ void wlr_keyboard_destroy(struct wlr_keyboard *keyboard);
void wlr_keyboard_notify_key(struct wlr_keyboard *keyboard,
struct wlr_event_keyboard_key *event);
void wlr_keyboard_notify_modifiers(struct wlr_keyboard *keyboard,
struct wlr_event_keyboard_modifiers *event);
uint32_t mods_depressed, uint32_t mods_latched, uint32_t mods_locked,
uint32_t group);
#endif

View File

@ -66,23 +66,12 @@ enum wlr_key_state {
};
struct wlr_event_keyboard_key {
struct wlr_input_device *device;
struct wlr_keyboard *keyboard;
uint32_t time_msec;
uint32_t keycode;
bool update_state;
enum wlr_key_state state;
};
struct wlr_event_keyboard_modifiers {
struct wlr_input_device *device;
struct wlr_keyboard *keyboard;
uint32_t mods_depressed;
uint32_t mods_latched;
uint32_t mods_locked;
uint32_t group;
};
void wlr_keyboard_set_keymap(struct wlr_keyboard *kb,
struct xkb_keymap *keymap);
void wlr_keyboard_led_update(struct wlr_keyboard *keyboard, uint32_t leds);

View File

@ -204,8 +204,7 @@ void roots_keyboard_handle_key(struct roots_keyboard *keyboard,
}
}
void roots_keyboard_handle_modifiers(struct roots_keyboard *r_keyboard,
struct wlr_event_keyboard_modifiers *event) {
void roots_keyboard_handle_modifiers(struct roots_keyboard *r_keyboard) {
struct wlr_seat *seat = r_keyboard->seat->seat;
wlr_seat_set_keyboard(seat, r_keyboard->device);
wlr_seat_keyboard_notify_modifiers(seat);

View File

@ -22,8 +22,7 @@ static void handle_keyboard_modifiers(struct wl_listener *listener,
void *data) {
struct roots_keyboard *keyboard =
wl_container_of(listener, keyboard, keyboard_modifiers);
struct wlr_event_keyboard_modifiers *event = data;
roots_keyboard_handle_modifiers(keyboard, event);
roots_keyboard_handle_modifiers(keyboard);
}
static void handle_cursor_motion(struct wl_listener *listener, void *data) {

View File

@ -41,6 +41,8 @@ static void keyboard_modifier_update(struct wlr_keyboard *keyboard) {
keyboard->modifiers.latched = latched;
keyboard->modifiers.locked = locked;
keyboard->modifiers.group = group;
wl_signal_emit(&keyboard->events.modifiers, keyboard);
}
static void keyboard_key_update(struct wlr_keyboard *keyboard,
@ -68,15 +70,14 @@ static void keyboard_key_update(struct wlr_keyboard *keyboard,
}
void wlr_keyboard_notify_modifiers(struct wlr_keyboard *keyboard,
struct wlr_event_keyboard_modifiers *event) {
uint32_t mods_depressed, uint32_t mods_latched, uint32_t mods_locked,
uint32_t group) {
if (!keyboard->xkb_state) {
return;
}
xkb_state_update_mask(keyboard->xkb_state, event->mods_depressed,
event->mods_latched, event->mods_locked, 0, 0, event->group);
xkb_state_update_mask(keyboard->xkb_state, mods_depressed, mods_latched,
mods_locked, 0, 0, group);
keyboard_modifier_update(keyboard);
wl_signal_emit(&keyboard->events.modifiers, event);
}
void wlr_keyboard_notify_key(struct wlr_keyboard *keyboard,