[vte/vte-next: 186/223] Decouple buffer and view in vteseq.c
- From: Christian Persch <chpe src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [vte/vte-next: 186/223] Decouple buffer and view in vteseq.c
- Date: Wed, 22 Jun 2011 21:04:13 +0000 (UTC)
commit 4a74418d19c1c201f5df8351d3b029ff852ed787
Author: Christian Persch <chpe gnome org>
Date: Mon Jun 13 22:16:56 2011 +0200
Decouple buffer and view in vteseq.c
src/vte-private.h | 7 ++++++
src/vte.c | 51 +++++++++++++++++++++++++++++++++++++++++++++
src/vteseq.c | 60 ++++++++++++++++++++++++++--------------------------
3 files changed, 88 insertions(+), 30 deletions(-)
---
diff --git a/src/vte-private.h b/src/vte-private.h
index b218e08..0350c60 100644
--- a/src/vte-private.h
+++ b/src/vte-private.h
@@ -496,6 +496,13 @@ void _vte_terminal_handle_sequence(VteBuffer *buffer,
const char *match_s,
GQuark match,
GValueArray *params);
+void _vte_buffer_view_adjust_adjustments(VteBuffer *buffer);
+void _vte_buffer_view_invalidate_all(VteBuffer *buffer);
+void _vte_buffer_view_invalidate_cells(VteBuffer *buffer,
+ glong column_start, gint column_count,
+ glong row_start, gint row_count);
+void _vte_buffer_view_scroll_region(VteBuffer *buffer,
+ glong row, glong count, glong delta);
/* private VteScreen methods */
void _vte_screen_set_default_attributes(VteScreen *screen);
diff --git a/src/vte.c b/src/vte.c
index 0016a80..5f4b61c 100644
--- a/src/vte.c
+++ b/src/vte.c
@@ -13377,6 +13377,57 @@ vte_terminal_search_find_next (VteTerminal *terminal)
* Since: 0.30
*/
+void
+_vte_buffer_view_adjust_adjustments(VteBuffer *buffer)
+{
+ VteBufferPrivate *pvt = buffer->pvt;
+
+ if (pvt->terminal == NULL)
+ return;
+
+ _vte_terminal_adjust_adjustments(pvt->terminal);
+}
+
+void
+_vte_buffer_view_invalidate_all(VteBuffer *buffer)
+{
+ VteBufferPrivate *pvt = buffer->pvt;
+
+ if (pvt->terminal == NULL)
+ return;
+
+ _vte_invalidate_all(pvt->terminal);
+}
+
+void
+_vte_buffer_view_invalidate_cells(VteBuffer *buffer,
+ glong column_start,
+ gint column_count,
+ glong row_start,
+ gint row_count)
+{
+ VteBufferPrivate *pvt = buffer->pvt;
+
+ if (pvt->terminal == NULL)
+ return;
+
+ _vte_invalidate_cells(pvt->terminal, column_start, column_count, row_start, row_count);
+}
+
+void
+_vte_buffer_view_scroll_region(VteBuffer *buffer,
+ glong row,
+ glong count,
+ glong delta)
+{
+ VteBufferPrivate *pvt = buffer->pvt;
+
+ if (pvt->terminal == NULL)
+ return;
+
+ _vte_terminal_scroll_region(pvt->terminal, row, count, delta);
+}
+
#ifdef VTE_DEBUG
G_DEFINE_TYPE_WITH_CODE(VteBuffer, vte_buffer, G_TYPE_OBJECT,
g_type_add_class_private (g_define_type_id, sizeof (VteBufferClassPrivate));
diff --git a/src/vteseq.c b/src/vteseq.c
index 99acada..bfce09b 100644
--- a/src/vteseq.c
+++ b/src/vteseq.c
@@ -202,9 +202,9 @@ _vte_buffer_clear_screen (VteBuffer *buffer)
* newly-cleared area and scroll if need be. */
screen->insert_delta = initial;
screen->cursor_current.row = row + screen->insert_delta;
- _vte_terminal_adjust_adjustments(buffer->pvt->terminal);
+ _vte_buffer_view_adjust_adjustments(buffer);
/* Redraw everything. */
- _vte_invalidate_all(buffer->pvt->terminal);
+ _vte_buffer_view_invalidate_all(buffer);
/* We've modified the display. Make a note of it. */
buffer->pvt->text_deleted_flag = TRUE;
}
@@ -230,7 +230,7 @@ _vte_buffer_clear_current_line (VteBuffer *buffer)
_vte_row_data_fill (rowdata, &screen->fill_defaults, buffer->pvt->column_count);
rowdata->attr.soft_wrapped = 0;
/* Repaint this row. */
- _vte_invalidate_cells(buffer->pvt->terminal,
+ _vte_buffer_view_invalidate_cells(buffer,
0, buffer->pvt->column_count,
screen->cursor_current.row, 1);
}
@@ -260,7 +260,7 @@ _vte_buffer_clear_above_current (VteBuffer *buffer)
_vte_row_data_fill (rowdata, &screen->fill_defaults, buffer->pvt->column_count);
rowdata->attr.soft_wrapped = 0;
/* Repaint the row. */
- _vte_invalidate_cells(buffer->pvt->terminal,
+ _vte_buffer_view_invalidate_cells(buffer,
0, buffer->pvt->column_count, i, 1);
}
}
@@ -302,11 +302,11 @@ _vte_buffer_scroll_text (VteBuffer *buffer,
}
/* Update the display. */
- _vte_terminal_scroll_region(buffer->pvt->terminal, start, end - start + 1,
+ _vte_buffer_view_scroll_region(buffer, start, end - start + 1,
scroll_amount);
/* Adjust the scrollbars if necessary. */
- _vte_terminal_adjust_adjustments(buffer->pvt->terminal);
+ _vte_buffer_view_adjust_adjustments(buffer);
/* We've modified the display. Make a note of it. */
buffer->pvt->text_inserted_flag = TRUE;
@@ -733,12 +733,12 @@ vte_sequence_handler_decset_internal(VteBuffer *buffer,
buffer->pvt->padding.top +
buffer->pvt->padding.bottom);
/* Request a resize and redraw. */
- _vte_invalidate_all(buffer->pvt->terminal);
+ _vte_buffer_view_invalidate_all(buffer);
break;
#endif
case 5:
/* Repaint everything in reverse mode. */
- _vte_invalidate_all(buffer->pvt->terminal);
+ _vte_buffer_view_invalidate_all(buffer);
break;
case 6:
/* Reposition the cursor in its new home position. */
@@ -761,7 +761,7 @@ vte_sequence_handler_decset_internal(VteBuffer *buffer,
vte_buffer_set_scrollback_lines(buffer,
buffer->pvt->scrollback_lines);
_vte_terminal_queue_contents_changed(buffer->pvt->terminal);
- _vte_invalidate_all (buffer->pvt->terminal);
+ _vte_buffer_view_invalidate_all(buffer);
break;
case 9:
case 1000:
@@ -853,11 +853,11 @@ vte_sequence_handler_al (VteBuffer *buffer, GValueArray *params)
_vte_buffer_ring_remove (buffer, end);
_vte_buffer_ring_insert (buffer, start, TRUE);
/* Adjust the scrollbars if necessary. */
- _vte_terminal_adjust_adjustments(buffer->pvt->terminal);
+ _vte_buffer_view_adjust_adjustments(buffer);
}
/* Update the display. */
- _vte_terminal_scroll_region(buffer->pvt->terminal, start, end - start + 1, param);
+ _vte_buffer_view_scroll_region(buffer, start, end - start + 1, param);
/* We've modified the display. Make a note of it. */
buffer->pvt->text_deleted_flag = TRUE;
@@ -937,7 +937,7 @@ vte_sequence_handler_cb (VteBuffer *buffer, GValueArray *params)
}
}
/* Repaint this row. */
- _vte_invalidate_cells(buffer->pvt->terminal,
+ _vte_buffer_view_invalidate_cells(buffer,
0, screen->cursor_current.col+1,
screen->cursor_current.row, 1);
@@ -989,7 +989,7 @@ vte_sequence_handler_cd (VteBuffer *buffer, GValueArray *params)
_vte_row_data_fill (rowdata, &screen->fill_defaults, buffer->pvt->column_count);
rowdata->attr.soft_wrapped = 0;
/* Repaint this row. */
- _vte_invalidate_cells(buffer->pvt->terminal,
+ _vte_buffer_view_invalidate_cells(buffer,
0, buffer->pvt->column_count,
i, 1);
}
@@ -1022,7 +1022,7 @@ vte_sequence_handler_ce (VteBuffer *buffer, GValueArray *params)
}
rowdata->attr.soft_wrapped = 0;
/* Repaint this row. */
- _vte_invalidate_cells(buffer->pvt->terminal,
+ _vte_buffer_view_invalidate_cells(buffer,
screen->cursor_current.col,
buffer->pvt->column_count -
screen->cursor_current.col,
@@ -1279,7 +1279,7 @@ vte_sequence_handler_dc (VteBuffer *buffer, GValueArray *params)
len = buffer->pvt->column_count;
}
/* Repaint this row. */
- _vte_invalidate_cells(buffer->pvt->terminal,
+ _vte_buffer_view_invalidate_cells(buffer,
col, len - col,
screen->cursor_current.row, 1);
}
@@ -1329,11 +1329,11 @@ vte_sequence_handler_dl (VteBuffer *buffer, GValueArray *params)
_vte_buffer_ring_remove (buffer, start);
_vte_buffer_ring_insert (buffer, end, TRUE);
/* Adjust the scrollbars if necessary. */
- _vte_terminal_adjust_adjustments(buffer->pvt->terminal);
+ _vte_buffer_view_adjust_adjustments(buffer);
}
/* Update the display. */
- _vte_terminal_scroll_region(buffer->pvt->terminal, start, end - start + 1, -param);
+ _vte_buffer_view_scroll_region(buffer, start, end - start + 1, -param);
/* We've modified the display. Make a note of it. */
buffer->pvt->text_deleted_flag = TRUE;
@@ -1424,7 +1424,7 @@ vte_sequence_handler_ec (VteBuffer *buffer, GValueArray *params)
}
}
/* Repaint this row. */
- _vte_invalidate_cells(buffer->pvt->terminal,
+ _vte_buffer_view_invalidate_cells(buffer,
screen->cursor_current.col, count,
screen->cursor_current.row, 1);
}
@@ -1897,8 +1897,8 @@ vte_sequence_handler_sr (VteBuffer *buffer, GValueArray *params)
_vte_buffer_ring_remove (buffer, end);
_vte_buffer_ring_insert (buffer, start, TRUE);
/* Update the display. */
- _vte_terminal_scroll_region(buffer->pvt->terminal, start, end - start + 1, 1);
- _vte_invalidate_cells(buffer->pvt->terminal,
+ _vte_buffer_view_scroll_region(buffer, start, end - start + 1, 1);
+ _vte_buffer_view_invalidate_cells(buffer,
0, buffer->pvt->column_count,
start, 2);
} else {
@@ -1906,7 +1906,7 @@ vte_sequence_handler_sr (VteBuffer *buffer, GValueArray *params)
screen->cursor_current.row--;
}
/* Adjust the scrollbars if necessary. */
- _vte_terminal_adjust_adjustments(buffer->pvt->terminal);
+ _vte_buffer_view_adjust_adjustments(buffer);
/* We modified the display, so make a note of it. */
buffer->pvt->text_modified_flag = TRUE;
}
@@ -2012,7 +2012,7 @@ vte_sequence_handler_ta (VteBuffer *buffer, GValueArray *params)
}
}
- _vte_invalidate_cells (buffer->pvt->terminal,
+ _vte_buffer_view_invalidate_cells(buffer,
screen->cursor_current.col,
newcol - screen->cursor_current.col,
screen->cursor_current.row, 1);
@@ -2070,7 +2070,7 @@ vte_sequence_handler_uc (VteBuffer *buffer, GValueArray *params)
/* Set this character to be underlined. */
cell->attr.underline = 1;
/* Cause the character to be repainted. */
- _vte_invalidate_cells(buffer->pvt->terminal,
+ _vte_buffer_view_invalidate_cells(buffer,
column, cell->attr.columns,
screen->cursor_current.row, 1);
/* Move the cursor right. */
@@ -2701,9 +2701,9 @@ vte_sequence_handler_insert_lines (VteBuffer *buffer, GValueArray *params)
_vte_buffer_ring_insert (buffer, row, TRUE);
}
/* Update the display. */
- _vte_terminal_scroll_region(buffer->pvt->terminal, row, end - row + 1, param);
+ _vte_buffer_view_scroll_region(buffer, row, end - row + 1, param);
/* Adjust the scrollbars if necessary. */
- _vte_terminal_adjust_adjustments(buffer->pvt->terminal);
+ _vte_buffer_view_adjust_adjustments(buffer);
/* We've modified the display. Make a note of it. */
buffer->pvt->text_inserted_flag = TRUE;
}
@@ -2742,9 +2742,9 @@ vte_sequence_handler_delete_lines (VteBuffer *buffer, GValueArray *params)
_vte_buffer_ring_insert (buffer, end, TRUE);
}
/* Update the display. */
- _vte_terminal_scroll_region(buffer->pvt->terminal, row, end - row + 1, -param);
+ _vte_buffer_view_scroll_region(buffer, row, end - row + 1, -param);
/* Adjust the scrollbars if necessary. */
- _vte_terminal_adjust_adjustments(buffer->pvt->terminal);
+ _vte_buffer_view_adjust_adjustments(buffer);
/* We've modified the display. Make a note of it. */
buffer->pvt->text_deleted_flag = TRUE;
}
@@ -2906,7 +2906,7 @@ vte_sequence_handler_screen_alignment_test (VteBuffer *buffer, GValueArray *para
/* Find this row. */
while (_vte_ring_next(screen->row_data) <= row)
_vte_buffer_ring_append (buffer, FALSE);
- _vte_terminal_adjust_adjustments(buffer->pvt->terminal);
+ _vte_buffer_view_adjust_adjustments(buffer);
rowdata = _vte_ring_index_writable (screen->row_data, row);
g_assert(rowdata != NULL);
/* Clear this row. */
@@ -2920,7 +2920,7 @@ vte_sequence_handler_screen_alignment_test (VteBuffer *buffer, GValueArray *para
_vte_row_data_fill (rowdata, &cell, buffer->pvt->column_count);
_vte_buffer_emit_text_inserted(buffer);
}
- _vte_invalidate_all(buffer->pvt->terminal);
+ _vte_buffer_view_invalidate_all(buffer);
/* We modified the display, so make a note of it for completeness. */
buffer->pvt->text_modified_flag = TRUE;
@@ -3019,7 +3019,7 @@ vte_sequence_handler_window_manipulation (VteBuffer *buffer, GValueArray *params
case 7:
_vte_debug_print(VTE_DEBUG_PARSE,
"Refreshing window.\n");
- _vte_invalidate_all(buffer->pvt->terminal);
+ _vte_buffer_view_invalidate_all(buffer);
_vte_buffer_emit_refresh_window(buffer);
break;
case 8:
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]