From 0afb4571a7b54dc7693e605f7ec8a0a3a9251b4d Mon Sep 17 00:00:00 2001 From: Jan D Date: Tue, 8 Mar 2011 09:34:55 +0100 Subject: [PATCH] Updates for compiling with Gtk+ 3.0 (--with-x-toolkit=gtk3). * configure.in: Require 3.0 for --with-gtk3. Add HAVE_GTK3. * doc/emacs/xresources.texi (GTK resources): ~/.emacs.d/gtkrc does not work for Gtk+ 3. * src/gtkutil.c: Include gtkx.h if HAVE_GTK3. If ! HAVE_GTK3, define gdk_window_get_screen, gdk_window_get_geometry, gdk_x11_window_lookup_for_display and GDK_KEY_g. (xg_set_screen): Use DEFAULT_GDK_DISPLAY. (xg_get_pixbuf_from_pixmap): New function. (xg_get_pixbuf_from_pix_and_mask): Change parameters from GdkPixmap to Pixmap, take frame as parameter, remove GdkColormap parameter. Call xg_get_pixbuf_from_pixmap instead of gdk_pixbuf_get_from_drawable. (xg_get_image_for_pixmap): Do not make GdkPixmaps, call xg_get_pixbuf_from_pix_and_mask with Pixmap parameters instead. (xg_check_special_colors): Use GtkStyleContext and its functions for HAVE_GTK3. (xg_prepare_tooltip, xg_hide_tooltip): Call gdk_window_get_screen. (xg_prepare_tooltip, create_dialog, menubar_map_cb) (xg_update_frame_menubar, xg_tool_bar_detach_callback) (xg_tool_bar_attach_callback, xg_update_tool_bar_sizes): Call gtk_widget_get_preferred_size. (xg_frame_resized): gdk_window_get_geometry only takes 5 parameters. (xg_win_to_widget, xg_event_is_for_menubar): Call gdk_x11_window_lookup_for_display. (xg_set_widget_bg): New function. (delete_cb): New function. (xg_create_frame_widgets): connect delete-event to delete_cb. Call xg_set_widget_bg. Only set backgrund pixmap for ! HAVE_GTK3 (xg_set_background_color): Call xg_set_widget_bg. (xg_set_frame_icon): Call xg_get_pixbuf_from_pix_and_mask. (xg_create_scroll_bar): vadj is a GtkAdjustment for HAVE_GTK3. Only call gtk_range_set_update_policy if ! HAVE_GTK3. (xg_make_tool_item): Only connect xg_tool_bar_item_expose_callback if ! HAVE_GTK3. (update_frame_tool_bar): Call gtk_widget_hide. (xg_initialize): Use GDK_KEY_g. * src/xmenu.c (menu_position_func): Call gtk_widget_get_preferred_size. * src/xsmfns.c (gdk_set_sm_client_id): Define to gdk_set_sm_client_id if ! HAVE_GTK3 (x_session_initialize): Call gdk_x11_set_sm_client_id. * src/xterm.c (XFillRectangle): Use cairo routines for HAVE_GTK3. (x_term_init): Disable Xinput(2) with GDK_CORE_DEVICE_EVENTS. Load ~/emacs.d/gtkrc only for ! HAVE_GTK3. * src/xterm.h (DEFAULT_GDK_DISPLAY): New define. (GDK_WINDOW_XID, gtk_widget_get_preferred_size): New defines for ! HAVE_GTK3. (GTK_WIDGET_TO_X_WIN): Use GDK_WINDOW_XID. --- ChangeLog | 4 + aclocal.m4 | 4 +- configure | 491 ++++++++++++++++++++++------------------------ configure.in | 5 +- doc/emacs/ChangeLog | 5 + doc/emacs/xresources.texi | 7 +- src/ChangeLog | 52 +++++ src/config.in | 3 + src/gtkutil.c | 267 ++++++++++++++++--------- src/xmenu.c | 2 +- src/xsmfns.c | 6 +- src/xterm.c | 29 ++- src/xterm.h | 13 +- 13 files changed, 534 insertions(+), 354 deletions(-) diff --git a/ChangeLog b/ChangeLog index 949862248bd..022eb468965 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2011-03-08 Jan Djärv + + * configure.in: Require 3.0 for --with-gtk3. Add HAVE_GTK3. + 2011-03-06 Glenn Morris * configure.in (FREETYPE_LIBS): Actually set it to something. diff --git a/aclocal.m4 b/aclocal.m4 index 9fdc8e76c49..963faafb453 100644 --- a/aclocal.m4 +++ b/aclocal.m4 @@ -13,8 +13,8 @@ m4_ifndef([AC_AUTOCONF_VERSION], [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl -m4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.67],, -[m4_warning([this file was generated for autoconf 2.67. +m4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.65],, +[m4_warning([this file was generated for autoconf 2.65. You have another version of autoconf. It may work, but is not guaranteed to. If you have problems, you may need to regenerate the build system entirely. To do so, use the procedure documented by the package, typically `autoreconf'.])]) diff --git a/configure b/configure index b8a83e66779..efe9a55f988 100755 --- a/configure +++ b/configure @@ -1,11 +1,11 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.67 for emacs 24.0.50. +# Generated by GNU Autoconf 2.65 for emacs 24.0.50. # # # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, -# 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 Free Software -# Foundation, Inc. +# 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation, +# Inc. # # # This configure script is free software; the Free Software Foundation @@ -316,7 +316,7 @@ $as_echo X"$as_dir" | test -d "$as_dir" && break done test -z "$as_dirs" || eval "mkdir $as_dirs" - } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir" + } || test -d "$as_dir" || as_fn_error "cannot create directory $as_dir" } # as_fn_mkdir_p @@ -356,19 +356,19 @@ else fi # as_fn_arith -# as_fn_error STATUS ERROR [LINENO LOG_FD] -# ---------------------------------------- +# as_fn_error ERROR [LINENO LOG_FD] +# --------------------------------- # Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are # provided, also output the error to LOG_FD, referencing LINENO. Then exit the -# script with STATUS, using 1 if that was 0. +# script with status $?, using 1 if that was 0. as_fn_error () { - as_status=$1; test $as_status -eq 0 && as_status=1 - if test "$4"; then - as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - $as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4 + as_status=$?; test $as_status -eq 0 && as_status=1 + if test "$3"; then + as_lineno=${as_lineno-"$2"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + $as_echo "$as_me:${as_lineno-$LINENO}: error: $1" >&$3 fi - $as_echo "$as_me: error: $2" >&2 + $as_echo "$as_me: error: $1" >&2 as_fn_exit $as_status } # as_fn_error @@ -530,7 +530,7 @@ test -n "$DJDIR" || exec 7<&0 &1 # Name of the host. -# hostname on some systems (SVR3.2, old GNU/Linux) returns a bogus exit status, +# hostname on some systems (SVR3.2, Linux) returns a bogus exit status, # so uname gets run too. ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q` @@ -1220,9 +1220,8 @@ do fi case $ac_option in - *=?*) ac_optarg=`expr "X$ac_option" : '[^=]*=\(.*\)'` ;; - *=) ac_optarg= ;; - *) ac_optarg=yes ;; + *=*) ac_optarg=`expr "X$ac_option" : '[^=]*=\(.*\)'` ;; + *) ac_optarg=yes ;; esac # Accept the important Cygnus configure options, so we can diagnose typos. @@ -1267,7 +1266,7 @@ do ac_useropt=`expr "x$ac_option" : 'x-*disable-\(.*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && - as_fn_error $? "invalid feature name: $ac_useropt" + as_fn_error "invalid feature name: $ac_useropt" ac_useropt_orig=$ac_useropt ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in @@ -1293,7 +1292,7 @@ do ac_useropt=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && - as_fn_error $? "invalid feature name: $ac_useropt" + as_fn_error "invalid feature name: $ac_useropt" ac_useropt_orig=$ac_useropt ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in @@ -1497,7 +1496,7 @@ do ac_useropt=`expr "x$ac_option" : 'x-*with-\([^=]*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && - as_fn_error $? "invalid package name: $ac_useropt" + as_fn_error "invalid package name: $ac_useropt" ac_useropt_orig=$ac_useropt ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in @@ -1513,7 +1512,7 @@ do ac_useropt=`expr "x$ac_option" : 'x-*without-\(.*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && - as_fn_error $? "invalid package name: $ac_useropt" + as_fn_error "invalid package name: $ac_useropt" ac_useropt_orig=$ac_useropt ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in @@ -1543,8 +1542,8 @@ do | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*) x_libraries=$ac_optarg ;; - -*) as_fn_error $? "unrecognized option: \`$ac_option' -Try \`$0 --help' for more information" + -*) as_fn_error "unrecognized option: \`$ac_option' +Try \`$0 --help' for more information." ;; *=*) @@ -1552,7 +1551,7 @@ Try \`$0 --help' for more information" # Reject names that are not valid shell variable names. case $ac_envvar in #( '' | [0-9]* | *[!_$as_cr_alnum]* ) - as_fn_error $? "invalid variable name: \`$ac_envvar'" ;; + as_fn_error "invalid variable name: \`$ac_envvar'" ;; esac eval $ac_envvar=\$ac_optarg export $ac_envvar ;; @@ -1570,13 +1569,13 @@ done if test -n "$ac_prev"; then ac_option=--`echo $ac_prev | sed 's/_/-/g'` - as_fn_error $? "missing argument to $ac_option" + as_fn_error "missing argument to $ac_option" fi if test -n "$ac_unrecognized_opts"; then case $enable_option_checking in no) ;; - fatal) as_fn_error $? "unrecognized options: $ac_unrecognized_opts" ;; + fatal) as_fn_error "unrecognized options: $ac_unrecognized_opts" ;; *) $as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2 ;; esac fi @@ -1599,7 +1598,7 @@ do [\\/$]* | ?:[\\/]* ) continue;; NONE | '' ) case $ac_var in *prefix ) continue;; esac;; esac - as_fn_error $? "expected an absolute directory name for --$ac_var: $ac_val" + as_fn_error "expected an absolute directory name for --$ac_var: $ac_val" done # There might be people who depend on the old broken behavior: `$host' @@ -1613,8 +1612,8 @@ target=$target_alias if test "x$host_alias" != x; then if test "x$build_alias" = x; then cross_compiling=maybe - $as_echo "$as_me: WARNING: if you wanted to set the --build type, don't use --host. - If a cross compiler is detected then cross compile mode will be used" >&2 + $as_echo "$as_me: WARNING: If you wanted to set the --build type, don't use --host. + If a cross compiler is detected then cross compile mode will be used." >&2 elif test "x$build_alias" != "x$host_alias"; then cross_compiling=yes fi @@ -1629,9 +1628,9 @@ test "$silent" = yes && exec 6>/dev/null ac_pwd=`pwd` && test -n "$ac_pwd" && ac_ls_di=`ls -di .` && ac_pwd_ls_di=`cd "$ac_pwd" && ls -di .` || - as_fn_error $? "working directory cannot be determined" + as_fn_error "working directory cannot be determined" test "X$ac_ls_di" = "X$ac_pwd_ls_di" || - as_fn_error $? "pwd does not report name of working directory" + as_fn_error "pwd does not report name of working directory" # Find the source files, if location was not specified. @@ -1670,11 +1669,11 @@ else fi if test ! -r "$srcdir/$ac_unique_file"; then test "$ac_srcdir_defaulted" = yes && srcdir="$ac_confdir or .." - as_fn_error $? "cannot find sources ($ac_unique_file) in $srcdir" + as_fn_error "cannot find sources ($ac_unique_file) in $srcdir" fi ac_msg="sources are in $srcdir, but \`cd $srcdir' does not work" ac_abs_confdir=`( - cd "$srcdir" && test -r "./$ac_unique_file" || as_fn_error $? "$ac_msg" + cd "$srcdir" && test -r "./$ac_unique_file" || as_fn_error "$ac_msg" pwd)` # When building in place, set srcdir=. if test "$ac_abs_confdir" = "$ac_pwd"; then @@ -1714,7 +1713,7 @@ Configuration: --help=short display options specific to this package --help=recursive display the short help of all the included packages -V, --version display version information and exit - -q, --quiet, --silent do not print \`checking ...' messages + -q, --quiet, --silent do not print \`checking...' messages --cache-file=FILE cache test results in FILE [disabled] -C, --config-cache alias for \`--cache-file=config.cache' -n, --no-create do not create output files @@ -1936,9 +1935,9 @@ test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF emacs configure 24.0.50 -generated by GNU Autoconf 2.67 +generated by GNU Autoconf 2.65 -Copyright (C) 2010 Free Software Foundation, Inc. +Copyright (C) 2009 Free Software Foundation, Inc. This configure script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it. _ACEOF @@ -2008,7 +2007,7 @@ $as_echo "$ac_try_echo"; } >&5 mv -f conftest.er1 conftest.err fi $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } > conftest.i && { + test $ac_status = 0; } >/dev/null && { test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || test ! -s conftest.err }; then : @@ -2032,10 +2031,10 @@ fi ac_fn_c_check_header_mongrel () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - if eval "test \"\${$3+set}\"" = set; then : + if { as_var=$3; eval "test \"\${$as_var+set}\" = set"; }; then : { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 $as_echo_n "checking for $2... " >&6; } -if eval "test \"\${$3+set}\"" = set; then : +if { as_var=$3; eval "test \"\${$as_var+set}\" = set"; }; then : $as_echo_n "(cached) " >&6 fi eval ac_res=\$$3 @@ -2071,7 +2070,7 @@ if ac_fn_c_try_cpp "$LINENO"; then : else ac_header_preproc=no fi -rm -f conftest.err conftest.i conftest.$ac_ext +rm -f conftest.err conftest.$ac_ext { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_header_preproc" >&5 $as_echo "$ac_header_preproc" >&6; } @@ -2098,7 +2097,7 @@ $as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;} esac { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 $as_echo_n "checking for $2... " >&6; } -if eval "test \"\${$3+set}\"" = set; then : +if { as_var=$3; eval "test \"\${$as_var+set}\" = set"; }; then : $as_echo_n "(cached) " >&6 else eval "$3=\$ac_header_compiler" @@ -2162,7 +2161,7 @@ ac_fn_c_check_header_compile () as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 $as_echo_n "checking for $2... " >&6; } -if eval "test \"\${$3+set}\"" = set; then : +if { as_var=$3; eval "test \"\${$as_var+set}\" = set"; }; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -2230,18 +2229,15 @@ fi } # ac_fn_c_try_link -# ac_fn_c_check_decl LINENO SYMBOL VAR INCLUDES -# --------------------------------------------- -# Tests whether SYMBOL is declared in INCLUDES, setting cache variable VAR -# accordingly. +# ac_fn_c_check_decl LINENO SYMBOL VAR +# ------------------------------------ +# Tests whether SYMBOL is declared, setting cache variable VAR accordingly. ac_fn_c_check_decl () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - as_decl_name=`echo $2|sed 's/ *(.*//'` - as_decl_use=`echo $2|sed -e 's/(/((/' -e 's/)/) 0&/' -e 's/,/) 0& (/g'` - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $as_decl_name is declared" >&5 -$as_echo_n "checking whether $as_decl_name is declared... " >&6; } -if eval "test \"\${$3+set}\"" = set; then : + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $2 is declared" >&5 +$as_echo_n "checking whether $2 is declared... " >&6; } +if { as_var=$3; eval "test \"\${$as_var+set}\" = set"; }; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -2250,12 +2246,8 @@ $4 int main () { -#ifndef $as_decl_name -#ifdef __cplusplus - (void) $as_decl_use; -#else - (void) $as_decl_name; -#endif +#ifndef $2 + (void) $2; #endif ; @@ -2284,7 +2276,7 @@ ac_fn_c_check_header_preproc () as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 $as_echo_n "checking for $2... " >&6; } -if eval "test \"\${$3+set}\"" = set; then : +if { as_var=$3; eval "test \"\${$as_var+set}\" = set"; }; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -2296,7 +2288,7 @@ if ac_fn_c_try_cpp "$LINENO"; then : else eval "$3=no" fi -rm -f conftest.err conftest.i conftest.$ac_ext +rm -f conftest.err conftest.$ac_ext fi eval ac_res=\$$3 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 @@ -2314,7 +2306,7 @@ ac_fn_c_check_member () as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2.$3" >&5 $as_echo_n "checking for $2.$3... " >&6; } -if eval "test \"\${$4+set}\"" = set; then : +if { as_var=$4; eval "test \"\${$as_var+set}\" = set"; }; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -2370,7 +2362,7 @@ ac_fn_c_check_func () as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 $as_echo_n "checking for $2... " >&6; } -if eval "test \"\${$3+set}\"" = set; then : +if { as_var=$3; eval "test \"\${$as_var+set}\" = set"; }; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -2438,7 +2430,7 @@ ac_fn_c_check_type () as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 $as_echo_n "checking for $2... " >&6; } -if eval "test \"\${$3+set}\"" = set; then : +if { as_var=$3; eval "test \"\${$as_var+set}\" = set"; }; then : $as_echo_n "(cached) " >&6 else eval "$3=no" @@ -2665,7 +2657,7 @@ This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. It was created by emacs $as_me 24.0.50, which was -generated by GNU Autoconf 2.67. Invocation command line was +generated by GNU Autoconf 2.65. Invocation command line was $ $0 $@ @@ -2775,9 +2767,11 @@ trap 'exit_status=$? { echo - $as_echo "## ---------------- ## + cat <<\_ASBOX +## ---------------- ## ## Cache variables. ## -## ---------------- ##" +## ---------------- ## +_ASBOX echo # The following way of writing the cache mishandles newlines in values, ( @@ -2811,9 +2805,11 @@ $as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; ) echo - $as_echo "## ----------------- ## + cat <<\_ASBOX +## ----------------- ## ## Output variables. ## -## ----------------- ##" +## ----------------- ## +_ASBOX echo for ac_var in $ac_subst_vars do @@ -2826,9 +2822,11 @@ $as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; echo if test -n "$ac_subst_files"; then - $as_echo "## ------------------- ## + cat <<\_ASBOX +## ------------------- ## ## File substitutions. ## -## ------------------- ##" +## ------------------- ## +_ASBOX echo for ac_var in $ac_subst_files do @@ -2842,9 +2840,11 @@ $as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; fi if test -s confdefs.h; then - $as_echo "## ----------- ## + cat <<\_ASBOX +## ----------- ## ## confdefs.h. ## -## ----------- ##" +## ----------- ## +_ASBOX echo cat confdefs.h echo @@ -2899,12 +2899,7 @@ _ACEOF ac_site_file1=NONE ac_site_file2=NONE if test -n "$CONFIG_SITE"; then - # We do not want a PATH search for config.site. - case $CONFIG_SITE in #(( - -*) ac_site_file1=./$CONFIG_SITE;; - */*) ac_site_file1=$CONFIG_SITE;; - *) ac_site_file1=./$CONFIG_SITE;; - esac + ac_site_file1=$CONFIG_SITE elif test "x$prefix" != xNONE; then ac_site_file1=$prefix/share/config.site ac_site_file2=$prefix/etc/config.site @@ -2919,11 +2914,7 @@ do { $as_echo "$as_me:${as_lineno-$LINENO}: loading site script $ac_site_file" >&5 $as_echo "$as_me: loading site script $ac_site_file" >&6;} sed 's/^/| /' "$ac_site_file" >&5 - . "$ac_site_file" \ - || { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -as_fn_error $? "failed to load site script $ac_site_file -See \`config.log' for more details" "$LINENO" 5 ; } + . "$ac_site_file" fi done @@ -3014,7 +3005,7 @@ if $ac_cache_corrupted; then $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: error: changes in the environment can compromise the build" >&5 $as_echo "$as_me: error: changes in the environment can compromise the build" >&2;} - as_fn_error $? "run \`make distclean' and/or \`rm $cache_file' and start over" "$LINENO" 5 + as_fn_error "run \`make distclean' and/or \`rm $cache_file' and start over" "$LINENO" 5 fi ## -------------------- ## ## Main body of script. ## @@ -3034,22 +3025,16 @@ am__api_version='1.11' ac_aux_dir= for ac_dir in "$srcdir" "$srcdir/.." "$srcdir/../.."; do - if test -f "$ac_dir/install-sh"; then - ac_aux_dir=$ac_dir - ac_install_sh="$ac_aux_dir/install-sh -c" - break - elif test -f "$ac_dir/install.sh"; then - ac_aux_dir=$ac_dir - ac_install_sh="$ac_aux_dir/install.sh -c" - break - elif test -f "$ac_dir/shtool"; then - ac_aux_dir=$ac_dir - ac_install_sh="$ac_aux_dir/shtool install -c" - break - fi + for ac_t in install-sh install.sh shtool; do + if test -f "$ac_dir/$ac_t"; then + ac_aux_dir=$ac_dir + ac_install_sh="$ac_aux_dir/$ac_t -c" + break 2 + fi + done done if test -z "$ac_aux_dir"; then - as_fn_error $? "cannot find install-sh, install.sh, or shtool in \"$srcdir\" \"$srcdir/..\" \"$srcdir/../..\"" "$LINENO" 5 + as_fn_error "cannot find install-sh, install.sh, or shtool in \"$srcdir\" \"$srcdir/..\" \"$srcdir/../..\"" "$LINENO" 5 fi # These three variables are undocumented and unsupported, @@ -3165,11 +3150,11 @@ am_lf=' ' case `pwd` in *[\\\"\#\$\&\'\`$am_lf]*) - as_fn_error $? "unsafe absolute working directory name" "$LINENO" 5 ;; + as_fn_error "unsafe absolute working directory name" "$LINENO" 5;; esac case $srcdir in *[\\\"\#\$\&\'\`$am_lf\ \ ]*) - as_fn_error $? "unsafe srcdir value: \`$srcdir'" "$LINENO" 5 ;; + as_fn_error "unsafe srcdir value: \`$srcdir'" "$LINENO" 5;; esac # Do `set' in a subshell so we don't clobber the current shell's @@ -3191,7 +3176,7 @@ if ( # if, for instance, CONFIG_SHELL is bash and it inherits a # broken ls alias from the environment. This has actually # happened. Such a system could not be considered "sane". - as_fn_error $? "ls -t appears to fail. Make sure there is not a broken + as_fn_error "ls -t appears to fail. Make sure there is not a broken alias in your environment" "$LINENO" 5 fi @@ -3201,7 +3186,7 @@ then # Ok. : else - as_fn_error $? "newly created file is older than distributed files! + as_fn_error "newly created file is older than distributed files! Check your system clock" "$LINENO" 5 fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 @@ -3440,7 +3425,7 @@ done $as_echo_n "checking whether ${MAKE-make} sets \$(MAKE)... " >&6; } set x ${MAKE-make} ac_make=`$as_echo "$2" | sed 's/+/p/g; s/[^a-zA-Z0-9_]/_/g'` -if eval "test \"\${ac_cv_prog_make_${ac_make}_set+set}\"" = set; then : +if { as_var=ac_cv_prog_make_${ac_make}_set; eval "test \"\${$as_var+set}\" = set"; }; then : $as_echo_n "(cached) " >&6 else cat >conftest.make <<\_ACEOF @@ -3448,7 +3433,7 @@ SHELL = /bin/sh all: @echo '@@@%%%=$(MAKE)=@@@%%%' _ACEOF -# GNU make sometimes prints "make[1]: Entering ...", which would confuse us. +# GNU make sometimes prints "make[1]: Entering...", which would confuse us. case `${MAKE-make} -f conftest.make 2>/dev/null` in *@@@%%%=?*=@@@%%%*) eval ac_cv_prog_make_${ac_make}_set=yes;; @@ -3482,7 +3467,7 @@ if test "`cd $srcdir && pwd`" != "`pwd`"; then am__isrc=' -I$(srcdir)' # test to see if srcdir already configured if test -f $srcdir/config.status; then - as_fn_error $? "source directory already configured; run \"make distclean\" there first" "$LINENO" 5 + as_fn_error "source directory already configured; run \"make distclean\" there first" "$LINENO" 5 fi fi @@ -3685,7 +3670,7 @@ if test "${with_x_toolkit+set}" = set; then : g | gt | gtk ) val=gtk ;; gtk3 ) val=gtk3 ;; * ) -as_fn_error $? "\`--with-x-toolkit=$withval' is invalid; +as_fn_error "\`--with-x-toolkit=$withval' is invalid; 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 ;; @@ -3998,7 +3983,7 @@ do stringfreelist) ac_gc_check_string_free_list=1 ;; xmallocoverrun) ac_xmalloc_overrun=1 ;; conslist) ac_gc_check_cons_list=1 ;; - *) as_fn_error $? "unknown check category $check" "$LINENO" 5 ;; + *) as_fn_error "unknown check category $check" "$LINENO" 5 ;; esac done IFS="$ac_save_IFS" @@ -4113,7 +4098,7 @@ fi # Make sure we can run config.sub. $SHELL "$ac_aux_dir/config.sub" sun4 >/dev/null 2>&1 || - as_fn_error $? "cannot run $SHELL $ac_aux_dir/config.sub" "$LINENO" 5 + as_fn_error "cannot run $SHELL $ac_aux_dir/config.sub" "$LINENO" 5 { $as_echo "$as_me:${as_lineno-$LINENO}: checking build system type" >&5 $as_echo_n "checking build system type... " >&6; } @@ -4124,16 +4109,16 @@ else test "x$ac_build_alias" = x && ac_build_alias=`$SHELL "$ac_aux_dir/config.guess"` test "x$ac_build_alias" = x && - as_fn_error $? "cannot guess build type; you must specify one" "$LINENO" 5 + as_fn_error "cannot guess build type; you must specify one" "$LINENO" 5 ac_cv_build=`$SHELL "$ac_aux_dir/config.sub" $ac_build_alias` || - as_fn_error $? "$SHELL $ac_aux_dir/config.sub $ac_build_alias failed" "$LINENO" 5 + as_fn_error "$SHELL $ac_aux_dir/config.sub $ac_build_alias failed" "$LINENO" 5 fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_build" >&5 $as_echo "$ac_cv_build" >&6; } case $ac_cv_build in *-*-*) ;; -*) as_fn_error $? "invalid value of canonical build" "$LINENO" 5 ;; +*) as_fn_error "invalid value of canonical build" "$LINENO" 5;; esac build=$ac_cv_build ac_save_IFS=$IFS; IFS='-' @@ -4158,7 +4143,7 @@ else ac_cv_host=$ac_cv_build else ac_cv_host=`$SHELL "$ac_aux_dir/config.sub" $host_alias` || - as_fn_error $? "$SHELL $ac_aux_dir/config.sub $host_alias failed" "$LINENO" 5 + as_fn_error "$SHELL $ac_aux_dir/config.sub $host_alias failed" "$LINENO" 5 fi fi @@ -4166,7 +4151,7 @@ fi $as_echo "$ac_cv_host" >&6; } case $ac_cv_host in *-*-*) ;; -*) as_fn_error $? "invalid value of canonical host" "$LINENO" 5 ;; +*) as_fn_error "invalid value of canonical host" "$LINENO" 5;; esac host=$ac_cv_host ac_save_IFS=$IFS; IFS='-' @@ -4420,7 +4405,7 @@ fi if test $unported = yes; then - as_fn_error $? "Emacs hasn't been ported to \`${canonical}' systems. + as_fn_error "Emacs hasn't been ported to \`${canonical}' systems. Check \`etc/MACHINES' for recognized configuration names." "$LINENO" 5 fi @@ -4738,8 +4723,8 @@ fi test -z "$CC" && { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -as_fn_error $? "no acceptable C compiler found in \$PATH -See \`config.log' for more details" "$LINENO" 5 ; } +as_fn_error "no acceptable C compiler found in \$PATH +See \`config.log' for more details." "$LINENO" 5; } # Provide some information about the compiler. $as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler version" >&5 @@ -4853,8 +4838,9 @@ sed 's/^/| /' conftest.$ac_ext >&5 { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -as_fn_error 77 "C compiler cannot create executables -See \`config.log' for more details" "$LINENO" 5 ; } +{ as_fn_set_status 77 +as_fn_error "C compiler cannot create executables +See \`config.log' for more details." "$LINENO" 5; }; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } @@ -4896,8 +4882,8 @@ done else { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -as_fn_error $? "cannot compute suffix of executables: cannot compile and link -See \`config.log' for more details" "$LINENO" 5 ; } +as_fn_error "cannot compute suffix of executables: cannot compile and link +See \`config.log' for more details." "$LINENO" 5; } fi rm -f conftest conftest$ac_cv_exeext { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_exeext" >&5 @@ -4954,9 +4940,9 @@ $as_echo "$ac_try_echo"; } >&5 else { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -as_fn_error $? "cannot run C compiled programs. +as_fn_error "cannot run C compiled programs. If you meant to cross compile, use \`--host'. -See \`config.log' for more details" "$LINENO" 5 ; } +See \`config.log' for more details." "$LINENO" 5; } fi fi fi @@ -5007,8 +4993,8 @@ sed 's/^/| /' conftest.$ac_ext >&5 { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -as_fn_error $? "cannot compute suffix of object files: cannot compile -See \`config.log' for more details" "$LINENO" 5 ; } +as_fn_error "cannot compute suffix of object files: cannot compile +See \`config.log' for more details." "$LINENO" 5; } fi rm -f conftest.$ac_cv_objext conftest.$ac_ext fi @@ -5426,7 +5412,7 @@ $as_echo_n "checking whether cc understands -c and -o together... " >&6; } fi set dummy $CC; ac_cc=`$as_echo "$2" | sed 's/[^a-zA-Z0-9_]/_/g;s/^[0-9]/_/'` -if eval "test \"\${ac_cv_prog_cc_${ac_cc}_c_o+set}\"" = set; then : +if { as_var=ac_cv_prog_cc_${ac_cc}_c_o; eval "test \"\${$as_var+set}\" = set"; }; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -5680,7 +5666,7 @@ else # Broken: fails on valid input. continue fi -rm -f conftest.err conftest.i conftest.$ac_ext +rm -f conftest.err conftest.$ac_ext # OK, works on sane cases. Now check whether nonexistent headers # can be detected and how. @@ -5696,11 +5682,11 @@ else ac_preproc_ok=: break fi -rm -f conftest.err conftest.i conftest.$ac_ext +rm -f conftest.err conftest.$ac_ext done # Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. -rm -f conftest.i conftest.err conftest.$ac_ext +rm -f conftest.err conftest.$ac_ext if $ac_preproc_ok; then : break fi @@ -5739,7 +5725,7 @@ else # Broken: fails on valid input. continue fi -rm -f conftest.err conftest.i conftest.$ac_ext +rm -f conftest.err conftest.$ac_ext # OK, works on sane cases. Now check whether nonexistent headers # can be detected and how. @@ -5755,18 +5741,18 @@ else ac_preproc_ok=: break fi -rm -f conftest.err conftest.i conftest.$ac_ext +rm -f conftest.err conftest.$ac_ext done # Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. -rm -f conftest.i conftest.err conftest.$ac_ext +rm -f conftest.err conftest.$ac_ext if $ac_preproc_ok; then : else { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -as_fn_error $? "C preprocessor \"$CPP\" fails sanity check -See \`config.log' for more details" "$LINENO" 5 ; } +as_fn_error "C preprocessor \"$CPP\" fails sanity check +See \`config.log' for more details." "$LINENO" 5; } fi ac_ext=c @@ -5827,7 +5813,7 @@ esac done IFS=$as_save_IFS if test -z "$ac_cv_path_GREP"; then - as_fn_error $? "no acceptable grep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 + as_fn_error "no acceptable grep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 fi else ac_cv_path_GREP=$GREP @@ -5893,7 +5879,7 @@ esac done IFS=$as_save_IFS if test -z "$ac_cv_path_EGREP"; then - as_fn_error $? "no acceptable egrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 + as_fn_error "no acceptable egrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 fi else ac_cv_path_EGREP=$EGREP @@ -6025,7 +6011,8 @@ do : as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` ac_fn_c_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default " -if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : +eval as_val=\$$as_ac_Header + if test "x$as_val" = x""yes; then : cat >>confdefs.h <<_ACEOF #define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF @@ -6356,7 +6343,7 @@ else # Broken: fails on valid input. continue fi -rm -f conftest.err conftest.i conftest.$ac_ext +rm -f conftest.err conftest.$ac_ext # OK, works on sane cases. Now check whether nonexistent headers # can be detected and how. @@ -6372,11 +6359,11 @@ else ac_preproc_ok=: break fi -rm -f conftest.err conftest.i conftest.$ac_ext +rm -f conftest.err conftest.$ac_ext done # Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. -rm -f conftest.i conftest.err conftest.$ac_ext +rm -f conftest.err conftest.$ac_ext if $ac_preproc_ok; then : break fi @@ -6415,7 +6402,7 @@ else # Broken: fails on valid input. continue fi -rm -f conftest.err conftest.i conftest.$ac_ext +rm -f conftest.err conftest.$ac_ext # OK, works on sane cases. Now check whether nonexistent headers # can be detected and how. @@ -6431,18 +6418,18 @@ else ac_preproc_ok=: break fi -rm -f conftest.err conftest.i conftest.$ac_ext +rm -f conftest.err conftest.$ac_ext done # Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. -rm -f conftest.i conftest.err conftest.$ac_ext +rm -f conftest.err conftest.$ac_ext if $ac_preproc_ok; then : else { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -as_fn_error $? "C preprocessor \"$CPP\" fails sanity check -See \`config.log' for more details" "$LINENO" 5 ; } +as_fn_error "C preprocessor \"$CPP\" fails sanity check +See \`config.log' for more details." "$LINENO" 5; } fi ac_ext=c @@ -6790,7 +6777,7 @@ if test "$MAKEINFO" = "no"; then if test "x${with_makeinfo}" = "xno"; then HAVE_MAKEINFO=no elif test ! -e $srcdir/info/emacs; then - as_fn_error $? "You do not seem to have makeinfo >= 4.6, and your + as_fn_error "You do not seem to have makeinfo >= 4.6, and your source tree does not seem to have pre-built manuals in the \`info' directory. Either install a suitable version of makeinfo, or re-run configure with the \`--without-makeinfo' option to build without the manuals. " "$LINENO" 5 @@ -6951,7 +6938,7 @@ fi if test "x$GCC" = "xyes"; then C_SWITCH_MACHINE="-fno-common" else - as_fn_error $? "What gives? Fix me if DEC Unix supports ELF now." "$LINENO" 5 + as_fn_error "What gives? Fix me if DEC Unix supports ELF now." "$LINENO" 5 fi else UNEXEC_OBJ=unexalpha.o @@ -7227,7 +7214,7 @@ else ## Some platforms don't use any of these files, so it is not ## appropriate to put this test outside the if block. test -e $CRT_DIR/crtn.o || test -e $CRT_DIR/crt0.o || \ - as_fn_error $? "crt*.o not found in specified location." "$LINENO" 5 + as_fn_error "crt*.o not found in specified location." "$LINENO" 5 fi @@ -7282,7 +7269,8 @@ if test "${with_sound}" != "no"; then do : as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default" -if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : +eval as_val=\$$as_ac_Header + if test "x$as_val" = x""yes; then : cat >>confdefs.h <<_ACEOF #define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF @@ -7473,7 +7461,7 @@ else fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext if test "$emacs_alsa_subdir" != yes; then - as_fn_error $? "pkg-config found alsa, but it does not compile. See config.log for error messages." "$LINENO" 5 + as_fn_error "pkg-config found alsa, but it does not compile. See config.log for error messages." "$LINENO" 5 fi ALSA_CFLAGS="$ALSA_CFLAGS -DALSA_SUBDIR_INCLUDE" fi @@ -7508,7 +7496,8 @@ for ac_header in sys/select.h sys/time.h unistd.h utime.h \ do : as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default" -if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : +eval as_val=\$$as_ac_Header + if test "x$as_val" = x""yes; then : cat >>confdefs.h <<_ACEOF #define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF @@ -8563,8 +8552,8 @@ $as_echo "#define AC_APPLE_UNIVERSAL_BUILD 1" >>confdefs.h ;; #( *) - as_fn_error $? "unknown endianness - presetting ac_cv_c_bigendian=no (or yes) will help" "$LINENO" 5 ;; + as_fn_error "unknown endianness + presetting ac_cv_c_bigendian=no (or yes) will help" "$LINENO" 5 ;; esac @@ -8603,7 +8592,7 @@ fi $as_echo_n "checking whether ${MAKE-make} sets \$(MAKE)... " >&6; } set x ${MAKE-make} ac_make=`$as_echo "$2" | sed 's/+/p/g; s/[^a-zA-Z0-9_]/_/g'` -if eval "test \"\${ac_cv_prog_make_${ac_make}_set+set}\"" = set; then : +if { as_var=ac_cv_prog_make_${ac_make}_set; eval "test \"\${$as_var+set}\" = set"; }; then : $as_echo_n "(cached) " >&6 else cat >conftest.make <<\_ACEOF @@ -8611,7 +8600,7 @@ SHELL = /bin/sh all: @echo '@@@%%%=$(MAKE)=@@@%%%' _ACEOF -# GNU make sometimes prints "make[1]: Entering ...", which would confuse us. +# GNU make sometimes prints "make[1]: Entering...", which would confuse us. case `${MAKE-make} -f conftest.make 2>/dev/null` in *@@@%%%=?*=@@@%%%*) eval ac_cv_prog_make_${ac_make}_set=yes;; @@ -8747,7 +8736,7 @@ if test "x$with_x" = xno; then have_x=disabled else case $x_includes,$x_libraries in #( - *\'*) as_fn_error $? "cannot use X directory names containing '" "$LINENO" 5 ;; #( + *\'*) as_fn_error "cannot use X directory names containing '" "$LINENO" 5;; #( *,NONE | NONE,*) if test "${ac_cv_have_x+set}" = set; then : $as_echo_n "(cached) " >&6 else @@ -8765,7 +8754,7 @@ libdir: @echo libdir='${LIBDIR}' _ACEOF if (export CC; ${XMKMF-xmkmf}) >/dev/null 2>/dev/null && test -f Makefile; then - # GNU make sometimes prints "make[1]: Entering ...", which would confuse us. + # GNU make sometimes prints "make[1]: Entering...", which would confuse us. for ac_var in incroot usrlibdir libdir; do eval "ac_im_$ac_var=\`\${MAKE-make} $ac_var 2>/dev/null | sed -n 's/^$ac_var=//p'\`" done @@ -8851,7 +8840,7 @@ else fi done fi -rm -f conftest.err conftest.i conftest.$ac_ext +rm -f conftest.err conftest.$ac_ext fi # $ac_x_includes = no if test "$ac_x_libraries" = no; then @@ -9034,7 +9023,7 @@ if test "${with_ns}" != no; then if test "x$ac_cv_header_AppKit_AppKit_h" = x""yes; then : HAVE_NS=yes else - as_fn_error $? "\`--with-ns' was specified, but the include + as_fn_error "\`--with-ns' was specified, but the include files are missing or cannot be compiled." "$LINENO" 5 fi @@ -9153,7 +9142,7 @@ fi if test "$HAVE_XSERVER" = true || test -n "$DISPLAY" || test "`echo /usr/lib/libX11.*`" != "/usr/lib/libX11.*"; then - as_fn_error $? "You seem to be running X, but no X development libraries + as_fn_error "You seem to be running X, but no X development libraries were found. You should install the relevant development files for X and for the toolkit you want, such as Gtk+, Lesstif or Motif. Also make sure you have development files for image handling, i.e. @@ -9276,7 +9265,8 @@ do : as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` ac_fn_c_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default " -if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : +eval as_val=\$$as_ac_Header + if test "x$as_val" = x""yes; then : cat >>confdefs.h <<_ACEOF #define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF @@ -9382,7 +9372,6 @@ int main () { char *data, *data2, *data3; - const char *cdata2; int i, pagesize; int fd, fd2; @@ -9407,10 +9396,10 @@ main () fd2 = open ("conftest.txt", O_RDWR | O_CREAT | O_TRUNC, 0600); if (fd2 < 0) return 4; - cdata2 = ""; - if (write (fd2, cdata2, 1) != 1) + data2 = ""; + if (write (fd2, data2, 1) != 1) return 5; - data2 = (char *) mmap (0, pagesize, PROT_READ | PROT_WRITE, MAP_SHARED, fd2, 0L); + data2 = mmap (0, pagesize, PROT_READ | PROT_WRITE, MAP_SHARED, fd2, 0L); if (data2 == MAP_FAILED) return 6; for (i = 0; i < pagesize; ++i) @@ -9783,7 +9772,8 @@ XScreenNumberOfScreen XSetWMProtocols 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" -if eval test \"x\$"$as_ac_var"\" = x"yes"; then : +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 @@ -10086,8 +10076,8 @@ fi HAVE_GTK=no if test "${with_gtk3}" = "yes"; then - GLIB_REQUIRED=2.6 - GTK_REQUIRED=2.90 + GLIB_REQUIRED=2.28 + GTK_REQUIRED=3.0 GTK_MODULES="gtk+-3.0 >= $GTK_REQUIRED glib-2.0 >= $GLIB_REQUIRED" @@ -10185,8 +10175,11 @@ $as_echo "no" >&6; } fi if test "$pkg_check_gtk" = "no" && test "$USE_X_TOOLKIT" != "maybe"; then - as_fn_error $? "$GTK_PKG_ERRORS" "$LINENO" 5 + as_fn_error "$GTK_PKG_ERRORS" "$LINENO" 5 fi + +$as_echo "#define HAVE_GTK3 1" >>confdefs.h + fi if test "$pkg_check_gtk" != "yes"; then @@ -10291,7 +10284,7 @@ $as_echo "no" >&6; } fi if test "$pkg_check_gtk" = "no" && test "$USE_X_TOOLKIT" != "maybe"; then - as_fn_error $? "$GTK_PKG_ERRORS" "$LINENO" 5 + as_fn_error "$GTK_PKG_ERRORS" "$LINENO" 5 fi fi fi @@ -10318,7 +10311,7 @@ done if test "${GTK_COMPILES}" != "yes"; then if test "$USE_X_TOOLKIT" != "maybe"; then - as_fn_error $? "Gtk+ wanted, but it does not compile, see config.log. Maybe some x11-devel files missing?" "$LINENO" 5 ; + as_fn_error "Gtk+ wanted, but it does not compile, see config.log. Maybe some x11-devel files missing?" "$LINENO" 5; fi else HAVE_GTK=yes @@ -10448,7 +10441,8 @@ $as_echo "#define HAVE_GTK_AND_PTHREAD 1" >>confdefs.h 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" -if eval test \"x\$"$as_ac_var"\" = x"yes"; then : +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 @@ -10970,7 +10964,7 @@ $as_echo "yes; using Lucid toolkit" >&6; } USE_X_TOOLKIT=LUCID LUCID_LIBW=-lXaw elif test x"${USE_X_TOOLKIT}" = xLUCID; then - as_fn_error $? "Lucid toolkit requires X11/Xaw include files" "$LINENO" 5 + as_fn_error "Lucid toolkit requires X11/Xaw include files" "$LINENO" 5 else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no; do not use toolkit by default" >&5 $as_echo "no; do not use toolkit by default" >&6; } @@ -11778,7 +11772,7 @@ $as_echo "no" >&6; } fi - test "$HAVE_FREETYPE" = "no" && as_fn_error $? "libxft requires libfreetype" "$LINENO" 5 + test "$HAVE_FREETYPE" = "no" && as_fn_error "libxft requires libfreetype" "$LINENO" 5 fi HAVE_LIBOTF=no @@ -12237,7 +12231,8 @@ if test "${HAVE_X11}" = "yes"; then do : as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default" -if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : +eval as_val=\$$as_ac_Header + if test "x$as_val" = x""yes; then : cat >>confdefs.h <<_ACEOF #define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF @@ -12489,7 +12484,7 @@ if test "${HAVE_X11}" = "yes"; then MISSING="$MISSING libtiff" && WITH_NO="$WITH_NO --with-tiff=no" if test "X${MISSING}" != X; then - as_fn_error $? "The following required libraries were not found: + as_fn_error "The following required libraries were not found: $MISSING Maybe some development libraries/packages are missing? If you don't want to link with them give @@ -12978,7 +12973,8 @@ if test $ac_cv_os_cray = yes; then for ac_func in _getb67 GETB67 getb67; 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" -if eval test \"x\$"$as_ac_var"\" = x"yes"; then : +eval as_val=\$$as_ac_var + if test "x$as_val" = x""yes; then : cat >>confdefs.h <<_ACEOF #define CRAY_STACKSEG_END $ac_func @@ -13042,7 +13038,7 @@ fi if test x"$ac_cv_func_alloca_works" != xyes; then - as_fn_error $? "a system implementation of alloca is required " "$LINENO" 5 + as_fn_error "a system implementation of alloca is required " "$LINENO" 5 fi # fmod, logb, and frexp are found in -lm on most systems. @@ -13238,7 +13234,7 @@ fi if test $ac_cv_prog_liblockfile = yes; then - as_fn_error $? "Shared liblockfile found but can't link against it. + as_fn_error "Shared liblockfile found but can't link against it. This probably means that movemail could lose mail. There may be a \`development' package to install containing liblockfile." "$LINENO" 5 fi @@ -13327,7 +13323,8 @@ cfmakeraw cfsetspeed isnan copysign __executable_start 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" -if eval test \"x\$"$as_ac_var"\" = x"yes"; then : +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 @@ -13719,8 +13716,8 @@ $as_echo "#define AC_APPLE_UNIVERSAL_BUILD 1" >>confdefs.h ;; #( *) - as_fn_error $? "unknown endianness - presetting ac_cv_c_bigendian=no (or yes) will help" "$LINENO" 5 ;; + as_fn_error "unknown endianness + presetting ac_cv_c_bigendian=no (or yes) will help" "$LINENO" 5 ;; esac @@ -14621,7 +14618,8 @@ fi 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" -if eval test \"x\$"$as_ac_var"\" = x"yes"; then : +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 @@ -15353,7 +15351,7 @@ fi # Make sure getloadavg.c is where it belongs, at configure-time. test -f "$srcdir/$gl_source_base/getloadavg.c" || - as_fn_error $? "$srcdir/$gl_source_base/getloadavg.c is missing" "$LINENO" 5 + as_fn_error "$srcdir/$gl_source_base/getloadavg.c is missing" "$LINENO" 5 gl_save_LIBS=$LIBS @@ -16951,7 +16949,8 @@ $as_echo "$gl_cv_header_working_stdint_h" >&6; } do : as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default" -if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : +eval as_val=\$$as_ac_Header + if test "x$as_val" = x""yes; then : cat >>confdefs.h <<_ACEOF #define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF @@ -16981,7 +16980,7 @@ done for gltype in ptrdiff_t size_t ; do { $as_echo "$as_me:${as_lineno-$LINENO}: checking for bit size of $gltype" >&5 $as_echo_n "checking for bit size of $gltype... " >&6; } -if eval "test \"\${gl_cv_bitsizeof_${gltype}+set}\"" = set; then : +if { as_var=gl_cv_bitsizeof_${gltype}; eval "test \"\${$as_var+set}\" = set"; }; then : $as_echo_n "(cached) " >&6 else if ac_fn_c_compute_int "$LINENO" "sizeof ($gltype) * CHAR_BIT" "result" " @@ -17026,7 +17025,7 @@ _ACEOF for gltype in sig_atomic_t wchar_t wint_t ; do { $as_echo "$as_me:${as_lineno-$LINENO}: checking for bit size of $gltype" >&5 $as_echo_n "checking for bit size of $gltype... " >&6; } -if eval "test \"\${gl_cv_bitsizeof_${gltype}+set}\"" = set; then : +if { as_var=gl_cv_bitsizeof_${gltype}; eval "test \"\${$as_var+set}\" = set"; }; then : $as_echo_n "(cached) " >&6 else if ac_fn_c_compute_int "$LINENO" "sizeof ($gltype) * CHAR_BIT" "result" " @@ -17070,7 +17069,7 @@ _ACEOF for gltype in sig_atomic_t wchar_t wint_t ; do { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $gltype is signed" >&5 $as_echo_n "checking whether $gltype is signed... " >&6; } -if eval "test \"\${gl_cv_type_${gltype}_signed+set}\"" = set; then : +if { as_var=gl_cv_type_${gltype}_signed; eval "test \"\${$as_var+set}\" = set"; }; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -17129,7 +17128,7 @@ _ACEOF for gltype in ptrdiff_t size_t ; do { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $gltype integer literal suffix" >&5 $as_echo_n "checking for $gltype integer literal suffix... " >&6; } -if eval "test \"\${gl_cv_type_${gltype}_suffix+set}\"" = set; then : +if { as_var=gl_cv_type_${gltype}_suffix; eval "test \"\${$as_var+set}\" = set"; }; then : $as_echo_n "(cached) " >&6 else eval gl_cv_type_${gltype}_suffix=no @@ -17201,7 +17200,7 @@ _ACEOF for gltype in sig_atomic_t wchar_t wint_t ; do { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $gltype integer literal suffix" >&5 $as_echo_n "checking for $gltype integer literal suffix... " >&6; } -if eval "test \"\${gl_cv_type_${gltype}_suffix+set}\"" = set; then : +if { as_var=gl_cv_type_${gltype}_suffix; eval "test \"\${$as_var+set}\" = set"; }; then : $as_echo_n "(cached) " >&6 else eval gl_cv_type_${gltype}_suffix=no @@ -17811,7 +17810,7 @@ else fi if test "$have_tputs_et_al" != true; then - as_fn_error $? "I couldn't find termcap functions (tputs and friends). + as_fn_error "I couldn't find termcap functions (tputs and friends). Maybe some development libraries/packages are missing? Try installing libncurses-dev(el), libterminfo-dev(el) or similar." "$LINENO" 5 fi @@ -18937,7 +18936,8 @@ for ac_func in fork vfork 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" -if eval test \"x\$"$as_ac_var"\" = x"yes"; then : +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 @@ -19257,7 +19257,7 @@ if test "x$GCC" = xyes \ && test x"`$CC --version 2> /dev/null | grep 'gcc.* 4.5.0'`" != x \ && test x"`echo $CFLAGS | grep '\-O[23]'`" != x \ && test x"`echo $CFLAGS | grep '\-fno-optimize-sibling-calls'`" = x; then - as_fn_error $? "GCC 4.5.0 has problems compiling Emacs; see etc/PROBLEMS'." "$LINENO" 5 + as_fn_error "GCC 4.5.0 has problems compiling Emacs; see etc/PROBLEMS'." "$LINENO" 5 fi version=$PACKAGE_VERSION @@ -19833,7 +19833,6 @@ DEFS=-DHAVE_CONFIG_H ac_libobjs= ac_ltlibobjs= -U= for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue # 1. Remove the extension, and $U if already installed. ac_script='s/\$U\././;s/\.o$//;s/\.obj$//' @@ -19857,16 +19856,16 @@ else fi if test -z "${AMDEP_TRUE}" && test -z "${AMDEP_FALSE}"; then - as_fn_error $? "conditional \"AMDEP\" was never defined. + as_fn_error "conditional \"AMDEP\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${am__fastdepCC_TRUE}" && test -z "${am__fastdepCC_FALSE}"; then - as_fn_error $? "conditional \"am__fastdepCC\" was never defined. + as_fn_error "conditional \"am__fastdepCC\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${GL_COND_LIBTOOL_TRUE}" && test -z "${GL_COND_LIBTOOL_FALSE}"; then - as_fn_error $? "conditional \"GL_COND_LIBTOOL\" was never defined. + as_fn_error "conditional \"GL_COND_LIBTOOL\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi @@ -20049,19 +20048,19 @@ export LANGUAGE (unset CDPATH) >/dev/null 2>&1 && unset CDPATH -# as_fn_error STATUS ERROR [LINENO LOG_FD] -# ---------------------------------------- +# as_fn_error ERROR [LINENO LOG_FD] +# --------------------------------- # Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are # provided, also output the error to LOG_FD, referencing LINENO. Then exit the -# script with STATUS, using 1 if that was 0. +# script with status $?, using 1 if that was 0. as_fn_error () { - as_status=$1; test $as_status -eq 0 && as_status=1 - if test "$4"; then - as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - $as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4 + as_status=$?; test $as_status -eq 0 && as_status=1 + if test "$3"; then + as_lineno=${as_lineno-"$2"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + $as_echo "$as_me:${as_lineno-$LINENO}: error: $1" >&$3 fi - $as_echo "$as_me: error: $2" >&2 + $as_echo "$as_me: error: $1" >&2 as_fn_exit $as_status } # as_fn_error @@ -20257,7 +20256,7 @@ $as_echo X"$as_dir" | test -d "$as_dir" && break done test -z "$as_dirs" || eval "mkdir $as_dirs" - } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir" + } || test -d "$as_dir" || as_fn_error "cannot create directory $as_dir" } # as_fn_mkdir_p @@ -20311,7 +20310,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # values after options handling. ac_log=" This file was extended by emacs $as_me 24.0.50, which was -generated by GNU Autoconf 2.67. Invocation command line was +generated by GNU Autoconf 2.65. Invocation command line was CONFIG_FILES = $CONFIG_FILES CONFIG_HEADERS = $CONFIG_HEADERS @@ -20377,10 +20376,10 @@ cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ emacs config.status 24.0.50 -configured by $0, generated by GNU Autoconf 2.67, +configured by $0, generated by GNU Autoconf 2.65, with options \\"\$ac_cs_config\\" -Copyright (C) 2010 Free Software Foundation, Inc. +Copyright (C) 2009 Free Software Foundation, Inc. This config.status script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it." @@ -20398,16 +20397,11 @@ ac_need_defaults=: while test $# != 0 do case $1 in - --*=?*) + --*=*) ac_option=`expr "X$1" : 'X\([^=]*\)='` ac_optarg=`expr "X$1" : 'X[^=]*=\(.*\)'` ac_shift=: ;; - --*=) - ac_option=`expr "X$1" : 'X\([^=]*\)='` - ac_optarg= - ac_shift=: - ;; *) ac_option=$1 ac_optarg=$2 @@ -20429,7 +20423,6 @@ do $ac_shift case $ac_optarg in *\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;; - '') as_fn_error $? "missing file argument" ;; esac as_fn_append CONFIG_FILES " '$ac_optarg'" ac_need_defaults=false;; @@ -20442,7 +20435,7 @@ do ac_need_defaults=false;; --he | --h) # Conflict between --help and --header - as_fn_error $? "ambiguous option: \`$1' + as_fn_error "ambiguous option: \`$1' Try \`$0 --help' for more information.";; --help | --hel | -h ) $as_echo "$ac_cs_usage"; exit ;; @@ -20451,7 +20444,7 @@ Try \`$0 --help' for more information.";; ac_cs_silent=: ;; # This is an error. - -*) as_fn_error $? "unrecognized option: \`$1' + -*) as_fn_error "unrecognized option: \`$1' Try \`$0 --help' for more information." ;; *) as_fn_append ac_config_targets " $1" @@ -20525,7 +20518,7 @@ do "epaths") CONFIG_COMMANDS="$CONFIG_COMMANDS epaths" ;; "gdbinit") CONFIG_COMMANDS="$CONFIG_COMMANDS gdbinit" ;; - *) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5 ;; + *) as_fn_error "invalid argument: \`$ac_config_target'" "$LINENO" 5;; esac done @@ -20563,7 +20556,7 @@ $debug || { tmp=./conf$$-$RANDOM (umask 077 && mkdir "$tmp") -} || as_fn_error $? "cannot create a temporary directory in ." "$LINENO" 5 +} || as_fn_error "cannot create a temporary directory in ." "$LINENO" 5 # Set up the scripts for CONFIG_FILES section. # No need to generate them if there are no CONFIG_FILES. @@ -20597,7 +20590,7 @@ if test "x$ac_cr" = x; then fi ac_cs_awk_cr=`$AWK 'BEGIN { print "a\rb" }' /dev/null` if test "$ac_cs_awk_cr" = "a${ac_cr}b"; then - ac_cs_awk_cr='\\r' + ac_cs_awk_cr='\r' else ac_cs_awk_cr=$ac_cr fi @@ -20614,7 +20607,7 @@ _ACEOF echo "_ACEOF" } >conf$$files.sh && . ./conf$$files.sh || - as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 + as_fn_error "could not make $CONFIG_STATUS" "$LINENO" 5 rm -f conf$$files.sh { @@ -20622,18 +20615,18 @@ rm -f conf$$files.sh echo "$ac_subst_vars" | sed 's/.*/&!$&$ac_delim/' && echo "_ACEOF" } >conf$$subs.sh || - as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 -ac_delim_num=`echo "$ac_subst_vars" | grep -c '^'` + as_fn_error "could not make $CONFIG_STATUS" "$LINENO" 5 +ac_delim_num=`echo "$ac_subst_vars" | grep -c '$'` ac_delim='%!_!# ' for ac_last_try in false false false false false :; do . ./conf$$subs.sh || - as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 + as_fn_error "could not make $CONFIG_STATUS" "$LINENO" 5 ac_delim_n=`sed -n "s/.*$ac_delim\$/X/p" conf$$subs.awk | grep -c X` if test $ac_delim_n = $ac_delim_num; then break elif $ac_last_try; then - as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 + as_fn_error "could not make $CONFIG_STATUS" "$LINENO" 5 else ac_delim="$ac_delim!$ac_delim _$ac_delim!! " fi @@ -20728,28 +20721,20 @@ if sed "s/$ac_cr//" < /dev/null > /dev/null 2>&1; then else cat fi < "$tmp/subs1.awk" > "$tmp/subs.awk" \ - || as_fn_error $? "could not setup config files machinery" "$LINENO" 5 + || as_fn_error "could not setup config files machinery" "$LINENO" 5 _ACEOF -# VPATH may cause trouble with some makes, so we remove sole $(srcdir), -# ${srcdir} and @srcdir@ entries from VPATH if srcdir is ".", strip leading and +# VPATH may cause trouble with some makes, so we remove $(srcdir), +# ${srcdir} and @srcdir@ from VPATH if srcdir is ".", strip leading and # trailing colons and then remove the whole line if VPATH becomes empty # (actually we leave an empty line to preserve line numbers). if test "x$srcdir" = x.; then - ac_vpsub='/^[ ]*VPATH[ ]*=[ ]*/{ -h -s/// -s/^/:/ -s/[ ]*$/:/ -s/:\$(srcdir):/:/g -s/:\${srcdir}:/:/g -s/:@srcdir@:/:/g -s/^:*// + ac_vpsub='/^[ ]*VPATH[ ]*=/{ +s/:*\$(srcdir):*/:/ +s/:*\${srcdir}:*/:/ +s/:*@srcdir@:*/:/ +s/^\([^=]*=[ ]*\):*/\1/ s/:*$// -x -s/\(=[ ]*\).*/\1/ -G -s/\n// s/^[^=]*=[ ]*$// }' fi @@ -20777,7 +20762,7 @@ for ac_last_try in false false :; do if test -z "$ac_t"; then break elif $ac_last_try; then - as_fn_error $? "could not make $CONFIG_HEADERS" "$LINENO" 5 + as_fn_error "could not make $CONFIG_HEADERS" "$LINENO" 5 else ac_delim="$ac_delim!$ac_delim _$ac_delim!! " fi @@ -20862,7 +20847,7 @@ cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 _ACAWK _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 - as_fn_error $? "could not setup config headers machinery" "$LINENO" 5 + as_fn_error "could not setup config headers machinery" "$LINENO" 5 fi # test -n "$CONFIG_HEADERS" @@ -20875,7 +20860,7 @@ do esac case $ac_mode$ac_tag in :[FHL]*:*);; - :L* | :C*:*) as_fn_error $? "invalid tag \`$ac_tag'" "$LINENO" 5 ;; + :L* | :C*:*) as_fn_error "invalid tag \`$ac_tag'" "$LINENO" 5;; :[FH]-) ac_tag=-:-;; :[FH]*) ac_tag=$ac_tag:$ac_tag.in;; esac @@ -20903,7 +20888,7 @@ do [\\/$]*) false;; *) test -f "$srcdir/$ac_f" && ac_f="$srcdir/$ac_f";; esac || - as_fn_error 1 "cannot find input file: \`$ac_f'" "$LINENO" 5 ;; + as_fn_error "cannot find input file: \`$ac_f'" "$LINENO" 5;; esac case $ac_f in *\'*) ac_f=`$as_echo "$ac_f" | sed "s/'/'\\\\\\\\''/g"`;; esac as_fn_append ac_file_inputs " '$ac_f'" @@ -20930,7 +20915,7 @@ $as_echo "$as_me: creating $ac_file" >&6;} case $ac_tag in *:-:* | *:-) cat >"$tmp/stdin" \ - || as_fn_error $? "could not create $ac_file" "$LINENO" 5 ;; + || as_fn_error "could not create $ac_file" "$LINENO" 5 ;; esac ;; esac @@ -21072,22 +21057,22 @@ if $ac_cs_awk_getline; then else $AWK -f "$tmp/subs.awk" | $SHELL fi >$tmp/out \ - || as_fn_error $? "could not create $ac_file" "$LINENO" 5 + || as_fn_error "could not create $ac_file" "$LINENO" 5 test -z "$ac_datarootdir_hack$ac_datarootdir_seen" && { ac_out=`sed -n '/\${datarootdir}/p' "$tmp/out"`; test -n "$ac_out"; } && { ac_out=`sed -n '/^[ ]*datarootdir[ ]*:*=/p' "$tmp/out"`; test -z "$ac_out"; } && { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file contains a reference to the variable \`datarootdir' -which seems to be undefined. Please make sure it is defined" >&5 +which seems to be undefined. Please make sure it is defined." >&5 $as_echo "$as_me: WARNING: $ac_file contains a reference to the variable \`datarootdir' -which seems to be undefined. Please make sure it is defined" >&2;} +which seems to be undefined. Please make sure it is defined." >&2;} rm -f "$tmp/stdin" case $ac_file in -) cat "$tmp/out" && rm -f "$tmp/out";; *) rm -f "$ac_file" && mv "$tmp/out" "$ac_file";; esac \ - || as_fn_error $? "could not create $ac_file" "$LINENO" 5 + || as_fn_error "could not create $ac_file" "$LINENO" 5 ;; :H) # @@ -21098,19 +21083,19 @@ which seems to be undefined. Please make sure it is defined" >&2;} $as_echo "/* $configure_input */" \ && eval '$AWK -f "$tmp/defines.awk"' "$ac_file_inputs" } >"$tmp/config.h" \ - || as_fn_error $? "could not create $ac_file" "$LINENO" 5 + || as_fn_error "could not create $ac_file" "$LINENO" 5 if diff "$ac_file" "$tmp/config.h" >/dev/null 2>&1; then { $as_echo "$as_me:${as_lineno-$LINENO}: $ac_file is unchanged" >&5 $as_echo "$as_me: $ac_file is unchanged" >&6;} else rm -f "$ac_file" mv "$tmp/config.h" "$ac_file" \ - || as_fn_error $? "could not create $ac_file" "$LINENO" 5 + || as_fn_error "could not create $ac_file" "$LINENO" 5 fi else $as_echo "/* $configure_input */" \ && eval '$AWK -f "$tmp/defines.awk"' "$ac_file_inputs" \ - || as_fn_error $? "could not create -" "$LINENO" 5 + || as_fn_error "could not create -" "$LINENO" 5 fi # Compute "$ac_file"'s index in $config_headers. _am_arg="$ac_file" @@ -21275,7 +21260,7 @@ _ACEOF ac_clean_files=$ac_clean_files_save test $ac_write_fail = 0 || - as_fn_error $? "write failure creating $CONFIG_STATUS" "$LINENO" 5 + as_fn_error "write failure creating $CONFIG_STATUS" "$LINENO" 5 # configure is writing to config.log, and then calls config.status. @@ -21296,7 +21281,7 @@ if test "$no_create" != yes; then exec 5>>config.log # Use ||, not &&, to avoid exiting from the if with $? = 1, which # would make configure fail if this is the last instruction. - $ac_cs_success || as_fn_exit 1 + $ac_cs_success || as_fn_exit $? fi if test -n "$ac_unrecognized_opts" && test "$enable_option_checking" != no; then { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: unrecognized options: $ac_unrecognized_opts" >&5 diff --git a/configure.in b/configure.in index 69d1a1e5bd3..086a7e12d67 100644 --- a/configure.in +++ b/configure.in @@ -1826,8 +1826,8 @@ fi HAVE_GTK=no if test "${with_gtk3}" = "yes"; then - GLIB_REQUIRED=2.6 - GTK_REQUIRED=2.90 + GLIB_REQUIRED=2.28 + GTK_REQUIRED=3.0 GTK_MODULES="gtk+-3.0 >= $GTK_REQUIRED glib-2.0 >= $GLIB_REQUIRED" dnl Checks for libraries. @@ -1835,6 +1835,7 @@ if test "${with_gtk3}" = "yes"; then if test "$pkg_check_gtk" = "no" && test "$USE_X_TOOLKIT" != "maybe"; then AC_MSG_ERROR($GTK_PKG_ERRORS) fi + AC_DEFINE(HAVE_GTK3, 1, [Define to 1 if using GTK 3 or later.]) fi if test "$pkg_check_gtk" != "yes"; then diff --git a/doc/emacs/ChangeLog b/doc/emacs/ChangeLog index a2708b454f4..1c8ca4bc322 100644 --- a/doc/emacs/ChangeLog +++ b/doc/emacs/ChangeLog @@ -1,3 +1,8 @@ +2011-03-08 Jan Djärv + + * xresources.texi (GTK resources): ~/.emacs.d/gtkrc does not work + for Gtk+ 3. + 2011-03-08 Glenn Morris * display.texi (Optional Mode Line): Don't mention exactly where diff --git a/doc/emacs/xresources.texi b/doc/emacs/xresources.texi index 41a09a5f713..33ea83d7d6e 100644 --- a/doc/emacs/xresources.texi +++ b/doc/emacs/xresources.texi @@ -660,8 +660,11 @@ The color for the border shadow, on the top and the left. @iftex The most common way to customize the GTK widgets Emacs uses (menus, dialogs tool bars and scroll bars) is by choosing an appropriate theme, for example -with the GNOME theme selector. You can also do Emacs specific customization -by inserting GTK style directives in the file @file{~/.emacs.d/gtkrc}. Some GTK +with the GNOME theme selector. + +You can also do Emacs specific customization +by inserting GTK style directives in the file @file{~/.emacs.d/gtkrc}, +but only if you have a Gtk+ version earlier than 3 (i.e. 2). Some GTK themes ignore customizations in @file{~/.emacs.d/gtkrc} so not everything works with all themes. To customize Emacs font, background, faces, etc., use the normal X resources (@pxref{Resources}). We will present some examples of diff --git a/src/ChangeLog b/src/ChangeLog index b73e3d0c860..ff5ee064a92 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,55 @@ +2011-03-08 Jan Djärv + + * xterm.h (DEFAULT_GDK_DISPLAY): New define. + (GDK_WINDOW_XID, gtk_widget_get_preferred_size): New defines + for ! HAVE_GTK3. + (GTK_WIDGET_TO_X_WIN): Use GDK_WINDOW_XID. + + * xmenu.c (menu_position_func): Call gtk_widget_get_preferred_size. + + * gtkutil.c: Include gtkx.h if HAVE_GTK3. If ! HAVE_GTK3, define + gdk_window_get_screen, gdk_window_get_geometry, + gdk_x11_window_lookup_for_display and GDK_KEY_g. + (xg_set_screen): Use DEFAULT_GDK_DISPLAY. + (xg_get_pixbuf_from_pixmap): New function. + (xg_get_pixbuf_from_pix_and_mask): Change parameters from GdkPixmap + to Pixmap, take frame as parameter, remove GdkColormap parameter. + Call xg_get_pixbuf_from_pixmap instead of + gdk_pixbuf_get_from_drawable. + (xg_get_image_for_pixmap): Do not make GdkPixmaps, call + xg_get_pixbuf_from_pix_and_mask with Pixmap parameters instead. + (xg_check_special_colors): Use GtkStyleContext and its functions + for HAVE_GTK3. + (xg_prepare_tooltip, xg_hide_tooltip): Call gdk_window_get_screen. + (xg_prepare_tooltip, create_dialog, menubar_map_cb) + (xg_update_frame_menubar, xg_tool_bar_detach_callback) + (xg_tool_bar_attach_callback, xg_update_tool_bar_sizes): Call + gtk_widget_get_preferred_size. + (xg_frame_resized): gdk_window_get_geometry only takes 5 + parameters. + (xg_win_to_widget, xg_event_is_for_menubar): Call + gdk_x11_window_lookup_for_display. + (xg_set_widget_bg): New function. + (delete_cb): New function. + (xg_create_frame_widgets): connect delete-event to delete_cb. + Call xg_set_widget_bg. Only set backgrund pixmap for ! HAVE_GTK3 + (xg_set_background_color): Call xg_set_widget_bg. + (xg_set_frame_icon): Call xg_get_pixbuf_from_pix_and_mask. + (xg_create_scroll_bar): vadj is a GtkAdjustment for HAVE_GTK3. + Only call gtk_range_set_update_policy if ! HAVE_GTK3. + (xg_make_tool_item): Only connect xg_tool_bar_item_expose_callback + if ! HAVE_GTK3. + (update_frame_tool_bar): Call gtk_widget_hide. + (xg_initialize): Use GDK_KEY_g. + + * xsmfns.c (gdk_set_sm_client_id): Define to gdk_set_sm_client_id + if ! HAVE_GTK3 + (x_session_initialize): Call gdk_x11_set_sm_client_id. + + * xterm.c (XFillRectangle): Use cairo routines for HAVE_GTK3. + (x_term_init): Disable Xinput(2) with GDK_CORE_DEVICE_EVENTS. + Load ~/emacs.d/gtkrc only for ! HAVE_GTK3. + 2011-03-08 Juanma Barranquero * w32xfns.c (select_palette): Check success of RealizePalette against diff --git a/src/config.in b/src/config.in index 7f33727c0b1..8889213b781 100644 --- a/src/config.in +++ b/src/config.in @@ -285,6 +285,9 @@ along with GNU Emacs. If not, see . */ /* Define to 1 if you have the `grantpt' function. */ #undef HAVE_GRANTPT +/* Define to 1 if using GTK 3 or later. */ +#undef HAVE_GTK3 + /* Define to 1 if you have the `gtk_adjustment_get_page_size' function. */ #undef HAVE_GTK_ADJUSTMENT_GET_PAGE_SIZE diff --git a/src/gtkutil.c b/src/gtkutil.c index 6ecd5d624af..b1ea6336eb6 100644 --- a/src/gtkutil.c +++ b/src/gtkutil.c @@ -40,6 +40,10 @@ along with GNU Emacs. If not, see . */ #include #endif +#ifdef HAVE_GTK3 +#include +#endif + #define FRAME_TOTAL_PIXEL_HEIGHT(f) \ (FRAME_PIXEL_HEIGHT (f) + FRAME_MENUBAR_HEIGHT (f) + FRAME_TOOLBAR_HEIGHT (f)) @@ -69,6 +73,15 @@ along with GNU Emacs. If not, see . */ #define remove_submenu(w) gtk_menu_item_remove_submenu ((w)) #endif +#ifndef HAVE_GTK3 +#define gdk_window_get_screen(w) gdk_drawable_get_screen (w) +#define gdk_window_get_geometry(w, a, b, c, d) \ + gdk_window_get_geometry (w, a, b, c, d, 0) +#define gdk_x11_window_lookup_for_display(d, w) \ + gdk_xid_table_lookup_for_display (d, w) +#define GDK_KEY_g GDK_g +#endif + #define XG_BIN_CHILD(x) gtk_bin_get_child (GTK_BIN (x)) @@ -88,7 +101,7 @@ static GdkDisplay *gdpy_def; static void xg_set_screen (GtkWidget *w, FRAME_PTR f) { - if (FRAME_X_DISPLAY (f) != GDK_DISPLAY ()) + if (FRAME_X_DISPLAY (f) != DEFAULT_GDK_DISPLAY ()) { GdkDisplay *gdpy = gdk_x11_lookup_xdisplay (FRAME_X_DISPLAY (f)); GdkScreen *gscreen = gdk_display_get_default_screen (gdpy); @@ -229,29 +242,55 @@ xg_create_default_cursor (Display *dpy) return gdk_cursor_new_for_display (gdpy, GDK_LEFT_PTR); } +static GdkPixbuf * +xg_get_pixbuf_from_pixmap (FRAME_PTR f, Pixmap pix) +{ + int iunused; + GdkPixbuf *tmp_buf; + Window wunused; + unsigned int width, height, uunused; + XImage *xim; + + XGetGeometry (FRAME_X_DISPLAY (f), pix, &wunused, &iunused, &iunused, + &width, &height, &uunused, &uunused); + + xim = XGetImage (FRAME_X_DISPLAY (f), pix, 0, 0, width, height, + ~0, XYPixmap); + if (!xim) return 0; + + tmp_buf = gdk_pixbuf_new_from_data (xim->data, + GDK_COLORSPACE_RGB, + FALSE, + xim->bitmap_unit, + (int) width, + (int) height, + xim->bytes_per_line, + NULL, + NULL); + XDestroyImage (xim); + return tmp_buf; +} + /* Apply GMASK to GPIX and return a GdkPixbuf with an alpha channel. */ static GdkPixbuf * -xg_get_pixbuf_from_pix_and_mask (GdkPixmap *gpix, - GdkPixmap *gmask, - GdkColormap *cmap) +xg_get_pixbuf_from_pix_and_mask (FRAME_PTR f, + Pixmap pix, + Pixmap mask) { int width, height; GdkPixbuf *icon_buf, *tmp_buf; - gdk_drawable_get_size (gpix, &width, &height); - tmp_buf = gdk_pixbuf_get_from_drawable (NULL, gpix, cmap, - 0, 0, 0, 0, width, height); + tmp_buf = xg_get_pixbuf_from_pixmap (f, pix); icon_buf = gdk_pixbuf_add_alpha (tmp_buf, FALSE, 0, 0, 0); g_object_unref (G_OBJECT (tmp_buf)); - if (gmask) + width = gdk_pixbuf_get_width (icon_buf); + height = gdk_pixbuf_get_height (icon_buf); + + if (mask) { - GdkPixbuf *mask_buf = gdk_pixbuf_get_from_drawable (NULL, - gmask, - NULL, - 0, 0, 0, 0, - width, height); + GdkPixbuf *mask_buf = xg_get_pixbuf_from_pixmap (f, mask); guchar *pixels = gdk_pixbuf_get_pixels (icon_buf); guchar *mask_pixels = gdk_pixbuf_get_pixels (mask_buf); int rowstride = gdk_pixbuf_get_rowstride (icon_buf); @@ -316,10 +355,6 @@ xg_get_image_for_pixmap (FRAME_PTR f, GtkWidget *widget, GtkImage *old_widget) { - GdkPixmap *gpix; - GdkPixmap *gmask; - GdkDisplay *gdpy; - GdkColormap *cmap; GdkPixbuf *icon_buf; /* If we have a file, let GTK do all the image handling. @@ -347,10 +382,6 @@ xg_get_image_for_pixmap (FRAME_PTR f, on a monochrome display, and sometimes bad on all displays with certain themes. */ - gdpy = gdk_x11_lookup_xdisplay (FRAME_X_DISPLAY (f)); - gpix = gdk_pixmap_foreign_new_for_display (gdpy, img->pixmap); - gmask = img->mask ? gdk_pixmap_foreign_new_for_display (gdpy, img->mask) : 0; - /* This is a workaround to make icons look good on pseudo color displays. Apparently GTK expects the images to have an alpha channel. If they don't, insensitive and activated icons will @@ -360,18 +391,17 @@ xg_get_image_for_pixmap (FRAME_PTR f, not associated with the img->pixmap. The img->pixmap may be removed by clearing the image cache and then the tool bar redraw fails, since Gtk+ assumes the pixmap is always there. */ - cmap = gtk_widget_get_colormap (widget); - icon_buf = xg_get_pixbuf_from_pix_and_mask (gpix, gmask, cmap); - - if (! old_widget) - old_widget = GTK_IMAGE (gtk_image_new_from_pixbuf (icon_buf)); - else - gtk_image_set_from_pixbuf (old_widget, icon_buf); + icon_buf = xg_get_pixbuf_from_pix_and_mask (f, img->pixmap, img->mask); - g_object_unref (G_OBJECT (icon_buf)); + if (icon_buf) + { + if (! old_widget) + old_widget = GTK_IMAGE (gtk_image_new_from_pixbuf (icon_buf)); + else + gtk_image_set_from_pixbuf (old_widget, icon_buf); - g_object_unref (G_OBJECT (gpix)); - if (gmask) g_object_unref (G_OBJECT (gmask)); + g_object_unref (G_OBJECT (icon_buf)); + } return GTK_WIDGET (old_widget); } @@ -514,28 +544,43 @@ xg_check_special_colors (struct frame *f, XColor *color) { int success_p = 0; - if (FRAME_GTK_WIDGET (f)) - { - if (strcmp ("gtk_selection_bg_color", color_name) == 0) - { - GtkStyle *gsty = gtk_widget_get_style (FRAME_GTK_WIDGET (f)); - color->red = gsty->bg[GTK_STATE_SELECTED].red; - color->green = gsty->bg[GTK_STATE_SELECTED].green; - color->blue = gsty->bg[GTK_STATE_SELECTED].blue; - color->pixel = gsty->bg[GTK_STATE_SELECTED].pixel; - success_p = 1; - } - else if (strcmp ("gtk_selection_fg_color", color_name) == 0) - { - GtkStyle *gsty = gtk_widget_get_style (FRAME_GTK_WIDGET (f)); - color->red = gsty->fg[GTK_STATE_SELECTED].red; - color->green = gsty->fg[GTK_STATE_SELECTED].green; - color->blue = gsty->fg[GTK_STATE_SELECTED].blue; - color->pixel = gsty->fg[GTK_STATE_SELECTED].pixel; - success_p = 1; - } - } + int get_bg = strcmp ("gtk_selection_bg_color", color_name) == 0; + int get_fg = !get_bg && strcmp ("gtk_selection_fg_color", color_name) == 0; + + if (! FRAME_GTK_WIDGET (f) || ! (get_bg || get_fg)) + return success_p; + + BLOCK_INPUT; + { +#ifdef HAVE_GTK3 + GtkStyleContext *gsty + = gtk_widget_get_style_context (FRAME_GTK_OUTER_WIDGET (f)); + GdkRGBA col; + char buf[64]; + int state = GTK_STATE_FLAG_SELECTED|GTK_STATE_FLAG_FOCUSED; + if (get_fg) + gtk_style_context_get_color (gsty, state, &col); + else + gtk_style_context_get_background_color (gsty, state, &col); + + sprintf (buf, "rgbi:%lf/%lf/%lf", col.red, col.green, col.blue); + success_p = XParseColor (FRAME_X_DISPLAY (f), FRAME_X_COLORMAP (f), + buf, color); +#else + GtkStyle *gsty = gtk_widget_get_style (FRAME_GTK_WIDGET (f)); + GdkColor *grgb = get_bg + ? &gsty->bg[GTK_STATE_SELECTED] + : &gsty->fg[GTK_STATE_SELECTED]; + + color->red = grgb->red; + color->green = grgb->green; + color->blue = grgb->blue; + color->pixel = grgb->pixel; + success_p = 1; +#endif + } + UNBLOCK_INPUT; return success_p; } @@ -629,7 +674,7 @@ xg_prepare_tooltip (FRAME_PTR f, encoded_string = ENCODE_UTF_8 (string); widget = GTK_WIDGET (x->ttip_lbl); gwin = gtk_widget_get_window (GTK_WIDGET (x->ttip_window)); - screen = gdk_drawable_get_screen (gwin); + screen = gdk_window_get_screen (gwin); settings = gtk_settings_get_for_screen (screen); g_object_get (settings, "gtk-enable-tooltips", &tt_enabled, NULL); if (tt_enabled) @@ -650,7 +695,7 @@ xg_prepare_tooltip (FRAME_PTR f, gtk_tooltip_set_custom (x->ttip_widget, widget); gtk_tooltip_set_text (x->ttip_widget, SDATA (encoded_string)); - gtk_widget_size_request (GTK_WIDGET (x->ttip_window), &req); + gtk_widget_get_preferred_size (GTK_WIDGET (x->ttip_window), NULL, &req); if (width) *width = req.width; if (height) *height = req.height; @@ -696,7 +741,7 @@ xg_hide_tooltip (FRAME_PTR f) if (g_object_get_data (G_OBJECT (win), "restore-tt")) { GdkWindow *gwin = gtk_widget_get_window (GTK_WIDGET (win)); - GdkScreen *screen = gdk_drawable_get_screen (gwin); + GdkScreen *screen = gdk_window_get_screen (gwin); GtkSettings *settings = gtk_settings_get_for_screen (screen); g_object_set (settings, "gtk-enable-tooltips", TRUE, NULL); } @@ -797,7 +842,7 @@ xg_frame_resized (FRAME_PTR f, int pixelwidth, int pixelheight) 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); + &pixelwidth, &pixelheight); else return; } @@ -910,8 +955,8 @@ xg_win_to_widget (Display *dpy, Window wdesc) BLOCK_INPUT; - gdkwin = gdk_xid_table_lookup_for_display (gdk_x11_lookup_xdisplay (dpy), - wdesc); + gdkwin = gdk_x11_window_lookup_for_display (gdk_x11_lookup_xdisplay (dpy), + wdesc); if (gdkwin) { GdkEvent event; @@ -923,14 +968,29 @@ xg_win_to_widget (Display *dpy, Window wdesc) return gwdesc; } -/* Fill in the GdkColor C so that it represents PIXEL. - W is the widget that color will be used for. Used to find colormap. */ +/* Set the background of widget W to PIXEL. */ static void -xg_pix_to_gcolor (GtkWidget *w, long unsigned int pixel, GdkColor *c) +xg_set_widget_bg (FRAME_PTR f, GtkWidget *w, long unsigned int pixel) { +#ifdef HAVE_GTK3 + GdkRGBA bg; + XColor xbg; + xbg.pixel = pixel; + if (XQueryColor (FRAME_X_DISPLAY (f), FRAME_X_COLORMAP (f), &xbg)) + { + bg.red = (double)xbg.red/65536.0; + bg.green = (double)xbg.green/65536.0; + bg.blue = (double)xbg.blue/65536.0; + bg.alpha = 1.0; + gtk_widget_override_background_color (w, GTK_STATE_FLAG_NORMAL, &bg); + } +#else + GdkColor bg; GdkColormap *map = gtk_widget_get_colormap (w); - gdk_colormap_query_color (map, pixel, c); + gdk_colormap_query_color (map, pixel, &bg); + gtk_widget_modify_bg (FRAME_GTK_WIDGET (f), GTK_STATE_NORMAL, &bg); +#endif } /* Callback called when the gtk theme changes. @@ -953,6 +1013,28 @@ style_changed_cb (GObject *go, kbd_buffer_store_event (&event); } +/* Called when a delete-event occurs on WIDGET. */ + +static gboolean +delete_cb (GtkWidget *widget, + GdkEvent *event, + gpointer user_data) +{ +#ifdef HAVE_GTK3 + /* The event doesn't arrive in the normal event loop. Send event + here. */ + FRAME_PTR f = (FRAME_PTR) user_data; + struct input_event ie; + + EVENT_INIT (ie); + ie.kind = DELETE_WINDOW_EVENT; + XSETFRAME (ie.frame_or_window, f); + kbd_buffer_store_event (&ie); +#endif + + return TRUE; +} + /* Create and set up the GTK widgets for frame F. Return 0 if creation failed, non-zero otherwise. */ @@ -962,7 +1044,6 @@ xg_create_frame_widgets (FRAME_PTR f) GtkWidget *wtop; GtkWidget *wvbox, *whbox; GtkWidget *wfixed; - GdkColor bg; GtkRcStyle *style; char *title = 0; @@ -1029,7 +1110,7 @@ xg_create_frame_widgets (FRAME_PTR f) /* Add callback to do nothing on WM_DELETE_WINDOW. The default in GTK is to destroy the widget. We want Emacs to do that instead. */ g_signal_connect (G_OBJECT (wtop), "delete-event", - G_CALLBACK (gtk_true), 0); + G_CALLBACK (delete_cb), f); /* Convert our geometry parameters into a geometry string and specify it. @@ -1057,9 +1138,9 @@ xg_create_frame_widgets (FRAME_PTR f) /* Since GTK clears its window by filling with the background color, we must keep X and GTK background in sync. */ - xg_pix_to_gcolor (wfixed, FRAME_BACKGROUND_PIXEL (f), &bg); - gtk_widget_modify_bg (wfixed, GTK_STATE_NORMAL, &bg); + xg_set_widget_bg (f, wfixed, FRAME_BACKGROUND_PIXEL (f)); +#ifndef HAVE_GTK3 /* Also, do not let any background pixmap to be set, this looks very bad as Emacs overwrites the background pixmap with its own idea of background color. */ @@ -1068,6 +1149,9 @@ xg_create_frame_widgets (FRAME_PTR f) /* Must use g_strdup because gtk_widget_modify_style does g_free. */ style->bg_pixmap_name[GTK_STATE_NORMAL] = g_strdup (""); gtk_widget_modify_style (wfixed, style); +#else + gtk_widget_set_can_focus (wfixed, TRUE); +#endif #ifdef USE_GTK_TOOLTIP /* Steal a tool tip window we can move ourselves. */ @@ -1224,11 +1308,8 @@ xg_set_background_color (FRAME_PTR f, long unsigned int bg) { if (FRAME_GTK_WIDGET (f)) { - GdkColor gdk_bg; - BLOCK_INPUT; - xg_pix_to_gcolor (FRAME_GTK_WIDGET (f), bg, &gdk_bg); - gtk_widget_modify_bg (FRAME_GTK_WIDGET (f), GTK_STATE_NORMAL, &gdk_bg); + xg_set_widget_bg (f, FRAME_GTK_WIDGET (f), FRAME_BACKGROUND_PIXEL (f)); UNBLOCK_INPUT; } } @@ -1240,11 +1321,10 @@ xg_set_background_color (FRAME_PTR f, long unsigned int bg) void xg_set_frame_icon (FRAME_PTR f, Pixmap icon_pixmap, Pixmap icon_mask) { - GdkDisplay *gdpy = gdk_x11_lookup_xdisplay (FRAME_X_DISPLAY (f)); - GdkPixmap *gpix = gdk_pixmap_foreign_new_for_display (gdpy, icon_pixmap); - GdkPixmap *gmask = gdk_pixmap_foreign_new_for_display (gdpy, icon_mask); - GdkPixbuf *gp = xg_get_pixbuf_from_pix_and_mask (gpix, gmask, NULL); - + GdkPixbuf *gp = xg_get_pixbuf_from_pix_and_mask (f, + icon_pixmap, + icon_mask); + if (gp) gtk_window_set_icon (GTK_WINDOW (FRAME_GTK_OUTER_WIDGET (f)), gp); } @@ -1381,7 +1461,7 @@ create_dialog (widget_value *wv, /* 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_widget_get_preferred_size (w, NULL, &req); gtk_box_set_spacing (wvbox, req.height); if (item->value && strlen (item->value) > 0) button_spacing = 2*req.width/strlen (item->value); @@ -3028,7 +3108,7 @@ menubar_map_cb (GtkWidget *w, gpointer user_data) { GtkRequisition req; FRAME_PTR f = (FRAME_PTR) user_data; - gtk_widget_size_request (w, &req); + gtk_widget_get_preferred_size (w, NULL, &req); if (FRAME_MENUBAR_HEIGHT (f) != req.height) { FRAME_MENUBAR_HEIGHT (f) = req.height; @@ -3059,7 +3139,7 @@ xg_update_frame_menubar (FRAME_PTR f) g_signal_connect (x->menubar_widget, "map", G_CALLBACK (menubar_map_cb), f); gtk_widget_show_all (x->menubar_widget); - gtk_widget_size_request (x->menubar_widget, &req); + gtk_widget_get_preferred_size (x->menubar_widget, NULL, &req); /* If menu bar doesn't know its height yet, cheat a little so the frame doesn't jump so much when resized later in menubar_map_cb. */ @@ -3120,7 +3200,7 @@ xg_event_is_for_menubar (FRAME_PTR f, XEvent *event) return 0; gdpy = gdk_x11_lookup_xdisplay (FRAME_X_DISPLAY (f)); - gw = gdk_xid_table_lookup_for_display (gdpy, event->xbutton.window); + gw = gdk_x11_window_lookup_for_display (gdpy, event->xbutton.window); if (! gw) return 0; gevent.any.window = gw; gwdesc = gtk_get_event_widget (&gevent); @@ -3284,8 +3364,12 @@ xg_create_scroll_bar (FRAME_PTR f, { GtkWidget *wscroll; GtkWidget *webox; - GtkObject *vadj; int scroll_id; +#ifdef HAVE_GTK3 + GtkAdjustment *vadj; +#else + GtkObject *vadj; +#endif /* Page, step increment values are not so important here, they will be corrected in x_set_toolkit_scroll_bar_thumb. */ @@ -3295,7 +3379,9 @@ xg_create_scroll_bar (FRAME_PTR f, wscroll = gtk_vscrollbar_new (GTK_ADJUSTMENT (vadj)); webox = gtk_event_box_new (); gtk_widget_set_name (wscroll, scroll_bar_name); +#ifndef HAVE_GTK3 gtk_range_set_update_policy (GTK_RANGE (wscroll), GTK_UPDATE_CONTINUOUS); +#endif g_object_set_data (G_OBJECT (wscroll), XG_FRAME_DATA, (gpointer)f); scroll_id = xg_store_widget_in_map (wscroll); @@ -3793,8 +3879,8 @@ xg_tool_bar_detach_callback (GtkHandleBox *wbox, { GtkRequisition req, req2; FRAME_X_OUTPUT (f)->toolbar_detached = 1; - gtk_widget_size_request (GTK_WIDGET (wbox), &req); - gtk_widget_size_request (w, &req2); + gtk_widget_get_preferred_size (GTK_WIDGET (wbox), NULL, &req); + gtk_widget_get_preferred_size (w, NULL, &req2); req.width -= req2.width; req.height -= req2.height; if (FRAME_TOOLBAR_TOP_HEIGHT (f) != 0) @@ -3828,8 +3914,8 @@ xg_tool_bar_attach_callback (GtkHandleBox *wbox, { GtkRequisition req, req2; FRAME_X_OUTPUT (f)->toolbar_detached = 0; - gtk_widget_size_request (GTK_WIDGET (wbox), &req); - gtk_widget_size_request (w, &req2); + gtk_widget_get_preferred_size (GTK_WIDGET (wbox), NULL, &req); + gtk_widget_get_preferred_size (w, NULL, &req2); req.width += req2.width; req.height += req2.height; if (FRAME_TOOLBAR_TOP_HEIGHT (f) != 0) @@ -3894,6 +3980,7 @@ xg_tool_bar_help_callback (GtkWidget *w, Returns FALSE to tell GTK to keep processing this event. */ +#ifndef HAVE_GTK3 static gboolean xg_tool_bar_item_expose_callback (GtkWidget *w, GdkEventExpose *event, @@ -3902,7 +3989,6 @@ xg_tool_bar_item_expose_callback (GtkWidget *w, gint width, height; gdk_drawable_get_size (event->window, &width, &height); - event->area.x -= width > event->area.width ? width-event->area.width : 0; event->area.y -= height > event->area.height ? height-event->area.height : 0; @@ -3914,6 +4000,7 @@ xg_tool_bar_item_expose_callback (GtkWidget *w, return FALSE; } +#endif #ifdef HAVE_GTK_ORIENTABLE_SET_ORIENTATION #define toolbar_set_orientation(w, o) \ @@ -4063,13 +4150,14 @@ xg_make_tool_item (FRAME_PTR f, g_object_set_data (G_OBJECT (weventbox), XG_FRAME_DATA, (gpointer)f); +#ifndef HAVE_GTK3 /* Catch expose events to overcome an annoying redraw bug, see comment for xg_tool_bar_item_expose_callback. */ g_signal_connect (G_OBJECT (ti), "expose-event", G_CALLBACK (xg_tool_bar_item_expose_callback), 0); - +#endif gtk_tool_item_set_homogeneous (ti, FALSE); /* Callback to save modifyer mask (Shift/Control, etc). GTK makes @@ -4153,7 +4241,7 @@ xg_update_tool_bar_sizes (FRAME_PTR f) GtkRequisition req; int nl = 0, nr = 0, nt = 0, nb = 0; - gtk_widget_size_request (GTK_WIDGET (x->handlebox_widget), &req); + gtk_widget_get_preferred_size (GTK_WIDGET (x->handlebox_widget), NULL, &req); if (x->toolbar_in_hbox) { int pos; @@ -4203,7 +4291,6 @@ update_frame_tool_bar (FRAME_PTR f) GtkToolItem *ti; GtkTextDirection dir; int pack_tool_bar = x->handlebox_widget == NULL; - Lisp_Object style; int text_image, horiz; @@ -4551,13 +4638,13 @@ xg_initialize (void) /* Make dialogs close on C-g. Since file dialog inherits from dialog, this works for them also. */ binding_set = gtk_binding_set_by_class (g_type_class_ref (GTK_TYPE_DIALOG)); - gtk_binding_entry_add_signal (binding_set, GDK_g, GDK_CONTROL_MASK, + gtk_binding_entry_add_signal (binding_set, GDK_KEY_g, GDK_CONTROL_MASK, "close", 0); /* Make menus close on C-g. */ binding_set = gtk_binding_set_by_class (g_type_class_ref (GTK_TYPE_MENU_SHELL)); - gtk_binding_entry_add_signal (binding_set, GDK_g, GDK_CONTROL_MASK, + gtk_binding_entry_add_signal (binding_set, GDK_KEY_g, GDK_CONTROL_MASK, "cancel", 0); } diff --git a/src/xmenu.c b/src/xmenu.c index 934db0f0406..8967437a376 100644 --- a/src/xmenu.c +++ b/src/xmenu.c @@ -1390,7 +1390,7 @@ menu_position_func (GtkMenu *menu, gint *x, gint *y, gboolean *push_in, gpointer /* Check if there is room for the menu. If not, adjust x/y so that the menu is fully visible. */ - gtk_widget_size_request (GTK_WIDGET (menu), &req); + gtk_widget_get_preferred_size (GTK_WIDGET (menu), NULL, &req); if (data->x + req.width > disp_width) *x -= data->x + req.width - disp_width; if (data->y + req.height > disp_height) diff --git a/src/xsmfns.c b/src/xsmfns.c index 825cec451d9..f3879dbcec0 100644 --- a/src/xsmfns.c +++ b/src/xsmfns.c @@ -41,6 +41,10 @@ along with GNU Emacs. If not, see . */ #include "process.h" #include "keyboard.h" +#ifndef HAVE_GTK3 +#define gdk_x11_set_sm_client_id(w) gdk_set_sm_client_id (w) +#endif + /* This is the event used when SAVE_SESSION_EVENT occurs. */ static struct input_event emacs_event; @@ -459,7 +463,7 @@ x_session_initialize (struct x_display_info *dpyinfo) #ifdef USE_GTK /* GTK creats a leader window by itself, but we need to tell it about our client_id. */ - gdk_set_sm_client_id (client_id); + gdk_x11_set_sm_client_id (client_id); #else create_client_leader_window (dpyinfo, client_id); #endif diff --git a/src/xterm.c b/src/xterm.c index 909b6978f5a..bb792d8b9a7 100644 --- a/src/xterm.c +++ b/src/xterm.c @@ -3021,6 +3021,17 @@ XTflash (struct frame *f) /* 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)); +#ifdef HAVE_GTK3 + cairo_t *cr = gdk_cairo_create (window); + cairo_set_source_rgb (cr, 1, 1, 1); + cairo_set_operator (cr, CAIRO_OPERATOR_DIFFERENCE); +#define XFillRectangle(d, win, gc, x, y, w, h) \ + do { \ + cairo_rectangle (cr, x, y, w, h); \ + cairo_fill (cr); \ + } \ + while (0) +#else /* ! HAVE_GTK3 */ GdkGCValues vals; GdkGC *gc; vals.foreground.pixel = (FRAME_FOREGROUND_PIXEL (f) @@ -3030,7 +3041,8 @@ XTflash (struct frame *f) &vals, GDK_GC_FUNCTION | GDK_GC_FOREGROUND); #define XFillRectangle(d, win, gc, x, y, w, h) \ gdk_draw_rectangle (window, gc, TRUE, x, y, w, h) -#else +#endif /* ! HAVE_GTK3 */ +#else /* ! USE_GTK */ GC gc; /* Create a GC that will use the GXxor function to flip foreground @@ -3151,7 +3163,11 @@ XTflash (struct frame *f) width, height - 2 * FRAME_INTERNAL_BORDER_WIDTH (f)); #ifdef USE_GTK +#ifdef HAVE_GTK3 + cairo_destroy (cr); +#else g_object_unref (G_OBJECT (gc)); +#endif #undef XFillRectangle #else XFreeGC (FRAME_X_DISPLAY (f), gc); @@ -9863,6 +9879,13 @@ x_term_init (Lisp_Object display_name, char *xrm_option, char *resource_name) XSetLocaleModifiers (""); + /* Emacs can only handle core input events, so make sure + Gtk doesn't use Xinput or Xinput2 extensions. */ + { + static char fix_events[] = "GDK_CORE_DEVICE_EVENTS=1"; + putenv (fix_events); + } + /* Work around GLib bug that outputs a faulty warning. See https://bugzilla.gnome.org/show_bug.cgi?id=563627. */ id = g_log_set_handler ("GLib", G_LOG_LEVEL_WARNING | G_LOG_FLAG_FATAL @@ -9874,11 +9897,12 @@ x_term_init (Lisp_Object display_name, char *xrm_option, char *resource_name) fixup_locale (); xg_initialize (); - dpy = GDK_DISPLAY (); + dpy = DEFAULT_GDK_DISPLAY (); /* NULL window -> events for all windows go to our function */ gdk_window_add_filter (NULL, event_handler_gdk, NULL); +#if GTK_MAJOR_VERSION <= 2 && GTK_MINOR_VERSION <= 90 /* Load our own gtkrc if it exists. */ { const char *file = "~/.emacs.d/gtkrc"; @@ -9890,6 +9914,7 @@ x_term_init (Lisp_Object display_name, char *xrm_option, char *resource_name) if (! NILP (abs_file) && !NILP (Ffile_readable_p (abs_file))) gtk_rc_parse (SSDATA (abs_file)); } +#endif XSetErrorHandler (x_error_handler); XSetIOErrorHandler (x_io_error_quitter); diff --git a/src/xterm.h b/src/xterm.h index 48d68557796..ee17cfe2bd5 100644 --- a/src/xterm.h +++ b/src/xterm.h @@ -675,9 +675,20 @@ enum #define gtk_adjustment_get_upper(w) ((w)->upper) #endif +#ifdef HAVE_GTK3 +#define DEFAULT_GDK_DISPLAY() \ + gdk_x11_display_get_xdisplay (gdk_display_get_default ()) +#else +#undef GDK_WINDOW_XID +#define GDK_WINDOW_XID(w) GDK_WINDOW_XWINDOW (w) +#define DEFAULT_GDK_DISPLAY() GDK_DISPLAY () +#define gtk_widget_get_preferred_size(a, ign, b) \ + gtk_widget_size_request(a, b) +#endif + #define GTK_WIDGET_TO_X_WIN(w) \ ((w) && gtk_widget_get_window (w) \ - ? GDK_WINDOW_XWINDOW (gtk_widget_get_window (w)) : 0) + ? GDK_WINDOW_XID (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) -- 2.11.4.GIT