mirror of
https://github.com/hyprwm/wlroots-hyprland.git
synced 2024-11-23 05:15:58 +01:00
wlr-keyboard: take out modifiers event struct (for now)
This commit is contained in:
parent
c680ace5e8
commit
739361aa70
9 changed files with 13 additions and 35 deletions
|
@ -54,7 +54,6 @@ void handle_keyboard_key(struct libinput_event *event,
|
||||||
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_event_keyboard_key wlr_event = { 0 };
|
||||||
wlr_event.device = wlr_dev;
|
|
||||||
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);
|
||||||
|
|
|
@ -151,7 +151,6 @@ static void keyboard_handle_key(void *data, struct wl_keyboard *wl_keyboard,
|
||||||
assert(dev && dev->keyboard);
|
assert(dev && dev->keyboard);
|
||||||
|
|
||||||
struct wlr_event_keyboard_key wlr_event;
|
struct wlr_event_keyboard_key wlr_event;
|
||||||
wlr_event.device = dev;
|
|
||||||
wlr_event.keycode = key;
|
wlr_event.keycode = key;
|
||||||
wlr_event.state = state;
|
wlr_event.state = state;
|
||||||
wlr_event.time_msec = time;
|
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) {
|
uint32_t mods_locked, uint32_t group) {
|
||||||
struct wlr_input_device *dev = data;
|
struct wlr_input_device *dev = data;
|
||||||
assert(dev && dev->keyboard);
|
assert(dev && dev->keyboard);
|
||||||
struct wlr_event_keyboard_modifiers wlr_event;
|
wlr_keyboard_notify_modifiers(dev->keyboard, mods_depressed, mods_latched,
|
||||||
wlr_event.device = dev;
|
mods_locked, group);
|
||||||
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);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void keyboard_handle_repeat_info(void *data, struct wl_keyboard *wl_keyboard,
|
static void keyboard_handle_repeat_info(void *data, struct wl_keyboard *wl_keyboard,
|
||||||
|
|
|
@ -50,7 +50,6 @@ static bool handle_x11_event(struct wlr_x11_backend *x11, xcb_generic_event_t *e
|
||||||
case XCB_KEY_RELEASE: {
|
case XCB_KEY_RELEASE: {
|
||||||
xcb_key_press_event_t *ev = (xcb_key_press_event_t *)event;
|
xcb_key_press_event_t *ev = (xcb_key_press_event_t *)event;
|
||||||
struct wlr_event_keyboard_key key = {
|
struct wlr_event_keyboard_key key = {
|
||||||
.device = &x11->keyboard_dev,
|
|
||||||
.time_msec = ev->time,
|
.time_msec = ev->time,
|
||||||
.keycode = ev->detail - 8,
|
.keycode = ev->detail - 8,
|
||||||
.state = event->response_type == XCB_KEY_PRESS ?
|
.state = event->response_type == XCB_KEY_PRESS ?
|
||||||
|
|
|
@ -27,7 +27,6 @@ void roots_keyboard_destroy(struct roots_keyboard *keyboard);
|
||||||
void roots_keyboard_handle_key(struct roots_keyboard *keyboard,
|
void roots_keyboard_handle_key(struct roots_keyboard *keyboard,
|
||||||
struct wlr_event_keyboard_key *event);
|
struct wlr_event_keyboard_key *event);
|
||||||
|
|
||||||
void roots_keyboard_handle_modifiers(struct roots_keyboard *r_keyboard,
|
void roots_keyboard_handle_modifiers(struct roots_keyboard *r_keyboard);
|
||||||
struct wlr_event_keyboard_modifiers *event);
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -14,6 +14,7 @@ void wlr_keyboard_destroy(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_event_keyboard_key *event);
|
||||||
void wlr_keyboard_notify_modifiers(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);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -66,23 +66,12 @@ enum wlr_key_state {
|
||||||
};
|
};
|
||||||
|
|
||||||
struct wlr_event_keyboard_key {
|
struct wlr_event_keyboard_key {
|
||||||
struct wlr_input_device *device;
|
|
||||||
struct wlr_keyboard *keyboard;
|
|
||||||
uint32_t time_msec;
|
uint32_t time_msec;
|
||||||
uint32_t keycode;
|
uint32_t keycode;
|
||||||
bool update_state;
|
bool update_state;
|
||||||
enum wlr_key_state 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,
|
void wlr_keyboard_set_keymap(struct wlr_keyboard *kb,
|
||||||
struct xkb_keymap *keymap);
|
struct xkb_keymap *keymap);
|
||||||
void wlr_keyboard_led_update(struct wlr_keyboard *keyboard, uint32_t leds);
|
void wlr_keyboard_led_update(struct wlr_keyboard *keyboard, uint32_t leds);
|
||||||
|
|
|
@ -204,8 +204,7 @@ void roots_keyboard_handle_key(struct roots_keyboard *keyboard,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void roots_keyboard_handle_modifiers(struct roots_keyboard *r_keyboard,
|
void roots_keyboard_handle_modifiers(struct roots_keyboard *r_keyboard) {
|
||||||
struct wlr_event_keyboard_modifiers *event) {
|
|
||||||
struct wlr_seat *seat = r_keyboard->seat->seat;
|
struct wlr_seat *seat = r_keyboard->seat->seat;
|
||||||
wlr_seat_set_keyboard(seat, r_keyboard->device);
|
wlr_seat_set_keyboard(seat, r_keyboard->device);
|
||||||
wlr_seat_keyboard_notify_modifiers(seat);
|
wlr_seat_keyboard_notify_modifiers(seat);
|
||||||
|
|
|
@ -22,8 +22,7 @@ static void handle_keyboard_modifiers(struct wl_listener *listener,
|
||||||
void *data) {
|
void *data) {
|
||||||
struct roots_keyboard *keyboard =
|
struct roots_keyboard *keyboard =
|
||||||
wl_container_of(listener, keyboard, keyboard_modifiers);
|
wl_container_of(listener, keyboard, keyboard_modifiers);
|
||||||
struct wlr_event_keyboard_modifiers *event = data;
|
roots_keyboard_handle_modifiers(keyboard);
|
||||||
roots_keyboard_handle_modifiers(keyboard, event);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void handle_cursor_motion(struct wl_listener *listener, void *data) {
|
static void handle_cursor_motion(struct wl_listener *listener, void *data) {
|
||||||
|
|
|
@ -41,6 +41,8 @@ static void keyboard_modifier_update(struct wlr_keyboard *keyboard) {
|
||||||
keyboard->modifiers.latched = latched;
|
keyboard->modifiers.latched = latched;
|
||||||
keyboard->modifiers.locked = locked;
|
keyboard->modifiers.locked = locked;
|
||||||
keyboard->modifiers.group = group;
|
keyboard->modifiers.group = group;
|
||||||
|
|
||||||
|
wl_signal_emit(&keyboard->events.modifiers, keyboard);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void keyboard_key_update(struct wlr_keyboard *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,
|
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) {
|
if (!keyboard->xkb_state) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
xkb_state_update_mask(keyboard->xkb_state, event->mods_depressed,
|
xkb_state_update_mask(keyboard->xkb_state, mods_depressed, mods_latched,
|
||||||
event->mods_latched, event->mods_locked, 0, 0, event->group);
|
mods_locked, 0, 0, group);
|
||||||
keyboard_modifier_update(keyboard);
|
keyboard_modifier_update(keyboard);
|
||||||
|
|
||||||
wl_signal_emit(&keyboard->events.modifiers, event);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void wlr_keyboard_notify_key(struct wlr_keyboard *keyboard,
|
void wlr_keyboard_notify_key(struct wlr_keyboard *keyboard,
|
||||||
|
|
Loading…
Reference in a new issue