1 To: vim_dev@googlegroups.com
4 From: Bram Moolenaar <Bram@moolenaar.net>
6 Content-Type: text/plain; charset=UTF-8
7 Content-Transfer-Encoding: 8bit
11 Problem: Gvim starts up slow on Unbuntu 12.04.
12 Solution: Move the call to gui_mch_init_check() to after fork(). (Yasuhiro
13 Matsumoto) Do check $DISPLAY being set.
14 Files: src/gui.c, src/gui_gtk_x11.c, src/proto/gui_gtk_x11.pro
17 *** ../vim-7.3.519/src/gui.c 2011-10-20 21:27:57.000000000 +0200
18 --- src/gui.c 2012-05-18 16:53:14.000000000 +0200
26 + /* Call gtk_init_check() here after fork(). See gui_init_check(). */
27 + if (gui_mch_init_check() != OK)
31 # if defined(HAVE_SETSID) || defined(HAVE_SETPGID)
33 * Change our process group. On some systems/shells a CTRL-C in the
40 + # ifdef FEAT_GUI_GTK
42 + * Note: Don't call gtk_init_check() before fork, it will be called after
43 + * the fork. When calling it before fork, it make vim hang for a while.
44 + * See gui_do_fork().
45 + * Use a simpler check if the GUI window can probably be opened.
47 + result = gui.dofork ? gui_mch_early_init_check() : gui_mch_init_check();
49 result = gui_mch_init_check();
54 *** ../vim-7.3.519/src/gui_gtk_x11.c 2011-10-26 11:36:21.000000000 +0200
55 --- src/gui_gtk_x11.c 2012-05-18 17:00:45.000000000 +0200
61 ! * Check if the GUI can be started. Called before gvimrc is sourced.
69 ! * Check if the GUI can be started. Called before gvimrc is sourced and
71 ! * Return OK or FAIL.
74 ! gui_mch_early_init_check(void)
78 ! /* Guess that when $DISPLAY isn't set the GUI can't start. */
79 ! p = mch_getenv((char_u *)"DISPLAY");
80 ! if (p == NULL || *p == NUL)
83 ! EMSG(_((char *)e_opendisp));
90 ! * Check if the GUI can be started. Called before gvimrc is sourced but after
98 for (i = 0; i < (int)N_SELECTION_TARGETS; ++i)
100 ! /* OpenOffice tries to use TARGET_HTML and fails when it doesn't
101 * return something, instead of trying another target. Therefore only
102 * offer TARGET_HTML when it works. */
103 if (!clip_html && selection_targets[i].info == TARGET_HTML)
106 for (i = 0; i < (int)N_SELECTION_TARGETS; ++i)
108 ! /* OpenOffice tries to use TARGET_HTML and fails when we don't
109 * return something, instead of trying another target. Therefore only
110 * offer TARGET_HTML when it works. */
111 if (!clip_html && selection_targets[i].info == TARGET_HTML)
112 *** ../vim-7.3.519/src/proto/gui_gtk_x11.pro 2011-08-10 17:44:41.000000000 +0200
113 --- src/proto/gui_gtk_x11.pro 2012-05-18 16:54:28.000000000 +0200
117 void gui_mch_set_blinking __ARGS((long waittime, long on, long off));
118 void gui_mch_stop_blink __ARGS((void));
119 void gui_mch_start_blink __ARGS((void));
120 + int gui_mch_early_init_check __ARGS((void));
121 int gui_mch_init_check __ARGS((void));
122 void gui_mch_show_tabline __ARGS((int showit));
123 int gui_mch_showing_tabline __ARGS((void));
124 *** ../vim-7.3.519/src/version.c 2012-05-18 16:35:17.000000000 +0200
125 --- src/version.c 2012-05-18 16:45:30.000000000 +0200
129 { /* Add new patch number below this line */
135 Bad programs can be written in any language.
137 /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\
138 /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
139 \\\ an exciting new programming language -- http://www.Zimbu.org ///
140 \\\ help me help AIDS victims -- http://ICCF-Holland.org ///