window.c: Port to use weston_config instead of old parser
authorKristian Høgsberg <krh@bitplanet.net>
Sun, 22 Sep 2013 05:26:10 +0000 (22:26 -0700)
committerKristian Høgsberg <krh@bitplanet.net>
Sun, 22 Sep 2013 05:26:10 +0000 (22:26 -0700)
clients/window.c

index 6854745..8d4ee3a 100644 (file)
@@ -1307,23 +1307,22 @@ static const struct cursor_alternatives cursors[] = {
 static void
 create_cursors(struct display *display)
 {
-       int config_fd;
+       struct weston_config *config;
+       struct weston_config_section *s;
+       int config_fd, size;
        char *theme = NULL;
-       unsigned int size = 32;
        unsigned int i, j;
        struct wl_cursor *cursor;
-       struct config_key shell_keys[] = {
-               { "cursor-theme", CONFIG_KEY_STRING, &theme },
-               { "cursor-size", CONFIG_KEY_UNSIGNED_INTEGER, &size },
-       };
-       struct config_section cs[] = {
-               { "shell", shell_keys, ARRAY_LENGTH(shell_keys), NULL },
-       };
 
        config_fd = open_config_file("weston.ini");
-       parse_config_file(config_fd, cs, ARRAY_LENGTH(cs), NULL);
+       config = weston_config_parse(config_fd);
        close(config_fd);
 
+       s = weston_config_get_section(config, "shell", NULL, NULL);
+       weston_config_section_get_string(s, "cursor-theme", &theme, NULL);
+       weston_config_section_get_int(s, "cursor-size", &size, 32);
+       weston_config_destroy(config);
+
        display->cursor_theme = wl_cursor_theme_load(theme, size, display->shm);
        display->cursors =
                xmalloc(ARRAY_LENGTH(cursors) * sizeof display->cursors[0]);