remove assumption of one device per identifier
This commit is contained in:
parent
483ede0146
commit
4c436a1a6f
|
@ -83,17 +83,6 @@ static struct sway_input_device *input_sway_device_from_wlr(
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct sway_input_device *input_sway_device_from_config(
|
|
||||||
struct sway_input_manager *input, struct input_config *config) {
|
|
||||||
struct sway_input_device *input_device = NULL;
|
|
||||||
wl_list_for_each(input_device, &input->devices, link) {
|
|
||||||
if (strcmp(input_device->identifier, config->identifier) == 0) {
|
|
||||||
return input_device;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
static bool input_has_seat_configuration(struct sway_input_manager *input) {
|
static bool input_has_seat_configuration(struct sway_input_manager *input) {
|
||||||
struct sway_seat *seat = NULL;
|
struct sway_seat *seat = NULL;
|
||||||
wl_list_for_each(seat, &input->seats, link) {
|
wl_list_for_each(seat, &input->seats, link) {
|
||||||
|
@ -238,11 +227,9 @@ void sway_input_manager_set_focus(struct sway_input_manager *input,
|
||||||
|
|
||||||
void sway_input_manager_apply_input_config(struct sway_input_manager *input,
|
void sway_input_manager_apply_input_config(struct sway_input_manager *input,
|
||||||
struct input_config *input_config) {
|
struct input_config *input_config) {
|
||||||
struct sway_input_device *input_device =
|
struct sway_input_device *input_device = NULL;
|
||||||
input_sway_device_from_config(input, input_config);
|
wl_list_for_each(input_device, &input->devices, link) {
|
||||||
if (!input_device) {
|
if (strcmp(input_device->identifier, input_config->identifier) == 0) {
|
||||||
return;
|
|
||||||
}
|
|
||||||
input_device->config = input_config;
|
input_device->config = input_config;
|
||||||
|
|
||||||
struct sway_seat *seat = NULL;
|
struct sway_seat *seat = NULL;
|
||||||
|
@ -250,6 +237,8 @@ void sway_input_manager_apply_input_config(struct sway_input_manager *input,
|
||||||
sway_seat_configure_device(seat, input_device);
|
sway_seat_configure_device(seat, input_device);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void sway_input_manager_apply_seat_config(struct sway_input_manager *input,
|
void sway_input_manager_apply_seat_config(struct sway_input_manager *input,
|
||||||
struct seat_config *seat_config) {
|
struct seat_config *seat_config) {
|
||||||
|
|
|
@ -91,6 +91,8 @@ void sway_keyboard_configure(struct sway_keyboard *keyboard) {
|
||||||
wlr_keyboard_set_keymap(wlr_device->keyboard, keyboard->keymap);
|
wlr_keyboard_set_keymap(wlr_device->keyboard, keyboard->keymap);
|
||||||
wlr_keyboard_set_repeat_info(wlr_device->keyboard, 25, 600);
|
wlr_keyboard_set_repeat_info(wlr_device->keyboard, 25, 600);
|
||||||
xkb_context_unref(context);
|
xkb_context_unref(context);
|
||||||
|
struct wlr_seat *seat = keyboard->seat_device->sway_seat->wlr_seat;
|
||||||
|
wlr_seat_set_keyboard(seat, wlr_device);
|
||||||
|
|
||||||
wl_list_remove(&keyboard->keyboard_key.link);
|
wl_list_remove(&keyboard->keyboard_key.link);
|
||||||
wl_signal_add(&wlr_device->keyboard->events.key, &keyboard->keyboard_key);
|
wl_signal_add(&wlr_device->keyboard->events.key, &keyboard->keyboard_key);
|
||||||
|
|
Loading…
Reference in a new issue