[vte3/f20] Apply an upstream fix for xterm escape sequences
Matthias Clasen
mclasen at fedoraproject.org
Fri May 9 19:47:03 UTC 2014
commit 10e0e04595e407dea06b99f2c906ce7e78ae3e67
Author: Matthias Clasen <mclasen at redhat.com>
Date: Fri May 9 15:47:16 2014 -0400
Apply an upstream fix for xterm escape sequences
vte-color-escape.patch | 203 ++++++++++++++++++++++++++++++++++++++++++++++++
vte3.spec | 8 ++-
2 files changed, 210 insertions(+), 1 deletions(-)
---
diff --git a/vte-color-escape.patch b/vte-color-escape.patch
new file mode 100644
index 0000000..7fa692e
--- /dev/null
+++ b/vte-color-escape.patch
@@ -0,0 +1,203 @@
+diff --git a/src/vte-private.h b/src/vte-private.h
+index b7de21f..520b0f4 100644
+--- a/src/vte-private.h
++++ b/src/vte-private.h
+@@ -342,8 +342,10 @@ struct _VteTerminalPrivate {
+
+ gboolean palette_initialized;
+ gboolean highlight_color_set;
++ gboolean cursor_default_color_set;
+ gboolean cursor_color_set;
+- PangoColor palette[VTE_PALETTE_SIZE];
++ PangoColor default_palette[VTE_PALETTE_SIZE]; /* get/set via API calls */
++ PangoColor palette[VTE_PALETTE_SIZE]; /* get/set via escape sequences */
+
+ /* Mouse cursors. */
+ gboolean mouse_cursor_visible;
+@@ -445,7 +447,11 @@ void _vte_terminal_visible_beep(VteTerminal *terminal);
+ void _vte_terminal_beep(VteTerminal *terminal);
+ void _vte_terminal_set_color_internal(VteTerminal *terminal,
+ int idx,
++ gboolean via_escape,
+ const GdkColor *color);
++void _vte_terminal_set_color_cursor_internal(VteTerminal *terminal,
++ gboolean via_escape,
++ const GdkColor *color);
+
+ void _vte_terminal_inline_error_message(VteTerminal *terminal, const char *format, ...) G_GNUC_PRINTF(2,3);
+
+diff --git a/src/vte.c b/src/vte.c
+index 0ad759d..2369978 100644
+--- a/src/vte.c
++++ b/src/vte.c
+@@ -2501,11 +2501,15 @@ vte_terminal_new(void)
+ void
+ _vte_terminal_set_color_internal(VteTerminal *terminal,
+ int entry,
++ gboolean via_escape,
+ const GdkColor *proposed)
+ {
+ PangoColor *color;
+
+- color = &terminal->pvt->palette[entry];
++ if (via_escape)
++ color = &terminal->pvt->palette[entry];
++ else
++ color = &terminal->pvt->default_palette[entry];
+
+ if (color->red == proposed->red &&
+ color->green == proposed->green &&
+@@ -2514,10 +2518,20 @@ _vte_terminal_set_color_internal(VteTerminal *terminal,
+ }
+
+ _vte_debug_print(VTE_DEBUG_MISC,
+- "Set color[%d] to (%04x,%04x,%04x).\n", entry,
+- proposed->red, proposed->green, proposed->blue);
++ "Set %s color[%d] to (%04x,%04x,%04x).\n", via_escape ? "actual" : "default",
++ entry, proposed->red, proposed->green, proposed->blue);
+
+ /* Save the requested color. */
++ if (!via_escape) {
++ PangoColor *actual_color = &terminal->pvt->palette[entry];
++ if (actual_color->red == color->red &&
++ actual_color->green == color->green &&
++ actual_color->blue == color->blue) {
++ actual_color->red = proposed->red;
++ actual_color->green = proposed->green;
++ actual_color->blue = proposed->blue;
++ }
++ }
+ color->red = proposed->red;
+ color->green = proposed->green;
+ color->blue = proposed->blue;
+@@ -2603,7 +2617,7 @@ vte_terminal_set_color_bold(VteTerminal *terminal, const GdkColor *bold)
+ _vte_debug_print(VTE_DEBUG_MISC,
+ "Set bold color to (%04x,%04x,%04x).\n",
+ bold->red, bold->green, bold->blue);
+- _vte_terminal_set_color_internal(terminal, VTE_BOLD_FG, bold);
++ _vte_terminal_set_color_internal(terminal, VTE_BOLD_FG, FALSE, bold);
+ }
+
+ /**
+@@ -2622,7 +2636,7 @@ vte_terminal_set_color_dim(VteTerminal *terminal, const GdkColor *dim)
+ _vte_debug_print(VTE_DEBUG_MISC,
+ "Set dim color to (%04x,%04x,%04x).\n",
+ dim->red, dim->green, dim->blue);
+- _vte_terminal_set_color_internal(terminal, VTE_DIM_FG, dim);
++ _vte_terminal_set_color_internal(terminal, VTE_DIM_FG, FALSE, dim);
+ }
+
+ /**
+@@ -2642,7 +2656,7 @@ vte_terminal_set_color_foreground(VteTerminal *terminal,
+ _vte_debug_print(VTE_DEBUG_MISC,
+ "Set foreground color to (%04x,%04x,%04x).\n",
+ foreground->red, foreground->green, foreground->blue);
+- _vte_terminal_set_color_internal(terminal, VTE_DEF_FG, foreground);
++ _vte_terminal_set_color_internal(terminal, VTE_DEF_FG, FALSE, foreground);
+ }
+
+ /**
+@@ -2664,7 +2678,24 @@ vte_terminal_set_color_background(VteTerminal *terminal,
+ _vte_debug_print(VTE_DEBUG_MISC,
+ "Set background color to (%04x,%04x,%04x).\n",
+ background->red, background->green, background->blue);
+- _vte_terminal_set_color_internal(terminal, VTE_DEF_BG, background);
++ _vte_terminal_set_color_internal(terminal, VTE_DEF_BG, FALSE, background);
++}
++
++void
++_vte_terminal_set_color_cursor_internal(VteTerminal *terminal,
++ gboolean via_escape,
++ const GdkColor *cursor_background)
++{
++ if (!via_escape) {
++ _vte_terminal_set_color_internal(terminal, VTE_CUR_BG, FALSE,
++ cursor_background);
++ terminal->pvt->cursor_default_color_set = TRUE;
++ }
++ if (via_escape || !terminal->pvt->cursor_color_set) {
++ _vte_terminal_set_color_internal(terminal, VTE_CUR_BG, TRUE,
++ cursor_background);
++ terminal->pvt->cursor_color_set = TRUE;
++ }
+ }
+
+ /**
+@@ -2690,13 +2721,19 @@ vte_terminal_set_color_cursor(VteTerminal *terminal,
+ cursor_background->red,
+ cursor_background->green,
+ cursor_background->blue);
+- _vte_terminal_set_color_internal(terminal, VTE_CUR_BG,
+- cursor_background);
+- terminal->pvt->cursor_color_set = TRUE;
+- } else {
+- _vte_debug_print(VTE_DEBUG_MISC,
+- "Cleared cursor color.\n");
+- terminal->pvt->cursor_color_set = FALSE;
++ _vte_terminal_set_color_cursor_internal(terminal, FALSE, cursor_background);
++ } else if (terminal->pvt->cursor_default_color_set) {
++ /* Unset only if there isn't a different value set by escape sequences.
++ Note: there's no way to reset the cursor color's defaults via escapes. */
++ PangoColor *default_color = &terminal->pvt->default_palette[VTE_CUR_BG];
++ PangoColor *actual_color = &terminal->pvt->palette[VTE_CUR_BG];
++ if (default_color->red == actual_color->red &&
++ default_color->green == actual_color->green &&
++ default_color->blue == actual_color->blue) {
++ _vte_debug_print(VTE_DEBUG_MISC,
++ "Cleared cursor color.\n");
++ terminal->pvt->cursor_default_color_set = FALSE;
++ }
+ }
+ }
+
+@@ -2723,7 +2760,7 @@ vte_terminal_set_color_highlight(VteTerminal *terminal,
+ highlight_background->red,
+ highlight_background->green,
+ highlight_background->blue);
+- _vte_terminal_set_color_internal(terminal, VTE_DEF_HL,
++ _vte_terminal_set_color_internal(terminal, VTE_DEF_HL, FALSE,
+ highlight_background);
+ terminal->pvt->highlight_color_set = TRUE;
+ } else {
+@@ -2864,7 +2901,9 @@ vte_terminal_set_colors(VteTerminal *terminal,
+ }
+
+ /* Set up the color entry. */
+- _vte_terminal_set_color_internal(terminal, i, &color);
++ _vte_terminal_set_color_internal(terminal, i, FALSE, &color);
++ if (!terminal->pvt->palette_initialized)
++ _vte_terminal_set_color_internal(terminal, i, TRUE, &color);
+ }
+
+ /* Track that we had a color palette set. */
+@@ -9186,7 +9225,7 @@ vte_terminal_realize(GtkWidget *widget)
+ color.green = terminal->pvt->palette[i].green;
+ color.blue = terminal->pvt->palette[i].blue;
+ color.pixel = 0;
+- _vte_terminal_set_color_internal(terminal, i, &color);
++ _vte_terminal_set_color_internal(terminal, i, FALSE, &color);
+ }
+
+ /* Set up input method support. FIXME: do we need to handle the
+diff --git a/src/vteseq.c b/src/vteseq.c
+index dc82792..fad4d46 100644
+--- a/src/vteseq.c
++++ b/src/vteseq.c
+@@ -1913,7 +1913,7 @@ vte_sequence_handler_change_color (VteTerminal *terminal, GValueArray *params)
+ continue;
+
+ if (vte_parse_color (pairs[i + 1], &color)) {
+- _vte_terminal_set_color_internal(terminal, idx, &color);
++ _vte_terminal_set_color_internal(terminal, idx, TRUE, &color);
+ } else if (strcmp (pairs[i + 1], "?") == 0) {
+ gchar buf[128];
+ g_snprintf (buf, sizeof (buf),
+@@ -3437,7 +3437,7 @@ vte_sequence_handler_change_cursor_color (VteTerminal *terminal, GValueArray *pa
+ return;
+
+ if (vte_parse_color (name, &color))
+- vte_terminal_set_color_cursor (terminal, &color);
++ _vte_terminal_set_color_cursor_internal(terminal, TRUE, &color);
+ else if (strcmp (name, "?") == 0) {
+ gchar buf[128];
+ g_snprintf (buf, sizeof (buf),
diff --git a/vte3.spec b/vte3.spec
index 8bfaebe..1db07ce 100644
--- a/vte3.spec
+++ b/vte3.spec
@@ -1,6 +1,6 @@
Name: vte3
Version: 0.34.9
-Release: 1%{?dist}
+Release: 2%{?dist}
Summary: A terminal emulator
License: LGPLv2+
Group: User Interface/X
@@ -11,6 +11,8 @@ Patch0: honey-I-shrank-the-terminal.patch
Patch1: vte-alt-meta-confusion.patch
# https://bugzilla.gnome.org/show_bug.cgi?id=688456
Patch2: 0001-widget-Only-show-the-cursor-on-motion-if-moved.patch
+# https://bugzilla.gnome.org/show_bug.cgi?id=705985
+Patch3: vte-color-escape.patch
BuildRequires: gtk3-devel >= 3.0.0
BuildRequires: ncurses-devel
@@ -43,6 +45,7 @@ vte.
%patch0 -p1 -b .grow-up
%patch1 -p1 -b .alt-meta
%patch2 -p1 -b .motion
+%patch3 -p1 -b .color-escape
%build
CFLAGS="%optflags -fPIE -DPIE" \
@@ -90,6 +93,9 @@ rm -f $RPM_BUILD_ROOT%{_libdir}/*.la
%changelog
+* Fri May 9 2014 Matthias Clasen <mclasen at redhat.com> - 0.34.9-2
+- Apply an upstream fix for xterm escape sequences
+
* Tue Oct 15 2013 Richard Hughes <rhughes at redhat.com> - 0.34.9-1
- Update to 0.34.9
More information about the scm-commits
mailing list