[vte/wip/sixels: 106/111] widget: Rename API to vte_terminal_[sg]et_sixel_enabled
- From: Christian Persch <chpe src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [vte/wip/sixels: 106/111] widget: Rename API to vte_terminal_[sg]et_sixel_enabled
- Date: Sat, 8 Aug 2020 18:43:03 +0000 (UTC)
commit 35fd6ad0e44a1e000e87015d551cfe25df4cdf82
Author: Christian Persch <chpe src gnome org>
Date: Sat Aug 8 20:42:49 2020 +0200
widget: Rename API to vte_terminal_[sg]et_sixel_enabled
doc/reference/vte-sections.txt | 4 ++--
src/vte.cc | 11 -----------
src/vte/vteterminal.h | 8 ++++----
src/vtedefines.hh | 2 ++
src/vtegtk.cc | 34 ++++++++++++++++------------------
src/vtegtk.hh | 2 +-
src/vteinternal.hh | 12 +++++++++++-
src/vteseq.cc | 2 +-
src/widget.hh | 3 +++
9 files changed, 40 insertions(+), 38 deletions(-)
---
diff --git a/doc/reference/vte-sections.txt b/doc/reference/vte-sections.txt
index 44aaeb25..c402b447 100644
--- a/doc/reference/vte-sections.txt
+++ b/doc/reference/vte-sections.txt
@@ -82,8 +82,8 @@ vte_terminal_set_word_char_exceptions
vte_terminal_get_word_char_exceptions
vte_terminal_set_input_enabled
vte_terminal_get_input_enabled
-vte_terminal_get_images_enabled
-vte_terminal_set_images_enabled
+vte_terminal_get_sixel_enabled
+vte_terminal_set_sixel_enabled
vte_terminal_write_contents_sync
vte_terminal_search_find_next
vte_terminal_search_find_previous
diff --git a/src/vte.cc b/src/vte.cc
index e9b6b05c..54ff872b 100644
--- a/src/vte.cc
+++ b/src/vte.cc
@@ -7552,14 +7552,6 @@ Terminal::screen_set_size(VteScreen *screen_,
screen_->scroll_delta = new_scroll_delta;
}
-bool
-Terminal::set_images_enabled(bool enabled)
-{
- m_images_enabled = enabled;
-
- return true;
-}
-
void
Terminal::set_size(long columns,
long rows)
@@ -7725,9 +7717,6 @@ Terminal::Terminal(vte::platform::Widget* w,
m_overline_position = 1;
m_regex_underline_position = 1;
- /* Images */
- m_images_enabled = TRUE;
-
reset_default_attributes(true);
/* Set up the desired palette. */
diff --git a/src/vte/vteterminal.h b/src/vte/vteterminal.h
index e49c0359..c7387d3d 100644
--- a/src/vte/vteterminal.h
+++ b/src/vte/vteterminal.h
@@ -505,13 +505,13 @@ gboolean vte_terminal_write_contents_sync (VteTerminal *terminal,
/* Images */
-/* Set or get whether inline image support is enabled */
+/* Set or get whether SIXEL image support is enabled */
_VTE_PUBLIC
-void vte_terminal_set_images_enabled(VteTerminal *terminal,
- gboolean enabled) _VTE_CXX_NOEXCEPT _VTE_GNUC_NONNULL(1);
+void vte_terminal_set_sixel_enabled(VteTerminal *terminal,
+ gboolean enabled) _VTE_CXX_NOEXCEPT _VTE_GNUC_NONNULL(1);
_VTE_PUBLIC
-gboolean vte_terminal_get_images_enabled(VteTerminal *terminal) _VTE_CXX_NOEXCEPT _VTE_GNUC_NONNULL(1);
+gboolean vte_terminal_get_sixel_enabled(VteTerminal *terminal) _VTE_CXX_NOEXCEPT _VTE_GNUC_NONNULL(1);
G_DEFINE_AUTOPTR_CLEANUP_FUNC(VteTerminal, g_object_unref)
diff --git a/src/vtedefines.hh b/src/vtedefines.hh
index 8aa4d9dc..2de3a626 100644
--- a/src/vtedefines.hh
+++ b/src/vtedefines.hh
@@ -143,3 +143,5 @@
#define VTE_VERSION_NUMERIC ((VTE_MAJOR_VERSION) * 10000 + (VTE_MINOR_VERSION) * 100 + (VTE_MICRO_VERSION))
#define VTE_TERMINFO_NAME "xterm-256color"
+
+#define VTE_SIXEL_ENABLED_DEFAULT false
diff --git a/src/vtegtk.cc b/src/vtegtk.cc
index ee8b8f3d..34cf2b72 100644
--- a/src/vtegtk.cc
+++ b/src/vtegtk.cc
@@ -1911,13 +1911,13 @@ vte_terminal_class_init(VteTerminalClass *klass)
(GParamFlags) (G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS |
G_PARAM_EXPLICIT_NOTIFY));
/**
- * VteTerminal:images-enabled:
+ * VteTerminal:sixel-enabled:
*
- * Controls whether inline image support is enabled.
+ * Controls whether SIXEL image support is enabled.
*/
- pspecs[PROP_IMAGES_ENABLED] =
- g_param_spec_boolean ("images-enabled", NULL, NULL,
- TRUE,
+ pspecs[PROP_SIXEL_ENABLED] =
+ g_param_spec_boolean ("sixel-enabled", NULL, NULL,
+ VTE_SIXEL_ENABLED_DEFAULT,
(GParamFlags) (G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS |
G_PARAM_EXPLICIT_NOTIFY));
@@ -5571,23 +5571,23 @@ catch (...)
}
/**
- * vte_terminal_set_images_enabled:
+ * vte_terminal_set_sixel_enabled:
* @terminal: a #VteTerminal
- * @enabled: %TRUE to enable images, %FALSE otherwise.
+ * @enabled: whether to enable SIXEL images
*
- * Set whether to enable inline images, e.g. SIXELs.
+ * Set whether to enable SIXEL images.
*
* Since: 0.62
*/
void
-vte_terminal_set_images_enabled(VteTerminal *terminal,
- gboolean enabled) noexcept
+vte_terminal_set_sixel_enabled(VteTerminal *terminal,
+ gboolean enabled) noexcept
try
{
g_return_if_fail(VTE_IS_TERMINAL(terminal));
- if (IMPL(terminal)->set_images_enabled(enabled))
- g_object_notify_by_pspec(G_OBJECT(terminal), pspecs[PROP_IMAGES_ENABLED]);
+ if (WIDGET(terminal)->set_sixel_enabled(enabled))
+ g_object_notify_by_pspec(G_OBJECT(terminal), pspecs[PROP_SIXEL_ENABLED]);
}
catch (...)
{
@@ -5595,22 +5595,20 @@ catch (...)
}
/**
- * vte_terminal_get_images_enabled:
+ * vte_terminal_get_sixel_enabled:
* @terminal: a #VteTerminal
*
- * Get whether to enable inline images, e.g. SIXELs.
- *
- * Returns: %TRUE if image support is enabled, %FALSE otherwise.
+ * Returns: %TRUE if SIXEL image support is enabled, %FALSE otherwise
*
* Since: 0.62
*/
gboolean
-vte_terminal_get_images_enabled(VteTerminal *terminal) noexcept
+vte_terminal_get_sixel_enabled(VteTerminal *terminal) noexcept
try
{
g_return_val_if_fail(VTE_IS_TERMINAL(terminal), FALSE);
- return IMPL(terminal)->m_images_enabled;
+ return WIDGET(terminal)->sixel_enabled();
}
catch (...)
{
diff --git a/src/vtegtk.hh b/src/vtegtk.hh
index 09eb90df..82aad3e0 100644
--- a/src/vtegtk.hh
+++ b/src/vtegtk.hh
@@ -90,10 +90,10 @@ enum {
PROP_SCROLLBACK_LINES,
PROP_SCROLL_ON_KEYSTROKE,
PROP_SCROLL_ON_OUTPUT,
+ PROP_SIXEL_ENABLED,
PROP_TEXT_BLINK_MODE,
PROP_WINDOW_TITLE,
PROP_WORD_CHAR_EXCEPTIONS,
- PROP_IMAGES_ENABLED,
LAST_PROP,
/* override properties */
diff --git a/src/vteinternal.hh b/src/vteinternal.hh
index fe2e5e14..7ee44008 100644
--- a/src/vteinternal.hh
+++ b/src/vteinternal.hh
@@ -754,9 +754,19 @@ public:
"mouse-autoscroll-timer"};
/* Inline images */
- gboolean m_images_enabled;
+ bool m_sixel_enabled{VTE_SIXEL_ENABLED_DEFAULT};
+ bool m_images_enabled{VTE_SIXEL_ENABLED_DEFAULT};
sixel_state_t m_sixel_state;
+ bool set_sixel_enabled(bool enabled) noexcept
+ {
+ auto const changed = m_sixel_enabled != enabled;
+ m_sixel_enabled = m_images_enabled = enabled;
+ return changed;
+ }
+
+ constexpr bool sixel_enabled() const noexcept { return m_sixel_enabled; }
+
/* State variables for handling match checks. */
int m_match_regex_next_tag{0};
auto regex_match_next_tag() noexcept { return m_match_regex_next_tag++; }
diff --git a/src/vteseq.cc b/src/vteseq.cc
index 82a0ee04..99edfb66 100644
--- a/src/vteseq.cc
+++ b/src/vteseq.cc
@@ -4337,7 +4337,7 @@ Terminal::DECSIXEL(vte::parser::Sequence const& seq)
* References: VT330
*/
- if (!m_images_enabled)
+ if (!m_sixel_enabled)
return;
unsigned char *pixels = NULL;
diff --git a/src/widget.hh b/src/widget.hh
index 0025d5bb..d870135c 100644
--- a/src/widget.hh
+++ b/src/widget.hh
@@ -177,6 +177,9 @@ public:
bool should_emit_signal(int id) noexcept;
+ bool set_sixel_enabled(bool enabled) noexcept { return m_terminal->set_sixel_enabled(enabled); }
+ bool sixel_enabled() const noexcept { return m_terminal->sixel_enabled(); }
+
protected:
enum class CursorType {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]