[vte/vte-0-62: 1/2] Revert "all: Add SIXEL support"
- From: Christian Persch <chpe src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [vte/vte-0-62: 1/2] Revert "all: Add SIXEL support"
- Date: Sat, 22 Aug 2020 19:01:22 +0000 (UTC)
commit b11351e19e61a5bf07ddad6587af24211dd7e63c
Author: Christian Persch <chpe src gnome org>
Date: Sat Aug 22 20:54:00 2020 +0200
Revert "all: Add SIXEL support"
This reverts commit 9b879a3c326118ec8bd7657a7ac11d78f084e6c0,
except for the API additions which become no-ops.
doc/reference/vte-sections.txt | 2 -
meson.build | 2 -
meson_options.txt | 7 -
src/app/app.cc | 6 -
src/debug.h | 1 -
src/image.cc | 68 ----
src/image.hh | 102 ------
src/meson.build | 25 --
src/parser-cmd.hh | 2 +-
src/parser-dcs.hh | 2 +-
src/parser-string.hh | 10 -
src/pty.cc | 4 -
src/ring.cc | 223 +-----------
src/ring.hh | 28 --
src/sixel-test.cc | 763 -----------------------------------------
src/sixelparser.cc | 713 --------------------------------------
src/sixelparser.hh | 75 ----
src/vte.cc | 88 +----
src/vtedefines.hh | 2 -
src/vtegtk.cc | 28 +-
src/vteinternal.hh | 21 +-
src/vteseq.cc | 114 +-----
src/widget.hh | 3 -
23 files changed, 26 insertions(+), 2263 deletions(-)
---
diff --git a/doc/reference/vte-sections.txt b/doc/reference/vte-sections.txt
index 28c1c958..c222e7fd 100644
--- a/doc/reference/vte-sections.txt
+++ b/doc/reference/vte-sections.txt
@@ -82,8 +82,6 @@ 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_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/meson.build b/meson.build
index 9033bf1a..decad511 100644
--- a/meson.build
+++ b/meson.build
@@ -124,7 +124,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] + '))')
@@ -506,7 +505,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 += ' Vala: ' + get_option('vapi').to_string() + '\n'
output += '\n'
output += ' Prefix: ' + get_option('prefix') + '\n'
diff --git a/meson_options.txt b/meson_options.txt
index d37be0ab..f8143f77 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -85,13 +85,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 a615fd5b..d8bfe9e1 100644
--- a/src/app/app.cc
+++ b/src/app/app.cc
@@ -69,7 +69,6 @@ public:
gboolean no_scrollbar{false};
gboolean no_shaping{false};
gboolean no_shell{false};
- gboolean no_sixel{false};
gboolean no_systemd_scope{false};
gboolean object_notifications{false};
gboolean require_systemd_scope{false};
@@ -560,8 +559,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,
@@ -574,8 +571,6 @@ public:
"Require use of a systemd user scope", 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 },
{ "transparent", 'T', 0, G_OPTION_ARG_INT, &transparency_percent,
"Enable the use of a transparent background", "0..100" },
{ "verbose", 'v', G_OPTION_FLAG_NO_ARG, G_OPTION_ARG_CALLBACK,
@@ -2118,7 +2113,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_mouse_autohide(window->terminal, true);
vte_terminal_set_rewrap_on_resize(window->terminal, !options.no_rewrap);
vte_terminal_set_scroll_on_output(window->terminal, false);
diff --git a/src/debug.h b/src/debug.h
index a9970f5f..90be5c5f 100644
--- a/src/debug.h
+++ b/src/debug.h
@@ -68,7 +68,6 @@ typedef enum {
VTE_DEBUG_BIDI = 1 << 28,
VTE_DEBUG_CONVERSION = 1 << 29,
VTE_DEBUG_EXCEPTIONS = 1 << 30,
- VTE_DEBUG_IMAGE = 1 << 31,
} VteDebugFlags;
void _vte_debug_init(void);
diff --git a/src/meson.build b/src/meson.build
index 365cf485..087831fa 100644
--- a/src/meson.build
+++ b/src/meson.build
@@ -87,13 +87,6 @@ regex_sources = files(
'regex.hh'
)
-sixel_sources = files(
- 'image.cc',
- 'image.hh',
- 'sixelparser.cc',
- 'sixelparser.hh',
-)
-
systemd_sources = files(
'systemd.cc',
'systemd.hh',
@@ -172,10 +165,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
@@ -470,20 +459,6 @@ test_refptr = executable(
install: false,
)
-if get_option('sixel')
- test_sixel_sources = files(
- 'sixel-test.cc',
- )
-
- test_sixel = executable(
- 'test-sixel',
- sources: test_sixel_sources,
- dependencies: [glib_dep,],
- include_directories: top_inc,
- install: false,
- )
-endif
-
test_tabstops_sources = files(
'tabstops-test.cc',
'tabstops.hh'
diff --git a/src/parser-cmd.hh b/src/parser-cmd.hh
index a94b9d62..f8481dd3 100644
--- a/src/parser-cmd.hh
+++ b/src/parser-cmd.hh
@@ -62,7 +62,6 @@ _VTE_CMD(DECSCUSR) /* set cursor style */
_VTE_CMD(DECSED) /* selective erase in display */
_VTE_CMD(DECSEL) /* selective erase in line */
_VTE_CMD(DECSGR) /* DEC select graphics rendition */
-_VTE_CMD(DECSIXEL) /* SIXEL graphics */
_VTE_CMD(DECSLPP) /* set lines per page */
_VTE_CMD(DECSLRM_OR_SCOSC) /* set left and right margins or SCO save cursor */
_VTE_CMD(DECSR) /* secure reset */
@@ -202,6 +201,7 @@ _VTE_NOP(DECSDPT) /* select digital printed data type */
_VTE_NOP(DECSERA) /* selective erase rectangular area */
_VTE_NOP(DECSEST) /* energy saver time */
_VTE_NOP(DECSFC) /* select flow control */
+_VTE_NOP(DECSIXEL) /* SIXEL graphics */
_VTE_NOP(DECSKCV) /* set key click volume */
_VTE_NOP(DECSLCK) /* set lock key style */
_VTE_NOP(DECSLE) /* select locator events */
diff --git a/src/parser-dcs.hh b/src/parser-dcs.hh
index b2b0b248..6ce2e74f 100644
--- a/src/parser-dcs.hh
+++ b/src/parser-dcs.hh
@@ -24,7 +24,7 @@ _VTE_NOQ(RLOGIN_MML, DCS, 'm', NONE, 1, HASH ) /* RLogin mu
_VTE_NOQ(DECREGIS, DCS, 'p', NONE, 0, NONE ) /* ReGIS-graphics */
_VTE_NOQ(DECRSTS, DCS, 'p', NONE, 1, CASH ) /* restore-terminal-state */
_VTE_NOQ(XTERM_STCAP, DCS, 'p', NONE, 1, PLUS ) /* xterm set termcap/terminfo */
-_VTE_SEQ(DECSIXEL, DCS, 'q', NONE, 0, NONE ) /* SIXEL-graphics */
+_VTE_NOQ(DECSIXEL, DCS, 'q', NONE, 0, NONE ) /* SIXEL-graphics */
_VTE_SEQ(DECRQSS, DCS, 'q', NONE, 1, CASH ) /* request-selection-or-setting */
_VTE_NOQ(XTERM_RQTCAP, DCS, 'q', NONE, 1, PLUS ) /* xterm request termcap/terminfo */
_VTE_NOQ(DECLBAN, DCS, 'r', NONE, 0, NONE ) /* load-banner-message */
diff --git a/src/parser-string.hh b/src/parser-string.hh
index 746051e4..7de37e45 100644
--- a/src/parser-string.hh
+++ b/src/parser-string.hh
@@ -34,17 +34,7 @@ typedef struct vte_seq_string_t {
} vte_seq_string_t;
#define VTE_SEQ_STRING_DEFAULT_CAPACITY (1 << 7) /* must be power of two */
-
-#ifdef WITH_SIXEL
-/* This needs to be somewhat large for the time being; it accommodates inline
- * graphics formats (e.g. sixels), and there is no provision for parsing
- * those incrementally yet. 8M characters is typically enough for an
- * RLE-incompressible 256-color 1920x1080 image. Since VTE seqs store 32 bits
- * per character, this corresponds to a 32MiB buffer. */
-#define VTE_SEQ_STRING_MAX_CAPACITY (1 << 23)
-#else
#define VTE_SEQ_STRING_MAX_CAPACITY (1 << 12)
-#endif
/*
* vte_seq_string_init:
diff --git a/src/pty.cc b/src/pty.cc
index ce77106b..e389758e 100644
--- a/src/pty.cc
+++ b/src/pty.cc
@@ -294,10 +294,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 ae86d23e..2d76d136 100644
--- a/src/ring.cc
+++ b/src/ring.cc
@@ -26,20 +26,6 @@
#include <string.h>
-#ifdef WITH_SIXEL
-
-#include <new>
-
-/* 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.
*/
@@ -51,10 +37,6 @@ _attrcpy (void *dst, void *src)
using namespace vte::base;
-#ifdef WITH_SIXEL
-using namespace vte::image;
-#endif
-
/*
* VteRing: A buffer ring
*/
@@ -104,13 +86,6 @@ Ring::Ring(row_t max_rows,
auto empty_str = g_string_new_len("", 0);
g_ptr_array_add(m_hyperlinks, empty_str);
-#ifdef WITH_SIXEL
- m_image_by_top_map = new (std::nothrow) std::map<int, Image *>();
- m_image_priority_map = new (std::nothrow) std::map<int, Image *>();
- m_next_image_priority = 0;
- m_image_fast_memory_used = 0;
-#endif
-
validate();
}
@@ -121,17 +96,6 @@ Ring::~Ring()
g_free (m_array);
-#ifdef WITH_SIXEL
- /* Clear images */
- auto image_map = m_image_by_top_map;
-
- for (auto it = image_map->begin (); it != image_map->end (); ++it)
- delete it->second;
- image_map->clear();
- delete m_image_by_top_map;
- delete m_image_priority_map;
-#endif /* WITH_SIXEL */
-
if (m_has_streams) {
g_object_unref (m_attr_stream);
g_object_unref (m_text_stream);
@@ -227,107 +191,6 @@ Ring::hyperlink_maybe_gc(row_t increment)
hyperlink_gc();
}
-#ifdef WITH_SIXEL
-
-void
-Ring::image_gc_region()
-{
- cairo_region_t *region = cairo_region_create();
-
- for (auto it = m_image_priority_map->rbegin(); it != m_image_priority_map->rend(); ) {
- Image *image = it->second;
- cairo_rectangle_int_t r;
-
- r.x = image->get_left();
- r.y = image->get_top();
- r.width = image->get_width();
- r.height = image->get_height();
-
- if (cairo_region_contains_rectangle(region, &r) == CAIRO_REGION_OVERLAP_IN) {
- /* 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... */
- it = decltype(it){m_image_priority_map->erase(std::next(it).base())};
- unlink_image_from_top_map(image);
- delete image;
- continue;
- }
-
- cairo_region_union_rectangle(region, &r);
- it++;
- }
-
- cairo_region_destroy(region);
-}
-
-void
-Ring::image_gc()
-{
- while (m_image_fast_memory_used > IMAGE_FAST_MEMORY_USED_MAX
- || m_image_priority_map->size() > IMAGE_FAST_COUNT_MAX) {
- if (m_image_priority_map->empty()) {
- /* If this happens, we've miscounted somehow. */
- break;
- }
-
- Image *image = m_image_priority_map->begin()->second;
- m_image_fast_memory_used -= image->resource_size();
- m_image_priority_map->erase(m_image_priority_map->begin());
- unlink_image_from_top_map(image);
- delete image;
- }
-}
-
-void
-Ring::unlink_image_from_top_map(Image *image)
-{
- for (auto it = m_image_by_top_map->find(image->get_top()); it != m_image_by_top_map->end(); it++) {
- Image *cur_image = it->second;
-
- if (cur_image->get_priority() == image->get_priority()) {
- m_image_by_top_map->erase(it);
- break;
- }
- }
-}
-
-void
-Ring::rebuild_image_top_map()
-{
- m_image_by_top_map->clear();
-
- for (auto it = m_image_priority_map->begin(); it != m_image_priority_map->end(); it++) {
- Image *image = it->second;
- m_image_by_top_map->insert(std::make_pair(image->get_top(), image));
- }
-}
-
-bool
-Ring::rewrap_images_in_range(std::map<int,Image*>::iterator &it,
- size_t text_start_ofs, size_t text_end_ofs, row_t new_row_index)
-{
- for ( ; it != m_image_by_top_map->end(); it++) {
- Image *image = it->second;
- CellTextOffset ofs;
-
- 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.
*
@@ -722,26 +585,12 @@ Ring::reset_streams(row_t position)
Ring::row_t
Ring::reset()
{
-#ifdef WITH_SIXEL
- auto image_map = m_image_by_top_map;
-#endif
-
_vte_debug_print (VTE_DEBUG_RING, "Reseting the ring at %lu.\n", m_end);
reset_streams(m_end);
m_start = m_writable = m_end;
m_cached_row_num = (row_t)-1;
-#ifdef WITH_SIXEL
- /* Clear images */
- for (auto it = image_map->begin (); it != image_map->end (); ++it)
- delete it->second;
- image_map->clear();
- m_image_priority_map->clear();
- m_next_image_priority = 0;
- m_image_fast_memory_used = 0;
-#endif
-
return m_end;
}
@@ -1172,16 +1021,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;
@@ -1193,6 +1033,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())) {
@@ -1213,7 +1055,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;
}
@@ -1325,9 +1167,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;
@@ -1462,17 +1301,10 @@ Ring::rewrap(column_t columns,
" Marker #%d will be
here in row %lu\n", i, new_row_index);
}
}
-
-#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;
col = 0;
-
}
if (paragraph_is_ascii) {
/* Shortcut for quickly wrapping ASCII (excluding TAB) text.
@@ -1516,12 +1348,6 @@ Ring::rewrap(column_t columns,
" Marker #%d will be here in row %lu\n", i,
new_row_index);
}
}
-
-#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;
}
@@ -1554,10 +1380,6 @@ Ring::rewrap(column_t columns,
g_free(marker_text_offsets);
g_free(new_markers);
-#ifdef WITH_SIXEL
- rebuild_image_top_map();
-#endif
-
_vte_debug_print(VTE_DEBUG_RING, "Ring after rewrapping:\n");
validate();
return;
@@ -1661,40 +1483,3 @@ Ring::write_contents(GOutputStream* stream,
return true;
}
-
-#ifdef WITH_SIXEL
-
-/**
- * Ring::append_image:
- * @surface: A Cairo surface object
- * @pixelwidth: Image width in pixels
- * @pixelheight: 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 (cairo_surface_t *surface, gint pixelwidth, gint pixelheight, glong left, glong top,
glong cell_width, glong cell_height)
-{
- Image *image;
-
- image = new (std::nothrow) Image (vte::cairo::Surface(surface),
- m_next_image_priority++,
- pixelwidth, pixelheight,
- left, top,
- cell_width, cell_height);
- if (!image)
- return;
-
- m_image_by_top_map->insert (std::make_pair (image->get_top (), image));
- m_image_priority_map->insert (std::make_pair (image->get_priority (), image));
- 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 85fd7236..87b73645 100644
--- a/src/ring.hh
+++ b/src/ring.hh
@@ -28,11 +28,6 @@
#include "vterowdata.hh"
#include "vtestream.h"
-#ifdef WITH_SIXEL
-#include "image.hh"
-#include <map>
-#endif
-
#include <type_traits>
typedef struct _VteVisualPosition {
@@ -103,15 +98,6 @@ public:
GCancellable* cancellable,
GError** error);
-#ifdef WITH_SIXEL
- void append_image (cairo_surface_t *surface,
- gint pixelwidth, gint pixelheight,
- glong left, glong top,
- glong cell_width, glong cell_height);
- std::map<gint, vte::image::Image *> *m_image_by_top_map;
- std::map<int, vte::image::Image *> *m_image_priority_map;
-#endif
-
private:
#ifdef VTE_DEBUG
@@ -240,20 +226,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
- /* Image bookkeeping */
-
- void image_gc();
- void image_gc_region();
- void unlink_image_from_top_map(vte::image::Image *image);
- void rebuild_image_top_map();
- bool rewrap_images_in_range(std::map<int,vte::image::Image*>::iterator &it,
- size_t text_start_ofs, size_t text_end_ofs, row_t new_row_index);
-
- int m_next_image_priority;
- unsigned int m_image_fast_memory_used;
-#endif /* WITH_SIXEL */
};
}; /* namespace base */
diff --git a/src/vte.cc b/src/vte.cc
index f8592985..829e6630 100644
--- a/src/vte.cc
+++ b/src/vte.cc
@@ -7637,7 +7637,6 @@ Terminal::vadjustment_value_changed()
if (!_vte_double_equal(dy, 0)) {
_vte_debug_print(VTE_DEBUG_ADJ,
"Scrolling by %f\n", dy);
-
invalidate_all();
match_contents_clear();
emit_text_scrolled(dy);
@@ -7745,11 +7744,6 @@ Terminal::Terminal(vte::platform::Widget* w,
save_cursor(&m_normal_screen);
save_cursor(&m_alternate_screen);
-#ifdef WITH_SIXEL
- /* Initialize SIXEL color register */
- sixel_parser_set_default_color(&m_sixel_state);
-#endif
-
/* Matching data. */
m_match_span.clear(); // FIXMEchpe unnecessary
match_hilite_clear(); // FIXMEchpe unnecessary
@@ -8206,11 +8200,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) {
@@ -8228,26 +8218,11 @@ Terminal::draw_cells(vte::view::DrawingContext::TextRequest* items,
break; /* break the run */
}
}
-
-#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);
}
}
@@ -8857,18 +8832,15 @@ 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->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) ||
cell->attr.fragment() ||
cell->attr.invisible()) {
- /* Skip empty or fragment cell, but erase on ' ' and '\t', since
- * it may be overwriting an image. */
+ /* Skip empty or fragment cell. */
lcol++;
continue;
}
@@ -9224,9 +9196,6 @@ Terminal::widget_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;
if (!gdk_cairo_get_clip_rectangle (cr, &clip_rect))
@@ -9254,33 +9223,6 @@ Terminal::widget_draw(cairo_t *cr)
get_color(VTE_DEFAULT_BG), m_background_alpha);
}
-#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 image_map = ring->m_image_priority_map;
- auto it = image_map->begin ();
- for (; it != image_map->end (); ++it) {
- vte::image::Image *image = it->second;
-
- if (image->get_bottom() < top_row
- || image->get_top() > bottom_row)
- continue;
-
- int x = m_padding.left + image->get_left () * m_cell_width;
- int y = m_padding.top + (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 */
-
/* Clip vertically, for the sake of smooth scrolling. We want the top and bottom paddings to be
unused.
* Don't clip horizontally so that antialiasing can legally overflow to the right padding. */
cairo_save(cr);
@@ -9964,12 +9906,6 @@ Terminal::reset(bool clear_tabstops,
m_mouse_smooth_scroll_delta = 0.;
/* Clear modifiers. */
m_modifiers = 0;
-
-#ifdef WITH_SIXEL
- /* Reset SIXEL color register */
- sixel_parser_set_default_color(&m_sixel_state);
-#endif
-
/* Reset the saved cursor. */
save_cursor(&m_normal_screen);
save_cursor(&m_alternate_screen);
diff --git a/src/vtedefines.hh b/src/vtedefines.hh
index 2de3a626..8aa4d9dc 100644
--- a/src/vtedefines.hh
+++ b/src/vtedefines.hh
@@ -143,5 +143,3 @@
#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 936b38b9..39f1c0ba 100644
--- a/src/vtegtk.cc
+++ b/src/vtegtk.cc
@@ -1787,11 +1787,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));
@@ -2071,11 +2067,6 @@ vte_get_features (void) noexcept
"-ICU"
#endif
" "
-#ifdef WITH_SIXEL
- "+SIXEL"
-#else
- "-SIXEL"
-#endif
#ifdef __linux__
" "
#ifdef WITH_SYSTEMD
@@ -2106,9 +2097,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 |
@@ -5627,7 +5615,7 @@ catch (...)
* @terminal: a #VteTerminal
* @enabled: whether to enable SIXEL images
*
- * Set whether to enable SIXEL images.
+ * This function does nothing.
*
* Since: 0.62
*/
@@ -5636,12 +5624,6 @@ 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 (...)
{
@@ -5652,7 +5634,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
*/
@@ -5660,13 +5642,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 8c510912..bc75888e 100644
--- a/src/vteinternal.hh
+++ b/src/vteinternal.hh
@@ -48,7 +48,6 @@
#include "vtepcre2.h"
#include "vteregexinternal.hh"
-#include "sixelparser.hh"
#include "chunk.hh"
#include "pty.hh"
@@ -753,22 +752,6 @@ public:
this),
"mouse-autoscroll-timer"};
- /* Inline images */
- 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;
- 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++; }
@@ -1526,7 +1509,6 @@ public:
bool set_scrollback_lines(long lines);
bool set_scroll_on_keystroke(bool scroll);
bool set_scroll_on_output(bool scroll);
- bool set_images_enabled(bool enabled);
bool set_word_char_exceptions(std::optional<std::string_view> stropt);
void set_clear_background(bool setting);
@@ -1580,8 +1562,7 @@ public:
inline vte::grid::column_t get_cursor_column_unclamped() const;
inline void move_cursor_up(vte::grid::row_t rows);
inline void move_cursor_down(vte::grid::row_t rows);
- inline void erase_characters(long count,
- bool use_basic = false);
+ inline void erase_characters(long count);
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 f2d1e524..ba9a2df6 100644
--- a/src/vteseq.cc
+++ b/src/vteseq.cc
@@ -945,8 +945,7 @@ Terminal::move_cursor_down(vte::grid::row_t rows)
}
void
-Terminal::erase_characters(long count,
- bool use_basic)
+Terminal::erase_characters(long count)
{
VteCell *cell;
long col, i;
@@ -969,10 +968,10 @@ Terminal::erase_characters(long count,
/* Replace this cell with the current
* defaults. */
cell = _vte_row_data_get_writable (rowdata, col);
- *cell = use_basic ? basic_cell : m_color_defaults;
+ *cell = m_color_defaults;
} else {
/* Add new cells until we have one here. */
- _vte_row_data_fill (rowdata, use_basic ? &basic_cell :
&m_color_defaults, col + 1);
+ _vte_row_data_fill (rowdata, &m_color_defaults, col + 1);
}
}
}
@@ -2377,11 +2376,7 @@ Terminal::DA1(vte::parser::Sequence const& seq)
if (seq.collect1(0, 0) != 0)
return;
- reply(seq, VTE_REPLY_DECDA1R, {65, 1,
-#ifdef WITH_SIXEL
- 4,
-#endif
- 9});
+ reply(seq, VTE_REPLY_DECDA1R, {65, 1, 9});
}
void
@@ -4338,105 +4333,6 @@ Terminal::DECSIXEL(vte::parser::Sequence const& seq)
*
* References: VT330
*/
-
-#ifdef WITH_SIXEL
- if (!m_sixel_enabled)
- return;
-
- unsigned char *pixels = NULL;
- auto fg = get_color(VTE_DEFAULT_FG);
- auto bg = get_color(VTE_DEFAULT_BG);
- int nfg = (fg->red >> 8) | ((fg->green >> 8) << 8) | ((fg->blue >> 8) << 16);
- int nbg = (bg->red >> 8) | ((bg->green >> 8) << 8) | ((bg->blue >> 8) << 16);
- glong left, top, width, height;
- glong pixelwidth, pixelheight;
- glong i;
- cairo_surface_t *image_surface, *surface;
- cairo_t *cr;
-
- /* This is unfortunate, but it avoids copying or measuring potentially
- * megabytes of data */
- const vte_seq_string_t *arg_str = &((*((vte::parser::Sequence &) seq).seq_ptr())->arg_str);
-
- /* Parse image */
-
- if (sixel_parser_init(&m_sixel_state, nfg, nbg,
- m_modes_private.XTERM_SIXEL_PRIVATE_COLOR_REGISTERS()) < 0) {
- sixel_parser_deinit(&m_sixel_state);
- return;
- }
- if (sixel_parser_feed(&m_sixel_state, arg_str->buf, arg_str->len) < 0) {
- sixel_parser_deinit(&m_sixel_state);
- return;
- }
- pixels = (unsigned char *)g_try_malloc(m_sixel_state.image.width * m_sixel_state.image.height * 4);
- if (!pixels) {
- sixel_parser_deinit(&m_sixel_state);
- return;
- }
- if (sixel_parser_finalize(&m_sixel_state, pixels) < 0) {
- g_free(pixels);
- sixel_parser_deinit(&m_sixel_state);
- return;
- }
- sixel_parser_deinit(&m_sixel_state);
-
- /* Calculate geometry */
-
- left = m_screen->cursor.col;
- top = m_screen->cursor.row;
- width = (m_sixel_state.image.width + m_cell_width - 1) / m_cell_width;
- height = (m_sixel_state.image.height + m_cell_height - 1) / m_cell_height;
- pixelwidth = m_sixel_state.image.width;
- pixelheight = m_sixel_state.image.height;
-
- /* Convert to device-compatible surface for m_widget */
-
- image_surface = cairo_image_surface_create_for_data(pixels, CAIRO_FORMAT_ARGB32, pixelwidth,
pixelheight, pixelwidth * 4);
- if (!image_surface) {
- g_free(pixels);
- return;
- }
-
- surface = gdk_window_create_similar_surface(gtk_widget_get_window (m_widget),
CAIRO_CONTENT_COLOR_ALPHA, pixelwidth, pixelheight);
- if (!surface) {
- cairo_surface_destroy(image_surface);
- g_free(pixels);
- return;
- }
-
- cr = cairo_create(surface);
- cairo_set_source_surface(cr, image_surface, 0, 0);
- cairo_paint(cr);
- cairo_destroy(cr);
- cairo_surface_destroy(image_surface);
- g_free(pixels);
-
- /* Append image to Ring */
-
- m_screen->row_data->append_image(surface, pixelwidth, pixelheight, left, top, m_cell_width,
m_cell_height);
-
- /* Erase characters under the image */
-
- for (i = 0; i < height; ++i) {
- vte::grid::row_t row = top + i;
-
- erase_characters(width, true);
-
- if (row > m_screen->insert_delta - 1
- && row < m_screen->insert_delta + m_row_count)
- set_hard_wrapped(row);
-
- if (i == height - 1) {
- if (m_modes_private.MINTTY_SIXEL_SCROLL_CURSOR_RIGHT())
- move_cursor_forward(width);
- else
- cursor_down(true);
- } else {
- cursor_down(true);
- }
- }
-#endif /* WITH_SIXEL */
}
void
@@ -5490,7 +5386,7 @@ Terminal::ECH(vte::parser::Sequence const& seq)
// FIXMEchpe limit to column_count - cursor.x ?
auto const count = seq.collect1(0, 1, 1, int(65535));
- erase_characters(count, false);
+ erase_characters(count);
}
void
diff --git a/src/widget.hh b/src/widget.hh
index d870135c..0025d5bb 100644
--- a/src/widget.hh
+++ b/src/widget.hh
@@ -177,9 +177,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(); }
-
protected:
enum class CursorType {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]