summaryrefslogtreecommitdiffstats
path: root/source/ap/vim/patches/7.3.271
blob: c42d19a8288a13ce97de42e89d329da4e0c3d36f (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
To: vim_dev@googlegroups.com
Subject: Patch 7.3.271
Fcc: outbox
From: Bram Moolenaar <Bram@moolenaar.net>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
------------

Patch 7.3.271
Problem:    Code not following Vim coding style.
Solution:   Fix the style. (Elias Diem)
Files:	    src/gui_photon.c


*** ../vim-7.3.270/src/gui_photon.c	2011-07-27 14:09:05.000000000 +0200
--- src/gui_photon.c	2011-08-10 12:18:35.000000000 +0200
***************
*** 358,378 ****
  }
  
      static int
! gui_ph_handle_window_cb( PtWidget_t *widget, void *data, PtCallbackInfo_t *info )
  {
      PhWindowEvent_t *we = info->cbdata;
      ushort_t *width, *height;
  
!     switch( we->event_f ) {
  	case Ph_WM_CLOSE:
  	    gui_shell_closed();
  	    break;
  
  	case Ph_WM_FOCUS:
  	    /* Just in case it's hidden and needs to be shown */
! 	    gui_mch_mousehide( MOUSE_SHOW );
  
! 	    if( we->event_state == Ph_WM_EVSTATE_FOCUS )
  	    {
  		gui_focus_change(TRUE);
  		gui_mch_start_blink();
--- 358,378 ----
  }
  
      static int
! gui_ph_handle_window_cb(PtWidget_t *widget, void *data, PtCallbackInfo_t *info)
  {
      PhWindowEvent_t *we = info->cbdata;
      ushort_t *width, *height;
  
!     switch (we->event_f) {
  	case Ph_WM_CLOSE:
  	    gui_shell_closed();
  	    break;
  
  	case Ph_WM_FOCUS:
  	    /* Just in case it's hidden and needs to be shown */
! 	    gui_mch_mousehide(MOUSE_SHOW);
  
! 	    if (we->event_state == Ph_WM_EVSTATE_FOCUS)
  	    {
  		gui_focus_change(TRUE);
  		gui_mch_start_blink();
***************
*** 385,401 ****
  	    break;
  
  	case Ph_WM_RESIZE:
! 	    PtGetResource( gui.vimWindow, Pt_ARG_WIDTH, &width, 0 );
! 	    PtGetResource( gui.vimWindow, Pt_ARG_HEIGHT, &height, 0 );
  #ifdef USE_PANEL_GROUP
  	    width  -= (pg_margin_left + pg_margin_right);
  	    height -= (pg_margin_top + pg_margin_bottom);
  #endif
! 	    gui_resize_shell( *width, *height );
! 	    gui_set_shellsize( FALSE, FALSE, RESIZE_BOTH );
  	    is_ignore_draw = FALSE;
! 	    PtEndFlux( gui.vimContainer );
! 	    PtContainerRelease( gui.vimContainer );
  	    break;
  
  	default:
--- 385,401 ----
  	    break;
  
  	case Ph_WM_RESIZE:
! 	    PtGetResource(gui.vimWindow, Pt_ARG_WIDTH, &width, 0);
! 	    PtGetResource(gui.vimWindow, Pt_ARG_HEIGHT, &height, 0);
  #ifdef USE_PANEL_GROUP
  	    width  -= (pg_margin_left + pg_margin_right);
  	    height -= (pg_margin_top + pg_margin_bottom);
  #endif
! 	    gui_resize_shell(*width, *height);
! 	    gui_set_shellsize(FALSE, FALSE, RESIZE_BOTH);
  	    is_ignore_draw = FALSE;
! 	    PtEndFlux(gui.vimContainer);
! 	    PtContainerRelease(gui.vimContainer);
  	    break;
  
  	default:
***************
*** 406,412 ****
  }
  
      static int
! gui_ph_handle_scrollbar( PtWidget_t *widget, void *data, PtCallbackInfo_t *info )
  {
      PtScrollbarCallback_t *scroll;
      scrollbar_T *sb;
--- 406,412 ----
  }
  
      static int
! gui_ph_handle_scrollbar(PtWidget_t *widget, void *data, PtCallbackInfo_t *info)
  {
      PtScrollbarCallback_t *scroll;
      scrollbar_T *sb;
***************
*** 415,424 ****
      scroll = info->cbdata;
  
      sb = (scrollbar_T *) data;
!     if( sb != NULL )
      {
  	value = scroll->position;
! 	switch( scroll->action )
  	{
  	    case Pt_SCROLL_DRAGGED:
  		dragging = TRUE;
--- 415,424 ----
      scroll = info->cbdata;
  
      sb = (scrollbar_T *) data;
!     if (sb != NULL)
      {
  	value = scroll->position;
! 	switch (scroll->action)
  	{
  	    case Pt_SCROLL_DRAGGED:
  		dragging = TRUE;
***************
*** 436,532 ****
  }
  
      static int
! gui_ph_handle_keyboard( PtWidget_t *widget, void *data, PtCallbackInfo_t *info )
  {
      PhKeyEvent_t    *key;
      unsigned char   string[6];
      int		    len, i;
      int		    ch, modifiers;
  
!     key = PhGetData( info->event );
  
      ch = modifiers = len = 0;
  
!     if( p_mh )
! 	gui_mch_mousehide( MOUSE_HIDE );
  
      /* We're a good lil photon program, aren't we? yes we are, yeess wee arrr */
!     if( key->key_flags & Pk_KF_Compose )
      {
  	return Pt_CONTINUE;
      }
  
!     if( (key->key_flags & Pk_KF_Cap_Valid) &&
! 	    PkIsKeyDown( key->key_flags ) )
      {
  #ifdef FEAT_MENU
  	/*
  	 * Only show the menu if the Alt key is down, and the Shift & Ctrl
  	 * keys aren't down, as well as the other conditions
  	 */
! 	if( ( ( key->key_mods & Pk_KM_Alt ) &&
! 		    !( key->key_mods & Pk_KM_Shift ) &&
! 		    !( key->key_mods & Pk_KM_Ctrl ) ) &&
  	    gui.menu_is_active &&
! 	    ( *p_wak == 'y' ||
! 	      ( *p_wak == 'm' &&
! 		gui_is_menu_shortcut( key->key_cap ) ) ) )
  	{
  	    /* Fallthrough and let photon look for the hotkey */
  	    return Pt_CONTINUE;
  	}
  #endif
  
! 	for( i = 0; special_keys[i].key_sym != 0; i++ )
  	{
! 	    if( special_keys[i].key_sym == key->key_cap )
  	    {
  		len = 0;
! 		if( special_keys[i].vim_code1 == NUL )
  		    ch = special_keys[i].vim_code0;
  		else
  		{
  		    /* Detect if a keypad number key has been pressed
  		     * and change the key if Num Lock is on */
! 		    if( key->key_cap >= Pk_KP_Enter && key->key_cap <= Pk_KP_9
! 			    && ( key->key_mods & Pk_KM_Num_Lock ) )
  		    {
  			/* FIXME: For now, just map the key to a ascii value
  			 * (see <photon/PkKeyDef.h>) */
  			ch = key->key_cap - 0xf080;
  		    }
  		    else
! 			ch = TO_SPECIAL( special_keys[i].vim_code0,
! 				special_keys[i].vim_code1 );
  		}
  		break;
  	    }
  	}
  
! 	if( key->key_mods & Pk_KM_Ctrl )
  	    modifiers |= MOD_MASK_CTRL;
! 	if( key->key_mods & Pk_KM_Alt )
  	    modifiers |= MOD_MASK_ALT;
! 	if( key->key_mods & Pk_KM_Shift )
  	    modifiers |= MOD_MASK_SHIFT;
  
  	/* Is this not a special key? */
! 	if( special_keys[i].key_sym == 0 )
  	{
! 	    ch = PhTo8859_1( key );
! 	    if( ch == -1
  #ifdef FEAT_MBYTE
! 		|| ( enc_utf8 && ch > 127 )
  #endif
  		)
  	    {
  #ifdef FEAT_MBYTE
! 		len = PhKeyToMb( string, key );
! 		if( len > 0 )
  		{
  		    static char buf[6];
  		    int src_taken, dst_made;
! 		    if( enc_utf8 != TRUE )
  		    {
  			PxTranslateFromUTF(
  				charset_translate,
--- 436,532 ----
  }
  
      static int
! gui_ph_handle_keyboard(PtWidget_t *widget, void *data, PtCallbackInfo_t *info)
  {
      PhKeyEvent_t    *key;
      unsigned char   string[6];
      int		    len, i;
      int		    ch, modifiers;
  
!     key = PhGetData(info->event);
  
      ch = modifiers = len = 0;
  
!     if (p_mh)
! 	gui_mch_mousehide(MOUSE_HIDE);
  
      /* We're a good lil photon program, aren't we? yes we are, yeess wee arrr */
!     if (key->key_flags & Pk_KF_Compose)
      {
  	return Pt_CONTINUE;
      }
  
!     if ((key->key_flags & Pk_KF_Cap_Valid) &&
! 	    PkIsKeyDown(key->key_flags))
      {
  #ifdef FEAT_MENU
  	/*
  	 * Only show the menu if the Alt key is down, and the Shift & Ctrl
  	 * keys aren't down, as well as the other conditions
  	 */
! 	if (((key->key_mods & Pk_KM_Alt) &&
! 		    !(key->key_mods & Pk_KM_Shift) &&
! 		    !(key->key_mods & Pk_KM_Ctrl)) &&
  	    gui.menu_is_active &&
! 	    (*p_wak == 'y' ||
! 	      (*p_wak == 'm' &&
! 		gui_is_menu_shortcut(key->key_cap))))
  	{
  	    /* Fallthrough and let photon look for the hotkey */
  	    return Pt_CONTINUE;
  	}
  #endif
  
! 	for(i = 0; special_keys[i].key_sym != 0; i++)
  	{
! 	    if (special_keys[i].key_sym == key->key_cap)
  	    {
  		len = 0;
! 		if (special_keys[i].vim_code1 == NUL)
  		    ch = special_keys[i].vim_code0;
  		else
  		{
  		    /* Detect if a keypad number key has been pressed
  		     * and change the key if Num Lock is on */
! 		    if (key->key_cap >= Pk_KP_Enter && key->key_cap <= Pk_KP_9
! 			    && (key->key_mods & Pk_KM_Num_Lock))
  		    {
  			/* FIXME: For now, just map the key to a ascii value
  			 * (see <photon/PkKeyDef.h>) */
  			ch = key->key_cap - 0xf080;
  		    }
  		    else
! 			ch = TO_SPECIAL(special_keys[i].vim_code0,
! 				special_keys[i].vim_code1);
  		}
  		break;
  	    }
  	}
  
! 	if (key->key_mods & Pk_KM_Ctrl)
  	    modifiers |= MOD_MASK_CTRL;
! 	if (key->key_mods & Pk_KM_Alt)
  	    modifiers |= MOD_MASK_ALT;
! 	if (key->key_mods & Pk_KM_Shift)
  	    modifiers |= MOD_MASK_SHIFT;
  
  	/* Is this not a special key? */
! 	if (special_keys[i].key_sym == 0)
  	{
! 	    ch = PhTo8859_1(key);
! 	    if (ch == -1
  #ifdef FEAT_MBYTE
! 		|| (enc_utf8 && ch > 127)
  #endif
  		)
  	    {
  #ifdef FEAT_MBYTE
! 		len = PhKeyToMb(string, key);
! 		if (len > 0)
  		{
  		    static char buf[6];
  		    int src_taken, dst_made;
! 		    if (enc_utf8 != TRUE)
  		    {
  			PxTranslateFromUTF(
  				charset_translate,
***************
*** 2931,2943 ****
  	name_len = (int_u) ( mark - vim_font );
  
      *font_name = vim_strnsave( vim_font, name_len );
!     if( *font_name != NULL )
      {
! 	if( mark != NULL )
  	{
! 	    while( *mark != NUL && *mark++ == ':')
  	    {
! 		switch( tolower( *mark++ ) )
  		{
  		    case 'a': *font_flags |= PF_STYLE_ANTIALIAS; break;
  		    case 'b': *font_flags |= PF_STYLE_BOLD; break;
--- 2931,2943 ----
  	name_len = (int_u) ( mark - vim_font );
  
      *font_name = vim_strnsave( vim_font, name_len );
!     if (*font_name != NULL)
      {
! 	if (mark != NULL)
  	{
! 	    while (*mark != NUL && *mark++ == ':')
  	    {
! 		switch (tolower(*mark++))
  		{
  		    case 'a': *font_flags |= PF_STYLE_ANTIALIAS; break;
  		    case 'b': *font_flags |= PF_STYLE_BOLD; break;
***************
*** 2946,2952 ****
  		    case 's':
  			size = getdigits( &mark );
  			/* Restrict the size to some vague limits */
! 			if( size < 1 || size > 100 )
  			    size = 8;
  
  			*font_size = size;
--- 2946,2952 ----
  		    case 's':
  			size = getdigits( &mark );
  			/* Restrict the size to some vague limits */
! 			if (size < 1 || size > 100)
  			    size = 8;
  
  			*font_size = size;
***************
*** 2973,2990 ****
      FontQueryInfo info;
      PhRect_t extent;
  
!     if( vim_font_name == NULL )
      {
  	/* Default font */
  	vim_font_name = "PC Terminal";
      }
  
!     if( STRCMP( vim_font_name, "*" ) == 0 )
      {
  	font_tag = PtFontSelection( gui.vimWindow, NULL, NULL,
  		"pcterm12", -1, PHFONT_FIXED, NULL );
  
! 	if( font_tag == NULL )
  	    return FAIL;
  
  	gui_mch_free_font( gui.norm_font );
--- 2973,2990 ----
      FontQueryInfo info;
      PhRect_t extent;
  
!     if (vim_font_name == NULL)
      {
  	/* Default font */
  	vim_font_name = "PC Terminal";
      }
  
!     if (STRCMP( vim_font_name, "*" ) == 0)
      {
  	font_tag = PtFontSelection( gui.vimWindow, NULL, NULL,
  		"pcterm12", -1, PHFONT_FIXED, NULL );
  
! 	if (font_tag == NULL)
  	    return FAIL;
  
  	gui_mch_free_font( gui.norm_font );
***************
*** 2995,3006 ****
      }
      else
      {
! 	if( gui_ph_parse_font_name( vim_font_name, &font_name, &font_flags,
! 		    &font_size ) == FALSE )
  	    return FAIL;
  
  	font_tag = gui_ph_get_font( font_name, font_flags, font_size, 0 );
! 	if( font_tag == NULL )
  	{
  	    vim_free( font_name );
  	    return FAIL;
--- 2995,3006 ----
      }
      else
      {
! 	if (gui_ph_parse_font_name( vim_font_name, &font_name, &font_flags,
! 		    &font_size ) == FALSE)
  	    return FAIL;
  
  	font_tag = gui_ph_get_font( font_name, font_flags, font_size, 0 );
! 	if (font_tag == NULL)
  	{
  	    vim_free( font_name );
  	    return FAIL;
***************
*** 3053,3069 ****
      int_u   font_size = 12;
      int_u   font_flags = 0;
  
!     if( gui_ph_parse_font_name( vim_font_name, &font_name, &font_flags,
! 		&font_size ) != FALSE )
      {
  	font_tag = gui_ph_get_font( font_name, font_flags, font_size, -1 );
  	vim_free( font_name );
  
! 	if( font_tag != NULL )
  	    return (GuiFont)font_tag;
      }
  
!     if( report_error )
  	EMSG2(e_font, vim_font_name );
  
      return FAIL;
--- 3053,3069 ----
      int_u   font_size = 12;
      int_u   font_flags = 0;
  
!     if (gui_ph_parse_font_name( vim_font_name, &font_name, &font_flags,
! 		&font_size ) != FALSE)
      {
  	font_tag = gui_ph_get_font( font_name, font_flags, font_size, -1 );
  	vim_free( font_name );
  
! 	if (font_tag != NULL)
  	    return (GuiFont)font_tag;
      }
  
!     if (report_error)
  	EMSG2(e_font, vim_font_name );
  
      return FAIL;
*** ../vim-7.3.270/src/version.c	2011-08-10 12:10:55.000000000 +0200
--- src/version.c	2011-08-10 12:17:06.000000000 +0200
***************
*** 711,712 ****
--- 711,714 ----
  {   /* Add new patch number below this line */
+ /**/
+     271,
  /**/

-- 
An indication you must be a manager:
You believe you never have any problems in your life, just
"issues" and "improvement opportunities".

 /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\  an exciting new programming language -- http://www.Zimbu.org        ///
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///