aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--x11-toolkits/vte/Makefile6
-rw-r--r--x11-toolkits/vte/files/patch-01_vtemodule19
-rw-r--r--x11-toolkits/vte/files/patch-03_cursor_position13
-rw-r--r--x11-toolkits/vte/files/patch-04_dsp_non_alias12
-rw-r--r--x11-toolkits/vte/files/patch-05_performance_boost466
-rw-r--r--x11-toolkits/vte/files/patch-06_remove_doublefree38
-rw-r--r--x11-toolkits/vte/files/patch-07_set_backspace_to_utf814
-rw-r--r--x11-toolkits/vte/files/patch-08_multiscreen_safe373
-rw-r--r--x11-toolkits/vte/files/patch-10_hide_pageup_behavior11
-rw-r--r--x11-toolkits/vte/files/patch-src_vte.c34
10 files changed, 949 insertions, 37 deletions
diff --git a/x11-toolkits/vte/Makefile b/x11-toolkits/vte/Makefile
index 20ed2c7d39cd..ca63f73c0a9e 100644
--- a/x11-toolkits/vte/Makefile
+++ b/x11-toolkits/vte/Makefile
@@ -7,7 +7,7 @@
PORTNAME= vte
PORTVERSION= 0.11.11
-PORTREVISION= 1
+PORTREVISION= 2
CATEGORIES= x11-toolkits gnome
MASTER_SITES= ${MASTER_SITE_GNOME}
MASTER_SITE_SUBDIR= sources/${PORTNAME}/${PORTVERSION:R}
@@ -22,8 +22,8 @@ USE_GMAKE= yes
USE_REINPLACE= yes
USE_BISON= yes
INSTALLS_SHLIB= yes
-USE_INC_LIBTOOL_VER=13
-USE_GNOME= gnomeprefix gnomehack lthack gtk20
+USE_LIBTOOL_VER=15
+USE_GNOME= gnomeprefix gnomehack gtk20
CONFIGURE_ENV= CPPFLAGS="-I${LOCALBASE}/include -I${X11BASE}/include" \
LDFLAGS="-L${LOCALBASE}/lib -L${X11BASE}/lib" \
BSD_PTHREAD_LIBS="${PTHREAD_LIBS}"
diff --git a/x11-toolkits/vte/files/patch-01_vtemodule b/x11-toolkits/vte/files/patch-01_vtemodule
new file mode 100644
index 000000000000..3c792c60e52f
--- /dev/null
+++ b/x11-toolkits/vte/files/patch-01_vtemodule
@@ -0,0 +1,19 @@
+--- python/vtemodule.c.orig 2004-05-09 16:58:16.000000000 +0200
++++ python/vtemodule.c 2004-05-09 17:00:22.000000000 +0200
+@@ -32,14 +32,14 @@
+ extern PyTypeObject PyVteTerminal_Type;
+
+ DL_EXPORT(void)
+-init_vte(void)
++initvte(void)
+ {
+ PyObject *m, *d;
+
+ init_pygobject();
+ init_pygtk();
+
+- m = Py_InitModule("_vte", pyvte_functions);
++ m = Py_InitModule("vte", pyvte_functions);
+ d = PyModule_GetDict(m);
+
+ pyvte_register_classes(d);
diff --git a/x11-toolkits/vte/files/patch-03_cursor_position b/x11-toolkits/vte/files/patch-03_cursor_position
new file mode 100644
index 000000000000..d5874cd80cb6
--- /dev/null
+++ b/x11-toolkits/vte/files/patch-03_cursor_position
@@ -0,0 +1,13 @@
+--- src/caps.c.orig 2004-05-15 21:47:00.000000000 +0200
++++ src/caps.c 2004-05-15 21:51:40.000000000 +0200
+@@ -507,8 +507,10 @@
+ {CSI "%d;%dr", "set-scrolling-region", 0},
+ {CSI "?r", "restore-mode", 0},
+ {CSI "?%mr", "restore-mode", 0},
++ {CSI "s", "save-cursor", 0},
+ {CSI "?s", "save-mode", 0},
+ {CSI "?%ms", "save-mode", 0},
++ {CSI "u", "restore-cursor", 0},
+
+ {CSI "%mt", "window-manipulation", 0},
+
diff --git a/x11-toolkits/vte/files/patch-04_dsp_non_alias b/x11-toolkits/vte/files/patch-04_dsp_non_alias
new file mode 100644
index 000000000000..34e12ab63149
--- /dev/null
+++ b/x11-toolkits/vte/files/patch-04_dsp_non_alias
@@ -0,0 +1,12 @@
+diff -urN vte-0.11.11.orig/src/vtefc.c vte-0.11.11/src/vtefc.c
+--- src/vtefc.c 2004-05-11 09:03:59.000000000 +0000
++++ src/vtefc.c 2004-05-11 09:05:48.000000000 +0000
+@@ -465,7 +465,7 @@
+ tmp = FcFontRenderPrepare(NULL,
+ pattern,
+ fontset->fonts[i]);
+- _vte_fc_defaults_from_gtk(widget, tmp, antialias);
++ FcConfigSubstitute (NULL, tmp, FcMatchPattern);
+ _vte_fc_set_antialias(tmp, antialias);
+ save = FcPatternDuplicate(tmp);
+ FcPatternDestroy(tmp);
diff --git a/x11-toolkits/vte/files/patch-05_performance_boost b/x11-toolkits/vte/files/patch-05_performance_boost
new file mode 100644
index 000000000000..612d3fc98e8a
--- /dev/null
+++ b/x11-toolkits/vte/files/patch-05_performance_boost
@@ -0,0 +1,466 @@
+diff -r -u src.orig/iso2022.c src/iso2022.c
+--- src.orig/iso2022.c 2003-09-15 11:57:33 -0700
++++ src/iso2022.c 2004-12-19 18:22:10 -0800
+@@ -298,24 +298,29 @@
+ {
+ int i;
+ gpointer p;
+- static GTree *ambiguous = NULL;
++ static GHashTable *ambiguous = NULL;
+ for (i = 0; i < G_N_ELEMENTS(_vte_iso2022_ambiguous_ranges); i++) {
+ if ((c >= _vte_iso2022_ambiguous_ranges[i].start) &&
+ (c <= _vte_iso2022_ambiguous_ranges[i].end)) {
+ return TRUE;
+ }
+ }
+- if (ambiguous == NULL) {
+- ambiguous = g_tree_new(_vte_direct_compare);
+- for (i = 0;
+- i < G_N_ELEMENTS(_vte_iso2022_ambiguous_chars);
+- i++) {
++ for (i = 0; i < G_N_ELEMENTS(_vte_iso2022_unambiguous_ranges); i++) {
++ if ((c >= _vte_iso2022_unambiguous_ranges[i].start) &&
++ (c <= _vte_iso2022_unambiguous_ranges[i].end)) {
++ return FALSE;
++ }
++ }
++ if (!ambiguous) {
++ ambiguous = g_hash_table_new (g_direct_hash, g_direct_equal);
++
++ for (i = 0; i < G_N_ELEMENTS(_vte_iso2022_ambiguous_chars); i++) {
+ p = GINT_TO_POINTER(_vte_iso2022_ambiguous_chars[i]);
+- g_tree_insert(ambiguous, p, p);
++ g_hash_table_insert(ambiguous, p, p);
+ }
+ }
+- p = GINT_TO_POINTER(c);
+- return g_tree_lookup(ambiguous, p) == p;
++
++ return g_hash_table_lookup(ambiguous, GINT_TO_POINTER(c)) != NULL;
+ }
+
+ /* If we only have a codepoint, guess what the ambiguous width should be based
+@@ -862,35 +867,34 @@
+ }
+
+ static char *
+-_vte_iso2022_better(char *p, char *q)
+-{
+- if (p == NULL) {
+- return q;
+- }
+- if (q == NULL) {
+- return p;
+- }
+- return MIN(p, q);
+-}
+-
+-static char *
+ _vte_iso2022_find_nextctl(const char *p, size_t length)
+ {
+ char *ret;
++ int i;
++
+ if (length == 0) {
+ return NULL;
+ }
+- ret = memchr(p, '\033', length);
+- ret = _vte_iso2022_better(ret, memchr(p, '\n', length));
+- ret = _vte_iso2022_better(ret, memchr(p, '\r', length));
+- ret = _vte_iso2022_better(ret, memchr(p, '\016', length));
+- ret = _vte_iso2022_better(ret, memchr(p, '\017', length));
++
++ for (i = 0; i < length; ++i) {
++ if (p[i] == '\033' ||
++ p[i] == '\n' ||
++ p[i] == '\r' ||
++ p[i] == '\016' ||
++ p[i] == '\017'
+ #ifdef VTE_ISO2022_8_BIT_CONTROLS
+- /* This breaks UTF-8 and other encodings which use the high bits. */
+- ret = _vte_iso2022_better(ret, memchr(p, 0x8e, length));
+- ret = _vte_iso2022_better(ret, memchr(p, 0x8f, length));
++ /* This breaks UTF-8 and other encodings which
++ * use the high bits.
++ */
++ ||
++ p[i] == 0x8e ||
++ p[i] == 0x8f
+ #endif
+- return ret;
++ ) {
++ return (char *)p + i;
++ }
++ }
++ return NULL;
+ }
+
+ static long
+diff -r -u src.orig/uniwidths src/uniwidths
+--- src.orig/uniwidths 2003-02-11 12:21:43 -0800
++++ src/uniwidths 2004-12-19 18:22:10 -0800
+@@ -5,6 +5,13 @@
+ {0xf0000, 0xffffd},
+ {0x100000, 0x10fffd},
+ };
++static const struct {
++ gunichar start, end;
++} _vte_iso2022_unambiguous_ranges[] = {
++ {0x01, 0xa0},
++ {0x452, 0x200f},
++};
++
+ static const gunichar _vte_iso2022_ambiguous_chars[] = {
+ 0xa1,
+ 0xa4,
+diff -r -u src.orig/vte.c src/vte.c
+--- src.orig/vte.c 2004-05-01 23:43:01 -0700
++++ src/vte.c 2004-12-19 18:22:10 -0800
+@@ -112,7 +112,8 @@
+ #define VTE_REGEXEC_FLAGS 0
+ #define VTE_INPUT_CHUNK_SIZE 0x1000
+ #define VTE_INVALID_BYTE '?'
+-#define VTE_COALESCE_TIMEOUT 2
++#define VTE_COALESCE_TIMEOUT 10
++#define VTE_DISPLAY_TIMEOUT 15
+
+ /* The structure we use to hold characters we're supposed to display -- this
+ * includes any supported visible attributes. */
+@@ -204,8 +205,8 @@
+ struct _vte_iso2022_state *iso2022;
+ struct _vte_buffer *incoming; /* pending bytestream */
+ GArray *pending; /* pending characters */
+- gboolean processing;
+- gint processing_tag;
++ gint coalesce_timeout;
++ gint display_timeout;
+
+ /* Output data queue. */
+ struct _vte_buffer *outgoing; /* pending input characters */
+@@ -462,7 +463,7 @@
+ static gboolean vte_terminal_background_update(gpointer data);
+ static void vte_terminal_queue_background_update(VteTerminal *terminal);
+ static void vte_terminal_queue_adjustment_changed(VteTerminal *terminal);
+-static gboolean vte_terminal_process_incoming(gpointer data);
++static gboolean vte_terminal_process_incoming(VteTerminal *terminal);
+ static gboolean vte_cell_is_selected(VteTerminal *terminal,
+ glong col, glong row, gpointer data);
+ static char *vte_terminal_get_text_range_maybe_wrapped(VteTerminal *terminal,
+@@ -489,6 +490,9 @@
+ gboolean include_trailing_spaces);
+ static void _vte_terminal_disconnect_pty_read(VteTerminal *terminal);
+ static void _vte_terminal_disconnect_pty_write(VteTerminal *terminal);
++static void vte_terminal_stop_processing (VteTerminal *terminal);
++static void vte_terminal_start_processing (VteTerminal *terminal);
++static gboolean vte_terminal_is_processing (VteTerminal *terminal);
+
+ /* Free a no-longer-used row data array. */
+ static void
+@@ -6989,11 +6993,7 @@
+ /* Take one last shot at processing whatever data is pending,
+ * then flush the buffers in case we're about to run a new
+ * command, disconnecting the timeout. */
+- if (terminal->pvt->processing) {
+- g_source_remove(terminal->pvt->processing_tag);
+- terminal->pvt->processing = FALSE;
+- terminal->pvt->processing_tag = VTE_INVALID_SOURCE;
+- }
++ vte_terminal_stop_processing (terminal);
+ if (_vte_buffer_length(terminal->pvt->incoming) > 0) {
+ vte_terminal_process_incoming(terminal);
+ }
+@@ -7277,11 +7277,7 @@
+ /* Take one last shot at processing whatever data is pending, then
+ * flush the buffers in case we're about to run a new command,
+ * disconnecting the timeout. */
+- if (terminal->pvt->processing) {
+- g_source_remove(terminal->pvt->processing_tag);
+- terminal->pvt->processing = FALSE;
+- terminal->pvt->processing_tag = VTE_INVALID_SOURCE;
+- }
++ vte_terminal_stop_processing (terminal);
+ if (_vte_buffer_length(terminal->pvt->incoming) > 0) {
+ vte_terminal_process_incoming(terminal);
+ }
+@@ -7379,10 +7375,9 @@
+ /* Process incoming data, first converting it to unicode characters, and then
+ * processing control sequences. */
+ static gboolean
+-vte_terminal_process_incoming(gpointer data)
++vte_terminal_process_incoming(VteTerminal *terminal)
+ {
+ GValueArray *params = NULL;
+- VteTerminal *terminal;
+ VteScreen *screen;
+ struct vte_cursor_position cursor;
+ GtkWidget *widget;
+@@ -7396,10 +7391,9 @@
+ gboolean leftovers, modified, bottom, inserted, again;
+ GArray *unichars;
+
+- g_return_val_if_fail(GTK_IS_WIDGET(data), FALSE);
+- g_return_val_if_fail(VTE_IS_TERMINAL(data), FALSE);
+- widget = GTK_WIDGET(data);
+- terminal = VTE_TERMINAL(data);
++ g_return_val_if_fail(GTK_IS_WIDGET(terminal), FALSE);
++ g_return_val_if_fail(VTE_IS_TERMINAL(terminal), FALSE);
++ widget = GTK_WIDGET(terminal);
+
+ bottom = (terminal->pvt->screen->insert_delta ==
+ terminal->pvt->screen->scroll_delta);
+@@ -7410,7 +7404,6 @@
+ _vte_buffer_length(terminal->pvt->incoming));
+ }
+ #endif
+-
+ /* Save the current cursor position. */
+ screen = terminal->pvt->screen;
+ cursor = screen->cursor_current;
+@@ -7705,14 +7698,6 @@
+ (long) _vte_buffer_length(terminal->pvt->incoming));
+ }
+ #endif
+- /* Disconnect this function from the main loop. */
+- if (!again) {
+- terminal->pvt->processing = FALSE;
+- if (terminal->pvt->processing_tag != VTE_INVALID_SOURCE) {
+- g_source_remove(terminal->pvt->processing_tag);
+- }
+- terminal->pvt->processing_tag = VTE_INVALID_SOURCE;
+- }
+
+ #ifdef VTE_DEBUG
+ if (_vte_debug_on(VTE_DEBUG_IO)) {
+@@ -7724,7 +7709,7 @@
+ }
+ #endif
+
+- return terminal->pvt->processing;
++ return again;
+ }
+
+ /* Read and handle data from the child. */
+@@ -7832,41 +7817,7 @@
+ _vte_buffer_append(terminal->pvt->incoming, data, length);
+ }
+
+- /* If we have sufficient data, just process it now. */
+- if (_vte_buffer_length(terminal->pvt->incoming) >
+- VTE_INPUT_CHUNK_SIZE) {
+- /* Disconnect the timeout if one is pending. */
+- if (terminal->pvt->processing) {
+- g_source_remove(terminal->pvt->processing_tag);
+- terminal->pvt->processing = FALSE;
+- terminal->pvt->processing_tag = VTE_INVALID_SOURCE;
+- }
+- vte_terminal_process_incoming(terminal);
+- }
+-
+- /* Wait no more than N milliseconds for more data. We don't
+- * touch the timeout if we're already slated to call it again
+- * because if the output were carefully timed, we could
+- * conceivably put it off forever. */
+- if (!terminal->pvt->processing &&
+- (_vte_buffer_length(terminal->pvt->incoming) > 0)) {
+-#ifdef VTE_DEBUG
+- if (_vte_debug_on(VTE_DEBUG_IO)) {
+- fprintf(stderr, "Adding timed handler.\n");
+- }
+-#endif
+- terminal->pvt->processing = TRUE;
+- terminal->pvt->processing_tag = g_timeout_add(VTE_COALESCE_TIMEOUT,
+- vte_terminal_process_incoming,
+- terminal);
+- } else {
+-#ifdef VTE_DEBUG
+- if (_vte_debug_on(VTE_DEBUG_IO)) {
+- fprintf(stderr, "Not touching timed handler, "
+- "or no data.\n");
+- }
+-#endif
+- }
++ vte_terminal_start_processing (terminal);
+ }
+
+ /* Send locally-encoded characters to the child. */
+@@ -11313,8 +11264,8 @@
+ (gpointer)terminal);
+ pvt->incoming = _vte_buffer_new();
+ pvt->pending = g_array_new(TRUE, TRUE, sizeof(gunichar));
+- pvt->processing = FALSE;
+- pvt->processing_tag = VTE_INVALID_SOURCE;
++ pvt->coalesce_timeout = VTE_INVALID_SOURCE;
++ pvt->display_timeout = VTE_INVALID_SOURCE;
+ pvt->outgoing = _vte_buffer_new();
+ pvt->outgoing_conv = (VteConv) -1;
+ pvt->conv_buffer = _vte_buffer_new();
+@@ -11892,10 +11843,7 @@
+ terminal->pvt->pty_reaper = NULL;
+
+ /* Stop processing input. */
+- if (terminal->pvt->processing_tag != VTE_INVALID_SOURCE) {
+- g_source_remove(terminal->pvt->processing_tag);
+- terminal->pvt->processing_tag = VTE_INVALID_SOURCE;
+- }
++ vte_terminal_stop_processing (terminal);
+
+ /* Discard any pending data. */
+ if (terminal->pvt->incoming != NULL) {
+@@ -15421,11 +15369,8 @@
+ {
+ g_return_if_fail(VTE_IS_TERMINAL(terminal));
+ /* Stop processing any of the data we've got backed up. */
+- if (terminal->pvt->processing) {
+- g_source_remove(terminal->pvt->processing_tag);
+- terminal->pvt->processing_tag = VTE_INVALID_SOURCE;
+- terminal->pvt->processing = FALSE;
+- }
++ vte_terminal_stop_processing (terminal);
++
+ /* Clear the input and output buffers. */
+ if (terminal->pvt->incoming != NULL) {
+ _vte_buffer_clear(terminal->pvt->incoming);
+@@ -15758,3 +15703,114 @@
+ g_return_if_fail(VTE_IS_TERMINAL(terminal));
+ terminal->pvt->accessible_emit = TRUE;
+ }
++
++static gboolean display_timeout (gpointer data);
++static gboolean coalesce_timeout (gpointer data);
++
++static void
++add_display_timeout (VteTerminal *terminal)
++{
++ terminal->pvt->display_timeout =
++ g_timeout_add (VTE_DISPLAY_TIMEOUT, display_timeout, terminal);
++}
++
++static void
++add_coalesce_timeout (VteTerminal *terminal)
++{
++ terminal->pvt->coalesce_timeout =
++ g_timeout_add (VTE_COALESCE_TIMEOUT, coalesce_timeout, terminal);
++}
++
++static void
++remove_display_timeout (VteTerminal *terminal)
++{
++ g_source_remove (terminal->pvt->display_timeout);
++ terminal->pvt->display_timeout = VTE_DISPLAY_TIMEOUT;
++}
++
++static void
++remove_coalesce_timeout (VteTerminal *terminal)
++{
++ g_source_remove (terminal->pvt->coalesce_timeout);
++ terminal->pvt->coalesce_timeout = VTE_INVALID_SOURCE;
++}
++
++static void
++vte_terminal_stop_processing (VteTerminal *terminal)
++{
++ remove_display_timeout (terminal);
++ remove_coalesce_timeout (terminal);
++}
++
++static void
++vte_terminal_start_processing (VteTerminal *terminal)
++{
++ if (vte_terminal_is_processing (terminal)) {
++ remove_coalesce_timeout (terminal);
++ add_coalesce_timeout (terminal);
++ }
++ else {
++ add_coalesce_timeout (terminal);
++ add_display_timeout (terminal);
++ }
++}
++
++static gboolean
++vte_terminal_is_processing (VteTerminal *terminal)
++{
++ return terminal->pvt->coalesce_timeout != VTE_INVALID_SOURCE;
++}
++
++
++/* This function is called every DISPLAY_TIMEOUT ms.
++ * It makes sure output is never delayed by more than DISPLAY_TIMEOUT
++ */
++static gboolean
++display_timeout (gpointer data)
++{
++ gboolean cont;
++ VteTerminal *terminal = data;
++
++ cont = vte_terminal_process_incoming (terminal);
++
++ if (!cont) {
++ remove_coalesce_timeout (terminal);
++
++ terminal->pvt->display_timeout = VTE_INVALID_SOURCE;
++
++ return FALSE;
++ }
++ else {
++ remove_coalesce_timeout (terminal);
++ add_coalesce_timeout (terminal);
++ }
++
++ return TRUE;
++}
++
++/* This function is called whenever data haven't arrived for
++ * COALESCE_TIMEOUT ms
++ */
++static gboolean
++coalesce_timeout (gpointer data)
++{
++ gboolean cont;
++ VteTerminal *terminal = data;
++
++ cont = vte_terminal_process_incoming (terminal);
++
++ if (!cont) {
++ remove_display_timeout (terminal);
++
++ terminal->pvt->coalesce_timeout = VTE_INVALID_SOURCE;
++
++ return FALSE;
++ }
++ else {
++ /* reset display timeout since we just displayed */
++ remove_display_timeout (terminal);
++ add_display_timeout (terminal);
++ }
++
++ return TRUE;
++ }
+diff -r -u src.orig/vtexft.c src/vtexft.c
+--- src.orig/vtexft.c 2004-04-19 22:16:56 -0700
++++ src/vtexft.c 2004-12-19 18:22:10 -0800
+@@ -661,6 +661,7 @@
+ XftCharFontSpec *specs, int n)
+ {
+ int i, j;
++
+ i = j = 0;
+ while (i < n) {
+ for (j = i + 1; j < n; j++) {
+@@ -695,7 +696,7 @@
+ for (i = j = 0; i < n_requests; i++) {
+ specs[j].font = _vte_xft_font_for_char(data->font,
+ requests[i].c);
+- if (specs[j].font != NULL) {
++ if (specs[j].font != NULL && requests[i].c != 32) {
+ specs[j].x = requests[i].x - data->x_offs;
+ width = _vte_xft_char_width(data->font,
+ specs[j].font,
+@@ -708,7 +709,7 @@
+ specs[j].y = requests[i].y - data->y_offs + draw->ascent;
+ specs[j].ucs4 = requests[i].c;
+ j++;
+- } else {
++ } else if (requests[i].c != 32) {
+ g_warning(_("Can not draw character U+%04x.\n"),
+ requests[i].c);
+ }
diff --git a/x11-toolkits/vte/files/patch-06_remove_doublefree b/x11-toolkits/vte/files/patch-06_remove_doublefree
new file mode 100644
index 000000000000..15a5b4deeabb
--- /dev/null
+++ b/x11-toolkits/vte/files/patch-06_remove_doublefree
@@ -0,0 +1,38 @@
+diff -r -u src.orig/table.c src/table.c
+--- src.orig/table.c 2003-05-28 21:50:47 -0700
++++ src/table.c 2004-12-19 18:52:35 -0800
+@@ -709,7 +709,6 @@
+ if (G_VALUE_HOLDS_POINTER(value)) {
+ printf("\"%ls\"",
+ (wchar_t*) g_value_get_pointer(value));
+- g_free(g_value_get_pointer(value));
+ }
+ }
+ printf(")");
+diff -r -u src.orig/trie.c src/trie.c
+--- src.orig/trie.c 2003-09-11 13:45:03 -0700
++++ src/trie.c 2004-12-19 18:52:35 -0800
+@@ -648,9 +648,12 @@
+ /* We're done searching. Copy out any parameters we picked up. */
+ if (bestarray != NULL) {
+ for (i = 0; i < bestarray->n_values; i++) {
+- g_value_array_append(array,
+- g_value_array_get_nth(bestarray,
+- i));
++ GValue *value = g_value_array_get_nth(bestarray, i);
++ g_value_array_append(array, value);
++
++ if (G_VALUE_HOLDS_POINTER(value)) {
++ g_value_set_pointer(value, NULL);
++ }
+ }
+ _vte_matcher_free_params_array(bestarray);
+ }
+@@ -704,6 +707,7 @@
+ if (ptr != NULL) {
+ g_free(ptr);
+ }
++ g_value_set_pointer(value, NULL);
+ }
+ }
+ _vte_matcher_free_params_array(valuearray);
diff --git a/x11-toolkits/vte/files/patch-07_set_backspace_to_utf8 b/x11-toolkits/vte/files/patch-07_set_backspace_to_utf8
new file mode 100644
index 000000000000..cf1d41e6b7d7
--- /dev/null
+++ b/x11-toolkits/vte/files/patch-07_set_backspace_to_utf8
@@ -0,0 +1,14 @@
+--- src/vte.c.orig 2004-12-20 00:57:39 -0800
++++ src/vte.c 2004-12-20 00:57:44 -0800
+@@ -7125,7 +7125,11 @@
+ break;
+ default:
+ if (pid != 0) {
++ char *codeset;
+ terminal->pvt->pty_master = i;
++ g_get_charset(&codeset);
++ _vte_pty_set_utf8(terminal->pvt->pty_master,
++ (strcmp(codeset, "UTF-8") == 0));
+ }
+ }
+
diff --git a/x11-toolkits/vte/files/patch-08_multiscreen_safe b/x11-toolkits/vte/files/patch-08_multiscreen_safe
new file mode 100644
index 000000000000..211e48e389c9
--- /dev/null
+++ b/x11-toolkits/vte/files/patch-08_multiscreen_safe
@@ -0,0 +1,373 @@
+diff -r -u src.orig/vtebg.c src/vtebg.c
+--- src.orig/vtebg.c 2004-04-19 23:35:43 -0700
++++ src/vtebg.c 2004-12-19 18:56:14 -0800
+@@ -37,7 +37,9 @@
+ GList *cache;
+ };
+
+-static VteBg *singleton_bg = NULL;
++#if !GTK_CHECK_VERSION(2,2,0)
++static VteBg *singlehead_bg = NULL;
++#endif
+ static void vte_bg_set_root_pixmap(VteBg *bg, GdkPixmap *pixmap);
+ static void vte_bg_init(VteBg *bg, gpointer *klass);
+ static GdkPixbuf *_vte_bg_resize_pixbuf(GdkPixbuf *pixbuf,
+@@ -70,7 +72,9 @@
+ #include <gdk/gdkx.h>
+
+ struct VteBgNative {
++#if GTK_CHECK_VERSION(2,2,0)
+ GdkDisplay *display;
++#endif
+ GdkWindow *window;
+ XID native_window;
+ GdkAtom atom;
+@@ -81,18 +85,19 @@
+ vte_bg_native_new(GdkWindow *window)
+ {
+ struct VteBgNative *pvt;
+- Atom atom;
++
+ pvt = g_malloc0(sizeof(struct VteBgNative));
+ pvt->window = window;
+ pvt->native_window = gdk_x11_drawable_get_xid(window);
+- pvt->atom = gdk_atom_intern("_XROOTPMAP_ID", FALSE);
++
+ #if GTK_CHECK_VERSION(2,2,0)
+- atom = gdk_x11_atom_to_xatom_for_display(gdk_drawable_get_display(window),
+- pvt->atom);
++ pvt->display = gdk_drawable_get_display(GDK_DRAWABLE(window));
++ pvt->native_atom = gdk_x11_get_xatom_by_name_for_display(pvt->display, "_XROOTPMAP_ID");
++ pvt->atom = gdk_x11_xatom_to_atom_for_display(pvt->display, pvt->native_atom);
+ #else
+- atom = gdk_x11_atom_to_xatom(pvt->atom);
++ pvt->atom = gdk_atom_intern("_XROOTPMAP_ID", FALSE);
++ pvt->native_atom = gdk_x11_atom_to_xatom(pvt->atom);
+ #endif
+- pvt->native_atom = atom;
+ return pvt;
+ }
+
+@@ -100,7 +105,7 @@
+ _vte_bg_display_sync(VteBg *bg)
+ {
+ #if GTK_CHECK_VERSION(2,2,0)
+- gdk_display_sync(gdk_drawable_get_display(bg->native->window));
++ gdk_display_sync(bg->native->display);
+ #else
+ XSync(GDK_DISPLAY(), FALSE);
+ #endif
+@@ -136,7 +141,7 @@
+ (prop_size >= sizeof(XID) &&
+ (pixmaps != NULL))) {
+ #if GTK_CHECK_VERSION(2,2,0)
+- pixmap = gdk_pixmap_foreign_new_for_display(gdk_drawable_get_display(bg->native->window), pixmaps[0]);
++ pixmap = gdk_pixmap_foreign_new_for_display(bg->native->display, pixmaps[0]);
+ #else
+ pixmap = gdk_pixmap_foreign_new(pixmaps[0]);
+ #endif
+@@ -244,6 +249,7 @@
+
+ /**
+ * vte_bg_get:
++ * @screen : A #GdkScreen.
+ *
+ * Finds the address of the global #VteBg object, creating the object if
+ * necessary.
+@@ -251,12 +257,48 @@
+ * Returns: the global #VteBg object
+ */
+ VteBg *
+-vte_bg_get(void)
++vte_bg_get_for_screen(gpointer screen)
+ {
+- if (!VTE_IS_BG(singleton_bg)) {
+- singleton_bg = g_object_new(VTE_TYPE_BG, NULL);
++ GdkEventMask events;
++ GdkWindow *window;
++ VteBg *bg;
++
++#if GTK_CHECK_VERSION(2,2,0)
++ bg = g_object_get_data(G_OBJECT(screen), "vte-bg");
++ if (G_UNLIKELY(bg == NULL)) {
++ bg = g_object_new(VTE_TYPE_BG, NULL);
++ g_object_set_data(G_OBJECT(screen), "vte-bg", bg);
++
++ /* connect bg to screen */
++ bg->screen = screen;
++ window = gdk_screen_get_root_window(screen);
++ bg->native = vte_bg_native_new(window);
++ bg->root_pixmap = vte_bg_root_pixmap(bg);
++ bg->pvt = g_malloc0(sizeof(struct VteBgPrivate));
++ bg->pvt->cache = NULL;
++ events = gdk_window_get_events(window);
++ events |= GDK_PROPERTY_CHANGE_MASK;
++ gdk_window_set_events(window, events);
++ gdk_window_add_filter(window, vte_bg_root_filter, bg);
+ }
+- return singleton_bg;
++#else
++ if (G_UNLIKELY(singlehead_bg == NULL)) {
++ bg = g_object_new(VTE_TYPE_BG, NULL);
++ singlehead_bg = bg;
++
++ window = gdk_get_default_root_window();
++ bg->native = vte_bg_native_new(window);
++ bg->root_pixmap = vte_bg_root_pixmap(bg);
++ bg->pvt = g_malloc0(sizeof(struct VteBgPrivate));
++ bg->pvt->cache = NULL;
++ events = gdk_window_get_events(window);
++ events |= GDK_PROPERTY_CHANGE_MASK;
++ gdk_window_set_events(window, events);
++ gdk_window_add_filter(window, vte_bg_root_filter, bg);
++ }
++#endif
++
++ return bg;
+ }
+
+ struct VteBgCacheItem {
+@@ -274,17 +316,6 @@
+ static void
+ vte_bg_init(VteBg *bg, gpointer *klass)
+ {
+- GdkWindow *window;
+- GdkEventMask events;
+- window = gdk_get_default_root_window();
+- bg->native = vte_bg_native_new(window);
+- bg->root_pixmap = vte_bg_root_pixmap(bg);
+- bg->pvt = g_malloc0(sizeof(struct VteBgPrivate));
+- bg->pvt->cache = NULL;
+- events = gdk_window_get_events(window);
+- events |= GDK_PROPERTY_CHANGE_MASK;
+- gdk_window_set_events(window, events);
+- gdk_window_add_filter(window, vte_bg_root_filter, bg);
+ }
+
+ /* Generate lookup tables for desaturating an image toward a given color. The
+@@ -581,10 +612,6 @@
+ GdkPixbuf *pixbuf;
+ char *file;
+
+- if (bg == NULL) {
+- bg = vte_bg_get();
+- }
+-
+ if (source_type == VTE_BG_SOURCE_NONE) {
+ return NULL;
+ }
+@@ -614,7 +641,11 @@
+ int width, height;
+ /* Tell GTK+ that this foreign pixmap shares the
+ * root window's colormap. */
++#if GTK_CHECK_VERSION(2,2,0)
++ rcolormap = gdk_drawable_get_colormap(gdk_screen_get_root_window(bg->screen));
++#else
+ rcolormap = gdk_drawable_get_colormap(gdk_get_default_root_window());
++#endif
+ if (gdk_drawable_get_colormap(bg->root_pixmap) == NULL) {
+ gdk_drawable_set_colormap(bg->root_pixmap,
+ rcolormap);
+@@ -710,10 +741,6 @@
+ GdkColormap *rcolormap;
+ char *file;
+
+- if (bg == NULL) {
+- bg = vte_bg_get();
+- }
+-
+ if (source_type == VTE_BG_SOURCE_NONE) {
+ return NULL;
+ }
+@@ -743,7 +770,11 @@
+
+ /* If the pixmap doesn't have a colormap, tell GTK+ that
+ * it shares the root window's colormap. */
++#if GTK_CHECK_VERSION(2,2,0)
++ rcolormap = gdk_drawable_get_colormap(gdk_screen_get_root_window(bg->screen));
++#else
+ rcolormap = gdk_drawable_get_colormap(gdk_get_default_root_window());
++#endif
+ if (gdk_drawable_get_colormap(bg->root_pixmap) == NULL) {
+ gdk_drawable_set_colormap(bg->root_pixmap, rcolormap);
+ }
+diff -r -u src.orig/vtebg.h src/vtebg.h
+--- src.orig/vtebg.h 2003-05-19 15:48:58 -0700
++++ src/vtebg.h 2004-12-19 18:56:14 -0800
+@@ -30,6 +30,7 @@
+ typedef struct _VteBg VteBg;
+ struct _VteBg {
+ GObject parent;
++ gpointer screen;
+ GdkPixmap *root_pixmap;
+ struct VteBgNative *native;
+ struct VteBgPrivate *pvt;
+@@ -50,7 +51,7 @@
+
+ GType vte_bg_get_type(void);
+
+-VteBg *vte_bg_get(void);
++VteBg *vte_bg_get_for_screen(gpointer screen);
+
+ enum VteBgSourceType {
+ VTE_BG_SOURCE_NONE,
+diff -r -u src.orig/vte.c src/vte.c
+--- src.orig/vte.c 2004-05-01 23:43:01 -0700
++++ src/vte.c 2004-12-19 18:56:14 -0800
+@@ -11653,6 +11653,7 @@
+ vte_terminal_unrealize(GtkWidget *widget)
+ {
+ VteTerminal *terminal;
++ VteBg *bg;
+
+ #ifdef VTE_DEBUG
+ if (_vte_debug_on(VTE_DEBUG_LIFECYCLE)) {
+@@ -11671,7 +11672,12 @@
+ terminal->pvt->draw = NULL;
+
+ /* Disconnect from background-change events. */
+- g_signal_handlers_disconnect_by_func(G_OBJECT(vte_bg_get()),
++#if GTK_CHECK_VERSION(2,2,0)
++ bg = vte_bg_get_for_screen(gtk_widget_get_screen(widget));
++#else
++ bg = vte_bg_get_for_screen(NULL);
++#endif
++ g_signal_handlers_disconnect_by_func(G_OBJECT(bg),
+ root_pixmap_changed_cb,
+ widget);
+
+@@ -12007,6 +12013,7 @@
+ GtkSettings *settings;
+ int attributes_mask = 0, i;
+ gint blink_cycle = 1000;
++ VteBg *bg;
+
+ #ifdef VTE_DEBUG
+ if (_vte_debug_on(VTE_DEBUG_LIFECYCLE)) {
+@@ -12145,7 +12152,12 @@
+ 0, 0);
+
+ /* Connect to background-change events. */
+- g_signal_connect(G_OBJECT(vte_bg_get()),
++#if GTK_CHECK_VERSION(2,2,0)
++ bg = vte_bg_get_for_screen(gtk_widget_get_screen(widget));
++#else
++ bg = vte_bg_get_for_screen(NULL);
++#endif
++ g_signal_connect(G_OBJECT(bg),
+ "root-pixmap-changed",
+ G_CALLBACK(root_pixmap_changed_cb),
+ terminal);
+diff -r -u src.orig/vteft2.c src/vteft2.c
+--- src.orig/vteft2.c 2004-04-19 22:16:56 -0700
++++ src/vteft2.c 2004-12-19 18:56:14 -0800
+@@ -166,10 +166,18 @@
+ {
+ struct _vte_ft2_data *data;
+ GdkPixbuf *bgpixbuf;
++ gpointer screen;
++
++#if GTK_CHECK_VERSION(2,2,0)
++ screen = gtk_widget_get_screen(draw->widget);
++#else
++ screen = NULL;
++#endif
+
+ data = (struct _vte_ft2_data*) draw->impl_data;
+
+- bgpixbuf = vte_bg_get_pixbuf(vte_bg_get(), type, pixbuf, file,
++ bgpixbuf = vte_bg_get_pixbuf(vte_bg_get_for_screen(screen),
++ type, pixbuf, file,
+ color, saturation);
+ if (GDK_IS_PIXBUF(data->pixbuf)) {
+ g_object_unref(G_OBJECT(data->pixbuf));
+diff -r -u src.orig/vtegl.c src/vtegl.c
+--- src.orig/vtegl.c 2004-04-19 22:16:56 -0700
++++ src/vtegl.c 2004-12-19 18:56:14 -0800
+@@ -279,9 +279,17 @@
+ {
+ struct _vte_gl_data *data;
+ GdkPixbuf *bgpixbuf;
++ gpointer screen;
++
++#if GTK_CHECK_VERSION(2,2,0)
++ screen = gtk_widget_get_screen(draw->widget);
++#else
++ screen = NULL;
++#endif
+
+ data = (struct _vte_gl_data*) draw->impl_data;
+- bgpixbuf = vte_bg_get_pixbuf(vte_bg_get(), type, pixbuf, file,
++ bgpixbuf = vte_bg_get_pixbuf(vte_bg_get_for_screen(screen),
++ type, pixbuf, file,
+ tint, saturation);
+ if (GDK_IS_PIXBUF(data->bgpixbuf)) {
+ g_object_unref(G_OBJECT(data->bgpixbuf));
+diff -r -u src.orig/vtepango.c src/vtepango.c
+--- src.orig/vtepango.c 2004-04-19 22:16:56 -0700
++++ src/vtepango.c 2004-12-19 18:56:14 -0800
+@@ -194,9 +194,17 @@
+ {
+ GdkPixmap *pixmap;
+ struct _vte_pango_data *data;
++ gpointer screen;
++
++#if GTK_CHECK_VERSION(2,2,0)
++ screen = gtk_widget_get_screen(draw->widget);
++#else
++ screen = NULL;
++#endif
+
+ data = (struct _vte_pango_data*) draw->impl_data;
+- pixmap = vte_bg_get_pixmap(vte_bg_get(), type, pixbuf, file,
++ pixmap = vte_bg_get_pixmap(vte_bg_get_for_screen(screen),
++ type, pixbuf, file,
+ color, saturation,
+ _vte_draw_get_colormap(draw, TRUE));
+ if (GDK_IS_PIXMAP(data->pixmap)) {
+diff -r -u src.orig/vtepangox.c src/vtepangox.c
+--- src.orig/vtepangox.c 2004-04-19 22:16:56 -0700
++++ src/vtepangox.c 2004-12-19 18:56:14 -0800
+@@ -207,9 +207,17 @@
+ {
+ GdkPixmap *pixmap;
+ struct _vte_pango_x_data *data;
++ gpointer screen;
++
++#if GTK_CHECK_VERSION(2,2,0)
++ screen = gtk_widget_get_screen (draw->widget);
++#else
++ screen = NULL;
++#endif
+
+ data = (struct _vte_pango_x_data*) draw->impl_data;
+- pixmap = vte_bg_get_pixmap(vte_bg_get(), type, pixbuf, file,
++ pixmap = vte_bg_get_pixmap(vte_bg_get_for_screen(screen),
++ type, pixbuf, file,
+ color, saturation,
+ _vte_draw_get_colormap(draw, TRUE));
+ if (data->pixmap) {
+diff -r -u src.orig/vtexft.c src/vtexft.c
+--- src.orig/vtexft.c 2004-04-19 22:16:56 -0700
++++ src/vtexft.c 2004-12-19 18:56:14 -0800
+@@ -451,12 +451,19 @@
+ {
+ struct _vte_xft_data *data;
+ GdkPixmap *pixmap;
++ gpointer screen;
+
+ data = (struct _vte_xft_data*) draw->impl_data;
+
++#if GTK_CHECK_VERSION(2,2,0)
++ screen = gtk_widget_get_screen (draw->widget);
++#else
++ screen = NULL;
++#endif
++
+ data->xpixmap = -1;
+ data->pixmapw = data->pixmaph = 0;
+- pixmap = vte_bg_get_pixmap(vte_bg_get(), type,
++ pixmap = vte_bg_get_pixmap(vte_bg_get_for_screen(screen), type,
+ pixbuf, file, color, saturation,
+ _vte_draw_get_colormap(draw, TRUE));
+ if (GDK_IS_PIXMAP(data->pixmap)) {
diff --git a/x11-toolkits/vte/files/patch-10_hide_pageup_behavior b/x11-toolkits/vte/files/patch-10_hide_pageup_behavior
new file mode 100644
index 000000000000..9f2b1e619d28
--- /dev/null
+++ b/x11-toolkits/vte/files/patch-10_hide_pageup_behavior
@@ -0,0 +1,11 @@
+--- src/vte.c.orig 2004-12-20 00:01:33 -0800
++++ src/vte.c 2004-12-20 00:22:28 -0800
+@@ -696,7 +696,7 @@
+ !terminal->pvt->bg_transparent &&
+ (terminal->pvt->bg_pixbuf == NULL) &&
+ (terminal->pvt->bg_file == NULL) &&
+- (row == terminal->pvt->screen->scroll_delta) &&
++ (row == 0) &&
+ (count == terminal->row_count) &&
+ (terminal->pvt->scroll_lock_count == 0)) {
+ height = terminal->char_height;
diff --git a/x11-toolkits/vte/files/patch-src_vte.c b/x11-toolkits/vte/files/patch-src_vte.c
deleted file mode 100644
index 728569d78a84..000000000000
--- a/x11-toolkits/vte/files/patch-src_vte.c
+++ /dev/null
@@ -1,34 +0,0 @@
---- src/vte.c.orig Sun May 2 02:43:01 2004
-+++ src/vte.c Sun Oct 31 20:23:36 2004
-@@ -105,14 +105,14 @@
- #define VTE_ADJUSTMENT_PRIORITY G_PRIORITY_DEFAULT_IDLE
- #define VTE_INPUT_RETRY_PRIORITY G_PRIORITY_HIGH
- #define VTE_INPUT_PRIORITY G_PRIORITY_DEFAULT_IDLE
--#define VTE_CHILD_INPUT_PRIORITY G_PRIORITY_DEFAULT_IDLE
-+#define VTE_CHILD_INPUT_PRIORITY G_PRIORITY_LOW
- #define VTE_CHILD_OUTPUT_PRIORITY G_PRIORITY_HIGH
- #define VTE_FX_PRIORITY G_PRIORITY_DEFAULT_IDLE
- #define VTE_REGCOMP_FLAGS REG_EXTENDED
- #define VTE_REGEXEC_FLAGS 0
- #define VTE_INPUT_CHUNK_SIZE 0x1000
- #define VTE_INVALID_BYTE '?'
--#define VTE_COALESCE_TIMEOUT 2
-+#define VTE_COALESCE_TIMEOUT 15
-
- /* The structure we use to hold characters we're supposed to display -- this
- * includes any supported visible attributes. */
-@@ -10534,9 +10534,13 @@
- static gint
- vte_terminal_visibility_notify(GtkWidget *widget, GdkEventVisibility *event)
- {
-+ VteTerminal *terminal;
- g_return_val_if_fail(GTK_WIDGET(widget), FALSE);
- g_return_val_if_fail(VTE_IS_TERMINAL(widget), FALSE);
-- (VTE_TERMINAL(widget))->pvt->visibility_state = event->state;
-+ terminal = VTE_TERMINAL(widget);
-+ terminal->pvt->visibility_state = event->state;
-+ if (terminal->pvt->visibility_state == GDK_VISIBILITY_UNOBSCURED)
-+ vte_invalidate_all(terminal);
- return FALSE;
- }
-