To: vim_dev@googlegroups.com Subject: Patch 8.1.2065 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 8.1.2065 Problem: Compiler warning building non-GUI with MinGW. Solution: Adjust #ifdefs. (Yegappan Lakshmanan, closes #4964) Files: sre/mouse.c *** ../vim-8.1.2064/src/mouse.c 2019-09-21 20:46:14.728275744 +0200 --- src/mouse.c 2019-09-22 14:08:06.445273525 +0200 *************** *** 15,22 **** #if defined(FEAT_MOUSE) || defined(PROTO) - static int get_fpos_of_mouse(pos_T *mpos); - /* * Get class of a character for selection: same class means same word. * 0: blank --- 15,20 ---- *************** *** 102,107 **** --- 100,151 ---- } } + #if defined(FEAT_GUI_MOTIF) || defined(FEAT_GUI_GTK) \ + || defined(FEAT_GUI_ATHENA) || defined(FEAT_GUI_MSWIN) \ + || defined(FEAT_GUI_MAC) || defined(FEAT_GUI_PHOTON) \ + || defined(FEAT_TERM_POPUP_MENU) + # define USE_POPUP_SETPOS + # define NEED_VCOL2COL + + /* + * Translate window coordinates to buffer position without any side effects + */ + static int + get_fpos_of_mouse(pos_T *mpos) + { + win_T *wp; + int row = mouse_row; + int col = mouse_col; + + if (row < 0 || col < 0) // check if it makes sense + return IN_UNKNOWN; + + // find the window where the row is in + wp = mouse_find_win(&row, &col, FAIL_POPUP); + if (wp == NULL) + return IN_UNKNOWN; + // winpos and height may change in win_enter()! + if (row >= wp->w_height) // In (or below) status line + return IN_STATUS_LINE; + if (col >= wp->w_width) // In vertical separator line + return IN_SEP_LINE; + + if (wp != curwin) + return IN_UNKNOWN; + + // compute the position in the buffer line from the posn on the screen + if (mouse_comp_pos(curwin, &row, &col, &mpos->lnum, NULL)) + return IN_STATUS_LINE; // past bottom + + mpos->col = vcol2col(wp, mpos->lnum, col); + + if (mpos->col > 0) + --mpos->col; + mpos->coladd = 0; + return IN_BUFFER; + } + #endif + /* * Do the appropriate action for the current mouse click in the current mode. * Not used for Command-line mode. *************** *** 469,478 **** if (which_button == MOUSE_RIGHT && !(mod_mask & (MOD_MASK_SHIFT | MOD_MASK_CTRL))) { ! #if defined(FEAT_GUI_MOTIF) || defined(FEAT_GUI_GTK) \ ! || defined(FEAT_GUI_ATHENA) || defined(FEAT_GUI_MSWIN) \ ! || defined(FEAT_GUI_MAC) || defined(FEAT_GUI_PHOTON) \ ! || defined(FEAT_TERM_POPUP_MENU) # ifdef FEAT_GUI if (gui.in_use) { --- 513,519 ---- if (which_button == MOUSE_RIGHT && !(mod_mask & (MOD_MASK_SHIFT | MOD_MASK_CTRL))) { ! #ifdef USE_POPUP_SETPOS # ifdef FEAT_GUI if (gui.in_use) { *************** *** 2232,2282 **** return NULL; } - #if defined(FEAT_GUI_MOTIF) || defined(FEAT_GUI_GTK) || defined(FEAT_GUI_MAC) \ - || defined(FEAT_GUI_ATHENA) || defined(FEAT_GUI_MSWIN) \ - || defined(FEAT_GUI_PHOTON) || defined(FEAT_TERM_POPUP_MENU) \ - || defined(PROTO) - # define NEED_VCOL2COL - - /* - * Translate window coordinates to buffer position without any side effects - */ - static int - get_fpos_of_mouse(pos_T *mpos) - { - win_T *wp; - int row = mouse_row; - int col = mouse_col; - - if (row < 0 || col < 0) // check if it makes sense - return IN_UNKNOWN; - - // find the window where the row is in - wp = mouse_find_win(&row, &col, FAIL_POPUP); - if (wp == NULL) - return IN_UNKNOWN; - // winpos and height may change in win_enter()! - if (row >= wp->w_height) // In (or below) status line - return IN_STATUS_LINE; - if (col >= wp->w_width) // In vertical separator line - return IN_SEP_LINE; - - if (wp != curwin) - return IN_UNKNOWN; - - // compute the position in the buffer line from the posn on the screen - if (mouse_comp_pos(curwin, &row, &col, &mpos->lnum, NULL)) - return IN_STATUS_LINE; // past bottom - - mpos->col = vcol2col(wp, mpos->lnum, col); - - if (mpos->col > 0) - --mpos->col; - mpos->coladd = 0; - return IN_BUFFER; - } - #endif - #if defined(NEED_VCOL2COL) || defined(FEAT_BEVAL) || defined(FEAT_TEXT_PROP) \ || defined(PROTO) /* --- 2273,2278 ---- *** ../vim-8.1.2064/src/version.c 2019-09-21 23:09:00.979830687 +0200 --- src/version.c 2019-09-22 14:10:21.072531944 +0200 *************** *** 759,760 **** --- 759,762 ---- { /* Add new patch number below this line */ + /**/ + 2065, /**/ -- I'd like to meet the man who invented sex and see what he's working on now. /// 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 ///