GUACAMOLE-630: Persist details of color scheme and font changes.
diff --git a/src/terminal/terminal.c b/src/terminal/terminal.c
index e502586..05bf720 100644
--- a/src/terminal/terminal.c
+++ b/src/terminal/terminal.c
@@ -343,6 +343,11 @@
term->upload_path_handler = NULL;
term->file_download_handler = NULL;
+ /* Copy initially-provided color scheme and font details */
+ term->color_scheme = strdup(color_scheme);
+ term->font_name = strdup(font_name);
+ term->font_size = font_size;
+
/* Set size of available screen area */
term->outer_width = width;
term->outer_height = height;
@@ -511,6 +516,10 @@
/* Free scrollbar */
guac_terminal_scrollbar_free(term->scrollbar);
+ /* Free copies of font and color scheme information */
+ free((char*) term->color_scheme);
+ free((char*) term->font_name);
+
/* Free the terminal itself */
free(term);
@@ -1955,6 +1964,16 @@
terminal->term_height - 1,
terminal->term_width - 1);
+ /* Acquire exclusive access to terminal */
+ guac_terminal_lock(terminal);
+
+ /* Update stored copy of color scheme */
+ free((char*) terminal->color_scheme);
+ terminal->color_scheme = strdup(color_scheme);
+
+ /* Release terminal */
+ guac_terminal_unlock(terminal);
+
guac_terminal_notify(terminal);
}
@@ -1979,6 +1998,20 @@
terminal->term_height - 1,
terminal->term_width - 1);
+ /* Acquire exclusive access to terminal */
+ guac_terminal_lock(terminal);
+
+ /* Update stored copy of font name, if changed */
+ if (font_name != NULL)
+ terminal->font_name = strdup(font_name);
+
+ /* Update stored copy of font size, if changed */
+ if (font_size != -1)
+ terminal->font_size = font_size;
+
+ /* Release terminal */
+ guac_terminal_unlock(terminal);
+
guac_terminal_notify(terminal);
}
diff --git a/src/terminal/terminal/terminal.h b/src/terminal/terminal/terminal.h
index c2fd456..e7746cb 100644
--- a/src/terminal/terminal/terminal.h
+++ b/src/terminal/terminal/terminal.h
@@ -507,6 +507,25 @@
guac_common_clipboard* clipboard;
/**
+ * The name of the font to use when rendering glyphs, as requested at
+ * creation time or via guac_terminal_apply_font().
+ */
+ const char* font_name;
+
+ /**
+ * The size of each glyph, in points, as requested at creation time or via
+ * guac_terminal_apply_font().
+ */
+ int font_size;
+
+ /**
+ * The name of the color scheme to use, as requested at creation time or
+ * via guac_terminal_apply_color_scheme(). This string must be in the
+ * format accepted by guac_terminal_parse_color_scheme().
+ */
+ const char* color_scheme;
+
+ /**
* ASCII character to send when backspace is pressed.
*/
char backspace;