K.Takata's patch queue for Vim
Revision | f6bc80e7256fb00dcf5e86cf2881f94a04ee37d1 (tree) |
---|---|
Time | 2022-01-23 03:58:23 |
Author | 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-remove-oldlook.patch | |
32 | 33 | fix-config_cache-removal.patch #+rejected |
@@ -0,0 +1,256 @@ | ||
1 | +# HG changeset patch | |
2 | +# Parent 83199336e36f99b25c8cc04567bebf5e1f341446 | |
3 | + | |
4 | +diff --git a/src/gui_w32.c b/src/gui_w32.c | |
5 | +--- a/src/gui_w32.c | |
6 | ++++ b/src/gui_w32.c | |
7 | +@@ -206,14 +206,12 @@ gui_mch_set_rendering_options(char_u *s) | |
8 | + // Some parameters for dialog boxes. All in pixels. | |
9 | + #define DLG_PADDING_X 10 | |
10 | + #define DLG_PADDING_Y 10 | |
11 | +-#define DLG_OLD_STYLE_PADDING_X 5 | |
12 | +-#define DLG_OLD_STYLE_PADDING_Y 5 | |
13 | + #define DLG_VERT_PADDING_X 4 // For vertical buttons | |
14 | + #define DLG_VERT_PADDING_Y 4 | |
15 | + #define DLG_ICON_WIDTH 34 | |
16 | + #define DLG_ICON_HEIGHT 34 | |
17 | + #define DLG_MIN_WIDTH 150 | |
18 | +-#define DLG_FONT_NAME "MS Sans Serif" | |
19 | ++#define DLG_FONT_NAME "MS Shell Dlg" | |
20 | + #define DLG_FONT_POINT_SIZE 8 | |
21 | + #define DLG_MIN_MAX_WIDTH 400 | |
22 | + #define DLG_MIN_MAX_HEIGHT 400 | |
23 | +@@ -4160,7 +4158,6 @@ static int dialog_default_button = -1; | |
24 | + // Intellimouse support | |
25 | + static int mouse_scroll_lines = 0; | |
26 | + | |
27 | +-static int s_usenewlook; // emulate W95/NT4 non-bold dialogs | |
28 | + #ifdef FEAT_TOOLBAR | |
29 | + static void initialise_toolbar(void); | |
30 | + static void update_toolbar_size(void); | |
31 | +@@ -7038,20 +7035,13 @@ gui_mch_dialog( | |
32 | + } | |
33 | + else | |
34 | + # endif | |
35 | +- font = CreateFont(-DLG_FONT_POINT_SIZE, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, | |
36 | +- VARIABLE_PITCH, DLG_FONT_NAME); | |
37 | +- if (s_usenewlook) | |
38 | +- { | |
39 | +- oldFont = SelectFont(hdc, font); | |
40 | +- dlgPaddingX = DLG_PADDING_X; | |
41 | +- dlgPaddingY = DLG_PADDING_Y; | |
42 | +- } | |
43 | +- else | |
44 | +- { | |
45 | +- oldFont = SelectFont(hdc, GetStockObject(SYSTEM_FONT)); | |
46 | +- dlgPaddingX = DLG_OLD_STYLE_PADDING_X; | |
47 | +- dlgPaddingY = DLG_OLD_STYLE_PADDING_Y; | |
48 | +- } | |
49 | ++ font = CreateFont(-DLG_FONT_POINT_SIZE, 0, 0, 0, 0, 0, 0, 0, | |
50 | ++ 0, 0, 0, 0, VARIABLE_PITCH, DLG_FONT_NAME); | |
51 | ++ | |
52 | ++ oldFont = SelectFont(hdc, font); | |
53 | ++ dlgPaddingX = DLG_PADDING_X; | |
54 | ++ dlgPaddingY = DLG_PADDING_Y; | |
55 | ++ | |
56 | + GetTextMetrics(hdc, &fontInfo); | |
57 | + fontHeight = fontInfo.tmHeight; | |
58 | + | |
59 | +@@ -7212,10 +7202,7 @@ gui_mch_dialog( | |
60 | + dlgwidth = DLG_MIN_WIDTH; // Don't allow a really thin dialog! | |
61 | + | |
62 | + // start to fill in the dlgtemplate information. addressing by WORDs | |
63 | +- if (s_usenewlook) | |
64 | +- lStyle = DS_MODALFRAME | WS_CAPTION |DS_3DLOOK| WS_VISIBLE |DS_SETFONT; | |
65 | +- else | |
66 | +- lStyle = DS_MODALFRAME | WS_CAPTION |DS_3DLOOK| WS_VISIBLE; | |
67 | ++ lStyle = DS_MODALFRAME | WS_CAPTION | DS_3DLOOK | WS_VISIBLE | DS_SETFONT; | |
68 | + | |
69 | + add_long(lStyle); | |
70 | + add_long(0); // (lExtendedStyle) | |
71 | +@@ -7257,26 +7244,23 @@ gui_mch_dialog( | |
72 | + : (LPSTR)("Vim "VIM_VERSION_MEDIUM)), TRUE); | |
73 | + p += nchar; | |
74 | + | |
75 | +- if (s_usenewlook) | |
76 | +- { | |
77 | +- // do the font, since DS_3DLOOK doesn't work properly | |
78 | ++ // do the font, since DS_3DLOOK doesn't work properly | |
79 | + # ifdef USE_SYSMENU_FONT | |
80 | +- if (use_lfSysmenu) | |
81 | +- { | |
82 | +- // point size | |
83 | +- *p++ = -MulDiv(lfSysmenu.lfHeight, 72, | |
84 | +- GetDeviceCaps(hdc, LOGPIXELSY)); | |
85 | +- wcscpy(p, lfSysmenu.lfFaceName); | |
86 | +- nchar = (int)wcslen(lfSysmenu.lfFaceName) + 1; | |
87 | +- } | |
88 | +- else | |
89 | ++ if (use_lfSysmenu) | |
90 | ++ { | |
91 | ++ // point size | |
92 | ++ *p++ = -MulDiv(lfSysmenu.lfHeight, 72, | |
93 | ++ GetDeviceCaps(hdc, LOGPIXELSY)); | |
94 | ++ wcscpy(p, lfSysmenu.lfFaceName); | |
95 | ++ nchar = (int)wcslen(lfSysmenu.lfFaceName) + 1; | |
96 | ++ } | |
97 | ++ else | |
98 | + # endif | |
99 | +- { | |
100 | +- *p++ = DLG_FONT_POINT_SIZE; // point size | |
101 | +- nchar = nCopyAnsiToWideChar(p, DLG_FONT_NAME, FALSE); | |
102 | +- } | |
103 | +- p += nchar; | |
104 | +- } | |
105 | ++ { | |
106 | ++ *p++ = DLG_FONT_POINT_SIZE; // point size | |
107 | ++ nchar = nCopyAnsiToWideChar(p, DLG_FONT_NAME, FALSE); | |
108 | ++ } | |
109 | ++ p += nchar; | |
110 | + | |
111 | + buttonYpos = msgheight + 2 * dlgPaddingY; | |
112 | + | |
113 | +@@ -7619,23 +7603,20 @@ tearoff_callback( | |
114 | + | |
115 | + | |
116 | + /* | |
117 | +- * Decide whether to use the "new look" (small, non-bold font) or the "old | |
118 | +- * look" (big, clanky font) for dialogs, and work out a few values for use | |
119 | +- * later accordingly. | |
120 | ++ * Computes the dialog base units based on the current dialog font. | |
121 | ++ * We don't use the GetDialogBaseUnits() API, because we don't use the | |
122 | ++ * (old-style) system font. | |
123 | + */ | |
124 | + static void | |
125 | + get_dialog_font_metrics(void) | |
126 | + { | |
127 | + HDC hdc; | |
128 | + HFONT hfontTools = 0; | |
129 | +- DWORD dlgFontSize; | |
130 | + SIZE size; | |
131 | + #ifdef USE_SYSMENU_FONT | |
132 | + LOGFONTW lfSysmenu; | |
133 | + #endif | |
134 | + | |
135 | +- s_usenewlook = FALSE; | |
136 | +- | |
137 | + #ifdef USE_SYSMENU_FONT | |
138 | + if (gui_w32_get_menu_font(&lfSysmenu) == OK) | |
139 | + hfontTools = CreateFontIndirectW(&lfSysmenu); | |
140 | +@@ -7644,31 +7625,20 @@ get_dialog_font_metrics(void) | |
141 | + hfontTools = CreateFont(-DLG_FONT_POINT_SIZE, 0, 0, 0, 0, 0, 0, 0, | |
142 | + 0, 0, 0, 0, VARIABLE_PITCH, DLG_FONT_NAME); | |
143 | + | |
144 | +- if (hfontTools) | |
145 | +- { | |
146 | +- hdc = GetDC(s_hwnd); | |
147 | +- SelectObject(hdc, hfontTools); | |
148 | +- /* | |
149 | +- * GetTextMetrics() doesn't return the right value in | |
150 | +- * tmAveCharWidth, so we have to figure out the dialog base units | |
151 | +- * ourselves. | |
152 | +- */ | |
153 | +- GetTextExtentPoint(hdc, | |
154 | +- "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz", | |
155 | +- 52, &size); | |
156 | +- ReleaseDC(s_hwnd, hdc); | |
157 | +- | |
158 | +- s_dlgfntwidth = (WORD)((size.cx / 26 + 1) / 2); | |
159 | +- s_dlgfntheight = (WORD)size.cy; | |
160 | +- s_usenewlook = TRUE; | |
161 | +- } | |
162 | +- | |
163 | +- if (!s_usenewlook) | |
164 | +- { | |
165 | +- dlgFontSize = GetDialogBaseUnits(); // fall back to big old system | |
166 | +- s_dlgfntwidth = LOWORD(dlgFontSize); | |
167 | +- s_dlgfntheight = HIWORD(dlgFontSize); | |
168 | +- } | |
169 | ++ hdc = GetDC(s_hwnd); | |
170 | ++ SelectObject(hdc, hfontTools); | |
171 | ++ /* | |
172 | ++ * GetTextMetrics() doesn't return the right value in | |
173 | ++ * tmAveCharWidth, so we have to figure out the dialog base units | |
174 | ++ * ourselves. | |
175 | ++ */ | |
176 | ++ GetTextExtentPoint(hdc, | |
177 | ++ "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz", | |
178 | ++ 52, &size); | |
179 | ++ ReleaseDC(s_hwnd, hdc); | |
180 | ++ | |
181 | ++ s_dlgfntwidth = (WORD)((size.cx / 26 + 1) / 2); | |
182 | ++ s_dlgfntheight = (WORD)size.cy; | |
183 | + } | |
184 | + | |
185 | + #if defined(FEAT_MENU) && defined(FEAT_TEAROFF) | |
186 | +@@ -7747,12 +7717,10 @@ gui_mch_tearoff( | |
187 | + } | |
188 | + else | |
189 | + # endif | |
190 | +- font = CreateFont(-DLG_FONT_POINT_SIZE, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, | |
191 | +- VARIABLE_PITCH, DLG_FONT_NAME); | |
192 | +- if (s_usenewlook) | |
193 | +- oldFont = SelectFont(hdc, font); | |
194 | +- else | |
195 | +- oldFont = SelectFont(hdc, GetStockObject(SYSTEM_FONT)); | |
196 | ++ font = CreateFont(-DLG_FONT_POINT_SIZE, 0, 0, 0, 0, 0, 0, 0, | |
197 | ++ 0, 0, 0, 0, VARIABLE_PITCH, DLG_FONT_NAME); | |
198 | ++ | |
199 | ++ oldFont = SelectFont(hdc, font); | |
200 | + | |
201 | + // Calculate width of a single space. Used for padding columns to the | |
202 | + // right width. | |
203 | +@@ -7809,10 +7777,7 @@ gui_mch_tearoff( | |
204 | + dlgwidth += 2 * TEAROFF_PADDING_X + TEAROFF_BUTTON_PAD_X; | |
205 | + | |
206 | + // start to fill in the dlgtemplate information. addressing by WORDs | |
207 | +- if (s_usenewlook) | |
208 | +- lStyle = DS_MODALFRAME | WS_CAPTION| WS_SYSMENU |DS_SETFONT| WS_VISIBLE; | |
209 | +- else | |
210 | +- lStyle = DS_MODALFRAME | WS_CAPTION| WS_SYSMENU | WS_VISIBLE; | |
211 | ++ lStyle = DS_MODALFRAME | WS_CAPTION | WS_SYSMENU | DS_SETFONT | WS_VISIBLE; | |
212 | + | |
213 | + lExtendedStyle = WS_EX_TOOLWINDOW|WS_EX_STATICEDGE; | |
214 | + *p++ = LOWORD(lStyle); | |
215 | +@@ -7842,26 +7807,23 @@ gui_mch_tearoff( | |
216 | + : (LPSTR)("Vim "VIM_VERSION_MEDIUM)), TRUE); | |
217 | + p += nchar; | |
218 | + | |
219 | +- if (s_usenewlook) | |
220 | +- { | |
221 | +- // do the font, since DS_3DLOOK doesn't work properly | |
222 | ++ // do the font, since DS_3DLOOK doesn't work properly | |
223 | + # ifdef USE_SYSMENU_FONT | |
224 | +- if (use_lfSysmenu) | |
225 | +- { | |
226 | +- // point size | |
227 | +- *p++ = -MulDiv(lfSysmenu.lfHeight, 72, | |
228 | +- GetDeviceCaps(hdc, LOGPIXELSY)); | |
229 | +- wcscpy(p, lfSysmenu.lfFaceName); | |
230 | +- nchar = (int)wcslen(lfSysmenu.lfFaceName) + 1; | |
231 | +- } | |
232 | +- else | |
233 | ++ if (use_lfSysmenu) | |
234 | ++ { | |
235 | ++ // point size | |
236 | ++ *p++ = -MulDiv(lfSysmenu.lfHeight, 72, | |
237 | ++ GetDeviceCaps(hdc, LOGPIXELSY)); | |
238 | ++ wcscpy(p, lfSysmenu.lfFaceName); | |
239 | ++ nchar = (int)wcslen(lfSysmenu.lfFaceName) + 1; | |
240 | ++ } | |
241 | ++ else | |
242 | + # endif | |
243 | +- { | |
244 | +- *p++ = DLG_FONT_POINT_SIZE; // point size | |
245 | +- nchar = nCopyAnsiToWideChar(p, DLG_FONT_NAME, FALSE); | |
246 | +- } | |
247 | +- p += nchar; | |
248 | +- } | |
249 | ++ { | |
250 | ++ *p++ = DLG_FONT_POINT_SIZE; // point size | |
251 | ++ nchar = nCopyAnsiToWideChar(p, DLG_FONT_NAME, FALSE); | |
252 | ++ } | |
253 | ++ p += nchar; | |
254 | + | |
255 | + /* | |
256 | + * Loop over all the items in the menu. |