summaryrefslogtreecommitdiffstats
path: root/source/ap/vim/patches/7.3.520
blob: 9e2da8d7bdd9f2edf70a6d4315e4b053ee27d109 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
To: vim_dev@googlegroups.com
Subject: Patch 7.3.520
Fcc: outbox
From: Bram Moolenaar <Bram@moolenaar.net>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
------------

Patch 7.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.
Files:	    src/gui.c, src/gui_gtk_x11.c, src/proto/gui_gtk_x11.pro


*** ../vim-7.3.519/src/gui.c	2011-10-20 21:27:57.000000000 +0200
--- src/gui.c	2012-05-18 16:53:14.000000000 +0200
***************
*** 270,275 ****
--- 270,281 ----
      }
      /* Child */
  
+ #ifdef FEAT_GUI_GTK
+     /* Call gtk_init_check() here after fork(). See gui_init_check(). */
+     if (gui_mch_init_check() != OK)
+ 	exit(1);
+ #endif
+ 
  # if defined(HAVE_SETSID) || defined(HAVE_SETPGID)
      /*
       * Change our process group.  On some systems/shells a CTRL-C in the
***************
*** 430,436 ****
--- 436,452 ----
  #ifdef ALWAYS_USE_GUI
      result = OK;
  #else
+ # ifdef FEAT_GUI_GTK
+     /*
+      * Note: Don't call gtk_init_check() before fork, it will be called after
+      * the fork. When calling it before fork, it make vim hang for a while.
+      * See gui_do_fork().
+      * Use a simpler check if the GUI window can probably be opened.
+      */
+     result = gui.dofork ? gui_mch_early_init_check() : gui_mch_init_check();
+ # else
      result = gui_mch_init_check();
+ # endif
  #endif
      return result;
  }
*** ../vim-7.3.519/src/gui_gtk_x11.c	2011-10-26 11:36:21.000000000 +0200
--- src/gui_gtk_x11.c	2012-05-18 17:00:45.000000000 +0200
***************
*** 1414,1420 ****
  }
  
  /*
!  * Check if the GUI can be started.  Called before gvimrc is sourced.
   * Return OK or FAIL.
   */
      int
--- 1414,1442 ----
  }
  
  /*
!  * 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,3056 ****
  
      for (i = 0; i < (int)N_SELECTION_TARGETS; ++i)
      {
! 	/* OpenOffice tries to use TARGET_HTML and fails when it doesn'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)
--- 3072,3078 ----
  
      for (i = 0; i < (int)N_SELECTION_TARGETS; ++i)
      {
! 	/* 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)
*** ../vim-7.3.519/src/proto/gui_gtk_x11.pro	2011-08-10 17:44:41.000000000 +0200
--- src/proto/gui_gtk_x11.pro	2012-05-18 16:54:28.000000000 +0200
***************
*** 4,9 ****
--- 4,10 ----
  void gui_mch_set_blinking __ARGS((long waittime, long on, long off));
  void gui_mch_stop_blink __ARGS((void));
  void gui_mch_start_blink __ARGS((void));
+ int gui_mch_early_init_check __ARGS((void));
  int gui_mch_init_check __ARGS((void));
  void gui_mch_show_tabline __ARGS((int showit));
  int gui_mch_showing_tabline __ARGS((void));
*** ../vim-7.3.519/src/version.c	2012-05-18 16:35:17.000000000 +0200
--- src/version.c	2012-05-18 16:45:30.000000000 +0200
***************
*** 716,717 ****
--- 716,719 ----
  {   /* Add new patch number below this line */
+ /**/
+     520,
  /**/

-- 
Bad programs can be written in any language.

 /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\  an exciting new programming language -- http://www.Zimbu.org        ///
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///