[vte] emulation: sixel: Implement DECSET 1070
- From: Christian Persch <chpe src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [vte] emulation: sixel: Implement DECSET 1070
- Date: Fri, 23 Oct 2020 18:18:10 +0000 (UTC)
commit 4b2c688dde8b239ec2af1e7d709893a328737e5f
Author: Christian Persch <chpe src gnome org>
Date: Fri Oct 23 20:16:55 2020 +0200
emulation: sixel: Implement DECSET 1070
Private mode 1070 controls whether each SIXEL image gets a freshly initialised
set of colour registers, or if changes from one SIXEL image persist to the next.
src/modes-private.hh | 13 ++++++++++++-
src/modes.hh | 5 ++++-
src/vte.cc | 10 ++++++++++
src/vteinternal.hh | 1 +
src/vteseq.cc | 4 +++-
5 files changed, 30 insertions(+), 3 deletions(-)
---
diff --git a/src/modes-private.hh b/src/modes-private.hh
index 255a968e..6bd0ca9b 100644
--- a/src/modes-private.hh
+++ b/src/modes-private.hh
@@ -163,6 +163,18 @@ MODE(XTERM_SAVE_CURSOR, 1048)
MODE(XTERM_OPT_ALTBUF_SAVE_CURSOR, 1049)
MODE(XTERM_READLINE_BRACKETED_PASTE, 2004)
+/*
+ * XTERM_SIXEL_PRIVATE_COLOR_REGISTERS:
+ * When set, each SIXEL graphic uses newly initialised colour registers.
+ * When reset, changes to colour registers from one SIXEL image are
+ * saved and used for the next SIXEL graphic.
+ *
+ * Default: set
+ *
+ * References: XTERM
+ */
+MODE(XTERM_SIXEL_PRIVATE_COLOR_REGISTERS, 1070)
+
/* Not supported modes: */
/* DEC */
@@ -858,7 +870,6 @@ MODE_FIXED(XTERM_FKEYS_HP, 1052, ALWAYS_RESET)
MODE_FIXED(XTERM_FKEYS_SCO, 1053, ALWAYS_RESET)
MODE_FIXED(XTERM_FKEYS_LEGACY, 1060, ALWAYS_RESET)
MODE_FIXED(XTERM_FKEYS_VT220, 1061, ALWAYS_RESET)
-MODE_FIXED(XTERM_SIXEL_PRIVATE_COLOR_REGISTERS, 1070, ALWAYS_SET)
MODE_FIXED(XTERM_READLINE_BUTTON1_MOVE_POINT, 2001, ALWAYS_RESET)
MODE_FIXED(XTERM_READLINE_BUTTON2_MOVE_POINT, 2002, ALWAYS_RESET)
MODE_FIXED(XTERM_READLINE_DBLBUTTON3_DELETE, 2003, ALWAYS_RESET)
diff --git a/src/modes.hh b/src/modes.hh
index 398155de..9ddf7429 100644
--- a/src/modes.hh
+++ b/src/modes.hh
@@ -239,7 +239,10 @@ public:
eDECSDM,
eVTE_BIDI_SWAP_ARROW_KEYS,
eXTERM_ALTBUF_SCROLL,
- eXTERM_META_SENDS_ESCAPE} { }
+ eXTERM_META_SENDS_ESCAPE,
+ eXTERM_SIXEL_PRIVATE_COLOR_REGISTERS}
+ {
+ }
inline void push_saved(int mode)
{
diff --git a/src/vte.cc b/src/vte.cc
index 855ca454..2a5c8bd6 100644
--- a/src/vte.cc
+++ b/src/vte.cc
@@ -9812,6 +9812,15 @@ 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
@@ -9936,6 +9945,7 @@ Terminal::reset(bool clear_tabstops,
* clear (assign to black) all SIXEL colour registers.
* (DEC PPLV2 ยง 5.8)
*/
+ reset_graphics_color_registers();
}
void
diff --git a/src/vteinternal.hh b/src/vteinternal.hh
index 7fb233c6..57895de3 100644
--- a/src/vteinternal.hh
+++ b/src/vteinternal.hh
@@ -951,6 +951,7 @@ 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);
diff --git a/src/vteseq.cc b/src/vteseq.cc
index 461ef3c8..ecdc6974 100644
--- a/src/vteseq.cc
+++ b/src/vteseq.cc
@@ -478,7 +478,7 @@ Terminal::update_mouse_protocol() noexcept
void
Terminal::set_mode_private(int mode,
- bool set) noexcept
+ bool set) noexcept
{
/* Pre actions */
switch (mode) {
@@ -4118,6 +4118,8 @@ Terminal::DECSCL(vte::parser::Sequence const& seq)
break;
}
#endif
+
+ reset_graphics_color_registers();
}
void
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]