2 <!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.3//EN"
3 "http://www.oasis-open.org/docbook/xml/4.3/docbookx.dtd" [
5 <refentry id="gtk-running">
7 <refentrytitle>Running GTK+ Applications</refentrytitle>
8 <manvolnum>3</manvolnum>
9 <refmiscinfo>GTK Library</refmiscinfo>
13 <refname>Running GTK+ Applications</refname>
15 How to run and debug your GTK+ application
20 <title>Running and debugging GTK+ Applications</title>
23 <title>Common commandline options</title>
26 All GTK+ applications support a number of standard commandline
27 options. These are removed from <literal>argv</literal> by gtk_init().
28 Modules may parse and remove further options. The
29 <link linkend="x11-cmdline">X11</link> and
30 <link linkend="win32-cmdline">Windows</link> GDK backends parse
31 some additional commandline options.
35 <title><systemitem>--gtk-module <replaceable>module</replaceable></systemitem></title>
38 A list of modules to load in addition to those specified in the
39 <envar>GTK_MODULES</envar> environment variable and the
40 <literal>gtk-modules</literal> setting.
45 <title><systemitem>--g-fatal-warnings</systemitem></title>
48 Make GTK+ abort on all warnings. This is useful to stop on the first
49 warning in a debugger, if your application is printing multiple
50 warnings. It's almost always best to start debugging with the first
56 <title><systemitem>--gtk-debug <replaceable>options</replaceable></systemitem></title>
59 A list of <link linkend="GTK-Debug-Options">debug options</link>
60 to turn on in addition to those specified in the <envar>GTK_DEBUG</envar>
61 environment variable. This option is only available if GTK+ has been
62 configured with <option>--enable-debug=yes</option>.
67 <title><systemitem>--gtk-no-debug <replaceable>options</replaceable></systemitem></title>
70 A list of <link linkend="GTK-Debug-Options">debug options</link>
71 to turn off. This option is only available if GTK+ has been configured with
72 <option>--enable-debug=yes</option>.
77 The following options are really used by GDK, not by GTK+, but we
78 list them here for completeness nevertheless.
82 <title><systemitem>--class <replaceable>class</replaceable></systemitem></title>
85 Sets the program class; see gdk_set_program_class().
90 <title><systemitem>--name <replaceable>name</replaceable></systemitem></title>
93 Sets the program name.
98 <title><systemitem>--gdk-debug <replaceable>options</replaceable></systemitem></title>
101 A list of <link linkend="GDK-Debug-Options">debug options</link>
102 to turn on in addition to those specified in the <envar>GDK_DEBUG</envar>
103 environment variable. This option is only available if GTK+ has been
104 configured with <option>--enable-debug=yes</option>.
109 <title><systemitem>--gdk-no-debug <replaceable>options</replaceable></systemitem></title>
112 A list of <link linkend="GDK-Debug-Options">debug options</link>
113 to turn off. This option is only available if GTK+ has been configured with
114 <option>--enable-debug=yes</option>.
121 <title>Environment variables</title>
124 GTK+ inspects a number of environment variables in addition to standard
125 variables like <envar>LANG</envar>, <envar>PATH</envar>, <envar>HOME</envar>
126 or <envar>DISPLAY</envar>; mostly to determine paths to look for certain
127 files. The <link linkend="x11-envar">X11</link>,
128 <link linkend="win32-envar">Windows</link> and
129 <link linkend="fb-envar">Framebuffer</link> GDK backends use some
130 additional environment variables.
133 <formalpara id="GTK-Debug-Options">
134 <title><envar>GTK_DEBUG</envar></title>
137 If GTK+ has been configured with <option>--enable-debug=yes</option>,
138 this variable can be set to a list of debug options, which cause GTK+
139 to print out different types of debugging information.
143 <listitem><para>Miscellaneous information</para></listitem>
146 <term>plugsocket</term>
147 <listitem><para>Cross-process embedding</para></listitem>
151 <listitem><para>Text widget internals</para></listitem>
155 <listitem><para>Tree widget internals</para></listitem>
159 <listitem><para>Visual feedback about window updates</para></listitem>
162 <term>keybindings</term>
163 <listitem><para>Keybindings</para></listitem>
166 <term>multihead</term>
167 <listitem><para>Working on multiple displays</para></listitem>
171 <listitem><para>Loading of modules</para></listitem>
174 <term>geometry</term>
175 <listitem><para>Size allocation</para></listitem>
178 <term>icontheme</term>
179 <listitem><para>Icon themes</para></listitem>
182 <term>printing</term>
183 <listitem><para>Printing support</para></listitem>
187 <listitem><para>GtkBuilder support</para></listitem>
191 The special value <literal>all</literal> can be used to turn on all
197 <title><envar>GTK_MODULES</envar></title>
200 A list of modules to load. Note that GTK+ also allows to specify modules to load via a commandline option (<option>--gtk-module</option>) and with the <literal>gtk-modules</literal> setting.
205 <title><envar>GTK_PATH</envar></title>
208 Specifies a list of directories to search when GTK+ is looking for
209 dynamically loaded objects such as the modules specified by
210 <envar>GTK_MODULES</envar>, theme engines, input method
211 modules, file system backends and print backends. If the path to
212 the dynamically loaded object is given as an absolute path name,
213 then GTK+ loads it directly.
214 Otherwise, GTK+ goes in turn through the directories in GTK_PATH,
215 followed by the directory <filename>.gtk-3.0</filename> in the user's
216 home directory, followed by the system default directory,
217 which is <filename><replaceable>libdir</replaceable>/gtk-3.0/modules</filename>.
218 (If <envar>GTK_EXE_PREFIX</envar> is defined, <replaceable>libdir</replaceable> is
219 <filename>$GTK_EXE_PREFIX/lib</filename>. Otherwise it is the libdir
220 specified when GTK+ was configured, usually
221 <filename>/usr/lib</filename>, or
222 <filename>/usr/local/lib</filename>.)
223 For each directory in this list, GTK+ actually looks in a
225 <filename><replaceable>directory</replaceable>/<replaceable>version</replaceable>/<replaceable>host</replaceable>/<replaceable>type</replaceable></filename>
226 Where <replaceable>version</replaceable> is derived from the
227 version of GTK+ (use <literal>pkg-config
228 --variable=gtk_binary_version gtk+-3.0</literal> to determine this from a
229 script), <replaceable>host</replaceable> is the architecture on
230 which GTK+ was built. (use <literal>pkg-config
231 --variable=gtk_host gtk+-3.0</literal> to determine this from a
232 script), and <replaceable>type</replaceable> is a directory
233 specific to the type of modules; currently it can be
234 <literal>modules</literal>, <literal>engines</literal>,
235 <literal>immodules</literal>, <literal>filesystems</literal> or
236 <literal>printbackends</literal>, corresponding to the types of
237 modules mentioned above. Either <replaceable>version</replaceable>,
238 <replaceable>host</replaceable>, or both may be omitted. GTK+ looks
239 first in the most specific directory, then in directories with
241 The components of GTK_PATH are separated by the ':' character on
242 Linux and Unix, and the ';' character on Windows.
247 <title><envar>GTK_IM_MODULE</envar></title>
250 Specifies an IM module to use in preference to the one determined
251 from the locale. If this isn't set and you are running on the system
252 that enables <literal>XSETTINGS</literal> and has a value in
253 <literal>Gtk/IMModule</literal>, that will be used for the default
258 <formalpara id="im-module-file">
259 <title><envar>GTK_IM_MODULE_FILE</envar></title>
262 Specifies the file listing the IM modules to load. This environment
263 variable overrides the <literal>im_module_file</literal> specified in
264 the RC files, which in turn overrides the default value
265 <filename><replaceable>sysconfdir</replaceable>/gtk-3.0/gtk.immodules</filename>
266 (<replaceable>sysconfdir</replaceable> is the sysconfdir specified when GTK+ was configured,
267 usually <filename>/usr/local/etc</filename>.)
272 <title><envar>GTK2_RC_FILES</envar></title>
275 Specifies a list of RC files to parse instead of the default ones;
276 see <link linkend="gtk-Resource-Files">Resource Files</link>.
281 <title><envar>GTK_EXE_PREFIX</envar></title>
284 If set, GTK+ uses <filename>$GTK_EXE_PREFIX/lib</filename> instead of
285 the libdir configured when GTK+ was compiled.
290 <title><envar>GTK_DATA_PREFIX</envar></title>
293 If set, makes GTK+ use <filename>$GTK_DATA_PREFIX</filename>
294 instead of the prefix configured when GTK+ was compiled.
299 The following environment variables are used by GdkPixbuf, GDK or
300 Pango, not by GTK+ itself, but we list them here for completeness
305 <title><envar>GDK_PIXBUF_MODULE_FILE</envar></title>
308 Specifies the file listing the GdkPixbuf loader modules to load.
309 This environment variable overrides the default value
310 <filename><replaceable>sysconfdir</replaceable>/gtk-3.0/gdk-pixbuf.loaders</filename>
311 (<replaceable>sysconfdir</replaceable> is the sysconfdir specified when
312 GTK+ was configured, usually <filename>/usr/local/etc</filename>.)
316 <formalpara id="GDK-Debug-Options">
317 <title><envar>GDK_DEBUG</envar></title>
320 If GTK+ has been configured with <option>--enable-debug=yes</option>,
321 this variable can be set to a list of debug options, which cause GDK
322 to print out different types of debugging information.
326 <listitem><para>Miscellaneous information</para></listitem>
330 <listitem><para>Show all events received by GDK</para></listitem>
334 <listitem><para>Information about drag-and-drop</para></listitem>
338 <listitem><para>Information about XIM support</para></listitem>
342 <listitem><para>Turn off all pointer and keyboard grabs</para></listitem>
345 <term>multihead</term>
346 <listitem><para>Information related to multiple screens</para></listitem>
349 <term>xinerama</term>
350 <listitem><para>Simulate a multi-monitor setup</para></listitem>
354 <listitem><para>Information about cursor objects (only win32)</para></listitem>
358 <listitem><para>Information about drawing operations (only win32)</para></listitem>
361 <term>eventloop</term>
362 <listitem><para>Information about event loop operation (mostly Quartz)</para></listitem>
366 The special value <literal>all</literal> can be used to turn on all
372 <title><envar>GDK_NATIVE_WINDOWS</envar></title>
375 If set, GDK creates all windows as native windows. This can help
376 applications that make assumptions about 1-1 correspondence between
377 GDK windows and X11 windows.
382 <title><envar>XDG_DATA_HOME</envar>, <envar>XDG_DATA_DIRS</envar></title>
385 GTK+ uses these environment variables to locate icon themes
386 and MIME information. For more information, see
387 <ulink url="http://freedesktop.org/Standards/icon-theme-spec">Icon Theme Specification</ulink>,
388 the <ulink url="http://freedesktop.org/Standards/shared-mime-info-spec">Shared MIME-info Database</ulink>
389 and the <ulink url="http://freedesktop.org/Standards/basedir-spec">Base Directory Specification</ulink>.