80col
This commit is contained in:
parent
53bb7ea996
commit
a82c107c76
|
@ -75,20 +75,20 @@ void apply_input_config(struct input_config *input) {
|
||||||
input_manager_apply_input_config(input_manager, input);
|
input_manager_apply_input_config(input_manager, input);
|
||||||
}
|
}
|
||||||
|
|
||||||
void apply_seat_config(struct seat_config *seat) {
|
void apply_seat_config(struct seat_config *seat_config) {
|
||||||
int i;
|
int i;
|
||||||
i = list_seq_find(config->seat_configs, seat_name_cmp, seat->name);
|
i = list_seq_find(config->seat_configs, seat_name_cmp, seat_config->name);
|
||||||
if (i >= 0) {
|
if (i >= 0) {
|
||||||
// merge existing config
|
// merge existing config
|
||||||
struct seat_config *sc = config->seat_configs->items[i];
|
struct seat_config *sc = config->seat_configs->items[i];
|
||||||
merge_seat_config(sc, seat);
|
merge_seat_config(sc, seat_config);
|
||||||
free_seat_config(seat);
|
free_seat_config(seat_config);
|
||||||
seat = sc;
|
seat_config = sc;
|
||||||
} else {
|
} else {
|
||||||
list_add(config->seat_configs, seat);
|
list_add(config->seat_configs, seat_config);
|
||||||
}
|
}
|
||||||
|
|
||||||
input_manager_apply_seat_config(input_manager, seat);
|
input_manager_apply_seat_config(input_manager, seat_config);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Keep alphabetized */
|
/* Keep alphabetized */
|
||||||
|
|
|
@ -14,7 +14,8 @@ struct cmd_results *cmd_seat(int argc, char **argv) {
|
||||||
free_seat_config(config->handler_context.seat_config);
|
free_seat_config(config->handler_context.seat_config);
|
||||||
config->handler_context.seat_config = new_seat_config(argv[0]);
|
config->handler_context.seat_config = new_seat_config(argv[0]);
|
||||||
if (!config->handler_context.seat_config) {
|
if (!config->handler_context.seat_config) {
|
||||||
return cmd_results_new(CMD_FAILURE, NULL, "Couldn't allocate config");
|
return cmd_results_new(CMD_FAILURE, NULL,
|
||||||
|
"Couldn't allocate config");
|
||||||
}
|
}
|
||||||
wlr_log(L_DEBUG, "entering seat block: %s", argv[0]);
|
wlr_log(L_DEBUG, "entering seat block: %s", argv[0]);
|
||||||
return cmd_results_new(CMD_BLOCK_SEAT, NULL, NULL);
|
return cmd_results_new(CMD_BLOCK_SEAT, NULL, NULL);
|
||||||
|
@ -28,7 +29,8 @@ struct cmd_results *cmd_seat(int argc, char **argv) {
|
||||||
if (!has_context) {
|
if (!has_context) {
|
||||||
config->handler_context.seat_config = new_seat_config(argv[0]);
|
config->handler_context.seat_config = new_seat_config(argv[0]);
|
||||||
if (!config->handler_context.seat_config) {
|
if (!config->handler_context.seat_config) {
|
||||||
return cmd_results_new(CMD_FAILURE, NULL, "Couldn't allocate config");
|
return cmd_results_new(CMD_FAILURE, NULL,
|
||||||
|
"Couldn't allocate config");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -41,7 +43,10 @@ struct cmd_results *cmd_seat(int argc, char **argv) {
|
||||||
} else if (strcasecmp("fallback", argv[1]) == 0) {
|
} else if (strcasecmp("fallback", argv[1]) == 0) {
|
||||||
res = seat_cmd_fallback(argc_new, argv_new);
|
res = seat_cmd_fallback(argc_new, argv_new);
|
||||||
} else {
|
} else {
|
||||||
res = cmd_results_new(CMD_INVALID, "seat <name>", "Unknown command %s", argv[1]);
|
res =
|
||||||
|
cmd_results_new(CMD_INVALID,
|
||||||
|
"seat <name>", "Unknown command %s",
|
||||||
|
argv[1]);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!has_context) {
|
if (!has_context) {
|
||||||
|
|
|
@ -92,7 +92,8 @@ static bool input_has_seat_configuration(struct sway_input_manager *input) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void input_manager_libinput_config_pointer(struct sway_input_device *input_device) {
|
static void input_manager_libinput_config_pointer(
|
||||||
|
struct sway_input_device *input_device) {
|
||||||
struct wlr_input_device *wlr_device = input_device->wlr_device;
|
struct wlr_input_device *wlr_device = input_device->wlr_device;
|
||||||
struct input_config *ic = input_device->config;
|
struct input_config *ic = input_device->config;
|
||||||
struct libinput_device *libinput_device;
|
struct libinput_device *libinput_device;
|
||||||
|
@ -102,22 +103,27 @@ static void input_manager_libinput_config_pointer(struct sway_input_device *inpu
|
||||||
}
|
}
|
||||||
|
|
||||||
libinput_device = wlr_libinput_get_device_handle(wlr_device);
|
libinput_device = wlr_libinput_get_device_handle(wlr_device);
|
||||||
wlr_log(L_DEBUG, "input_manager_libinput_config_pointer(%s)", ic->identifier);
|
wlr_log(L_DEBUG, "input_manager_libinput_config_pointer(%s)",
|
||||||
|
ic->identifier);
|
||||||
|
|
||||||
if (ic->accel_profile != INT_MIN) {
|
if (ic->accel_profile != INT_MIN) {
|
||||||
wlr_log(L_DEBUG, "libinput_config_pointer(%s) accel_set_profile(%d)",
|
wlr_log(L_DEBUG, "libinput_config_pointer(%s) accel_set_profile(%d)",
|
||||||
ic->identifier, ic->accel_profile);
|
ic->identifier, ic->accel_profile);
|
||||||
libinput_device_config_accel_set_profile(libinput_device, ic->accel_profile);
|
libinput_device_config_accel_set_profile(libinput_device,
|
||||||
|
ic->accel_profile);
|
||||||
}
|
}
|
||||||
if (ic->click_method != INT_MIN) {
|
if (ic->click_method != INT_MIN) {
|
||||||
wlr_log(L_DEBUG, "libinput_config_pointer(%s) click_set_method(%d)",
|
wlr_log(L_DEBUG, "libinput_config_pointer(%s) click_set_method(%d)",
|
||||||
ic->identifier, ic->click_method);
|
ic->identifier, ic->click_method);
|
||||||
libinput_device_config_click_set_method(libinput_device, ic->click_method);
|
libinput_device_config_click_set_method(libinput_device,
|
||||||
|
ic->click_method);
|
||||||
}
|
}
|
||||||
if (ic->drag_lock != INT_MIN) {
|
if (ic->drag_lock != INT_MIN) {
|
||||||
wlr_log(L_DEBUG, "libinput_config_pointer(%s) tap_set_drag_lock_enabled(%d)",
|
wlr_log(L_DEBUG,
|
||||||
|
"libinput_config_pointer(%s) tap_set_drag_lock_enabled(%d)",
|
||||||
ic->identifier, ic->click_method);
|
ic->identifier, ic->click_method);
|
||||||
libinput_device_config_tap_set_drag_lock_enabled(libinput_device, ic->drag_lock);
|
libinput_device_config_tap_set_drag_lock_enabled(libinput_device,
|
||||||
|
ic->drag_lock);
|
||||||
}
|
}
|
||||||
if (ic->dwt != INT_MIN) {
|
if (ic->dwt != INT_MIN) {
|
||||||
wlr_log(L_DEBUG, "libinput_config_pointer(%s) dwt_set_enabled(%d)",
|
wlr_log(L_DEBUG, "libinput_config_pointer(%s) dwt_set_enabled(%d)",
|
||||||
|
@ -125,34 +131,43 @@ static void input_manager_libinput_config_pointer(struct sway_input_device *inpu
|
||||||
libinput_device_config_dwt_set_enabled(libinput_device, ic->dwt);
|
libinput_device_config_dwt_set_enabled(libinput_device, ic->dwt);
|
||||||
}
|
}
|
||||||
if (ic->left_handed != INT_MIN) {
|
if (ic->left_handed != INT_MIN) {
|
||||||
wlr_log(L_DEBUG, "libinput_config_pointer(%s) left_handed_set_enabled(%d)",
|
wlr_log(L_DEBUG,
|
||||||
|
"libinput_config_pointer(%s) left_handed_set_enabled(%d)",
|
||||||
ic->identifier, ic->left_handed);
|
ic->identifier, ic->left_handed);
|
||||||
libinput_device_config_left_handed_set(libinput_device, ic->left_handed);
|
libinput_device_config_left_handed_set(libinput_device,
|
||||||
|
ic->left_handed);
|
||||||
}
|
}
|
||||||
if (ic->middle_emulation != INT_MIN) {
|
if (ic->middle_emulation != INT_MIN) {
|
||||||
wlr_log(L_DEBUG, "libinput_config_pointer(%s) middle_emulation_set_enabled(%d)",
|
wlr_log(L_DEBUG,
|
||||||
|
"libinput_config_pointer(%s) middle_emulation_set_enabled(%d)",
|
||||||
ic->identifier, ic->middle_emulation);
|
ic->identifier, ic->middle_emulation);
|
||||||
libinput_device_config_middle_emulation_set_enabled(libinput_device, ic->middle_emulation);
|
libinput_device_config_middle_emulation_set_enabled(libinput_device,
|
||||||
|
ic->middle_emulation);
|
||||||
}
|
}
|
||||||
if (ic->natural_scroll != INT_MIN) {
|
if (ic->natural_scroll != INT_MIN) {
|
||||||
wlr_log(L_DEBUG, "libinput_config_pointer(%s) natural_scroll_set_enabled(%d)",
|
wlr_log(L_DEBUG,
|
||||||
|
"libinput_config_pointer(%s) natural_scroll_set_enabled(%d)",
|
||||||
ic->identifier, ic->natural_scroll);
|
ic->identifier, ic->natural_scroll);
|
||||||
libinput_device_config_scroll_set_natural_scroll_enabled(libinput_device, ic->natural_scroll);
|
libinput_device_config_scroll_set_natural_scroll_enabled(
|
||||||
|
libinput_device, ic->natural_scroll);
|
||||||
}
|
}
|
||||||
if (ic->pointer_accel != FLT_MIN) {
|
if (ic->pointer_accel != FLT_MIN) {
|
||||||
wlr_log(L_DEBUG, "libinput_config_pointer(%s) accel_set_speed(%f)",
|
wlr_log(L_DEBUG, "libinput_config_pointer(%s) accel_set_speed(%f)",
|
||||||
ic->identifier, ic->pointer_accel);
|
ic->identifier, ic->pointer_accel);
|
||||||
libinput_device_config_accel_set_speed(libinput_device, ic->pointer_accel);
|
libinput_device_config_accel_set_speed(libinput_device,
|
||||||
|
ic->pointer_accel);
|
||||||
}
|
}
|
||||||
if (ic->scroll_method != INT_MIN) {
|
if (ic->scroll_method != INT_MIN) {
|
||||||
wlr_log(L_DEBUG, "libinput_config_pointer(%s) scroll_set_method(%d)",
|
wlr_log(L_DEBUG, "libinput_config_pointer(%s) scroll_set_method(%d)",
|
||||||
ic->identifier, ic->scroll_method);
|
ic->identifier, ic->scroll_method);
|
||||||
libinput_device_config_scroll_set_method(libinput_device, ic->scroll_method);
|
libinput_device_config_scroll_set_method(libinput_device,
|
||||||
|
ic->scroll_method);
|
||||||
}
|
}
|
||||||
if (ic->send_events != INT_MIN) {
|
if (ic->send_events != INT_MIN) {
|
||||||
wlr_log(L_DEBUG, "libinput_config_pointer(%s) send_events_set_mode(%d)",
|
wlr_log(L_DEBUG, "libinput_config_pointer(%s) send_events_set_mode(%d)",
|
||||||
ic->identifier, ic->send_events);
|
ic->identifier, ic->send_events);
|
||||||
libinput_device_config_send_events_set_mode(libinput_device, ic->send_events);
|
libinput_device_config_send_events_set_mode(libinput_device,
|
||||||
|
ic->send_events);
|
||||||
}
|
}
|
||||||
if (ic->tap != INT_MIN) {
|
if (ic->tap != INT_MIN) {
|
||||||
wlr_log(L_DEBUG, "libinput_config_pointer(%s) tap_set_enabled(%d)",
|
wlr_log(L_DEBUG, "libinput_config_pointer(%s) tap_set_enabled(%d)",
|
||||||
|
|
|
@ -49,7 +49,8 @@ static void handle_seat_container_destroy(struct wl_listener *listener,
|
||||||
if (is_focus) {
|
if (is_focus) {
|
||||||
// pick next focus
|
// pick next focus
|
||||||
seat_set_focus(seat, NULL);
|
seat_set_focus(seat, NULL);
|
||||||
struct sway_container *next = seat_get_focus_inactive(seat, con->parent);
|
struct sway_container *next =
|
||||||
|
seat_get_focus_inactive(seat, con->parent);
|
||||||
if (next == NULL) {
|
if (next == NULL) {
|
||||||
next = con->parent;
|
next = con->parent;
|
||||||
}
|
}
|
||||||
|
@ -133,7 +134,8 @@ struct sway_seat *seat_create(struct sway_input_manager *input,
|
||||||
// init the focus stack
|
// init the focus stack
|
||||||
wl_list_init(&seat->focus_stack);
|
wl_list_init(&seat->focus_stack);
|
||||||
|
|
||||||
container_for_each_descendant_dfs(&root_container, collect_focus_iter, seat);
|
container_for_each_descendant_dfs(&root_container,
|
||||||
|
collect_focus_iter, seat);
|
||||||
|
|
||||||
wl_signal_add(&root_container.sway_root->events.new_container,
|
wl_signal_add(&root_container.sway_root->events.new_container,
|
||||||
&seat->new_container);
|
&seat->new_container);
|
||||||
|
@ -165,7 +167,8 @@ static void seat_configure_keyboard(struct sway_seat *seat,
|
||||||
if (!seat_device->keyboard) {
|
if (!seat_device->keyboard) {
|
||||||
sway_keyboard_create(seat, seat_device);
|
sway_keyboard_create(seat, seat_device);
|
||||||
}
|
}
|
||||||
struct wlr_keyboard *wlr_keyboard = seat_device->input_device->wlr_device->keyboard;
|
struct wlr_keyboard *wlr_keyboard =
|
||||||
|
seat_device->input_device->wlr_device->keyboard;
|
||||||
sway_keyboard_configure(seat_device->keyboard);
|
sway_keyboard_configure(seat_device->keyboard);
|
||||||
wlr_seat_set_keyboard(seat->wlr_seat,
|
wlr_seat_set_keyboard(seat->wlr_seat,
|
||||||
seat_device->input_device->wlr_device);
|
seat_device->input_device->wlr_device);
|
||||||
|
@ -275,7 +278,8 @@ void seat_configure_xcursor(struct sway_seat *seat) {
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int i = 0; i < root_container.children->length; ++i) {
|
for (int i = 0; i < root_container.children->length; ++i) {
|
||||||
struct sway_container *output_container = root_container.children->items[i];
|
struct sway_container *output_container =
|
||||||
|
root_container.children->items[i];
|
||||||
struct wlr_output *output =
|
struct wlr_output *output =
|
||||||
output_container->sway_output->wlr_output;
|
output_container->sway_output->wlr_output;
|
||||||
bool result =
|
bool result =
|
||||||
|
@ -379,7 +383,8 @@ void seat_set_focus(struct sway_seat *seat,
|
||||||
seat_set_focus_warp(seat, container, true);
|
seat_set_focus_warp(seat, container, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
struct sway_container *seat_get_focus_inactive(struct sway_seat *seat, struct sway_container *container) {
|
struct sway_container *seat_get_focus_inactive(struct sway_seat *seat,
|
||||||
|
struct sway_container *container) {
|
||||||
struct sway_seat_container *current = NULL;
|
struct sway_seat_container *current = NULL;
|
||||||
struct sway_container *parent = NULL;
|
struct sway_container *parent = NULL;
|
||||||
wl_list_for_each(current, &seat->focus_stack, link) {
|
wl_list_for_each(current, &seat->focus_stack, link) {
|
||||||
|
@ -409,7 +414,8 @@ struct sway_container *seat_get_focus(struct sway_seat *seat) {
|
||||||
|
|
||||||
struct sway_container *seat_get_focus_by_type(struct sway_seat *seat,
|
struct sway_container *seat_get_focus_by_type(struct sway_seat *seat,
|
||||||
enum sway_container_type type) {
|
enum sway_container_type type) {
|
||||||
struct sway_container *focus = seat_get_focus_inactive(seat, &root_container);
|
struct sway_container *focus =
|
||||||
|
seat_get_focus_inactive(seat, &root_container);
|
||||||
if (focus->type == type) {
|
if (focus->type == type) {
|
||||||
return focus;
|
return focus;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue