diff options
| author | Karoly Lorentey | 2005-12-12 03:15:52 +0000 |
|---|---|---|
| committer | Karoly Lorentey | 2005-12-12 03:15:52 +0000 |
| commit | 5f6a587f307d47878dfa44058c613fefab4ecac3 (patch) | |
| tree | 0e01b9c4d14238d1d8af843268ded8d9dba7e426 | |
| parent | d68058039e1ff5635b2e44509fc242de4f0a286f (diff) | |
| download | emacs-5f6a587f307d47878dfa44058c613fefab4ecac3.tar.gz emacs-5f6a587f307d47878dfa44058c613fefab4ecac3.zip | |
Prevent core dumps with GTK by disabling secondary X connections there.
* src/xterm.c (x_term_init) [!HAVE_GTK_MULTIDISPLAY]:
Refuse to create secondary X connections.
* configure.in (HAVE_GTK_MULTIDISPLAY): Disable test, unconditionally undefine.
* configure: Regenerate.
git-archimport-id: lorentey@elte.hu--2004/emacs--multi-tty--0--patch-450
| -rw-r--r-- | README.multi-tty | 21 | ||||
| -rwxr-xr-x | configure | 109 | ||||
| -rw-r--r-- | configure.in | 13 | ||||
| -rw-r--r-- | src/xterm.c | 14 |
4 files changed, 37 insertions, 120 deletions
diff --git a/README.multi-tty b/README.multi-tty index 3f873facaec..7e673d256cb 100644 --- a/README.multi-tty +++ b/README.multi-tty | |||
| @@ -98,11 +98,13 @@ few tricky test cases for you. | |||
| 98 | Known problems: | 98 | Known problems: |
| 99 | 99 | ||
| 100 | * GTK support. If you compile your Emacs with the GTK | 100 | * GTK support. If you compile your Emacs with the GTK |
| 101 | toolkit, some functionality of multi-tty will be lost. | 101 | toolkit, some functionality of multi-tty will be lost. In |
| 102 | In particular, closing an X display causes a crash. | 102 | particular, you will not be able to work on multiple X |
| 103 | Current releases of GTK have limitations and bugs that | 103 | displays at once. Current releases of GTK have limitations |
| 104 | prevent full-blown multi-display support in Emacs. Use the | 104 | and bugs that prevent full-blown multi-display support in |
| 105 | Lucid toolkit if you want to see a complete feature set. | 105 | Emacs. (GTK crashes when Emacs tries to disconnect from an |
| 106 | X server.) Use the Lucid toolkit if you want to see a | ||
| 107 | complete feature set. | ||
| 106 | 108 | ||
| 107 | * The single-kboard mode. | 109 | * The single-kboard mode. |
| 108 | 110 | ||
| @@ -393,7 +395,10 @@ THINGS TO DO | |||
| 393 | ** Report GTK multi-display problems to GTK maintainers. For extra | 395 | ** Report GTK multi-display problems to GTK maintainers. For extra |
| 394 | credit, fix them. | 396 | credit, fix them. |
| 395 | 397 | ||
| 396 | ** Disable connecting to a new X display when we use the GTK toolkit. | 398 | Currently you can not connect to new X displays when you compile |
| 399 | Emacs with GTK support. If you want to play around with GTK | ||
| 400 | multidisplay (and don't mind core dumps), you can edit src/config.h | ||
| 401 | and define HAVE_GTK_MULTIDISPLAY there by hand. | ||
| 397 | 402 | ||
| 398 | ** Possibly turn off the double C-g feature when there is an X frame. | 403 | ** Possibly turn off the double C-g feature when there is an X frame. |
| 399 | C.f. (emacs)Emergency Escape. | 404 | C.f. (emacs)Emergency Escape. |
| @@ -1278,5 +1283,9 @@ DIARY OF CHANGES | |||
| 1278 | switched keyboards. I don't understand why did this bug only | 1283 | switched keyboards. I don't understand why did this bug only |
| 1279 | appear on brand new frames, though!) | 1284 | appear on brand new frames, though!) |
| 1280 | 1285 | ||
| 1286 | -- Disable connecting to a new X display when we use the GTK toolkit. | ||
| 1287 | |||
| 1288 | (Disabled in patch-450.) | ||
| 1289 | |||
| 1281 | ;;; arch-tag: 8da1619e-2e79-41a8-9ac9-a0485daad17d | 1290 | ;;; arch-tag: 8da1619e-2e79-41a8-9ac9-a0485daad17d |
| 1282 | 1291 | ||
| @@ -9964,115 +9964,8 @@ _ACEOF | |||
| 9964 | with_toolkit_scroll_bars=yes | 9964 | with_toolkit_scroll_bars=yes |
| 9965 | fi | 9965 | fi |
| 9966 | 9966 | ||
| 9967 | HAVE_GTK_MULTIDISPLAY=no | 9967 | HAVE_GTK_MULTIDISPLAY=no |
| 9968 | 9968 | ||
| 9969 | for ac_func in gdk_display_open | ||
| 9970 | do | ||
| 9971 | as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` | ||
| 9972 | echo "$as_me:$LINENO: checking for $ac_func" >&5 | ||
| 9973 | echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6 | ||
| 9974 | if eval "test \"\${$as_ac_var+set}\" = set"; then | ||
| 9975 | echo $ECHO_N "(cached) $ECHO_C" >&6 | ||
| 9976 | else | ||
| 9977 | cat >conftest.$ac_ext <<_ACEOF | ||
| 9978 | /* confdefs.h. */ | ||
| 9979 | _ACEOF | ||
| 9980 | cat confdefs.h >>conftest.$ac_ext | ||
| 9981 | cat >>conftest.$ac_ext <<_ACEOF | ||
| 9982 | /* end confdefs.h. */ | ||
| 9983 | /* Define $ac_func to an innocuous variant, in case <limits.h> declares $ac_func. | ||
| 9984 | For example, HP-UX 11i <limits.h> declares gettimeofday. */ | ||
| 9985 | #define $ac_func innocuous_$ac_func | ||
| 9986 | |||
| 9987 | /* System header to define __stub macros and hopefully few prototypes, | ||
| 9988 | which can conflict with char $ac_func (); below. | ||
| 9989 | Prefer <limits.h> to <assert.h> if __STDC__ is defined, since | ||
| 9990 | <limits.h> exists even on freestanding compilers. */ | ||
| 9991 | |||
| 9992 | #ifdef __STDC__ | ||
| 9993 | # include <limits.h> | ||
| 9994 | #else | ||
| 9995 | # include <assert.h> | ||
| 9996 | #endif | ||
| 9997 | |||
| 9998 | #undef $ac_func | ||
| 9999 | |||
| 10000 | /* Override any gcc2 internal prototype to avoid an error. */ | ||
| 10001 | #ifdef __cplusplus | ||
| 10002 | extern "C" | ||
| 10003 | { | ||
| 10004 | #endif | ||
| 10005 | /* We use char because int might match the return type of a gcc2 | ||
| 10006 | builtin and then its argument prototype would still apply. */ | ||
| 10007 | char $ac_func (); | ||
| 10008 | /* The GNU C library defines this for functions which it implements | ||
| 10009 | to always fail with ENOSYS. Some functions are actually named | ||
| 10010 | something starting with __ and the normal name is an alias. */ | ||
| 10011 | #if defined (__stub_$ac_func) || defined (__stub___$ac_func) | ||
| 10012 | choke me | ||
| 10013 | #else | ||
| 10014 | char (*f) () = $ac_func; | ||
| 10015 | #endif | ||
| 10016 | #ifdef __cplusplus | ||
| 10017 | } | ||
| 10018 | #endif | ||
| 10019 | |||
| 10020 | int | ||
| 10021 | main () | ||
| 10022 | { | ||
| 10023 | return f != $ac_func; | ||
| 10024 | ; | ||
| 10025 | return 0; | ||
| 10026 | } | ||
| 10027 | _ACEOF | ||
| 10028 | rm -f conftest.$ac_objext conftest$ac_exeext | ||
| 10029 | if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 | ||
| 10030 | (eval $ac_link) 2>conftest.er1 | ||
| 10031 | ac_status=$? | ||
| 10032 | grep -v '^ *+' conftest.er1 >conftest.err | ||
| 10033 | rm -f conftest.er1 | ||
| 10034 | cat conftest.err >&5 | ||
| 10035 | echo "$as_me:$LINENO: \$? = $ac_status" >&5 | ||
| 10036 | (exit $ac_status); } && | ||
| 10037 | { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' | ||
| 10038 | { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 | ||
| 10039 | (eval $ac_try) 2>&5 | ||
| 10040 | ac_status=$? | ||
| 10041 | echo "$as_me:$LINENO: \$? = $ac_status" >&5 | ||
| 10042 | (exit $ac_status); }; } && | ||
| 10043 | { ac_try='test -s conftest$ac_exeext' | ||
| 10044 | { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 | ||
| 10045 | (eval $ac_try) 2>&5 | ||
| 10046 | ac_status=$? | ||
| 10047 | echo "$as_me:$LINENO: \$? = $ac_status" >&5 | ||
| 10048 | (exit $ac_status); }; }; then | ||
| 10049 | eval "$as_ac_var=yes" | ||
| 10050 | else | ||
| 10051 | echo "$as_me: failed program was:" >&5 | ||
| 10052 | sed 's/^/| /' conftest.$ac_ext >&5 | ||
| 10053 | |||
| 10054 | eval "$as_ac_var=no" | ||
| 10055 | fi | ||
| 10056 | rm -f conftest.err conftest.$ac_objext \ | ||
| 10057 | conftest$ac_exeext conftest.$ac_ext | ||
| 10058 | fi | ||
| 10059 | echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5 | ||
| 10060 | echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6 | ||
| 10061 | if test `eval echo '${'$as_ac_var'}'` = yes; then | ||
| 10062 | cat >>confdefs.h <<_ACEOF | ||
| 10063 | #define `echo "HAVE_$ac_func" | $as_tr_cpp` 1 | ||
| 10064 | _ACEOF | ||
| 10065 | HAVE_GTK_MULTIDISPLAY=yes | ||
| 10066 | fi | ||
| 10067 | done | ||
| 10068 | |||
| 10069 | if test "${HAVE_GTK_MULTIDISPLAY}" = "yes"; then | ||
| 10070 | |||
| 10071 | cat >>confdefs.h <<\_ACEOF | ||
| 10072 | #define HAVE_GTK_MULTIDISPLAY 1 | ||
| 10073 | _ACEOF | ||
| 10074 | |||
| 10075 | fi | ||
| 10076 | HAVE_GTK_FILE_SELECTION=no | 9969 | HAVE_GTK_FILE_SELECTION=no |
| 10077 | 9970 | ||
| 10078 | for ac_func in gtk_file_selection_new | 9971 | for ac_func in gtk_file_selection_new |
diff --git a/configure.in b/configure.in index b39a7e85678..f413c57db55 100644 --- a/configure.in +++ b/configure.in | |||
| @@ -2011,12 +2011,15 @@ if test "${with_gtk}" = "yes" || test "$USE_X_TOOLKIT" = "gtk"; then | |||
| 2011 | 2011 | ||
| 2012 | dnl Check if we can use multiple displays with this GTK version. | 2012 | dnl Check if we can use multiple displays with this GTK version. |
| 2013 | dnl If gdk_display_open exists, assume all others are there also. | 2013 | dnl If gdk_display_open exists, assume all others are there also. |
| 2014 | dnl XXX The multidisplay feature is severely broken in current GTK | ||
| 2015 | dnl versions. --lorentey | ||
| 2014 | HAVE_GTK_MULTIDISPLAY=no | 2016 | HAVE_GTK_MULTIDISPLAY=no |
| 2015 | AC_CHECK_FUNCS(gdk_display_open, HAVE_GTK_MULTIDISPLAY=yes) | 2017 | dnl AC_CHECK_FUNCS(gdk_display_open, HAVE_GTK_MULTIDISPLAY=yes) |
| 2016 | if test "${HAVE_GTK_MULTIDISPLAY}" = "yes"; then | 2018 | dnl if test "${HAVE_GTK_MULTIDISPLAY}" = "yes"; then |
| 2017 | AC_DEFINE(HAVE_GTK_MULTIDISPLAY, 1, | 2019 | dnl AC_DEFINE(HAVE_GTK_MULTIDISPLAY, 1, |
| 2018 | [Define to 1 if GTK can handle more than one display.]) | 2020 | dnl [Define to 1 if GTK can handle more than one display.]) |
| 2019 | fi | 2021 | dnl fi |
| 2022 | |||
| 2020 | dnl Check if we have the old file selection dialog. | 2023 | dnl Check if we have the old file selection dialog. |
| 2021 | dnl If gdk_display_open exists, assume all others are there also. | 2024 | dnl If gdk_display_open exists, assume all others are there also. |
| 2022 | HAVE_GTK_FILE_SELECTION=no | 2025 | HAVE_GTK_FILE_SELECTION=no |
diff --git a/src/xterm.c b/src/xterm.c index 42c860b64c9..cf0c8176dd5 100644 --- a/src/xterm.c +++ b/src/xterm.c | |||
| @@ -10141,14 +10141,26 @@ x_term_init (display_name, xrm_option, resource_name) | |||
| 10141 | char **argv2 = argv; | 10141 | char **argv2 = argv; |
| 10142 | GdkAtom atom; | 10142 | GdkAtom atom; |
| 10143 | 10143 | ||
| 10144 | #ifndef HAVE_GTK_MULTIDISPLAY | ||
| 10145 | if (!EQ (Vinitial_window_system, intern ("x"))) | ||
| 10146 | error ("Sorry, you cannot connect to X servers with the GTK toolkit"); | ||
| 10147 | #endif | ||
| 10148 | |||
| 10144 | if (x_initialized++ > 1) | 10149 | if (x_initialized++ > 1) |
| 10145 | { | 10150 | { |
| 10151 | #ifdef HAVE_GTK_MULTIDISPLAY | ||
| 10146 | /* Opening another display. If xg_display_open returns less | 10152 | /* Opening another display. If xg_display_open returns less |
| 10147 | than zero, we are probably on GTK 2.0, which can only handle | 10153 | than zero, we are probably on GTK 2.0, which can only handle |
| 10148 | one display. GTK 2.2 or later can handle more than one. */ | 10154 | one display. GTK 2.2 or later can handle more than one. */ |
| 10149 | if (xg_display_open (SDATA (display_name), &dpy) < 0) | 10155 | if (xg_display_open (SDATA (display_name), &dpy) < 0) |
| 10150 | error ("Sorry, this version of GTK can only handle one display"); | 10156 | error ("Sorry, this version of GTK can only handle one display"); |
| 10151 | } | 10157 | #else |
| 10158 | /* XXX Unfortunately, multiple display support is severely broken | ||
| 10159 | in recent GTK versions, so HAVE_GTK_MULTIDISPLAY is | ||
| 10160 | unconditionally disabled in configure.in. */ | ||
| 10161 | error ("Sorry, multiple display support is broken in current GTK versions"); | ||
| 10162 | #endif | ||
| 10163 | } | ||
| 10152 | else | 10164 | else |
| 10153 | { | 10165 | { |
| 10154 | for (argc = 0; argc < NUM_ARGV; ++argc) | 10166 | for (argc = 0; argc < NUM_ARGV; ++argc) |