changeset 109232:bb675fbc7bc6

Merge from mainline.
author Katsumi Yamaoka <katsumi@flagship2>
date Mon, 28 Jun 2010 13:32:47 +0000
parents b6c00fb16e8f (current diff) 012ef7d8f2be (diff)
children 9f1761f40039
files lisp/dynamic-setting.el
diffstat 36 files changed, 740 insertions(+), 485 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Fri Jun 25 23:19:18 2010 +0000
+++ b/ChangeLog	Mon Jun 28 13:32:47 2010 +0000
@@ -1,3 +1,14 @@
+2010-06-28  Jan Djärv  <jan.h.d@swipnet.se>
+
+	* configure.in: Add --with-x-toolkit=gtk3. Remove HAVE_GTK_MULTIDISPLAY,
+	check for gtk_file_chooser_dialog_new, and HAVE_GTK_FILE_BOTH (implied
+	by minimum required Gtk+ 2.6).  Add checks for functions introduced
+	in Gtk+ 2.14 or newer (bug#6505).
+
+2010-06-26  Eli Zaretskii  <eliz@gnu.org>
+
+	* config.bat: Remove white space around "+" in COPY commands.
+
 2010-06-16  Chong Yidong  <cyd@stupidchicken.com>
 
 	* INSTALL: Update font information (Bug#6389).
--- a/config.bat	Fri Jun 25 23:19:18 2010 +0000
+++ b/config.bat	Mon Jun 28 13:32:47 2010 +0000
@@ -191,7 +191,7 @@
 
 rem   Create "makefile" from "makefile.in".
 rm -f Makefile makefile.tmp
-copy Makefile.in + deps.mk makefile.tmp
+copy Makefile.in+deps.mk makefile.tmp
 sed -f ../msdos/sed1v2.inp <makefile.tmp >Makefile
 rm -f makefile.tmp
 
--- a/configure	Fri Jun 25 23:19:18 2010 +0000
+++ b/configure	Mon Jun 28 13:32:47 2010 +0000
@@ -745,6 +745,7 @@
 build_cpu
 build
 MAINT
+GZIP_INFO
 target_alias
 host_alias
 build_alias
@@ -815,6 +816,7 @@
 with_gconf
 with_selinux
 with_makeinfo
+with_compress_info
 with_pkg_config_prog
 with_crt_dir
 with_gnustep_conf
@@ -1495,8 +1497,8 @@
                           string giving default POP mail host
   --without-sound         don't compile with sound support
   --without-sync-input    process async input synchronously
-  --with-x-toolkit=KIT    use an X toolkit (KIT one of: yes or gtk, lucid or
-                          athena, motif, no)
+  --with-x-toolkit=KIT    use an X toolkit (KIT one of: yes or gtk, gtk3,
+                          lucid or athena, motif, no)
   --without-xpm           don't compile with XPM image support
   --without-jpeg          don't compile with JPEG image support
   --without-tiff          don't compile with TIFF image support
@@ -1517,6 +1519,7 @@
   --without-gconf         don't compile with GConf support
   --without-selinux       don't compile with SELinux support
   --without-makeinfo      don't require makeinfo for building manuals
+  --without-compress-info don't compress the installed Info pages
   --with-pkg-config-prog=PATH
                           path to pkg-config for finding GTK and librsvg
   --with-crt-dir=DIR      directory containing crtn.o etc. The default is
@@ -2658,10 +2661,11 @@
 	    a | at | ath | athe | athen | athena )	val=athena ;;
 	    m | mo | mot | moti | motif )	val=motif ;;
 	    g | gt | gtk  )	val=gtk ;;
+	    gtk3  )	val=gtk3 ;;
 	    * )
 as_fn_error "\`--with-x-toolkit=$withval' is invalid;
-this option's value should be \`yes', \`no', \`lucid', \`athena', \`motif' or \`gtk'.
-\`yes' and \`gtk' are synonyms. \`athena' and \`lucid' are synonyms." "$LINENO" 5
+this option's value should be \`yes', \`no', \`lucid', \`athena', \`motif', \`gtk' or
+\`gtk3'.  \`yes' and \`gtk' are synonyms. \`athena' and \`lucid' are synonyms." "$LINENO" 5
 	    ;;
 	  esac
 	  with_x_toolkit=$val
@@ -2820,6 +2824,23 @@
 fi
 
 
+## This is an option because I do not know if all info/man support
+## compressed files, nor how to test if they do so.
+
+# Check whether --with-compress-info was given.
+if test "${with_compress_info+set}" = set; then :
+  withval=$with_compress_info;
+else
+     with_compress_info=yes
+fi
+
+if test $with_compress_info = yes; then
+   GZIP_INFO=yes
+else
+   GZIP_INFO=
+fi
+
+
 
 # Check whether --with-pkg-config-prog was given.
 if test "${with_pkg_config_prog+set}" = set; then :
@@ -7482,6 +7503,8 @@
       motif ) USE_X_TOOLKIT=MOTIF ;;
       gtk ) with_gtk=yes
             USE_X_TOOLKIT=none ;;
+      gtk3 ) with_gtk3=yes
+             USE_X_TOOLKIT=none ;;
       no ) USE_X_TOOLKIT=none ;;
       * ) USE_X_TOOLKIT=maybe ;;
     esac
@@ -8317,6 +8340,112 @@
 
 
 HAVE_GTK=no
+if test "${with_gtk3}" = "yes"; then
+  GLIB_REQUIRED=2.6
+  GTK_REQUIRED=2.90
+  GTK_MODULES="gtk+-3.0 >= $GTK_REQUIRED glib-2.0 >= $GLIB_REQUIRED"
+
+
+  succeeded=no
+
+  # Extract the first word of "pkg-config", so it can be a program name with args.
+set dummy pkg-config; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_path_PKG_CONFIG+set}" = set; then :
+  $as_echo_n "(cached) " >&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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_path_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+  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
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PKG_CONFIG" >&5
+$as_echo "$PKG_CONFIG" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+
+  if test "$PKG_CONFIG" = "no" ; then
+     pkg_check_gtk=no
+  else
+     PKG_CONFIG_MIN_VERSION=0.9.0
+     if $PKG_CONFIG --atleast-pkgconfig-version $PKG_CONFIG_MIN_VERSION; then
+        { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $GTK_MODULES" >&5
+$as_echo_n "checking for $GTK_MODULES... " >&6; }
+
+        if $PKG_CONFIG --exists "$GTK_MODULES" 2>&5; then
+            { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+            succeeded=yes
+
+            { $as_echo "$as_me:${as_lineno-$LINENO}: checking GTK_CFLAGS" >&5
+$as_echo_n "checking GTK_CFLAGS... " >&6; }
+            GTK_CFLAGS=`$PKG_CONFIG --cflags "$GTK_MODULES"|sed -e 's,///*,/,g'`
+            { $as_echo "$as_me:${as_lineno-$LINENO}: result: $GTK_CFLAGS" >&5
+$as_echo "$GTK_CFLAGS" >&6; }
+
+            { $as_echo "$as_me:${as_lineno-$LINENO}: checking GTK_LIBS" >&5
+$as_echo_n "checking GTK_LIBS... " >&6; }
+            GTK_LIBS=`$PKG_CONFIG --libs "$GTK_MODULES"|sed -e 's,///*,/,g'`
+            { $as_echo "$as_me:${as_lineno-$LINENO}: result: $GTK_LIBS" >&5
+$as_echo "$GTK_LIBS" >&6; }
+        else
+            { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+            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"`
+
+        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
+     pkg_check_gtk=yes
+  else
+     pkg_check_gtk=no
+  fi
+
+  if test "$pkg_check_gtk" = "no" && test "$USE_X_TOOLKIT" != "maybe"; then
+     as_fn_error "$GTK_PKG_ERRORS" "$LINENO" 5
+  fi
+fi
+
+if test "$pkg_check_gtk" != "yes"; then
+  HAVE_GTK=no
 if test "${with_gtk}" = "yes" || test "$USE_X_TOOLKIT" = "maybe"; then
   GLIB_REQUIRED=2.6
   GTK_REQUIRED=2.6
@@ -8420,7 +8549,7 @@
      as_fn_error "$GTK_PKG_ERRORS" "$LINENO" 5
   fi
 fi
-
+fi
 
 GTK_OBJ=
 if test x"$pkg_check_gtk" = xyes; then
@@ -8478,24 +8607,6 @@
     with_toolkit_scroll_bars=yes
   fi
 
-      HAVE_GTK_MULTIDISPLAY=no
-  for ac_func in gdk_display_open
-do :
-  ac_fn_c_check_func "$LINENO" "gdk_display_open" "ac_cv_func_gdk_display_open"
-if test "x$ac_cv_func_gdk_display_open" = x""yes; then :
-  cat >>confdefs.h <<_ACEOF
-#define HAVE_GDK_DISPLAY_OPEN 1
-_ACEOF
- HAVE_GTK_MULTIDISPLAY=yes
-fi
-done
-
-  if test "${HAVE_GTK_MULTIDISPLAY}" = "yes"; then
-
-$as_echo "#define HAVE_GTK_MULTIDISPLAY 1" >>confdefs.h
-
-  fi
-
           HAVE_GTK_FILE_SELECTION=no
   ac_fn_c_check_decl "$LINENO" "GTK_TYPE_FILE_SELECTION" "ac_cv_have_decl_GTK_TYPE_FILE_SELECTION" "$ac_includes_default
 #include <gtk/gtk.h>
@@ -8514,49 +8625,13 @@
   cat >>confdefs.h <<_ACEOF
 #define HAVE_GTK_FILE_SELECTION_NEW 1
 _ACEOF
- HAVE_GTK_FILE_SELECTION=yes
-else
-  HAVE_GTK_FILE_SELECTION=no
-fi
-done
-
-  fi
-
-    HAVE_GTK_FILE_CHOOSER=no
-  ac_fn_c_check_decl "$LINENO" "GTK_TYPE_FILE_CHOOSER" "ac_cv_have_decl_GTK_TYPE_FILE_CHOOSER" "$ac_includes_default
-#include <gtk/gtk.h>
-"
-if test "x$ac_cv_have_decl_GTK_TYPE_FILE_CHOOSER" = x""yes; then :
-  HAVE_GTK_FILE_CHOOSER=yes
-else
-  HAVE_GTK_FILE_CHOOSER=no
-fi
-
-  if test "$HAVE_GTK_FILE_CHOOSER" = yes; then
-    for ac_func in gtk_file_chooser_dialog_new
-do :
-  ac_fn_c_check_func "$LINENO" "gtk_file_chooser_dialog_new" "ac_cv_func_gtk_file_chooser_dialog_new"
-if test "x$ac_cv_func_gtk_file_chooser_dialog_new" = x""yes; then :
-  cat >>confdefs.h <<_ACEOF
-#define HAVE_GTK_FILE_CHOOSER_DIALOG_NEW 1
-_ACEOF
- HAVE_GTK_FILE_CHOOSER=yes
-else
-  HAVE_GTK_FILE_CHOOSER=no
-fi
-done
-
-  fi
-
-  if test "$HAVE_GTK_FILE_SELECTION" = yes \
-     && test "$HAVE_GTK_FILE_CHOOSER" = yes;  then
-
-$as_echo "#define HAVE_GTK_FILE_BOTH 1" >>confdefs.h
-
-  fi
-
-      if test "$HAVE_GTK_FILE_CHOOSER" = yes; then
-    HAVE_GTK_AND_PTHREAD=no
+
+fi
+done
+
+  fi
+
+        HAVE_GTK_AND_PTHREAD=no
     for ac_header in pthread.h
 do :
   ac_fn_c_check_header_mongrel "$LINENO" "pthread.h" "ac_cv_header_pthread_h" "$ac_includes_default"
@@ -8620,7 +8695,24 @@
 $as_echo "#define HAVE_GTK_AND_PTHREAD 1" >>confdefs.h
 
     fi
-  fi
+
+    for ac_func in gtk_widget_get_window gtk_widget_set_has_window \
+                 gtk_dialog_get_action_area gtk_widget_get_sensitive \
+                 gtk_widget_get_mapped gtk_adjustment_get_page_size \
+                 gtk_orientable_set_orientation
+do :
+  as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
+ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var"
+eval as_val=\$$as_ac_var
+   if test "x$as_val" = x""yes; then :
+  cat >>confdefs.h <<_ACEOF
+#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1
+_ACEOF
+
+fi
+done
+
+
 fi
 
 HAVE_DBUS=no
--- a/configure.in	Fri Jun 25 23:19:18 2010 +0000
+++ b/configure.in	Mon Jun 28 13:32:47 2010 +0000
@@ -129,7 +129,7 @@
 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],[AS_HELP_STRING([--with-x-toolkit=KIT],
- [use an X toolkit (KIT one of: yes or gtk, lucid or athena, motif, no)])],
+ [use an X toolkit (KIT one of: yes or gtk, gtk3, lucid or athena, motif, no)])],
 [	  case "${withval}" in
 	    y | ye | yes )	val=gtk ;;
 	    n | no )		val=no  ;;
@@ -137,10 +137,11 @@
 	    a | at | ath | athe | athen | athena )	val=athena ;;
 	    m | mo | mot | moti | motif )	val=motif ;;
 	    g | gt | gtk  )	val=gtk ;;
+	    gtk3  )	val=gtk3 ;;
 	    * )
 AC_MSG_ERROR([`--with-x-toolkit=$withval' is invalid;
-this option's value should be `yes', `no', `lucid', `athena', `motif' or `gtk'.
-`yes' and `gtk' are synonyms. `athena' and `lucid' are synonyms.])
+this option's value should be `yes', `no', `lucid', `athena', `motif', `gtk' or
+`gtk3'.  `yes' and `gtk' are synonyms. `athena' and `lucid' are synonyms.])
 	    ;;
 	  esac
 	  with_x_toolkit=$val
@@ -1594,6 +1595,8 @@
 dnl Dont set this for GTK.  A lot of tests below assumes Xt when
 dnl USE_X_TOOLKIT is set.
             USE_X_TOOLKIT=none ;;
+      gtk3 ) with_gtk3=yes
+             USE_X_TOOLKIT=none ;;
       no ) USE_X_TOOLKIT=none ;;
 dnl If user did not say whether to use a toolkit, make this decision later:
 dnl use the toolkit if we have gtk, or X11R5 or newer.
@@ -1842,6 +1845,20 @@
 
 
 HAVE_GTK=no
+if test "${with_gtk3}" = "yes"; then
+  GLIB_REQUIRED=2.6
+  GTK_REQUIRED=2.90
+  GTK_MODULES="gtk+-3.0 >= $GTK_REQUIRED glib-2.0 >= $GLIB_REQUIRED"
+
+  dnl Checks for libraries.
+  PKG_CHECK_MODULES(GTK, $GTK_MODULES, pkg_check_gtk=yes, pkg_check_gtk=no)
+  if test "$pkg_check_gtk" = "no" && test "$USE_X_TOOLKIT" != "maybe"; then
+     AC_MSG_ERROR($GTK_PKG_ERRORS)
+  fi
+fi
+
+if test "$pkg_check_gtk" != "yes"; then
+  HAVE_GTK=no
 if test "${with_gtk}" = "yes" || test "$USE_X_TOOLKIT" = "maybe"; then
   GLIB_REQUIRED=2.6
   GTK_REQUIRED=2.6
@@ -1853,7 +1870,7 @@
      AC_MSG_ERROR($GTK_PKG_ERRORS)
   fi
 fi
-
+fi
 
 GTK_OBJ=
 if test x"$pkg_check_gtk" = xyes; then
@@ -1898,15 +1915,6 @@
     with_toolkit_scroll_bars=yes
   fi
 
-  dnl  Check if we can use multiple displays with this GTK version.
-  dnl  If gdk_display_open exists, assume all others are there also.
-  HAVE_GTK_MULTIDISPLAY=no
-  AC_CHECK_FUNCS(gdk_display_open, HAVE_GTK_MULTIDISPLAY=yes)
-  if test "${HAVE_GTK_MULTIDISPLAY}" = "yes"; then
-    AC_DEFINE(HAVE_GTK_MULTIDISPLAY, 1,
-              [Define to 1 if GTK can handle more than one display.])
-  fi
-
   dnl  Check if we have the old file selection dialog declared and
   dnl  in the link library.  In 2.x it may be in the library,
   dnl  but not declared if deprecated featured has been selected out.
@@ -1916,29 +1924,11 @@
                    HAVE_GTK_FILE_SELECTION=no, [AC_INCLUDES_DEFAULT
 #include <gtk/gtk.h>])
   if test "$HAVE_GTK_FILE_SELECTION" = yes; then
-    AC_CHECK_FUNCS(gtk_file_selection_new, HAVE_GTK_FILE_SELECTION=yes,
-                   HAVE_GTK_FILE_SELECTION=no)
-  fi
-
-  dnl  Check if we have the new file chooser dialog
-  HAVE_GTK_FILE_CHOOSER=no
-  AC_CHECK_DECL(GTK_TYPE_FILE_CHOOSER, HAVE_GTK_FILE_CHOOSER=yes,
-                HAVE_GTK_FILE_CHOOSER=no, [AC_INCLUDES_DEFAULT
-#include <gtk/gtk.h>])
-  if test "$HAVE_GTK_FILE_CHOOSER" = yes; then
-    AC_CHECK_FUNCS(gtk_file_chooser_dialog_new, HAVE_GTK_FILE_CHOOSER=yes,
-                   HAVE_GTK_FILE_CHOOSER=no)
-  fi
-
-  if test "$HAVE_GTK_FILE_SELECTION" = yes \
-     && test "$HAVE_GTK_FILE_CHOOSER" = yes;  then
-    AC_DEFINE(HAVE_GTK_FILE_BOTH, 1,
-              [Define to 1 if GTK has both file selection and chooser dialog.])
+    AC_CHECK_FUNCS(gtk_file_selection_new)
   fi
 
   dnl Check if pthreads are available.  Emacs only needs this when using
   dnl gtk_file_chooser under Gnome.
-  if test "$HAVE_GTK_FILE_CHOOSER" = yes; then
     HAVE_GTK_AND_PTHREAD=no
     AC_CHECK_HEADERS(pthread.h)
     if test "$ac_cv_header_pthread_h"; then
@@ -1952,7 +1942,13 @@
       AC_DEFINE(HAVE_GTK_AND_PTHREAD, 1,
                [Define to 1 if you have GTK and pthread (-lpthread).])
     fi
-  fi
+
+  dnl Check for functions introduced in 2.14 and later.
+  AC_CHECK_FUNCS(gtk_widget_get_window gtk_widget_set_has_window \
+                 gtk_dialog_get_action_area gtk_widget_get_sensitive \
+                 gtk_widget_get_mapped gtk_adjustment_get_page_size \
+                 gtk_orientable_set_orientation)
+
 fi
 
 dnl D-Bus has been tested under GNU/Linux only.  Must be adapted for
--- a/etc/NEWS	Fri Jun 25 23:19:18 2010 +0000
+++ b/etc/NEWS	Mon Jun 28 13:32:47 2010 +0000
@@ -41,6 +41,12 @@
 ** There is a new configure option --with-crt-dir.
 This is only useful if your crt*.o files are in a non-standard location.
 
+---
+** Emacs can be compiled against Gtk+ 3.0 if you pass --with-x-toolkit=gtk3 
+to configure.  Note that other libraries used by Emacs, RSVG and GConf,
+also depend on Gtk+.  You can disable them with --without-rsvg and
+--without-gconf.
+
 
 * Startup Changes in Emacs 24.1
 
@@ -144,6 +150,25 @@
 ** completion-at-point is now an alias for complete-symbol.
 
 ** mouse-region-delete-keys has been deleted.
+
+** Deletion changes
+
+*** New option `delete-active-region'.
+If non-nil, C-d, [delete], and DEL delete the region if it is active
+and no prefix argument is given.  If set to `kill', these commands
+kill instead.
+
+*** New command `delete-forward-char', bound to C-d and [delete].
+This is meant for interactive use, and obeys `delete-active-region';
+delete-char, meant for Lisp, does not obey `delete-active-region'.
+
+*** `delete-backward-char' is now a Lisp function.
+Apart from obeying `delete-active-region', its behavior is unchanged.
+However, the byte compiler now warns if it is called from Lisp; you
+should use delete-char with a negative argument instead.
+
+*** The option `mouse-region-delete-keys' has been deleted.
+
 
 * Changes in Specialized Modes and Packages in Emacs 24.1
 
@@ -275,6 +300,15 @@
 
 ** Passing a nil argument to a minor mode function now turns the mode
    ON unconditionally.
+
+** During startup, Emacs no longer adds entries for `menu-bar-lines'
+and `tool-bar-lines' to `default-frame-alist' and
+`initial-frame-alist'.  With these alist entries omitted, `make-frame'
+checks the value of the variable `menu-bar-mode'/`tool-bar-mode' to
+determine whether to create a menu-bar or tool-bar, respectively.
+If the alist entries are added, they override the value of
+`menu-bar-mode'/`tool-bar-mode'.
+
 
 * Lisp changes in Emacs 24.1
 
--- a/lisp/ChangeLog	Fri Jun 25 23:19:18 2010 +0000
+++ b/lisp/ChangeLog	Mon Jun 28 13:32:47 2010 +0000
@@ -1,3 +1,51 @@
+2010-06-28  Jan Djärv  <jan.h.d@swipnet.se>
+
+	* dynamic-setting.el (font-setting-change-default-font): Remove
+	call to message.
+
+2010-06-28  Kenichi Handa  <handa@m17n.org>
+
+	* international/quail.el (quail-insert-kbd-layout): Fix the
+	showing of untranslated characters.
+
+2010-06-28  Chong Yidong  <cyd@stupidchicken.com>
+
+	* simple.el (delete-active-region): New option.
+	(delete-backward-char): Implement in Lisp.
+	(delete-forward-char): New command.
+
+	* mouse.el (mouse-region-delete-keys): Deleted.
+	(mouse-show-mark): Simplify.
+
+	* bindings.el (global-map): Bind delete and DEL, the former to
+	delete-forward-char.
+
+2010-01-16  Lennart Borgman  <lennart.borgman@gmail.com>
+
+	* progmodes/ruby-mode.el (ruby-mode-map): Don't bind TAB.
+	(ruby-mode): Bind indent-line-function (Bug#5119).
+
+2010-06-27  Chong Yidong  <cyd@stupidchicken.com>
+
+	* startup.el (command-line): Recognize "0" X resource value.
+
+2010-06-27  Chong Yidong  <cyd@stupidchicken.com>
+
+	* startup.el (command-line): Use X resources to set the value of
+	menu-bar-mode and tool-bar-mode, before calling frame-initialize.
+
+	* menu-bar.el (menu-bar-mode):
+	* tool-bar.el (tool-bar-mode): Don't change default-frame-alist.
+	Set init-value to t.
+
+	* frame.el (frame-notice-user-settings): Don't change
+	default-frame-alist based on menu-bar-mode and tool-bar-mode, or
+	vice versa (Bug#2249).
+
+2010-06-26  Eli Zaretskii  <eliz@gnu.org>
+
+	* w32-fns.el (w32-convert-standard-filename): Doc fix.
+
 2010-06-25  Agustín Martín  <agustin.martin@hispalinux.es>
 
 	* flyspell.el (flyspell-check-previous-highlighted-word): Make
--- a/lisp/bindings.el	Fri Jun 25 23:19:18 2010 +0000
+++ b/lisp/bindings.el	Mon Jun 28 13:32:47 2010 +0000
@@ -822,6 +822,9 @@
     (setq i (1+ i))))
 (define-key global-map [?\C-\M--] 'negative-argument)
 
+(define-key global-map "\177" 'delete-backward-char)
+(define-key global-map "\C-d" 'delete-forward-char)
+
 (define-key global-map "\C-k" 'kill-line)
 (define-key global-map "\C-w" 'kill-region)
 (define-key esc-map "w" 'kill-ring-save)
--- a/lisp/dynamic-setting.el	Fri Jun 25 23:19:18 2010 +0000
+++ b/lisp/dynamic-setting.el	Mon Jun 28 13:32:47 2010 +0000
@@ -65,7 +65,6 @@
 		      frame-font)))
 	      (if font-to-set
 		  (progn
-		    (message "setting %s" font-to-set)
 		    (set-frame-parameter f 'font-parameter font-to-set)
 		    (set-face-attribute 'default f
 					:width 'normal
--- a/lisp/frame.el	Fri Jun 25 23:19:18 2010 +0000
+++ b/lisp/frame.el	Mon Jun 28 13:32:47 2010 +0000
@@ -39,13 +39,6 @@
 
 (defvar window-system-default-frame-alist nil
   "Alist of window-system dependent default frame parameters.
-You can set this in your init file; for example,
-
- ;; Disable menubar and toolbar on the console, but enable them under X.
- (setq window-system-default-frame-alist
-       '((x (menu-bar-lines . 1) (tool-bar-lines . 1))
-         (nil (menu-bar-lines . 0) (tool-bar-lines . 0))))
-
 Parameters specified here supersede the values given in
 `default-frame-alist'.")
 
@@ -287,36 +280,6 @@
 React to settings of `initial-frame-alist',
 `window-system-default-frame-alist' and `default-frame-alist'
 there (in decreasing order of priority)."
-  ;; Make menu-bar-mode and default-frame-alist consistent.
-  (when (boundp 'menu-bar-mode)
-    (let ((default (assq 'menu-bar-lines default-frame-alist)))
-      (if default
-	  (setq menu-bar-mode (not (eq (cdr default) 0)))
-	(setq default-frame-alist
-	      (cons (cons 'menu-bar-lines (if menu-bar-mode 1 0))
-		    default-frame-alist)))))
-
-  ;; Make tool-bar-mode and default-frame-alist consistent.  Don't do
-  ;; it in batch mode since that would leave a tool-bar-lines
-  ;; parameter in default-frame-alist in a dumped Emacs, which is not
-  ;; what we want.
-  (when (and (boundp 'tool-bar-mode)
- 	     (not noninteractive))
-    (let ((default (assq 'tool-bar-lines default-frame-alist)))
-      (if default
- 	  (setq tool-bar-mode (not (eq (cdr default) 0)))
-	;; If Emacs was started on a tty, changing default-frame-alist
-	;; would disable the toolbar on X frames created later.  We
-	;; want to keep the default of showing a toolbar under X even
-	;; in this case.
-	;;
-	;; If the user explicitly called `tool-bar-mode' in .emacs,
-	;; then default-frame-alist is already changed anyway.
-	(when initial-window-system
-	  (setq default-frame-alist
-		(cons (cons 'tool-bar-lines (if tool-bar-mode 1 0))
-		      default-frame-alist))))))
-
   ;; Creating and deleting frames may shift the selected frame around,
   ;; and thus the current buffer.  Protect against that.  We don't
   ;; want to use save-excursion here, because that may also try to set
--- a/lisp/international/quail.el	Fri Jun 25 23:19:18 2010 +0000
+++ b/lisp/international/quail.el	Mon Jun 28 13:32:47 2010 +0000
@@ -811,7 +811,7 @@
 		      (setq translation (aref (cdr translation) 0))
 		    (setq translation " ")))
 	      (setq done-list (cons translation done-list)))
-	  (setq translation ch))
+	  (setq translation (aref kbd-layout i)))
 	(aset layout i translation))
       (setq i (1+ i)))
 
--- a/lisp/menu-bar.el	Fri Jun 25 23:19:18 2010 +0000
+++ b/lisp/menu-bar.el	Mon Jun 28 13:32:47 2010 +0000
@@ -1924,28 +1924,20 @@
     `(menu-item ,(purecopy "Previous History Item") previous-history-element
 		:help ,(purecopy "Put previous minibuffer history element in the minibuffer"))))
 
-;;;###autoload
-;; This comment is taken from tool-bar.el near
-;; (put 'tool-bar-mode ...)
-;; We want to pretend the menu bar by standard is on, as this will make
-;; customize consider disabling the menu bar a customization, and save
-;; that.  We could do this for real by setting :init-value below, but
-;; that would overwrite disabling the tool bar from X resources.
-(put 'menu-bar-mode 'standard-value '(t))
-
 (define-minor-mode menu-bar-mode
   "Toggle display of a menu bar on each frame.
 This command applies to all frames that exist and frames to be
 created in the future.
 With a numeric argument, if the argument is positive,
 turn on menu bars; otherwise, turn off menu bars."
-  :init-value nil
+  :init-value t
   :global t
   :group 'frames
 
-  ;; Make menu-bar-mode and default-frame-alist consistent.
-  (modify-all-frames-parameters (list (cons 'menu-bar-lines
-					    (if menu-bar-mode 1 0))))
+  ;; Turn the menu-bars on all frames on or off.
+  (let ((val (if menu-bar-mode 1 0)))
+    (dolist (frame (frame-list))
+      (set-frame-parameter frame 'menu-bar-lines val)))
 
   ;; Make the message appear when Emacs is idle.  We can not call message
   ;; directly.  The minor-mode message "Menu-bar mode disabled" comes
--- a/lisp/mouse.el	Fri Jun 25 23:19:18 2010 +0000
+++ b/lisp/mouse.el	Mon Jun 28 13:32:47 2010 +0000
@@ -929,7 +929,7 @@
   (mouse-minibuffer-check start-event)
   (setq mouse-selection-click-count-buffer (current-buffer))
   ;; We must call deactivate-mark before repositioning point.
-  ;; Otherwise, for select-active-regions non-nil, we get the wrong
+  ;; Otherwise, for `select-active-regions' non-nil, we get the wrong
   ;; selection if the user drags a region, clicks elsewhere to
   ;; reposition point, then middle-clicks to paste the selection.
   (deactivate-mark)
@@ -1263,11 +1263,6 @@
 
 ;; Momentarily show where the mark is, if highlighting doesn't show it.
 
-(defcustom mouse-region-delete-keys '([delete] [deletechar] [backspace])
-  "List of keys that should cause the mouse region to be deleted."
-  :group 'mouse
-  :type '(repeat key-sequence))
-
 (defun mouse-show-mark ()
   (let ((inhibit-quit t)
 	(echo-keystrokes 0)
@@ -1297,8 +1292,7 @@
 				 'vertical-scroll-bar))
 			(and (memq 'down (event-modifiers event))
 			     (not (key-binding key))
-			     (not (mouse-undouble-last-event events))
-			     (not (member key mouse-region-delete-keys)))))
+			     (not (mouse-undouble-last-event events)))))
 	(and (consp event)
 	     (or (eq (car event) 'switch-frame)
 		 (eq (posn-point (event-end event))
@@ -1311,22 +1305,9 @@
 		      (setq events nil)))))))
     ;; If we lost the selection, just turn off the highlighting.
     (unless ignore
-      ;; For certain special keys, delete the region.
-      (if (member key mouse-region-delete-keys)
-	  (progn
-	    ;; Since notionally this is a separate command,
-	    ;; run all the hooks that would be run if it were
-	    ;; executed separately.
-	    (run-hooks 'post-command-hook)
-	    (setq last-command this-command)
-	    (setq this-original-command 'delete-region)
-	    (setq this-command (or (command-remapping this-original-command)
-				   this-original-command))
-	    (run-hooks 'pre-command-hook)
-	    (call-interactively this-command))
-	;; Otherwise, unread the key so it gets executed normally.
-	(setq unread-command-events
-	      (nconc events unread-command-events))))
+      ;; Unread the key so it gets executed normally.
+      (setq unread-command-events
+	    (nconc events unread-command-events)))
     (setq quit-flag nil)
     (unless transient-mark-mode
       (delete-overlay mouse-drag-overlay))))
--- a/lisp/org/ChangeLog	Fri Jun 25 23:19:18 2010 +0000
+++ b/lisp/org/ChangeLog	Mon Jun 28 13:32:47 2010 +0000
@@ -1,3 +1,13 @@
+2010-06-26  Carsten Dominik  <carsten.dominik@gmail.com>
+
+	* org-agenda.el (org-agenda-goto-calendar): Do not bind obsolete
+	variables.
+
+	* org.el (calendar): Require calendar now on top level in org.el
+	and define aliases to new variables when needed.
+	(org-read-date, org-goto-calendar): Do not bind obsolete
+	variables.
+
 2010-06-22  Glenn Morris  <rgm@gnu.org>
 
 	* org-entities.el: Add explicit utf-8 coding cookie to file with
--- a/lisp/org/org-agenda.el	Fri Jun 25 23:19:18 2010 +0000
+++ b/lisp/org/org-agenda.el	Mon Jun 28 13:32:47 2010 +0000
@@ -3981,7 +3981,6 @@
   "Get the (Emacs Calendar) diary entries for DATE."
   (require 'diary-lib)
   (let* ((diary-fancy-buffer "*temporary-fancy-diary-buffer*")
-	 (fancy-diary-buffer diary-fancy-buffer)
 	 (diary-display-hook '(fancy-diary-display))
 	 (diary-display-function 'fancy-diary-display)
 	 (pop-up-frames nil)
@@ -7312,9 +7311,7 @@
 	 (date (calendar-gregorian-from-absolute day))
 	 (calendar-move-hook nil)
 	 (calendar-view-holidays-initially-flag nil)
-	 (calendar-view-diary-initially-flag nil)
-	 (view-calendar-holidays-initially nil)
-	 (view-diary-entries-initially nil))
+	 (calendar-view-diary-initially-flag nil))
     (calendar)
     (calendar-goto-date date)))
 
--- a/lisp/org/org.el	Fri Jun 25 23:19:18 2010 +0000
+++ b/lisp/org/org.el	Mon Jun 28 13:32:47 2010 +0000
@@ -72,8 +72,19 @@
 
 (eval-when-compile
   (require 'cl)
-  (require 'gnus-sum)
-  (require 'calendar))
+  (require 'gnus-sum))
+
+(require 'calendar)
+;; Emacs 22 calendar compatibility:  Make sure the new variables are available
+(unless (boundp 'calendar-view-holidays-initially-flag)
+  (defvaralias 'calendar-view-holidays-initially-flag
+    'view-calendar-holidays-initially))
+(unless (boundp 'calendar-view-diary-initially-flag)
+  (defvaralias 'calendar-view-diary-initially-flag
+    'view-diary-entries-initially))
+(unless (boundp 'diary-fancy-buffer)
+  (defvaralias 'diary-fancy-buffer 'fancy-diary-buffer))
+
 ;; For XEmacs, noutline is not yet provided by outline.el, so arrange for
 ;; the file noutline.el being loaded.
 (if (featurep 'xemacs) (condition-case nil (require 'noutline)))
@@ -13516,9 +13527,7 @@
 	 (calendar-frame-setup nil)
 	 (calendar-move-hook nil)
 	 (calendar-view-diary-initially-flag nil)
-	 (view-diary-entries-initially nil)
 	 (calendar-view-holidays-initially-flag nil)
-	 (view-calendar-holidays-initially nil)
 	 (timestr (format-time-string
 		   (if with-time "%Y-%m-%d %H:%M" "%Y-%m-%d") def))
 	 (prompt (concat (if prompt (concat prompt " ") "")
@@ -14578,9 +14587,7 @@
   (let ((tsr org-ts-regexp) diff
 	(calendar-move-hook nil)
 	(calendar-view-holidays-initially-flag nil)
-	(view-calendar-holidays-initially nil)
-	(calendar-view-diary-initially-flag nil)
-	(view-diary-entries-initially nil))
+	(calendar-view-diary-initially-flag nil))
     (if (or (org-at-timestamp-p)
 	    (save-excursion
 	      (beginning-of-line 1)
--- a/lisp/progmodes/ruby-mode.el	Fri Jun 25 23:19:18 2010 +0000
+++ b/lisp/progmodes/ruby-mode.el	Mon Jun 28 13:32:47 2010 +0000
@@ -166,7 +166,6 @@
     (define-key map (kbd "M-C-n") 'ruby-end-of-block)
     (define-key map (kbd "M-C-h") 'ruby-mark-defun)
     (define-key map (kbd "M-C-q") 'ruby-indent-exp)
-    (define-key map (kbd "TAB")   'ruby-indent-line)
     (define-key map (kbd "C-M-h") 'backward-kill-word)
     (define-key map (kbd "C-j")   'reindent-then-newline-and-indent)
     (define-key map (kbd "C-m")   'newline)
@@ -1390,6 +1389,8 @@
   (setq major-mode 'ruby-mode)
   (ruby-mode-variables)
 
+  (set (make-local-variable 'indent-line-function)
+       'ruby-indent-line)
   (set (make-local-variable 'imenu-create-index-function)
        'ruby-imenu-create-index)
   (set (make-local-variable 'add-log-current-defun-function)
--- a/lisp/simple.el	Fri Jun 25 23:19:18 2010 +0000
+++ b/lisp/simple.el	Mon Jun 28 13:32:47 2010 +0000
@@ -844,6 +844,78 @@
 	 (overlay-recenter (point))
 	 (recenter -3))))
 
+(defcustom delete-active-region t
+  "Whether single-char deletion commands delete an active region.
+This has an effect only if Transient Mark mode is enabled, and
+affects `delete-forward-char' and `delete-backward-char', though
+not `delete-char'.
+
+If the value is the symbol `kill', the active region is killed
+instead of deleted."
+  :type '(choice (const :tag "Delete active region" t)
+                 (const :tag "Kill active region" kill)
+                 (const :tag "Do ordinary deletion" nil))
+  :group 'editing
+  :version "24.1")
+
+(defun delete-backward-char (n &optional killflag)
+  "Delete the previous N characters (following if N is negative).
+If Transient Mark mode is enabled, the mark is active, and N is 1,
+delete the text in the region and deactivate the mark instead.
+To disable this, set `delete-active-region' to nil.
+
+Optional second arg KILLFLAG, if non-nil, means to kill (save in
+kill ring) instead of delete.  Interactively, N is the prefix
+arg, and KILLFLAG is set if N is explicitly specified.
+
+In Overwrite mode, single character backward deletion may replace
+tabs with spaces so as to back over columns, unless point is at
+the end of the line."
+  (interactive "p\nP")
+  (unless (integerp n)
+    (signal 'wrong-type-argument (list 'integerp n)))
+  (cond ((and (use-region-p)
+	      delete-active-region
+	      (= n 1))
+	 ;; If a region is active, kill or delete it.
+	 (if (eq delete-active-region 'kill)
+	     (kill-region (region-beginning) (region-end))
+	   (delete-region (region-beginning) (region-end))))
+	;; In Overwrite mode, maybe untabify while deleting
+	((null (or (null overwrite-mode)
+		   (<= n 0)
+		   (memq (char-before) '(?\t ?\n))
+		   (eobp)
+		   (eq (char-after) ?\n)))
+	 (let* ((ocol (current-column))
+		(val (delete-char (- n) killflag)))
+	   (save-excursion
+	     (insert-char ?\s (- ocol (current-column)) nil))))
+	;; Otherwise, do simple deletion.
+	(t (delete-char (- n) killflag))))
+
+(defun delete-forward-char (n &optional killflag)
+  "Delete the previous N characters (following if N is negative).
+If Transient Mark mode is enabled, the mark is active, and N is 1,
+delete the text in the region and deactivate the mark instead.
+To disable this, set `delete-active-region' to nil.
+
+Optional second arg KILLFLAG non-nil means to kill (save in kill
+ring) instead of delete.  Interactively, N is the prefix arg, and
+KILLFLAG is set if N was explicitly specified."
+  (interactive "p\nP")
+  (unless (integerp n)
+    (signal 'wrong-type-argument (list 'integerp n)))
+  (cond ((and (use-region-p)
+	      delete-active-region
+	      (= n 1))
+	 ;; If a region is active, kill or delete it.
+	 (if (eq delete-active-region 'kill)
+	     (kill-region (region-beginning) (region-end))
+	   (delete-region (region-beginning) (region-end))))
+	;; Otherwise, do simple deletion.
+	(t (delete-char n killflag))))
+
 (defun mark-whole-buffer ()
   "Put point at beginning and mark at end of buffer.
 You probably should not use this function in Lisp programs;
--- a/lisp/startup.el	Fri Jun 25 23:19:18 2010 +0000
+++ b/lisp/startup.el	Mon Jun 28 13:32:47 2010 +0000
@@ -878,10 +878,32 @@
 
   (run-hooks 'before-init-hook)
 
-  ;; Under X Window, this creates the X frame and deletes the terminal frame.
+  ;; Under X, this creates the X frame and deletes the terminal frame.
   (unless (daemonp)
+    ;; Enable or disable the tool-bar and menu-bar.
+    ;; While we're at it, set `no-blinking-cursor' too.
+    (cond
+     ((or noninteractive emacs-basic-display)
+      (setq menu-bar-mode nil
+	    tool-bar-mode nil
+	    no-blinking-cursor t))
+     ;; Check X resources if available.
+     ((memq initial-window-system '(x w32 ns))
+      (let ((no-vals  '("no" "off" "false" "0")))
+	(if (member (x-get-resource "menuBar" "MenuBar") no-vals)
+	    (setq menu-bar-mode nil))
+	(if (member (x-get-resource "toolBar" "ToolBar") no-vals)
+	    (setq tool-bar-mode nil))
+	(if (member (x-get-resource "cursorBlink" "CursorBlink")
+		    no-vals)
+	    (setq no-blinking-cursor t)))))
     (frame-initialize))
 
+  ;; Set up the tool-bar (even in tty frames, since Emacs might open a
+  ;; graphical frame later).
+  (unless noninteractive
+    (tool-bar-setup))
+
   ;; Turn off blinking cursor if so specified in X resources.  This is here
   ;; only because all other settings of no-blinking-cursor are here.
   (unless (or noninteractive
@@ -891,25 +913,6 @@
 				'("off" "false")))))
     (setq no-blinking-cursor t))
 
-  ;; If frame was created with a menu bar, set menu-bar-mode on.
-  (unless (or noninteractive
-	      emacs-basic-display
-              (and (memq initial-window-system '(x w32))
-                   (<= (frame-parameter nil 'menu-bar-lines) 0)))
-    (menu-bar-mode 1))
-
-  (unless (or noninteractive (not (fboundp 'tool-bar-mode)))
-    ;; Set up the tool-bar.  Do this even in tty frames, so that there
-    ;; is a tool-bar if Emacs later opens a graphical frame.
-    (if (or emacs-basic-display
-	    (and (numberp (frame-parameter nil 'tool-bar-lines))
-		 (<= (frame-parameter nil 'tool-bar-lines) 0)))
-	;; On a graphical display with the toolbar disabled via X
-	;; resources, set up the toolbar without enabling it.
-	(tool-bar-setup)
-      ;; Otherwise, enable tool-bar-mode.
-      (tool-bar-mode 1)))
-
   ;; Re-evaluate predefined variables whose initial value depends on
   ;; the runtime context.
   (mapc 'custom-reevaluate-setting
--- a/lisp/tool-bar.el	Fri Jun 25 23:19:18 2010 +0000
+++ b/lisp/tool-bar.el	Mon Jun 28 13:32:47 2010 +0000
@@ -48,21 +48,17 @@
 
 See `tool-bar-add-item' and `tool-bar-add-item-from-menu' for
 conveniently adding tool bar items."
-  :init-value nil
+  :init-value t
   :global t
   :group 'mouse
   :group 'frames
-  (if tool-bar-mode
-      (progn
-	;; Make one tool-bar-line for any - including non-graphical -
-	;; terminal, see Bug#1754.  If this causes problems, we should
-	;; handle the problem in `modify-frame-parameters' or do not
-	;; call `modify-all-frames-parameters' when toggling the tool
-	;; bar off either.
-	(modify-all-frames-parameters (list (cons 'tool-bar-lines 1)))
-	(if (= 1 (length (default-value 'tool-bar-map))) ; not yet setup
-	    (tool-bar-setup)))
-    (modify-all-frames-parameters (list (cons 'tool-bar-lines 0)))))
+  ;; Make tool-bar even if terminal is non-graphical (Bug#1754).
+  (let ((val (if tool-bar-mode 1 0)))
+    (dolist (frame (frame-list))
+      (set-frame-parameter frame 'tool-bar-lines val)))
+  (when tool-bar-mode
+    (if (= 1 (length (default-value 'tool-bar-map))) ; not yet setup
+	(tool-bar-setup))))
 
 ;;;###autoload
 ;; Used in the Show/Hide menu, to have the toggle reflect the current frame.
@@ -74,17 +70,6 @@
       (tool-bar-mode (if (> (frame-parameter nil 'tool-bar-lines) 0) 0 1))
     (tool-bar-mode arg)))
 
-;;;###autoload
-;; We want to pretend the toolbar by standard is on, as this will make
-;; customize consider disabling the toolbar a customization, and save
-;; that.  We could do this for real by setting :init-value above, but
-;; that would turn on the toolbar in MS Windows where it is currently
-;; useless, and it would overwrite disabling the tool bar from X
-;; resources.  If anyone want to implement this in a cleaner way,
-;; please do so.
-;; -- Per Abrahamsen <abraham@dina.kvl.dk> 2002-02-21.
-(put 'tool-bar-mode 'standard-value '(t))
-
 (defvar tool-bar-map (make-sparse-keymap)
   "Keymap for the tool bar.
 Define this locally to override the global tool bar.")
--- a/lisp/w32-fns.el	Fri Jun 25 23:19:18 2010 +0000
+++ b/lisp/w32-fns.el	Mon Jun 28 13:32:47 2010 +0000
@@ -254,7 +254,7 @@
 ;;				     (expand-file-name ".." exec-directory)))))
 
 (defun w32-convert-standard-filename (filename)
-  "Convert a standard file's name to something suitable for the MS-Windows.
+  "Convert a standard file's name to something suitable for MS-Windows.
 This means to guarantee valid names and perhaps to canonicalize
 certain patterns.
 
--- a/msdos/ChangeLog	Fri Jun 25 23:19:18 2010 +0000
+++ b/msdos/ChangeLog	Mon Jun 28 13:32:47 2010 +0000
@@ -1,3 +1,14 @@
+2010-06-26  Eli Zaretskii  <eliz@gnu.org>
+
+	* mainmake.v2 (version): Use emacs_version[] in src/emacs.c
+	instead of lisp/version.el (see revno 100306).
+
+	* sed1v2.inp (MKDEPDIR): Edit to empty.
+	Delete lines in rules that invoke $(MKDEPDIR).
+	Fix editing rules that begin with "cd ../lisp".
+	Edit out sh if-then-else-fi constructs that test ${CANNOT_DUMP}.
+	Edit out "|| exit ;\" constructs in emacs${EXEEXT} rule.
+
 2010-06-03  Dan Nicolaescu  <dann@ics.uci.edu>
 
 	* sed1v2.inp (UNEXEC_OBJ): Use UNEXEC_OBJ instead of unexec.
--- a/msdos/mainmake.v2	Fri Jun 25 23:19:18 2010 +0000
+++ b/msdos/mainmake.v2	Mon Jun 28 13:32:47 2010 +0000
@@ -65,7 +65,7 @@
 top_srcdir := $(subst \,/,$(shell cd))
 
 # Find out which version of Emacs this is.
-version := ${shell sed -n -e '/(defconst emacs-version/s/^[^"]*\("[^"]*"\).*/\1/p' lisp/version.el}
+version := ${shell sed -n -e '/^const char emacs_version/s/^[^"]*\("[^"]*"\).*/\1/p' src/emacs.c}
 
 # Q: Do we need to bootstrap?
 # A: Only if we find admin/admin.el, i.e. we are building out of 
--- a/msdos/sed1v2.inp	Fri Jun 25 23:19:18 2010 +0000
+++ b/msdos/sed1v2.inp	Mon Jun 28 13:32:47 2010 +0000
@@ -20,12 +20,6 @@
 s/^[ \f\t][ \f\t]*$//
 s/^ /	/
 s/\.h\.in/.h-in/
-/^	LC_ALL=C \$(RUN_TEMACS)/i\
-	stubedit temacs.exe minstack=1024k
-/^	LC_ALL=C.*\$(RUN_TEMACS)/s/LC_ALL=C/set &;/
-/-batch -l loadup/a\
-	stubify emacs\
-	stubedit emacs.exe minstack=2048k
 /^MAKE *=/s/^/# /
 /^SHELL *=/s/^/# /
 /^srcdir *=/s/@[^@\n]*@/./
@@ -124,7 +118,7 @@
 /^UNEXEC_OBJ *=/s/@UNEXEC_OBJ@/unexec.o/
 /^CANNOT_DUMP *=/s/@cannot_dump@/no/
 /^DEPFLAGS *=/s/@DEPFLAGS@//
-/^MKDEPDIR *=/s/@MKDEPDIR@/:/
+/^MKDEPDIR *=/s/@MKDEPDIR@//
 /^version *=/s/@[^@\n]*@//
 /^M_FILE *=/s!@[^@\n]*@!m/intel386.h!
 /^S_FILE *=/s!@[^@\n]*@!s/msdos.h!
@@ -132,17 +126,29 @@
 /^.\${libsrc}make-docfile.*>/s!make-docfile!make-docfile -o ../etc/DOC!
 /^.\${libsrc}make-doc/s!>.*$!!
 /^[ 	]*$/d
+/^	if test -f/,/^	fi$/c\
+	command.com /c if exist .gdbinit rm -f _gdbinit
 /^temacs:/s/prefix-args//
 /^temacs:/s/stamp-oldxmenu//
+/^	if test "\${CANNOT_DUMP}" =/,/^	else /d
+/^	fi/d
+/^	LC_ALL=C \$(RUN_TEMACS)/i\
+	stubedit temacs.exe minstack=1024k
+/^	 *LC_ALL=C.*\$(RUN_TEMACS)/s/LC_ALL=C/set &;/
+/-batch -l loadup/a\
+	stubify emacs\
+	stubedit emacs.exe minstack=2048k
+s/ || exit 1\; \\$//
+s/ || true\; \\$//
 /^RUN_TEMACS *=/s|`/bin/pwd`|.|
+/^	 *@\$(MKDEPDIR) *$/d
 /^	mv \.\/\.gdbinit/d
-/^	if test -f/c\
+/^	if test -f/,/^	fi$/c\
 	command.com /c if exist .gdbinit rm -f _gdbinit
-/^	else mv \.\/\.gdbinit/d
 /^	#/d
 /^	cd.*make-docfile/s!$!; cd ${dot}${dot}/src!
 /^	@: /d
-/^	-\{0,1\}ln -/s/ln -f/cp -pf/
+/^	-\{0,1\} *ln -/s/ln -f/cp -pf/
 /^[ 	]touch /s/touch/djecho $@ >/
 s/@YMF_PASS_LDFLAGS@/flags/
 s/@deps_frag@//
@@ -162,7 +168,7 @@
 	stubedit b-emacs.exe minstack=3072k\
 	djecho bootlisp > bootlisp
 /^	-\{0,1\}rm -f/s/\\#/#/
-/^	@\{0,1\}cd ..\/lisp; /s|$|\; cd ../src|
+/^	@\{0,1\}cd ..\/lisp;.*[^\]$/s|$|\; cd ../src|
 /^	echo.* buildobj.h/s|echo |djecho |
 
 # arch-tag: c7e3aacb-4162-460e-99f9-4252bca68d2c
--- a/src/ChangeLog	Fri Jun 25 23:19:18 2010 +0000
+++ b/src/ChangeLog	Mon Jun 28 13:32:47 2010 +0000
@@ -1,3 +1,83 @@
+2010-06-28  Jan Djärv  <jan.h.d@swipnet.se>
+
+	* xfns.c (x_default_font_parameter): Remove got_from_system
+	(Bug#6526).
+
+	* xterm.h (gtk_widget_get_window, gtk_widget_get_mapped)
+	(gtk_adjustment_get_page_size, gtk_adjustment_get_upper): New
+	defines based on what configure finds.
+
+	* xterm.c (XTflash): Use gtk_widget_get_window.
+	(xg_scroll_callback): Use gtk_adjustment_get_upper and
+	gtk_adjustment_get_page_size.
+	(handle_one_xevent): Use gtk_widget_get_mapped.
+	(x_term_init): Remove HAVE_GTK_MULTIDISPLAY and associated error
+	messages.
+
+	* xmenu.c (create_and_show_popup_menu): Call gtk_widget_get_mapped.
+
+	* gtkutil.h: Replace HAVE_GTK_FILE_BOTH with
+	HAVE_GTK_FILE_SELECTION_NEW.
+
+	* gtkutil.c (xg_display_open, xg_display_close): Remove
+	HAVE_GTK_MULTIDISPLAY, it is always defined.
+	(xg_display_open): Return type is void.
+	(gtk_widget_set_has_window)
+	(gtk_dialog_get_action_area, gtk_dialog_get_content_area)
+	(gtk_widget_get_sensitive, gtk_adjustment_set_page_size)
+	(gtk_adjustment_set_page_increment)
+	(gtk_adjustment_get_step_increment): #define these if not found
+	by configure.
+	(remove_submenu): New define based on Gtk+ version.
+	(xg_set_cursor, xg_frame_resized, xg_event_is_for_scrollbar): Use
+	gtk_widget_get_window.
+	(xg_frame_resized, xg_update_frame_menubar): Use gtk_widget_get_mapped.
+	(xg_create_frame_widgets): Use gtk_widget_set_has_window.
+	(create_dialog): Use gtk_dialog_get_action_area and
+	gtk_dialog_get_content_area.
+	(xg_uses_old_file_dialog, xg_get_file_name): Remove HAVE_GTK_FILE_BOTH
+	and HAVE_GTK_FILE_CHOOSER_DIALOG_NEW.  File chooser is always
+	available, so checking for HAVE_GTK_FILE_SELECTION_NEW is enough.
+	(xg_update_menubar, xg_update_submenu, xg_show_toolbar_item): Use
+	g_object_ref and g_object_unref.
+	(xg_update_menu_item, xg_tool_bar_menu_proxy): Use
+	gtk_widget_get_sensitive.
+	(xg_update_submenu): Use remove_submenu.
+	(xg_update_scrollbar_pos): Don't use GtkFixedChild, use child
+	properties instead to get old x and y position.
+	(xg_set_toolkit_scroll_bar_thumb): Use gtk_adjustment_get_page_size,
+	gtk_adjustment_get_step_increment, gtk_adjustment_set_page_size,
+        gtk_adjustment_set_step_increment and gtk_adjustment_set_page_increment.
+	(xg_get_tool_bar_widgets): New function.
+	(xg_tool_bar_menu_proxy, xg_show_toolbar_item)
+	(update_frame_tool_bar): Call xg_get_tool_bar_widgets.
+	(toolbar_set_orientation): New #define based on if configure
+	finds gtk_orientable_set_orientation.
+	(xg_create_tool_bar): Call toolbar_set_orientation.
+	(xg_make_tool_item, xg_show_toolbar_item): Call gtk_box_pack_start
+	instead of gtk_box_pack_start_defaults.
+
+2010-06-28  Chong Yidong  <cyd@stupidchicken.com>
+
+	* cmds.c (Fdelete_backward_char): Move into Lisp.
+
+2010-06-27  Dan Nicolaescu  <dann@ics.uci.edu>
+
+	* s/freebsd.h (BSD4_2): Remove redundant definition.
+	bsd-common.h defines it already.
+
+2010-06-27  Chong Yidong  <cyd@stupidchicken.com>
+
+	* xfns.c (Fx_create_frame): Don't consult X resouces when setting
+	menu-bar-lines and tool-bar-lines.  Use menu-bar-mode and
+	tool-bar-mode, which are now set using these X resources at
+	startup, to determine the defaults (Bug#2249).
+
+	* w32fns.c (Fx_create_frame):
+	* nsfns.m (Fx_create_frame): Likewise.
+
+	* frame.c (Vmenu_bar_mode, Vtool_bar_mode): New vars.
+
 2010-06-24  Juanma Barranquero  <lekktu@gmail.com>
 
 	* gtkutil.c (xg_update_scrollbar_pos):
--- a/src/cmds.c	Fri Jun 25 23:19:18 2010 +0000
+++ b/src/cmds.c	Mon Jun 28 13:32:47 2010 +0000
@@ -240,7 +240,9 @@
        doc: /* Delete the following N characters (previous if N is negative).
 Optional second arg KILLFLAG non-nil means kill instead (save in kill ring).
 Interactively, N is the prefix arg, and KILLFLAG is set if
-N was explicitly specified.  */)
+N was explicitly specified.
+
+The command `delete-forward' is preferable for interactive use.  */)
      (n, killflag)
      Lisp_Object n, killflag;
 {
@@ -273,60 +275,6 @@
   return Qnil;
 }
 
-DEFUN ("delete-backward-char", Fdelete_backward_char, Sdelete_backward_char,
-       1, 2, "p\nP",
-       doc: /* Delete the previous N characters (following if N is negative).
-Optional second arg KILLFLAG non-nil means kill instead (save in kill ring).
-Interactively, N is the prefix arg, and KILLFLAG is set if
-N was explicitly specified.
-This is meant for interactive use only; from Lisp, better use `delete-char'
-with a negated argument.  */)
-     (n, killflag)
-     Lisp_Object n, killflag;
-{
-  Lisp_Object value;
-  int deleted_special = 0;
-  int pos, pos_byte, i;
-
-  CHECK_NUMBER (n);
-
-  /* See if we are about to delete a tab or newline backwards.  */
-  pos = PT;
-  pos_byte = PT_BYTE;
-  for (i = 0; i < XINT (n) && pos_byte > BEGV_BYTE; i++)
-    {
-      int c;
-
-      DEC_BOTH (pos, pos_byte);
-      c = FETCH_BYTE (pos_byte);
-      if (c == '\t' || c == '\n')
-	{
-	  deleted_special = 1;
-	  break;
-	}
-    }
-
-  /* In overwrite mode, back over columns while clearing them out,
-     unless at end of line.  */
-  if (XINT (n) > 0
-      && ! NILP (current_buffer->overwrite_mode)
-      && ! deleted_special
-      && ! (PT == ZV || FETCH_BYTE (PT_BYTE) == '\n'))
-    {
-      int column = (int) current_column (); /* iftc */
-
-      value = Fdelete_char (make_number (-XINT (n)), killflag);
-      i = column - (int) current_column (); /* iftc */
-      Finsert_char (make_number (' '), make_number (i), Qnil);
-      /* Whitespace chars are ASCII chars, so we can simply subtract.  */
-      SET_PT_BOTH (PT - i, PT_BYTE - i);
-    }
-  else
-    value = Fdelete_char (make_number (-XINT (n)), killflag);
-
-  return value;
-}
-
 static int nonundocount;
 
 /* Note that there's code in command_loop_1 which typically avoids
@@ -635,8 +583,6 @@
   defsubr (&Send_of_line);
 
   defsubr (&Sdelete_char);
-  defsubr (&Sdelete_backward_char);
-
   defsubr (&Sself_insert_command);
 }
 
@@ -658,10 +604,8 @@
 
   initial_define_key (global_map, Ctl ('A'), "beginning-of-line");
   initial_define_key (global_map, Ctl ('B'), "backward-char");
-  initial_define_key (global_map, Ctl ('D'), "delete-char");
   initial_define_key (global_map, Ctl ('E'), "end-of-line");
   initial_define_key (global_map, Ctl ('F'), "forward-char");
-  initial_define_key (global_map, 0177, "delete-backward-char");
 }
 
 /* arch-tag: 022ba3cd-67f9-4978-9c5d-7d2b18d8644e
--- a/src/config.in	Fri Jun 25 23:19:18 2010 +0000
+++ b/src/config.in	Mon Jun 28 13:32:47 2010 +0000
@@ -195,9 +195,6 @@
 /* Define to 1 if using GConf. */
 #undef HAVE_GCONF
 
-/* Define to 1 if you have the `gdk_display_open' function. */
-#undef HAVE_GDK_DISPLAY_OPEN
-
 /* Define to 1 if you have the `getaddrinfo' function. */
 #undef HAVE_GETADDRINFO
 
@@ -264,14 +261,14 @@
 /* Define to 1 if you have the `grantpt' function. */
 #undef HAVE_GRANTPT
 
+/* Define to 1 if you have the `gtk_adjustment_get_page_size' function. */
+#undef HAVE_GTK_ADJUSTMENT_GET_PAGE_SIZE
+
 /* Define to 1 if you have GTK and pthread (-lpthread). */
 #undef HAVE_GTK_AND_PTHREAD
 
-/* Define to 1 if GTK has both file selection and chooser dialog. */
-#undef HAVE_GTK_FILE_BOTH
-
-/* Define to 1 if you have the `gtk_file_chooser_dialog_new' function. */
-#undef HAVE_GTK_FILE_CHOOSER_DIALOG_NEW
+/* Define to 1 if you have the `gtk_dialog_get_action_area' function. */
+#undef HAVE_GTK_DIALOG_GET_ACTION_AREA
 
 /* Define to 1 if you have the `gtk_file_selection_new' function. */
 #undef HAVE_GTK_FILE_SELECTION_NEW
@@ -279,8 +276,20 @@
 /* Define to 1 if you have the `gtk_main' function. */
 #undef HAVE_GTK_MAIN
 
-/* Define to 1 if GTK can handle more than one display. */
-#undef HAVE_GTK_MULTIDISPLAY
+/* Define to 1 if you have the `gtk_orientable_set_orientation' function. */
+#undef HAVE_GTK_ORIENTABLE_SET_ORIENTATION
+
+/* Define to 1 if you have the `gtk_widget_get_mapped' function. */
+#undef HAVE_GTK_WIDGET_GET_MAPPED
+
+/* Define to 1 if you have the `gtk_widget_get_sensitive' function. */
+#undef HAVE_GTK_WIDGET_GET_SENSITIVE
+
+/* Define to 1 if you have the `gtk_widget_get_window' function. */
+#undef HAVE_GTK_WIDGET_GET_WINDOW
+
+/* Define to 1 if you have the `gtk_widget_set_has_window' function. */
+#undef HAVE_GTK_WIDGET_SET_HAS_WINDOW
 
 /* Define to 1 if netdb.h declares h_errno. */
 #undef HAVE_H_ERRNO
--- a/src/frame.c	Fri Jun 25 23:19:18 2010 +0000
+++ b/src/frame.c	Mon Jun 28 13:32:47 2010 +0000
@@ -119,6 +119,7 @@
 Lisp_Object Qexplicit_name;
 Lisp_Object Qunsplittable;
 Lisp_Object Qmenu_bar_lines, Qtool_bar_lines;
+Lisp_Object Vmenu_bar_mode, Vtool_bar_mode;
 Lisp_Object Qleft_fringe, Qright_fringe;
 Lisp_Object Qbuffer_predicate, Qbuffer_list, Qburied_buffer_list;
 Lisp_Object Qtty_color_mode;
@@ -4648,6 +4649,14 @@
   Qdelete_frame_functions = intern_c_string ("delete-frame-functions");
   staticpro (&Qdelete_frame_functions);
 
+  DEFVAR_LISP ("menu-bar-mode", &Vmenu_bar_mode,
+               doc: /* Non-nil if Menu-Bar mode is enabled.  */);
+  Vmenu_bar_mode = Qt;
+
+  DEFVAR_LISP ("tool-bar-mode", &Vtool_bar_mode,
+               doc: /* Non-nil if Tool-Bar mode is enabled.  */);
+  Vtool_bar_mode = Qt;
+
   DEFVAR_KBOARD ("default-minibuffer-frame", Vdefault_minibuffer_frame,
 		 doc: /* Minibufferless frames use this frame's minibuffer.
 
--- a/src/gtkutil.c	Fri Jun 25 23:19:18 2010 +0000
+++ b/src/gtkutil.c	Mon Jun 28 13:32:47 2010 +0000
@@ -47,13 +47,34 @@
 /* Avoid "differ in sign" warnings */
 #define SSDATA(x)  ((char *) SDATA (x))
 
+#ifndef HAVE_GTK_WIDGET_SET_HAS_WINDOW
+#define gtk_widget_set_has_window(w, b) \
+  (gtk_fixed_set_has_window (GTK_FIXED (w), b))
+#endif
+#ifndef HAVE_GTK_DIALOG_GET_ACTION_AREA
+#define gtk_dialog_get_action_area(w) ((w)->action_area)
+#define gtk_dialog_get_content_area(w) ((w)->vbox)
+#endif
+#ifndef HAVE_GTK_WIDGET_GET_SENSITIVE
+#define gtk_widget_get_sensitive(w) (GTK_WIDGET_SENSITIVE (w))
+#endif
+#ifndef HAVE_GTK_ADJUSTMENT_GET_PAGE_SIZE
+#define gtk_adjustment_set_page_size(w, s) ((w)->page_size = (s))
+#define gtk_adjustment_set_page_increment(w, s) ((w)->page_increment = (s))
+#define gtk_adjustment_get_step_increment(w) ((w)->step_increment)
+#define gtk_adjustment_set_step_increment(w, s) ((w)->step_increment = (s))
+#endif
+#if GTK_MAJOR_VERSION > 2 || GTK_MINOR_VERSION > 11
+#define remove_submenu(w) gtk_menu_item_set_submenu ((w), NULL)
+#else
+#define remove_submenu(w) gtk_menu_item_remove_submenu ((w))
+#endif
+
 
 /***********************************************************************
                       Display handling functions
  ***********************************************************************/
 
-#ifdef HAVE_GTK_MULTIDISPLAY
-
 /* Keep track of the default display, or NULL if there is none.  Emacs
    may close all its displays.  */
 
@@ -81,20 +102,6 @@
 }
 
 
-#else /* not HAVE_GTK_MULTIDISPLAY */
-
-/* Make some defines so we can use the GTK 2.2 functions when
-   compiling with GTK 2.0.  */
-
-#define xg_set_screen(w, f)
-#define gdk_xid_table_lookup_for_display(dpy, w)    gdk_xid_table_lookup (w)
-#define gdk_pixmap_foreign_new_for_display(dpy, p)  gdk_pixmap_foreign_new (p)
-#define gdk_cursor_new_for_display(dpy, c)          gdk_cursor_new (c)
-#define gdk_x11_lookup_xdisplay(dpy)                0
-#define GdkDisplay                                  void
-
-#endif /* not HAVE_GTK_MULTIDISPLAY */
-
 /* Open a display named by DISPLAY_NAME.  The display is returned in *DPY.
    *DPY is set to NULL if the display can't be opened.
 
@@ -102,12 +109,11 @@
    be opened, and less than zero if the GTK version doesn't support
    multipe displays.  */
 
-int
+void
 xg_display_open (display_name, dpy)
      char *display_name;
      Display **dpy;
 {
-#ifdef HAVE_GTK_MULTIDISPLAY
   GdkDisplay *gdpy;
 
   gdpy = gdk_display_open (display_name);
@@ -119,12 +125,6 @@
     }
 
   *dpy = gdpy ? GDK_DISPLAY_XDISPLAY (gdpy) : NULL;
-  return gdpy != NULL;
-
-#else /* not HAVE_GTK_MULTIDISPLAY */
-
-  return -1;
-#endif /* not HAVE_GTK_MULTIDISPLAY */
 }
 
 
@@ -133,7 +133,6 @@
 void
 xg_display_close (Display *dpy)
 {
-#ifdef HAVE_GTK_MULTIDISPLAY
   GdkDisplay *gdpy = gdk_x11_lookup_xdisplay (dpy);
 
   /* If this is the default display, try to change it before closing.
@@ -165,7 +164,6 @@
   /* This seems to be fixed in GTK 2.10. */
   gdk_display_close (gdpy);
 #endif
-#endif /* HAVE_GTK_MULTIDISPLAY */
 }
 
 
@@ -397,9 +395,10 @@
      GtkWidget *w;
      GdkCursor *cursor;
 {
-  GList *children = gdk_window_peek_children (w->window);
-
-  gdk_window_set_cursor (w->window, cursor);
+  GdkWindow *window = gtk_widget_get_window(w);
+  GList *children = gdk_window_peek_children (window);
+
+  gdk_window_set_cursor (window, cursor);
 
   /* The scroll bar widget has more than one GDK window (had to look at
      the source to figure this out), and there is no way to set cursor
@@ -606,8 +605,9 @@
 
   if (pixelwidth == -1 && pixelheight == -1)
     {
-      if (FRAME_GTK_WIDGET (f) && GTK_WIDGET_MAPPED (FRAME_GTK_WIDGET (f)))
-          gdk_window_get_geometry (FRAME_GTK_WIDGET (f)->window, 0, 0,
+      if (FRAME_GTK_WIDGET (f) && gtk_widget_get_mapped (FRAME_GTK_WIDGET (f)))
+          gdk_window_get_geometry (gtk_widget_get_window (FRAME_GTK_WIDGET (f)),
+                                   0, 0,
                                    &pixelwidth, &pixelheight, 0);
       else return;
     }
@@ -802,7 +802,7 @@
   FRAME_GTK_WIDGET (f) = wfixed;
   f->output_data.x->vbox_widget = wvbox;
 
-  gtk_fixed_set_has_window (GTK_FIXED (wfixed), TRUE);
+  gtk_widget_set_has_window (wfixed, TRUE);
 
   gtk_container_add (GTK_CONTAINER (wtop), wvbox);
   gtk_box_pack_end (GTK_BOX (wvbox), wfixed, TRUE, TRUE, 0);
@@ -1093,8 +1093,9 @@
   int button_nr = 0;
   int button_spacing = 10;
   GtkWidget *wdialog = gtk_dialog_new ();
+  GtkDialog *wd = GTK_DIALOG (wdialog);
+  GtkBox *cur_box = GTK_BOX (gtk_dialog_get_action_area (wd));
   widget_value *item;
-  GtkBox *cur_box;
   GtkWidget *wvbox;
   GtkWidget *whbox_up;
   GtkWidget *whbox_down;
@@ -1109,7 +1110,6 @@
   gtk_window_set_title (GTK_WINDOW (wdialog), title);
   gtk_widget_set_name (wdialog, "emacs-dialog");
 
-  cur_box = GTK_BOX (GTK_DIALOG (wdialog)->action_area);
 
   if (make_two_rows)
     {
@@ -1141,21 +1141,18 @@
 
       if (item->name && strcmp (item->name, "message") == 0)
         {
+          GtkBox *wvbox = GTK_BOX (gtk_dialog_get_content_area (wd));
           /* This is the text part of the dialog.  */
           w = gtk_label_new (utf8_label);
-          gtk_box_pack_start (GTK_BOX (GTK_DIALOG (wdialog)->vbox),
-                              gtk_label_new (""),
-                              FALSE, FALSE, 0);
-          gtk_box_pack_start (GTK_BOX (GTK_DIALOG (wdialog)->vbox), w,
-                              TRUE, TRUE, 0);
+          gtk_box_pack_start (wvbox, gtk_label_new (""), FALSE, FALSE, 0);
+          gtk_box_pack_start (wvbox, w, TRUE, TRUE, 0);
           gtk_misc_set_alignment (GTK_MISC (w), 0.1, 0.5);
 
           /* Try to make dialog look better.  Must realize first so
              the widget can calculate the size it needs.  */
           gtk_widget_realize (w);
           gtk_widget_size_request (w, &req);
-          gtk_box_set_spacing (GTK_BOX (GTK_DIALOG (wdialog)->vbox),
-                               req.height);
+          gtk_box_set_spacing (wvbox, req.height);
 	  if (item->value && strlen (item->value) > 0)
             button_spacing = 2*req.width/strlen (item->value);
         }
@@ -1313,25 +1310,17 @@
 int
 xg_uses_old_file_dialog ()
 {
-#ifdef HAVE_GTK_FILE_BOTH
+#ifdef HAVE_GTK_FILE_SELECTION_NEW
   extern int x_gtk_use_old_file_dialog;
   return x_gtk_use_old_file_dialog;
-#else /* ! HAVE_GTK_FILE_BOTH */
-
-#ifdef HAVE_GTK_FILE_SELECTION_NEW
-  return 1;
 #else
   return 0;
 #endif
-
-#endif /* ! HAVE_GTK_FILE_BOTH */
 }
 
 
 typedef char * (*xg_get_file_func) P_ ((GtkWidget *));
 
-#ifdef HAVE_GTK_FILE_CHOOSER_DIALOG_NEW
-
 /* Return the selected file for file chooser dialog W.
    The returned string must be free:d.  */
 
@@ -1507,7 +1496,6 @@
   *func = xg_get_file_name_from_chooser;
   return filewin;
 }
-#endif /* HAVE_GTK_FILE_CHOOSER_DIALOG_NEW */
 
 #ifdef HAVE_GTK_FILE_SELECTION_NEW
 
@@ -1595,7 +1583,7 @@
   sigblock (sigmask (__SIGRTMIN));
 #endif /* HAVE_GTK_AND_PTHREAD */
 
-#ifdef HAVE_GTK_FILE_BOTH
+#ifdef HAVE_GTK_FILE_SELECTION_NEW
 
   if (xg_uses_old_file_dialog ())
     w = xg_get_file_with_selection (f, prompt, default_filename,
@@ -1604,18 +1592,10 @@
     w = xg_get_file_with_chooser (f, prompt, default_filename,
                                   mustmatch_p, only_dir_p, &func);
 
-#else /* not HAVE_GTK_FILE_BOTH */
-
-#ifdef HAVE_GTK_FILE_SELECTION_NEW
-  w = xg_get_file_with_selection (f, prompt, default_filename,
-                                  mustmatch_p, only_dir_p, &func);
-#endif
-#ifdef HAVE_GTK_FILE_CHOOSER_DIALOG_NEW
+#else /* not HAVE_GTK_FILE_SELECTION_NEW */
   w = xg_get_file_with_chooser (f, prompt, default_filename,
                                 mustmatch_p, only_dir_p, &func);
-#endif
-
-#endif /* HAVE_GTK_FILE_BOTH */
+#endif /* not HAVE_GTK_FILE_SELECTION_NEW */
 
   gtk_widget_set_name (w, "emacs-filedialog");
 
@@ -2473,7 +2453,7 @@
                 New:      A C
               Remove B.  */
 
-          gtk_widget_ref (GTK_WIDGET (witem));
+          g_object_ref (G_OBJECT (witem));
           gtk_container_remove (GTK_CONTAINER (menubar), GTK_WIDGET (witem));
           gtk_widget_destroy (GTK_WIDGET (witem));
 
@@ -2555,11 +2535,11 @@
                 New:      A C B
               Move C before B  */
 
-          gtk_widget_ref (GTK_WIDGET (witem2));
+          g_object_ref (G_OBJECT (witem2));
           gtk_container_remove (GTK_CONTAINER (menubar), GTK_WIDGET (witem2));
           gtk_menu_shell_insert (GTK_MENU_SHELL (menubar),
                                  GTK_WIDGET (witem2), pos);
-          gtk_widget_unref (GTK_WIDGET (witem2));
+          g_object_unref (G_OBJECT (witem2));
 
           g_list_free (*list);
           *list = iter = gtk_container_get_children (GTK_CONTAINER (menubar));
@@ -2613,9 +2593,10 @@
       if (! utf8_key)
         {
           /* Remove the key and keep just the label.  */
-          gtk_widget_ref (GTK_WIDGET (wlbl));
+          g_object_ref (G_OBJECT (wlbl));
           gtk_container_remove (GTK_CONTAINER (w), wchild);
           gtk_container_add (GTK_CONTAINER (w), GTK_WIDGET (wlbl));
+          g_object_unref (G_OBJECT (wlbl));
           wkey = 0;
         }
 
@@ -2652,9 +2633,9 @@
   if (utf8_key && utf8_key != val->key) g_free (utf8_key);
   if (utf8_label && utf8_label != val->name) g_free (utf8_label);
 
-  if (! val->enabled && GTK_WIDGET_SENSITIVE (w))
+  if (! val->enabled && gtk_widget_get_sensitive (w))
     gtk_widget_set_sensitive (w, FALSE);
-  else if (val->enabled && ! GTK_WIDGET_SENSITIVE (w))
+  else if (val->enabled && ! gtk_widget_get_sensitive (w))
     gtk_widget_set_sensitive (w, TRUE);
 
   cb_data = (xg_menu_item_cb_data*) g_object_get_data (G_OBJECT (w),
@@ -2793,8 +2774,8 @@
         if (sub && ! cur->contents)
           {
             /* Not a submenu anymore.  */
-            gtk_widget_ref (sub);
-            gtk_menu_item_remove_submenu (witem);
+            g_object_ref (G_OBJECT (sub));
+            remove_submenu (witem);
             gtk_widget_destroy (sub);
           }
         else if (cur->contents)
@@ -2940,7 +2921,7 @@
   struct x_output *x = f->output_data.x;
   GtkRequisition req;
 
-  if (!x->menubar_widget || GTK_WIDGET_MAPPED (x->menubar_widget))
+  if (!x->menubar_widget || gtk_widget_get_mapped (x->menubar_widget))
     return 0;
 
   if (x->menubar_widget && gtk_widget_get_parent (x->menubar_widget))
@@ -3212,24 +3193,16 @@
     {
       GtkWidget *wfixed = f->output_data.x->edit_widget;
       GtkWidget *wparent = gtk_widget_get_parent (wscroll);
-      GtkFixed *wf = GTK_FIXED (wfixed);
       gint msl;
 
       /* Clear out old position.  */
-      GList *iter;
       int oldx = -1, oldy = -1, oldw, oldh;
-      for (iter = wf->children; iter; iter = iter->next)
-        if (((GtkFixedChild *)iter->data)->widget == wparent)
-          {
-            GtkFixedChild *ch = (GtkFixedChild *)iter->data;
-            if (ch->x != left || ch->y != top)
-              {
-                oldx = ch->x;
-                oldy = ch->y;
-                gtk_widget_get_size_request (wscroll, &oldw, &oldh);
-              }
-            break;
-          }
+      if (gtk_widget_get_parent (wparent) == wfixed)
+        {
+          gtk_container_child_get (GTK_CONTAINER (wfixed), wparent,
+                                   "x", &oldx, "y", &oldy, NULL);
+          gtk_widget_get_size_request (wscroll, &oldw, &oldh);
+        }
 
       /* Move and resize to new values.  */
       gtk_fixed_move (GTK_FIXED (wfixed), wparent, left, top);
@@ -3318,13 +3291,13 @@
       /* Assume all lines are of equal size.  */
       new_step = size / max (1, FRAME_LINES (f));
 
-      if ((int) adj->page_size != size
-          || (int) adj->step_increment != new_step)
+      if ((int) gtk_adjustment_get_page_size (adj) != size
+          || (int) gtk_adjustment_get_step_increment (adj) != new_step)
         {
-          adj->page_size = size;
-          adj->step_increment = new_step;
+          gtk_adjustment_set_page_size (adj, size);
+          gtk_adjustment_set_step_increment (adj, new_step);
           /* Assume a page increment is about 95% of the page size  */
-          adj->page_increment = (int) (0.95*adj->page_size);
+          gtk_adjustment_set_page_increment (adj,(int) (0.95*size));
           changed = 1;
         }
 
@@ -3367,7 +3340,7 @@
       /* Check if press occurred outside the edit widget.  */
       GdkDisplay *gdpy = gdk_x11_lookup_xdisplay (FRAME_X_DISPLAY (f));
       retval = gdk_display_get_window_at_pointer (gdpy, NULL, NULL)
-        != f->output_data.x->edit_widget->window;
+        != gtk_widget_get_window (f->output_data.x->edit_widget);
     }
   else if (f
            && ((event->type == ButtonRelease && event->xbutton.button < 4)
@@ -3512,6 +3485,17 @@
   return xg_tool_bar_help_callback (wbutton, event, client_data);
 }
 
+static GtkWidget *
+xg_get_tool_bar_widgets (GtkWidget *vb, GtkWidget **wimage)
+{
+  GList *clist = gtk_container_get_children (GTK_CONTAINER (vb));
+  GtkWidget *c1 = (GtkWidget *) clist->data;
+  GtkWidget *c2 = (GtkWidget *) clist->next->data;
+  *wimage = GTK_IS_IMAGE (c1) ? c1 : c2;
+  g_list_free (clist);
+  return GTK_IS_LABEL (c1) ? c1 : c2;
+}
+
 
 /* This callback is called when a tool item should create a proxy item,
    such as for the overflow menu.  Also called when the tool bar is detached.
@@ -3525,18 +3509,15 @@
 {
   GtkWidget *weventbox = gtk_bin_get_child (GTK_BIN (toolitem));
   GtkButton *wbutton = GTK_BUTTON (gtk_bin_get_child (GTK_BIN (weventbox)));
-  GtkBox *vb = GTK_BOX (gtk_bin_get_child (GTK_BIN (wbutton)));
-  GtkBoxChild *c1 = (GtkBoxChild *) vb->children->data;
-  GtkBoxChild *c2 = (GtkBoxChild *) vb->children->next->data;
-  GtkImage *wimage = GTK_IS_IMAGE (c1->widget)
-    ? GTK_IMAGE (c1->widget) : GTK_IMAGE (c2->widget);
-  GtkLabel *wlbl = GTK_IS_LABEL (c1->widget)
-    ? GTK_LABEL (c1->widget) : GTK_LABEL (c2->widget);
+  GtkWidget *vb = gtk_bin_get_child (GTK_BIN (wbutton));
+  GtkWidget *c1;
+  GtkLabel *wlbl = GTK_LABEL (xg_get_tool_bar_widgets (vb, &c1));
+  GtkImage *wimage = GTK_IMAGE (c1);
   GtkWidget *wmenuitem = gtk_image_menu_item_new_with_label
     (gtk_label_get_text (wlbl));
-
   GtkWidget *wmenuimage;
 
+
   if (gtk_button_get_use_stock (wbutton))
     wmenuimage = gtk_image_new_from_stock (gtk_button_get_label (wbutton),
                                            GTK_ICON_SIZE_MENU);
@@ -3607,7 +3588,8 @@
   g_object_set_data (G_OBJECT (wmenuitem), XG_TOOL_BAR_PROXY_BUTTON,
                      (gpointer) wbutton);
   gtk_tool_item_set_proxy_menu_item (toolitem, "Emacs toolbar item", wmenuitem);
-  gtk_widget_set_sensitive (wmenuitem, GTK_WIDGET_SENSITIVE (wbutton));
+  gtk_widget_set_sensitive (wmenuitem,
+                            gtk_widget_get_sensitive (GTK_WIDGET (wbutton)));
 
   /* Use enter/leave notify to show help.  We use the events
      rather than the GtkButton specific signals "enter" and
@@ -3786,6 +3768,13 @@
 }
 
 /* Create a tool bar for frame F.  */
+#ifdef HAVE_GTK_ORIENTABLE_SET_ORIENTATION
+#define toolbar_set_orientation(w, o) \
+  gtk_orientable_set_orientation (GTK_ORIENTABLE (w), o)
+#else
+#define toolbar_set_orientation(w, o) \
+  gtk_toolbar_set_orientation (GTK_TOOLBAR (w), o)
+#endif
 
 static void
 xg_create_tool_bar (f)
@@ -3799,7 +3788,7 @@
   gtk_widget_set_name (x->toolbar_widget, "emacs-toolbar");
 
   gtk_toolbar_set_style (GTK_TOOLBAR (x->toolbar_widget), GTK_TOOLBAR_ICONS);
-  gtk_toolbar_set_orientation (GTK_TOOLBAR (x->toolbar_widget),
+  toolbar_set_orientation (x->toolbar_widget,
                                GTK_ORIENTATION_HORIZONTAL);
 }
 
@@ -3854,9 +3843,9 @@
   GtkWidget *weventbox = gtk_event_box_new ();
 
   if (wimage)
-    gtk_box_pack_start_defaults (GTK_BOX (vb), wimage);
-
-  gtk_box_pack_start_defaults (GTK_BOX (vb), gtk_label_new (label));
+    gtk_box_pack_start (GTK_BOX (vb), wimage, TRUE, TRUE, 0);
+
+  gtk_box_pack_start (GTK_BOX (vb), gtk_label_new (label), TRUE, TRUE, 0);
   gtk_button_set_focus_on_click (GTK_BUTTON (wb), FALSE);
   gtk_button_set_relief (GTK_BUTTON (wb), GTK_RELIEF_NONE);
   gtk_container_add (GTK_CONTAINER (wb), vb);
@@ -3926,13 +3915,9 @@
 
   GtkWidget *weventbox = gtk_bin_get_child (GTK_BIN (ti));
   GtkWidget *wbutton = gtk_bin_get_child (GTK_BIN (weventbox));
-  GtkBox *vb = GTK_BOX (gtk_bin_get_child (GTK_BIN (wbutton)));
-  GtkBoxChild *c1 = (GtkBoxChild *) vb->children->data;
-  GtkBoxChild *c2 = (GtkBoxChild *) vb->children->next->data;
-  GtkWidget *wimage = GTK_IS_IMAGE (c1->widget)
-    ? c1->widget : c2->widget;
-  GtkWidget *wlbl = GTK_IS_LABEL (c1->widget)
-    ? c1->widget : c2->widget;
+  GtkWidget *vb = gtk_bin_get_child (GTK_BIN (wbutton));
+  GtkWidget *wimage;
+  GtkWidget *wlbl = xg_get_tool_bar_widgets (vb, &wimage);
   GtkWidget *new_box = NULL;
 
   if (GTK_IS_VBOX (vb) && horiz)
@@ -3941,17 +3926,17 @@
     new_box = gtk_vbox_new (FALSE, 0);
   if (new_box)
     {
-      gtk_widget_ref (wimage);
-      gtk_widget_ref (wlbl);
+      g_object_ref (G_OBJECT (wimage));
+      g_object_ref (G_OBJECT (wlbl));
       gtk_container_remove (GTK_CONTAINER (vb), wimage);
       gtk_container_remove (GTK_CONTAINER (vb), wlbl);
       gtk_widget_destroy (GTK_WIDGET (vb));
-      gtk_box_pack_start_defaults (GTK_BOX (new_box), wimage);
-      gtk_box_pack_start_defaults (GTK_BOX (new_box), wlbl);
+      gtk_box_pack_start (GTK_BOX (new_box), wimage, TRUE, TRUE, 0);
+      gtk_box_pack_start (GTK_BOX (new_box), wlbl, TRUE, TRUE, 0);
       gtk_container_add (GTK_CONTAINER (wbutton), new_box);
-      gtk_widget_unref (wimage);
-      gtk_widget_unref (wlbl);
-      vb = GTK_BOX (new_box);
+      g_object_unref (G_OBJECT (wimage));
+      g_object_unref (G_OBJECT (wlbl));
+      vb = new_box;
     }
 
   if (show_label) gtk_widget_show (wlbl);
@@ -4167,13 +4152,9 @@
         }
       else
         {
-          GtkBox *vb = GTK_BOX (gtk_bin_get_child (GTK_BIN (wbutton)));
-          GtkBoxChild *c1 = (GtkBoxChild *) vb->children->data;
-          GtkBoxChild *c2 = (GtkBoxChild *) vb->children->next->data;
-          GtkWidget *wimage = GTK_IS_IMAGE (c1->widget)
-            ? c1->widget : c2->widget;
-          GtkWidget *wlbl = GTK_IS_LABEL (c1->widget)
-            ? c1->widget : c2->widget;
+          GtkWidget *vb = gtk_bin_get_child (GTK_BIN (wbutton));
+          GtkWidget *wimage;
+          GtkWidget *wlbl = xg_get_tool_bar_widgets (vb, &wimage);
 
           Pixmap old_img = (Pixmap)g_object_get_data (G_OBJECT (wimage),
                                                       XG_TOOL_BAR_IMAGE_DATA);
--- a/src/gtkutil.h	Fri Jun 25 23:19:18 2010 +0000
+++ b/src/gtkutil.h	Mon Jun 28 13:32:47 2010 +0000
@@ -38,7 +38,6 @@
 /* Key for data that menu items hold.  */
 #define XG_ITEM_DATA "emacs_menuitem"
 
-
 /* Button types in menus.  */
 enum button_type
 {
@@ -119,7 +118,7 @@
   struct _widget_value *free_list;
 } widget_value;
 
-#ifdef HAVE_GTK_FILE_BOTH
+#ifdef HAVE_GTK_FILE_SELECTION_NEW
 extern int use_old_gtk_file_dialog;
 #endif
 
@@ -187,7 +186,7 @@
 extern void xg_frame_set_char_size P_ ((FRAME_PTR f, int cols, int rows));
 extern GtkWidget * xg_win_to_widget P_ ((Display *dpy, Window wdesc));
 
-extern int xg_display_open P_ ((char *display_name, Display **dpy));
+extern void xg_display_open P_ ((char *display_name, Display **dpy));
 extern void xg_display_close P_ ((Display *dpy));
 extern GdkCursor * xg_create_default_cursor P_ ((Display *dpy));
 
--- a/src/nsfns.m	Fri Jun 25 23:19:18 2010 +0000
+++ b/src/nsfns.m	Mon Jun 28 13:32:47 2010 +0000
@@ -1234,10 +1234,18 @@
 
   init_frame_faces (f);
 
-  x_default_parameter (f, parms, Qmenu_bar_lines, make_number (0), "menuBar",
-                      "menuBar", RES_TYPE_NUMBER);
-  x_default_parameter (f, parms, Qtool_bar_lines, make_number (0), "toolBar",
-                      "toolBar", RES_TYPE_NUMBER);
+  /* The X resources controlling the menu-bar and tool-bar are
+     processed specially at startup, and reflected in the mode
+     variables; ignore them here.  */
+  x_default_parameter (f, parms, Qmenu_bar_lines,
+		       NILP (Vmenu_bar_mode)
+		       ? make_number (0) : make_number (1),
+		       NULL, NULL, RES_TYPE_NUMBER);
+  x_default_parameter (f, parms, Qtool_bar_lines,
+		       NILP (Vtool_bar_mode)
+		       ? make_number (0) : make_number (1),
+		       NULL, NULL, RES_TYPE_NUMBER);
+
   x_default_parameter (f, parms, Qbuffer_predicate, Qnil, "bufferPredicate",
                        "BufferPredicate", RES_TYPE_SYMBOL);
   x_default_parameter (f, parms, Qtitle, Qnil, "title", "Title",
--- a/src/s/freebsd.h	Fri Jun 25 23:19:18 2010 +0000
+++ b/src/s/freebsd.h	Mon Jun 28 13:32:47 2010 +0000
@@ -25,9 +25,6 @@
 /* Get most of the stuff from bsd-common */
 #include "bsd-common.h"
 
-/* For mem-limits.h. */
-#define BSD4_2
-
 #define PENDING_OUTPUT_COUNT(FILE) ((FILE)->_p - (FILE)->_bf._base)
 
 #define HAVE_GETLOADAVG 1
--- a/src/w32fns.c	Fri Jun 25 23:19:18 2010 +0000
+++ b/src/w32fns.c	Mon Jun 28 13:32:47 2010 +0000
@@ -290,6 +290,7 @@
 
 /* The below are defined in frame.c.  */
 
+extern Lisp_Object Vmenu_bar_mode, Vtool_bar_mode;
 extern Lisp_Object Vwindow_system_version;
 
 #ifdef GLYPH_DEBUG
@@ -4462,10 +4463,17 @@
      happen.  */
   init_frame_faces (f);
 
-  x_default_parameter (f, parameters, Qmenu_bar_lines, make_number (1),
-		       "menuBar", "MenuBar", RES_TYPE_NUMBER);
-  x_default_parameter (f, parameters, Qtool_bar_lines, make_number (1),
-                       "toolBar", "ToolBar", RES_TYPE_NUMBER);
+  /* The X resources controlling the menu-bar and tool-bar are
+     processed specially at startup, and reflected in the mode
+     variables; ignore them here.  */
+  x_default_parameter (f, parameters, Qmenu_bar_lines,
+		       NILP (Vmenu_bar_mode)
+		       ? make_number (0) : make_number (1),
+		       NULL, NULL, RES_TYPE_NUMBER);
+  x_default_parameter (f, parameters, Qtool_bar_lines,
+		       NILP (Vtool_bar_mode)
+		       ? make_number (0) : make_number (1),
+		       NULL, NULL, RES_TYPE_NUMBER);
 
   x_default_parameter (f, parameters, Qbuffer_predicate, Qnil,
 		       "bufferPredicate", "BufferPredicate", RES_TYPE_SYMBOL);
--- a/src/xfns.c	Fri Jun 25 23:19:18 2010 +0000
+++ b/src/xfns.c	Mon Jun 28 13:32:47 2010 +0000
@@ -204,6 +204,8 @@
 
 /* The below are defined in frame.c.  */
 
+extern Lisp_Object Vmenu_bar_mode, Vtool_bar_mode;
+
 #if GLYPH_DEBUG
 int image_cache_refcount, dpyinfo_refcount;
 #endif
@@ -3065,13 +3067,12 @@
   Lisp_Object font_param = x_get_arg (dpyinfo, parms, Qfont, NULL, NULL,
                                       RES_TYPE_STRING);
   Lisp_Object font = Qnil;
-  int got_from_system = 0;
   if (EQ (font_param, Qunbound))
     font_param = Qnil;
 
   if (NILP (font_param))
     {
-      /* System font takes precedendce over X resources.  We must suggest this
+      /* System font should take precedendce over X resources.  We suggest this
          regardless of font-use-system-font because .emacs may not have been
          read yet.  */
       const char *system_font = xsettings_get_system_font ();
@@ -3079,7 +3080,6 @@
         {
           char *name = xstrdup (system_font);
           font = font_open_by_name (f, name);
-          got_from_system = ! NILP (font);
           free (name);
         }
     }
@@ -3125,10 +3125,8 @@
       x_set_frame_parameters (f, Fcons (Fcons (Qfont_param, font_param), Qnil));
     }
 
-  x_default_parameter (f, parms, Qfont, font,
-                       got_from_system ? NULL : "font",
-                       got_from_system ? NULL : "Font",
-                       RES_TYPE_STRING);
+  /* This call will make X resources override any system font setting.  */
+  x_default_parameter (f, parms, Qfont, font, "font", "Font", RES_TYPE_STRING);
 }
 
 
@@ -3450,10 +3448,18 @@
      happen.  */
   init_frame_faces (f);
 
-  x_default_parameter (f, parms, Qmenu_bar_lines, make_number (1),
-		       "menuBar", "MenuBar", RES_TYPE_BOOLEAN_NUMBER);
-  x_default_parameter (f, parms, Qtool_bar_lines, make_number (1),
-		       "toolBar", "ToolBar", RES_TYPE_NUMBER);
+  /* The X resources controlling the menu-bar and tool-bar are
+     processed specially at startup, and reflected in the mode
+     variables; ignore them here.  */
+  x_default_parameter (f, parms, Qmenu_bar_lines,
+		       NILP (Vmenu_bar_mode)
+		       ? make_number (0) : make_number (1),
+		       NULL, NULL, RES_TYPE_NUMBER);
+  x_default_parameter (f, parms, Qtool_bar_lines,
+		       NILP (Vtool_bar_mode)
+		       ? make_number (0) : make_number (1),
+		       NULL, NULL, RES_TYPE_NUMBER);
+
   x_default_parameter (f, parms, Qbuffer_predicate, Qnil,
 		       "bufferPredicate", "BufferPredicate",
 		       RES_TYPE_SYMBOL);
--- a/src/xmenu.c	Fri Jun 25 23:19:18 2010 +0000
+++ b/src/xmenu.c	Mon Jun 28 13:32:47 2010 +0000
@@ -1565,7 +1565,7 @@
 
   record_unwind_protect (pop_down_menu, make_save_value (menu, 0));
 
-  if (GTK_WIDGET_MAPPED (menu))
+  if (gtk_widget_get_mapped (menu))
     {
       /* Set this to one.  popup_widget_loop increases it by one, so it becomes
          two.  show_help_echo uses this to detect popup menus.  */
--- a/src/xterm.c	Fri Jun 25 23:19:18 2010 +0000
+++ b/src/xterm.c	Mon Jun 28 13:32:47 2010 +0000
@@ -3017,18 +3017,16 @@
 #ifdef USE_GTK
     /* Use Gdk routines to draw.  This way, we won't draw over scroll bars
        when the scroll bars and the edit widget share the same X window.  */
+    GdkWindow *window = gtk_widget_get_window (FRAME_GTK_WIDGET (f));
     GdkGCValues vals;
     GdkGC *gc;
     vals.foreground.pixel = (FRAME_FOREGROUND_PIXEL (f)
                              ^ FRAME_BACKGROUND_PIXEL (f));
     vals.function = GDK_XOR;
-    gc = gdk_gc_new_with_values (FRAME_GTK_WIDGET (f)->window,
-                                 &vals,
-                                 GDK_GC_FUNCTION
-                                 | GDK_GC_FOREGROUND);
+    gc = gdk_gc_new_with_values (window,
+                                 &vals, GDK_GC_FUNCTION | GDK_GC_FOREGROUND);
 #define XFillRectangle(d, win, gc, x, y, w, h) \
-    gdk_draw_rectangle (FRAME_GTK_WIDGET (f)->window, \
-                        gc, TRUE, x, y, w, h)
+    gdk_draw_rectangle (window, gc, TRUE, x, y, w, h)
 #else
     GC gc;
 
@@ -4428,7 +4426,8 @@
           && FRAME_X_DISPLAY_INFO (f)->grabbed < (1 << 4))
         {
           part = scroll_bar_handle;
-          whole = adj->upper - adj->page_size;
+          whole = gtk_adjustment_get_upper (adj) -
+            gtk_adjustment_get_page_size (adj);
           portion = min ((int)position, whole);
           bar->dragging = make_number ((int)portion);
         }
@@ -6845,7 +6844,7 @@
           /* GTK creates windows but doesn't map them.
              Only get real positions when mapped. */
           if (FRAME_GTK_OUTER_WIDGET (f)
-              && GTK_WIDGET_MAPPED (FRAME_GTK_OUTER_WIDGET (f)))
+              && gtk_widget_get_mapped (FRAME_GTK_OUTER_WIDGET (f)))
 #endif
             {
 	      x_real_positions (f, &f->left_pos, &f->top_pos);
@@ -10109,20 +10108,10 @@
     char *argv[NUM_ARGV];
     char **argv2 = argv;
     guint id;
-#ifndef HAVE_GTK_MULTIDISPLAY
-    if (!EQ (Vinitial_window_system, Qx))
-      error ("Sorry, you cannot connect to X servers with the GTK toolkit");
-#endif
 
     if (x_initialized++ > 1)
       {
-#ifdef HAVE_GTK_MULTIDISPLAY
-        /* Opening another display.  If xg_display_open returns less
-           than zero, we are probably on GTK 2.0, which can only handle
-           one display.  GTK 2.2 or later can handle more than one.  */
-        if (xg_display_open (SDATA (display_name), &dpy) < 0)
-#endif
-          error ("Sorry, this version of GTK can only handle one display");
+        xg_display_open (SDATA (display_name), &dpy);
       }
     else
       {
--- a/src/xterm.h	Fri Jun 25 23:19:18 2010 +0000
+++ b/src/xterm.h	Mon Jun 28 13:32:47 2010 +0000
@@ -661,8 +661,22 @@
                                FRAME_X_WINDOW (f))
 #else
 #ifdef USE_GTK
+/* Functions not present in older Gtk+ */
+
+#ifndef HAVE_GTK_WIDGET_GET_WINDOW
+#define gtk_widget_get_window(w) ((w)->window)
+#endif
+#ifndef HAVE_GTK_WIDGET_GET_MAPPED
+#define gtk_widget_get_mapped(w) (GTK_WIDGET_MAPPED (w))
+#endif
+#ifndef HAVE_GTK_ADJUSTMENT_GET_PAGE_SIZE
+#define gtk_adjustment_get_page_size(w) ((w)->page_size)
+#define gtk_adjustment_get_upper(w) ((w)->upper)
+#endif
+
 #define GTK_WIDGET_TO_X_WIN(w) \
-  ((w) && (w)->window ? GDK_WINDOW_XWINDOW ((w)->window) : 0)
+  ((w) && gtk_widget_get_window (w) \
+   ? GDK_WINDOW_XWINDOW (gtk_widget_get_window (w)) : 0)
 
 #define FRAME_GTK_OUTER_WIDGET(f) ((f)->output_data.x->widget)
 #define FRAME_GTK_WIDGET(f) ((f)->output_data.x->edit_widget)