]>
Commit | Line | Data |
---|---|---|
3e524028 AG |
1 | To: vim-dev@vim.org |
2 | Subject: Patch 7.2.088 (extra) | |
3 | Fcc: outbox | |
4 | From: Bram Moolenaar <Bram@moolenaar.net> | |
5 | Mime-Version: 1.0 | |
6 | Content-Type: text/plain; charset=ISO-8859-1 | |
7 | Content-Transfer-Encoding: 8bit | |
8 | ------------ | |
9 | ||
10 | Patch 7.2.088 (extra) | |
11 | Problem: OpenClipboard() may fail when another application is using the | |
12 | clipboard. | |
13 | Solution: Retry OpenClipboard() a few times. (Jianrong Yu) | |
14 | Files: src/os_mswin.c | |
15 | ||
16 | ||
17 | *** ../vim-7.2.087/src/os_mswin.c Thu Nov 20 17:09:09 2008 | |
18 | --- src/os_mswin.c Thu Jan 22 18:38:12 2009 | |
19 | *************** | |
20 | *** 1224,1229 **** | |
21 | --- 1224,1248 ---- | |
22 | #endif /* FEAT_MBYTE */ | |
23 | ||
24 | /* | |
25 | + * Wait for another process to Close the Clipboard. | |
26 | + * Returns TRUE for success. | |
27 | + */ | |
28 | + int | |
29 | + vim_open_clipboard() | |
30 | + { | |
31 | + int delay = 10; | |
32 | + | |
33 | + while (!OpenClipboard(NULL)) | |
34 | + { | |
35 | + if (delay > 500) | |
36 | + return FALSE; /* waited too long, give up */ | |
37 | + Sleep(delay); | |
38 | + delay *= 2; /* wait for 10, 20, 40, 80, etc. msec */ | |
39 | + } | |
40 | + return TRUE; | |
41 | + } | |
42 | + | |
43 | + /* | |
44 | * Get the current selection and put it in the clipboard register. | |
45 | * | |
46 | * NOTE: Must use GlobalLock/Unlock here to ensure Win32s compatibility. | |
47 | *************** | |
48 | *** 1254,1260 **** | |
49 | * Don't pass GetActiveWindow() as an argument to OpenClipboard() because | |
50 | * then we can't paste back into the same window for some reason - webb. | |
51 | */ | |
52 | ! if (!OpenClipboard(NULL)) | |
53 | return; | |
54 | ||
55 | /* Check for vim's own clipboard format first. This only gets the type of | |
56 | --- 1273,1279 ---- | |
57 | * Don't pass GetActiveWindow() as an argument to OpenClipboard() because | |
58 | * then we can't paste back into the same window for some reason - webb. | |
59 | */ | |
60 | ! if (!vim_open_clipboard()) | |
61 | return; | |
62 | ||
63 | /* Check for vim's own clipboard format first. This only gets the type of | |
64 | *************** | |
65 | *** 1562,1568 **** | |
66 | * because then we can't paste back into the same window for some | |
67 | * reason - webb. | |
68 | */ | |
69 | ! if (OpenClipboard(NULL)) | |
70 | { | |
71 | if (EmptyClipboard()) | |
72 | { | |
73 | --- 1581,1587 ---- | |
74 | * because then we can't paste back into the same window for some | |
75 | * reason - webb. | |
76 | */ | |
77 | ! if (vim_open_clipboard()) | |
78 | { | |
79 | if (EmptyClipboard()) | |
80 | { | |
81 | *** ../vim-7.2.087/src/version.c Thu Jan 22 21:31:24 2009 | |
82 | --- src/version.c Thu Jan 22 21:47:52 2009 | |
83 | *************** | |
84 | *** 678,679 **** | |
85 | --- 678,681 ---- | |
86 | { /* Add new patch number below this line */ | |
87 | + /**/ | |
88 | + 88, | |
89 | /**/ | |
90 | ||
91 | -- | |
92 | hundred-and-one symptoms of being an internet addict: | |
93 | 22. You've already visited all the links at Yahoo and you're halfway through | |
94 | Lycos. | |
95 | ||
96 | /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ | |
97 | /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\ | |
98 | \\\ download, build and distribute -- http://www.A-A-P.org /// | |
99 | \\\ help me help AIDS victims -- http://ICCF-Holland.org /// |