summaryrefslogtreecommitdiffstats
path: root/src/gui.c
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2017-09-16 20:54:51 +0200
committerBram Moolenaar <Bram@vim.org>2017-09-16 20:54:51 +0200
commit4033c55eca575777718c0701e26635a0cc47d907 (patch)
tree8dc460ad495106198a9119b52f6505033f7a75b3 /src/gui.c
parente738a1a033cd31cd2568ba99a9e2dca1e65b45ea (diff)
patch 8.0.1118: FEAT_WINDOWS adds a lot of #ifdefsv8.0.1118
Problem: FEAT_WINDOWS adds a lot of #ifdefs while it is nearly always enabled and only adds 7% to the binary size of the tiny build. Solution: Graduate FEAT_WINDOWS.
Diffstat (limited to 'src/gui.c')
-rw-r--r--src/gui.c74
1 files changed, 6 insertions, 68 deletions
diff --git a/src/gui.c b/src/gui.c
index f714d7ac6b..4f9c63f669 100644
--- a/src/gui.c
+++ b/src/gui.c
@@ -1642,9 +1642,7 @@ gui_set_shellsize(
min_width = base_width + MIN_COLUMNS * gui.char_width;
min_height = base_height + MIN_LINES * gui.char_height;
-#ifdef FEAT_WINDOWS
min_height += tabline_height() * gui.char_height;
-#endif
#ifdef FEAT_GUI_GTK
if (un_maximize)
@@ -1828,7 +1826,6 @@ gui_write(
gui.scroll_region_bot = arg1;
}
break;
-#ifdef FEAT_WINDOWS
case 'V': /* Set vertical scroll region */
if (arg1 < arg2)
{
@@ -1841,7 +1838,6 @@ gui_write(
gui.scroll_region_right = arg1;
}
break;
-#endif
case 'd': /* Delete line */
gui_delete_lines(gui.row, 1);
break;
@@ -3154,16 +3150,11 @@ button_set:
* Visual selection.
*/
if ((State == NORMAL || State == NORMAL_BUSY || (State & INSERT))
- && Y_2_ROW(y) >= topframe->fr_height
-# ifdef FEAT_WINDOWS
- + firstwin->w_winrow
-# endif
+ && Y_2_ROW(y) >= topframe->fr_height + firstwin->w_winrow
&& button != MOUSE_DRAG
# ifdef FEAT_MOUSESHAPE
&& !drag_status_line
-# ifdef FEAT_WINDOWS
&& !drag_sep_line
-# endif
# endif
)
checkfor = MOUSE_NONE;
@@ -3439,7 +3430,6 @@ gui_init_which_components(char_u *oldval UNUSED)
case GO_RIGHT:
gui.which_scrollbars[SBAR_RIGHT] = TRUE;
break;
-#ifdef FEAT_WINDOWS
case GO_VLEFT:
if (win_hasvertsplit())
gui.which_scrollbars[SBAR_LEFT] = TRUE;
@@ -3448,7 +3438,6 @@ gui_init_which_components(char_u *oldval UNUSED)
if (win_hasvertsplit())
gui.which_scrollbars[SBAR_RIGHT] = TRUE;
break;
-#endif
case GO_BOT:
gui.which_scrollbars[SBAR_BOTTOM] = TRUE;
break;
@@ -3511,11 +3500,8 @@ gui_init_which_components(char_u *oldval UNUSED)
* shown/unshown. Thus we need two places to remember whether a
* scrollbar is there or not. */
if (gui.which_scrollbars[i] != prev_which_scrollbars[i]
-#ifdef FEAT_WINDOWS
|| gui.which_scrollbars[i]
- != curtab->tp_prev_which_scrollbars[i]
-#endif
- )
+ != curtab->tp_prev_which_scrollbars[i])
{
if (i == SBAR_BOTTOM)
gui_mch_enable_scrollbar(&gui.bottom_sbar,
@@ -3537,9 +3523,7 @@ gui_init_which_components(char_u *oldval UNUSED)
fix_size = TRUE;
}
}
-#ifdef FEAT_WINDOWS
curtab->tp_prev_which_scrollbars[i] = gui.which_scrollbars[i];
-#endif
prev_which_scrollbars[i] = gui.which_scrollbars[i];
}
@@ -3615,12 +3599,10 @@ gui_init_which_components(char_u *oldval UNUSED)
Columns = prev_Columns;
#endif
}
-#ifdef FEAT_WINDOWS
/* When the console tabline appears or disappears the window positions
* change. */
if (firstwin->w_winrow != tabline_height())
shell_new_rows(); /* recompute window positions and heights */
-#endif
}
}
@@ -3830,7 +3812,6 @@ send_tabline_menu_event(int tabidx, int event)
* Scrollbar stuff:
*/
-#if defined(FEAT_WINDOWS) || defined(PROTO)
/*
* Remove all scrollbars. Used before switching to another tab page.
*/
@@ -3854,7 +3835,6 @@ gui_remove_scrollbars(void)
curtab->tp_prev_which_scrollbars[i] = -1;
}
}
-#endif
void
gui_create_scrollbar(scrollbar_T *sb, int type, win_T *wp)
@@ -3872,9 +3852,7 @@ gui_create_scrollbar(scrollbar_T *sb, int type, win_T *wp)
sb->max = 1;
sb->top = 0;
sb->height = 0;
-#ifdef FEAT_WINDOWS
sb->width = 0;
-#endif
sb->status_height = 0;
gui_mch_create_scrollbar(sb, (wp == NULL) ? SBAR_HORIZ : SBAR_VERT);
}
@@ -3917,9 +3895,7 @@ gui_find_scrollbar(long ident)
void
gui_drag_scrollbar(scrollbar_T *sb, long value, int still_dragging)
{
-#ifdef FEAT_WINDOWS
win_T *wp;
-#endif
int sb_num;
#ifdef USE_ON_FLY_SCROLL
colnr_T old_leftcol = curwin->w_leftcol;
@@ -4011,15 +3987,10 @@ gui_drag_scrollbar(scrollbar_T *sb, long value, int still_dragging)
if (sb->wp != NULL) /* vertical scrollbar */
{
sb_num = 0;
-#ifdef FEAT_WINDOWS
for (wp = firstwin; wp != sb->wp && wp != NULL; wp = wp->w_next)
sb_num++;
if (wp == NULL)
return;
-#else
- if (sb->wp != curwin)
- return;
-#endif
#ifdef USE_ON_FLY_SCROLL
current_scrollbar = sb_num;
@@ -4128,7 +4099,6 @@ gui_drag_scrollbar(scrollbar_T *sb, long value, int still_dragging)
* Scrollbar stuff:
*/
-#if defined(FEAT_AUTOCMD) || defined(FEAT_WINDOWS) || defined(PROTO)
/*
* Called when something in the window layout has changed.
*/
@@ -4143,7 +4113,6 @@ gui_may_update_scrollbars(void)
}
need_mouse_correct = TRUE;
}
-#endif
void
gui_update_scrollbars(
@@ -4154,9 +4123,7 @@ gui_update_scrollbars(
long val, size, max; /* need 32 bits here */
int which_sb;
int h, y;
-#ifdef FEAT_WINDOWS
static win_T *prev_curwin = NULL;
-#endif
/* Update the horizontal scrollbar */
gui_update_horiz_scrollbar(force);
@@ -4249,22 +4216,17 @@ gui_update_scrollbars(
continue;
}
if (force || sb->height != wp->w_height
-#ifdef FEAT_WINDOWS
|| sb->top != wp->w_winrow
|| sb->status_height != wp->w_status_height
|| sb->width != wp->w_width
- || prev_curwin != curwin
-#endif
- )
+ || prev_curwin != curwin)
{
/* Height, width or position of scrollbar has changed. For
* vertical split: curwin changed. */
sb->height = wp->w_height;
-#ifdef FEAT_WINDOWS
sb->top = wp->w_winrow;
sb->status_height = wp->w_status_height;
sb->width = wp->w_width;
-#endif
/* Calculate height and position in pixels */
h = (sb->height + sb->status_height) * gui.char_height;
@@ -4290,9 +4252,7 @@ gui_update_scrollbars(
y += gui.tabline_height;
#endif
-#ifdef FEAT_WINDOWS
if (wp->w_winrow == 0)
-#endif
{
/* Height of top scrollbar includes width of top border */
h += gui.border_offset;
@@ -4345,9 +4305,7 @@ gui_update_scrollbars(
val, size, max);
}
}
-#ifdef FEAT_WINDOWS
prev_curwin = curwin;
-#endif
--hold_gui_events;
}
@@ -4362,7 +4320,6 @@ gui_do_scrollbar(
int which, /* SBAR_LEFT or SBAR_RIGHT */
int enable) /* TRUE to enable scrollbar */
{
-#ifdef FEAT_WINDOWS
int midcol = curwin->w_wincol + curwin->w_width / 2;
int has_midcol = (wp->w_wincol <= midcol
&& wp->w_wincol + wp->w_width >= midcol);
@@ -4393,7 +4350,6 @@ gui_do_scrollbar(
enable = FALSE;
}
}
-#endif
gui_mch_enable_scrollbar(&wp->w_scrollbars[which], enable);
}
@@ -4863,11 +4819,9 @@ gui_mouse_moved(int x, int y)
if (wp == curwin || wp == NULL)
return; /* still in the same old window, or none at all */
-#ifdef FEAT_WINDOWS
/* Ignore position in the tab pages line. */
if (Y_2_ROW(y) < tabline_height())
return;
-#endif
/*
* format a mouse click on status line input
@@ -4886,11 +4840,7 @@ gui_mouse_moved(int x, int y)
st[2] = KE_FILLER;
st[3] = (char_u)MOUSE_LEFT;
fill_mouse_coord(st + 4,
-#ifdef FEAT_WINDOWS
wp->w_wincol == 0 ? -1 : wp->w_wincol + MOUSE_COLOFF,
-#else
- -1,
-#endif
wp->w_height + W_WINROW(wp));
add_to_input_buf(st, 8);
@@ -4922,11 +4872,7 @@ gui_mouse_correct(void)
/* Don't move the mouse when it's left or right of the Vim window */
if (x < 0 || x > Columns * gui.char_width)
return;
- if (y >= 0
-# ifdef FEAT_WINDOWS
- && Y_2_ROW(y) >= tabline_height()
-# endif
- )
+ if (y >= 0 && Y_2_ROW(y) >= tabline_height())
wp = xy2win(x, y);
if (wp != curwin && wp != NULL) /* If in other than current window */
{
@@ -4943,7 +4889,6 @@ gui_mouse_correct(void)
static win_T *
xy2win(int x UNUSED, int y UNUSED)
{
-#ifdef FEAT_WINDOWS
int row;
int col;
win_T *wp;
@@ -4955,7 +4900,7 @@ xy2win(int x UNUSED, int y UNUSED)
wp = mouse_find_win(&row, &col);
if (wp == NULL)
return NULL;
-# ifdef FEAT_MOUSESHAPE
+#ifdef FEAT_MOUSESHAPE
if (State == HITRETURN || State == ASKMORE)
{
if (Y_2_ROW(y) >= msg_row)
@@ -4973,11 +4918,8 @@ xy2win(int x UNUSED, int y UNUSED)
update_mouseshape(SHAPE_IDX_STATUS);
else
update_mouseshape(-2);
-# endif
- return wp;
-#else
- return firstwin;
#endif
+ return wp;
}
/*
@@ -5412,7 +5354,6 @@ gui_do_findrepl(
|| defined(FEAT_GUI_MAC) \
|| defined(PROTO)
-#ifdef FEAT_WINDOWS
static void gui_wingoto_xy(int x, int y);
/*
@@ -5432,7 +5373,6 @@ gui_wingoto_xy(int x, int y)
win_goto(wp);
}
}
-#endif
/*
* Process file drop. Mouse cursor position, key modifiers, name of files
@@ -5495,9 +5435,7 @@ gui_handle_drop(
{
/* Go to the window under mouse cursor, then shorten given "fnames" by
* current window, because a window can have local current dir. */
-# ifdef FEAT_WINDOWS
gui_wingoto_xy(x, y);
-# endif
shorten_filenames(fnames, count);
/* If Shift held down, remember the first item. */