|
|
@ -83,7 +83,8 @@ static struct sway_input_device *input_sway_device_from_wlr(
|
|
|
|
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) {
|
|
|
|
if (seat->config) {
|
|
|
|
struct seat_config *seat_config = seat_get_config(seat);
|
|
|
|
|
|
|
|
if (seat_config) {
|
|
|
|
return true;
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -225,11 +226,13 @@ static void handle_new_input(struct wl_listener *listener, void *data) {
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
struct seat_config *seat_config = seat_get_config(seat);
|
|
|
|
|
|
|
|
|
|
|
|
bool added = false;
|
|
|
|
bool added = false;
|
|
|
|
wl_list_for_each(seat, &input->seats, link) {
|
|
|
|
wl_list_for_each(seat, &input->seats, link) {
|
|
|
|
bool has_attachment = seat->config &&
|
|
|
|
bool has_attachment = config &&
|
|
|
|
(seat_config_get_attachment(seat->config, input_device->identifier) ||
|
|
|
|
(seat_config_get_attachment(seat_config, input_device->identifier) ||
|
|
|
|
seat_config_get_attachment(seat->config, "*"));
|
|
|
|
seat_config_get_attachment(seat_config, "*"));
|
|
|
|
|
|
|
|
|
|
|
|
if (has_attachment) {
|
|
|
|
if (has_attachment) {
|
|
|
|
seat_add_device(seat, input_device);
|
|
|
|
seat_add_device(seat, input_device);
|
|
|
@ -239,7 +242,7 @@ static void handle_new_input(struct wl_listener *listener, void *data) {
|
|
|
|
|
|
|
|
|
|
|
|
if (!added) {
|
|
|
|
if (!added) {
|
|
|
|
wl_list_for_each(seat, &input->seats, link) {
|
|
|
|
wl_list_for_each(seat, &input->seats, link) {
|
|
|
|
if (seat->config && seat->config->fallback == 1) {
|
|
|
|
if (seat_config && seat_config->fallback == 1) {
|
|
|
|
seat_add_device(seat, input_device);
|
|
|
|
seat_add_device(seat, input_device);
|
|
|
|
added = true;
|
|
|
|
added = true;
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -326,7 +329,7 @@ void input_manager_apply_seat_config(struct sway_input_manager *input,
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
seat_set_config(seat, seat_config);
|
|
|
|
seat_apply_config(seat, seat_config);
|
|
|
|
|
|
|
|
|
|
|
|
// for every device, try to add it to a seat and if no seat has it
|
|
|
|
// for every device, try to add it to a seat and if no seat has it
|
|
|
|
// attached, add it to the fallback seats.
|
|
|
|
// attached, add it to the fallback seats.
|
|
|
@ -335,11 +338,12 @@ void input_manager_apply_seat_config(struct sway_input_manager *input,
|
|
|
|
list_t *seat_list = create_list();
|
|
|
|
list_t *seat_list = create_list();
|
|
|
|
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) {
|
|
|
|
if (!seat->config) {
|
|
|
|
struct seat_config *seat_config = seat_get_config(seat);
|
|
|
|
|
|
|
|
if (!seat_config) {
|
|
|
|
continue;
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (seat_config_get_attachment(seat->config, "*") ||
|
|
|
|
if (seat_config_get_attachment(seat_config, "*") ||
|
|
|
|
seat_config_get_attachment(seat->config,
|
|
|
|
seat_config_get_attachment(seat_config,
|
|
|
|
input_device->identifier)) {
|
|
|
|
input_device->identifier)) {
|
|
|
|
list_add(seat_list, seat);
|
|
|
|
list_add(seat_list, seat);
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -362,7 +366,8 @@ void input_manager_apply_seat_config(struct sway_input_manager *input,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
wl_list_for_each(seat, &input->seats, link) {
|
|
|
|
wl_list_for_each(seat, &input->seats, link) {
|
|
|
|
if (seat->config && seat->config->fallback == 1) {
|
|
|
|
struct seat_config *seat_config = seat_get_config(seat);
|
|
|
|
|
|
|
|
if (seat_config && seat_config->fallback == 1) {
|
|
|
|
seat_add_device(seat, input_device);
|
|
|
|
seat_add_device(seat, input_device);
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
seat_remove_device(seat, input_device);
|
|
|
|
seat_remove_device(seat, input_device);
|
|
|
|