Running GTK+ Applications 3 GTK Library Running GTK+ Applications How to run and debug your GTK+ application Running and debugging GTK+ Applications Common commandline options All GTK+ applications support a number of standard commandline options. These are removed from argv by gtk_init(). Modules may parse and remove further options. <systemitem>--gtk-module <replaceable>module</replaceable></systemitem> A list of modules to load in addition to those specified in the GTK_MODULES environment variable. <systemitem>--g-fatal-warnings</systemitem> Make GTK+ abort on all warnings. This is useful to stop on the first warning in a debugger, if your application is printing multiple warnings. It's almost always best to start debugging with the first warning that occurs. <systemitem>--gtk-debug <replaceable>options</replaceable></systemitem> A list of debug options to turn on in addition to those specified in the GTK_DEBUG environment variable. This option is only available if GTK+ has been configured with . <systemitem>--gtk-no-debug <replaceable>options</replaceable></systemitem> A list of debug options to turn off. This option is only available if GTK+ has been configured with . The following options are really used by GDK, not by GTK+, but we list them here for completeness nevertheless. <systemitem>--class <replaceable>class</replaceable></systemitem> Sets the program class; see gdk_set_program_class(). <systemitem>--name <replaceable>name</replaceable></systemitem> Sets the program name. <systemitem>--gdk-debug <replaceable>options</replaceable></systemitem> A list of debug options to turn on in addition to those specified in the GDK_DEBUG environment variable. This option is only available if GTK+ has been configured with . <systemitem>--gdk-no-debug <replaceable>options</replaceable></systemitem> A list of debug options to turn off. This option is only available if GTK+ has been configured with . <systemitem>--display <replaceable>display</replaceable></systemitem> The name of the X display to open instead of the one specified in the DISPLAY environment variable. This option is only available if GTK+ has been configured with . <systemitem>--screen <replaceable>screen_number</replaceable></systemitem> The number of the screen within the default display. This overrides any screen number specified in the display name specified by by he --display command line option or the DISPLAY environment variable. If this screen cannot be opened, then GTK+ will fall back to the screen specified in the display name. This option is not useful interactively; the intended purposes is that when a program registers its command line with a session manager for later restarting, it can save the screen it is on, without having to worry if it might be restarted on a different display. <systemitem>--sync</systemitem> Makes all X requests synchronously. This is a useful option for debugging, but it will slow down the performance considerably. This option is only available if GTK+ has been configured with . <systemitem>--gxid-host <replaceable>host</replaceable></systemitem> The host to contact the gxid daemon on; overrides the GXID_HOST environment variable. This option is only available if GTK+ has been configured with . <systemitem>--gxid-port <replaceable>port</replaceable></systemitem> The port for the connection to gxid; overrides the GXID_PORT environment variable. This option is only available if GTK+ has been configured with . Environment variables GTK+ inspects a number of environment variables in addition to standard variables like LANG, PATH, HOME or DISPLAY; mostly to determine paths to look for certain files. <envar>GTK_DEBUG</envar> If GTK+ has been configured with , this variable can be set to a list of debug options, which cause GTK+ to print out different types of debugging information. misc Miscellaneous information text Information about text widget internals tree Information about tree widget internals updates Visual feedback about window updates The special value all can be used to turn on all debug options. <envar>GTK_MODULES</envar> A list of modules to load. <envar>GTK_PATH</envar> Specifies a list of directories to search when GTK+ is looking for dynamically loaded objects such as the modules specified by GTK_MODULES, theme engines, and input method modules. If the path to the dynamically loaded object is given as an absolute path name, then GTK+ loads it directly. Otherwise, GTK+ goes in turn through the directories in GTK_PATH, followed by the directory .gtk-2.0 in the user's home directory, followed by the system default directory, which is libdir/gtk-2.0/modules. (If GTK_EXE_PREFIX is defined, libdir is $GTK_EXE_PREFIX/lib. Otherwise it is the libdir specified when GTK+ was configured, usually /usr/lib, or /usr/local/lib.) For each directory in this list, GTK+ actually looks in a subdirectory directory/version/host/type Where version is derived from the version of GTK+ (use pkg-config --variable=gtk_binary_version gtk+-2.0 to determine this from a script), host is the architecture on which GTK+ was built. (use pkg-config --variable=gtk_host gtk+-2.0 to determine this from a script), and type is a directory specific to the type of modules; currently it can be modules, engines or immodules corresponding to the three types of modules above. Either version, host, or both may be omitted. GTK+ looks 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. <envar>GTK_IM_MODULE</envar> Specifies an IM module to use in preference to the one determined from the locale. <envar>GTK_IM_MODULE_FILE</envar> Specifies the file listing the IM modules to load. This environment variable overrides the im_module_file specified in the RC files, which in turn overrides the default value sysconfdir/gtk-2.0/gtk.immodules (sysconfdir is the sysconfdir specified when GTK+ was configured, usually /usr/local/etc.) <envar>GTK_RC_FILES</envar> Specifies a list of RC files to parse instead of the default ones; see Resource Files. <envar>GTK_EXE_PREFIX</envar> If set, GTK+ uses $GTK_EXE_PREFIX/lib instead of the libdir configured when GTK+ was compiled. <envar>GTK_DATA_PREFIX</envar> If set, makes GTK+ use $GTK_DATA_PREFIX instead of the prefix configured when GTK+ was compiled. The following environment variables are used by GdkPixbuf, GDK or Pango, not by GTK+ itself, but we list them here for completeness nevertheless. <envar>GDK_PIXBUF_MODULE_FILE</envar> Specifies the file listing the GdkPixbuf loader modules to load. This environment variable overrides the default value sysconfdir/gtk-2.0/gdk-pixbuf.loaders (sysconfdir is the sysconfdir specified when GTK+ was configured, usually /usr/local/etc.) <envar>GDK_DEBUG</envar> If GTK+ has been configured with , this variable can be set to a list of debug options, which cause GDK to print out different types of debugging information. misc Miscellaneous information events Show all events received by GDK dnd Information about drag-and-drop xim Information about XIM support The special value all can be used to turn on all debug options. <envar>GXID_HOST</envar> and <envar>GXID_PORT</envar> The host and port to contact the gxid daemon on. gxid is only necessary on X servers which don't support using the pointer and extension devices at once, and is only built if GTK+ is configured with . The XFree86 X servers don't have this restriction. <envar>GDK_USE_XFT</envar> If this variable is set to 1, GTK+ will use the Pango Xft backend instead of the X backend when possible (i.e. when the X server supports the XRender extension and Pango has been built with Xft support).