aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSamuel G. Fadel <samuelfadel@gmail.com>2013-02-02 21:07:41 -0200
committerSamuel G. Fadel <samuelfadel@gmail.com>2013-02-02 21:07:49 -0200
commitf967d6eee9d248fb42d37196d776c5ec210e2386 (patch)
tree66c1645bced2f7cd17c0c22dcd91b8318edf876a
parentf1af5208777cb655dbee3ed126bb36de5939071f (diff)
Color parsing done only once now.
-rw-r--r--src/T.c22
1 files changed, 14 insertions, 8 deletions
diff --git a/src/T.c b/src/T.c
index 93e838a..5be140e 100644
--- a/src/T.c
+++ b/src/T.c
@@ -106,22 +106,28 @@ static void
set_app_preferences(VteTerminal *terminal)
{
/*
- * Options set here can be configured through config.h
+ * Options set here can (and should) be configured through config.h
*/
- int i;
- GdkColor palette[PALETTE_SIZE], bg_color, fg_color;
+ static gboolean colors_parsed = FALSE;
+ static GdkColor palette[PALETTE_SIZE], bg_color, fg_color;
+
+ if (!colors_parsed) {
+ int i;
+
+ gdk_color_parse(FOREGROUND_COLOR, &fg_color);
+ gdk_color_parse(BACKGROUND_COLOR, &bg_color);
+ for (i = 0; i < PALETTE_SIZE; ++i)
+ gdk_color_parse(COLOR_PALETTE[i], &palette[i]);
+
+ colors_parsed = TRUE;
+ }
/* Set preferences */
vte_terminal_set_mouse_autohide(terminal, MOUSE_AUTOHIDE);
vte_terminal_set_visible_bell(terminal, VISIBLE_BELL);
vte_terminal_set_audible_bell(terminal, AUDIBLE_BELL);
vte_terminal_set_font_from_string(terminal, FONT_NAME);
-
- gdk_color_parse(FOREGROUND_COLOR, &fg_color);
- gdk_color_parse(BACKGROUND_COLOR, &bg_color);
- for (i = 0; i < PALETTE_SIZE; ++i)
- gdk_color_parse(COLOR_PALETTE[i], &palette[i]);
vte_terminal_set_colors(terminal, &fg_color, &bg_color, palette, PALETTE_SIZE);
}