Commit 488dd4c4 authored by Jan Djärv's avatar Jan Djärv

GTK version

parent 3c77dc44
2003-01-19 Jan D. <jan.h.d@swipnet.se>
* configure.in: Add --with-gtk, --with-x-toolkit=gtk
* INSTALL (DETAILED BUILDING AND INSTALLATION): Add text about GTK.
2003-01-14 Francesco Potort,Al(B <pot@gnu.org>
* configure.in (m68k-motorola-sysv): Removed (obsolete).
......
......@@ -270,7 +270,7 @@ accept a list of directories, separated with colons.
To get more attractive menus, you can specify an X toolkit when you
configure Emacs; use the option `--with-x-toolkit=TOOLKIT', where
TOOLKIT is `athena' or `motif' (`yes' and `lucid' are synonyms for
TOOLKIT is `athena', `motif' or `gtk' (`yes' and `lucid' are synonyms for
`athena'). On some systems, it does not work to use a toolkit with
shared libraries. A free implementation of Motif, called LessTif, is
available ftom <http://www.lesstif.org>. Compiling with LessTif or
......@@ -280,6 +280,11 @@ bars, even without LessTif/Motif, if you have the Xaw3d library
installed (see "Image support libraries" above for Xaw3d
availability).
If `--with-x-toolkit=gtk' is specified, you can tell configure where
to search for GTK by specifying `--with-pkg-config-prog=PATH' where
PATH is the pathname to pkg-config. Note that GTK version 2.0 or
newer is required for Emacs.
The `--with-gcc' option specifies that the build process should
compile Emacs using GCC. If you don't want to use GCC, specify
`--with-gcc=no'. If you omit this option, `configure' will search
......
......@@ -309,7 +309,7 @@ ac_includes_default="\
# include <unistd.h>
#endif"
ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS build build_cpu build_vendor build_os host host_cpu host_vendor host_os CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT LN_S CPP INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA RANLIB ac_ct_RANLIB INSTALL_INFO EGREP LIBSOUND SET_MAKE ALLOCA liblockfile LIBOBJS NEED_SETGID KMEM_GROUP GETLOADAVG_LIBS version configuration canonical srcdir lispdir locallisppath lisppath x_default_search_path etcdir archlibdir docdir bitmapdir gamedir gameuser c_switch_system c_switch_machine LD_SWITCH_X_SITE LD_SWITCH_X_SITE_AUX C_SWITCH_X_SITE X_TOOLKIT_TYPE machfile opsysfile carbon_appdir LTLIBOBJS'
ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS build build_cpu build_vendor build_os host host_cpu host_vendor host_os CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT LN_S CPP INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA RANLIB ac_ct_RANLIB INSTALL_INFO EGREP LIBSOUND SET_MAKE PKG_CONFIG GTK_CFLAGS GTK_LIBS ALLOCA liblockfile LIBOBJS NEED_SETGID KMEM_GROUP GETLOADAVG_LIBS version configuration canonical srcdir lispdir locallisppath lisppath x_default_search_path etcdir archlibdir docdir bitmapdir gamedir gameuser c_switch_system c_switch_machine LD_SWITCH_X_SITE LD_SWITCH_X_SITE_AUX C_SWITCH_X_SITE X_TOOLKIT_TYPE machfile opsysfile carbon_appdir LTLIBOBJS'
ac_subst_files=''
# Initialize some variables set by options.
......@@ -866,12 +866,15 @@ Optional Packages:
--with-kerberos5 support Kerberos version 5 authenticated POP
--with-hesiod support Hesiod to get the POP server host
--without-sound don't compile with sound support
--with-x-toolkit=KIT use an X toolkit (KIT = yes/lucid/athena/motif/no)
--with-x-toolkit=KIT use an X toolkit
(KIT = yes/lucid/athena/motif/gtk/no)
--with-xpm use -lXpm for displaying XPM images
--with-jpeg use -ljpeg for displaying JPEG images
--with-tiff use -ltiff for displaying TIFF images
--with-gif use -lungif for displaying GIF images
--with-png use -lpng for displaying PNG images
--with-gtk use GTK (same as --with-x-toolkit=gtk)
--with-pkg-config-prog Path to pkg-config to use for finding GTK
--without-toolkit-scroll-bars
don't use Motif or Xaw3d scroll bars
--without-xim don't use X11 XIM
......@@ -1402,12 +1405,13 @@ if test "${with_x_toolkit+set}" = set; then
l | lu | luc | luci | lucid ) val=lucid ;;
a | at | ath | athe | athen | athena ) val=athena ;;
m | mo | mot | moti | motif ) val=motif ;;
g | gt | gtk ) val=gtk ;;
* )
{ { echo "$as_me:$LINENO: error: \`--with-x-toolkit=$withval' is invalid\;
this option's value should be \`yes', \`no', \`lucid', \`athena', or \`motif'.
this option's value should be \`yes', \`no', \`lucid', \`athena', \`motif' or \`gtk'.
Currently, \`yes', \`athena' and \`lucid' are synonyms." >&5
echo "$as_me: error: \`--with-x-toolkit=$withval' is invalid\;
this option's value should be \`yes', \`no', \`lucid', \`athena', or \`motif'.
this option's value should be \`yes', \`no', \`lucid', \`athena', \`motif' or \`gtk'.
Currently, \`yes', \`athena' and \`lucid' are synonyms." >&2;}
{ (exit 1); exit 1; }; }
;;
......@@ -1446,6 +1450,18 @@ if test "${with_png+set}" = set; then
fi;
# Check whether --with-gtk or --without-gtk was given.
if test "${with_gtk+set}" = set; then
withval="$with_gtk"
fi;
# Check whether --with-pkg-config-prog or --without-pkg-config-prog was given.
if test "${with_pkg_config_prog+set}" = set; then
withval="$with_pkg_config_prog"
fi;
# Check whether --with-toolkit-scroll-bars or --without-toolkit-scroll-bars was given.
if test "${with_toolkit_scroll_bars+set}" = set; then
withval="$with_toolkit_scroll_bars"
......@@ -6800,6 +6816,8 @@ case "${window_system}" in
case "${with_x_toolkit}" in
athena | lucid ) USE_X_TOOLKIT=LUCID ;;
motif ) USE_X_TOOLKIT=MOTIF ;;
gtk ) with_gtk=yes
USE_X_TOOLKIT=none ;;
no ) USE_X_TOOLKIT=none ;;
* ) USE_X_TOOLKIT=maybe ;;
esac
......@@ -8058,6 +8076,134 @@ echo "${ECHO_T}before 5" >&6
fi
fi
HAVE_GTK=no
if test "${with_gtk}" = "yes" || test "$USE_X_TOOLKIT" = "gtk"; then
if test "$USE_X_TOOLKIT" != "none"; then
{ { echo "$as_me:$LINENO: error: Conflicting options, --with-gtk is incompatible with --with-x-toolkit=${with_x_toolkit}" >&5
echo "$as_me: error: Conflicting options, --with-gtk is incompatible with --with-x-toolkit=${with_x_toolkit}" >&2;}
{ (exit 1); exit 1; }; };
fi
GLIB_REQUIRED=2.0.1
GTK_REQUIRED=2.0.1
GTK_MODULES="gtk+-2.0 >= $GTK_REQUIRED glib-2.0 >= $GLIB_REQUIRED"
if test "X${with_pkg_config_prog}" != X; then
PKG_CONFIG="${with_pkg_config_prog}"
fi
succeeded=no
if test -z "$PKG_CONFIG"; then
# Extract the first word of "pkg-config", so it can be a program name with args.
set dummy pkg-config; ac_word=$2
echo "$as_me:$LINENO: checking for $ac_word" >&5
echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
if test "${ac_cv_path_PKG_CONFIG+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
case $PKG_CONFIG in
[\\/]* | ?:[\\/]*)
ac_cv_path_PKG_CONFIG="$PKG_CONFIG" # Let the user override the test with a path.
;;
*)
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in $PATH
do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
ac_cv_path_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext"
echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
fi
done
done
test -z "$ac_cv_path_PKG_CONFIG" && ac_cv_path_PKG_CONFIG="no"
;;
esac
fi
PKG_CONFIG=$ac_cv_path_PKG_CONFIG
if test -n "$PKG_CONFIG"; then
echo "$as_me:$LINENO: result: $PKG_CONFIG" >&5
echo "${ECHO_T}$PKG_CONFIG" >&6
else
echo "$as_me:$LINENO: result: no" >&5
echo "${ECHO_T}no" >&6
fi
fi
if test "$PKG_CONFIG" = "no" ; then
echo "*** The pkg-config script could not be found. Make sure it is"
echo "*** in your path, or give the full path to pkg-config with"
echo "*** the PKG_CONFIG environment variable or --with-pkg-config-prog."
echo "*** Or see http://www.freedesktop.org/software/pkgconfig to get pkg-config."
else
PKG_CONFIG_MIN_VERSION=0.9.0
if $PKG_CONFIG --atleast-pkgconfig-version $PKG_CONFIG_MIN_VERSION; then
echo "$as_me:$LINENO: checking for $GTK_MODULES" >&5
echo $ECHO_N "checking for $GTK_MODULES... $ECHO_C" >&6
if $PKG_CONFIG --exists "$GTK_MODULES" ; then
echo "$as_me:$LINENO: result: yes" >&5
echo "${ECHO_T}yes" >&6
succeeded=yes
echo "$as_me:$LINENO: checking GTK_CFLAGS" >&5
echo $ECHO_N "checking GTK_CFLAGS... $ECHO_C" >&6
GTK_CFLAGS=`$PKG_CONFIG --cflags "$GTK_MODULES"`
echo "$as_me:$LINENO: result: $GTK_CFLAGS" >&5
echo "${ECHO_T}$GTK_CFLAGS" >&6
echo "$as_me:$LINENO: checking GTK_LIBS" >&5
echo $ECHO_N "checking GTK_LIBS... $ECHO_C" >&6
GTK_LIBS=`$PKG_CONFIG --libs "$GTK_MODULES"`
echo "$as_me:$LINENO: result: $GTK_LIBS" >&5
echo "${ECHO_T}$GTK_LIBS" >&6
else
GTK_CFLAGS=""
GTK_LIBS=""
## If we have a custom action on failure, don't print errors, but
## do set a variable so people can do so.
GTK_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "$GTK_MODULES"`
echo $GTK_PKG_ERRORS
fi
else
echo "*** Your version of pkg-config is too old. You need version $PKG_CONFIG_MIN_VERSION or newer."
echo "*** See http://www.freedesktop.org/software/pkgconfig"
fi
fi
if test $succeeded = yes; then
:
else
{ { echo "$as_me:$LINENO: error: Library requirements ($GTK_MODULES) not met; consider adjusting the PKG_CONFIG_PATH environment variable if your libraries are in a nonstandard prefix so pkg-config can find them." >&5
echo "$as_me: error: Library requirements ($GTK_MODULES) not met; consider adjusting the PKG_CONFIG_PATH environment variable if your libraries are in a nonstandard prefix so pkg-config can find them." >&2;}
{ (exit 1); exit 1; }; }
fi
C_SWITCH_X_SITE="$C_SWITCH_X_SITE $GTK_CFLAGS"
HAVE_GTK=yes
cat >>confdefs.h <<\_ACEOF
#define HAVE_GTK 1
_ACEOF
USE_X_TOOLKIT=none
with_toolkit_scroll_bars=yes
fi
if test x"${USE_X_TOOLKIT}" = xmaybe; then
if test x"${HAVE_X11R5}" = xyes; then
echo "$as_me:$LINENO: checking X11 version 5 with Xaw" >&5
......@@ -8650,6 +8796,12 @@ _ACEOF
USE_TOOLKIT_SCROLL_BARS=yes
fi
elif test "${HAVE_GTK}" = "yes"; then
cat >>confdefs.h <<\_ACEOF
#define USE_TOOLKIT_SCROLL_BARS 1
_ACEOF
USE_TOOLKIT_SCROLL_BARS=yes
fi
fi
......@@ -17845,6 +17997,13 @@ fi
#### Report on what we decided to do.
#### Report GTK as a toolkit, even if it doesn't use Xt.
#### It makes printing result more understandable as using GTK sets
#### toolkit_scroll_bars to yes by default.
if test "${HAVE_GTK}" = "yes"; then
USE_X_TOOLKIT=GTK
fi
echo "
Configured for \`${canonical}'.
......@@ -18566,6 +18725,9 @@ s,@INSTALL_INFO@,$INSTALL_INFO,;t t
s,@EGREP@,$EGREP,;t t
s,@LIBSOUND@,$LIBSOUND,;t t
s,@SET_MAKE@,$SET_MAKE,;t t
s,@PKG_CONFIG@,$PKG_CONFIG,;t t
s,@GTK_CFLAGS@,$GTK_CFLAGS,;t t
s,@GTK_LIBS@,$GTK_LIBS,;t t
s,@ALLOCA@,$ALLOCA,;t t
s,@liblockfile@,$liblockfile,;t t
s,@LIBOBJS@,$LIBOBJS,;t t
......
......@@ -77,13 +77,15 @@ dnl This should be the last --with option, because --with-x is
dnl added later on when we find the path of X, and it's best to
dnl keep them together visually.
AC_ARG_WITH(x-toolkit,
[ --with-x-toolkit=KIT use an X toolkit (KIT = yes/lucid/athena/motif/no)],
[ --with-x-toolkit=KIT use an X toolkit
(KIT = yes/lucid/athena/motif/gtk/no)],
[ case "${withval}" in
y | ye | yes ) val=athena ;;
n | no ) val=no ;;
l | lu | luc | luci | lucid ) val=lucid ;;
a | at | ath | athe | athen | athena ) val=athena ;;
m | mo | mot | moti | motif ) val=motif ;;
g | gt | gtk ) val=gtk ;;
dnl These don't currently work.
dnl o | op | ope | open | open- | open-l | open-lo \
dnl | open-loo | open-look ) val=open-look ;;
......@@ -91,7 +93,7 @@ dnl | open-loo | open-look ) val=open-look ;;
dnl AC_MSG_ERROR([the `--with-x-toolkit' option is supposed to have a value
dnl which is `yes', `no', `lucid', `athena', `motif' or `open-look'.])
AC_MSG_ERROR([`--with-x-toolkit=$withval' is invalid\;
this option's value should be `yes', `no', `lucid', `athena', or `motif'.
this option's value should be `yes', `no', `lucid', `athena', `motif' or `gtk'.
Currently, `yes', `athena' and `lucid' are synonyms.])
;;
esac
......@@ -107,6 +109,10 @@ AC_ARG_WITH(gif,
[ --with-gif use -lungif for displaying GIF images])
AC_ARG_WITH(png,
[ --with-png use -lpng for displaying PNG images])
AC_ARG_WITH(gtk,
[ --with-gtk use GTK (same as --with-x-toolkit=gtk)])
AC_ARG_WITH(pkg-config-prog,
[ --with-pkg-config-prog Path to pkg-config to use for finding GTK])
AC_ARG_WITH(toolkit-scroll-bars,
[ --without-toolkit-scroll-bars
don't use Motif or Xaw3d scroll bars])
......@@ -1570,6 +1576,10 @@ case "${window_system}" in
athena | lucid ) USE_X_TOOLKIT=LUCID ;;
motif ) USE_X_TOOLKIT=MOTIF ;;
dnl open-look ) USE_X_TOOLKIT=OPEN_LOOK ;;
gtk ) with_gtk=yes
dnl Dont set this for GTK. A lot of tests below assumes Xt when
dnl USE_X_TOOLKIT is set.
USE_X_TOOLKIT=none ;;
no ) USE_X_TOOLKIT=none ;;
dnl If user did not say whether to use a toolkit,
dnl make this decision later: use the toolkit if we have X11R5 or newer.
......@@ -1781,6 +1791,89 @@ fail;
fi
fi
dnl This function defintion taken from Gnome 2.0
dnl PKG_CHECK_MODULES(GSTUFF, gtk+-2.0 >= 1.3 glib = 1.3.4, action-if, action-not)
dnl defines GSTUFF_LIBS, GSTUFF_CFLAGS, see pkg-config man page
dnl also defines GSTUFF_PKG_ERRORS on error
AC_DEFUN(PKG_CHECK_MODULES, [
succeeded=no
if test -z "$PKG_CONFIG"; then
AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
fi
if test "$PKG_CONFIG" = "no" ; then
echo "*** The pkg-config script could not be found. Make sure it is"
echo "*** in your path, or give the full path to pkg-config with"
echo "*** the PKG_CONFIG environment variable or --with-pkg-config-prog."
echo "*** Or see http://www.freedesktop.org/software/pkgconfig to get pkg-config."
else
PKG_CONFIG_MIN_VERSION=0.9.0
if $PKG_CONFIG --atleast-pkgconfig-version $PKG_CONFIG_MIN_VERSION; then
AC_MSG_CHECKING(for $2)
if $PKG_CONFIG --exists "$2" ; then
AC_MSG_RESULT(yes)
succeeded=yes
AC_MSG_CHECKING($1_CFLAGS)
$1_CFLAGS=`$PKG_CONFIG --cflags "$2"`
AC_MSG_RESULT($$1_CFLAGS)
AC_MSG_CHECKING($1_LIBS)
$1_LIBS=`$PKG_CONFIG --libs "$2"`
AC_MSG_RESULT($$1_LIBS)
else
$1_CFLAGS=""
$1_LIBS=""
## If we have a custom action on failure, don't print errors, but
## do set a variable so people can do so.
$1_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "$2"`
ifelse([$4], ,echo $$1_PKG_ERRORS,)
fi
AC_SUBST($1_CFLAGS)
AC_SUBST($1_LIBS)
else
echo "*** Your version of pkg-config is too old. You need version $PKG_CONFIG_MIN_VERSION or newer."
echo "*** See http://www.freedesktop.org/software/pkgconfig"
fi
fi
if test $succeeded = yes; then
ifelse([$3], , :, [$3])
else
ifelse([$4], , AC_MSG_ERROR([Library requirements ($2) not met; consider adjusting the PKG_CONFIG_PATH environment variable if your libraries are in a nonstandard prefix so pkg-config can find them.]), [$4])
fi
])
HAVE_GTK=no
if test "${with_gtk}" = "yes" || test "$USE_X_TOOLKIT" = "gtk"; then
if test "$USE_X_TOOLKIT" != "none"; then
AC_MSG_ERROR([Conflicting options, --with-gtk is incompatible with --with-x-toolkit=${with_x_toolkit}]);
fi
GLIB_REQUIRED=2.0.1
GTK_REQUIRED=2.0.1
GTK_MODULES="gtk+-2.0 >= $GTK_REQUIRED glib-2.0 >= $GLIB_REQUIRED"
dnl Check if --with-pkg-config-prog has been given.
if test "X${with_pkg_config_prog}" != X; then
PKG_CONFIG="${with_pkg_config_prog}"
fi
dnl Checks for libraries.
PKG_CHECK_MODULES(GTK, $GTK_MODULES)
AC_SUBST(GTK_CFLAGS)
AC_SUBST(GTK_LIBS)
C_SWITCH_X_SITE="$C_SWITCH_X_SITE $GTK_CFLAGS"
HAVE_GTK=yes
AC_DEFINE(HAVE_GTK, 1, [Define to 1 if using GTK.])
USE_X_TOOLKIT=none
dnl GTK scrollbars resembles toolkit scrollbars alot, so to avoid
dnl a lot if #ifdef:s, say we have toolkit scrollbars.
with_toolkit_scroll_bars=yes
fi
dnl Do not put whitespace before the #include statements below.
dnl Older compilers (eg sunos4 cc) choke on it.
if test x"${USE_X_TOOLKIT}" = xmaybe; then
......@@ -1903,7 +1996,7 @@ if test "${HAVE_X11}" = "yes"; then
fi
fi
dnl Use toolkit scroll bars if configured for X toolkit and either
dnl Use toolkit scroll bars if configured for GTK or X toolkit and either
dnl using Motif or Xaw3d is available, and unless
dnl --with-toolkit-scroll-bars=no was specified.
......@@ -1920,6 +2013,9 @@ if test "${with_toolkit_scroll_bars}" != "no"; then
AC_DEFINE(USE_TOOLKIT_SCROLL_BARS)
USE_TOOLKIT_SCROLL_BARS=yes
fi
elif test "${HAVE_GTK}" = "yes"; then
AC_DEFINE(USE_TOOLKIT_SCROLL_BARS)
USE_TOOLKIT_SCROLL_BARS=yes
fi
fi
......@@ -2745,6 +2841,13 @@ End:
])dnl
#### Report on what we decided to do.
#### Report GTK as a toolkit, even if it doesn't use Xt.
#### It makes printing result more understandable as using GTK sets
#### toolkit_scroll_bars to yes by default.
if test "${HAVE_GTK}" = "yes"; then
USE_X_TOOLKIT=GTK
fi
echo "
Configured for \`${canonical}'.
......
2003-01-19 Jan D. <jan.h.d@swipnet.se>
* xresources.texi (GTK resources): New node.
(GTK widget names): New node.
(GTK names in Emacs): New node.
(GTK styles): New node.
2003-01-15 ShengHuo ZHU <zsh@cs.rochester.edu>
* gnus.texi: Do not use `path' in several locations.
......
@c This is part of the Emacs manual.
@c Copyright (C) 1987,93,94,95,1997,2001 Free Software Foundation, Inc.
@c Copyright (C) 1987,93,94,95,1997,2001,03 Free Software Foundation, Inc.
@c See file emacs.texi for copying conditions.
@node X Resources, Antinews, Command Arguments, Top
@appendix X Options and Resources
......@@ -18,6 +18,7 @@ describes the X resources that Emacs recognizes and how to use them.
* Face Resources:: X resources for customizing faces.
* Lucid Resources:: X resources for Lucid menus.
* LessTif Resources:: X resources for LessTif and Motif menus.
* GTK resources:: Resources for GTK widgets.
@end menu
@node Resources
......@@ -520,3 +521,395 @@ The color for the border shadow, on the bottom and the right.
@item topShadowColor
The color for the border shadow, on the top and the left.
@end table
@node GTK resources
@appendixsec GTK resources
@cindex GTK resources and customization
@cindex resource files for GTK
@cindex @file{~/.gtkrc-2.0} file
@cindex @file{~/.emacs.d/gtkrc} file
If the Emacs installed at your site was built to use the GTK widget set,
then the menu bar, scroll bar and the dialogs can be customized with
the standard GTK @file{~/.gtkrc-2.0} file or with the Emacs specific
@file{~/.emacs.d/gtkrc} file; note that these files are only for
customizing specific GTK widget features. To customize Emacs font,
background, faces etc., use the normal X resources, see @ref{Resources}.
In these files you first defines a style and then how to apply that style
to widgets (@pxref{GTK widget names}). Here is an example of how to
change the font for Emacs menus:
@smallexample
# This is a comment.
style "menufont"
@{
font_name = "helvetica bold 14" # This is a Pango font name
@}
widget "*emacs-menuitem*" style "menufont"
@end smallexample
There are some things you can set without using any style or widget name,
which affect GTK as a whole. Most of these are poorly documented, but can
be found in the `Properties' section of the documentation page for
@code{GtkSetting}, in the GTK document references below.
One property of interest is @code{gtk-font-name} which sets the default
font for GTK; you must use Pango font names (@pxref{GTK styles}). A
@file{~/.gtkrc-2.0} file that just sets a default font looks like this:
@smallexample
gtk-font-name = "courier 12"
@end smallexample
If GTK at your site is installed under @var{prefix},
the resource file syntax is fully described in the GTK API
document
@file{@var{prefix}/share/gtk-doc/html/gtk/gtk-resource-files.html}.
@var{prefix} is usually @file{/usr} or @file{/usr/local}.
You can find the same document online at
@uref{http://developer.gnome.org/doc/API/2.0/gtk/gtk-Resource-Files.html}.
@menu
* GTK widget names:: How widgets in GTK are named in general.
* GTK names in Emacs:: GTK widget names in Emacs.
* GTK styles:: What can be customized in a GTK widget.
@end menu
@node GTK widget names
@appendixsubsec GTK widget names
@cindex GTK widget names
Widgets are specified by widget class or by widget name.
The widget class is the type of the widget, for example @code{GtkMenuBar}.
The widget name is the name given to a specific widget within a program.
A widget always have a class but it is not mandatory to give a name to
a widget. Absolute names are sequences of widget names or
widget classes, corresponding to hierarchies of widgets embedded within
other widgets. For example, if a @code{GtkWindow} contains a @code{GtkVBox}
which in turn contains a @code{GtkMenuBar}, the absolute class name
is @code{GtkWindow.GtkVBox.GtkMenuBar}.
@noindent
If the widgets are named ``top'', ``box'' and ``menubar'', the absolute
widget name is @code{top.box.menubar},
When assigning a style to a widget, you can use the absolute class
name or the absolute widget name.
There are two commands: @code{widget_class} will assign a style to
widgets, matching only against the absolute class name.
The command @code{widget} will match the absolute widget name,
but if there is no name for a widget in the hierarchy, the class is matched.
These commands require the absolute name and the style name to be
within double quotes. These commands are written at the top level in a
@file{~/.gtkrc-2.0} file, like this:
@smallexample
style "menufont"
@{
font_name = "helvetica bold 14"
@}
widget "top.box.menubar" style "menufont"
widget_class "GtkWindow.GtkVBox.GtkMenuBar" style "menufont"
@end smallexample
Matching of absolute names is done with shell ``glob'' syntax, that is
@samp{*} matches zero or more characters and @samp{?} matches one character.
So the following would assign @code{base_style} to all widgets:
@smallexample
widget "*" style "base_style"
@end smallexample
Given the absolute class name @code{GtkWindow.GtkVBox.GtkMenuBar}
and the corresponding absolute widget name @code{top.box.menubar},
the following all assign @code{my_style} to the menu bar:
@smallexample
widget_class "GtkWindow.GtkVBox.GtkMenuBar" style "my_style"
widget_class "GtkWindow.*.GtkMenuBar" style "my_style"
widget_class "*GtkMenuBar" style "my_style"
widget "top.box.menubar" style "my_style"
widget "*box*menubar" style "my_style"
widget "*menubar" style "my_style"
widget "*menu*" style "my_style"
@end smallexample
@node GTK names in Emacs
@appendixsubsec GTK names in Emacs
@cindex GTK widget names
@cindex GTK widget classes
In Emacs the top level widget for a frame is a @code{GtkWindow} that
contains a @code{GtkVBox}. The @code{GtkVBox} contains the
@code{GtkMenuBar} and a @code{GtkFixed} widget.
The vertical scroll bars, @code{GtkVScrollbar},
are contained in the @code{GtkFixed} widget.
The text you write in Emacs is drawn in the @code{GtkFixed} widget.
Dialogs in Emacs are @code{GtkDialog} widgets. The file dialog is a
@code{GtkFileSelection} widget.
@noindent
To set a style for the menu bar using the absolute class name, use:
@smallexample
widget_class "GtkWindow.GtkVBox.GtkMenuBar" style "my_style"
@end smallexample
@noindent
For the scroll bar, the absolute class name is:
@smallexample
widget_class
"GtkWindow.GtkVBox.GtkFixed.GtkVScrollbar"
style "my_style"
@end smallexample
@noindent
The names for the emacs widgets, and their classes, are:
@multitable {@code{verticalScrollbar plus}} {@code{GtkFileSelection} and some}
@item @code{emacs-filedialog}
@tab @code{GtkFileSelection}
@item @code{emacs-dialog}
@tab @code{GtkDialog}
@item @code{Emacs}
@tab @code{GtkWindow}
@item @code{pane}
@tab @code{GtkVHbox}
@item @code{emacs}
@tab @code{GtkFixed}
@item @code{menubar}
@tab @code{GtkMenuBar}
@item @code{verticalScrollbar}
@tab @code{GtkVScrollbar}
@item @code{emacs-menuitem}
@tab anything in menus
@end multitable
@noindent
Thus, for Emacs you can write the two examples above as:
@smallexample
widget "Emacs.pane.menubar" style "my_style"
widget "Emacs.pane.emacs.verticalScrollbar" style "my_style"
@end smallexample
GTK absolute names are quite strange when it comes to menus
and dialogs. The names do not start with @samp{Emacs}, as they are
free-standing windows and not contained (in the GTK sense) by the
Emacs GtkWindow. To customize the dialogs and menus, use wildcards like this:
@smallexample
widget "*emacs-dialog*" style "my_dialog_style"
widget "*emacs-filedialog* style "my_file_style"
widget "*emacs-menuitem* style "my_menu_style"
@end smallexample
An alternative is to put customization into @file{~/.emacs.d/gtkrc}.
This file is only read by Emacs, so anything in @file{~/.emacs.d/gtkrc}
affects Emacs but leaves other applications unaffected.
For example, the drop down menu in the file dialog can not
be customized by any absolute widget name, only by an absolute
class name. This is so because the widgets in the drop down menu does not
have names and the menu is not contained in the Emacs GtkWindow.
To have all menus in Emacs look the same, use this in @file{~/.emacs.d/gtkrc}:
@smallexample
widget_class "*Menu*" style "my_menu_style"
@end smallexample
@node GTK styles
@appendixsubsec GTK styles
@cindex GTK styles
In a GTK style you specify the appearance widgets shall have. You
can specify foreground and background color, background pixmap and font.
The edit widget (where you edit the text) in Emacs is a GTK widget,
but trying to specify a style for the edit widget will have no effect.
This is so that Emacs compiled for GTK is compatible with Emacs compiled
for other X toolkits. The settings for foreground, background and font