[vte] widget: Move some public API to its own file



commit fcbf96505dc472b277b5d7984bea368fffd876f2
Author: Christian Persch <chpe gnome org>
Date:   Wed Nov 18 21:15:46 2015 +0100

    widget: Move some public API to its own file

 src/vte.cc         |   36 +++++++-----------------------------
 src/vtegtk.cc      |   35 +++++++++++++++++++++++++++++++++++
 src/vteinternal.hh |    1 +
 3 files changed, 43 insertions(+), 29 deletions(-)
---
diff --git a/src/vte.cc b/src/vte.cc
index 016da55..f1556c8 100644
--- a/src/vte.cc
+++ b/src/vte.cc
@@ -2473,38 +2473,16 @@ VteTerminalPrivate::set_encoding(char const* codeset)
         return true;
 }
 
-/**
- * vte_terminal_set_cjk_ambiguous_width:
- * @terminal: a #VteTerminal
- * @width: either 1 (narrow) or 2 (wide)
- *
- * This setting controls whether ambiguous-width characters are narrow or wide
- * when using the UTF-8 encoding (vte_terminal_set_encoding()). In all other encodings,
- * the width of ambiguous-width characters is fixed.
- */
-void
-vte_terminal_set_cjk_ambiguous_width(VteTerminal *terminal, int width)
+bool
+VteTerminalPrivate::set_cjk_ambiguous_width(int width)
 {
-        g_return_if_fail(VTE_IS_TERMINAL(terminal));
-        g_return_if_fail(width == 1 || width == 2);
+        g_assert(width == 1 || width == 2);
 
-        terminal->pvt->utf8_ambiguous_width = width;
-}
+        if (m_utf8_ambiguous_width == width)
+                return false;
 
-/**
- * vte_terminal_get_cjk_ambiguous_width:
- * @terminal: a #VteTerminal
- *
- * Returns whether ambiguous-width characters are narrow or wide when using
- * the UTF-8 encoding (vte_terminal_set_encoding()).
- *
- * Returns: 1 if ambiguous-width characters are narrow, or 2 if they are wide
- */
-int
-vte_terminal_get_cjk_ambiguous_width(VteTerminal *terminal)
-{
-        g_return_val_if_fail(VTE_IS_TERMINAL(terminal), 1);
-        return terminal->pvt->utf8_ambiguous_width;
+        m_utf8_ambiguous_width = width;
+        return true;
 }
 
 static inline VteRowData *
diff --git a/src/vtegtk.cc b/src/vtegtk.cc
index c6f1386..2d48ce8 100644
--- a/src/vtegtk.cc
+++ b/src/vtegtk.cc
@@ -2317,6 +2317,41 @@ vte_terminal_get_char_width(VteTerminal *terminal)
 }
 
 /**
+ * vte_terminal_get_cjk_ambiguous_width:
+ * @terminal: a #VteTerminal
+ *
+ * Returns whether ambiguous-width characters are narrow or wide when using
+ * the UTF-8 encoding (vte_terminal_set_encoding()).
+ *
+ * Returns: 1 if ambiguous-width characters are narrow, or 2 if they are wide
+ */
+int
+vte_terminal_get_cjk_ambiguous_width(VteTerminal *terminal)
+{
+        g_return_val_if_fail(VTE_IS_TERMINAL(terminal), 1);
+        return terminal->pvt->utf8_ambiguous_width;
+}
+
+/**
+ * vte_terminal_set_cjk_ambiguous_width:
+ * @terminal: a #VteTerminal
+ * @width: either 1 (narrow) or 2 (wide)
+ *
+ * This setting controls whether ambiguous-width characters are narrow or wide
+ * when using the UTF-8 encoding (vte_terminal_set_encoding()). In all other encodings,
+ * the width of ambiguous-width characters is fixed.
+ */
+void
+vte_terminal_set_cjk_ambiguous_width(VteTerminal *terminal, int width)
+{
+        g_return_if_fail(VTE_IS_TERMINAL(terminal));
+        g_return_if_fail(width == 1 || width == 2);
+
+        if (terminal->pvt->set_cjk_ambiguous_width(width))
+                g_object_notify_by_pspec(G_OBJECT(terminal), pspecs[PROP_CJK_AMBIGUOUS_WIDTH]);
+}
+
+/**
  * vte_terminal_get_column_count:
  * @terminal: a #VteTerminal
  *
diff --git a/src/vteinternal.hh b/src/vteinternal.hh
index 37579ec..414b809 100644
--- a/src/vteinternal.hh
+++ b/src/vteinternal.hh
@@ -643,6 +643,7 @@ public:
         bool set_audible_bell(bool setting);
         bool set_allow_bold(bool setting);
         bool set_backspace_binding(VteEraseBinding binding);
+        bool set_cjk_ambiguous_width(int width);
         bool set_cursor_blink_mode(VteCursorBlinkMode mode);
         bool set_cursor_shape(VteCursorShape shape);
         bool set_delete_binding(VteEraseBinding binding);


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