[vte/wip/sixels: 88/111] terminal: Expose inline image support, not sixel support specifically




commit d04bac33fa8d5280a6090109d1df9c89a60595ec
Author: Hans Petter Jansson <hpj cl no>
Date:   Sat Aug 8 20:42:49 2020 +0200

    terminal: Expose inline image support, not sixel support specifically

 src/vte.cc            |  8 ++++----
 src/vte/vteterminal.h |  8 ++++----
 src/vtegtk.cc         | 30 +++++++++++++++---------------
 src/vtegtk.hh         |  2 +-
 src/vteinternal.hh    |  7 ++++---
 src/vteseq.cc         |  2 +-
 6 files changed, 29 insertions(+), 28 deletions(-)
---
diff --git a/src/vte.cc b/src/vte.cc
index 9c38e440..ff7e3ba4 100644
--- a/src/vte.cc
+++ b/src/vte.cc
@@ -7561,9 +7561,9 @@ Terminal::screen_set_size(VteScreen *screen_,
 }
 
 bool
-Terminal::set_sixel_enabled(bool enabled)
+Terminal::set_images_enabled(bool enabled)
 {
-        m_sixel_enabled = enabled;
+        m_images_enabled = enabled;
 
         return true;
 }
@@ -7735,7 +7735,7 @@ Terminal::Terminal(vte::platform::Widget* w,
 
         /* Image */
         m_frozen_image_limit = VTE_DEFAULT_FROZEN_IMAGE_LIMIT;
-        m_sixel_enabled = TRUE;
+        m_images_enabled = TRUE;
 
         reset_default_attributes(true);
 
@@ -9254,7 +9254,7 @@ Terminal::widget_draw(cairo_t *cr)
 
        /* Draw images */
 
-       if (m_sixel_enabled) {
+       if (m_images_enabled) {
                vte::grid::row_t top_row = first_displayed_row();
                vte::grid::row_t bottom_row = last_displayed_row();
                auto image_map = ring->m_image_priority_map;
diff --git a/src/vte/vteterminal.h b/src/vte/vteterminal.h
index 5c414fb9..9bae740a 100644
--- a/src/vte/vteterminal.h
+++ b/src/vte/vteterminal.h
@@ -513,13 +513,13 @@ void vte_terminal_set_frozen_image_limit(VteTerminal *terminal,
 _VTE_PUBLIC
 gulong vte_terminal_get_frozen_image_limit(VteTerminal *terminal) _VTE_GNUC_NONNULL(1);
 
-/* Set or get whether the SIXEL graphics feature is enabled */
+/* Set or get whether inline image support is enabled */
 _VTE_PUBLIC
-void vte_terminal_set_sixel_enabled (VteTerminal *terminal,
-                                     gboolean enabled) _VTE_GNUC_NONNULL(1);
+void vte_terminal_set_images_enabled (VteTerminal *terminal,
+                                      gboolean enabled) _VTE_GNUC_NONNULL(1);
 
 _VTE_PUBLIC
-gboolean vte_terminal_get_sixel_enabled (VteTerminal *terminal) _VTE_GNUC_NONNULL(1);
+gboolean vte_terminal_get_images_enabled (VteTerminal *terminal) _VTE_GNUC_NONNULL(1);
 
 G_DEFINE_AUTOPTR_CLEANUP_FUNC(VteTerminal, g_object_unref)
 
diff --git a/src/vtegtk.cc b/src/vtegtk.cc
index f61667ed..38c787fa 100644
--- a/src/vtegtk.cc
+++ b/src/vtegtk.cc
@@ -1922,12 +1922,12 @@ vte_terminal_class_init(VteTerminalClass *klass)
                                       (GParamFlags) (G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS | 
G_PARAM_EXPLICIT_NOTIFY));
 
         /**
-         * VteTerminal:sixel-enabled:
+         * VteTerminal:images-enabled:
          *
-         * Controls whether the SIXEL graphics feature is enabled.
+         * Controls whether inline image support is enabled.
          */
-        pspecs[PROP_SIXEL_ENABLED] =
-                g_param_spec_boolean ("sixel-enabled", NULL, NULL,
+        pspecs[PROP_IMAGES_ENABLED] =
+                g_param_spec_boolean ("images-enabled", NULL, NULL,
                                       TRUE,
                                       (GParamFlags) (G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS | 
G_PARAM_EXPLICIT_NOTIFY));
 
@@ -5717,34 +5717,34 @@ vte_terminal_get_frozen_image_limit(VteTerminal *terminal)
 }
 
 /**
- * vte_terminal_set_sixel_enabled:
+ * vte_terminal_set_images_enabled:
  * @terminal: a #VteTerminal
- * @enabled: %TRUE enables SIXEL graphics feature.
+ * @enabled: %TRUE to enable images, %FALSE otherwise.
  *
- * Set whether to enable SIXEL graphics feature
+ * Set whether to enable inline images, e.g. sixels.
  */
 void
-vte_terminal_set_sixel_enabled(VteTerminal *terminal, gboolean enabled)
+vte_terminal_set_images_enabled(VteTerminal *terminal, gboolean enabled)
 {
         g_return_if_fail(VTE_IS_TERMINAL(terminal));
 
-        if (IMPL(terminal)->set_sixel_enabled(enabled))
-                g_object_notify_by_pspec(G_OBJECT(terminal), pspecs[PROP_SIXEL_ENABLED]);
+        if (IMPL(terminal)->set_images_enabled(enabled))
+                g_object_notify_by_pspec(G_OBJECT(terminal), pspecs[PROP_IMAGES_ENABLED]);
 }
 
 /**
- * vte_terminal_set_sixel_enabled:
+ * vte_terminal_get_images_enabled:
  * @terminal: a #VteTerminal
  *
- * Get whether the SIXEL graphics feature is enabled.
+ * Get whether to enable inline images, e.g. sixels.
  *
- * Returns: %TRUE if SIXEL graphics feature is enabled.
+ * Returns: %TRUE if image support is enabled, %FALSE otherwise.
  */
 
 gboolean
-vte_terminal_get_sixel_enabled(VteTerminal *terminal)
+vte_terminal_get_images_enabled(VteTerminal *terminal)
 {
         g_return_val_if_fail(VTE_IS_TERMINAL(terminal), FALSE);
 
-        return IMPL(terminal)->m_sixel_enabled;
+        return IMPL(terminal)->m_images_enabled;
 }
diff --git a/src/vtegtk.hh b/src/vtegtk.hh
index 68cd7f9e..4900f252 100644
--- a/src/vtegtk.hh
+++ b/src/vtegtk.hh
@@ -94,7 +94,7 @@ enum {
         PROP_TEXT_BLINK_MODE,
         PROP_WINDOW_TITLE,
         PROP_WORD_CHAR_EXCEPTIONS,
-        PROP_SIXEL_ENABLED,
+        PROP_IMAGES_ENABLED,
         LAST_PROP,
 
         /* override properties */
diff --git a/src/vteinternal.hh b/src/vteinternal.hh
index 4f8d01f0..687823ce 100644
--- a/src/vteinternal.hh
+++ b/src/vteinternal.hh
@@ -753,13 +753,14 @@ public:
                                                             this),
                                                   "mouse-autoscroll-timer"};
 
-        /* SIXEL feature */
+        /* Inline images */
+        gboolean m_images_enabled;
+
         gboolean m_sixel_display_mode;
         gboolean m_sixel_scrolls_right;
         gboolean m_sixel_use_private_register;
         sixel_state_t m_sixel_state;
         gulong m_frozen_image_limit;
-        gboolean m_sixel_enabled;
 
        /* State variables for handling match checks. */
         int m_match_regex_next_tag{0};
@@ -1519,7 +1520,7 @@ public:
         bool set_scrollback_lines(long lines);
         bool set_scroll_on_keystroke(bool scroll);
         bool set_scroll_on_output(bool scroll);
-        bool set_sixel_enabled(bool enabled);
+        bool set_images_enabled(bool enabled);
         bool set_word_char_exceptions(std::optional<std::string_view> stropt);
         void set_clear_background(bool setting);
 
diff --git a/src/vteseq.cc b/src/vteseq.cc
index 765d7295..51bb3732 100644
--- a/src/vteseq.cc
+++ b/src/vteseq.cc
@@ -4351,7 +4351,7 @@ Terminal::DECSIXEL(vte::parser::Sequence const& seq)
          * References: VT330
          */
 
-        if (!m_sixel_enabled)
+        if (!m_images_enabled)
                 return;
 
        unsigned char *pixels = NULL;


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