[vte] terminal: Move some initialisations to the class



commit 7467cba7a396b9105fc441800b86c7b17f3a7405
Author: Christian Persch <chpe src gnome org>
Date:   Mon Nov 18 22:42:22 2019 +0100

    terminal: Move some initialisations to the class

 src/vte.cc         | 20 +-------------------
 src/vtegtk.hh      |  2 --
 src/vteinternal.hh | 26 +++++++++++++-------------
 3 files changed, 14 insertions(+), 34 deletions(-)
---
diff --git a/src/vte.cc b/src/vte.cc
index 17aec2e6..d7dd796e 100644
--- a/src/vte.cc
+++ b/src/vte.cc
@@ -7878,12 +7878,7 @@ Terminal::Terminal(vte::platform::Widget* w,
                m_palette[i].sources[VTE_COLOR_SOURCE_ESCAPE].is_set = FALSE;
 
        /* Set up I/O encodings. */
-        m_utf8_ambiguous_width = VTE_DEFAULT_UTF8_AMBIGUOUS_WIDTH;
-       m_max_input_bytes = VTE_MAX_INPUT_READ;
-       m_cursor_blink_tag = 0;
-        m_text_blink_tag = 0;
        m_outgoing = _vte_byte_array_new();
-        m_last_graphic_character = 0;
 
        /* Setting the terminal type and size requires the PTY master to
         * be set up properly first. */
@@ -7891,7 +7886,7 @@ Terminal::Terminal(vte::platform::Widget* w,
 
        /* Scrolling options. */
        m_scroll_on_keystroke = TRUE;
-        m_scrollback_lines = -1; /* force update in vte_terminal_set_scrollback_lines */
+        /* Default is -1, forces update in vte_terminal_set_scrollback_lines */
        set_scrollback_lines(VTE_SCROLLBACK_INIT);
 
        /* Selection info. */
@@ -7914,10 +7909,8 @@ Terminal::Terminal(vte::platform::Widget* w,
 
        /* Cursor shape. */
        m_cursor_shape = VTE_CURSOR_SHAPE_BLOCK;
-        m_cursor_aspect_ratio = 0.04;
 
        /* Cursor blinking. */
-       m_cursor_blink_timeout = 500;
         m_cursor_blinks = FALSE;
         m_cursor_blink_mode = VTE_CURSOR_BLINK_SYSTEM;
 
@@ -7936,9 +7929,6 @@ Terminal::Terminal(vte::platform::Widget* w,
        /* Rendering data */
        m_draw = _vte_draw_new();
 
-       /* Set up background information. */
-        m_background_alpha = 1.;
-
         /* Word chars */
         set_word_char_exceptions(WORD_CHAR_EXCEPTIONS_DEFAULT);
 
@@ -7946,19 +7936,11 @@ Terminal::Terminal(vte::platform::Widget* w,
        m_selection_block_mode = FALSE;
         m_unscaled_font_desc = nullptr;
         m_fontdesc = nullptr;
-        m_font_scale = 1.;
-        m_cell_width_scale = 1.;
-        m_cell_height_scale = 1.;
        m_has_fonts = FALSE;
 
         /* Hyperlink */
         m_allow_hyperlink = FALSE;
-        m_hyperlink_auto_id = 0;
-
-        /* Mouse */
-        m_mouse_last_position = vte::view::coords(-1, -1);
 
-        m_padding = default_padding;
         update_view_extents();
 
 #ifdef VTE_DEBUG
diff --git a/src/vtegtk.hh b/src/vtegtk.hh
index e2515b34..ae9fb08c 100644
--- a/src/vtegtk.hh
+++ b/src/vtegtk.hh
@@ -102,5 +102,3 @@ enum {
         PROP_VSCROLL_POLICY
 };
 extern GParamSpec *pspecs[LAST_PROP];
-
-const GtkBorder default_padding = { 1, 1, 1, 1 };
diff --git a/src/vteinternal.hh b/src/vteinternal.hh
index 0251a564..123c348a 100644
--- a/src/vteinternal.hh
+++ b/src/vteinternal.hh
@@ -390,8 +390,8 @@ public:
 
         auto data_syntax() const noexcept { return m_data_syntax; }
 
-        int m_utf8_ambiguous_width;
-        gunichar m_last_graphic_character; /* for REP */
+        int m_utf8_ambiguous_width{VTE_DEFAULT_UTF8_AMBIGUOUS_WIDTH};
+        gunichar m_last_graphic_character{0}; /* for REP */
         /* Array of dirty rectangles in view coordinates; need to
          * add allocation origin and padding when passing to gtk.
          */
@@ -403,7 +403,7 @@ public:
         GList *m_active_terminals_link;
         // FIXMEchpe should these two be g[s]size ?
         size_t m_input_bytes;
-        glong m_max_input_bytes;
+        long m_max_input_bytes{VTE_MAX_INPUT_READ};
 
        /* Output data queue. */
         VteByteArray *m_outgoing; /* pending input characters */
@@ -479,7 +479,7 @@ public:
        /* Scrolling options. */
         gboolean m_scroll_on_output;
         gboolean m_scroll_on_keystroke;
-        vte::grid::row_t m_scrollback_lines;
+        vte::grid::row_t m_scrollback_lines{0};
 
         /* Restricted scrolling */
         struct vte_scrolling_region m_scrolling_region;     /* the region we scroll in */
@@ -487,14 +487,14 @@ public:
 
        /* Cursor shape, as set via API */
         VteCursorShape m_cursor_shape;
-        double m_cursor_aspect_ratio;
+        double m_cursor_aspect_ratio{0.04};
 
        /* Cursor blinking, as set in dconf. */
         VteCursorBlinkMode m_cursor_blink_mode;
         gboolean m_cursor_blink_state;
-        guint m_cursor_blink_tag;           /* cursor blinking timeout ID */
+        guint m_cursor_blink_tag{0};           /* cursor blinking timeout ID */
         gint m_cursor_blink_cycle;          /* gtk-cursor-blink-time / 2 */
-        gint m_cursor_blink_timeout;        /* gtk-cursor-blink-timeout */
+        int m_cursor_blink_timeout{500};        /* gtk-cursor-blink-timeout */
         gboolean m_cursor_blinks;           /* whether the cursor is actually blinking */
         gint64 m_cursor_blink_time;         /* how long the cursor has been blinking yet */
         gboolean m_has_focus;               /* is the terminal window focused */
@@ -504,7 +504,7 @@ public:
         gint m_text_blink_cycle;  /* gtk-cursor-blink-time / 2 */
         bool m_text_blink_state;  /* whether blinking text should be visible at this very moment */
         bool m_text_to_blink;     /* drawing signals here if it encounters any cell with blink attribute */
-        guint m_text_blink_tag;   /* timeout ID for redrawing due to blinking */
+        guint m_text_blink_tag{0};   /* timeout ID for redrawing due to blinking */
 
         /* DECSCUSR cursor style (shape and blinking possibly overridden
          * via escape sequence) */
@@ -521,7 +521,7 @@ public:
          * this in grid coordinates because we want also to check if they were outside
          * the viewable area, and also want to catch in-cell movements if they make the pointer visible.
          */
-        vte::view::coords m_mouse_last_position;
+        vte::view::coords m_mouse_last_position{-1, -1};
         guint m_mouse_autoscroll_tag;
         double m_mouse_smooth_scroll_delta{0.0};
 
@@ -618,7 +618,7 @@ public:
         * resources and which can be kept after unrealizing. */
         PangoFontDescription *m_unscaled_font_desc;
         PangoFontDescription *m_fontdesc;
-        gdouble m_font_scale;
+        double m_font_scale{1.};
         gboolean m_fontdirty;
 
         /* First, the dimensions of ASCII characters are measured. The result
@@ -702,7 +702,7 @@ public:
         std::vector<std::string> m_window_title_stack{};
 
        /* Background */
-        double m_background_alpha;
+        double m_background_alpha{1.};
 
         /* Bell */
         int64_t m_bell_timestamp;
@@ -728,7 +728,7 @@ public:
         double m_undercurl_thickness{VTE_LINE_WIDTH};
 
         /* Style stuff */
-        GtkBorder m_padding;
+        GtkBorder m_padding{1, 1, 1, 1};
 
         vte::glib::RefPtr<GtkAdjustment> m_vadjustment{};
         auto vadjustment() noexcept { return m_vadjustment.get(); }
@@ -737,7 +737,7 @@ public:
         gboolean m_allow_hyperlink;
         vte::base::Ring::hyperlink_idx_t m_hyperlink_hover_idx;
         const char *m_hyperlink_hover_uri; /* data is owned by the ring */
-        long m_hyperlink_auto_id;
+        long m_hyperlink_auto_id{0};
 
         /* RingView and friends */
         vte::base::RingView m_ringview;


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