[vte/vte-0-70: 1/2] all: Remove SIXEL support from stable branch
- From: Christian Persch <chpe src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [vte/vte-0-70: 1/2] all: Remove SIXEL support from stable branch
- Date: Fri, 5 Aug 2022 19:23:29 +0000 (UTC)
commit d90b9d1139c3ce413670f34588506741673919bb
Author: Christian Persch <chpe src gnome org>
Date: Fri Aug 5 21:23:02 2022 +0200
all: Remove SIXEL support from stable branch
The SIXEL support is not in a releasable state with
important and fundamental problems still unsolved.
(cherry picked from commit d578bd30b18a0d040305f356a3327fbd011e5451)
(cherry picked from commit ba1e05c9ad34d0e48a823ad5a67b96baa166de24)
(cherry picked from commit 6d80d3bca78397b2073f61e7954f3ceb45a8cb37)
meson.build | 2 -
meson_options.txt | 7 -
src/app/app.cc | 6 -
src/debug.cc | 1 -
src/debug.h | 1 -
src/fwd.hh | 8 -
src/image.cc | 68 ---
src/image.hh | 102 ----
src/meson.build | 56 --
src/parser-cat.cc | 327 -----------
src/parser-seq.py | 2 +-
src/pty.cc | 4 -
src/ring.cc | 225 +------
src/ring.hh | 45 --
src/sixel-context.cc | 516 ----------------
src/sixel-context.hh | 663 ---------------------
src/sixel-fuzzer.cc | 763 ------------------------
src/sixel-parser.hh | 669 ---------------------
src/sixel-test.cc | 1597 --------------------------------------------------
src/vte.cc | 179 +-----
src/vtedefines.hh | 6 -
src/vtegtk.cc | 26 +-
src/vteinternal.hh | 38 --
src/vteseq.cc | 223 +------
src/widget.hh | 3 -
25 files changed, 19 insertions(+), 5518 deletions(-)
---
diff --git a/meson.build b/meson.build
index febc5b2a..1900504b 100644
--- a/meson.build
+++ b/meson.build
@@ -185,7 +185,6 @@ config_h.set('WITH_A11Y', get_option('a11y'))
config_h.set('WITH_FRIBIDI', get_option('fribidi'))
config_h.set('WITH_GNUTLS', get_option('gnutls'))
config_h.set('WITH_ICU', get_option('icu'))
-config_h.set('WITH_SIXEL', get_option('sixel'))
ver = glib_min_req_version.split('.')
config_h.set('GLIB_VERSION_MIN_REQUIRED', '(G_ENCODE_VERSION(' + ver[0] + ',' + ver[1] + '))')
@@ -724,7 +723,6 @@ output += ' GTK+ 4.0: ' + get_option('gtk4').to_string() + '\n'
output += ' ICU: ' + get_option('icu').to_string() + '\n'
output += ' GIR: ' + get_option('gir').to_string() + '\n'
output += ' systemd: ' + systemd_dep.found().to_string() + '\n'
-output += ' SIXEL: ' + get_option('sixel').to_string() + '\n'
output += ' Glade: ' + get_option('glade').to_string() + '\n'
output += ' Vala: ' + get_option('vapi').to_string() + '\n'
output += '\n'
diff --git a/meson_options.txt b/meson_options.txt
index 72c3de5e..0e259910 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -92,13 +92,6 @@ option(
description: 'Enable legacy charset support using ICU',
)
-option(
- 'sixel',
- type: 'boolean',
- value: false,
- description: 'Enable SIXEL support',
-)
-
option(
'_systemd',
type: 'boolean',
diff --git a/src/app/app.cc b/src/app/app.cc
index 9d53f274..90d958bd 100644
--- a/src/app/app.cc
+++ b/src/app/app.cc
@@ -73,7 +73,6 @@ public:
gboolean no_scrollbar{false};
gboolean no_shaping{false};
gboolean no_shell{false};
- gboolean no_sixel{false};
gboolean no_systemd_scope{false};
gboolean no_xfill{false};
gboolean no_yfill{false};
@@ -635,8 +634,6 @@ public:
"Disable Arabic shaping", nullptr },
{ "no-shell", 'S', 0, G_OPTION_ARG_NONE, &no_shell,
"Disable spawning a shell inside the terminal", nullptr },
- { "no-sixel", 0, 0, G_OPTION_ARG_NONE, &no_sixel,
- "Disable SIXEL images", nullptr },
{ "no-systemd-scope", 0, 0, G_OPTION_ARG_NONE, &no_systemd_scope,
"Don't use systemd user scope", nullptr },
{ "object-notifications", 'N', 0, G_OPTION_ARG_NONE, &object_notifications,
@@ -651,8 +648,6 @@ public:
"Use pixels as scroll unit", nullptr },
{ "scrollback-lines", 'n', 0, G_OPTION_ARG_INT, &scrollback_lines,
"Specify the number of scrollback-lines (-1 for infinite)", nullptr },
- { "sixel", 0, G_OPTION_FLAG_REVERSE, G_OPTION_ARG_NONE, &no_sixel,
- "Enable SIXEL images", nullptr },
{ "title", 0, 0, G_OPTION_ARG_STRING, &title, "Set the initial title of the window",
"TITLE" },
{ "transparent", 'T', 0, G_OPTION_ARG_INT, &transparency_percent,
"Enable the use of a transparent background", "0..100" },
@@ -2570,7 +2565,6 @@ vteapp_window_constructed(GObject *object)
vte_terminal_set_cursor_shape(window->terminal, options.cursor_shape);
vte_terminal_set_enable_bidi(window->terminal, !options.no_bidi);
vte_terminal_set_enable_shaping(window->terminal, !options.no_shaping);
- vte_terminal_set_enable_sixel(window->terminal, !options.no_sixel);
vte_terminal_set_enable_fallback_scrolling(window->terminal, !options.no_fallback_scrolling);
vte_terminal_set_mouse_autohide(window->terminal, true);
vte_terminal_set_rewrap_on_resize(window->terminal, !options.no_rewrap);
diff --git a/src/debug.cc b/src/debug.cc
index 4185a57a..cda5d47b 100644
--- a/src/debug.cc
+++ b/src/debug.cc
@@ -60,7 +60,6 @@ _vte_debug_init(void)
{ "bidi", VTE_DEBUG_BIDI },
{ "conversion", VTE_DEBUG_CONVERSION },
{ "exceptions", VTE_DEBUG_EXCEPTIONS },
- { "image", VTE_DEBUG_IMAGE },
};
_vte_debug_flags = g_parse_debug_string (g_getenv("VTE_DEBUG"),
diff --git a/src/debug.h b/src/debug.h
index da1d51d8..11429645 100644
--- a/src/debug.h
+++ b/src/debug.h
@@ -67,7 +67,6 @@ typedef enum : unsigned {
VTE_DEBUG_BIDI = 1u << 28,
VTE_DEBUG_CONVERSION = 1u << 29,
VTE_DEBUG_EXCEPTIONS = 1u << 30,
- VTE_DEBUG_IMAGE = 1u << 31,
} VteDebugFlags;
void _vte_debug_init(void);
diff --git a/src/fwd.hh b/src/fwd.hh
index 58e2208b..b6b2e1f7 100644
--- a/src/fwd.hh
+++ b/src/fwd.hh
@@ -36,14 +36,6 @@ class Widget;
} // namespace platform
-namespace sixel {
-
-class Context;
-class Parser;
-class Sequence;
-
-} // namespace sixel
-
namespace view {
class FontInfo;
diff --git a/src/meson.build b/src/meson.build
index 9253a4a5..b13c8ec8 100644
--- a/src/meson.build
+++ b/src/meson.build
@@ -135,20 +135,6 @@ regex_sources = files(
'regex.hh'
)
-sixel_parser_sources = files(
- 'sixel-parser.hh',
-)
-
-sixel_context_sources = files(
- 'sixel-context.cc',
- 'sixel-context.hh',
-)
-
-sixel_sources = sixel_parser_sources + sixel_context_sources + files(
- 'image.cc',
- 'image.hh',
-)
-
std_glue_sources = files(
'std-glue.hh',
)
@@ -232,10 +218,6 @@ if get_option('icu')
libvte_common_sources += icu_sources
endif
-if get_option('sixel')
- libvte_common_sources += sixel_sources
-endif
-
if systemd_dep.found()
libvte_common_sources += systemd_sources
endif
@@ -405,10 +387,6 @@ parser_cat_sources = config_sources + glib_glue_sources + libc_glue_sources + pa
'vtedefines.hh',
)
-if get_option('sixel')
- parser_cat_sources += sixel_parser_sources
-endif
-
parser_cat = executable(
'parser-cat',
parser_cat_sources,
@@ -589,34 +567,6 @@ test_refptr = executable(
install: false,
)
-if get_option('sixel')
- fuzz_sixel_sources = config_sources + files(
- 'sixel-fuzzer.cc',
- )
-
- fuzz_sixel = executable(
- 'fuzz-sixel',
- sources: fuzz_sixel_sources,
- dependencies: [glib_dep,],
- include_directories: top_inc,
- install: false,
- )
-
- test_sixel_sources = config_sources + debug_sources + glib_glue_sources + sixel_parser_sources +
sixel_context_sources + files(
- 'cairo-glue.hh',
- 'sixel-test.cc',
- 'vtedefines.hh',
- )
-
- test_sixel = executable(
- 'test-sixel',
- sources: test_sixel_sources,
- dependencies: [glib_dep,],
- include_directories: top_inc,
- install: false,
- )
-endif
-
test_stream_sources = config_sources + files(
'vtestream-base.h',
'vtestream-file.h',
@@ -698,12 +648,6 @@ if get_option('gtk3')
]
endif
-if get_option('sixel')
- test_units += [
- ['sixel', test_sixel],
- ]
-endif
-
foreach test: test_units
test(
test[0],
diff --git a/src/parser-cat.cc b/src/parser-cat.cc
index 5fade9db..afb6fb1a 100644
--- a/src/parser-cat.cc
+++ b/src/parser-cat.cc
@@ -40,10 +40,6 @@
#include "utf8.hh"
#include "vtedefines.hh"
-#ifdef WITH_SIXEL
-#include "sixel-parser.hh"
-#endif
-
enum {
#define _VTE_SGR(...)
#define _VTE_NGR(name, value) VTE_SGR_##name = value,
@@ -58,9 +54,6 @@ enum class DataSyntax {
ECMA48_UTF8,
/* ECMA48_PCTERM, */
/* ECMA48_ECMA35, */
- #ifdef WITH_SIXEL
- DECSIXEL,
- #endif
};
char*
@@ -154,9 +147,6 @@ private:
std::string m_str;
bool m_plain;
bool m_codepoints;
-#ifdef WITH_SIXEL
- char32_t m_sixel_st;
-#endif
inline constexpr bool plain() const noexcept { return m_plain; }
@@ -389,48 +379,6 @@ private:
}
}
-#ifdef WITH_SIXEL
-
- void
- print_params(vte::sixel::Sequence const& seq) noexcept
- {
- auto const size = seq.size();
- if (size > 0)
- m_str.push_back(' ');
-
- for (unsigned int i = 0; i < size; i++) {
- if (!seq.param_default(i))
- print_format("%d", seq.param(i));
- if (i + 1 < size)
- m_str.push_back(';');
- }
- }
-
- void
- print_seq(vte::sixel::Sequence const& seq) noexcept
- {
- ReverseAttr attr(this);
- GreenAttr green(this);
-
- m_str.push_back('{');
- switch (seq.command()) {
- case vte::sixel::Command::DECGRI: m_str.append("DECGRI"); break;
- case vte::sixel::Command::DECGRA: m_str.append("DECGRA"); break;
- case vte::sixel::Command::DECGCI: m_str.append("DECGCI"); break;
- case vte::sixel::Command::DECGCR: m_str.append("DECGCR"); break;
- case vte::sixel::Command::DECGNL: m_str.append("DECGNL"); break;
- default:
- print_format("%d/%d",
- int(seq.command()) / 16,
- int(seq.command()) % 16);
- break;
- }
- print_params(seq);
- m_str.push_back('}');
- }
-
-#endif /* WITH_SIXEL */
-
void
printout() noexcept
{
@@ -463,45 +411,9 @@ public:
printout();
}
-#ifdef WITH_SIXEL
-
- void SIXEL_CMD(vte::sixel::Sequence const& seq) noexcept
- {
- print_seq(seq);
-
- switch (seq.command()) {
- case vte::sixel::Command::DECGCR:
- case vte::sixel::Command::DECGNL:
- printout();
- break;
- default:
- break;
- }
- }
-
- void SIXEL(uint8_t sixel) noexcept
- {
- print_format("%c", sixel + 0x3f);
- }
-
- void SIXEL_ST(char32_t st) noexcept
- {
- m_sixel_st = st;
- }
-
-#endif /* WITH_SIXEL */
-
void enter_data_syntax(DataSyntax syntax) noexcept
{
switch (syntax) {
-#ifdef WITH_SIXEL
- case DataSyntax::DECSIXEL: {
- GreenAttr green(this);
- print_literal("<SIXEL[");
- m_sixel_st = 0;
- break;
- }
-#endif
default:
break;
}
@@ -511,17 +423,6 @@ public:
bool success) noexcept
{
switch (syntax) {
-#ifdef WITH_SIXEL
- case DataSyntax::DECSIXEL:
- if (success) {
- GreenAttr green(this);
- print_literal("]ST>");
- } else {
- RedAttr green(this);
- print_literal("]>");
- }
- break;
-#endif
default:
break;
}
@@ -718,13 +619,6 @@ private:
}
}
-#ifdef WITH_SIXEL
- char32_t m_sixel_st{0};
- bool m_seen_sixel_commands{false};
- bool m_seen_sixel_data{false};
- std::bitset<VTE_SIXEL_NUM_COLOR_REGISTERS> m_sixel_color_set;
-#endif
-
public:
Linter() noexcept = default;
~Linter() noexcept = default;
@@ -753,22 +647,6 @@ public:
check_sgr(seq);
break;
-#ifdef WITH_SIXEL
- case VTE_CMD_DECSIXEL:
- /* OR mode is a nonstandard NetBSD/x68k extension that is
- * not supported in VTE.
- */
- if (seq.collect1(1) == 5)
- warn("DECSIXEL OR-mode not supported");
-
- /* Image ID (args[3]) is a nonstandard RLogin extension that is
- * not supported in VTE.
- */
- if (seq.collect1(3) != -1)
- warn("DECSIXEL ID extension not supported");
- break;
-#endif /* WITH_SIXEL */
-
default:
if (cmd >= VTE_CMD_NOP_FIRST)
warn("%s is unimplemented", cmd_to_str(cmd));
@@ -776,135 +654,8 @@ public:
}
}
-#ifdef WITH_SIXEL
-
- void SIXEL(uint8_t raw) noexcept
- {
- m_seen_sixel_data = true;
- }
-
- void SIXEL_CMD(vte::sixel::Sequence const& seq) noexcept
- {
- switch (seq.command()) {
- case vte::sixel::Command::DECGRI: {
- auto const count = seq.param(0, 1);
- if (count < 3)
- warn("DECGRI %d wastes space", seq.param(0));
- else if (count == 3)
- warn("DECGRI %d saves no space", count);
- else if (count > 255)
- warn("DECGRI %d exceeds DEC limit of 255", count);
- break;
- }
-
- case vte::sixel::Command::DECGRA:
- if (m_seen_sixel_commands || m_seen_sixel_data)
- warn("DECGRA ignored after any SIXEL commands or data");
- break;
-
- case vte::sixel::Command::DECGCI: {
-
- auto reg = seq.param(0);
- if (reg == -1) {
- warn("DECGCI does not admit a default value for parameter 1");
- break;
- } else if (reg >= VTE_SIXEL_NUM_COLOR_REGISTERS) {
- warn("DECGCI %d exceeds number of available colour registers, wrapped to
register %d", reg, reg & (VTE_SIXEL_NUM_COLOR_REGISTERS - 1));
- reg &= (VTE_SIXEL_NUM_COLOR_REGISTERS - 1);
- }
-
- if (seq.size() > 1) {
- switch (seq.param(1)) {
- case -1: /* default */
- warn("DECGCI does not admit a default value for parameter 2");
- break;
- case 1: /* HLS */ {
- auto const h = seq.param(2, 0);
- auto const l = seq.param(3, 0);
- auto const s = seq.param(4, 0);
- if (h > 360)
- warn("DECGCI HSL colour hue %d exceeds range 0..360", h);
- if (l > 100)
- warn("DECGCI HSL colour luminosity %d exceeds range 0..100",
l);
- if (s > 100)
- warn("DECGCI HSL colour saturation %d exceeds range 0..100",
s);
- break;
- }
-
- case 2: /* RGB */ {
- auto const r = seq.param(2, 0);
- auto const g = seq.param(3, 0);
- auto const b = seq.param(4, 0);
- if (r > 100)
- warn("DECGCI RGB colour red %d exceeds range 0..100", r);
- if (g > 100)
- warn("DECGCI RGB colour red %d exceeds range 0..100", g);
- if (b > 100)
- warn("DECGCI RGB colour red %d exceeds range 0..100", b);
- break;
- }
-
- case 3: /* RGB truecolour.
- * This is an RLogin extension and not supported by VTE.
- */
- warn("DECGCI RGB truecolour extension is not supported");
- break;
-
- case 0:
- default:
- warn("DECGCI unknown colour coordinate system %d", seq.param(1));
- break;
- }
-
- m_sixel_color_set.set(reg);
- } else {
- /* Select colour register param[0] */
-
- if (!m_sixel_color_set.test(reg))
- warn("DECGCI %d selects colour which has not been defined", reg);
- }
-
- break;
- }
-
- case vte::sixel::Command::DECGCR:
- break;
-
- case vte::sixel::Command::DECGNL:
- break;
-
- default:
- warn("Ignoring unknown SIXEL command %d/%d '%c'",
- int(seq.command()) / 16,
- int(seq.command()) % 16,
- char(seq.command()));
- break;
- }
-
- m_seen_sixel_commands = true;
- }
-
- void SIXEL_ST(char32_t st) noexcept
- {
- m_sixel_st = st;
- }
-
-#endif /* WITH_SIXEL */
-
void enter_data_syntax(DataSyntax syntax) noexcept
{
- switch (syntax) {
-#ifdef WITH_SIXEL
- case DataSyntax::DECSIXEL:
- m_sixel_st = 0;
- m_seen_sixel_commands = m_seen_sixel_data = false;
- m_sixel_color_set.reset();
- break;
-#endif
-
- default:
- break;
- }
}
void leave_data_syntax(DataSyntax syntax,
@@ -922,12 +673,6 @@ class Sink {
public:
void VT(vte::parser::Sequence const& seq) noexcept { }
-#ifdef WITH_SIXEL
- void SIXEL(uint8_t raw) noexcept { }
- void SIXEL_CMD(vte::sixel::Sequence const& seq) noexcept { }
- void SIXEL_ST(char32_t st) noexcept { }
-#endif
-
void enter_data_syntax(DataSyntax syntax) noexcept { }
void leave_data_syntax(DataSyntax syntax,
bool success) noexcept { }
@@ -943,7 +688,6 @@ private:
D& m_delegate;
size_t m_buffer_size{0};
- bool m_no_sixel{false};
bool m_statistics{false};
bool m_benchmark{false};
@@ -956,10 +700,6 @@ private:
vte::base::UTF8Decoder m_utf8_decoder{};
vte::parser::Parser m_parser{};
-#ifdef WITH_SIXEL
- vte::sixel::Parser m_sixel_parser{};
-#endif
-
DataSyntax m_primary_data_syntax{DataSyntax::ECMA48_UTF8};
DataSyntax m_current_data_syntax{DataSyntax::ECMA48_UTF8};
@@ -971,12 +711,6 @@ private:
m_utf8_decoder.reset();
break;
-#ifdef WITH_SIXEL
- case DataSyntax::DECSIXEL:
- m_sixel_parser.reset();
- break;
-#endif
-
default:
break;
}
@@ -994,20 +728,6 @@ private:
process_seq(vte::parser::Sequence const& seq) noexcept
{
m_delegate.VT(seq);
-
-#ifdef WITH_SIXEL
- if (G_UNLIKELY(!m_no_sixel &&
- seq.command() == VTE_CMD_DECSIXEL &&
- seq.is_unripe())) {
- m_parser.reset(); // sixel parser takes over until ST
- m_sixel_parser.reset();
- m_current_data_syntax = DataSyntax::DECSIXEL;
-
- m_delegate.enter_data_syntax(m_current_data_syntax);
- return false;
- }
-#endif /* WITH_SIXEL */
-
return true;
}
@@ -1070,33 +790,6 @@ private:
return bufend;
}
-#ifdef WITH_SIXEL
-
- uint8_t const*
- process_data_decsixel(uint8_t const* const bufstart,
- uint8_t const* const bufend,
- bool eos) noexcept
- {
- auto [status, ip] = m_sixel_parser.parse(bufstart, bufend, eos, m_delegate);
-
- switch (status) {
- case vte::sixel::Parser::ParseStatus::CONTINUE:
- break;
-
- case vte::sixel::Parser::ParseStatus::COMPLETE:
- case vte::sixel::Parser::ParseStatus::ABORT: {
- auto const success = (status == vte::sixel::Parser::ParseStatus::COMPLETE);
- m_delegate.leave_data_syntax(m_current_data_syntax, success);
- m_current_data_syntax = m_primary_data_syntax;
- break;
- }
- }
-
- return ip;
- }
-
-#endif /* WITH_SIXEL */
-
void
process_fd(int fd)
{
@@ -1124,12 +817,6 @@ private:
sptr = process_data_utf8(sptr, bufend, eos);
break;
-#ifdef WITH_SIXEL
- case DataSyntax::DECSIXEL:
- sptr = process_data_decsixel(sptr, bufend, eos);
- break;
-#endif
-
default:
g_assert_not_reached();
break;
@@ -1179,22 +866,16 @@ public:
Processor(Delegate& delegate,
size_t buffer_size,
- bool no_sixel,
bool statistics,
bool benchmark) noexcept
: m_delegate{delegate},
m_buffer_size{std::max(buffer_size, k_buf_overlap + 1)},
- m_no_sixel{no_sixel},
m_statistics{statistics},
m_benchmark{benchmark}
{
memset(&m_seq_stats, 0, sizeof(m_seq_stats));
memset(&m_cmd_stats, 0, sizeof(m_cmd_stats));
m_bench_times = g_array_new(false, true, sizeof(int64_t));
-
-#ifdef WITH_SIXEL
- m_parser.set_dispatch_unripe(!m_no_sixel);
-#endif
}
~Processor() noexcept
@@ -1290,7 +971,6 @@ private:
bool m_benchmark{false};
bool m_codepoints{false};
bool m_lint{false};
- bool m_no_sixel{false};
bool m_plain{false};
bool m_quiet{false};
bool m_statistics{false};
@@ -1310,7 +990,6 @@ public:
inline constexpr size_t buffer_size() const noexcept { return m_buffer_size; }
inline constexpr bool codepoints() const noexcept { return m_codepoints; }
inline constexpr bool lint() const noexcept { return m_lint; }
- inline constexpr bool no_sixel() const noexcept { return m_no_sixel; }
inline constexpr bool plain() const noexcept { return m_plain; }
inline constexpr bool quiet() const noexcept { return m_quiet; }
inline constexpr bool statistics() const noexcept { return m_statistics; }
@@ -1328,7 +1007,6 @@ public:
auto benchmark = BoolOption{m_benchmark, false};
auto codepoints = BoolOption{m_codepoints, false};
auto lint = BoolOption{m_lint, false};
- auto no_sixel = BoolOption{m_no_sixel, false};
auto plain = BoolOption{m_plain, false};
auto quiet = BoolOption{m_quiet, false};
auto statistics = BoolOption{m_statistics, false};
@@ -1345,10 +1023,6 @@ public:
"Output unicode code points by number", nullptr },
{ "lint", 'l', 0, G_OPTION_ARG_NONE, &lint,
"Check input", nullptr },
-#ifdef WITH_SIXEL
- { "no-sixel", 0, 0, G_OPTION_ARG_NONE, &no_sixel,
- "Disable DECSIXEL processing", nullptr },
-#endif
{ "plain", 'p', 0, G_OPTION_ARG_NONE, &plain,
"Output plain text without attributes", nullptr },
{ "quiet", 'q', 0, G_OPTION_ARG_NONE, &quiet,
@@ -1377,7 +1051,6 @@ process(Options const& options,
{
auto proc = Processor{delegate,
options.buffer_size(),
- options.no_sixel(),
options.statistics(),
options.benchmark()};
diff --git a/src/parser-seq.py b/src/parser-seq.py
index 2243a203..8692b147 100755
--- a/src/parser-seq.py
+++ b/src/parser-seq.py
@@ -916,7 +916,7 @@ sequences = [
comment='restore terminal state'),
seq_DCS('XTERM_STCAP', 'p', intermediates=(Intermediate.PLUS,), flags=Flags.NOP,
comment='xterm set termcap/terminfo'),
- seq_DCS('DECSIXEL', 'q', flags=Flags.UNRIPE | Flags.HANDLER_RV,
+ seq_DCS('DECSIXEL', 'q', flags=Flags.NOP,
comment='SIXEL graphics'),
seq_DCS('DECRQSS', 'q', intermediates=(Intermediate.CASH,),
comment='request selection or setting'),
diff --git a/src/pty.cc b/src/pty.cc
index 0a22fffc..c2d1cb82 100644
--- a/src/pty.cc
+++ b/src/pty.cc
@@ -288,10 +288,6 @@ Pty::set_size(int rows,
memset(&size, 0, sizeof(size));
size.ws_row = rows > 0 ? rows : 24;
size.ws_col = columns > 0 ? columns : 80;
-#ifdef WITH_SIXEL
- size.ws_ypixel = size.ws_row * cell_height_px;
- size.ws_xpixel = size.ws_col * cell_width_px;
-#endif
_vte_debug_print(VTE_DEBUG_PTY,
"Setting size on fd %d to (%d,%d).\n",
master, columns, rows);
diff --git a/src/ring.cc b/src/ring.cc
index 23d79600..fe5bab17 100644
--- a/src/ring.cc
+++ b/src/ring.cc
@@ -25,20 +25,6 @@
#include <string.h>
-#ifdef WITH_SIXEL
-
-#include "cxx-utils.hh"
-
-/* We should be able to hold a single fullscreen 4K image at most.
- * 35MiB equals 3840 * 2160 * 4 plus a little extra. */
-#define IMAGE_FAST_MEMORY_USED_MAX (35 * 1024 * 1024)
-
-/* Hard limit on number of images to keep around. This limits the impact
- * of potential issues related to algorithmic complexity. */
-#define IMAGE_FAST_COUNT_MAX 4096
-
-#endif /* WITH_SIXEL */
-
/*
* Copy the common attributes from VteCellAttr to VteStreamCellAttr or vice versa.
*/
@@ -204,115 +190,6 @@ Ring::hyperlink_maybe_gc(row_t increment)
hyperlink_gc();
}
-#ifdef WITH_SIXEL
-
-void
-Ring::image_gc_region() noexcept
-{
- cairo_region_t *region = cairo_region_create();
-
- for (auto rit = m_image_map.rbegin();
- rit != m_image_map.rend();
- ) {
- auto const& image = rit->second;
- auto const rect = cairo_rectangle_int_t{image->get_left(),
- image->get_top(),
- image->get_width(),
- image->get_height()};
-
- if (cairo_region_contains_rectangle(region, &rect) == CAIRO_REGION_OVERLAP_IN) {
- /* vte::image::Image has been completely overdrawn; delete it */
-
- m_image_fast_memory_used -= image->resource_size();
-
- /* Apparently this is the cleanest way to erase() with a reverse iterator... */
- /* Unlink the image from m_image_by_top_map, then erase it from m_image_map */
- unlink_image_from_top_map(image.get());
- rit = image_map_type::reverse_iterator{m_image_map.erase(std::next(rit).base())};
- continue;
- }
-
- cairo_region_union_rectangle(region, &rect);
- ++rit;
- }
-
- cairo_region_destroy(region);
-}
-
-void
-Ring::image_gc() noexcept
-{
- while (m_image_fast_memory_used > IMAGE_FAST_MEMORY_USED_MAX ||
- m_image_map.size() > IMAGE_FAST_COUNT_MAX) {
- if (m_image_map.empty()) {
- /* If this happens, we've miscounted somehow. */
- break;
- }
-
- auto& image = m_image_map.begin()->second;
- m_image_fast_memory_used -= image->resource_size();
- unlink_image_from_top_map(image.get());
- m_image_map.erase(m_image_map.begin());
- }
-}
-
-void
-Ring::unlink_image_from_top_map(vte::image::Image const* image) noexcept
-{
- auto [begin, end] = m_image_by_top_map.equal_range(image->get_top());
-
- for (auto it = begin; it != end; ++it) {
- if (it->second != image)
- continue;
-
- m_image_by_top_map.erase(it);
- break;
- }
-}
-
-void
-Ring::rebuild_image_top_map() /* throws */
-{
- m_image_by_top_map.clear();
-
- for (auto it = m_image_map.begin(), end = m_image_map.end();
- it != end;
- ++it) {
- auto const& image = it->second;
- m_image_by_top_map.emplace(std::piecewise_construct,
- std::forward_as_tuple(image->get_top()),
- std::forward_as_tuple(image.get()));
- }
-}
-
-bool
-Ring::rewrap_images_in_range(Ring::image_by_top_map_type::iterator& it,
- size_t text_start_ofs,
- size_t text_end_ofs,
- row_t new_row_index) noexcept
-{
- for (auto const end = m_image_by_top_map.end();
- it != end;
- ++it) {
- auto const& image = it->second;
- auto ofs = CellTextOffset{};
-
- if (!frozen_row_column_to_text_offset(image->get_top(), 0, &ofs))
- return false;
-
- if (ofs.text_offset >= text_end_ofs)
- break;
-
- if (ofs.text_offset >= text_start_ofs && ofs.text_offset < text_end_ofs) {
- image->set_top(new_row_index);
- }
- }
-
- return true;
-}
-
-#endif /* WITH_SIXEL */
-
/*
* Find existing idx for the hyperlink or allocate a new one.
*
@@ -713,13 +590,6 @@ Ring::reset()
m_start = m_writable = m_end;
m_cached_row_num = (row_t)-1;
-#ifdef WITH_SIXEL
- m_image_by_top_map.clear();
- m_image_map.clear();
- m_next_image_priority = 0;
- m_image_fast_memory_used = 0;
-#endif
-
return m_end;
}
@@ -1150,16 +1020,7 @@ Ring::frozen_row_column_to_text_offset(row_t position,
} else
records[1].text_start_offset = _vte_stream_head(m_text_stream);
- offset->fragment_cells = 0;
- offset->eol_cells = -1;
- offset->text_offset = records[0].text_start_offset;
-
- /* Save some work if we're in column 0. This holds true for images, whose column
- * positions are disregarded for the purposes of wrapping. */
- if (column == 0)
- return true;
-
- g_string_set_size (buffer, records[1].text_start_offset - records[0].text_start_offset);
+ g_string_set_size (buffer, records[1].text_start_offset - records[0].text_start_offset);
if (!_vte_stream_read(m_text_stream, records[0].text_start_offset, buffer->str, buffer->len))
return false;
@@ -1171,6 +1032,8 @@ Ring::frozen_row_column_to_text_offset(row_t position,
/* row and buffer now contain the same text, in different representation */
/* count the number of characters up to the given column */
+ offset->fragment_cells = 0;
+ offset->eol_cells = -1;
num_chars = 0;
for (i = 0, cell = row->cells; i < row->len && i < column; i++, cell++) {
if (G_LIKELY (!cell->attr.fragment())) {
@@ -1191,7 +1054,7 @@ Ring::frozen_row_column_to_text_offset(row_t position,
off++;
if ((buffer->str[off] & 0xC0) != 0x80) num_chars--;
}
- offset->text_offset += off;
+ offset->text_offset = records[0].text_start_offset + off;
return true;
}
@@ -1303,9 +1166,6 @@ Ring::rewrap(column_t columns,
gsize paragraph_len; /* excluding trailing '\n' */
gsize attr_offset;
gsize old_ring_end;
-#ifdef WITH_SIXEL
- auto image_it = m_image_by_top_map.begin();
-#endif
if (G_UNLIKELY(length() == 0))
return;
@@ -1441,14 +1301,6 @@ Ring::rewrap(column_t columns,
}
}
-#ifdef WITH_SIXEL
- if (!rewrap_images_in_range(image_it,
- new_record.text_start_offset,
- text_offset,
- new_row_index))
- goto err;
-#endif
-
new_row_index++;
new_record.text_start_offset = text_offset;
new_record.attr_start_offset = attr_offset;
@@ -1498,14 +1350,6 @@ Ring::rewrap(column_t columns,
}
}
-#ifdef WITH_SIXEL
- if (!rewrap_images_in_range(image_it,
- new_record.text_start_offset,
- paragraph_end_text_offset,
- new_row_index))
- goto err;
-#endif
-
new_row_index++;
paragraph_start_text_offset = paragraph_end_text_offset;
}
@@ -1538,14 +1382,6 @@ Ring::rewrap(column_t columns,
g_free(marker_text_offsets);
g_free(new_markers);
-#ifdef WITH_SIXEL
- try {
- rebuild_image_top_map();
- } catch (...) {
- vte::log_exception();
- }
-#endif
-
_vte_debug_print(VTE_DEBUG_RING, "Ring after rewrapping:\n");
validate();
return;
@@ -1649,56 +1485,3 @@ Ring::write_contents(GOutputStream* stream,
return true;
}
-
-#ifdef WITH_SIXEL
-
-/**
- * Ring::append_image:
- * @surface: A Cairo surface object
- * @pixelwidth: vte::image::Image width in pixels
- * @pixelheight: vte::image::Image height in pixels
- * @left: Left position of image in cell units
- * @top: Top position of image in cell units
- * @cell_width: Width of image in cell units
- * @cell_height: Height of image in cell units
- *
- * Append an image to the internal image list.
- */
-void
-Ring::append_image(vte::Freeable<cairo_surface_t> surface,
- int pixelwidth,
- int pixelheight,
- long left,
- long top,
- long cell_width,
- long cell_height) /* throws */
-{
- auto const priority = m_next_image_priority;
- auto [it, success] = m_image_map.try_emplace
- (priority, // key
- std::make_unique<vte::image::Image>(std::move(surface),
- priority,
- pixelwidth,
- pixelheight,
- left,
- top,
- cell_width,
- cell_height));
- if (!success)
- return;
-
- ++m_next_image_priority;
-
- auto const& image = it->second;
-
- m_image_by_top_map.emplace(std::piecewise_construct,
- std::forward_as_tuple(image->get_top()),
- std::forward_as_tuple(image.get()));
-
- m_image_fast_memory_used += image->resource_size ();
-
- image_gc_region();
- image_gc();
-}
-
-#endif /* WITH_SIXEL */
diff --git a/src/ring.hh b/src/ring.hh
index 54223904..186a92bd 100644
--- a/src/ring.hh
+++ b/src/ring.hh
@@ -27,13 +27,6 @@
#include "vterowdata.hh"
#include "vtestream.h"
-#ifdef WITH_SIXEL
-#include "cairo-glue.hh"
-#include "image.hh"
-#include <map>
-#include <memory>
-#endif
-
#include <type_traits>
typedef struct _VteVisualPosition {
@@ -234,44 +227,6 @@ private:
hyperlink_idx_t m_hyperlink_hover_idx{0}; /* The hyperlink idx of the hovered cell.
An idx is allocated on hover even if the cell is scrolled
out to the streams. */
row_t m_hyperlink_maybe_gc_counter{0}; /* Do a GC when it reaches 65536. */
-
-#ifdef WITH_SIXEL
-
-private:
- size_t m_next_image_priority{0};
- size_t m_image_fast_memory_used{0};
-
- /* m_image_priority_map stores the Image. key is the priority of the image. */
- using image_map_type = std::map<size_t, std::unique_ptr<vte::image::Image>>;
- image_map_type m_image_map{};
-
- /* m_image_by_top_map stores only an iterator to the Image in m_image_priority_map;
- * key is the top row of the image.
- */
- using image_by_top_map_type = std::multimap<row_t, vte::image::Image*>;
- image_by_top_map_type m_image_by_top_map{};
-
- void image_gc() noexcept;
- void image_gc_region() noexcept;
- void unlink_image_from_top_map(vte::image::Image const* image) noexcept;
- void rebuild_image_top_map() /* throws */;
- bool rewrap_images_in_range(image_by_top_map_type::iterator& it,
- size_t text_start_ofs,
- size_t text_end_ofs,
- row_t new_row_index) noexcept;
-
-public:
- auto const& image_map() const noexcept { return m_image_map; }
-
- void append_image(vte::Freeable<cairo_surface_t> surface,
- int pixelwidth,
- int pixelheight,
- long left,
- long top,
- long cell_width,
- long cell_height) /* throws */;
-
-#endif /* WITH_SIXEL */
};
}; /* namespace base */
diff --git a/src/vte.cc b/src/vte.cc
index 4bf9587d..554d0cca 100644
--- a/src/vte.cc
+++ b/src/vte.cc
@@ -3114,43 +3114,6 @@ not_inserted:
m_line_wrapped = line_wrapped;
}
-#ifdef WITH_SIXEL
-
-void
-Terminal::insert_image(ProcessingContext& context,
- vte::Freeable<cairo_surface_t> image_surface) /* throws */
-{
- if (!image_surface)
- return;
-
- auto const image_width_px = cairo_image_surface_get_width(image_surface.get());
- auto const image_height_px = cairo_image_surface_get_height(image_surface.get());
-
- /* Calculate geometry */
-
- auto const left = m_screen->cursor.col;
- auto const top = m_screen->cursor.row;
- auto const width = (image_width_px + m_cell_width_unscaled - 1) / m_cell_width_unscaled;
- auto const height = (image_height_px + m_cell_height_unscaled - 1) / m_cell_height_unscaled;
-
- m_screen->row_data->append_image(std::move(image_surface),
- image_width_px,
- image_height_px,
- left,
- top,
- m_cell_width_unscaled,
- m_cell_height_unscaled);
-
- /* Erase characters under the image. Since this inserts content, we need
- * to update the processing context's bbox.
- */
- context.pre_GRAPHIC(*this);
- erase_image_rect(height, width);
- context.post_GRAPHIC(*this);
-}
-
-#endif /* WITH_SIXEL */
-
guint8
Terminal::get_bidi_flags() const noexcept
{
@@ -3514,12 +3477,6 @@ Terminal::process_incoming()
break;
#endif
-#ifdef WITH_SIXEL
- case DataSyntax::DECSIXEL:
- process_incoming_decsixel(context, *chunk);
- break;
-#endif
-
default:
g_assert_not_reached();
break;
@@ -3723,7 +3680,10 @@ Terminal::process_incoming_utf8(ProcessingContext& context,
}
}
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wunused-label"
switched_data_syntax:
+#pragma GCC diagnostic pop
// Update start for data consumed
chunk.set_begin_reading(ip);
@@ -3848,7 +3808,10 @@ Terminal::process_incoming_pcterm(ProcessingContext& context,
return;
}
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wunused-label"
switched_data_syntax:
+#pragma GCC diagnostic pop
// Update start for data consumed
chunk.set_begin_reading(ip);
@@ -3862,44 +3825,6 @@ Terminal::process_incoming_pcterm(ProcessingContext& context,
#endif /* WITH_ICU */
-#ifdef WITH_SIXEL
-
-void
-Terminal::process_incoming_decsixel(ProcessingContext& context,
- vte::base::Chunk& chunk)
-{
- auto const [status, ip] = m_sixel_context->parse(chunk.begin_reading(),
- chunk.end_reading(),
- chunk.eos());
-
- // Update start for data consumed
- chunk.set_begin_reading(ip);
-
- switch (status) {
- case vte::sixel::Parser::ParseStatus::CONTINUE:
- break;
-
- case vte::sixel::Parser::ParseStatus::COMPLETE:
- /* Like the main parser, the sequence only takes effect
- * if introducer and terminator match (both C0 or both C1).
- */
- if (m_sixel_context->is_matching_controls()) {
- try {
- insert_image(context, m_sixel_context->image_cairo());
- } catch (...) {
- }
- }
-
- [[fallthrough]];
- case vte::sixel::Parser::ParseStatus::ABORT:
- m_sixel_context->reset();
- pop_data_syntax();
- break;
- }
-}
-
-#endif /* WITH_SIXEL */
-
bool
Terminal::pty_io_read(int const fd,
GIOCondition const condition)
@@ -7684,12 +7609,6 @@ Terminal::Terminal(vte::platform::Widget* w,
for (auto i = 0; i < VTE_PALETTE_SIZE; i++)
m_palette[i].sources[VTE_COLOR_SOURCE_ESCAPE].is_set = FALSE;
- /* Dispatch unripe DCS (for now, just DECSIXEL) sequences,
- * so we can switch data syntax and parse the contents with
- * the SIXEL subparser.
- */
- m_parser.set_dispatch_unripe(true);
-
/* Set up I/O encodings. */
m_outgoing = _vte_byte_array_new();
@@ -8219,11 +8138,7 @@ Terminal::draw_cells(vte::view::DrawingContext::TextRequest* items,
else
rgb_from_index<4, 5, 4>(deco, dc);
-#ifndef WITH_SIXEL
if (clear && (draw_default_bg || back != VTE_DEFAULT_BG)) {
-#else
- {
-#endif
/* Paint the background. */
i = 0;
while (i < n) {
@@ -8242,25 +8157,11 @@ Terminal::draw_cells(vte::view::DrawingContext::TextRequest* items,
}
}
-#ifdef WITH_SIXEL
- if (back == VTE_DEFAULT_BG) {
- /* Clear cells in order to properly overdraw images */
- m_draw.clear(xl,
- y,
- xr - xl, row_height,
- get_color(VTE_DEFAULT_BG), m_background_alpha);
- }
-
- if (clear && (draw_default_bg || back != VTE_DEFAULT_BG)) {
-#else
- {
-#endif
- m_draw.fill_rectangle(
- xl,
- y,
- xr - xl, row_height,
- &bg, VTE_DRAW_OPAQUE);
- }
+ m_draw.fill_rectangle(
+ xl,
+ y,
+ xr - xl, row_height,
+ &bg, VTE_DRAW_OPAQUE);
}
}
@@ -8874,14 +8775,12 @@ Terminal::draw_rows(VteScreen *screen_,
nhilite = (nhyperlink && cell->attr.hyperlink_idx == m_hyperlink_hover_idx) ||
(!nhyperlink && regex_match_has_current() && m_match_span.contains(row,
lcol));
if (cell->c == 0 ||
-#ifndef WITH_SIXEL
((cell->c == ' ' || cell->c == '\t') && // FIXME '\t' is newly added now,
double check
cell->attr.has_none(VTE_ATTR_UNDERLINE_MASK |
VTE_ATTR_STRIKETHROUGH_MASK |
VTE_ATTR_OVERLINE_MASK) &&
!nhyperlink &&
!nhilite) ||
-#endif
cell->attr.fragment() ||
cell->attr.invisible()) {
/* Skip empty or fragment cell, but erase on ' ' and '\t', since
@@ -9317,9 +9216,6 @@ Terminal::draw(cairo_t* cr,
int allocated_width, allocated_height;
int extra_area_for_cursor;
bool text_blink_enabled_now;
-#ifdef WITH_SIXEL
- VteRing *ring = m_screen->row_data;
-#endif
gint64 now = 0;
allocated_width = get_allocated_width();
@@ -9362,33 +9258,6 @@ Terminal::draw(cairo_t* cr,
allocated_height - m_border.top - m_border.bottom);
cairo_clip(cr);
-#ifdef WITH_SIXEL
- /* Draw images */
- if (m_images_enabled) {
- vte::grid::row_t top_row = first_displayed_row();
- vte::grid::row_t bottom_row = last_displayed_row();
- auto const& image_map = ring->image_map();
- auto const image_map_end = image_map.end();
- for (auto it = image_map.begin(); it != image_map_end; ++it) {
- auto const& image = it->second;
-
- if (image->get_bottom() < top_row ||
- image->get_top() > bottom_row)
- continue;
-
- auto const x = image->get_left () * m_cell_width;
- auto const y = (image->get_top () - m_screen->scroll_delta) * m_cell_height;
-
- /* Clear cell extent; image may be slightly smaller */
- m_draw.clear(x, y, image->get_width() * m_cell_width,
- image->get_height() * m_cell_height,
- get_color(VTE_DEFAULT_BG), m_background_alpha);
-
- image->paint(cr, x, y, m_cell_width, m_cell_height);
- }
- }
-#endif /* WITH_SIXEL */
-
/* Whether blinking text should be visible now */
m_text_blink_state = true;
text_blink_enabled_now = (unsigned)m_text_blink_mode & (unsigned)(m_has_focus ?
TextBlinkMode::eFOCUSED : TextBlinkMode::eUNFOCUSED);
@@ -9953,12 +9822,6 @@ Terminal::reset_data_syntax()
return;
switch (current_data_syntax()) {
-#ifdef WITH_SIXEL
- case DataSyntax::DECSIXEL:
- m_sixel_context->reset();
- break;
-#endif
-
default:
break;
}
@@ -9966,15 +9829,6 @@ Terminal::reset_data_syntax()
pop_data_syntax();
}
-void
-Terminal::reset_graphics_color_registers()
-{
-#ifdef WITH_SIXEL
- if (m_sixel_context)
- m_sixel_context->reset_colors();
-#endif
-}
-
/*
* Terminal::reset:
* @clear_tabstops: whether to reset tabstops
@@ -10079,11 +9933,6 @@ Terminal::reset(bool clear_tabstops,
/* Clear modifiers. */
m_modifiers = 0;
-#ifdef WITH_SIXEL
- if (m_sixel_context)
- m_sixel_context->reset_colors();
-#endif
-
/* Reset the saved cursor. */
save_cursor(&m_normal_screen);
save_cursor(&m_alternate_screen);
@@ -10094,12 +9943,6 @@ Terminal::reset(bool clear_tabstops,
/* Reset XTerm window controls */
m_xterm_wm_iconified = false;
-
- /* When not using private colour registers, we should
- * clear (assign to black) all SIXEL colour registers.
- * (DEC PPLV2 § 5.8)
- */
- reset_graphics_color_registers();
}
void
diff --git a/src/vtedefines.hh b/src/vtedefines.hh
index 7f2e478a..23827c96 100644
--- a/src/vtedefines.hh
+++ b/src/vtedefines.hh
@@ -143,12 +143,6 @@
#define VTE_TERMINFO_NAME "xterm-256color"
-#define VTE_SIXEL_ENABLED_DEFAULT false
-
-#define VTE_SIXEL_MAX_WIDTH (2048)
-#define VTE_SIXEL_MAX_HEIGHT (2052)
-#define VTE_SIXEL_NUM_COLOR_REGISTERS (1024)
-
#define VTE_MIN_CURSOR_BLINK_CYCLE (50 /* ms */)
#define VTE_MIN_CURSOR_BLINK_TIMEOUT (50 /* ms */)
diff --git a/src/vtegtk.cc b/src/vtegtk.cc
index f9265712..d029085f 100644
--- a/src/vtegtk.cc
+++ b/src/vtegtk.cc
@@ -2127,11 +2127,7 @@ vte_terminal_class_init(VteTerminalClass *klass)
*/
pspecs[PROP_ENABLE_SIXEL] =
g_param_spec_boolean ("enable-sixel", nullptr, nullptr,
-#ifdef WITH_SIXEL
- VTE_SIXEL_ENABLED_DEFAULT,
-#else
false,
-#endif
(GParamFlags) (G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS |
G_PARAM_EXPLICIT_NOTIFY));
@@ -2504,12 +2500,6 @@ vte_get_features (void) noexcept
"+ICU"
#else
"-ICU"
-#endif
- " "
-#ifdef WITH_SIXEL
- "+SIXEL"
-#else
- "-SIXEL"
#endif
#ifdef __linux__
" "
@@ -2541,9 +2531,6 @@ vte_get_feature_flags(void) noexcept
#ifdef WITH_ICU
VTE_FEATURE_FLAG_ICU |
#endif
-#ifdef WITH_SIXEL
- VTE_FEATURE_FLAG_SIXEL |
-#endif
#ifdef __linux__
#ifdef WITH_SYSTEMD
VTE_FEATURE_FLAG_SYSTEMD |
@@ -6473,12 +6460,7 @@ vte_terminal_set_enable_sixel(VteTerminal *terminal,
gboolean enabled) noexcept
try
{
-#ifdef WITH_SIXEL
g_return_if_fail(VTE_IS_TERMINAL(terminal));
-
- if (WIDGET(terminal)->set_sixel_enabled(enabled != FALSE))
- g_object_notify_by_pspec(G_OBJECT(terminal), pspecs[PROP_ENABLE_SIXEL]);
-#endif
}
catch (...)
{
@@ -6489,7 +6471,7 @@ catch (...)
* vte_terminal_get_enable_sixel:
* @terminal: a #VteTerminal
*
- * Returns: %TRUE if SIXEL image support is enabled, %FALSE otherwise
+ * Returns: %FALSE
*
* Since: 0.62
*/
@@ -6497,13 +6479,7 @@ gboolean
vte_terminal_get_enable_sixel(VteTerminal *terminal) noexcept
try
{
-#ifdef WITH_SIXEL
- g_return_val_if_fail(VTE_IS_TERMINAL(terminal), FALSE);
-
- return WIDGET(terminal)->sixel_enabled();
-#else
return false;
-#endif
}
catch (...)
{
diff --git a/src/vteinternal.hh b/src/vteinternal.hh
index 88464760..0d454649 100644
--- a/src/vteinternal.hh
+++ b/src/vteinternal.hh
@@ -75,10 +75,6 @@
#include "icu-converter.hh"
#endif
-#ifdef WITH_SIXEL
-#include "sixel-context.hh"
-#endif
-
enum {
VTE_BIDI_FLAG_IMPLICIT = 1 << 0,
VTE_BIDI_FLAG_RTL = 1 << 1,
@@ -320,9 +316,6 @@ public:
/* ECMA48_ECMA35, not supported */
/* The following can never be primary data syntax: */
-#ifdef WITH_SIXEL
- DECSIXEL,
-#endif
};
DataSyntax m_primary_data_syntax{DataSyntax::ECMA48_UTF8};
@@ -383,10 +376,6 @@ public:
}
}
-#ifdef WITH_SIXEL
- std::unique_ptr<vte::sixel::Context> m_sixel_context{};
-#endif
-
/* Screen data. We support the normal screen, and an alternate
* screen, which seems to be a DEC-specific feature. */
VteScreen m_normal_screen;
@@ -511,21 +500,6 @@ public:
this),
"mouse-autoscroll-timer"};
- /* Inline images */
- bool m_sixel_enabled{VTE_SIXEL_ENABLED_DEFAULT};
- bool m_images_enabled{VTE_SIXEL_ENABLED_DEFAULT};
-
- bool set_sixel_enabled(bool enabled) noexcept
- {
- auto const changed = m_sixel_enabled != enabled;
- m_sixel_enabled = m_images_enabled = enabled;
- if (changed)
- invalidate_all();
- 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++; }
@@ -806,11 +780,6 @@ public:
bool insert,
bool invalidate_now);
- #ifdef WITH_SIXEL
- void insert_image(ProcessingContext& context,
- vte::Freeable<cairo_surface_t> image_surface) /* throws */;
- #endif
-
void invalidate_row(vte::grid::row_t row);
void invalidate_rows(vte::grid::row_t row_start,
vte::grid::row_t row_end /* inclusive */);
@@ -836,10 +805,6 @@ public:
void process_incoming_pcterm(ProcessingContext& context,
vte::base::Chunk& chunk);
#endif
- #ifdef WITH_SIXEL
- void process_incoming_decsixel(ProcessingContext& context,
- vte::base::Chunk& chunk);
- #endif
bool process(bool emit_adj_changed);
inline bool is_processing() const { return m_active_terminals_link != nullptr; }
void start_processing();
@@ -1037,7 +1002,6 @@ public:
void im_reset();
void im_update_cursor();
- void reset_graphics_color_registers();
void reset(bool clear_tabstops,
bool clear_history,
bool from_api = false);
@@ -1473,8 +1437,6 @@ public:
inline void move_cursor_down(vte::grid::row_t rows);
inline void erase_characters(long count,
bool use_basic = false);
- void erase_image_rect(vte::grid::row_t rows,
- vte::grid::column_t columns);
inline void insert_blank_character();
template<unsigned int redbits, unsigned int greenbits, unsigned int bluebits>
diff --git a/src/vteseq.cc b/src/vteseq.cc
index 3945fcac..874d2405 100644
--- a/src/vteseq.cc
+++ b/src/vteseq.cc
@@ -982,33 +982,6 @@ Terminal::erase_characters(long count,
m_text_deleted_flag = TRUE;
}
-void
-Terminal::erase_image_rect(vte::grid::row_t rows,
- vte::grid::column_t columns)
-{
- auto const top = m_screen->cursor.row;
-
- /* FIXMEchpe: simplify! */
- for (auto i = 0; i < rows; ++i) {
- auto const row = top + i;
-
- erase_characters(columns, true);
-
- if (row > m_screen->insert_delta - 1 &&
- row < m_screen->insert_delta + m_row_count)
- set_hard_wrapped(row);
-
- if (i == rows - 1) {
- if (m_modes_private.MINTTY_SIXEL_SCROLL_CURSOR_RIGHT())
- move_cursor_forward(columns);
- else
- cursor_down(true);
- } else {
- cursor_down(true);
- }
- }
-}
-
/* Insert a blank character. */
void
Terminal::insert_blank_character()
@@ -2403,9 +2376,6 @@ Terminal::DA1(vte::parser::Sequence const& seq)
return;
reply(seq, VTE_REPLY_DECDA1R, {65, 1,
-#ifdef WITH_SIXEL
- m_sixel_enabled ? 4 : -2 /* skip */,
-#endif
9});
}
@@ -4135,8 +4105,6 @@ Terminal::DECSCL(vte::parser::Sequence const& seq)
break;
}
#endif
-
- reset_graphics_color_registers();
}
void
@@ -4381,7 +4349,7 @@ Terminal::DECSGR(vte::parser::Sequence const& seq)
/* TODO: consider implementing sub/superscript? */
}
-bool
+void
Terminal::DECSIXEL(vte::parser::Sequence const& seq)
{
/*
@@ -4409,116 +4377,6 @@ Terminal::DECSIXEL(vte::parser::Sequence const& seq)
* References: VT330
* DEC PPLV2 § 5.4
*/
-
-#ifdef WITH_SIXEL
- auto process_sixel = false;
- auto mode = vte::sixel::Parser::Mode{};
- if (m_sixel_enabled) {
- switch (primary_data_syntax()) {
- case DataSyntax::ECMA48_UTF8:
- process_sixel = true;
- mode = vte::sixel::Parser::Mode::UTF8;
- break;
-
-#ifdef WITH_ICU
- case DataSyntax::ECMA48_PCTERM:
- /* It's not really clear how DECSIXEL should be processed in PCTERM mode.
- * The DEC documentation available isn't very detailed on PCTERM mode,
- * and doesn't appear to mention its interaction with DECSIXEL at all.
- *
- * Since (afaik) a "real" DEC PCTERM mode only (?) translates the graphic
- * characters, not the whole data stream, as we do, let's assume that
- * DECSIXEL content should be processed as raw bytes, i.e. without any
- * translation.
- * Also, since C1 controls don't exist in PCTERM mode, let's process
- * DECSIXEL in 7-bit mode.
- *
- * As an added complication, we can only switch data syntaxes if
- * the data stream is exact, that is the charset converter has
- * not consumed more data than we have currently read output bytes
- * from it. So we need to check that the converter has no pending
- * characters.
- *
- * Alternatively, we could just refuse to process DECSIXEL in
- * PCTERM mode.
- */
- process_sixel = !m_converter->decoder().pending();
- mode = vte::sixel::Parser::Mode::SEVENBIT;
- break;
-#endif /* WITH_ICU */
-
- default:
- __builtin_unreachable();
- process_sixel = false;
- }
- }
-
- /* How to interpret args[1] is not entirely clear from the DEC
- * documentation and other terminal emulators.
- * We choose to make args[1]==1 mean to use transparent background.
- * and treat all other values (default, 0, 2) as using the current
- * SGR background colour. See the discussion in issue #253.
- *
- * Also use the current SGR foreground colour to initialise
- * the special colour register so that SIXEL images which set
- * no colours get a sensible default.
- */
- auto transparent_bg = bool{};
- switch (seq.collect1(1, 2)) {
- case -1: /* default */
- case 0:
- case 2:
- transparent_bg = false;
- break;
-
- case 1:
- transparent_bg = true;
- break;
-
- case 5: /* OR mode (a nonstandard NetBSD/x68k extension; not supported */
- process_sixel = false;
- break;
-
- default:
- transparent_bg = false;
- break;
- }
-
- /* Ignore the whole sequence */
- if (!process_sixel || seq.is_ripe() /* that shouldn't happen */) {
- m_parser.ignore_until_st();
- return false;
- }
-
- auto fore = unsigned{}, back = unsigned{};
- auto fg = vte::color::rgb{}, bg = vte::color::rgb{};
- resolve_normal_colors(&m_defaults, &fore, &back, fg, bg);
-
- try {
- if (!m_sixel_context)
- m_sixel_context = std::make_unique<vte::sixel::Context>();
-
- m_sixel_context->prepare(seq.introducer(),
- fg.red >> 8, fg.green >> 8, fg.blue >> 8,
- bg.red >> 8, bg.green >> 8, bg.blue >> 8,
- back == VTE_DEFAULT_BG || transparent_bg,
- m_modes_private.XTERM_SIXEL_PRIVATE_COLOR_REGISTERS());
-
- m_sixel_context->set_mode(mode);
-
- /* We need to reset the main parser, so that when it is in the ground state
- * when processing returns to the primary data syntax from DECSIXEL
- */
- m_parser.reset();
- push_data_syntax(DataSyntax::DECSIXEL);
-
- return true; /* switching data syntax */
- } catch (...) {
- }
-#endif /* WITH_SIXEL */
-
- m_parser.ignore_until_st();
- return false;
}
void
@@ -8933,84 +8791,7 @@ Terminal::XTERM_SMGRAPHICS(vte::parser::Sequence const& seq)
*/
auto const attr = seq.collect1(0);
- auto status = 3, rv0 = -2, rv1 = -2;
-
- switch (attr) {
-#ifdef WITH_SIXEL
- case 0: /* Colour registers.
- *
- * VTE doesn't support changing the number of colour registers, so always
- * return the fixed number, and set() returns success iff the passed number
- * was less or equal that number.
- */
- switch (seq.collect1(1)) {
- case 1: /* read */
- case 2: /* reset */
- case 4: /* read maximum */
- status = 0;
- rv0 = VTE_SIXEL_NUM_COLOR_REGISTERS;
- break;
- case 3: /* set */
- status = (seq.collect1(2) <= VTE_SIXEL_NUM_COLOR_REGISTERS) ? 0 : 2;
- rv0 = VTE_SIXEL_NUM_COLOR_REGISTERS;
- break;
- case -1: /* no default */
- default:
- status = 2;
- break;
- }
- break;
-
- case 1: /* SIXEL graphics geometry.
- *
- * VTE doesn't support variable geometries; always report
- * the maximum size of a SIXEL graphic, and set() returns success iff the
- * passed numbers are less or equal to that number.
- */
- switch (seq.collect1(1)) {
- case 1: /* read */
- case 2: /* reset */
- case 4: /* read maximum */
- status = 0;
- rv0 = VTE_SIXEL_MAX_WIDTH;
- rv1 = VTE_SIXEL_MAX_HEIGHT;
- break;
-
- case 3: /* set */ {
- auto w = int{}, h = int{};
- if (seq.collect(2, {&w, &h}) &&
- w > 0 && w <= VTE_SIXEL_MAX_WIDTH &&
- h > 0 && h <= VTE_SIXEL_MAX_HEIGHT) {
- rv0 = VTE_SIXEL_MAX_WIDTH;
- rv1 = VTE_SIXEL_MAX_HEIGHT;
- status = 0;
- } else {
- status = 3;
- }
-
- break;
- }
-
- case -1: /* no default */
- default:
- status = 2;
- break;
- }
- break;
-
-#endif /* WITH_SIXEL */
-
-#if 0 /* ifdef WITH_REGIS */
- case 2:
- status = 1;
- break;
-#endif
-
- case -1: /* no default value */
- default:
- status = 1;
- break;
- }
+ auto status = 1, rv0 = -2, rv1 = -2;
reply(seq, VTE_REPLY_XTERM_SMGRAPHICS_REPORT, {attr, status, rv0, rv1});
}
diff --git a/src/widget.hh b/src/widget.hh
index cd8ee771..21a494d3 100644
--- a/src/widget.hh
+++ b/src/widget.hh
@@ -505,9 +505,6 @@ 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(); }
-
constexpr auto xalign() const noexcept { return m_xalign; }
constexpr auto yalign() const noexcept { return m_yalign; }
constexpr auto xfill() const noexcept { return m_xfill; }
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]