summaryrefslogtreecommitdiff
path: root/src/gui_gtk_x11.c
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2012-05-18 17:03:18 +0200
committerBram Moolenaar <Bram@vim.org>2012-05-18 17:03:18 +0200
commit2969570036e154c440cab5a4f8a2cead22587dd9 (patch)
tree6096b9f46418d91be78c13785198bda9a64aa1de /src/gui_gtk_x11.c
parent8a4c136a90574ae1800fd088818f0e3bceaa9f21 (diff)
downloadvim-git-2969570036e154c440cab5a4f8a2cead22587dd9.tar.gz
updated for version 7.3.520v7.3.520
Problem: Gvim starts up slow on Unbuntu 12.04. Solution: Move the call to gui_mch_init_check() to after fork(). (Yasuhiro Matsumoto) Do check $DISPLAY being set.
Diffstat (limited to 'src/gui_gtk_x11.c')
-rw-r--r--src/gui_gtk_x11.c26
1 files changed, 24 insertions, 2 deletions
diff --git a/src/gui_gtk_x11.c b/src/gui_gtk_x11.c
index 091260942..d70f41860 100644
--- a/src/gui_gtk_x11.c
+++ b/src/gui_gtk_x11.c
@@ -1414,7 +1414,29 @@ selection_get_cb(GtkWidget *widget UNUSED,
}
/*
- * Check if the GUI can be started. Called before gvimrc is sourced.
+ * Check if the GUI can be started. Called before gvimrc is sourced and
+ * before fork().
+ * Return OK or FAIL.
+ */
+ int
+gui_mch_early_init_check(void)
+{
+ char_u *p;
+
+ /* Guess that when $DISPLAY isn't set the GUI can't start. */
+ p = mch_getenv((char_u *)"DISPLAY");
+ if (p == NULL || *p == NUL)
+ {
+ gui.dying = TRUE;
+ EMSG(_((char *)e_opendisp));
+ return FAIL;
+ }
+ return OK;
+}
+
+/*
+ * Check if the GUI can be started. Called before gvimrc is sourced but after
+ * fork().
* Return OK or FAIL.
*/
int
@@ -3050,7 +3072,7 @@ gui_gtk_set_selection_targets(void)
for (i = 0; i < (int)N_SELECTION_TARGETS; ++i)
{
- /* OpenOffice tries to use TARGET_HTML and fails when it doesn't
+ /* OpenOffice tries to use TARGET_HTML and fails when we don't
* return something, instead of trying another target. Therefore only
* offer TARGET_HTML when it works. */
if (!clip_html && selection_targets[i].info == TARGET_HTML)