1 <refentry id="gtk-running" revision="10 Jan 2002">
3 <refentrytitle>Running GTK+ Applications</refentrytitle>
4 <manvolnum>3</manvolnum>
5 <refmiscinfo>GTK Library</refmiscinfo>
9 <refname>Running GTK+ Applications</refname>
11 How to run and debug your GTK+ application
16 <title>Running and debugging GTK+ Applications</title>
19 <title>Common commandline options</title>
22 All GTK+ applications support a number of standard commandline
23 options. These are removed from <literal>argv</literal> by <link
24 linkend="gtk-init">gtk_init()</link>. Modules may parse and remove
29 <title><systemitem>--gtk-module <replaceable>module</replaceable></systemitem></title>
32 A list of modules to load in addition to those specified in the
33 <envar>GTK_MODULES</envar> environment variable.
38 <title><systemitem>--g-fatal-warnings</systemitem></title>
41 Make GTK+ abort on all warnings. This is useful to stop on the first
42 warning in a debugger, if your application is printing multiple
43 warnings. It's almost always best to start debugging with the first
49 <title><systemitem>--gtk-debug <replaceable>options</replaceable></systemitem></title>
52 A list of <link linkend="GTK-Debug-Options">debug options</link>
53 to turn on in addition to those specified in the <envar>GTK_DEBUG</envar>
55 This option is only available if GTK+ has been configured with
56 <option>--enable-debug=yes</option>.
61 <title><systemitem>--gtk-no-debug <replaceable>options</replaceable></systemitem></title>
64 A list of <link linkend="GTK-Debug-Options">debug options</link>
66 This option is only available if GTK+ has been configured with
67 <option>--enable-debug=yes</option>.
72 The following options are really used by GDK, not by GTK+, but we
73 list them here for completeness nevertheless.
77 <title><systemitem>--class <replaceable>class</replaceable></systemitem></title>
80 Sets the program class; see gdk_set_program_class().
85 <title><systemitem>--name <replaceable>name</replaceable></systemitem></title>
88 Sets the program name.
93 <title><systemitem>--gdk-debug <replaceable>options</replaceable></systemitem></title>
96 A list of <link linkend="GDK-Debug-Options">debug options</link>
97 to turn on in addition to those
98 specified in the <envar>GDK_DEBUG</envar> environment variable.
99 This option is only available if GTK+ has been configured with
100 <option>--enable-debug=yes</option>.
105 <title><systemitem>--gdk-no-debug <replaceable>options</replaceable></systemitem></title>
108 A list of <link linkend="GDK-Debug-Options">debug options</link>
110 This option is only available if GTK+ has been configured with
111 <option>--enable-debug=yes</option>.
116 <title><systemitem>--display <replaceable>display</replaceable></systemitem></title>
119 The name of the X display to open instead of the one specified
120 in the <envar>DISPLAY</envar> environment variable.
121 This option is only available if GTK+ has been configured with
122 <option>--gdk-target=x11</option>.
127 <title><systemitem>--screen <replaceable>screen_number</replaceable></systemitem></title>
130 The number of the screen within the default display. This overrides
131 any screen number specified in the display name specified by
132 by he <systemitem>--display</systemitem> command line option or
133 the <envar>DISPLAY</envar> environment variable. If this screen
134 cannot be opened, then GTK+ will fall back to the screen
135 specified in the display name. This option is not useful
136 interactively; the intended purposes is that when a program
137 registers its command line with a <firstterm>session
138 manager</firstterm> for later restarting, it can save the
139 screen it is on, without having to worry if it might be
140 restarted on a different display.
145 <title><systemitem>--sync</systemitem></title>
148 Makes all X requests synchronously. This is a useful option for
149 debugging, but it will slow down the performance considerably.
150 This option is only available if GTK+ has been configured with
151 <option>--gdk-target=x11</option>.
156 <title><systemitem>--gxid-host <replaceable>host</replaceable></systemitem></title>
159 The host to contact the <application>gxid</application> daemon on; overrides
160 the <link linkend="GXID"><envar>GXID_HOST</envar></link> environment variable.
161 This option is only available if GTK+ has been configured with
162 <option>--gdk-target=x11</option>.
167 <title><systemitem>--gxid-port <replaceable>port</replaceable></systemitem></title>
170 The port for the connection to <application>gxid</application>; overrides
171 the <link linkend="GXID"><envar>GXID_PORT</envar></link> environment variable.
172 This option is only available if GTK+ has been configured with
173 <option>--gdk-target=x11</option>.
180 <title>Environment variables</title>
183 GTK+ inspects a number of environment variables in addition to standard
184 variables like <envar>LANG</envar>, <envar>PATH</envar>, <envar>HOME</envar>
185 or <envar>DISPLAY</envar>; mostly to determine paths to look for certain files.
188 <formalpara id="GTK-Debug-Options">
189 <title><envar>GTK_DEBUG</envar></title>
192 If GTK+ has been configured with <option>--enable-debug=yes</option>,
193 this variable can be set to a list of debug options, which cause GTK+
194 to print out different types of debugging information.
198 <listitem><para>Miscellaneous information</para></listitem>
202 <listitem><para>Information about text widget internals</para></listitem>
206 <listitem><para>Information about tree widget internals</para></listitem>
210 <listitem><para>Visual feedback about window updates</para></listitem>
213 The special value <literal>all</literal> can be used to turn on all debug options.
218 <title><envar>GTK_MODULES</envar></title>
221 A list of modules to load.
226 <title><envar>GTK_PATH</envar></title>
229 Specifies a list of directories to search when GTK+ is looking for
230 dynamically loaded objects such as the modules specified by
231 <envar>GTK_MODULES</envar>, theme engines, and input method
232 modules. If the path to the dynamically loaded object is given
233 as an absolute path name, then GTK+ loads it directly. Otherwise,
234 GTK+ goes in turn through the directories in GTK_PATH, followed
235 by the directory <filename>.gtk-2.0</filename> in the user's home
236 directory, followed by the system default directory,
237 which is <filename><replaceable>libdir</replaceable>/gtk-2.0/modules</filename>.
238 (If <envar>GTK_EXE_PREFIX</envar> is defined, <replaceable>libdir</replaceable> is
239 <filename>$GTK_EXE_PREFIX/lib</filename>. Otherwise it is the libdir
240 specified when GTK+ was configured, usually
241 <filename>/usr/lib</filename>, or
242 <filename>/usr/local/lib</filename>.)
243 For each directory in this list, GTK+ actually looks in a
245 <filename><replaceable>directory</replaceable>/<replaceable>version</replaceable>/<replaceable>host</replaceable>/<replaceable>type</replaceable></filename>
246 Where <replaceable>version</replaceable> is derived from the
247 version of GTK+ (use <literal>pkg-config
248 --variable=gtk_binary_version gtk+-2.0</literal> to determine this from a
249 script), <replaceable>host</replaceable> is the architecture on
250 which GTK+ was built. (use <literal>pkg-config
251 --variable=gtk_host gtk+-2.0</literal> to determine this from a
252 script), and <replaceable>type</replaceable> is a directory
253 specific to the type of modules; currently it can be
254 <literal>modules</literal>, <literal>engines</literal> or
255 <literal>immodules</literal> corresponding to the three types of
256 modules above. Either <replaceable>version</replaceable>,
257 <replaceable>host</replaceable>, or both may be omitted. GTK+ looks
258 first in the most specific directory, then in directories with
260 The components of GTK_PATH are separated by the ':' character on
261 Linux and Unix, and the ';' character on Windows.
266 <title><envar>GTK_IM_MODULE</envar></title>
269 Specifies an IM module to use in preference to the one determined
274 <formalpara id="im-module-file">
275 <title><envar>GTK_IM_MODULE_FILE</envar></title>
278 Specifies the file listing the IM modules to load. This environment
279 variable overrides the <literal>im_module_file</literal> specified in
280 the RC files, which in turn overrides the default value
281 <filename><replaceable>sysconfdir</replaceable>/gtk-2.0/gtk.immodules</filename>
282 (<replaceable>sysconfdir</replaceable> is the sysconfdir specified when GTK+ was configured,
283 usually <filename>/usr/local/etc</filename>.)
288 <title><envar>GTK_RC_FILES</envar></title>
291 Specifies a list of RC files to parse instead of the default ones;
292 see <link linkend="gtk-Resource-Files">Resource Files</link>.
297 <title><envar>GTK_EXE_PREFIX</envar></title>
300 If set, GTK+ uses <filename>$GTK_EXE_PREFIX/lib</filename> instead of
301 the libdir configured when GTK+ was compiled.
306 <title><envar>GTK_DATA_PREFIX</envar></title>
309 If set, makes GTK+ use <filename>$GTK_DATA_PREFIX</filename>
310 instead of the prefix configured when GTK+ was compiled.
315 The following environment variables are used by GdkPixbuf, GDK or
316 Pango, not by GTK+ itself, but we list them here for completeness
321 <title><envar>GDK_PIXBUF_MODULE_FILE</envar></title>
324 Specifies the file listing the GdkPixbuf loader modules to load.
325 This environment variable overrides the default value
326 <filename><replaceable>sysconfdir</replaceable>/gtk-2.0/gdk-pixbuf.loaders</filename>
327 (<replaceable>sysconfdir</replaceable> is the sysconfdir specified when
328 GTK+ was configured, usually <filename>/usr/local/etc</filename>.)
332 <formalpara id="GDK-Debug-Options">
333 <title><envar>GDK_DEBUG</envar></title>
336 If GTK+ has been configured with <option>--enable-debug=yes</option>,
337 this variable can be set to a list of debug options, which cause GDK
338 to print out different types of debugging information.
342 <listitem><para>Miscellaneous information</para></listitem>
346 <listitem><para>Show all events received by GDK</para></listitem>
350 <listitem><para>Information about drag-and-drop</para></listitem>
354 <listitem><para>Information about XIM support</para></listitem>
357 The special value <literal>all</literal> can be used to turn on all debug options.
361 <formalpara id="GXID">
362 <title><envar>GXID_HOST</envar> and <envar>GXID_PORT</envar></title>
365 The host and port to contact the <application>gxid</application> daemon on.
366 <application>gxid</application> is only necessary on X servers which
367 don't support using the pointer and extension devices at once, and is
368 only built if GTK+ is configured with <option>--with-xinput=gxi</option>.
369 The <application>XFree86</application> X servers don't have this
375 <title><envar>GDK_USE_XFT</envar></title>
378 If this variable is set to 1, GTK+ will use the Pango Xft backend instead
379 of the X backend when possible (i.e. when the X server supports the XRender
380 extension and Pango has been built with Xft support).