summaryrefslogtreecommitdiff
path: root/shared
diff options
context:
space:
mode:
authorArmin K <krejzi@email.com>2013-07-31 01:41:03 +0200
committerKristian Høgsberg <krh@bitplanet.net>2013-08-12 22:42:17 -0700
commitb502f906db71ceae53c4f9514a0d71e2e90cfba5 (patch)
treeec33045a9b58b9318043245e3ff342c9a40f6140 /shared
parent7ac9f73c7ddfecd6f81fb907c4e61ed2339c95d8 (diff)
downloadweston-b502f906db71ceae53c4f9514a0d71e2e90cfba5.tar.gz
weston-b502f906db71ceae53c4f9514a0d71e2e90cfba5.tar.bz2
weston-b502f906db71ceae53c4f9514a0d71e2e90cfba5.zip
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.
Diffstat (limited to 'shared')
-rw-r--r--shared/config-parser.c26
-rw-r--r--shared/config-parser.h4
2 files changed, 30 insertions, 0 deletions
diff --git a/shared/config-parser.c b/shared/config-parser.c
index 4e6cf7fb..f98209cb 100644
--- a/shared/config-parser.c
+++ b/shared/config-parser.c
@@ -337,6 +337,32 @@ weston_config_section_get_uint(struct weston_config_section *section,
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,
const char *key,
char **value, const char *default_value)
diff --git a/shared/config-parser.h b/shared/config-parser.h
index 794e09cd..410a7ef1 100644
--- a/shared/config-parser.h
+++ b/shared/config-parser.h
@@ -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,