Gnome Vte is a virtual terminal widget for GTK+ applications. It is used in various GTK+ applications, such as Guake, lxterminal, qemu, remmina, terminator…etc.
Its a well done infrastructure library, but with poor documentation about how to building, debugging, and developing this library.
Here are some notes to fill the gap.
Building
1 2 3 4 5 |
$ git clone https://gitlab.gnome.org/GNOME/vte $ cd vte $ meson _build $ ninja –C _build $ sudo ninja –C _build install |
We can use -D
to pass configuration to meson, such as enable debug mode or chang the install prefix:
1 |
$ meson _build –Dprefix=/usr –Ddebugg=true —reconfigure |
Debugging
Vte provide its _vte_debug_print
debug print logger, we can setup environment variable to trigger the logger:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 |
# You should change “guake” to your program which called Vte $ VTE_DEBUG=selection guake .... Guake initialized Showing the terminal Selection started at halfgrid[14,110L]. Selection resolved to grid[empty]. Selection dragged to halfgrid[13,109R]. Selection resolved to grid[(14,0), (15,0)). Selection dragged to halfgrid[12,108R]. Selection resolved to grid[(13,0), (15,0)). Selection dragged to halfgrid[11,107R]. Selection resolved to grid[(12,0), (15,0)). Selection dragged to halfgrid[10,105R]. Selection resolved to grid[(11,0), (15,0)). Selection dragged to halfgrid[10,102L]. ... |
You can provide multiple logging level to the variable:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 |
$ VTE_DEBUG=selection,draw,cell guake ... Settings cairo context draw_clear (0, 0, 1908, 524) draw_fill_rectangle (0, 198, 1904, 18, color=(65535,65535,65535,1.000)) draw_fill_rectangle (0, 216, 1904, 18, color=(65535,65535,65535,1.000)) draw_fill_rectangle (0, 234, 1904, 18, color=(65535,65535,65535,1.000)) Unsetting cairo context Assuming ownership of selection. Setting selection 0 (8 UTF–8 bytes.) for target UTF8_STRING 0x000a 0x000a 0x000a 0x000a 0x000a 0x000a 0x000a 0x000a Hiding the terminal Lost selection. Deselecting all text. Selection resolved to grid[empty]. ... |
Here is the full logging level list:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
VTE_DEBUG_MISC = 1 << 0, VTE_DEBUG_PARSER = 1 << 1, VTE_DEBUG_IO = 1 << 2, VTE_DEBUG_UPDATES = 1 << 3, VTE_DEBUG_EVENTS = 1 << 4, VTE_DEBUG_SIGNALS = 1 << 5, VTE_DEBUG_SELECTION = 1 << 6, VTE_DEBUG_SUBSTITUTION = 1 << 7, VTE_DEBUG_RING = 1 << 8, VTE_DEBUG_PTY = 1 << 9, VTE_DEBUG_CURSOR = 1 << 10, VTE_DEBUG_KEYBOARD = 1 << 11, VTE_DEBUG_LIFECYCLE = 1 << 12, VTE_DEBUG_WORK = 1 << 13, VTE_DEBUG_CELLS = 1 << 14, VTE_DEBUG_TIMEOUT = 1 << 15, VTE_DEBUG_DRAW = 1 << 16, VTE_DEBUG_ALLY = 1 << 17, VTE_DEBUG_ADJ = 1 << 18, VTE_DEBUG_PANGOCAIRO = 1 << 19, VTE_DEBUG_WIDGET_SIZE = 1 << 20, VTE_DEBUG_STYLE = 1 << 21, VTE_DEBUG_RESIZE = 1 << 22, VTE_DEBUG_REGEX = 1 << 23, VTE_DEBUG_HYPERLINK = 1 << 24, VTE_DEBUG_MODES = 1 << 25, VTE_DEBUG_EMULATION = 1 << 26, |
If you want to log all events, please use “all”: VTE_DEBUG=all guake
Developing
Adding new python wrapper API function
- Add function inside
src/vtegtk.cc
- Add declaration to
src/vte/vteterminal.h
with_VTE_PUBLIC
&_VTE_GNUC_NONNULL(1)
Print Call Stack of function
- libunwind: Programmatic access to the call stack in C
- You should add two ld flags into
meson.build: linker_flags
- -lunwind
- -lunwind-x86_64
Leave a Reply