evdev-touchpad: Set some options using weston.ini

This patch adds 3 new options to weston.ini to allow
the user to change default constant_accel_factor,
min_accel_factor and max_accel_factor. If no options
are set, it falls back using defaults as it did before.

v2: create weston_config_section_get_double and use it
instead of manualy converting string to double.

v3: add default values in weston_config_get_double
instead of using conditionals.

v4: don't pass diagonal as pointer.
This commit is contained in:
Armin K
2013-07-31 01:41:03 +02:00
committed by Kristian Høgsberg
parent 7ac9f73c7d
commit b502f906db
4 changed files with 70 additions and 5 deletions
+26
View File
@@ -335,6 +335,32 @@ weston_config_section_get_uint(struct weston_config_section *section,
return 0;
}
WL_EXPORT
int
weston_config_section_get_double(struct weston_config_section *section,
const char *key,
double *value, double default_value)
{
struct weston_config_entry *entry;
char *end;
entry = config_section_get_entry(section, key);
if (entry == NULL) {
*value = default_value;
errno = ENOENT;
return -1;
}
*value = strtod(entry->value, &end);
if (*end != '\0') {
*value = default_value;
errno = EINVAL;
return -1;
}
return 0;
}
WL_EXPORT
int
weston_config_section_get_string(struct weston_config_section *section,
+4
View File
@@ -88,6 +88,10 @@ weston_config_section_get_uint(struct weston_config_section *section,
const char *key,
uint32_t *value, uint32_t default_value);
int
weston_config_section_get_double(struct weston_config_section *section,
const char *key,
double *value, double default_value);
int
weston_config_section_get_string(struct weston_config_section *section,
const char *key,
char **value,