2008-07-10 03:27:56 +00:00
<?xml version="1.0"?>
< !DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.3//EN"
"http://www.oasis-open.org/docbook/xml/4.3/docbookx.dtd" [
]>
2010-05-08 05:18:53 +00:00
<refentry id= "gtk-running" >
2002-01-11 22:39:03 +00:00
<refmeta >
2019-02-05 09:14:31 +00:00
<refentrytitle > Running GTK Applications</refentrytitle>
2002-01-11 22:39:03 +00:00
<manvolnum > 3</manvolnum>
<refmiscinfo > GTK Library</refmiscinfo>
</refmeta>
<refnamediv >
2019-02-05 09:14:31 +00:00
<refname > Running GTK Applications</refname>
2002-01-11 22:39:03 +00:00
<refpurpose >
2019-02-05 09:14:31 +00:00
How to run and debug your GTK application
2002-01-11 22:39:03 +00:00
</refpurpose>
</refnamediv>
<refsect1 >
2019-02-05 09:14:31 +00:00
<title > Running and debugging GTK Applications</title>
2002-01-11 22:39:03 +00:00
<refsect2 >
<title > Environment variables</title>
2010-05-08 05:18:53 +00:00
<para >
2019-02-05 09:14:31 +00:00
GTK inspects a number of environment variables in addition to standard
2010-05-08 05:18:53 +00:00
variables like <envar > LANG</envar> , <envar > PATH</envar> , <envar > HOME</envar>
or <envar > DISPLAY</envar> ; mostly to determine paths to look for certain
files. The <link linkend= "x11-envar" > X11</link> ,
<link linkend= "win32-envar" > Windows</link> and
2013-01-24 11:23:04 +00:00
<link linkend= "broadway-envar" > Broadway</link> GDK backends use some
2004-07-31 21:21:08 +00:00
additional environment variables.
2002-01-11 22:39:03 +00:00
</para>
<formalpara id= "GTK-Debug-Options" >
<title > <envar > GTK_DEBUG</envar> </title>
<para >
2019-02-05 09:14:31 +00:00
Unless GTK has been configured with <option > --enable-debug=no</option> ,
this variable can be set to a list of debug options, which cause GTK
2002-01-11 22:39:03 +00:00
to print out different types of debugging information.
<variablelist >
2014-08-02 22:23:58 +00:00
<varlistentry >
<term > actions</term>
2016-03-11 04:18:38 +00:00
<listitem > <para > Actions and menu models</para> </listitem>
2014-08-02 22:23:58 +00:00
</varlistentry>
2004-10-08 15:26:02 +00:00
<varlistentry >
2014-06-27 10:46:34 +00:00
<term > builder</term>
<listitem > <para > GtkBuilder support</para> </listitem>
2004-10-08 15:26:02 +00:00
</varlistentry>
2002-01-11 22:39:03 +00:00
<varlistentry >
2014-06-27 10:46:34 +00:00
<term > geometry</term>
<listitem > <para > Size allocation</para> </listitem>
2002-01-11 22:39:03 +00:00
</varlistentry>
<varlistentry >
2014-06-27 10:46:34 +00:00
<term > icontheme</term>
<listitem > <para > Icon themes</para> </listitem>
2002-01-11 22:39:03 +00:00
</varlistentry>
2004-10-08 15:26:02 +00:00
<varlistentry >
<term > keybindings</term>
<listitem > <para > Keybindings</para> </listitem>
</varlistentry>
<varlistentry >
2014-06-27 10:46:34 +00:00
<term > modules</term>
<listitem > <para > Loading of modules</para> </listitem>
2004-10-08 15:26:02 +00:00
</varlistentry>
2012-05-01 23:59:15 +00:00
<varlistentry >
2014-06-27 10:46:34 +00:00
<term > printing</term>
<listitem > <para > Printing support</para> </listitem>
2012-05-01 23:59:15 +00:00
</varlistentry>
2014-05-11 01:39:55 +00:00
<varlistentry >
2014-06-27 10:46:34 +00:00
<term > size-request</term>
<listitem > <para > Size requests</para> </listitem>
2014-05-11 01:39:55 +00:00
</varlistentry>
<varlistentry >
2014-06-27 10:46:34 +00:00
<term > text</term>
<listitem > <para > Text widget internals</para> </listitem>
2014-05-11 01:39:55 +00:00
</varlistentry>
2018-01-14 22:03:28 +00:00
<varlistentry >
<term > tree</term>
<listitem > <para > Tree widget internals</para> </listitem>
</varlistentry>
</variablelist>
A number of keys are influencing behavior instead of just logging:
<variablelist >
<varlistentry >
<term > interactive</term>
<listitem > <para > Open the <link linkend= "interactive-debugging" > interactive debugger</link> </para> </listitem>
</varlistentry>
<varlistentry >
<term > no-css-cache</term>
<listitem > <para > Bypass caching for CSS style properties</para> </listitem>
</varlistentry>
2014-07-10 14:10:11 +00:00
<varlistentry >
<term > touchscreen</term>
<listitem > <para > Pretend the pointer is a touchscreen device</para> </listitem>
</varlistentry>
2014-05-11 01:39:55 +00:00
<varlistentry >
2014-06-27 10:46:34 +00:00
<term > updates</term>
<listitem > <para > Visual feedback about window updates</para> </listitem>
2014-05-11 01:39:55 +00:00
</varlistentry>
2015-12-17 11:34:30 +00:00
<varlistentry >
<term > resize</term>
<listitem > <para > Highlight resizing widgets</para> </listitem>
</varlistentry>
2016-03-11 04:14:57 +00:00
<varlistentry >
<term > layout</term>
<listitem > <para > Show layout borders</para> </listitem>
</varlistentry>
2016-12-20 18:20:02 +00:00
<varlistentry >
<term > snapshot</term>
<listitem > <para > Include debug render nodes in the generated snapshots</para> </listitem>
</varlistentry>
2002-01-11 22:39:03 +00:00
</variablelist>
2010-05-08 05:18:53 +00:00
The special value <literal > all</literal> can be used to turn on all
2014-05-11 01:39:55 +00:00
debug options. The special value <literal > help</literal> can be used
to obtain a list of all supported debug options.
2002-01-11 22:39:03 +00:00
</para>
</formalpara>
2011-02-09 05:21:37 +00:00
<formalpara id= "gtk-path" >
2002-02-19 05:33:34 +00:00
<title > <envar > GTK_PATH</envar> </title>
2002-01-11 22:39:03 +00:00
<para >
2019-02-05 09:14:31 +00:00
Specifies a list of directories to search when GTK is looking for
2018-02-18 14:02:05 +00:00
dynamically loaded objects such as input method
modules and print backends. If the path to
2010-05-08 05:18:53 +00:00
the dynamically loaded object is given as an absolute path name,
2019-02-05 09:14:31 +00:00
then GTK loads it directly.
Otherwise, GTK goes in turn through the directories in <envar > GTK_PATH</envar> ,
2016-10-23 18:06:33 +00:00
followed by the directory <filename > .gtk-4.0</filename> in the user's
2010-05-08 05:18:53 +00:00
home directory, followed by the system default directory,
2016-10-23 18:06:33 +00:00
which is <filename > <replaceable > libdir</replaceable> /gtk-4.0/modules</filename> .
2010-05-08 05:18:53 +00:00
(If <envar > GTK_EXE_PREFIX</envar> is defined, <replaceable > libdir</replaceable> is
2002-01-11 22:39:03 +00:00
<filename > $GTK_EXE_PREFIX/lib</filename> . Otherwise it is the libdir
2019-02-05 09:14:31 +00:00
specified when GTK was configured, usually
2002-02-19 05:33:34 +00:00
<filename > /usr/lib</filename> , or
<filename > /usr/local/lib</filename> .)
2019-02-05 09:14:31 +00:00
For each directory in this list, GTK actually looks in a
2002-02-19 05:33:34 +00:00
subdirectory
<filename > <replaceable > directory</replaceable> /<replaceable > version</replaceable> /<replaceable > host</replaceable> /<replaceable > type</replaceable> </filename>
Where <replaceable > version</replaceable> is derived from the
2019-02-05 09:14:31 +00:00
version of GTK (use <literal > pkg-config
--variable=gtk_binary_version gtk4</literal> to determine this from a
2002-02-19 05:33:34 +00:00
script), <replaceable > host</replaceable> is the architecture on
2019-02-05 09:14:31 +00:00
which GTK was built. (use <literal > pkg-config
--variable=gtk_host gtk4</literal> to determine this from a
2002-02-19 05:33:34 +00:00
script), and <replaceable > type</replaceable> is a directory
specific to the type of modules; currently it can be
2010-05-08 05:18:53 +00:00
<literal > modules</literal> , <literal > engines</literal> ,
<literal > immodules</literal> , <literal > filesystems</literal> or
2007-06-10 06:52:51 +00:00
<literal > printbackends</literal> , corresponding to the types of
modules mentioned above. Either <replaceable > version</replaceable> ,
2019-02-05 09:14:31 +00:00
<replaceable > host</replaceable> , or both may be omitted. GTK looks
2002-02-19 05:33:34 +00:00
first in the most specific directory, then in directories with
fewer components.
The components of GTK_PATH are separated by the ':' character on
Linux and Unix, and the ';' character on Windows.
2002-01-11 22:39:03 +00:00
</para>
2011-02-08 18:09:52 +00:00
<warning >
2019-02-05 09:14:31 +00:00
Note that this environment variable is read by GTK 2.x and GTK 3.x too,
2018-05-07 02:06:35 +00:00
which makes it unsuitable for setting it system-wide (or session-wide),
2019-02-05 09:14:31 +00:00
since doing so will cause applications using different GTK versions
2018-05-07 02:06:35 +00:00
to see incompatible modules.
2011-02-08 18:09:52 +00:00
</warning>
2002-01-11 22:39:03 +00:00
</formalpara>
<formalpara >
<title > <envar > GTK_IM_MODULE</envar> </title>
<para >
Specifies an IM module to use in preference to the one determined
2011-01-31 14:29:40 +00:00
from the locale. If this isn't set and you are running on the system
2007-12-18 03:24:17 +00:00
that enables <literal > XSETTINGS</literal> and has a value in
<literal > Gtk/IMModule</literal> , that will be used for the default
IM module.
2011-11-05 05:47:46 +00:00
This also can be a colon-separated list of input-methods, which
2019-02-05 09:14:31 +00:00
GTK will try in turn until it finds one available on the system.
2002-01-11 22:39:03 +00:00
</para>
</formalpara>
<formalpara >
<title > <envar > GTK_EXE_PREFIX</envar> </title>
<para >
2019-02-05 09:14:31 +00:00
If set, GTK uses <filename > $GTK_EXE_PREFIX/lib</filename> instead of
the libdir configured when GTK was compiled.
2002-01-11 22:39:03 +00:00
</para>
</formalpara>
<formalpara >
<title > <envar > GTK_DATA_PREFIX</envar> </title>
<para >
2019-02-05 09:14:31 +00:00
If set, makes GTK use <filename > $GTK_DATA_PREFIX</filename>
instead of the prefix configured when GTK was compiled.
2002-01-11 22:39:03 +00:00
</para>
</formalpara>
2013-11-18 01:28:49 +00:00
<formalpara >
<title > <envar > GTK_THEME</envar> </title>
<para >
2019-02-05 09:14:31 +00:00
If set, makes GTK use the named theme instead of the theme
2013-11-18 01:28:49 +00:00
that is specified by the gtk-theme-name setting. This is intended
mainly for easy debugging of theme issues.
</para>
2014-03-07 00:27:37 +00:00
<para >
It is also possible to specify a theme variant to load, by appending
the variant name with a colon, like this: `GTK_THEME=Adwaita:dark`.
</para>
2013-11-18 01:28:49 +00:00
</formalpara>
2002-01-11 22:39:03 +00:00
<para >
The following environment variables are used by GdkPixbuf, GDK or
2019-02-05 09:14:31 +00:00
Pango, not by GTK itself, but we list them here for completeness
2002-01-11 22:39:03 +00:00
nevertheless.
</para>
<formalpara >
2002-10-03 22:49:35 +00:00
<title > <envar > GDK_PIXBUF_MODULE_FILE</envar> </title>
2002-01-11 22:39:03 +00:00
<para >
2010-05-08 05:18:53 +00:00
Specifies the file listing the GdkPixbuf loader modules to load.
This environment variable overrides the default value
2016-10-23 18:06:33 +00:00
<filename > <replaceable > libdir</replaceable> /gtk-4.0/4.0.0/loaders.cache</filename>
2010-05-18 23:23:06 +00:00
(<replaceable > libdir</replaceable> is the sysconfdir specified when
2019-02-05 09:14:31 +00:00
GTK was configured, usually <filename > /usr/local/lib</filename> .)
2011-01-31 14:29:40 +00:00
</para>
<para >
The <filename > loaders.cache</filename> file is generated by the
<command > gdk-pixbuf-query-loaders</command> utility.
2002-01-11 22:39:03 +00:00
</para>
</formalpara>
<formalpara id= "GDK-Debug-Options" >
<title > <envar > GDK_DEBUG</envar> </title>
<para >
2019-02-05 09:14:31 +00:00
If GTK has been configured with <option > --enable-debug=yes</option> ,
2002-01-11 22:39:03 +00:00
this variable can be set to a list of debug options, which cause GDK
to print out different types of debugging information.
<variablelist >
<varlistentry >
2014-06-27 10:52:34 +00:00
<term > cursor</term>
<listitem > <para > Information about cursor objects (only win32)</para> </listitem>
2002-01-11 22:39:03 +00:00
</varlistentry>
2009-11-27 05:32:14 +00:00
<varlistentry >
2014-06-27 10:52:34 +00:00
<term > eventloop</term>
<listitem > <para > Information about event loop operation (mostly Quartz)</para> </listitem>
2009-11-27 05:32:14 +00:00
</varlistentry>
<varlistentry >
2014-06-27 10:52:34 +00:00
<term > misc</term>
<listitem > <para > Miscellaneous information</para> </listitem>
2009-11-27 05:32:14 +00:00
</varlistentry>
2018-01-10 05:09:25 +00:00
<varlistentry >
<term > frames</term>
<listitem > <para > Information about the frame clock</para> </listitem>
</varlistentry>
<varlistentry >
<term > settings</term>
<listitem > <para > Information about xsettings</para> </listitem>
</varlistentry>
<varlistentry >
<term > selection</term>
<listitem > <para > Information about selections</para> </listitem>
</varlistentry>
<varlistentry >
<term > clipboard</term>
<listitem > <para > Information about clipboards</para> </listitem>
</varlistentry>
<varlistentry >
<term > dnd</term>
<listitem > <para > Information about drag-and-drop</para> </listitem>
</varlistentry>
<varlistentry >
<term > opengl</term>
<listitem > <para > Information about OpenGL</para> </listitem>
</varlistentry>
<varlistentry >
<term > vulkan</term>
<listitem > <para > Information about Vulkan</para> </listitem>
</varlistentry>
2018-01-14 22:03:28 +00:00
</variablelist>
A number of options affect behavior instead of logging:
<variablelist >
<varlistentry >
<term > nograbs</term>
<listitem > <para > Turn off all pointer and keyboard grabs</para> </listitem>
</varlistentry>
<varlistentry >
<term > gl-disable</term>
<listitem > <para > Disable OpenGL support</para> </listitem>
</varlistentry>
<varlistentry >
<term > gl-software</term>
<listitem > <para > Force OpenGL software rendering</para> </listitem>
</varlistentry>
<varlistentry >
<term > gl-texture-rect</term>
<listitem > <para > Use the OpenGL texture rectangle extension, if available</para> </listitem>
</varlistentry>
<varlistentry >
<term > gl-legacy</term>
<listitem > <para > Use a legacy OpenGL context</para> </listitem>
</varlistentry>
<varlistentry >
2018-05-07 02:45:36 +00:00
<term > gl-gles</term>
2018-01-14 22:03:28 +00:00
<listitem > <para > Use a GLES OpenGL context</para> </listitem>
</varlistentry>
<varlistentry >
<term > vulkan-disable</term>
<listitem > <para > Disable Vulkan support</para> </listitem>
</varlistentry>
<varlistentry >
<term > vulkan-validate</term>
<listitem > <para > Load the Vulkan validation layer, if available</para> </listitem>
</varlistentry>
2002-01-11 22:39:03 +00:00
</variablelist>
2009-11-27 05:32:14 +00:00
The special value <literal > all</literal> can be used to turn on all
2018-01-10 05:02:23 +00:00
debug options. The special value <literal > help</literal> can be used
to obtain a list of all supported debug options.
2002-01-11 22:39:03 +00:00
</para>
</formalpara>
2018-01-14 22:03:28 +00:00
<formalpara id= "GSK-Debug-Options" >
<title > <envar > GSK_DEBUG</envar> </title>
2011-03-11 00:10:37 +00:00
<para >
2019-02-05 09:14:31 +00:00
If GTK has been configured with <option > --enable-debug=yes</option> ,
2018-01-14 22:03:28 +00:00
this variable can be set to a list of debug options, which cause GSK
to print out different types of debugging information.
<variablelist >
<varlistentry >
<term > renderer</term>
<listitem > <para > General renderer information</para> </listitem>
</varlistentry>
<varlistentry >
<term > cairo</term>
<listitem > <para > cairo renderer information</para> </listitem>
</varlistentry>
<varlistentry >
<term > opengl</term>
<listitem > <para > OpenGL renderer information</para> </listitem>
</varlistentry>
2018-05-07 02:45:36 +00:00
<varlistentry >
<term > shaders</term>
<listitem > <para > Shaders</para> </listitem>
</varlistentry>
<varlistentry >
<term > ssurface</term>
<listitem > <para > Surfaces</para> </listitem>
</varlistentry>
2018-01-14 22:03:28 +00:00
<varlistentry >
<term > vulkan</term>
<listitem > <para > Vulkan renderer information</para> </listitem>
</varlistentry>
<varlistentry >
<term > fallback</term>
<listitem > <para > Information about fallbacks</para> </listitem>
</varlistentry>
<varlistentry >
<term > glyphcache</term>
<listitem > <para > Information about glyph caching</para> </listitem>
</varlistentry>
</variablelist>
A number of options affect behavior instead of logging:
<variablelist >
2018-05-07 02:45:36 +00:00
<varlistentry >
<term > diff</term>
<listitem > <para > Show differences</para> </listitem>
</varlistentry>
2018-01-14 22:03:28 +00:00
<varlistentry >
<term > geometry</term>
<listitem > <para > Show borders</para> </listitem>
</varlistentry>
<varlistentry >
<term > full-redraw</term>
<listitem > <para > Force full redraws for every frame</para> </listitem>
</varlistentry>
<varlistentry >
<term > sync</term>
<listitem > <para > Sync after each frame</para> </listitem>
</varlistentry>
<varlistentry >
<term > vulkan-staging-image</term>
<listitem > <para > Use a staging image for Vulkan texture upload</para> </listitem>
</varlistentry>
<varlistentry >
<term > vulkan-staging-buffer</term>
<listitem > <para > Use a staging buffer for Vulkan texture upload</para> </listitem>
</varlistentry>
</variablelist>
The special value <literal > all</literal> can be used to turn on all
debug options. The special value <literal > help</literal> can be used
to obtain a list of all supported debug options.
2011-03-11 00:10:37 +00:00
</para>
</formalpara>
2011-02-12 21:03:08 +00:00
<formalpara >
<title > <envar > GDK_BACKEND</envar> </title>
<para >
2012-03-11 18:23:53 +00:00
If set, selects the GDK backend to use. Selecting a backend requires that
2019-02-05 09:14:31 +00:00
GTK is compiled with support for that backend. The following backends can
2016-02-19 03:03:12 +00:00
be selected, provided they are included in the GDK libraries you are using:
2011-02-12 21:03:08 +00:00
<variablelist >
<varlistentry >
<term > quartz</term>
<listitem > <para > Selects the native Quartz backend</para> </listitem>
</varlistentry>
<varlistentry >
<term > win32</term>
<listitem > <para > Selects the native backend for Microsoft Windows</para> </listitem>
</varlistentry>
<varlistentry >
<term > x11</term>
<listitem > <para > Selects the native backend for connecting to X11 servers.</para> </listitem>
</varlistentry>
2012-03-11 18:23:53 +00:00
<varlistentry >
<term > broadway</term>
2013-01-24 11:23:04 +00:00
<listitem > <para > Selects the Broadway backend for display in web browsers</para> </listitem>
2012-03-11 18:23:53 +00:00
</varlistentry>
<varlistentry >
<term > wayland</term>
2013-01-24 11:23:04 +00:00
<listitem > <para > Selects the Wayland backend for connecting to Wayland display servers</para> </listitem>
2012-03-11 18:23:53 +00:00
</varlistentry>
2011-02-12 21:03:08 +00:00
</variablelist>
2013-03-23 04:16:24 +00:00
Since 3.10, this environment variable can contain a comma-separated list
of backend names, which are tried in order. The list may also contain
2016-02-19 03:03:12 +00:00
a *, which means: try all remaining backends. The special value "help" can
be used to make GDK print out a list of all available backends.
2011-02-12 21:03:08 +00:00
For more information about selecting backends, see the gdk_display_manager_get() function.
</para>
</formalpara>
2018-01-10 05:14:10 +00:00
<formalpara >
<title > <envar > GDK_VULKAN_DEVICE</envar> </title>
<para >
This variable can be set to the index of a Vulkan device to override the
default selection of the device that is used for Vulkan rendering.
The special value <literal > list</literal> can be used to obtain a list
of all Vulkan devices.
</para>
</formalpara>
2018-05-07 02:06:35 +00:00
<formalpara >
<title > <envar > GSK_RENDERER</envar> </title>
<para >
If set, selects the GSK renderer to use. The following renderers can
2018-05-07 14:45:32 +00:00
be selected, provided they are included in the GTK library you are using
and the GDK backend supports them:
2018-05-07 02:06:35 +00:00
<variablelist >
<varlistentry >
2018-05-07 14:45:32 +00:00
<term > help</term>
<listitem > <para > Prints information about available options</para> </listitem>
2018-05-07 02:06:35 +00:00
</varlistentry>
<varlistentry >
2018-05-07 14:45:32 +00:00
<term > broadway</term>
<listitem > <para > Selects the Broadway-backend specific renderer</para> </listitem>
2018-05-07 02:06:35 +00:00
</varlistentry>
<varlistentry >
<term > cairo</term>
2018-05-07 14:45:32 +00:00
<listitem > <para > Selects the fallback Cairo renderer</para> </listitem>
</varlistentry>
<varlistentry >
<term > gl</term>
<listitem > <para > Selects the default OpenGL renderer</para> </listitem>
</varlistentry>
<varlistentry >
<term > vulkan</term>
<listitem > <para > Selects the Vulkan renderer</para> </listitem>
2018-05-07 02:06:35 +00:00
</varlistentry>
</variablelist>
</para>
</formalpara>
2017-08-06 16:42:17 +00:00
<formalpara >
<title > <envar > GTK_CSD</envar> </title>
<para >
The default value of this environment variable is 1. If changed to 0, this
2019-02-05 09:14:31 +00:00
disables the default use of client-side decorations on GTK windows, thus
2017-08-06 16:42:17 +00:00
making the window manager responsible for drawing the decorations of
windows that do not have a custom titlebar widget.
</para>
<para >
CSD is always used for windows with a custom titlebar widget set, as the WM
should not draw another titlebar or other decorations around the custom one.
</para>
</formalpara>
2002-01-11 22:39:03 +00:00
<formalpara >
2004-07-31 21:21:08 +00:00
<title > <envar > XDG_DATA_HOME</envar> , <envar > XDG_DATA_DIRS</envar> </title>
2002-01-11 22:39:03 +00:00
<para >
2019-02-05 09:14:31 +00:00
GTK uses these environment variables to locate icon themes
2010-05-08 05:18:53 +00:00
and MIME information. For more information, see
2017-04-03 17:06:51 +00:00
<ulink url= "https://freedesktop.org/Standards/icon-theme-spec" > Icon Theme Specification</ulink> ,
the <ulink url= "https://freedesktop.org/Standards/shared-mime-info-spec" > Shared MIME-info Database</ulink>
and the <ulink url= "https://freedesktop.org/Standards/basedir-spec" > Base Directory Specification</ulink> .
2002-01-11 22:39:03 +00:00
</para>
</formalpara>
2011-01-04 15:58:04 +00:00
<formalpara >
<title > <envar > DESKTOP_STARTUP_ID</envar> </title>
<para >
2019-02-05 09:14:31 +00:00
GTK uses this environment variable to provide startup notification
2017-04-03 17:06:51 +00:00
according to the <ulink url= "https://standards.freedesktop.org/startup-notification-spec/startup-notification-latest.txt" > Startup Notification Spec</ulink> .
2019-02-05 09:14:31 +00:00
Following the specification, GTK unsets this variable after reading
2011-01-04 15:58:04 +00:00
it (to keep it from leaking to child processes). So, if you need its
value for your own purposes, you have to read it before calling
gtk_init().
</para>
</formalpara>
2002-01-11 22:39:03 +00:00
</refsect2>
2014-05-11 01:39:55 +00:00
<refsect2 id= "interactive-debugging" >
<title > Interactive debugging</title>
2014-05-13 18:16:53 +00:00
<inlinegraphic fileref= "inspector.png" format= "PNG" > </inlinegraphic>
2014-05-11 01:39:55 +00:00
<para >
2019-02-05 09:14:31 +00:00
GTK includes an interactive debugger, called the GTK Inspector, which
lets you explore the widget tree of any GTK application at runtime, as
2014-05-24 14:07:46 +00:00
well as tweak the theme and trigger visual debugging aids. You can
easily try out changes at runtime before putting them into the code.
2014-05-11 01:39:55 +00:00
</para>
<para >
2019-02-05 09:14:31 +00:00
Note that the GTK inspector can only show GTK internals. It can not
understand the application-specific logic of a GTK application. Also,
the fact that the GTK inspector is running in the application process
2014-05-24 14:07:46 +00:00
limits what it can do. It is meant as a complement to full-blown debuggers
and system tracing facilities such as DTrace, not as a replacement.
</para>
<para >
2019-02-05 09:14:31 +00:00
To enable the GTK inspector, you can use the Control-Shift-I or
2014-05-15 12:42:14 +00:00
Control-Shift-D keyboard shortcuts, or set the
2014-05-13 15:04:43 +00:00
<envar > GTK_DEBUG=interactive</envar> environment variable.
2014-05-11 01:39:55 +00:00
</para>
2017-03-30 02:48:19 +00:00
<para >
There are a few more environment variables that can be set to influence
how the inspector renders its UI. <envar > GTK_INSPECTOR_DISPLAY</envar> and
<envar > GTK_INSPECTOR_RENDERER</envar> determine the GDK display and
the GSK renderer that the inspector is using.
</para>
2014-05-13 18:16:53 +00:00
<para >
2014-05-24 14:07:46 +00:00
In some situations, it may be inappropriate to give users access to the
2019-02-05 09:14:31 +00:00
GTK inspector. The keyboard shortcuts can be disabled with the
2014-05-24 14:07:46 +00:00
`enable-inspector-keybinding` key in the `org.gtk.Settings.Debug`
2014-05-13 18:16:53 +00:00
GSettings schema.
</para>
2017-03-30 02:48:19 +00:00
2014-05-11 01:39:55 +00:00
</refsect2>
2019-05-06 20:30:20 +00:00
<refsect2 id= "profiling" >
<title > Profiling</title>
<para >
GTK supports profiling with sysprof. It exports timing information
about frameclock phases and various characteristics of GskRenders
in a format that can be displayed by sysprof or GNOME Builder.
</para>
<para >
A simple way to capture data is to set the <envar > GTK_TRACE</envar>
environment variable. When it is set, GTK will write profiling
data to a file called
<filename > gtk.<replaceable > PID</replaceable> .syscap</filename> .
</para>
<para >
When launching the application from sysprof, it will set the
<envar > SYSPROF_TRACE_FD</envar> environment variable to point
GTK at a file descriptor to write profiling data to.
</para>
<para >
When GtkApplication registers with D-Bus, it exports the
<literal > org.gnome.Sysprof2.Profiler</literal> interface
that lets sysprof request profiling data at runtime.
</para>
</refsect2>
2002-01-11 22:39:03 +00:00
</refsect1>
</refentry>