comparison src/ui.c @ 7835:4d7ce6c03fda v7.4.1214

commit https://github.com/vim/vim/commit/764b23c8fd3369cb05ae9122abf3ca16fec539d7 Author: Bram Moolenaar <Bram@vim.org> Date: Sat Jan 30 21:10:09 2016 +0100 patch 7.4.1214 Problem: Using old style function declarations. Solution: Change to new style function declarations. (script by Hirohito Higashi)
author Christian Brabandt <cb@256bit.org>
date Sat, 30 Jan 2016 21:15:04 +0100
parents 0b6c37dd858d
children 10f17a228661
comparison
equal deleted inserted replaced
7834:2d1dc9ec41ce 7835:4d7ce6c03fda
23 # include <windows.h> 23 # include <windows.h>
24 # include "winclip.pro" 24 # include "winclip.pro"
25 #endif 25 #endif
26 26
27 void 27 void
28 ui_write(s, len) 28 ui_write(char_u *s, int len)
29 char_u *s;
30 int len;
31 { 29 {
32 #ifdef FEAT_GUI 30 #ifdef FEAT_GUI
33 if (gui.in_use && !gui.dying && !gui.starting) 31 if (gui.in_use && !gui.dying && !gui.starting)
34 { 32 {
35 gui_write(s, len); 33 gui_write(s, len);
73 static char_u *ta_str = NULL; 71 static char_u *ta_str = NULL;
74 static int ta_off; /* offset for next char to use when ta_str != NULL */ 72 static int ta_off; /* offset for next char to use when ta_str != NULL */
75 static int ta_len; /* length of ta_str when it's not NULL*/ 73 static int ta_len; /* length of ta_str when it's not NULL*/
76 74
77 void 75 void
78 ui_inchar_undo(s, len) 76 ui_inchar_undo(char_u *s, int len)
79 char_u *s;
80 int len;
81 { 77 {
82 char_u *new; 78 char_u *new;
83 int newlen; 79 int newlen;
84 80
85 newlen = len; 81 newlen = len;
115 * it. When typebuf.tb_change_cnt changes (e.g., when a message is received 111 * it. When typebuf.tb_change_cnt changes (e.g., when a message is received
116 * from a remote client) "buf" can no longer be used. "tb_change_cnt" is NULL 112 * from a remote client) "buf" can no longer be used. "tb_change_cnt" is NULL
117 * otherwise. 113 * otherwise.
118 */ 114 */
119 int 115 int
120 ui_inchar(buf, maxlen, wtime, tb_change_cnt) 116 ui_inchar(
121 char_u *buf; 117 char_u *buf,
122 int maxlen; 118 int maxlen,
123 long wtime; /* don't use "time", MIPS cannot handle it */ 119 long wtime, /* don't use "time", MIPS cannot handle it */
124 int tb_change_cnt; 120 int tb_change_cnt)
125 { 121 {
126 int retval = 0; 122 int retval = 0;
127 123
128 #if defined(FEAT_GUI) && (defined(UNIX) || defined(VMS)) 124 #if defined(FEAT_GUI) && (defined(UNIX) || defined(VMS))
129 /* 125 /*
218 214
219 /* 215 /*
220 * return non-zero if a character is available 216 * return non-zero if a character is available
221 */ 217 */
222 int 218 int
223 ui_char_avail() 219 ui_char_avail(void)
224 { 220 {
225 #ifdef FEAT_GUI 221 #ifdef FEAT_GUI
226 if (gui.in_use) 222 if (gui.in_use)
227 { 223 {
228 gui_mch_update(); 224 gui_mch_update();
243 /* 239 /*
244 * Delay for the given number of milliseconds. If ignoreinput is FALSE then we 240 * Delay for the given number of milliseconds. If ignoreinput is FALSE then we
245 * cancel the delay if a key is hit. 241 * cancel the delay if a key is hit.
246 */ 242 */
247 void 243 void
248 ui_delay(msec, ignoreinput) 244 ui_delay(long msec, int ignoreinput)
249 long msec;
250 int ignoreinput;
251 { 245 {
252 #ifdef FEAT_GUI 246 #ifdef FEAT_GUI
253 if (gui.in_use && !ignoreinput) 247 if (gui.in_use && !ignoreinput)
254 gui_wait_for_chars(msec); 248 gui_wait_for_chars(msec);
255 else 249 else
261 * If the machine has job control, use it to suspend the program, 255 * If the machine has job control, use it to suspend the program,
262 * otherwise fake it by starting a new shell. 256 * otherwise fake it by starting a new shell.
263 * When running the GUI iconify the window. 257 * When running the GUI iconify the window.
264 */ 258 */
265 void 259 void
266 ui_suspend() 260 ui_suspend(void)
267 { 261 {
268 #ifdef FEAT_GUI 262 #ifdef FEAT_GUI
269 if (gui.in_use) 263 if (gui.in_use)
270 { 264 {
271 gui_mch_iconify(); 265 gui_mch_iconify();
279 /* 273 /*
280 * When the OS can't really suspend, call this function to start a shell. 274 * When the OS can't really suspend, call this function to start a shell.
281 * This is never called in the GUI. 275 * This is never called in the GUI.
282 */ 276 */
283 void 277 void
284 suspend_shell() 278 suspend_shell(void)
285 { 279 {
286 if (*p_sh == NUL) 280 if (*p_sh == NUL)
287 EMSG(_(e_shellempty)); 281 EMSG(_(e_shellempty));
288 else 282 else
289 { 283 {
297 * Try to get the current Vim shell size. Put the result in Rows and Columns. 291 * Try to get the current Vim shell size. Put the result in Rows and Columns.
298 * Use the new sizes as defaults for 'columns' and 'lines'. 292 * Use the new sizes as defaults for 'columns' and 'lines'.
299 * Return OK when size could be determined, FAIL otherwise. 293 * Return OK when size could be determined, FAIL otherwise.
300 */ 294 */
301 int 295 int
302 ui_get_shellsize() 296 ui_get_shellsize(void)
303 { 297 {
304 int retval; 298 int retval;
305 299
306 #ifdef FEAT_GUI 300 #ifdef FEAT_GUI
307 if (gui.in_use) 301 if (gui.in_use)
325 * Set the size of the Vim shell according to Rows and Columns, if possible. 319 * Set the size of the Vim shell according to Rows and Columns, if possible.
326 * The gui_set_shellsize() or mch_set_shellsize() function will try to set the 320 * The gui_set_shellsize() or mch_set_shellsize() function will try to set the
327 * new size. If this is not possible, it will adjust Rows and Columns. 321 * new size. If this is not possible, it will adjust Rows and Columns.
328 */ 322 */
329 void 323 void
330 ui_set_shellsize(mustset) 324 ui_set_shellsize(
331 int mustset UNUSED; /* set by the user */ 325 int mustset UNUSED) /* set by the user */
332 { 326 {
333 #ifdef FEAT_GUI 327 #ifdef FEAT_GUI
334 if (gui.in_use) 328 if (gui.in_use)
335 gui_set_shellsize(mustset, TRUE, RESIZE_BOTH); 329 gui_set_shellsize(mustset, TRUE, RESIZE_BOTH);
336 else 330 else
341 /* 335 /*
342 * Called when Rows and/or Columns changed. Adjust scroll region and mouse 336 * Called when Rows and/or Columns changed. Adjust scroll region and mouse
343 * region. 337 * region.
344 */ 338 */
345 void 339 void
346 ui_new_shellsize() 340 ui_new_shellsize(void)
347 { 341 {
348 if (full_screen && !exiting) 342 if (full_screen && !exiting)
349 { 343 {
350 #ifdef FEAT_GUI 344 #ifdef FEAT_GUI
351 if (gui.in_use) 345 if (gui.in_use)
355 mch_new_shellsize(); 349 mch_new_shellsize();
356 } 350 }
357 } 351 }
358 352
359 void 353 void
360 ui_breakcheck() 354 ui_breakcheck(void)
361 { 355 {
362 #ifdef FEAT_GUI 356 #ifdef FEAT_GUI
363 if (gui.in_use) 357 if (gui.in_use)
364 gui_mch_update(); 358 gui_mch_update();
365 else 359 else
393 * is included, but the clipboard can not be used, or TRUE if the clipboard can 387 * is included, but the clipboard can not be used, or TRUE if the clipboard can
394 * be used. Eg unix may call this with FALSE, then call it again with TRUE if 388 * be used. Eg unix may call this with FALSE, then call it again with TRUE if
395 * the GUI starts. 389 * the GUI starts.
396 */ 390 */
397 void 391 void
398 clip_init(can_use) 392 clip_init(int can_use)
399 int can_use;
400 { 393 {
401 VimClipboard *cb; 394 VimClipboard *cb;
402 395
403 cb = &clip_star; 396 cb = &clip_star;
404 for (;;) 397 for (;;)
423 * lying around. If the VIsual mode has ended, make a copy of what was 416 * lying around. If the VIsual mode has ended, make a copy of what was
424 * selected so we can still give it to others. Will probably have to make sure 417 * selected so we can still give it to others. Will probably have to make sure
425 * this is called whenever VIsual mode is ended. 418 * this is called whenever VIsual mode is ended.
426 */ 419 */
427 void 420 void
428 clip_update_selection(clip) 421 clip_update_selection(VimClipboard *clip)
429 VimClipboard *clip;
430 { 422 {
431 pos_T start, end; 423 pos_T start, end;
432 424
433 /* If visual mode is only due to a redo command ("."), then ignore it */ 425 /* If visual mode is only due to a redo command ("."), then ignore it */
434 if (!redo_VIsual_busy && VIsual_active && (State & NORMAL)) 426 if (!redo_VIsual_busy && VIsual_active && (State & NORMAL))
461 } 453 }
462 } 454 }
463 } 455 }
464 456
465 void 457 void
466 clip_own_selection(cbd) 458 clip_own_selection(VimClipboard *cbd)
467 VimClipboard *cbd;
468 { 459 {
469 /* 460 /*
470 * Also want to check somehow that we are reading from the keyboard rather 461 * Also want to check somehow that we are reading from the keyboard rather
471 * than a mapping etc. 462 * than a mapping etc.
472 */ 463 */
498 cbd->owned = (clip_gen_own_selection(cbd) == OK); 489 cbd->owned = (clip_gen_own_selection(cbd) == OK);
499 #endif 490 #endif
500 } 491 }
501 492
502 void 493 void
503 clip_lose_selection(cbd) 494 clip_lose_selection(VimClipboard *cbd)
504 VimClipboard *cbd;
505 { 495 {
506 #ifdef FEAT_X11 496 #ifdef FEAT_X11
507 int was_owned = cbd->owned; 497 int was_owned = cbd->owned;
508 #endif 498 #endif
509 int visual_selection = FALSE; 499 int visual_selection = FALSE;
541 } 531 }
542 #endif 532 #endif
543 } 533 }
544 534
545 static void 535 static void
546 clip_copy_selection(clip) 536 clip_copy_selection(VimClipboard *clip)
547 VimClipboard *clip;
548 { 537 {
549 if (VIsual_active && (State & NORMAL) && clip->available) 538 if (VIsual_active && (State & NORMAL) && clip->available)
550 { 539 {
551 clip_update_selection(clip); 540 clip_update_selection(clip);
552 clip_free_selection(clip); 541 clip_free_selection(clip);
567 556
568 /* 557 /*
569 * Save clip_unnamed and reset it. 558 * Save clip_unnamed and reset it.
570 */ 559 */
571 void 560 void
572 start_global_changes() 561 start_global_changes(void)
573 { 562 {
574 if (++global_change_count > 1) 563 if (++global_change_count > 1)
575 return; 564 return;
576 clip_unnamed_saved = clip_unnamed; 565 clip_unnamed_saved = clip_unnamed;
577 clipboard_needs_update = FALSE; 566 clipboard_needs_update = FALSE;
585 574
586 /* 575 /*
587 * Restore clip_unnamed and set the selection when needed. 576 * Restore clip_unnamed and set the selection when needed.
588 */ 577 */
589 void 578 void
590 end_global_changes() 579 end_global_changes(void)
591 { 580 {
592 if (--global_change_count > 0) 581 if (--global_change_count > 0)
593 /* recursive */ 582 /* recursive */
594 return; 583 return;
595 if (!clip_did_set_selection) 584 if (!clip_did_set_selection)
617 606
618 /* 607 /*
619 * Called when Visual mode is ended: update the selection. 608 * Called when Visual mode is ended: update the selection.
620 */ 609 */
621 void 610 void
622 clip_auto_select() 611 clip_auto_select(void)
623 { 612 {
624 if (clip_isautosel_star()) 613 if (clip_isautosel_star())
625 clip_copy_selection(&clip_star); 614 clip_copy_selection(&clip_star);
626 if (clip_isautosel_plus()) 615 if (clip_isautosel_plus())
627 clip_copy_selection(&clip_plus); 616 clip_copy_selection(&clip_plus);
630 /* 619 /*
631 * Return TRUE if automatic selection of Visual area is desired for the * 620 * Return TRUE if automatic selection of Visual area is desired for the *
632 * register. 621 * register.
633 */ 622 */
634 int 623 int
635 clip_isautosel_star() 624 clip_isautosel_star(void)
636 { 625 {
637 return ( 626 return (
638 #ifdef FEAT_GUI 627 #ifdef FEAT_GUI
639 gui.in_use ? (vim_strchr(p_go, GO_ASEL) != NULL) : 628 gui.in_use ? (vim_strchr(p_go, GO_ASEL) != NULL) :
640 #endif 629 #endif
644 /* 633 /*
645 * Return TRUE if automatic selection of Visual area is desired for the + 634 * Return TRUE if automatic selection of Visual area is desired for the +
646 * register. 635 * register.
647 */ 636 */
648 int 637 int
649 clip_isautosel_plus() 638 clip_isautosel_plus(void)
650 { 639 {
651 return ( 640 return (
652 #ifdef FEAT_GUI 641 #ifdef FEAT_GUI
653 gui.in_use ? (vim_strchr(p_go, GO_ASELPLUS) != NULL) : 642 gui.in_use ? (vim_strchr(p_go, GO_ASELPLUS) != NULL) :
654 #endif 643 #endif
676 /* 665 /*
677 * Start, continue or end a modeless selection. Used when editing the 666 * Start, continue or end a modeless selection. Used when editing the
678 * command-line and in the cmdline window. 667 * command-line and in the cmdline window.
679 */ 668 */
680 void 669 void
681 clip_modeless(button, is_click, is_drag) 670 clip_modeless(int button, int is_click, int is_drag)
682 int button;
683 int is_click;
684 int is_drag;
685 { 671 {
686 int repeat; 672 int repeat;
687 673
688 repeat = ((clip_star.mode == SELECT_MODE_CHAR 674 repeat = ((clip_star.mode == SELECT_MODE_CHAR
689 || clip_star.mode == SELECT_MODE_LINE) 675 || clip_star.mode == SELECT_MODE_LINE)
713 699
714 /* 700 /*
715 * Compare two screen positions ala strcmp() 701 * Compare two screen positions ala strcmp()
716 */ 702 */
717 static int 703 static int
718 clip_compare_pos(row1, col1, row2, col2) 704 clip_compare_pos(
719 int row1; 705 int row1,
720 int col1; 706 int col1,
721 int row2; 707 int row2,
722 int col2; 708 int col2)
723 { 709 {
724 if (row1 > row2) return(1); 710 if (row1 > row2) return(1);
725 if (row1 < row2) return(-1); 711 if (row1 < row2) return(-1);
726 if (col1 > col2) return(1); 712 if (col1 > col2) return(1);
727 if (col1 < col2) return(-1); 713 if (col1 < col2) return(-1);
730 716
731 /* 717 /*
732 * Start the selection 718 * Start the selection
733 */ 719 */
734 void 720 void
735 clip_start_selection(col, row, repeated_click) 721 clip_start_selection(int col, int row, int repeated_click)
736 int col;
737 int row;
738 int repeated_click;
739 { 722 {
740 VimClipboard *cb = &clip_star; 723 VimClipboard *cb = &clip_star;
741 724
742 if (cb->state == SELECT_DONE) 725 if (cb->state == SELECT_DONE)
743 clip_clear_selection(cb); 726 clip_clear_selection(cb);
803 786
804 /* 787 /*
805 * Continue processing the selection 788 * Continue processing the selection
806 */ 789 */
807 void 790 void
808 clip_process_selection(button, col, row, repeated_click) 791 clip_process_selection(
809 int button; 792 int button,
810 int col; 793 int col,
811 int row; 794 int row,
812 int_u repeated_click; 795 int_u repeated_click)
813 { 796 {
814 VimClipboard *cb = &clip_star; 797 VimClipboard *cb = &clip_star;
815 int diff; 798 int diff;
816 int slen = 1; /* cursor shape width */ 799 int slen = 1; /* cursor shape width */
817 800
988 /* 971 /*
989 * Redraw part of the selection if character at "row,col" is inside of it. 972 * Redraw part of the selection if character at "row,col" is inside of it.
990 * Only used for the GUI. 973 * Only used for the GUI.
991 */ 974 */
992 void 975 void
993 clip_may_redraw_selection(row, col, len) 976 clip_may_redraw_selection(int row, int col, int len)
994 int row, col;
995 int len;
996 { 977 {
997 int start = col; 978 int start = col;
998 int end = col + len; 979 int end = col + len;
999 980
1000 if (clip_star.state != SELECT_CLEARED 981 if (clip_star.state != SELECT_CLEARED
1013 994
1014 /* 995 /*
1015 * Called from outside to clear selected region from the display 996 * Called from outside to clear selected region from the display
1016 */ 997 */
1017 void 998 void
1018 clip_clear_selection(cbd) 999 clip_clear_selection(VimClipboard *cbd)
1019 VimClipboard *cbd;
1020 { 1000 {
1021 1001
1022 if (cbd->state == SELECT_CLEARED) 1002 if (cbd->state == SELECT_CLEARED)
1023 return; 1003 return;
1024 1004
1029 1009
1030 /* 1010 /*
1031 * Clear the selection if any lines from "row1" to "row2" are inside of it. 1011 * Clear the selection if any lines from "row1" to "row2" are inside of it.
1032 */ 1012 */
1033 void 1013 void
1034 clip_may_clear_selection(row1, row2) 1014 clip_may_clear_selection(int row1, int row2)
1035 int row1, row2;
1036 { 1015 {
1037 if (clip_star.state == SELECT_DONE 1016 if (clip_star.state == SELECT_DONE
1038 && row2 >= clip_star.start.lnum 1017 && row2 >= clip_star.start.lnum
1039 && row1 <= clip_star.end.lnum) 1018 && row1 <= clip_star.end.lnum)
1040 clip_clear_selection(&clip_star); 1019 clip_clear_selection(&clip_star);
1043 /* 1022 /*
1044 * Called before the screen is scrolled up or down. Adjusts the line numbers 1023 * Called before the screen is scrolled up or down. Adjusts the line numbers
1045 * of the selection. Call with big number when clearing the screen. 1024 * of the selection. Call with big number when clearing the screen.
1046 */ 1025 */
1047 void 1026 void
1048 clip_scroll_selection(rows) 1027 clip_scroll_selection(
1049 int rows; /* negative for scroll down */ 1028 int rows) /* negative for scroll down */
1050 { 1029 {
1051 int lnum; 1030 int lnum;
1052 1031
1053 if (clip_star.state == SELECT_CLEARED) 1032 if (clip_star.state == SELECT_CLEARED)
1054 return; 1033 return;
1077 * CLIP_SET: set inversion 1056 * CLIP_SET: set inversion
1078 * CLIP_TOGGLE: set inversion if pos1 < pos2, undo inversion otherwise. 1057 * CLIP_TOGGLE: set inversion if pos1 < pos2, undo inversion otherwise.
1079 * 0: invert (GUI only). 1058 * 0: invert (GUI only).
1080 */ 1059 */
1081 static void 1060 static void
1082 clip_invert_area(row1, col1, row2, col2, how) 1061 clip_invert_area(
1083 int row1; 1062 int row1,
1084 int col1; 1063 int col1,
1085 int row2; 1064 int row2,
1086 int col2; 1065 int col2,
1087 int how; 1066 int how)
1088 { 1067 {
1089 int invert = FALSE; 1068 int invert = FALSE;
1090 1069
1091 if (how == CLIP_SET) 1070 if (how == CLIP_SET)
1092 invert = TRUE; 1071 invert = TRUE;
1137 /* 1116 /*
1138 * Invert or un-invert a rectangle of the screen. 1117 * Invert or un-invert a rectangle of the screen.
1139 * "invert" is true if the result is inverted. 1118 * "invert" is true if the result is inverted.
1140 */ 1119 */
1141 static void 1120 static void
1142 clip_invert_rectangle(row, col, height, width, invert) 1121 clip_invert_rectangle(
1143 int row; 1122 int row,
1144 int col; 1123 int col,
1145 int height; 1124 int height,
1146 int width; 1125 int width,
1147 int invert; 1126 int invert)
1148 { 1127 {
1149 #ifdef FEAT_GUI 1128 #ifdef FEAT_GUI
1150 if (gui.in_use) 1129 if (gui.in_use)
1151 gui_mch_invert_rectangle(row, col, height, width); 1130 gui_mch_invert_rectangle(row, col, height, width);
1152 else 1131 else
1158 * Copy the currently selected area into the '*' register so it will be 1137 * Copy the currently selected area into the '*' register so it will be
1159 * available for pasting. 1138 * available for pasting.
1160 * When "both" is TRUE also copy to the '+' register. 1139 * When "both" is TRUE also copy to the '+' register.
1161 */ 1140 */
1162 void 1141 void
1163 clip_copy_modeless_selection(both) 1142 clip_copy_modeless_selection(int both UNUSED)
1164 int both UNUSED;
1165 { 1143 {
1166 char_u *buffer; 1144 char_u *buffer;
1167 char_u *bufp; 1145 char_u *bufp;
1168 int row; 1146 int row;
1169 int start_col; 1147 int start_col;
1342 * column. Only white-separated words are recognized here. 1320 * column. Only white-separated words are recognized here.
1343 */ 1321 */
1344 #define CHAR_CLASS(c) (c <= ' ' ? ' ' : vim_iswordc(c)) 1322 #define CHAR_CLASS(c) (c <= ' ' ? ' ' : vim_iswordc(c))
1345 1323
1346 static void 1324 static void
1347 clip_get_word_boundaries(cb, row, col) 1325 clip_get_word_boundaries(VimClipboard *cb, int row, int col)
1348 VimClipboard *cb;
1349 int row;
1350 int col;
1351 { 1326 {
1352 int start_class; 1327 int start_class;
1353 int temp_col; 1328 int temp_col;
1354 char_u *p; 1329 char_u *p;
1355 #ifdef FEAT_MBYTE 1330 #ifdef FEAT_MBYTE
1404 /* 1379 /*
1405 * Find the column position for the last non-whitespace character on the given 1380 * Find the column position for the last non-whitespace character on the given
1406 * line. 1381 * line.
1407 */ 1382 */
1408 static int 1383 static int
1409 clip_get_line_end(row) 1384 clip_get_line_end(int row)
1410 int row;
1411 { 1385 {
1412 int i; 1386 int i;
1413 1387
1414 if (row >= screen_Rows || ScreenLines == NULL) 1388 if (row >= screen_Rows || ScreenLines == NULL)
1415 return 0; 1389 return 0;
1422 /* 1396 /*
1423 * Update the currently selected region by adding and/or subtracting from the 1397 * Update the currently selected region by adding and/or subtracting from the
1424 * beginning or end and inverting the changed area(s). 1398 * beginning or end and inverting the changed area(s).
1425 */ 1399 */
1426 static void 1400 static void
1427 clip_update_modeless_selection(cb, row1, col1, row2, col2) 1401 clip_update_modeless_selection(
1428 VimClipboard *cb; 1402 VimClipboard *cb,
1429 int row1; 1403 int row1,
1430 int col1; 1404 int col1,
1431 int row2; 1405 int row2,
1432 int col2; 1406 int col2)
1433 { 1407 {
1434 /* See if we changed at the beginning of the selection */ 1408 /* See if we changed at the beginning of the selection */
1435 if (row1 != cb->start.lnum || col1 != (int)cb->start.col) 1409 if (row1 != cb->start.lnum || col1 != (int)cb->start.col)
1436 { 1410 {
1437 clip_invert_area(row1, col1, (int)cb->start.lnum, cb->start.col, 1411 clip_invert_area(row1, col1, (int)cb->start.lnum, cb->start.col,
1449 cb->end.col = col2; 1423 cb->end.col = col2;
1450 } 1424 }
1451 } 1425 }
1452 1426
1453 int 1427 int
1454 clip_gen_own_selection(cbd) 1428 clip_gen_own_selection(VimClipboard *cbd)
1455 VimClipboard *cbd;
1456 { 1429 {
1457 #ifdef FEAT_XCLIPBOARD 1430 #ifdef FEAT_XCLIPBOARD
1458 # ifdef FEAT_GUI 1431 # ifdef FEAT_GUI
1459 if (gui.in_use) 1432 if (gui.in_use)
1460 return clip_mch_own_selection(cbd); 1433 return clip_mch_own_selection(cbd);
1465 return clip_mch_own_selection(cbd); 1438 return clip_mch_own_selection(cbd);
1466 #endif 1439 #endif
1467 } 1440 }
1468 1441
1469 void 1442 void
1470 clip_gen_lose_selection(cbd) 1443 clip_gen_lose_selection(VimClipboard *cbd)
1471 VimClipboard *cbd;
1472 { 1444 {
1473 #ifdef FEAT_XCLIPBOARD 1445 #ifdef FEAT_XCLIPBOARD
1474 # ifdef FEAT_GUI 1446 # ifdef FEAT_GUI
1475 if (gui.in_use) 1447 if (gui.in_use)
1476 clip_mch_lose_selection(cbd); 1448 clip_mch_lose_selection(cbd);
1481 clip_mch_lose_selection(cbd); 1453 clip_mch_lose_selection(cbd);
1482 #endif 1454 #endif
1483 } 1455 }
1484 1456
1485 void 1457 void
1486 clip_gen_set_selection(cbd) 1458 clip_gen_set_selection(VimClipboard *cbd)
1487 VimClipboard *cbd;
1488 { 1459 {
1489 if (!clip_did_set_selection) 1460 if (!clip_did_set_selection)
1490 { 1461 {
1491 /* Updating postponed, so that accessing the system clipboard won't 1462 /* Updating postponed, so that accessing the system clipboard won't
1492 * hang Vim when accessing it many times (e.g. on a :g comand). */ 1463 * hang Vim when accessing it many times (e.g. on a :g comand). */
1508 clip_mch_set_selection(cbd); 1479 clip_mch_set_selection(cbd);
1509 #endif 1480 #endif
1510 } 1481 }
1511 1482
1512 void 1483 void
1513 clip_gen_request_selection(cbd) 1484 clip_gen_request_selection(VimClipboard *cbd)
1514 VimClipboard *cbd;
1515 { 1485 {
1516 #ifdef FEAT_XCLIPBOARD 1486 #ifdef FEAT_XCLIPBOARD
1517 # ifdef FEAT_GUI 1487 # ifdef FEAT_GUI
1518 if (gui.in_use) 1488 if (gui.in_use)
1519 clip_mch_request_selection(cbd); 1489 clip_mch_request_selection(cbd);
1524 clip_mch_request_selection(cbd); 1494 clip_mch_request_selection(cbd);
1525 #endif 1495 #endif
1526 } 1496 }
1527 1497
1528 int 1498 int
1529 clip_gen_owner_exists(cbd) 1499 clip_gen_owner_exists(VimClipboard *cbd UNUSED)
1530 VimClipboard *cbd UNUSED;
1531 { 1500 {
1532 #ifdef FEAT_XCLIPBOARD 1501 #ifdef FEAT_XCLIPBOARD
1533 # ifdef FEAT_GUI_GTK 1502 # ifdef FEAT_GUI_GTK
1534 if (gui.in_use) 1503 if (gui.in_use)
1535 return clip_gtk_owner_exists(cbd); 1504 return clip_gtk_owner_exists(cbd);
1582 * trash_input_buf() are functions for manipulating the input buffer. These 1551 * trash_input_buf() are functions for manipulating the input buffer. These
1583 * are used by the gui_* calls when a GUI is used to handle keyboard input. 1552 * are used by the gui_* calls when a GUI is used to handle keyboard input.
1584 */ 1553 */
1585 1554
1586 int 1555 int
1587 vim_is_input_buf_full() 1556 vim_is_input_buf_full(void)
1588 { 1557 {
1589 return (inbufcount >= INBUFLEN); 1558 return (inbufcount >= INBUFLEN);
1590 } 1559 }
1591 1560
1592 int 1561 int
1593 vim_is_input_buf_empty() 1562 vim_is_input_buf_empty(void)
1594 { 1563 {
1595 return (inbufcount == 0); 1564 return (inbufcount == 0);
1596 } 1565 }
1597 1566
1598 #if defined(FEAT_OLE) || defined(PROTO) 1567 #if defined(FEAT_OLE) || defined(PROTO)
1599 int 1568 int
1600 vim_free_in_input_buf() 1569 vim_free_in_input_buf(void)
1601 { 1570 {
1602 return (INBUFLEN - inbufcount); 1571 return (INBUFLEN - inbufcount);
1603 } 1572 }
1604 #endif 1573 #endif
1605 1574
1606 #if defined(FEAT_GUI_GTK) || defined(PROTO) 1575 #if defined(FEAT_GUI_GTK) || defined(PROTO)
1607 int 1576 int
1608 vim_used_in_input_buf() 1577 vim_used_in_input_buf(void)
1609 { 1578 {
1610 return inbufcount; 1579 return inbufcount;
1611 } 1580 }
1612 #endif 1581 #endif
1613 1582
1615 /* 1584 /*
1616 * Return the current contents of the input buffer and make it empty. 1585 * Return the current contents of the input buffer and make it empty.
1617 * The returned pointer must be passed to set_input_buf() later. 1586 * The returned pointer must be passed to set_input_buf() later.
1618 */ 1587 */
1619 char_u * 1588 char_u *
1620 get_input_buf() 1589 get_input_buf(void)
1621 { 1590 {
1622 garray_T *gap; 1591 garray_T *gap;
1623 1592
1624 /* We use a growarray to store the data pointer and the length. */ 1593 /* We use a growarray to store the data pointer and the length. */
1625 gap = (garray_T *)alloc((unsigned)sizeof(garray_T)); 1594 gap = (garray_T *)alloc((unsigned)sizeof(garray_T));
1638 /* 1607 /*
1639 * Restore the input buffer with a pointer returned from get_input_buf(). 1608 * Restore the input buffer with a pointer returned from get_input_buf().
1640 * The allocated memory is freed, this only works once! 1609 * The allocated memory is freed, this only works once!
1641 */ 1610 */
1642 void 1611 void
1643 set_input_buf(p) 1612 set_input_buf(char_u *p)
1644 char_u *p;
1645 { 1613 {
1646 garray_T *gap = (garray_T *)p; 1614 garray_T *gap = (garray_T *)p;
1647 1615
1648 if (gap != NULL) 1616 if (gap != NULL)
1649 { 1617 {
1667 * Add the given bytes to the input buffer 1635 * Add the given bytes to the input buffer
1668 * Special keys start with CSI. A real CSI must have been translated to 1636 * Special keys start with CSI. A real CSI must have been translated to
1669 * CSI KS_EXTRA KE_CSI. K_SPECIAL doesn't require translation. 1637 * CSI KS_EXTRA KE_CSI. K_SPECIAL doesn't require translation.
1670 */ 1638 */
1671 void 1639 void
1672 add_to_input_buf(s, len) 1640 add_to_input_buf(char_u *s, int len)
1673 char_u *s;
1674 int len;
1675 { 1641 {
1676 if (inbufcount + len > INBUFLEN + MAX_KEY_CODE_LEN) 1642 if (inbufcount + len > INBUFLEN + MAX_KEY_CODE_LEN)
1677 return; /* Shouldn't ever happen! */ 1643 return; /* Shouldn't ever happen! */
1678 1644
1679 #ifdef FEAT_HANGULIN 1645 #ifdef FEAT_HANGULIN
1717 } 1683 }
1718 #endif 1684 #endif
1719 1685
1720 #if defined(FEAT_HANGULIN) || defined(PROTO) 1686 #if defined(FEAT_HANGULIN) || defined(PROTO)
1721 void 1687 void
1722 push_raw_key(s, len) 1688 push_raw_key(char_u *s, int len)
1723 char_u *s;
1724 int len;
1725 { 1689 {
1726 char_u *tmpbuf; 1690 char_u *tmpbuf;
1727 1691
1728 tmpbuf = hangul_string_convert(s, &len); 1692 tmpbuf = hangul_string_convert(s, &len);
1729 if (tmpbuf != NULL) 1693 if (tmpbuf != NULL)
1739 1703
1740 #if defined(FEAT_GUI) || defined(FEAT_EVAL) || defined(FEAT_EX_EXTRA) \ 1704 #if defined(FEAT_GUI) || defined(FEAT_EVAL) || defined(FEAT_EX_EXTRA) \
1741 || defined(PROTO) 1705 || defined(PROTO)
1742 /* Remove everything from the input buffer. Called when ^C is found */ 1706 /* Remove everything from the input buffer. Called when ^C is found */
1743 void 1707 void
1744 trash_input_buf() 1708 trash_input_buf(void)
1745 { 1709 {
1746 inbufcount = 0; 1710 inbufcount = 0;
1747 } 1711 }
1748 #endif 1712 #endif
1749 1713
1751 * Read as much data from the input buffer as possible up to maxlen, and store 1715 * Read as much data from the input buffer as possible up to maxlen, and store
1752 * it in buf. 1716 * it in buf.
1753 * Note: this function used to be Read() in unix.c 1717 * Note: this function used to be Read() in unix.c
1754 */ 1718 */
1755 int 1719 int
1756 read_from_input_buf(buf, maxlen) 1720 read_from_input_buf(char_u *buf, long maxlen)
1757 char_u *buf;
1758 long maxlen;
1759 { 1721 {
1760 if (inbufcount == 0) /* if the buffer is empty, fill it */ 1722 if (inbufcount == 0) /* if the buffer is empty, fill it */
1761 fill_input_buf(TRUE); 1723 fill_input_buf(TRUE);
1762 if (maxlen > inbufcount) 1724 if (maxlen > inbufcount)
1763 maxlen = inbufcount; 1725 maxlen = inbufcount;
1767 mch_memmove(inbuf, inbuf + maxlen, (size_t)inbufcount); 1729 mch_memmove(inbuf, inbuf + maxlen, (size_t)inbufcount);
1768 return (int)maxlen; 1730 return (int)maxlen;
1769 } 1731 }
1770 1732
1771 void 1733 void
1772 fill_input_buf(exit_on_error) 1734 fill_input_buf(int exit_on_error UNUSED)
1773 int exit_on_error UNUSED;
1774 { 1735 {
1775 #if defined(UNIX) || defined(VMS) || defined(MACOS_X_UNIX) 1736 #if defined(UNIX) || defined(VMS) || defined(MACOS_X_UNIX)
1776 int len; 1737 int len;
1777 int try; 1738 int try;
1778 static int did_read_something = FALSE; 1739 static int did_read_something = FALSE;
1946 1907
1947 /* 1908 /*
1948 * Exit because of an input read error. 1909 * Exit because of an input read error.
1949 */ 1910 */
1950 void 1911 void
1951 read_error_exit() 1912 read_error_exit(void)
1952 { 1913 {
1953 if (silent_mode) /* Normal way to exit for "ex -s" */ 1914 if (silent_mode) /* Normal way to exit for "ex -s" */
1954 getout(0); 1915 getout(0);
1955 STRCPY(IObuff, _("Vim: Error reading input, exiting...\n")); 1916 STRCPY(IObuff, _("Vim: Error reading input, exiting...\n"));
1956 preserve_exit(); 1917 preserve_exit();
1959 #if defined(CURSOR_SHAPE) || defined(PROTO) 1920 #if defined(CURSOR_SHAPE) || defined(PROTO)
1960 /* 1921 /*
1961 * May update the shape of the cursor. 1922 * May update the shape of the cursor.
1962 */ 1923 */
1963 void 1924 void
1964 ui_cursor_shape() 1925 ui_cursor_shape(void)
1965 { 1926 {
1966 # ifdef FEAT_GUI 1927 # ifdef FEAT_GUI
1967 if (gui.in_use) 1928 if (gui.in_use)
1968 gui_update_cursor_later(); 1929 gui_update_cursor_later();
1969 else 1930 else
1984 || defined(FEAT_MBYTE) || defined(PROTO) 1945 || defined(FEAT_MBYTE) || defined(PROTO)
1985 /* 1946 /*
1986 * Check bounds for column number 1947 * Check bounds for column number
1987 */ 1948 */
1988 int 1949 int
1989 check_col(col) 1950 check_col(int col)
1990 int col;
1991 { 1951 {
1992 if (col < 0) 1952 if (col < 0)
1993 return 0; 1953 return 0;
1994 if (col >= (int)screen_Columns) 1954 if (col >= (int)screen_Columns)
1995 return (int)screen_Columns - 1; 1955 return (int)screen_Columns - 1;
1998 1958
1999 /* 1959 /*
2000 * Check bounds for row number 1960 * Check bounds for row number
2001 */ 1961 */
2002 int 1962 int
2003 check_row(row) 1963 check_row(int row)
2004 int row;
2005 { 1964 {
2006 if (row < 0) 1965 if (row < 0)
2007 return 0; 1966 return 0;
2008 if (row >= (int)screen_Rows) 1967 if (row >= (int)screen_Rows)
2009 return (int)screen_Rows - 1; 1968 return (int)screen_Rows - 1;
2022 /* 1981 /*
2023 * Open the application context (if it hasn't been opened yet). 1982 * Open the application context (if it hasn't been opened yet).
2024 * Used for Motif and Athena GUI and the xterm clipboard. 1983 * Used for Motif and Athena GUI and the xterm clipboard.
2025 */ 1984 */
2026 void 1985 void
2027 open_app_context() 1986 open_app_context(void)
2028 { 1987 {
2029 if (app_context == NULL) 1988 if (app_context == NULL)
2030 { 1989 {
2031 XtToolkitInitialize(); 1990 XtToolkitInitialize();
2032 app_context = XtCreateApplicationContext(); 1991 app_context = XtCreateApplicationContext();
2042 static Atom text_atom; 2001 static Atom text_atom;
2043 static Atom targets_atom; 2002 static Atom targets_atom;
2044 static Atom timestamp_atom; /* Used to get a timestamp */ 2003 static Atom timestamp_atom; /* Used to get a timestamp */
2045 2004
2046 void 2005 void
2047 x11_setup_atoms(dpy) 2006 x11_setup_atoms(Display *dpy)
2048 Display *dpy;
2049 { 2007 {
2050 vim_atom = XInternAtom(dpy, VIM_ATOM_NAME, False); 2008 vim_atom = XInternAtom(dpy, VIM_ATOM_NAME, False);
2051 #ifdef FEAT_MBYTE 2009 #ifdef FEAT_MBYTE
2052 vimenc_atom = XInternAtom(dpy, VIMENC_ATOM_NAME,False); 2010 vimenc_atom = XInternAtom(dpy, VIMENC_ATOM_NAME,False);
2053 utf8_atom = XInternAtom(dpy, "UTF8_STRING", False); 2011 utf8_atom = XInternAtom(dpy, "UTF8_STRING", False);
2071 2029
2072 /* 2030 /*
2073 * Property callback to get a timestamp for XtOwnSelection. 2031 * Property callback to get a timestamp for XtOwnSelection.
2074 */ 2032 */
2075 static void 2033 static void
2076 clip_x11_timestamp_cb(w, n, event, cont) 2034 clip_x11_timestamp_cb(
2077 Widget w; 2035 Widget w,
2078 XtPointer n UNUSED; 2036 XtPointer n UNUSED,
2079 XEvent *event; 2037 XEvent *event,
2080 Boolean *cont UNUSED; 2038 Boolean *cont UNUSED)
2081 { 2039 {
2082 Atom actual_type; 2040 Atom actual_type;
2083 int format; 2041 int format;
2084 unsigned long nitems, bytes_after; 2042 unsigned long nitems, bytes_after;
2085 unsigned char *prop=NULL; 2043 unsigned char *prop=NULL;
2117 clip_star.owned = TRUE; 2075 clip_star.owned = TRUE;
2118 } 2076 }
2119 } 2077 }
2120 2078
2121 void 2079 void
2122 x11_setup_selection(w) 2080 x11_setup_selection(Widget w)
2123 Widget w;
2124 { 2081 {
2125 XtAddEventHandler(w, PropertyChangeMask, False, 2082 XtAddEventHandler(w, PropertyChangeMask, False,
2126 /*(XtEventHandler)*/clip_x11_timestamp_cb, (XtPointer)NULL); 2083 /*(XtEventHandler)*/clip_x11_timestamp_cb, (XtPointer)NULL);
2127 } 2084 }
2128 2085
2129 static void 2086 static void
2130 clip_x11_request_selection_cb(w, success, sel_atom, type, value, length, 2087 clip_x11_request_selection_cb(
2131 format) 2088 Widget w UNUSED,
2132 Widget w UNUSED; 2089 XtPointer success,
2133 XtPointer success; 2090 Atom *sel_atom,
2134 Atom *sel_atom; 2091 Atom *type,
2135 Atom *type; 2092 XtPointer value,
2136 XtPointer value; 2093 long_u *length,
2137 long_u *length; 2094 int *format)
2138 int *format;
2139 { 2095 {
2140 int motion_type = MAUTO; 2096 int motion_type = MAUTO;
2141 long_u len; 2097 long_u len;
2142 char_u *p; 2098 char_u *p;
2143 char **text_list = NULL; 2099 char **text_list = NULL;
2239 XtFree((char *)value); 2195 XtFree((char *)value);
2240 *(int *)success = TRUE; 2196 *(int *)success = TRUE;
2241 } 2197 }
2242 2198
2243 void 2199 void
2244 clip_x11_request_selection(myShell, dpy, cbd) 2200 clip_x11_request_selection(
2245 Widget myShell; 2201 Widget myShell,
2246 Display *dpy; 2202 Display *dpy,
2247 VimClipboard *cbd; 2203 VimClipboard *cbd)
2248 { 2204 {
2249 XEvent event; 2205 XEvent event;
2250 Atom type; 2206 Atom type;
2251 static int success; 2207 static int success;
2252 int i; 2208 int i;
2344 /* Final fallback position - use the X CUT_BUFFER0 store */ 2300 /* Final fallback position - use the X CUT_BUFFER0 store */
2345 yank_cut_buffer0(dpy, cbd); 2301 yank_cut_buffer0(dpy, cbd);
2346 } 2302 }
2347 2303
2348 static Boolean 2304 static Boolean
2349 clip_x11_convert_selection_cb(w, sel_atom, target, type, value, length, format) 2305 clip_x11_convert_selection_cb(
2350 Widget w UNUSED; 2306 Widget w UNUSED,
2351 Atom *sel_atom; 2307 Atom *sel_atom,
2352 Atom *target; 2308 Atom *target,
2353 Atom *type; 2309 Atom *type,
2354 XtPointer *value; 2310 XtPointer *value,
2355 long_u *length; 2311 long_u *length,
2356 int *format; 2312 int *format)
2357 { 2313 {
2358 char_u *string; 2314 char_u *string;
2359 char_u *result; 2315 char_u *result;
2360 int motion_type; 2316 int motion_type;
2361 VimClipboard *cbd; 2317 VimClipboard *cbd;
2486 vim_free(string); 2442 vim_free(string);
2487 return True; 2443 return True;
2488 } 2444 }
2489 2445
2490 static void 2446 static void
2491 clip_x11_lose_ownership_cb(w, sel_atom) 2447 clip_x11_lose_ownership_cb(Widget w UNUSED, Atom *sel_atom)
2492 Widget w UNUSED;
2493 Atom *sel_atom;
2494 { 2448 {
2495 if (*sel_atom == clip_plus.sel_atom) 2449 if (*sel_atom == clip_plus.sel_atom)
2496 clip_lose_selection(&clip_plus); 2450 clip_lose_selection(&clip_plus);
2497 else 2451 else
2498 clip_lose_selection(&clip_star); 2452 clip_lose_selection(&clip_star);
2499 } 2453 }
2500 2454
2501 void 2455 void
2502 clip_x11_lose_selection(myShell, cbd) 2456 clip_x11_lose_selection(Widget myShell, VimClipboard *cbd)
2503 Widget myShell;
2504 VimClipboard *cbd;
2505 { 2457 {
2506 XtDisownSelection(myShell, cbd->sel_atom, 2458 XtDisownSelection(myShell, cbd->sel_atom,
2507 XtLastTimestampProcessed(XtDisplay(myShell))); 2459 XtLastTimestampProcessed(XtDisplay(myShell)));
2508 } 2460 }
2509 2461
2510 int 2462 int
2511 clip_x11_own_selection(myShell, cbd) 2463 clip_x11_own_selection(Widget myShell, VimClipboard *cbd)
2512 Widget myShell;
2513 VimClipboard *cbd;
2514 { 2464 {
2515 /* When using the GUI we have proper timestamps, use the one of the last 2465 /* When using the GUI we have proper timestamps, use the one of the last
2516 * event. When in the console we don't get events (the terminal gets 2466 * event. When in the console we don't get events (the terminal gets
2517 * them), Get the time by a zero-length append, clip_x11_timestamp_cb will 2467 * them), Get the time by a zero-length append, clip_x11_timestamp_cb will
2518 * be called with the current timestamp. */ 2468 * be called with the current timestamp. */
2540 /* 2490 /*
2541 * Send the current selection to the clipboard. Do nothing for X because we 2491 * Send the current selection to the clipboard. Do nothing for X because we
2542 * will fill in the selection only when requested by another app. 2492 * will fill in the selection only when requested by another app.
2543 */ 2493 */
2544 void 2494 void
2545 clip_x11_set_selection(cbd) 2495 clip_x11_set_selection(VimClipboard *cbd UNUSED)
2546 VimClipboard *cbd UNUSED;
2547 { 2496 {
2548 } 2497 }
2549 2498
2550 int 2499 int
2551 clip_x11_owner_exists(cbd) 2500 clip_x11_owner_exists(VimClipboard *cbd)
2552 VimClipboard *cbd;
2553 { 2501 {
2554 return XGetSelectionOwner(X_DISPLAY, cbd->sel_atom) != None; 2502 return XGetSelectionOwner(X_DISPLAY, cbd->sel_atom) != None;
2555 } 2503 }
2556 #endif 2504 #endif
2557 2505
2559 || defined(FEAT_GUI_GTK) || defined(PROTO) 2507 || defined(FEAT_GUI_GTK) || defined(PROTO)
2560 /* 2508 /*
2561 * Get the contents of the X CUT_BUFFER0 and put it in "cbd". 2509 * Get the contents of the X CUT_BUFFER0 and put it in "cbd".
2562 */ 2510 */
2563 void 2511 void
2564 yank_cut_buffer0(dpy, cbd) 2512 yank_cut_buffer0(Display *dpy, VimClipboard *cbd)
2565 Display *dpy;
2566 VimClipboard *cbd;
2567 { 2513 {
2568 int nbytes = 0; 2514 int nbytes = 0;
2569 char_u *buffer = (char_u *)XFetchBuffer(dpy, &nbytes, 0); 2515 char_u *buffer = (char_u *)XFetchBuffer(dpy, &nbytes, 0);
2570 2516
2571 if (nbytes > 0) 2517 if (nbytes > 0)
2636 * 2582 *
2637 * If flags has MOUSE_SETPOS, nothing is done, only the current position is 2583 * If flags has MOUSE_SETPOS, nothing is done, only the current position is
2638 * remembered. 2584 * remembered.
2639 */ 2585 */
2640 int 2586 int
2641 jump_to_mouse(flags, inclusive, which_button) 2587 jump_to_mouse(
2642 int flags; 2588 int flags,
2643 int *inclusive; /* used for inclusive operator, can be NULL */ 2589 int *inclusive, /* used for inclusive operator, can be NULL */
2644 int which_button; /* MOUSE_LEFT, MOUSE_RIGHT, MOUSE_MIDDLE */ 2590 int which_button) /* MOUSE_LEFT, MOUSE_RIGHT, MOUSE_MIDDLE */
2645 { 2591 {
2646 static int on_status_line = 0; /* #lines below bottom of window */ 2592 static int on_status_line = 0; /* #lines below bottom of window */
2647 #ifdef FEAT_VERTSPLIT 2593 #ifdef FEAT_VERTSPLIT
2648 static int on_sep_line = 0; /* on separator right of window */ 2594 static int on_sep_line = 0; /* on separator right of window */
2649 #endif 2595 #endif
3049 * Compute the position in the buffer line from the posn on the screen in 2995 * Compute the position in the buffer line from the posn on the screen in
3050 * window "win". 2996 * window "win".
3051 * Returns TRUE if the position is below the last line. 2997 * Returns TRUE if the position is below the last line.
3052 */ 2998 */
3053 int 2999 int
3054 mouse_comp_pos(win, rowp, colp, lnump) 3000 mouse_comp_pos(
3055 win_T *win; 3001 win_T *win,
3056 int *rowp; 3002 int *rowp,
3057 int *colp; 3003 int *colp,
3058 linenr_T *lnump; 3004 linenr_T *lnump)
3059 { 3005 {
3060 int col = *colp; 3006 int col = *colp;
3061 int row = *rowp; 3007 int row = *rowp;
3062 linenr_T lnum; 3008 linenr_T lnum;
3063 int retval = FALSE; 3009 int retval = FALSE;
3138 /* 3084 /*
3139 * Find the window at screen position "*rowp" and "*colp". The positions are 3085 * Find the window at screen position "*rowp" and "*colp". The positions are
3140 * updated to become relative to the top-left of the window. 3086 * updated to become relative to the top-left of the window.
3141 */ 3087 */
3142 win_T * 3088 win_T *
3143 mouse_find_win(rowp, colp) 3089 mouse_find_win(int *rowp, int *colp UNUSED)
3144 int *rowp;
3145 int *colp UNUSED;
3146 { 3090 {
3147 frame_T *fp; 3091 frame_T *fp;
3148 3092
3149 fp = topframe; 3093 fp = topframe;
3150 *rowp -= firstwin->w_winrow; 3094 *rowp -= firstwin->w_winrow;
3182 || defined(FEAT_GUI_PHOTON) || defined(PROTO) 3126 || defined(FEAT_GUI_PHOTON) || defined(PROTO)
3183 /* 3127 /*
3184 * Translate window coordinates to buffer position without any side effects 3128 * Translate window coordinates to buffer position without any side effects
3185 */ 3129 */
3186 int 3130 int
3187 get_fpos_of_mouse(mpos) 3131 get_fpos_of_mouse(pos_T *mpos)
3188 pos_T *mpos;
3189 { 3132 {
3190 win_T *wp; 3133 win_T *wp;
3191 int row = mouse_row; 3134 int row = mouse_row;
3192 int col = mouse_col; 3135 int col = mouse_col;
3193 3136
3230 /* 3173 /*
3231 * Convert a virtual (screen) column to a character column. 3174 * Convert a virtual (screen) column to a character column.
3232 * The first column is one. 3175 * The first column is one.
3233 */ 3176 */
3234 int 3177 int
3235 vcol2col(wp, lnum, vcol) 3178 vcol2col(win_T *wp, linenr_T lnum, int vcol)
3236 win_T *wp;
3237 linenr_T lnum;
3238 int vcol;
3239 { 3179 {
3240 /* try to advance to the specified column */ 3180 /* try to advance to the specified column */
3241 int count = 0; 3181 int count = 0;
3242 char_u *ptr; 3182 char_u *ptr;
3243 char_u *line; 3183 char_u *line;
3258 /* 3198 /*
3259 * Called when focus changed. Used for the GUI or for systems where this can 3199 * Called when focus changed. Used for the GUI or for systems where this can
3260 * be done in the console (Win32). 3200 * be done in the console (Win32).
3261 */ 3201 */
3262 void 3202 void
3263 ui_focus_change(in_focus) 3203 ui_focus_change(
3264 int in_focus; /* TRUE if focus gained. */ 3204 int in_focus) /* TRUE if focus gained. */
3265 { 3205 {
3266 static time_t last_time = (time_t)0; 3206 static time_t last_time = (time_t)0;
3267 int need_redraw = FALSE; 3207 int need_redraw = FALSE;
3268 3208
3269 /* When activated: Check if any file was modified outside of Vim. 3209 /* When activated: Check if any file was modified outside of Vim.
3327 #if defined(USE_IM_CONTROL) || defined(PROTO) 3267 #if defined(USE_IM_CONTROL) || defined(PROTO)
3328 /* 3268 /*
3329 * Save current Input Method status to specified place. 3269 * Save current Input Method status to specified place.
3330 */ 3270 */
3331 void 3271 void
3332 im_save_status(psave) 3272 im_save_status(long *psave)
3333 long *psave;
3334 { 3273 {
3335 /* Don't save when 'imdisable' is set or "xic" is NULL, IM is always 3274 /* Don't save when 'imdisable' is set or "xic" is NULL, IM is always
3336 * disabled then (but might start later). 3275 * disabled then (but might start later).
3337 * Also don't save when inside a mapping, vgetc_im_active has not been set 3276 * Also don't save when inside a mapping, vgetc_im_active has not been set
3338 * then. 3277 * then.