]> git.ipfire.org Git - ipfire-3.x.git/blob - pkgs/vim/patches/vim-7.3.011.patch0
Change file layout of the makefiles.
[ipfire-3.x.git] / pkgs / vim / patches / vim-7.3.011.patch0
1 To: vim-dev@vim.org
2 Subject: Patch 7.3.011
3 Fcc: outbox
4 From: Bram Moolenaar <Bram@moolenaar.net>
5 Mime-Version: 1.0
6 Content-Type: text/plain; charset=UTF-8
7 Content-Transfer-Encoding: 8bit
8 ------------
9
10 Patch 7.3.011
11 Problem: X11 clipboard doesn't work in Athena/Motif GUI. First selection
12 after a shell command doesn't work.
13 Solution: When using the GUI use XtLastTimestampProcessed() instead of
14 changing a property. (partly by Toni Ronkko)
15 When executing a shell command disown the selection.
16 Files: src/ui.c, src/os_unix.c
17
18
19 *** ../vim-7.3.010/src/ui.c 2010-08-15 21:57:31.000000000 +0200
20 --- src/ui.c 2010-09-21 22:08:22.000000000 +0200
21 ***************
22 *** 469,475 ****
23 */
24 #ifdef FEAT_X11
25 /* Always own the selection, we might have lost it without being
26 ! * notified. */
27 if (cbd->available)
28 {
29 int was_owned = cbd->owned;
30 --- 469,475 ----
31 */
32 #ifdef FEAT_X11
33 /* Always own the selection, we might have lost it without being
34 ! * notified, e.g. during a ":sh" command. */
35 if (cbd->available)
36 {
37 int was_owned = cbd->owned;
38 ***************
39 *** 1944,1953 ****
40 */
41
42 static Boolean clip_x11_convert_selection_cb __ARGS((Widget, Atom *, Atom *, Atom *, XtPointer *, long_u *, int *));
43 -
44 static void clip_x11_lose_ownership_cb __ARGS((Widget, Atom *));
45 -
46 static void clip_x11_timestamp_cb __ARGS((Widget w, XtPointer n, XEvent *event, Boolean *cont));
47
48 /*
49 * Property callback to get a timestamp for XtOwnSelection.
50 --- 1944,1952 ----
51 */
52
53 static Boolean clip_x11_convert_selection_cb __ARGS((Widget, Atom *, Atom *, Atom *, XtPointer *, long_u *, int *));
54 static void clip_x11_lose_ownership_cb __ARGS((Widget, Atom *));
55 static void clip_x11_timestamp_cb __ARGS((Widget w, XtPointer n, XEvent *event, Boolean *cont));
56 + static void clip_x11_request_selection_cb __ARGS((Widget, XtPointer, Atom *, Atom *, XtPointer, long_u *, int *));
57
58 /*
59 * Property callback to get a timestamp for XtOwnSelection.
60 ***************
61 *** 1985,1992 ****
62 return;
63
64 /* Get the selection, using the event timestamp. */
65 ! XtOwnSelection(w, xproperty->atom, xproperty->time,
66 ! clip_x11_convert_selection_cb, clip_x11_lose_ownership_cb, NULL);
67 }
68
69 void
70 --- 1984,2000 ----
71 return;
72
73 /* Get the selection, using the event timestamp. */
74 ! if (XtOwnSelection(w, xproperty->atom, xproperty->time,
75 ! clip_x11_convert_selection_cb, clip_x11_lose_ownership_cb,
76 ! NULL) == OK)
77 ! {
78 ! /* Set the "owned" flag now, there may have been a call to
79 ! * lose_ownership_cb in between. */
80 ! if (xproperty->atom == clip_plus.sel_atom)
81 ! clip_plus.owned = TRUE;
82 ! else
83 ! clip_star.owned = TRUE;
84 ! }
85 }
86
87 void
88 ***************
89 *** 1997,2004 ****
90 /*(XtEventHandler)*/clip_x11_timestamp_cb, (XtPointer)NULL);
91 }
92
93 - static void clip_x11_request_selection_cb __ARGS((Widget, XtPointer, Atom *, Atom *, XtPointer, long_u *, int *));
94 -
95 static void
96 clip_x11_request_selection_cb(w, success, sel_atom, type, value, length,
97 format)
98 --- 2005,2010 ----
99 ***************
100 *** 2336,2342 ****
101
102 void
103 clip_x11_lose_selection(myShell, cbd)
104 ! Widget myShell;
105 VimClipboard *cbd;
106 {
107 XtDisownSelection(myShell, cbd->sel_atom, CurrentTime);
108 --- 2342,2348 ----
109
110 void
111 clip_x11_lose_selection(myShell, cbd)
112 ! Widget myShell;
113 VimClipboard *cbd;
114 {
115 XtDisownSelection(myShell, cbd->sel_atom, CurrentTime);
116 ***************
117 *** 2344,2357 ****
118
119 int
120 clip_x11_own_selection(myShell, cbd)
121 ! Widget myShell;
122 VimClipboard *cbd;
123 {
124 ! /* Get the time by a zero-length append, clip_x11_timestamp_cb will be
125 ! * called with the current timestamp. */
126 ! if (!XChangeProperty(XtDisplay(myShell), XtWindow(myShell), cbd->sel_atom,
127 ! timestamp_atom, 32, PropModeAppend, NULL, 0))
128 return FAIL;
129 /* Flush is required in a terminal as nothing else is doing it. */
130 XFlush(XtDisplay(myShell));
131 return OK;
132 --- 2350,2378 ----
133
134 int
135 clip_x11_own_selection(myShell, cbd)
136 ! Widget myShell;
137 VimClipboard *cbd;
138 {
139 ! /* When using the GUI we have proper timestamps, use the one of the last
140 ! * event. When in the console we don't get events (the terminal gets
141 ! * them), Get the time by a zero-length append, clip_x11_timestamp_cb will
142 ! * be called with the current timestamp. */
143 ! #ifdef FEAT_GUI
144 ! if (gui.in_use)
145 ! {
146 ! if (XtOwnSelection(myShell, cbd->sel_atom,
147 ! XtLastTimestampProcessed(XtDisplay(myShell)),
148 ! clip_x11_convert_selection_cb, clip_x11_lose_ownership_cb,
149 ! NULL) == False)
150 return FAIL;
151 + }
152 + else
153 + #endif
154 + {
155 + if (!XChangeProperty(XtDisplay(myShell), XtWindow(myShell),
156 + cbd->sel_atom, timestamp_atom, 32, PropModeAppend, NULL, 0))
157 + return FAIL;
158 + }
159 /* Flush is required in a terminal as nothing else is doing it. */
160 XFlush(XtDisplay(myShell));
161 return OK;
162 *** ../vim-7.3.010/src/os_unix.c 2010-08-15 21:57:30.000000000 +0200
163 --- src/os_unix.c 2010-09-21 21:59:25.000000000 +0200
164 ***************
165 *** 1123,1128 ****
166 --- 1123,1152 ----
167 }
168 #endif
169
170 + # if defined(FEAT_CLIPBOARD) && defined(FEAT_X11)
171 + static void loose_clipboard __ARGS((void));
172 +
173 + /*
174 + * Called when Vim is going to sleep or execute a shell command.
175 + * We can't respond to requests for the X selections. Lose them, otherwise
176 + * other applications will hang. But first copy the text to cut buffer 0.
177 + */
178 + static void
179 + loose_clipboard()
180 + {
181 + if (clip_star.owned || clip_plus.owned)
182 + {
183 + x11_export_final_selection();
184 + if (clip_star.owned)
185 + clip_lose_selection(&clip_star);
186 + if (clip_plus.owned)
187 + clip_lose_selection(&clip_plus);
188 + if (x11_display != NULL)
189 + XFlush(x11_display);
190 + }
191 + }
192 + #endif
193 +
194 /*
195 * If the machine has job control, use it to suspend the program,
196 * otherwise fake it by starting a new shell.
197 ***************
198 *** 1137,1155 ****
199 out_flush(); /* needed to disable mouse on some systems */
200
201 # if defined(FEAT_CLIPBOARD) && defined(FEAT_X11)
202 ! /* Since we are going to sleep, we can't respond to requests for the X
203 ! * selections. Lose them, otherwise other applications will hang. But
204 ! * first copy the text to cut buffer 0. */
205 ! if (clip_star.owned || clip_plus.owned)
206 ! {
207 ! x11_export_final_selection();
208 ! if (clip_star.owned)
209 ! clip_lose_selection(&clip_star);
210 ! if (clip_plus.owned)
211 ! clip_lose_selection(&clip_plus);
212 ! if (x11_display != NULL)
213 ! XFlush(x11_display);
214 ! }
215 # endif
216
217 # if defined(_REENTRANT) && defined(SIGCONT)
218 --- 1161,1167 ----
219 out_flush(); /* needed to disable mouse on some systems */
220
221 # if defined(FEAT_CLIPBOARD) && defined(FEAT_X11)
222 ! loose_clipboard();
223 # endif
224
225 # if defined(_REENTRANT) && defined(SIGCONT)
226 ***************
227 *** 3706,3711 ****
228 --- 3718,3727 ----
229 if (options & SHELL_COOKED)
230 settmode(TMODE_COOK); /* set to normal mode */
231
232 + # if defined(FEAT_CLIPBOARD) && defined(FEAT_X11)
233 + loose_clipboard();
234 + # endif
235 +
236 # ifdef __EMX__
237 if (cmd == NULL)
238 x = system(""); /* this starts an interactive shell in emx */
239 ***************
240 *** 3814,3826 ****
241 # endif
242 int did_settmode = FALSE; /* settmode(TMODE_RAW) called */
243
244 out_flush();
245 if (options & SHELL_COOKED)
246 settmode(TMODE_COOK); /* set to normal mode */
247
248 ! newcmd = vim_strsave(p_sh);
249 ! if (newcmd == NULL) /* out of memory */
250 ! goto error;
251
252 /*
253 * Do this loop twice:
254 --- 3830,3846 ----
255 # endif
256 int did_settmode = FALSE; /* settmode(TMODE_RAW) called */
257
258 + newcmd = vim_strsave(p_sh);
259 + if (newcmd == NULL) /* out of memory */
260 + goto error;
261 +
262 out_flush();
263 if (options & SHELL_COOKED)
264 settmode(TMODE_COOK); /* set to normal mode */
265
266 ! # if defined(FEAT_CLIPBOARD) && defined(FEAT_X11)
267 ! loose_clipboard();
268 ! # endif
269
270 /*
271 * Do this loop twice:
272 *** ../vim-7.3.010/src/version.c 2010-09-21 17:34:26.000000000 +0200
273 --- src/version.c 2010-09-21 20:45:02.000000000 +0200
274 ***************
275 *** 716,717 ****
276 --- 716,719 ----
277 { /* Add new patch number below this line */
278 + /**/
279 + 11,
280 /**/
281
282 --
283 hundred-and-one symptoms of being an internet addict:
284 184. You no longer ask prospective dates what their sign is, instead
285 your line is "Hi, what's your URL?"
286
287 /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\
288 /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
289 \\\ download, build and distribute -- http://www.A-A-P.org ///
290 \\\ help me help AIDS victims -- http://ICCF-Holland.org ///