[vte] widget: Move some methods to VteTerminalPrivate



commit 71f097cbc6672648ecff8a9780484d6208241f7d
Author: Christian Persch <chpe gnome org>
Date:   Sat Jan 30 18:19:27 2016 +0100

    widget: Move some methods to VteTerminalPrivate

 src/vte-private.h  |    4 ----
 src/vte.cc         |   39 +++++++++++++++++++++------------------
 src/vteinternal.hh |    5 +++++
 src/vteseq.cc      |   28 ++++++++++++++--------------
 4 files changed, 40 insertions(+), 36 deletions(-)
---
diff --git a/src/vte-private.h b/src/vte-private.h
index b22ba0c..5df8814 100644
--- a/src/vte-private.h
+++ b/src/vte-private.h
@@ -58,10 +58,6 @@ VteTerminalPrivate *_vte_terminal_get_impl(VteTerminal *terminal);
 VteRowData *_vte_terminal_ensure_row(VteTerminal *terminal);
 VteRowData * _vte_new_row_data(VteTerminal *terminal);
 
-VteRowData *_vte_terminal_ring_insert (VteTerminal *terminal, glong position, gboolean fill);
-VteRowData *_vte_terminal_ring_append (VteTerminal *terminal, gboolean fill);
-void _vte_terminal_ring_remove (VteTerminal *terminal, glong position);
-
 gboolean _vte_terminal_size_to_grid_size(VteTerminal *terminal,
                                          long w,
                                          long h,
diff --git a/src/vte.cc b/src/vte.cc
index e423c43..71bcdd3 100644
--- a/src/vte.cc
+++ b/src/vte.cc
@@ -224,33 +224,36 @@ vte_g_array_fill(GArray *array, gconstpointer item, guint final_size)
        } while (--final_size);
 }
 
-
-VteRowData *
-_vte_terminal_ring_insert (VteTerminal *terminal, glong position, gboolean fill)
+// FIXMEchpe replace this with a method on VteRing
+VteRowData*
+VteTerminalPrivate::ring_insert(vte::grid::row_t position,
+                                bool fill)
 {
        VteRowData *row;
-       VteRing *ring = terminal->pvt->screen->row_data;
+       VteRing *ring = m_screen->row_data;
        while (G_UNLIKELY (_vte_ring_next (ring) < position)) {
                row = _vte_ring_append (ring);
-                if (terminal->pvt->fill_defaults.attr.back != VTE_DEFAULT_BG)
-                        _vte_row_data_fill (row, &terminal->pvt->fill_defaults, terminal->pvt->column_count);
+                if (m_fill_defaults.attr.back != VTE_DEFAULT_BG)
+                        _vte_row_data_fill (row, &m_fill_defaults, m_column_count);
        }
        row = _vte_ring_insert (ring, position);
-        if (fill && terminal->pvt->fill_defaults.attr.back != VTE_DEFAULT_BG)
-                _vte_row_data_fill (row, &terminal->pvt->fill_defaults, terminal->pvt->column_count);
+        if (fill && m_fill_defaults.attr.back != VTE_DEFAULT_BG)
+                _vte_row_data_fill (row, &m_fill_defaults, m_column_count);
        return row;
 }
 
-VteRowData *
-_vte_terminal_ring_append (VteTerminal *terminal, gboolean fill)
+// FIXMEchpe replace this with a method on VteRing
+VteRowData*
+VteTerminalPrivate::ring_append(bool fill)
 {
-       return _vte_terminal_ring_insert (terminal, _vte_ring_next (terminal->pvt->screen->row_data), fill);
+       return ring_insert(_vte_ring_next(m_screen->row_data), fill);
 }
 
+// FIXMEchpe replace this with a method on VteRing
 void
-_vte_terminal_ring_remove (VteTerminal *terminal, glong position)
+VteTerminalPrivate::ring_remove(vte::grid::row_t position)
 {
-       _vte_ring_remove (terminal->pvt->screen->row_data, position);
+       _vte_ring_remove(m_screen->row_data, position);
 }
 
 /* Reset defaults for character insertion. */
@@ -2393,17 +2396,17 @@ VteTerminalPrivate::set_cjk_ambiguous_width(int width)
         return true;
 }
 
+// FIXMEchpe replace this with a method on VteRing
 VteRowData *
 VteTerminalPrivate::insert_rows (guint cnt)
 {
        VteRowData *row;
        do {
-               row = _vte_terminal_ring_append(m_terminal, FALSE);
+               row = ring_append(false);
        } while(--cnt);
        return row;
 }
 
-
 /* Make sure we have enough rows and columns to hold data at the current
  * cursor position. */
 VteRowData *
@@ -3006,7 +3009,7 @@ VteTerminalPrivate::cursor_down()
                                 * to insert_delta. */
                                start++;
                                end++;
-                                _vte_terminal_ring_insert(m_terminal, m_screen->cursor.row, FALSE);
+                                ring_insert(m_screen->cursor.row, false);
                                /* Force the areas below the region to be
                                 * redrawn -- they've moved. */
                                scroll_region(start,
@@ -3017,8 +3020,8 @@ VteTerminalPrivate::cursor_down()
                                /* If we're at the bottom of the scrolling
                                 * region, add a line at the top to scroll the
                                 * bottom off. */
-                               _vte_terminal_ring_remove(m_terminal, start);
-                               _vte_terminal_ring_insert(m_terminal, end, TRUE);
+                               ring_remove(start);
+                               ring_insert(end, true);
                                /* Update the display. */
                                scroll_region(start,
                                                           end - start + 1, -1);
diff --git a/src/vteinternal.hh b/src/vteinternal.hh
index 9ef8b4d..c78245a 100644
--- a/src/vteinternal.hh
+++ b/src/vteinternal.hh
@@ -543,6 +543,11 @@ public:
 
 public:
 
+        inline VteRowData* ring_insert(vte::grid::row_t position,
+                                       bool fill);
+        inline VteRowData* ring_append(bool fill);
+        inline void ring_remove(vte::grid::row_t position);
+
         inline vte::view::coord_t scroll_delta_pixel() const;
         inline vte::grid::row_t pixel_to_row(vte::view::coord_t y) const;
         inline vte::view::coord_t row_to_pixel(vte::grid::row_t row) const;
diff --git a/src/vteseq.cc b/src/vteseq.cc
index ed61641..9e0d163 100644
--- a/src/vteseq.cc
+++ b/src/vteseq.cc
@@ -238,7 +238,7 @@ VteTerminalPrivate::seq_clear_screen()
         auto initial = _vte_ring_next(m_screen->row_data);
        /* Add a new screen's worth of rows. */
         for (auto i = 0; i < m_row_count; i++)
-                _vte_terminal_ring_append(m_terminal, TRUE);
+                ring_append(true);
        /* Move the cursor and insertion delta to the first line in the
         * newly-cleared area and scroll if need be. */
         m_screen->insert_delta = initial;
@@ -314,17 +314,17 @@ VteTerminalPrivate::seq_scroll_text(vte::grid::row_t scroll_amount)
        }
 
         while (_vte_ring_next(m_screen->row_data) <= end)
-                _vte_terminal_ring_append(m_terminal, FALSE);
+                ring_append(false);
 
        if (scroll_amount > 0) {
                for (auto i = 0; i < scroll_amount; i++) {
-                        _vte_terminal_ring_remove(m_terminal, end);
-                        _vte_terminal_ring_insert(m_terminal, start, TRUE);
+                        ring_remove(end);
+                        ring_insert(start, true);
                }
        } else {
                for (auto i = 0; i < -scroll_amount; i++) {
-                        _vte_terminal_ring_remove(m_terminal, start);
-                        _vte_terminal_ring_insert(m_terminal, end, TRUE);
+                        ring_remove(start);
+                        ring_insert(end, true);
                }
        }
 
@@ -1116,7 +1116,7 @@ VteTerminalPrivate::seq_cd()
                        rowdata = _vte_ring_index_writable (m_screen->row_data, i);
                        g_assert(rowdata != NULL);
                } else {
-                       rowdata = _vte_terminal_ring_append(m_terminal, FALSE);
+                       rowdata = ring_append(false);
                }
                /* Pad out the row. */
                 if (m_fill_defaults.attr.back != VTE_DEFAULT_BG) {
@@ -1841,8 +1841,8 @@ VteTerminalPrivate::seq_reverse_index()
         if (m_screen->cursor.row == start) {
                /* If we're at the top of the scrolling region, add a
                 * line at the top to scroll the bottom off. */
-               _vte_terminal_ring_remove(m_terminal, end);
-               _vte_terminal_ring_insert(m_terminal, start, TRUE);
+               ring_remove(end);
+               ring_insert(start, true);
                /* Update the display. */
                scroll_region(start, end - start + 1, 1);
                 invalidate_cells(0, m_column_count,
@@ -2738,8 +2738,8 @@ VteTerminalPrivate::seq_insert_lines(vte::grid::row_t param)
        for (i = 0; i < param; i++) {
                /* Clear a line off the end of the region and add one to the
                 * top of the region. */
-                _vte_terminal_ring_remove(m_terminal, end);
-                _vte_terminal_ring_insert(m_terminal, row, TRUE);
+                ring_remove(end);
+                ring_insert(row, true);
        }
         m_screen->cursor.col = 0;
        /* Update the display. */
@@ -2790,8 +2790,8 @@ VteTerminalPrivate::seq_delete_lines(vte::grid::row_t param)
        for (i = 0; i < param; i++) {
                /* Insert a line at the end of the region and remove one from
                 * the top of the region. */
-                _vte_terminal_ring_remove(m_terminal, row);
-                _vte_terminal_ring_insert(m_terminal, end, TRUE);
+                ring_remove(row);
+                ring_insert(end, true);
        }
         m_screen->cursor.col = 0;
        /* Update the display. */
@@ -2964,7 +2964,7 @@ VteTerminalPrivate::seq_screen_alignment_test()
             row++) {
                /* Find this row. */
                 while (_vte_ring_next(m_screen->row_data) <= row)
-                        _vte_terminal_ring_append(m_terminal, FALSE);
+                        ring_append(false);
                 adjust_adjustments();
                 auto rowdata = _vte_ring_index_writable (screen->row_data, row);
                g_assert(rowdata != NULL);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]