summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Persch <chpe@src.gnome.org>2023-03-08 20:36:48 +0100
committerChristian Persch <chpe@src.gnome.org>2023-03-08 20:36:48 +0100
commitfb3220bee959d37f58daf702165f142ef9fab9f4 (patch)
tree7646df3d003c5bc730e78d74b8deae746795831f
parent75543c3b30dbf696b084e927dabbf52a41d32638 (diff)
downloadvte-fb3220bee959d37f58daf702165f142ef9fab9f4.tar.gz
all: Use defined values for defines
... instead of defined/undefined names, so that -Wundef can catch mistakes.
-rw-r--r--meson.build16
-rw-r--r--src/app/app.cc4
-rw-r--r--src/bidi.cc14
-rw-r--r--src/bidi.hh4
-rw-r--r--src/cxx-utils.hh2
-rw-r--r--src/debug.cc8
-rw-r--r--src/debug.h4
-rw-r--r--src/decoder-cat.cc12
-rw-r--r--src/fonts-pangocairo.cc8
-rw-r--r--src/fonts-pangocairo.hh2
-rw-r--r--src/glib-glue.cc8
-rw-r--r--src/glib-glue.hh8
-rw-r--r--src/keymap.cc2
-rw-r--r--src/missing.cc6
-rw-r--r--src/missing.hh6
-rw-r--r--src/parser-cat.cc38
-rw-r--r--src/pty.cc2
-rw-r--r--src/reflect.c4
-rw-r--r--src/ring.cc20
-rw-r--r--src/ring.hh6
-rw-r--r--src/sixel-context.cc4
-rw-r--r--src/spawn.cc6
-rw-r--r--src/vte.cc56
-rw-r--r--src/vtegtk.cc46
-rw-r--r--src/vteinternal.hh29
-rw-r--r--src/vteseq.cc12
-rw-r--r--src/vtestream-file.h16
-rw-r--r--src/vtetypes.cc10
-rw-r--r--src/vtetypes.hh2
-rw-r--r--src/widget.cc2
30 files changed, 177 insertions, 180 deletions
diff --git a/meson.build b/meson.build
index c2b10873..8db3189b 100644
--- a/meson.build
+++ b/meson.build
@@ -182,12 +182,12 @@ config_h = configuration_data()
config_h.set_quoted('GETTEXT_PACKAGE', vte_gettext_domain)
config_h.set_quoted('VERSION', vte_version)
-config_h.set('VTE_DEBUG', enable_debug)
-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'))
+config_h.set10('VTE_DEBUG', enable_debug)
+config_h.set10('WITH_A11Y', get_option('a11y'))
+config_h.set10('WITH_FRIBIDI', get_option('fribidi'))
+config_h.set10('WITH_GNUTLS', get_option('gnutls'))
+config_h.set10('WITH_ICU', get_option('icu'))
+config_h.set10('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] + '))')
@@ -423,7 +423,7 @@ foreach func: check_functions
if __reqd
assert(__have, __name + ' not found')
else
- config_h.set('HAVE_' + __name.underscorify().to_upper(), __have)
+ config_h.set10('HAVE_' + __name.underscorify().to_upper(), __have)
endif
endforeach
@@ -644,7 +644,7 @@ else
systemd_dep = dependency('', required: false)
endif
-config_h.set('WITH_SYSTEMD', systemd_dep.found())
+config_h.set10('WITH_SYSTEMD', systemd_dep.found())
# Write config.h
diff --git a/src/app/app.cc b/src/app/app.cc
index 9809af61..e574a272 100644
--- a/src/app/app.cc
+++ b/src/app/app.cc
@@ -766,7 +766,7 @@ public:
"Use a GtkScrolledWindow", nullptr },
{ "shell", 'S', G_OPTION_FLAG_REVERSE | G_OPTION_FLAG_HIDDEN,
G_OPTION_ARG_NONE, &no_shell, nullptr, nullptr },
-#ifdef VTE_DEBUG
+#if VTE_DEBUG
{ "test-mode", 0, 0, G_OPTION_ARG_NONE, &test_mode,
"Enable test mode", nullptr },
#endif
@@ -3159,7 +3159,7 @@ main(int argc,
gdk_window_set_debug_updates(true);
#endif /* VTE_GTK == 3 */
-#ifdef VTE_DEBUG
+#if VTE_DEBUG
if (options.test_mode) {
vte_set_test_flags(VTE_TEST_FLAGS_ALL);
options.allow_window_ops = true;
diff --git a/src/bidi.cc b/src/bidi.cc
index 7adf74a4..76f0fcb3 100644
--- a/src/bidi.cc
+++ b/src/bidi.cc
@@ -42,7 +42,7 @@
#include <config.h>
-#ifdef WITH_FRIBIDI
+#if WITH_FRIBIDI
#include <fribidi.h>
#endif
@@ -51,7 +51,7 @@
#include "vtedefines.hh"
#include "vteinternal.hh"
-#ifdef WITH_FRIBIDI
+#if WITH_FRIBIDI
static_assert (sizeof (FriBidiChar) == sizeof (gunichar), "Unexpected FriBidiChar size");
#endif
@@ -178,7 +178,7 @@ BidiRow::vis_get_shaped_char(vte::grid::column_t col, vteunistr s) const
}
-#ifdef WITH_FRIBIDI
+#if WITH_FRIBIDI
static inline bool
is_arabic(gunichar c)
{
@@ -349,7 +349,7 @@ BidiRunner::explicit_line(vte::grid::row_t row, bool rtl, bool do_shaping)
}
}
-#ifdef WITH_FRIBIDI
+#if WITH_FRIBIDI
if (do_shaping)
explicit_line_shape(row);
#endif
@@ -374,7 +374,7 @@ BidiRunner::paragraph(vte::grid::row_t start, vte::grid::row_t end,
return;
}
-#ifdef WITH_FRIBIDI
+#if WITH_FRIBIDI
/* Have a consistent limit on the number of rows in a paragraph
* that can get implicit BiDi treatment, which is independent from
* the current scroll position. */
@@ -399,7 +399,7 @@ BidiRunner::explicit_paragraph(vte::grid::row_t start, vte::grid::row_t end,
}
}
-#ifdef WITH_FRIBIDI
+#if WITH_FRIBIDI
/* Figure out the mapping for the implicit paragraph between the given rows.
* Returns success. */
bool
@@ -766,7 +766,7 @@ vte_bidi_get_mirror_char (vteunistr unistr, gboolean mirror_box_drawing, vteunis
if (G_UNLIKELY (mirror_box_drawing))
base_ch_mirrored = 0x2500 + mirrored_2500[base_ch - 0x2500];
} else {
-#ifdef WITH_FRIBIDI
+#if WITH_FRIBIDI
/* Prefer the FriBidi variant as that's more likely to be in sync with the rest of our BiDi stuff. */
fribidi_get_mirror_char (base_ch, &base_ch_mirrored);
#else
diff --git a/src/bidi.hh b/src/bidi.hh
index 5faec854..7b69dc12 100644
--- a/src/bidi.hh
+++ b/src/bidi.hh
@@ -98,13 +98,13 @@ public:
private:
RingView *m_ringview;
-#ifdef WITH_FRIBIDI
+#if WITH_FRIBIDI
void explicit_line_shape(vte::grid::row_t row);
#endif
void explicit_line(vte::grid::row_t row, bool rtl, bool do_shaping);
void explicit_paragraph(vte::grid::row_t start, vte::grid::row_t end, bool rtl, bool do_shaping);
-#ifdef WITH_FRIBIDI
+#if WITH_FRIBIDI
bool implicit_paragraph(vte::grid::row_t start, vte::grid::row_t end, bool do_shaping);
#endif
};
diff --git a/src/cxx-utils.hh b/src/cxx-utils.hh
index cc2b2215..c74c0f3a 100644
--- a/src/cxx-utils.hh
+++ b/src/cxx-utils.hh
@@ -46,7 +46,7 @@ inline constexpr auto to_integral(E e) noexcept
return static_cast<std::underlying_type_t<E>>(e);
}
-#ifdef VTE_DEBUG
+#if VTE_DEBUG
void log_exception(char const* func = __builtin_FUNCTION(),
char const* filename = __builtin_FILE(),
int const line = __builtin_LINE()) noexcept;
diff --git a/src/debug.cc b/src/debug.cc
index 4185a57a..2d56f085 100644
--- a/src/debug.cc
+++ b/src/debug.cc
@@ -27,7 +27,7 @@ guint _vte_debug_flags;
void
_vte_debug_init(void)
{
-#ifdef VTE_DEBUG
+#if VTE_DEBUG
const GDebugKey keys[] = {
{ "misc", VTE_DEBUG_MISC },
{ "io", VTE_DEBUG_IO },
@@ -73,7 +73,7 @@ const char *
_vte_debug_sequence_to_string(const char *str,
gssize length)
{
-#if defined(VTE_DEBUG)
+#if VTE_DEBUG
static const char codes[][6] = {
"NUL", "SOH", "STX", "ETX", "EOT", "ENQ", "ACK", "BEL",
"BS", "HT", "LF", "VT", "FF", "CR", "SO", "SI",
@@ -126,7 +126,7 @@ _vte_debug_sequence_to_string(const char *str,
#endif /* VTE_DEBUG */
}
-#ifdef VTE_DEBUG
+#if VTE_DEBUG
static bool
hexdump_line(GString* str,
size_t ofs,
@@ -157,7 +157,7 @@ _vte_debug_hexdump(char const* str,
uint8_t const* buf,
size_t len)
{
-#ifdef VTE_DEBUG
+#if VTE_DEBUG
GString* s = g_string_new(str);
g_string_append_printf(s, " len = 0x%x = %u\n", (unsigned int)len, (unsigned int)len);
diff --git a/src/debug.h b/src/debug.h
index da1d51d8..7b02a896 100644
--- a/src/debug.h
+++ b/src/debug.h
@@ -87,13 +87,13 @@ _vte_debug_on(guint flags)
return (_vte_debug_flags & flags) != 0;
}
-#ifdef VTE_DEBUG
+#if VTE_DEBUG
#define _VTE_DEBUG_IF(flags) if (G_UNLIKELY (_vte_debug_on (flags)))
#else
#define _VTE_DEBUG_IF(flags) if (0)
#endif
-#ifdef VTE_DEBUG
+#if VTE_DEBUG
#if defined(__GNUC__) && G_HAVE_GNUC_VARARGS
#define _vte_debug_print(flags, fmt, ...) \
G_STMT_START { _VTE_DEBUG_IF(flags) g_printerr(fmt, ##__VA_ARGS__); } G_STMT_END
diff --git a/src/decoder-cat.cc b/src/decoder-cat.cc
index 79fda186..5d6e943f 100644
--- a/src/decoder-cat.cc
+++ b/src/decoder-cat.cc
@@ -36,7 +36,7 @@
#include "libc-glue.hh"
#include "utf8.hh"
-#ifdef WITH_ICU
+#if WITH_ICU
#include "icu-decoder.hh"
#include "icu-glue.hh"
#endif
@@ -214,7 +214,7 @@ public:
}; // class Sink
-#ifdef WITH_ICU
+#if WITH_ICU
static std::unique_ptr<vte::base::ICUDecoder>
make_decoder(Options const& options)
@@ -320,7 +320,7 @@ private:
g_free(buf);
}
-#ifdef WITH_ICU
+#if WITH_ICU
template<class Functor>
void
process_file_icu(int fd,
@@ -394,7 +394,7 @@ private:
Options const& options,
Functor& func)
{
-#ifdef WITH_ICU
+#if WITH_ICU
auto decoder = std::unique_ptr<vte::base::ICUDecoder>{};
if (options.charset()) {
decoder = make_decoder(options);
@@ -412,7 +412,7 @@ private:
return false;
}
-#ifdef WITH_ICU
+#if WITH_ICU
if (decoder) {
process_file_icu(fd, options, decoder.get(), func);
} else
@@ -528,7 +528,7 @@ main(int argc,
}
if (options.list()) {
-#ifdef WITH_ICU
+#if WITH_ICU
auto charsets = vte::base::get_icu_charsets(true);
for (auto i = 0; charsets[i]; ++i)
g_print("%s\n", charsets[i]);
diff --git a/src/fonts-pangocairo.cc b/src/fonts-pangocairo.cc
index 91ed62f3..803a9438 100644
--- a/src/fonts-pangocairo.cc
+++ b/src/fonts-pangocairo.cc
@@ -157,13 +157,13 @@ FontInfo::cache_ascii()
ufi->using_cairo_glyph.scaled_font = cairo_scaled_font_reference (scaled_font);
ufi->using_cairo_glyph.glyph_index = glyph;
-#ifdef VTE_DEBUG
+#if VTE_DEBUG
m_coverage_count[0]++;
m_coverage_count[(unsigned)uinfo->coverage()]++;
#endif
}
-#ifdef VTE_DEBUG
+#if VTE_DEBUG
_vte_debug_print (VTE_DEBUG_PANGOCAIRO,
"vtepangocairo: %p cached %d ASCII letters\n",
(void*)this, m_coverage_count[0]);
@@ -278,7 +278,7 @@ FontInfo::~FontInfo()
g_hash_table_remove(s_font_info_for_context,
pango_layout_get_context(m_layout.get()));
-#ifdef VTE_DEBUG
+#if VTE_DEBUG
_vte_debug_print (VTE_DEBUG_PANGOCAIRO,
"vtepangocairo: %p freeing font_info. coverages %d = %d + %d + %d\n",
(void*)this,
@@ -534,7 +534,7 @@ FontInfo::get_unistr_info(vteunistr c)
/* release internal layout resources */
pango_layout_set_text(m_layout.get(), "", -1);
-#ifdef VTE_DEBUG
+#if VTE_DEBUG
m_coverage_count[0]++;
m_coverage_count[uinfo->m_coverage]++;
#endif
diff --git a/src/fonts-pangocairo.hh b/src/fonts-pangocairo.hh
index 587e6421..da5faa2e 100644
--- a/src/fonts-pangocairo.hh
+++ b/src/fonts-pangocairo.hh
@@ -261,7 +261,7 @@ private:
// FIXME: use std::string
GString* m_string{nullptr};
-#ifdef VTE_DEBUG
+#if VTE_DEBUG
/* profiling info */
int m_coverage_count[4]{0, 0, 0, 0};
#endif
diff --git a/src/glib-glue.cc b/src/glib-glue.cc
index e4903f3b..190c879b 100644
--- a/src/glib-glue.cc
+++ b/src/glib-glue.cc
@@ -56,7 +56,7 @@ exception_append_to_string(std::exception const& e,
}
}
-#ifdef VTE_DEBUG
+#if VTE_DEBUG
void log_exception(char const* func,
char const* filename,
@@ -123,7 +123,7 @@ catch (...)
namespace glib {
bool set_error_from_exception(GError** error
-#ifdef VTE_DEBUG
+#if VTE_DEBUG
, char const* func
, char const* filename
, int const line
@@ -143,7 +143,7 @@ try
what = "Unknown exception"sv;
}
-#ifdef VTE_DEBUG
+#if VTE_DEBUG
auto msg = vte::glib::take_string(g_strdup_printf("Caught exception in %s [%s:%d]: %s",
func, filename, line,
what.c_str()));
@@ -163,7 +163,7 @@ try
catch (...)
{
vte::log_exception();
-#ifdef VTE_DEBUG
+#if VTE_DEBUG
g_set_error(error,
VTE_EXCEPTION_ERROR,
VTE_EXCEPTION_GENERIC,
diff --git a/src/glib-glue.hh b/src/glib-glue.hh
index b3a97858..1897b5cb 100644
--- a/src/glib-glue.hh
+++ b/src/glib-glue.hh
@@ -133,7 +133,7 @@ public:
Timer(callback_type callback,
char const* name)
: m_callback(callback)
-#ifdef VTE_DEBUG
+#if VTE_DEBUG
, m_name(name)
#endif
{
@@ -208,7 +208,7 @@ public:
private:
callback_type m_callback{};
-#ifdef VTE_DEBUG
+#if VTE_DEBUG
char const* m_name{nullptr};
#endif
guint m_source_id{0};
@@ -241,7 +241,7 @@ private:
inline void set_source_name() const noexcept
{
- #ifdef VTE_DEBUG
+ #if VTE_DEBUG
g_source_set_name_by_id(m_source_id, m_name);
#endif
}
@@ -267,7 +267,7 @@ private:
};
bool set_error_from_exception(GError** error
-#ifdef VTE_DEBUG
+#if VTE_DEBUG
, char const* func = __builtin_FUNCTION()
, char const* filename = __builtin_FILE()
, int const line = __builtin_LINE()
diff --git a/src/keymap.cc b/src/keymap.cc
index 6c82d96a..00fad07a 100644
--- a/src/keymap.cc
+++ b/src/keymap.cc
@@ -29,7 +29,7 @@
#include "debug.h"
#include "keymap.h"
-#ifdef VTE_DEBUG
+#if VTE_DEBUG
static void
_vte_keysym_print(guint keyval,
guint modifiers)
diff --git a/src/missing.cc b/src/missing.cc
index ebaba4e1..c769fb40 100644
--- a/src/missing.cc
+++ b/src/missing.cc
@@ -44,7 +44,7 @@
* Copyright 2000 Red Hat, Inc.
*/
-#ifndef HAVE_FDWALK
+#if !HAVE_FDWALK
#ifdef __linux__
@@ -140,7 +140,7 @@ getrlimit_NOFILE_max(void)
return RLIM_INFINITY;
}
-#ifndef HAVE_CLOSE_RANGE
+#if !HAVE_CLOSE_RANGE
int
close_range(unsigned int first_fd,
@@ -257,7 +257,7 @@ fdwalk(int (*cb)(void *data, int fd),
}
#endif /* !HAVE_FDWALK */
-#ifndef HAVE_STRCHRNUL
+#if !HAVE_STRCHRNUL
/* Copied from glib */
char*
strchrnul(char const* s,
diff --git a/src/missing.hh b/src/missing.hh
index 0d92f4c7..9dd4c4b1 100644
--- a/src/missing.hh
+++ b/src/missing.hh
@@ -43,17 +43,17 @@
#define NSIG (8 * sizeof(sigset_t))
#endif
-#ifndef HAVE_FDWALK
+#if !HAVE_FDWALK
int fdwalk(int (*cb)(void* data, int fd),
void* data);
#endif
-#ifndef HAVE_STRCHRNUL
+#if !HAVE_STRCHRNUL
char* strchrnul(char const* s,
int c);
#endif
-#ifndef HAVE_CLOSE_RANGE
+#if !HAVE_CLOSE_RANGE
int close_range(unsigned int first,
unsigned int last,
unsigned int flags);
diff --git a/src/parser-cat.cc b/src/parser-cat.cc
index 5fade9db..973ecdd2 100644
--- a/src/parser-cat.cc
+++ b/src/parser-cat.cc
@@ -40,7 +40,7 @@
#include "utf8.hh"
#include "vtedefines.hh"
-#ifdef WITH_SIXEL
+#if WITH_SIXEL
#include "sixel-parser.hh"
#endif
@@ -58,7 +58,7 @@ enum class DataSyntax {
ECMA48_UTF8,
/* ECMA48_PCTERM, */
/* ECMA48_ECMA35, */
- #ifdef WITH_SIXEL
+ #if WITH_SIXEL
DECSIXEL,
#endif
};
@@ -154,7 +154,7 @@ private:
std::string m_str;
bool m_plain;
bool m_codepoints;
-#ifdef WITH_SIXEL
+#if WITH_SIXEL
char32_t m_sixel_st;
#endif
@@ -389,7 +389,7 @@ private:
}
}
-#ifdef WITH_SIXEL
+#if WITH_SIXEL
void
print_params(vte::sixel::Sequence const& seq) noexcept
@@ -463,7 +463,7 @@ public:
printout();
}
-#ifdef WITH_SIXEL
+#if WITH_SIXEL
void SIXEL_CMD(vte::sixel::Sequence const& seq) noexcept
{
@@ -494,7 +494,7 @@ public:
void enter_data_syntax(DataSyntax syntax) noexcept
{
switch (syntax) {
-#ifdef WITH_SIXEL
+#if WITH_SIXEL
case DataSyntax::DECSIXEL: {
GreenAttr green(this);
print_literal("<SIXEL[");
@@ -511,7 +511,7 @@ public:
bool success) noexcept
{
switch (syntax) {
-#ifdef WITH_SIXEL
+#if WITH_SIXEL
case DataSyntax::DECSIXEL:
if (success) {
GreenAttr green(this);
@@ -718,7 +718,7 @@ private:
}
}
-#ifdef WITH_SIXEL
+#if WITH_SIXEL
char32_t m_sixel_st{0};
bool m_seen_sixel_commands{false};
bool m_seen_sixel_data{false};
@@ -753,7 +753,7 @@ public:
check_sgr(seq);
break;
-#ifdef WITH_SIXEL
+#if WITH_SIXEL
case VTE_CMD_DECSIXEL:
/* OR mode is a nonstandard NetBSD/x68k extension that is
* not supported in VTE.
@@ -776,7 +776,7 @@ public:
}
}
-#ifdef WITH_SIXEL
+#if WITH_SIXEL
void SIXEL(uint8_t raw) noexcept
{
@@ -894,7 +894,7 @@ public:
void enter_data_syntax(DataSyntax syntax) noexcept
{
switch (syntax) {
-#ifdef WITH_SIXEL
+#if WITH_SIXEL
case DataSyntax::DECSIXEL:
m_sixel_st = 0;
m_seen_sixel_commands = m_seen_sixel_data = false;
@@ -922,7 +922,7 @@ class Sink {
public:
void VT(vte::parser::Sequence const& seq) noexcept { }
-#ifdef WITH_SIXEL
+#if WITH_SIXEL
void SIXEL(uint8_t raw) noexcept { }
void SIXEL_CMD(vte::sixel::Sequence const& seq) noexcept { }
void SIXEL_ST(char32_t st) noexcept { }
@@ -956,7 +956,7 @@ private:
vte::base::UTF8Decoder m_utf8_decoder{};
vte::parser::Parser m_parser{};
-#ifdef WITH_SIXEL
+#if WITH_SIXEL
vte::sixel::Parser m_sixel_parser{};
#endif
@@ -971,7 +971,7 @@ private:
m_utf8_decoder.reset();
break;
-#ifdef WITH_SIXEL
+#if WITH_SIXEL
case DataSyntax::DECSIXEL:
m_sixel_parser.reset();
break;
@@ -995,7 +995,7 @@ private:
{
m_delegate.VT(seq);
-#ifdef WITH_SIXEL
+#if WITH_SIXEL
if (G_UNLIKELY(!m_no_sixel &&
seq.command() == VTE_CMD_DECSIXEL &&
seq.is_unripe())) {
@@ -1070,7 +1070,7 @@ private:
return bufend;
}
-#ifdef WITH_SIXEL
+#if WITH_SIXEL
uint8_t const*
process_data_decsixel(uint8_t const* const bufstart,
@@ -1124,7 +1124,7 @@ private:
sptr = process_data_utf8(sptr, bufend, eos);
break;
-#ifdef WITH_SIXEL
+#if WITH_SIXEL
case DataSyntax::DECSIXEL:
sptr = process_data_decsixel(sptr, bufend, eos);
break;
@@ -1192,7 +1192,7 @@ public:
memset(&m_cmd_stats, 0, sizeof(m_cmd_stats));
m_bench_times = g_array_new(false, true, sizeof(int64_t));
-#ifdef WITH_SIXEL
+#if WITH_SIXEL
m_parser.set_dispatch_unripe(!m_no_sixel);
#endif
}
@@ -1345,7 +1345,7 @@ public:
"Output unicode code points by number", nullptr },
{ "lint", 'l', 0, G_OPTION_ARG_NONE, &lint,
"Check input", nullptr },
-#ifdef WITH_SIXEL
+#if WITH_SIXEL
{ "no-sixel", 0, 0, G_OPTION_ARG_NONE, &no_sixel,
"Disable DECSIXEL processing", nullptr },
#endif
diff --git a/src/pty.cc b/src/pty.cc
index 52d21fb7..9075719a 100644
--- a/src/pty.cc
+++ b/src/pty.cc
@@ -280,7 +280,7 @@ 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
+#if WITH_SIXEL
size.ws_ypixel = size.ws_row * cell_height_px;
size.ws_xpixel = size.ws_col * cell_width_px;
#endif
diff --git a/src/reflect.c b/src/reflect.c
index d51ae1f6..83e21ca2 100644
--- a/src/reflect.c
+++ b/src/reflect.c
@@ -150,7 +150,7 @@ text_changed_insert(AtkObject *obj, gint offset, gint length, gpointer data)
p = g_utf8_next_char(p);
}
-#ifdef VTE_DEBUG
+#if VTE_DEBUG
if ((getenv("REFLECT_VERBOSE") != NULL) &&
(atol(getenv("REFLECT_VERBOSE")) != 0)) {
g_printerr("Inserted %d chars ('%.*s') at %d,",
@@ -176,7 +176,7 @@ text_changed_delete(AtkObject *obj, gint offset, gint length, gpointer data)
}
g_array_remove_index(contents, i);
}
-#ifdef VTE_DEBUG
+#if VTE_DEBUG
if ((getenv("REFLECT_VERBOSE") != NULL) &&
(atol(getenv("REFLECT_VERBOSE")) != 0)) {
g_printerr("Deleted %d chars at %d.\n", length, offset);
diff --git a/src/ring.cc b/src/ring.cc
index 23d79600..cf24dd71 100644
--- a/src/ring.cc
+++ b/src/ring.cc
@@ -25,7 +25,7 @@
#include <string.h>
-#ifdef WITH_SIXEL
+#if WITH_SIXEL
#include "cxx-utils.hh"
@@ -54,7 +54,7 @@ using namespace vte::base;
* VteRing: A buffer ring
*/
-#ifdef VTE_DEBUG
+#if VTE_DEBUG
void
Ring::validate() const
{
@@ -204,7 +204,7 @@ Ring::hyperlink_maybe_gc(row_t increment)
hyperlink_gc();
}
-#ifdef WITH_SIXEL
+#if WITH_SIXEL
void
Ring::image_gc_region() noexcept
@@ -713,7 +713,7 @@ Ring::reset()
m_start = m_writable = m_end;
m_cached_row_num = (row_t)-1;
-#ifdef WITH_SIXEL
+#if WITH_SIXEL
m_image_by_top_map.clear();
m_image_map.clear();
m_next_image_priority = 0;
@@ -1303,7 +1303,7 @@ Ring::rewrap(column_t columns,
gsize paragraph_len; /* excluding trailing '\n' */
gsize attr_offset;
gsize old_ring_end;
-#ifdef WITH_SIXEL
+#if WITH_SIXEL
auto image_it = m_image_by_top_map.begin();
#endif
@@ -1441,7 +1441,7 @@ Ring::rewrap(column_t columns,
}
}
-#ifdef WITH_SIXEL
+#if WITH_SIXEL
if (!rewrap_images_in_range(image_it,
new_record.text_start_offset,
text_offset,
@@ -1498,7 +1498,7 @@ Ring::rewrap(column_t columns,
}
}
-#ifdef WITH_SIXEL
+#if WITH_SIXEL
if (!rewrap_images_in_range(image_it,
new_record.text_start_offset,
paragraph_end_text_offset,
@@ -1538,7 +1538,7 @@ Ring::rewrap(column_t columns,
g_free(marker_text_offsets);
g_free(new_markers);
-#ifdef WITH_SIXEL
+#if WITH_SIXEL
try {
rebuild_image_top_map();
} catch (...) {
@@ -1551,7 +1551,7 @@ Ring::rewrap(column_t columns,
return;
err:
-#ifdef VTE_DEBUG
+#if VTE_DEBUG
_vte_debug_print(VTE_DEBUG_RING,
"Error while rewrapping\n");
g_assert_not_reached();
@@ -1650,7 +1650,7 @@ Ring::write_contents(GOutputStream* stream,
return true;
}
-#ifdef WITH_SIXEL
+#if WITH_SIXEL
/**
* Ring::append_image:
diff --git a/src/ring.hh b/src/ring.hh
index 54223904..2db7fec5 100644
--- a/src/ring.hh
+++ b/src/ring.hh
@@ -27,7 +27,7 @@
#include "vterowdata.hh"
#include "vtestream.h"
-#ifdef WITH_SIXEL
+#if WITH_SIXEL
#include "cairo-glue.hh"
#include "image.hh"
#include <map>
@@ -108,7 +108,7 @@ public:
private:
- #ifdef VTE_DEBUG
+ #if VTE_DEBUG
void validate() const;
#endif
@@ -235,7 +235,7 @@ private:
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
+#if WITH_SIXEL
private:
size_t m_next_image_priority{0};
diff --git a/src/sixel-context.cc b/src/sixel-context.cc
index 20238ac6..aea5b990 100644
--- a/src/sixel-context.cc
+++ b/src/sixel-context.cc
@@ -23,7 +23,7 @@
#include <cmath>
#include <cstdint>
-#ifdef VTE_DEBUG
+#if VTE_DEBUG
#include "debug.h"
#include "libc-glue.hh"
#endif
@@ -473,7 +473,7 @@ Context::image_cairo() noexcept
image_height(),
stride));
-#ifdef VTE_DEBUG
+#if VTE_DEBUG
_VTE_DEBUG_IF(VTE_DEBUG_IMAGE) {
static auto num = 0;
diff --git a/src/spawn.cc b/src/spawn.cc
index e231105c..e3052448 100644
--- a/src/spawn.cc
+++ b/src/spawn.cc
@@ -39,7 +39,7 @@
#include "glib-glue.hh"
-#ifdef WITH_SYSTEMD
+#if WITH_SYSTEMD
#include "systemd.hh"
#endif
@@ -529,7 +529,7 @@ SpawnOperation::~SpawnOperation()
bool
SpawnOperation::prepare(vte::glib::Error& error)
{
-#ifndef WITH_SYSTEMD
+#if !WITH_SYSTEMD
if (context().require_systemd_scope()) {
error.set_literal(G_IO_ERROR, G_IO_ERROR_NOT_SUPPORTED,
"systemd not available");
@@ -713,7 +713,7 @@ SpawnOperation::run(vte::glib::Error& error) noexcept
/* Spawn succeeded */
-#ifdef WITH_SYSTEMD
+#if WITH_SYSTEMD
if (context().systemd_scope() &&
!vte::systemd::create_scope_for_pid_sync(m_pid,
m_timeout, // FIXME: recalc timeout
diff --git a/src/vte.cc b/src/vte.cc
index e047db61..9f331a38 100644
--- a/src/vte.cc
+++ b/src/vte.cc
@@ -78,11 +78,9 @@
#include "cxx-utils.hh"
#include "gobject-glue.hh"
-#ifdef WITH_A11Y
+#if WITH_A11Y
#if VTE_GTK == 3
#include "vteaccess.h"
-#else
-#undef WITH_A11Y
#endif /* VTE_GTK == 3 */
#endif /* WITH_A11Y */
@@ -90,7 +88,7 @@
using namespace std::literals;
-#ifndef HAVE_ROUND
+#if !HAVE_ROUND
static inline double round(double x) {
if(x - floor(x) < 0.5) {
return floor(x);
@@ -98,7 +96,7 @@ static inline double round(double x) {
return ceil(x);
}
}
-#endif
+#endif /* !HAVE_ROUND */
#define WORD_CHAR_EXCEPTIONS_DEFAULT "-#%&+,./=?@\\_~\302\267"sv
@@ -274,7 +272,7 @@ vte_g_array_fill(GArray *array, gconstpointer item, guint final_size)
void
Terminal::unset_widget() noexcept
{
-#ifdef WITH_A11Y
+#if WITH_A11Y && VTE_GTK == 3
set_accessible(nullptr);
#endif
@@ -2146,7 +2144,7 @@ Terminal::set_encoding(char const* charset,
auto const to_utf8 = bool{charset == nullptr || g_ascii_strcasecmp(charset, "UTF-8") == 0};
auto const primary_is_current = (current_data_syntax() == primary_data_syntax());
-#ifdef WITH_ICU
+#if WITH_ICU
/* Note that if the current data syntax is not a primary one, the change
* will only be applied when returning to the primrary data syntax.
*/
@@ -3149,7 +3147,7 @@ not_inserted:
m_line_wrapped = line_wrapped;
}
-#ifdef WITH_SIXEL
+#if WITH_SIXEL
void
Terminal::insert_image(ProcessingContext& context,
@@ -3543,13 +3541,13 @@ Terminal::process_incoming()
process_incoming_utf8(context, *chunk);
break;
-#ifdef WITH_ICU
+#if WITH_ICU
case DataSyntax::ECMA48_PCTERM:
process_incoming_pcterm(context, *chunk);
break;
#endif
-#ifdef WITH_SIXEL
+#if WITH_SIXEL
case DataSyntax::DECSIXEL:
process_incoming_decsixel(context, *chunk);
break;
@@ -3571,7 +3569,7 @@ Terminal::process_incoming()
m_incoming_queue.pop();
}
-#ifdef VTE_DEBUG
+#if VTE_DEBUG
/* Some safety checks: ensure the visible parts of the buffer
* are all in the buffer. */
g_assert_cmpint(m_screen->insert_delta, >=, _vte_ring_delta(m_screen->row_data));
@@ -3672,18 +3670,18 @@ Terminal::process_incoming_utf8(ProcessingContext& context,
case vte::base::UTF8Decoder::ACCEPT: {
auto rv = m_parser.feed(m_utf8_decoder.codepoint());
if (G_UNLIKELY(rv < 0)) {
-#ifdef DEBUG
+#if VTE_DEBUG
uint32_t c = m_utf8_decoder.codepoint();
char c_buf[7];
g_snprintf(c_buf, sizeof(c_buf), "%lc", c);
char const* wp_str = g_unichar_isprint(c) ? c_buf : _vte_debug_sequence_to_string(c_buf, -1);
_vte_debug_print(VTE_DEBUG_PARSER, "Parser error on U+%04X [%s]!\n",
c, wp_str);
-#endif
+#endif /* VTE_DEBUG */
break;
}
-#ifdef VTE_DEBUG
+#if VTE_DEBUG
if (rv != VTE_SEQ_NONE)
g_assert((bool)seq);
#endif
@@ -3764,7 +3762,7 @@ switched_data_syntax:
chunk.set_begin_reading(ip);
}
-#ifdef WITH_ICU
+#if WITH_ICU
/* Note that this is mostly a copy of process_incoming_utf8() above; any non-charset-decoding
* related changes made here need to be made there, too.
@@ -3789,7 +3787,7 @@ Terminal::process_incoming_pcterm(ProcessingContext& context,
case vte::base::ICUDecoder::Result::eSomething: {
auto rv = m_parser.feed(decoder.codepoint());
if (G_UNLIKELY(rv < 0)) {
-#ifdef VTE_DEBUG
+#if VTE_DEBUG
uint32_t c = decoder.codepoint();
char c_buf[7];
g_snprintf(c_buf, sizeof(c_buf), "%lc", c);
@@ -3800,7 +3798,7 @@ Terminal::process_incoming_pcterm(ProcessingContext& context,
break;
}
-#ifdef VTE_DEBUG
+#if VTE_DEBUG
if (rv != VTE_SEQ_NONE)
g_assert((bool)seq);
#endif
@@ -3897,7 +3895,7 @@ Terminal::process_incoming_pcterm(ProcessingContext& context,
#endif /* WITH_ICU */
-#ifdef WITH_SIXEL
+#if WITH_SIXEL
void
Terminal::process_incoming_decsixel(ProcessingContext& context,
@@ -4272,7 +4270,7 @@ Terminal::send_child(std::string_view const& data)
_vte_byte_array_append(m_outgoing, data.data(), data.size());
break;
-#ifdef WITH_ICU
+#if WITH_ICU
case DataSyntax::ECMA48_PCTERM: {
auto converted = m_converter->convert(data);
@@ -6285,7 +6283,7 @@ Terminal::get_selected_text(GArray *attributes)
attributes);
}
-#ifdef VTE_DEBUG
+#if VTE_DEBUG
unsigned int
Terminal::checksum_area(vte::grid::row_t start_row,
vte::grid::column_t start_col,
@@ -7773,7 +7771,7 @@ Terminal::Terminal(vte::platform::Widget* w,
update_view_extents();
-#ifdef VTE_DEBUG
+#if VTE_DEBUG
if (g_test_flags != 0) {
feed("\e[1m\e[31mWARNING:\e[39m Test mode enabled. This is insecure!\e[0m\n\e[G"sv, false);
}
@@ -8302,7 +8300,7 @@ Terminal::draw_cells(vte::view::DrawingContext::TextRequest* items,
}
}
-#ifdef WITH_SIXEL
+#if WITH_SIXEL
if (back == VTE_DEFAULT_BG) {
/* Clear cells in order to properly overdraw images */
m_draw.clear(xl,
@@ -9299,7 +9297,7 @@ Terminal::paint_im_preedit_string()
void
Terminal::widget_draw(cairo_t* cr) noexcept
{
-#ifdef VTE_DEBUG
+#if VTE_DEBUG
_VTE_DEBUG_IF(VTE_DEBUG_LIFECYCLE | VTE_DEBUG_WORK | VTE_DEBUG_UPDATES) do {
auto clip_rect = cairo_rectangle_int_t{};
if (!gdk_cairo_get_clip_rectangle (cr, &clip_rect))
@@ -9377,7 +9375,7 @@ Terminal::draw(cairo_t* cr,
int allocated_width, allocated_height;
int extra_area_for_cursor;
bool text_blink_enabled_now;
-#ifdef WITH_SIXEL
+#if WITH_SIXEL
VteRing *ring = m_screen->row_data;
#endif
gint64 now = 0;
@@ -9422,7 +9420,7 @@ Terminal::draw(cairo_t* cr,
allocated_height - m_border.top - m_border.bottom);
cairo_clip(cr);
-#ifdef WITH_SIXEL
+#if WITH_SIXEL
/* Draw images */
if (m_images_enabled) {
vte::grid::row_t top_row = first_displayed_row();
@@ -9995,7 +9993,7 @@ Terminal::reset_decoder()
m_utf8_decoder.reset();
break;
-#ifdef WITH_ICU
+#if WITH_ICU
case DataSyntax::ECMA48_PCTERM:
m_converter->decoder().reset();
break;
@@ -10013,7 +10011,7 @@ Terminal::reset_data_syntax()
return;
switch (current_data_syntax()) {
-#ifdef WITH_SIXEL
+#if WITH_SIXEL
case DataSyntax::DECSIXEL:
m_sixel_context->reset();
break;
@@ -10029,7 +10027,7 @@ Terminal::reset_data_syntax()
void
Terminal::reset_graphics_color_registers()
{
-#ifdef WITH_SIXEL
+#if WITH_SIXEL
if (m_sixel_context)
m_sixel_context->reset_colors();
#endif
@@ -10139,7 +10137,7 @@ Terminal::reset(bool clear_tabstops,
/* Clear modifiers. */
m_modifiers = 0;
-#ifdef WITH_SIXEL
+#if WITH_SIXEL
if (m_sixel_context)
m_sixel_context->reset_colors();
#endif
diff --git a/src/vtegtk.cc b/src/vtegtk.cc
index fa7856d9..a461129c 100644
--- a/src/vtegtk.cc
+++ b/src/vtegtk.cc
@@ -64,15 +64,13 @@
#include <cairo-gobject.h>
-#ifdef WITH_A11Y
+#if WITH_A11Y
#if VTE_GTK == 3
#include "vteaccess.h"
-#else
-#undef WITH_A11Y
#endif /* VTE_GTK == 3 */
#endif /* WITH_A11Y */
-#ifdef WITH_ICU
+#if WITH_ICU
#include "icu-glue.hh"
#endif
@@ -157,7 +155,7 @@ private:
std::shared_ptr<vte::platform::Widget> m_widget;
};
-#ifdef VTE_DEBUG
+#if VTE_DEBUG
G_DEFINE_TYPE_WITH_CODE(VteTerminal, vte_terminal, GTK_TYPE_WIDGET,
{
VteTerminal_private_offset =
@@ -1217,7 +1215,7 @@ catch (...)
static void
vte_terminal_class_init(VteTerminalClass *klass)
{
-#ifdef VTE_DEBUG
+#if VTE_DEBUG
{
_vte_debug_init();
_vte_debug_print(VTE_DEBUG_LIFECYCLE,
@@ -2148,7 +2146,7 @@ vte_terminal_class_init(VteTerminalClass *klass)
*/
pspecs[PROP_ENABLE_SIXEL] =
g_param_spec_boolean ("enable-sixel", nullptr, nullptr,
-#ifdef WITH_SIXEL
+#if WITH_SIXEL
VTE_SIXEL_ENABLED_DEFAULT,
#else
false,
@@ -2506,7 +2504,7 @@ vte_terminal_class_init(VteTerminalClass *klass)
#endif
#if VTE_GTK == 3
-#ifdef WITH_A11Y
+#if WITH_A11Y
/* a11y */
gtk_widget_class_set_accessible_type(widget_class, VTE_TYPE_TERMINAL_ACCESSIBLE);
#endif
@@ -2528,32 +2526,32 @@ const char *
vte_get_features (void) noexcept
{
return
-#ifdef WITH_FRIBIDI
+#if WITH_FRIBIDI
"+BIDI"
#else
"-BIDI"
#endif
" "
-#ifdef WITH_GNUTLS
+#if WITH_GNUTLS
"+GNUTLS"
#else
"-GNUTLS"
#endif
" "
-#ifdef WITH_ICU
+#if WITH_ICU
"+ICU"
#else
"-ICU"
#endif
" "
-#ifdef WITH_SIXEL
+#if WITH_SIXEL
"+SIXEL"
#else
"-SIXEL"
#endif
#ifdef __linux__
" "
-#ifdef WITH_SYSTEMD
+#if WITH_SYSTEMD
"+SYSTEMD"
#else
"-SYSTEMD"
@@ -2575,17 +2573,17 @@ VteFeatureFlags
vte_get_feature_flags(void) noexcept
{
return VteFeatureFlags(0ULL |
-#ifdef WITH_FRIBIDI
+#if WITH_FRIBIDI
VTE_FEATURE_FLAG_BIDI |
#endif
-#ifdef WITH_ICU
+#if WITH_ICU
VTE_FEATURE_FLAG_ICU |
#endif
-#ifdef WITH_SIXEL
+#if WITH_SIXEL
VTE_FEATURE_FLAG_SIXEL |
#endif
#ifdef __linux__
-#ifdef WITH_SYSTEMD
+#if WITH_SYSTEMD
VTE_FEATURE_FLAG_SYSTEMD |
#endif
#endif // __linux__
@@ -2679,7 +2677,7 @@ vte_get_user_shell (void) noexcept
void
vte_set_test_flags(guint64 flags) noexcept
{
-#ifdef VTE_DEBUG
+#if VTE_DEBUG
g_test_flags = flags;
#endif
}
@@ -2704,7 +2702,7 @@ char **
vte_get_encodings(gboolean include_aliases) noexcept
try
{
-#ifdef WITH_ICU
+#if WITH_ICU
return vte::base::get_icu_charsets(include_aliases != FALSE);
#else
char *empty[] = { nullptr };
@@ -2741,7 +2739,7 @@ try
{
g_return_val_if_fail(encoding != nullptr, false);
-#ifdef WITH_ICU
+#if WITH_ICU
return vte::base::get_icu_charset_supported(encoding);
#else
return false;
@@ -4313,7 +4311,7 @@ warn_if_callback(VteSelectionFunc func,
if (!func)
return;
-#ifndef VTE_DEBUG
+#if !VTE_DEBUG
static gboolean warned = FALSE;
if (warned)
return;
@@ -4335,7 +4333,7 @@ warn_if_attributes(void* array,
if (!array)
return;
-#ifndef VTE_DEBUG
+#if !VTE_DEBUG
static gboolean warned = FALSE;
if (warned)
return;
@@ -6654,7 +6652,7 @@ vte_terminal_set_enable_sixel(VteTerminal *terminal,
gboolean enabled) noexcept
try
{
-#ifdef WITH_SIXEL
+#if WITH_SIXEL
g_return_if_fail(VTE_IS_TERMINAL(terminal));
if (WIDGET(terminal)->set_sixel_enabled(enabled != FALSE))
@@ -6678,7 +6676,7 @@ gboolean
vte_terminal_get_enable_sixel(VteTerminal *terminal) noexcept
try
{
-#ifdef WITH_SIXEL
+#if WITH_SIXEL
g_return_val_if_fail(VTE_IS_TERMINAL(terminal), FALSE);
return WIDGET(terminal)->sixel_enabled();
diff --git a/src/vteinternal.hh b/src/vteinternal.hh
index b9f77891..6c27e767 100644
--- a/src/vteinternal.hh
+++ b/src/vteinternal.hh
@@ -63,19 +63,18 @@
#include <variant>
#include <vector>
-#ifdef WITH_A11Y
+#if WITH_A11Y
#if VTE_GTK == 3
#include "vteaccess.h"
#else
-#undef WITH_A11Y
#endif
#endif
-#ifdef WITH_ICU
+#if WITH_ICU
#include "icu-converter.hh"
#endif
-#ifdef WITH_SIXEL
+#if WITH_SIXEL
#include "sixel-context.hh"
#endif
@@ -265,7 +264,7 @@ public:
void unset_widget() noexcept;
-#ifdef WITH_A11Y
+#if WITH_A11Y && VTE_GTK == 3
/* Accessible */
vte::glib::RefPtr<VteTerminalAccessible> m_accessible{};
#endif
@@ -314,13 +313,13 @@ public:
enum class DataSyntax {
/* The primary data syntax is always one of the following: */
ECMA48_UTF8,
- #ifdef WITH_ICU
+ #if WITH_ICU
ECMA48_PCTERM,
#endif
/* ECMA48_ECMA35, not supported */
/* The following can never be primary data syntax: */
-#ifdef WITH_SIXEL
+#if WITH_SIXEL
DECSIXEL,
#endif
};
@@ -367,7 +366,7 @@ public:
/* Output data queue. */
VteByteArray *m_outgoing; /* pending input characters */
-#ifdef WITH_ICU
+#if WITH_ICU
/* Legacy charset support */
std::unique_ptr<vte::base::ICUConverter> m_converter;
#endif /* WITH_ICU */
@@ -376,14 +375,14 @@ public:
{
switch (primary_data_syntax()) {
case DataSyntax::ECMA48_UTF8: return "UTF-8";
- #ifdef WITH_ICU
+ #if WITH_ICU
case DataSyntax::ECMA48_PCTERM: return m_converter->charset().c_str();
#endif
default: g_assert_not_reached(); return nullptr;
}
}
-#ifdef WITH_SIXEL
+#if WITH_SIXEL
std::unique_ptr<vte::sixel::Context> m_sixel_context{};
#endif
@@ -807,7 +806,7 @@ public:
bool insert,
bool invalidate_now);
- #ifdef WITH_SIXEL
+ #if WITH_SIXEL
void insert_image(ProcessingContext& context,
vte::Freeable<cairo_surface_t> image_surface) /* throws */;
#endif
@@ -833,11 +832,11 @@ public:
void process_incoming();
void process_incoming_utf8(ProcessingContext& context,
vte::base::Chunk& chunk);
- #ifdef WITH_ICU
+ #if WITH_ICU
void process_incoming_pcterm(ProcessingContext& context,
vte::base::Chunk& chunk);
#endif
- #ifdef WITH_SIXEL
+ #if WITH_SIXEL
void process_incoming_decsixel(ProcessingContext& context,
vte::base::Chunk& chunk);
#endif
@@ -1168,7 +1167,7 @@ public:
void queue_child_exited();
void queue_eof();
-#ifdef WITH_A11Y
+#if WITH_A11Y && VTE_GTK == 3
void set_accessible(VteTerminalAccessible* accessible) noexcept
{
@@ -1211,7 +1210,7 @@ public:
inline constexpr void emit_text_modified() const noexcept { }
inline constexpr void emit_text_scrolled(long delta) const noexcept { }
-#endif /* WITH_A11Y */
+#endif /* WITH_A11Y && VTE_GTK == 3*/
void emit_pending_signals();
void emit_increase_font_size();
diff --git a/src/vteseq.cc b/src/vteseq.cc
index 55315da6..768615f7 100644
--- a/src/vteseq.cc
+++ b/src/vteseq.cc
@@ -72,7 +72,7 @@ enum {
void
vte::parser::Sequence::print() const noexcept
{
-#ifdef VTE_DEBUG
+#if VTE_DEBUG
auto c = m_seq != nullptr ? terminator() : 0;
char c_buf[7];
g_snprintf(c_buf, sizeof(c_buf), "%lc", c);
@@ -2403,7 +2403,7 @@ Terminal::DA1(vte::parser::Sequence const& seq)
return;
reply(seq, VTE_REPLY_DECDA1R, {65, 1,
-#ifdef WITH_SIXEL
+#if WITH_SIXEL
m_sixel_enabled ? 4 : -2 /* skip */,
#endif
9});
@@ -3541,7 +3541,7 @@ Terminal::DECRQCRA(vte::parser::Sequence const& seq)
unsigned int idx = 0;
int id = seq.collect1(idx);
-#ifndef VTE_DEBUG
+#if !VTE_DEBUG
/* Send a dummy reply */
return reply(seq, VTE_REPLY_DECCKSR, {id}, "0000");
#else
@@ -4410,7 +4410,7 @@ Terminal::DECSIXEL(vte::parser::Sequence const& seq)
* DEC PPLV2 ยง 5.4
*/
-#ifdef WITH_SIXEL
+#if WITH_SIXEL
auto process_sixel = false;
auto mode = vte::sixel::Parser::Mode{};
if (m_sixel_enabled) {
@@ -4420,7 +4420,7 @@ Terminal::DECSIXEL(vte::parser::Sequence const& seq)
mode = vte::sixel::Parser::Mode::UTF8;
break;
-#ifdef WITH_ICU
+#if 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,
@@ -8936,7 +8936,7 @@ Terminal::XTERM_SMGRAPHICS(vte::parser::Sequence const& seq)
auto status = 3, rv0 = -2, rv1 = -2;
switch (attr) {
-#ifdef WITH_SIXEL
+#if WITH_SIXEL
case 0: /* Colour registers.
*
* VTE doesn't support changing the number of colour registers, so always
diff --git a/src/vtestream-file.h b/src/vtestream-file.h
index 1ab68fd5..d9b433be 100644
--- a/src/vtestream-file.h
+++ b/src/vtestream-file.h
@@ -83,16 +83,18 @@
#include <unistd.h>
#include <zlib.h>
-#ifdef WITH_GNUTLS
+#include "vteutils.h"
+
+#if WITH_GNUTLS
# include <gnutls/gnutls.h>
# include <gnutls/crypto.h>
+#else
+#undef WITH_GNUTLS
#endif
-#include "vteutils.h"
-
G_BEGIN_DECLS
-#ifdef WITH_GNUTLS
+#if WITH_GNUTLS
/* Currently the code requires that a stream cipher (e.g. GCM) is used
* which can encrypt any amount of data without need for padding. */
# define VTE_CIPHER_ALGORITHM GNUTLS_CIPHER_AES_256_GCM
@@ -126,11 +128,11 @@ typedef guint8 _vte_overwrite_counter_t;
/******************************************************************************************/
-#ifndef HAVE_EXPLICIT_BZERO
+#if !HAVE_EXPLICIT_BZERO
#define explicit_bzero(s, n) memset((s), 0, (n))
#endif
-#ifndef HAVE_PREAD
+#if !HAVE_PREAD
#define pread _pread
static inline gsize
pread (int fd, char *data, gsize len, gsize offset)
@@ -141,7 +143,7 @@ pread (int fd, char *data, gsize len, gsize offset)
}
#endif
-#ifndef HAVE_PWRITE
+#if !HAVE_PWRITE
#define pwrite _pwrite
static inline gsize
pwrite (int fd, char *data, gsize len, gsize offset)
diff --git a/src/vtetypes.cc b/src/vtetypes.cc
index f25cc0b6..eb5c3c70 100644
--- a/src/vtetypes.cc
+++ b/src/vtetypes.cc
@@ -76,7 +76,7 @@ vte::color::rgb::parse(char const* spec)
return retval;
}
-#ifdef VTE_DEBUG
+#if VTE_DEBUG
#define DEBUG_STRING_SIZE (256)
#define DEBUG_STRING_SLICES (64)
@@ -204,7 +204,7 @@ test_grid_coords (void)
g_assert_false(coords(42, 42) >= coords(43, 160));
g_assert_false(coords(42, 42) > coords(43, 160));
-#ifdef VTE_DEBUG
+#if VTE_DEBUG
/* to_string() */
g_assert_cmpstr(vte::grid::coords(17, 42).to_string(), ==, "grid[17,42]");
#endif
@@ -257,7 +257,7 @@ test_grid_halfcoords (void)
g_assert_false(d > e);
g_assert_false(d >= e);
-#ifdef VTE_DEBUG
+#if VTE_DEBUG
/* to_string() */
g_assert_cmpstr(halfcoords(16, 32, 0).to_string(), ==, "halfgrid[16,32L]");
g_assert_cmpstr(halfcoords(16, 32, 1).to_string(), ==, "halfgrid[16,32R]");
@@ -363,7 +363,7 @@ test_grid_span (void)
span s10(16, 16, 32, 1);
g_assert_cmpint(s10.last_row(), ==, 32);
-#ifdef VTE_DEBUG
+#if VTE_DEBUG
/* to_string() */
g_assert_cmpstr(vte::grid::span(17, 42, 18, 3).to_string(), ==, "grid[(17,42), (18,3))");
#endif
@@ -395,7 +395,7 @@ test_view_coords (void)
g_assert_true(p3 == p4);
g_assert_true(p5 == p2);
-#ifdef VTE_DEBUG
+#if VTE_DEBUG
/* to_string() */
g_assert_cmpstr(vte::view::coords(256, 512).to_string(), ==, "view[256,512]");
#endif
diff --git a/src/vtetypes.hh b/src/vtetypes.hh
index cf93b723..6083930c 100644
--- a/src/vtetypes.hh
+++ b/src/vtetypes.hh
@@ -25,7 +25,7 @@
#include <cstdint>
#include <memory>
-#ifdef VTE_DEBUG
+#if VTE_DEBUG
#define IFDEF_DEBUG(str) str
#else
#define IFDEF_DEBUG(str)
diff --git a/src/widget.cc b/src/widget.cc
index 49e02049..84704275 100644
--- a/src/widget.cc
+++ b/src/widget.cc
@@ -758,7 +758,7 @@ Widget::direction_changed(GtkTextDirection old_direction) noexcept
void
Widget::dispose() noexcept
{
-#ifdef WITH_A11Y
+#if WITH_A11Y && VTE_GTK == 3
m_terminal->set_accessible(nullptr);
#endif