mirror of
https://github.com/hyprwm/wlroots-hyprland.git
synced 2024-11-09 15:05:58 +01:00
move keyboard to seat
This commit is contained in:
parent
9bd0f47efd
commit
5354fe8729
13 changed files with 176 additions and 43 deletions
|
@ -54,6 +54,7 @@ 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,6 +151,7 @@ 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;
|
||||||
|
@ -162,8 +163,15 @@ 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);
|
||||||
wlr_keyboard_notify_modifiers(dev->keyboard, mods_depressed, mods_latched,
|
struct wlr_event_keyboard_modifiers wlr_event;
|
||||||
mods_locked, group);
|
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);
|
||||||
}
|
}
|
||||||
|
|
||||||
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,6 +50,7 @@ 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 ?
|
||||||
|
|
|
@ -67,6 +67,7 @@ struct roots_input {
|
||||||
struct wl_list pointers;
|
struct wl_list pointers;
|
||||||
struct wl_list touch;
|
struct wl_list touch;
|
||||||
struct wl_list tablet_tools;
|
struct wl_list tablet_tools;
|
||||||
|
struct wl_list seats;
|
||||||
|
|
||||||
struct wl_listener input_add;
|
struct wl_listener input_add;
|
||||||
struct wl_listener input_remove;
|
struct wl_listener input_remove;
|
||||||
|
|
|
@ -8,21 +8,28 @@
|
||||||
|
|
||||||
struct roots_keyboard {
|
struct roots_keyboard {
|
||||||
struct roots_input *input;
|
struct roots_input *input;
|
||||||
|
struct roots_seat *seat;
|
||||||
struct wlr_input_device *device;
|
struct wlr_input_device *device;
|
||||||
struct wl_listener key;
|
struct wl_list seat_link;
|
||||||
struct wl_listener modifiers;
|
// XXX temporary
|
||||||
struct wl_list link;
|
struct wl_list link;
|
||||||
|
|
||||||
|
struct wl_listener keyboard_key;
|
||||||
|
struct wl_listener keyboard_modifiers;
|
||||||
|
|
||||||
xkb_keysym_t pressed_keysyms[ROOTS_KEYBOARD_PRESSED_KEYSYMS_CAP];
|
xkb_keysym_t pressed_keysyms[ROOTS_KEYBOARD_PRESSED_KEYSYMS_CAP];
|
||||||
};
|
};
|
||||||
|
|
||||||
struct roots_keyboard *roots_keyboard_create(struct wlr_input_device *device,
|
struct roots_keyboard *roots_keyboard_create(struct wlr_input_device *device,
|
||||||
struct roots_input *input);
|
struct roots_input *input);
|
||||||
void roots_keyboard_destroy(struct wlr_input_device *device, struct roots_input *input);
|
|
||||||
|
void roots_keyboard_destroy(struct wlr_input_device *device,
|
||||||
|
struct roots_input *input);
|
||||||
|
|
||||||
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
|
||||||
|
|
26
include/rootston/seat.h
Normal file
26
include/rootston/seat.h
Normal file
|
@ -0,0 +1,26 @@
|
||||||
|
#ifndef _ROOTSTON_SEAT_H
|
||||||
|
#define _ROOTSTON_SEAT_H
|
||||||
|
|
||||||
|
#include <wayland-server.h>
|
||||||
|
|
||||||
|
#include "rootston/input.h"
|
||||||
|
#include "rootston/keyboard.h"
|
||||||
|
|
||||||
|
struct roots_seat {
|
||||||
|
struct roots_input *input;
|
||||||
|
struct wlr_seat *seat;
|
||||||
|
struct wl_list keyboards;
|
||||||
|
struct wl_list link;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct roots_seat *roots_seat_create(struct roots_input *input, char *name);
|
||||||
|
|
||||||
|
void roots_seat_destroy(struct roots_seat *seat);
|
||||||
|
|
||||||
|
void roots_seat_add_keyboard(struct roots_seat *seat,
|
||||||
|
struct roots_keyboard *keyboard);
|
||||||
|
|
||||||
|
void roots_seat_remove_keyboard(struct roots_seat *seat,
|
||||||
|
struct roots_keyboard *keyboard);
|
||||||
|
|
||||||
|
#endif
|
|
@ -14,7 +14,6 @@ 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,
|
||||||
uint32_t mods_depressed, uint32_t mods_latched, uint32_t mods_locked,
|
struct wlr_event_keyboard_modifiers *event);
|
||||||
uint32_t group);
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -63,12 +63,23 @@ 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);
|
||||||
|
|
|
@ -12,6 +12,7 @@
|
||||||
#include "rootston/keyboard.h"
|
#include "rootston/keyboard.h"
|
||||||
#include "rootston/pointer.h"
|
#include "rootston/pointer.h"
|
||||||
#include "rootston/touch.h"
|
#include "rootston/touch.h"
|
||||||
|
#include "rootston/seat.h"
|
||||||
|
|
||||||
static const char *device_type(enum wlr_input_device_type type) {
|
static const char *device_type(enum wlr_input_device_type type) {
|
||||||
switch (type) {
|
switch (type) {
|
||||||
|
@ -29,15 +30,42 @@ static const char *device_type(enum wlr_input_device_type type) {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static struct roots_seat *input_get_seat(struct roots_input *input, char *name) {
|
||||||
|
struct roots_seat *seat = NULL;
|
||||||
|
wl_list_for_each(seat, &input->seats, link) {
|
||||||
|
if (strcmp(seat->seat->name, name) == 0) {
|
||||||
|
return seat;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
seat = roots_seat_create(input, name);
|
||||||
|
return seat;
|
||||||
|
}
|
||||||
|
|
||||||
static void input_add_notify(struct wl_listener *listener, void *data) {
|
static void input_add_notify(struct wl_listener *listener, void *data) {
|
||||||
struct wlr_input_device *device = data;
|
struct wlr_input_device *device = data;
|
||||||
struct roots_input *input = wl_container_of(listener, input, input_add);
|
struct roots_input *input = wl_container_of(listener, input, input_add);
|
||||||
|
|
||||||
|
char *seat_name = "seat0";
|
||||||
|
struct device_config *dc = config_get_device(input->config, device);
|
||||||
|
if (dc) {
|
||||||
|
seat_name = dc->seat;
|
||||||
|
}
|
||||||
|
|
||||||
|
struct roots_seat *seat = input_get_seat(input, seat_name);
|
||||||
|
if (!seat) {
|
||||||
|
wlr_log(L_ERROR, "could not create roots seat");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
wlr_log(L_DEBUG, "New input device: %s (%d:%d) %s", device->name,
|
wlr_log(L_DEBUG, "New input device: %s (%d:%d) %s", device->name,
|
||||||
device->vendor, device->product, device_type(device->type));
|
device->vendor, device->product, device_type(device->type));
|
||||||
switch (device->type) {
|
switch (device->type) {
|
||||||
case WLR_INPUT_DEVICE_KEYBOARD:
|
case WLR_INPUT_DEVICE_KEYBOARD: {
|
||||||
roots_keyboard_create(device, input);
|
struct roots_keyboard *keyboard = roots_keyboard_create(device, input);
|
||||||
|
roots_seat_add_keyboard(seat, keyboard);
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
case WLR_INPUT_DEVICE_POINTER:
|
case WLR_INPUT_DEVICE_POINTER:
|
||||||
pointer_add(device, input);
|
pointer_add(device, input);
|
||||||
break;
|
break;
|
||||||
|
@ -123,6 +151,7 @@ struct roots_input *input_create(struct roots_server *server,
|
||||||
wl_list_init(&input->pointers);
|
wl_list_init(&input->pointers);
|
||||||
wl_list_init(&input->touch);
|
wl_list_init(&input->touch);
|
||||||
wl_list_init(&input->tablet_tools);
|
wl_list_init(&input->tablet_tools);
|
||||||
|
wl_list_init(&input->seats);
|
||||||
|
|
||||||
input->input_add.notify = input_add_notify;
|
input->input_add.notify = input_add_notify;
|
||||||
wl_signal_add(&server->backend->events.input_add, &input->input_add);
|
wl_signal_add(&server->backend->events.input_add, &input->input_add);
|
||||||
|
|
|
@ -10,6 +10,7 @@
|
||||||
#include <wlr/util/log.h>
|
#include <wlr/util/log.h>
|
||||||
#include <xkbcommon/xkbcommon.h>
|
#include <xkbcommon/xkbcommon.h>
|
||||||
#include "rootston/input.h"
|
#include "rootston/input.h"
|
||||||
|
#include "rootston/seat.h"
|
||||||
#include "rootston/keyboard.h"
|
#include "rootston/keyboard.h"
|
||||||
|
|
||||||
static ssize_t keyboard_pressed_keysym_index(struct roots_keyboard *keyboard,
|
static ssize_t keyboard_pressed_keysym_index(struct roots_keyboard *keyboard,
|
||||||
|
@ -85,8 +86,8 @@ static bool keyboard_keysym_press(struct roots_keyboard *keyboard,
|
||||||
}
|
}
|
||||||
|
|
||||||
if (keysym == XKB_KEY_Escape) {
|
if (keysym == XKB_KEY_Escape) {
|
||||||
wlr_seat_pointer_end_grab(keyboard->input->wl_seat);
|
wlr_seat_pointer_end_grab(keyboard->seat->seat);
|
||||||
wlr_seat_keyboard_end_grab(keyboard->input->wl_seat);
|
wlr_seat_keyboard_end_grab(keyboard->seat->seat);
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t modifiers = wlr_keyboard_get_modifiers(keyboard->device->keyboard);
|
uint32_t modifiers = wlr_keyboard_get_modifiers(keyboard->device->keyboard);
|
||||||
|
@ -141,20 +142,15 @@ void roots_keyboard_handle_key(struct roots_keyboard *keyboard,
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!handled) {
|
if (!handled) {
|
||||||
wlr_seat_set_keyboard(keyboard->input->wl_seat, keyboard->device);
|
wlr_seat_set_keyboard(keyboard->seat->seat, keyboard->device);
|
||||||
wlr_seat_keyboard_notify_key(keyboard->input->wl_seat, event->time_msec,
|
wlr_seat_keyboard_notify_key(keyboard->seat->seat, event->time_msec,
|
||||||
event->keycode, event->state);
|
event->keycode, event->state);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void handle_keyboard_key(struct wl_listener *listener, void *data) {
|
void roots_keyboard_handle_modifiers(struct roots_keyboard *r_keyboard,
|
||||||
struct roots_keyboard *keyboard = wl_container_of(listener, keyboard, key);
|
struct wlr_event_keyboard_modifiers *event) {
|
||||||
struct wlr_event_keyboard_key *event = data;
|
struct wlr_seat *seat = r_keyboard->seat->seat;
|
||||||
roots_keyboard_handle_key(keyboard, event);
|
|
||||||
}
|
|
||||||
|
|
||||||
void roots_keyboard_handle_modifiers(struct roots_keyboard *r_keyboard) {
|
|
||||||
struct wlr_seat *seat = r_keyboard->input->wl_seat;
|
|
||||||
struct wlr_keyboard *keyboard = r_keyboard->device->keyboard;
|
struct wlr_keyboard *keyboard = r_keyboard->device->keyboard;
|
||||||
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,
|
||||||
|
@ -164,12 +160,6 @@ void roots_keyboard_handle_modifiers(struct roots_keyboard *r_keyboard) {
|
||||||
keyboard->modifiers.group);
|
keyboard->modifiers.group);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void handle_keyboard_modifiers(struct wl_listener *listener, void *data) {
|
|
||||||
struct roots_keyboard *r_keyboard =
|
|
||||||
wl_container_of(listener, r_keyboard, modifiers);
|
|
||||||
roots_keyboard_handle_modifiers(r_keyboard);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void keyboard_config_merge(struct keyboard_config *config,
|
static void keyboard_config_merge(struct keyboard_config *config,
|
||||||
struct keyboard_config *fallback) {
|
struct keyboard_config *fallback) {
|
||||||
if (fallback == NULL) {
|
if (fallback == NULL) {
|
||||||
|
@ -192,7 +182,8 @@ static void keyboard_config_merge(struct keyboard_config *config,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
struct roots_keyboard *roots_keyboard_create(struct wlr_input_device *device, struct roots_input *input) {
|
struct roots_keyboard *roots_keyboard_create(struct wlr_input_device *device,
|
||||||
|
struct roots_input *input) {
|
||||||
struct roots_keyboard *keyboard = calloc(sizeof(struct roots_keyboard), 1);
|
struct roots_keyboard *keyboard = calloc(sizeof(struct roots_keyboard), 1);
|
||||||
if (keyboard == NULL) {
|
if (keyboard == NULL) {
|
||||||
return NULL;
|
return NULL;
|
||||||
|
@ -201,12 +192,7 @@ struct roots_keyboard *roots_keyboard_create(struct wlr_input_device *device, st
|
||||||
keyboard->device = device;
|
keyboard->device = device;
|
||||||
keyboard->input = input;
|
keyboard->input = input;
|
||||||
|
|
||||||
keyboard->key.notify = handle_keyboard_key;
|
// XXX temporary
|
||||||
wl_signal_add(&device->keyboard->events.key, &keyboard->key);
|
|
||||||
|
|
||||||
keyboard->modifiers.notify = handle_keyboard_modifiers;
|
|
||||||
wl_signal_add(&device->keyboard->events.modifiers, &keyboard->modifiers);
|
|
||||||
|
|
||||||
wl_list_insert(&input->keyboards, &keyboard->link);
|
wl_list_insert(&input->keyboards, &keyboard->link);
|
||||||
|
|
||||||
struct keyboard_config config;
|
struct keyboard_config config;
|
||||||
|
@ -244,8 +230,6 @@ struct roots_keyboard *roots_keyboard_create(struct wlr_input_device *device, st
|
||||||
|
|
||||||
void roots_keyboard_destroy(struct wlr_input_device *device, struct roots_input *input) {
|
void roots_keyboard_destroy(struct wlr_input_device *device, struct roots_input *input) {
|
||||||
struct roots_keyboard *keyboard = device->data;
|
struct roots_keyboard *keyboard = device->data;
|
||||||
wl_list_remove(&keyboard->key.link);
|
|
||||||
wl_list_remove(&keyboard->modifiers.link);
|
|
||||||
wl_list_remove(&keyboard->link);
|
wl_list_remove(&keyboard->link);
|
||||||
free(keyboard);
|
free(keyboard);
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,6 +8,7 @@ sources = [
|
||||||
'main.c',
|
'main.c',
|
||||||
'output.c',
|
'output.c',
|
||||||
'pointer.c',
|
'pointer.c',
|
||||||
|
'seat.c',
|
||||||
'tablet_tool.c',
|
'tablet_tool.c',
|
||||||
'touch.c',
|
'touch.c',
|
||||||
'xcursor.c',
|
'xcursor.c',
|
||||||
|
|
66
rootston/seat.c
Normal file
66
rootston/seat.c
Normal file
|
@ -0,0 +1,66 @@
|
||||||
|
#include <wayland-server.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
|
||||||
|
#include "rootston/input.h"
|
||||||
|
#include "rootston/seat.h"
|
||||||
|
#include "rootston/keyboard.h"
|
||||||
|
|
||||||
|
static void handle_keyboard_key(struct wl_listener *listener, void *data) {
|
||||||
|
struct roots_keyboard *keyboard =
|
||||||
|
wl_container_of(listener, keyboard, keyboard_key);
|
||||||
|
struct wlr_event_keyboard_key *event = data;
|
||||||
|
roots_keyboard_handle_key(keyboard, event);
|
||||||
|
}
|
||||||
|
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
|
||||||
|
struct roots_seat *roots_seat_create(struct roots_input *input, char *name) {
|
||||||
|
struct roots_seat *seat = calloc(1, sizeof(struct roots_seat));
|
||||||
|
if (!seat) {
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
seat->seat = wlr_seat_create(input->server->wl_display, name);
|
||||||
|
wlr_seat_set_capabilities(seat->seat,
|
||||||
|
WL_SEAT_CAPABILITY_KEYBOARD |
|
||||||
|
WL_SEAT_CAPABILITY_POINTER |
|
||||||
|
WL_SEAT_CAPABILITY_TOUCH);
|
||||||
|
seat->input = input;
|
||||||
|
wl_list_insert(&input->seats, &seat->link);
|
||||||
|
wl_list_init(&seat->keyboards);
|
||||||
|
|
||||||
|
return seat;
|
||||||
|
}
|
||||||
|
|
||||||
|
void roots_seat_destroy(struct roots_seat *seat) {
|
||||||
|
// TODO
|
||||||
|
}
|
||||||
|
|
||||||
|
void roots_seat_add_keyboard(struct roots_seat *seat,
|
||||||
|
struct roots_keyboard *keyboard) {
|
||||||
|
if (keyboard->seat) {
|
||||||
|
roots_seat_remove_keyboard(keyboard->seat, keyboard);
|
||||||
|
}
|
||||||
|
keyboard->seat = seat;
|
||||||
|
wl_list_insert(&seat->keyboards, &keyboard->seat_link);
|
||||||
|
|
||||||
|
keyboard->keyboard_key.notify = handle_keyboard_key;
|
||||||
|
wl_signal_add(&keyboard->device->keyboard->events.key,
|
||||||
|
&keyboard->keyboard_key);
|
||||||
|
|
||||||
|
keyboard->keyboard_modifiers.notify = handle_keyboard_modifiers;
|
||||||
|
wl_signal_add(&keyboard->device->keyboard->events.modifiers,
|
||||||
|
&keyboard->keyboard_modifiers);
|
||||||
|
}
|
||||||
|
|
||||||
|
void roots_seat_remove_keyboard(struct roots_seat *seat,
|
||||||
|
struct roots_keyboard *keyboard) {
|
||||||
|
// TODO
|
||||||
|
}
|
||||||
|
|
|
@ -41,19 +41,18 @@ 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);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
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,
|
struct wlr_event_keyboard_modifiers *event) {
|
||||||
uint32_t group) {
|
|
||||||
if (!keyboard->xkb_state) {
|
if (!keyboard->xkb_state) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
xkb_state_update_mask(keyboard->xkb_state, mods_depressed, mods_latched,
|
xkb_state_update_mask(keyboard->xkb_state, event->mods_depressed,
|
||||||
mods_locked, 0, 0, group);
|
event->mods_latched, event->mods_locked, 0, 0, event->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