Commit e8c0fe4e authored by Guido Gunther's avatar Guido Gunther
Browse files

settings: Drop device configuration from config file

We'll use the GSettings
parent 8e51b02c
......@@ -108,13 +108,6 @@ handle_new_input (struct wl_listener *listener, void *data)
PhocInput *input = wl_container_of (listener, input, new_input);
char *seat_name = ROOTS_CONFIG_DEFAULT_SEAT_NAME;
struct roots_device_config *dc =
roots_config_get_device (input->config, device);
if (dc) {
seat_name = dc->seat;
}
struct roots_seat *seat = phoc_input_get_seat (input, seat_name);
if (!seat) {
......@@ -127,17 +120,6 @@ handle_new_input (struct wl_listener *listener, void *data)
phoc_input_get_device_type (device->type), seat_name);
roots_seat_add_device (seat, device);
if (dc && wlr_input_device_is_libinput (device)) {
struct libinput_device *libinput_dev =
wlr_libinput_get_device_handle (device);
g_debug ("input has config, tap_enabled: %d\n", dc->tap_enabled);
if (dc->tap_enabled) {
libinput_device_config_tap_set_enabled (libinput_dev,
LIBINPUT_CONFIG_TAP_ENABLED);
}
}
}
static void
......
......@@ -238,40 +238,7 @@ static int config_ini_handler(void *user, const char *section, const char *name,
config_handle_cursor(config, ROOTS_CONFIG_DEFAULT_SEAT_NAME, name,
value);
} else if (strncmp(device_prefix, section, strlen(device_prefix)) == 0) {
const char *device_name = section + strlen(device_prefix);
struct roots_device_config *dc;
bool found = false;
wl_list_for_each(dc, &config->devices, link) {
if (strcmp(dc->name, device_name) == 0) {
found = true;
break;
}
}
if (!found) {
dc = calloc(1, sizeof(struct roots_device_config));
dc->name = strdup(device_name);
dc->seat = strdup(ROOTS_CONFIG_DEFAULT_SEAT_NAME);
wl_list_insert(&config->devices, &dc->link);
}
if (strcmp(name, "seat") == 0) {
free(dc->seat);
dc->seat = strdup(value);
} else if (strcmp(name, "tap_enabled") == 0) {
if (strcasecmp(value, "true") == 0) {
dc->tap_enabled = true;
} else if (strcasecmp(value, "false") == 0) {
dc->tap_enabled = false;
} else {
wlr_log(WLR_ERROR,
"got unknown tap_enabled value: %s",
value);
}
} else {
wlr_log(WLR_ERROR, "got unknown device config: %s", name);
}
g_warning ("Found unused 'device:' config section. Please remove");
} else if (strncmp(switch_prefix, section, strlen(switch_prefix)) == 0) {
const char *switch_name = section + strlen(switch_prefix);
add_switch_config(&config->switches, switch_name, name, value);
......@@ -291,7 +258,6 @@ struct roots_config *roots_config_create(const char *config_path) {
config->xwayland = true;
config->xwayland_lazy = true;
wl_list_init(&config->outputs);
wl_list_init(&config->devices);
wl_list_init(&config->cursors);
wl_list_init(&config->switches);
......@@ -341,13 +307,6 @@ void roots_config_destroy(struct roots_config *config) {
free(oc);
}
struct roots_device_config *dc, *dtmp = NULL;
wl_list_for_each_safe(dc, dtmp, &config->devices, link) {
free(dc->name);
free(dc->seat);
free(dc);
}
struct roots_cursor_config *cc, *ctmp = NULL;
wl_list_for_each_safe(cc, ctmp, &config->cursors, link) {
free(cc->seat);
......@@ -379,18 +338,6 @@ struct roots_output_config *roots_config_get_output(struct roots_config *config,
return NULL;
}
struct roots_device_config *roots_config_get_device(struct roots_config *config,
struct wlr_input_device *device) {
struct roots_device_config *d_config;
wl_list_for_each(d_config, &config->devices, link) {
if (strcmp(d_config->name, device->name) == 0) {
return d_config;
}
}
return NULL;
}
struct roots_cursor_config *roots_config_get_cursor(struct roots_config *config,
const char *seat_name) {
if (seat_name == NULL) {
......
......@@ -29,13 +29,6 @@ struct roots_output_config {
struct wl_list modes;
};
struct roots_device_config {
char *name;
char *seat;
bool tap_enabled;
struct wl_list link;
};
struct roots_cursor_config {
char *seat;
char *theme;
......@@ -58,7 +51,6 @@ struct roots_config {
PhocKeybindings *keybindings;
struct wl_list outputs;
struct wl_list devices;
struct wl_list cursors;
struct wl_list switches;
......@@ -82,13 +74,6 @@ void roots_config_destroy(struct roots_config *config);
struct roots_output_config *roots_config_get_output(struct roots_config *config,
struct wlr_output *output);
/**
* Get configuration for the device. If the device is not configured, returns
* NULL.
*/
struct roots_device_config *roots_config_get_device(struct roots_config *config,
struct wlr_input_device *device);
/**
* Get configuration for the keyboard. If the keyboard is not configured,
* returns NULL. A NULL device returns the default config for keyboards.
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment