[vte] emulation: Fix DA1 response with SIXEL disabled



commit ea72547c12f27f05b0622f510c2d5ac32512bac5
Author: Christian Persch <chpe src gnome org>
Date:   Mon Oct 19 00:16:36 2020 +0200

    emulation: Fix DA1 response with SIXEL disabled
    
    Omit SIXEL from the DA1 response when SIXEL is enabled at build time
    but disabled at runtime.

 src/parser-glue.hh | 27 +++++++++++++++++++++++++--
 src/vteseq.cc      |  2 +-
 2 files changed, 26 insertions(+), 3 deletions(-)
---
diff --git a/src/parser-glue.hh b/src/parser-glue.hh
index 0b1ba213..8813b710 100644
--- a/src/parser-glue.hh
+++ b/src/parser-glue.hh
@@ -540,17 +540,40 @@ public:
                 m_seq.args[m_seq.n_args++] = vte_seq_arg_init(std::min(p, 0xffff));
         }
 
+        /*
+         * append_parms:
+         * @params:
+         *
+         * Appends the parameters from @params to @this. Parameter values must be
+         * in the range -1..MAXUSHORT; use -2 to skip a parameter
+         *
+         */
         inline void append_params(std::initializer_list<int> params) noexcept
         {
                 assert(m_seq.n_args + params.size() <= (sizeof(m_seq.args) / sizeof(m_seq.args[0])));
-                for (int p : params)
+                for (auto p : params) {
+                        if (p == -2)
+                                continue;
+
                         m_seq.args[m_seq.n_args++] = vte_seq_arg_init(std::min(p, 0xffff));
+                }
         }
 
+        /*
+         * append_subparms:
+         * @subparams:
+         *
+         * Appends the subparameters from @params to @this. Subparameter values must be
+         * in the range -1..MAXUSHORT; use -2 to skip a subparameter
+         *
+         */
         inline void append_subparams(std::initializer_list<int> subparams) noexcept
         {
                 assert(m_seq.n_args + subparams.size() <= (sizeof(m_seq.args) / sizeof(m_seq.args[0])));
-                for (int p : subparams) {
+                for (auto p : subparams) {
+                        if (p == -2)
+                                continue;
+
                         int* arg = &m_seq.args[m_seq.n_args++];
                         *arg = vte_seq_arg_init(std::min(p, 0xffff));
                         vte_seq_arg_finish(arg, false);
diff --git a/src/vteseq.cc b/src/vteseq.cc
index 4f2d6b83..b0e5fbe4 100644
--- a/src/vteseq.cc
+++ b/src/vteseq.cc
@@ -2379,7 +2379,7 @@ Terminal::DA1(vte::parser::Sequence const& seq)
 
         reply(seq, VTE_REPLY_DECDA1R, {65, 1,
 #ifdef WITH_SIXEL
-                                       4,
+                                       m_sixel_enabled ? 4 : -2 /* skip */,
 #endif
                                        9});
 }


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