Skip to content

Commit 910c378

Browse files
committed
patch 8.1.2065: compiler warning building non-GUI with MinGW.
Problem: Compiler warning building non-GUI with MinGW. Solution: Adjust #ifdefs. (Yegappan Lakshmanan, closes #4964)
1 parent bd67aac commit 910c378

2 files changed

Lines changed: 49 additions & 51 deletions

File tree

src/mouse.c

Lines changed: 47 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,6 @@
1515

1616
#if defined(FEAT_MOUSE) || defined(PROTO)
1717

18-
static int get_fpos_of_mouse(pos_T *mpos);
19-
2018
/*
2119
* Get class of a character for selection: same class means same word.
2220
* 0: blank
@@ -102,6 +100,52 @@ find_end_of_word(pos_T *pos)
102100
}
103101
}
104102

103+
#if defined(FEAT_GUI_MOTIF) || defined(FEAT_GUI_GTK) \
104+
|| defined(FEAT_GUI_ATHENA) || defined(FEAT_GUI_MSWIN) \
105+
|| defined(FEAT_GUI_MAC) || defined(FEAT_GUI_PHOTON) \
106+
|| defined(FEAT_TERM_POPUP_MENU)
107+
# define USE_POPUP_SETPOS
108+
# define NEED_VCOL2COL
109+
110+
/*
111+
* Translate window coordinates to buffer position without any side effects
112+
*/
113+
static int
114+
get_fpos_of_mouse(pos_T *mpos)
115+
{
116+
win_T *wp;
117+
int row = mouse_row;
118+
int col = mouse_col;
119+
120+
if (row < 0 || col < 0) // check if it makes sense
121+
return IN_UNKNOWN;
122+
123+
// find the window where the row is in
124+
wp = mouse_find_win(&row, &col, FAIL_POPUP);
125+
if (wp == NULL)
126+
return IN_UNKNOWN;
127+
// winpos and height may change in win_enter()!
128+
if (row >= wp->w_height) // In (or below) status line
129+
return IN_STATUS_LINE;
130+
if (col >= wp->w_width) // In vertical separator line
131+
return IN_SEP_LINE;
132+
133+
if (wp != curwin)
134+
return IN_UNKNOWN;
135+
136+
// compute the position in the buffer line from the posn on the screen
137+
if (mouse_comp_pos(curwin, &row, &col, &mpos->lnum, NULL))
138+
return IN_STATUS_LINE; // past bottom
139+
140+
mpos->col = vcol2col(wp, mpos->lnum, col);
141+
142+
if (mpos->col > 0)
143+
--mpos->col;
144+
mpos->coladd = 0;
145+
return IN_BUFFER;
146+
}
147+
#endif
148+
105149
/*
106150
* Do the appropriate action for the current mouse click in the current mode.
107151
* Not used for Command-line mode.
@@ -469,10 +513,7 @@ do_mouse(
469513
if (which_button == MOUSE_RIGHT
470514
&& !(mod_mask & (MOD_MASK_SHIFT | MOD_MASK_CTRL)))
471515
{
472-
#if defined(FEAT_GUI_MOTIF) || defined(FEAT_GUI_GTK) \
473-
|| defined(FEAT_GUI_ATHENA) || defined(FEAT_GUI_MSWIN) \
474-
|| defined(FEAT_GUI_MAC) || defined(FEAT_GUI_PHOTON) \
475-
|| defined(FEAT_TERM_POPUP_MENU)
516+
#ifdef USE_POPUP_SETPOS
476517
# ifdef FEAT_GUI
477518
if (gui.in_use)
478519
{
@@ -2232,51 +2273,6 @@ mouse_find_win(int *rowp, int *colp, mouse_find_T popup UNUSED)
22322273
return NULL;
22332274
}
22342275

2235-
#if defined(FEAT_GUI_MOTIF) || defined(FEAT_GUI_GTK) || defined(FEAT_GUI_MAC) \
2236-
|| defined(FEAT_GUI_ATHENA) || defined(FEAT_GUI_MSWIN) \
2237-
|| defined(FEAT_GUI_PHOTON) || defined(FEAT_TERM_POPUP_MENU) \
2238-
|| defined(PROTO)
2239-
# define NEED_VCOL2COL
2240-
2241-
/*
2242-
* Translate window coordinates to buffer position without any side effects
2243-
*/
2244-
static int
2245-
get_fpos_of_mouse(pos_T *mpos)
2246-
{
2247-
win_T *wp;
2248-
int row = mouse_row;
2249-
int col = mouse_col;
2250-
2251-
if (row < 0 || col < 0) // check if it makes sense
2252-
return IN_UNKNOWN;
2253-
2254-
// find the window where the row is in
2255-
wp = mouse_find_win(&row, &col, FAIL_POPUP);
2256-
if (wp == NULL)
2257-
return IN_UNKNOWN;
2258-
// winpos and height may change in win_enter()!
2259-
if (row >= wp->w_height) // In (or below) status line
2260-
return IN_STATUS_LINE;
2261-
if (col >= wp->w_width) // In vertical separator line
2262-
return IN_SEP_LINE;
2263-
2264-
if (wp != curwin)
2265-
return IN_UNKNOWN;
2266-
2267-
// compute the position in the buffer line from the posn on the screen
2268-
if (mouse_comp_pos(curwin, &row, &col, &mpos->lnum, NULL))
2269-
return IN_STATUS_LINE; // past bottom
2270-
2271-
mpos->col = vcol2col(wp, mpos->lnum, col);
2272-
2273-
if (mpos->col > 0)
2274-
--mpos->col;
2275-
mpos->coladd = 0;
2276-
return IN_BUFFER;
2277-
}
2278-
#endif
2279-
22802276
#if defined(NEED_VCOL2COL) || defined(FEAT_BEVAL) || defined(FEAT_TEXT_PROP) \
22812277
|| defined(PROTO)
22822278
/*

src/version.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -757,6 +757,8 @@ static char *(features[]) =
757757

758758
static int included_patches[] =
759759
{ /* Add new patch number below this line */
760+
/**/
761+
2065,
760762
/**/
761763
2064,
762764
/**/

0 commit comments

Comments
 (0)