diff options
author | Chris Wilson <chris@chris-wilson.co.uk> | 2007-02-26 10:25:09 +0000 |
---|---|---|
committer | Chris Wilson <cpwilson@src.gnome.org> | 2007-02-26 10:25:09 +0000 |
commit | 4a97568d88997a1b1046de05277d58f7a239c267 (patch) | |
tree | f99c50a636b52f06d936969312592ee61721d7dc | |
parent | 550b55875ea57b63d1164a1120decb55f55333a6 (diff) | |
download | vte-4a97568d88997a1b1046de05277d58f7a239c267.tar.gz |
Bug 411000 – Orca repeats old text in gnome-terminal
2007-02-26 Chris Wilson <chris@chris-wilson.co.uk>
Bug 411000 – Orca repeats old text in gnome-terminal
The deferred handling of the window scrolling had the unfortunate
side-effect of postponing the accessibility 'text-scrolled' signal
until after the 'text-inserted' signal. This caused vteaccess to
determine that the whole window had been modified and cause orca to
reread the entire screen.
* src/vte-private.h:
* src/vte.c: (vte_terminal_emit_contents_changed),
(_vte_terminal_queue_contents_changed),
(vte_terminal_emit_cursor_moved),
(vte_terminal_queue_cursor_moved), (vte_terminal_scroll_pages),
(vte_terminal_eof), (vte_terminal_emit_pending_text_signals),
(vte_terminal_process_incoming), (vte_terminal_handle_scroll),
(vte_terminal_size_allocate), (vte_terminal_unrealize),
(vte_terminal_emit_pending_signals):
* src/vteaccess.c: (emit_text_caret_moved),
(emit_text_changed_insert), (emit_text_changed_delete):
* src/vteseq.c: (vte_sequence_handler_decset_internal):
Restore the order of the ally signals. However, Bug 372777
remains unresolved.
svn path=/trunk/; revision=1754
-rw-r--r-- | ChangeLog | 25 | ||||
-rw-r--r-- | src/vte-private.h | 5 | ||||
-rw-r--r-- | src/vte.c | 67 | ||||
-rw-r--r-- | src/vteaccess.c | 6 | ||||
-rw-r--r-- | src/vteseq.c | 2 |
5 files changed, 81 insertions, 24 deletions
@@ -1,5 +1,30 @@ 2007-02-26 Chris Wilson <chris@chris-wilson.co.uk> + Bug 411000 – Orca repeats old text in gnome-terminal + + The deferred handling of the window scrolling had the unfortunate + side-effect of postponing the accessibility 'text-scrolled' signal + until after the 'text-inserted' signal. This caused vteaccess to + determine that the whole window had been modified and cause orca to + reread the entire screen. + + * src/vte-private.h: + * src/vte.c: (vte_terminal_emit_contents_changed), + (_vte_terminal_queue_contents_changed), + (vte_terminal_emit_cursor_moved), + (vte_terminal_queue_cursor_moved), (vte_terminal_scroll_pages), + (vte_terminal_eof), (vte_terminal_emit_pending_text_signals), + (vte_terminal_process_incoming), (vte_terminal_handle_scroll), + (vte_terminal_size_allocate), (vte_terminal_unrealize), + (vte_terminal_emit_pending_signals): + * src/vteaccess.c: (emit_text_caret_moved), + (emit_text_changed_insert), (emit_text_changed_delete): + * src/vteseq.c: (vte_sequence_handler_decset_internal): + Restore the order of the ally signals. However, Bug 372777 + remains unresolved. + +2007-02-26 Chris Wilson <chris@chris-wilson.co.uk> + * src/vte.c: (vte_terminal_io_read): Eeek, correctly compute the buffer length when we no longer aim to fill it. diff --git a/src/vte-private.h b/src/vte-private.h index 9ebb64ba..95a27c32 100644 --- a/src/vte-private.h +++ b/src/vte-private.h @@ -350,6 +350,9 @@ struct _VteTerminalPrivate { gboolean adjustment_changed_pending; gboolean adjustment_value_changed_pending; + gboolean cursor_moved_pending; + gboolean contents_changed_pending; + /* window name changes */ gchar *window_title_changed; gchar *icon_title_changed; @@ -385,7 +388,7 @@ VteRowData * _vte_new_row_data(VteTerminal *terminal); VteRowData * _vte_new_row_data_sized(VteTerminal *terminal, gboolean fill); VteRowData * _vte_reset_row_data (VteTerminal *terminal, VteRowData *row, gboolean fill); void _vte_terminal_adjust_adjustments(VteTerminal *terminal); -void _vte_terminal_emit_contents_changed(VteTerminal *terminal); +void _vte_terminal_queue_contents_changed(VteTerminal *terminal); void _vte_terminal_emit_text_deleted(VteTerminal *terminal); void _vte_terminal_emit_text_inserted(VteTerminal *terminal); void _vte_terminal_insert_char(VteTerminal *terminal, gunichar c, @@ -79,6 +79,7 @@ static gboolean vte_terminal_background_update(VteTerminal *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(VteTerminal *terminal); +static void vte_terminal_emit_pending_signals(VteTerminal *terminal); static inline gboolean vte_cell_is_selected(VteTerminal *terminal, glong col, glong row, gpointer data); static char *vte_terminal_get_text_range_maybe_wrapped(VteTerminal *terminal, @@ -800,21 +801,41 @@ vte_terminal_emit_child_exited(VteTerminal *terminal) } /* Emit a "contents_changed" signal. */ +static void +vte_terminal_emit_contents_changed(VteTerminal *terminal) +{ + if (terminal->pvt->contents_changed_pending) { + _vte_debug_print(VTE_DEBUG_SIGNALS, + "Emitting `contents-changed'.\n"); + g_signal_emit_by_name(terminal, "contents-changed"); + terminal->pvt->contents_changed_pending = FALSE; + } +} void -_vte_terminal_emit_contents_changed(VteTerminal *terminal) +_vte_terminal_queue_contents_changed(VteTerminal *terminal) { _vte_debug_print(VTE_DEBUG_SIGNALS, - "Emitting `contents-changed'.\n"); - g_signal_emit_by_name(terminal, "contents-changed"); + "Queueing `contents-changed'.\n"); + terminal->pvt->contents_changed_pending = TRUE; } /* Emit a "cursor_moved" signal. */ static void vte_terminal_emit_cursor_moved(VteTerminal *terminal) { + if (terminal->pvt->cursor_moved_pending) { + _vte_debug_print(VTE_DEBUG_SIGNALS, + "Emitting `cursor-moved'.\n"); + g_signal_emit_by_name(terminal, "cursor-moved"); + terminal->pvt->cursor_moved_pending = FALSE; + } +} +static void +vte_terminal_queue_cursor_moved(VteTerminal *terminal) +{ _vte_debug_print(VTE_DEBUG_SIGNALS, - "Emitting `cursor-moved'.\n"); - g_signal_emit_by_name(terminal, "cursor-moved"); + "Queueing `cursor-moved'.\n"); + terminal->pvt->cursor_moved_pending = TRUE; } /* Emit a "eof" signal. */ @@ -1744,7 +1765,7 @@ vte_terminal_scroll_pages(VteTerminal *terminal, gint pages) /* Clear dingus match set. */ _vte_terminal_match_contents_clear(terminal); /* Notify viewers that the contents have changed. */ - _vte_terminal_emit_contents_changed(terminal); + _vte_terminal_queue_contents_changed(terminal); } /* Scroll so that the scroll delta is the minimum value. */ @@ -2979,6 +3000,7 @@ vte_terminal_eof(GIOChannel *channel, VteTerminal *terminal) vte_terminal_stop_processing (terminal); if (terminal->pvt->incoming) { vte_terminal_process_incoming(terminal); + vte_terminal_emit_pending_signals (terminal); } g_array_set_size(terminal->pvt->pending, 0); @@ -3057,6 +3079,10 @@ vte_terminal_emit_pending_text_signals(VteTerminal *terminal, GQuark quark) _vte_terminal_emit_text_deleted(terminal); terminal->pvt->text_deleted_count = 0; } + + terminal->pvt->text_modified_flag = FALSE; + terminal->pvt->text_inserted_count = 0; + terminal->pvt->text_deleted_count = 0; } /* Process incoming data, first converting it to unicode characters, and then @@ -3090,12 +3116,6 @@ vte_terminal_process_incoming(VteTerminal *terminal) cursor = screen->cursor_current; cursor_visible = terminal->pvt->cursor_visible; - /* We're going to check if the text was modified once we're done here, - * so keep a flag. */ - terminal->pvt->text_modified_flag = FALSE; - terminal->pvt->text_inserted_count = 0; - terminal->pvt->text_deleted_count = 0; - /* We should only be called when there's data to process. */ g_assert(terminal->pvt->incoming || (terminal->pvt->pending->len > 0)); @@ -3385,9 +3405,6 @@ next_match: again = FALSE; } - /* Flush any pending "inserted" signals. */ - vte_terminal_emit_pending_text_signals(terminal, 0); - if (modified) { /* Keep the cursor on-screen if we scroll on output, or if * we're currently at the bottom of the buffer. */ @@ -3419,7 +3436,7 @@ next_match: if (modified || (screen != terminal->pvt->screen)) { /* Signal that the visible contents changed. */ _vte_terminal_match_contents_clear(terminal); - _vte_terminal_emit_contents_changed(terminal); + _vte_terminal_queue_contents_changed(terminal); } if ((cursor.col != terminal->pvt->screen->cursor_current.col) || @@ -3429,7 +3446,7 @@ next_match: _vte_invalidate_cell(terminal, cursor.col, cursor.row); _vte_invalidate_cursor_once(terminal, FALSE); /* Signal that the cursor moved. */ - vte_terminal_emit_cursor_moved(terminal); + vte_terminal_queue_cursor_moved(terminal); } else if (cursor_visible != terminal->pvt->cursor_visible) { _vte_invalidate_cell(terminal, cursor.col, cursor.row); } @@ -6843,7 +6860,7 @@ vte_terminal_handle_scroll(VteTerminal *terminal) _vte_terminal_scroll_region(terminal, screen->scroll_delta, terminal->row_count, -dy); vte_terminal_emit_text_scrolled(terminal, dy); - _vte_terminal_emit_contents_changed(terminal); + _vte_terminal_queue_contents_changed(terminal); } else { _vte_debug_print(VTE_DEBUG_IO, "Not scrolling\n"); } @@ -7380,7 +7397,7 @@ vte_terminal_size_allocate(GtkWidget *widget, GtkAllocation *allocation) _vte_ring_next (screen->row_data)- 1); /* Notify viewers that the contents have changed. */ _vte_terminal_match_contents_clear(terminal); - _vte_terminal_emit_contents_changed(terminal); + _vte_terminal_queue_contents_changed(terminal); } /* Resize the GDK window. */ @@ -7489,6 +7506,13 @@ vte_terminal_unrealize(GtkWidget *widget) /* Cancel any pending redraws. */ remove_update_timeout (terminal); + /* Cancel any pending signals */ + terminal->pvt->contents_changed_pending = FALSE; + terminal->pvt->cursor_moved_pending = FALSE; + terminal->pvt->text_modified_flag = FALSE; + terminal->pvt->text_inserted_count = 0; + terminal->pvt->text_deleted_count = 0; + /* Clear modifiers. */ terminal->pvt->modifiers = 0; @@ -11843,6 +11867,11 @@ vte_terminal_emit_pending_signals(VteTerminal *terminal) terminal->icon_title); vte_terminal_emit_icon_title_changed(terminal); } + + /* Flush any pending "inserted" signals. */ + vte_terminal_emit_cursor_moved(terminal); + vte_terminal_emit_pending_text_signals(terminal, 0); + vte_terminal_emit_contents_changed (terminal); } /* This function is called after DISPLAY_TIMEOUT ms. diff --git a/src/vteaccess.c b/src/vteaccess.c index fe64622a..d28be839 100644 --- a/src/vteaccess.c +++ b/src/vteaccess.c @@ -181,7 +181,7 @@ all_selected(VteTerminal *terminal, glong column, glong row, gpointer data) static void emit_text_caret_moved(GObject *object, glong caret) { - _vte_debug_print(VTE_DEBUG_SIGNALS, + _vte_debug_print(VTE_DEBUG_SIGNALS|VTE_DEBUG_ALLY, "Accessibility peer emitting " "`text-caret-moved'.\n"); g_signal_emit_by_name(object, "text-caret-moved", caret); @@ -198,7 +198,7 @@ emit_text_changed_insert(GObject *object, /* Convert the byte offsets to character offsets. */ start = g_utf8_pointer_to_offset (text, text + offset); count = g_utf8_pointer_to_offset (text + offset, text + offset + len); - _vte_debug_print(VTE_DEBUG_SIGNALS, + _vte_debug_print(VTE_DEBUG_SIGNALS|VTE_DEBUG_ALLY, "Accessibility peer emitting " "`text-changed::insert' (%ld, %ld) (%ld, %ld).\n" "Inserted text was `%.*s'.\n", @@ -218,7 +218,7 @@ emit_text_changed_delete(GObject *object, /* Convert the byte offsets to characters. */ start = g_utf8_pointer_to_offset (text, text + offset); count = g_utf8_pointer_to_offset (text + offset, text + offset + len); - _vte_debug_print(VTE_DEBUG_SIGNALS, + _vte_debug_print(VTE_DEBUG_SIGNALS|VTE_DEBUG_ALLY, "Accessibility peer emitting " "`text-changed::delete' (%ld, %ld) (%ld, %ld).\n" "Deleted text was `%.*s'.\n", diff --git a/src/vteseq.c b/src/vteseq.c index 21d73f4c..e13f75fd 100644 --- a/src/vteseq.c +++ b/src/vteseq.c @@ -723,7 +723,7 @@ vte_sequence_handler_decset_internal(VteTerminal *terminal, vte_terminal_set_scrollback_lines(terminal, terminal->pvt->scrollback_lines); _vte_terminal_match_contents_clear(terminal); - _vte_terminal_emit_contents_changed(terminal); + _vte_terminal_queue_contents_changed(terminal); _vte_invalidate_all (terminal); break; case 9: |