Bug Summary

File:/rootdir/_build/../src/btectk.cc
Warning:line 3555, column 1
This statement is never executed

Annotated Source Code

Press '?' to see keyboard shortcuts

clang -cc1 -cc1 -triple x86_64-pc-linux-gnu -analyze -disable-free -clear-ast-before-backend -disable-llvm-verifier -discard-value-names -main-file-name btectk.cc -analyzer-store=region -analyzer-opt-analyze-nested-blocks -analyzer-checker=core -analyzer-checker=apiModeling -analyzer-checker=unix -analyzer-checker=deadcode -analyzer-checker=cplusplus -analyzer-checker=security.insecureAPI.UncheckedReturn -analyzer-checker=security.insecureAPI.getpw -analyzer-checker=security.insecureAPI.gets -analyzer-checker=security.insecureAPI.mktemp -analyzer-checker=security.insecureAPI.mkstemp -analyzer-checker=security.insecureAPI.vfork -analyzer-checker=nullability.NullPassedToNonnull -analyzer-checker=nullability.NullReturnedFromNonnull -analyzer-output plist -w -setup-static-analyzer -mrelocation-model pic -pic-level 2 -mframe-pointer=none -relaxed-aliasing -fmath-errno -ffp-contract=on -fno-rounding-math -mconstructor-aliases -funwind-tables=2 -target-cpu x86-64 -tune-cpu generic -debugger-tuning=gdb -fcoverage-compilation-dir=/rootdir/_build -resource-dir /usr/lib/llvm-14/lib/clang/14.0.6 -I src/libbte-2.91.so.0.6500.0.p -I src -I ../src -I . -I .. -I src/bte -I ../src/bte -I /usr/include/glib-2.0 -I /usr/lib/x86_64-linux-gnu/glib-2.0/include -I /usr/include/libmount -I /usr/include/blkid -I /usr/include/pango-1.0 -I /usr/include/harfbuzz -I /usr/include/freetype2 -I /usr/include/libpng16 -I /usr/include/fribidi -I /usr/include/uuid -I /usr/include/cairo -I /usr/include/pixman-1 -I /usr/include/p11-kit-1 -I /usr/include/ctk-3.0 -I /usr/include/gdk-pixbuf-2.0 -I /usr/include/x86_64-linux-gnu -I /usr/include/gio-unix-2.0 -I /usr/include/atk-1.0 -I /usr/include/at-spi2-atk/2.0 -I /usr/include/at-spi-2.0 -I /usr/include/dbus-1.0 -I /usr/lib/x86_64-linux-gnu/dbus-1.0/include -D _FILE_OFFSET_BITS=64 -D G_LOG_DOMAIN="BTE" -D LOCALEDIR="/usr/local/share/locale" -D BTE_DISABLE_DEPRECATION_WARNINGS -D BTE_COMPILATION -U PARSER_INCLUDE_NOP -D CDK_VERSION_MIN_REQUIRED=(G_ENCODE_VERSION(3,18)) -D CDK_VERSION_MAX_ALLOWED=(G_ENCODE_VERSION(3,20)) -internal-isystem /usr/lib/gcc/x86_64-linux-gnu/12/../../../../include/c++/12 -internal-isystem /usr/lib/gcc/x86_64-linux-gnu/12/../../../../include/x86_64-linux-gnu/c++/12 -internal-isystem /usr/lib/gcc/x86_64-linux-gnu/12/../../../../include/c++/12/backward -internal-isystem /usr/lib/llvm-14/lib/clang/14.0.6/include -internal-isystem /usr/local/include -internal-isystem /usr/lib/gcc/x86_64-linux-gnu/12/../../../../x86_64-linux-gnu/include -internal-externc-isystem /usr/include/x86_64-linux-gnu -internal-externc-isystem /include -internal-externc-isystem /usr/include -O3 -Wno-address-of-packed-member -Wno-missing-field-initializers -Wno-packed -Wno-switch-enum -Wno-unused-parameter -Wwrite-strings -std=gnu++17 -fdeprecated-macro -fdebug-compilation-dir=/rootdir/_build -ferror-limit 19 -fvisibility hidden -fvisibility-inlines-hidden -stack-protector 2 -fgnuc-version=4.2.1 -fcxx-exceptions -fexceptions -fcolor-diagnostics -vectorize-loops -vectorize-slp -analyzer-checker deadcode.DeadStores -analyzer-checker alpha.deadcode.UnreachableCode -analyzer-checker alpha.core.CastSize -analyzer-checker alpha.core.CastToStruct -analyzer-checker alpha.core.IdenticalExpr -analyzer-checker alpha.core.SizeofPtr -analyzer-checker alpha.security.ArrayBoundV2 -analyzer-checker alpha.security.MallocOverflow -analyzer-checker alpha.security.ReturnPtrRange -analyzer-checker alpha.unix.SimpleStream -analyzer-checker alpha.unix.cstring.BufferOverlap -analyzer-checker alpha.unix.cstring.NotNullTerminated -analyzer-checker alpha.unix.cstring.OutOfBounds -analyzer-checker alpha.core.FixedAddr -analyzer-output=html -faddrsig -D__GCC_HAVE_DWARF2_CFI_ASM=1 -o /rootdir/html-report/2022-12-31-022803-10898-1 -x c++ ../src/btectk.cc
1/*
2 * Copyright (C) 2001-2004,2009,2010 Red Hat, Inc.
3 * Copyright © 2008, 2009, 2010, 2015 Christian Persch
4 *
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Lesser General Public
7 * License as published by the Free Software Foundation; either
8 * version 2.1 of the License, or (at your option) any later version.
9 *
10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Lesser General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program. If not, see <http://www.gnu.org/licenses/>.
17 */
18
19/**
20 * SECTION: bte-terminal
21 * @short_description: A terminal widget implementation
22 *
23 * A BteTerminal is a terminal emulator implemented as a CTK3 widget.
24 *
25 * Note that altough #BteTerminal implements the #CtkScrollable interface,
26 * you should not place a #BteTerminal inside a #CtkScrolledWindow
27 * container, since they are incompatible. Instead, pack the terminal in
28 * a horizontal #CtkBox together with a #CtkScrollbar which uses the
29 * #CtkAdjustment returned from ctk_scrollable_get_vadjustment().
30 */
31
32#include "config.h"
33
34#include <new> /* placement new */
35#include <exception>
36
37#include <pwd.h>
38
39#ifdef HAVE_LOCALE_H
40#include <locale.h>
41#endif
42
43#include <glib.h>
44#include <glib/gi18n-lib.h>
45#include <ctk/ctk.h>
46#include "bte/bteenums.h"
47#include "bte/btepty.h"
48#include "bte/bteterminal.h"
49#include "bte/btetypebuiltins.h"
50
51#include "debug.h"
52#include "glib-glue.hh"
53#include "gobject-glue.hh"
54#include "marshal.h"
55#include "reaper.hh"
56#include "btedefines.hh"
57#include "bteinternal.hh"
58#include "widget.hh"
59
60#include "btectk.hh"
61#include "bteptyinternal.hh"
62#include "bteregexinternal.hh"
63
64#ifdef WITH_A11Y
65#include "bteaccess.h"
66#endif
67
68#ifdef WITH_ICU
69#include "icu-glue.hh"
70#endif
71
72#define I_(string)(g_intern_static_string(string)) (g_intern_static_string(string))
73#define _BTE_PARAM_DEPRECATED(_bte_debug_on(BTE_DEBUG_SIGNALS) ? G_PARAM_DEPRECATED : 0) (_bte_debug_on(BTE_DEBUG_SIGNALS) ? G_PARAM_DEPRECATED : 0)
74
75#define BTE_TERMINAL_CSS_NAME"bte-terminal" "bte-terminal"
76
77struct _BteTerminalClassPrivate {
78 CtkStyleProvider *fallback_style_provider;
79 CtkStyleProvider *style_provider;
80};
81
82static void bte_terminal_scrollable_iface_init(CtkScrollableInterface* iface) noexcept;
83
84#ifdef BTE_DEBUG
85G_DEFINE_TYPE_WITH_CODE(BteTerminal, bte_terminal, CTK_TYPE_WIDGET,static void bte_terminal_init (BteTerminal *self); static void
bte_terminal_class_init (BteTerminalClass *klass); static GType
bte_terminal_get_type_once (void); static gpointer bte_terminal_parent_class
= __null; static gint BteTerminal_private_offset; static void
bte_terminal_class_intern_init (gpointer klass) { bte_terminal_parent_class
= g_type_class_peek_parent (klass); if (BteTerminal_private_offset
!= 0) g_type_class_adjust_private_offset (klass, &BteTerminal_private_offset
); bte_terminal_class_init ((BteTerminalClass*) klass); } __attribute__
((__unused__)) static inline gpointer bte_terminal_get_instance_private
(BteTerminal *self) { return (((gpointer) ((guint8*) (self) +
(glong) (BteTerminal_private_offset)))); } GType bte_terminal_get_type
(void) { static gsize static_g_define_type_id = 0; if ((__extension__
({ static_assert (sizeof *(&static_g_define_type_id) == sizeof
(gpointer), "Expression evaluates to false"); (void) (0 ? (gpointer
) *(&static_g_define_type_id) : __null); (!(__extension__
({ static_assert (sizeof *(&static_g_define_type_id) == sizeof
(gpointer), "Expression evaluates to false"); gpointer gapg_temp_newval
; gpointer *gapg_temp_atomic = (gpointer *)(&static_g_define_type_id
); __atomic_load (gapg_temp_atomic, &gapg_temp_newval, 5)
; gapg_temp_newval; })) && g_once_init_enter (&static_g_define_type_id
)); }))) { GType g_define_type_id = bte_terminal_get_type_once
(); (__extension__ ({ static_assert (sizeof *(&static_g_define_type_id
) == sizeof (gpointer), "Expression evaluates to false"); 0 ?
(void) (*(&static_g_define_type_id) = (g_define_type_id)
) : (void) 0; g_once_init_leave ((&static_g_define_type_id
), (gsize) (g_define_type_id)); })); } return static_g_define_type_id
; } [[gnu::noinline]] static GType bte_terminal_get_type_once
(void) { GType g_define_type_id = g_type_register_static_simple
((ctk_widget_get_type ()), g_intern_static_string ("BteTerminal"
), sizeof (BteTerminalClass), (GClassInitFunc)(void (*)(void)
) bte_terminal_class_intern_init, sizeof (BteTerminal), (GInstanceInitFunc
)(void (*)(void)) bte_terminal_init, (GTypeFlags) 0); { {{ BteTerminal_private_offset
= g_type_add_instance_private(g_define_type_id, sizeof(bte::
platform::Widget)); } g_type_add_class_private (g_define_type_id
, sizeof (BteTerminalClassPrivate)); { const GInterfaceInfo g_implement_interface_info
= { (GInterfaceInitFunc)(void (*)(void)) bte_terminal_scrollable_iface_init
, __null, __null }; g_type_add_interface_static (g_define_type_id
, (ctk_scrollable_get_type ()), &g_implement_interface_info
); } if (_bte_debug_on(BTE_DEBUG_LIFECYCLE)) { g_printerr("bte_terminal_get_type()\n"
); };} } return g_define_type_id; }
86 {static void bte_terminal_init (BteTerminal *self); static void
bte_terminal_class_init (BteTerminalClass *klass); static GType
bte_terminal_get_type_once (void); static gpointer bte_terminal_parent_class
= __null; static gint BteTerminal_private_offset; static void
bte_terminal_class_intern_init (gpointer klass) { bte_terminal_parent_class
= g_type_class_peek_parent (klass); if (BteTerminal_private_offset
!= 0) g_type_class_adjust_private_offset (klass, &BteTerminal_private_offset
); bte_terminal_class_init ((BteTerminalClass*) klass); } __attribute__
((__unused__)) static inline gpointer bte_terminal_get_instance_private
(BteTerminal *self) { return (((gpointer) ((guint8*) (self) +
(glong) (BteTerminal_private_offset)))); } GType bte_terminal_get_type
(void) { static gsize static_g_define_type_id = 0; if ((__extension__
({ static_assert (sizeof *(&static_g_define_type_id) == sizeof
(gpointer), "Expression evaluates to false"); (void) (0 ? (gpointer
) *(&static_g_define_type_id) : __null); (!(__extension__
({ static_assert (sizeof *(&static_g_define_type_id) == sizeof
(gpointer), "Expression evaluates to false"); gpointer gapg_temp_newval
; gpointer *gapg_temp_atomic = (gpointer *)(&static_g_define_type_id
); __atomic_load (gapg_temp_atomic, &gapg_temp_newval, 5)
; gapg_temp_newval; })) && g_once_init_enter (&static_g_define_type_id
)); }))) { GType g_define_type_id = bte_terminal_get_type_once
(); (__extension__ ({ static_assert (sizeof *(&static_g_define_type_id
) == sizeof (gpointer), "Expression evaluates to false"); 0 ?
(void) (*(&static_g_define_type_id) = (g_define_type_id)
) : (void) 0; g_once_init_leave ((&static_g_define_type_id
), (gsize) (g_define_type_id)); })); } return static_g_define_type_id
; } [[gnu::noinline]] static GType bte_terminal_get_type_once
(void) { GType g_define_type_id = g_type_register_static_simple
((ctk_widget_get_type ()), g_intern_static_string ("BteTerminal"
), sizeof (BteTerminalClass), (GClassInitFunc)(void (*)(void)
) bte_terminal_class_intern_init, sizeof (BteTerminal), (GInstanceInitFunc
)(void (*)(void)) bte_terminal_init, (GTypeFlags) 0); { {{ BteTerminal_private_offset
= g_type_add_instance_private(g_define_type_id, sizeof(bte::
platform::Widget)); } g_type_add_class_private (g_define_type_id
, sizeof (BteTerminalClassPrivate)); { const GInterfaceInfo g_implement_interface_info
= { (GInterfaceInitFunc)(void (*)(void)) bte_terminal_scrollable_iface_init
, __null, __null }; g_type_add_interface_static (g_define_type_id
, (ctk_scrollable_get_type ()), &g_implement_interface_info
); } if (_bte_debug_on(BTE_DEBUG_LIFECYCLE)) { g_printerr("bte_terminal_get_type()\n"
); };} } return g_define_type_id; }
87 BteTerminal_private_offset =static void bte_terminal_init (BteTerminal *self); static void
bte_terminal_class_init (BteTerminalClass *klass); static GType
bte_terminal_get_type_once (void); static gpointer bte_terminal_parent_class
= __null; static gint BteTerminal_private_offset; static void
bte_terminal_class_intern_init (gpointer klass) { bte_terminal_parent_class
= g_type_class_peek_parent (klass); if (BteTerminal_private_offset
!= 0) g_type_class_adjust_private_offset (klass, &BteTerminal_private_offset
); bte_terminal_class_init ((BteTerminalClass*) klass); } __attribute__
((__unused__)) static inline gpointer bte_terminal_get_instance_private
(BteTerminal *self) { return (((gpointer) ((guint8*) (self) +
(glong) (BteTerminal_private_offset)))); } GType bte_terminal_get_type
(void) { static gsize static_g_define_type_id = 0; if ((__extension__
({ static_assert (sizeof *(&static_g_define_type_id) == sizeof
(gpointer), "Expression evaluates to false"); (void) (0 ? (gpointer
) *(&static_g_define_type_id) : __null); (!(__extension__
({ static_assert (sizeof *(&static_g_define_type_id) == sizeof
(gpointer), "Expression evaluates to false"); gpointer gapg_temp_newval
; gpointer *gapg_temp_atomic = (gpointer *)(&static_g_define_type_id
); __atomic_load (gapg_temp_atomic, &gapg_temp_newval, 5)
; gapg_temp_newval; })) && g_once_init_enter (&static_g_define_type_id
)); }))) { GType g_define_type_id = bte_terminal_get_type_once
(); (__extension__ ({ static_assert (sizeof *(&static_g_define_type_id
) == sizeof (gpointer), "Expression evaluates to false"); 0 ?
(void) (*(&static_g_define_type_id) = (g_define_type_id)
) : (void) 0; g_once_init_leave ((&static_g_define_type_id
), (gsize) (g_define_type_id)); })); } return static_g_define_type_id
; } [[gnu::noinline]] static GType bte_terminal_get_type_once
(void) { GType g_define_type_id = g_type_register_static_simple
((ctk_widget_get_type ()), g_intern_static_string ("BteTerminal"
), sizeof (BteTerminalClass), (GClassInitFunc)(void (*)(void)
) bte_terminal_class_intern_init, sizeof (BteTerminal), (GInstanceInitFunc
)(void (*)(void)) bte_terminal_init, (GTypeFlags) 0); { {{ BteTerminal_private_offset
= g_type_add_instance_private(g_define_type_id, sizeof(bte::
platform::Widget)); } g_type_add_class_private (g_define_type_id
, sizeof (BteTerminalClassPrivate)); { const GInterfaceInfo g_implement_interface_info
= { (GInterfaceInitFunc)(void (*)(void)) bte_terminal_scrollable_iface_init
, __null, __null }; g_type_add_interface_static (g_define_type_id
, (ctk_scrollable_get_type ()), &g_implement_interface_info
); } if (_bte_debug_on(BTE_DEBUG_LIFECYCLE)) { g_printerr("bte_terminal_get_type()\n"
); };} } return g_define_type_id; }
88 g_type_add_instance_private(g_define_type_id, sizeof(bte::platform::Widget));static void bte_terminal_init (BteTerminal *self); static void
bte_terminal_class_init (BteTerminalClass *klass); static GType
bte_terminal_get_type_once (void); static gpointer bte_terminal_parent_class
= __null; static gint BteTerminal_private_offset; static void
bte_terminal_class_intern_init (gpointer klass) { bte_terminal_parent_class
= g_type_class_peek_parent (klass); if (BteTerminal_private_offset
!= 0) g_type_class_adjust_private_offset (klass, &BteTerminal_private_offset
); bte_terminal_class_init ((BteTerminalClass*) klass); } __attribute__
((__unused__)) static inline gpointer bte_terminal_get_instance_private
(BteTerminal *self) { return (((gpointer) ((guint8*) (self) +
(glong) (BteTerminal_private_offset)))); } GType bte_terminal_get_type
(void) { static gsize static_g_define_type_id = 0; if ((__extension__
({ static_assert (sizeof *(&static_g_define_type_id) == sizeof
(gpointer), "Expression evaluates to false"); (void) (0 ? (gpointer
) *(&static_g_define_type_id) : __null); (!(__extension__
({ static_assert (sizeof *(&static_g_define_type_id) == sizeof
(gpointer), "Expression evaluates to false"); gpointer gapg_temp_newval
; gpointer *gapg_temp_atomic = (gpointer *)(&static_g_define_type_id
); __atomic_load (gapg_temp_atomic, &gapg_temp_newval, 5)
; gapg_temp_newval; })) && g_once_init_enter (&static_g_define_type_id
)); }))) { GType g_define_type_id = bte_terminal_get_type_once
(); (__extension__ ({ static_assert (sizeof *(&static_g_define_type_id
) == sizeof (gpointer), "Expression evaluates to false"); 0 ?
(void) (*(&static_g_define_type_id) = (g_define_type_id)
) : (void) 0; g_once_init_leave ((&static_g_define_type_id
), (gsize) (g_define_type_id)); })); } return static_g_define_type_id
; } [[gnu::noinline]] static GType bte_terminal_get_type_once
(void) { GType g_define_type_id = g_type_register_static_simple
((ctk_widget_get_type ()), g_intern_static_string ("BteTerminal"
), sizeof (BteTerminalClass), (GClassInitFunc)(void (*)(void)
) bte_terminal_class_intern_init, sizeof (BteTerminal), (GInstanceInitFunc
)(void (*)(void)) bte_terminal_init, (GTypeFlags) 0); { {{ BteTerminal_private_offset
= g_type_add_instance_private(g_define_type_id, sizeof(bte::
platform::Widget)); } g_type_add_class_private (g_define_type_id
, sizeof (BteTerminalClassPrivate)); { const GInterfaceInfo g_implement_interface_info
= { (GInterfaceInitFunc)(void (*)(void)) bte_terminal_scrollable_iface_init
, __null, __null }; g_type_add_interface_static (g_define_type_id
, (ctk_scrollable_get_type ()), &g_implement_interface_info
); } if (_bte_debug_on(BTE_DEBUG_LIFECYCLE)) { g_printerr("bte_terminal_get_type()\n"
); };} } return g_define_type_id; }
89 }static void bte_terminal_init (BteTerminal *self); static void
bte_terminal_class_init (BteTerminalClass *klass); static GType
bte_terminal_get_type_once (void); static gpointer bte_terminal_parent_class
= __null; static gint BteTerminal_private_offset; static void
bte_terminal_class_intern_init (gpointer klass) { bte_terminal_parent_class
= g_type_class_peek_parent (klass); if (BteTerminal_private_offset
!= 0) g_type_class_adjust_private_offset (klass, &BteTerminal_private_offset
); bte_terminal_class_init ((BteTerminalClass*) klass); } __attribute__
((__unused__)) static inline gpointer bte_terminal_get_instance_private
(BteTerminal *self) { return (((gpointer) ((guint8*) (self) +
(glong) (BteTerminal_private_offset)))); } GType bte_terminal_get_type
(void) { static gsize static_g_define_type_id = 0; if ((__extension__
({ static_assert (sizeof *(&static_g_define_type_id) == sizeof
(gpointer), "Expression evaluates to false"); (void) (0 ? (gpointer
) *(&static_g_define_type_id) : __null); (!(__extension__
({ static_assert (sizeof *(&static_g_define_type_id) == sizeof
(gpointer), "Expression evaluates to false"); gpointer gapg_temp_newval
; gpointer *gapg_temp_atomic = (gpointer *)(&static_g_define_type_id
); __atomic_load (gapg_temp_atomic, &gapg_temp_newval, 5)
; gapg_temp_newval; })) && g_once_init_enter (&static_g_define_type_id
)); }))) { GType g_define_type_id = bte_terminal_get_type_once
(); (__extension__ ({ static_assert (sizeof *(&static_g_define_type_id
) == sizeof (gpointer), "Expression evaluates to false"); 0 ?
(void) (*(&static_g_define_type_id) = (g_define_type_id)
) : (void) 0; g_once_init_leave ((&static_g_define_type_id
), (gsize) (g_define_type_id)); })); } return static_g_define_type_id
; } [[gnu::noinline]] static GType bte_terminal_get_type_once
(void) { GType g_define_type_id = g_type_register_static_simple
((ctk_widget_get_type ()), g_intern_static_string ("BteTerminal"
), sizeof (BteTerminalClass), (GClassInitFunc)(void (*)(void)
) bte_terminal_class_intern_init, sizeof (BteTerminal), (GInstanceInitFunc
)(void (*)(void)) bte_terminal_init, (GTypeFlags) 0); { {{ BteTerminal_private_offset
= g_type_add_instance_private(g_define_type_id, sizeof(bte::
platform::Widget)); } g_type_add_class_private (g_define_type_id
, sizeof (BteTerminalClassPrivate)); { const GInterfaceInfo g_implement_interface_info
= { (GInterfaceInitFunc)(void (*)(void)) bte_terminal_scrollable_iface_init
, __null, __null }; g_type_add_interface_static (g_define_type_id
, (ctk_scrollable_get_type ()), &g_implement_interface_info
); } if (_bte_debug_on(BTE_DEBUG_LIFECYCLE)) { g_printerr("bte_terminal_get_type()\n"
); };} } return g_define_type_id; }
90 g_type_add_class_private (g_define_type_id, sizeof (BteTerminalClassPrivate));static void bte_terminal_init (BteTerminal *self); static void
bte_terminal_class_init (BteTerminalClass *klass); static GType
bte_terminal_get_type_once (void); static gpointer bte_terminal_parent_class
= __null; static gint BteTerminal_private_offset; static void
bte_terminal_class_intern_init (gpointer klass) { bte_terminal_parent_class
= g_type_class_peek_parent (klass); if (BteTerminal_private_offset
!= 0) g_type_class_adjust_private_offset (klass, &BteTerminal_private_offset
); bte_terminal_class_init ((BteTerminalClass*) klass); } __attribute__
((__unused__)) static inline gpointer bte_terminal_get_instance_private
(BteTerminal *self) { return (((gpointer) ((guint8*) (self) +
(glong) (BteTerminal_private_offset)))); } GType bte_terminal_get_type
(void) { static gsize static_g_define_type_id = 0; if ((__extension__
({ static_assert (sizeof *(&static_g_define_type_id) == sizeof
(gpointer), "Expression evaluates to false"); (void) (0 ? (gpointer
) *(&static_g_define_type_id) : __null); (!(__extension__
({ static_assert (sizeof *(&static_g_define_type_id) == sizeof
(gpointer), "Expression evaluates to false"); gpointer gapg_temp_newval
; gpointer *gapg_temp_atomic = (gpointer *)(&static_g_define_type_id
); __atomic_load (gapg_temp_atomic, &gapg_temp_newval, 5)
; gapg_temp_newval; })) && g_once_init_enter (&static_g_define_type_id
)); }))) { GType g_define_type_id = bte_terminal_get_type_once
(); (__extension__ ({ static_assert (sizeof *(&static_g_define_type_id
) == sizeof (gpointer), "Expression evaluates to false"); 0 ?
(void) (*(&static_g_define_type_id) = (g_define_type_id)
) : (void) 0; g_once_init_leave ((&static_g_define_type_id
), (gsize) (g_define_type_id)); })); } return static_g_define_type_id
; } [[gnu::noinline]] static GType bte_terminal_get_type_once
(void) { GType g_define_type_id = g_type_register_static_simple
((ctk_widget_get_type ()), g_intern_static_string ("BteTerminal"
), sizeof (BteTerminalClass), (GClassInitFunc)(void (*)(void)
) bte_terminal_class_intern_init, sizeof (BteTerminal), (GInstanceInitFunc
)(void (*)(void)) bte_terminal_init, (GTypeFlags) 0); { {{ BteTerminal_private_offset
= g_type_add_instance_private(g_define_type_id, sizeof(bte::
platform::Widget)); } g_type_add_class_private (g_define_type_id
, sizeof (BteTerminalClassPrivate)); { const GInterfaceInfo g_implement_interface_info
= { (GInterfaceInitFunc)(void (*)(void)) bte_terminal_scrollable_iface_init
, __null, __null }; g_type_add_interface_static (g_define_type_id
, (ctk_scrollable_get_type ()), &g_implement_interface_info
); } if (_bte_debug_on(BTE_DEBUG_LIFECYCLE)) { g_printerr("bte_terminal_get_type()\n"
); };} } return g_define_type_id; }
91 G_IMPLEMENT_INTERFACE(CTK_TYPE_SCROLLABLE, bte_terminal_scrollable_iface_init)static void bte_terminal_init (BteTerminal *self); static void
bte_terminal_class_init (BteTerminalClass *klass); static GType
bte_terminal_get_type_once (void); static gpointer bte_terminal_parent_class
= __null; static gint BteTerminal_private_offset; static void
bte_terminal_class_intern_init (gpointer klass) { bte_terminal_parent_class
= g_type_class_peek_parent (klass); if (BteTerminal_private_offset
!= 0) g_type_class_adjust_private_offset (klass, &BteTerminal_private_offset
); bte_terminal_class_init ((BteTerminalClass*) klass); } __attribute__
((__unused__)) static inline gpointer bte_terminal_get_instance_private
(BteTerminal *self) { return (((gpointer) ((guint8*) (self) +
(glong) (BteTerminal_private_offset)))); } GType bte_terminal_get_type
(void) { static gsize static_g_define_type_id = 0; if ((__extension__
({ static_assert (sizeof *(&static_g_define_type_id) == sizeof
(gpointer), "Expression evaluates to false"); (void) (0 ? (gpointer
) *(&static_g_define_type_id) : __null); (!(__extension__
({ static_assert (sizeof *(&static_g_define_type_id) == sizeof
(gpointer), "Expression evaluates to false"); gpointer gapg_temp_newval
; gpointer *gapg_temp_atomic = (gpointer *)(&static_g_define_type_id
); __atomic_load (gapg_temp_atomic, &gapg_temp_newval, 5)
; gapg_temp_newval; })) && g_once_init_enter (&static_g_define_type_id
)); }))) { GType g_define_type_id = bte_terminal_get_type_once
(); (__extension__ ({ static_assert (sizeof *(&static_g_define_type_id
) == sizeof (gpointer), "Expression evaluates to false"); 0 ?
(void) (*(&static_g_define_type_id) = (g_define_type_id)
) : (void) 0; g_once_init_leave ((&static_g_define_type_id
), (gsize) (g_define_type_id)); })); } return static_g_define_type_id
; } [[gnu::noinline]] static GType bte_terminal_get_type_once
(void) { GType g_define_type_id = g_type_register_static_simple
((ctk_widget_get_type ()), g_intern_static_string ("BteTerminal"
), sizeof (BteTerminalClass), (GClassInitFunc)(void (*)(void)
) bte_terminal_class_intern_init, sizeof (BteTerminal), (GInstanceInitFunc
)(void (*)(void)) bte_terminal_init, (GTypeFlags) 0); { {{ BteTerminal_private_offset
= g_type_add_instance_private(g_define_type_id, sizeof(bte::
platform::Widget)); } g_type_add_class_private (g_define_type_id
, sizeof (BteTerminalClassPrivate)); { const GInterfaceInfo g_implement_interface_info
= { (GInterfaceInitFunc)(void (*)(void)) bte_terminal_scrollable_iface_init
, __null, __null }; g_type_add_interface_static (g_define_type_id
, (ctk_scrollable_get_type ()), &g_implement_interface_info
); } if (_bte_debug_on(BTE_DEBUG_LIFECYCLE)) { g_printerr("bte_terminal_get_type()\n"
); };} } return g_define_type_id; }
92 if (_bte_debug_on(BTE_DEBUG_LIFECYCLE)) {static void bte_terminal_init (BteTerminal *self); static void
bte_terminal_class_init (BteTerminalClass *klass); static GType
bte_terminal_get_type_once (void); static gpointer bte_terminal_parent_class
= __null; static gint BteTerminal_private_offset; static void
bte_terminal_class_intern_init (gpointer klass) { bte_terminal_parent_class
= g_type_class_peek_parent (klass); if (BteTerminal_private_offset
!= 0) g_type_class_adjust_private_offset (klass, &BteTerminal_private_offset
); bte_terminal_class_init ((BteTerminalClass*) klass); } __attribute__
((__unused__)) static inline gpointer bte_terminal_get_instance_private
(BteTerminal *self) { return (((gpointer) ((guint8*) (self) +
(glong) (BteTerminal_private_offset)))); } GType bte_terminal_get_type
(void) { static gsize static_g_define_type_id = 0; if ((__extension__
({ static_assert (sizeof *(&static_g_define_type_id) == sizeof
(gpointer), "Expression evaluates to false"); (void) (0 ? (gpointer
) *(&static_g_define_type_id) : __null); (!(__extension__
({ static_assert (sizeof *(&static_g_define_type_id) == sizeof
(gpointer), "Expression evaluates to false"); gpointer gapg_temp_newval
; gpointer *gapg_temp_atomic = (gpointer *)(&static_g_define_type_id
); __atomic_load (gapg_temp_atomic, &gapg_temp_newval, 5)
; gapg_temp_newval; })) && g_once_init_enter (&static_g_define_type_id
)); }))) { GType g_define_type_id = bte_terminal_get_type_once
(); (__extension__ ({ static_assert (sizeof *(&static_g_define_type_id
) == sizeof (gpointer), "Expression evaluates to false"); 0 ?
(void) (*(&static_g_define_type_id) = (g_define_type_id)
) : (void) 0; g_once_init_leave ((&static_g_define_type_id
), (gsize) (g_define_type_id)); })); } return static_g_define_type_id
; } [[gnu::noinline]] static GType bte_terminal_get_type_once
(void) { GType g_define_type_id = g_type_register_static_simple
((ctk_widget_get_type ()), g_intern_static_string ("BteTerminal"
), sizeof (BteTerminalClass), (GClassInitFunc)(void (*)(void)
) bte_terminal_class_intern_init, sizeof (BteTerminal), (GInstanceInitFunc
)(void (*)(void)) bte_terminal_init, (GTypeFlags) 0); { {{ BteTerminal_private_offset
= g_type_add_instance_private(g_define_type_id, sizeof(bte::
platform::Widget)); } g_type_add_class_private (g_define_type_id
, sizeof (BteTerminalClassPrivate)); { const GInterfaceInfo g_implement_interface_info
= { (GInterfaceInitFunc)(void (*)(void)) bte_terminal_scrollable_iface_init
, __null, __null }; g_type_add_interface_static (g_define_type_id
, (ctk_scrollable_get_type ()), &g_implement_interface_info
); } if (_bte_debug_on(BTE_DEBUG_LIFECYCLE)) { g_printerr("bte_terminal_get_type()\n"
); };} } return g_define_type_id; }
93 g_printerr("bte_terminal_get_type()\n");static void bte_terminal_init (BteTerminal *self); static void
bte_terminal_class_init (BteTerminalClass *klass); static GType
bte_terminal_get_type_once (void); static gpointer bte_terminal_parent_class
= __null; static gint BteTerminal_private_offset; static void
bte_terminal_class_intern_init (gpointer klass) { bte_terminal_parent_class
= g_type_class_peek_parent (klass); if (BteTerminal_private_offset
!= 0) g_type_class_adjust_private_offset (klass, &BteTerminal_private_offset
); bte_terminal_class_init ((BteTerminalClass*) klass); } __attribute__
((__unused__)) static inline gpointer bte_terminal_get_instance_private
(BteTerminal *self) { return (((gpointer) ((guint8*) (self) +
(glong) (BteTerminal_private_offset)))); } GType bte_terminal_get_type
(void) { static gsize static_g_define_type_id = 0; if ((__extension__
({ static_assert (sizeof *(&static_g_define_type_id) == sizeof
(gpointer), "Expression evaluates to false"); (void) (0 ? (gpointer
) *(&static_g_define_type_id) : __null); (!(__extension__
({ static_assert (sizeof *(&static_g_define_type_id) == sizeof
(gpointer), "Expression evaluates to false"); gpointer gapg_temp_newval
; gpointer *gapg_temp_atomic = (gpointer *)(&static_g_define_type_id
); __atomic_load (gapg_temp_atomic, &gapg_temp_newval, 5)
; gapg_temp_newval; })) && g_once_init_enter (&static_g_define_type_id
)); }))) { GType g_define_type_id = bte_terminal_get_type_once
(); (__extension__ ({ static_assert (sizeof *(&static_g_define_type_id
) == sizeof (gpointer), "Expression evaluates to false"); 0 ?
(void) (*(&static_g_define_type_id) = (g_define_type_id)
) : (void) 0; g_once_init_leave ((&static_g_define_type_id
), (gsize) (g_define_type_id)); })); } return static_g_define_type_id
; } [[gnu::noinline]] static GType bte_terminal_get_type_once
(void) { GType g_define_type_id = g_type_register_static_simple
((ctk_widget_get_type ()), g_intern_static_string ("BteTerminal"
), sizeof (BteTerminalClass), (GClassInitFunc)(void (*)(void)
) bte_terminal_class_intern_init, sizeof (BteTerminal), (GInstanceInitFunc
)(void (*)(void)) bte_terminal_init, (GTypeFlags) 0); { {{ BteTerminal_private_offset
= g_type_add_instance_private(g_define_type_id, sizeof(bte::
platform::Widget)); } g_type_add_class_private (g_define_type_id
, sizeof (BteTerminalClassPrivate)); { const GInterfaceInfo g_implement_interface_info
= { (GInterfaceInitFunc)(void (*)(void)) bte_terminal_scrollable_iface_init
, __null, __null }; g_type_add_interface_static (g_define_type_id
, (ctk_scrollable_get_type ()), &g_implement_interface_info
); } if (_bte_debug_on(BTE_DEBUG_LIFECYCLE)) { g_printerr("bte_terminal_get_type()\n"
); };} } return g_define_type_id; }
94 })static void bte_terminal_init (BteTerminal *self); static void
bte_terminal_class_init (BteTerminalClass *klass); static GType
bte_terminal_get_type_once (void); static gpointer bte_terminal_parent_class
= __null; static gint BteTerminal_private_offset; static void
bte_terminal_class_intern_init (gpointer klass) { bte_terminal_parent_class
= g_type_class_peek_parent (klass); if (BteTerminal_private_offset
!= 0) g_type_class_adjust_private_offset (klass, &BteTerminal_private_offset
); bte_terminal_class_init ((BteTerminalClass*) klass); } __attribute__
((__unused__)) static inline gpointer bte_terminal_get_instance_private
(BteTerminal *self) { return (((gpointer) ((guint8*) (self) +
(glong) (BteTerminal_private_offset)))); } GType bte_terminal_get_type
(void) { static gsize static_g_define_type_id = 0; if ((__extension__
({ static_assert (sizeof *(&static_g_define_type_id) == sizeof
(gpointer), "Expression evaluates to false"); (void) (0 ? (gpointer
) *(&static_g_define_type_id) : __null); (!(__extension__
({ static_assert (sizeof *(&static_g_define_type_id) == sizeof
(gpointer), "Expression evaluates to false"); gpointer gapg_temp_newval
; gpointer *gapg_temp_atomic = (gpointer *)(&static_g_define_type_id
); __atomic_load (gapg_temp_atomic, &gapg_temp_newval, 5)
; gapg_temp_newval; })) && g_once_init_enter (&static_g_define_type_id
)); }))) { GType g_define_type_id = bte_terminal_get_type_once
(); (__extension__ ({ static_assert (sizeof *(&static_g_define_type_id
) == sizeof (gpointer), "Expression evaluates to false"); 0 ?
(void) (*(&static_g_define_type_id) = (g_define_type_id)
) : (void) 0; g_once_init_leave ((&static_g_define_type_id
), (gsize) (g_define_type_id)); })); } return static_g_define_type_id
; } [[gnu::noinline]] static GType bte_terminal_get_type_once
(void) { GType g_define_type_id = g_type_register_static_simple
((ctk_widget_get_type ()), g_intern_static_string ("BteTerminal"
), sizeof (BteTerminalClass), (GClassInitFunc)(void (*)(void)
) bte_terminal_class_intern_init, sizeof (BteTerminal), (GInstanceInitFunc
)(void (*)(void)) bte_terminal_init, (GTypeFlags) 0); { {{ BteTerminal_private_offset
= g_type_add_instance_private(g_define_type_id, sizeof(bte::
platform::Widget)); } g_type_add_class_private (g_define_type_id
, sizeof (BteTerminalClassPrivate)); { const GInterfaceInfo g_implement_interface_info
= { (GInterfaceInitFunc)(void (*)(void)) bte_terminal_scrollable_iface_init
, __null, __null }; g_type_add_interface_static (g_define_type_id
, (ctk_scrollable_get_type ()), &g_implement_interface_info
); } if (_bte_debug_on(BTE_DEBUG_LIFECYCLE)) { g_printerr("bte_terminal_get_type()\n"
); };} } return g_define_type_id; }
95#else
96G_DEFINE_TYPE_WITH_CODE(BteTerminal, bte_terminal, CTK_TYPE_WIDGET,static void bte_terminal_init (BteTerminal *self); static void
bte_terminal_class_init (BteTerminalClass *klass); static GType
bte_terminal_get_type_once (void); static gpointer bte_terminal_parent_class
= __null; static gint BteTerminal_private_offset; static void
bte_terminal_class_intern_init (gpointer klass) { bte_terminal_parent_class
= g_type_class_peek_parent (klass); if (BteTerminal_private_offset
!= 0) g_type_class_adjust_private_offset (klass, &BteTerminal_private_offset
); bte_terminal_class_init ((BteTerminalClass*) klass); } __attribute__
((__unused__)) static inline gpointer bte_terminal_get_instance_private
(BteTerminal *self) { return (((gpointer) ((guint8*) (self) +
(glong) (BteTerminal_private_offset)))); } GType bte_terminal_get_type
(void) { static gsize static_g_define_type_id = 0; if ((__extension__
({ static_assert (sizeof *(&static_g_define_type_id) == sizeof
(gpointer), "Expression evaluates to false"); (void) (0 ? (gpointer
) *(&static_g_define_type_id) : __null); (!(__extension__
({ static_assert (sizeof *(&static_g_define_type_id) == sizeof
(gpointer), "Expression evaluates to false"); gpointer gapg_temp_newval
; gpointer *gapg_temp_atomic = (gpointer *)(&static_g_define_type_id
); __atomic_load (gapg_temp_atomic, &gapg_temp_newval, 5)
; gapg_temp_newval; })) && g_once_init_enter (&static_g_define_type_id
)); }))) { GType g_define_type_id = bte_terminal_get_type_once
(); (__extension__ ({ static_assert (sizeof *(&static_g_define_type_id
) == sizeof (gpointer), "Expression evaluates to false"); 0 ?
(void) (*(&static_g_define_type_id) = (g_define_type_id)
) : (void) 0; g_once_init_leave ((&static_g_define_type_id
), (gsize) (g_define_type_id)); })); } return static_g_define_type_id
; } [[gnu::noinline]] static GType bte_terminal_get_type_once
(void) { GType g_define_type_id = g_type_register_static_simple
((ctk_widget_get_type ()), g_intern_static_string ("BteTerminal"
), sizeof (BteTerminalClass), (GClassInitFunc)(void (*)(void)
) bte_terminal_class_intern_init, sizeof (BteTerminal), (GInstanceInitFunc
)(void (*)(void)) bte_terminal_init, (GTypeFlags) 0); { {{ BteTerminal_private_offset
= g_type_add_instance_private(g_define_type_id, sizeof(bte::
platform::Widget)); } g_type_add_class_private (g_define_type_id
, sizeof (BteTerminalClassPrivate)); { const GInterfaceInfo g_implement_interface_info
= { (GInterfaceInitFunc)(void (*)(void)) bte_terminal_scrollable_iface_init
, __null, __null }; g_type_add_interface_static (g_define_type_id
, (ctk_scrollable_get_type ()), &g_implement_interface_info
); };} } return g_define_type_id; }
97 {static void bte_terminal_init (BteTerminal *self); static void
bte_terminal_class_init (BteTerminalClass *klass); static GType
bte_terminal_get_type_once (void); static gpointer bte_terminal_parent_class
= __null; static gint BteTerminal_private_offset; static void
bte_terminal_class_intern_init (gpointer klass) { bte_terminal_parent_class
= g_type_class_peek_parent (klass); if (BteTerminal_private_offset
!= 0) g_type_class_adjust_private_offset (klass, &BteTerminal_private_offset
); bte_terminal_class_init ((BteTerminalClass*) klass); } __attribute__
((__unused__)) static inline gpointer bte_terminal_get_instance_private
(BteTerminal *self) { return (((gpointer) ((guint8*) (self) +
(glong) (BteTerminal_private_offset)))); } GType bte_terminal_get_type
(void) { static gsize static_g_define_type_id = 0; if ((__extension__
({ static_assert (sizeof *(&static_g_define_type_id) == sizeof
(gpointer), "Expression evaluates to false"); (void) (0 ? (gpointer
) *(&static_g_define_type_id) : __null); (!(__extension__
({ static_assert (sizeof *(&static_g_define_type_id) == sizeof
(gpointer), "Expression evaluates to false"); gpointer gapg_temp_newval
; gpointer *gapg_temp_atomic = (gpointer *)(&static_g_define_type_id
); __atomic_load (gapg_temp_atomic, &gapg_temp_newval, 5)
; gapg_temp_newval; })) && g_once_init_enter (&static_g_define_type_id
)); }))) { GType g_define_type_id = bte_terminal_get_type_once
(); (__extension__ ({ static_assert (sizeof *(&static_g_define_type_id
) == sizeof (gpointer), "Expression evaluates to false"); 0 ?
(void) (*(&static_g_define_type_id) = (g_define_type_id)
) : (void) 0; g_once_init_leave ((&static_g_define_type_id
), (gsize) (g_define_type_id)); })); } return static_g_define_type_id
; } [[gnu::noinline]] static GType bte_terminal_get_type_once
(void) { GType g_define_type_id = g_type_register_static_simple
((ctk_widget_get_type ()), g_intern_static_string ("BteTerminal"
), sizeof (BteTerminalClass), (GClassInitFunc)(void (*)(void)
) bte_terminal_class_intern_init, sizeof (BteTerminal), (GInstanceInitFunc
)(void (*)(void)) bte_terminal_init, (GTypeFlags) 0); { {{ BteTerminal_private_offset
= g_type_add_instance_private(g_define_type_id, sizeof(bte::
platform::Widget)); } g_type_add_class_private (g_define_type_id
, sizeof (BteTerminalClassPrivate)); { const GInterfaceInfo g_implement_interface_info
= { (GInterfaceInitFunc)(void (*)(void)) bte_terminal_scrollable_iface_init
, __null, __null }; g_type_add_interface_static (g_define_type_id
, (ctk_scrollable_get_type ()), &g_implement_interface_info
); };} } return g_define_type_id; }
98 BteTerminal_private_offset =static void bte_terminal_init (BteTerminal *self); static void
bte_terminal_class_init (BteTerminalClass *klass); static GType
bte_terminal_get_type_once (void); static gpointer bte_terminal_parent_class
= __null; static gint BteTerminal_private_offset; static void
bte_terminal_class_intern_init (gpointer klass) { bte_terminal_parent_class
= g_type_class_peek_parent (klass); if (BteTerminal_private_offset
!= 0) g_type_class_adjust_private_offset (klass, &BteTerminal_private_offset
); bte_terminal_class_init ((BteTerminalClass*) klass); } __attribute__
((__unused__)) static inline gpointer bte_terminal_get_instance_private
(BteTerminal *self) { return (((gpointer) ((guint8*) (self) +
(glong) (BteTerminal_private_offset)))); } GType bte_terminal_get_type
(void) { static gsize static_g_define_type_id = 0; if ((__extension__
({ static_assert (sizeof *(&static_g_define_type_id) == sizeof
(gpointer), "Expression evaluates to false"); (void) (0 ? (gpointer
) *(&static_g_define_type_id) : __null); (!(__extension__
({ static_assert (sizeof *(&static_g_define_type_id) == sizeof
(gpointer), "Expression evaluates to false"); gpointer gapg_temp_newval
; gpointer *gapg_temp_atomic = (gpointer *)(&static_g_define_type_id
); __atomic_load (gapg_temp_atomic, &gapg_temp_newval, 5)
; gapg_temp_newval; })) && g_once_init_enter (&static_g_define_type_id
)); }))) { GType g_define_type_id = bte_terminal_get_type_once
(); (__extension__ ({ static_assert (sizeof *(&static_g_define_type_id
) == sizeof (gpointer), "Expression evaluates to false"); 0 ?
(void) (*(&static_g_define_type_id) = (g_define_type_id)
) : (void) 0; g_once_init_leave ((&static_g_define_type_id
), (gsize) (g_define_type_id)); })); } return static_g_define_type_id
; } [[gnu::noinline]] static GType bte_terminal_get_type_once
(void) { GType g_define_type_id = g_type_register_static_simple
((ctk_widget_get_type ()), g_intern_static_string ("BteTerminal"
), sizeof (BteTerminalClass), (GClassInitFunc)(void (*)(void)
) bte_terminal_class_intern_init, sizeof (BteTerminal), (GInstanceInitFunc
)(void (*)(void)) bte_terminal_init, (GTypeFlags) 0); { {{ BteTerminal_private_offset
= g_type_add_instance_private(g_define_type_id, sizeof(bte::
platform::Widget)); } g_type_add_class_private (g_define_type_id
, sizeof (BteTerminalClassPrivate)); { const GInterfaceInfo g_implement_interface_info
= { (GInterfaceInitFunc)(void (*)(void)) bte_terminal_scrollable_iface_init
, __null, __null }; g_type_add_interface_static (g_define_type_id
, (ctk_scrollable_get_type ()), &g_implement_interface_info
); };} } return g_define_type_id; }
99 g_type_add_instance_private(g_define_type_id, sizeof(bte::platform::Widget));static void bte_terminal_init (BteTerminal *self); static void
bte_terminal_class_init (BteTerminalClass *klass); static GType
bte_terminal_get_type_once (void); static gpointer bte_terminal_parent_class
= __null; static gint BteTerminal_private_offset; static void
bte_terminal_class_intern_init (gpointer klass) { bte_terminal_parent_class
= g_type_class_peek_parent (klass); if (BteTerminal_private_offset
!= 0) g_type_class_adjust_private_offset (klass, &BteTerminal_private_offset
); bte_terminal_class_init ((BteTerminalClass*) klass); } __attribute__
((__unused__)) static inline gpointer bte_terminal_get_instance_private
(BteTerminal *self) { return (((gpointer) ((guint8*) (self) +
(glong) (BteTerminal_private_offset)))); } GType bte_terminal_get_type
(void) { static gsize static_g_define_type_id = 0; if ((__extension__
({ static_assert (sizeof *(&static_g_define_type_id) == sizeof
(gpointer), "Expression evaluates to false"); (void) (0 ? (gpointer
) *(&static_g_define_type_id) : __null); (!(__extension__
({ static_assert (sizeof *(&static_g_define_type_id) == sizeof
(gpointer), "Expression evaluates to false"); gpointer gapg_temp_newval
; gpointer *gapg_temp_atomic = (gpointer *)(&static_g_define_type_id
); __atomic_load (gapg_temp_atomic, &gapg_temp_newval, 5)
; gapg_temp_newval; })) && g_once_init_enter (&static_g_define_type_id
)); }))) { GType g_define_type_id = bte_terminal_get_type_once
(); (__extension__ ({ static_assert (sizeof *(&static_g_define_type_id
) == sizeof (gpointer), "Expression evaluates to false"); 0 ?
(void) (*(&static_g_define_type_id) = (g_define_type_id)
) : (void) 0; g_once_init_leave ((&static_g_define_type_id
), (gsize) (g_define_type_id)); })); } return static_g_define_type_id
; } [[gnu::noinline]] static GType bte_terminal_get_type_once
(void) { GType g_define_type_id = g_type_register_static_simple
((ctk_widget_get_type ()), g_intern_static_string ("BteTerminal"
), sizeof (BteTerminalClass), (GClassInitFunc)(void (*)(void)
) bte_terminal_class_intern_init, sizeof (BteTerminal), (GInstanceInitFunc
)(void (*)(void)) bte_terminal_init, (GTypeFlags) 0); { {{ BteTerminal_private_offset
= g_type_add_instance_private(g_define_type_id, sizeof(bte::
platform::Widget)); } g_type_add_class_private (g_define_type_id
, sizeof (BteTerminalClassPrivate)); { const GInterfaceInfo g_implement_interface_info
= { (GInterfaceInitFunc)(void (*)(void)) bte_terminal_scrollable_iface_init
, __null, __null }; g_type_add_interface_static (g_define_type_id
, (ctk_scrollable_get_type ()), &g_implement_interface_info
); };} } return g_define_type_id; }
100 }static void bte_terminal_init (BteTerminal *self); static void
bte_terminal_class_init (BteTerminalClass *klass); static GType
bte_terminal_get_type_once (void); static gpointer bte_terminal_parent_class
= __null; static gint BteTerminal_private_offset; static void
bte_terminal_class_intern_init (gpointer klass) { bte_terminal_parent_class
= g_type_class_peek_parent (klass); if (BteTerminal_private_offset
!= 0) g_type_class_adjust_private_offset (klass, &BteTerminal_private_offset
); bte_terminal_class_init ((BteTerminalClass*) klass); } __attribute__
((__unused__)) static inline gpointer bte_terminal_get_instance_private
(BteTerminal *self) { return (((gpointer) ((guint8*) (self) +
(glong) (BteTerminal_private_offset)))); } GType bte_terminal_get_type
(void) { static gsize static_g_define_type_id = 0; if ((__extension__
({ static_assert (sizeof *(&static_g_define_type_id) == sizeof
(gpointer), "Expression evaluates to false"); (void) (0 ? (gpointer
) *(&static_g_define_type_id) : __null); (!(__extension__
({ static_assert (sizeof *(&static_g_define_type_id) == sizeof
(gpointer), "Expression evaluates to false"); gpointer gapg_temp_newval
; gpointer *gapg_temp_atomic = (gpointer *)(&static_g_define_type_id
); __atomic_load (gapg_temp_atomic, &gapg_temp_newval, 5)
; gapg_temp_newval; })) && g_once_init_enter (&static_g_define_type_id
)); }))) { GType g_define_type_id = bte_terminal_get_type_once
(); (__extension__ ({ static_assert (sizeof *(&static_g_define_type_id
) == sizeof (gpointer), "Expression evaluates to false"); 0 ?
(void) (*(&static_g_define_type_id) = (g_define_type_id)
) : (void) 0; g_once_init_leave ((&static_g_define_type_id
), (gsize) (g_define_type_id)); })); } return static_g_define_type_id
; } [[gnu::noinline]] static GType bte_terminal_get_type_once
(void) { GType g_define_type_id = g_type_register_static_simple
((ctk_widget_get_type ()), g_intern_static_string ("BteTerminal"
), sizeof (BteTerminalClass), (GClassInitFunc)(void (*)(void)
) bte_terminal_class_intern_init, sizeof (BteTerminal), (GInstanceInitFunc
)(void (*)(void)) bte_terminal_init, (GTypeFlags) 0); { {{ BteTerminal_private_offset
= g_type_add_instance_private(g_define_type_id, sizeof(bte::
platform::Widget)); } g_type_add_class_private (g_define_type_id
, sizeof (BteTerminalClassPrivate)); { const GInterfaceInfo g_implement_interface_info
= { (GInterfaceInitFunc)(void (*)(void)) bte_terminal_scrollable_iface_init
, __null, __null }; g_type_add_interface_static (g_define_type_id
, (ctk_scrollable_get_type ()), &g_implement_interface_info
); };} } return g_define_type_id; }
101 g_type_add_class_private (g_define_type_id, sizeof (BteTerminalClassPrivate));static void bte_terminal_init (BteTerminal *self); static void
bte_terminal_class_init (BteTerminalClass *klass); static GType
bte_terminal_get_type_once (void); static gpointer bte_terminal_parent_class
= __null; static gint BteTerminal_private_offset; static void
bte_terminal_class_intern_init (gpointer klass) { bte_terminal_parent_class
= g_type_class_peek_parent (klass); if (BteTerminal_private_offset
!= 0) g_type_class_adjust_private_offset (klass, &BteTerminal_private_offset
); bte_terminal_class_init ((BteTerminalClass*) klass); } __attribute__
((__unused__)) static inline gpointer bte_terminal_get_instance_private
(BteTerminal *self) { return (((gpointer) ((guint8*) (self) +
(glong) (BteTerminal_private_offset)))); } GType bte_terminal_get_type
(void) { static gsize static_g_define_type_id = 0; if ((__extension__
({ static_assert (sizeof *(&static_g_define_type_id) == sizeof
(gpointer), "Expression evaluates to false"); (void) (0 ? (gpointer
) *(&static_g_define_type_id) : __null); (!(__extension__
({ static_assert (sizeof *(&static_g_define_type_id) == sizeof
(gpointer), "Expression evaluates to false"); gpointer gapg_temp_newval
; gpointer *gapg_temp_atomic = (gpointer *)(&static_g_define_type_id
); __atomic_load (gapg_temp_atomic, &gapg_temp_newval, 5)
; gapg_temp_newval; })) && g_once_init_enter (&static_g_define_type_id
)); }))) { GType g_define_type_id = bte_terminal_get_type_once
(); (__extension__ ({ static_assert (sizeof *(&static_g_define_type_id
) == sizeof (gpointer), "Expression evaluates to false"); 0 ?
(void) (*(&static_g_define_type_id) = (g_define_type_id)
) : (void) 0; g_once_init_leave ((&static_g_define_type_id
), (gsize) (g_define_type_id)); })); } return static_g_define_type_id
; } [[gnu::noinline]] static GType bte_terminal_get_type_once
(void) { GType g_define_type_id = g_type_register_static_simple
((ctk_widget_get_type ()), g_intern_static_string ("BteTerminal"
), sizeof (BteTerminalClass), (GClassInitFunc)(void (*)(void)
) bte_terminal_class_intern_init, sizeof (BteTerminal), (GInstanceInitFunc
)(void (*)(void)) bte_terminal_init, (GTypeFlags) 0); { {{ BteTerminal_private_offset
= g_type_add_instance_private(g_define_type_id, sizeof(bte::
platform::Widget)); } g_type_add_class_private (g_define_type_id
, sizeof (BteTerminalClassPrivate)); { const GInterfaceInfo g_implement_interface_info
= { (GInterfaceInitFunc)(void (*)(void)) bte_terminal_scrollable_iface_init
, __null, __null }; g_type_add_interface_static (g_define_type_id
, (ctk_scrollable_get_type ()), &g_implement_interface_info
); };} } return g_define_type_id; }
102 G_IMPLEMENT_INTERFACE(CTK_TYPE_SCROLLABLE, bte_terminal_scrollable_iface_init))static void bte_terminal_init (BteTerminal *self); static void
bte_terminal_class_init (BteTerminalClass *klass); static GType
bte_terminal_get_type_once (void); static gpointer bte_terminal_parent_class
= __null; static gint BteTerminal_private_offset; static void
bte_terminal_class_intern_init (gpointer klass) { bte_terminal_parent_class
= g_type_class_peek_parent (klass); if (BteTerminal_private_offset
!= 0) g_type_class_adjust_private_offset (klass, &BteTerminal_private_offset
); bte_terminal_class_init ((BteTerminalClass*) klass); } __attribute__
((__unused__)) static inline gpointer bte_terminal_get_instance_private
(BteTerminal *self) { return (((gpointer) ((guint8*) (self) +
(glong) (BteTerminal_private_offset)))); } GType bte_terminal_get_type
(void) { static gsize static_g_define_type_id = 0; if ((__extension__
({ static_assert (sizeof *(&static_g_define_type_id) == sizeof
(gpointer), "Expression evaluates to false"); (void) (0 ? (gpointer
) *(&static_g_define_type_id) : __null); (!(__extension__
({ static_assert (sizeof *(&static_g_define_type_id) == sizeof
(gpointer), "Expression evaluates to false"); gpointer gapg_temp_newval
; gpointer *gapg_temp_atomic = (gpointer *)(&static_g_define_type_id
); __atomic_load (gapg_temp_atomic, &gapg_temp_newval, 5)
; gapg_temp_newval; })) && g_once_init_enter (&static_g_define_type_id
)); }))) { GType g_define_type_id = bte_terminal_get_type_once
(); (__extension__ ({ static_assert (sizeof *(&static_g_define_type_id
) == sizeof (gpointer), "Expression evaluates to false"); 0 ?
(void) (*(&static_g_define_type_id) = (g_define_type_id)
) : (void) 0; g_once_init_leave ((&static_g_define_type_id
), (gsize) (g_define_type_id)); })); } return static_g_define_type_id
; } [[gnu::noinline]] static GType bte_terminal_get_type_once
(void) { GType g_define_type_id = g_type_register_static_simple
((ctk_widget_get_type ()), g_intern_static_string ("BteTerminal"
), sizeof (BteTerminalClass), (GClassInitFunc)(void (*)(void)
) bte_terminal_class_intern_init, sizeof (BteTerminal), (GInstanceInitFunc
)(void (*)(void)) bte_terminal_init, (GTypeFlags) 0); { {{ BteTerminal_private_offset
= g_type_add_instance_private(g_define_type_id, sizeof(bte::
platform::Widget)); } g_type_add_class_private (g_define_type_id
, sizeof (BteTerminalClassPrivate)); { const GInterfaceInfo g_implement_interface_info
= { (GInterfaceInitFunc)(void (*)(void)) bte_terminal_scrollable_iface_init
, __null, __null }; g_type_add_interface_static (g_define_type_id
, (ctk_scrollable_get_type ()), &g_implement_interface_info
); };} } return g_define_type_id; }
103#endif
104
105static inline
106bte::platform::Widget* get_widget(BteTerminal* terminal)
107{
108 return reinterpret_cast<bte::platform::Widget*>(bte_terminal_get_instance_private(terminal));
109}
110
111#define WIDGET(t)(get_widget(t)) (get_widget(t))
112
113bte::terminal::Terminal*
114_bte_terminal_get_impl(BteTerminal *terminal)
115{
116 return WIDGET(terminal)(get_widget(terminal))->terminal();
117}
118
119#define IMPL(t)(_bte_terminal_get_impl(t)) (_bte_terminal_get_impl(t))
120
121guint signals[LAST_SIGNAL];
122GParamSpec *pspecs[LAST_PROP];
123GTimer *process_timer;
124uint64_t g_test_flags = 0;
125
126static bool
127valid_color(CdkRGBA const* color) noexcept
128{
129 return color->red >= 0. && color->red <= 1. &&
130 color->green >= 0. && color->green <= 1. &&
131 color->blue >= 0. && color->blue <= 1. &&
132 color->alpha >= 0. && color->alpha <= 1.;
133}
134
135static void
136bte_terminal_set_hadjustment(BteTerminal *terminal,
137 CtkAdjustment *adjustment) noexcept
138try
139{
140 g_return_if_fail(adjustment == nullptr || CTK_IS_ADJUSTMENT(adjustment))do { if ((__builtin_expect (__extension__ ({ int _g_boolean_var_
; if (adjustment == nullptr || (((__extension__ ({ GTypeInstance
*__inst = (GTypeInstance*) ((adjustment)); GType __t = ((ctk_adjustment_get_type
())); gboolean __r; if (!__inst) __r = (0); else if (__inst->
g_class && __inst->g_class->g_type == __t) __r =
(!(0)); else __r = g_type_check_instance_is_a (__inst, __t);
__r; }))))) _g_boolean_var_ = 1; else _g_boolean_var_ = 0; _g_boolean_var_
; }), 1))) { } else { g_return_if_fail_warning ("BTE", ((const
char*) (__PRETTY_FUNCTION__)), "adjustment == nullptr || CTK_IS_ADJUSTMENT(adjustment)"
); return; } } while (0)
;
141 WIDGET(terminal)(get_widget(terminal))->set_hadjustment(bte::glib::make_ref_sink(adjustment));
142}
143catch (...)
144{
145 bte::log_exception();
146}
147
148static void
149bte_terminal_set_vadjustment(BteTerminal *terminal,
150 CtkAdjustment *adjustment) noexcept
151try
152{
153 g_return_if_fail(adjustment == nullptr || CTK_IS_ADJUSTMENT(adjustment))do { if ((__builtin_expect (__extension__ ({ int _g_boolean_var_
; if (adjustment == nullptr || (((__extension__ ({ GTypeInstance
*__inst = (GTypeInstance*) ((adjustment)); GType __t = ((ctk_adjustment_get_type
())); gboolean __r; if (!__inst) __r = (0); else if (__inst->
g_class && __inst->g_class->g_type == __t) __r =
(!(0)); else __r = g_type_check_instance_is_a (__inst, __t);
__r; }))))) _g_boolean_var_ = 1; else _g_boolean_var_ = 0; _g_boolean_var_
; }), 1))) { } else { g_return_if_fail_warning ("BTE", ((const
char*) (__PRETTY_FUNCTION__)), "adjustment == nullptr || CTK_IS_ADJUSTMENT(adjustment)"
); return; } } while (0)
;
154 WIDGET(terminal)(get_widget(terminal))->set_vadjustment(bte::glib::make_ref_sink(adjustment));
155}
156catch (...)
157{
158 bte::log_exception();
159}
160
161static void
162bte_terminal_set_hscroll_policy(BteTerminal *terminal,
163 CtkScrollablePolicy policy) noexcept
164try
165{
166 WIDGET(terminal)(get_widget(terminal))->set_hscroll_policy(policy);
167 ctk_widget_queue_resize_no_redraw (CTK_WIDGET (terminal)((((CtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((terminal)), ((ctk_widget_get_type ()))))))
);
168}
169catch (...)
170{
171 bte::log_exception();
172}
173
174static void
175bte_terminal_set_vscroll_policy(BteTerminal *terminal,
176 CtkScrollablePolicy policy) noexcept
177try
178{
179 WIDGET(terminal)(get_widget(terminal))->set_vscroll_policy(policy);
180 ctk_widget_queue_resize_no_redraw (CTK_WIDGET (terminal)((((CtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((terminal)), ((ctk_widget_get_type ()))))))
);
181}
182catch (...)
183{
184 bte::log_exception();
185}
186
187static void
188bte_terminal_real_copy_clipboard(BteTerminal *terminal) noexcept
189try
190{
191 WIDGET(terminal)(get_widget(terminal))->copy(BTE_SELECTION_CLIPBOARD, BTE_FORMAT_TEXT);
192}
193catch (...)
194{
195 bte::log_exception();
196}
197
198static void
199bte_terminal_real_paste_clipboard(BteTerminal *terminal) noexcept
200try
201{
202 WIDGET(terminal)(get_widget(terminal))->paste(CDK_SELECTION_CLIPBOARD((CdkAtom)((gpointer) (gulong) (69))));
203}
204catch (...)
205{
206 bte::log_exception();
207}
208
209static void
210bte_terminal_style_updated (CtkWidget *widget) noexcept
211try
212{
213 BteTerminal *terminal = BTE_TERMINAL(widget)((((BteTerminal*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((widget)), ((bte_terminal_get_type()))))))
;
214
215 CTK_WIDGET_CLASS (bte_terminal_parent_class)((((CtkWidgetClass*) (void *) g_type_check_class_cast ((GTypeClass
*) ((bte_terminal_parent_class)), ((ctk_widget_get_type ())))
)))
->style_updated (widget);
216
217 WIDGET(terminal)(get_widget(terminal))->style_updated();
218}
219catch (...)
220{
221 bte::log_exception();
222}
223
224static gboolean
225bte_terminal_key_press(CtkWidget *widget,
226 CdkEventKey *event) noexcept
227try
228{
229 BteTerminal *terminal = BTE_TERMINAL(widget)((((BteTerminal*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((widget)), ((bte_terminal_get_type()))))))
;
230
231 /* We do NOT want chain up to CtkWidget::key-press-event, since that would
232 * cause CtkWidget's keybindings to be handled and consumed. However we'll
233 * have to handle the one sane binding (Shift-F10 or MenuKey, to pop up the
234 * context menu) ourself, so for now we simply skip the offending keybinding
235 * in class_init.
236 */
237
238 /* First, check if CtkWidget's behavior already does something with
239 * this key. */
240 if (CTK_WIDGET_CLASS(bte_terminal_parent_class)((((CtkWidgetClass*) (void *) g_type_check_class_cast ((GTypeClass
*) ((bte_terminal_parent_class)), ((ctk_widget_get_type ())))
)))
->key_press_event) {
241 if ((CTK_WIDGET_CLASS(bte_terminal_parent_class)((((CtkWidgetClass*) (void *) g_type_check_class_cast ((GTypeClass
*) ((bte_terminal_parent_class)), ((ctk_widget_get_type ())))
)))
)->key_press_event(widget,
242 event)) {
243 return TRUE(!(0));
244 }
245 }
246
247 return WIDGET(terminal)(get_widget(terminal))->key_press(event);
248}
249catch (...)
250{
251 bte::log_exception();
252 return true;
253}
254
255static gboolean
256bte_terminal_key_release(CtkWidget *widget,
257 CdkEventKey *event) noexcept
258try
259{
260 BteTerminal *terminal = BTE_TERMINAL(widget)((((BteTerminal*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((widget)), ((bte_terminal_get_type()))))))
;
261 return WIDGET(terminal)(get_widget(terminal))->key_release(event);
262}
263catch (...)
264{
265 bte::log_exception();
266 return true;
267}
268
269static gboolean
270bte_terminal_motion_notify(CtkWidget *widget,
271 CdkEventMotion *event) noexcept
272try
273{
274 BteTerminal *terminal = BTE_TERMINAL(widget)((((BteTerminal*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((widget)), ((bte_terminal_get_type()))))))
;
275 return WIDGET(terminal)(get_widget(terminal))->motion_notify(event);
276}
277catch (...)
278{
279 bte::log_exception();
280 return true;
281}
282
283static gboolean
284bte_terminal_button_press(CtkWidget *widget,
285 CdkEventButton *event) noexcept
286try
287{
288 BteTerminal *terminal = BTE_TERMINAL(widget)((((BteTerminal*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((widget)), ((bte_terminal_get_type()))))))
;
289 return WIDGET(terminal)(get_widget(terminal))->button_press(event);
290}
291catch (...)
292{
293 bte::log_exception();
294 return true;
295}
296
297static gboolean
298bte_terminal_button_release(CtkWidget *widget,
299 CdkEventButton *event) noexcept
300try
301{
302 BteTerminal *terminal = BTE_TERMINAL(widget)((((BteTerminal*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((widget)), ((bte_terminal_get_type()))))))
;
303 return WIDGET(terminal)(get_widget(terminal))->button_release(event);
304}
305catch (...)
306{
307 bte::log_exception();
308 return true;
309}
310
311static gboolean
312bte_terminal_scroll(CtkWidget *widget,
313 CdkEventScroll *event) noexcept
314try
315{
316 BteTerminal *terminal = BTE_TERMINAL(widget)((((BteTerminal*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((widget)), ((bte_terminal_get_type()))))))
;
317 WIDGET(terminal)(get_widget(terminal))->scroll(event);
318 return TRUE(!(0));
319}
320catch (...)
321{
322 bte::log_exception();
323 return true;
324}
325
326static gboolean
327bte_terminal_focus_in(CtkWidget *widget,
328 CdkEventFocus *event) noexcept
329try
330{
331 BteTerminal *terminal = BTE_TERMINAL(widget)((((BteTerminal*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((widget)), ((bte_terminal_get_type()))))))
;
332 WIDGET(terminal)(get_widget(terminal))->focus_in(event);
333 return FALSE(0);
334}
335catch (...)
336{
337 bte::log_exception();
338 return false;
339}
340
341static gboolean
342bte_terminal_focus_out(CtkWidget *widget,
343 CdkEventFocus *event) noexcept
344try
345{
346 BteTerminal *terminal = BTE_TERMINAL(widget)((((BteTerminal*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((widget)), ((bte_terminal_get_type()))))))
;
347 WIDGET(terminal)(get_widget(terminal))->focus_out(event);
348 return FALSE(0);
349}
350catch (...)
351{
352 bte::log_exception();
353 return false;
354}
355
356static gboolean
357bte_terminal_enter(CtkWidget *widget,
358 CdkEventCrossing *event) noexcept
359try
360{
361 BteTerminal *terminal = BTE_TERMINAL(widget)((((BteTerminal*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((widget)), ((bte_terminal_get_type()))))))
;
362 gboolean ret = FALSE(0);
363
364 if (CTK_WIDGET_CLASS (bte_terminal_parent_class)((((CtkWidgetClass*) (void *) g_type_check_class_cast ((GTypeClass
*) ((bte_terminal_parent_class)), ((ctk_widget_get_type ())))
)))
->enter_notify_event) {
365 ret = CTK_WIDGET_CLASS (bte_terminal_parent_class)((((CtkWidgetClass*) (void *) g_type_check_class_cast ((GTypeClass
*) ((bte_terminal_parent_class)), ((ctk_widget_get_type ())))
)))
->enter_notify_event (widget, event);
366 }
367
368 WIDGET(terminal)(get_widget(terminal))->enter(event);
369
370 return ret;
371}
372catch (...)
373{
374 bte::log_exception();
375 return false;
376}
377
378static gboolean
379bte_terminal_leave(CtkWidget *widget,
380 CdkEventCrossing *event) noexcept
381try
382{
383 BteTerminal *terminal = BTE_TERMINAL(widget)((((BteTerminal*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((widget)), ((bte_terminal_get_type()))))))
;
384 gboolean ret = FALSE(0);
385
386 if (CTK_WIDGET_CLASS (bte_terminal_parent_class)((((CtkWidgetClass*) (void *) g_type_check_class_cast ((GTypeClass
*) ((bte_terminal_parent_class)), ((ctk_widget_get_type ())))
)))
->leave_notify_event) {
387 ret = CTK_WIDGET_CLASS (bte_terminal_parent_class)((((CtkWidgetClass*) (void *) g_type_check_class_cast ((GTypeClass
*) ((bte_terminal_parent_class)), ((ctk_widget_get_type ())))
)))
->leave_notify_event (widget, event);
388 }
389
390 WIDGET(terminal)(get_widget(terminal))->leave(event);
391
392 return ret;
393}
394catch (...)
395{
396 bte::log_exception();
397 return false;
398}
399
400static void
401bte_terminal_get_preferred_width(CtkWidget *widget,
402 int *minimum_width,
403 int *natural_width) noexcept
404try
405{
406 BteTerminal *terminal = BTE_TERMINAL(widget)((((BteTerminal*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((widget)), ((bte_terminal_get_type()))))))
;
407 WIDGET(terminal)(get_widget(terminal))->get_preferred_width(minimum_width, natural_width);
408}
409catch (...)
410{
411 bte::log_exception();
412}
413
414static void
415bte_terminal_get_preferred_height(CtkWidget *widget,
416 int *minimum_height,
417 int *natural_height) noexcept
418try
419{
420 BteTerminal *terminal = BTE_TERMINAL(widget)((((BteTerminal*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((widget)), ((bte_terminal_get_type()))))))
;
421 WIDGET(terminal)(get_widget(terminal))->get_preferred_height(minimum_height, natural_height);
422}
423catch (...)
424{
425 bte::log_exception();
426}
427
428static void
429bte_terminal_size_allocate(CtkWidget *widget,
430 CtkAllocation *allocation) noexcept
431try
432{
433 BteTerminal *terminal = BTE_TERMINAL(widget)((((BteTerminal*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((widget)), ((bte_terminal_get_type()))))))
;
434 WIDGET(terminal)(get_widget(terminal))->size_allocate(allocation);
435}
436catch (...)
437{
438 bte::log_exception();
439}
440
441static gboolean
442bte_terminal_draw(CtkWidget *widget,
443 cairo_t *cr) noexcept
444try
445{
446 BteTerminal *terminal = BTE_TERMINAL (widget)((((BteTerminal*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((widget)), ((bte_terminal_get_type()))))))
;
447 WIDGET(terminal)(get_widget(terminal))->draw(cr);
448 return FALSE(0);
449}
450catch (...)
451{
452 bte::log_exception();
453 return false;
454}
455
456static void
457bte_terminal_realize(CtkWidget *widget) noexcept
458try
459{
460 _bte_debug_print(BTE_DEBUG_LIFECYCLE, "bte_terminal_realize()\n")do { } while(0);
461
462 CTK_WIDGET_CLASS(bte_terminal_parent_class)((((CtkWidgetClass*) (void *) g_type_check_class_cast ((GTypeClass
*) ((bte_terminal_parent_class)), ((ctk_widget_get_type ())))
)))
->realize(widget);
463
464 BteTerminal *terminal= BTE_TERMINAL(widget)((((BteTerminal*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((widget)), ((bte_terminal_get_type()))))))
;
465 WIDGET(terminal)(get_widget(terminal))->realize();
466}
467catch (...)
468{
469 bte::log_exception();
470}
471
472static void
473bte_terminal_unrealize(CtkWidget *widget) noexcept
474{
475 _bte_debug_print(BTE_DEBUG_LIFECYCLE, "bte_terminal_unrealize()\n")do { } while(0);
476
477 try {
478 BteTerminal *terminal = BTE_TERMINAL (widget)((((BteTerminal*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((widget)), ((bte_terminal_get_type()))))))
;
479 WIDGET(terminal)(get_widget(terminal))->unrealize();
480 } catch (...) {
481 bte::log_exception();
482 }
483
484 CTK_WIDGET_CLASS(bte_terminal_parent_class)((((CtkWidgetClass*) (void *) g_type_check_class_cast ((GTypeClass
*) ((bte_terminal_parent_class)), ((ctk_widget_get_type ())))
)))
->unrealize(widget);
485}
486
487static void
488bte_terminal_map(CtkWidget *widget) noexcept
489try
490{
491 _bte_debug_print(BTE_DEBUG_LIFECYCLE, "bte_terminal_map()\n")do { } while(0);
492
493 BteTerminal *terminal = BTE_TERMINAL(widget)((((BteTerminal*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((widget)), ((bte_terminal_get_type()))))))
;
494 CTK_WIDGET_CLASS(bte_terminal_parent_class)((((CtkWidgetClass*) (void *) g_type_check_class_cast ((GTypeClass
*) ((bte_terminal_parent_class)), ((ctk_widget_get_type ())))
)))
->map(widget);
495
496 WIDGET(terminal)(get_widget(terminal))->map();
497}
498catch (...)
499{
500 bte::log_exception();
501}
502
503static void
504bte_terminal_unmap(CtkWidget *widget) noexcept
505{
506 _bte_debug_print(BTE_DEBUG_LIFECYCLE, "bte_terminal_unmap()\n")do { } while(0);
507
508 try {
509 BteTerminal *terminal = BTE_TERMINAL(widget)((((BteTerminal*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((widget)), ((bte_terminal_get_type()))))))
;
510 WIDGET(terminal)(get_widget(terminal))->unmap();
511 } catch (...) {
512 bte::log_exception();
513 }
514
515 CTK_WIDGET_CLASS(bte_terminal_parent_class)((((CtkWidgetClass*) (void *) g_type_check_class_cast ((GTypeClass
*) ((bte_terminal_parent_class)), ((ctk_widget_get_type ())))
)))
->unmap(widget);
516}
517
518static void
519bte_terminal_screen_changed (CtkWidget *widget,
520 CdkScreen *previous_screen) noexcept
521try
522{
523 BteTerminal *terminal = BTE_TERMINAL (widget)((((BteTerminal*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((widget)), ((bte_terminal_get_type()))))))
;
524
525 if (CTK_WIDGET_CLASS (bte_terminal_parent_class)((((CtkWidgetClass*) (void *) g_type_check_class_cast ((GTypeClass
*) ((bte_terminal_parent_class)), ((ctk_widget_get_type ())))
)))
->screen_changed) {
526 CTK_WIDGET_CLASS (bte_terminal_parent_class)((((CtkWidgetClass*) (void *) g_type_check_class_cast ((GTypeClass
*) ((bte_terminal_parent_class)), ((ctk_widget_get_type ())))
)))
->screen_changed (widget, previous_screen);
527 }
528
529 WIDGET(terminal)(get_widget(terminal))->screen_changed(previous_screen);
530}
531catch (...)
532{
533 bte::log_exception();
534}
535
536static void
537bte_terminal_constructed (GObject *object) noexcept
538try
539{
540 BteTerminal *terminal = BTE_TERMINAL (object)((((BteTerminal*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((object)), ((bte_terminal_get_type()))))))
;
541
542 G_OBJECT_CLASS (bte_terminal_parent_class)((((GObjectClass*) (void *) g_type_check_class_cast ((GTypeClass
*) ((bte_terminal_parent_class)), (((GType) ((20) << (2
))))))))
->constructed (object);
543
544 WIDGET(terminal)(get_widget(terminal))->constructed();
545}
546catch (...)
547{
548 bte::log_exception();
549}
550
551static void
552bte_terminal_init(BteTerminal *terminal)
553try
554{
555 void *place;
556 CtkStyleContext *context;
557
558 _bte_debug_print(BTE_DEBUG_LIFECYCLE, "bte_terminal_init()\n")do { } while(0);
559
560 context = ctk_widget_get_style_context(&terminal->widget);
561 ctk_style_context_add_provider (context,
562 BTE_TERMINAL_GET_CLASS (terminal)((((BteTerminalClass*) (((GTypeInstance*) ((terminal)))->g_class
))))
->priv->fallback_style_provider,
563 CTK_STYLE_PROVIDER_PRIORITY_FALLBACK1);
564 ctk_style_context_add_provider (context,
565 BTE_TERMINAL_GET_CLASS (terminal)((((BteTerminalClass*) (((GTypeInstance*) ((terminal)))->g_class
))))
->priv->style_provider,
566 CTK_STYLE_PROVIDER_PRIORITY_APPLICATION600);
567
568 ctk_widget_set_has_window(&terminal->widget, FALSE(0));
569
570 /* Initialize private data. NOTE: place is zeroed */
571 place = bte_terminal_get_instance_private(terminal);
572 new (place) bte::platform::Widget(terminal);
573}
574catch (...)
575{
576 bte::log_exception();
577
578 // There's not really anything we can do after the
579 // construction of Widget failed... we'll crash soon anyway.
580 g_assert_not_reached()do { g_assertion_message_expr ("BTE", "../src/btectk.cc", 580
, ((const char*) (__PRETTY_FUNCTION__)), __null); } while (0)
;
581}
582
583static void
584bte_terminal_dispose(GObject *object) noexcept
585{
586 _bte_debug_print(BTE_DEBUG_LIFECYCLE, "bte_terminal_dispose()\n")do { } while(0);
587
588 try {
589 BteTerminal *terminal = BTE_TERMINAL (object)((((BteTerminal*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((object)), ((bte_terminal_get_type()))))))
;
590 WIDGET(terminal)(get_widget(terminal))->dispose();
591 } catch (...) {
592 bte::log_exception();
593 }
594
595 /* Call the inherited dispose() method. */
596 G_OBJECT_CLASS(bte_terminal_parent_class)((((GObjectClass*) (void *) g_type_check_class_cast ((GTypeClass
*) ((bte_terminal_parent_class)), (((GType) ((20) << (2
))))))))
->dispose(object);
597}
598
599static void
600bte_terminal_finalize(GObject *object) noexcept
601{
602 _bte_debug_print(BTE_DEBUG_LIFECYCLE, "bte_terminal_finalize()\n")do { } while(0);
603
604 try {
605 BteTerminal *terminal = BTE_TERMINAL (object)((((BteTerminal*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((object)), ((bte_terminal_get_type()))))))
;
606 WIDGET(terminal)(get_widget(terminal))->~Widget();
607 } catch (...) {
608 bte::log_exception();
609 }
610
611 /* Call the inherited finalize() method. */
612 G_OBJECT_CLASS(bte_terminal_parent_class)((((GObjectClass*) (void *) g_type_check_class_cast ((GTypeClass
*) ((bte_terminal_parent_class)), (((GType) ((20) << (2
))))))))
->finalize(object);
613}
614
615static void
616bte_terminal_get_property (GObject *object,
617 guint prop_id,
618 GValue *value,
619 GParamSpec *pspec) noexcept
620try
621{
622 BteTerminal *terminal = BTE_TERMINAL (object)((((BteTerminal*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((object)), ((bte_terminal_get_type()))))))
;
623 auto widget = WIDGET(terminal)(get_widget(terminal));
624 auto impl = IMPL(terminal)(_bte_terminal_get_impl(terminal));
625
626 switch (prop_id)
627 {
628 case PROP_HADJUSTMENT:
629 g_value_set_object (value, widget->hadjustment());
630 break;
631 case PROP_VADJUSTMENT:
632 g_value_set_object (value, widget->vadjustment());
633 break;
634 case PROP_HSCROLL_POLICY:
635 g_value_set_enum (value, widget->hscroll_policy());
636 break;
637 case PROP_VSCROLL_POLICY:
638 g_value_set_enum (value, widget->vscroll_policy());
639 break;
640 case PROP_ALLOW_BOLD:
641 g_value_set_boolean (value, bte_terminal_get_allow_bold (terminal));
642 break;
643 case PROP_ALLOW_HYPERLINK:
644 g_value_set_boolean (value, bte_terminal_get_allow_hyperlink (terminal));
645 break;
646 case PROP_AUDIBLE_BELL:
647 g_value_set_boolean (value, bte_terminal_get_audible_bell (terminal));
648 break;
649 case PROP_BACKSPACE_BINDING:
650 g_value_set_enum (value, widget->backspace_binding());
651 break;
652 case PROP_BOLD_IS_BRIGHT:
653 g_value_set_boolean (value, bte_terminal_get_bold_is_bright (terminal));
654 break;
655 case PROP_CELL_HEIGHT_SCALE:
656 g_value_set_double (value, bte_terminal_get_cell_height_scale (terminal));
657 break;
658 case PROP_CELL_WIDTH_SCALE:
659 g_value_set_double (value, bte_terminal_get_cell_width_scale (terminal));
660 break;
661 case PROP_CJK_AMBIGUOUS_WIDTH:
662 g_value_set_int (value, bte_terminal_get_cjk_ambiguous_width (terminal));
663 break;
664 case PROP_CURSOR_BLINK_MODE:
665 g_value_set_enum (value, bte_terminal_get_cursor_blink_mode (terminal));
666 break;
667 case PROP_CURRENT_DIRECTORY_URI:
668 g_value_set_string (value, bte_terminal_get_current_directory_uri (terminal));
669 break;
670 case PROP_CURRENT_FILE_URI:
671 g_value_set_string (value, bte_terminal_get_current_file_uri (terminal));
672 break;
673 case PROP_CURSOR_SHAPE:
674 g_value_set_enum (value, bte_terminal_get_cursor_shape (terminal));
675 break;
676 case PROP_DELETE_BINDING:
677 g_value_set_enum (value, widget->delete_binding());
678 break;
679 case PROP_ENABLE_BIDI:
680 g_value_set_boolean (value, bte_terminal_get_enable_bidi (terminal));
681 break;
682 case PROP_ENABLE_SHAPING:
683 g_value_set_boolean (value, bte_terminal_get_enable_shaping (terminal));
684 break;
685 case PROP_ENABLE_SIXEL:
686 g_value_set_boolean (value, bte_terminal_get_enable_sixel (terminal));
687 break;
688 case PROP_ENCODING:
689 g_value_set_string (value, bte_terminal_get_encoding (terminal));
690 break;
691 case PROP_FONT_DESC:
692 g_value_set_boxed (value, bte_terminal_get_font (terminal));
693 break;
694 case PROP_FONT_SCALE:
695 g_value_set_double (value, bte_terminal_get_font_scale (terminal));
696 break;
697 case PROP_HYPERLINK_HOVER_URI:
698 g_value_set_string (value, impl->m_hyperlink_hover_uri);
699 break;
700 case PROP_ICON_TITLE:
701 g_value_set_string (value, bte_terminal_get_icon_title (terminal));
702 break;
703 case PROP_INPUT_ENABLED:
704 g_value_set_boolean (value, bte_terminal_get_input_enabled (terminal));
705 break;
706 case PROP_MOUSE_POINTER_AUTOHIDE:
707 g_value_set_boolean (value, bte_terminal_get_mouse_autohide (terminal));
708 break;
709 case PROP_PTY:
710 g_value_set_object (value, bte_terminal_get_pty(terminal));
711 break;
712 case PROP_REWRAP_ON_RESIZE:
713 g_value_set_boolean (value, bte_terminal_get_rewrap_on_resize (terminal));
714 break;
715 case PROP_SCROLLBACK_LINES:
716 g_value_set_uint (value, bte_terminal_get_scrollback_lines(terminal));
717 break;
718 case PROP_SCROLL_ON_KEYSTROKE:
719 g_value_set_boolean (value, bte_terminal_get_scroll_on_keystroke(terminal));
720 break;
721 case PROP_SCROLL_ON_OUTPUT:
722 g_value_set_boolean (value, bte_terminal_get_scroll_on_output(terminal));
723 break;
724 case PROP_TEXT_BLINK_MODE:
725 g_value_set_enum (value, bte_terminal_get_text_blink_mode (terminal));
726 break;
727 case PROP_WINDOW_TITLE:
728 g_value_set_string (value, bte_terminal_get_window_title (terminal));
729 break;
730 case PROP_WORD_CHAR_EXCEPTIONS:
731 g_value_set_string (value, bte_terminal_get_word_char_exceptions (terminal));
732 break;
733
734 default:
735 G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec)do { GObject *_glib__object = (GObject*) ((object)); GParamSpec
*_glib__pspec = (GParamSpec*) ((pspec)); guint _glib__property_id
= ((prop_id)); g_warning ("%s:%d: invalid %s id %u for \"%s\" of type '%s' in '%s'"
, "../src/btectk.cc", 735, ("property"), _glib__property_id, _glib__pspec
->name, g_type_name ((((((GTypeClass*) (((GTypeInstance*) (
_glib__pspec))->g_class))->g_type)))), (g_type_name (((
(((GTypeClass*) (((GTypeInstance*) (_glib__object))->g_class
))->g_type)))))); } while (0)
;
736 return;
737 }
738}
739catch (...)
740{
741 bte::log_exception();
742}
743
744static void
745bte_terminal_set_property (GObject *object,
746 guint prop_id,
747 const GValue *value,
748 GParamSpec *pspec) noexcept
749try
750{
751 BteTerminal *terminal = BTE_TERMINAL (object)((((BteTerminal*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((object)), ((bte_terminal_get_type()))))))
;
752
753 switch (prop_id)
754 {
755 case PROP_HADJUSTMENT:
756 bte_terminal_set_hadjustment (terminal, (CtkAdjustment *)g_value_get_object (value));
757 break;
758 case PROP_VADJUSTMENT:
759 bte_terminal_set_vadjustment (terminal, (CtkAdjustment *)g_value_get_object (value));
760 break;
761 case PROP_HSCROLL_POLICY:
762 bte_terminal_set_hscroll_policy(terminal, (CtkScrollablePolicy)g_value_get_enum(value));
763 break;
764 case PROP_VSCROLL_POLICY:
765 bte_terminal_set_vscroll_policy(terminal, (CtkScrollablePolicy)g_value_get_enum(value));
766 break;
767 case PROP_ALLOW_BOLD:
768 bte_terminal_set_allow_bold (terminal, g_value_get_boolean (value));
769 break;
770 case PROP_ALLOW_HYPERLINK:
771 bte_terminal_set_allow_hyperlink (terminal, g_value_get_boolean (value));
772 break;
773 case PROP_AUDIBLE_BELL:
774 bte_terminal_set_audible_bell (terminal, g_value_get_boolean (value));
775 break;
776 case PROP_BACKSPACE_BINDING:
777 bte_terminal_set_backspace_binding (terminal, (BteEraseBinding)g_value_get_enum (value));
778 break;
779 case PROP_BOLD_IS_BRIGHT:
780 bte_terminal_set_bold_is_bright (terminal, g_value_get_boolean (value));
781 break;
782 case PROP_CELL_HEIGHT_SCALE:
783 bte_terminal_set_cell_height_scale (terminal, g_value_get_double (value));
784 break;
785 case PROP_CELL_WIDTH_SCALE:
786 bte_terminal_set_cell_width_scale (terminal, g_value_get_double (value));
787 break;
788 case PROP_CJK_AMBIGUOUS_WIDTH:
789 bte_terminal_set_cjk_ambiguous_width (terminal, g_value_get_int (value));
790 break;
791 case PROP_CURSOR_BLINK_MODE:
792 bte_terminal_set_cursor_blink_mode (terminal, (BteCursorBlinkMode)g_value_get_enum (value));
793 break;
794 case PROP_CURSOR_SHAPE:
795 bte_terminal_set_cursor_shape (terminal, (BteCursorShape)g_value_get_enum (value));
796 break;
797 case PROP_DELETE_BINDING:
798 bte_terminal_set_delete_binding (terminal, (BteEraseBinding)g_value_get_enum (value));
799 break;
800 case PROP_ENABLE_BIDI:
801 bte_terminal_set_enable_bidi (terminal, g_value_get_boolean (value));
802 break;
803 case PROP_ENABLE_SHAPING:
804 bte_terminal_set_enable_shaping (terminal, g_value_get_boolean (value));
805 break;
806 case PROP_ENABLE_SIXEL:
807 bte_terminal_set_enable_sixel (terminal, g_value_get_boolean (value));
808 break;
809 case PROP_ENCODING:
810 bte_terminal_set_encoding (terminal, g_value_get_string (value), NULL__null);
811 break;
812 case PROP_FONT_DESC:
813 bte_terminal_set_font (terminal, (PangoFontDescription *)g_value_get_boxed (value));
814 break;
815 case PROP_FONT_SCALE:
816 bte_terminal_set_font_scale (terminal, g_value_get_double (value));
817 break;
818 case PROP_INPUT_ENABLED:
819 bte_terminal_set_input_enabled (terminal, g_value_get_boolean (value));
820 break;
821 case PROP_MOUSE_POINTER_AUTOHIDE:
822 bte_terminal_set_mouse_autohide (terminal, g_value_get_boolean (value));
823 break;
824 case PROP_PTY:
825 bte_terminal_set_pty (terminal, (BtePty *)g_value_get_object (value));
826 break;
827 case PROP_REWRAP_ON_RESIZE:
828 bte_terminal_set_rewrap_on_resize (terminal, g_value_get_boolean (value));
829 break;
830 case PROP_SCROLLBACK_LINES:
831 bte_terminal_set_scrollback_lines (terminal, g_value_get_uint (value));
832 break;
833 case PROP_SCROLL_ON_KEYSTROKE:
834 bte_terminal_set_scroll_on_keystroke(terminal, g_value_get_boolean (value));
835 break;
836 case PROP_SCROLL_ON_OUTPUT:
837 bte_terminal_set_scroll_on_output (terminal, g_value_get_boolean (value));
838 break;
839 case PROP_TEXT_BLINK_MODE:
840 bte_terminal_set_text_blink_mode (terminal, (BteTextBlinkMode)g_value_get_enum (value));
841 break;
842 case PROP_WORD_CHAR_EXCEPTIONS:
843 bte_terminal_set_word_char_exceptions (terminal, g_value_get_string (value));
844 break;
845
846 /* Not writable */
847 case PROP_CURRENT_DIRECTORY_URI:
848 case PROP_CURRENT_FILE_URI:
849 case PROP_HYPERLINK_HOVER_URI:
850 case PROP_ICON_TITLE:
851 case PROP_WINDOW_TITLE:
852 g_assert_not_reached ()do { g_assertion_message_expr ("BTE", "../src/btectk.cc", 852
, ((const char*) (__PRETTY_FUNCTION__)), __null); } while (0)
;
853 break;
854
855 default:
856 G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec)do { GObject *_glib__object = (GObject*) ((object)); GParamSpec
*_glib__pspec = (GParamSpec*) ((pspec)); guint _glib__property_id
= ((prop_id)); g_warning ("%s:%d: invalid %s id %u for \"%s\" of type '%s' in '%s'"
, "../src/btectk.cc", 856, ("property"), _glib__property_id, _glib__pspec
->name, g_type_name ((((((GTypeClass*) (((GTypeInstance*) (
_glib__pspec))->g_class))->g_type)))), (g_type_name (((
(((GTypeClass*) (((GTypeInstance*) (_glib__object))->g_class
))->g_type)))))); } while (0)
;
857 return;
858 }
859}
860catch (...)
861{
862 bte::log_exception();
863}
864
865static void
866bte_terminal_class_init(BteTerminalClass *klass)
867{
868 GObjectClass *gobject_class;
869 CtkWidgetClass *widget_class;
870 CtkBindingSet *binding_set;
871
872#ifdef BTE_DEBUG
873 {
874 _bte_debug_init();
875 _bte_debug_print(BTE_DEBUG_LIFECYCLE,do { } while(0)
876 "bte_terminal_class_init()\n")do { } while(0);
877 /* print out the legend */
878 _bte_debug_print(BTE_DEBUG_WORK,do { } while(0)
879 "Debugging work flow (top input to bottom output):\n"do { } while(0)
880 " . _bte_terminal_process_incoming\n"do { } while(0)
881 " < start process_timeout\n"do { } while(0)
882 " {[ start update_timeout [ => rate limited\n"do { } while(0)
883 " T start of terminal in update_timeout\n"do { } while(0)
884 " ( start _bte_terminal_process_incoming\n"do { } while(0)
885 " ? _bte_invalidate_cells (call)\n"do { } while(0)
886 " ! _bte_invalidate_cells (dirty)\n"do { } while(0)
887 " * _bte_invalidate_all\n"do { } while(0)
888 " ) end _bte_terminal_process_incoming\n"do { } while(0)
889 " = bte_terminal_paint\n"do { } while(0)
890 " ]} end update_timeout\n"do { } while(0)
891 " > end process_timeout\n")do { } while(0);
892 }
893#endif
894
895 _BTE_DEBUG_IF (BTE_DEBUG_UPDATES)if (0) cdk_window_set_debug_updates(TRUE(!(0)));
896
897 bindtextdomain(GETTEXT_PACKAGE"bte-2.91", LOCALEDIR"/usr/local/share/locale");
898 bind_textdomain_codeset(GETTEXT_PACKAGE"bte-2.91", "UTF-8");
899
900 gobject_class = G_OBJECT_CLASS(klass)((((GObjectClass*) (void *) g_type_check_class_cast ((GTypeClass
*) ((klass)), (((GType) ((20) << (2))))))))
;
901 widget_class = CTK_WIDGET_CLASS(klass)((((CtkWidgetClass*) (void *) g_type_check_class_cast ((GTypeClass
*) ((klass)), ((ctk_widget_get_type ()))))))
;
902
903 /* Override some of the default handlers. */
904 gobject_class->constructed = bte_terminal_constructed;
905 gobject_class->dispose = bte_terminal_dispose;
906 gobject_class->finalize = bte_terminal_finalize;
907 gobject_class->get_property = bte_terminal_get_property;
908 gobject_class->set_property = bte_terminal_set_property;
909 widget_class->realize = bte_terminal_realize;
910 widget_class->unrealize = bte_terminal_unrealize;
911 widget_class->map = bte_terminal_map;
912 widget_class->unmap = bte_terminal_unmap;
913 widget_class->scroll_event = bte_terminal_scroll;
914 widget_class->draw = bte_terminal_draw;
915 widget_class->key_press_event = bte_terminal_key_press;
916 widget_class->key_release_event = bte_terminal_key_release;
917 widget_class->button_press_event = bte_terminal_button_press;
918 widget_class->button_release_event = bte_terminal_button_release;
919 widget_class->motion_notify_event = bte_terminal_motion_notify;
920 widget_class->enter_notify_event = bte_terminal_enter;
921 widget_class->leave_notify_event = bte_terminal_leave;
922 widget_class->focus_in_event = bte_terminal_focus_in;
923 widget_class->focus_out_event = bte_terminal_focus_out;
924 widget_class->style_updated = bte_terminal_style_updated;
925 widget_class->get_preferred_width = bte_terminal_get_preferred_width;
926 widget_class->get_preferred_height = bte_terminal_get_preferred_height;
927 widget_class->size_allocate = bte_terminal_size_allocate;
928 widget_class->screen_changed = bte_terminal_screen_changed;
929
930 ctk_widget_class_set_css_name(widget_class, BTE_TERMINAL_CSS_NAME"bte-terminal");
931
932 /* Initialize default handlers. */
933 klass->eof = NULL__null;
934 klass->child_exited = NULL__null;
935 klass->encoding_changed = NULL__null;
936 klass->char_size_changed = NULL__null;
937 klass->window_title_changed = NULL__null;
938 klass->icon_title_changed = NULL__null;
939 klass->selection_changed = NULL__null;
940 klass->contents_changed = NULL__null;
941 klass->cursor_moved = NULL__null;
942 klass->commit = NULL__null;
943
944 klass->deiconify_window = NULL__null;
945 klass->iconify_window = NULL__null;
946 klass->raise_window = NULL__null;
947 klass->lower_window = NULL__null;
948 klass->refresh_window = NULL__null;
949 klass->restore_window = NULL__null;
950 klass->maximize_window = NULL__null;
951 klass->resize_window = NULL__null;
952 klass->move_window = NULL__null;
953
954 klass->increase_font_size = NULL__null;
955 klass->decrease_font_size = NULL__null;
956
957 klass->text_modified = NULL__null;
958 klass->text_inserted = NULL__null;
959 klass->text_deleted = NULL__null;
960 klass->text_scrolled = NULL__null;
961
962 klass->copy_clipboard = bte_terminal_real_copy_clipboard;
963 klass->paste_clipboard = bte_terminal_real_paste_clipboard;
964
965 klass->bell = NULL__null;
966
967 /* CtkScrollable interface properties */
968 g_object_class_override_property (gobject_class, PROP_HADJUSTMENT, "hadjustment");
969 g_object_class_override_property (gobject_class, PROP_VADJUSTMENT, "vadjustment");
970 g_object_class_override_property (gobject_class, PROP_HSCROLL_POLICY, "hscroll-policy");
971 g_object_class_override_property (gobject_class, PROP_VSCROLL_POLICY, "vscroll-policy");
972
973 /* Register some signals of our own. */
974
975 /**
976 * BteTerminal::eof:
977 * @bteterminal: the object which received the signal
978 *
979 * Emitted when the terminal receives an end-of-file from a child which
980 * is running in the terminal. This signal is frequently (but not
981 * always) emitted with a #BteTerminal::child-exited signal.
982 */
983 signals[SIGNAL_EOF] =
984 g_signal_new(I_("eof")(g_intern_static_string("eof")),
985 G_OBJECT_CLASS_TYPE(klass)((((GTypeClass*) (klass))->g_type)),
986 G_SIGNAL_RUN_LAST,
987 G_STRUCT_OFFSET(BteTerminalClass, eof)((glong) __builtin_offsetof(BteTerminalClass, eof)),
988 NULL__null,
989 NULL__null,
990 g_cclosure_marshal_VOID__VOID,
991 G_TYPE_NONE((GType) ((1) << (2))), 0);
992 g_signal_set_va_marshaller(signals[SIGNAL_EOF],
993 G_OBJECT_CLASS_TYPE(klass)((((GTypeClass*) (klass))->g_type)),
994 g_cclosure_marshal_VOID__VOIDv);
995
996 /**
997 * BteTerminal::child-exited:
998 * @bteterminal: the object which received the signal
999 * @status: the child's exit status
1000 *
1001 * This signal is emitted when the terminal detects that a child
1002 * watched using bte_terminal_watch_child() has exited.
1003 */
1004 signals[SIGNAL_CHILD_EXITED] =
1005 g_signal_new(I_("child-exited")(g_intern_static_string("child-exited")),
1006 G_OBJECT_CLASS_TYPE(klass)((((GTypeClass*) (klass))->g_type)),
1007 G_SIGNAL_RUN_LAST,
1008 G_STRUCT_OFFSET(BteTerminalClass, child_exited)((glong) __builtin_offsetof(BteTerminalClass, child_exited)),
1009 NULL__null,
1010 NULL__null,
1011 g_cclosure_marshal_VOID__INT,
1012 G_TYPE_NONE((GType) ((1) << (2))),
1013 1, G_TYPE_INT((GType) ((6) << (2))));
1014 g_signal_set_va_marshaller(signals[SIGNAL_CHILD_EXITED],
1015 G_OBJECT_CLASS_TYPE(klass)((((GTypeClass*) (klass))->g_type)),
1016 g_cclosure_marshal_VOID__INTv);
1017
1018 /**
1019 * BteTerminal::window-title-changed:
1020 * @bteterminal: the object which received the signal
1021 *
1022 * Emitted when the terminal's %window_title field is modified.
1023 */
1024 signals[SIGNAL_WINDOW_TITLE_CHANGED] =
1025 g_signal_new(I_("window-title-changed")(g_intern_static_string("window-title-changed")),
1026 G_OBJECT_CLASS_TYPE(klass)((((GTypeClass*) (klass))->g_type)),
1027 G_SIGNAL_RUN_LAST,
1028 G_STRUCT_OFFSET(BteTerminalClass, window_title_changed)((glong) __builtin_offsetof(BteTerminalClass, window_title_changed
))
,
1029 NULL__null,
1030 NULL__null,
1031 g_cclosure_marshal_VOID__VOID,
1032 G_TYPE_NONE((GType) ((1) << (2))), 0);
1033 g_signal_set_va_marshaller(signals[SIGNAL_WINDOW_TITLE_CHANGED],
1034 G_OBJECT_CLASS_TYPE(klass)((((GTypeClass*) (klass))->g_type)),
1035 g_cclosure_marshal_VOID__VOIDv);
1036
1037 /**
1038 * BteTerminal::icon-title-changed:
1039 * @bteterminal: the object which received the signal
1040 *
1041 * Emitted when the terminal's %icon_title field is modified.
1042 */
1043 signals[SIGNAL_ICON_TITLE_CHANGED] =
1044 g_signal_new(I_("icon-title-changed")(g_intern_static_string("icon-title-changed")),
1045 G_OBJECT_CLASS_TYPE(klass)((((GTypeClass*) (klass))->g_type)),
1046 G_SIGNAL_RUN_LAST,
1047 G_STRUCT_OFFSET(BteTerminalClass, icon_title_changed)((glong) __builtin_offsetof(BteTerminalClass, icon_title_changed
))
,
1048 NULL__null,
1049 NULL__null,
1050 g_cclosure_marshal_VOID__VOID,
1051 G_TYPE_NONE((GType) ((1) << (2))), 0);
1052 g_signal_set_va_marshaller(signals[SIGNAL_ICON_TITLE_CHANGED],
1053 G_OBJECT_CLASS_TYPE(klass)((((GTypeClass*) (klass))->g_type)),
1054 g_cclosure_marshal_VOID__VOIDv);
1055
1056 /**
1057 * BteTerminal::current-directory-uri-changed:
1058 * @bteterminal: the object which received the signal
1059 *
1060 * Emitted when the current directory URI is modified.
1061 */
1062 signals[SIGNAL_CURRENT_DIRECTORY_URI_CHANGED] =
1063 g_signal_new(I_("current-directory-uri-changed")(g_intern_static_string("current-directory-uri-changed")),
1064 G_OBJECT_CLASS_TYPE(klass)((((GTypeClass*) (klass))->g_type)),
1065 G_SIGNAL_RUN_LAST,
1066 0,
1067 NULL__null,
1068 NULL__null,
1069 g_cclosure_marshal_VOID__VOID,
1070 G_TYPE_NONE((GType) ((1) << (2))), 0);
1071 g_signal_set_va_marshaller(signals[SIGNAL_CURRENT_DIRECTORY_URI_CHANGED],
1072 G_OBJECT_CLASS_TYPE(klass)((((GTypeClass*) (klass))->g_type)),
1073 g_cclosure_marshal_VOID__VOIDv);
1074
1075 /**
1076 * BteTerminal::current-file-uri-changed:
1077 * @bteterminal: the object which received the signal
1078 *
1079 * Emitted when the current file URI is modified.
1080 */
1081 signals[SIGNAL_CURRENT_FILE_URI_CHANGED] =
1082 g_signal_new(I_("current-file-uri-changed")(g_intern_static_string("current-file-uri-changed")),
1083 G_OBJECT_CLASS_TYPE(klass)((((GTypeClass*) (klass))->g_type)),
1084 G_SIGNAL_RUN_LAST,
1085 0,
1086 NULL__null,
1087 NULL__null,
1088 g_cclosure_marshal_VOID__VOID,
1089 G_TYPE_NONE((GType) ((1) << (2))), 0);
1090 g_signal_set_va_marshaller(signals[SIGNAL_CURRENT_FILE_URI_CHANGED],
1091 G_OBJECT_CLASS_TYPE(klass)((((GTypeClass*) (klass))->g_type)),
1092 g_cclosure_marshal_VOID__VOIDv);
1093
1094 /**
1095 * BteTerminal::hyperlink-hover-uri-changed:
1096 * @bteterminal: the object which received the signal
1097 * @uri: the nonempty target URI under the mouse, or NULL
1098 * @bbox: the bounding box of the hyperlink anchor text, or NULL
1099 *
1100 * Emitted when the hovered hyperlink changes.
1101 *
1102 * @uri and @bbox are owned by BTE, must not be modified, and might
1103 * change after the signal handlers returns.
1104 *
1105 * The signal is not re-emitted when the bounding box changes for the
1106 * same hyperlink. This might change in a future BTE version without notice.
1107 *
1108 * Since: 0.50
1109 */
1110 signals[SIGNAL_HYPERLINK_HOVER_URI_CHANGED] =
1111 g_signal_new(I_("hyperlink-hover-uri-changed")(g_intern_static_string("hyperlink-hover-uri-changed")),
1112 G_OBJECT_CLASS_TYPE(klass)((((GTypeClass*) (klass))->g_type)),
1113 G_SIGNAL_RUN_LAST,
1114 0,
1115 NULL__null,
1116 NULL__null,
1117 _bte_marshal_VOID__STRING_BOXED,
1118 G_TYPE_NONE((GType) ((1) << (2))),
1119 2, G_TYPE_STRING((GType) ((16) << (2))), CDK_TYPE_RECTANGLE(cdk_rectangle_get_type ()) | G_SIGNAL_TYPE_STATIC_SCOPE(((GType) (1 << 0))));
1120 g_signal_set_va_marshaller(signals[SIGNAL_HYPERLINK_HOVER_URI_CHANGED],
1121 G_OBJECT_CLASS_TYPE(klass)((((GTypeClass*) (klass))->g_type)),
1122 _bte_marshal_VOID__STRING_BOXEDv);
1123
1124 /**
1125 * BteTerminal::encoding-changed:
1126 * @bteterminal: the object which received the signal
1127 *
1128 * Emitted whenever the terminal's current encoding has changed.
1129 */
1130 signals[SIGNAL_ENCODING_CHANGED] =
1131 g_signal_new(I_("encoding-changed")(g_intern_static_string("encoding-changed")),
1132 G_OBJECT_CLASS_TYPE(klass)((((GTypeClass*) (klass))->g_type)),
1133 G_SIGNAL_RUN_LAST,
1134 G_STRUCT_OFFSET(BteTerminalClass, encoding_changed)((glong) __builtin_offsetof(BteTerminalClass, encoding_changed
))
,
1135 NULL__null,
1136 NULL__null,
1137 g_cclosure_marshal_VOID__VOID,
1138 G_TYPE_NONE((GType) ((1) << (2))), 0);
1139 g_signal_set_va_marshaller(signals[SIGNAL_ENCODING_CHANGED],
1140 G_OBJECT_CLASS_TYPE(klass)((((GTypeClass*) (klass))->g_type)),
1141 g_cclosure_marshal_VOID__VOIDv);
1142
1143 /**
1144 * BteTerminal::commit:
1145 * @bteterminal: the object which received the signal
1146 * @text: a string of text
1147 * @size: the length of that string of text
1148 *
1149 * Emitted whenever the terminal receives input from the user and
1150 * prepares to send it to the child process.
1151 */
1152 signals[SIGNAL_COMMIT] =
1153 g_signal_new(I_("commit")(g_intern_static_string("commit")),
1154 G_OBJECT_CLASS_TYPE(klass)((((GTypeClass*) (klass))->g_type)),
1155 G_SIGNAL_RUN_LAST,
1156 G_STRUCT_OFFSET(BteTerminalClass, commit)((glong) __builtin_offsetof(BteTerminalClass, commit)),
1157 NULL__null,
1158 NULL__null,
1159 _bte_marshal_VOID__STRING_UINT,
1160 G_TYPE_NONE((GType) ((1) << (2))), 2, G_TYPE_STRING((GType) ((16) << (2))), G_TYPE_UINT((GType) ((7) << (2))));
1161 g_signal_set_va_marshaller(signals[SIGNAL_COMMIT],
1162 G_OBJECT_CLASS_TYPE(klass)((((GTypeClass*) (klass))->g_type)),
1163 _bte_marshal_VOID__STRING_UINTv);
1164
1165 /**
1166 * BteTerminal::char-size-changed:
1167 * @bteterminal: the object which received the signal
1168 * @width: the new character cell width
1169 * @height: the new character cell height
1170 *
1171 * Emitted whenever the cell size changes, e.g. due to a change in
1172 * font, font-scale or cell-width/height-scale.
1173 *
1174 * Note that this signal should rather be called "cell-size-changed".
1175 */
1176 signals[SIGNAL_CHAR_SIZE_CHANGED] =
1177 g_signal_new(I_("char-size-changed")(g_intern_static_string("char-size-changed")),
1178 G_OBJECT_CLASS_TYPE(klass)((((GTypeClass*) (klass))->g_type)),
1179 G_SIGNAL_RUN_LAST,
1180 G_STRUCT_OFFSET(BteTerminalClass, char_size_changed)((glong) __builtin_offsetof(BteTerminalClass, char_size_changed
))
,
1181 NULL__null,
1182 NULL__null,
1183 _bte_marshal_VOID__UINT_UINT,
1184 G_TYPE_NONE((GType) ((1) << (2))), 2, G_TYPE_UINT((GType) ((7) << (2))), G_TYPE_UINT((GType) ((7) << (2))));
1185 g_signal_set_va_marshaller(signals[SIGNAL_CHAR_SIZE_CHANGED],
1186 G_OBJECT_CLASS_TYPE(klass)((((GTypeClass*) (klass))->g_type)),
1187 _bte_marshal_VOID__UINT_UINTv);
1188
1189 /**
1190 * BteTerminal::selection-changed:
1191 * @bteterminal: the object which received the signal
1192 *
1193 * Emitted whenever the contents of terminal's selection changes.
1194 */
1195 signals[SIGNAL_SELECTION_CHANGED] =
1196 g_signal_new (I_("selection-changed")(g_intern_static_string("selection-changed")),
1197 G_OBJECT_CLASS_TYPE(klass)((((GTypeClass*) (klass))->g_type)),
1198 G_SIGNAL_RUN_LAST,
1199 G_STRUCT_OFFSET(BteTerminalClass, selection_changed)((glong) __builtin_offsetof(BteTerminalClass, selection_changed
))
,
1200 NULL__null,
1201 NULL__null,
1202 g_cclosure_marshal_VOID__VOID,
1203 G_TYPE_NONE((GType) ((1) << (2))), 0);
1204 g_signal_set_va_marshaller(signals[SIGNAL_SELECTION_CHANGED],
1205 G_OBJECT_CLASS_TYPE(klass)((((GTypeClass*) (klass))->g_type)),
1206 g_cclosure_marshal_VOID__VOIDv);
1207
1208 /**
1209 * BteTerminal::contents-changed:
1210 * @bteterminal: the object which received the signal
1211 *
1212 * Emitted whenever the visible appearance of the terminal has changed.
1213 * Used primarily by #BteTerminalAccessible.
1214 */
1215 signals[SIGNAL_CONTENTS_CHANGED] =
1216 g_signal_new(I_("contents-changed")(g_intern_static_string("contents-changed")),
1217 G_OBJECT_CLASS_TYPE(klass)((((GTypeClass*) (klass))->g_type)),
1218 G_SIGNAL_RUN_LAST,
1219 G_STRUCT_OFFSET(BteTerminalClass, contents_changed)((glong) __builtin_offsetof(BteTerminalClass, contents_changed
))
,
1220 NULL__null,
1221 NULL__null,
1222 g_cclosure_marshal_VOID__VOID,
1223 G_TYPE_NONE((GType) ((1) << (2))), 0);
1224 g_signal_set_va_marshaller(signals[SIGNAL_CONTENTS_CHANGED],
1225 G_OBJECT_CLASS_TYPE(klass)((((GTypeClass*) (klass))->g_type)),
1226 g_cclosure_marshal_VOID__VOIDv);
1227
1228 /**
1229 * BteTerminal::cursor-moved:
1230 * @bteterminal: the object which received the signal
1231 *
1232 * Emitted whenever the cursor moves to a new character cell. Used
1233 * primarily by #BteTerminalAccessible.
1234 */
1235 signals[SIGNAL_CURSOR_MOVED] =
1236 g_signal_new(I_("cursor-moved")(g_intern_static_string("cursor-moved")),
1237 G_OBJECT_CLASS_TYPE(klass)((((GTypeClass*) (klass))->g_type)),
1238 G_SIGNAL_RUN_LAST,
1239 G_STRUCT_OFFSET(BteTerminalClass, cursor_moved)((glong) __builtin_offsetof(BteTerminalClass, cursor_moved)),
1240 NULL__null,
1241 NULL__null,
1242 g_cclosure_marshal_VOID__VOID,
1243 G_TYPE_NONE((GType) ((1) << (2))), 0);
1244 g_signal_set_va_marshaller(signals[SIGNAL_CURSOR_MOVED],
1245 G_OBJECT_CLASS_TYPE(klass)((((GTypeClass*) (klass))->g_type)),
1246 g_cclosure_marshal_VOID__VOIDv);
1247
1248 /**
1249 * BteTerminal::deiconify-window:
1250 * @bteterminal: the object which received the signal
1251 *
1252 * Never emitted.
1253 *
1254 * Deprecated: 0.60
1255 */
1256 signals[SIGNAL_DEICONIFY_WINDOW] =
1257 g_signal_new(I_("deiconify-window")(g_intern_static_string("deiconify-window")),
1258 G_OBJECT_CLASS_TYPE(klass)((((GTypeClass*) (klass))->g_type)),
1259 G_SIGNAL_RUN_LAST,
1260 G_STRUCT_OFFSET(BteTerminalClass, deiconify_window)((glong) __builtin_offsetof(BteTerminalClass, deiconify_window
))
,
1261 NULL__null,
1262 NULL__null,
1263 g_cclosure_marshal_VOID__VOID,
1264 G_TYPE_NONE((GType) ((1) << (2))), 0);
1265 g_signal_set_va_marshaller(signals[SIGNAL_DEICONIFY_WINDOW],
1266 G_OBJECT_CLASS_TYPE(klass)((((GTypeClass*) (klass))->g_type)),
1267 g_cclosure_marshal_VOID__VOIDv);
1268
1269 /**
1270 * BteTerminal::iconify-window:
1271 * @bteterminal: the object which received the signal
1272 *
1273 * Never emitted.
1274 *
1275 * Deprecated: 0.60
1276 */
1277 signals[SIGNAL_ICONIFY_WINDOW] =
1278 g_signal_new(I_("iconify-window")(g_intern_static_string("iconify-window")),
1279 G_OBJECT_CLASS_TYPE(klass)((((GTypeClass*) (klass))->g_type)),
1280 G_SIGNAL_RUN_LAST,
1281 G_STRUCT_OFFSET(BteTerminalClass, iconify_window)((glong) __builtin_offsetof(BteTerminalClass, iconify_window)
)
,
1282 NULL__null,
1283 NULL__null,
1284 g_cclosure_marshal_VOID__VOID,
1285 G_TYPE_NONE((GType) ((1) << (2))), 0);
1286 g_signal_set_va_marshaller(signals[SIGNAL_ICONIFY_WINDOW],
1287 G_OBJECT_CLASS_TYPE(klass)((((GTypeClass*) (klass))->g_type)),
1288 g_cclosure_marshal_VOID__VOIDv);
1289
1290 /**
1291 * BteTerminal::raise-window:
1292 * @bteterminal: the object which received the signal
1293 *
1294 * Never emitted.
1295 *
1296 * Deprecated: 0.60
1297 */
1298 signals[SIGNAL_RAISE_WINDOW] =
1299 g_signal_new(I_("raise-window")(g_intern_static_string("raise-window")),
1300 G_OBJECT_CLASS_TYPE(klass)((((GTypeClass*) (klass))->g_type)),
1301 G_SIGNAL_RUN_LAST,
1302 G_STRUCT_OFFSET(BteTerminalClass, raise_window)((glong) __builtin_offsetof(BteTerminalClass, raise_window)),
1303 NULL__null,
1304 NULL__null,
1305 g_cclosure_marshal_VOID__VOID,
1306 G_TYPE_NONE((GType) ((1) << (2))), 0);
1307 g_signal_set_va_marshaller(signals[SIGNAL_RAISE_WINDOW],
1308 G_OBJECT_CLASS_TYPE(klass)((((GTypeClass*) (klass))->g_type)),
1309 g_cclosure_marshal_VOID__VOIDv);
1310
1311 /**
1312 * BteTerminal::lower-window:
1313 * @bteterminal: the object which received the signal
1314 *
1315 * Never emitted.
1316 *
1317 * Deprecated: 0.60
1318 */
1319 signals[SIGNAL_LOWER_WINDOW] =
1320 g_signal_new(I_("lower-window")(g_intern_static_string("lower-window")),
1321 G_OBJECT_CLASS_TYPE(klass)((((GTypeClass*) (klass))->g_type)),
1322 G_SIGNAL_RUN_LAST,
1323 G_STRUCT_OFFSET(BteTerminalClass, lower_window)((glong) __builtin_offsetof(BteTerminalClass, lower_window)),
1324 NULL__null,
1325 NULL__null,
1326 g_cclosure_marshal_VOID__VOID,
1327 G_TYPE_NONE((GType) ((1) << (2))), 0);
1328 g_signal_set_va_marshaller(signals[SIGNAL_LOWER_WINDOW],
1329 G_OBJECT_CLASS_TYPE(klass)((((GTypeClass*) (klass))->g_type)),
1330 g_cclosure_marshal_VOID__VOIDv);
1331
1332 /**
1333 * BteTerminal::refresh-window:
1334 * @bteterminal: the object which received the signal
1335 *
1336 * Never emitted.
1337 *
1338 * Deprecated: 0.60
1339 */
1340 signals[SIGNAL_REFRESH_WINDOW] =
1341 g_signal_new(I_("refresh-window")(g_intern_static_string("refresh-window")),
1342 G_OBJECT_CLASS_TYPE(klass)((((GTypeClass*) (klass))->g_type)),
1343 G_SIGNAL_RUN_LAST,
1344 G_STRUCT_OFFSET(BteTerminalClass, refresh_window)((glong) __builtin_offsetof(BteTerminalClass, refresh_window)
)
,
1345 NULL__null,
1346 NULL__null,
1347 g_cclosure_marshal_VOID__VOID,
1348 G_TYPE_NONE((GType) ((1) << (2))), 0);
1349 g_signal_set_va_marshaller(signals[SIGNAL_REFRESH_WINDOW],
1350 G_OBJECT_CLASS_TYPE(klass)((((GTypeClass*) (klass))->g_type)),
1351 g_cclosure_marshal_VOID__VOIDv);
1352
1353 /**
1354 * BteTerminal::restore-window:
1355 * @bteterminal: the object which received the signal
1356 *
1357 * Never emitted.
1358 *
1359 * Deprecated: 0.60
1360 */
1361 signals[SIGNAL_RESTORE_WINDOW] =
1362 g_signal_new(I_("restore-window")(g_intern_static_string("restore-window")),
1363 G_OBJECT_CLASS_TYPE(klass)((((GTypeClass*) (klass))->g_type)),
1364 G_SIGNAL_RUN_LAST,
1365 G_STRUCT_OFFSET(BteTerminalClass, restore_window)((glong) __builtin_offsetof(BteTerminalClass, restore_window)
)
,
1366 NULL__null,
1367 NULL__null,
1368 g_cclosure_marshal_VOID__VOID,
1369 G_TYPE_NONE((GType) ((1) << (2))), 0);
1370 g_signal_set_va_marshaller(signals[SIGNAL_RESTORE_WINDOW],
1371 G_OBJECT_CLASS_TYPE(klass)((((GTypeClass*) (klass))->g_type)),
1372 g_cclosure_marshal_VOID__VOIDv);
1373
1374 /**
1375 * BteTerminal::maximize-window:
1376 * @bteterminal: the object which received the signal
1377 *
1378 * Never emitted.
1379 *
1380 * Deprecated: 0.60
1381 */
1382 signals[SIGNAL_MAXIMIZE_WINDOW] =
1383 g_signal_new(I_("maximize-window")(g_intern_static_string("maximize-window")),
1384 G_OBJECT_CLASS_TYPE(klass)((((GTypeClass*) (klass))->g_type)),
1385 G_SIGNAL_RUN_LAST,
1386 G_STRUCT_OFFSET(BteTerminalClass, maximize_window)((glong) __builtin_offsetof(BteTerminalClass, maximize_window
))
,
1387 NULL__null,
1388 NULL__null,
1389 g_cclosure_marshal_VOID__VOID,
1390 G_TYPE_NONE((GType) ((1) << (2))), 0);
1391 g_signal_set_va_marshaller(signals[SIGNAL_MAXIMIZE_WINDOW],
1392 G_OBJECT_CLASS_TYPE(klass)((((GTypeClass*) (klass))->g_type)),
1393 g_cclosure_marshal_VOID__VOIDv);
1394
1395 /**
1396 * BteTerminal::resize-window:
1397 * @bteterminal: the object which received the signal
1398 * @width: the desired number of columns
1399 * @height: the desired number of rows
1400 *
1401 * Emitted at the child application's request.
1402 */
1403 signals[SIGNAL_RESIZE_WINDOW] =
1404 g_signal_new(I_("resize-window")(g_intern_static_string("resize-window")),
1405 G_OBJECT_CLASS_TYPE(klass)((((GTypeClass*) (klass))->g_type)),
1406 G_SIGNAL_RUN_LAST,
1407 G_STRUCT_OFFSET(BteTerminalClass, resize_window)((glong) __builtin_offsetof(BteTerminalClass, resize_window)),
1408 NULL__null,
1409 NULL__null,
1410 _bte_marshal_VOID__UINT_UINT,
1411 G_TYPE_NONE((GType) ((1) << (2))), 2, G_TYPE_UINT((GType) ((7) << (2))), G_TYPE_UINT((GType) ((7) << (2))));
1412 g_signal_set_va_marshaller(signals[SIGNAL_RESIZE_WINDOW],
1413 G_OBJECT_CLASS_TYPE(klass)((((GTypeClass*) (klass))->g_type)),
1414 _bte_marshal_VOID__UINT_UINTv);
1415
1416 /**
1417 * BteTerminal::move-window:
1418 * @bteterminal: the object which received the signal
1419 * @x: the terminal's desired location, X coordinate
1420 * @y: the terminal's desired location, Y coordinate
1421 *
1422 * Never emitted.
1423 *
1424 * Deprecated: 0.60
1425 */
1426 signals[SIGNAL_MOVE_WINDOW] =
1427 g_signal_new(I_("move-window")(g_intern_static_string("move-window")),
1428 G_OBJECT_CLASS_TYPE(klass)((((GTypeClass*) (klass))->g_type)),
1429 G_SIGNAL_RUN_LAST,
1430 G_STRUCT_OFFSET(BteTerminalClass, move_window)((glong) __builtin_offsetof(BteTerminalClass, move_window)),
1431 NULL__null,
1432 NULL__null,
1433 _bte_marshal_VOID__UINT_UINT,
1434 G_TYPE_NONE((GType) ((1) << (2))), 2, G_TYPE_UINT((GType) ((7) << (2))), G_TYPE_UINT((GType) ((7) << (2))));
1435 g_signal_set_va_marshaller(signals[SIGNAL_MOVE_WINDOW],
1436 G_OBJECT_CLASS_TYPE(klass)((((GTypeClass*) (klass))->g_type)),
1437 _bte_marshal_VOID__UINT_UINTv);
1438
1439 /**
1440 * BteTerminal::increase-font-size:
1441 * @bteterminal: the object which received the signal
1442 *
1443 * Emitted when the user hits the '+' key while holding the Control key.
1444 */
1445 signals[SIGNAL_INCREASE_FONT_SIZE] =
1446 g_signal_new(I_("increase-font-size")(g_intern_static_string("increase-font-size")),
1447 G_OBJECT_CLASS_TYPE(klass)((((GTypeClass*) (klass))->g_type)),
1448 G_SIGNAL_RUN_LAST,
1449 G_STRUCT_OFFSET(BteTerminalClass, increase_font_size)((glong) __builtin_offsetof(BteTerminalClass, increase_font_size
))
,
1450 NULL__null,
1451 NULL__null,
1452 g_cclosure_marshal_VOID__VOID,
1453 G_TYPE_NONE((GType) ((1) << (2))), 0);
1454 g_signal_set_va_marshaller(signals[SIGNAL_INCREASE_FONT_SIZE],
1455 G_OBJECT_CLASS_TYPE(klass)((((GTypeClass*) (klass))->g_type)),
1456 g_cclosure_marshal_VOID__VOIDv);
1457
1458 /**
1459 * BteTerminal::decrease-font-size:
1460 * @bteterminal: the object which received the signal
1461 *
1462 * Emitted when the user hits the '-' key while holding the Control key.
1463 */
1464 signals[SIGNAL_DECREASE_FONT_SIZE] =
1465 g_signal_new(I_("decrease-font-size")(g_intern_static_string("decrease-font-size")),
1466 G_OBJECT_CLASS_TYPE(klass)((((GTypeClass*) (klass))->g_type)),
1467 G_SIGNAL_RUN_LAST,
1468 G_STRUCT_OFFSET(BteTerminalClass, decrease_font_size)((glong) __builtin_offsetof(BteTerminalClass, decrease_font_size
))
,
1469 NULL__null,
1470 NULL__null,
1471 g_cclosure_marshal_VOID__VOID,
1472 G_TYPE_NONE((GType) ((1) << (2))), 0);
1473 g_signal_set_va_marshaller(signals[SIGNAL_DECREASE_FONT_SIZE],
1474 G_OBJECT_CLASS_TYPE(klass)((((GTypeClass*) (klass))->g_type)),
1475 g_cclosure_marshal_VOID__VOIDv);
1476
1477 /**
1478 * BteTerminal::text-modified:
1479 * @bteterminal: the object which received the signal
1480 *
1481 * An internal signal used for communication between the terminal and
1482 * its accessibility peer. May not be emitted under certain
1483 * circumstances.
1484 */
1485 signals[SIGNAL_TEXT_MODIFIED] =
1486 g_signal_new(I_("text-modified")(g_intern_static_string("text-modified")),
1487 G_OBJECT_CLASS_TYPE(klass)((((GTypeClass*) (klass))->g_type)),
1488 G_SIGNAL_RUN_LAST,
1489 G_STRUCT_OFFSET(BteTerminalClass, text_modified)((glong) __builtin_offsetof(BteTerminalClass, text_modified)),
1490 NULL__null,
1491 NULL__null,
1492 g_cclosure_marshal_VOID__VOID,
1493 G_TYPE_NONE((GType) ((1) << (2))), 0);
1494 g_signal_set_va_marshaller(signals[SIGNAL_TEXT_MODIFIED],
1495 G_OBJECT_CLASS_TYPE(klass)((((GTypeClass*) (klass))->g_type)),
1496 g_cclosure_marshal_VOID__VOIDv);
1497
1498 /**
1499 * BteTerminal::text-inserted:
1500 * @bteterminal: the object which received the signal
1501 *
1502 * An internal signal used for communication between the terminal and
1503 * its accessibility peer. May not be emitted under certain
1504 * circumstances.
1505 */
1506 signals[SIGNAL_TEXT_INSERTED] =
1507 g_signal_new(I_("text-inserted")(g_intern_static_string("text-inserted")),
1508 G_OBJECT_CLASS_TYPE(klass)((((GTypeClass*) (klass))->g_type)),
1509 G_SIGNAL_RUN_LAST,
1510 G_STRUCT_OFFSET(BteTerminalClass, text_inserted)((glong) __builtin_offsetof(BteTerminalClass, text_inserted)),
1511 NULL__null,
1512 NULL__null,
1513 g_cclosure_marshal_VOID__VOID,
1514 G_TYPE_NONE((GType) ((1) << (2))), 0);
1515 g_signal_set_va_marshaller(signals[SIGNAL_TEXT_INSERTED],
1516 G_OBJECT_CLASS_TYPE(klass)((((GTypeClass*) (klass))->g_type)),
1517 g_cclosure_marshal_VOID__VOIDv);
1518
1519 /**
1520 * BteTerminal::text-deleted:
1521 * @bteterminal: the object which received the signal
1522 *
1523 * An internal signal used for communication between the terminal and
1524 * its accessibility peer. May not be emitted under certain
1525 * circumstances.
1526 */
1527 signals[SIGNAL_TEXT_DELETED] =
1528 g_signal_new(I_("text-deleted")(g_intern_static_string("text-deleted")),
1529 G_OBJECT_CLASS_TYPE(klass)((((GTypeClass*) (klass))->g_type)),
1530 G_SIGNAL_RUN_LAST,
1531 G_STRUCT_OFFSET(BteTerminalClass, text_deleted)((glong) __builtin_offsetof(BteTerminalClass, text_deleted)),
1532 NULL__null,
1533 NULL__null,
1534 g_cclosure_marshal_VOID__VOID,
1535 G_TYPE_NONE((GType) ((1) << (2))), 0);
1536 g_signal_set_va_marshaller(signals[SIGNAL_TEXT_DELETED],
1537 G_OBJECT_CLASS_TYPE(klass)((((GTypeClass*) (klass))->g_type)),
1538 g_cclosure_marshal_VOID__VOIDv);
1539
1540 /**
1541 * BteTerminal::text-scrolled:
1542 * @bteterminal: the object which received the signal
1543 * @delta: the number of lines scrolled
1544 *
1545 * An internal signal used for communication between the terminal and
1546 * its accessibility peer. May not be emitted under certain
1547 * circumstances.
1548 */
1549 signals[SIGNAL_TEXT_SCROLLED] =
1550 g_signal_new(I_("text-scrolled")(g_intern_static_string("text-scrolled")),
1551 G_OBJECT_CLASS_TYPE(klass)((((GTypeClass*) (klass))->g_type)),
1552 G_SIGNAL_RUN_LAST,
1553 G_STRUCT_OFFSET(BteTerminalClass, text_scrolled)((glong) __builtin_offsetof(BteTerminalClass, text_scrolled)),
1554 NULL__null,
1555 NULL__null,
1556 g_cclosure_marshal_VOID__INT,
1557 G_TYPE_NONE((GType) ((1) << (2))), 1, G_TYPE_INT((GType) ((6) << (2))));
1558 g_signal_set_va_marshaller(signals[SIGNAL_TEXT_SCROLLED],
1559 G_OBJECT_CLASS_TYPE(klass)((((GTypeClass*) (klass))->g_type)),
1560 g_cclosure_marshal_VOID__INTv);
1561
1562 /**
1563 * BteTerminal::copy-clipboard:
1564 * @bteterminal: the object which received the signal
1565 *
1566 * Emitted whenever bte_terminal_copy_clipboard() is called.
1567 */
1568 signals[SIGNAL_COPY_CLIPBOARD] =
1569 g_signal_new(I_("copy-clipboard")(g_intern_static_string("copy-clipboard")),
1570 G_OBJECT_CLASS_TYPE(klass)((((GTypeClass*) (klass))->g_type)),
1571 (GSignalFlags)(G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION),
1572 G_STRUCT_OFFSET(BteTerminalClass, copy_clipboard)((glong) __builtin_offsetof(BteTerminalClass, copy_clipboard)
)
,
1573 NULL__null,
1574 NULL__null,
1575 g_cclosure_marshal_VOID__VOID,
1576 G_TYPE_NONE((GType) ((1) << (2))), 0);
1577 g_signal_set_va_marshaller(signals[SIGNAL_COPY_CLIPBOARD],
1578 G_OBJECT_CLASS_TYPE(klass)((((GTypeClass*) (klass))->g_type)),
1579 g_cclosure_marshal_VOID__VOIDv);
1580
1581 /**
1582 * BteTerminal::paste-clipboard:
1583 * @bteterminal: the object which received the signal
1584 *
1585 * Emitted whenever bte_terminal_paste_clipboard() is called.
1586 */
1587 signals[SIGNAL_PASTE_CLIPBOARD] =
1588 g_signal_new(I_("paste-clipboard")(g_intern_static_string("paste-clipboard")),
1589 G_OBJECT_CLASS_TYPE(klass)((((GTypeClass*) (klass))->g_type)),
1590 (GSignalFlags)(G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION),
1591 G_STRUCT_OFFSET(BteTerminalClass, paste_clipboard)((glong) __builtin_offsetof(BteTerminalClass, paste_clipboard
))
,
1592 NULL__null,
1593 NULL__null,
1594 g_cclosure_marshal_VOID__VOID,
1595 G_TYPE_NONE((GType) ((1) << (2))), 0);
1596 g_signal_set_va_marshaller(signals[SIGNAL_PASTE_CLIPBOARD],
1597 G_OBJECT_CLASS_TYPE(klass)((((GTypeClass*) (klass))->g_type)),
1598 g_cclosure_marshal_VOID__VOIDv);
1599
1600 /**
1601 * BteTerminal::bell:
1602 * @bteterminal: the object which received the signal
1603 *
1604 * This signal is emitted when the a child sends a bell request to the
1605 * terminal.
1606 */
1607 signals[SIGNAL_BELL] =
1608 g_signal_new(I_("bell")(g_intern_static_string("bell")),
1609 G_OBJECT_CLASS_TYPE(klass)((((GTypeClass*) (klass))->g_type)),
1610 G_SIGNAL_RUN_LAST,
1611 G_STRUCT_OFFSET(BteTerminalClass, bell)((glong) __builtin_offsetof(BteTerminalClass, bell)),
1612 NULL__null,
1613 NULL__null,
1614 g_cclosure_marshal_VOID__VOID,
1615 G_TYPE_NONE((GType) ((1) << (2))), 0);
1616 g_signal_set_va_marshaller(signals[SIGNAL_BELL],
1617 G_OBJECT_CLASS_TYPE(klass)((((GTypeClass*) (klass))->g_type)),
1618 g_cclosure_marshal_VOID__VOIDv);
1619
1620 /**
1621 * BteTerminal:allow-bold:
1622 *
1623 * Controls whether or not the terminal will attempt to draw bold text,
1624 * by using a bold font variant.
1625 */
1626 pspecs[PROP_ALLOW_BOLD] =
1627 g_param_spec_boolean ("allow-bold", NULL__null, NULL__null,
1628 TRUE(!(0)),
1629 (GParamFlags) (G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS(G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB
)
| G_PARAM_EXPLICIT_NOTIFY));
1630
1631 /**
1632 * BteTerminal:allow-hyperlink:
1633 *
1634 * Controls whether or not hyperlinks (OSC 8 escape sequence) are recognized and displayed.
1635 *
1636 * Since: 0.50
1637 */
1638 pspecs[PROP_ALLOW_HYPERLINK] =
1639 g_param_spec_boolean ("allow-hyperlink", NULL__null, NULL__null,
1640 FALSE(0),
1641 (GParamFlags) (G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS(G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB
)
| G_PARAM_EXPLICIT_NOTIFY));
1642
1643 /**
1644 * BteTerminal:audible-bell:
1645 *
1646 * Controls whether or not the terminal will beep when the child outputs the
1647 * "bl" sequence.
1648 */
1649 pspecs[PROP_AUDIBLE_BELL] =
1650 g_param_spec_boolean ("audible-bell", NULL__null, NULL__null,
1651 TRUE(!(0)),
1652 (GParamFlags) (G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS(G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB
)
| G_PARAM_EXPLICIT_NOTIFY));
1653
1654 /**
1655 * BteTerminal:backspace-binding:
1656 *
1657 * Controls what string or control sequence the terminal sends to its child
1658 * when the user presses the backspace key.
1659 */
1660 pspecs[PROP_BACKSPACE_BINDING] =
1661 g_param_spec_enum ("backspace-binding", NULL__null, NULL__null,
1662 BTE_TYPE_ERASE_BINDING(bte_erase_binding_get_type ()),
1663 BTE_ERASE_AUTO,
1664 (GParamFlags) (G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS(G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB
)
| G_PARAM_EXPLICIT_NOTIFY));
1665
1666 /**
1667 * BteTerminal:bold-is-bright:
1668 *
1669 * Whether the SGR 1 attribute also switches to the bright counterpart
1670 * of the first 8 palette colors, in addition to making them bold (legacy behavior)
1671 * or if SGR 1 only enables bold and leaves the color intact.
1672 *
1673 * Since: 0.52
1674 */
1675 pspecs[PROP_BOLD_IS_BRIGHT] =
1676 g_param_spec_boolean ("bold-is-bright", NULL__null, NULL__null,
1677 FALSE(0),
1678 (GParamFlags) (G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS(G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB
)
| G_PARAM_EXPLICIT_NOTIFY));
1679
1680 /**
1681 * BteTerminal:cell-height-scale:
1682 *
1683 * Scale factor for the cell height, to increase line spacing. (The font's height is not affected.)
1684 *
1685 * Since: 0.52
1686 */
1687 pspecs[PROP_CELL_HEIGHT_SCALE] =
1688 g_param_spec_double ("cell-height-scale", NULL__null, NULL__null,
1689 BTE_CELL_SCALE_MIN(1.),
1690 BTE_CELL_SCALE_MAX(2.),
1691 1.,
1692 (GParamFlags) (G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS(G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB
)
| G_PARAM_EXPLICIT_NOTIFY));
1693
1694 /**
1695 * BteTerminal:cell-width-scale:
1696 *
1697 * Scale factor for the cell width, to increase letter spacing. (The font's width is not affected.)
1698 *
1699 * Since: 0.52
1700 */
1701 pspecs[PROP_CELL_WIDTH_SCALE] =
1702 g_param_spec_double ("cell-width-scale", NULL__null, NULL__null,
1703 BTE_CELL_SCALE_MIN(1.),
1704 BTE_CELL_SCALE_MAX(2.),
1705 1.,
1706 (GParamFlags) (G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS(G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB
)
| G_PARAM_EXPLICIT_NOTIFY));
1707
1708 /**
1709 * BteTerminal:cjk-ambiguous-width:
1710 *
1711 * This setting controls whether ambiguous-width characters are narrow or wide.
1712 * (Note that when using a non-UTF-8 encoding set via bte_terminal_set_encoding(),
1713 * the width of ambiguous-width characters is fixed and determined by the encoding
1714 * itself.)
1715 *
1716 * This setting only takes effect the next time the terminal is reset, either
1717 * via escape sequence or with bte_terminal_reset().
1718 */
1719 pspecs[PROP_CJK_AMBIGUOUS_WIDTH] =
1720 g_param_spec_int ("cjk-ambiguous-width", NULL__null, NULL__null,
1721 1, 2, BTE_DEFAULT_UTF8_AMBIGUOUS_WIDTH1,
1722 (GParamFlags) (G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS(G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB
)
| G_PARAM_EXPLICIT_NOTIFY));
1723
1724 /**
1725 * BteTerminal:cursor-blink-mode:
1726 *
1727 * Sets whether or not the cursor will blink. Using %BTE_CURSOR_BLINK_SYSTEM
1728 * will use the #CtkSettings::ctk-cursor-blink setting.
1729 */
1730 pspecs[PROP_CURSOR_BLINK_MODE] =
1731 g_param_spec_enum ("cursor-blink-mode", NULL__null, NULL__null,
1732 BTE_TYPE_CURSOR_BLINK_MODE(bte_cursor_blink_mode_get_type ()),
1733 BTE_CURSOR_BLINK_SYSTEM,
1734 (GParamFlags) (G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS(G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB
)
| G_PARAM_EXPLICIT_NOTIFY));
1735
1736 /**
1737 * BteTerminal:cursor-shape:
1738 *
1739 * Controls the shape of the cursor.
1740 */
1741 pspecs[PROP_CURSOR_SHAPE] =
1742 g_param_spec_enum ("cursor-shape", NULL__null, NULL__null,
1743 BTE_TYPE_CURSOR_SHAPE(bte_cursor_shape_get_type ()),
1744 BTE_CURSOR_SHAPE_BLOCK,
1745 (GParamFlags) (G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS(G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB
)
| G_PARAM_EXPLICIT_NOTIFY));
1746
1747 /**
1748 * BteTerminal:delete-binding:
1749 *
1750 * Controls what string or control sequence the terminal sends to its child
1751 * when the user presses the delete key.
1752 */
1753 pspecs[PROP_DELETE_BINDING] =
1754 g_param_spec_enum ("delete-binding", NULL__null, NULL__null,
1755 BTE_TYPE_ERASE_BINDING(bte_erase_binding_get_type ()),
1756 BTE_ERASE_AUTO,
1757 (GParamFlags) (G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS(G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB
)
| G_PARAM_EXPLICIT_NOTIFY));
1758
1759 /**
1760 * BteTerminal:enable-bidi:
1761 *
1762 * Controls whether or not the terminal will perform bidirectional text rendering.
1763 *
1764 * Since: 0.58
1765 */
1766 pspecs[PROP_ENABLE_BIDI] =
1767 g_param_spec_boolean ("enable-bidi", NULL__null, NULL__null,
1768 TRUE(!(0)),
1769 (GParamFlags) (G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS(G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB
)
| G_PARAM_EXPLICIT_NOTIFY));
1770
1771 /**
1772 * BteTerminal:enable-shaping:
1773 *
1774 * Controls whether or not the terminal will shape Arabic text.
1775 *
1776 * Since: 0.58
1777 */
1778 pspecs[PROP_ENABLE_SHAPING] =
1779 g_param_spec_boolean ("enable-shaping", NULL__null, NULL__null,
1780 TRUE(!(0)),
1781 (GParamFlags) (G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS(G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB
)
| G_PARAM_EXPLICIT_NOTIFY));
1782
1783 /**
1784 * BteTerminal:enable-sixel:
1785 *
1786 * Controls whether SIXEL image support is enabled.
1787 *
1788 * Since: 0.62
1789 */
1790 pspecs[PROP_ENABLE_SIXEL] =
1791 g_param_spec_boolean ("enable-sixel", nullptr, nullptr,
1792 false,
1793 (GParamFlags) (G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS(G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB
)
| G_PARAM_EXPLICIT_NOTIFY));
1794
1795
1796 /**
1797 * BteTerminal:font-scale:
1798 *
1799 * The terminal's font scale.
1800 */
1801 pspecs[PROP_FONT_SCALE] =
1802 g_param_spec_double ("font-scale", NULL__null, NULL__null,
1803 BTE_FONT_SCALE_MIN(.25),
1804 BTE_FONT_SCALE_MAX(4.),
1805 1.,
1806 (GParamFlags) (G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS(G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB
)
| G_PARAM_EXPLICIT_NOTIFY));
1807
1808 /**
1809 * BteTerminal:encoding:
1810 *
1811 * Controls the encoding the terminal will expect data from the child to
1812 * be encoded with. For certain terminal types, applications executing in the
1813 * terminal can change the encoding. The default is defined by the
1814 * application's locale settings.
1815 */
1816 pspecs[PROP_ENCODING] =
1817 g_param_spec_string ("encoding", NULL__null, NULL__null,
1818 NULL__null,
1819 (GParamFlags) (G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS(G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB
)
| G_PARAM_EXPLICIT_NOTIFY | _BTE_PARAM_DEPRECATED(_bte_debug_on(BTE_DEBUG_SIGNALS) ? G_PARAM_DEPRECATED : 0)));
1820
1821 /**
1822 * BteTerminal:font-desc:
1823 *
1824 * Specifies the font used for rendering all text displayed by the terminal,
1825 * overriding any fonts set using ctk_widget_modify_font(). The terminal
1826 * will immediately attempt to load the desired font, retrieve its
1827 * metrics, and attempt to resize itself to keep the same number of rows
1828 * and columns.
1829 */
1830 pspecs[PROP_FONT_DESC] =
1831 g_param_spec_boxed ("font-desc", NULL__null, NULL__null,
1832 PANGO_TYPE_FONT_DESCRIPTION(pango_font_description_get_type ()),
1833 (GParamFlags) (G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS(G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB
)
| G_PARAM_EXPLICIT_NOTIFY));
1834
1835 /**
1836 * BteTerminal:icon-title:
1837 *
1838 * The terminal's so-called icon title, or %NULL if no icon title has been set.
1839 */
1840 pspecs[PROP_ICON_TITLE] =
1841 g_param_spec_string ("icon-title", NULL__null, NULL__null,
1842 NULL__null,
1843 (GParamFlags) (G_PARAM_READABLE | G_PARAM_STATIC_STRINGS(G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB
)
| G_PARAM_EXPLICIT_NOTIFY));
1844
1845 /**
1846 * BteTerminal:input-enabled:
1847 *
1848 * Controls whether the terminal allows user input. When user input is disabled,
1849 * key press and mouse button press and motion events are not sent to the
1850 * terminal's child.
1851 */
1852 pspecs[PROP_INPUT_ENABLED] =
1853 g_param_spec_boolean ("input-enabled", NULL__null, NULL__null,
1854 TRUE(!(0)),
1855 (GParamFlags) (G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS(G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB
)
| G_PARAM_EXPLICIT_NOTIFY));
1856
1857 /**
1858 * BteTerminal:pointer-autohide:
1859 *
1860 * Controls the value of the terminal's mouse autohide setting. When autohiding
1861 * is enabled, the mouse cursor will be hidden when the user presses a key and
1862 * shown when the user moves the mouse.
1863 */
1864 pspecs[PROP_MOUSE_POINTER_AUTOHIDE] =
1865 g_param_spec_boolean ("pointer-autohide", NULL__null, NULL__null,
1866 FALSE(0),
1867 (GParamFlags) (G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS(G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB
)
| G_PARAM_EXPLICIT_NOTIFY));
1868
1869 /**
1870 * BteTerminal:pty:
1871 *
1872 * The PTY object for the terminal.
1873 */
1874 pspecs[PROP_PTY] =
1875 g_param_spec_object ("pty", NULL__null, NULL__null,
1876 BTE_TYPE_PTY(bte_pty_get_type()),
1877 (GParamFlags) (G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS(G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB
)
| G_PARAM_EXPLICIT_NOTIFY));
1878
1879 /**
1880 * BteTerminal:rewrap-on-resize:
1881 *
1882 * Controls whether or not the terminal will rewrap its contents, including
1883 * the scrollback buffer, whenever the terminal's width changes.
1884 *
1885 * Deprecated: 0.58
1886 */
1887 pspecs[PROP_REWRAP_ON_RESIZE] =
1888 g_param_spec_boolean ("rewrap-on-resize", NULL__null, NULL__null,
1889 TRUE(!(0)),
1890 (GParamFlags) (G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS(G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB
)
| G_PARAM_EXPLICIT_NOTIFY));
1891
1892 /**
1893 * BteTerminal:scrollback-lines:
1894 *
1895 * The length of the scrollback buffer used by the terminal. The size of
1896 * the scrollback buffer will be set to the larger of this value and the number
1897 * of visible rows the widget can display, so 0 can safely be used to disable
1898 * scrollback. Note that this setting only affects the normal screen buffer.
1899 * For terminal types which have an alternate screen buffer, no scrollback is
1900 * allowed on the alternate screen buffer.
1901 */
1902 pspecs[PROP_SCROLLBACK_LINES] =
1903 g_param_spec_uint ("scrollback-lines", NULL__null, NULL__null,
1904 0, G_MAXUINT(2147483647 *2U +1U),
1905 BTE_SCROLLBACK_INIT512,
1906 (GParamFlags) (G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS(G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB
)
| G_PARAM_EXPLICIT_NOTIFY));
1907
1908 /**
1909 * BteTerminal:scroll-on-keystroke:
1910 *
1911 * Controls whether or not the terminal will forcibly scroll to the bottom of
1912 * the viewable history when the user presses a key. Modifier keys do not
1913 * trigger this behavior.
1914 */
1915 pspecs[PROP_SCROLL_ON_KEYSTROKE] =
1916 g_param_spec_boolean ("scroll-on-keystroke", NULL__null, NULL__null,
1917 FALSE(0),
1918 (GParamFlags) (G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS(G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB
)
| G_PARAM_EXPLICIT_NOTIFY));
1919
1920 /**
1921 * BteTerminal:scroll-on-output:
1922 *
1923 * Controls whether or not the terminal will forcibly scroll to the bottom of
1924 * the viewable history when the new data is received from the child.
1925 */
1926 pspecs[PROP_SCROLL_ON_OUTPUT] =
1927 g_param_spec_boolean ("scroll-on-output", NULL__null, NULL__null,
1928 TRUE(!(0)),
1929 (GParamFlags) (G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS(G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB
)
| G_PARAM_EXPLICIT_NOTIFY));
1930
1931 /**
1932 * BteTerminal:text-blink-mode:
1933 *
1934 * Controls whether or not the terminal will allow blinking text.
1935 *
1936 * Since: 0.52
1937 */
1938 pspecs[PROP_TEXT_BLINK_MODE] =
1939 g_param_spec_enum ("text-blink-mode", NULL__null, NULL__null,
1940 BTE_TYPE_TEXT_BLINK_MODE(bte_text_blink_mode_get_type ()),
1941 BTE_TEXT_BLINK_ALWAYS,
1942 (GParamFlags) (G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS(G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB
)
| G_PARAM_EXPLICIT_NOTIFY));
1943
1944 /**
1945 * BteTerminal:window-title:
1946 *
1947 * The terminal's title.
1948 */
1949 pspecs[PROP_WINDOW_TITLE] =
1950 g_param_spec_string ("window-title", NULL__null, NULL__null,
1951 NULL__null,
1952 (GParamFlags) (G_PARAM_READABLE | G_PARAM_STATIC_STRINGS(G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB
)
| G_PARAM_EXPLICIT_NOTIFY));
1953
1954 /**
1955 * BteTerminal:current-directory-uri:
1956 *
1957 * The current directory URI, or %NULL if unset.
1958 */
1959 pspecs[PROP_CURRENT_DIRECTORY_URI] =
1960 g_param_spec_string ("current-directory-uri", NULL__null, NULL__null,
1961 NULL__null,
1962 (GParamFlags) (G_PARAM_READABLE | G_PARAM_STATIC_STRINGS(G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB
)
| G_PARAM_EXPLICIT_NOTIFY));
1963
1964 /**
1965 * BteTerminal:current-file-uri:
1966 *
1967 * The current file URI, or %NULL if unset.
1968 */
1969 pspecs[PROP_CURRENT_FILE_URI] =
1970 g_param_spec_string ("current-file-uri", NULL__null, NULL__null,
1971 NULL__null,
1972 (GParamFlags) (G_PARAM_READABLE | G_PARAM_STATIC_STRINGS(G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB
)
| G_PARAM_EXPLICIT_NOTIFY));
1973
1974 /**
1975 * BteTerminal:hyperlink-hover-uri:
1976 *
1977 * The currently hovered hyperlink URI, or %NULL if unset.
1978 *
1979 * Since: 0.50
1980 */
1981 pspecs[PROP_HYPERLINK_HOVER_URI] =
1982 g_param_spec_string ("hyperlink-hover-uri", NULL__null, NULL__null,
1983 NULL__null,
1984 (GParamFlags) (G_PARAM_READABLE | G_PARAM_STATIC_STRINGS(G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB
)
| G_PARAM_EXPLICIT_NOTIFY));
1985
1986 /**
1987 * BteTerminal:word-char-exceptions:
1988 *
1989 * The set of characters which will be considered parts of a word
1990 * when doing word-wise selection, in addition to the default which only
1991 * considers alphanumeric characters part of a word.
1992 *
1993 * If %NULL, a built-in set is used.
1994 *
1995 * Since: 0.40
1996 */
1997 pspecs[PROP_WORD_CHAR_EXCEPTIONS] =
1998 g_param_spec_string ("word-char-exceptions", NULL__null, NULL__null,
1999 NULL__null,
2000 (GParamFlags) (G_PARAM_READABLE | G_PARAM_STATIC_STRINGS(G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB
)
| G_PARAM_EXPLICIT_NOTIFY));
2001
2002 g_object_class_install_properties(gobject_class, LAST_PROP, pspecs);
2003
2004 /* Disable CtkWidget's keybindings except for Shift-F10 and MenuKey
2005 * which pop up the context menu.
2006 */
2007 binding_set = ctk_binding_set_by_class(bte_terminal_parent_class);
2008 ctk_binding_entry_skip(binding_set, CDK_KEY_F10xffbe, CDK_CONTROL_MASK);
2009 ctk_binding_entry_skip(binding_set, CDK_KEY_F10xffbe, CDK_SHIFT_MASK);
2010 ctk_binding_entry_skip(binding_set, CDK_KEY_KP_F10xff91, CDK_CONTROL_MASK);
2011 ctk_binding_entry_skip(binding_set, CDK_KEY_KP_F10xff91, CDK_SHIFT_MASK);
2012
2013 process_timer = g_timer_new();
2014
2015 klass->priv = G_TYPE_CLASS_GET_PRIVATE (klass, BTE_TYPE_TERMINAL, BteTerminalClassPrivate)((BteTerminalClassPrivate*) g_type_class_get_private ((GTypeClass
*) (klass), ((bte_terminal_get_type()))))
;
2016
2017 klass->priv->fallback_style_provider = CTK_STYLE_PROVIDER (ctk_css_provider_new ())((((CtkStyleProvider*) (void *) g_type_check_instance_cast ((
GTypeInstance*) ((ctk_css_provider_new ())), ((ctk_style_provider_get_type
()))))))
;
2018 /* Some themes don't define text_view_bg */
2019 ctk_css_provider_load_from_data (CTK_CSS_PROVIDER (klass->priv->fallback_style_provider)((((CtkCssProvider*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((klass->priv->fallback_style_provider)), ((ctk_css_provider_get_type
()))))))
,
2020 "@define-color text_view_bg @theme_base_color;\n"
2021 "BteTerminal, " BTE_TERMINAL_CSS_NAME"bte-terminal" " {\n"
2022 "background-color: @text_view_bg;\n"
2023 "color: @theme_text_color;\n"
2024 "}\n",
2025 -1, NULL__null);
2026 klass->priv->style_provider = CTK_STYLE_PROVIDER (ctk_css_provider_new ())((((CtkStyleProvider*) (void *) g_type_check_instance_cast ((
GTypeInstance*) ((ctk_css_provider_new ())), ((ctk_style_provider_get_type
()))))))
;
2027 ctk_css_provider_load_from_data (CTK_CSS_PROVIDER (klass->priv->style_provider)((((CtkCssProvider*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((klass->priv->style_provider)), ((ctk_css_provider_get_type
()))))))
,
2028 "BteTerminal, " BTE_TERMINAL_CSS_NAME"bte-terminal" " {\n"
2029 "padding: 1px 1px 1px 1px;\n"
2030 "}\n",
2031 -1, NULL__null);
2032
2033#ifdef WITH_A11Y
2034 /* a11y */
2035 ctk_widget_class_set_accessible_type(widget_class, BTE_TYPE_TERMINAL_ACCESSIBLE(_bte_terminal_accessible_get_type ()));
2036#endif
2037}
2038
2039static gboolean
2040bte_terminal_scrollable_get_border(CtkScrollable* scrollable,
2041 CtkBorder* border) noexcept
2042try
2043{
2044 *border = *WIDGET(BTE_TERMINAL(scrollable))(get_widget(((((BteTerminal*) (void *) g_type_check_instance_cast
((GTypeInstance*) ((scrollable)), ((bte_terminal_get_type())
)))))))
->padding();
2045 return true;
2046}
2047catch (...)
2048{
2049 bte::log_exception();
2050 return false;
2051}
2052
2053static void
2054bte_terminal_scrollable_iface_init(CtkScrollableInterface* iface) noexcept
2055{
2056 iface->get_border = bte_terminal_scrollable_get_border;
2057}
2058
2059/* public API */
2060
2061/**
2062 * bte_get_features:
2063 *
2064 * Gets a list of features bte was compiled with.
2065 *
2066 * Returns: (transfer none): a string with features
2067 *
2068 * Since: 0.40
2069 */
2070const char *
2071bte_get_features (void) noexcept
2072{
2073 return
2074#ifdef WITH_FRIBIDI
2075 "+BIDI"
2076#else
2077 "-BIDI"
2078#endif
2079 " "
2080#ifdef WITH_GNUTLS
2081 "+GNUTLS"
2082#else
2083 "-GNUTLS"
2084#endif
2085 " "
2086#ifdef WITH_ICU
2087 "+ICU"
2088#else
2089 "-ICU"
2090#endif
2091 " "
2092#ifdef __linux__1
2093#ifdef WITH_SYSTEMD
2094 "+SYSTEMD"
2095#else
2096 "-SYSTEMD"
2097#endif
2098#endif // __linux__
2099 ;
2100}
2101
2102/**
2103 * bte_get_feature_flags:
2104 *
2105 * Gets features BTE was compiled with.
2106 *
2107 * Returns: (transfer none): flags from #BteFeatureFlags
2108 *
2109 * Since: 0.62
2110 */
2111BteFeatureFlags
2112bte_get_feature_flags(void) noexcept
2113{
2114 return BteFeatureFlags(
2115#ifdef WITH_FRIBIDI
2116 BTE_FEATURE_FLAG_BIDI |
2117#endif
2118#ifdef WITH_ICU
2119 BTE_FEATURE_FLAG_ICU |
2120#endif
2121#ifdef __linux__1
2122#ifdef WITH_SYSTEMD
2123 BTE_FEATURE_FLAG_SYSTEMD |
2124#endif
2125#endif // __linux__
2126 0ULL);
2127}
2128
2129/**
2130 * bte_get_major_version:
2131 *
2132 * Returns the major version of the BTE library at runtime.
2133 * Contrast this with %BTE_MAJOR_VERSION which represents
2134 * the version of the BTE library that the code was compiled
2135 * with.
2136 *
2137 * Returns: the major version
2138 *
2139 * Since: 0.40
2140 */
2141guint
2142bte_get_major_version (void) noexcept
2143{
2144 return BTE_MAJOR_VERSION(0);
2145}
2146
2147/**
2148 * bte_get_minor_version:
2149 *
2150 * Returns the minor version of the BTE library at runtime.
2151 * Contrast this with %BTE_MINOR_VERSION which represents
2152 * the version of the BTE library that the code was compiled
2153 * with.
2154 *
2155 * Returns: the minor version
2156 *
2157 * Since: 0.40
2158 */
2159guint
2160bte_get_minor_version (void) noexcept
2161{
2162 return BTE_MINOR_VERSION(65);
2163}
2164
2165/**
2166 * bte_get_micro_version:
2167 *
2168 * Returns the micro version of the BTE library at runtime.
2169 * Contrast this with %BTE_MICRO_VERSION which represents
2170 * the version of the BTE library that the code was compiled
2171 * with.
2172 *
2173 * Returns: the micro version
2174 *
2175 * Since: 0.40
2176 */
2177guint
2178bte_get_micro_version (void) noexcept
2179{
2180 return BTE_MICRO_VERSION(0);
2181}
2182
2183/**
2184 * bte_get_user_shell:
2185 *
2186 * Gets the user's shell, or %NULL. In the latter case, the
2187 * system default (usually "/bin/sh") should be used.
2188 *
2189 * Returns: (transfer full) (type filename): a newly allocated string with the
2190 * user's shell, or %NULL
2191 */
2192char *
2193bte_get_user_shell (void) noexcept
2194{
2195 struct passwd *pwd;
2196
2197 pwd = getpwuid(getuid());
2198 if (pwd && pwd->pw_shell)
2199 return g_strdup (pwd->pw_shell);
2200
2201 return NULL__null;
2202}
2203
2204/**
2205 * bte_set_test_flags: (skip):
2206 * @flags: flags
2207 *
2208 * Sets test flags. This function is only useful for implementing
2209 * unit tests for bte itself; it is a no-op in non-debug builds.
2210 *
2211 * Since: 0.54
2212 */
2213void
2214bte_set_test_flags(guint64 flags) noexcept
2215{
2216#ifdef BTE_DEBUG
2217 g_test_flags = flags;
2218#endif
2219}
2220
2221/**
2222 * bte_get_encodings:
2223 * @include_aliases: whether to include alias names
2224 *
2225 * Gets the list of supported legacy encodings.
2226 *
2227 * If ICU support is not available, this returns an empty vector.
2228 * Note that UTF-8 is always supported; you can select it by
2229 * passing %NULL to bte_terminal_set_encoding().
2230 *
2231 * Returns: (transfer full): the list of supported encodings; free with
2232 * g_strfreev()
2233 *
2234 * Since: 0.60
2235 * Deprecated: 0.60
2236 */
2237char **
2238bte_get_encodings(gboolean include_aliases) noexcept
2239try
2240{
2241#ifdef WITH_ICU
2242 return bte::base::get_icu_charsets(include_aliases != FALSE(0));
2243#else
2244 char *empty[] = { nullptr };
2245 return g_strdupv(empty);
2246#endif
2247}
2248catch (...)
2249{
2250 bte::log_exception();
2251
2252 char *empty[] = { nullptr };
2253 return g_strdupv(empty);
2254}
2255
2256/**
2257 * bte_get_encoding_supported:
2258 * @encoding: the name of the legacy encoding
2259 *
2260 * Queries whether the legacy encoding @encoding is supported.
2261 *
2262 * If ICU support is not available, this function always returns %FALSE.
2263 *
2264 * Note that UTF-8 is always supported; you can select it by
2265 * passing %NULL to bte_terminal_set_encoding().
2266 *
2267 * Returns: %TRUE iff the legacy encoding @encoding is supported
2268 *
2269 * Since: 0.60
2270 * Deprecated: 0.60
2271 */
2272gboolean
2273bte_get_encoding_supported(const char *encoding) noexcept
2274try
2275{
2276 g_return_val_if_fail(encoding != nullptr, false)do { if ((__builtin_expect (__extension__ ({ int _g_boolean_var_
; if (encoding != nullptr) _g_boolean_var_ = 1; else _g_boolean_var_
= 0; _g_boolean_var_; }), 1))) { } else { g_return_if_fail_warning
("BTE", ((const char*) (__PRETTY_FUNCTION__)), "encoding != nullptr"
); return (false); } } while (0)
;
2277
2278#ifdef WITH_ICU
2279 return bte::base::get_icu_charset_supported(encoding);
2280#else
2281 return false;
2282#endif
2283}
2284catch (...)
2285{
2286 bte::log_exception();
2287 return false;
2288}
2289
2290/* BteTerminal public API */
2291
2292/**
2293 * bte_terminal_new:
2294 *
2295 * Creates a new terminal widget.
2296 *
2297 * Returns: (transfer none) (type Bte.Terminal): a new #BteTerminal object
2298 */
2299CtkWidget *
2300bte_terminal_new(void) noexcept
2301{
2302 return (CtkWidget *)g_object_new(BTE_TYPE_TERMINAL(bte_terminal_get_type()), nullptr);
2303}
2304
2305/**
2306 * bte_terminal_copy_clipboard:
2307 * @terminal: a #BteTerminal
2308 *
2309 * Places the selected text in the terminal in the #CDK_SELECTION_CLIPBOARD
2310 * selection.
2311 *
2312 * Deprecated: 0.50: Use bte_terminal_copy_clipboard_format() with %BTE_FORMAT_TEXT
2313 * instead.
2314 */
2315void
2316bte_terminal_copy_clipboard(BteTerminal *terminal) noexcept
2317try
2318{
2319 g_return_if_fail(BTE_IS_TERMINAL(terminal))do { if ((__builtin_expect (__extension__ ({ int _g_boolean_var_
; if ((((__extension__ ({ GTypeInstance *__inst = (GTypeInstance
*) ((terminal)); GType __t = ((bte_terminal_get_type())); gboolean
__r; if (!__inst) __r = (0); else if (__inst->g_class &&
__inst->g_class->g_type == __t) __r = (!(0)); else __r
= g_type_check_instance_is_a (__inst, __t); __r; }))))) _g_boolean_var_
= 1; else _g_boolean_var_ = 0; _g_boolean_var_; }), 1))) { }
else { g_return_if_fail_warning ("BTE", ((const char*) (__PRETTY_FUNCTION__
)), "BTE_IS_TERMINAL(terminal)"); return; } } while (0)
;
2320
2321 IMPL(terminal)(_bte_terminal_get_impl(terminal))->emit_copy_clipboard();
2322}
2323catch (...)
2324{
2325 bte::log_exception();
2326}
2327
2328/**
2329 * bte_terminal_copy_clipboard_format:
2330 * @terminal: a #BteTerminal
2331 * @format: a #BteFormat
2332 *
2333 * Places the selected text in the terminal in the #CDK_SELECTION_CLIPBOARD
2334 * selection in the form specified by @format.
2335 *
2336 * For all formats, the selection data (see #CtkSelectionData) will include the
2337 * text targets (see ctk_target_list_add_text_targets() and
2338 * ctk_selection_data_targets_includes_text()). For %BTE_FORMAT_HTML,
2339 * the selection will also include the "text/html" target, which when requested,
2340 * returns the HTML data in UTF-16 with a U+FEFF BYTE ORDER MARK character at
2341 * the start.
2342 *
2343 * Since: 0.50
2344 */
2345void
2346bte_terminal_copy_clipboard_format(BteTerminal *terminal,
2347 BteFormat format) noexcept
2348try
2349{
2350 g_return_if_fail(BTE_IS_TERMINAL(terminal))do { if ((__builtin_expect (__extension__ ({ int _g_boolean_var_
; if ((((__extension__ ({ GTypeInstance *__inst = (GTypeInstance
*) ((terminal)); GType __t = ((bte_terminal_get_type())); gboolean
__r; if (!__inst) __r = (0); else if (__inst->g_class &&
__inst->g_class->g_type == __t) __r = (!(0)); else __r
= g_type_check_instance_is_a (__inst, __t); __r; }))))) _g_boolean_var_
= 1; else _g_boolean_var_ = 0; _g_boolean_var_; }), 1))) { }
else { g_return_if_fail_warning ("BTE", ((const char*) (__PRETTY_FUNCTION__
)), "BTE_IS_TERMINAL(terminal)"); return; } } while (0)
;
2351 g_return_if_fail(format == BTE_FORMAT_TEXT || format == BTE_FORMAT_HTML)do { if ((__builtin_expect (__extension__ ({ int _g_boolean_var_
; if (format == BTE_FORMAT_TEXT || format == BTE_FORMAT_HTML)
_g_boolean_var_ = 1; else _g_boolean_var_ = 0; _g_boolean_var_
; }), 1))) { } else { g_return_if_fail_warning ("BTE", ((const
char*) (__PRETTY_FUNCTION__)), "format == BTE_FORMAT_TEXT || format == BTE_FORMAT_HTML"
); return; } } while (0)
;
2352
2353 WIDGET(terminal)(get_widget(terminal))->copy(BTE_SELECTION_CLIPBOARD, format);
2354}
2355catch (...)
2356{
2357 bte::log_exception();
2358}
2359
2360/**
2361 * bte_terminal_copy_primary:
2362 * @terminal: a #BteTerminal
2363 *
2364 * Places the selected text in the terminal in the #CDK_SELECTION_PRIMARY
2365 * selection.
2366 */
2367void
2368bte_terminal_copy_primary(BteTerminal *terminal) noexcept
2369try
2370{
2371 g_return_if_fail(BTE_IS_TERMINAL(terminal))do { if ((__builtin_expect (__extension__ ({ int _g_boolean_var_
; if ((((__extension__ ({ GTypeInstance *__inst = (GTypeInstance
*) ((terminal)); GType __t = ((bte_terminal_get_type())); gboolean
__r; if (!__inst) __r = (0); else if (__inst->g_class &&
__inst->g_class->g_type == __t) __r = (!(0)); else __r
= g_type_check_instance_is_a (__inst, __t); __r; }))))) _g_boolean_var_
= 1; else _g_boolean_var_ = 0; _g_boolean_var_; }), 1))) { }
else { g_return_if_fail_warning ("BTE", ((const char*) (__PRETTY_FUNCTION__
)), "BTE_IS_TERMINAL(terminal)"); return; } } while (0)
;
2372 _bte_debug_print(BTE_DEBUG_SELECTION, "Copying to PRIMARY.\n")do { } while(0);
2373 WIDGET(terminal)(get_widget(terminal))->copy(BTE_SELECTION_PRIMARY, BTE_FORMAT_TEXT);
2374}
2375catch (...)
2376{
2377 bte::log_exception();
2378}
2379
2380/**
2381 * bte_terminal_paste_clipboard:
2382 * @terminal: a #BteTerminal
2383 *
2384 * Sends the contents of the #CDK_SELECTION_CLIPBOARD selection to the
2385 * terminal's child. It's called on paste menu item, or when
2386 * user presses Shift+Insert.
2387 */
2388void
2389bte_terminal_paste_clipboard(BteTerminal *terminal) noexcept
2390try
2391{
2392 g_return_if_fail(BTE_IS_TERMINAL(terminal))do { if ((__builtin_expect (__extension__ ({ int _g_boolean_var_
; if ((((__extension__ ({ GTypeInstance *__inst = (GTypeInstance
*) ((terminal)); GType __t = ((bte_terminal_get_type())); gboolean
__r; if (!__inst) __r = (0); else if (__inst->g_class &&
__inst->g_class->g_type == __t) __r = (!(0)); else __r
= g_type_check_instance_is_a (__inst, __t); __r; }))))) _g_boolean_var_
= 1; else _g_boolean_var_ = 0; _g_boolean_var_; }), 1))) { }
else { g_return_if_fail_warning ("BTE", ((const char*) (__PRETTY_FUNCTION__
)), "BTE_IS_TERMINAL(terminal)"); return; } } while (0)
;
2393
2394 IMPL(terminal)(_bte_terminal_get_impl(terminal))->emit_paste_clipboard();
2395}
2396catch (...)
2397{
2398 bte::log_exception();
2399}
2400
2401/**
2402 * bte_terminal_paste_primary:
2403 * @terminal: a #BteTerminal
2404 *
2405 * Sends the contents of the #CDK_SELECTION_PRIMARY selection to the terminal's
2406 * child. The terminal will call also paste the
2407 * #CDK_SELECTION_PRIMARY selection when the user clicks with the the second
2408 * mouse button.
2409 */
2410void
2411bte_terminal_paste_primary(BteTerminal *terminal) noexcept
2412try
2413{
2414 g_return_if_fail(BTE_IS_TERMINAL(terminal))do { if ((__builtin_expect (__extension__ ({ int _g_boolean_var_
; if ((((__extension__ ({ GTypeInstance *__inst = (GTypeInstance
*) ((terminal)); GType __t = ((bte_terminal_get_type())); gboolean
__r; if (!__inst) __r = (0); else if (__inst->g_class &&
__inst->g_class->g_type == __t) __r = (!(0)); else __r
= g_type_check_instance_is_a (__inst, __t); __r; }))))) _g_boolean_var_
= 1; else _g_boolean_var_ = 0; _g_boolean_var_; }), 1))) { }
else { g_return_if_fail_warning ("BTE", ((const char*) (__PRETTY_FUNCTION__
)), "BTE_IS_TERMINAL(terminal)"); return; } } while (0)
;
2415 _bte_debug_print(BTE_DEBUG_SELECTION, "Pasting PRIMARY.\n")do { } while(0);
2416 WIDGET(terminal)(get_widget(terminal))->paste(CDK_SELECTION_PRIMARY((CdkAtom)((gpointer) (gulong) (1))));
2417}
2418catch (...)
2419{
2420 bte::log_exception();
2421}
2422
2423/**
2424 * bte_terminal_match_add_gregex:
2425 * @terminal: a #BteTerminal
2426 * @gregex: a #GRegex
2427 * @gflags: the #GRegexMatchFlags to use when matching the regex
2428 *
2429 * This function does nothing since version 0.60.
2430 *
2431 * Returns: -1
2432 *
2433 * Deprecated: 0.46: Use bte_terminal_match_add_regex() or bte_terminal_match_add_regex_full() instead.
2434 */
2435int
2436bte_terminal_match_add_gregex(BteTerminal *terminal,
2437 GRegex *gregex,
2438 GRegexMatchFlags gflags) noexcept
2439{
2440 return -1;
2441}
2442
2443/**
2444 * bte_terminal_match_add_regex:
2445 * @terminal: a #BteTerminal
2446 * @regex: (transfer none): a #BteRegex
2447 * @flags: PCRE2 match flags, or 0
2448 *
2449 * Adds the regular expression @regex to the list of matching expressions. When the
2450 * user moves the mouse cursor over a section of displayed text which matches
2451 * this expression, the text will be highlighted.
2452 *
2453 * Note that @regex should have been created using the %PCRE2_MULTILINE flag.
2454 *
2455 * Returns: an integer associated with this expression
2456 *
2457 * Since: 0.46
2458 */
2459int
2460bte_terminal_match_add_regex(BteTerminal *terminal,
2461 BteRegex *regex,
2462 guint32 flags) noexcept
2463try
2464{
2465 g_return_val_if_fail(BTE_IS_TERMINAL(terminal), -1)do { if ((__builtin_expect (__extension__ ({ int _g_boolean_var_
; if ((((__extension__ ({ GTypeInstance *__inst = (GTypeInstance
*) ((terminal)); GType __t = ((bte_terminal_get_type())); gboolean
__r; if (!__inst) __r = (0); else if (__inst->g_class &&
__inst->g_class->g_type == __t) __r = (!(0)); else __r
= g_type_check_instance_is_a (__inst, __t); __r; }))))) _g_boolean_var_
= 1; else _g_boolean_var_ = 0; _g_boolean_var_; }), 1))) { }
else { g_return_if_fail_warning ("BTE", ((const char*) (__PRETTY_FUNCTION__
)), "BTE_IS_TERMINAL(terminal)"); return (-1); } } while (0)
;
2466 g_return_val_if_fail(regex != NULL, -1)do { if ((__builtin_expect (__extension__ ({ int _g_boolean_var_
; if (regex != __null) _g_boolean_var_ = 1; else _g_boolean_var_
= 0; _g_boolean_var_; }), 1))) { } else { g_return_if_fail_warning
("BTE", ((const char*) (__PRETTY_FUNCTION__)), "regex != NULL"
); return (-1); } } while (0)
;
2467 g_return_val_if_fail(_bte_regex_has_purpose(regex, bte::base::Regex::Purpose::eMatch), -1)do { if ((__builtin_expect (__extension__ ({ int _g_boolean_var_
; if (_bte_regex_has_purpose(regex, bte::base::Regex::Purpose
::eMatch)) _g_boolean_var_ = 1; else _g_boolean_var_ = 0; _g_boolean_var_
; }), 1))) { } else { g_return_if_fail_warning ("BTE", ((const
char*) (__PRETTY_FUNCTION__)), "_bte_regex_has_purpose(regex, bte::base::Regex::Purpose::eMatch)"
); return (-1); } } while (0)
;
2468 g_warn_if_fail(_bte_regex_has_multiline_compile_flag(regex))do { if (__builtin_expect (__extension__ ({ int _g_boolean_var_
; if (_bte_regex_has_multiline_compile_flag(regex)) _g_boolean_var_
= 1; else _g_boolean_var_ = 0; _g_boolean_var_; }), 1)) ; else
g_warn_message ("BTE", "../src/btectk.cc", 2468, ((const char
*) (__PRETTY_FUNCTION__)), "_bte_regex_has_multiline_compile_flag(regex)"
); } while (0)
;
2469
2470 auto impl = IMPL(terminal)(_bte_terminal_get_impl(terminal));
2471 return impl->regex_match_add(bte::base::make_ref(regex_from_wrapper(regex)),
2472 flags,
2473 BTE_DEFAULT_CURSORCDK_XTERM,
2474 impl->regex_match_next_tag()).tag();
2475}
2476catch (...)
2477{
2478 bte::log_exception();
2479 return -1;
2480}
2481
2482/**
2483 * bte_terminal_match_check:
2484 * @terminal: a #BteTerminal
2485 * @column: the text column
2486 * @row: the text row
2487 * @tag: (out) (allow-none): a location to store the tag, or %NULL
2488 *
2489 * Checks if the text in and around the specified position matches any of the
2490 * regular expressions previously set using bte_terminal_match_add(). If a
2491 * match exists, the text string is returned and if @tag is not %NULL, the number
2492 * associated with the matched regular expression will be stored in @tag.
2493 *
2494 * If more than one regular expression has been set with
2495 * bte_terminal_match_add(), then expressions are checked in the order in
2496 * which they were added.
2497 *
2498 * Returns: (transfer full) (nullable): a newly allocated string which matches one of the previously
2499 * set regular expressions
2500 *
2501 * Deprecated: 0.46: Use bte_terminal_match_check_event() instead.
2502 */
2503char *
2504bte_terminal_match_check(BteTerminal *terminal,
2505 long column,
2506 long row,
2507 int *tag) noexcept
2508try
2509{
2510 g_return_val_if_fail(BTE_IS_TERMINAL(terminal), NULL)do { if ((__builtin_expect (__extension__ ({ int _g_boolean_var_
; if ((((__extension__ ({ GTypeInstance *__inst = (GTypeInstance
*) ((terminal)); GType __t = ((bte_terminal_get_type())); gboolean
__r; if (!__inst) __r = (0); else if (__inst->g_class &&
__inst->g_class->g_type == __t) __r = (!(0)); else __r
= g_type_check_instance_is_a (__inst, __t); __r; }))))) _g_boolean_var_
= 1; else _g_boolean_var_ = 0; _g_boolean_var_; }), 1))) { }
else { g_return_if_fail_warning ("BTE", ((const char*) (__PRETTY_FUNCTION__
)), "BTE_IS_TERMINAL(terminal)"); return (__null); } } while (
0)
;
2511 return WIDGET(terminal)(get_widget(terminal))->regex_match_check(column, row, tag);
2512}
2513catch (...)
2514{
2515 bte::log_exception();
2516 return nullptr;
2517}
2518
2519/**
2520 * bte_terminal_match_check_event:
2521 * @terminal: a #BteTerminal
2522 * @event: a #CdkEvent
2523 * @tag: (out) (allow-none): a location to store the tag, or %NULL
2524 *
2525 * Checks if the text in and around the position of the event matches any of the
2526 * regular expressions previously set using bte_terminal_match_add(). If a
2527 * match exists, the text string is returned and if @tag is not %NULL, the number
2528 * associated with the matched regular expression will be stored in @tag.
2529 *
2530 * If more than one regular expression has been set with
2531 * bte_terminal_match_add(), then expressions are checked in the order in
2532 * which they were added.
2533 *
2534 * Returns: (transfer full) (nullable): a newly allocated string which matches one of the previously
2535 * set regular expressions, or %NULL if there is no match
2536 */
2537char *
2538bte_terminal_match_check_event(BteTerminal *terminal,
2539 CdkEvent *event,
2540 int *tag) noexcept
2541try
2542{
2543 g_return_val_if_fail(BTE_IS_TERMINAL(terminal), FALSE)do { if ((__builtin_expect (__extension__ ({ int _g_boolean_var_
; if ((((__extension__ ({ GTypeInstance *__inst = (GTypeInstance
*) ((terminal)); GType __t = ((bte_terminal_get_type())); gboolean
__r; if (!__inst) __r = (0); else if (__inst->g_class &&
__inst->g_class->g_type == __t) __r = (!(0)); else __r
= g_type_check_instance_is_a (__inst, __t); __r; }))))) _g_boolean_var_
= 1; else _g_boolean_var_ = 0; _g_boolean_var_; }), 1))) { }
else { g_return_if_fail_warning ("BTE", ((const char*) (__PRETTY_FUNCTION__
)), "BTE_IS_TERMINAL(terminal)"); return ((0)); } } while (0)
;
2544 return WIDGET(terminal)(get_widget(terminal))->regex_match_check(event, tag);
2545}
2546catch (...)
2547{
2548 bte::log_exception();
2549 return nullptr;
2550}
2551
2552/**
2553 * bte_terminal_hyperlink_check_event:
2554 * @terminal: a #BteTerminal
2555 * @event: a #CdkEvent
2556 *
2557 * Returns a nonempty string: the target of the explicit hyperlink (printed using the OSC 8
2558 * escape sequence) at the position of the event, or %NULL.
2559 *
2560 * Proper use of the escape sequence should result in URI-encoded URIs with a proper scheme
2561 * like "http://", "https://", "file://", "mailto:" etc. This is, however, not enforced by BTE.
2562 * The caller must tolerate the returned string potentially not being a valid URI.
2563 *
2564 * Returns: (transfer full) (nullable): a newly allocated string containing the target of the hyperlink,
2565 * or %NULL
2566 *
2567 * Since: 0.50
2568 */
2569char *
2570bte_terminal_hyperlink_check_event(BteTerminal *terminal,
2571 CdkEvent *event) noexcept
2572try
2573{
2574 g_return_val_if_fail(BTE_IS_TERMINAL(terminal), nullptr)do { if ((__builtin_expect (__extension__ ({ int _g_boolean_var_
; if ((((__extension__ ({ GTypeInstance *__inst = (GTypeInstance
*) ((terminal)); GType __t = ((bte_terminal_get_type())); gboolean
__r; if (!__inst) __r = (0); else if (__inst->g_class &&
__inst->g_class->g_type == __t) __r = (!(0)); else __r
= g_type_check_instance_is_a (__inst, __t); __r; }))))) _g_boolean_var_
= 1; else _g_boolean_var_ = 0; _g_boolean_var_; }), 1))) { }
else { g_return_if_fail_warning ("BTE", ((const char*) (__PRETTY_FUNCTION__
)), "BTE_IS_TERMINAL(terminal)"); return (nullptr); } } while
(0)
;
2575 return WIDGET(terminal)(get_widget(terminal))->hyperlink_check(event);
2576}
2577catch (...)
2578{
2579 bte::log_exception();
2580 return nullptr;
2581}
2582
2583/**
2584 * bte_terminal_event_check_regex_array: (rename-to bte_terminal_event_check_regex_simple)
2585 * @terminal: a #BteTerminal
2586 * @event: a #CdkEvent
2587 * @regexes: (array length=n_regexes): an array of #BteRegex
2588 * @n_regexes: number of items in @regexes
2589 * @match_flags: PCRE2 match flags, or 0
2590 * @n_matches: (out) (optional): number of items in @matches, which is always equal to @n_regexes
2591 *
2592 * Like bte_terminal_event_check_regex_simple(), but returns an array of strings,
2593 * containing the matching text (or %NULL if no match) corresponding to each of the
2594 * regexes in @regexes.
2595 *
2596 * You must free each string and the array; but note that this is *not* a %NULL-terminated
2597 * string array, and so you must *not* use g_strfreev() on it.
2598 *
2599 * Returns: (nullable) (transfer full) (array length=n_matches): a newly allocated array of strings,
2600 * or %NULL if none of the regexes matched
2601 *
2602 * Since: 0.62
2603 */
2604char**
2605bte_terminal_event_check_regex_array(BteTerminal *terminal,
2606 CdkEvent *event,
2607 BteRegex **regexes,
2608 gsize n_regexes,
2609 guint32 match_flags,
2610 gsize *n_matches) noexcept
2611try
2612{
2613 if (n_matches)
2614 *n_matches = n_regexes;
2615
2616 if (n_regexes == 0)
2617 return nullptr;
2618
2619 auto matches = bte::glib::take_free_ptr(g_new0(char*, n_regexes)(char* *) (__extension__ ({ gsize __n = (gsize) (n_regexes); gsize
__s = sizeof (char*); gpointer __p; if (__s == 1) __p = g_malloc0
(__n); else if (__builtin_constant_p (__n) && (__s ==
0 || __n <= (9223372036854775807L *2UL+1UL) / __s)) __p =
g_malloc0 (__n * __s); else __p = g_malloc0_n (__n, __s); __p
; }))
);
2620 if (!bte_terminal_event_check_regex_simple(terminal,
2621 event,
2622 regexes,
2623 n_regexes,
2624 match_flags,
2625 matches.get()))
2626 return nullptr;
2627
2628 return matches.release();
2629}
2630catch (...)
2631{
2632 bte::log_exception();
2633 return nullptr;
2634}
2635
2636/**
2637 * bte_terminal_event_check_regex_simple: (skip)
2638 * @terminal: a #BteTerminal
2639 * @event: a #CdkEvent
2640 * @regexes: (array length=n_regexes): an array of #BteRegex
2641 * @n_regexes: number of items in @regexes
2642 * @match_flags: PCRE2 match flags, or 0
2643 * @matches: (out caller-allocates) (array length=n_regexes) (transfer full): a location to store the matches
2644 *
2645 * Checks each regex in @regexes if the text in and around the position of
2646 * the event matches the regular expressions. If a match exists, the matched
2647 * text is stored in @matches at the position of the regex in @regexes; otherwise
2648 * %NULL is stored there. Each non-%NULL element of @matches should be freed with
2649 * g_free().
2650 *
2651 * Note that the regexes in @regexes should have been created using the %PCRE2_MULTILINE flag.
2652 *
2653 * Returns: %TRUE iff any of the regexes produced a match
2654 *
2655 * Since: 0.46
2656 */
2657gboolean
2658bte_terminal_event_check_regex_simple(BteTerminal *terminal,
2659 CdkEvent *event,
2660 BteRegex **regexes,
2661 gsize n_regexes,
2662 guint32 match_flags,
2663 char **matches) noexcept
2664try
2665{
2666 g_return_val_if_fail(BTE_IS_TERMINAL(terminal), FALSE)do { if ((__builtin_expect (__extension__ ({ int _g_boolean_var_
; if ((((__extension__ ({ GTypeInstance *__inst = (GTypeInstance
*) ((terminal)); GType __t = ((bte_terminal_get_type())); gboolean
__r; if (!__inst) __r = (0); else if (__inst->g_class &&
__inst->g_class->g_type == __t) __r = (!(0)); else __r
= g_type_check_instance_is_a (__inst, __t); __r; }))))) _g_boolean_var_
= 1; else _g_boolean_var_ = 0; _g_boolean_var_; }), 1))) { }
else { g_return_if_fail_warning ("BTE", ((const char*) (__PRETTY_FUNCTION__
)), "BTE_IS_TERMINAL(terminal)"); return ((0)); } } while (0)
;
2667 g_return_val_if_fail(event != NULL, FALSE)do { if ((__builtin_expect (__extension__ ({ int _g_boolean_var_
; if (event != __null) _g_boolean_var_ = 1; else _g_boolean_var_
= 0; _g_boolean_var_; }), 1))) { } else { g_return_if_fail_warning
("BTE", ((const char*) (__PRETTY_FUNCTION__)), "event != NULL"
); return ((0)); } } while (0)
;
2668 g_return_val_if_fail(regexes != NULL || n_regexes == 0, FALSE)do { if ((__builtin_expect (__extension__ ({ int _g_boolean_var_
; if (regexes != __null || n_regexes == 0) _g_boolean_var_ = 1
; else _g_boolean_var_ = 0; _g_boolean_var_; }), 1))) { } else
{ g_return_if_fail_warning ("BTE", ((const char*) (__PRETTY_FUNCTION__
)), "regexes != NULL || n_regexes == 0"); return ((0)); } } while
(0)
;
2669 for (gsize i = 0; i < n_regexes; i++) {
2670 g_return_val_if_fail(_bte_regex_has_purpose(regexes[i], bte::base::Regex::Purpose::eMatch), -1)do { if ((__builtin_expect (__extension__ ({ int _g_boolean_var_
; if (_bte_regex_has_purpose(regexes[i], bte::base::Regex::Purpose
::eMatch)) _g_boolean_var_ = 1; else _g_boolean_var_ = 0; _g_boolean_var_
; }), 1))) { } else { g_return_if_fail_warning ("BTE", ((const
char*) (__PRETTY_FUNCTION__)), "_bte_regex_has_purpose(regexes[i], bte::base::Regex::Purpose::eMatch)"
); return (-1); } } while (0)
;
2671 g_warn_if_fail(_bte_regex_has_multiline_compile_flag(regexes[i]))do { if (__builtin_expect (__extension__ ({ int _g_boolean_var_
; if (_bte_regex_has_multiline_compile_flag(regexes[i])) _g_boolean_var_
= 1; else _g_boolean_var_ = 0; _g_boolean_var_; }), 1)) ; else
g_warn_message ("BTE", "../src/btectk.cc", 2671, ((const char
*) (__PRETTY_FUNCTION__)), "_bte_regex_has_multiline_compile_flag(regexes[i])"
); } while (0)
;
2672 }
2673 g_return_val_if_fail(matches != NULL, FALSE)do { if ((__builtin_expect (__extension__ ({ int _g_boolean_var_
; if (matches != __null) _g_boolean_var_ = 1; else _g_boolean_var_
= 0; _g_boolean_var_; }), 1))) { } else { g_return_if_fail_warning
("BTE", ((const char*) (__PRETTY_FUNCTION__)), "matches != NULL"
); return ((0)); } } while (0)
;
2674
2675 return WIDGET(terminal)(get_widget(terminal))->regex_match_check_extra(event,
2676 regex_array_from_wrappers(regexes),
2677 n_regexes,
2678 match_flags,
2679 matches);
2680}
2681catch (...)
2682{
2683 bte::log_exception();
2684 return false;
2685}
2686
2687/**
2688 * bte_terminal_event_check_gregex_simple:
2689 * @terminal: a #BteTerminal
2690 * @event: a #CdkEvent
2691 * @regexes: (array length=n_regexes): an array of #GRegex
2692 * @n_regexes: number of items in @regexes
2693 * @match_flags: the #GRegexMatchFlags to use when matching the regexes
2694 * @matches: (out caller-allocates) (array length=n_regexes): a location to store the matches
2695 *
2696 * This function does nothing.
2697 *
2698 * Returns: %FALSE
2699 *
2700 * Since: 0.44
2701 * Deprecated: 0.46: Use bte_terminal_event_check_regex_simple() instead.
2702 */
2703gboolean
2704bte_terminal_event_check_gregex_simple(BteTerminal *terminal,
2705 CdkEvent *event,
2706 GRegex **regexes,
2707 gsize n_regexes,
2708 GRegexMatchFlags match_flags,
2709 char **matches) noexcept
2710{
2711 return FALSE(0);
2712}
2713
2714/**
2715 * bte_terminal_match_set_cursor:
2716 * @terminal: a #BteTerminal
2717 * @tag: the tag of the regex which should use the specified cursor
2718 * @cursor: (allow-none): the #CdkCursor which the terminal should use when the pattern is
2719 * highlighted, or %NULL to use the standard cursor
2720 *
2721 * Sets which cursor the terminal will use if the pointer is over the pattern
2722 * specified by @tag. The terminal keeps a reference to @cursor.
2723 *
2724 * Deprecated: 0.40: Use bte_terminal_match_set_cursor_name() instead.
2725 */
2726void
2727bte_terminal_match_set_cursor(BteTerminal *terminal,
2728 int tag,
2729 CdkCursor *cursor) noexcept
2730try
2731{
2732 g_return_if_fail(BTE_IS_TERMINAL(terminal))do { if ((__builtin_expect (__extension__ ({ int _g_boolean_var_
; if ((((__extension__ ({ GTypeInstance *__inst = (GTypeInstance
*) ((terminal)); GType __t = ((bte_terminal_get_type())); gboolean
__r; if (!__inst) __r = (0); else if (__inst->g_class &&
__inst->g_class->g_type == __t) __r = (!(0)); else __r
= g_type_check_instance_is_a (__inst, __t); __r; }))))) _g_boolean_var_
= 1; else _g_boolean_var_ = 0; _g_boolean_var_; }), 1))) { }
else { g_return_if_fail_warning ("BTE", ((const char*) (__PRETTY_FUNCTION__
)), "BTE_IS_TERMINAL(terminal)"); return; } } while (0)
;
2733 g_return_if_fail(tag >= 0)do { if ((__builtin_expect (__extension__ ({ int _g_boolean_var_
; if (tag >= 0) _g_boolean_var_ = 1; else _g_boolean_var_ =
0; _g_boolean_var_; }), 1))) { } else { g_return_if_fail_warning
("BTE", ((const char*) (__PRETTY_FUNCTION__)), "tag >= 0"
); return; } } while (0)
;
2734 if (auto rem = IMPL(terminal)(_bte_terminal_get_impl(terminal))->regex_match_get(tag))
2735 rem->set_cursor(bte::glib::make_ref<CdkCursor>(cursor));
2736}
2737catch (...)
2738{
2739 bte::log_exception();
2740}
2741
2742/**
2743 * bte_terminal_match_set_cursor_type:
2744 * @terminal: a #BteTerminal
2745 * @tag: the tag of the regex which should use the specified cursor
2746 * @cursor_type: a #CdkCursorType
2747 *
2748 * Sets which cursor the terminal will use if the pointer is over the pattern
2749 * specified by @tag.
2750 *
2751 * Deprecated: 0.54: Use bte_terminal_match_set_cursor_name() instead.
2752 */
2753void
2754bte_terminal_match_set_cursor_type(BteTerminal *terminal,
2755 int tag,
2756 CdkCursorType cursor_type) noexcept
2757try
2758{
2759 g_return_if_fail(BTE_IS_TERMINAL(terminal))do { if ((__builtin_expect (__extension__ ({ int _g_boolean_var_
; if ((((__extension__ ({ GTypeInstance *__inst = (GTypeInstance
*) ((terminal)); GType __t = ((bte_terminal_get_type())); gboolean
__r; if (!__inst) __r = (0); else if (__inst->g_class &&
__inst->g_class->g_type == __t) __r = (!(0)); else __r
= g_type_check_instance_is_a (__inst, __t); __r; }))))) _g_boolean_var_
= 1; else _g_boolean_var_ = 0; _g_boolean_var_; }), 1))) { }
else { g_return_if_fail_warning ("BTE", ((const char*) (__PRETTY_FUNCTION__
)), "BTE_IS_TERMINAL(terminal)"); return; } } while (0)
;
2760 g_return_if_fail(tag >= 0)do { if ((__builtin_expect (__extension__ ({ int _g_boolean_var_
; if (tag >= 0) _g_boolean_var_ = 1; else _g_boolean_var_ =
0; _g_boolean_var_; }), 1))) { } else { g_return_if_fail_warning
("BTE", ((const char*) (__PRETTY_FUNCTION__)), "tag >= 0"
); return; } } while (0)
;
2761 if (auto rem = IMPL(terminal)(_bte_terminal_get_impl(terminal))->regex_match_get(tag))
2762 rem->set_cursor(cursor_type);
2763}
2764catch (...)
2765{
2766 bte::log_exception();
2767}
2768
2769/**
2770 * bte_terminal_match_set_cursor_name:
2771 * @terminal: a #BteTerminal
2772 * @tag: the tag of the regex which should use the specified cursor
2773 * @cursor_name: the name of the cursor
2774 *
2775 * Sets which cursor the terminal will use if the pointer is over the pattern
2776 * specified by @tag.
2777 */
2778void
2779bte_terminal_match_set_cursor_name(BteTerminal *terminal,
2780 int tag,
2781 const char *cursor_name) noexcept
2782try
2783{
2784 g_return_if_fail(BTE_IS_TERMINAL(terminal))do { if ((__builtin_expect (__extension__ ({ int _g_boolean_var_
; if ((((__extension__ ({ GTypeInstance *__inst = (GTypeInstance
*) ((terminal)); GType __t = ((bte_terminal_get_type())); gboolean
__r; if (!__inst) __r = (0); else if (__inst->g_class &&
__inst->g_class->g_type == __t) __r = (!(0)); else __r
= g_type_check_instance_is_a (__inst, __t); __r; }))))) _g_boolean_var_
= 1; else _g_boolean_var_ = 0; _g_boolean_var_; }), 1))) { }
else { g_return_if_fail_warning ("BTE", ((const char*) (__PRETTY_FUNCTION__
)), "BTE_IS_TERMINAL(terminal)"); return; } } while (0)
;
2785 g_return_if_fail(tag >= 0)do { if ((__builtin_expect (__extension__ ({ int _g_boolean_var_
; if (tag >= 0) _g_boolean_var_ = 1; else _g_boolean_var_ =
0; _g_boolean_var_; }), 1))) { } else { g_return_if_fail_warning
("BTE", ((const char*) (__PRETTY_FUNCTION__)), "tag >= 0"
); return; } } while (0)
;
2786 if (auto rem = IMPL(terminal)(_bte_terminal_get_impl(terminal))->regex_match_get(tag))
2787 rem->set_cursor(cursor_name);
2788}
2789catch (...)
2790{
2791 bte::log_exception();
2792}
2793
2794/**
2795 * bte_terminal_match_remove:
2796 * @terminal: a #BteTerminal
2797 * @tag: the tag of the regex to remove
2798 *
2799 * Removes the regular expression which is associated with the given @tag from
2800 * the list of expressions which the terminal will highlight when the user
2801 * moves the mouse cursor over matching text.
2802 */
2803void
2804bte_terminal_match_remove(BteTerminal *terminal,
2805 int tag) noexcept
2806try
2807{
2808 g_return_if_fail(BTE_IS_TERMINAL(terminal))do { if ((__builtin_expect (__extension__ ({ int _g_boolean_var_
; if ((((__extension__ ({ GTypeInstance *__inst = (GTypeInstance
*) ((terminal)); GType __t = ((bte_terminal_get_type())); gboolean
__r; if (!__inst) __r = (0); else if (__inst->g_class &&
__inst->g_class->g_type == __t) __r = (!(0)); else __r
= g_type_check_instance_is_a (__inst, __t); __r; }))))) _g_boolean_var_
= 1; else _g_boolean_var_ = 0; _g_boolean_var_; }), 1))) { }
else { g_return_if_fail_warning ("BTE", ((const char*) (__PRETTY_FUNCTION__
)), "BTE_IS_TERMINAL(terminal)"); return; } } while (0)
;
2809 IMPL(terminal)(_bte_terminal_get_impl(terminal))->regex_match_remove(tag);
2810}
2811catch (...)
2812{
2813 bte::log_exception();
2814}
2815
2816/**
2817 * bte_terminal_match_remove_all:
2818 * @terminal: a #BteTerminal
2819 *
2820 * Clears the list of regular expressions the terminal uses to highlight text
2821 * when the user moves the mouse cursor.
2822 */
2823void
2824bte_terminal_match_remove_all(BteTerminal *terminal) noexcept
2825try
2826{
2827 g_return_if_fail(BTE_IS_TERMINAL(terminal))do { if ((__builtin_expect (__extension__ ({ int _g_boolean_var_
; if ((((__extension__ ({ GTypeInstance *__inst = (GTypeInstance
*) ((terminal)); GType __t = ((bte_terminal_get_type())); gboolean
__r; if (!__inst) __r = (0); else if (__inst->g_class &&
__inst->g_class->g_type == __t) __r = (!(0)); else __r
= g_type_check_instance_is_a (__inst, __t); __r; }))))) _g_boolean_var_
= 1; else _g_boolean_var_ = 0; _g_boolean_var_; }), 1))) { }
else { g_return_if_fail_warning ("BTE", ((const char*) (__PRETTY_FUNCTION__
)), "BTE_IS_TERMINAL(terminal)"); return; } } while (0)
;
2828 IMPL(terminal)(_bte_terminal_get_impl(terminal))->regex_match_remove_all();
2829}
2830catch (...)
2831{
2832 bte::log_exception();
2833}
2834
2835/**
2836 * bte_terminal_search_find_previous:
2837 * @terminal: a #BteTerminal
2838 *
2839 * Searches the previous string matching the search regex set with
2840 * bte_terminal_search_set_regex().
2841 *
2842 * Returns: %TRUE if a match was found
2843 */
2844gboolean
2845bte_terminal_search_find_previous (BteTerminal *terminal) noexcept
2846try
2847{
2848 g_return_val_if_fail(BTE_IS_TERMINAL(terminal), false)do { if ((__builtin_expect (__extension__ ({ int _g_boolean_var_
; if ((((__extension__ ({ GTypeInstance *__inst = (GTypeInstance
*) ((terminal)); GType __t = ((bte_terminal_get_type())); gboolean
__r; if (!__inst) __r = (0); else if (__inst->g_class &&
__inst->g_class->g_type == __t) __r = (!(0)); else __r
= g_type_check_instance_is_a (__inst, __t); __r; }))))) _g_boolean_var_
= 1; else _g_boolean_var_ = 0; _g_boolean_var_; }), 1))) { }
else { g_return_if_fail_warning ("BTE", ((const char*) (__PRETTY_FUNCTION__
)), "BTE_IS_TERMINAL(terminal)"); return (false); } } while (
0)
;
2849 return IMPL(terminal)(_bte_terminal_get_impl(terminal))->search_find(true);
2850}
2851catch (...)
2852{
2853 bte::log_exception();
2854 return false;
2855}
2856
2857/**
2858 * bte_terminal_search_find_next:
2859 * @terminal: a #BteTerminal
2860 *
2861 * Searches the next string matching the search regex set with
2862 * bte_terminal_search_set_regex().
2863 *
2864 * Returns: %TRUE if a match was found
2865 */
2866gboolean
2867bte_terminal_search_find_next (BteTerminal *terminal) noexcept
2868try
2869{
2870 g_return_val_if_fail(BTE_IS_TERMINAL(terminal), false)do { if ((__builtin_expect (__extension__ ({ int _g_boolean_var_
; if ((((__extension__ ({ GTypeInstance *__inst = (GTypeInstance
*) ((terminal)); GType __t = ((bte_terminal_get_type())); gboolean
__r; if (!__inst) __r = (0); else if (__inst->g_class &&
__inst->g_class->g_type == __t) __r = (!(0)); else __r
= g_type_check_instance_is_a (__inst, __t); __r; }))))) _g_boolean_var_
= 1; else _g_boolean_var_ = 0; _g_boolean_var_; }), 1))) { }
else { g_return_if_fail_warning ("BTE", ((const char*) (__PRETTY_FUNCTION__
)), "BTE_IS_TERMINAL(terminal)"); return (false); } } while (
0)
;
2871 return IMPL(terminal)(_bte_terminal_get_impl(terminal))->search_find(false);
2872}
2873catch (...)
2874{
2875 bte::log_exception();
2876 return false;
2877}
2878
2879/**
2880 * bte_terminal_search_set_regex:
2881 * @terminal: a #BteTerminal
2882 * @regex: (allow-none): a #BteRegex, or %NULL
2883 * @flags: PCRE2 match flags, or 0
2884 *
2885 * Sets the regex to search for. Unsets the search regex when passed %NULL.
2886 *
2887 * Note that @regex should have been created using the %PCRE2_MULTILINE flag.
2888 *
2889 * Since: 0.46
2890 */
2891void
2892bte_terminal_search_set_regex (BteTerminal *terminal,
2893 BteRegex *regex,
2894 guint32 flags) noexcept
2895try
2896{
2897 g_return_if_fail(BTE_IS_TERMINAL(terminal))do { if ((__builtin_expect (__extension__ ({ int _g_boolean_var_
; if ((((__extension__ ({ GTypeInstance *__inst = (GTypeInstance
*) ((terminal)); GType __t = ((bte_terminal_get_type())); gboolean
__r; if (!__inst) __r = (0); else if (__inst->g_class &&
__inst->g_class->g_type == __t) __r = (!(0)); else __r
= g_type_check_instance_is_a (__inst, __t); __r; }))))) _g_boolean_var_
= 1; else _g_boolean_var_ = 0; _g_boolean_var_; }), 1))) { }
else { g_return_if_fail_warning ("BTE", ((const char*) (__PRETTY_FUNCTION__
)), "BTE_IS_TERMINAL(terminal)"); return; } } while (0)
;
2898 g_return_if_fail(regex == nullptr || _bte_regex_has_purpose(regex, bte::base::Regex::Purpose::eSearch))do { if ((__builtin_expect (__extension__ ({ int _g_boolean_var_
; if (regex == nullptr || _bte_regex_has_purpose(regex, bte::
base::Regex::Purpose::eSearch)) _g_boolean_var_ = 1; else _g_boolean_var_
= 0; _g_boolean_var_; }), 1))) { } else { g_return_if_fail_warning
("BTE", ((const char*) (__PRETTY_FUNCTION__)), "regex == nullptr || _bte_regex_has_purpose(regex, bte::base::Regex::Purpose::eSearch)"
); return; } } while (0)
;
2899 g_warn_if_fail(regex == nullptr || _bte_regex_has_multiline_compile_flag(regex))do { if (__builtin_expect (__extension__ ({ int _g_boolean_var_
; if (regex == nullptr || _bte_regex_has_multiline_compile_flag
(regex)) _g_boolean_var_ = 1; else _g_boolean_var_ = 0; _g_boolean_var_
; }), 1)) ; else g_warn_message ("BTE", "../src/btectk.cc", 2899
, ((const char*) (__PRETTY_FUNCTION__)), "regex == nullptr || _bte_regex_has_multiline_compile_flag(regex)"
); } while (0)
;
2900
2901 IMPL(terminal)(_bte_terminal_get_impl(terminal))->search_set_regex(bte::base::make_ref(regex_from_wrapper(regex)), flags);
2902}
2903catch (...)
2904{
2905 bte::log_exception();
2906}
2907
2908/**
2909 * bte_terminal_search_get_regex:
2910 * @terminal: a #BteTerminal
2911 *
2912 * Returns: (transfer none): the search #BteRegex regex set in @terminal, or %NULL
2913 *
2914 * Since: 0.46
2915 */
2916BteRegex *
2917bte_terminal_search_get_regex(BteTerminal *terminal) noexcept
2918try
2919{
2920 g_return_val_if_fail(BTE_IS_TERMINAL(terminal), nullptr)do { if ((__builtin_expect (__extension__ ({ int _g_boolean_var_
; if ((((__extension__ ({ GTypeInstance *__inst = (GTypeInstance
*) ((terminal)); GType __t = ((bte_terminal_get_type())); gboolean
__r; if (!__inst) __r = (0); else if (__inst->g_class &&
__inst->g_class->g_type == __t) __r = (!(0)); else __r
= g_type_check_instance_is_a (__inst, __t); __r; }))))) _g_boolean_var_
= 1; else _g_boolean_var_ = 0; _g_boolean_var_; }), 1))) { }
else { g_return_if_fail_warning ("BTE", ((const char*) (__PRETTY_FUNCTION__
)), "BTE_IS_TERMINAL(terminal)"); return (nullptr); } } while
(0)
;
2921
2922 return wrapper_from_regex(IMPL(terminal)(_bte_terminal_get_impl(terminal))->search_regex());
2923}
2924catch (...)
2925{
2926 bte::log_exception();
2927 return nullptr;
2928}
2929
2930/**
2931 * bte_terminal_search_set_gregex:
2932 * @terminal: a #BteTerminal
2933 * @gregex: (allow-none): a #GRegex, or %NULL
2934 * @gflags: flags from #GRegexMatchFlags
2935 *
2936 * This function does nothing since version 0.60.
2937 *
2938 * Deprecated: 0.46: use bte_terminal_search_set_regex() instead.
2939 */
2940void
2941bte_terminal_search_set_gregex (BteTerminal *terminal,
2942 GRegex *gregex,
2943 GRegexMatchFlags gflags) noexcept
2944{
2945}
2946
2947/**
2948 * bte_terminal_search_get_gregex:
2949 * @terminal: a #BteTerminal
2950 *
2951 * Returns: (transfer none): %NULL
2952 *
2953 * Deprecated: 0.46: use bte_terminal_search_get_regex() instead.
2954 */
2955GRegex *
2956bte_terminal_search_get_gregex (BteTerminal *terminal) noexcept
2957{
2958 g_return_val_if_fail(BTE_IS_TERMINAL(terminal), nullptr)do { if ((__builtin_expect (__extension__ ({ int _g_boolean_var_
; if ((((__extension__ ({ GTypeInstance *__inst = (GTypeInstance
*) ((terminal)); GType __t = ((bte_terminal_get_type())); gboolean
__r; if (!__inst) __r = (0); else if (__inst->g_class &&
__inst->g_class->g_type == __t) __r = (!(0)); else __r
= g_type_check_instance_is_a (__inst, __t); __r; }))))) _g_boolean_var_
= 1; else _g_boolean_var_ = 0; _g_boolean_var_; }), 1))) { }
else { g_return_if_fail_warning ("BTE", ((const char*) (__PRETTY_FUNCTION__
)), "BTE_IS_TERMINAL(terminal)"); return (nullptr); } } while
(0)
;
2959
2960 return nullptr;
2961}
2962
2963/**
2964 * bte_terminal_search_set_wrap_around:
2965 * @terminal: a #BteTerminal
2966 * @wrap_around: whether search should wrap
2967 *
2968 * Sets whether search should wrap around to the beginning of the
2969 * terminal content when reaching its end.
2970 */
2971void
2972bte_terminal_search_set_wrap_around (BteTerminal *terminal,
2973 gboolean wrap_around) noexcept
2974try
2975{
2976 g_return_if_fail(BTE_IS_TERMINAL(terminal))do { if ((__builtin_expect (__extension__ ({ int _g_boolean_var_
; if ((((__extension__ ({ GTypeInstance *__inst = (GTypeInstance
*) ((terminal)); GType __t = ((bte_terminal_get_type())); gboolean
__r; if (!__inst) __r = (0); else if (__inst->g_class &&
__inst->g_class->g_type == __t) __r = (!(0)); else __r
= g_type_check_instance_is_a (__inst, __t); __r; }))))) _g_boolean_var_
= 1; else _g_boolean_var_ = 0; _g_boolean_var_; }), 1))) { }
else { g_return_if_fail_warning ("BTE", ((const char*) (__PRETTY_FUNCTION__
)), "BTE_IS_TERMINAL(terminal)"); return; } } while (0)
;
2977
2978 IMPL(terminal)(_bte_terminal_get_impl(terminal))->search_set_wrap_around(wrap_around != FALSE(0));
2979}
2980catch (...)
2981{
2982 bte::log_exception();
2983}
2984
2985/**
2986 * bte_terminal_search_get_wrap_around:
2987 * @terminal: a #BteTerminal
2988 *
2989 * Returns: whether searching will wrap around
2990 */
2991gboolean
2992bte_terminal_search_get_wrap_around (BteTerminal *terminal) noexcept
2993try
2994{
2995 g_return_val_if_fail(BTE_IS_TERMINAL(terminal), false)do { if ((__builtin_expect (__extension__ ({ int _g_boolean_var_
; if ((((__extension__ ({ GTypeInstance *__inst = (GTypeInstance
*) ((terminal)); GType __t = ((bte_terminal_get_type())); gboolean
__r; if (!__inst) __r = (0); else if (__inst->g_class &&
__inst->g_class->g_type == __t) __r = (!(0)); else __r
= g_type_check_instance_is_a (__inst, __t); __r; }))))) _g_boolean_var_
= 1; else _g_boolean_var_ = 0; _g_boolean_var_; }), 1))) { }
else { g_return_if_fail_warning ("BTE", ((const char*) (__PRETTY_FUNCTION__
)), "BTE_IS_TERMINAL(terminal)"); return (false); } } while (
0)
;
2996 return IMPL(terminal)(_bte_terminal_get_impl(terminal))->m_search_wrap_around;
2997}
2998catch (...)
2999{
3000 bte::log_exception();
3001 return false;
3002}
3003
3004/**
3005 * bte_terminal_select_all:
3006 * @terminal: a #BteTerminal
3007 *
3008 * Selects all text within the terminal (including the scrollback buffer).
3009 */
3010void
3011bte_terminal_select_all (BteTerminal *terminal) noexcept
3012try
3013{
3014 g_return_if_fail (BTE_IS_TERMINAL (terminal))do { if ((__builtin_expect (__extension__ ({ int _g_boolean_var_
; if ((((__extension__ ({ GTypeInstance *__inst = (GTypeInstance
*) ((terminal)); GType __t = ((bte_terminal_get_type())); gboolean
__r; if (!__inst) __r = (0); else if (__inst->g_class &&
__inst->g_class->g_type == __t) __r = (!(0)); else __r
= g_type_check_instance_is_a (__inst, __t); __r; }))))) _g_boolean_var_
= 1; else _g_boolean_var_ = 0; _g_boolean_var_; }), 1))) { }
else { g_return_if_fail_warning ("BTE", ((const char*) (__PRETTY_FUNCTION__
)), "BTE_IS_TERMINAL (terminal)"); return; } } while (0)
;
3015
3016 IMPL(terminal)(_bte_terminal_get_impl(terminal))->select_all();
3017}
3018catch (...)
3019{
3020 bte::log_exception();
3021}
3022
3023/**
3024 * bte_terminal_unselect_all:
3025 * @terminal: a #BteTerminal
3026 *
3027 * Clears the current selection.
3028 */
3029void
3030bte_terminal_unselect_all(BteTerminal *terminal) noexcept
3031try
3032{
3033 g_return_if_fail (BTE_IS_TERMINAL (terminal))do { if ((__builtin_expect (__extension__ ({ int _g_boolean_var_
; if ((((__extension__ ({ GTypeInstance *__inst = (GTypeInstance
*) ((terminal)); GType __t = ((bte_terminal_get_type())); gboolean
__r; if (!__inst) __r = (0); else if (__inst->g_class &&
__inst->g_class->g_type == __t) __r = (!(0)); else __r
= g_type_check_instance_is_a (__inst, __t); __r; }))))) _g_boolean_var_
= 1; else _g_boolean_var_ = 0; _g_boolean_var_; }), 1))) { }
else { g_return_if_fail_warning ("BTE", ((const char*) (__PRETTY_FUNCTION__
)), "BTE_IS_TERMINAL (terminal)"); return; } } while (0)
;
3034
3035 IMPL(terminal)(_bte_terminal_get_impl(terminal))->deselect_all();
3036}
3037catch (...)
3038{
3039 bte::log_exception();
3040}
3041
3042/**
3043 * bte_terminal_get_cursor_position:
3044 * @terminal: a #BteTerminal
3045 * @column: (out) (allow-none): a location to store the column, or %NULL
3046 * @row: (out) (allow-none): a location to store the row, or %NULL
3047 *
3048 * Reads the location of the insertion cursor and returns it. The row
3049 * coordinate is absolute.
3050 *
3051 * This method is unaware of BiDi. The returned column is logical column.
3052 */
3053void
3054bte_terminal_get_cursor_position(BteTerminal *terminal,
3055 long *column,
3056 long *row) noexcept
3057try
3058{
3059 g_return_if_fail(BTE_IS_TERMINAL(terminal))do { if ((__builtin_expect (__extension__ ({ int _g_boolean_var_
; if ((((__extension__ ({ GTypeInstance *__inst = (GTypeInstance
*) ((terminal)); GType __t = ((bte_terminal_get_type())); gboolean
__r; if (!__inst) __r = (0); else if (__inst->g_class &&
__inst->g_class->g_type == __t) __r = (!(0)); else __r
= g_type_check_instance_is_a (__inst, __t); __r; }))))) _g_boolean_var_
= 1; else _g_boolean_var_ = 0; _g_boolean_var_; }), 1))) { }
else { g_return_if_fail_warning ("BTE", ((const char*) (__PRETTY_FUNCTION__
)), "BTE_IS_TERMINAL(terminal)"); return; } } while (0)
;
3060
3061 auto impl = IMPL(terminal)(_bte_terminal_get_impl(terminal));
3062 if (column) {
3063 *column = impl->m_screen->cursor.col;
3064 }
3065 if (row) {
3066 *row = impl->m_screen->cursor.row;
3067 }
3068}
3069catch (...)
3070{
3071 bte::log_exception();
3072}
3073
3074/**
3075 * bte_terminal_pty_new_sync:
3076 * @terminal: a #BteTerminal
3077 * @flags: flags from #BtePtyFlags
3078 * @cancellable: (allow-none): a #GCancellable, or %NULL
3079 * @error: (allow-none): return location for a #GError, or %NULL
3080 *
3081 * Creates a new #BtePty, sets the emulation property
3082 * from #BteTerminal:emulation, and sets the size using
3083 * @terminal's size.
3084 *
3085 * See bte_pty_new() for more information.
3086 *
3087 * Returns: (transfer full): a new #BtePty
3088 */
3089BtePty *
3090bte_terminal_pty_new_sync(BteTerminal *terminal,
3091 BtePtyFlags flags,
3092 GCancellable *cancellable,
3093 GError **error) noexcept
3094try
3095{
3096 g_return_val_if_fail(BTE_IS_TERMINAL(terminal), NULL)do { if ((__builtin_expect (__extension__ ({ int _g_boolean_var_
; if ((((__extension__ ({ GTypeInstance *__inst = (GTypeInstance
*) ((terminal)); GType __t = ((bte_terminal_get_type())); gboolean
__r; if (!__inst) __r = (0); else if (__inst->g_class &&
__inst->g_class->g_type == __t) __r = (!(0)); else __r
= g_type_check_instance_is_a (__inst, __t); __r; }))))) _g_boolean_var_
= 1; else _g_boolean_var_ = 0; _g_boolean_var_; }), 1))) { }
else { g_return_if_fail_warning ("BTE", ((const char*) (__PRETTY_FUNCTION__
)), "BTE_IS_TERMINAL(terminal)"); return (__null); } } while (
0)
;
3097
3098 auto pty = bte::glib::take_ref(bte_pty_new_sync(flags, cancellable, error));
3099 if (!pty)
3100 return nullptr;
3101
3102 auto impl = IMPL(terminal)(_bte_terminal_get_impl(terminal));
3103 _bte_pty_set_size(pty.get(),
3104 impl->m_row_count,
3105 impl->m_column_count,
3106 impl->m_cell_height,
3107 impl->m_cell_width,
3108 nullptr);
3109
3110 return pty.release();
3111}
3112catch (...)
3113{
3114 bte::glib::set_error_from_exception(error);
3115 return nullptr;
3116}
3117
3118/**
3119 * bte_terminal_watch_child:
3120 * @terminal: a #BteTerminal
3121 * @child_pid: a #GPid
3122 *
3123 * Watches @child_pid. When the process exists, the #BteTerminal::child-exited
3124 * signal will be called with the child's exit status.
3125 *
3126 * Prior to calling this function, a #BtePty must have been set in @terminal
3127 * using bte_terminal_set_pty().
3128 * When the child exits, the terminal's #BtePty will be set to %NULL.
3129 *
3130 * Note: g_child_watch_add() or g_child_watch_add_full() must not have
3131 * been called for @child_pid, nor a #GSource for it been created with
3132 * g_child_watch_source_new().
3133 *
3134 * Note: when using the g_spawn_async() family of functions,
3135 * the %G_SPAWN_DO_NOT_REAP_CHILD flag MUST have been passed.
3136 */
3137void
3138bte_terminal_watch_child (BteTerminal *terminal,
3139 GPid child_pid) noexcept
3140try
3141{
3142 g_return_if_fail(BTE_IS_TERMINAL(terminal))do { if ((__builtin_expect (__extension__ ({ int _g_boolean_var_
; if ((((__extension__ ({ GTypeInstance *__inst = (GTypeInstance
*) ((terminal)); GType __t = ((bte_terminal_get_type())); gboolean
__r; if (!__inst) __r = (0); else if (__inst->g_class &&
__inst->g_class->g_type == __t) __r = (!(0)); else __r
= g_type_check_instance_is_a (__inst, __t); __r; }))))) _g_boolean_var_
= 1; else _g_boolean_var_ = 0; _g_boolean_var_; }), 1))) { }
else { g_return_if_fail_warning ("BTE", ((const char*) (__PRETTY_FUNCTION__
)), "BTE_IS_TERMINAL(terminal)"); return; } } while (0)
;
3143 g_return_if_fail(child_pid != -1)do { if ((__builtin_expect (__extension__ ({ int _g_boolean_var_
; if (child_pid != -1) _g_boolean_var_ = 1; else _g_boolean_var_
= 0; _g_boolean_var_; }), 1))) { } else { g_return_if_fail_warning
("BTE", ((const char*) (__PRETTY_FUNCTION__)), "child_pid != -1"
); return; } } while (0)
;
3144
3145 g_return_if_fail(WIDGET(terminal)->pty() != nullptr)do { if ((__builtin_expect (__extension__ ({ int _g_boolean_var_
; if ((get_widget(terminal))->pty() != nullptr) _g_boolean_var_
= 1; else _g_boolean_var_ = 0; _g_boolean_var_; }), 1))) { }
else { g_return_if_fail_warning ("BTE", ((const char*) (__PRETTY_FUNCTION__
)), "WIDGET(terminal)->pty() != nullptr"); return; } } while
(0)
;
3146
3147 IMPL(terminal)(_bte_terminal_get_impl(terminal))->watch_child(child_pid);
3148}
3149catch (...)
3150{
3151 bte::log_exception();
3152}
3153
3154/**
3155 * bte_terminal_spawn_sync:
3156 * @terminal: a #BteTerminal
3157 * @pty_flags: flags from #BtePtyFlags
3158 * @working_directory: (allow-none): the name of a directory the command should start
3159 * in, or %NULL to use the current working directory
3160 * @argv: (array zero-terminated=1) (element-type filename): child's argument vector
3161 * @envv: (allow-none) (array zero-terminated=1) (element-type filename): a list of environment
3162 * variables to be added to the environment before starting the process, or %NULL
3163 * @spawn_flags: flags from #GSpawnFlags
3164 * @child_setup: (allow-none) (scope call): an extra child setup function to run in the child just before exec(), or %NULL
3165 * @child_setup_data: user data for @child_setup
3166 * @child_pid: (out) (allow-none) (transfer full): a location to store the child PID, or %NULL
3167 * @cancellable: (allow-none): a #GCancellable, or %NULL
3168 * @error: (allow-none): return location for a #GError, or %NULL
3169 *
3170 * Starts the specified command under a newly-allocated controlling
3171 * pseudo-terminal. The @argv and @envv lists should be %NULL-terminated.
3172 * The "TERM" environment variable is automatically set to a default value,
3173 * but can be overridden from @envv.
3174 * @pty_flags controls logging the session to the specified system log files.
3175 *
3176 * Note that %G_SPAWN_DO_NOT_REAP_CHILD will always be added to @spawn_flags.
3177 *
3178 * Note also that %G_SPAWN_STDOUT_TO_DEV_NULL, %G_SPAWN_STDERR_TO_DEV_NULL,
3179 * and %G_SPAWN_CHILD_INHERITS_STDIN are not supported in @spawn_flags, since
3180 * stdin, stdout and stderr of the child process will always be connected to
3181 * the PTY.
3182 *
3183 * Note that all open file descriptors will be closed in the child. If you want
3184 * to keep some file descriptor open for use in the child process, you need to
3185 * use a child setup function that unsets the FD_CLOEXEC flag on that file
3186 * descriptor.
3187 *
3188 * See bte_pty_new(), g_spawn_async() and bte_terminal_watch_child() for more information.
3189 *
3190 * Beginning with 0.52, sets PWD to @working_directory in order to preserve symlink components.
3191 * The caller should also make sure that symlinks were preserved while constructing the value of @working_directory,
3192 * e.g. by using bte_terminal_get_current_directory_uri(), g_get_current_dir() or get_current_dir_name().
3193 *
3194 * Returns: %TRUE on success, or %FALSE on error with @error filled in
3195 *
3196 * Deprecated: 0.48: Use bte_terminal_spawn_async() instead.
3197 */
3198gboolean
3199bte_terminal_spawn_sync(BteTerminal *terminal,
3200 BtePtyFlags pty_flags,
3201 const char *working_directory,
3202 char **argv,
3203 char **envv,
3204 GSpawnFlags spawn_flags,
3205 GSpawnChildSetupFunc child_setup,
3206 gpointer child_setup_data,
3207 GPid *child_pid /* out */,
3208 GCancellable *cancellable,
3209 GError **error) noexcept
3210try
3211{
3212 g_return_val_if_fail(BTE_IS_TERMINAL(terminal), FALSE)do { if ((__builtin_expect (__extension__ ({ int _g_boolean_var_
; if ((((__extension__ ({ GTypeInstance *__inst = (GTypeInstance
*) ((terminal)); GType __t = ((bte_terminal_get_type())); gboolean
__r; if (!__inst) __r = (0); else if (__inst->g_class &&
__inst->g_class->g_type == __t) __r = (!(0)); else __r
= g_type_check_instance_is_a (__inst, __t); __r; }))))) _g_boolean_var_
= 1; else _g_boolean_var_ = 0; _g_boolean_var_; }), 1))) { }
else { g_return_if_fail_warning ("BTE", ((const char*) (__PRETTY_FUNCTION__
)), "BTE_IS_TERMINAL(terminal)"); return ((0)); } } while (0)
;
3213 g_return_val_if_fail(argv != NULL, FALSE)do { if ((__builtin_expect (__extension__ ({ int _g_boolean_var_
; if (argv != __null) _g_boolean_var_ = 1; else _g_boolean_var_
= 0; _g_boolean_var_; }), 1))) { } else { g_return_if_fail_warning
("BTE", ((const char*) (__PRETTY_FUNCTION__)), "argv != NULL"
); return ((0)); } } while (0)
;
3214 g_return_val_if_fail(argv[0] != nullptr, FALSE)do { if ((__builtin_expect (__extension__ ({ int _g_boolean_var_
; if (argv[0] != nullptr) _g_boolean_var_ = 1; else _g_boolean_var_
= 0; _g_boolean_var_; }), 1))) { } else { g_return_if_fail_warning
("BTE", ((const char*) (__PRETTY_FUNCTION__)), "argv[0] != nullptr"
); return ((0)); } } while (0)
;
3215 g_return_val_if_fail(envv == nullptr ||_bte_pty_check_envv(envv), false)do { if ((__builtin_expect (__extension__ ({ int _g_boolean_var_
; if (envv == nullptr ||_bte_pty_check_envv(envv)) _g_boolean_var_
= 1; else _g_boolean_var_ = 0; _g_boolean_var_; }), 1))) { }
else { g_return_if_fail_warning ("BTE", ((const char*) (__PRETTY_FUNCTION__
)), "envv == nullptr ||_bte_pty_check_envv(envv)"); return (false
); } } while (0)
;
3216 g_return_val_if_fail((spawn_flags & (BTE_SPAWN_NO_SYSTEMD_SCOPE | BTE_SPAWN_REQUIRE_SYSTEMD_SCOPE)) == 0, FALSE)do { if ((__builtin_expect (__extension__ ({ int _g_boolean_var_
; if ((spawn_flags & ((1 << 26) | (1 << 27)))
== 0) _g_boolean_var_ = 1; else _g_boolean_var_ = 0; _g_boolean_var_
; }), 1))) { } else { g_return_if_fail_warning ("BTE", ((const
char*) (__PRETTY_FUNCTION__)), "(spawn_flags & (BTE_SPAWN_NO_SYSTEMD_SCOPE | BTE_SPAWN_REQUIRE_SYSTEMD_SCOPE)) == 0"
); return ((0)); } } while (0)
;
3217 g_return_val_if_fail(child_setup_data == NULL || child_setup, FALSE)do { if ((__builtin_expect (__extension__ ({ int _g_boolean_var_
; if (child_setup_data == __null || child_setup) _g_boolean_var_
= 1; else _g_boolean_var_ = 0; _g_boolean_var_; }), 1))) { }
else { g_return_if_fail_warning ("BTE", ((const char*) (__PRETTY_FUNCTION__
)), "child_setup_data == NULL || child_setup"); return ((0));
} } while (0)
;
3218 g_return_val_if_fail(error == NULL || *error == NULL, FALSE)do { if ((__builtin_expect (__extension__ ({ int _g_boolean_var_
; if (error == __null || *error == __null) _g_boolean_var_ = 1
; else _g_boolean_var_ = 0; _g_boolean_var_; }), 1))) { } else
{ g_return_if_fail_warning ("BTE", ((const char*) (__PRETTY_FUNCTION__
)), "error == NULL || *error == NULL"); return ((0)); } } while
(0)
;
3219
3220 auto new_pty = bte::glib::take_ref(bte_terminal_pty_new_sync(terminal, pty_flags, cancellable, error));
3221 if (!new_pty)
3222 return false;
3223
3224 GPid pid;
3225 if (!_bte_pty_spawn_sync(new_pty.get(),
3226 working_directory,
3227 argv,
3228 envv,
3229 spawn_flags,
3230 child_setup, child_setup_data, nullptr,
3231 &pid,
3232 -1 /* default timeout */,
3233 cancellable,
3234 error))
3235 return false;
3236
3237 bte_terminal_set_pty(terminal, new_pty.get());
3238 bte_terminal_watch_child(terminal, pid);
3239
3240 if (child_pid)
3241 *child_pid = pid;
3242
3243 return true;
3244}
3245catch (...)
3246{
3247 return bte::glib::set_error_from_exception(error);
3248}
3249
3250typedef struct {
3251 GWeakRef wref;
3252 BteTerminalSpawnAsyncCallback callback;
3253 gpointer user_data;
3254} SpawnAsyncCallbackData;
3255
3256static gpointer
3257spawn_async_callback_data_new(BteTerminal *terminal,
3258 BteTerminalSpawnAsyncCallback callback,
3259 gpointer user_data) noexcept
3260{
3261 SpawnAsyncCallbackData *data = g_new0 (SpawnAsyncCallbackData, 1)(SpawnAsyncCallbackData *) (__extension__ ({ gsize __n = (gsize
) (1); gsize __s = sizeof (SpawnAsyncCallbackData); gpointer __p
; if (__s == 1) __p = g_malloc0 (__n); else if (__builtin_constant_p
(__n) && (__s == 0 || __n <= (9223372036854775807L
*2UL+1UL) / __s)) __p = g_malloc0 (__n * __s); else __p = g_malloc0_n
(__n, __s); __p; }))
;
3262
3263 g_weak_ref_init(&data->wref, terminal);
3264 data->callback = callback;
3265 data->user_data = user_data;
3266
3267 return data;
3268}
3269
3270static void
3271spawn_async_callback_data_free(SpawnAsyncCallbackData* data) noexcept
3272{
3273 g_weak_ref_clear(&data->wref);
3274 g_free(data);
3275}
3276
3277static void
3278spawn_async_cb(GObject *source,
3279 GAsyncResult *result,
3280 gpointer user_data) noexcept
3281{
3282 SpawnAsyncCallbackData *data = reinterpret_cast<SpawnAsyncCallbackData*>(user_data);
3283 BtePty *pty = BTE_PTY(source)((((BtePty*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((source)), ((bte_pty_get_type()))))))
;
3284
3285 auto pid = pid_t{-1};
3286 auto error = bte::glib::Error{};
3287 if (source) {
3288 bte_pty_spawn_finish(pty, result, &pid, error);
3289 } else {
3290 (void)g_task_propagate_int(G_TASK(result)((((GTask*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((result)), ((g_task_get_type ()))))))
, error);
3291 assert(error.error())(static_cast <bool> (error.error()) ? void (0) : __assert_fail
("error.error()", "../src/btectk.cc", 3291, __extension__ __PRETTY_FUNCTION__
))
;
3292 }
3293
3294 /* Now get a ref to the terminal */
3295 auto terminal = bte::glib::acquire_ref<BteTerminal>(&data->wref);
3296
3297 if (terminal) {
3298 if (pid != -1) {
3299 bte_terminal_set_pty(terminal.get(), pty);
3300 bte_terminal_watch_child(terminal.get(), pid);
3301 } else {
3302 bte_terminal_set_pty(terminal.get(), nullptr);
3303 }
3304 }
3305
3306 if (data->callback) {
3307 try {
3308 data->callback(terminal.get(), pid, error, data->user_data);
3309 } catch (...) {
3310 bte::log_exception();
3311 }
3312 }
3313
3314 if (!terminal) {
3315 /* If the terminal was destroyed, we need to abort the child process, if any */
3316 if (pid != -1) {
3317 pid_t pgrp;
3318 pgrp = getpgid(pid);
3319 if (pgrp != -1 && pgrp != getpgid(getpid())) {
3320 kill(-pgrp, SIGHUP1);
3321 }
3322
3323 kill(pid, SIGHUP1);
3324 }
3325 }
3326
3327 spawn_async_callback_data_free(data);
3328}
3329
3330/**
3331 * BteTerminalSpawnAsyncCallback:
3332 * @terminal: the #BteTerminal
3333 * @pid: a #GPid
3334 * @error: a #GError, or %NULL
3335 * @user_data: user data that was passed to bte_terminal_spawn_async
3336 *
3337 * Callback for bte_terminal_spawn_async().
3338 *
3339 * On success, @pid contains the PID of the spawned process, and @error
3340 * is %NULL.
3341 * On failure, @pid is -1 and @error contains the error information.
3342 *
3343 * Since: 0.48
3344 */
3345
3346/**
3347 * bte_terminal_spawn_with_fds_async:
3348 * @terminal: a #BteTerminal
3349 * @pty_flags: flags from #BtePtyFlags
3350 * @working_directory: (allow-none): the name of a directory the command should start
3351 * in, or %NULL to use the current working directory
3352 * @argv: (array zero-terminated=1) (element-type filename): child's argument vector
3353 * @envv: (allow-none) (array zero-terminated=1) (element-type filename): a list of environment
3354 * variables to be added to the environment before starting the process, or %NULL
3355 * @fds: (nullable) (array length=n_fds) (transfer none) (scope call): an array of file descriptors, or %NULL
3356 * @n_fds: the number of file descriptors in @fds, or 0 if @fds is %NULL
3357 * @map_fds: (nullable) (array length=n_map_fds) (transfer none) (scope call): an array of integers, or %NULL
3358 * @n_map_fds: the number of elements in @map_fds, or 0 if @map_fds is %NULL
3359 * @spawn_flags: flags from #GSpawnFlags
3360 * @child_setup: (allow-none) (scope async): an extra child setup function to run in the child just before exec(), or %NULL
3361 * @child_setup_data: (nullable) (closure child_setup): user data for @child_setup, or %NULL
3362 * @child_setup_data_destroy: (nullable) (destroy child_setup_data): a #GDestroyNotify for @child_setup_data, or %NULL
3363 * @timeout: a timeout value in ms, -1 for the default timeout, or G_MAXINT to wait indefinitely
3364 * @cancellable: (allow-none): a #GCancellable, or %NULL
3365 * @callback: (nullable) (scope async): a #BteTerminalSpawnAsyncCallback, or %NULL
3366 * @user_data: (closure callback): user data for @callback, or %NULL
3367 *
3368 * A convenience function that wraps creating the #BtePty and spawning
3369 * the child process on it. See bte_pty_new_sync(), bte_pty_spawn_with_fds_async(),
3370 * and bte_pty_spawn_finish() for more information.
3371 *
3372 * When the operation is finished successfully, @callback will be called
3373 * with the child #GPid, and a %NULL #GError. The child PID will already be
3374 * watched via bte_terminal_watch_child().
3375 *
3376 * When the operation fails, @callback will be called with a -1 #GPid,
3377 * and a non-%NULL #GError containing the error information.
3378 *
3379 * Note that %G_SPAWN_STDOUT_TO_DEV_NULL, %G_SPAWN_STDERR_TO_DEV_NULL,
3380 * and %G_SPAWN_CHILD_INHERITS_STDIN are not supported in @spawn_flags, since
3381 * stdin, stdout and stderr of the child process will always be connected to
3382 * the PTY.
3383 *
3384 * If @fds is not %NULL, the child process will map the file descriptors from
3385 * @fds according to @map_fds; @n_map_fds must be less or equal to @n_fds.
3386 * This function will take ownership of the file descriptors in @fds;
3387 * you must not use or close them after this call.
3388 *
3389 * Note that all open file descriptors apart from those mapped as above
3390 * will be closed in the child. (If you want to keep some other file descriptor
3391 * open for use in the child process, you need to use a child setup function
3392 * that unsets the FD_CLOEXEC flag on that file descriptor manually.)
3393 *
3394 * Beginning with 0.60, and on linux only, and unless %BTE_SPAWN_NO_SYSTEMD_SCOPE is
3395 * passed in @spawn_flags, the newly created child process will be moved to its own
3396 * systemd user scope; and if %BTE_SPAWN_REQUIRE_SYSTEMD_SCOPE is passed, and creation
3397 * of the systemd user scope fails, the whole spawn will fail.
3398 * You can override the options used for the systemd user scope by
3399 * providing a systemd override file for 'bte-spawn-.scope' unit. See man:systemd.unit(5)
3400 * for further information.
3401 *
3402 * Note that if @terminal has been destroyed before the operation is called,
3403 * @callback will be called with a %NULL @terminal; you must not do anything
3404 * in the callback besides freeing any resources associated with @user_data,
3405 * but taking care not to access the now-destroyed #BteTerminal. Note that
3406 * in this case, if spawning was successful, the child process will be aborted
3407 * automatically.
3408 *
3409 * Beginning with 0.52, sets PWD to @working_directory in order to preserve symlink components.
3410 * The caller should also make sure that symlinks were preserved while constructing the value of @working_directory,
3411 * e.g. by using bte_terminal_get_current_directory_uri(), g_get_current_dir() or get_current_dir_name().
3412 *
3413 * Since: 0.62
3414 */
3415void
3416bte_terminal_spawn_with_fds_async(BteTerminal *terminal,
3417 BtePtyFlags pty_flags,
3418 const char *working_directory,
3419 char const* const* argv,
3420 char const* const* envv,
3421 int const* fds,
3422 int n_fds,
3423 int const* fd_map_to,
3424 int n_fd_map_to,
3425 GSpawnFlags spawn_flags,
3426 GSpawnChildSetupFunc child_setup,
3427 gpointer child_setup_data,
3428 GDestroyNotify child_setup_data_destroy,
3429 int timeout,
3430 GCancellable *cancellable,
3431 BteTerminalSpawnAsyncCallback callback,
3432 gpointer user_data) noexcept
3433try
3434{
3435 g_return_if_fail(BTE_IS_TERMINAL(terminal))do { if ((__builtin_expect (__extension__ ({ int _g_boolean_var_
; if ((((__extension__ ({ GTypeInstance *__inst = (GTypeInstance
*) ((terminal)); GType __t = ((bte_terminal_get_type())); gboolean
__r; if (!__inst) __r = (0); else if (__inst->g_class &&
__inst->g_class->g_type == __t) __r = (!(0)); else __r
= g_type_check_instance_is_a (__inst, __t); __r; }))))) _g_boolean_var_
= 1; else _g_boolean_var_ = 0; _g_boolean_var_; }), 1))) { }
else { g_return_if_fail_warning ("BTE", ((const char*) (__PRETTY_FUNCTION__
)), "BTE_IS_TERMINAL(terminal)"); return; } } while (0)
;
3436 g_return_if_fail(cancellable == nullptr || G_IS_CANCELLABLE (cancellable))do { if ((__builtin_expect (__extension__ ({ int _g_boolean_var_
; if (cancellable == nullptr || (((__extension__ ({ GTypeInstance
*__inst = (GTypeInstance*) ((cancellable)); GType __t = ((g_cancellable_get_type
())); gboolean __r; if (!__inst) __r = (0); else if (__inst->
g_class && __inst->g_class->g_type == __t) __r =
(!(0)); else __r = g_type_check_instance_is_a (__inst, __t);
__r; }))))) _g_boolean_var_ = 1; else _g_boolean_var_ = 0; _g_boolean_var_
; }), 1))) { } else { g_return_if_fail_warning ("BTE", ((const
char*) (__PRETTY_FUNCTION__)), "cancellable == nullptr || G_IS_CANCELLABLE (cancellable)"
); return; } } while (0)
;
3437
3438 auto error = bte::glib::Error{};
3439 auto pty = bte::glib::take_ref(bte_terminal_pty_new_sync(terminal, pty_flags, cancellable, error));
3440 if (!pty) {
3441 auto task = bte::glib::take_ref(g_task_new(nullptr,
3442 cancellable,
3443 spawn_async_cb,
3444 spawn_async_callback_data_new(terminal, callback, user_data)));
3445 g_task_return_error(task.get(), error.release());
3446 return;
3447 }
3448
3449 bte_pty_spawn_with_fds_async(pty.get(),
3450 working_directory,
3451 argv,
3452 envv,
3453 fds, n_fds, fd_map_to, n_fd_map_to,
3454 spawn_flags,
3455 child_setup, child_setup_data, child_setup_data_destroy,
3456 timeout, cancellable,
3457 spawn_async_cb,
3458 spawn_async_callback_data_new(terminal, callback, user_data));
3459}
3460catch (...)
3461{
3462 bte::log_exception();
3463}
3464
3465/**
3466 * bte_terminal_spawn_async:
3467 * @terminal: a #BteTerminal
3468 * @pty_flags: flags from #BtePtyFlags
3469 * @working_directory: (allow-none): the name of a directory the command should start
3470 * in, or %NULL to use the current working directory
3471 * @argv: (array zero-terminated=1) (element-type filename): child's argument vector
3472 * @envv: (allow-none) (array zero-terminated=1) (element-type filename): a list of environment
3473 * variables to be added to the environment before starting the process, or %NULL
3474 * @spawn_flags: flags from #GSpawnFlags
3475 * @child_setup: (allow-none) (scope async): an extra child setup function to run in the child just before exec(), or %NULL
3476 * @child_setup_data: (nullable) (closure child_setup): user data for @child_setup, or %NULL
3477 * @child_setup_data_destroy: (nullable) (destroy child_setup_data): a #GDestroyNotify for @child_setup_data, or %NULL
3478 * @timeout: a timeout value in ms, -1 for the default timeout, or G_MAXINT to wait indefinitely
3479 * @cancellable: (allow-none): a #GCancellable, or %NULL
3480 * @callback: (nullable) (scope async): a #BteTerminalSpawnAsyncCallback, or %NULL
3481 * @user_data: (closure callback): user data for @callback, or %NULL
3482 *
3483 * A convenience function that wraps creating the #BtePty and spawning
3484 * the child process on it. Like bte_terminal_spawn_with_fds_async(),
3485 * except that this function does not allow passing file descriptors to
3486 * the child process. See bte_terminal_spawn_with_fds_async() for more
3487 * information.
3488 *
3489 * Since: 0.48
3490 */
3491void
3492bte_terminal_spawn_async(BteTerminal *terminal,
3493 BtePtyFlags pty_flags,
3494 const char *working_directory,
3495 char **argv,
3496 char **envv,
3497 GSpawnFlags spawn_flags,
3498 GSpawnChildSetupFunc child_setup,
3499 gpointer child_setup_data,
3500 GDestroyNotify child_setup_data_destroy,
3501 int timeout,
3502 GCancellable *cancellable,
3503 BteTerminalSpawnAsyncCallback callback,
3504 gpointer user_data) noexcept
3505{
3506 bte_terminal_spawn_with_fds_async(terminal, pty_flags, working_directory, argv, envv,
3507 nullptr, 0, nullptr, 0,
3508 spawn_flags,
3509 child_setup, child_setup_data, child_setup_data_destroy,
3510 timeout, cancellable,
3511 callback, user_data);
3512}
3513
3514/**
3515 * bte_terminal_feed:
3516 * @terminal: a #BteTerminal
3517 * @data: (array length=length) (element-type guint8) (allow-none): a string in the terminal's current encoding
3518 * @length: the length of the string, or -1 to use the full length or a nul-terminated string
3519 *
3520 * Interprets @data as if it were data received from a child process.
3521 */
3522void
3523bte_terminal_feed(BteTerminal *terminal,
3524 const char *data,
3525 gssize length) noexcept
3526try
3527{
3528 g_return_if_fail(BTE_IS_TERMINAL(terminal))do { if ((__builtin_expect (__extension__ ({ int _g_boolean_var_
; if ((((__extension__ ({ GTypeInstance *__inst = (GTypeInstance
*) ((terminal)); GType __t = ((bte_terminal_get_type())); gboolean
__r; if (!__inst) __r = (0); else if (__inst->g_class &&
__inst->g_class->g_type == __t) __r = (!(0)); else __r
= g_type_check_instance_is_a (__inst, __t); __r; }))))) _g_boolean_var_
= 1; else _g_boolean_var_ = 0; _g_boolean_var_; }), 1))) { }
else { g_return_if_fail_warning ("BTE", ((const char*) (__PRETTY_FUNCTION__
)), "BTE_IS_TERMINAL(terminal)"); return; } } while (0)
;
3529 g_return_if_fail(length == 0 || data != NULL)do { if ((__builtin_expect (__extension__ ({ int _g_boolean_var_
; if (length == 0 || data != __null) _g_boolean_var_ = 1; else
_g_boolean_var_ = 0; _g_boolean_var_; }), 1))) { } else { g_return_if_fail_warning
("BTE", ((const char*) (__PRETTY_FUNCTION__)), "length == 0 || data != NULL"
); return; } } while (0)
;
3530
3531 if (length == 0)
3532 return;
3533
3534 auto const len = size_t{length == -1 ? strlen(data) : size_t(length)};
3535 WIDGET(terminal)(get_widget(terminal))->feed({data, len});
3536}
3537catch (...)
3538{
3539 bte::log_exception();
3540}
3541
3542/**
3543 * bte_terminal_feed_child:
3544 * @terminal: a #BteTerminal
3545 * @text: (array length=length) (element-type guint8) (allow-none): data to send to the child
3546 * @length: length of @text in bytes, or -1 if @text is NUL-terminated
3547 *
3548 * Sends a block of UTF-8 text to the child as if it were entered by the user
3549 * at the keyboard.
3550 */
3551void
3552bte_terminal_feed_child(BteTerminal *terminal,
3553 const char *text,
3554 gssize length) noexcept
3555try
This statement is never executed
3556{
3557 g_return_if_fail(BTE_IS_TERMINAL(terminal))do { if ((__builtin_expect (__extension__ ({ int _g_boolean_var_
; if ((((__extension__ ({ GTypeInstance *__inst = (GTypeInstance
*) ((terminal)); GType __t = ((bte_terminal_get_type())); gboolean
__r; if (!__inst) __r = (0); else if (__inst->g_class &&
__inst->g_class->g_type == __t) __r = (!(0)); else __r
= g_type_check_instance_is_a (__inst, __t); __r; }))))) _g_boolean_var_
= 1; else _g_boolean_var_ = 0; _g_boolean_var_; }), 1))) { }
else { g_return_if_fail_warning ("BTE", ((const char*) (__PRETTY_FUNCTION__
)), "BTE_IS_TERMINAL(terminal)"); return; } } while (0)
;
3558 g_return_if_fail(length == 0 || text != NULL)do { if ((__builtin_expect (__extension__ ({ int _g_boolean_var_
; if (length == 0 || text != __null) _g_boolean_var_ = 1; else
_g_boolean_var_ = 0; _g_boolean_var_; }), 1))) { } else { g_return_if_fail_warning
("BTE", ((const char*) (__PRETTY_FUNCTION__)), "length == 0 || text != NULL"
); return; } } while (0)
;
3559
3560 if (length == 0)
3561 return;
3562
3563 auto const len = size_t{length == -1 ? strlen(text) : size_t(length)};
3564 WIDGET(terminal)(get_widget(terminal))->feed_child({text, len});
3565}
3566catch (...)
3567{
3568 bte::log_exception();
3569}
3570
3571/**
3572 * bte_terminal_feed_child_binary:
3573 * @terminal: a #BteTerminal
3574 * @data: (array length=length) (element-type guint8) (allow-none): data to send to the child
3575 * @length: length of @data
3576 *
3577 * Sends a block of binary data to the child.
3578 *
3579 * Deprecated: 0.60: Don't send binary data. Use bte_terminal_feed_child() instead to send
3580 * UTF-8 text
3581 */
3582void
3583bte_terminal_feed_child_binary(BteTerminal *terminal,
3584 const guint8 *data,
3585 gsize length) noexcept
3586try
3587{
3588 g_return_if_fail(BTE_IS_TERMINAL(terminal))do { if ((__builtin_expect (__extension__ ({ int _g_boolean_var_
; if ((((__extension__ ({ GTypeInstance *__inst = (GTypeInstance
*) ((terminal)); GType __t = ((bte_terminal_get_type())); gboolean
__r; if (!__inst) __r = (0); else if (__inst->g_class &&
__inst->g_class->g_type == __t) __r = (!(0)); else __r
= g_type_check_instance_is_a (__inst, __t); __r; }))))) _g_boolean_var_
= 1; else _g_boolean_var_ = 0; _g_boolean_var_; }), 1))) { }
else { g_return_if_fail_warning ("BTE", ((const char*) (__PRETTY_FUNCTION__
)), "BTE_IS_TERMINAL(terminal)"); return; } } while (0)
;
3589 g_return_if_fail(length == 0 || data != NULL)do { if ((__builtin_expect (__extension__ ({ int _g_boolean_var_
; if (length == 0 || data != __null) _g_boolean_var_ = 1; else
_g_boolean_var_ = 0; _g_boolean_var_; }), 1))) { } else { g_return_if_fail_warning
("BTE", ((const char*) (__PRETTY_FUNCTION__)), "length == 0 || data != NULL"
); return; } } while (0)
;
3590
3591 if (length == 0)
3592 return;
3593
3594 WIDGET(terminal)(get_widget(terminal))->feed_child_binary({(char*)data, length});
3595}
3596catch (...)
3597{
3598 bte::log_exception();
3599}
3600
3601/**
3602 * BteSelectionFunc:
3603 * @terminal: terminal in which the cell is.
3604 * @column: column in which the cell is.
3605 * @row: row in which the cell is.
3606 * @data: (closure): user data.
3607 *
3608 * Specifies the type of a selection function used to check whether
3609 * a cell has to be selected or not.
3610 *
3611 * Returns: %TRUE if cell has to be selected; %FALSE if otherwise.
3612 */
3613
3614static void
3615warn_if_callback(BteSelectionFunc func) noexcept
3616{
3617 if (!func)
3618 return;
3619
3620#ifndef BTE_DEBUG
3621 static gboolean warned = FALSE(0);
3622 if (warned)
3623 return;
3624 warned = TRUE(!(0));
3625#endif
3626 g_warning ("BteSelectionFunc callback ignored.\n");
3627}
3628
3629/**
3630 * bte_terminal_get_text:
3631 * @terminal: a #BteTerminal
3632 * @is_selected: (scope call) (allow-none): a #BteSelectionFunc callback
3633 * @user_data: (closure): user data to be passed to the callback
3634 * @attributes: (out caller-allocates) (transfer full) (array) (element-type Bte.CharAttributes): location for storing text attributes
3635 *
3636 * Extracts a view of the visible part of the terminal. If @is_selected is not
3637 * %NULL, characters will only be read if @is_selected returns %TRUE after being
3638 * passed the column and row, respectively. A #BteCharAttributes structure
3639 * is added to @attributes for each byte added to the returned string detailing
3640 * the character's position, colors, and other characteristics.
3641 *
3642 * This method is unaware of BiDi. The columns returned in @attributes are
3643 * logical columns.
3644 *
3645 * Returns: (transfer full): a newly allocated text string, or %NULL.
3646 */
3647char *
3648bte_terminal_get_text(BteTerminal *terminal,
3649 BteSelectionFunc is_selected,
3650 gpointer user_data,
3651 GArray *attributes) noexcept
3652try
3653{
3654 g_return_val_if_fail(BTE_IS_TERMINAL(terminal), NULL)do { if ((__builtin_expect (__extension__ ({ int _g_boolean_var_
; if ((((__extension__ ({ GTypeInstance *__inst = (GTypeInstance
*) ((terminal)); GType __t = ((bte_terminal_get_type())); gboolean
__r; if (!__inst) __r = (0); else if (__inst->g_class &&
__inst->g_class->g_type == __t) __r = (!(0)); else __r
= g_type_check_instance_is_a (__inst, __t); __r; }))))) _g_boolean_var_
= 1; else _g_boolean_var_ = 0; _g_boolean_var_; }), 1))) { }
else { g_return_if_fail_warning ("BTE", ((const char*) (__PRETTY_FUNCTION__
)), "BTE_IS_TERMINAL(terminal)"); return (__null); } } while (
0)
;
3655 warn_if_callback(is_selected);
3656 auto text = IMPL(terminal)(_bte_terminal_get_impl(terminal))->get_text_displayed(true /* wrap */,
3657 attributes);
3658 if (text == nullptr)
3659 return nullptr;
3660 return (char*)g_string_free(text, FALSE(0));
3661}
3662catch (...)
3663{
3664 bte::log_exception();
3665 return nullptr;
3666}
3667
3668/**
3669 * bte_terminal_get_text_include_trailing_spaces:
3670 * @terminal: a #BteTerminal
3671 * @is_selected: (scope call) (allow-none): a #BteSelectionFunc callback
3672 * @user_data: (closure): user data to be passed to the callback
3673 * @attributes: (out caller-allocates) (transfer full) (array) (element-type Bte.CharAttributes): location for storing text attributes
3674 *
3675 * Extracts a view of the visible part of the terminal. If @is_selected is not
3676 * %NULL, characters will only be read if @is_selected returns %TRUE after being
3677 * passed the column and row, respectively. A #BteCharAttributes structure
3678 * is added to @attributes for each byte added to the returned string detailing
3679 * the character's position, colors, and other characteristics.
3680 *
3681 * This method is unaware of BiDi. The columns returned in @attributes are
3682 * logical columns.
3683 *
3684 * Returns: (transfer full): a newly allocated text string, or %NULL.
3685 *
3686 * Deprecated: 0.56: Use bte_terminal_get_text() instead.
3687 */
3688char *
3689bte_terminal_get_text_include_trailing_spaces(BteTerminal *terminal,
3690 BteSelectionFunc is_selected,
3691 gpointer user_data,
3692 GArray *attributes) noexcept
3693{
3694 return bte_terminal_get_text(terminal, is_selected, user_data, attributes);
3695}
3696
3697/**
3698 * bte_terminal_get_text_range:
3699 * @terminal: a #BteTerminal
3700 * @start_row: first row to search for data
3701 * @start_col: first column to search for data
3702 * @end_row: last row to search for data
3703 * @end_col: last column to search for data
3704 * @is_selected: (scope call) (allow-none): a #BteSelectionFunc callback
3705 * @user_data: (closure): user data to be passed to the callback
3706 * @attributes: (out caller-allocates) (transfer full) (array) (element-type Bte.CharAttributes): location for storing text attributes
3707 *
3708 * Extracts a view of the visible part of the terminal. If @is_selected is not
3709 * %NULL, characters will only be read if @is_selected returns %TRUE after being
3710 * passed the column and row, respectively. A #BteCharAttributes structure
3711 * is added to @attributes for each byte added to the returned string detailing
3712 * the character's position, colors, and other characteristics. The
3713 * entire scrollback buffer is scanned, so it is possible to read the entire
3714 * contents of the buffer using this function.
3715 *
3716 * This method is unaware of BiDi. The columns passed in @start_col and @end_row,
3717 * and returned in @attributes are logical columns.
3718 *
3719 * Returns: (transfer full): a newly allocated text string, or %NULL.
3720 */
3721char *
3722bte_terminal_get_text_range(BteTerminal *terminal,
3723 long start_row,
3724 long start_col,
3725 long end_row,
3726 long end_col,
3727 BteSelectionFunc is_selected,
3728 gpointer user_data,
3729 GArray *attributes) noexcept
3730try
3731{
3732 g_return_val_if_fail(BTE_IS_TERMINAL(terminal), NULL)do { if ((__builtin_expect (__extension__ ({ int _g_boolean_var_
; if ((((__extension__ ({ GTypeInstance *__inst = (GTypeInstance
*) ((terminal)); GType __t = ((bte_terminal_get_type())); gboolean
__r; if (!__inst) __r = (0); else if (__inst->g_class &&
__inst->g_class->g_type == __t) __r = (!(0)); else __r
= g_type_check_instance_is_a (__inst, __t); __r; }))))) _g_boolean_var_
= 1; else _g_boolean_var_ = 0; _g_boolean_var_; }), 1))) { }
else { g_return_if_fail_warning ("BTE", ((const char*) (__PRETTY_FUNCTION__
)), "BTE_IS_TERMINAL(terminal)"); return (__null); } } while (
0)
;
3733 warn_if_callback(is_selected);
3734 auto text = IMPL(terminal)(_bte_terminal_get_impl(terminal))->get_text(start_row, start_col,
3735 end_row, end_col,
3736 false /* block */,
3737 true /* wrap */,
3738 attributes);
3739 if (text == nullptr)
3740 return nullptr;
3741 return (char*)g_string_free(text, FALSE(0));
3742}
3743catch (...)
3744{
3745 bte::log_exception();
3746 return nullptr;
3747}
3748
3749/**
3750 * bte_terminal_reset:
3751 * @terminal: a #BteTerminal
3752 * @clear_tabstops: whether to reset tabstops
3753 * @clear_history: whether to empty the terminal's scrollback buffer
3754 *
3755 * Resets as much of the terminal's internal state as possible, discarding any
3756 * unprocessed input data, resetting character attributes, cursor state,
3757 * national character set state, status line, terminal modes (insert/delete),
3758 * selection state, and encoding.
3759 *
3760 */
3761void
3762bte_terminal_reset(BteTerminal *terminal,
3763 gboolean clear_tabstops,
3764 gboolean clear_history) noexcept
3765try
3766{
3767 g_return_if_fail(BTE_IS_TERMINAL(terminal))do { if ((__builtin_expect (__extension__ ({ int _g_boolean_var_
; if ((((__extension__ ({ GTypeInstance *__inst = (GTypeInstance
*) ((terminal)); GType __t = ((bte_terminal_get_type())); gboolean
__r; if (!__inst) __r = (0); else if (__inst->g_class &&
__inst->g_class->g_type == __t) __r = (!(0)); else __r
= g_type_check_instance_is_a (__inst, __t); __r; }))))) _g_boolean_var_
= 1; else _g_boolean_var_ = 0; _g_boolean_var_; }), 1))) { }
else { g_return_if_fail_warning ("BTE", ((const char*) (__PRETTY_FUNCTION__
)), "BTE_IS_TERMINAL(terminal)"); return; } } while (0)
;
3768 IMPL(terminal)(_bte_terminal_get_impl(terminal))->reset(clear_tabstops, clear_history, true);
3769}
3770catch (...)
3771{
3772 bte::log_exception();
3773}
3774
3775/**
3776 * bte_terminal_set_size:
3777 * @terminal: a #BteTerminal
3778 * @columns: the desired number of columns
3779 * @rows: the desired number of rows
3780 *
3781 * Attempts to change the terminal's size in terms of rows and columns. If
3782 * the attempt succeeds, the widget will resize itself to the proper size.
3783 */
3784void
3785bte_terminal_set_size(BteTerminal *terminal,
3786 long columns,
3787 long rows) noexcept
3788try
3789{
3790 g_return_if_fail(columns >= 1)do { if ((__builtin_expect (__extension__ ({ int _g_boolean_var_
; if (columns >= 1) _g_boolean_var_ = 1; else _g_boolean_var_
= 0; _g_boolean_var_; }), 1))) { } else { g_return_if_fail_warning
("BTE", ((const char*) (__PRETTY_FUNCTION__)), "columns >= 1"
); return; } } while (0)
;
3791 g_return_if_fail(rows >= 1)do { if ((__builtin_expect (__extension__ ({ int _g_boolean_var_
; if (rows >= 1) _g_boolean_var_ = 1; else _g_boolean_var_
= 0; _g_boolean_var_; }), 1))) { } else { g_return_if_fail_warning
("BTE", ((const char*) (__PRETTY_FUNCTION__)), "rows >= 1"
); return; } } while (0)
;
3792
3793 IMPL(terminal)(_bte_terminal_get_impl(terminal))->set_size(columns, rows);
3794}
3795catch (...)
3796{
3797 bte::log_exception();
3798}
3799
3800/**
3801 * bte_terminal_get_text_blink_mode:
3802 * @terminal: a #BteTerminal
3803 *
3804 * Checks whether or not the terminal will allow blinking text.
3805 *
3806 * Returns: the blinking setting
3807 *
3808 * Since: 0.52
3809 */
3810BteTextBlinkMode
3811bte_terminal_get_text_blink_mode(BteTerminal *terminal) noexcept
3812try
3813{
3814 g_return_val_if_fail(BTE_IS_TERMINAL(terminal), BTE_TEXT_BLINK_ALWAYS)do { if ((__builtin_expect (__extension__ ({ int _g_boolean_var_
; if ((((__extension__ ({ GTypeInstance *__inst = (GTypeInstance
*) ((terminal)); GType __t = ((bte_terminal_get_type())); gboolean
__r; if (!__inst) __r = (0); else if (__inst->g_class &&
__inst->g_class->g_type == __t) __r = (!(0)); else __r
= g_type_check_instance_is_a (__inst, __t); __r; }))))) _g_boolean_var_
= 1; else _g_boolean_var_ = 0; _g_boolean_var_; }), 1))) { }
else { g_return_if_fail_warning ("BTE", ((const char*) (__PRETTY_FUNCTION__
)), "BTE_IS_TERMINAL(terminal)"); return (BTE_TEXT_BLINK_ALWAYS
); } } while (0)
;
3815 return WIDGET(terminal)(get_widget(terminal))->text_blink_mode();
3816}
3817catch (...)
3818{
3819 bte::log_exception();
3820 return BTE_TEXT_BLINK_ALWAYS;
3821}
3822
3823/**
3824 * bte_terminal_set_text_blink_mode:
3825 * @terminal: a #BteTerminal
3826 * @text_blink_mode: the #BteTextBlinkMode to use
3827 *
3828 * Controls whether or not the terminal will allow blinking text.
3829 *
3830 * Since: 0.52
3831 */
3832void
3833bte_terminal_set_text_blink_mode(BteTerminal *terminal,
3834 BteTextBlinkMode text_blink_mode) noexcept
3835try
3836{
3837 g_return_if_fail(BTE_IS_TERMINAL(terminal))do { if ((__builtin_expect (__extension__ ({ int _g_boolean_var_
; if ((((__extension__ ({ GTypeInstance *__inst = (GTypeInstance
*) ((terminal)); GType __t = ((bte_terminal_get_type())); gboolean
__r; if (!__inst) __r = (0); else if (__inst->g_class &&
__inst->g_class->g_type == __t) __r = (!(0)); else __r
= g_type_check_instance_is_a (__inst, __t); __r; }))))) _g_boolean_var_
= 1; else _g_boolean_var_ = 0; _g_boolean_var_; }), 1))) { }
else { g_return_if_fail_warning ("BTE", ((const char*) (__PRETTY_FUNCTION__
)), "BTE_IS_TERMINAL(terminal)"); return; } } while (0)
;
3838
3839 if (WIDGET(terminal)(get_widget(terminal))->set_text_blink_mode(text_blink_mode))
3840 g_object_notify_by_pspec(G_OBJECT(terminal)((((GObject*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((terminal)), (((GType) ((20) << (2))))))))
, pspecs[PROP_TEXT_BLINK_MODE]);
3841}
3842catch (...)
3843{
3844 bte::log_exception();
3845}
3846
3847/**
3848 * bte_terminal_get_allow_bold:
3849 * @terminal: a #BteTerminal
3850 *
3851 * Checks whether or not the terminal will attempt to draw bold text,
3852 * by using a bold font variant.
3853 *
3854 * Returns: %TRUE if bolding is enabled, %FALSE if not
3855 */
3856gboolean
3857bte_terminal_get_allow_bold(BteTerminal *terminal) noexcept
3858try
3859{
3860 g_return_val_if_fail(BTE_IS_TERMINAL(terminal), false)do { if ((__builtin_expect (__extension__ ({ int _g_boolean_var_
; if ((((__extension__ ({ GTypeInstance *__inst = (GTypeInstance
*) ((terminal)); GType __t = ((bte_terminal_get_type())); gboolean
__r; if (!__inst) __r = (0); else if (__inst->g_class &&
__inst->g_class->g_type == __t) __r = (!(0)); else __r
= g_type_check_instance_is_a (__inst, __t); __r; }))))) _g_boolean_var_
= 1; else _g_boolean_var_ = 0; _g_boolean_var_; }), 1))) { }
else { g_return_if_fail_warning ("BTE", ((const char*) (__PRETTY_FUNCTION__
)), "BTE_IS_TERMINAL(terminal)"); return (false); } } while (
0)
;
3861 return IMPL(terminal)(_bte_terminal_get_impl(terminal))->m_allow_bold;
3862}
3863catch (...)
3864{
3865 bte::log_exception();
3866 return false;
3867}
3868
3869/**
3870 * bte_terminal_set_allow_bold:
3871 * @terminal: a #BteTerminal
3872 * @allow_bold: %TRUE if the terminal should attempt to draw bold text
3873 *
3874 * Controls whether or not the terminal will attempt to draw bold text,
3875 * by using a bold font variant.
3876 */
3877void
3878bte_terminal_set_allow_bold(BteTerminal *terminal,
3879 gboolean allow_bold) noexcept
3880try
3881{
3882 g_return_if_fail(BTE_IS_TERMINAL(terminal))do { if ((__builtin_expect (__extension__ ({ int _g_boolean_var_
; if ((((__extension__ ({ GTypeInstance *__inst = (GTypeInstance
*) ((terminal)); GType __t = ((bte_terminal_get_type())); gboolean
__r; if (!__inst) __r = (0); else if (__inst->g_class &&
__inst->g_class->g_type == __t) __r = (!(0)); else __r
= g_type_check_instance_is_a (__inst, __t); __r; }))))) _g_boolean_var_
= 1; else _g_boolean_var_ = 0; _g_boolean_var_; }), 1))) { }
else { g_return_if_fail_warning ("BTE", ((const char*) (__PRETTY_FUNCTION__
)), "BTE_IS_TERMINAL(terminal)"); return; } } while (0)
;
3883
3884 if (IMPL(terminal)(_bte_terminal_get_impl(terminal))->set_allow_bold(allow_bold != FALSE(0)))
3885 g_object_notify_by_pspec(G_OBJECT(terminal)((((GObject*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((terminal)), (((GType) ((20) << (2))))))))
, pspecs[PROP_ALLOW_BOLD]);
3886}
3887catch (...)
3888{
3889 bte::log_exception();
3890}
3891
3892/**
3893 * bte_terminal_get_allow_hyperlink:
3894 * @terminal: a #BteTerminal
3895 *
3896 * Checks whether or not hyperlinks (OSC 8 escape sequence) are allowed.
3897 *
3898 * Returns: %TRUE if hyperlinks are enabled, %FALSE if not
3899 *
3900 * Since: 0.50
3901 */
3902gboolean
3903bte_terminal_get_allow_hyperlink(BteTerminal *terminal) noexcept
3904try
3905{
3906 g_return_val_if_fail(BTE_IS_TERMINAL(terminal), FALSE)do { if ((__builtin_expect (__extension__ ({ int _g_boolean_var_
; if ((((__extension__ ({ GTypeInstance *__inst = (GTypeInstance
*) ((terminal)); GType __t = ((bte_terminal_get_type())); gboolean
__r; if (!__inst) __r = (0); else if (__inst->g_class &&
__inst->g_class->g_type == __t) __r = (!(0)); else __r
= g_type_check_instance_is_a (__inst, __t); __r; }))))) _g_boolean_var_
= 1; else _g_boolean_var_ = 0; _g_boolean_var_; }), 1))) { }
else { g_return_if_fail_warning ("BTE", ((const char*) (__PRETTY_FUNCTION__
)), "BTE_IS_TERMINAL(terminal)"); return ((0)); } } while (0)
;
3907 return IMPL(terminal)(_bte_terminal_get_impl(terminal))->m_allow_hyperlink;
3908}
3909catch (...)
3910{
3911 bte::log_exception();
3912 return false;
3913}
3914
3915/**
3916 * bte_terminal_set_allow_hyperlink:
3917 * @terminal: a #BteTerminal
3918 * @allow_hyperlink: %TRUE if the terminal should allow hyperlinks
3919 *
3920 * Controls whether or not hyperlinks (OSC 8 escape sequence) are allowed.
3921 *
3922 * Since: 0.50
3923 */
3924void
3925bte_terminal_set_allow_hyperlink(BteTerminal *terminal,
3926 gboolean allow_hyperlink) noexcept
3927try
3928{
3929 g_return_if_fail(BTE_IS_TERMINAL(terminal))do { if ((__builtin_expect (__extension__ ({ int _g_boolean_var_
; if ((((__extension__ ({ GTypeInstance *__inst = (GTypeInstance
*) ((terminal)); GType __t = ((bte_terminal_get_type())); gboolean
__r; if (!__inst) __r = (0); else if (__inst->g_class &&
__inst->g_class->g_type == __t) __r = (!(0)); else __r
= g_type_check_instance_is_a (__inst, __t); __r; }))))) _g_boolean_var_
= 1; else _g_boolean_var_ = 0; _g_boolean_var_; }), 1))) { }
else { g_return_if_fail_warning ("BTE", ((const char*) (__PRETTY_FUNCTION__
)), "BTE_IS_TERMINAL(terminal)"); return; } } while (0)
;
3930
3931 if (IMPL(terminal)(_bte_terminal_get_impl(terminal))->set_allow_hyperlink(allow_hyperlink != FALSE(0)))
3932 g_object_notify_by_pspec(G_OBJECT(terminal)((((GObject*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((terminal)), (((GType) ((20) << (2))))))))
, pspecs[PROP_ALLOW_HYPERLINK]);
3933}
3934catch (...)
3935{
3936 bte::log_exception();
3937}
3938
3939/**
3940 * bte_terminal_get_audible_bell:
3941 * @terminal: a #BteTerminal
3942 *
3943 * Checks whether or not the terminal will beep when the child outputs the
3944 * "bl" sequence.
3945 *
3946 * Returns: %TRUE if audible bell is enabled, %FALSE if not
3947 */
3948gboolean
3949bte_terminal_get_audible_bell(BteTerminal *terminal) noexcept
3950try
3951{
3952 g_return_val_if_fail(BTE_IS_TERMINAL(terminal), false)do { if ((__builtin_expect (__extension__ ({ int _g_boolean_var_
; if ((((__extension__ ({ GTypeInstance *__inst = (GTypeInstance
*) ((terminal)); GType __t = ((bte_terminal_get_type())); gboolean
__r; if (!__inst) __r = (0); else if (__inst->g_class &&
__inst->g_class->g_type == __t) __r = (!(0)); else __r
= g_type_check_instance_is_a (__inst, __t); __r; }))))) _g_boolean_var_
= 1; else _g_boolean_var_ = 0; _g_boolean_var_; }), 1))) { }
else { g_return_if_fail_warning ("BTE", ((const char*) (__PRETTY_FUNCTION__
)), "BTE_IS_TERMINAL(terminal)"); return (false); } } while (
0)
;
3953 return IMPL(terminal)(_bte_terminal_get_impl(terminal))->m_audible_bell;
3954}
3955catch (...)
3956{
3957 bte::log_exception();
3958 return false;
3959}
3960
3961/**
3962 * bte_terminal_set_audible_bell:
3963 * @terminal: a #BteTerminal
3964 * @is_audible: %TRUE if the terminal should beep
3965 *
3966 * Controls whether or not the terminal will beep when the child outputs the
3967 * "bl" sequence.
3968 */
3969void
3970bte_terminal_set_audible_bell(BteTerminal *terminal,
3971 gboolean is_audible) noexcept
3972try
3973{
3974 g_return_if_fail(BTE_IS_TERMINAL(terminal))do { if ((__builtin_expect (__extension__ ({ int _g_boolean_var_
; if ((((__extension__ ({ GTypeInstance *__inst = (GTypeInstance
*) ((terminal)); GType __t = ((bte_terminal_get_type())); gboolean
__r; if (!__inst) __r = (0); else if (__inst->g_class &&
__inst->g_class->g_type == __t) __r = (!(0)); else __r
= g_type_check_instance_is_a (__inst, __t); __r; }))))) _g_boolean_var_
= 1; else _g_boolean_var_ = 0; _g_boolean_var_; }), 1))) { }
else { g_return_if_fail_warning ("BTE", ((const char*) (__PRETTY_FUNCTION__
)), "BTE_IS_TERMINAL(terminal)"); return; } } while (0)
;
3975
3976 if (IMPL(terminal)(_bte_terminal_get_impl(terminal))->set_audible_bell(is_audible != FALSE(0)))
3977 g_object_notify_by_pspec(G_OBJECT(terminal)((((GObject*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((terminal)), (((GType) ((20) << (2))))))))
, pspecs[PROP_AUDIBLE_BELL]);
3978}
3979catch (...)
3980{
3981 bte::log_exception();
3982}
3983
3984/**
3985 * bte_terminal_set_backspace_binding:
3986 * @terminal: a #BteTerminal
3987 * @binding: a #BteEraseBinding for the backspace key
3988 *
3989 * Modifies the terminal's backspace key binding, which controls what
3990 * string or control sequence the terminal sends to its child when the user
3991 * presses the backspace key.
3992 */
3993void
3994bte_terminal_set_backspace_binding(BteTerminal *terminal,
3995 BteEraseBinding binding) noexcept
3996try
3997{
3998 g_return_if_fail(BTE_IS_TERMINAL(terminal))do { if ((__builtin_expect (__extension__ ({ int _g_boolean_var_
; if ((((__extension__ ({ GTypeInstance *__inst = (GTypeInstance
*) ((terminal)); GType __t = ((bte_terminal_get_type())); gboolean
__r; if (!__inst) __r = (0); else if (__inst->g_class &&
__inst->g_class->g_type == __t) __r = (!(0)); else __r
= g_type_check_instance_is_a (__inst, __t); __r; }))))) _g_boolean_var_
= 1; else _g_boolean_var_ = 0; _g_boolean_var_; }), 1))) { }
else { g_return_if_fail_warning ("BTE", ((const char*) (__PRETTY_FUNCTION__
)), "BTE_IS_TERMINAL(terminal)"); return; } } while (0)
;
3999 g_return_if_fail(binding >= BTE_ERASE_AUTO && binding <= BTE_ERASE_TTY)do { if ((__builtin_expect (__extension__ ({ int _g_boolean_var_
; if (binding >= BTE_ERASE_AUTO && binding <= BTE_ERASE_TTY
) _g_boolean_var_ = 1; else _g_boolean_var_ = 0; _g_boolean_var_
; }), 1))) { } else { g_return_if_fail_warning ("BTE", ((const
char*) (__PRETTY_FUNCTION__)), "binding >= BTE_ERASE_AUTO && binding <= BTE_ERASE_TTY"
); return; } } while (0)
;
4000
4001 if (WIDGET(terminal)(get_widget(terminal))->set_backspace_binding(binding))
4002 g_object_notify_by_pspec(G_OBJECT(terminal)((((GObject*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((terminal)), (((GType) ((20) << (2))))))))
, pspecs[PROP_BACKSPACE_BINDING]);
4003}
4004catch (...)
4005{
4006 bte::log_exception();
4007}
4008
4009/**
4010 * bte_terminal_get_bold_is_bright:
4011 * @terminal: a #BteTerminal
4012 *
4013 * Checks whether the SGR 1 attribute also switches to the bright counterpart
4014 * of the first 8 palette colors, in addition to making them bold (legacy behavior)
4015 * or if SGR 1 only enables bold and leaves the color intact.
4016 *
4017 * Returns: %TRUE if bold also enables bright, %FALSE if not
4018 *
4019 * Since: 0.52
4020 */
4021gboolean
4022bte_terminal_get_bold_is_bright(BteTerminal *terminal) noexcept
4023try
4024{
4025 g_return_val_if_fail(BTE_IS_TERMINAL(terminal), false)do { if ((__builtin_expect (__extension__ ({ int _g_boolean_var_
; if ((((__extension__ ({ GTypeInstance *__inst = (GTypeInstance
*) ((terminal)); GType __t = ((bte_terminal_get_type())); gboolean
__r; if (!__inst) __r = (0); else if (__inst->g_class &&
__inst->g_class->g_type == __t) __r = (!(0)); else __r
= g_type_check_instance_is_a (__inst, __t); __r; }))))) _g_boolean_var_
= 1; else _g_boolean_var_ = 0; _g_boolean_var_; }), 1))) { }
else { g_return_if_fail_warning ("BTE", ((const char*) (__PRETTY_FUNCTION__
)), "BTE_IS_TERMINAL(terminal)"); return (false); } } while (
0)
;
4026 return IMPL(terminal)(_bte_terminal_get_impl(terminal))->m_bold_is_bright;
4027}
4028catch (...)
4029{
4030 bte::log_exception();
4031 return false;
4032}
4033
4034/**
4035 * bte_terminal_set_bold_is_bright:
4036 * @terminal: a #BteTerminal
4037 * @bold_is_bright: %TRUE if bold should also enable bright
4038 *
4039 * Sets whether the SGR 1 attribute also switches to the bright counterpart
4040 * of the first 8 palette colors, in addition to making them bold (legacy behavior)
4041 * or if SGR 1 only enables bold and leaves the color intact.
4042 *
4043 * Since: 0.52
4044 */
4045void
4046bte_terminal_set_bold_is_bright(BteTerminal *terminal,
4047 gboolean bold_is_bright) noexcept
4048try
4049{
4050 g_return_if_fail(BTE_IS_TERMINAL(terminal))do { if ((__builtin_expect (__extension__ ({ int _g_boolean_var_
; if ((((__extension__ ({ GTypeInstance *__inst = (GTypeInstance
*) ((terminal)); GType __t = ((bte_terminal_get_type())); gboolean
__r; if (!__inst) __r = (0); else if (__inst->g_class &&
__inst->g_class->g_type == __t) __r = (!(0)); else __r
= g_type_check_instance_is_a (__inst, __t); __r; }))))) _g_boolean_var_
= 1; else _g_boolean_var_ = 0; _g_boolean_var_; }), 1))) { }
else { g_return_if_fail_warning ("BTE", ((const char*) (__PRETTY_FUNCTION__
)), "BTE_IS_TERMINAL(terminal)"); return; } } while (0)
;
4051
4052 if (IMPL(terminal)(_bte_terminal_get_impl(terminal))->set_bold_is_bright(bold_is_bright != FALSE(0)))
4053 g_object_notify_by_pspec(G_OBJECT(terminal)((((GObject*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((terminal)), (((GType) ((20) << (2))))))))
, pspecs[PROP_BOLD_IS_BRIGHT]);
4054}
4055catch (...)
4056{
4057 bte::log_exception();
4058}
4059
4060/**
4061 * bte_terminal_get_char_height:
4062 * @terminal: a #BteTerminal
4063 *
4064 * Returns: the height of a character cell
4065 *
4066 * Note that this method should rather be called bte_terminal_get_cell_height,
4067 * because the return value takes cell-height-scale into account.
4068 */
4069glong
4070bte_terminal_get_char_height(BteTerminal *terminal) noexcept
4071try
4072{
4073 g_return_val_if_fail(BTE_IS_TERMINAL(terminal), -1)do { if ((__builtin_expect (__extension__ ({ int _g_boolean_var_
; if ((((__extension__ ({ GTypeInstance *__inst = (GTypeInstance
*) ((terminal)); GType __t = ((bte_terminal_get_type())); gboolean
__r; if (!__inst) __r = (0); else if (__inst->g_class &&
__inst->g_class->g_type == __t) __r = (!(0)); else __r
= g_type_check_instance_is_a (__inst, __t); __r; }))))) _g_boolean_var_
= 1; else _g_boolean_var_ = 0; _g_boolean_var_; }), 1))) { }
else { g_return_if_fail_warning ("BTE", ((const char*) (__PRETTY_FUNCTION__
)), "BTE_IS_TERMINAL(terminal)"); return (-1); } } while (0)
;
4074 return IMPL(terminal)(_bte_terminal_get_impl(terminal))->get_cell_height();
4075}
4076catch (...)
4077{
4078 bte::log_exception();
4079 return -1;
4080}
4081
4082/**
4083 * bte_terminal_get_char_width:
4084 * @terminal: a #BteTerminal
4085 *
4086 * Returns: the width of a character cell
4087 *
4088 * Note that this method should rather be called bte_terminal_get_cell_width,
4089 * because the return value takes cell-width-scale into account.
4090 */
4091glong
4092bte_terminal_get_char_width(BteTerminal *terminal) noexcept
4093try
4094{
4095 g_return_val_if_fail(BTE_IS_TERMINAL(terminal), -1)do { if ((__builtin_expect (__extension__ ({ int _g_boolean_var_
; if ((((__extension__ ({ GTypeInstance *__inst = (GTypeInstance
*) ((terminal)); GType __t = ((bte_terminal_get_type())); gboolean
__r; if (!__inst) __r = (0); else if (__inst->g_class &&
__inst->g_class->g_type == __t) __r = (!(0)); else __r
= g_type_check_instance_is_a (__inst, __t); __r; }))))) _g_boolean_var_
= 1; else _g_boolean_var_ = 0; _g_boolean_var_; }), 1))) { }
else { g_return_if_fail_warning ("BTE", ((const char*) (__PRETTY_FUNCTION__
)), "BTE_IS_TERMINAL(terminal)"); return (-1); } } while (0)
;
4096 return IMPL(terminal)(_bte_terminal_get_impl(terminal))->get_cell_width();
4097}
4098catch (...)
4099{
4100 bte::log_exception();
4101 return -1;
4102}
4103
4104/**
4105 * bte_terminal_get_cjk_ambiguous_width:
4106 * @terminal: a #BteTerminal
4107 *
4108 * Returns whether ambiguous-width characters are narrow or wide.
4109 * (Note that when using a non-UTF-8 encoding set via bte_terminal_set_encoding(),
4110 * the width of ambiguous-width characters is fixed and determined by the encoding
4111 * itself.)
4112 *
4113 * Returns: 1 if ambiguous-width characters are narrow, or 2 if they are wide
4114 */
4115int
4116bte_terminal_get_cjk_ambiguous_width(BteTerminal *terminal) noexcept
4117try
4118{
4119 g_return_val_if_fail(BTE_IS_TERMINAL(terminal), 1)do { if ((__builtin_expect (__extension__ ({ int _g_boolean_var_
; if ((((__extension__ ({ GTypeInstance *__inst = (GTypeInstance
*) ((terminal)); GType __t = ((bte_terminal_get_type())); gboolean
__r; if (!__inst) __r = (0); else if (__inst->g_class &&
__inst->g_class->g_type == __t) __r = (!(0)); else __r
= g_type_check_instance_is_a (__inst, __t); __r; }))))) _g_boolean_var_
= 1; else _g_boolean_var_ = 0; _g_boolean_var_; }), 1))) { }
else { g_return_if_fail_warning ("BTE", ((const char*) (__PRETTY_FUNCTION__
)), "BTE_IS_TERMINAL(terminal)"); return (1); } } while (0)
;
4120 return IMPL(terminal)(_bte_terminal_get_impl(terminal))->m_utf8_ambiguous_width;
4121}
4122catch (...)
4123{
4124 bte::log_exception();
4125 return 1;
4126}
4127
4128/**
4129 * bte_terminal_set_cjk_ambiguous_width:
4130 * @terminal: a #BteTerminal
4131 * @width: either 1 (narrow) or 2 (wide)
4132 *
4133 * This setting controls whether ambiguous-width characters are narrow or wide.
4134 * (Note that when using a non-UTF-8 encoding set via bte_terminal_set_encoding(),
4135 * the width of ambiguous-width characters is fixed and determined by the encoding
4136 * itself.)
4137 */
4138void
4139bte_terminal_set_cjk_ambiguous_width(BteTerminal *terminal, int width) noexcept
4140try
4141{
4142 g_return_if_fail(BTE_IS_TERMINAL(terminal))do { if ((__builtin_expect (__extension__ ({ int _g_boolean_var_
; if ((((__extension__ ({ GTypeInstance *__inst = (GTypeInstance
*) ((terminal)); GType __t = ((bte_terminal_get_type())); gboolean
__r; if (!__inst) __r = (0); else if (__inst->g_class &&
__inst->g_class->g_type == __t) __r = (!(0)); else __r
= g_type_check_instance_is_a (__inst, __t); __r; }))))) _g_boolean_var_
= 1; else _g_boolean_var_ = 0; _g_boolean_var_; }), 1))) { }
else { g_return_if_fail_warning ("BTE", ((const char*) (__PRETTY_FUNCTION__
)), "BTE_IS_TERMINAL(terminal)"); return; } } while (0)
;
4143 g_return_if_fail(width == 1 || width == 2)do { if ((__builtin_expect (__extension__ ({ int _g_boolean_var_
; if (width == 1 || width == 2) _g_boolean_var_ = 1; else _g_boolean_var_
= 0; _g_boolean_var_; }), 1))) { } else { g_return_if_fail_warning
("BTE", ((const char*) (__PRETTY_FUNCTION__)), "width == 1 || width == 2"
); return; } } while (0)
;
4144
4145 if (IMPL(terminal)(_bte_terminal_get_impl(terminal))->set_cjk_ambiguous_width(width))
4146 g_object_notify_by_pspec(G_OBJECT(terminal)((((GObject*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((terminal)), (((GType) ((20) << (2))))))))
, pspecs[PROP_CJK_AMBIGUOUS_WIDTH]);
4147}
4148catch (...)
4149{
4150 bte::log_exception();
4151}
4152
4153/**
4154 * bte_terminal_set_color_background:
4155 * @terminal: a #BteTerminal
4156 * @background: the new background color
4157 *
4158 * Sets the background color for text which does not have a specific background
4159 * color assigned. Only has effect when no background image is set and when
4160 * the terminal is not transparent.
4161 */
4162void
4163bte_terminal_set_color_background(BteTerminal *terminal,
4164 const CdkRGBA *background) noexcept
4165try
4166{
4167 g_return_if_fail(BTE_IS_TERMINAL(terminal))do { if ((__builtin_expect (__extension__ ({ int _g_boolean_var_
; if ((((__extension__ ({ GTypeInstance *__inst = (GTypeInstance
*) ((terminal)); GType __t = ((bte_terminal_get_type())); gboolean
__r; if (!__inst) __r = (0); else if (__inst->g_class &&
__inst->g_class->g_type == __t) __r = (!(0)); else __r
= g_type_check_instance_is_a (__inst, __t); __r; }))))) _g_boolean_var_
= 1; else _g_boolean_var_ = 0; _g_boolean_var_; }), 1))) { }
else { g_return_if_fail_warning ("BTE", ((const char*) (__PRETTY_FUNCTION__
)), "BTE_IS_TERMINAL(terminal)"); return; } } while (0)
;
4168 g_return_if_fail(background != NULL)do { if ((__builtin_expect (__extension__ ({ int _g_boolean_var_
; if (background != __null) _g_boolean_var_ = 1; else _g_boolean_var_
= 0; _g_boolean_var_; }), 1))) { } else { g_return_if_fail_warning
("BTE", ((const char*) (__PRETTY_FUNCTION__)), "background != NULL"
); return; } } while (0)
;
4169 g_return_if_fail(valid_color(background))do { if ((__builtin_expect (__extension__ ({ int _g_boolean_var_
; if (valid_color(background)) _g_boolean_var_ = 1; else _g_boolean_var_
= 0; _g_boolean_var_; }), 1))) { } else { g_return_if_fail_warning
("BTE", ((const char*) (__PRETTY_FUNCTION__)), "valid_color(background)"
); return; } } while (0)
;
4170
4171 auto impl = IMPL(terminal)(_bte_terminal_get_impl(terminal));
4172 impl->set_color_background(bte::color::rgb(background));
4173 impl->set_background_alpha(background->alpha);
4174}
4175catch (...)
4176{
4177 bte::log_exception();
4178}
4179
4180/**
4181 * bte_terminal_set_color_bold:
4182 * @terminal: a #BteTerminal
4183 * @bold: (allow-none): the new bold color or %NULL
4184 *
4185 * Sets the color used to draw bold text in the default foreground color.
4186 * If @bold is %NULL then the default color is used.
4187 */
4188void
4189bte_terminal_set_color_bold(BteTerminal *terminal,
4190 const CdkRGBA *bold) noexcept
4191try
4192{
4193 g_return_if_fail(BTE_IS_TERMINAL(terminal))do { if ((__builtin_expect (__extension__ ({ int _g_boolean_var_
; if ((((__extension__ ({ GTypeInstance *__inst = (GTypeInstance
*) ((terminal)); GType __t = ((bte_terminal_get_type())); gboolean
__r; if (!__inst) __r = (0); else if (__inst->g_class &&
__inst->g_class->g_type == __t) __r = (!(0)); else __r
= g_type_check_instance_is_a (__inst, __t); __r; }))))) _g_boolean_var_
= 1; else _g_boolean_var_ = 0; _g_boolean_var_; }), 1))) { }
else { g_return_if_fail_warning ("BTE", ((const char*) (__PRETTY_FUNCTION__
)), "BTE_IS_TERMINAL(terminal)"); return; } } while (0)
;
4194 g_return_if_fail(bold == nullptr || valid_color(bold))do { if ((__builtin_expect (__extension__ ({ int _g_boolean_var_
; if (bold == nullptr || valid_color(bold)) _g_boolean_var_ =
1; else _g_boolean_var_ = 0; _g_boolean_var_; }), 1))) { } else
{ g_return_if_fail_warning ("BTE", ((const char*) (__PRETTY_FUNCTION__
)), "bold == nullptr || valid_color(bold)"); return; } } while
(0)
;
4195
4196 auto impl = IMPL(terminal)(_bte_terminal_get_impl(terminal));
4197 if (bold)
4198 impl->set_color_bold(bte::color::rgb(bold));
4199 else
4200 impl->reset_color_bold();
4201}
4202catch (...)
4203{
4204 bte::log_exception();
4205}
4206
4207/**
4208 * bte_terminal_set_color_cursor:
4209 * @terminal: a #BteTerminal
4210 * @cursor_background: (allow-none): the new color to use for the text cursor, or %NULL
4211 *
4212 * Sets the background color for text which is under the cursor. If %NULL, text
4213 * under the cursor will be drawn with foreground and background colors
4214 * reversed.
4215 */
4216void
4217bte_terminal_set_color_cursor(BteTerminal *terminal,
4218 const CdkRGBA *cursor_background) noexcept
4219try
4220{
4221 g_return_if_fail(BTE_IS_TERMINAL(terminal))do { if ((__builtin_expect (__extension__ ({ int _g_boolean_var_
; if ((((__extension__ ({ GTypeInstance *__inst = (GTypeInstance
*) ((terminal)); GType __t = ((bte_terminal_get_type())); gboolean
__r; if (!__inst) __r = (0); else if (__inst->g_class &&
__inst->g_class->g_type == __t) __r = (!(0)); else __r
= g_type_check_instance_is_a (__inst, __t); __r; }))))) _g_boolean_var_
= 1; else _g_boolean_var_ = 0; _g_boolean_var_; }), 1))) { }
else { g_return_if_fail_warning ("BTE", ((const char*) (__PRETTY_FUNCTION__
)), "BTE_IS_TERMINAL(terminal)"); return; } } while (0)
;
4222 g_return_if_fail(cursor_background == nullptr || valid_color(cursor_background))do { if ((__builtin_expect (__extension__ ({ int _g_boolean_var_
; if (cursor_background == nullptr || valid_color(cursor_background
)) _g_boolean_var_ = 1; else _g_boolean_var_ = 0; _g_boolean_var_
; }), 1))) { } else { g_return_if_fail_warning ("BTE", ((const
char*) (__PRETTY_FUNCTION__)), "cursor_background == nullptr || valid_color(cursor_background)"
); return; } } while (0)
;
4223
4224 auto impl = IMPL(terminal)(_bte_terminal_get_impl(terminal));
4225 if (cursor_background)
4226 impl->set_color_cursor_background(bte::color::rgb(cursor_background));
4227 else
4228 impl->reset_color_cursor_background();
4229}
4230catch (...)
4231{
4232 bte::log_exception();
4233}
4234
4235/**
4236 * bte_terminal_set_color_cursor_foreground:
4237 * @terminal: a #BteTerminal
4238 * @cursor_foreground: (allow-none): the new color to use for the text cursor, or %NULL
4239 *
4240 * Sets the foreground color for text which is under the cursor. If %NULL, text
4241 * under the cursor will be drawn with foreground and background colors
4242 * reversed.
4243 *
4244 * Since: 0.44
4245 */
4246void
4247bte_terminal_set_color_cursor_foreground(BteTerminal *terminal,
4248 const CdkRGBA *cursor_foreground) noexcept
4249try
4250{
4251 g_return_if_fail(BTE_IS_TERMINAL(terminal))do { if ((__builtin_expect (__extension__ ({ int _g_boolean_var_
; if ((((__extension__ ({ GTypeInstance *__inst = (GTypeInstance
*) ((terminal)); GType __t = ((bte_terminal_get_type())); gboolean
__r; if (!__inst) __r = (0); else if (__inst->g_class &&
__inst->g_class->g_type == __t) __r = (!(0)); else __r
= g_type_check_instance_is_a (__inst, __t); __r; }))))) _g_boolean_var_
= 1; else _g_boolean_var_ = 0; _g_boolean_var_; }), 1))) { }
else { g_return_if_fail_warning ("BTE", ((const char*) (__PRETTY_FUNCTION__
)), "BTE_IS_TERMINAL(terminal)"); return; } } while (0)
;
4252 g_return_if_fail(cursor_foreground == nullptr || valid_color(cursor_foreground))do { if ((__builtin_expect (__extension__ ({ int _g_boolean_var_
; if (cursor_foreground == nullptr || valid_color(cursor_foreground
)) _g_boolean_var_ = 1; else _g_boolean_var_ = 0; _g_boolean_var_
; }), 1))) { } else { g_return_if_fail_warning ("BTE", ((const
char*) (__PRETTY_FUNCTION__)), "cursor_foreground == nullptr || valid_color(cursor_foreground)"
); return; } } while (0)
;
4253
4254 auto impl = IMPL(terminal)(_bte_terminal_get_impl(terminal));
4255 if (cursor_foreground)
4256 impl->set_color_cursor_foreground(bte::color::rgb(cursor_foreground));
4257 else
4258 impl->reset_color_cursor_foreground();
4259}
4260catch (...)
4261{
4262 bte::log_exception();
4263}
4264
4265/**
4266 * bte_terminal_set_color_foreground:
4267 * @terminal: a #BteTerminal
4268 * @foreground: the new foreground color
4269 *
4270 * Sets the foreground color used to draw normal text.
4271 */
4272void
4273bte_terminal_set_color_foreground(BteTerminal *terminal,
4274 const CdkRGBA *foreground) noexcept
4275try
4276{
4277 g_return_if_fail(BTE_IS_TERMINAL(terminal))do { if ((__builtin_expect (__extension__ ({ int _g_boolean_var_
; if ((((__extension__ ({ GTypeInstance *__inst = (GTypeInstance
*) ((terminal)); GType __t = ((bte_terminal_get_type())); gboolean
__r; if (!__inst) __r = (0); else if (__inst->g_class &&
__inst->g_class->g_type == __t) __r = (!(0)); else __r
= g_type_check_instance_is_a (__inst, __t); __r; }))))) _g_boolean_var_
= 1; else _g_boolean_var_ = 0; _g_boolean_var_; }), 1))) { }
else { g_return_if_fail_warning ("BTE", ((const char*) (__PRETTY_FUNCTION__
)), "BTE_IS_TERMINAL(terminal)"); return; } } while (0)
;
4278 g_return_if_fail(foreground != nullptr)do { if ((__builtin_expect (__extension__ ({ int _g_boolean_var_
; if (foreground != nullptr) _g_boolean_var_ = 1; else _g_boolean_var_
= 0; _g_boolean_var_; }), 1))) { } else { g_return_if_fail_warning
("BTE", ((const char*) (__PRETTY_FUNCTION__)), "foreground != nullptr"
); return; } } while (0)
;
4279 g_return_if_fail(valid_color(foreground))do { if ((__builtin_expect (__extension__ ({ int _g_boolean_var_
; if (valid_color(foreground)) _g_boolean_var_ = 1; else _g_boolean_var_
= 0; _g_boolean_var_; }), 1))) { } else { g_return_if_fail_warning
("BTE", ((const char*) (__PRETTY_FUNCTION__)), "valid_color(foreground)"
); return; } } while (0)
;
4280
4281 IMPL(terminal)(_bte_terminal_get_impl(terminal))->set_color_foreground(bte::color::rgb(foreground));
4282}
4283catch (...)
4284{
4285 bte::log_exception();
4286}
4287
4288/**
4289 * bte_terminal_set_color_highlight:
4290 * @terminal: a #BteTerminal
4291 * @highlight_background: (allow-none): the new color to use for highlighted text, or %NULL
4292 *
4293 * Sets the background color for text which is highlighted. If %NULL,
4294 * it is unset. If neither highlight background nor highlight foreground are set,
4295 * highlighted text (which is usually highlighted because it is selected) will
4296 * be drawn with foreground and background colors reversed.
4297 */
4298void
4299bte_terminal_set_color_highlight(BteTerminal *terminal,
4300 const CdkRGBA *highlight_background) noexcept
4301try
4302{
4303 g_return_if_fail(BTE_IS_TERMINAL(terminal))do { if ((__builtin_expect (__extension__ ({ int _g_boolean_var_
; if ((((__extension__ ({ GTypeInstance *__inst = (GTypeInstance
*) ((terminal)); GType __t = ((bte_terminal_get_type())); gboolean
__r; if (!__inst) __r = (0); else if (__inst->g_class &&
__inst->g_class->g_type == __t) __r = (!(0)); else __r
= g_type_check_instance_is_a (__inst, __t); __r; }))))) _g_boolean_var_
= 1; else _g_boolean_var_ = 0; _g_boolean_var_; }), 1))) { }
else { g_return_if_fail_warning ("BTE", ((const char*) (__PRETTY_FUNCTION__
)), "BTE_IS_TERMINAL(terminal)"); return; } } while (0)
;
4304 g_return_if_fail(highlight_background == nullptr || valid_color(highlight_background))do { if ((__builtin_expect (__extension__ ({ int _g_boolean_var_
; if (highlight_background == nullptr || valid_color(highlight_background
)) _g_boolean_var_ = 1; else _g_boolean_var_ = 0; _g_boolean_var_
; }), 1))) { } else { g_return_if_fail_warning ("BTE", ((const
char*) (__PRETTY_FUNCTION__)), "highlight_background == nullptr || valid_color(highlight_background)"
); return; } } while (0)
;
4305
4306 auto impl = IMPL(terminal)(_bte_terminal_get_impl(terminal));
4307 if (highlight_background)
4308 impl->set_color_highlight_background(bte::color::rgb(highlight_background));
4309 else
4310 impl->reset_color_highlight_background();
4311}
4312catch (...)
4313{
4314 bte::log_exception();
4315}
4316
4317/**
4318 * bte_terminal_set_color_highlight_foreground:
4319 * @terminal: a #BteTerminal
4320 * @highlight_foreground: (allow-none): the new color to use for highlighted text, or %NULL
4321 *
4322 * Sets the foreground color for text which is highlighted. If %NULL,
4323 * it is unset. If neither highlight background nor highlight foreground are set,
4324 * highlighted text (which is usually highlighted because it is selected) will
4325 * be drawn with foreground and background colors reversed.
4326 */
4327void
4328bte_terminal_set_color_highlight_foreground(BteTerminal *terminal,
4329 const CdkRGBA *highlight_foreground) noexcept
4330try
4331{
4332 g_return_if_fail(BTE_IS_TERMINAL(terminal))do { if ((__builtin_expect (__extension__ ({ int _g_boolean_var_
; if ((((__extension__ ({ GTypeInstance *__inst = (GTypeInstance
*) ((terminal)); GType __t = ((bte_terminal_get_type())); gboolean
__r; if (!__inst) __r = (0); else if (__inst->g_class &&
__inst->g_class->g_type == __t) __r = (!(0)); else __r
= g_type_check_instance_is_a (__inst, __t); __r; }))))) _g_boolean_var_
= 1; else _g_boolean_var_ = 0; _g_boolean_var_; }), 1))) { }
else { g_return_if_fail_warning ("BTE", ((const char*) (__PRETTY_FUNCTION__
)), "BTE_IS_TERMINAL(terminal)"); return; } } while (0)
;
4333 g_return_if_fail(highlight_foreground == nullptr || valid_color(highlight_foreground))do { if ((__builtin_expect (__extension__ ({ int _g_boolean_var_
; if (highlight_foreground == nullptr || valid_color(highlight_foreground
)) _g_boolean_var_ = 1; else _g_boolean_var_ = 0; _g_boolean_var_
; }), 1))) { } else { g_return_if_fail_warning ("BTE", ((const
char*) (__PRETTY_FUNCTION__)), "highlight_foreground == nullptr || valid_color(highlight_foreground)"
); return; } } while (0)
;
4334
4335 auto impl = IMPL(terminal)(_bte_terminal_get_impl(terminal));
4336 if (highlight_foreground)
4337 impl->set_color_highlight_foreground(bte::color::rgb(highlight_foreground));
4338 else
4339 impl->reset_color_highlight_foreground();
4340}
4341catch (...)
4342{
4343 bte::log_exception();
4344}
4345
4346/**
4347 * bte_terminal_set_colors:
4348 * @terminal: a #BteTerminal
4349 * @foreground: (allow-none): the new foreground color, or %NULL
4350 * @background: (allow-none): the new background color, or %NULL
4351 * @palette: (array length=palette_size zero-terminated=0) (element-type Cdk.RGBA) (allow-none): the color palette
4352 * @palette_size: the number of entries in @palette
4353 *
4354 * @palette specifies the new values for the 256 palette colors: 8 standard colors,
4355 * their 8 bright counterparts, 6x6x6 color cube, and 24 grayscale colors.
4356 * Omitted entries will default to a hardcoded value.
4357 *
4358 * @palette_size must be 0, 8, 16, 232 or 256.
4359 *
4360 * If @foreground is %NULL and @palette_size is greater than 0, the new foreground
4361 * color is taken from @palette[7]. If @background is %NULL and @palette_size is
4362 * greater than 0, the new background color is taken from @palette[0].
4363 */
4364void
4365bte_terminal_set_colors(BteTerminal *terminal,
4366 const CdkRGBA *foreground,
4367 const CdkRGBA *background,
4368 const CdkRGBA *palette,
4369 gsize palette_size) noexcept
4370try
4371{
4372 g_return_if_fail(BTE_IS_TERMINAL(terminal))do { if ((__builtin_expect (__extension__ ({ int _g_boolean_var_
; if ((((__extension__ ({ GTypeInstance *__inst = (GTypeInstance
*) ((terminal)); GType __t = ((bte_terminal_get_type())); gboolean
__r; if (!__inst) __r = (0); else if (__inst->g_class &&
__inst->g_class->g_type == __t) __r = (!(0)); else __r
= g_type_check_instance_is_a (__inst, __t); __r; }))))) _g_boolean_var_
= 1; else _g_boolean_var_ = 0; _g_boolean_var_; }), 1))) { }
else { g_return_if_fail_warning ("BTE", ((const char*) (__PRETTY_FUNCTION__
)), "BTE_IS_TERMINAL(terminal)"); return; } } while (0)
;
4373 g_return_if_fail((palette_size == 0) ||do { if ((__builtin_expect (__extension__ ({ int _g_boolean_var_
; if ((palette_size == 0) || (palette_size == 8) || (palette_size
== 16) || (palette_size == 232) || (palette_size == 256)) _g_boolean_var_
= 1; else _g_boolean_var_ = 0; _g_boolean_var_; }), 1))) { }
else { g_return_if_fail_warning ("BTE", ((const char*) (__PRETTY_FUNCTION__
)), "(palette_size == 0) || (palette_size == 8) || (palette_size == 16) || (palette_size == 232) || (palette_size == 256)"
); return; } } while (0)
4374 (palette_size == 8) ||do { if ((__builtin_expect (__extension__ ({ int _g_boolean_var_
; if ((palette_size == 0) || (palette_size == 8) || (palette_size
== 16) || (palette_size == 232) || (palette_size == 256)) _g_boolean_var_
= 1; else _g_boolean_var_ = 0; _g_boolean_var_; }), 1))) { }
else { g_return_if_fail_warning ("BTE", ((const char*) (__PRETTY_FUNCTION__
)), "(palette_size == 0) || (palette_size == 8) || (palette_size == 16) || (palette_size == 232) || (palette_size == 256)"
); return; } } while (0)
4375 (palette_size == 16) ||do { if ((__builtin_expect (__extension__ ({ int _g_boolean_var_
; if ((palette_size == 0) || (palette_size == 8) || (palette_size
== 16) || (palette_size == 232) || (palette_size == 256)) _g_boolean_var_
= 1; else _g_boolean_var_ = 0; _g_boolean_var_; }), 1))) { }
else { g_return_if_fail_warning ("BTE", ((const char*) (__PRETTY_FUNCTION__
)), "(palette_size == 0) || (palette_size == 8) || (palette_size == 16) || (palette_size == 232) || (palette_size == 256)"
); return; } } while (0)
4376 (palette_size == 232) ||do { if ((__builtin_expect (__extension__ ({ int _g_boolean_var_
; if ((palette_size == 0) || (palette_size == 8) || (palette_size
== 16) || (palette_size == 232) || (palette_size == 256)) _g_boolean_var_
= 1; else _g_boolean_var_ = 0; _g_boolean_var_; }), 1))) { }
else { g_return_if_fail_warning ("BTE", ((const char*) (__PRETTY_FUNCTION__
)), "(palette_size == 0) || (palette_size == 8) || (palette_size == 16) || (palette_size == 232) || (palette_size == 256)"
); return; } } while (0)
4377 (palette_size == 256))do { if ((__builtin_expect (__extension__ ({ int _g_boolean_var_
; if ((palette_size == 0) || (palette_size == 8) || (palette_size
== 16) || (palette_size == 232) || (palette_size == 256)) _g_boolean_var_
= 1; else _g_boolean_var_ = 0; _g_boolean_var_; }), 1))) { }
else { g_return_if_fail_warning ("BTE", ((const char*) (__PRETTY_FUNCTION__
)), "(palette_size == 0) || (palette_size == 8) || (palette_size == 16) || (palette_size == 232) || (palette_size == 256)"
); return; } } while (0)
;
4378 g_return_if_fail(foreground == nullptr || valid_color(foreground))do { if ((__builtin_expect (__extension__ ({ int _g_boolean_var_
; if (foreground == nullptr || valid_color(foreground)) _g_boolean_var_
= 1; else _g_boolean_var_ = 0; _g_boolean_var_; }), 1))) { }
else { g_return_if_fail_warning ("BTE", ((const char*) (__PRETTY_FUNCTION__
)), "foreground == nullptr || valid_color(foreground)"); return
; } } while (0)
;
4379 g_return_if_fail(background == nullptr || valid_color(background))do { if ((__builtin_expect (__extension__ ({ int _g_boolean_var_
; if (background == nullptr || valid_color(background)) _g_boolean_var_
= 1; else _g_boolean_var_ = 0; _g_boolean_var_; }), 1))) { }
else { g_return_if_fail_warning ("BTE", ((const char*) (__PRETTY_FUNCTION__
)), "background == nullptr || valid_color(background)"); return
; } } while (0)
;
4380 for (gsize i = 0; i < palette_size; ++i)
4381 g_return_if_fail(valid_color(&palette[i]))do { if ((__builtin_expect (__extension__ ({ int _g_boolean_var_
; if (valid_color(&palette[i])) _g_boolean_var_ = 1; else
_g_boolean_var_ = 0; _g_boolean_var_; }), 1))) { } else { g_return_if_fail_warning
("BTE", ((const char*) (__PRETTY_FUNCTION__)), "valid_color(&palette[i])"
); return; } } while (0)
;
4382
4383 bte::color::rgb fg;
4384 if (foreground)
4385 fg = bte::color::rgb(foreground);
4386 bte::color::rgb bg;
4387 if (background)
4388 bg = bte::color::rgb(background);
4389
4390 bte::color::rgb* pal = nullptr;
4391 if (palette_size) {
4392 pal = g_new0(bte::color::rgb, palette_size)(bte::color::rgb *) (__extension__ ({ gsize __n = (gsize) (palette_size
); gsize __s = sizeof (bte::color::rgb); gpointer __p; if (__s
== 1) __p = g_malloc0 (__n); else if (__builtin_constant_p (
__n) && (__s == 0 || __n <= (9223372036854775807L *
2UL+1UL) / __s)) __p = g_malloc0 (__n * __s); else __p = g_malloc0_n
(__n, __s); __p; }))
;
4393 for (gsize i = 0; i < palette_size; ++i)
4394 pal[i] = bte::color::rgb(palette[i]);
4395 }
4396
4397 auto impl = IMPL(terminal)(_bte_terminal_get_impl(terminal));
4398 impl->set_colors(foreground ? &fg : nullptr,
4399 background ? &bg : nullptr,
4400 pal, palette_size);
4401 impl->set_background_alpha(background ? background->alpha : 1.0);
4402 g_free(pal);
4403}
4404catch (...)
4405{
4406 bte::log_exception();
4407}
4408
4409/**
4410 * bte_terminal_set_default_colors:
4411 * @terminal: a #BteTerminal
4412 *
4413 * Reset the terminal palette to reasonable compiled-in default color.
4414 */
4415void
4416bte_terminal_set_default_colors(BteTerminal *terminal) noexcept
4417try
4418{
4419 g_return_if_fail(BTE_IS_TERMINAL(terminal))do { if ((__builtin_expect (__extension__ ({ int _g_boolean_var_
; if ((((__extension__ ({ GTypeInstance *__inst = (GTypeInstance
*) ((terminal)); GType __t = ((bte_terminal_get_type())); gboolean
__r; if (!__inst) __r = (0); else if (__inst->g_class &&
__inst->g_class->g_type == __t) __r = (!(0)); else __r
= g_type_check_instance_is_a (__inst, __t); __r; }))))) _g_boolean_var_
= 1; else _g_boolean_var_ = 0; _g_boolean_var_; }), 1))) { }
else { g_return_if_fail_warning ("BTE", ((const char*) (__PRETTY_FUNCTION__
)), "BTE_IS_TERMINAL(terminal)"); return; } } while (0)
;
4420 IMPL(terminal)(_bte_terminal_get_impl(terminal))->set_colors_default();
4421}
4422catch (...)
4423{
4424 bte::log_exception();
4425}
4426
4427/**
4428 * bte_terminal_get_column_count:
4429 * @terminal: a #BteTerminal
4430 *
4431 * Returns: the number of columns
4432 */
4433glong
4434bte_terminal_get_column_count(BteTerminal *terminal) noexcept
4435try
4436{
4437 g_return_val_if_fail(BTE_IS_TERMINAL(terminal), -1)do { if ((__builtin_expect (__extension__ ({ int _g_boolean_var_
; if ((((__extension__ ({ GTypeInstance *__inst = (GTypeInstance
*) ((terminal)); GType __t = ((bte_terminal_get_type())); gboolean
__r; if (!__inst) __r = (0); else if (__inst->g_class &&
__inst->g_class->g_type == __t) __r = (!(0)); else __r
= g_type_check_instance_is_a (__inst, __t); __r; }))))) _g_boolean_var_
= 1; else _g_boolean_var_ = 0; _g_boolean_var_; }), 1))) { }
else { g_return_if_fail_warning ("BTE", ((const char*) (__PRETTY_FUNCTION__
)), "BTE_IS_TERMINAL(terminal)"); return (-1); } } while (0)
;
4438 return IMPL(terminal)(_bte_terminal_get_impl(terminal))->m_column_count;
4439}
4440catch (...)
4441{
4442 bte::log_exception();
4443 return -1;
4444}
4445
4446/**
4447 * bte_terminal_get_current_directory_uri:
4448 * @terminal: a #BteTerminal
4449 *
4450 * Returns: (nullable) (transfer none): the URI of the current directory of the
4451 * process running in the terminal, or %NULL
4452 */
4453const char *
4454bte_terminal_get_current_directory_uri(BteTerminal *terminal) noexcept
4455try
4456{
4457 g_return_val_if_fail(BTE_IS_TERMINAL(terminal), NULL)do { if ((__builtin_expect (__extension__ ({ int _g_boolean_var_
; if ((((__extension__ ({ GTypeInstance *__inst = (GTypeInstance
*) ((terminal)); GType __t = ((bte_terminal_get_type())); gboolean
__r; if (!__inst) __r = (0); else if (__inst->g_class &&
__inst->g_class->g_type == __t) __r = (!(0)); else __r
= g_type_check_instance_is_a (__inst, __t); __r; }))))) _g_boolean_var_
= 1; else _g_boolean_var_ = 0; _g_boolean_var_; }), 1))) { }
else { g_return_if_fail_warning ("BTE", ((const char*) (__PRETTY_FUNCTION__
)), "BTE_IS_TERMINAL(terminal)"); return (__null); } } while (
0)
;
4458 auto impl = IMPL(terminal)(_bte_terminal_get_impl(terminal));
4459 return impl->m_current_directory_uri.size() ? impl->m_current_directory_uri.data() : nullptr;
4460}
4461catch (...)
4462{
4463 bte::log_exception();
4464 return nullptr;
4465}
4466
4467/**
4468 * bte_terminal_get_current_file_uri:
4469 * @terminal: a #BteTerminal
4470 *
4471 * Returns: (nullable) (transfer none): the URI of the current file the
4472 * process running in the terminal is operating on, or %NULL if
4473 * not set
4474 */
4475const char *
4476bte_terminal_get_current_file_uri(BteTerminal *terminal) noexcept
4477try
4478{
4479 g_return_val_if_fail(BTE_IS_TERMINAL(terminal), NULL)do { if ((__builtin_expect (__extension__ ({ int _g_boolean_var_
; if ((((__extension__ ({ GTypeInstance *__inst = (GTypeInstance
*) ((terminal)); GType __t = ((bte_terminal_get_type())); gboolean
__r; if (!__inst) __r = (0); else if (__inst->g_class &&
__inst->g_class->g_type == __t) __r = (!(0)); else __r
= g_type_check_instance_is_a (__inst, __t); __r; }))))) _g_boolean_var_
= 1; else _g_boolean_var_ = 0; _g_boolean_var_; }), 1))) { }
else { g_return_if_fail_warning ("BTE", ((const char*) (__PRETTY_FUNCTION__
)), "BTE_IS_TERMINAL(terminal)"); return (__null); } } while (
0)
;
4480 auto impl = IMPL(terminal)(_bte_terminal_get_impl(terminal));
4481 return impl->m_current_file_uri.size() ? impl->m_current_file_uri.data() : nullptr;
4482}
4483catch (...)
4484{
4485 bte::log_exception();
4486 return nullptr;
4487}
4488
4489/**
4490 * bte_terminal_get_cursor_blink_mode:
4491 * @terminal: a #BteTerminal
4492 *
4493 * Returns the currently set cursor blink mode.
4494 *
4495 * Return value: cursor blink mode.
4496 */
4497BteCursorBlinkMode
4498bte_terminal_get_cursor_blink_mode(BteTerminal *terminal) noexcept
4499try
4500{
4501 g_return_val_if_fail(BTE_IS_TERMINAL(terminal), BTE_CURSOR_BLINK_SYSTEM)do { if ((__builtin_expect (__extension__ ({ int _g_boolean_var_
; if ((((__extension__ ({ GTypeInstance *__inst = (GTypeInstance
*) ((terminal)); GType __t = ((bte_terminal_get_type())); gboolean
__r; if (!__inst) __r = (0); else if (__inst->g_class &&
__inst->g_class->g_type == __t) __r = (!(0)); else __r
= g_type_check_instance_is_a (__inst, __t); __r; }))))) _g_boolean_var_
= 1; else _g_boolean_var_ = 0; _g_boolean_var_; }), 1))) { }
else { g_return_if_fail_warning ("BTE", ((const char*) (__PRETTY_FUNCTION__
)), "BTE_IS_TERMINAL(terminal)"); return (BTE_CURSOR_BLINK_SYSTEM
); } } while (0)
;
4502
4503 return WIDGET(terminal)(get_widget(terminal))->cursor_blink_mode();
4504}
4505catch (...)
4506{
4507 bte::log_exception();
4508 return BTE_CURSOR_BLINK_SYSTEM;
4509}
4510
4511/**
4512 * bte_terminal_set_cursor_blink_mode:
4513 * @terminal: a #BteTerminal
4514 * @mode: the #BteCursorBlinkMode to use
4515 *
4516 * Sets whether or not the cursor will blink. Using %BTE_CURSOR_BLINK_SYSTEM
4517 * will use the #CtkSettings::ctk-cursor-blink setting.
4518 */
4519void
4520bte_terminal_set_cursor_blink_mode(BteTerminal *terminal,
4521 BteCursorBlinkMode mode) noexcept
4522try
4523{
4524 g_return_if_fail(BTE_IS_TERMINAL(terminal))do { if ((__builtin_expect (__extension__ ({ int _g_boolean_var_
; if ((((__extension__ ({ GTypeInstance *__inst = (GTypeInstance
*) ((terminal)); GType __t = ((bte_terminal_get_type())); gboolean
__r; if (!__inst) __r = (0); else if (__inst->g_class &&
__inst->g_class->g_type == __t) __r = (!(0)); else __r
= g_type_check_instance_is_a (__inst, __t); __r; }))))) _g_boolean_var_
= 1; else _g_boolean_var_ = 0; _g_boolean_var_; }), 1))) { }
else { g_return_if_fail_warning ("BTE", ((const char*) (__PRETTY_FUNCTION__
)), "BTE_IS_TERMINAL(terminal)"); return; } } while (0)
;
4525 g_return_if_fail(mode >= BTE_CURSOR_BLINK_SYSTEM && mode <= BTE_CURSOR_BLINK_OFF)do { if ((__builtin_expect (__extension__ ({ int _g_boolean_var_
; if (mode >= BTE_CURSOR_BLINK_SYSTEM && mode <=
BTE_CURSOR_BLINK_OFF) _g_boolean_var_ = 1; else _g_boolean_var_
= 0; _g_boolean_var_; }), 1))) { } else { g_return_if_fail_warning
("BTE", ((const char*) (__PRETTY_FUNCTION__)), "mode >= BTE_CURSOR_BLINK_SYSTEM && mode <= BTE_CURSOR_BLINK_OFF"
); return; } } while (0)
;
4526
4527 if (WIDGET(terminal)(get_widget(terminal))->set_cursor_blink_mode(mode))
4528 g_object_notify_by_pspec(G_OBJECT(terminal)((((GObject*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((terminal)), (((GType) ((20) << (2))))))))
, pspecs[PROP_CURSOR_BLINK_MODE]);
4529}
4530catch (...)
4531{
4532 bte::log_exception();
4533}
4534
4535/**
4536 * bte_terminal_get_cursor_shape:
4537 * @terminal: a #BteTerminal
4538 *
4539 * Returns the currently set cursor shape.
4540 *
4541 * Return value: cursor shape.
4542 */
4543BteCursorShape
4544bte_terminal_get_cursor_shape(BteTerminal *terminal) noexcept
4545try
4546{
4547 g_return_val_if_fail(BTE_IS_TERMINAL(terminal), BTE_CURSOR_SHAPE_BLOCK)do { if ((__builtin_expect (__extension__ ({ int _g_boolean_var_
; if ((((__extension__ ({ GTypeInstance *__inst = (GTypeInstance
*) ((terminal)); GType __t = ((bte_terminal_get_type())); gboolean
__r; if (!__inst) __r = (0); else if (__inst->g_class &&
__inst->g_class->g_type == __t) __r = (!(0)); else __r
= g_type_check_instance_is_a (__inst, __t); __r; }))))) _g_boolean_var_
= 1; else _g_boolean_var_ = 0; _g_boolean_var_; }), 1))) { }
else { g_return_if_fail_warning ("BTE", ((const char*) (__PRETTY_FUNCTION__
)), "BTE_IS_TERMINAL(terminal)"); return (BTE_CURSOR_SHAPE_BLOCK
); } } while (0)
;
4548
4549 return WIDGET(terminal)(get_widget(terminal))->cursor_shape();
4550}
4551catch (...)
4552{
4553 bte::log_exception();
4554 return BTE_CURSOR_SHAPE_BLOCK;
4555}
4556
4557/**
4558 * bte_terminal_set_cursor_shape:
4559 * @terminal: a #BteTerminal
4560 * @shape: the #BteCursorShape to use
4561 *
4562 * Sets the shape of the cursor drawn.
4563 */
4564void
4565bte_terminal_set_cursor_shape(BteTerminal *terminal,
4566 BteCursorShape shape) noexcept
4567try
4568{
4569 g_return_if_fail(BTE_IS_TERMINAL(terminal))do { if ((__builtin_expect (__extension__ ({ int _g_boolean_var_
; if ((((__extension__ ({ GTypeInstance *__inst = (GTypeInstance
*) ((terminal)); GType __t = ((bte_terminal_get_type())); gboolean
__r; if (!__inst) __r = (0); else if (__inst->g_class &&
__inst->g_class->g_type == __t) __r = (!(0)); else __r
= g_type_check_instance_is_a (__inst, __t); __r; }))))) _g_boolean_var_
= 1; else _g_boolean_var_ = 0; _g_boolean_var_; }), 1))) { }
else { g_return_if_fail_warning ("BTE", ((const char*) (__PRETTY_FUNCTION__
)), "BTE_IS_TERMINAL(terminal)"); return; } } while (0)
;
4570 g_return_if_fail(shape >= BTE_CURSOR_SHAPE_BLOCK && shape <= BTE_CURSOR_SHAPE_UNDERLINE)do { if ((__builtin_expect (__extension__ ({ int _g_boolean_var_
; if (shape >= BTE_CURSOR_SHAPE_BLOCK && shape <=
BTE_CURSOR_SHAPE_UNDERLINE) _g_boolean_var_ = 1; else _g_boolean_var_
= 0; _g_boolean_var_; }), 1))) { } else { g_return_if_fail_warning
("BTE", ((const char*) (__PRETTY_FUNCTION__)), "shape >= BTE_CURSOR_SHAPE_BLOCK && shape <= BTE_CURSOR_SHAPE_UNDERLINE"
); return; } } while (0)
;
4571
4572 if (WIDGET(terminal)(get_widget(terminal))->set_cursor_shape(shape))
4573 g_object_notify_by_pspec(G_OBJECT(terminal)((((GObject*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((terminal)), (((GType) ((20) << (2))))))))
, pspecs[PROP_CURSOR_SHAPE]);
4574}
4575catch (...)
4576{
4577 bte::log_exception();
4578}
4579
4580/**
4581 * bte_terminal_set_delete_binding:
4582 * @terminal: a #BteTerminal
4583 * @binding: a #BteEraseBinding for the delete key
4584 *
4585 * Modifies the terminal's delete key binding, which controls what
4586 * string or control sequence the terminal sends to its child when the user
4587 * presses the delete key.
4588 */
4589void
4590bte_terminal_set_delete_binding(BteTerminal *terminal,
4591 BteEraseBinding binding) noexcept
4592try
4593{
4594 g_return_if_fail(BTE_IS_TERMINAL(terminal))do { if ((__builtin_expect (__extension__ ({ int _g_boolean_var_
; if ((((__extension__ ({ GTypeInstance *__inst = (GTypeInstance
*) ((terminal)); GType __t = ((bte_terminal_get_type())); gboolean
__r; if (!__inst) __r = (0); else if (__inst->g_class &&
__inst->g_class->g_type == __t) __r = (!(0)); else __r
= g_type_check_instance_is_a (__inst, __t); __r; }))))) _g_boolean_var_
= 1; else _g_boolean_var_ = 0; _g_boolean_var_; }), 1))) { }
else { g_return_if_fail_warning ("BTE", ((const char*) (__PRETTY_FUNCTION__
)), "BTE_IS_TERMINAL(terminal)"); return; } } while (0)
;
4595 g_return_if_fail(binding >= BTE_ERASE_AUTO && binding <= BTE_ERASE_TTY)do { if ((__builtin_expect (__extension__ ({ int _g_boolean_var_
; if (binding >= BTE_ERASE_AUTO && binding <= BTE_ERASE_TTY
) _g_boolean_var_ = 1; else _g_boolean_var_ = 0; _g_boolean_var_
; }), 1))) { } else { g_return_if_fail_warning ("BTE", ((const
char*) (__PRETTY_FUNCTION__)), "binding >= BTE_ERASE_AUTO && binding <= BTE_ERASE_TTY"
); return; } } while (0)
;
4596
4597 if (WIDGET(terminal)(get_widget(terminal))->set_delete_binding(binding))
4598 g_object_notify_by_pspec(G_OBJECT(terminal)((((GObject*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((terminal)), (((GType) ((20) << (2))))))))
, pspecs[PROP_DELETE_BINDING]);
4599}
4600catch (...)
4601{
4602 bte::log_exception();
4603}
4604
4605/**
4606 * bte_terminal_get_enable_bidi:
4607 * @terminal: a #BteTerminal
4608 *
4609 * Checks whether the terminal performs bidirectional text rendering.
4610 *
4611 * Returns: %TRUE if BiDi is enabled, %FALSE if not
4612 *
4613 * Since: 0.58
4614 */
4615gboolean
4616bte_terminal_get_enable_bidi(BteTerminal *terminal) noexcept
4617try
4618{
4619 g_return_val_if_fail(BTE_IS_TERMINAL(terminal), false)do { if ((__builtin_expect (__extension__ ({ int _g_boolean_var_
; if ((((__extension__ ({ GTypeInstance *__inst = (GTypeInstance
*) ((terminal)); GType __t = ((bte_terminal_get_type())); gboolean
__r; if (!__inst) __r = (0); else if (__inst->g_class &&
__inst->g_class->g_type == __t) __r = (!(0)); else __r
= g_type_check_instance_is_a (__inst, __t); __r; }))))) _g_boolean_var_
= 1; else _g_boolean_var_ = 0; _g_boolean_var_; }), 1))) { }
else { g_return_if_fail_warning ("BTE", ((const char*) (__PRETTY_FUNCTION__
)), "BTE_IS_TERMINAL(terminal)"); return (false); } } while (
0)
;
4620 return IMPL(terminal)(_bte_terminal_get_impl(terminal))->m_enable_bidi;
4621}
4622catch (...)
4623{
4624 bte::log_exception();
4625 return false;
4626}
4627
4628/**
4629 * bte_terminal_set_enable_bidi:
4630 * @terminal: a #BteTerminal
4631 * @enable_bidi: %TRUE to enable BiDi support
4632 *
4633 * Controls whether or not the terminal will perform bidirectional text rendering.
4634 *
4635 * Since: 0.58
4636 */
4637void
4638bte_terminal_set_enable_bidi(BteTerminal *terminal,
4639 gboolean enable_bidi) noexcept
4640try
4641{
4642 g_return_if_fail(BTE_IS_TERMINAL(terminal))do { if ((__builtin_expect (__extension__ ({ int _g_boolean_var_
; if ((((__extension__ ({ GTypeInstance *__inst = (GTypeInstance
*) ((terminal)); GType __t = ((bte_terminal_get_type())); gboolean
__r; if (!__inst) __r = (0); else if (__inst->g_class &&
__inst->g_class->g_type == __t) __r = (!(0)); else __r
= g_type_check_instance_is_a (__inst, __t); __r; }))))) _g_boolean_var_
= 1; else _g_boolean_var_ = 0; _g_boolean_var_; }), 1))) { }
else { g_return_if_fail_warning ("BTE", ((const char*) (__PRETTY_FUNCTION__
)), "BTE_IS_TERMINAL(terminal)"); return; } } while (0)
;
4643
4644 if (IMPL(terminal)(_bte_terminal_get_impl(terminal))->set_enable_bidi(enable_bidi != FALSE(0)))
4645 g_object_notify_by_pspec(G_OBJECT(terminal)((((GObject*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((terminal)), (((GType) ((20) << (2))))))))
, pspecs[PROP_ENABLE_BIDI]);
4646}
4647catch (...)
4648{
4649 bte::log_exception();
4650}
4651
4652/**
4653 * bte_terminal_get_enable_shaping:
4654 * @terminal: a #BteTerminal
4655 *
4656 * Checks whether the terminal shapes Arabic text.
4657 *
4658 * Returns: %TRUE if Arabic shaping is enabled, %FALSE if not
4659 *
4660 * Since: 0.58
4661 */
4662gboolean
4663bte_terminal_get_enable_shaping(BteTerminal *terminal) noexcept
4664try
4665{
4666 g_return_val_if_fail(BTE_IS_TERMINAL(terminal), false)do { if ((__builtin_expect (__extension__ ({ int _g_boolean_var_
; if ((((__extension__ ({ GTypeInstance *__inst = (GTypeInstance
*) ((terminal)); GType __t = ((bte_terminal_get_type())); gboolean
__r; if (!__inst) __r = (0); else if (__inst->g_class &&
__inst->g_class->g_type == __t) __r = (!(0)); else __r
= g_type_check_instance_is_a (__inst, __t); __r; }))))) _g_boolean_var_
= 1; else _g_boolean_var_ = 0; _g_boolean_var_; }), 1))) { }
else { g_return_if_fail_warning ("BTE", ((const char*) (__PRETTY_FUNCTION__
)), "BTE_IS_TERMINAL(terminal)"); return (false); } } while (
0)
;
4667 return IMPL(terminal)(_bte_terminal_get_impl(terminal))->m_enable_shaping;
4668}
4669catch (...)
4670{
4671 bte::log_exception();
4672 return false;
4673}
4674
4675/**
4676 * bte_terminal_set_enable_shaping:
4677 * @terminal: a #BteTerminal
4678 * @enable_shaping: %TRUE to enable Arabic shaping
4679 *
4680 * Controls whether or not the terminal will shape Arabic text.
4681 *
4682 * Since: 0.58
4683 */
4684void
4685bte_terminal_set_enable_shaping(BteTerminal *terminal,
4686 gboolean enable_shaping) noexcept
4687try
4688{
4689 g_return_if_fail(BTE_IS_TERMINAL(terminal))do { if ((__builtin_expect (__extension__ ({ int _g_boolean_var_
; if ((((__extension__ ({ GTypeInstance *__inst = (GTypeInstance
*) ((terminal)); GType __t = ((bte_terminal_get_type())); gboolean
__r; if (!__inst) __r = (0); else if (__inst->g_class &&
__inst->g_class->g_type == __t) __r = (!(0)); else __r
= g_type_check_instance_is_a (__inst, __t); __r; }))))) _g_boolean_var_
= 1; else _g_boolean_var_ = 0; _g_boolean_var_; }), 1))) { }
else { g_return_if_fail_warning ("BTE", ((const char*) (__PRETTY_FUNCTION__
)), "BTE_IS_TERMINAL(terminal)"); return; } } while (0)
;
4690
4691 if (IMPL(terminal)(_bte_terminal_get_impl(terminal))->set_enable_shaping(enable_shaping != FALSE(0)))
4692 g_object_notify_by_pspec(G_OBJECT(terminal)((((GObject*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((terminal)), (((GType) ((20) << (2))))))))
, pspecs[PROP_ENABLE_SHAPING]);
4693}
4694catch (...)
4695{
4696 bte::log_exception();
4697}
4698
4699/**
4700 * bte_terminal_get_encoding:
4701 * @terminal: a #BteTerminal
4702 *
4703 * Determines the name of the encoding in which the terminal expects data to be
4704 * encoded, or %NULL if UTF-8 is in use.
4705 *
4706 * Returns: (nullable) (transfer none): the current encoding for the terminal
4707 */
4708const char *
4709bte_terminal_get_encoding(BteTerminal *terminal) noexcept
4710try
4711{
4712 g_return_val_if_fail(BTE_IS_TERMINAL(terminal), NULL)do { if ((__builtin_expect (__extension__ ({ int _g_boolean_var_
; if ((((__extension__ ({ GTypeInstance *__inst = (GTypeInstance
*) ((terminal)); GType __t = ((bte_terminal_get_type())); gboolean
__r; if (!__inst) __r = (0); else if (__inst->g_class &&
__inst->g_class->g_type == __t) __r = (!(0)); else __r
= g_type_check_instance_is_a (__inst, __t); __r; }))))) _g_boolean_var_
= 1; else _g_boolean_var_ = 0; _g_boolean_var_; }), 1))) { }
else { g_return_if_fail_warning ("BTE", ((const char*) (__PRETTY_FUNCTION__
)), "BTE_IS_TERMINAL(terminal)"); return (__null); } } while (
0)
;
4713 return WIDGET(terminal)(get_widget(terminal))->encoding();
4714}
4715catch (...)
4716{
4717 bte::log_exception();
4718 return nullptr;
4719}
4720
4721/**
4722 * bte_terminal_set_encoding:
4723 * @terminal: a #BteTerminal
4724 * @codeset: (allow-none): target charset, or %NULL to use UTF-8
4725 * @error: (allow-none): return location for a #GError, or %NULL
4726 *
4727 * Changes the encoding the terminal will expect data from the child to
4728 * be encoded with. For certain terminal types, applications executing in the
4729 * terminal can change the encoding. If @codeset is %NULL, it uses "UTF-8".
4730 *
4731 * Returns: %TRUE if the encoding could be changed to the specified one,
4732 * or %FALSE with @error set to %G_CONVERT_ERROR_NO_CONVERSION.
4733 */
4734gboolean
4735bte_terminal_set_encoding(BteTerminal *terminal,
4736 const char *codeset,
4737 GError **error) noexcept
4738try
4739{
4740 g_return_val_if_fail(BTE_IS_TERMINAL(terminal), FALSE)do { if ((__builtin_expect (__extension__ ({ int _g_boolean_var_
; if ((((__extension__ ({ GTypeInstance *__inst = (GTypeInstance
*) ((terminal)); GType __t = ((bte_terminal_get_type())); gboolean
__r; if (!__inst) __r = (0); else if (__inst->g_class &&
__inst->g_class->g_type == __t) __r = (!(0)); else __r
= g_type_check_instance_is_a (__inst, __t); __r; }))))) _g_boolean_var_
= 1; else _g_boolean_var_ = 0; _g_boolean_var_; }), 1))) { }
else { g_return_if_fail_warning ("BTE", ((const char*) (__PRETTY_FUNCTION__
)), "BTE_IS_TERMINAL(terminal)"); return ((0)); } } while (0)
;
4741 g_return_val_if_fail(error == NULL || *error == NULL, FALSE)do { if ((__builtin_expect (__extension__ ({ int _g_boolean_var_
; if (error == __null || *error == __null) _g_boolean_var_ = 1
; else _g_boolean_var_ = 0; _g_boolean_var_; }), 1))) { } else
{ g_return_if_fail_warning ("BTE", ((const char*) (__PRETTY_FUNCTION__
)), "error == NULL || *error == NULL"); return ((0)); } } while
(0)
;
4742
4743 auto const freezer = bte::glib::FreezeObjectNotify{terminal};
4744
4745 auto const rv = IMPL(terminal)(_bte_terminal_get_impl(terminal))->set_encoding(codeset, error);
4746 if (rv) {
4747 g_signal_emit(freezer.get(), signals[SIGNAL_ENCODING_CHANGED], 0);
4748 g_object_notify_by_pspec(freezer.get(), pspecs[PROP_ENCODING]);
4749 }
4750
4751 return rv;
4752}
4753catch (...)
4754{
4755 return bte::glib::set_error_from_exception(error);
4756}
4757
4758/**
4759 * bte_terminal_get_font:
4760 * @terminal: a #BteTerminal
4761 *
4762 * Queries the terminal for information about the fonts which will be
4763 * used to draw text in the terminal. The actual font takes the font scale
4764 * into account, this is not reflected in the return value, the unscaled
4765 * font is returned.
4766 *
4767 * Returns: (transfer none): a #PangoFontDescription describing the font the
4768 * terminal uses to render text at the default font scale of 1.0.
4769 */
4770const PangoFontDescription *
4771bte_terminal_get_font(BteTerminal *terminal) noexcept
4772try
4773{
4774 g_return_val_if_fail(BTE_IS_TERMINAL(terminal), nullptr)do { if ((__builtin_expect (__extension__ ({ int _g_boolean_var_
; if ((((__extension__ ({ GTypeInstance *__inst = (GTypeInstance
*) ((terminal)); GType __t = ((bte_terminal_get_type())); gboolean
__r; if (!__inst) __r = (0); else if (__inst->g_class &&
__inst->g_class->g_type == __t) __r = (!(0)); else __r
= g_type_check_instance_is_a (__inst, __t); __r; }))))) _g_boolean_var_
= 1; else _g_boolean_var_ = 0; _g_boolean_var_; }), 1))) { }
else { g_return_if_fail_warning ("BTE", ((const char*) (__PRETTY_FUNCTION__
)), "BTE_IS_TERMINAL(terminal)"); return (nullptr); } } while
(0)
;
4775
4776 return IMPL(terminal)(_bte_terminal_get_impl(terminal))->unscaled_font_description();
4777}
4778catch (...)
4779{
4780 bte::log_exception();
4781 return nullptr;
4782}
4783
4784/**
4785 * bte_terminal_set_font:
4786 * @terminal: a #BteTerminal
4787 * @font_desc: (allow-none): a #PangoFontDescription for the desired font, or %NULL
4788 *
4789 * Sets the font used for rendering all text displayed by the terminal,
4790 * overriding any fonts set using ctk_widget_modify_font(). The terminal
4791 * will immediately attempt to load the desired font, retrieve its
4792 * metrics, and attempt to resize itself to keep the same number of rows
4793 * and columns. The font scale is applied to the specified font.
4794 */
4795void
4796bte_terminal_set_font(BteTerminal *terminal,
4797 const PangoFontDescription* font_desc) noexcept
4798try
4799{
4800 g_return_if_fail(BTE_IS_TERMINAL(terminal))do { if ((__builtin_expect (__extension__ ({ int _g_boolean_var_
; if ((((__extension__ ({ GTypeInstance *__inst = (GTypeInstance
*) ((terminal)); GType __t = ((bte_terminal_get_type())); gboolean
__r; if (!__inst) __r = (0); else if (__inst->g_class &&
__inst->g_class->g_type == __t) __r = (!(0)); else __r
= g_type_check_instance_is_a (__inst, __t); __r; }))))) _g_boolean_var_
= 1; else _g_boolean_var_ = 0; _g_boolean_var_; }), 1))) { }
else { g_return_if_fail_warning ("BTE", ((const char*) (__PRETTY_FUNCTION__
)), "BTE_IS_TERMINAL(terminal)"); return; } } while (0)
;
4801
4802 if (IMPL(terminal)(_bte_terminal_get_impl(terminal))->set_font_desc(font_desc))
4803 g_object_notify_by_pspec(G_OBJECT(terminal)((((GObject*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((terminal)), (((GType) ((20) << (2))))))))
, pspecs[PROP_FONT_DESC]);
4804}
4805catch (...)
4806{
4807 bte::log_exception();
4808}
4809
4810/**
4811 * bte_terminal_get_font_scale:
4812 * @terminal: a #BteTerminal
4813 *
4814 * Returns: the terminal's font scale
4815 */
4816gdouble
4817bte_terminal_get_font_scale(BteTerminal *terminal) noexcept
4818try
4819{
4820 g_return_val_if_fail(BTE_IS_TERMINAL(terminal), 1.)do { if ((__builtin_expect (__extension__ ({ int _g_boolean_var_
; if ((((__extension__ ({ GTypeInstance *__inst = (GTypeInstance
*) ((terminal)); GType __t = ((bte_terminal_get_type())); gboolean
__r; if (!__inst) __r = (0); else if (__inst->g_class &&
__inst->g_class->g_type == __t) __r = (!(0)); else __r
= g_type_check_instance_is_a (__inst, __t); __r; }))))) _g_boolean_var_
= 1; else _g_boolean_var_ = 0; _g_boolean_var_; }), 1))) { }
else { g_return_if_fail_warning ("BTE", ((const char*) (__PRETTY_FUNCTION__
)), "BTE_IS_TERMINAL(terminal)"); return (1.); } } while (0)
;
4821
4822 return IMPL(terminal)(_bte_terminal_get_impl(terminal))->m_font_scale;
4823}
4824catch (...)
4825{
4826 bte::log_exception();
4827 return 1.;
4828}
4829
4830/**
4831 * bte_terminal_set_font_scale:
4832 * @terminal: a #BteTerminal
4833 * @scale: the font scale
4834 *
4835 * Sets the terminal's font scale to @scale.
4836 */
4837void
4838bte_terminal_set_font_scale(BteTerminal *terminal,
4839 double scale) noexcept
4840try
4841{
4842 g_return_if_fail(BTE_IS_TERMINAL(terminal))do { if ((__builtin_expect (__extension__ ({ int _g_boolean_var_
; if ((((__extension__ ({ GTypeInstance *__inst = (GTypeInstance
*) ((terminal)); GType __t = ((bte_terminal_get_type())); gboolean
__r; if (!__inst) __r = (0); else if (__inst->g_class &&
__inst->g_class->g_type == __t) __r = (!(0)); else __r
= g_type_check_instance_is_a (__inst, __t); __r; }))))) _g_boolean_var_
= 1; else _g_boolean_var_ = 0; _g_boolean_var_; }), 1))) { }
else { g_return_if_fail_warning ("BTE", ((const char*) (__PRETTY_FUNCTION__
)), "BTE_IS_TERMINAL(terminal)"); return; } } while (0)
;
4843
4844 scale = CLAMP(scale, BTE_FONT_SCALE_MIN, BTE_FONT_SCALE_MAX)(((scale) > ((4.))) ? ((4.)) : (((scale) < ((.25))) ? (
(.25)) : (scale)))
;
4845 if (IMPL(terminal)(_bte_terminal_get_impl(terminal))->set_font_scale(scale))
4846 g_object_notify_by_pspec(G_OBJECT(terminal)((((GObject*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((terminal)), (((GType) ((20) << (2))))))))
, pspecs[PROP_FONT_SCALE]);
4847}
4848catch (...)
4849{
4850 bte::log_exception();
4851}
4852
4853/**
4854 * bte_terminal_get_cell_height_scale:
4855 * @terminal: a #BteTerminal
4856 *
4857 * Returns: the terminal's cell height scale
4858 *
4859 * Since: 0.52
4860 */
4861double
4862bte_terminal_get_cell_height_scale(BteTerminal *terminal) noexcept
4863try
4864{
4865 g_return_val_if_fail(BTE_IS_TERMINAL(terminal), 1.)do { if ((__builtin_expect (__extension__ ({ int _g_boolean_var_
; if ((((__extension__ ({ GTypeInstance *__inst = (GTypeInstance
*) ((terminal)); GType __t = ((bte_terminal_get_type())); gboolean
__r; if (!__inst) __r = (0); else if (__inst->g_class &&
__inst->g_class->g_type == __t) __r = (!(0)); else __r
= g_type_check_instance_is_a (__inst, __t); __r; }))))) _g_boolean_var_
= 1; else _g_boolean_var_ = 0; _g_boolean_var_; }), 1))) { }
else { g_return_if_fail_warning ("BTE", ((const char*) (__PRETTY_FUNCTION__
)), "BTE_IS_TERMINAL(terminal)"); return (1.); } } while (0)
;
4866
4867 return IMPL(terminal)(_bte_terminal_get_impl(terminal))->m_cell_height_scale;
4868}
4869catch (...)
4870{
4871 bte::log_exception();
4872 return 1.;
4873}
4874
4875/**
4876 * bte_terminal_set_cell_height_scale:
4877 * @terminal: a #BteTerminal
4878 * @scale: the cell height scale
4879 *
4880 * Sets the terminal's cell height scale to @scale.
4881 *
4882 * This can be used to increase the line spacing. (The font's height is not affected.)
4883 * Valid values go from 1.0 (default) to 2.0 ("double spacing").
4884 *
4885 * Since: 0.52
4886 */
4887void
4888bte_terminal_set_cell_height_scale(BteTerminal *terminal,
4889 double scale) noexcept
4890try
4891{
4892 g_return_if_fail(BTE_IS_TERMINAL(terminal))do { if ((__builtin_expect (__extension__ ({ int _g_boolean_var_
; if ((((__extension__ ({ GTypeInstance *__inst = (GTypeInstance
*) ((terminal)); GType __t = ((bte_terminal_get_type())); gboolean
__r; if (!__inst) __r = (0); else if (__inst->g_class &&
__inst->g_class->g_type == __t) __r = (!(0)); else __r
= g_type_check_instance_is_a (__inst, __t); __r; }))))) _g_boolean_var_
= 1; else _g_boolean_var_ = 0; _g_boolean_var_; }), 1))) { }
else { g_return_if_fail_warning ("BTE", ((const char*) (__PRETTY_FUNCTION__
)), "BTE_IS_TERMINAL(terminal)"); return; } } while (0)
;
4893
4894 scale = CLAMP(scale, BTE_CELL_SCALE_MIN, BTE_CELL_SCALE_MAX)(((scale) > ((2.))) ? ((2.)) : (((scale) < ((1.))) ? ((
1.)) : (scale)))
;
4895 if (IMPL(terminal)(_bte_terminal_get_impl(terminal))->set_cell_height_scale(scale))
4896 g_object_notify_by_pspec(G_OBJECT(terminal)((((GObject*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((terminal)), (((GType) ((20) << (2))))))))
, pspecs[PROP_CELL_HEIGHT_SCALE]);
4897}
4898catch (...)
4899{
4900 bte::log_exception();
4901}
4902
4903/**
4904 * bte_terminal_get_cell_width_scale:
4905 * @terminal: a #BteTerminal
4906 *
4907 * Returns: the terminal's cell width scale
4908 *
4909 * Since: 0.52
4910 */
4911double
4912bte_terminal_get_cell_width_scale(BteTerminal *terminal) noexcept
4913try
4914{
4915 g_return_val_if_fail(BTE_IS_TERMINAL(terminal), 1.)do { if ((__builtin_expect (__extension__ ({ int _g_boolean_var_
; if ((((__extension__ ({ GTypeInstance *__inst = (GTypeInstance
*) ((terminal)); GType __t = ((bte_terminal_get_type())); gboolean
__r; if (!__inst) __r = (0); else if (__inst->g_class &&
__inst->g_class->g_type == __t) __r = (!(0)); else __r
= g_type_check_instance_is_a (__inst, __t); __r; }))))) _g_boolean_var_
= 1; else _g_boolean_var_ = 0; _g_boolean_var_; }), 1))) { }
else { g_return_if_fail_warning ("BTE", ((const char*) (__PRETTY_FUNCTION__
)), "BTE_IS_TERMINAL(terminal)"); return (1.); } } while (0)
;
4916
4917 return IMPL(terminal)(_bte_terminal_get_impl(terminal))->m_cell_width_scale;
4918}
4919catch (...)
4920{
4921 bte::log_exception();
4922 return 1.;
4923}
4924
4925/**
4926 * bte_terminal_set_cell_width_scale:
4927 * @terminal: a #BteTerminal
4928 * @scale: the cell width scale
4929 *
4930 * Sets the terminal's cell width scale to @scale.
4931 *
4932 * This can be used to increase the letter spacing. (The font's width is not affected.)
4933 * Valid values go from 1.0 (default) to 2.0.
4934 *
4935 * Since: 0.52
4936 */
4937void
4938bte_terminal_set_cell_width_scale(BteTerminal *terminal,
4939 double scale) noexcept
4940try
4941{
4942 g_return_if_fail(BTE_IS_TERMINAL(terminal))do { if ((__builtin_expect (__extension__ ({ int _g_boolean_var_
; if ((((__extension__ ({ GTypeInstance *__inst = (GTypeInstance
*) ((terminal)); GType __t = ((bte_terminal_get_type())); gboolean
__r; if (!__inst) __r = (0); else if (__inst->g_class &&
__inst->g_class->g_type == __t) __r = (!(0)); else __r
= g_type_check_instance_is_a (__inst, __t); __r; }))))) _g_boolean_var_
= 1; else _g_boolean_var_ = 0; _g_boolean_var_; }), 1))) { }
else { g_return_if_fail_warning ("BTE", ((const char*) (__PRETTY_FUNCTION__
)), "BTE_IS_TERMINAL(terminal)"); return; } } while (0)
;
4943
4944 scale = CLAMP(scale, BTE_CELL_SCALE_MIN, BTE_CELL_SCALE_MAX)(((scale) > ((2.))) ? ((2.)) : (((scale) < ((1.))) ? ((
1.)) : (scale)))
;
4945 if (IMPL(terminal)(_bte_terminal_get_impl(terminal))->set_cell_width_scale(scale))
4946 g_object_notify_by_pspec(G_OBJECT(terminal)((((GObject*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((terminal)), (((GType) ((20) << (2))))))))
, pspecs[PROP_CELL_WIDTH_SCALE]);
4947}
4948catch (...)
4949{
4950 bte::log_exception();
4951}
4952
4953/* Just some arbitrary minimum values */
4954#define MIN_COLUMNS(16) (16)
4955#define MIN_ROWS(2) (2)
4956
4957/**
4958 * bte_terminal_get_geometry_hints:
4959 * @terminal: a #BteTerminal
4960 * @hints: (out caller-allocates): a #CdkGeometry to fill in
4961 * @min_rows: the minimum number of rows to request
4962 * @min_columns: the minimum number of columns to request
4963 *
4964 * Fills in some @hints from @terminal's geometry. The hints
4965 * filled are those covered by the %CDK_HINT_RESIZE_INC,
4966 * %CDK_HINT_MIN_SIZE and %CDK_HINT_BASE_SIZE flags.
4967 *
4968 * See ctk_window_set_geometry_hints() for more information.
4969 *
4970 * @terminal must be realized (see ctk_widget_get_realized()).
4971 *
4972 * Deprecated: 0.52
4973 */
4974void
4975bte_terminal_get_geometry_hints(BteTerminal *terminal,
4976 CdkGeometry *hints,
4977 int min_rows,
4978 int min_columns) noexcept
4979{
4980 CtkWidget *widget;
4981 CtkBorder padding;
4982
4983 g_return_if_fail(BTE_IS_TERMINAL(terminal))do { if ((__builtin_expect (__extension__ ({ int _g_boolean_var_
; if ((((__extension__ ({ GTypeInstance *__inst = (GTypeInstance
*) ((terminal)); GType __t = ((bte_terminal_get_type())); gboolean
__r; if (!__inst) __r = (0); else if (__inst->g_class &&
__inst->g_class->g_type == __t) __r = (!(0)); else __r
= g_type_check_instance_is_a (__inst, __t); __r; }))))) _g_boolean_var_
= 1; else _g_boolean_var_ = 0; _g_boolean_var_; }), 1))) { }
else { g_return_if_fail_warning ("BTE", ((const char*) (__PRETTY_FUNCTION__
)), "BTE_IS_TERMINAL(terminal)"); return; } } while (0)
;
4984 g_return_if_fail(hints != NULL)do { if ((__builtin_expect (__extension__ ({ int _g_boolean_var_
; if (hints != __null) _g_boolean_var_ = 1; else _g_boolean_var_
= 0; _g_boolean_var_; }), 1))) { } else { g_return_if_fail_warning
("BTE", ((const char*) (__PRETTY_FUNCTION__)), "hints != NULL"
); return; } } while (0)
;
4985 widget = &terminal->widget;
4986 g_return_if_fail(ctk_widget_get_realized(widget))do { if ((__builtin_expect (__extension__ ({ int _g_boolean_var_
; if (ctk_widget_get_realized(widget)) _g_boolean_var_ = 1; else
_g_boolean_var_ = 0; _g_boolean_var_; }), 1))) { } else { g_return_if_fail_warning
("BTE", ((const char*) (__PRETTY_FUNCTION__)), "ctk_widget_get_realized(widget)"
); return; } } while (0)
;
4987
4988 auto impl = IMPL(terminal)(_bte_terminal_get_impl(terminal));
4989
4990 auto context = ctk_widget_get_style_context(widget);
4991 ctk_style_context_get_padding(context, ctk_style_context_get_state(context),
4992 &padding);
4993
4994 hints->base_width = padding.left + padding.right;
4995 hints->base_height = padding.top + padding.bottom;
4996 hints->width_inc = impl->m_cell_width;
4997 hints->height_inc = impl->m_cell_height;
4998 hints->min_width = hints->base_width + hints->width_inc * min_columns;
4999 hints->min_height = hints->base_height + hints->height_inc * min_rows;
5000
5001 _bte_debug_print(BTE_DEBUG_WIDGET_SIZE,do { } while(0)
5002 "[Terminal %p] Geometry cell width %ld height %ld\n"do { } while(0)
5003 " base width %d height %d\n"do { } while(0)
5004 " increments width %d height %d\n"do { } while(0)
5005 " minimum width %d height %d\n",do { } while(0)
5006 terminal,do { } while(0)
5007 impl->m_cell_width, impl->m_cell_height,do { } while(0)
5008 hints->base_width, hints->base_height,do { } while(0)
5009 hints->width_inc, hints->height_inc,do { } while(0)
5010 hints->min_width, hints->min_height)do { } while(0);
5011}
5012
5013/**
5014 * bte_terminal_set_geometry_hints_for_window:
5015 * @terminal: a #BteTerminal
5016 * @window: a #CtkWindow
5017 *
5018 * Sets @terminal as @window's geometry widget. See
5019 * ctk_window_set_geometry_hints() for more information.
5020 *
5021 * @terminal must be realized (see ctk_widget_get_realized()).
5022 *
5023 * Deprecated: 0.52
5024 */
5025void
5026bte_terminal_set_geometry_hints_for_window(BteTerminal *terminal,
5027 CtkWindow *window) noexcept
5028{
5029 CdkGeometry hints;
5030
5031 g_return_if_fail(BTE_IS_TERMINAL(terminal))do { if ((__builtin_expect (__extension__ ({ int _g_boolean_var_
; if ((((__extension__ ({ GTypeInstance *__inst = (GTypeInstance
*) ((terminal)); GType __t = ((bte_terminal_get_type())); gboolean
__r; if (!__inst) __r = (0); else if (__inst->g_class &&
__inst->g_class->g_type == __t) __r = (!(0)); else __r
= g_type_check_instance_is_a (__inst, __t); __r; }))))) _g_boolean_var_
= 1; else _g_boolean_var_ = 0; _g_boolean_var_; }), 1))) { }
else { g_return_if_fail_warning ("BTE", ((const char*) (__PRETTY_FUNCTION__
)), "BTE_IS_TERMINAL(terminal)"); return; } } while (0)
;
5032 g_return_if_fail(ctk_widget_get_realized(&terminal->widget))do { if ((__builtin_expect (__extension__ ({ int _g_boolean_var_
; if (ctk_widget_get_realized(&terminal->widget)) _g_boolean_var_
= 1; else _g_boolean_var_ = 0; _g_boolean_var_; }), 1))) { }
else { g_return_if_fail_warning ("BTE", ((const char*) (__PRETTY_FUNCTION__
)), "ctk_widget_get_realized(&terminal->widget)"); return
; } } while (0)
;
5033
5034 bte_terminal_get_geometry_hints(terminal, &hints, MIN_ROWS(2), MIN_COLUMNS(16));
5035 ctk_window_set_geometry_hints(window,
5036 NULL__null,
5037 &hints,
5038 (CdkWindowHints)(CDK_HINT_RESIZE_INC |
5039 CDK_HINT_MIN_SIZE |
5040 CDK_HINT_BASE_SIZE));
5041}
5042
5043/**
5044 * bte_terminal_get_has_selection:
5045 * @terminal: a #BteTerminal
5046 *
5047 * Checks if the terminal currently contains selected text. Note that this
5048 * is different from determining if the terminal is the owner of any
5049 * #CtkClipboard items.
5050 *
5051 * Returns: %TRUE if part of the text in the terminal is selected.
5052 */
5053gboolean
5054bte_terminal_get_has_selection(BteTerminal *terminal) noexcept
5055try
5056{
5057 g_return_val_if_fail(BTE_IS_TERMINAL(terminal), false)do { if ((__builtin_expect (__extension__ ({ int _g_boolean_var_
; if ((((__extension__ ({ GTypeInstance *__inst = (GTypeInstance
*) ((terminal)); GType __t = ((bte_terminal_get_type())); gboolean
__r; if (!__inst) __r = (0); else if (__inst->g_class &&
__inst->g_class->g_type == __t) __r = (!(0)); else __r
= g_type_check_instance_is_a (__inst, __t); __r; }))))) _g_boolean_var_
= 1; else _g_boolean_var_ = 0; _g_boolean_var_; }), 1))) { }
else { g_return_if_fail_warning ("BTE", ((const char*) (__PRETTY_FUNCTION__
)), "BTE_IS_TERMINAL(terminal)"); return (false); } } while (
0)
;
5058 return !IMPL(terminal)(_bte_terminal_get_impl(terminal))->m_selection_resolved.empty();
5059}
5060catch (...)
5061{
5062 bte::log_exception();
5063 return false;
5064}
5065
5066/**
5067 * bte_terminal_get_icon_title:
5068 * @terminal: a #BteTerminal
5069 *
5070 * Returns: (transfer none): the icon title
5071 */
5072const char *
5073bte_terminal_get_icon_title(BteTerminal *terminal) noexcept
5074{
5075 return IMPL(terminal)(_bte_terminal_get_impl(terminal))->m_icon_title.data();
5076}
5077
5078/**
5079 * bte_terminal_get_input_enabled:
5080 * @terminal: a #BteTerminal
5081 *
5082 * Returns whether the terminal allow user input.
5083 */
5084gboolean
5085bte_terminal_get_input_enabled (BteTerminal *terminal) noexcept
5086try
5087{
5088 g_return_val_if_fail(BTE_IS_TERMINAL(terminal), false)do { if ((__builtin_expect (__extension__ ({ int _g_boolean_var_
; if ((((__extension__ ({ GTypeInstance *__inst = (GTypeInstance
*) ((terminal)); GType __t = ((bte_terminal_get_type())); gboolean
__r; if (!__inst) __r = (0); else if (__inst->g_class &&
__inst->g_class->g_type == __t) __r = (!(0)); else __r
= g_type_check_instance_is_a (__inst, __t); __r; }))))) _g_boolean_var_
= 1; else _g_boolean_var_ = 0; _g_boolean_var_; }), 1))) { }
else { g_return_if_fail_warning ("BTE", ((const char*) (__PRETTY_FUNCTION__
)), "BTE_IS_TERMINAL(terminal)"); return (false); } } while (
0)
;
5089
5090 return IMPL(terminal)(_bte_terminal_get_impl(terminal))->m_input_enabled;
5091}
5092catch (...)
5093{
5094 bte::log_exception();
5095 return false;
5096}
5097
5098/**
5099 * bte_terminal_set_input_enabled:
5100 * @terminal: a #BteTerminal
5101 * @enabled: whether to enable user input
5102 *
5103 * Enables or disables user input. When user input is disabled,
5104 * the terminal's child will not receive any key press, or mouse button
5105 * press or motion events sent to it.
5106 */
5107void
5108bte_terminal_set_input_enabled (BteTerminal *terminal,
5109 gboolean enabled) noexcept
5110try
5111{
5112 g_return_if_fail(BTE_IS_TERMINAL(terminal))do { if ((__builtin_expect (__extension__ ({ int _g_boolean_var_
; if ((((__extension__ ({ GTypeInstance *__inst = (GTypeInstance
*) ((terminal)); GType __t = ((bte_terminal_get_type())); gboolean
__r; if (!__inst) __r = (0); else if (__inst->g_class &&
__inst->g_class->g_type == __t) __r = (!(0)); else __r
= g_type_check_instance_is_a (__inst, __t); __r; }))))) _g_boolean_var_
= 1; else _g_boolean_var_ = 0; _g_boolean_var_; }), 1))) { }
else { g_return_if_fail_warning ("BTE", ((const char*) (__PRETTY_FUNCTION__
)), "BTE_IS_TERMINAL(terminal)"); return; } } while (0)
;
5113
5114 if (IMPL(terminal)(_bte_terminal_get_impl(terminal))->set_input_enabled(enabled != FALSE(0)))
5115 g_object_notify_by_pspec(G_OBJECT(terminal)((((GObject*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((terminal)), (((GType) ((20) << (2))))))))
, pspecs[PROP_INPUT_ENABLED]);
5116}
5117catch (...)
5118{
5119 bte::log_exception();
5120}
5121
5122/**
5123 * bte_terminal_get_mouse_autohide:
5124 * @terminal: a #BteTerminal
5125 *
5126 * Determines the value of the terminal's mouse autohide setting. When
5127 * autohiding is enabled, the mouse cursor will be hidden when the user presses
5128 * a key and shown when the user moves the mouse. This setting can be changed
5129 * using bte_terminal_set_mouse_autohide().
5130 *
5131 * Returns: %TRUE if autohiding is enabled, %FALSE if not
5132 */
5133gboolean
5134bte_terminal_get_mouse_autohide(BteTerminal *terminal) noexcept
5135try
5136{
5137 g_return_val_if_fail(BTE_IS_TERMINAL(terminal), false)do { if ((__builtin_expect (__extension__ ({ int _g_boolean_var_
; if ((((__extension__ ({ GTypeInstance *__inst = (GTypeInstance
*) ((terminal)); GType __t = ((bte_terminal_get_type())); gboolean
__r; if (!__inst) __r = (0); else if (__inst->g_class &&
__inst->g_class->g_type == __t) __r = (!(0)); else __r
= g_type_check_instance_is_a (__inst, __t); __r; }))))) _g_boolean_var_
= 1; else _g_boolean_var_ = 0; _g_boolean_var_; }), 1))) { }
else { g_return_if_fail_warning ("BTE", ((const char*) (__PRETTY_FUNCTION__
)), "BTE_IS_TERMINAL(terminal)"); return (false); } } while (
0)
;
5138 return IMPL(terminal)(_bte_terminal_get_impl(terminal))->m_mouse_autohide;
5139}
5140catch (...)
5141{
5142 bte::log_exception();
5143 return false;
5144}
5145
5146/**
5147 * bte_terminal_set_mouse_autohide:
5148 * @terminal: a #BteTerminal
5149 * @setting: whether the mouse pointer should autohide
5150 *
5151 * Changes the value of the terminal's mouse autohide setting. When autohiding
5152 * is enabled, the mouse cursor will be hidden when the user presses a key and
5153 * shown when the user moves the mouse. This setting can be read using
5154 * bte_terminal_get_mouse_autohide().
5155 */
5156void
5157bte_terminal_set_mouse_autohide(BteTerminal *terminal,
5158 gboolean setting) noexcept
5159try
5160{
5161 g_return_if_fail(BTE_IS_TERMINAL(terminal))do { if ((__builtin_expect (__extension__ ({ int _g_boolean_var_
; if ((((__extension__ ({ GTypeInstance *__inst = (GTypeInstance
*) ((terminal)); GType __t = ((bte_terminal_get_type())); gboolean
__r; if (!__inst) __r = (0); else if (__inst->g_class &&
__inst->g_class->g_type == __t) __r = (!(0)); else __r
= g_type_check_instance_is_a (__inst, __t); __r; }))))) _g_boolean_var_
= 1; else _g_boolean_var_ = 0; _g_boolean_var_; }), 1))) { }
else { g_return_if_fail_warning ("BTE", ((const char*) (__PRETTY_FUNCTION__
)), "BTE_IS_TERMINAL(terminal)"); return; } } while (0)
;
5162
5163 if (IMPL(terminal)(_bte_terminal_get_impl(terminal))->set_mouse_autohide(setting != FALSE(0)))
5164 g_object_notify_by_pspec(G_OBJECT(terminal)((((GObject*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((terminal)), (((GType) ((20) << (2))))))))
, pspecs[PROP_MOUSE_POINTER_AUTOHIDE]);
5165}
5166catch (...)
5167{
5168 bte::log_exception();
5169}
5170
5171/**
5172 * bte_terminal_set_pty:
5173 * @terminal: a #BteTerminal
5174 * @pty: (allow-none): a #BtePty, or %NULL
5175 *
5176 * Sets @pty as the PTY to use in @terminal.
5177 * Use %NULL to unset the PTY.
5178 */
5179void
5180bte_terminal_set_pty(BteTerminal *terminal,
5181 BtePty *pty) noexcept
5182try
5183{
5184 g_return_if_fail(BTE_IS_TERMINAL(terminal))do { if ((__builtin_expect (__extension__ ({ int _g_boolean_var_
; if ((((__extension__ ({ GTypeInstance *__inst = (GTypeInstance
*) ((terminal)); GType __t = ((bte_terminal_get_type())); gboolean
__r; if (!__inst) __r = (0); else if (__inst->g_class &&
__inst->g_class->g_type == __t) __r = (!(0)); else __r
= g_type_check_instance_is_a (__inst, __t); __r; }))))) _g_boolean_var_
= 1; else _g_boolean_var_ = 0; _g_boolean_var_; }), 1))) { }
else { g_return_if_fail_warning ("BTE", ((const char*) (__PRETTY_FUNCTION__
)), "BTE_IS_TERMINAL(terminal)"); return; } } while (0)
;
5185 g_return_if_fail(pty == NULL || BTE_IS_PTY(pty))do { if ((__builtin_expect (__extension__ ({ int _g_boolean_var_
; if (pty == __null || (((__extension__ ({ GTypeInstance *__inst
= (GTypeInstance*) ((pty)); GType __t = ((bte_pty_get_type()
)); gboolean __r; if (!__inst) __r = (0); else if (__inst->
g_class && __inst->g_class->g_type == __t) __r =
(!(0)); else __r = g_type_check_instance_is_a (__inst, __t);
__r; }))))) _g_boolean_var_ = 1; else _g_boolean_var_ = 0; _g_boolean_var_
; }), 1))) { } else { g_return_if_fail_warning ("BTE", ((const
char*) (__PRETTY_FUNCTION__)), "pty == NULL || BTE_IS_PTY(pty)"
); return; } } while (0)
;
5186
5187 auto const freezer = bte::glib::FreezeObjectNotify{terminal};
5188
5189 if (WIDGET(terminal)(get_widget(terminal))->set_pty(pty))
5190 g_object_notify_by_pspec(freezer.get(), pspecs[PROP_PTY]);
5191}
5192catch (...)
5193{
5194 bte::log_exception();
5195}
5196
5197/**
5198 * bte_terminal_get_pty:
5199 * @terminal: a #BteTerminal
5200 *
5201 * Returns the #BtePty of @terminal.
5202 *
5203 * Returns: (transfer none): a #BtePty, or %NULL
5204 */
5205BtePty *
5206bte_terminal_get_pty(BteTerminal *terminal) noexcept
5207try
5208{
5209 g_return_val_if_fail (BTE_IS_TERMINAL (terminal), nullptr)do { if ((__builtin_expect (__extension__ ({ int _g_boolean_var_
; if ((((__extension__ ({ GTypeInstance *__inst = (GTypeInstance
*) ((terminal)); GType __t = ((bte_terminal_get_type())); gboolean
__r; if (!__inst) __r = (0); else if (__inst->g_class &&
__inst->g_class->g_type == __t) __r = (!(0)); else __r
= g_type_check_instance_is_a (__inst, __t); __r; }))))) _g_boolean_var_
= 1; else _g_boolean_var_ = 0; _g_boolean_var_; }), 1))) { }
else { g_return_if_fail_warning ("BTE", ((const char*) (__PRETTY_FUNCTION__
)), "BTE_IS_TERMINAL (terminal)"); return (nullptr); } } while
(0)
;
5210 return WIDGET(terminal)(get_widget(terminal))->pty();
5211}
5212catch (...)
5213{
5214 bte::log_exception();
5215 return nullptr;
5216}
5217
5218/**
5219 * bte_terminal_get_rewrap_on_resize:
5220 * @terminal: a #BteTerminal
5221 *
5222 * Checks whether or not the terminal will rewrap its contents upon resize.
5223 *
5224 * Returns: %TRUE if rewrapping is enabled, %FALSE if not
5225 *
5226 * Deprecated: 0.58
5227 */
5228gboolean
5229bte_terminal_get_rewrap_on_resize(BteTerminal *terminal) noexcept
5230try
5231{
5232 g_return_val_if_fail(BTE_IS_TERMINAL(terminal), false)do { if ((__builtin_expect (__extension__ ({ int _g_boolean_var_
; if ((((__extension__ ({ GTypeInstance *__inst = (GTypeInstance
*) ((terminal)); GType __t = ((bte_terminal_get_type())); gboolean
__r; if (!__inst) __r = (0); else if (__inst->g_class &&
__inst->g_class->g_type == __t) __r = (!(0)); else __r
= g_type_check_instance_is_a (__inst, __t); __r; }))))) _g_boolean_var_
= 1; else _g_boolean_var_ = 0; _g_boolean_var_; }), 1))) { }
else { g_return_if_fail_warning ("BTE", ((const char*) (__PRETTY_FUNCTION__
)), "BTE_IS_TERMINAL(terminal)"); return (false); } } while (
0)
;
5233 return IMPL(terminal)(_bte_terminal_get_impl(terminal))->m_rewrap_on_resize;
5234}
5235catch (...)
5236{
5237 bte::log_exception();
5238 return false;
5239}
5240
5241/**
5242 * bte_terminal_set_rewrap_on_resize:
5243 * @terminal: a #BteTerminal
5244 * @rewrap: %TRUE if the terminal should rewrap on resize
5245 *
5246 * Controls whether or not the terminal will rewrap its contents, including
5247 * the scrollback history, whenever the terminal's width changes.
5248 *
5249 * Deprecated: 0.58
5250 */
5251void
5252bte_terminal_set_rewrap_on_resize(BteTerminal *terminal,
5253 gboolean rewrap) noexcept
5254try
5255{
5256 g_return_if_fail(BTE_IS_TERMINAL(terminal))do { if ((__builtin_expect (__extension__ ({ int _g_boolean_var_
; if ((((__extension__ ({ GTypeInstance *__inst = (GTypeInstance
*) ((terminal)); GType __t = ((bte_terminal_get_type())); gboolean
__r; if (!__inst) __r = (0); else if (__inst->g_class &&
__inst->g_class->g_type == __t) __r = (!(0)); else __r
= g_type_check_instance_is_a (__inst, __t); __r; }))))) _g_boolean_var_
= 1; else _g_boolean_var_ = 0; _g_boolean_var_; }), 1))) { }
else { g_return_if_fail_warning ("BTE", ((const char*) (__PRETTY_FUNCTION__
)), "BTE_IS_TERMINAL(terminal)"); return; } } while (0)
;
5257
5258 if (IMPL(terminal)(_bte_terminal_get_impl(terminal))->set_rewrap_on_resize(rewrap != FALSE(0)))
5259 g_object_notify_by_pspec(G_OBJECT(terminal)((((GObject*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((terminal)), (((GType) ((20) << (2))))))))
, pspecs[PROP_REWRAP_ON_RESIZE]);
5260}
5261catch (...)
5262{
5263 bte::log_exception();
5264}
5265
5266/**
5267 * bte_terminal_get_row_count:
5268 * @terminal: a #BteTerminal
5269 *
5270 *
5271 * Returns: the number of rows
5272 */
5273glong
5274bte_terminal_get_row_count(BteTerminal *terminal) noexcept
5275try
5276{
5277 g_return_val_if_fail(BTE_IS_TERMINAL(terminal), -1)do { if ((__builtin_expect (__extension__ ({ int _g_boolean_var_
; if ((((__extension__ ({ GTypeInstance *__inst = (GTypeInstance
*) ((terminal)); GType __t = ((bte_terminal_get_type())); gboolean
__r; if (!__inst) __r = (0); else if (__inst->g_class &&
__inst->g_class->g_type == __t) __r = (!(0)); else __r
= g_type_check_instance_is_a (__inst, __t); __r; }))))) _g_boolean_var_
= 1; else _g_boolean_var_ = 0; _g_boolean_var_; }), 1))) { }
else { g_return_if_fail_warning ("BTE", ((const char*) (__PRETTY_FUNCTION__
)), "BTE_IS_TERMINAL(terminal)"); return (-1); } } while (0)
;
5278 return IMPL(terminal)(_bte_terminal_get_impl(terminal))->m_row_count;
5279}
5280catch (...)
5281{
5282 bte::log_exception();
5283 return -1;
5284}
5285
5286/**
5287 * bte_terminal_set_scrollback_lines:
5288 * @terminal: a #BteTerminal
5289 * @lines: the length of the history buffer
5290 *
5291 * Sets the length of the scrollback buffer used by the terminal. The size of
5292 * the scrollback buffer will be set to the larger of this value and the number
5293 * of visible rows the widget can display, so 0 can safely be used to disable
5294 * scrollback.
5295 *
5296 * A negative value means "infinite scrollback".
5297 *
5298 * Note that this setting only affects the normal screen buffer.
5299 * No scrollback is allowed on the alternate screen buffer.
5300 */
5301void
5302bte_terminal_set_scrollback_lines(BteTerminal *terminal,
5303 glong lines) noexcept
5304try
5305{
5306 g_return_if_fail(BTE_IS_TERMINAL(terminal))do { if ((__builtin_expect (__extension__ ({ int _g_boolean_var_
; if ((((__extension__ ({ GTypeInstance *__inst = (GTypeInstance
*) ((terminal)); GType __t = ((bte_terminal_get_type())); gboolean
__r; if (!__inst) __r = (0); else if (__inst->g_class &&
__inst->g_class->g_type == __t) __r = (!(0)); else __r
= g_type_check_instance_is_a (__inst, __t); __r; }))))) _g_boolean_var_
= 1; else _g_boolean_var_ = 0; _g_boolean_var_; }), 1))) { }
else { g_return_if_fail_warning ("BTE", ((const char*) (__PRETTY_FUNCTION__
)), "BTE_IS_TERMINAL(terminal)"); return; } } while (0)
;
5307 g_return_if_fail(lines >= -1)do { if ((__builtin_expect (__extension__ ({ int _g_boolean_var_
; if (lines >= -1) _g_boolean_var_ = 1; else _g_boolean_var_
= 0; _g_boolean_var_; }), 1))) { } else { g_return_if_fail_warning
("BTE", ((const char*) (__PRETTY_FUNCTION__)), "lines >= -1"
); return; } } while (0)
;
5308
5309 auto const freezer = bte::glib::FreezeObjectNotify{terminal};
5310
5311 if (IMPL(terminal)(_bte_terminal_get_impl(terminal))->set_scrollback_lines(lines))
5312 g_object_notify_by_pspec(freezer.get(), pspecs[PROP_SCROLLBACK_LINES]);
5313}
5314catch (...)
5315{
5316 bte::log_exception();
5317}
5318
5319/**
5320 * bte_terminal_get_scrollback_lines:
5321 * @terminal: a #BteTerminal
5322 *
5323 * Returns: length of the scrollback buffer used by the terminal.
5324 * A negative value means "infinite scrollback".
5325 *
5326 * Since: 0.52
5327 */
5328glong
5329bte_terminal_get_scrollback_lines(BteTerminal *terminal) noexcept
5330try
5331{
5332 g_return_val_if_fail(BTE_IS_TERMINAL(terminal), 0)do { if ((__builtin_expect (__extension__ ({ int _g_boolean_var_
; if ((((__extension__ ({ GTypeInstance *__inst = (GTypeInstance
*) ((terminal)); GType __t = ((bte_terminal_get_type())); gboolean
__r; if (!__inst) __r = (0); else if (__inst->g_class &&
__inst->g_class->g_type == __t) __r = (!(0)); else __r
= g_type_check_instance_is_a (__inst, __t); __r; }))))) _g_boolean_var_
= 1; else _g_boolean_var_ = 0; _g_boolean_var_; }), 1))) { }
else { g_return_if_fail_warning ("BTE", ((const char*) (__PRETTY_FUNCTION__
)), "BTE_IS_TERMINAL(terminal)"); return (0); } } while (0)
;
5333 return IMPL(terminal)(_bte_terminal_get_impl(terminal))->m_scrollback_lines;
5334}
5335catch (...)
5336{
5337 bte::log_exception();
5338 return 0;
5339}
5340
5341/**
5342 * bte_terminal_set_scroll_on_keystroke:
5343 * @terminal: a #BteTerminal
5344 * @scroll: whether the terminal should scroll on keystrokes
5345 *
5346 * Controls whether or not the terminal will forcibly scroll to the bottom of
5347 * the viewable history when the user presses a key. Modifier keys do not
5348 * trigger this behavior.
5349 */
5350void
5351bte_terminal_set_scroll_on_keystroke(BteTerminal *terminal,
5352 gboolean scroll) noexcept
5353try
5354{
5355 g_return_if_fail(BTE_IS_TERMINAL(terminal))do { if ((__builtin_expect (__extension__ ({ int _g_boolean_var_
; if ((((__extension__ ({ GTypeInstance *__inst = (GTypeInstance
*) ((terminal)); GType __t = ((bte_terminal_get_type())); gboolean
__r; if (!__inst) __r = (0); else if (__inst->g_class &&
__inst->g_class->g_type == __t) __r = (!(0)); else __r
= g_type_check_instance_is_a (__inst, __t); __r; }))))) _g_boolean_var_
= 1; else _g_boolean_var_ = 0; _g_boolean_var_; }), 1))) { }
else { g_return_if_fail_warning ("BTE", ((const char*) (__PRETTY_FUNCTION__
)), "BTE_IS_TERMINAL(terminal)"); return; } } while (0)
;
5356
5357 if (IMPL(terminal)(_bte_terminal_get_impl(terminal))->set_scroll_on_keystroke(scroll != FALSE(0)))
5358 g_object_notify_by_pspec(G_OBJECT(terminal)((((GObject*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((terminal)), (((GType) ((20) << (2))))))))
, pspecs[PROP_SCROLL_ON_KEYSTROKE]);
5359}
5360catch (...)
5361{
5362 bte::log_exception();
5363}
5364
5365/**
5366 * bte_terminal_get_scroll_on_keystroke:
5367 * @terminal: a #BteTerminal
5368 *
5369 * Returns: whether or not the terminal will forcibly scroll to the bottom of
5370 * the viewable history when the user presses a key. Modifier keys do not
5371 * trigger this behavior.
5372 *
5373 * Since: 0.52
5374 */
5375gboolean
5376bte_terminal_get_scroll_on_keystroke(BteTerminal *terminal) noexcept
5377try
5378{
5379 g_return_val_if_fail(BTE_IS_TERMINAL(terminal), false)do { if ((__builtin_expect (__extension__ ({ int _g_boolean_var_
; if ((((__extension__ ({ GTypeInstance *__inst = (GTypeInstance
*) ((terminal)); GType __t = ((bte_terminal_get_type())); gboolean
__r; if (!__inst) __r = (0); else if (__inst->g_class &&
__inst->g_class->g_type == __t) __r = (!(0)); else __r
= g_type_check_instance_is_a (__inst, __t); __r; }))))) _g_boolean_var_
= 1; else _g_boolean_var_ = 0; _g_boolean_var_; }), 1))) { }
else { g_return_if_fail_warning ("BTE", ((const char*) (__PRETTY_FUNCTION__
)), "BTE_IS_TERMINAL(terminal)"); return (false); } } while (
0)
;
5380 return IMPL(terminal)(_bte_terminal_get_impl(terminal))->m_scroll_on_keystroke;
5381}
5382catch (...)
5383{
5384 bte::log_exception();
5385 return false;
5386}
5387
5388/**
5389 * bte_terminal_set_scroll_on_output:
5390 * @terminal: a #BteTerminal
5391 * @scroll: whether the terminal should scroll on output
5392 *
5393 * Controls whether or not the terminal will forcibly scroll to the bottom of
5394 * the viewable history when the new data is received from the child.
5395 */
5396void
5397bte_terminal_set_scroll_on_output(BteTerminal *terminal,
5398 gboolean scroll) noexcept
5399try
5400{
5401 g_return_if_fail(BTE_IS_TERMINAL(terminal))do { if ((__builtin_expect (__extension__ ({ int _g_boolean_var_
; if ((((__extension__ ({ GTypeInstance *__inst = (GTypeInstance
*) ((terminal)); GType __t = ((bte_terminal_get_type())); gboolean
__r; if (!__inst) __r = (0); else if (__inst->g_class &&
__inst->g_class->g_type == __t) __r = (!(0)); else __r
= g_type_check_instance_is_a (__inst, __t); __r; }))))) _g_boolean_var_
= 1; else _g_boolean_var_ = 0; _g_boolean_var_; }), 1))) { }
else { g_return_if_fail_warning ("BTE", ((const char*) (__PRETTY_FUNCTION__
)), "BTE_IS_TERMINAL(terminal)"); return; } } while (0)
;
5402
5403 if (IMPL(terminal)(_bte_terminal_get_impl(terminal))->set_scroll_on_output(scroll != FALSE(0)))
5404 g_object_notify_by_pspec(G_OBJECT(terminal)((((GObject*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((terminal)), (((GType) ((20) << (2))))))))
, pspecs[PROP_SCROLL_ON_OUTPUT]);
5405}
5406catch (...)
5407{
5408 bte::log_exception();
5409}
5410
5411/**
5412 * bte_terminal_get_scroll_on_output:
5413 * @terminal: a #BteTerminal
5414 *
5415 * Returns: whether or not the terminal will forcibly scroll to the bottom of
5416 * the viewable history when the new data is received from the child.
5417 *
5418 * Since: 0.52
5419 */
5420gboolean
5421bte_terminal_get_scroll_on_output(BteTerminal *terminal) noexcept
5422try
5423{
5424 g_return_val_if_fail(BTE_IS_TERMINAL(terminal), false)do { if ((__builtin_expect (__extension__ ({ int _g_boolean_var_
; if ((((__extension__ ({ GTypeInstance *__inst = (GTypeInstance
*) ((terminal)); GType __t = ((bte_terminal_get_type())); gboolean
__r; if (!__inst) __r = (0); else if (__inst->g_class &&
__inst->g_class->g_type == __t) __r = (!(0)); else __r
= g_type_check_instance_is_a (__inst, __t); __r; }))))) _g_boolean_var_
= 1; else _g_boolean_var_ = 0; _g_boolean_var_; }), 1))) { }
else { g_return_if_fail_warning ("BTE", ((const char*) (__PRETTY_FUNCTION__
)), "BTE_IS_TERMINAL(terminal)"); return (false); } } while (
0)
;
5425 return IMPL(terminal)(_bte_terminal_get_impl(terminal))->m_scroll_on_output;
5426}
5427catch (...)
5428{
5429 bte::log_exception();
5430 return false;
5431}
5432
5433/**
5434 * bte_terminal_get_window_title:
5435 * @terminal: a #BteTerminal
5436 *
5437 * Returns: (nullable) (transfer none): the window title, or %NULL
5438 */
5439const char *
5440bte_terminal_get_window_title(BteTerminal *terminal) noexcept
5441try
5442{
5443 g_return_val_if_fail(BTE_IS_TERMINAL(terminal), nullptr)do { if ((__builtin_expect (__extension__ ({ int _g_boolean_var_
; if ((((__extension__ ({ GTypeInstance *__inst = (GTypeInstance
*) ((terminal)); GType __t = ((bte_terminal_get_type())); gboolean
__r; if (!__inst) __r = (0); else if (__inst->g_class &&
__inst->g_class->g_type == __t) __r = (!(0)); else __r
= g_type_check_instance_is_a (__inst, __t); __r; }))))) _g_boolean_var_
= 1; else _g_boolean_var_ = 0; _g_boolean_var_; }), 1))) { }
else { g_return_if_fail_warning ("BTE", ((const char*) (__PRETTY_FUNCTION__
)), "BTE_IS_TERMINAL(terminal)"); return (nullptr); } } while
(0)
;
5444 return IMPL(terminal)(_bte_terminal_get_impl(terminal))->m_window_title.data();
5445}
5446catch (...)
5447{
5448 bte::log_exception();
5449 return nullptr;
5450}
5451
5452/**
5453 * bte_terminal_get_word_char_exceptions:
5454 * @terminal: a #BteTerminal
5455 *
5456 * Returns the set of characters which will be considered parts of a word
5457 * when doing word-wise selection, in addition to the default which only
5458 * considers alphanumeric characters part of a word.
5459 *
5460 * If %NULL, a built-in set is used.
5461 *
5462 * Returns: (nullable) (transfer none): a string, or %NULL
5463 *
5464 * Since: 0.40
5465 */
5466const char *
5467bte_terminal_get_word_char_exceptions(BteTerminal *terminal) noexcept
5468try
5469{
5470 g_return_val_if_fail(BTE_IS_TERMINAL(terminal), NULL)do { if ((__builtin_expect (__extension__ ({ int _g_boolean_var_
; if ((((__extension__ ({ GTypeInstance *__inst = (GTypeInstance
*) ((terminal)); GType __t = ((bte_terminal_get_type())); gboolean
__r; if (!__inst) __r = (0); else if (__inst->g_class &&
__inst->g_class->g_type == __t) __r = (!(0)); else __r
= g_type_check_instance_is_a (__inst, __t); __r; }))))) _g_boolean_var_
= 1; else _g_boolean_var_ = 0; _g_boolean_var_; }), 1))) { }
else { g_return_if_fail_warning ("BTE", ((const char*) (__PRETTY_FUNCTION__
)), "BTE_IS_TERMINAL(terminal)"); return (__null); } } while (
0)
;
5471
5472 return WIDGET(terminal)(get_widget(terminal))->word_char_exceptions();
5473}
5474catch (...)
5475{
5476 bte::log_exception();
5477 return nullptr;
5478}
5479
5480/**
5481 * bte_terminal_set_word_char_exceptions:
5482 * @terminal: a #BteTerminal
5483 * @exceptions: a string of ASCII punctuation characters, or %NULL
5484 *
5485 * With this function you can provide a set of characters which will
5486 * be considered parts of a word when doing word-wise selection, in
5487 * addition to the default which only considers alphanumeric characters
5488 * part of a word.
5489 *
5490 * The characters in @exceptions must be non-alphanumeric, each character
5491 * must occur only once, and if @exceptions contains the character
5492 * U+002D HYPHEN-MINUS, it must be at the start of the string.
5493 *
5494 * Use %NULL to reset the set of exception characters to the default.
5495 *
5496 * Since: 0.40
5497 */
5498void
5499bte_terminal_set_word_char_exceptions(BteTerminal *terminal,
5500 const char *exceptions) noexcept
5501try
5502{
5503 g_return_if_fail(BTE_IS_TERMINAL(terminal))do { if ((__builtin_expect (__extension__ ({ int _g_boolean_var_
; if ((((__extension__ ({ GTypeInstance *__inst = (GTypeInstance
*) ((terminal)); GType __t = ((bte_terminal_get_type())); gboolean
__r; if (!__inst) __r = (0); else if (__inst->g_class &&
__inst->g_class->g_type == __t) __r = (!(0)); else __r
= g_type_check_instance_is_a (__inst, __t); __r; }))))) _g_boolean_var_
= 1; else _g_boolean_var_ = 0; _g_boolean_var_; }), 1))) { }
else { g_return_if_fail_warning ("BTE", ((const char*) (__PRETTY_FUNCTION__
)), "BTE_IS_TERMINAL(terminal)"); return; } } while (0)
;
5504
5505 auto stropt = exceptions ? std::make_optional<std::string_view>(exceptions) : std::nullopt;
5506 if (WIDGET(terminal)(get_widget(terminal))->set_word_char_exceptions(stropt))
5507 g_object_notify_by_pspec(G_OBJECT(terminal)((((GObject*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((terminal)), (((GType) ((20) << (2))))))))
, pspecs[PROP_WORD_CHAR_EXCEPTIONS]);
5508}
5509catch (...)
5510{
5511 bte::log_exception();
5512}
5513
5514/**
5515 * bte_terminal_write_contents_sync:
5516 * @terminal: a #BteTerminal
5517 * @stream: a #GOutputStream to write to
5518 * @flags: a set of #BteWriteFlags
5519 * @cancellable: (allow-none): a #GCancellable object, or %NULL
5520 * @error: (allow-none): a #GError location to store the error occuring, or %NULL
5521 *
5522 * Write contents of the current contents of @terminal (including any
5523 * scrollback history) to @stream according to @flags.
5524 *
5525 * If @cancellable is not %NULL, then the operation can be cancelled by triggering
5526 * the cancellable object from another thread. If the operation was cancelled,
5527 * the error %G_IO_ERROR_CANCELLED will be returned in @error.
5528 *
5529 * This is a synchronous operation and will make the widget (and input
5530 * processing) during the write operation, which may take a long time
5531 * depending on scrollback history and @stream availability for writing.
5532 *
5533 * Returns: %TRUE on success, %FALSE if there was an error
5534 */
5535gboolean
5536bte_terminal_write_contents_sync (BteTerminal *terminal,
5537 GOutputStream *stream,
5538 BteWriteFlags flags,
5539 GCancellable *cancellable,
5540 GError **error) noexcept
5541try
5542{
5543 g_return_val_if_fail(BTE_IS_TERMINAL(terminal), false)do { if ((__builtin_expect (__extension__ ({ int _g_boolean_var_
; if ((((__extension__ ({ GTypeInstance *__inst = (GTypeInstance
*) ((terminal)); GType __t = ((bte_terminal_get_type())); gboolean
__r; if (!__inst) __r = (0); else if (__inst->g_class &&
__inst->g_class->g_type == __t) __r = (!(0)); else __r
= g_type_check_instance_is_a (__inst, __t); __r; }))))) _g_boolean_var_
= 1; else _g_boolean_var_ = 0; _g_boolean_var_; }), 1))) { }
else { g_return_if_fail_warning ("BTE", ((const char*) (__PRETTY_FUNCTION__
)), "BTE_IS_TERMINAL(terminal)"); return (false); } } while (
0)
;
5544 g_return_val_if_fail(G_IS_OUTPUT_STREAM(stream), false)do { if ((__builtin_expect (__extension__ ({ int _g_boolean_var_
; if ((((__extension__ ({ GTypeInstance *__inst = (GTypeInstance
*) ((stream)); GType __t = ((g_output_stream_get_type ())); gboolean
__r; if (!__inst) __r = (0); else if (__inst->g_class &&
__inst->g_class->g_type == __t) __r = (!(0)); else __r
= g_type_check_instance_is_a (__inst, __t); __r; }))))) _g_boolean_var_
= 1; else _g_boolean_var_ = 0; _g_boolean_var_; }), 1))) { }
else { g_return_if_fail_warning ("BTE", ((const char*) (__PRETTY_FUNCTION__
)), "G_IS_OUTPUT_STREAM(stream)"); return (false); } } while (
0)
;
5545
5546 return IMPL(terminal)(_bte_terminal_get_impl(terminal))->write_contents_sync(stream, flags, cancellable, error);
5547}
5548catch (...)
5549{
5550 return bte::glib::set_error_from_exception(error);
5551}
5552
5553/**
5554 * bte_terminal_set_clear_background:
5555 * @terminal: a #BteTerminal
5556 * @setting:
5557 *
5558 * Sets whether to paint the background with the background colour.
5559 * The default is %TRUE.
5560 *
5561 * This function is rarely useful. One use for it is to add a background
5562 * image to the terminal.
5563 *
5564 * Since: 0.52
5565 */
5566void
5567bte_terminal_set_clear_background(BteTerminal* terminal,
5568 gboolean setting) noexcept
5569try
5570{
5571 g_return_if_fail(BTE_IS_TERMINAL(terminal))do { if ((__builtin_expect (__extension__ ({ int _g_boolean_var_
; if ((((__extension__ ({ GTypeInstance *__inst = (GTypeInstance
*) ((terminal)); GType __t = ((bte_terminal_get_type())); gboolean
__r; if (!__inst) __r = (0); else if (__inst->g_class &&
__inst->g_class->g_type == __t) __r = (!(0)); else __r
= g_type_check_instance_is_a (__inst, __t); __r; }))))) _g_boolean_var_
= 1; else _g_boolean_var_ = 0; _g_boolean_var_; }), 1))) { }
else { g_return_if_fail_warning ("BTE", ((const char*) (__PRETTY_FUNCTION__
)), "BTE_IS_TERMINAL(terminal)"); return; } } while (0)
;
5572
5573 IMPL(terminal)(_bte_terminal_get_impl(terminal))->set_clear_background(setting != FALSE(0));
5574}
5575catch (...)
5576{
5577 bte::log_exception();
5578}
5579
5580/**
5581 * bte_terminal_get_color_background_for_draw:
5582 * @terminal: a #BteTerminal
5583 * @color: (out): a location to store a #GdbRGBA color
5584 *
5585 * Returns the background colour, as used by @terminal when
5586 * drawing the background, which may be different from
5587 * the color set by bte_terminal_set_color_background().
5588 *
5589 * Note: you must only call this function while handling the
5590 * CtkWidget::draw signal.
5591 *
5592 * This function is rarely useful. One use for it is if you disable
5593 * drawing the background (see bte_terminal_set_clear_background())
5594 * and then need to draw the background yourself.
5595 *
5596 * Since: 0.54
5597 */
5598void
5599bte_terminal_get_color_background_for_draw(BteTerminal* terminal,
5600 CdkRGBA* color) noexcept
5601try
5602{
5603 g_return_if_fail(BTE_IS_TERMINAL(terminal))do { if ((__builtin_expect (__extension__ ({ int _g_boolean_var_
; if ((((__extension__ ({ GTypeInstance *__inst = (GTypeInstance
*) ((terminal)); GType __t = ((bte_terminal_get_type())); gboolean
__r; if (!__inst) __r = (0); else if (__inst->g_class &&
__inst->g_class->g_type == __t) __r = (!(0)); else __r
= g_type_check_instance_is_a (__inst, __t); __r; }))))) _g_boolean_var_
= 1; else _g_boolean_var_ = 0; _g_boolean_var_; }), 1))) { }
else { g_return_if_fail_warning ("BTE", ((const char*) (__PRETTY_FUNCTION__
)), "BTE_IS_TERMINAL(terminal)"); return; } } while (0)
;
5604 g_return_if_fail(color != nullptr)do { if ((__builtin_expect (__extension__ ({ int _g_boolean_var_
; if (color != nullptr) _g_boolean_var_ = 1; else _g_boolean_var_
= 0; _g_boolean_var_; }), 1))) { } else { g_return_if_fail_warning
("BTE", ((const char*) (__PRETTY_FUNCTION__)), "color != nullptr"
); return; } } while (0)
;
5605
5606 auto impl = IMPL(terminal)(_bte_terminal_get_impl(terminal));
5607 auto const c = impl->get_color(BTE_DEFAULT_BG257);
5608 color->red = c->red / 65535.;
5609 color->green = c->green / 65535.;
5610 color->blue = c->blue / 65535.;
5611 color->alpha = impl->m_background_alpha;
5612}
5613catch (...)
5614{
5615 bte::log_exception();
5616 *color = {0., 0., 0., 1.};
5617}
5618
5619/**
5620 * bte_terminal_set_enable_sixel:
5621 * @terminal: a #BteTerminal
5622 * @enabled: whether to enable SIXEL images
5623 *
5624 * This function does nothing.
5625 *
5626 * Since: 0.62
5627 */
5628void
5629bte_terminal_set_enable_sixel(BteTerminal *terminal,
5630 gboolean enabled) noexcept
5631try
5632{
5633}
5634catch (...)
5635{
5636 bte::log_exception();
5637}
5638
5639/**
5640 * bte_terminal_get_enable_sixel:
5641 * @terminal: a #BteTerminal
5642 *
5643 * Returns: %FALSE
5644 *
5645 * Since: 0.62
5646 */
5647gboolean
5648bte_terminal_get_enable_sixel(BteTerminal *terminal) noexcept
5649try
5650{
5651 return false;
5652}
5653catch (...)
5654{
5655 bte::log_exception();
5656 return false;
5657}
5658
5659namespace bte {
5660
5661using namespace std::literals;
5662
5663static void
5664exception_append_to_string(std::exception const& e,
5665 std::string& what,
5666 int level = 0)
5667{
5668 if (level > 0)
5669 what += ": "sv;
5670 what += e.what();
5671
5672 try {
5673 std::rethrow_if_nested(e);
5674 } catch (std::exception const& en) {
5675 exception_append_to_string(en, what, level + 1);
5676 } catch (...) {
5677 what += ": Unknown nested exception"sv;
5678 }
5679}
5680
5681#ifdef BTE_DEBUG
5682void log_exception(char const* func,
5683 char const* filename,
5684 int const line) noexcept
5685try
5686{
5687 auto what = std::string{};
5688
5689 try {
5690 throw; // rethrow current exception
5691 } catch (std::bad_alloc const& e) {
5692 g_error("Allocation failure: %s\n", e.what());
5693 } catch (std::exception const& e) {
5694 exception_append_to_string(e, what);
5695 } catch (...) {
5696 what = "Unknown exception"sv;
5697 }
5698
5699 _bte_debug_print(BTE_DEBUG_EXCEPTIONS,do { } while(0)
5700 "Caught exception in %s [%s:%d]: %s\n",do { } while(0)
5701 func, filename, line, what.c_str())do { } while(0);
5702}
5703catch (...)
5704{
5705 _bte_debug_print(BTE_DEBUG_EXCEPTIONS,do { } while(0)
5706 "Caught exception while logging an exception in %s [%s:%d]\n",do { } while(0)
5707 func, filename, line)do { } while(0);
5708}
5709#endif /* BTE_DEBUG */
5710
5711namespace glib {
5712
5713bool set_error_from_exception(GError** error
5714#ifdef BTE_DEBUG
5715 , char const* func
5716 , char const* filename
5717 , int const line
5718#endif
5719 ) noexcept
5720try
5721{
5722 auto what = std::string{};
5723
5724 try {
5725 throw; // rethrow current exception
5726 } catch (std::bad_alloc const& e) {
5727 g_error("Allocation failure: %s\n", e.what());
5728 } catch (std::exception const& e) {
5729 exception_append_to_string(e, what);
5730 } catch (...) {
5731 what = "Unknown exception"sv;
5732 }
5733
5734#ifdef BTE_DEBUG
5735 auto msg = bte::glib::take_string(g_strdup_printf("Caught exception in %s [%s:%d]: %s",
5736 func, filename, line,
5737 what.c_str()));
5738#else
5739 auto msg = bte::glib::take_string(g_strdup_printf("Caught exception: %s",
5740 what.c_str()));
5741#endif
5742 auto msg_str = bte::glib::take_string(g_utf8_make_valid(msg.get(), -1));
5743 g_set_error_literal(error,
5744 G_IO_ERRORg_io_error_quark(),
5745 G_IO_ERROR_FAILED,
5746 msg_str.get());
5747 _bte_debug_print(BTE_DEBUG_EXCEPTIONS, "%s", msg_str.get())do { } while(0);
5748
5749 return false;
5750}
5751catch (...)
5752{
5753 bte::log_exception();
5754#ifdef BTE_DEBUG
5755 g_set_error(error, G_IO_ERRORg_io_error_quark(), G_IO_ERROR_FAILED,
5756 "Caught exception while logging an exception in %s [%s:%d]\n",
5757 func, filename, line);
5758#else
5759 g_set_error_literal(error, G_IO_ERRORg_io_error_quark(), G_IO_ERROR_FAILED,
5760 "Caught exception while logging an exception");
5761#endif
5762 return false;
5763}
5764
5765} // namespace glib
5766} // namespace bte