[vte] build: Add configure switch to disable a11y code



commit 623f3c66de097eefef44001a4ff70600c11313f9
Author: Christian Persch <chpe src gnome org>
Date:   Mon Nov 11 22:10:34 2019 +0100

    build: Add configure switch to disable a11y code

 meson.build        |  3 +++
 meson_options.txt  |  7 +++++++
 src/meson.build    | 11 +++++++++--
 src/vte.cc         | 15 ++++++++++++++-
 src/vtegtk.cc      |  7 ++++++-
 src/vteinternal.hh |  2 ++
 6 files changed, 41 insertions(+), 4 deletions(-)
---
diff --git a/meson.build b/meson.build
index 28514566..4e79657a 100644
--- a/meson.build
+++ b/meson.build
@@ -114,6 +114,7 @@ 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_ICONV', get_option('iconv'))
@@ -478,6 +479,8 @@ output += '  C++ compiler: ' + cxx.get_id() + ' (version ' + cxx.version() + ')\
 output += '\n'
 output += '  Coverage:     ' + get_option('b_coverage').to_string() + '\n'
 output += '  Debug:        ' + enable_debug.to_string() + '\n'
+output += '\n'
+output += '  A11y:         ' + get_option('a11y').to_string() + '\n'
 output += '  Docs:         ' + get_option('docs').to_string() + '\n'
 output += '  FRIBIDI:      ' + get_option('fribidi').to_string() + '\n'
 output += '  GNUTLS:       ' + get_option('gnutls').to_string() + '\n'
diff --git a/meson_options.txt b/meson_options.txt
index 5d8c8798..bb59bc67 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -22,6 +22,13 @@ option(
   description: 'Use -Bsymbolic-functions',
 )
 
+option(
+  'a11y',
+  type: 'boolean',
+  value: true,
+  description: 'Enable a11y',
+)
+
 option(
   'debugg', # for some reason, 'debug' is "reserved"
   type: 'boolean',
diff --git a/src/meson.build b/src/meson.build
index efaf81f4..4b2f19b9 100644
--- a/src/meson.build
+++ b/src/meson.build
@@ -18,6 +18,11 @@ subdir('vte')
 
 src_inc = include_directories('.')
 
+a11y_sources = files(
+  'vteaccess.cc',
+  'vteaccess.h',
+)
+
 debug_sources = files(
   'debug.cc',
   'debug.h',
@@ -88,8 +93,6 @@ libvte_common_sources = debug_sources + modes_sources + parser_sources + pty_sou
   'utf8.cc',
   'utf8.hh',
   'vte.cc',
-  'vteaccess.cc',
-  'vteaccess.h',
   'vtedefines.hh',
   'vtedraw.cc',
   'vtedraw.hh',
@@ -118,6 +121,10 @@ libvte_common_sources = debug_sources + modes_sources + parser_sources + pty_sou
   'widget.hh',
 )
 
+if get_option('a11y')
+  libvte_common_sources += a11y_sources
+endif
+
 libvte_common_doc_sources = files(
   # These file contain gtk-doc comments to be extracted for docs and gir
   'pty.cc',
diff --git a/src/vte.cc b/src/vte.cc
index b15df435..54e8a587 100644
--- a/src/vte.cc
+++ b/src/vte.cc
@@ -62,10 +62,13 @@
 #include <pango/pango.h>
 #include "keymap.h"
 #include "marshal.h"
-#include "vteaccess.h"
 #include "vtepty.h"
 #include "vtegtk.hh"
 
+#ifdef WITH_A11Y
+#include "vteaccess.h"
+#endif
+
 #include <new> /* placement new */
 
 #ifndef HAVE_ROUND
@@ -828,42 +831,49 @@ Terminal::emit_decrease_font_size()
 void
 Terminal::emit_text_inserted()
 {
+#ifdef WITH_A11Y
        if (!m_accessible_emit) {
                return;
        }
        _vte_debug_print(VTE_DEBUG_SIGNALS,
                        "Emitting `text-inserted'.\n");
        g_signal_emit(m_terminal, signals[SIGNAL_TEXT_INSERTED], 0);
+#endif
 }
 
 /* Emit a "text-deleted" signal. */
 void
 Terminal::emit_text_deleted()
 {
+#ifdef WITH_A11Y
        if (!m_accessible_emit) {
                return;
        }
        _vte_debug_print(VTE_DEBUG_SIGNALS,
                        "Emitting `text-deleted'.\n");
        g_signal_emit(m_terminal, signals[SIGNAL_TEXT_DELETED], 0);
+#endif
 }
 
 /* Emit a "text-modified" signal. */
 void
 Terminal::emit_text_modified()
 {
+#ifdef WITH_A11Y
        if (!m_accessible_emit) {
                return;
        }
        _vte_debug_print(VTE_DEBUG_SIGNALS,
                          "Emitting `text-modified'.\n");
        g_signal_emit(m_terminal, signals[SIGNAL_TEXT_MODIFIED], 0);
+#endif
 }
 
 /* Emit a "text-scrolled" signal. */
 void
 Terminal::emit_text_scrolled(long delta)
 {
+#ifdef WITH_A11Y
        if (!m_accessible_emit) {
                return;
        }
@@ -871,6 +881,7 @@ Terminal::emit_text_scrolled(long delta)
                        "Emitting `text-scrolled'(%ld).\n", delta);
         // FIXMEchpe fix signal signature?
        g_signal_emit(m_terminal, signals[SIGNAL_TEXT_SCROLLED], 0, (int)delta);
+#endif
 }
 
 void
@@ -10184,7 +10195,9 @@ Terminal::terminate_child() noexcept
 void
 Terminal::subscribe_accessible_events()
 {
+#ifdef WITH_A11Y
        m_accessible_emit = true;
+#endif
 }
 
 void
diff --git a/src/vtegtk.cc b/src/vtegtk.cc
index c23b9fdb..3b9fb415 100644
--- a/src/vtegtk.cc
+++ b/src/vtegtk.cc
@@ -52,13 +52,16 @@
 #include "reaper.hh"
 #include "vtedefines.hh"
 #include "vteinternal.hh"
-#include "vteaccess.h"
 #include "widget.hh"
 
 #include "vtegtk.hh"
 #include "vteptyinternal.hh"
 #include "vteregexinternal.hh"
 
+#ifdef WITH_A11Y
+#include "vteaccess.h"
+#endif
+
 #define I_(string) (g_intern_static_string(string))
 
 #define VTE_TERMINAL_CSS_NAME "vte-terminal"
@@ -1798,8 +1801,10 @@ vte_terminal_class_init(VteTerminalClass *klass)
                                          "}\n",
                                          -1, NULL);
 
+#ifdef WITH_A11Y
         /* a11y */
         gtk_widget_class_set_accessible_type(widget_class, VTE_TYPE_TERMINAL_ACCESSIBLE);
+#endif
 }
 
 /* public API */
diff --git a/src/vteinternal.hh b/src/vteinternal.hh
index 3de98d13..f32add77 100644
--- a/src/vteinternal.hh
+++ b/src/vteinternal.hh
@@ -654,7 +654,9 @@ public:
         PangoAttrList *m_im_preedit_attrs;
         int m_im_preedit_cursor;
 
+        #ifdef WITH_A11Y
         gboolean m_accessible_emit;
+        #endif
 
         /* Adjustment updates pending. */
         gboolean m_adjustment_changed_pending;


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