mirror of
https://gitlab.freedesktop.org/wayland/weston.git
synced 2026-04-22 03:30:48 +02:00
terminal: Port to new weston_config parse
This commit is contained in:
parent
b12e35617c
commit
9c3dee18ce
1 changed files with 11 additions and 19 deletions
|
|
@ -44,9 +44,9 @@
|
|||
#include "window.h"
|
||||
|
||||
static int option_fullscreen;
|
||||
static char *option_font = "mono";
|
||||
static int option_font_size = 14;
|
||||
static char *option_term = "xterm";
|
||||
static char *option_font;
|
||||
static int option_font_size;
|
||||
static char *option_term;
|
||||
static char *option_shell;
|
||||
|
||||
static struct wl_list terminal_list;
|
||||
|
|
@ -2781,17 +2781,6 @@ terminal_run(struct terminal *terminal, const char *path)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static const struct config_key terminal_config_keys[] = {
|
||||
{ "font", CONFIG_KEY_STRING, &option_font },
|
||||
{ "font-size", CONFIG_KEY_INTEGER, &option_font_size },
|
||||
{ "term", CONFIG_KEY_STRING, &option_term },
|
||||
};
|
||||
|
||||
static const struct config_section config_sections[] = {
|
||||
{ "terminal",
|
||||
terminal_config_keys, ARRAY_LENGTH(terminal_config_keys) },
|
||||
};
|
||||
|
||||
static const struct weston_option terminal_options[] = {
|
||||
{ WESTON_OPTION_BOOLEAN, "fullscreen", 'f', &option_fullscreen },
|
||||
{ WESTON_OPTION_STRING, "font", 0, &option_font },
|
||||
|
|
@ -2802,6 +2791,8 @@ int main(int argc, char *argv[])
|
|||
{
|
||||
struct display *d;
|
||||
struct terminal *terminal;
|
||||
struct weston_config *config;
|
||||
struct weston_config_section *s;
|
||||
int config_fd;
|
||||
|
||||
/* as wcwidth is locale-dependent,
|
||||
|
|
@ -2813,13 +2804,14 @@ int main(int argc, char *argv[])
|
|||
option_shell = "/bin/bash";
|
||||
|
||||
config_fd = open_config_file("weston.ini");
|
||||
parse_config_file(config_fd,
|
||||
config_sections, ARRAY_LENGTH(config_sections),
|
||||
NULL);
|
||||
config = weston_config_parse(config_fd);
|
||||
close(config_fd);
|
||||
|
||||
parse_options(terminal_options,
|
||||
ARRAY_LENGTH(terminal_options), &argc, argv);
|
||||
s = weston_config_get_section(config, "terminal", NULL, NULL);
|
||||
weston_config_section_get_string(s, "font", &option_font, "mono");
|
||||
weston_config_section_get_int(s, "font-size", &option_font_size, 14);
|
||||
weston_config_section_get_string(s, "term", &option_term, "xterm");
|
||||
weston_config_destroy(config);
|
||||
|
||||
d = display_create(&argc, argv);
|
||||
if (d == NULL) {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue