K.Takata's patch queue for Vim
Revision | b626e8c95346e304bedc1cd8cc87ca2d7b41b9d7 (tree) |
---|---|
Zeit | 2022-01-22 12:23:20 |
Autor | K.Takata <kentkt@csc....> |
Commiter | K.Takata |
Add a new patch
@@ -29,4 +29,5 @@ | ||
29 | 29 | add-testing-option-7970.patch |
30 | 30 | wip-win32-vimdir-encoding.patch #+wip |
31 | 31 | win32-directwrite-ambiwidth-auto.patch |
32 | +win32-always-enable-multiline-balloon.patch | |
32 | 33 | fix-config_cache-removal.patch #+rejected |
@@ -0,0 +1,184 @@ | ||
1 | +# HG changeset patch | |
2 | +# Parent 6b740aadb2c5924e54c721142e598660406c3c21 | |
3 | + | |
4 | +diff --git a/src/evalfunc.c b/src/evalfunc.c | |
5 | +--- a/src/evalfunc.c | |
6 | ++++ b/src/evalfunc.c | |
7 | +@@ -5104,8 +5104,7 @@ f_has(typval_T *argvars, typval_T *rettv | |
8 | + #endif | |
9 | + }, | |
10 | + {"balloon_multiline", | |
11 | +-#if defined(FEAT_BEVAL_GUI) && !defined(FEAT_GUI_MSWIN) | |
12 | +- // MS-Windows requires runtime check, see below | |
13 | ++#ifdef FEAT_BEVAL_GUI | |
14 | + 1 | |
15 | + #else | |
16 | + 0 | |
17 | +@@ -6079,10 +6078,6 @@ f_has(typval_T *argvars, typval_T *rettv | |
18 | + { | |
19 | + // intentionally empty | |
20 | + } | |
21 | +-#if defined(FEAT_BEVAL) && defined(FEAT_GUI_MSWIN) | |
22 | +- else if (STRICMP(name, "balloon_multiline") == 0) | |
23 | +- n = multiline_balloon_available(); | |
24 | +-#endif | |
25 | + #ifdef VIMDLL | |
26 | + else if (STRICMP(name, "filterpipe") == 0) | |
27 | + n = gui.in_use || gui.starting; | |
28 | +@@ -6261,9 +6256,6 @@ f_has(typval_T *argvars, typval_T *rettv | |
29 | + dynamic_feature(char_u *feature) | |
30 | + { | |
31 | + return (feature == NULL | |
32 | +-#if defined(FEAT_BEVAL) && defined(FEAT_GUI_MSWIN) | |
33 | +- || STRICMP(feature, "balloon_multiline") == 0 | |
34 | +-#endif | |
35 | + #if defined(FEAT_GUI) && defined(FEAT_BROWSE) | |
36 | + || (STRICMP(feature, "browse") == 0 && !gui.in_use) | |
37 | + #endif | |
38 | +diff --git a/src/gui_w32.c b/src/gui_w32.c | |
39 | +--- a/src/gui_w32.c | |
40 | ++++ b/src/gui_w32.c | |
41 | +@@ -8561,89 +8561,13 @@ gui_mch_destroy_sign(void *sign) | |
42 | + * 5) WM_NOTIFY:TTN_POP destroys created tooltip | |
43 | + */ | |
44 | + | |
45 | +-/* | |
46 | +- * determine whether installed Common Controls support multiline tooltips | |
47 | +- * (i.e. their version is >= 4.70 | |
48 | +- */ | |
49 | +- int | |
50 | +-multiline_balloon_available(void) | |
51 | +-{ | |
52 | +- HINSTANCE hDll; | |
53 | +- static char comctl_dll[] = "comctl32.dll"; | |
54 | +- static int multiline_tip = MAYBE; | |
55 | +- | |
56 | +- if (multiline_tip != MAYBE) | |
57 | +- return multiline_tip; | |
58 | +- | |
59 | +- hDll = GetModuleHandle(comctl_dll); | |
60 | +- if (hDll != NULL) | |
61 | +- { | |
62 | +- DLLGETVERSIONPROC pGetVer; | |
63 | +- pGetVer = (DLLGETVERSIONPROC)GetProcAddress(hDll, "DllGetVersion"); | |
64 | +- | |
65 | +- if (pGetVer != NULL) | |
66 | +- { | |
67 | +- DLLVERSIONINFO dvi; | |
68 | +- HRESULT hr; | |
69 | +- | |
70 | +- ZeroMemory(&dvi, sizeof(dvi)); | |
71 | +- dvi.cbSize = sizeof(dvi); | |
72 | +- | |
73 | +- hr = (*pGetVer)(&dvi); | |
74 | +- | |
75 | +- if (SUCCEEDED(hr) | |
76 | +- && (dvi.dwMajorVersion > 4 | |
77 | +- || (dvi.dwMajorVersion == 4 | |
78 | +- && dvi.dwMinorVersion >= 70))) | |
79 | +- { | |
80 | +- multiline_tip = TRUE; | |
81 | +- return multiline_tip; | |
82 | +- } | |
83 | +- } | |
84 | +- else | |
85 | +- { | |
86 | +- // there is chance we have ancient CommCtl 4.70 | |
87 | +- // which doesn't export DllGetVersion | |
88 | +- DWORD dwHandle = 0; | |
89 | +- DWORD len = GetFileVersionInfoSize(comctl_dll, &dwHandle); | |
90 | +- if (len > 0) | |
91 | +- { | |
92 | +- VS_FIXEDFILEINFO *ver; | |
93 | +- UINT vlen = 0; | |
94 | +- void *data = alloc(len); | |
95 | +- | |
96 | +- if ((data != NULL | |
97 | +- && GetFileVersionInfo(comctl_dll, 0, len, data) | |
98 | +- && VerQueryValue(data, "\\", (void **)&ver, &vlen) | |
99 | +- && vlen | |
100 | +- && HIWORD(ver->dwFileVersionMS) > 4) | |
101 | +- || ((HIWORD(ver->dwFileVersionMS) == 4 | |
102 | +- && LOWORD(ver->dwFileVersionMS) >= 70))) | |
103 | +- { | |
104 | +- vim_free(data); | |
105 | +- multiline_tip = TRUE; | |
106 | +- return multiline_tip; | |
107 | +- } | |
108 | +- vim_free(data); | |
109 | +- } | |
110 | +- } | |
111 | +- } | |
112 | +- multiline_tip = FALSE; | |
113 | +- return multiline_tip; | |
114 | +-} | |
115 | +- | |
116 | + static void | |
117 | + make_tooltip(BalloonEval *beval, char *text, POINT pt) | |
118 | + { | |
119 | +- TOOLINFOW *pti; | |
120 | +- int ToolInfoSize; | |
121 | +- | |
122 | +- if (multiline_balloon_available()) | |
123 | +- ToolInfoSize = sizeof(TOOLINFOW_NEW); | |
124 | +- else | |
125 | +- ToolInfoSize = sizeof(TOOLINFOW); | |
126 | +- | |
127 | +- pti = alloc(ToolInfoSize); | |
128 | ++ TOOLINFOW_NEW *pti; | |
129 | ++ RECT rect; | |
130 | ++ | |
131 | ++ pti = alloc(sizeof(TOOLINFOW_NEW)); | |
132 | + if (pti == NULL) | |
133 | + return; | |
134 | + | |
135 | +@@ -8655,30 +8579,19 @@ make_tooltip(BalloonEval *beval, char *t | |
136 | + SetWindowPos(beval->balloon, HWND_TOPMOST, 0, 0, 0, 0, | |
137 | + SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE); | |
138 | + | |
139 | +- pti->cbSize = ToolInfoSize; | |
140 | ++ pti->cbSize = sizeof(TOOLINFOW_NEW); | |
141 | + pti->uFlags = TTF_SUBCLASS; | |
142 | + pti->hwnd = beval->target; | |
143 | + pti->hinst = 0; // Don't use string resources | |
144 | + pti->uId = ID_BEVAL_TOOLTIP; | |
145 | + | |
146 | +- if (multiline_balloon_available()) | |
147 | +- { | |
148 | +- RECT rect; | |
149 | +- TOOLINFOW_NEW *ptin = (TOOLINFOW_NEW *)pti; | |
150 | +- pti->lpszText = LPSTR_TEXTCALLBACKW; | |
151 | +- beval->tofree = enc_to_utf16((char_u*)text, NULL); | |
152 | +- ptin->lParam = (LPARAM)beval->tofree; | |
153 | +- // switch multiline tooltips on | |
154 | +- if (GetClientRect(s_textArea, &rect)) | |
155 | +- SendMessageW(beval->balloon, TTM_SETMAXTIPWIDTH, 0, | |
156 | +- (LPARAM)rect.right); | |
157 | +- } | |
158 | +- else | |
159 | +- { | |
160 | +- // do this old way | |
161 | +- beval->tofree = enc_to_utf16((char_u*)text, NULL); | |
162 | +- pti->lpszText = (LPWSTR)beval->tofree; | |
163 | +- } | |
164 | ++ pti->lpszText = LPSTR_TEXTCALLBACKW; | |
165 | ++ beval->tofree = enc_to_utf16((char_u*)text, NULL); | |
166 | ++ pti->lParam = (LPARAM)beval->tofree; | |
167 | ++ // switch multiline tooltips on | |
168 | ++ if (GetClientRect(s_textArea, &rect)) | |
169 | ++ SendMessageW(beval->balloon, TTM_SETMAXTIPWIDTH, 0, | |
170 | ++ (LPARAM)rect.right); | |
171 | + | |
172 | + // Limit ballooneval bounding rect to CursorPos neighbourhood. | |
173 | + pti->rect.left = pt.x - 3; | |
174 | +diff --git a/src/proto/gui_w32.pro b/src/proto/gui_w32.pro | |
175 | +--- a/src/proto/gui_w32.pro | |
176 | ++++ b/src/proto/gui_w32.pro | |
177 | +@@ -91,7 +91,6 @@ void gui_mch_set_foreground(void); | |
178 | + void gui_mch_drawsign(int row, int col, int typenr); | |
179 | + void *gui_mch_register_sign(char_u *signfile); | |
180 | + void gui_mch_destroy_sign(void *sign); | |
181 | +-int multiline_balloon_available(void); | |
182 | + void gui_mch_disable_beval_area(BalloonEval *beval); | |
183 | + void gui_mch_enable_beval_area(BalloonEval *beval); | |
184 | + void gui_mch_post_balloon(BalloonEval *beval, char_u *mesg); |