[vte/vte-0-36] emulation: Add support for OSC 1?1[017] (fg, bg, highlight colors)
- From: Egmont Koblinger <egmontkob src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [vte/vte-0-36] emulation: Add support for OSC 1?1[017] (fg, bg, highlight colors)
- Date: Tue, 21 Jan 2014 23:19:17 +0000 (UTC)
commit 1b8c6b1aac587b79476a60a5830385abc939430d
Author: Egmont Koblinger <egmont gmail com>
Date: Wed Jan 22 00:13:51 2014 +0100
emulation: Add support for OSC 1?1[017] (fg, bg, highlight colors)
https://bugzilla.gnome.org/show_bug.cgi?id=567444
src/caps.c | 34 ++++++++++++++++++++----
src/osc | 6 ++++
src/vteseq-n.gperf | 17 ++++++++++--
src/vteseq.c | 70 ++++++++++++++++++++++++++++++++++++++++++++++------
4 files changed, 110 insertions(+), 17 deletions(-)
---
diff --git a/src/caps.c b/src/caps.c
index d9f52a3..f5e6511 100644
--- a/src/caps.c
+++ b/src/caps.c
@@ -530,16 +530,27 @@ struct _vte_capability_string _vte_xterm_capability_strings[] = {
{OSC "11;%s" BEL, "change-background-colors", 0},
{OSC "12;%s" BEL, "change-cursor-colors", 0},
{OSC "13;%s" BEL, "change-mouse-cursor-foreground-colors", 0},
- {OSC "14;%s" BEL, "change-mouse-cursor-foreground-colors", 0},
- {OSC "15;%s" BEL, "change-tek-background-colors", 0},
+ {OSC "14;%s" BEL, "change-mouse-cursor-background-colors", 0},
+ {OSC "15;%s" BEL, "change-tek-foreground-colors", 0},
{OSC "16;%s" BEL, "change-tek-background-colors", 0},
- {OSC "17;%s" BEL, "change-highlight-colors", 0},
+ {OSC "17;%s" BEL, "change-highlight-background-colors", 0},
+ {OSC "18;%s" BEL, "change-tek-cursor-colors", 0},
+ {OSC "19;%s" BEL, "change-highlight-foreground-colors", 0},
{OSC "46;%s" BEL, "change-logfile", 0},
{OSC "50;#%d" BEL, "change-font-number", 0},
{OSC "50;%s" BEL, "change-font-name", 0},
{OSC "104" BEL, "reset-color", 0},
{OSC "104;%m" BEL, "reset-color", 0},
+ {OSC "110" BEL, "reset-foreground-colors", 0},
+ {OSC "111" BEL, "reset-background-colors", 0},
{OSC "112" BEL, "reset-cursor-colors", 0},
+ {OSC "113" BEL, "reset-mouse-cursor-foreground-colors", 0},
+ {OSC "114" BEL, "reset-mouse-cursor-background-colors", 0},
+ {OSC "115" BEL, "reset-tek-foreground-colors", 0},
+ {OSC "116" BEL, "reset-tek-background-colors", 0},
+ {OSC "117" BEL, "reset-highlight-background-colors", 0},
+ {OSC "118" BEL, "reset-tek-cursor-colors", 0},
+ {OSC "119" BEL, "reset-highlight-foreground-colors", 0},
/* Set text parameters, ST-terminated versions. */
{OSC ";%s" ST, "set-icon-and-window-title", 0}, /* undocumented default */
@@ -554,16 +565,27 @@ struct _vte_capability_string _vte_xterm_capability_strings[] = {
{OSC "11;%s" ST, "change-background-colors", 0},
{OSC "12;%s" ST, "change-cursor-colors", 0},
{OSC "13;%s" ST, "change-mouse-cursor-foreground-colors", 0},
- {OSC "14;%s" ST, "change-mouse-cursor-foreground-colors", 0},
- {OSC "15;%s" ST, "change-tek-background-colors", 0},
+ {OSC "14;%s" ST, "change-mouse-cursor-background-colors", 0},
+ {OSC "15;%s" ST, "change-tek-foreground-colors", 0},
{OSC "16;%s" ST, "change-tek-background-colors", 0},
- {OSC "17;%s" ST, "change-highlight-colors", 0},
+ {OSC "17;%s" ST, "change-highlight-background-colors", 0},
+ {OSC "18;%s" ST, "change-tek-cursor-colors", 0},
+ {OSC "19;%s" ST, "change-highlight-foreground-colors", 0},
{OSC "46;%s" ST, "change-logfile", 0},
{OSC "50;#%d" ST, "change-font-number", 0},
{OSC "50;%s" ST, "change-font-name", 0},
{OSC "104" ST, "reset-color", 0},
{OSC "104;%m" ST, "reset-color", 0},
+ {OSC "110" ST, "reset-foreground-colors", 0},
+ {OSC "111" ST, "reset-background-colors", 0},
{OSC "112" ST, "reset-cursor-colors", 0},
+ {OSC "113" ST, "reset-mouse-cursor-foreground-colors", 0},
+ {OSC "114" ST, "reset-mouse-cursor-background-colors", 0},
+ {OSC "115" ST, "reset-tek-foreground-colors", 0},
+ {OSC "116" ST, "reset-tek-background-colors", 0},
+ {OSC "117" ST, "reset-highlight-background-colors", 0},
+ {OSC "118" ST, "reset-tek-cursor-colors", 0},
+ {OSC "119" ST, "reset-highlight-foreground-colors", 0},
/* These may be bogus, I can't find docs for them anywhere (#104154). */
{OSC "21;%s" BEL, "set-text-property-21", 0},
diff --git a/src/osc b/src/osc
index 1dbff5f..c7f095c 100755
--- a/src/osc
+++ b/src/osc
@@ -11,9 +11,15 @@ if [ "$#" -eq 0 ] ; then
echo " 4 'index;color' change color"
echo " 6 'uri' change current file uri"
echo " 7 'uri' change current directory uri"
+ echo " 10 'color' change foreground color"
+ echo " 11 'color' change background color"
echo " 12 'color' change cursor color"
+ echo " 17 'color' change highlight background color"
echo " 104 'index' reset color (or all colors)"
+ echo " 110 reset foreground color"
+ echo " 111 reset background color"
echo " 112 reset cursor color"
+ echo " 117 reset highlight background color"
exit
fi
args=
diff --git a/src/vteseq-n.gperf b/src/vteseq-n.gperf
index c359a80..fb5b151 100644
--- a/src/vteseq-n.gperf
+++ b/src/vteseq-n.gperf
@@ -96,7 +96,10 @@ struct vteseq_n_struct {
#"double-height-top-half", VTE_SEQUENCE_HANDLER_NULL
"line-position-absolute", VTE_SEQUENCE_HANDLER(vte_sequence_handler_line_position_absolute)
"return-terminal-status", VTE_SEQUENCE_HANDLER(vte_sequence_handler_return_terminal_status)
-#"change-highlight-colors", VTE_SEQUENCE_HANDLER_NULL
+"change-highlight-background-colors",
VTE_SEQUENCE_HANDLER(vte_sequence_handler_change_highlight_background_color)
+"reset-highlight-background-colors",
VTE_SEQUENCE_HANDLER(vte_sequence_handler_reset_highlight_background_color)
+#"change-highlight-foreground-colors", VTE_SEQUENCE_HANDLER_NULL
+#"reset-highlight-foreground-colors", VTE_SEQUENCE_HANDLER_NULL
#"enable-filter-rectangle", VTE_SEQUENCE_HANDLER_NULL
"insert-blank-characters", VTE_SEQUENCE_HANDLER(vte_sequence_handler_insert_blank_characters)
#"invoke-g2-character-set", VTE_SEQUENCE_HANDLER_NULL
@@ -106,8 +109,10 @@ struct vteseq_n_struct {
#"ansi-conformance-level-1", VTE_SEQUENCE_HANDLER_NULL
#"ansi-conformance-level-2", VTE_SEQUENCE_HANDLER_NULL
#"ansi-conformance-level-3", VTE_SEQUENCE_HANDLER_NULL
-#"change-background-colors", VTE_SEQUENCE_HANDLER_NULL
-#"change-foreground-colors", VTE_SEQUENCE_HANDLER_NULL
+"change-background-colors", VTE_SEQUENCE_HANDLER(vte_sequence_handler_change_background_color)
+"reset-background-colors", VTE_SEQUENCE_HANDLER(vte_sequence_handler_reset_background_color)
+"change-foreground-colors", VTE_SEQUENCE_HANDLER(vte_sequence_handler_change_foreground_color)
+"reset-foreground-colors", VTE_SEQUENCE_HANDLER(vte_sequence_handler_reset_foreground_color)
"dec-device-status-report", VTE_SEQUENCE_HANDLER(vte_sequence_handler_dec_device_status_report)
#"enable-locator-reporting", VTE_SEQUENCE_HANDLER_NULL
#"request-locator-position", VTE_SEQUENCE_HANDLER_NULL
@@ -120,7 +125,11 @@ struct vteseq_n_struct {
"request-terminal-parameters", VTE_SEQUENCE_HANDLER(vte_sequence_handler_request_terminal_parameters)
#"select-character-protection", VTE_SEQUENCE_HANDLER_NULL
#"change-tek-background-colors", VTE_SEQUENCE_HANDLER_NULL
+#"reset-tek-background-colors", VTE_SEQUENCE_HANDLER_NULL
#"change-tek-foreground-colors", VTE_SEQUENCE_HANDLER_NULL
+#"reset-tek-foreground-colors", VTE_SEQUENCE_HANDLER_NULL
+#"change-tek-cursor-colors", VTE_SEQUENCE_HANDLER_NULL
+#"reset-tek-cursor-colors", VTE_SEQUENCE_HANDLER_NULL
#"invoke-g1-character-set-as-gr", VTE_SEQUENCE_HANDLER_NULL
#"invoke-g2-character-set-as-gr", VTE_SEQUENCE_HANDLER_NULL
#"invoke-g3-character-set-as-gr", VTE_SEQUENCE_HANDLER_NULL
@@ -130,6 +139,8 @@ struct vteseq_n_struct {
"horizontal-and-vertical-position",
VTE_SEQUENCE_HANDLER(vte_sequence_handler_horizontal_and_vertical_position)
"send-secondary-device-attributes",
VTE_SEQUENCE_HANDLER(vte_sequence_handler_send_secondary_device_attributes)
#"change-mouse-cursor-background-colors", VTE_SEQUENCE_HANDLER_NULL
+#"reset-mouse-cursor-background-colors", VTE_SEQUENCE_HANDLER_NULL
#"change-mouse-cursor-foreground-colors", VTE_SEQUENCE_HANDLER_NULL
+#"reset-mouse-cursor-foreground-colors", VTE_SEQUENCE_HANDLER_NULL
"set-current-directory-uri", VTE_SEQUENCE_HANDLER(vte_sequence_handler_set_current_directory_uri)
"set-current-file-uri", VTE_SEQUENCE_HANDLER(vte_sequence_handler_set_current_file_uri)
diff --git a/src/vteseq.c b/src/vteseq.c
index bdd186b..37d41e1 100644
--- a/src/vteseq.c
+++ b/src/vteseq.c
@@ -3529,9 +3529,10 @@ vte_sequence_handler_window_manipulation (VteTerminal *terminal, GValueArray *pa
}
}
-/* Change the color of the cursor */
+/* Internal helper for setting/querying special colors */
static void
-vte_sequence_handler_change_cursor_color (VteTerminal *terminal, GValueArray *params)
+vte_sequence_handler_change_special_color_internal (VteTerminal *terminal, GValueArray *params,
+ int index, int index_fallback, int osc)
{
gchar *name = NULL;
GValue *value;
@@ -3549,16 +3550,16 @@ vte_sequence_handler_change_cursor_color (VteTerminal *terminal, GValueArray *pa
return;
if (vte_parse_color (name, &color))
- _vte_terminal_set_color_internal(terminal, VTE_CUR_BG, VTE_COLOR_SOURCE_ESCAPE,
&color);
+ _vte_terminal_set_color_internal(terminal, index, VTE_COLOR_SOURCE_ESCAPE, &color);
else if (strcmp (name, "?") == 0) {
gchar buf[128];
- PangoColor *c = _vte_terminal_get_color(terminal, VTE_CUR_BG);
- if (c == NULL)
- c = _vte_terminal_get_color(terminal, VTE_DEF_FG);
+ PangoColor *c = _vte_terminal_get_color(terminal, index);
+ if (c == NULL && index_fallback != -1)
+ c = _vte_terminal_get_color(terminal, index_fallback);
g_assert(c != NULL);
g_snprintf (buf, sizeof (buf),
- _VTE_CAP_OSC "12;rgb:%04x/%04x/%04x" BEL,
- c->red, c->green, c->blue);
+ _VTE_CAP_OSC "%d;rgb:%04x/%04x/%04x" BEL,
+ osc, c->red, c->green, c->blue);
vte_terminal_feed_child (terminal, buf, -1);
}
@@ -3566,6 +3567,44 @@ vte_sequence_handler_change_cursor_color (VteTerminal *terminal, GValueArray *pa
}
}
+/* Change the default foreground cursor */
+static void
+vte_sequence_handler_change_foreground_color (VteTerminal *terminal, GValueArray *params)
+{
+ vte_sequence_handler_change_special_color_internal (terminal, params,
+ VTE_DEF_FG, -1, 10);
+}
+
+/* Reset the default foreground color */
+static void
+vte_sequence_handler_reset_foreground_color (VteTerminal *terminal, GValueArray *params)
+{
+ _vte_terminal_set_color_internal(terminal, VTE_DEF_FG, VTE_COLOR_SOURCE_ESCAPE, NULL);
+}
+
+/* Change the default background cursor */
+static void
+vte_sequence_handler_change_background_color (VteTerminal *terminal, GValueArray *params)
+{
+ vte_sequence_handler_change_special_color_internal (terminal, params,
+ VTE_DEF_BG, -1, 11);
+}
+
+/* Reset the default background color */
+static void
+vte_sequence_handler_reset_background_color (VteTerminal *terminal, GValueArray *params)
+{
+ _vte_terminal_set_color_internal(terminal, VTE_DEF_BG, VTE_COLOR_SOURCE_ESCAPE, NULL);
+}
+
+/* Change the color of the cursor */
+static void
+vte_sequence_handler_change_cursor_color (VteTerminal *terminal, GValueArray *params)
+{
+ vte_sequence_handler_change_special_color_internal (terminal, params,
+ VTE_CUR_BG, VTE_DEF_FG, 12);
+}
+
/* Reset the color of the cursor */
static void
vte_sequence_handler_reset_cursor_color (VteTerminal *terminal, GValueArray *params)
@@ -3573,6 +3612,21 @@ vte_sequence_handler_reset_cursor_color (VteTerminal *terminal, GValueArray *par
_vte_terminal_set_color_internal(terminal, VTE_CUR_BG, VTE_COLOR_SOURCE_ESCAPE, NULL);
}
+/* Change the highlight background color */
+static void
+vte_sequence_handler_change_highlight_background_color (VteTerminal *terminal, GValueArray *params)
+{
+ vte_sequence_handler_change_special_color_internal (terminal, params,
+ VTE_DEF_HL, VTE_DEF_FG, 17);
+}
+
+/* Reset the highlight background color */
+static void
+vte_sequence_handler_reset_highlight_background_color (VteTerminal *terminal, GValueArray *params)
+{
+ _vte_terminal_set_color_internal(terminal, VTE_DEF_HL, VTE_COLOR_SOURCE_ESCAPE, NULL);
+}
+
/* Lookup tables */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]