]>
Commit | Line | Data |
---|---|---|
c6060300 MT |
1 | To: vim_dev@googlegroups.com |
2 | Subject: Patch 7.3.299 | |
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.299 | |
11 | Problem: Source code not in Vim style. | |
12 | Solution: Adjust the style. (Elias Diem) | |
13 | Files: src/gui_photon.c | |
14 | ||
15 | ||
16 | *** ../vim-7.3.298/src/gui_photon.c 2011-09-07 18:58:24.000000000 +0200 | |
17 | --- src/gui_photon.c 2011-09-07 19:02:59.000000000 +0200 | |
18 | *************** | |
19 | *** 535,547 **** | |
20 | &src_taken, | |
21 | buf, | |
22 | 6, | |
23 | ! &dst_made ); | |
24 | ||
25 | ! add_to_input_buf( buf, dst_made ); | |
26 | } | |
27 | else | |
28 | { | |
29 | ! add_to_input_buf( string, len ); | |
30 | } | |
31 | ||
32 | return Pt_CONSUME; | |
33 | --- 535,547 ---- | |
34 | &src_taken, | |
35 | buf, | |
36 | 6, | |
37 | ! &dst_made); | |
38 | ||
39 | ! add_to_input_buf(buf, dst_made); | |
40 | } | |
41 | else | |
42 | { | |
43 | ! add_to_input_buf(string, len); | |
44 | } | |
45 | ||
46 | return Pt_CONSUME; | |
47 | *************** | |
48 | *** 549,579 **** | |
49 | len = 0; | |
50 | #endif | |
51 | ch = key->key_cap; | |
52 | ! if( ch < 0xff ) | |
53 | { | |
54 | /* FIXME: is this the right thing to do? */ | |
55 | ! if( modifiers & MOD_MASK_CTRL ) | |
56 | { | |
57 | modifiers &= ~MOD_MASK_CTRL; | |
58 | ||
59 | ! if( ( ch >= 'a' && ch <= 'z' ) || | |
60 | ch == '[' || | |
61 | ch == ']' || | |
62 | ! ch == '\\' ) | |
63 | ! ch = Ctrl_chr( ch ); | |
64 | ! else if( ch == '2' ) | |
65 | ch = NUL; | |
66 | ! else if( ch == '6' ) | |
67 | ch = 0x1e; | |
68 | ! else if( ch == '-' ) | |
69 | ch = 0x1f; | |
70 | else | |
71 | modifiers |= MOD_MASK_CTRL; | |
72 | } | |
73 | ||
74 | ! if( modifiers & MOD_MASK_ALT ) | |
75 | { | |
76 | ! ch = Meta( ch ); | |
77 | modifiers &= ~MOD_MASK_ALT; | |
78 | } | |
79 | } | |
80 | --- 549,579 ---- | |
81 | len = 0; | |
82 | #endif | |
83 | ch = key->key_cap; | |
84 | ! if (ch < 0xff) | |
85 | { | |
86 | /* FIXME: is this the right thing to do? */ | |
87 | ! if (modifiers & MOD_MASK_CTRL) | |
88 | { | |
89 | modifiers &= ~MOD_MASK_CTRL; | |
90 | ||
91 | ! if ((ch >= 'a' && ch <= 'z') || | |
92 | ch == '[' || | |
93 | ch == ']' || | |
94 | ! ch == '\\') | |
95 | ! ch = Ctrl_chr(ch); | |
96 | ! else if (ch == '2') | |
97 | ch = NUL; | |
98 | ! else if (ch == '6') | |
99 | ch = 0x1e; | |
100 | ! else if (ch == '-') | |
101 | ch = 0x1f; | |
102 | else | |
103 | modifiers |= MOD_MASK_CTRL; | |
104 | } | |
105 | ||
106 | ! if (modifiers & MOD_MASK_ALT) | |
107 | { | |
108 | ! ch = Meta(ch); | |
109 | modifiers &= ~MOD_MASK_ALT; | |
110 | } | |
111 | } | |
112 | *************** | |
113 | *** 586,604 **** | |
114 | modifiers &= ~MOD_MASK_SHIFT; | |
115 | } | |
116 | ||
117 | ! ch = simplify_key( ch, &modifiers ); | |
118 | ! if( modifiers ) | |
119 | { | |
120 | string[ len++ ] = CSI; | |
121 | string[ len++ ] = KS_MODIFIER; | |
122 | string[ len++ ] = modifiers; | |
123 | } | |
124 | ||
125 | ! if( IS_SPECIAL( ch ) ) | |
126 | { | |
127 | string[ len++ ] = CSI; | |
128 | ! string[ len++ ] = K_SECOND( ch ); | |
129 | ! string[ len++ ] = K_THIRD( ch ); | |
130 | } | |
131 | else | |
132 | { | |
133 | --- 586,604 ---- | |
134 | modifiers &= ~MOD_MASK_SHIFT; | |
135 | } | |
136 | ||
137 | ! ch = simplify_key(ch, &modifiers); | |
138 | ! if (modifiers) | |
139 | { | |
140 | string[ len++ ] = CSI; | |
141 | string[ len++ ] = KS_MODIFIER; | |
142 | string[ len++ ] = modifiers; | |
143 | } | |
144 | ||
145 | ! if (IS_SPECIAL(ch)) | |
146 | { | |
147 | string[ len++ ] = CSI; | |
148 | ! string[ len++ ] = K_SECOND(ch); | |
149 | ! string[ len++ ] = K_THIRD(ch); | |
150 | } | |
151 | else | |
152 | { | |
153 | *************** | |
154 | *** 619,627 **** | |
155 | string[ len++ ] = KE_CSI; | |
156 | } | |
157 | ||
158 | ! if( len > 0 ) | |
159 | { | |
160 | ! add_to_input_buf( string, len ); | |
161 | return Pt_CONSUME; | |
162 | } | |
163 | } | |
164 | --- 619,627 ---- | |
165 | string[ len++ ] = KE_CSI; | |
166 | } | |
167 | ||
168 | ! if (len > 0) | |
169 | { | |
170 | ! add_to_input_buf(string, len); | |
171 | return Pt_CONSUME; | |
172 | } | |
173 | } | |
174 | *************** | |
175 | *** 630,646 **** | |
176 | } | |
177 | ||
178 | static int | |
179 | ! gui_ph_handle_mouse( PtWidget_t *widget, void *data, PtCallbackInfo_t *info ) | |
180 | { | |
181 | PhPointerEvent_t *pointer; | |
182 | PhRect_t *pos; | |
183 | int button = 0, repeated_click, modifiers = 0x0; | |
184 | short mouse_x, mouse_y; | |
185 | ||
186 | ! pointer = PhGetData( info->event ); | |
187 | ! pos = PhGetRects( info->event ); | |
188 | ||
189 | ! gui_mch_mousehide( MOUSE_SHOW ); | |
190 | ||
191 | /* | |
192 | * Coordinates need to be relative to the base window, | |
193 | --- 630,646 ---- | |
194 | } | |
195 | ||
196 | static int | |
197 | ! gui_ph_handle_mouse(PtWidget_t *widget, void *data, PtCallbackInfo_t *info) | |
198 | { | |
199 | PhPointerEvent_t *pointer; | |
200 | PhRect_t *pos; | |
201 | int button = 0, repeated_click, modifiers = 0x0; | |
202 | short mouse_x, mouse_y; | |
203 | ||
204 | ! pointer = PhGetData(info->event); | |
205 | ! pos = PhGetRects(info->event); | |
206 | ||
207 | ! gui_mch_mousehide(MOUSE_SHOW); | |
208 | ||
209 | /* | |
210 | * Coordinates need to be relative to the base window, | |
211 | *************** | |
212 | *** 649,675 **** | |
213 | mouse_x = pos->ul.x + gui.border_width; | |
214 | mouse_y = pos->ul.y + gui.border_width; | |
215 | ||
216 | ! if( info->event->type == Ph_EV_PTR_MOTION_NOBUTTON ) | |
217 | { | |
218 | ! gui_mouse_moved( mouse_x, mouse_y ); | |
219 | return Pt_CONTINUE; | |
220 | } | |
221 | ||
222 | ! if( pointer->key_mods & Pk_KM_Shift ) | |
223 | modifiers |= MOUSE_SHIFT; | |
224 | ! if( pointer->key_mods & Pk_KM_Ctrl ) | |
225 | modifiers |= MOUSE_CTRL; | |
226 | ! if( pointer->key_mods & Pk_KM_Alt ) | |
227 | modifiers |= MOUSE_ALT; | |
228 | ||
229 | /* | |
230 | * FIXME More than one button may be involved, but for | |
231 | * now just deal with one | |
232 | */ | |
233 | ! if( pointer->buttons & Ph_BUTTON_SELECT ) | |
234 | button = MOUSE_LEFT; | |
235 | ||
236 | ! if( pointer->buttons & Ph_BUTTON_MENU ) | |
237 | { | |
238 | button = MOUSE_RIGHT; | |
239 | /* Need the absolute coordinates for the popup menu */ | |
240 | --- 649,675 ---- | |
241 | mouse_x = pos->ul.x + gui.border_width; | |
242 | mouse_y = pos->ul.y + gui.border_width; | |
243 | ||
244 | ! if (info->event->type == Ph_EV_PTR_MOTION_NOBUTTON) | |
245 | { | |
246 | ! gui_mouse_moved(mouse_x, mouse_y); | |
247 | return Pt_CONTINUE; | |
248 | } | |
249 | ||
250 | ! if (pointer->key_mods & Pk_KM_Shift) | |
251 | modifiers |= MOUSE_SHIFT; | |
252 | ! if (pointer->key_mods & Pk_KM_Ctrl) | |
253 | modifiers |= MOUSE_CTRL; | |
254 | ! if (pointer->key_mods & Pk_KM_Alt) | |
255 | modifiers |= MOUSE_ALT; | |
256 | ||
257 | /* | |
258 | * FIXME More than one button may be involved, but for | |
259 | * now just deal with one | |
260 | */ | |
261 | ! if (pointer->buttons & Ph_BUTTON_SELECT) | |
262 | button = MOUSE_LEFT; | |
263 | ||
264 | ! if (pointer->buttons & Ph_BUTTON_MENU) | |
265 | { | |
266 | button = MOUSE_RIGHT; | |
267 | /* Need the absolute coordinates for the popup menu */ | |
268 | *************** | |
269 | *** 677,705 **** | |
270 | abs_mouse.y = pointer->pos.y; | |
271 | } | |
272 | ||
273 | ! if( pointer->buttons & Ph_BUTTON_ADJUST ) | |
274 | button = MOUSE_MIDDLE; | |
275 | ||
276 | /* Catch a real release (not phantom or other releases */ | |
277 | ! if( info->event->type == Ph_EV_BUT_RELEASE ) | |
278 | button = MOUSE_RELEASE; | |
279 | ||
280 | ! if( info->event->type & Ph_EV_PTR_MOTION_BUTTON ) | |
281 | button = MOUSE_DRAG; | |
282 | ||
283 | #if 0 | |
284 | /* Vim doesn't use button repeats */ | |
285 | ! if( info->event->type & Ph_EV_BUT_REPEAT ) | |
286 | button = MOUSE_DRAG; | |
287 | #endif | |
288 | ||
289 | /* Don't do anything if it is one of the phantom mouse release events */ | |
290 | ! if( ( button != MOUSE_RELEASE ) || | |
291 | ! ( info->event->subtype == Ph_EV_RELEASE_REAL ) ) | |
292 | { | |
293 | repeated_click = (pointer->click_count >= 2) ? TRUE : FALSE; | |
294 | ||
295 | ! gui_send_mouse_event( button , mouse_x, mouse_y, repeated_click, modifiers ); | |
296 | } | |
297 | ||
298 | return Pt_CONTINUE; | |
299 | --- 677,705 ---- | |
300 | abs_mouse.y = pointer->pos.y; | |
301 | } | |
302 | ||
303 | ! if (pointer->buttons & Ph_BUTTON_ADJUST) | |
304 | button = MOUSE_MIDDLE; | |
305 | ||
306 | /* Catch a real release (not phantom or other releases */ | |
307 | ! if (info->event->type == Ph_EV_BUT_RELEASE) | |
308 | button = MOUSE_RELEASE; | |
309 | ||
310 | ! if (info->event->type & Ph_EV_PTR_MOTION_BUTTON) | |
311 | button = MOUSE_DRAG; | |
312 | ||
313 | #if 0 | |
314 | /* Vim doesn't use button repeats */ | |
315 | ! if (info->event->type & Ph_EV_BUT_REPEAT) | |
316 | button = MOUSE_DRAG; | |
317 | #endif | |
318 | ||
319 | /* Don't do anything if it is one of the phantom mouse release events */ | |
320 | ! if ((button != MOUSE_RELEASE) || | |
321 | ! (info->event->subtype == Ph_EV_RELEASE_REAL)) | |
322 | { | |
323 | repeated_click = (pointer->click_count >= 2) ? TRUE : FALSE; | |
324 | ||
325 | ! gui_send_mouse_event(button , mouse_x, mouse_y, repeated_click, modifiers); | |
326 | } | |
327 | ||
328 | return Pt_CONTINUE; | |
329 | *************** | |
330 | *** 707,741 **** | |
331 | ||
332 | /* Handle a focus change of the PtRaw widget */ | |
333 | static int | |
334 | ! gui_ph_handle_focus( PtWidget_t *widget, void *data, PtCallbackInfo_t *info ) | |
335 | { | |
336 | ! if( info->reason == Pt_CB_LOST_FOCUS ) | |
337 | { | |
338 | ! PtRemoveEventHandler( gui.vimTextArea, Ph_EV_PTR_MOTION_NOBUTTON, | |
339 | ! gui_ph_handle_mouse, NULL ); | |
340 | ||
341 | ! gui_mch_mousehide( MOUSE_SHOW ); | |
342 | } | |
343 | else | |
344 | { | |
345 | ! PtAddEventHandler( gui.vimTextArea, Ph_EV_PTR_MOTION_NOBUTTON, | |
346 | ! gui_ph_handle_mouse, NULL ); | |
347 | } | |
348 | return Pt_CONTINUE; | |
349 | } | |
350 | ||
351 | static void | |
352 | ! gui_ph_handle_raw_draw( PtWidget_t *widget, PhTile_t *damage ) | |
353 | { | |
354 | PhRect_t *r; | |
355 | PhPoint_t offset; | |
356 | PhPoint_t translation; | |
357 | ||
358 | ! if( is_ignore_draw == TRUE ) | |
359 | return; | |
360 | ||
361 | ! PtSuperClassDraw( PtBasic, widget, damage ); | |
362 | ! PgGetTranslation( &translation ); | |
363 | PgClearTranslation(); | |
364 | ||
365 | #if 0 | |
366 | --- 707,741 ---- | |
367 | ||
368 | /* Handle a focus change of the PtRaw widget */ | |
369 | static int | |
370 | ! gui_ph_handle_focus(PtWidget_t *widget, void *data, PtCallbackInfo_t *info) | |
371 | { | |
372 | ! if (info->reason == Pt_CB_LOST_FOCUS) | |
373 | { | |
374 | ! PtRemoveEventHandler(gui.vimTextArea, Ph_EV_PTR_MOTION_NOBUTTON, | |
375 | ! gui_ph_handle_mouse, NULL); | |
376 | ||
377 | ! gui_mch_mousehide(MOUSE_SHOW); | |
378 | } | |
379 | else | |
380 | { | |
381 | ! PtAddEventHandler(gui.vimTextArea, Ph_EV_PTR_MOTION_NOBUTTON, | |
382 | ! gui_ph_handle_mouse, NULL); | |
383 | } | |
384 | return Pt_CONTINUE; | |
385 | } | |
386 | ||
387 | static void | |
388 | ! gui_ph_handle_raw_draw(PtWidget_t *widget, PhTile_t *damage) | |
389 | { | |
390 | PhRect_t *r; | |
391 | PhPoint_t offset; | |
392 | PhPoint_t translation; | |
393 | ||
394 | ! if (is_ignore_draw == TRUE) | |
395 | return; | |
396 | ||
397 | ! PtSuperClassDraw(PtBasic, widget, damage); | |
398 | ! PgGetTranslation(&translation); | |
399 | PgClearTranslation(); | |
400 | ||
401 | #if 0 | |
402 | *************** | |
403 | *** 750,770 **** | |
404 | out_flush(); | |
405 | #endif | |
406 | ||
407 | ! PtWidgetOffset( widget, &offset ); | |
408 | ! PhTranslatePoint( &offset, PtWidgetPos( gui.vimTextArea, NULL ) ); | |
409 | ||
410 | #if 1 | |
411 | /* Redraw individual damage regions */ | |
412 | ! if( damage->next != NULL ) | |
413 | damage = damage->next; | |
414 | ||
415 | ! while( damage != NULL ) | |
416 | { | |
417 | r = &damage->rect; | |
418 | gui_redraw( | |
419 | r->ul.x - offset.x, r->ul.y - offset.y, | |
420 | r->lr.x - r->ul.x + 1, | |
421 | ! r->lr.y - r->ul.y + 1 ); | |
422 | damage = damage->next; | |
423 | } | |
424 | #else | |
425 | --- 750,770 ---- | |
426 | out_flush(); | |
427 | #endif | |
428 | ||
429 | ! PtWidgetOffset(widget, &offset); | |
430 | ! PhTranslatePoint(&offset, PtWidgetPos(gui.vimTextArea, NULL)); | |
431 | ||
432 | #if 1 | |
433 | /* Redraw individual damage regions */ | |
434 | ! if (damage->next != NULL) | |
435 | damage = damage->next; | |
436 | ||
437 | ! while(damage != NULL) | |
438 | { | |
439 | r = &damage->rect; | |
440 | gui_redraw( | |
441 | r->ul.x - offset.x, r->ul.y - offset.y, | |
442 | r->lr.x - r->ul.x + 1, | |
443 | ! r->lr.y - r->ul.y + 1); | |
444 | damage = damage->next; | |
445 | } | |
446 | #else | |
447 | *************** | |
448 | *** 773,796 **** | |
449 | gui_redraw( | |
450 | r->ul.x - offset.x, r->ul.y - offset.y, | |
451 | r->lr.x - r->ul.x + 1, | |
452 | ! r->lr.y - r->ul.y + 1 ); | |
453 | #endif | |
454 | ||
455 | ! PgSetTranslation( &translation, 0 ); | |
456 | } | |
457 | ||
458 | static int | |
459 | gui_ph_handle_pulldown_menu( | |
460 | PtWidget_t *widget, | |
461 | void *data, | |
462 | ! PtCallbackInfo_t *info ) | |
463 | { | |
464 | ! if( data != NULL ) | |
465 | { | |
466 | vimmenu_T *menu = (vimmenu_T *) data; | |
467 | ||
468 | ! PtPositionMenu( menu->submenu_id, NULL ); | |
469 | ! PtRealizeWidget( menu->submenu_id ); | |
470 | } | |
471 | ||
472 | return Pt_CONTINUE; | |
473 | --- 773,796 ---- | |
474 | gui_redraw( | |
475 | r->ul.x - offset.x, r->ul.y - offset.y, | |
476 | r->lr.x - r->ul.x + 1, | |
477 | ! r->lr.y - r->ul.y + 1); | |
478 | #endif | |
479 | ||
480 | ! PgSetTranslation(&translation, 0); | |
481 | } | |
482 | ||
483 | static int | |
484 | gui_ph_handle_pulldown_menu( | |
485 | PtWidget_t *widget, | |
486 | void *data, | |
487 | ! PtCallbackInfo_t *info) | |
488 | { | |
489 | ! if (data != NULL) | |
490 | { | |
491 | vimmenu_T *menu = (vimmenu_T *) data; | |
492 | ||
493 | ! PtPositionMenu(menu->submenu_id, NULL); | |
494 | ! PtRealizeWidget(menu->submenu_id); | |
495 | } | |
496 | ||
497 | return Pt_CONTINUE; | |
498 | *** ../vim-7.3.298/src/version.c 2011-09-07 18:58:24.000000000 +0200 | |
499 | --- src/version.c 2011-09-07 19:01:17.000000000 +0200 | |
500 | *************** | |
501 | *** 711,712 **** | |
502 | --- 711,714 ---- | |
503 | { /* Add new patch number below this line */ | |
504 | + /**/ | |
505 | + 299, | |
506 | /**/ | |
507 | ||
508 | -- | |
509 | The only way the average employee can speak to an executive is by taking a | |
510 | second job as a golf caddie. | |
511 | (Scott Adams - The Dilbert principle) | |
512 | ||
513 | /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ | |
514 | /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\ | |
515 | \\\ an exciting new programming language -- http://www.Zimbu.org /// | |
516 | \\\ help me help AIDS victims -- http://ICCF-Holland.org /// |