]>
Commit | Line | Data |
---|---|---|
eb6c80df | 1 | To: vim_dev@googlegroups.com |
2 | Subject: Patch 7.3.271 | |
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.271 | |
11 | Problem: Code not following Vim coding style. | |
12 | Solution: Fix the style. (Elias Diem) | |
13 | Files: src/gui_photon.c | |
14 | ||
15 | ||
16 | *** ../vim-7.3.270/src/gui_photon.c 2011-07-27 14:09:05.000000000 +0200 | |
17 | --- src/gui_photon.c 2011-08-10 12:18:35.000000000 +0200 | |
18 | *************** | |
19 | *** 358,378 **** | |
20 | } | |
21 | ||
22 | static int | |
23 | ! gui_ph_handle_window_cb( PtWidget_t *widget, void *data, PtCallbackInfo_t *info ) | |
24 | { | |
25 | PhWindowEvent_t *we = info->cbdata; | |
26 | ushort_t *width, *height; | |
27 | ||
28 | ! switch( we->event_f ) { | |
29 | case Ph_WM_CLOSE: | |
30 | gui_shell_closed(); | |
31 | break; | |
32 | ||
33 | case Ph_WM_FOCUS: | |
34 | /* Just in case it's hidden and needs to be shown */ | |
35 | ! gui_mch_mousehide( MOUSE_SHOW ); | |
36 | ||
37 | ! if( we->event_state == Ph_WM_EVSTATE_FOCUS ) | |
38 | { | |
39 | gui_focus_change(TRUE); | |
40 | gui_mch_start_blink(); | |
41 | --- 358,378 ---- | |
42 | } | |
43 | ||
44 | static int | |
45 | ! gui_ph_handle_window_cb(PtWidget_t *widget, void *data, PtCallbackInfo_t *info) | |
46 | { | |
47 | PhWindowEvent_t *we = info->cbdata; | |
48 | ushort_t *width, *height; | |
49 | ||
50 | ! switch (we->event_f) { | |
51 | case Ph_WM_CLOSE: | |
52 | gui_shell_closed(); | |
53 | break; | |
54 | ||
55 | case Ph_WM_FOCUS: | |
56 | /* Just in case it's hidden and needs to be shown */ | |
57 | ! gui_mch_mousehide(MOUSE_SHOW); | |
58 | ||
59 | ! if (we->event_state == Ph_WM_EVSTATE_FOCUS) | |
60 | { | |
61 | gui_focus_change(TRUE); | |
62 | gui_mch_start_blink(); | |
63 | *************** | |
64 | *** 385,401 **** | |
65 | break; | |
66 | ||
67 | case Ph_WM_RESIZE: | |
68 | ! PtGetResource( gui.vimWindow, Pt_ARG_WIDTH, &width, 0 ); | |
69 | ! PtGetResource( gui.vimWindow, Pt_ARG_HEIGHT, &height, 0 ); | |
70 | #ifdef USE_PANEL_GROUP | |
71 | width -= (pg_margin_left + pg_margin_right); | |
72 | height -= (pg_margin_top + pg_margin_bottom); | |
73 | #endif | |
74 | ! gui_resize_shell( *width, *height ); | |
75 | ! gui_set_shellsize( FALSE, FALSE, RESIZE_BOTH ); | |
76 | is_ignore_draw = FALSE; | |
77 | ! PtEndFlux( gui.vimContainer ); | |
78 | ! PtContainerRelease( gui.vimContainer ); | |
79 | break; | |
80 | ||
81 | default: | |
82 | --- 385,401 ---- | |
83 | break; | |
84 | ||
85 | case Ph_WM_RESIZE: | |
86 | ! PtGetResource(gui.vimWindow, Pt_ARG_WIDTH, &width, 0); | |
87 | ! PtGetResource(gui.vimWindow, Pt_ARG_HEIGHT, &height, 0); | |
88 | #ifdef USE_PANEL_GROUP | |
89 | width -= (pg_margin_left + pg_margin_right); | |
90 | height -= (pg_margin_top + pg_margin_bottom); | |
91 | #endif | |
92 | ! gui_resize_shell(*width, *height); | |
93 | ! gui_set_shellsize(FALSE, FALSE, RESIZE_BOTH); | |
94 | is_ignore_draw = FALSE; | |
95 | ! PtEndFlux(gui.vimContainer); | |
96 | ! PtContainerRelease(gui.vimContainer); | |
97 | break; | |
98 | ||
99 | default: | |
100 | *************** | |
101 | *** 406,412 **** | |
102 | } | |
103 | ||
104 | static int | |
105 | ! gui_ph_handle_scrollbar( PtWidget_t *widget, void *data, PtCallbackInfo_t *info ) | |
106 | { | |
107 | PtScrollbarCallback_t *scroll; | |
108 | scrollbar_T *sb; | |
109 | --- 406,412 ---- | |
110 | } | |
111 | ||
112 | static int | |
113 | ! gui_ph_handle_scrollbar(PtWidget_t *widget, void *data, PtCallbackInfo_t *info) | |
114 | { | |
115 | PtScrollbarCallback_t *scroll; | |
116 | scrollbar_T *sb; | |
117 | *************** | |
118 | *** 415,424 **** | |
119 | scroll = info->cbdata; | |
120 | ||
121 | sb = (scrollbar_T *) data; | |
122 | ! if( sb != NULL ) | |
123 | { | |
124 | value = scroll->position; | |
125 | ! switch( scroll->action ) | |
126 | { | |
127 | case Pt_SCROLL_DRAGGED: | |
128 | dragging = TRUE; | |
129 | --- 415,424 ---- | |
130 | scroll = info->cbdata; | |
131 | ||
132 | sb = (scrollbar_T *) data; | |
133 | ! if (sb != NULL) | |
134 | { | |
135 | value = scroll->position; | |
136 | ! switch (scroll->action) | |
137 | { | |
138 | case Pt_SCROLL_DRAGGED: | |
139 | dragging = TRUE; | |
140 | *************** | |
141 | *** 436,532 **** | |
142 | } | |
143 | ||
144 | static int | |
145 | ! gui_ph_handle_keyboard( PtWidget_t *widget, void *data, PtCallbackInfo_t *info ) | |
146 | { | |
147 | PhKeyEvent_t *key; | |
148 | unsigned char string[6]; | |
149 | int len, i; | |
150 | int ch, modifiers; | |
151 | ||
152 | ! key = PhGetData( info->event ); | |
153 | ||
154 | ch = modifiers = len = 0; | |
155 | ||
156 | ! if( p_mh ) | |
157 | ! gui_mch_mousehide( MOUSE_HIDE ); | |
158 | ||
159 | /* We're a good lil photon program, aren't we? yes we are, yeess wee arrr */ | |
160 | ! if( key->key_flags & Pk_KF_Compose ) | |
161 | { | |
162 | return Pt_CONTINUE; | |
163 | } | |
164 | ||
165 | ! if( (key->key_flags & Pk_KF_Cap_Valid) && | |
166 | ! PkIsKeyDown( key->key_flags ) ) | |
167 | { | |
168 | #ifdef FEAT_MENU | |
169 | /* | |
170 | * Only show the menu if the Alt key is down, and the Shift & Ctrl | |
171 | * keys aren't down, as well as the other conditions | |
172 | */ | |
173 | ! if( ( ( key->key_mods & Pk_KM_Alt ) && | |
174 | ! !( key->key_mods & Pk_KM_Shift ) && | |
175 | ! !( key->key_mods & Pk_KM_Ctrl ) ) && | |
176 | gui.menu_is_active && | |
177 | ! ( *p_wak == 'y' || | |
178 | ! ( *p_wak == 'm' && | |
179 | ! gui_is_menu_shortcut( key->key_cap ) ) ) ) | |
180 | { | |
181 | /* Fallthrough and let photon look for the hotkey */ | |
182 | return Pt_CONTINUE; | |
183 | } | |
184 | #endif | |
185 | ||
186 | ! for( i = 0; special_keys[i].key_sym != 0; i++ ) | |
187 | { | |
188 | ! if( special_keys[i].key_sym == key->key_cap ) | |
189 | { | |
190 | len = 0; | |
191 | ! if( special_keys[i].vim_code1 == NUL ) | |
192 | ch = special_keys[i].vim_code0; | |
193 | else | |
194 | { | |
195 | /* Detect if a keypad number key has been pressed | |
196 | * and change the key if Num Lock is on */ | |
197 | ! if( key->key_cap >= Pk_KP_Enter && key->key_cap <= Pk_KP_9 | |
198 | ! && ( key->key_mods & Pk_KM_Num_Lock ) ) | |
199 | { | |
200 | /* FIXME: For now, just map the key to a ascii value | |
201 | * (see <photon/PkKeyDef.h>) */ | |
202 | ch = key->key_cap - 0xf080; | |
203 | } | |
204 | else | |
205 | ! ch = TO_SPECIAL( special_keys[i].vim_code0, | |
206 | ! special_keys[i].vim_code1 ); | |
207 | } | |
208 | break; | |
209 | } | |
210 | } | |
211 | ||
212 | ! if( key->key_mods & Pk_KM_Ctrl ) | |
213 | modifiers |= MOD_MASK_CTRL; | |
214 | ! if( key->key_mods & Pk_KM_Alt ) | |
215 | modifiers |= MOD_MASK_ALT; | |
216 | ! if( key->key_mods & Pk_KM_Shift ) | |
217 | modifiers |= MOD_MASK_SHIFT; | |
218 | ||
219 | /* Is this not a special key? */ | |
220 | ! if( special_keys[i].key_sym == 0 ) | |
221 | { | |
222 | ! ch = PhTo8859_1( key ); | |
223 | ! if( ch == -1 | |
224 | #ifdef FEAT_MBYTE | |
225 | ! || ( enc_utf8 && ch > 127 ) | |
226 | #endif | |
227 | ) | |
228 | { | |
229 | #ifdef FEAT_MBYTE | |
230 | ! len = PhKeyToMb( string, key ); | |
231 | ! if( len > 0 ) | |
232 | { | |
233 | static char buf[6]; | |
234 | int src_taken, dst_made; | |
235 | ! if( enc_utf8 != TRUE ) | |
236 | { | |
237 | PxTranslateFromUTF( | |
238 | charset_translate, | |
239 | --- 436,532 ---- | |
240 | } | |
241 | ||
242 | static int | |
243 | ! gui_ph_handle_keyboard(PtWidget_t *widget, void *data, PtCallbackInfo_t *info) | |
244 | { | |
245 | PhKeyEvent_t *key; | |
246 | unsigned char string[6]; | |
247 | int len, i; | |
248 | int ch, modifiers; | |
249 | ||
250 | ! key = PhGetData(info->event); | |
251 | ||
252 | ch = modifiers = len = 0; | |
253 | ||
254 | ! if (p_mh) | |
255 | ! gui_mch_mousehide(MOUSE_HIDE); | |
256 | ||
257 | /* We're a good lil photon program, aren't we? yes we are, yeess wee arrr */ | |
258 | ! if (key->key_flags & Pk_KF_Compose) | |
259 | { | |
260 | return Pt_CONTINUE; | |
261 | } | |
262 | ||
263 | ! if ((key->key_flags & Pk_KF_Cap_Valid) && | |
264 | ! PkIsKeyDown(key->key_flags)) | |
265 | { | |
266 | #ifdef FEAT_MENU | |
267 | /* | |
268 | * Only show the menu if the Alt key is down, and the Shift & Ctrl | |
269 | * keys aren't down, as well as the other conditions | |
270 | */ | |
271 | ! if (((key->key_mods & Pk_KM_Alt) && | |
272 | ! !(key->key_mods & Pk_KM_Shift) && | |
273 | ! !(key->key_mods & Pk_KM_Ctrl)) && | |
274 | gui.menu_is_active && | |
275 | ! (*p_wak == 'y' || | |
276 | ! (*p_wak == 'm' && | |
277 | ! gui_is_menu_shortcut(key->key_cap)))) | |
278 | { | |
279 | /* Fallthrough and let photon look for the hotkey */ | |
280 | return Pt_CONTINUE; | |
281 | } | |
282 | #endif | |
283 | ||
284 | ! for(i = 0; special_keys[i].key_sym != 0; i++) | |
285 | { | |
286 | ! if (special_keys[i].key_sym == key->key_cap) | |
287 | { | |
288 | len = 0; | |
289 | ! if (special_keys[i].vim_code1 == NUL) | |
290 | ch = special_keys[i].vim_code0; | |
291 | else | |
292 | { | |
293 | /* Detect if a keypad number key has been pressed | |
294 | * and change the key if Num Lock is on */ | |
295 | ! if (key->key_cap >= Pk_KP_Enter && key->key_cap <= Pk_KP_9 | |
296 | ! && (key->key_mods & Pk_KM_Num_Lock)) | |
297 | { | |
298 | /* FIXME: For now, just map the key to a ascii value | |
299 | * (see <photon/PkKeyDef.h>) */ | |
300 | ch = key->key_cap - 0xf080; | |
301 | } | |
302 | else | |
303 | ! ch = TO_SPECIAL(special_keys[i].vim_code0, | |
304 | ! special_keys[i].vim_code1); | |
305 | } | |
306 | break; | |
307 | } | |
308 | } | |
309 | ||
310 | ! if (key->key_mods & Pk_KM_Ctrl) | |
311 | modifiers |= MOD_MASK_CTRL; | |
312 | ! if (key->key_mods & Pk_KM_Alt) | |
313 | modifiers |= MOD_MASK_ALT; | |
314 | ! if (key->key_mods & Pk_KM_Shift) | |
315 | modifiers |= MOD_MASK_SHIFT; | |
316 | ||
317 | /* Is this not a special key? */ | |
318 | ! if (special_keys[i].key_sym == 0) | |
319 | { | |
320 | ! ch = PhTo8859_1(key); | |
321 | ! if (ch == -1 | |
322 | #ifdef FEAT_MBYTE | |
323 | ! || (enc_utf8 && ch > 127) | |
324 | #endif | |
325 | ) | |
326 | { | |
327 | #ifdef FEAT_MBYTE | |
328 | ! len = PhKeyToMb(string, key); | |
329 | ! if (len > 0) | |
330 | { | |
331 | static char buf[6]; | |
332 | int src_taken, dst_made; | |
333 | ! if (enc_utf8 != TRUE) | |
334 | { | |
335 | PxTranslateFromUTF( | |
336 | charset_translate, | |
337 | *************** | |
338 | *** 2931,2943 **** | |
339 | name_len = (int_u) ( mark - vim_font ); | |
340 | ||
341 | *font_name = vim_strnsave( vim_font, name_len ); | |
342 | ! if( *font_name != NULL ) | |
343 | { | |
344 | ! if( mark != NULL ) | |
345 | { | |
346 | ! while( *mark != NUL && *mark++ == ':') | |
347 | { | |
348 | ! switch( tolower( *mark++ ) ) | |
349 | { | |
350 | case 'a': *font_flags |= PF_STYLE_ANTIALIAS; break; | |
351 | case 'b': *font_flags |= PF_STYLE_BOLD; break; | |
352 | --- 2931,2943 ---- | |
353 | name_len = (int_u) ( mark - vim_font ); | |
354 | ||
355 | *font_name = vim_strnsave( vim_font, name_len ); | |
356 | ! if (*font_name != NULL) | |
357 | { | |
358 | ! if (mark != NULL) | |
359 | { | |
360 | ! while (*mark != NUL && *mark++ == ':') | |
361 | { | |
362 | ! switch (tolower(*mark++)) | |
363 | { | |
364 | case 'a': *font_flags |= PF_STYLE_ANTIALIAS; break; | |
365 | case 'b': *font_flags |= PF_STYLE_BOLD; break; | |
366 | *************** | |
367 | *** 2946,2952 **** | |
368 | case 's': | |
369 | size = getdigits( &mark ); | |
370 | /* Restrict the size to some vague limits */ | |
371 | ! if( size < 1 || size > 100 ) | |
372 | size = 8; | |
373 | ||
374 | *font_size = size; | |
375 | --- 2946,2952 ---- | |
376 | case 's': | |
377 | size = getdigits( &mark ); | |
378 | /* Restrict the size to some vague limits */ | |
379 | ! if (size < 1 || size > 100) | |
380 | size = 8; | |
381 | ||
382 | *font_size = size; | |
383 | *************** | |
384 | *** 2973,2990 **** | |
385 | FontQueryInfo info; | |
386 | PhRect_t extent; | |
387 | ||
388 | ! if( vim_font_name == NULL ) | |
389 | { | |
390 | /* Default font */ | |
391 | vim_font_name = "PC Terminal"; | |
392 | } | |
393 | ||
394 | ! if( STRCMP( vim_font_name, "*" ) == 0 ) | |
395 | { | |
396 | font_tag = PtFontSelection( gui.vimWindow, NULL, NULL, | |
397 | "pcterm12", -1, PHFONT_FIXED, NULL ); | |
398 | ||
399 | ! if( font_tag == NULL ) | |
400 | return FAIL; | |
401 | ||
402 | gui_mch_free_font( gui.norm_font ); | |
403 | --- 2973,2990 ---- | |
404 | FontQueryInfo info; | |
405 | PhRect_t extent; | |
406 | ||
407 | ! if (vim_font_name == NULL) | |
408 | { | |
409 | /* Default font */ | |
410 | vim_font_name = "PC Terminal"; | |
411 | } | |
412 | ||
413 | ! if (STRCMP( vim_font_name, "*" ) == 0) | |
414 | { | |
415 | font_tag = PtFontSelection( gui.vimWindow, NULL, NULL, | |
416 | "pcterm12", -1, PHFONT_FIXED, NULL ); | |
417 | ||
418 | ! if (font_tag == NULL) | |
419 | return FAIL; | |
420 | ||
421 | gui_mch_free_font( gui.norm_font ); | |
422 | *************** | |
423 | *** 2995,3006 **** | |
424 | } | |
425 | else | |
426 | { | |
427 | ! if( gui_ph_parse_font_name( vim_font_name, &font_name, &font_flags, | |
428 | ! &font_size ) == FALSE ) | |
429 | return FAIL; | |
430 | ||
431 | font_tag = gui_ph_get_font( font_name, font_flags, font_size, 0 ); | |
432 | ! if( font_tag == NULL ) | |
433 | { | |
434 | vim_free( font_name ); | |
435 | return FAIL; | |
436 | --- 2995,3006 ---- | |
437 | } | |
438 | else | |
439 | { | |
440 | ! if (gui_ph_parse_font_name( vim_font_name, &font_name, &font_flags, | |
441 | ! &font_size ) == FALSE) | |
442 | return FAIL; | |
443 | ||
444 | font_tag = gui_ph_get_font( font_name, font_flags, font_size, 0 ); | |
445 | ! if (font_tag == NULL) | |
446 | { | |
447 | vim_free( font_name ); | |
448 | return FAIL; | |
449 | *************** | |
450 | *** 3053,3069 **** | |
451 | int_u font_size = 12; | |
452 | int_u font_flags = 0; | |
453 | ||
454 | ! if( gui_ph_parse_font_name( vim_font_name, &font_name, &font_flags, | |
455 | ! &font_size ) != FALSE ) | |
456 | { | |
457 | font_tag = gui_ph_get_font( font_name, font_flags, font_size, -1 ); | |
458 | vim_free( font_name ); | |
459 | ||
460 | ! if( font_tag != NULL ) | |
461 | return (GuiFont)font_tag; | |
462 | } | |
463 | ||
464 | ! if( report_error ) | |
465 | EMSG2(e_font, vim_font_name ); | |
466 | ||
467 | return FAIL; | |
468 | --- 3053,3069 ---- | |
469 | int_u font_size = 12; | |
470 | int_u font_flags = 0; | |
471 | ||
472 | ! if (gui_ph_parse_font_name( vim_font_name, &font_name, &font_flags, | |
473 | ! &font_size ) != FALSE) | |
474 | { | |
475 | font_tag = gui_ph_get_font( font_name, font_flags, font_size, -1 ); | |
476 | vim_free( font_name ); | |
477 | ||
478 | ! if (font_tag != NULL) | |
479 | return (GuiFont)font_tag; | |
480 | } | |
481 | ||
482 | ! if (report_error) | |
483 | EMSG2(e_font, vim_font_name ); | |
484 | ||
485 | return FAIL; | |
486 | *** ../vim-7.3.270/src/version.c 2011-08-10 12:10:55.000000000 +0200 | |
487 | --- src/version.c 2011-08-10 12:17:06.000000000 +0200 | |
488 | *************** | |
489 | *** 711,712 **** | |
490 | --- 711,714 ---- | |
491 | { /* Add new patch number below this line */ | |
492 | + /**/ | |
493 | + 271, | |
494 | /**/ | |
495 | ||
496 | -- | |
497 | An indication you must be a manager: | |
498 | You believe you never have any problems in your life, just | |
499 | "issues" and "improvement opportunities". | |
500 | ||
501 | /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ | |
502 | /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\ | |
503 | \\\ an exciting new programming language -- http://www.Zimbu.org /// | |
504 | \\\ help me help AIDS victims -- http://ICCF-Holland.org /// |