To: Daniel Burrows Cc: Wichert Akkerman , vim-dev@vim.org Subject: patch 5.4.10 (was: Bug#42161: gvim -f doesn't work outside X any more) In-Reply-To: <19990730074749.A11626@bluegreen.dhis.org> Fcc: outbox From: Bram Moolenaar ------------ Daniel Burrows wrote: > On Fri, Jul 30, 1999 at 01:38:59PM +0200, Bram Moolenaar was heard to say: > > This problem is caused by gtk_init(). When it can't open the display, it > > just exits. Not very kind! > > I just poked around in the GTK headers and found another initialization > function, gtk_init_check(). It appears to try to open the display and return > true for success, or false for failure. (in fact, the implementation of > gtk_init() is basically: if(!gtk_init_check(argc,argv)) > print_error_and_exit() ) > > This might be helpful for you :) Certainly! This makes the patch much simpler. And safer to include. I'll make a numbered patch for it now. Patch 5.4.10 Problem: GTK GUI: When $DISPLAY is invalid, "gvim -f" just exits. It should run in the terminal. Solution: Use gtk_init_check() instead of gtk_init(). Files: src/gui_gtk_x11.c *** ../vim-5.4/src/gui_gtk_x11.c Sun Jul 25 22:02:11 1999 --- src/gui_gtk_x11.c Fri Jul 30 19:42:36 1999 *************** *** 753,767 **** gtk_set_locale(); #endif ! gtk_init(&gui_argc, &gui_argv); ! vim_free(gui_argv); ! ! if (!GDK_DISPLAY()) { gui.dying = TRUE; EMSG("cannot open display"); return FAIL; } /* Somehow I can't resist the feeling that we should move the * corrseponding code out of the terminal section and --- 753,766 ---- gtk_set_locale(); #endif ! /* Don't use gtk_init(), it exits on failure. */ ! if (!gtk_init_check(&gui_argc, &gui_argv)) { gui.dying = TRUE; EMSG("cannot open display"); return FAIL; } + vim_free(gui_argv); /* Somehow I can't resist the feeling that we should move the * corrseponding code out of the terminal section and *** ../vim-5.4/src/version.h Fri Jul 30 09:54:57 1999 --- src/version.h Sat Jul 31 16:28:09 1999 *************** *** 19,26 **** #define VIM_VERSION_MINOR_STR "4" #define VIM_VERSION_BUILD 57 #define VIM_VERSION_BUILD_STR "57" ! #define VIM_VERSION_PATCHLEVEL 9 ! #define VIM_VERSION_PATCHLEVEL_STR "9" /* * VIM_VERSION_NODOT is used for the runtime directory name. --- 19,26 ---- #define VIM_VERSION_MINOR_STR "4" #define VIM_VERSION_BUILD 57 #define VIM_VERSION_BUILD_STR "57" ! #define VIM_VERSION_PATCHLEVEL 10 ! #define VIM_VERSION_PATCHLEVEL_STR "10" /* * VIM_VERSION_NODOT is used for the runtime directory name. *************** *** 30,35 **** */ #define VIM_VERSION_NODOT "vim54" #define VIM_VERSION_SHORT "5.4" ! #define VIM_VERSION_MEDIUM "5.4.9" ! #define VIM_VERSION_LONG "VIM - Vi IMproved 5.4.9 (1999 Jul 29)" ! #define VIM_VERSION_LONG_DATE "VIM - Vi IMproved 5.4.9 (1999 Jul 29, compiled " --- 30,35 ---- */ #define VIM_VERSION_NODOT "vim54" #define VIM_VERSION_SHORT "5.4" ! #define VIM_VERSION_MEDIUM "5.4.10" ! #define VIM_VERSION_LONG "VIM - Vi IMproved 5.4.10 (1999 Jul 30)" ! #define VIM_VERSION_LONG_DATE "VIM - Vi IMproved 5.4.10 (1999 Jul 30, compiled " -- ARTHUR: I command you as King of the Britons to stand aside! BLACK KNIGHT: I move for no man. The Quest for the Holy Grail (Monty Python) --/-/---- Bram Moolenaar ---- Bram@moolenaar.net ---- Bram@vim.org ---\-\-- \ \ www.vim.org/iccf www.moolenaar.net www.vim.org / /